@epic-designer/antd 1.0.5

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 (62) hide show
  1. package/LICENSE +21 -0
  2. package/dist/chunks/button.cjs +44 -0
  3. package/dist/chunks/button.mjs +42 -0
  4. package/dist/chunks/card.cjs +39 -0
  5. package/dist/chunks/card.mjs +37 -0
  6. package/dist/chunks/col.cjs +39 -0
  7. package/dist/chunks/col.mjs +37 -0
  8. package/dist/chunks/datePicker.cjs +47 -0
  9. package/dist/chunks/datePicker.mjs +45 -0
  10. package/dist/chunks/form.cjs +116 -0
  11. package/dist/chunks/form.mjs +114 -0
  12. package/dist/chunks/formItem.cjs +24 -0
  13. package/dist/chunks/formItem.mjs +22 -0
  14. package/dist/chunks/modal.cjs +136 -0
  15. package/dist/chunks/modal.mjs +134 -0
  16. package/dist/chunks/row.cjs +39 -0
  17. package/dist/chunks/row.mjs +37 -0
  18. package/dist/chunks/uploadFile.cjs +138 -0
  19. package/dist/chunks/uploadFile.mjs +136 -0
  20. package/dist/chunks/uploadImage.cjs +152 -0
  21. package/dist/chunks/uploadImage.mjs +150 -0
  22. package/dist/index.cjs +3047 -0
  23. package/dist/index.d.cts +5 -0
  24. package/dist/index.d.mts +5 -0
  25. package/dist/index.d.ts +5 -0
  26. package/dist/index.mjs +3045 -0
  27. package/package.json +38 -0
  28. package/src/button/button.vue +19 -0
  29. package/src/button/index.ts +204 -0
  30. package/src/card/card.ts +38 -0
  31. package/src/card/index.ts +65 -0
  32. package/src/cascader/cascader.vue +24 -0
  33. package/src/cascader/index.ts +201 -0
  34. package/src/checkbox/index.ts +101 -0
  35. package/src/col/col.ts +38 -0
  36. package/src/col/index.ts +22 -0
  37. package/src/color-picker/index.ts +109 -0
  38. package/src/date-picker/datePicker.ts +48 -0
  39. package/src/date-picker/index.ts +301 -0
  40. package/src/form/form.vue +153 -0
  41. package/src/form/index.ts +196 -0
  42. package/src/form-item/formItem.vue +12 -0
  43. package/src/form-item/index.ts +10 -0
  44. package/src/index.less +33 -0
  45. package/src/index.ts +131 -0
  46. package/src/input/index.ts +171 -0
  47. package/src/input-number/index.ts +182 -0
  48. package/src/input-password/index.ts +154 -0
  49. package/src/modal/index.ts +20 -0
  50. package/src/modal/modal.vue +98 -0
  51. package/src/radio/index.ts +107 -0
  52. package/src/row/index.ts +116 -0
  53. package/src/row/row.ts +38 -0
  54. package/src/select/index.ts +231 -0
  55. package/src/slider/index.ts +145 -0
  56. package/src/switch/index.ts +143 -0
  57. package/src/textarea/index.ts +164 -0
  58. package/src/time-picker/index.ts +192 -0
  59. package/src/upload-file/index.ts +90 -0
  60. package/src/upload-file/uploadFile.vue +145 -0
  61. package/src/upload-image/index.ts +71 -0
  62. package/src/upload-image/uploadImage.vue +167 -0
