diff --git a/packages/editor/src/services/props.ts b/packages/editor/src/services/props.ts index 3da07905..664640f0 100644 --- a/packages/editor/src/services/props.ts +++ b/packages/editor/src/services/props.ts @@ -93,6 +93,10 @@ class Props extends BaseService { this.emit('props-configs-change'); } + public getPropsConfigs(): Record { + return this.state.propsConfigMap; + } + public async fillConfig(config: FormConfig, labelWidth?: string) { return fillConfig(config, { labelWidth: typeof labelWidth !== 'function' ? labelWidth : '80px', @@ -125,12 +129,20 @@ class Props extends BaseService { return cloneDeep(this.state.propsConfigMap[toLine(type)] || (await this.fillConfig([]))); } + public hasPropsConfig(type: string): boolean { + return !!this.state.propsConfigMap[toLine(type)]; + } + public setPropsValues(values: Record | PropsFormValueFunction>) { Object.keys(values).forEach((type: string) => { this.setPropsValue(toLine(type), values[type]); }); } + public getPropsValues(): Record> { + return this.state.propsValueMap; + } + /** * 为指点类型组件设置组件初始值 * @param type 组件类型 @@ -178,6 +190,10 @@ class Props extends BaseService { }; } + public hasPropsValue(type: string): boolean { + return !!this.state.propsValueMap[toLine(type)]; + } + public createId(type: string | number): string { return `${type}_${guid()}`; }