amis-editor 4.2.0-beta.2 → 5.1.9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/6dbcbb49b6fd405190a9.png +0 -0
- package/dist/component/Control/APIControl.d.ts +1101 -447
- package/dist/component/Control/ActionAPIControl.d.ts +1158 -0
- package/dist/component/Control/BadgeControl.d.ts +133 -0
- package/dist/component/Control/BaseControl.d.ts +248 -0
- package/dist/component/Control/DataBindingControl.d.ts +14 -0
- package/dist/component/Control/DataPickerControl.d.ts +13 -0
- package/dist/component/Control/DateShortCutControl.d.ts +83 -0
- package/dist/component/Control/FormulaControl.d.ts +51 -0
- package/dist/component/Control/OptionControl.d.ts +23 -34
- package/dist/component/Control/StatusControl.d.ts +39 -0
- package/dist/component/Control/SwitchMoreControl.d.ts +224 -0
- package/dist/component/Control/ValidationControl.d.ts +50 -15
- package/dist/component/Control/ValidationItem.d.ts +46 -0
- package/dist/component/Control/style-control/Background.d.ts +17 -0
- package/dist/component/Control/style-control/Border.d.ts +18 -0
- package/dist/component/Control/style-control/BoxModel.d.ts +17 -0
- package/dist/component/Control/style-control/BoxShadow.d.ts +18 -0
- package/dist/component/Control/style-control/Display.d.ts +14 -0
- package/dist/component/Control/style-control/Font.d.ts +16 -0
- package/dist/component/Control/style-control/font-family.d.ts +11 -0
- package/dist/component/Control/style-control/transformation.d.ts +29 -0
- package/dist/component/Control/style-control/types.d.ts +8 -0
- package/dist/component/Editor.d.ts +16 -0
- package/dist/component/RegionWrapper.d.ts +10 -0
- package/dist/component/VRenderer.d.ts +10 -0
- package/dist/component/schemaTpl.d.ts +8 -0
- package/dist/component/validator.d.ts +62 -0
- package/dist/dnd/index.d.ts +1 -1
- package/dist/event-action/action-config-panel.d.ts +8 -0
- package/dist/event-action/actions.d.ts +3 -0
- package/dist/event-action/comp-action-select.d.ts +11 -0
- package/dist/event-action/config.d.ts +13 -0
- package/dist/event-action/index.d.ts +459 -0
- package/dist/event-action/schema.d.ts +32 -0
- package/dist/exports.min.js +1 -1
- package/dist/index.d.ts +23 -5
- package/dist/index.min.js +1 -1
- package/dist/manager.d.ts +46 -1
- package/dist/plugin/Alert.d.ts +4 -2
- package/dist/plugin/Button.d.ts +5 -1
- package/dist/plugin/ButtonGroup.d.ts +13 -34
- package/dist/plugin/ButtonToolbar.d.ts +4 -10
- package/dist/plugin/CRUD.d.ts +2 -0
- package/dist/plugin/Chart.d.ts +2 -0
- package/dist/plugin/Collapse.d.ts +1 -0
- package/dist/plugin/CollapseGroup.d.ts +28 -4
- package/dist/plugin/Container.d.ts +2 -1
- package/dist/plugin/Dialog.d.ts +12 -2
- package/dist/plugin/Drawer.d.ts +12 -2
- package/dist/plugin/DropDownButton.d.ts +11 -11
- package/dist/plugin/Form/ButtonGroupSelect.d.ts +7 -2
- package/dist/plugin/Form/ButtonToolbar.d.ts +8 -7
- package/dist/plugin/Form/ChainedSelect.d.ts +3 -0
- package/dist/plugin/Form/Checkbox.d.ts +7 -2
- package/dist/plugin/Form/Checkboxes.d.ts +8 -2
- package/dist/plugin/Form/CodeEditor.d.ts +7 -22
- package/dist/plugin/Form/Combo.d.ts +3 -0
- package/dist/plugin/Form/Control.d.ts +6 -2
- package/dist/plugin/Form/DiffEditor.d.ts +7 -1
- package/dist/plugin/Form/Form.d.ts +6 -0
- package/dist/plugin/Form/Formula.d.ts +1 -25
- package/dist/plugin/Form/InputDate.d.ts +8 -2
- package/dist/plugin/Form/InputDateRange.d.ts +8 -2
- package/dist/plugin/Form/InputDateTime.d.ts +4 -4
- package/dist/plugin/Form/InputDateTimeRange.d.ts +4 -4
- package/dist/plugin/Form/InputEmail.d.ts +1 -0
- package/dist/plugin/Form/InputExcel.d.ts +6 -41
- package/dist/plugin/Form/InputFile.d.ts +7 -3
- package/dist/plugin/Form/InputKV.d.ts +6 -0
- package/dist/plugin/Form/InputMonth.d.ts +1 -0
- package/dist/plugin/Form/InputMonthRange.d.ts +4 -4
- package/dist/plugin/Form/InputPassword.d.ts +1 -0
- package/dist/plugin/Form/InputQuarter.d.ts +1 -0
- package/dist/plugin/Form/InputQuarterRange.d.ts +4 -4
- package/dist/plugin/Form/InputRange.d.ts +3 -0
- package/dist/plugin/Form/InputRating.d.ts +9 -3
- package/dist/plugin/Form/InputText.d.ts +24 -2
- package/dist/plugin/Form/InputTime.d.ts +3 -3
- package/dist/plugin/Form/InputTimeRange.d.ts +20 -0
- package/dist/plugin/Form/InputTree.d.ts +6 -2
- package/dist/plugin/Form/InputURL.d.ts +1 -0
- package/dist/plugin/Form/InputYear.d.ts +1 -0
- package/dist/plugin/Form/InputYearRange.d.ts +20 -0
- package/dist/plugin/Form/ListSelect.d.ts +6 -2
- package/dist/plugin/Form/LocationPicker.d.ts +1 -31
- package/dist/plugin/Form/NestedSelect.d.ts +5 -2
- package/dist/plugin/Form/Radios.d.ts +7 -2
- package/dist/plugin/Form/Select.d.ts +7 -2
- package/dist/plugin/Form/Switch.d.ts +7 -2
- package/dist/plugin/Form/TabsTransfer.d.ts +5 -2
- package/dist/plugin/Form/Textarea.d.ts +7 -1
- package/dist/plugin/Form/Transfer.d.ts +5 -2
- package/dist/plugin/Form/TreeSelect.d.ts +6 -2
- package/dist/plugin/IFrame.d.ts +2 -2
- package/dist/plugin/Nav.d.ts +1 -116
- package/dist/plugin/Others/Action.d.ts +5 -1
- package/dist/plugin/Page.d.ts +5 -2
- package/dist/plugin/Progress.d.ts +5 -1
- package/dist/plugin/Table.d.ts +2 -0
- package/dist/plugin/Tabs.d.ts +33 -2
- package/dist/plugin/TooltipWrapper.d.ts +10 -0
- package/dist/plugin/Tpl.d.ts +2 -1
- package/dist/plugin/Wizard.d.ts +4 -1
- package/dist/plugin.d.ts +37 -1
- package/dist/store/editor.d.ts +65 -38
- package/dist/store/node.d.ts +16 -0
- package/dist/style.css +1 -1
- package/dist/util.d.ts +36 -3
- package/package.json +14 -8
- package/src/component/schemaTpl.tsx +1198 -474
- package/src/plugin/.DS_Store +0 -0
- package/src/plugin/Alert.tsx +69 -48
- package/src/plugin/AnchorNav.tsx +1 -0
- package/src/plugin/Audio.tsx +9 -15
- package/src/plugin/Avatar.tsx +2 -1
- package/src/plugin/Breadcrumb.tsx +2 -1
- package/src/plugin/Button.tsx +257 -188
- package/src/plugin/ButtonGroup.tsx +99 -38
- package/src/plugin/ButtonToolbar.tsx +7 -13
- package/src/plugin/CRUD.tsx +77 -135
- package/src/plugin/Card.tsx +1 -0
- package/src/plugin/Cards.tsx +8 -14
- package/src/plugin/Carousel.tsx +1 -1
- package/src/plugin/Chart.tsx +26 -14
- package/src/plugin/Collapse.tsx +78 -78
- package/src/plugin/CollapseGroup.tsx +165 -83
- package/src/plugin/Container.tsx +59 -6
- package/src/plugin/Custom.tsx +2 -8
- package/src/plugin/CustomRegion.tsx +4 -3
- package/src/plugin/Dialog.tsx +55 -24
- package/src/plugin/Drawer.tsx +65 -35
- package/src/plugin/DropDownButton.tsx +95 -79
- package/src/plugin/Flex.tsx +123 -65
- package/src/plugin/Form/ButtonGroupSelect.tsx +114 -26
- package/src/plugin/Form/ButtonToolbar.tsx +62 -55
- package/src/plugin/Form/ChainedSelect.tsx +45 -0
- package/src/plugin/Form/Checkbox.tsx +122 -33
- package/src/plugin/Form/Checkboxes.tsx +154 -87
- package/src/plugin/Form/CodeEditor.tsx +163 -34
- package/src/plugin/Form/Combo.tsx +104 -65
- package/src/plugin/Form/Control.tsx +16 -70
- package/src/plugin/Form/DiffEditor.tsx +158 -54
- package/src/plugin/Form/FieldSet.tsx +6 -11
- package/src/plugin/Form/Form.tsx +277 -70
- package/src/plugin/Form/Formula.tsx +8 -14
- package/src/plugin/Form/InputArray.tsx +7 -16
- package/src/plugin/Form/InputCity.tsx +1 -1
- package/src/plugin/Form/InputDate.tsx +344 -121
- package/src/plugin/Form/InputDateRange.tsx +303 -161
- package/src/plugin/Form/InputDateTime.tsx +6 -150
- package/src/plugin/Form/InputDateTimeRange.tsx +7 -187
- package/src/plugin/Form/InputEmail.tsx +1 -0
- package/src/plugin/Form/InputExcel.tsx +70 -27
- package/src/plugin/Form/InputFile.tsx +326 -152
- package/src/plugin/Form/InputImage.tsx +1 -1
- package/src/plugin/Form/InputKV.tsx +61 -0
- package/src/plugin/Form/InputMonth.tsx +3 -1
- package/src/plugin/Form/InputMonthRange.tsx +6 -160
- package/src/plugin/Form/InputNumber.tsx +1 -1
- package/src/plugin/Form/InputPassword.tsx +2 -0
- package/src/plugin/Form/InputQuarter.tsx +3 -1
- package/src/plugin/Form/InputQuarterRange.tsx +6 -160
- package/src/plugin/Form/InputRange.tsx +74 -4
- package/src/plugin/Form/InputRating.tsx +347 -35
- package/src/plugin/Form/InputRichText.tsx +2 -3
- package/src/plugin/Form/InputTable.tsx +33 -49
- package/src/plugin/Form/InputTag.tsx +1 -1
- package/src/plugin/Form/InputText.tsx +310 -132
- package/src/plugin/Form/InputTime.tsx +4 -53
- package/src/plugin/Form/InputTimeRange.tsx +41 -0
- package/src/plugin/Form/InputTree.tsx +196 -46
- package/src/plugin/Form/InputURL.tsx +2 -0
- package/src/plugin/Form/InputYear.tsx +2 -0
- package/src/plugin/Form/InputYearRange.tsx +41 -0
- package/src/plugin/Form/Item.tsx +17 -18
- package/src/plugin/Form/ListSelect.tsx +75 -20
- package/src/plugin/Form/LocationPicker.tsx +2 -7
- package/src/plugin/Form/MatrixCheckboxes.tsx +1 -1
- package/src/plugin/Form/NestedSelect.tsx +110 -43
- package/src/plugin/Form/Picker.tsx +2 -5
- package/src/plugin/Form/Radios.tsx +122 -52
- package/src/plugin/Form/Select.tsx +239 -168
- package/src/plugin/Form/Static.tsx +1 -1
- package/src/plugin/Form/Switch.tsx +170 -58
- package/src/plugin/Form/TabsTransfer.tsx +175 -79
- package/src/plugin/Form/Textarea.tsx +146 -36
- package/src/plugin/Form/Transfer.tsx +295 -233
- package/src/plugin/Form/TreeSelect.tsx +287 -146
- package/src/plugin/Grid.tsx +340 -312
- package/src/plugin/HBox.tsx +1 -0
- package/src/plugin/IFrame.tsx +21 -12
- package/src/plugin/Image.tsx +7 -12
- package/src/plugin/Images.tsx +7 -12
- package/src/plugin/Link.tsx +6 -12
- package/src/plugin/List.tsx +6 -10
- package/src/plugin/ListItem.tsx +1 -0
- package/src/plugin/Nav.tsx +7 -9
- package/src/plugin/Others/Action.tsx +16 -10
- package/src/plugin/Others/BasicToolbar.tsx +4 -1
- package/src/plugin/Others/TableCell.tsx +19 -39
- package/src/plugin/Page.tsx +315 -229
- package/src/plugin/Panel.tsx +6 -7
- package/src/plugin/Plain.tsx +3 -6
- package/src/plugin/Progress.tsx +234 -94
- package/src/plugin/Service.tsx +10 -6
- package/src/plugin/Table.tsx +49 -20
- package/src/plugin/TableView.tsx +212 -106
- package/src/plugin/Tabs.tsx +306 -146
- package/src/plugin/TooltipWrapper.tsx +231 -135
- package/src/plugin/Tpl.tsx +68 -52
- package/src/plugin/Video.tsx +9 -20
- package/src/plugin/Wizard.tsx +537 -336
- package/src/plugin/Wrapper.tsx +82 -61
- package/src/plugin.ts +66 -4
- package/static/empty.png +0 -0
package/src/plugin/Collapse.tsx
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import {registerEditorPlugin} from '../manager';
|
2
2
|
import {BasePlugin, RegionConfig, BaseEventContext} from '../plugin';
|
3
3
|
import {defaultValue, getSchemaTpl} from '../component/schemaTpl';
|
4
|
+
import {tipedLabel} from '../component/control/BaseControl';
|
4
5
|
|
5
6
|
export class CollapsePlugin extends BasePlugin {
|
6
7
|
// 关联渲染器名字
|
@@ -28,99 +29,98 @@ export class CollapsePlugin extends BasePlugin {
|
|
28
29
|
previewSchema = {
|
29
30
|
...this.scaffold
|
30
31
|
};
|
31
|
-
|
32
32
|
panelTitle = '折叠器';
|
33
|
+
|
34
|
+
panelJustify = true;
|
35
|
+
|
33
36
|
panelBodyCreator = (context: BaseEventContext) => {
|
34
37
|
return getSchemaTpl('tabs', [
|
35
38
|
{
|
36
39
|
title: '属性',
|
37
|
-
body: [
|
38
|
-
{
|
39
|
-
name: 'header',
|
40
|
-
label: '标题',
|
41
|
-
type: 'input-text',
|
42
|
-
pipeIn: defaultValue(
|
43
|
-
context?.schema?.title || context?.schema?.header || ''
|
44
|
-
),
|
45
|
-
onChange: (value: any, oldValue: any, model: any, form: any) => {
|
46
|
-
// 转换一下旧版本的title字段
|
47
|
-
form.setValueByName('header', value);
|
48
|
-
form.setValueByName('title', undefined);
|
49
|
-
}
|
50
|
-
},
|
51
|
-
{
|
52
|
-
name: 'collapseHeader',
|
53
|
-
label: '展开标题',
|
54
|
-
type: 'input-text',
|
55
|
-
description: '折叠器处于展开状态时的标题'
|
56
|
-
},
|
40
|
+
body: getSchemaTpl('collapseGroup', [
|
57
41
|
{
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
42
|
+
title: '基本',
|
43
|
+
body: [
|
44
|
+
{
|
45
|
+
name: 'header',
|
46
|
+
label: '标题',
|
47
|
+
type: 'input-text',
|
48
|
+
pipeIn: defaultValue(
|
49
|
+
context?.schema?.title || context?.schema?.header || ''
|
50
|
+
),
|
51
|
+
onChange: (
|
52
|
+
value: any,
|
53
|
+
oldValue: any,
|
54
|
+
model: any,
|
55
|
+
form: any
|
56
|
+
) => {
|
57
|
+
// 转换一下旧版本的title字段
|
58
|
+
form.setValueByName('header', value);
|
59
|
+
form.setValueByName('title', undefined);
|
60
|
+
}
|
61
|
+
},
|
64
62
|
{
|
65
|
-
|
66
|
-
|
67
|
-
|
63
|
+
name: 'collapseHeader',
|
64
|
+
label: tipedLabel('展开标题', '折叠器处于展开状态时的标题'),
|
65
|
+
type: 'input-text'
|
68
66
|
},
|
69
67
|
{
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
68
|
+
name: 'headerPosition',
|
69
|
+
label: '标题位置',
|
70
|
+
type: 'button-group-select',
|
71
|
+
size: 'sm',
|
72
|
+
pipeIn: defaultValue('top'),
|
73
|
+
options: [
|
74
|
+
{
|
75
|
+
label: '顶部',
|
76
|
+
value: 'top',
|
77
|
+
icon: 'fa fa-arrow-up'
|
78
|
+
},
|
79
|
+
{
|
80
|
+
label: '底部',
|
81
|
+
value: 'bottom',
|
82
|
+
icon: 'fa fa-arrow-down'
|
83
|
+
}
|
84
|
+
]
|
85
|
+
},
|
86
|
+
{
|
87
|
+
name: 'showArrow',
|
88
|
+
label: '显示图标',
|
89
|
+
mode: 'row',
|
90
|
+
inputClassName: 'inline-flex justify-between flex-row-reverse',
|
91
|
+
type: 'switch',
|
92
|
+
pipeIn: defaultValue(true)
|
93
|
+
},
|
94
|
+
|
95
|
+
getSchemaTpl('switch', {
|
96
|
+
name: 'collapsable',
|
97
|
+
label: '可折叠',
|
98
|
+
pipeIn: defaultValue(true)
|
99
|
+
})
|
74
100
|
]
|
75
101
|
},
|
76
|
-
{
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
description: '折叠器key,主要用于设置默认展开状态'
|
81
|
-
},
|
82
|
-
{
|
83
|
-
name: 'showArrow',
|
84
|
-
label: '显示箭头',
|
85
|
-
mode: 'row',
|
86
|
-
inputClassName: 'inline-flex justify-between flex-row-reverse',
|
87
|
-
type: 'switch',
|
88
|
-
pipeIn: defaultValue(true)
|
89
|
-
},
|
90
|
-
{
|
91
|
-
name: 'collapsable',
|
92
|
-
type: 'switch',
|
93
|
-
mode: 'row',
|
94
|
-
inputClassName: 'inline-flex justify-between flex-row-reverse',
|
95
|
-
label: '可折叠',
|
96
|
-
pipeIn: defaultValue(true)
|
97
|
-
},
|
98
|
-
{
|
99
|
-
name: 'collapsed',
|
100
|
-
type: 'switch',
|
101
|
-
mode: 'row',
|
102
|
-
inputClassName: 'inline-flex justify-between flex-row-reverse',
|
103
|
-
label: '默认折叠'
|
104
|
-
}
|
105
|
-
]
|
102
|
+
getSchemaTpl('status', {
|
103
|
+
disabled: true
|
104
|
+
})
|
105
|
+
])
|
106
106
|
},
|
107
107
|
{
|
108
108
|
title: '外观',
|
109
|
-
body: [
|
110
|
-
getSchemaTpl('
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
109
|
+
body: getSchemaTpl('collapseGroup', [
|
110
|
+
getSchemaTpl('style:classNames', {
|
111
|
+
isFormItem: false,
|
112
|
+
schema: [
|
113
|
+
getSchemaTpl('className', {
|
114
|
+
name: 'headingClassName',
|
115
|
+
label: '标题类名'
|
116
|
+
}),
|
117
|
+
getSchemaTpl('className', {
|
118
|
+
name: 'bodyClassName',
|
119
|
+
label: '内容类名'
|
120
|
+
})
|
121
|
+
]
|
118
122
|
})
|
119
|
-
]
|
120
|
-
},
|
121
|
-
{
|
122
|
-
title: '状态',
|
123
|
-
body: [getSchemaTpl('disabled'), getSchemaTpl('visible')]
|
123
|
+
])
|
124
124
|
}
|
125
125
|
]);
|
126
126
|
};
|
@@ -1,13 +1,10 @@
|
|
1
1
|
import {registerEditorPlugin} from '../manager';
|
2
|
-
import {
|
3
|
-
BasePlugin,
|
4
|
-
RegionConfig,
|
5
|
-
RendererInfo,
|
6
|
-
BaseEventContext
|
7
|
-
} from '../plugin';
|
2
|
+
import {BasePlugin, RegionConfig, BaseEventContext} from '../plugin';
|
8
3
|
import {defaultValue, getSchemaTpl} from '../component/schemaTpl';
|
9
4
|
|
10
5
|
import type {CollapseSchema} from 'amis/lib/renderers/Collapse';
|
6
|
+
import {tipedLabel} from '../component/control/BaseControl';
|
7
|
+
import {isObject} from '../util';
|
11
8
|
|
12
9
|
export class CollapseGroupPlugin extends BasePlugin {
|
13
10
|
// 关联渲染器名字
|
@@ -28,6 +25,7 @@ export class CollapseGroupPlugin extends BasePlugin {
|
|
28
25
|
{
|
29
26
|
type: 'collapse',
|
30
27
|
key: '1',
|
28
|
+
active: true,
|
31
29
|
header: '标题1',
|
32
30
|
body: [
|
33
31
|
{
|
@@ -55,100 +53,184 @@ export class CollapseGroupPlugin extends BasePlugin {
|
|
55
53
|
...this.scaffold
|
56
54
|
};
|
57
55
|
|
56
|
+
activeKeyData: any = [];
|
58
57
|
panelTitle = '折叠面板';
|
59
|
-
panelBodyCreator = (context: BaseEventContext) => {
|
60
|
-
const collapseChildren: CollapseSchema[] = Array.isArray(
|
61
|
-
context?.schema?.body
|
62
|
-
)
|
63
|
-
? context?.schema?.body.filter(
|
64
|
-
(item: CollapseSchema) => item.type === 'collapse' && item.key != null
|
65
|
-
)
|
66
|
-
: [];
|
67
58
|
|
59
|
+
panelJustify = true;
|
60
|
+
|
61
|
+
panelBodyCreator = (context: BaseEventContext) => {
|
68
62
|
return [
|
69
63
|
getSchemaTpl('tabs', [
|
70
64
|
{
|
71
65
|
title: '属性',
|
72
|
-
body: [
|
66
|
+
body: getSchemaTpl('collapseGroup', [
|
73
67
|
{
|
74
|
-
|
75
|
-
|
76
|
-
type: 'input-tag',
|
77
|
-
clearable: true,
|
78
|
-
joinValues: false,
|
79
|
-
extractValue: true,
|
80
|
-
options: collapseChildren.map((item: CollapseSchema) => item.key)
|
81
|
-
},
|
82
|
-
{
|
83
|
-
name: 'expandIconPosition',
|
84
|
-
label: '图标位置',
|
85
|
-
type: 'button-group-select',
|
86
|
-
pipeIn: defaultValue('left'),
|
87
|
-
options: [
|
68
|
+
title: '基本',
|
69
|
+
body: [
|
88
70
|
{
|
89
|
-
|
90
|
-
|
91
|
-
|
71
|
+
name: 'expandIconPosition',
|
72
|
+
label: '图标位置',
|
73
|
+
type: 'button-group-select',
|
74
|
+
|
75
|
+
pipeIn: defaultValue('left'),
|
76
|
+
options: [
|
77
|
+
{
|
78
|
+
label: '左边',
|
79
|
+
value: 'left',
|
80
|
+
icon: 'fa fa-align-left'
|
81
|
+
},
|
82
|
+
{
|
83
|
+
label: '右边',
|
84
|
+
value: 'right',
|
85
|
+
icon: 'fa fa-align-right'
|
86
|
+
}
|
87
|
+
]
|
92
88
|
},
|
93
89
|
{
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
90
|
+
type: 'ae-switch-more',
|
91
|
+
label: '自定义图标',
|
92
|
+
bulk: true,
|
93
|
+
mode: 'normal',
|
94
|
+
value: false,
|
95
|
+
formType: 'extend',
|
96
|
+
autoFocus: false,
|
97
|
+
form: {
|
98
|
+
body: [
|
99
|
+
{
|
100
|
+
label: '图标',
|
101
|
+
name: 'expandIcon',
|
102
|
+
type: 'icon-picker',
|
103
|
+
className: 'fix-icon-picker-overflow',
|
104
|
+
pipeIn: (value: any) => value?.icon,
|
105
|
+
pipeOut: (value: any) => ({
|
106
|
+
type: 'icon',
|
107
|
+
vendor: '',
|
108
|
+
icon: value
|
109
|
+
})
|
110
|
+
}
|
111
|
+
]
|
112
|
+
},
|
113
|
+
pipeIn: (value: string) => {
|
114
|
+
if (typeof value === 'string' && value.length) {
|
115
|
+
return {
|
116
|
+
character: value
|
117
|
+
};
|
118
|
+
}
|
119
|
+
return undefined;
|
120
|
+
},
|
121
|
+
pipeOut: (value: any) => {
|
122
|
+
if (!isObject(value)) {
|
123
|
+
return undefined;
|
124
|
+
}
|
125
|
+
return typeof value.character === 'string'
|
126
|
+
? value.character
|
127
|
+
: undefined;
|
128
|
+
}
|
125
129
|
},
|
126
130
|
{
|
127
|
-
name: '
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
131
|
+
name: 'accordion',
|
132
|
+
label: tipedLabel(
|
133
|
+
'手风琴模式',
|
134
|
+
'手风琴模式,只允许单个面板展开'
|
135
|
+
),
|
136
|
+
mode: 'row',
|
137
|
+
inputClassName:
|
138
|
+
'inline-flex justify-between flex-row-reverse',
|
139
|
+
type: 'switch',
|
140
|
+
pipeIn: defaultValue(false)
|
141
|
+
},
|
142
|
+
getSchemaTpl('combo-container', {
|
143
|
+
name: 'body',
|
144
|
+
type: 'combo',
|
145
|
+
label: '面板管理',
|
146
|
+
mode: 'normal',
|
147
|
+
multiple: true,
|
148
|
+
addable: true,
|
149
|
+
columnClassName: 'w-20',
|
150
|
+
addButtonText: '新增折叠器',
|
151
|
+
minLength: 1,
|
152
|
+
draggable: true,
|
153
|
+
draggableTip: '',
|
154
|
+
placeholder: '请添加折叠器',
|
155
|
+
items: [
|
156
|
+
{
|
157
|
+
type: 'container',
|
158
|
+
columnClassName: 'flex-none',
|
159
|
+
body: tipedLabel(
|
160
|
+
[
|
161
|
+
{
|
162
|
+
name: 'active',
|
163
|
+
type: 'checkbox'
|
164
|
+
}
|
165
|
+
],
|
166
|
+
'默认展开此面板'
|
167
|
+
)
|
168
|
+
},
|
169
|
+
{
|
170
|
+
name: 'header',
|
171
|
+
placeholder: '标题',
|
172
|
+
type: 'input-text'
|
173
|
+
}
|
174
|
+
],
|
175
|
+
onChange: (
|
176
|
+
value: Array<any>,
|
177
|
+
oldValue: Array<any>,
|
178
|
+
model: any,
|
179
|
+
form: any
|
180
|
+
) => {
|
181
|
+
const activeKey = value.reduce((arr: any, item: any) => {
|
182
|
+
item.active === true && arr.push(item.key);
|
183
|
+
return arr;
|
184
|
+
}, []);
|
185
|
+
form.setValues({
|
186
|
+
activeKey
|
187
|
+
});
|
188
|
+
},
|
189
|
+
pipeOut: (value: any[], oldValue: any, data: any) => {
|
190
|
+
const keys = value.map(item => item.key);
|
191
|
+
const findMinCanUsedKey = (
|
192
|
+
keys: string[],
|
193
|
+
max: number
|
194
|
+
): void | string => {
|
195
|
+
for (let i = 1; i <= max; i++) {
|
196
|
+
if (!keys.includes(String(i))) {
|
197
|
+
return String(i);
|
198
|
+
}
|
199
|
+
}
|
200
|
+
};
|
201
|
+
value.forEach(item => {
|
202
|
+
if (!item.key) {
|
203
|
+
const key = findMinCanUsedKey(keys, value.length);
|
204
|
+
item.key = key;
|
205
|
+
item.header = `标题${key}`;
|
206
|
+
}
|
207
|
+
});
|
208
|
+
return value;
|
209
|
+
},
|
210
|
+
scaffold: {
|
211
|
+
type: 'collapse',
|
212
|
+
header: '标题',
|
213
|
+
body: [
|
214
|
+
{
|
215
|
+
type: 'tpl',
|
216
|
+
tpl: '内容',
|
217
|
+
inline: false
|
218
|
+
}
|
219
|
+
],
|
220
|
+
key: ''
|
142
221
|
}
|
143
|
-
|
144
|
-
|
145
|
-
}
|
222
|
+
})
|
223
|
+
]
|
146
224
|
}
|
147
|
-
]
|
225
|
+
])
|
148
226
|
},
|
149
227
|
{
|
150
228
|
title: '外观',
|
151
|
-
body:
|
229
|
+
body: getSchemaTpl('collapseGroup', [
|
230
|
+
getSchemaTpl('style:classNames', {
|
231
|
+
isFormItem: false
|
232
|
+
})
|
233
|
+
])
|
152
234
|
}
|
153
235
|
])
|
154
236
|
];
|
package/src/plugin/Container.tsx
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
import {registerEditorPlugin} from '../manager';
|
2
|
-
import {
|
3
|
-
|
4
|
-
BasePlugin,
|
5
|
-
RegionConfig} from '../plugin';
|
6
|
-
import {getSchemaTpl} from '../component/schemaTpl';
|
2
|
+
import {BaseEventContext, BasePlugin, RegionConfig} from '../plugin';
|
3
|
+
import {defaultValue, getSchemaTpl} from '../component/schemaTpl';
|
7
4
|
|
8
5
|
export class ContainerPlugin extends BasePlugin {
|
9
6
|
// 关联渲染器名字
|
@@ -32,8 +29,64 @@ export class ContainerPlugin extends BasePlugin {
|
|
32
29
|
];
|
33
30
|
|
34
31
|
panelTitle = '容器';
|
32
|
+
|
33
|
+
panelJustify = true;
|
34
|
+
|
35
35
|
panelBodyCreator = (context: BaseEventContext) => {
|
36
|
-
return
|
36
|
+
return getSchemaTpl('tabs', [
|
37
|
+
{
|
38
|
+
title: '属性',
|
39
|
+
body: getSchemaTpl('collapseGroup', [
|
40
|
+
{
|
41
|
+
title: '常用',
|
42
|
+
body: [
|
43
|
+
{
|
44
|
+
name: 'wrapperComponent',
|
45
|
+
label: '容器标签',
|
46
|
+
type: 'input-text',
|
47
|
+
options: [
|
48
|
+
'article',
|
49
|
+
'aside',
|
50
|
+
'code',
|
51
|
+
'div',
|
52
|
+
'footer',
|
53
|
+
'header',
|
54
|
+
'p',
|
55
|
+
'section'
|
56
|
+
],
|
57
|
+
pipeIn: defaultValue('div'),
|
58
|
+
validations: {
|
59
|
+
isAlphanumeric: true,
|
60
|
+
matchRegexp: '/^(?!.*script).*$/' // 禁用一下script标签
|
61
|
+
},
|
62
|
+
validationErrors: {
|
63
|
+
isAlpha: 'HTML标签不合法,请重新输入',
|
64
|
+
matchRegexp: 'HTML标签不合法,请重新输入'
|
65
|
+
},
|
66
|
+
validateOnChange: false
|
67
|
+
}
|
68
|
+
]
|
69
|
+
}
|
70
|
+
])
|
71
|
+
},
|
72
|
+
{
|
73
|
+
title: '外观',
|
74
|
+
className: 'p-none',
|
75
|
+
body: getSchemaTpl('collapseGroup', [
|
76
|
+
...getSchemaTpl('style:common'),
|
77
|
+
{
|
78
|
+
title: 'CSS 类名',
|
79
|
+
body: [
|
80
|
+
getSchemaTpl('className', {label: '外层CSS类名'}),
|
81
|
+
getSchemaTpl('className', {
|
82
|
+
name: 'bodyClassName',
|
83
|
+
label: '内容区CSS类名'
|
84
|
+
})
|
85
|
+
]
|
86
|
+
}
|
87
|
+
])
|
88
|
+
}
|
89
|
+
]);
|
37
90
|
};
|
38
91
|
}
|
39
92
|
|
package/src/plugin/Custom.tsx
CHANGED
@@ -2,20 +2,14 @@
|
|
2
2
|
* @file 自定义代码
|
3
3
|
*/
|
4
4
|
|
5
|
-
import React from 'react';
|
6
5
|
import {registerEditorPlugin} from '../manager';
|
7
6
|
import {
|
8
7
|
BasePlugin,
|
9
8
|
BasicSubRenderInfo,
|
10
|
-
BaseEventContext,
|
11
9
|
RendererEventContext,
|
12
|
-
SubRendererInfo
|
13
|
-
BasicRendererInfo,
|
14
|
-
RendererInfoResolveEventContext,
|
15
|
-
PluginInterface
|
10
|
+
SubRendererInfo
|
16
11
|
} from '../plugin';
|
17
|
-
import {
|
18
|
-
import {isArray} from 'lodash';
|
12
|
+
import {getSchemaTpl} from '../component/schemaTpl';
|
19
13
|
|
20
14
|
export class CustomPlugin extends BasePlugin {
|
21
15
|
// 关联渲染器名字
|
@@ -9,10 +9,10 @@ import {
|
|
9
9
|
BasicRendererInfo,
|
10
10
|
RendererInfoResolveEventContext,
|
11
11
|
PluginInterface,
|
12
|
-
RegionConfig
|
12
|
+
RegionConfig
|
13
13
|
} from '../plugin';
|
14
14
|
import {defaultValue, getSchemaTpl} from '../component/schemaTpl';
|
15
|
-
import
|
15
|
+
import isArray from 'lodash/isArray';
|
16
16
|
|
17
17
|
export class CustomPlugin extends BasePlugin {
|
18
18
|
// 关联渲染器名字
|
@@ -30,7 +30,8 @@ export class CustomPlugin extends BasePlugin {
|
|
30
30
|
icon = 'fa fa-gears';
|
31
31
|
scaffold = {
|
32
32
|
type: 'custom',
|
33
|
-
html:
|
33
|
+
html:
|
34
|
+
'<div>\n<h2>hello, world!</h2>\n<div id="customBox">自定义容器区域</div>\n</div>',
|
34
35
|
onMount: `this.renderChild('body', props.body, document.getElementById('customBox'));`,
|
35
36
|
body: [
|
36
37
|
{
|