@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,196 @@
1
+ import type { ComponentConfigModel } from '@epic-designer/types';
2
+
3
+ export default {
4
+ component: () => import('./form.vue'),
5
+ config: {
6
+ action: [
7
+ {
8
+ description: '获取表单数据',
9
+ type: 'getData',
10
+ },
11
+ {
12
+ description: '设置表单数据',
13
+ type: 'setData',
14
+ },
15
+ {
16
+ description: '校验表单',
17
+ type: 'validate',
18
+ },
19
+ ],
20
+ attribute: [
21
+ {
22
+ field: 'componentProps.name',
23
+ label: 'Name',
24
+ type: 'input',
25
+ },
26
+ {
27
+ componentProps: {
28
+ allowClear: true,
29
+ 'option-type': 'button',
30
+ options: [
31
+ {
32
+ label: '水平',
33
+ value: 'horizontal',
34
+ },
35
+ {
36
+ label: '垂直',
37
+ value: 'vertical',
38
+ },
39
+ {
40
+ label: '内联',
41
+ value: 'inline',
42
+ },
43
+ ],
44
+ placeholder: '请选择',
45
+ },
46
+ field: 'componentProps.layout',
47
+ label: '表单布局',
48
+ type: 'radio',
49
+ },
50
+ {
51
+ componentProps: {
52
+ 'option-type': 'button',
53
+ options: [
54
+ {
55
+ label: '固定宽度',
56
+ value: 'fixed',
57
+ },
58
+ {
59
+ label: '自适应宽度',
60
+ value: 'flex',
61
+ },
62
+ ],
63
+ },
64
+ field: 'componentProps.labelLayout',
65
+ label: '标签布局',
66
+ type: 'radio',
67
+ },
68
+ {
69
+ field: 'componentProps.labelWidth',
70
+ label: '标签宽度',
71
+ show: ({ values }) => {
72
+ return values.componentProps?.labelLayout === 'fixed';
73
+ },
74
+ type: 'EInputSize',
75
+ },
76
+ {
77
+ componentProps: {
78
+ placeholder: '请输入',
79
+ },
80
+ field: 'componentProps.labelCol.span',
81
+ label: '标签占比',
82
+ show: ({ values }) => {
83
+ return values.componentProps?.labelLayout === 'flex';
84
+ },
85
+ type: 'input',
86
+ },
87
+ {
88
+ componentProps: {
89
+ placeholder: '请输入',
90
+ },
91
+ field: 'componentProps.wrapperCol.span',
92
+ label: '控件占比',
93
+ show: ({ values }) => {
94
+ return values.componentProps?.labelLayout === 'flex';
95
+ },
96
+ type: 'input',
97
+ },
98
+ {
99
+ componentProps: {
100
+ 'option-type': 'button',
101
+ options: [
102
+ {
103
+ label: '左',
104
+ value: 'left',
105
+ },
106
+ {
107
+ label: '右',
108
+ value: 'right',
109
+ },
110
+ ],
111
+ },
112
+ field: 'componentProps.labelAlign',
113
+ label: '标签对齐',
114
+ type: 'radio',
115
+ },
116
+ {
117
+ componentProps: {
118
+ allowClear: true,
119
+ options: [
120
+ {
121
+ label: '大号',
122
+ value: 'large',
123
+ },
124
+ {
125
+ label: '中等',
126
+ value: 'middle',
127
+ },
128
+ {
129
+ label: '小型',
130
+ value: 'small',
131
+ },
132
+ ],
133
+ placeholder: '请选择',
134
+ },
135
+ defaultValue: 'default',
136
+ field: 'componentProps.size',
137
+ label: '尺寸',
138
+ type: 'select',
139
+ },
140
+ {
141
+ componentProps: {
142
+ checkedValue: false,
143
+ unCheckedValue: true,
144
+ },
145
+ field: 'componentProps.colon',
146
+ label: '隐藏冒号',
147
+ type: 'switch',
148
+ },
149
+ {
150
+ field: 'componentProps.hideRequiredMark',
151
+ label: '隐藏必须标志',
152
+ type: 'switch',
153
+ },
154
+
155
+ {
156
+ field: 'componentProps.labelWrap',
157
+ label: '标签文本换行',
158
+ type: 'switch',
159
+ },
160
+ {
161
+ field: 'componentProps.scrollToFirstError',
162
+ label: '滚动校验错误处',
163
+ type: 'switch',
164
+ },
165
+ {
166
+ field: 'componentProps.disabled',
167
+ label: '禁用',
168
+ type: 'switch',
169
+ },
170
+ {
171
+ field: 'componentProps.hidden',
172
+ label: '隐藏',
173
+ type: 'switch',
174
+ },
175
+ ],
176
+ },
177
+ defaultSchema: {
178
+ componentProps: {
179
+ labelCol: {
180
+ span: 5,
181
+ },
182
+ labelLayout: 'fixed',
183
+ labelWidth: '100px',
184
+ name: 'default',
185
+ wrapperCol: {
186
+ span: 19,
187
+ },
188
+ },
189
+ label: '表单',
190
+ type: 'form',
191
+ children: [],
192
+ },
193
+ groupName: '表单',
194
+ icon: 'icon--epic--list-alt-outline-rounded',
195
+ sort: 600,
196
+ } as ComponentConfigModel;
@@ -0,0 +1,12 @@
1
+ <script lang="ts" setup>
2
+ import { useAttrs } from 'vue';
3
+
4
+ import { FormItem } from 'ant-design-vue';
5
+
6
+ const attrs = useAttrs() as any;
7
+ </script>
8
+ <template>
9
+ <FormItem v-bind="attrs" :name="attrs.field">
10
+ <slot></slot>
11
+ </FormItem>
12
+ </template>
@@ -0,0 +1,10 @@
1
+ import type { ComponentConfigModel } from '@epic-designer/types';
2
+
3
+ export default {
4
+ component: () => import('./formItem.vue'),
5
+ config: {},
6
+ defaultSchema: {
7
+ label: '表单项',
8
+ type: 'form-item',
9
+ },
10
+ } as ComponentConfigModel;
package/src/index.less ADDED
@@ -0,0 +1,33 @@
1
+ .epic-designer-main {
2
+ .ant-input-number {
3
+ width: 100%;
4
+ }
5
+
6
+ .ant-collapse-content > .ant-collapse-content-box {
7
+ padding: 8px;
8
+ }
9
+
10
+ .ant-select {
11
+ width: 100%;
12
+ }
13
+
14
+ .epic-upload-image {
15
+ .avatar-uploader > .ant-upload {
16
+ width: 128px;
17
+ height: 128px;
18
+ }
19
+ }
20
+ }
21
+
22
+ // 适配epic-input-size样式
23
+ .epic-input-size {
24
+ &.ant-input-affix-wrapper {
25
+ padding-top: 0;
26
+ padding-right: 0;
27
+ padding-bottom: 0;
28
+ }
29
+ .ant-select:hover {
30
+ border: none !important;
31
+ box-shadow: none !important;
32
+ }
33
+ }
package/src/index.ts ADDED
@@ -0,0 +1,131 @@
1
+ import type { PluginManager } from '@epic-designer/manager';
2
+
3
+ import { watchEffect } from 'vue';
4
+
5
+ // 注册ant-design-vue ui
6
+ import { pluginManager as pManager } from '@epic-designer/manager';
7
+ import { message, version } from 'ant-design-vue';
8
+
9
+ import Button from './button';
10
+ import Card from './card';
11
+ import Cascader from './cascader';
12
+ import Checkbox from './checkbox';
13
+ import Col from './col';
14
+ import colorPicker from './color-picker';
15
+ import DatePicker from './date-picker';
16
+ import Form from './form';
17
+ import FormItem from './form-item';
18
+ import Input from './input';
19
+ import InputNumber from './input-number';
20
+ import InputPassword from './input-password';
21
+ import Modal from './modal';
22
+ import Radio from './radio';
23
+ import Row from './row';
24
+ import Select from './select';
25
+ import Slider from './slider';
26
+ import Switch from './switch';
27
+ import Textarea from './textarea';
28
+ import TimePicker from './time-picker';
29
+ import UploadFile from './upload-file';
30
+ import UploadImage from './upload-image';
31
+
32
+ export function setupAntd(pluginManager: PluginManager = pManager): void {
33
+ // 版本兼容处理 start
34
+ const versionArray = version.split('.');
35
+ // 获取版本号第一个数字
36
+ const firstNumber = Number.parseInt(versionArray[0]);
37
+
38
+ // 创建一个 style 标签
39
+ const style = document.createElement('style');
40
+
41
+ // 大于v3版本
42
+ if (firstNumber > 3) {
43
+ // 定义 CSS 样式
44
+ const css = `
45
+ .epic-modal-ant .epic-modal-main {
46
+ padding: 4px 12px 12px;
47
+ }
48
+ .epic-modal-ant .ant-modal-title {
49
+ padding: 16px 16px 0px;
50
+ }
51
+ .epic-modal-ant .ant-modal-content {
52
+ padding: 0px;
53
+ }`;
54
+ style.append(document.createTextNode(css));
55
+ // 将 style 标签插入到页面的 head 中
56
+ document.head.append(style);
57
+ // 版本兼容处理 end
58
+ } else {
59
+ // v3版本
60
+ Form.config.attribute = Form.config.attribute?.filter(
61
+ (item) => item.label !== '禁用',
62
+ );
63
+ }
64
+
65
+ // 加载组件
66
+ pluginManager.component(
67
+ 'Collapse',
68
+ async () => (await import('ant-design-vue')).Collapse,
69
+ );
70
+ pluginManager.component(
71
+ 'CollapseItem',
72
+ async () => (await import('ant-design-vue')).CollapsePanel,
73
+ );
74
+ pluginManager.component(
75
+ 'Tabs',
76
+ async () => (await import('ant-design-vue')).Tabs,
77
+ );
78
+ pluginManager.component(
79
+ 'TabPane',
80
+ async () => (await import('ant-design-vue')).TabPane,
81
+ );
82
+
83
+ const componentArray = [
84
+ Form,
85
+ FormItem,
86
+ Input,
87
+ Textarea,
88
+ InputNumber,
89
+ InputPassword,
90
+ Radio,
91
+ Checkbox,
92
+ Select,
93
+ Slider,
94
+ TimePicker,
95
+ DatePicker,
96
+ Cascader,
97
+ Switch,
98
+ UploadImage,
99
+ UploadFile,
100
+ colorPicker,
101
+ Button,
102
+ Card,
103
+ Row,
104
+ Col,
105
+ Modal,
106
+ ];
107
+
108
+ // 更新默认上传地址
109
+ watchEffect(() => {
110
+ UploadImage.defaultSchema.componentProps.action =
111
+ pluginManager.global.uploadImage;
112
+ UploadFile.defaultSchema.componentProps.action =
113
+ pluginManager.global.uploadFile;
114
+ });
115
+
116
+ componentArray.forEach((item) => {
117
+ pluginManager.registerComponent(item);
118
+ pluginManager.addBaseComponentTypes(item.defaultSchema.type);
119
+ });
120
+
121
+ // 注册全局提示函数
122
+ pluginManager.global.$message = {
123
+ error: message.error,
124
+ info: message.info,
125
+ success: message.success,
126
+ warning: message.warning,
127
+ };
128
+
129
+ // ui初始化完成。
130
+ pluginManager.setInitialized(true);
131
+ }
@@ -0,0 +1,171 @@
1
+ import type { ComponentConfigModel } from '@epic-designer/types';
2
+
3
+ export default {
4
+ bindModel: 'value',
5
+ component: async () => (await import('ant-design-vue')).Input,
6
+ config: {
7
+ action: [
8
+ {
9
+ description: '使输入框获取焦点',
10
+ type: 'focus',
11
+ },
12
+ {
13
+ description: '使输入框失去焦点',
14
+ type: 'blur',
15
+ },
16
+ {
17
+ description: '选中输入框中的文字',
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
+ placeholder: '请输入',
40
+ },
41
+ field: 'componentProps.defaultValue',
42
+ label: '默认值',
43
+ type: 'input',
44
+ },
45
+ {
46
+ componentProps: {
47
+ allowClear: true,
48
+ options: [
49
+ {
50
+ label: 'text',
51
+ value: 'text',
52
+ },
53
+ {
54
+ label: 'number',
55
+ value: 'number',
56
+ },
57
+ {
58
+ label: 'password',
59
+ value: 'password',
60
+ },
61
+ ],
62
+ placeholder: '请选择',
63
+ },
64
+ field: 'componentProps.type',
65
+ label: '输入类型',
66
+ type: 'select',
67
+ },
68
+ {
69
+ componentProps: {
70
+ allowClear: true,
71
+ options: [
72
+ {
73
+ label: '大号',
74
+ value: 'large',
75
+ },
76
+ {
77
+ label: '中等',
78
+ value: 'middle',
79
+ },
80
+ {
81
+ label: '小型',
82
+ value: 'small',
83
+ },
84
+ ],
85
+ placeholder: '请选择',
86
+ },
87
+ field: 'componentProps.size',
88
+ label: '尺寸',
89
+ type: 'select',
90
+ },
91
+ {
92
+ componentProps: {
93
+ checkedValue: false,
94
+ unCheckedValue: true,
95
+ },
96
+ field: 'componentProps.bordered',
97
+ label: '无边框',
98
+ type: 'switch',
99
+ },
100
+ {
101
+ componentProps: {
102
+ placeholder: '请输入',
103
+ },
104
+ field: 'componentProps.maxlength',
105
+ label: '最大输入长度',
106
+ type: 'number',
107
+ },
108
+ {
109
+ field: 'componentProps.showCount',
110
+ label: '展示字数',
111
+ type: 'switch',
112
+ },
113
+ {
114
+ field: 'componentProps.allowClear',
115
+ label: '可清空',
116
+ type: 'switch',
117
+ },
118
+ {
119
+ field: 'componentProps.disabled',
120
+ label: '禁用',
121
+ type: 'switch',
122
+ },
123
+ {
124
+ field: 'componentProps.hidden',
125
+ label: '隐藏',
126
+ type: 'switch',
127
+ },
128
+ {
129
+ description: '校验规则需要配合表单使用',
130
+ field: 'rules',
131
+ label: '表单校验',
132
+ layout: 'vertical',
133
+ type: 'ERuleEditor',
134
+ },
135
+ ],
136
+ event: [
137
+ {
138
+ description: '输入值时',
139
+ type: 'input',
140
+ },
141
+ {
142
+ description: '值修改时',
143
+ type: 'change',
144
+ },
145
+ {
146
+ description: '按下回车时',
147
+ type: 'pressEnter',
148
+ },
149
+ {
150
+ description: '获取焦点时',
151
+ type: 'focus',
152
+ },
153
+ {
154
+ description: '失去焦点时',
155
+ type: 'blur',
156
+ },
157
+ ],
158
+ },
159
+ defaultSchema: {
160
+ componentProps: {
161
+ placeholder: '请输入',
162
+ },
163
+ field: 'input',
164
+ input: true,
165
+ label: '输入框',
166
+ type: 'input',
167
+ },
168
+ groupName: '表单',
169
+ icon: 'icon--epic--border-color-outline-rounded',
170
+ sort: 700,
171
+ } as ComponentConfigModel;