@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,216 @@
1
+ <template>
2
+ <li
3
+ class="_fd-tree-node"
4
+ :class="nodeClass"
5
+ role="treeitem"
6
+ :aria-expanded="hasChildren ? String(expanded) : undefined"
7
+ :data-key="String(itemKey)"
8
+ >
9
+ <div
10
+ class="_fd-tree-node__content"
11
+ :class="contentClass"
12
+ :style="{ paddingLeft: padLeft }"
13
+ :data-key="String(itemKey)"
14
+ @click="onSelect"
15
+ >
16
+ <span v-if="showBeforeLine" class="_fd-tree-node__drop-line is-before"></span>
17
+ <span class="_fd-tree-node__expand" :class="hasChildren ? '' : 'is-leaf'" @click="onToggle">
18
+ <i v-if="hasChildren" class="fc-icon icon-caret-right" :class="{ down: expanded }"></i>
19
+ <span v-else class="_fd-tree-node__expand-placeholder"></span>
20
+ </span>
21
+ <div class="_fd-tree-node__label">
22
+ <slot :node="nodeCtx" :data="item" />
23
+ </div>
24
+ <span v-if="showAfterLine" class="_fd-tree-node__drop-line is-after"></span>
25
+ </div>
26
+ <ul
27
+ v-if="expanded"
28
+ class="_fd-tree-node__children"
29
+ role="group"
30
+ :data-parent-key="String(itemKey)"
31
+ :style="{ marginLeft: indent + 'px' }"
32
+ >
33
+ <FcTreeNode
34
+ v-for="child in children"
35
+ :key="getKey(child)"
36
+ :item="child"
37
+ :level="level + 1"
38
+ :indent="indent"
39
+ :expanded-keys="expandedKeys"
40
+ :get-key="getKey"
41
+ :get-children="getChildren"
42
+ :drag-state="dragState"
43
+ @toggle="$emit('toggle', $event)"
44
+ @select="$emit('select', $event)"
45
+ >
46
+ <template #default="scope">
47
+ <slot v-bind="scope" />
48
+ </template>
49
+ </FcTreeNode>
50
+ </ul>
51
+ </li>
52
+ </template>
53
+
54
+ <script>
55
+ export default {
56
+ name: 'FcTreeNode',
57
+ props: {
58
+ item: { type: Object, required: true },
59
+ level: { type: Number, required: true },
60
+ indent: { type: Number, required: true },
61
+ expandedKeys: { type: Object, required: true }, // Set
62
+ getKey: { type: Function, required: true },
63
+ getChildren: { type: Function, required: true },
64
+ dragState: {
65
+ type: Object,
66
+ default: () => ({}),
67
+ },
68
+ },
69
+ emits: ['toggle', 'select'],
70
+ computed: {
71
+ itemKey() {
72
+ return this.getKey(this.item);
73
+ },
74
+ children() {
75
+ const v = this.getChildren(this.item);
76
+ return Array.isArray(v) ? v : [];
77
+ },
78
+ hasChildren() {
79
+ return this.children.length > 0;
80
+ },
81
+ expanded() {
82
+ return !!this.expandedKeys?.has?.(this.itemKey);
83
+ },
84
+ padLeft() {
85
+ return `${(this.level - 1) * this.indent}px`;
86
+ },
87
+ nodeCtx() {
88
+ return {
89
+ level: this.level,
90
+ expanded: this.expanded,
91
+ isLeaf: !this.hasChildren,
92
+ };
93
+ },
94
+ isDragSource() {
95
+ return this.dragState?.draggingKey === String(this.itemKey);
96
+ },
97
+ isHoverTarget() {
98
+ return this.dragState?.hoverKey === String(this.itemKey);
99
+ },
100
+ showBeforeLine() {
101
+ return this.isHoverTarget && this.dragState?.dropType === 'before' && this.dragState?.allowed !== false;
102
+ },
103
+ showAfterLine() {
104
+ return this.isHoverTarget && this.dragState?.dropType === 'after' && this.dragState?.allowed !== false;
105
+ },
106
+ contentClass() {
107
+ return {
108
+ 'is-drop-inner': this.isHoverTarget && this.dragState?.dropType === 'inner' && this.dragState?.allowed !== false,
109
+ };
110
+ },
111
+ nodeClass() {
112
+ return {
113
+ 'is-drag-source': this.isDragSource,
114
+ };
115
+ },
116
+ },
117
+ methods: {
118
+ onToggle(e) {
119
+ e?.stopPropagation?.();
120
+ this.$emit('toggle', this.item);
121
+ },
122
+ onSelect() {
123
+ this.$emit('select', this.item);
124
+ },
125
+ },
126
+ };
127
+ </script>
128
+
129
+ <style scoped>
130
+ ._fd-tree-node__content {
131
+ display: flex;
132
+ align-items: center;
133
+ position: relative;
134
+ }
135
+
136
+ ._fd-tree-node__label {
137
+ width: 100%;
138
+ min-width: 0;
139
+ cursor: pointer;
140
+ font-size: 14px;
141
+ min-height: 30px;
142
+ user-select: none;
143
+ }
144
+
145
+ ._fd-tree-node__children {
146
+ list-style: none;
147
+ padding: 0;
148
+ margin: 0;
149
+ min-height: 8px; /* 空子级也能拖入(由使用方决定是否创建空 children) */
150
+ padding-bottom: 2px;
151
+ box-sizing: border-box;
152
+ }
153
+
154
+ ._fd-tree-node__expand {
155
+ display: inline-flex;
156
+ align-items: center;
157
+ justify-content: center;
158
+ width: 16px;
159
+ height: 16px;
160
+ margin-right: 2px;
161
+ cursor: pointer;
162
+ color: #262626;
163
+ flex: 0 0 auto;
164
+ }
165
+
166
+ ._fd-tree-node__expand.is-leaf {
167
+ cursor: default;
168
+ }
169
+
170
+ ._fd-tree-node__expand-placeholder {
171
+ display: inline-block;
172
+ width: 12px;
173
+ height: 12px;
174
+ }
175
+
176
+ ._fd-tree-node__expand .icon-caret-right {
177
+ display: inline-block;
178
+ transition: transform 0.15s ease;
179
+ }
180
+
181
+ ._fd-tree-node__expand .icon-caret-right.down {
182
+ transform: rotate(90deg);
183
+ }
184
+
185
+ ._fd-tree-node.is-drag-source > ._fd-tree-node__content {
186
+ opacity: 0.45;
187
+ }
188
+
189
+ ._fd-tree-node__content.is-drop-inner {
190
+ background: rgba(46, 115, 255, 0.05);
191
+ border-radius: 4px;
192
+ }
193
+
194
+ ._fd-tree-node__content:hover {
195
+ background-color: rgba(46, 115, 255, 0.05);
196
+ color: #2e73ff !important;
197
+ }
198
+
199
+ ._fd-tree-node__drop-line {
200
+ position: absolute;
201
+ left: 18px;
202
+ right: 0;
203
+ height: 2px;
204
+ background: rgba(46, 115, 255, 0.5);
205
+ pointer-events: none;
206
+ border-radius: 1px;
207
+ }
208
+
209
+ ._fd-tree-node__drop-line.is-before {
210
+ top: -1px;
211
+ }
212
+
213
+ ._fd-tree-node__drop-line.is-after {
214
+ bottom: -1px;
215
+ }
216
+ </style>
@@ -0,0 +1,43 @@
1
+ export default function field({t}) {
2
+ return [
3
+ {
4
+ type: 'FieldInput',
5
+ field: 'field',
6
+ value: '',
7
+ title: t('form.field'),
8
+ warning: t('warning.field'),
9
+ }, {
10
+ type: 'LanguageInput',
11
+ field: 'title',
12
+ value: '',
13
+ title: t('form.title'),
14
+ }, {
15
+ type: 'LanguageInput',
16
+ field: 'info',
17
+ value: '',
18
+ title: t('form.info'),
19
+ }, {
20
+ type: 'SizeInput',
21
+ field: 'formCreateWrap>labelWidth',
22
+ value: '',
23
+ title: t('form.labelWidth'),
24
+ }, {
25
+ type: 'Struct',
26
+ field: '_control',
27
+ name: 'control',
28
+ value: [],
29
+ title: t('form.control'),
30
+ warning: t('form.controlDocument', {doc: '<a target="_blank" href="https://view.form-create.com/control" style="color: inherit;text-decoration: underline;">' + t('form.document') + '</a>'}),
31
+ props: {
32
+ placeholder: '[{ value: "value", rule: ["field1", "field2"] }]',
33
+ validate(val) {
34
+ if (!Array.isArray(val)) return false;
35
+ if (!val.length) return true;
36
+ return !val.some(({rule}) => {
37
+ return !Array.isArray(rule);
38
+ });
39
+ }
40
+ }
41
+ },
42
+ ];
43
+ }
@@ -0,0 +1,132 @@
1
+ import {localeOptions} from '../../utils';
2
+
3
+ export default function form({t}) {
4
+ return [
5
+ {
6
+ type: 'input',
7
+ field: 'formCreateFormName',
8
+ value: '',
9
+ title: t('form.formName'),
10
+ }, {
11
+ type: 'input',
12
+ field: 'class',
13
+ value: '',
14
+ title: 'Class',
15
+ }, {
16
+ type: 'radio',
17
+ field: 'labelPosition',
18
+ value: 'left',
19
+ title: t('form.labelPosition'),
20
+ options: localeOptions(t, [
21
+ {value: 'left', label: 'left'},
22
+ {value: 'right', label: 'right'},
23
+ {value: 'top', label: 'top'},
24
+ ])
25
+ }, {
26
+ type: 'radio',
27
+ field: 'size',
28
+ value: 'small',
29
+ title: t('form.size'),
30
+ options: localeOptions(t, [
31
+ {value: 'large', label: 'large'},
32
+ {value: 'default', label: 'default'},
33
+ {value: 'small', label: 'small'},
34
+ ])
35
+ }, {
36
+ type: 'input',
37
+ field: 'labelSuffix',
38
+ value: '',
39
+ title: t('form.labelSuffix'),
40
+ style: {
41
+ width: '150px'
42
+ }
43
+ }, {
44
+ type: 'SizeInput',
45
+ field: 'labelWidth',
46
+ value: '125px',
47
+ title: t('form.labelWidth'),
48
+ }, {
49
+ type: 'switch',
50
+ field: 'hideRequiredAsterisk',
51
+ value: false,
52
+ title: t('form.hideRequiredAsterisk'),
53
+ }, {
54
+ type: 'switch',
55
+ field: 'showMessage',
56
+ value: true,
57
+ title: t('form.showMessage'),
58
+ }, {
59
+ type: 'switch',
60
+ field: 'inlineMessage',
61
+ value: false,
62
+ title: t('form.inlineMessage'),
63
+ }, {
64
+ type: 'switch',
65
+ field: '_submitBtn>show',
66
+ value: true,
67
+ title: t('form.submitBtn'),
68
+ }, {
69
+ type: 'switch',
70
+ field: '_resetBtn>show',
71
+ value: false,
72
+ title: t('form.resetBtn'),
73
+ }, {
74
+ type: 'FnConfig',
75
+ field: 'formCreate_event',
76
+ name: 'event',
77
+ warning: t('form.controlDocument', {doc: '<a target="_blank" href="https://form-create.com/v3/guide/global-event" style="color: inherit;text-decoration: underline;">' + t('form.document') + '</a>'}),
78
+ value: {},
79
+ col: {show: true},
80
+ props: {
81
+ eventConfig: [
82
+ {
83
+ name: 'onSubmit',
84
+ info: t('form.onSubmit'),
85
+ args: ['formData', 'api'],
86
+ },
87
+ {
88
+ name: 'onReset',
89
+ info: t('form.onReset'),
90
+ args: ['api'],
91
+ },
92
+ {
93
+ name: 'onCreated',
94
+ info: t('form.onCreated'),
95
+ args: ['api'],
96
+ },
97
+ {
98
+ name: 'onMounted',
99
+ info: t('form.onMounted'),
100
+ args: ['api'],
101
+ },
102
+ {
103
+ name: 'onBeforeUnmount',
104
+ info: t('form.onBeforeUnmount'),
105
+ args: ['api'],
106
+ },
107
+ {
108
+ name: 'onReload',
109
+ info: t('form.onReload'),
110
+ args: ['api'],
111
+ },
112
+ {
113
+ name: 'onChange',
114
+ info: t('form.onChange'),
115
+ args: ['field', 'value', 'options'],
116
+ },
117
+ {
118
+ name: 'beforeSubmit',
119
+ info: t('form.beforeSubmit'),
120
+ args: ['formData', 'data'],
121
+ },
122
+ {
123
+ name: 'beforeFetch',
124
+ info: t('form.beforeFetch'),
125
+ args: ['config', 'data'],
126
+ },
127
+ ]
128
+ },
129
+ title: t('form.event'),
130
+ },
131
+ ];
132
+ }
@@ -0,0 +1,26 @@
1
+ export default function field({t}) {
2
+ return [
3
+ {
4
+ type: 'input',
5
+ title: 'ID',
6
+ field: 'id',
7
+ wrap: {
8
+ labelWidth: '45px'
9
+ }
10
+ },
11
+ {
12
+ type: 'input',
13
+ title: 'Class',
14
+ field: 'class',
15
+ wrap: {
16
+ labelWidth: '45px'
17
+ }
18
+ },
19
+ {
20
+ type: 'StyleConfig',
21
+ field: 'style',
22
+ title: '',
23
+ value: {},
24
+ }
25
+ ];
26
+ }
@@ -0,0 +1,15 @@
1
+ export default function validate({t}) {
2
+ return [
3
+ {
4
+ type: 'Required',
5
+ field: '$required',
6
+ title: t('validate.required')
7
+ },
8
+ {
9
+ type: 'validate',
10
+ field: 'validate',
11
+ title: t('validate.rule'),
12
+ value: []
13
+ },
14
+ ];
15
+ }
@@ -0,0 +1,70 @@
1
+ import radio from './rule/radio';
2
+ import checkbox from './rule/checkbox';
3
+ import input from './rule/input';
4
+ import textarea from './rule/textarea';
5
+ import password from './rule/password';
6
+ import number from './rule/number';
7
+ import select from './rule/select';
8
+ import _switch from './rule/switch';
9
+ import slider from './rule/slider';
10
+ import time from './rule/time';
11
+ import timeRange from './rule/timeRange';
12
+ import date from './rule/date';
13
+ import dateRange from './rule/dateRange';
14
+ import rate from './rule/rate';
15
+ import color from './rule/color';
16
+ import row from './rule/row';
17
+ import col from './rule/col';
18
+ import tabPane from './rule/tabPane';
19
+ import divider from './rule/divider';
20
+ import cascader from './rule/cascader';
21
+ import upload from './rule/upload';
22
+ import transfer from './rule/transfer';
23
+ import tree from './rule/tree';
24
+ import alert from './rule/alert';
25
+ import text from './rule/text';
26
+ import space from './rule/space';
27
+ import tabs from './rule/tabs';
28
+ import button from './rule/button';
29
+ import editor from './rule/editor';
30
+ import group from './rule/group';
31
+ import subForm from './rule/subForm';
32
+ import card from './rule/card';
33
+ import collapse from './rule/collapse';
34
+ import collapseItem from './rule/collapseItem';
35
+ import treeSelect from './rule/treeSelect';
36
+ import tag from './rule/tag';
37
+ import html from './rule/html';
38
+ import table from './rule/table';
39
+ import tableForm from './rule/tableForm';
40
+ import tableFormColumn from './rule/tableFormColumn';
41
+ import image from './rule/image';
42
+ import signaturePad from './rule/signaturePad';
43
+ import title from './rule/title';
44
+
45
+
46
+ const ruleList = [
47
+ input, textarea, password, number, radio, checkbox, select, _switch, rate, time, timeRange, slider, date, dateRange, color, cascader, upload, transfer, tree, treeSelect, editor, signaturePad,
48
+ group, subForm, tableForm, tableFormColumn,
49
+ alert, button, text, title, html, divider, tag, image,
50
+ row, table, tabs, space, card, collapse,
51
+ col, tabPane, collapseItem,
52
+ ];
53
+
54
+ export default ruleList;
55
+
56
+ export function defaultDrag(rule) {
57
+ return {
58
+ icon: rule.field ? 'icon-input' : 'icon-cell',
59
+ label: rule.field || rule.type,
60
+ name: '_',
61
+ mask: true,
62
+ handleBtn: ['delete'],
63
+ rule() {
64
+ return rule;
65
+ },
66
+ props() {
67
+ return [];
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,24 @@
1
+ const menus = [
2
+ {
3
+ name: 'main',
4
+ title: '基础组件',
5
+ list: []
6
+ },
7
+ {
8
+ name: 'subform',
9
+ title: '子表单组件',
10
+ list: []
11
+ },
12
+ {
13
+ name: 'aide',
14
+ title: '辅助组件',
15
+ list: []
16
+ },
17
+ {
18
+ name: 'layout',
19
+ title: '布局组件',
20
+ list: []
21
+ },
22
+ ];
23
+
24
+ export default menus;
@@ -0,0 +1,45 @@
1
+ import {localeProps} from '../../utils';
2
+
3
+ const label = '提示';
4
+ const name = 'elAlert';
5
+
6
+ export default {
7
+ menu: 'aide',
8
+ icon: 'icon-alert',
9
+ label,
10
+ name,
11
+ event: ['close'],
12
+ rule({t}) {
13
+ return {
14
+ type: name,
15
+ props: {
16
+ title: t('com.elAlert.name'),
17
+ description: t('com.elAlert.description'),
18
+ type: 'success',
19
+ effect: 'dark',
20
+ },
21
+ children: []
22
+ };
23
+ },
24
+ props(_, {t}) {
25
+ return localeProps(t, name + '.props', [{type: 'input', field: 'title'}, {
26
+ type: 'select',
27
+ field: 'type',
28
+ options: [{label: 'success', value: 'success'}, {label: 'warning', value: 'warning'}, {
29
+ label: 'info',
30
+ value: 'info'
31
+ }, {label: 'error', value: 'error'}]
32
+ }, {type: 'input', field: 'description'}, {
33
+ type: 'switch',
34
+ field: 'closable',
35
+ value: true
36
+ }, {type: 'switch', field: 'center', value: true}, {
37
+ type: 'input',
38
+ field: 'closeText'
39
+ }, {type: 'switch', field: 'showIcon'}, {
40
+ type: 'select',
41
+ field: 'effect',
42
+ options: [{label: 'light', value: 'light'}, {label: 'dark', value: 'dark'}]
43
+ }]);
44
+ }
45
+ };
@@ -0,0 +1,49 @@
1
+ import {localeOptions, localeProps} from '../../utils';
2
+
3
+ const label = '按钮';
4
+ const name = 'elButton';
5
+
6
+ export default {
7
+ menu: 'aide',
8
+ icon: 'icon-button',
9
+ label,
10
+ name,
11
+ mask: true,
12
+ event: ['click'],
13
+ rule({t}) {
14
+ return {
15
+ type: name,
16
+ props: {},
17
+ children: [t('com.elButton.name')],
18
+ };
19
+ },
20
+ props(_, {t}) {
21
+ return localeProps(t, name + '.props', [{
22
+ type: 'input',
23
+ field: 'formCreateChild',
24
+ }, {
25
+ type: 'select',
26
+ field: 'size',
27
+ options: localeOptions(t, [{label: 'large', value: 'large'}, {label: 'default', value: 'default'}, {
28
+ label: 'small',
29
+ value: 'small'
30
+ }])
31
+ }, {
32
+ type: 'select',
33
+ field: 'type',
34
+ options: [{label: 'primary', value: 'primary'}, {
35
+ label: 'success',
36
+ value: 'success'
37
+ }, {label: 'warning', value: 'warning'}, {label: 'danger', value: 'danger'}, {
38
+ label: 'info',
39
+ value: 'info'
40
+ }]
41
+ }, {type: 'switch', field: 'plain'}, {
42
+ type: 'switch',
43
+ field: 'round'
44
+ }, {type: 'switch', field: 'circle'}, {
45
+ type: 'switch',
46
+ field: 'loading'
47
+ }, {type: 'switch', field: 'disabled'}]);
48
+ }
49
+ };
@@ -0,0 +1,40 @@
1
+ import {localeOptions, localeProps} from '../../utils';
2
+
3
+ const label = '卡片';
4
+ const name = 'elCard';
5
+
6
+ export default {
7
+ menu: 'layout',
8
+ icon: 'icon-card',
9
+ label,
10
+ name,
11
+ drag: true,
12
+ inside: false,
13
+ mask: false,
14
+ rule({t}) {
15
+ return {
16
+ type: name,
17
+ props: {
18
+ header: t('com.elCard.props.header')
19
+ },
20
+ style: {
21
+ width: '100%'
22
+ },
23
+ children: []
24
+ };
25
+ },
26
+ props(_, {t}) {
27
+ return localeProps(t, name + '.props', [{
28
+ type: 'input',
29
+ field: 'header',
30
+ }, {
31
+ type: 'select',
32
+ field: 'shadow',
33
+ value: 'always',
34
+ options: localeOptions(t, [{label: 'always', value: 'always'}, {label: 'never', value: 'never'}, {
35
+ label: 'hover',
36
+ value: 'hover'
37
+ }])
38
+ }]);
39
+ }
40
+ };