@@ -0,0 +1,182 @@
1
+ import type { ComponentConfigModel } from '@epic-designer/types';
2
+
3
+ export default {
4
+ bindModel: 'value',
5
+ component: async () => (await import('ant-design-vue')).InputNumber,
6
+ config: {
7
+ action: [
8
+ {
9
+ description: '使 input 获取焦点',
10
+ type: 'focus',
11
+ },
12
+ {
13
+ description: '使 input 失去焦点',
14
+ type: 'blur',
15
+ },
16
+ {
17
+ description: '选中 input 中的文字',
18
+ type: 'select',
19
+ },
20
+ ],
21
+ attribute: [
22
+ {
23
+ field: 'field',
24
+ label: '字段名',
25
+ type: 'input',
26
+ },
27
+ {
28
+ field: 'label',
29
+ label: '标题',
30
+ type: 'input',
31
+ },
32
+ {
33
+ componentProps: {
34
+ placeholder: '请输入',
35
+ size: 'middle',
36
+ },
37
+ field: 'componentProps.defaultValue',
38
+ label: '默认值',
39
+ type: 'number',
40
+ },
41
+ {
42
+ field: 'componentProps.placeholder',
43
+ label: '占位内容',
44
+ type: 'input',
45
+ },
46
+ {
47
+ componentProps: {
48
+ allowClear: true,
49
+ options: [
50
+ {
51
+ label: '大号',
52
+ value: 'large',
53
+ },
54
+ {
55
+ label: '中等',
56
+ value: 'middle',
57
+ },
58
+ {
59
+ label: '小型',
60
+ value: 'small',
61
+ },
62
+ ],
63
+ placeholder: '请选择',
64
+ },
65
+ field: 'componentProps.size',
66
+ label: '尺寸',
67
+ type: 'select',
68
+ },
69
+ {
70
+ field: 'componentProps.keyboard',
71
+ label: '键盘快捷行为',
72
+ type: 'switch',
73
+ },
74
+ {
75
+ componentProps: {
76
+ placeholder: '请输入',
77
+ },
78
+ field: 'componentProps.max',
79
+ label: '最大值',
80
+ type: 'number',
81
+ },
82
+ {
83
+ componentProps: {
84
+ placeholder: '请输入',
85
+ },
86
+ field: 'componentProps.min',
87
+ label: '最小值',
88
+ type: 'number',
89
+ },
90
+ {
91
+ componentProps: {
92
+ placeholder: '请输入',
93
+ },
94
+ field: 'componentProps.precision',
95
+ label: '精度',
96
+ type: 'number',
97
+ },
98
+ {
99
+ componentProps: {
100
+ placeholder: '请输入',
101
+ },
102
+ field: 'componentProps.step',
103
+ label: '步长',
104
+ type: 'number',
105
+ },
106
+ {
107
+ field: 'componentProps.stringMode',
108
+ label: '字符模式',
109
+ type: 'switch',
110
+ },
111
+ {
112
+ componentProps: {
113
+ checkedValue: false,
114
+ unCheckedValue: true,
115
+ },
116
+ field: 'componentProps.bordered',
117
+ label: '无边框',
118
+ type: 'switch',
119
+ },
120
+ {
121
+ field: 'componentProps.allowClear',
122
+ label: '可清空',
123
+ type: 'switch',
124
+ },
125
+ {
126
+ field: 'componentProps.disabled',
127
+ label: '禁用',
128
+ type: 'switch',
129
+ },
130
+ {
131
+ field: 'componentProps.hidden',
132
+ label: '隐藏',
133
+ type: 'switch',
134
+ },
135
+ {
136
+ componentProps: {
137
+ ruleType: 'number',
138
+ },
139
+ description: '校验规则需要配合表单使用',
140
+ field: 'rules',
141
+ label: '表单校验',
142
+ layout: 'vertical',
143
+ type: 'ERuleEditor',
144
+ },
145
+ ],
146
+ event: [
147
+ {
148
+ description: '输入值',
149
+ type: 'input',
150
+ },
151
+ {
152
+ description: '值修改',
153
+ type: 'change',
154
+ },
155
+ {
156
+ description: '按下回车的回调',
157
+ type: 'pressEnter',
158
+ },
159
+ {
160
+ description: '获取焦点',
161
+ type: 'focus',
162
+ },
163
+ {
164
+ description: '失去焦点',
165
+ type: 'blur',
166
+ },
167
+ ],
168
+ },
169
+ defaultSchema: {
170
+ componentProps: {
171
+ placeholder: '请输入',
172
+ style: { width: '100%' },
173
+ },
174
+ field: 'number',
175
+ input: true,
176
+ label: '数字输入框',
177
+ type: 'number',
178
+ },
179
+ groupName: '表单',
180
+ icon: 'icon--epic--123-rounded',
181
+ sort: 710,
182
+ } as ComponentConfigModel;
@@ -0,0 +1,154 @@
1
+ import type { ComponentConfigModel } from '@epic-designer/types';
2
+
3
+ export default {
4
+ bindModel: 'value',
5
+ component: async () => (await import('ant-design-vue')).InputPassword,
6
+ config: {
7
+ action: [
8
+ {
9
+ description: '使 input 获取焦点',
10
+ type: 'focus',
11
+ },
12
+ {
13
+ description: '使 input 失去焦点',
14
+ type: 'blur',
15
+ },
16
+ {
17
+ description: '选中 input 中的文字',
18
+ type: 'select',
19
+ },
20
+ ],
21
+ attribute: [
22
+ {
23
+ field: 'field',
24
+ label: '字段名',
25
+ type: 'input',
26
+ },
27
+ {
28
+ field: 'label',
29
+ label: '标题',
30
+ type: 'input',
31
+ },
32
+ {
33
+ field: 'componentProps.placeholder',
34
+ label: '占位内容',
35
+ type: 'input',
36
+ },
37
+ {
38
+ componentProps: {
39
+ allowClear: true,
40
+ options: [
41
+ {
42
+ label: '大号',
43
+ value: 'large',
44
+ },
45
+ {
46
+ label: '中等',
47
+ value: 'middle',
48
+ },
49
+ {
50
+ label: '小型',
51
+ value: 'small',
52
+ },
53
+ ],
54
+ placeholder: '请选择',
55
+ },
56
+ field: 'componentProps.size',
57
+ label: '尺寸',
58
+ type: 'select',
59
+ },
60
+ {
61
+ componentProps: {
62
+ checkedValue: false,
63
+ unCheckedValue: true,
64
+ },
65
+ field: 'componentProps.bordered',
66
+ label: '无边框',
67
+ type: 'switch',
68
+ },
69
+ {
70
+ componentProps: {
71
+ placeholder: '请输入',
72
+ },
73
+ field: 'componentProps.maxLength',
74
+ label: '最大输入长度',
75
+ type: 'number',
76
+ },
77
+ {
78
+ field: 'componentProps.showCount',
79
+ label: '统计字数',
80
+ type: 'switch',
81
+ },
82
+ {
83
+ field: 'componentProps.visible',
84
+ label: '密码可见',
85
+ type: 'switch',
86
+ },
87
+ {
88
+ componentProps: {
89
+ checkedValue: false,
90
+ unCheckedValue: true,
91
+ },
92
+ field: 'componentProps.visibilityToggle',
93
+ label: '隐藏切换按钮',
94
+ type: 'switch',
95
+ },
96
+ {
97
+ field: 'componentProps.allowClear',
98
+ label: '可清空',
99
+ type: 'switch',
100
+ },
101
+ {
102
+ field: 'componentProps.disabled',
103
+ label: '禁用',
104
+ type: 'switch',
105
+ },
106
+ {
107
+ field: 'componentProps.hidden',
108
+ label: '隐藏',
109
+ type: 'switch',
110
+ },
111
+ {
112
+ description: '校验规则需要配合表单使用',
113
+ field: 'rules',
114
+ label: '表单校验',
115
+ layout: 'vertical',
116
+ type: 'ERuleEditor',
117
+ },
118
+ ],
119
+ event: [
120
+ {
121
+ description: '输入值',
122
+ type: 'input',
123
+ },
124
+ {
125
+ description: '值修改',
126
+ type: 'change',
127
+ },
128
+ {
129
+ description: '按下回车的回调',
130
+ type: 'pressEnter',
131
+ },
132
+ {
133
+ description: '获取焦点',
134
+ type: 'focus',
135
+ },
136
+ {
137
+ description: '失去焦点',
138
+ type: 'blur',
139
+ },
140
+ ],
141
+ },
142
+ defaultSchema: {
143
+ componentProps: {
144
+ placeholder: '请输入',
145
+ },
146
+ field: 'password',
147
+ input: true,
148
+ label: '密码输入框',
149
+ type: 'password',
150
+ },
151
+ groupName: '表单',
152
+ icon: 'icon--epic--lock-outline',
153
+ sort: 720,
154
+ } as ComponentConfigModel;
@@ -0,0 +1,20 @@
1
+ import type { ComponentConfigModel } from '@epic-designer/types';
2
+
3
+ export default {
4
+ component: () => import('./modal.vue'),
5
+ config: {
6
+ attribute: [
7
+ {
8
+ field: 'title',
9
+ label: '标题',
10
+ type: 'input',
11
+ },
12
+ ],
13
+ },
14
+ defaultSchema: {
15
+ label: '模态框',
16
+ type: 'modal',
17
+ children: [],
18
+ },
19
+ icon: 'epic-icon-xiala',
20
+ } as ComponentConfigModel;
@@ -0,0 +1,98 @@
1
+ <script lang="ts" setup>
2
+ import type { ComponentSchema } from '@epic-designer/types';
3
+
4
+ import { computed, useAttrs } from 'vue';
5
+
6
+ import { Button, Modal, Space, version } from 'ant-design-vue';
7
+
8
+ const props = withDefaults(
9
+ defineProps<{
10
+ cancelText?: string;
11
+ componentSchema?: ComponentSchema;
12
+ hideConfirm?: boolean;
13
+ okText?: string;
14
+ }>(),
15
+ {
16
+ cancelText: '关闭',
17
+ componentSchema: () => ({
18
+ type: 'modal',
19
+ }),
20
+ okText: '确定',
21
+ },
22
+ );
23
+ const emits = defineEmits(['ok', 'close', 'update:modelValue']);
24
+ const versionArray = version.split('.');
25
+ // 获取版本号第一个数字
26
+ const firstNumber = Number.parseInt(versionArray[0]);
27
+
28
+ const attrs = useAttrs();
29
+ const dialogStyle = {
30
+ bottom: '30px',
31
+ left: '150px',
32
+ minHeight: '500px',
33
+ minWidth: '700px',
34
+ position: 'absolute',
35
+ right: '150px',
36
+ top: '56px',
37
+ width: 'auto',
38
+ };
39
+
40
+ const bodyStyle = {
41
+ height: 'calc(100vh - 108px)',
42
+ padding: 0,
43
+ };
44
+
45
+ const getComponentProps = computed<Record<string, any>>(() => ({
46
+ ...props.componentSchema,
47
+ ...attrs,
48
+ bodyStyle,
49
+ dialogStyle,
50
+ footer: null,
51
+ 'onUpdate:open': updateModelValue,
52
+ 'onUpdate:visible': updateModelValue,
53
+ open: attrs.modelValue,
54
+ style: 'top:20px',
55
+ title: props.componentSchema?.label ?? '',
56
+ visible: firstNumber > 3 ? undefined : attrs.modelValue,
57
+ wrapClassName: 'epic-modal-ant',
58
+ children: null,
59
+ }));
60
+
61
+ const children = computed(() => props.componentSchema?.children ?? []);
62
+
63
+ function handleOk() {
64
+ emits('ok');
65
+ }
66
+
67
+ function updateModelValue(value = false) {
68
+ emits('update:modelValue', value);
69
+ }
70
+
71
+ function handleClose() {
72
+ emits('close');
73
+ }
74
+ </script>
75
+
76
+ <template>
77
+ <Modal v-bind="getComponentProps">
78
+ <div class="epic-modal-main epic-scoped">
79
+ <slot>
80
+ <slot name="edit-node">
81
+ <slot
82
+ v-for="item in children"
83
+ name="node"
84
+ :component-schema="item"
85
+ ></slot>
86
+ </slot>
87
+ </slot>
88
+ </div>
89
+ <div class="epic-modal-footer">
90
+ <Space align="end">
91
+ <Button @click="handleClose"> {{ props.cancelText }} </Button>
92
+ <Button v-if="!props.hideConfirm" type="primary" @click="handleOk">
93
+ {{ props.okText }}
94
+ </Button>
95
+ </Space>
96
+ </div>
97
+ </Modal>
98
+ </template>
@@ -0,0 +1,107 @@
1
+ import type { ComponentConfigModel } from '@epic-designer/types';
2
+
3
+ export default {
4
+ bindModel: 'value',
5
+ component: async () => (await import('ant-design-vue')).RadioGroup,
6
+ config: {
7
+ attribute: [
8
+ {
9
+ field: 'field',
10
+ label: '字段名',
11
+ type: 'input',
12
+ },
13
+ {
14
+ field: 'label',
15
+ label: '标题',
16
+ type: 'input',
17
+ },
18
+ {
19
+ field: 'componentProps.defaultValue',
20
+ label: '默认值',
21
+ type: 'radio',
22
+ },
23
+ {
24
+ componentProps: {
25
+ allowClear: true,
26
+ options: [
27
+ {
28
+ label: '大号',
29
+ value: 'large',
30
+ },
31
+ {
32
+ label: '中等',
33
+ value: 'middle',
34
+ },
35
+ {
36
+ label: '小型',
37
+ value: 'small',
38
+ },
39
+ ],
40
+ placeholder: '请选择',
41
+ },
42
+ field: 'componentProps.size',
43
+ label: '尺寸',
44
+ type: 'select',
45
+ },
46
+ {
47
+ componentProps: {
48
+ checkedValue: 'button',
49
+ unCheckedValue: 'default',
50
+ },
51
+ field: 'componentProps.optionType',
52
+ label: '按钮样式',
53
+ type: 'switch',
54
+ },
55
+ {
56
+ field: 'componentProps.disabled',
57
+ label: '禁用',
58
+ type: 'switch',
59
+ },
60
+ {
61
+ field: 'componentProps.hidden',
62
+ label: '隐藏',
63
+ type: 'switch',
64
+ },
65
+ {
66
+ field: 'componentProps.options',
67
+ label: '选项管理',
68
+ layout: 'vertical',
69
+ type: 'EOptionsEditor',
70
+ },
71
+ {
72
+ description: '校验规则需要配合表单使用',
73
+ field: 'rules',
74
+ label: '表单校验',
75
+ layout: 'vertical',
76
+ type: 'ERuleEditor',
77
+ },
78
+ ],
79
+ event: [
80
+ {
81
+ description: '值变化时',
82
+ type: 'change',
83
+ },
84
+ ],
85
+ },
86
+ defaultSchema: {
87
+ componentProps: {
88
+ options: [
89
+ {
90
+ label: '选项1',
91
+ value: '选项1',
92
+ },
93
+ {
94
+ label: '选项2',
95
+ value: '选项2',
96
+ },
97
+ ],
98
+ },
99
+ field: 'radio',
100
+ input: true,
101
+ label: '单选框',
102
+ type: 'radio',
103
+ },
104
+ groupName: '表单',
105
+ icon: 'icon--epic--radio-button-checked-outline',
106
+ sort: 850,
107
+ } as ComponentConfigModel;
@@ -0,0 +1,116 @@
1
+ import type { ComponentConfigModel } from '@epic-designer/types';
2
+
3
+ export default {
4
+ component: () => import('./row'),
5
+ config: {
6
+ attribute: [
7
+ {
8
+ componentProps: {
9
+ options: [
10
+ {
11
+ label: 'top',
12
+ value: 'top',
13
+ },
14
+ {
15
+ label: 'middle',
16
+ value: 'middle',
17
+ },
18
+ {
19
+ label: 'bottom',
20
+ value: 'bottom',
21
+ },
22
+ ],
23
+ placeholder: '请选择',
24
+ style: { width: '100%' },
25
+ },
26
+ field: 'componentProps.align',
27
+ label: '垂直对齐方式',
28
+ type: 'select',
29
+ },
30
+ {
31
+ componentProps: {
32
+ options: [
33
+ {
34
+ label: 'start',
35
+ value: 'start',
36
+ },
37
+ {
38
+ label: 'end',
39
+ value: 'end',
40
+ },
41
+ {
42
+ label: 'center',
43
+ value: 'center',
44
+ },
45
+ {
46
+ label: 'space-around',
47
+ value: 'space-around',
48
+ },
49
+ {
50
+ label: 'space-between',
51
+ value: 'space-between',
52
+ },
53
+ ],
54
+ placeholder: '请选择',
55
+ style: { width: '100%' },
56
+ },
57
+ field: 'componentProps.justify',
58
+ label: '水平排列方式',
59
+ type: 'select',
60
+ },
61
+ {
62
+ componentProps: {
63
+ placeholder: '请输入',
64
+ },
65
+ field: 'componentProps.gutter',
66
+ label: '栅格间距',
67
+ type: 'input',
68
+ },
69
+ {
70
+ field: 'children',
71
+ label: '列编辑',
72
+ type: 'EColEditor',
73
+ },
74
+ {
75
+ componentProps: {
76
+ checkedValue: false,
77
+ unCheckedValue: true,
78
+ },
79
+ field: 'componentProps.wrap',
80
+ label: '不自动换行',
81
+ type: 'switch',
82
+ },
83
+ {
84
+ field: 'componentProps.hidden',
85
+ label: '隐藏',
86
+ type: 'switch',
87
+ },
88
+ ],
89
+ },
90
+ defaultSchema: {
91
+ label: '栅格布局',
92
+ type: 'row',
93
+ children: [
94
+ {
95
+ type: 'col',
96
+ children: [],
97
+ componentProps: {
98
+ span: 12,
99
+ },
100
+ },
101
+ {
102
+ type: 'col',
103
+ children: [],
104
+ componentProps: {
105
+ span: 12,
106
+ },
107
+ },
108
+ ],
109
+ },
110
+ editConstraints: {
111
+ childImmovable: true,
112
+ },
113
+ groupName: '布局',
114
+ icon: 'icon--epic--width-normal-outline',
115
+ sort: 800,
116
+ } as ComponentConfigModel;
package/src/row/row.ts ADDED
@@ -0,0 +1,38 @@
1
+ import type { ComponentSchema } from '@epic-designer/types';
2
+
3
+ import type { PropType } from 'vue';
4
+
5
+ import { defineComponent, h, renderSlot } from 'vue';
6
+
7
+ import { Row } from 'ant-design-vue';
8
+
9
+ export default defineComponent({
10
+ props: {
11
+ componentSchema: {
12
+ default: () => ({}),
13
+ require: true,
14
+ type: Object as PropType<ComponentSchema>,
15
+ },
16
+ },
17
+ setup(props, { slots }) {
18
+ return () => {
19
+ const componentSchema = {
20
+ ...props.componentSchema,
21
+ title: props.componentSchema?.label ?? '',
22
+ } as any;
23
+ const children = componentSchema.children;
24
+ delete componentSchema.children;
25
+
26
+ return h(Row, componentSchema, {
27
+ default: () =>
28
+ renderSlot(slots, 'edit-node', {}, () =>
29
+ children.map((subcomponentSchema: ComponentSchema) =>
30
+ renderSlot(slots, 'node', {
31
+ componentSchema: subcomponentSchema,
32
+ }),
33
+ ),
34
+ ),
35
+ });
36
+ };
37
+ },
38
+ });