feat: change reducer stage

This commit is contained in:
shuaige.zsg 2020-05-15 17:46:26 +08:00
parent 17c6ed3e31
commit c2e83c7cdc
5 changed files with 6 additions and 17 deletions

View File

@ -108,6 +108,8 @@ hotkey.bind(['command+c', 'ctrl+c', 'command+x', 'ctrl+x'], (e, action) => {
const componentsMap = {};
const componentsTree = selected.map((item) => item.export(TransformStage.Save));
// FIXME: clear node.id
const data = { type: 'nodeSchema', componentsMap, componentsTree };
clipboard.setData(data);

View File

@ -483,7 +483,7 @@ export class DocumentModel {
// add toData
toData() {
const node = this.project?.currentDocument?.export(TransformStage.Serilize);
const node = this.project?.currentDocument?.export(TransformStage.Save);
return { componentsTree: [node] };
}

View File

@ -486,9 +486,9 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
componentName: this.componentName,
};
if (stage !== TransformStage.Save) {
// if (stage !== TransformStage.Save) {
baseSchema.id = this.id;
}
// }
if (this.isLeaf()) {
baseSchema.children = this.props.get('children')?.export(stage);

View File

@ -261,19 +261,6 @@ export function upgradePropConfig(config: OldPropConfig, collector: ConfigCollec
} else if (hidden != null || disabled != null) {
extraProps.condition = (field: Field) => !(isHidden(field) || isDisabled(field));
}
if (ignore != null || disabled != null) {
// FIXME! addFilter
extraProps.virtual = (field: Field) => {
if (isDisabled(field)) {
return true;
}
if (typeof ignore === 'function') {
return ignore.call(field, field.getValue()) === true;
}
return ignore === true;
};
}
if (type === 'group') {
newConfig.items = items ? upgradeConfigure(items, collector) : [];

View File

@ -58,7 +58,7 @@ function filterReducer(props: any, node: Node): any {
}
return props;
}
designer.addPropsReducer(filterReducer, TransformStage.Serilize);
designer.addPropsReducer(filterReducer, TransformStage.Save);
designer.addPropsReducer(filterReducer, TransformStage.Render);
function upgradePropsReducer(props: any) {