@epic-designer/antd 1.1.0 → 1.1.2-beta.1

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 (45) hide show
  1. package/dist/chunks/button.cjs +1 -1
  2. package/dist/chunks/button.mjs +1 -1
  3. package/dist/chunks/form.cjs +5 -5
  4. package/dist/chunks/form.mjs +5 -5
  5. package/dist/chunks/modal.cjs +2 -2
  6. package/dist/chunks/modal.mjs +2 -2
  7. package/dist/chunks/tabPane.cjs +42 -0
  8. package/dist/chunks/tabPane.mjs +40 -0
  9. package/dist/chunks/tabs.cjs +65 -0
  10. package/dist/chunks/tabs.mjs +63 -0
  11. package/dist/chunks/uploadImage.cjs +1 -1
  12. package/dist/chunks/uploadImage.mjs +1 -1
  13. package/dist/index.cjs +679 -706
  14. package/dist/index.mjs +679 -706
  15. package/package.json +1 -2
  16. package/src/button/button.vue +1 -1
  17. package/src/button/index.ts +25 -25
  18. package/src/card/index.ts +9 -9
  19. package/src/cascader/cascader.vue +2 -2
  20. package/src/cascader/index.ts +41 -41
  21. package/src/checkbox/index.ts +16 -16
  22. package/src/col/index.ts +6 -3
  23. package/src/color-picker/index.ts +16 -16
  24. package/src/date-picker/index.ts +79 -79
  25. package/src/form/form.vue +5 -5
  26. package/src/form/index.ts +34 -34
  27. package/src/index.ts +7 -15
  28. package/src/input/index.ts +25 -25
  29. package/src/input-number/index.ts +36 -36
  30. package/src/modal/modal.vue +2 -2
  31. package/src/radio/index.ts +16 -16
  32. package/src/row/index.ts +18 -15
  33. package/src/select/index.ts +37 -38
  34. package/src/slider/index.ts +28 -28
  35. package/src/switch/index.ts +38 -38
  36. package/src/tab-pane/index.ts +22 -0
  37. package/src/tab-pane/tabPane.ts +43 -0
  38. package/src/tabs/index.ts +107 -0
  39. package/src/tabs/tabs.ts +69 -0
  40. package/src/textarea/index.ts +28 -28
  41. package/src/time-picker/index.ts +42 -42
  42. package/src/upload-file/index.ts +18 -18
  43. package/src/upload-image/index.ts +15 -15
  44. package/src/upload-image/uploadImage.vue +1 -1
  45. package/src/input-password/index.ts +0 -154
