@houaoran/designer 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +98 -0
  3. package/dist/components.es.js +11424 -0
  4. package/dist/components.umd.js +878 -0
  5. package/dist/index.es.js +39113 -0
  6. package/dist/index.umd.js +1187 -0
  7. package/package.json +96 -0
  8. package/src/components/DragBox.vue +49 -0
  9. package/src/components/DragTool.vue +235 -0
  10. package/src/components/EventConfig.vue +557 -0
  11. package/src/components/FcDesigner.vue +2569 -0
  12. package/src/components/FcTitle.vue +69 -0
  13. package/src/components/FetchConfig.vue +415 -0
  14. package/src/components/FieldInput.vue +371 -0
  15. package/src/components/FnConfig.vue +315 -0
  16. package/src/components/FnEditor.vue +327 -0
  17. package/src/components/FnInput.vue +103 -0
  18. package/src/components/FormLabel.vue +47 -0
  19. package/src/components/HtmlEditor.vue +125 -0
  20. package/src/components/JsonPreview.vue +146 -0
  21. package/src/components/OptionsTextInput.vue +151 -0
  22. package/src/components/PropsInput.vue +72 -0
  23. package/src/components/Required.vue +75 -0
  24. package/src/components/Row.vue +26 -0
  25. package/src/components/SignaturePad.vue +176 -0
  26. package/src/components/Struct.vue +153 -0
  27. package/src/components/StructEditor.vue +121 -0
  28. package/src/components/StructTree.vue +209 -0
  29. package/src/components/TableOptions.vue +164 -0
  30. package/src/components/TreeOptions.vue +167 -0
  31. package/src/components/TypeSelect.vue +144 -0
  32. package/src/components/Validate.vue +302 -0
  33. package/src/components/ValueInput.vue +89 -0
  34. package/src/components/Warning.vue +46 -0
  35. package/src/components/ai/AiPanel.vue +1122 -0
  36. package/src/components/ai/MarkdownRenderer.vue +548 -0
  37. package/src/components/language/LanguageConfig.vue +174 -0
  38. package/src/components/language/LanguageInput.vue +191 -0
  39. package/src/components/style/BackgroundInput.vue +315 -0
  40. package/src/components/style/BorderInput.vue +242 -0
  41. package/src/components/style/BoxSizeInput.vue +166 -0
  42. package/src/components/style/BoxSpaceInput.vue +269 -0
  43. package/src/components/style/ColorInput.vue +90 -0
  44. package/src/components/style/ConfigItem.vue +118 -0
  45. package/src/components/style/FontInput.vue +197 -0
  46. package/src/components/style/PositionInput.vue +146 -0
  47. package/src/components/style/RadiusInput.vue +164 -0
  48. package/src/components/style/ShadowContent.vue +335 -0
  49. package/src/components/style/ShadowInput.vue +91 -0
  50. package/src/components/style/SizeInput.vue +118 -0
  51. package/src/components/style/StyleConfig.vue +307 -0
  52. package/src/components/table/Table.vue +252 -0
  53. package/src/components/table/TableView.vue +1058 -0
  54. package/src/components/tableForm/TableForm.vue +471 -0
  55. package/src/components/tableForm/TableFormColumnView.vue +103 -0
  56. package/src/components/tableForm/TableFormView.vue +46 -0
  57. package/src/components/tree/FcTree.vue +713 -0
  58. package/src/components/tree/FcTreeNode.vue +216 -0
  59. package/src/config/base/field.js +43 -0
  60. package/src/config/base/form.js +132 -0
  61. package/src/config/base/style.js +26 -0
  62. package/src/config/base/validate.js +15 -0
  63. package/src/config/index.js +70 -0
  64. package/src/config/menu.js +24 -0
  65. package/src/config/rule/alert.js +45 -0
  66. package/src/config/rule/button.js +49 -0
  67. package/src/config/rule/card.js +40 -0
  68. package/src/config/rule/cascader.js +121 -0
  69. package/src/config/rule/checkbox.js +68 -0
  70. package/src/config/rule/col.js +86 -0
  71. package/src/config/rule/collapse.js +30 -0
  72. package/src/config/rule/collapseItem.js +36 -0
  73. package/src/config/rule/color.js +53 -0
  74. package/src/config/rule/date.js +66 -0
  75. package/src/config/rule/dateRange.js +60 -0
  76. package/src/config/rule/divider.js +31 -0
  77. package/src/config/rule/editor.js +31 -0
  78. package/src/config/rule/group.js +86 -0
  79. package/src/config/rule/html.js +43 -0
  80. package/src/config/rule/image.js +32 -0
  81. package/src/config/rule/input.js +62 -0
  82. package/src/config/rule/number.js +49 -0
  83. package/src/config/rule/password.js +52 -0
  84. package/src/config/rule/radio.js +43 -0
  85. package/src/config/rule/rate.js +44 -0
  86. package/src/config/rule/row.js +46 -0
  87. package/src/config/rule/select.js +70 -0
  88. package/src/config/rule/signaturePad.js +59 -0
  89. package/src/config/rule/slider.js +53 -0
  90. package/src/config/rule/space.js +44 -0
  91. package/src/config/rule/subForm.js +47 -0
  92. package/src/config/rule/switch.js +46 -0
  93. package/src/config/rule/tabPane.js +29 -0
  94. package/src/config/rule/table.js +37 -0
  95. package/src/config/rule/tableForm.js +115 -0
  96. package/src/config/rule/tableFormColumn.js +55 -0
  97. package/src/config/rule/tabs.js +38 -0
  98. package/src/config/rule/tag.js +69 -0
  99. package/src/config/rule/text.js +41 -0
  100. package/src/config/rule/textarea.js +63 -0
  101. package/src/config/rule/time.js +58 -0
  102. package/src/config/rule/timeRange.js +49 -0
  103. package/src/config/rule/title.js +37 -0
  104. package/src/config/rule/transfer.js +59 -0
  105. package/src/config/rule/tree.js +70 -0
  106. package/src/config/rule/treeSelect.js +77 -0
  107. package/src/config/rule/upload.js +107 -0
  108. package/src/form/index.js +19 -0
  109. package/src/index.js +173 -0
  110. package/src/locale/en.js +981 -0
  111. package/src/locale/zh-cn.js +983 -0
  112. package/src/style/fonts/fc-icons.woff +0 -0
  113. package/src/style/icon.css +1052 -0
  114. package/src/style/index.css +836 -0
  115. package/src/utils/form.js +9 -0
  116. package/src/utils/highlight/highlight.min.js +307 -0
  117. package/src/utils/highlight/javascript.min.js +80 -0
  118. package/src/utils/highlight/style.css +1 -0
  119. package/src/utils/highlight/xml.min.js +29 -0
  120. package/src/utils/hintStubs.js +120 -0
  121. package/src/utils/index.js +544 -0
  122. package/src/utils/jsonDiff.js +173 -0
  123. package/src/utils/locale.js +23 -0
  124. package/src/utils/message.js +19 -0
  125. package/src/utils/template.js +105 -0
  126. package/types/index.d.ts +575 -0
