feat(editor): props-service支持通过fill-config设置label-width

This commit is contained in:
roymondchen 2024-03-04 14:18:21 +08:00
parent 0e314ef5ad
commit 0315389ce9
3 changed files with 6 additions and 9 deletions

View File

@ -103,7 +103,7 @@ const doAsyncAction = async (
* *
* Class EditorService extends BaseService { * Class EditorService extends BaseService {
* constructor() { * constructor() {
* super(['add']); * super([ { name: 'add', isAsync: true },]);
* } * }
* add(value) { return result; } * add(value) { return result; }
* }; * };
@ -131,7 +131,7 @@ const doAsyncAction = async (
* *
* Class EditorService extends BaseService { * Class EditorService extends BaseService {
* constructor() { * constructor() {
* super(['add']); * super([ { name: 'add', isAsync: true },]);
* } * }
* add(value) { return result; } * add(value) { return result; }
* }; * };

View File

@ -58,8 +58,8 @@ class Props extends BaseService {
this.emit('props-configs-change'); this.emit('props-configs-change');
} }
public async fillConfig(config: FormConfig) { public async fillConfig(config: FormConfig, labelWidth?: string) {
return fillConfig(config); return fillConfig(config, typeof labelWidth !== 'function' ? labelWidth : '80px');
} }
/** /**

View File

@ -41,7 +41,6 @@ const numberOptions = [
export const styleTabConfig: TabPaneConfig = { export const styleTabConfig: TabPaneConfig = {
title: '样式', title: '样式',
labelWidth: '80px',
items: [ items: [
{ {
name: 'style', name: 'style',
@ -219,13 +218,11 @@ export const advancedTabConfig: TabPaneConfig = {
{ {
name: 'created', name: 'created',
text: 'created', text: 'created',
labelWidth: '100px',
type: 'code-select', type: 'code-select',
}, },
{ {
name: 'mounted', name: 'mounted',
text: 'mounted', text: 'mounted',
labelWidth: '100px',
type: 'code-select', type: 'code-select',
}, },
], ],
@ -331,13 +328,13 @@ export const displayTabConfig: TabPaneConfig = {
* @param config * @param config
* @returns Object * @returns Object
*/ */
export const fillConfig = (config: FormConfig = []) => [ export const fillConfig = (config: FormConfig = [], labelWidth = '80px') => [
{ {
type: 'tab', type: 'tab',
labelWidth,
items: [ items: [
{ {
title: '属性', title: '属性',
labelWidth: '80px',
items: [ items: [
// 组件类型,必须要有 // 组件类型,必须要有
{ {