@@ -7,8 +7,8 @@ export default {
7
7
  attribute: [
8
8
  {
9
9
  field: 'field',
10
- label: '字段名',
11
- type: 'input',
10
+ label: '数据字段',
11
+ type: 'EpField',
12
12
  },
13
13
  {
14
14
  field: 'label',
@@ -16,50 +16,52 @@ export default {
16
16
  type: 'input',
17
17
  },
18
18
  {
19
- field: 'componentProps.defaultValue',
19
+ field: 'props.defaultValue',
20
20
  label: '默认值',
21
21
  type: 'switch',
22
22
  },
23
23
  {
24
- componentProps: {
25
- placeholder: '请输入',
26
- },
27
- field: 'componentProps.checkedValue',
24
+ field: 'props.checkedValue',
28
25
  label: 'ON状态值',
29
26
  onChange(e) {
30
27
  setTimeout(() => setDefaultValue(e));
31
28
  },
29
+ props: {
30
+ placeholder: '请输入',
31
+ },
32
32
  type: 'input',
33
33
  },
34
34
  {
35
- componentProps: {
36
- placeholder: '请输入',
37
- },
38
- field: 'componentProps.unCheckedValue',
35
+ field: 'props.unCheckedValue',
39
36
  label: 'OFF状态值',
40
37
  onChange(e) {
41
38
  setTimeout(() => setDefaultValue(e));
42
39
  },
40
+ props: {
41
+ placeholder: '请输入',
42
+ },
43
43
  type: 'input',
44
44
  },
45
45
  {
46
- componentProps: {
46
+ field: 'props.checkedChildren',
47
+ label: 'ON状态描述',
48
+ props: {
47
49
  placeholder: '请输入',
48
50
  },
49
- field: 'componentProps.checkedChildren',
50
- label: 'ON状态描述',
51
51
  type: 'input',
52
52
  },
53
53
  {
54
- componentProps: {
54
+ field: 'props.unCheckedChildren',
55
+ label: 'OFF状态描述',
56
+ props: {
55
57
  placeholder: '请输入',
56
58
  },
57
- field: 'componentProps.unCheckedChildren',
58
- label: 'OFF状态描述',
59
59
  type: 'input',
60
60
  },
61
61
  {
62
- componentProps: {
62
+ field: 'props.size',
63
+ label: '尺寸',
64
+ props: {
63
65
  allowClear: true,
64
66
  options: [
65
67
  {
@@ -73,28 +75,26 @@ export default {
73
75
  ],
74
76
  placeholder: '请选择',
75
77
  },
76
- field: 'componentProps.size',
77
- label: '尺寸',
78
78
  type: 'select',
79
79
  },
80
80
  {
81
- field: 'componentProps.disabled',
81
+ field: 'props.disabled',
82
82
  label: '禁用',
83
83
  type: 'switch',
84
84
  },
85
85
  {
86
- field: 'componentProps.hidden',
86
+ field: 'props.hidden',
87
87
  label: '隐藏',
88
88
  type: 'switch',
89
89
  },
90
90
  {
91
- componentProps: {
92
- ruleType: 'boolean',
93
- },
94
91
  description: '校验规则需要配合表单使用',
95
92
  field: 'rules',
96
93
  label: '表单校验',
97
94
  layout: 'vertical',
95
+ props: {
96
+ ruleType: 'boolean',
97
+ },
98
98
  type: 'ERuleEditor',
99
99
  },
100
100
  ],
@@ -106,12 +106,12 @@ export default {
106
106
  ],
107
107
  },
108
108
  defaultSchema: {
109
- componentProps: {
110
- defaultValue: false,
111
- },
112
109
  field: 'switch',
113
110
  input: true,
114
111
  label: '开关',
112
+ props: {
113
+ defaultValue: false,
114
+ },
115
115
  type: 'switch',
116
116
  },
117
117
  groupName: '表单',
@@ -120,23 +120,23 @@ export default {
120
120
  } as ComponentConfigModel;
121
121
 
122
122
  function setDefaultValue(e) {
123
- const defaultValue = e.values.componentProps?.unCheckedValue || false;
123
+ const defaultValue = e.values.props?.unCheckedValue || false;
124
124
  // 如果unCheckedValue === '',则在下一个事件循环中删除 unCheckedValue 属性
125
- if (e.values.componentProps.unCheckedValue === '') {
126
- delete e.values.componentProps.unCheckedValue;
125
+ if (e.values.props.unCheckedValue === '') {
126
+ delete e.values.props.unCheckedValue;
127
127
  }
128
128
 
129
129
  // 如果checkedValue === '',则在下一个事件循环中删除 checkedValue 属性
130
- if (e.values.componentProps.checkedValue === '') {
131
- delete e.values.componentProps.checkedValue;
130
+ if (e.values.props.checkedValue === '') {
131
+ delete e.values.props.checkedValue;
132
132
  }
133
133
 
134
- // 检查是否已经有了 componentProps 对象,如果有,将默认值赋给 defaultValue 属性
135
- if (e.values.componentProps) {
136
- e.values.componentProps.defaultValue = defaultValue;
134
+ // 检查是否已经有了 props 对象,如果有,将默认值赋给 defaultValue 属性
135
+ if (e.values.props) {
136
+ e.values.props.defaultValue = defaultValue;
137
137
  } else {
138
- // 如果没有 componentProps 对象,则创建一个新对象并添加 defaultValue 属性
139
- e.values.componentProps = {
138
+ // 如果没有 props 对象,则创建一个新对象并添加 defaultValue 属性
139
+ e.values.props = {
140
140
  defaultValue,
141
141
  };
142
142
  }
@@ -0,0 +1,22 @@
1
+ import type { ComponentConfigModel } from '@epic-designer/types';
2
+
3
+ export default {
4
+ component: () => import('./tabPane'),
5
+ config: {
6
+ attribute: [
7
+ {
8
+ field: 'props.tab',
9
+ label: '标签名称',
10
+ type: 'input',
11
+ },
12
+ ],
13
+ },
14
+ defaultSchema: {
15
+ label: '标签',
16
+ type: 'tab-pane',
17
+ children: [],
18
+ },
19
+ editConstraints: {
20
+ locked: true,
21
+ },
22
+ } as ComponentConfigModel;
@@ -0,0 +1,43 @@
1
+ import type { ComponentSchema } from '@epic-designer/types';
2
+
3
+ import type { PropType } from 'vue';
4
+
5
+ import { defineComponent, h, inject, renderSlot } from 'vue';
6
+
7
+ import { TabPane } 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
+ const nodeAttrs = inject('nodeAttrs', {});
19
+
20
+ return () => {
21
+ const componentSchema = {
22
+ ...props.componentSchema,
23
+ ...props.componentSchema?.props,
24
+ };
25
+ const children = componentSchema.children;
26
+ delete componentSchema.children;
27
+
28
+ // return h("div", "sdfsd");
29
+ return h(
30
+ TabPane,
31
+ { componentSchema, ...nodeAttrs },
32
+ {
33
+ default: () =>
34
+ renderSlot(slots, 'edit-node', {}, () =>
35
+ children.map((componentSchema: any) =>
36
+ renderSlot(slots, 'node', { componentSchema }),
37
+ ),
38
+ ),
39
+ },
40
+ );
41
+ };
42
+ },
43
+ });
@@ -0,0 +1,107 @@
1
+ import type { ComponentConfigModel } from '@epic-designer/types';
2
+
3
+ export default {
4
+ component: () => import('./tabs'),
5
+ config: {
6
+ attribute: [
7
+ {
8
+ field: 'props.tabPosition',
9
+ label: '页签位置',
10
+ props: {
11
+ allowClear: true,
12
+ options: [
13
+ {
14
+ label: 'top',
15
+ value: 'top',
16
+ },
17
+ {
18
+ label: 'right',
19
+ value: 'right',
20
+ },
21
+ {
22
+ label: 'bottom',
23
+ value: 'bottom',
24
+ },
25
+ {
26
+ label: 'left',
27
+ value: 'left',
28
+ },
29
+ ],
30
+ placeholder: '请选择',
31
+ },
32
+ type: 'select',
33
+ },
34
+ {
35
+ field: 'props.animated',
36
+ label: '切换动画',
37
+ type: 'switch',
38
+ },
39
+ {
40
+ field: 'props.tabBarGutter',
41
+ label: '标签间隙',
42
+ props: {
43
+ placeholder: '请输入',
44
+ },
45
+ type: 'number',
46
+ },
47
+ {
48
+ field: 'children',
49
+ label: '页签管理',
50
+ layout: 'vertical',
51
+ type: 'ETabPaneEditor',
52
+ },
53
+ {
54
+ field: 'props.size',
55
+ label: '尺寸',
56
+ props: {
57
+ allowClear: true,
58
+ options: [
59
+ {
60
+ label: 'large',
61
+ value: 'large',
62
+ },
63
+ {
64
+ label: 'middle',
65
+ value: 'middle',
66
+ },
67
+ {
68
+ label: 'small',
69
+ value: 'small',
70
+ },
71
+ ],
72
+ placeholder: '请选择',
73
+ },
74
+ type: 'select',
75
+ },
76
+ {
77
+ field: 'props.hidden',
78
+ label: '隐藏',
79
+ type: 'switch',
80
+ },
81
+ ],
82
+ },
83
+ defaultSchema: {
84
+ label: '标签页',
85
+ props: {
86
+ defaultValue: '标签1',
87
+ },
88
+ type: 'tabs',
89
+ children: [
90
+ {
91
+ label: '标签1',
92
+ type: 'tab-pane',
93
+ children: [],
94
+ },
95
+ {
96
+ label: '标签2',
97
+ type: 'tab-pane',
98
+ children: [],
99
+ },
100
+ ],
101
+ },
102
+ editConstraints: {
103
+ childImmovable: true,
104
+ },
105
+ groupName: '布局',
106
+ icon: 'icon--epic--layout-tabs',
107
+ } as ComponentConfigModel;
@@ -0,0 +1,69 @@
1
+ import type { ComponentSchema } from '@epic-designer/types';
2
+
3
+ import type { PropType } from 'vue';
4
+
5
+ import { computed, defineComponent, h, ref, renderSlot, watch } from 'vue';
6
+
7
+ import { Tabs } 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
+ const modelValue = ref();
19
+ watch(
20
+ () => props.componentSchema.props.defaultValue,
21
+ (newValue) => {
22
+ const tabPaneLabels = props.componentSchema.children?.map(
23
+ (node) => node.label,
24
+ );
25
+ modelValue.value = tabPaneLabels?.includes(newValue)
26
+ ? newValue
27
+ : tabPaneLabels?.[0];
28
+ },
29
+ {
30
+ immediate: true,
31
+ },
32
+ );
33
+
34
+ const componentSchema = computed(() => ({
35
+ ...props.componentSchema?.props,
36
+ activeKey: modelValue.value,
37
+ 'onUpdate:activeKey': (e) => {
38
+ modelValue.value = e;
39
+ },
40
+ }));
41
+
42
+ const children = props.componentSchema?.children ?? [];
43
+ return () =>
44
+ h(Tabs, componentSchema.value, {
45
+ default: () => {
46
+ const defaultSlotList = slots['edit-node']?.()[0].children;
47
+ // 设计区渲染
48
+ if (defaultSlotList?.length) {
49
+ const list = defaultSlotList[0].children?.map((item) => {
50
+ item.props.key = item.props.schema.label;
51
+ item.props.tab = item.props.schema.label;
52
+ return item;
53
+ });
54
+
55
+ return list;
56
+ }
57
+
58
+ // 直接渲染
59
+ return children.map((componentSchema: any) =>
60
+ renderSlot(slots, 'node', {
61
+ componentSchema,
62
+ key: componentSchema.label,
63
+ tab: componentSchema.label,
64
+ }),
65
+ );
66
+ },
67
+ });
68
+ },
69
+ });
@@ -21,8 +21,8 @@ export default {
21
21
  attribute: [
22
22
  {
23
23
  field: 'field',
24
- label: '字段名',
25
- type: 'input',
24
+ label: '数据字段',
25
+ type: 'EpField',
26
26
  },
27
27
  {
28
28
  field: 'label',
@@ -30,36 +30,38 @@ export default {
30
30
  type: 'input',
31
31
  },
32
32
  {
33
- componentProps: {
33
+ field: 'props.defaultValue',
34
+ label: '默认值',
35
+ props: {
34
36
  placeholder: '请输入',
35
37
  },
36
- field: 'componentProps.defaultValue',
37
- label: '默认值',
38
38
  type: 'textarea',
39
39
  },
40
40
  {
41
- field: 'componentProps.placeholder',
41
+ field: 'props.placeholder',
42
42
  label: '占位内容',
43
43
  type: 'input',
44
44
  },
45
45
  {
46
- componentProps: {
46
+ field: 'props.autoSize.minRows',
47
+ label: '最小行数',
48
+ props: {
47
49
  placeholder: '请输入',
48
50
  },
49
- field: 'componentProps.autoSize.minRows',
50
- label: '最小行数',
51
51
  type: 'number',
52
52
  },
53
53
  {
54
- componentProps: {
54
+ field: 'props.autoSize.maxRows',
55
+ label: '最大行数',
56
+ props: {
55
57
  placeholder: '请输入',
56
58
  },
57
- field: 'componentProps.autoSize.maxRows',
58
- label: '最大行数',
59
59
  type: 'number',
60
60
  },
61
61
  {
62
- componentProps: {
62
+ field: 'props.size',
63
+ label: '尺寸',
64
+ props: {
63
65
  allowClear: true,
64
66
  options: [
65
67
  {
@@ -77,44 +79,42 @@ export default {
77
79
  ],
78
80
  placeholder: '请选择',
79
81
  },
80
- field: 'componentProps.size',
81
- label: '尺寸',
82
82
  type: 'select',
83
83
  },
84
84
  {
85
- componentProps: {
85
+ field: 'props.maxLength',
86
+ label: '最大输入长度',
87
+ props: {
86
88
  placeholder: '请输入',
87
89
  },
88
- field: 'componentProps.maxLength',
89
- label: '最大输入长度',
90
90
  type: 'number',
91
91
  },
92
92
  {
93
- componentProps: {
93
+ field: 'props.bordered',
94
+ label: '无边框',
95
+ props: {
94
96
  checkedValue: false,
95
97
  unCheckedValue: true,
96
98
  },
97
- field: 'componentProps.bordered',
98
- label: '无边框',
99
99
  type: 'switch',
100
100
  },
101
101
  {
102
- field: 'componentProps.showCount',
102
+ field: 'props.showCount',
103
103
  label: '统计字数',
104
104
  type: 'switch',
105
105
  },
106
106
  {
107
- field: 'componentProps.allowClear',
107
+ field: 'props.allowClear',
108
108
  label: '可清除',
109
109
  type: 'switch',
110
110
  },
111
111
  {
112
- field: 'componentProps.disabled',
112
+ field: 'props.disabled',
113
113
  label: '禁用',
114
114
  type: 'switch',
115
115
  },
116
116
  {
117
- field: 'componentProps.hidden',
117
+ field: 'props.hidden',
118
118
  label: '隐藏',
119
119
  type: 'switch',
120
120
  },
@@ -150,12 +150,12 @@ export default {
150
150
  ],
151
151
  },
152
152
  defaultSchema: {
153
- componentProps: {
154
- placeholder: '请输入',
155
- },
156
153
  field: 'textarea',
157
154
  input: true,
158
155
  label: '文本域',
156
+ props: {
157
+ placeholder: '请输入',
158
+ },
159
159
  type: 'textarea',
160
160
  },
161
161
  groupName: '表单',