@@ -0,0 +1,121 @@
1
+ import uniqueId from '@form-create/utils/lib/unique';
2
+ import {localeOptions, localeProps, makeTreeOptions, makeTreeOptionsRule} from '../../utils/index';
3
+
4
+ const label = '级联选择器';
5
+ const name = 'cascader';
6
+
7
+ export default {
8
+ menu: 'main',
9
+ icon: 'icon-cascader',
10
+ label,
11
+ name,
12
+ input: true,
13
+ event: ['change', 'expandChange', 'blur', 'focus', 'visibleChange', 'removeTag'],
14
+ validate: ['string', 'number', 'array'],
15
+ rule({t}) {
16
+ return {
17
+ type: name,
18
+ field: uniqueId(),
19
+ title: t('com.cascader.name'),
20
+ info: '',
21
+ effect: {
22
+ fetch: ''
23
+ },
24
+ $required: false,
25
+ props: {
26
+ options: makeTreeOptions(t('props.option'), {label: 'label', value: 'value'}, 3)
27
+ }
28
+ };
29
+ },
30
+ props(_, {t}) {
31
+ return localeProps(t, name + '.props', [
32
+ makeTreeOptionsRule(t, 'props.options'),
33
+ ...[
34
+
35
+ {
36
+ type: 'switch',
37
+ field: 'disabled'
38
+ },
39
+ {
40
+ type: 'switch',
41
+ field: 'clearable'
42
+ },
43
+ {
44
+ type: 'input',
45
+ field: 'placeholder'
46
+ },
47
+ {
48
+ type: 'Object',
49
+ field: 'props',
50
+ props: {
51
+ rule: localeProps(t, name + '.propsOpt', [{
52
+ type: 'switch',
53
+ field: 'multiple'
54
+ }, {
55
+ type: 'select',
56
+ field: 'expandTrigger',
57
+ options: localeOptions(t, [{label: 'click', value: 'click'}, {
58
+ label: 'hover',
59
+ value: 'hover'
60
+ }])
61
+ }, {
62
+ type: 'switch',
63
+ field: 'checkStrictly'
64
+ }, {
65
+ type: 'switch',
66
+ field: 'emitPath',
67
+ value: true
68
+ }, {
69
+ type: 'input',
70
+ field: 'value',
71
+ value: 'value'
72
+ }, {
73
+ type: 'input',
74
+ field: 'label',
75
+ value: 'label'
76
+ }, {
77
+ type: 'input',
78
+ field: 'children',
79
+ value: 'children'
80
+ }, {
81
+ type: 'input',
82
+ field: 'disabled',
83
+ value: 'disabled'
84
+ }, {type: 'input', field: 'leaf'}])
85
+ }
86
+ },
87
+ {
88
+ type: 'switch',
89
+ field: 'showAllLevels',
90
+ value: true
91
+ },
92
+ {
93
+ type: 'switch',
94
+ field: 'collapseTags'
95
+ },
96
+ {
97
+ type: 'switch',
98
+ field: 'collapseTagsTooltip'
99
+ },
100
+ {
101
+ type: 'input',
102
+ field: 'separator'
103
+ },
104
+ {
105
+ type: 'switch',
106
+ field: 'filterable'
107
+ },
108
+ {
109
+ type: 'select',
110
+ field: 'tagType',
111
+ options: [
112
+ {label: 'success', value: 'success'},
113
+ {label: 'info', value: 'info'},
114
+ {label: 'warning', value: 'warning'},
115
+ {label: 'danger', value: 'danger'},
116
+ ]
117
+ },
118
+ ]
119
+ ]);
120
+ }
121
+ };
@@ -0,0 +1,68 @@
1
+ import uniqueId from '@form-create/utils/lib/unique';
2
+ import {localeProps, makeOptionsRule, makeTreeOptions} from '../../utils/index';
3
+
4
+ const label = '多选框';
5
+ const name = 'checkbox';
6
+
7
+ export default {
8
+ menu: 'main',
9
+ icon: 'icon-checkbox',
10
+ label,
11
+ name,
12
+ input: true,
13
+ event: ['change'],
14
+ validate: ['array'],
15
+ rule({t}) {
16
+ return {
17
+ type: name,
18
+ field: uniqueId(),
19
+ title: t('com.checkbox.name'),
20
+ info: '',
21
+ effect: {
22
+ fetch: ''
23
+ },
24
+ $required: false,
25
+ props: {},
26
+ options: makeTreeOptions(t('props.option'), {label: 'label', value: 'value'}, 1)
27
+ };
28
+ },
29
+ props(_, {t}) {
30
+ return localeProps(t, name + '.props', [
31
+ makeOptionsRule(t, 'options'),
32
+ ...[
33
+ {
34
+ type: 'switch',
35
+ field: 'disabled'
36
+ },
37
+ {type: 'switch', field: 'input'},
38
+ {
39
+ type: 'switch',
40
+ field: 'type',
41
+ props: {activeValue: 'button', inactiveValue: 'default'}
42
+ },
43
+ {
44
+ field: 'min',
45
+ type: 'inputNumber',
46
+ props: {
47
+ min: 0
48
+ }
49
+ },
50
+ {
51
+ field: 'max',
52
+ type: 'inputNumber',
53
+ props: {
54
+ min: 0
55
+ }
56
+ },
57
+ {
58
+ type: 'ColorInput',
59
+ field: 'textColor'
60
+ },
61
+ {
62
+ type: 'ColorInput',
63
+ field: 'fill'
64
+ }
65
+ ]
66
+ ]);
67
+ }
68
+ };
@@ -0,0 +1,86 @@
1
+ import {localeProps} from '../../utils';
2
+
3
+ const name = 'col';
4
+
5
+ const devices = {
6
+ xs: '<768px',
7
+ sm: '≥768px',
8
+ md: '≥992px',
9
+ lg: '≥1200px',
10
+ xl: '≥1920px',
11
+ };
12
+
13
+ export default {
14
+ name,
15
+ label: '格子',
16
+ drag: true,
17
+ dragBtn: false,
18
+ inside: true,
19
+ mask: false,
20
+ rule() {
21
+ return {
22
+ type: name,
23
+ props: {span: 12},
24
+ children: []
25
+ };
26
+ },
27
+ props(_, {t}) {
28
+ return localeProps(t, name + '.props', [
29
+ {type: 'slider', field: 'span', value: 12, props: {min: 0, max: 24}},
30
+ {type: 'slider', field: 'offset', props: {min: 0, max: 24}},
31
+ {type: 'slider', field: 'push', props: {min: 0, max: 24}},
32
+ {type: 'slider', field: 'pull', props: {min: 0, max: 24}},
33
+ {
34
+ type: 'ConfigItem',
35
+ props: {
36
+ label: t('props.reactive')
37
+ },
38
+ children: [
39
+ {
40
+ type: 'elTabs',
41
+ style: {
42
+ width: '100%'
43
+ },
44
+ slot: 'append',
45
+ children: Object.keys(devices).map(k => {
46
+ return {
47
+ type: 'elTabPane',
48
+ props: {
49
+ label: devices[k]
50
+ },
51
+ style: 'padding:0 10px;',
52
+ children: [
53
+ {
54
+ type: 'slider',
55
+ field: k + '>span',
56
+ title: t('com.col.props.span'),
57
+ value: 12,
58
+ props: {min: 0, max: 24},
59
+ },
60
+ {
61
+ type: 'slider',
62
+ field: k + '>offset',
63
+ title: t('com.col.props.offset'),
64
+ props: {min: 0, max: 24},
65
+ },
66
+ {
67
+ type: 'slider',
68
+ field: k + '>push',
69
+ title: t('com.col.props.push'),
70
+ props: {min: 0, max: 24},
71
+ },
72
+ {
73
+ type: 'slider',
74
+ field: k + '>pull',
75
+ title: t('com.col.props.pull'),
76
+ props: {min: 0, max: 24},
77
+ }
78
+ ]
79
+ };
80
+ })
81
+ }
82
+ ]
83
+ },
84
+ ]);
85
+ }
86
+ };
@@ -0,0 +1,30 @@
1
+ import {localeProps} from '../../utils';
2
+
3
+ const label = '折叠面板';
4
+ const name = 'elCollapse';
5
+
6
+ export default {
7
+ menu: 'layout',
8
+ icon: 'icon-collapse',
9
+ label,
10
+ name,
11
+ mask: false,
12
+ children: 'elCollapseItem',
13
+ event: ['change'],
14
+ rule() {
15
+ return {
16
+ type: name,
17
+ props: {},
18
+ style: {
19
+ width: '100%',
20
+ },
21
+ children: []
22
+ };
23
+ },
24
+ props(_, {t}) {
25
+ return localeProps(t, name + '.props', [{
26
+ type: 'switch',
27
+ field: 'accordion'
28
+ }]);
29
+ }
30
+ };
@@ -0,0 +1,36 @@
1
+ import {localeProps} from '../../utils';
2
+
3
+ const label = '面板';
4
+ const name = 'elCollapseItem';
5
+
6
+ export default {
7
+ icon: 'icon-cell',
8
+ label,
9
+ name,
10
+ drag: true,
11
+ dragBtn: false,
12
+ inside: true,
13
+ mask: false,
14
+ rule({t}) {
15
+ return {
16
+ type: name,
17
+ props: {
18
+ title: t('com.elCollapseItem.name')
19
+ },
20
+ style: {},
21
+ children: []
22
+ };
23
+ },
24
+ props(_, {t}) {
25
+ return localeProps(t, name + '.props', [{
26
+ type: 'input',
27
+ field: 'title',
28
+ }, {
29
+ type: 'input',
30
+ field: 'name',
31
+ }, {
32
+ type: 'switch',
33
+ field: 'disabled'
34
+ }]);
35
+ }
36
+ };
@@ -0,0 +1,53 @@
1
+ import uniqueId from '@form-create/utils/lib/unique';
2
+ import {localeProps} from '../../utils';
3
+
4
+ const label = '颜色选择器';
5
+ const name = 'colorPicker';
6
+
7
+ export default {
8
+ menu: 'main',
9
+ icon: 'icon-color',
10
+ label,
11
+ name,
12
+ input: true,
13
+ event: ['change', 'activeChange', 'focus', 'blur'],
14
+ validate: ['string'],
15
+ rule({t}) {
16
+ return {
17
+ type: name,
18
+ field: uniqueId(),
19
+ title: t('com.colorPicker.name'),
20
+ info: '',
21
+ $required: false,
22
+ props: {},
23
+ };
24
+ },
25
+ props(_, {t}) {
26
+ return localeProps(t, name + '.props', [
27
+ {
28
+ type: 'switch',
29
+ field: 'disabled'
30
+ },
31
+ {
32
+ type: 'switch',
33
+ field: 'showAlpha'
34
+ },
35
+ {
36
+ type: 'select',
37
+ field: 'colorFormat',
38
+ options: [{label: 'hsl', value: 'hsl'}, {label: 'hsv', value: 'hsv'}, {
39
+ label: 'hex',
40
+ value: 'hex'
41
+ }, {label: 'rgb', value: 'rgb'}]
42
+ },
43
+ {
44
+ type: 'tableOptions',
45
+ field: 'predefine',
46
+ props: {
47
+ column: [{label: t('props.value'), key: 'value'}],
48
+ valueType: 'string'
49
+ }
50
+ },
51
+ ]);
52
+ }
53
+ };
@@ -0,0 +1,66 @@
1
+ import uniqueId from '@form-create/utils/lib/unique';
2
+ import {localeOptions, localeProps} from '../../utils';
3
+
4
+ const label = '日期';
5
+ const name = 'datePicker';
6
+
7
+ export default {
8
+ menu: 'main',
9
+ icon: 'icon-date',
10
+ label,
11
+ name,
12
+ input: true,
13
+ event: ['change', 'blur', 'focus', 'calendarChange', 'panelChange', 'visibleChange'],
14
+ rule({t}) {
15
+ return {
16
+ type: name,
17
+ field: uniqueId(),
18
+ title: t('com.datePicker.name'),
19
+ info: '',
20
+ $required: false,
21
+ props: {},
22
+ };
23
+ },
24
+ props(_, {t}) {
25
+ return localeProps(t, name + '.props', [{type: 'switch', field: 'readonly'}, {
26
+ type: 'switch',
27
+ field: 'disabled'
28
+ }, {
29
+ type: 'select',
30
+ field: 'type',
31
+ options: localeOptions(t, [{label: 'year', value: 'year'}, {label: 'month', value: 'month'}, {
32
+ label: 'date',
33
+ value: 'date'
34
+ }, {label: 'dates', value: 'dates'}, {label: 'week', value: 'week'}, {
35
+ label: 'datetime',
36
+ value: 'datetime'
37
+ }, {label: 'datetimerange', value: 'datetimerange'}, {
38
+ label: 'daterange',
39
+ value: 'daterange'
40
+ }, {label: 'monthrange', value: 'monthrange'}])
41
+ }, {
42
+ type: 'switch',
43
+ field: 'clearable',
44
+ value: true
45
+ }, {type: 'switch', field: 'editable', value: true}, {
46
+ type: 'input',
47
+ field: 'placeholder'
48
+ }, {
49
+ type: 'input',
50
+ field: 'startPlaceholder'
51
+ }, {type: 'input', field: 'endPlaceholder'}, {
52
+ type: 'input',
53
+ field: 'format'
54
+ }, {
55
+ type: 'select',
56
+ field: 'align',
57
+ options: localeOptions(t, [{label: 'left', value: 'left'}, {label: 'center', value: 'center'}, {
58
+ label: 'right',
59
+ value: 'right'
60
+ }])
61
+ }, {type: 'input', field: 'rangeSeparator'}, {
62
+ type: 'switch',
63
+ field: 'unlinkPanels'
64
+ }]);
65
+ }
66
+ };
@@ -0,0 +1,60 @@
1
+ import uniqueId from '@form-create/utils/lib/unique';
2
+ import {localeOptions, localeProps} from '../../utils';
3
+
4
+ const label = '日期区间';
5
+ const name = 'dateRange';
6
+
7
+ export default {
8
+ menu: 'main',
9
+ icon: 'icon-date-range',
10
+ label,
11
+ name,
12
+ input: true,
13
+ event: ['change', 'blur', 'focus', 'calendarChange', 'panelChange', 'visibleChange'],
14
+ rule({t}) {
15
+ return {
16
+ type: 'datePicker',
17
+ field: uniqueId(),
18
+ title: t('com.dateRange.name'),
19
+ info: '',
20
+ $required: false,
21
+ props: {
22
+ type: 'datetimerange',
23
+ },
24
+ };
25
+ },
26
+ props(_, {t}) {
27
+ return localeProps(t, 'datePicker.props', [{type: 'switch', field: 'readonly'}, {
28
+ type: 'switch',
29
+ field: 'disabled'
30
+ }, {
31
+ type: 'select',
32
+ field: 'type',
33
+ options: localeOptions(t, [
34
+ {label: 'datetimerange', value: 'datetimerange'},
35
+ {label: 'daterange', value: 'daterange'},
36
+ {label: 'monthrange', value: 'monthrange'}
37
+ ])
38
+ }, {
39
+ type: 'switch',
40
+ field: 'clearable',
41
+ value: true
42
+ }, {type: 'switch', field: 'editable', value: true}, {
43
+ type: 'input',
44
+ field: 'startPlaceholder'
45
+ }, {type: 'input', field: 'endPlaceholder'}, {
46
+ type: 'input',
47
+ field: 'format'
48
+ }, {
49
+ type: 'select',
50
+ field: 'align',
51
+ options: localeOptions(t, [{label: 'left', value: 'left'}, {label: 'center', value: 'center'}, {
52
+ label: 'right',
53
+ value: 'right'
54
+ }])
55
+ }, {type: 'input', field: 'rangeSeparator'}, {
56
+ type: 'switch',
57
+ field: 'unlinkPanels'
58
+ }]);
59
+ }
60
+ };
@@ -0,0 +1,31 @@
1
+ import {localeOptions, localeProps} from '../../utils';
2
+
3
+ const label = '分割线';
4
+ const name = 'elDivider';
5
+
6
+ export default {
7
+ menu: 'aide',
8
+ icon: 'icon-divider',
9
+ label,
10
+ name,
11
+ rule({t}) {
12
+ return {
13
+ type: name,
14
+ props: {},
15
+ children: [t('com.elDivider.name')],
16
+ };
17
+ },
18
+ props(_, {t}) {
19
+ return localeProps(t, name + '.props', [{
20
+ type: 'input',
21
+ field: 'formCreateChild',
22
+ }, {
23
+ type: 'select',
24
+ field: 'contentPosition',
25
+ options: localeOptions(t, [{label: 'left', value: 'left'}, {label: 'right', value: 'right'}, {
26
+ label: 'center',
27
+ value: 'center'
28
+ }])
29
+ }]);
30
+ }
31
+ };
@@ -0,0 +1,31 @@
1
+ import uniqueId from '@form-create/utils/lib/unique';
2
+ import {localeProps} from '../../utils';
3
+
4
+ const label = '富文本框';
5
+ const name = 'fcEditor';
6
+
7
+ export default {
8
+ menu: 'main',
9
+ icon: 'icon-editor',
10
+ label,
11
+ name,
12
+ input: true,
13
+ event: ['change'],
14
+ validate: ['string'],
15
+ rule({t}) {
16
+ return {
17
+ type: name,
18
+ field: uniqueId(),
19
+ title: t('com.fcEditor.name'),
20
+ info: '',
21
+ $required: false,
22
+ props: {},
23
+ };
24
+ },
25
+ props(_, {t}) {
26
+ return localeProps(t, name + '.props', [{
27
+ type: 'switch',
28
+ field: 'disabled'
29
+ }]);
30
+ }
31
+ };
@@ -0,0 +1,86 @@
1
+ import {getInjectArg, localeProps} from '../../utils';
2
+ import uniqueId from '@form-create/utils/lib/unique';
3
+
4
+ const label = '子表单';
5
+ const name = 'group';
6
+
7
+ export default {
8
+ menu: 'subform',
9
+ icon: 'icon-subform',
10
+ label,
11
+ name,
12
+ input: true,
13
+ inside: false,
14
+ drag: true,
15
+ dragBtn: true,
16
+ mask: false,
17
+ event: ['change'],
18
+ subForm: 'array',
19
+ loadRule(rule) {
20
+ rule.children = rule.props.rule || [];
21
+ rule.type = 'FcRow';
22
+ delete rule.props.rule;
23
+ },
24
+ parseRule(rule) {
25
+ rule.props.rule = rule.children;
26
+ rule.type = 'group';
27
+ delete rule.children;
28
+ delete rule.props.mode;
29
+ },
30
+ rule({t}) {
31
+ return {
32
+ type: 'fcRow',
33
+ field: uniqueId(),
34
+ title: t('com.group.name'),
35
+ info: '',
36
+ $required: false,
37
+ props: {
38
+ title: '第{index}页',
39
+ },
40
+ children: [],
41
+ };
42
+ },
43
+ props(_, {t}) {
44
+ return localeProps(t, name + '.props', [
45
+ {
46
+ type: 'select',
47
+ field: 'type',
48
+ options: [
49
+ {label: t('props.default'), value: 'default'},
50
+ {label: t('props.card'), value: 'card'},
51
+ ],
52
+ control: [
53
+ {
54
+ value: 'card',
55
+ rule: ['title'],
56
+ },
57
+ ],
58
+ },
59
+ {
60
+ type: 'input',
61
+ field: 'title',
62
+ },
63
+ {
64
+ type: 'switch',
65
+ field: 'disabled',
66
+ },
67
+ {type: 'switch', field: 'button', value: true},
68
+ {type: 'switch', field: 'sortBtn', value: true},
69
+ {type: 'inputNumber', field: 'expand'},
70
+ {type: 'inputNumber', field: 'min'},
71
+ {type: 'inputNumber', field: 'max'},
72
+ {
73
+ type: 'FnInput',
74
+ field: 'onBeforeRemove',
75
+ warning: t('com.group.info'),
76
+ props: {
77
+ body: true,
78
+ button: true,
79
+ fnx: true,
80
+ args: [getInjectArg(t)],
81
+ name: 'onBeforeRemove',
82
+ },
83
+ },
84
+ ]);
85
+ },
86
+ };