@elementplus-kit/uikit 1.6.0 → 1.7.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 (65) hide show
  1. package/build.log +0 -0
  2. package/components/button/index.ts +4 -0
  3. package/components/button/src/constants.ts +50 -0
  4. package/components/button/src/index.ts +264 -0
  5. package/components/button/style/index.scss +3 -0
  6. package/components/config.ts +4 -0
  7. package/components/dialog/index.ts +6 -0
  8. package/components/dialog/src/constants.ts +3 -0
  9. package/components/dialog/src/index.ts +54 -0
  10. package/components/dialog/style/index.scss +18 -0
  11. package/components/dictLabel/index.ts +4 -0
  12. package/components/dictLabel/src/index.vue +21 -0
  13. package/components/drawer/index.ts +4 -0
  14. package/components/drawer/src/constants.ts +3 -0
  15. package/components/drawer/src/index.ts +53 -0
  16. package/components/drawer/style/index.scss +18 -0
  17. package/components/form/index.ts +4 -0
  18. package/components/form/src/FormItem.ts +398 -0
  19. package/components/form/src/constants.ts +161 -0
  20. package/components/form/src/index.ts +198 -0
  21. package/components/form/src/types.ts +39 -0
  22. package/components/form/src/utils.ts +4 -0
  23. package/components/form/style/index.scss +5 -0
  24. package/components/pagination/index.ts +4 -0
  25. package/components/pagination/src/constants.ts +5 -0
  26. package/components/pagination/src/index.ts +50 -0
  27. package/components/search/index.ts +4 -0
  28. package/components/search/src/index.tsx +294 -0
  29. package/components/search/style/index.scss +104 -0
  30. package/components/table/index.ts +4 -0
  31. package/components/table/src/TableColumn.ts +116 -0
  32. package/components/table/src/constants.ts +42 -0
  33. package/components/table/src/index.ts +250 -0
  34. package/components/table/src/index2.ts +219 -0
  35. package/components/table/src/index3.ts +233 -0
  36. package/components/table/src/tableDictLabel.vue +21 -0
  37. package/components/table/src/tableaa.ts +71 -0
  38. package/components/table/src/type.ts +0 -0
  39. package/components/table/type/index.scss +0 -0
  40. package/components/table2/index.ts +4 -0
  41. package/components/table2/src/config.ts +5 -0
  42. package/components/table2/src/index.ts +12 -0
  43. package/components/table2/src/render.ts +136 -0
  44. package/components/table2/src/types.ts +39 -0
  45. package/components/table2/style/index.scss +0 -0
  46. package/components//346/250/241/346/235/277/index.tsx +57 -0
  47. package/components//346/250/241/346/235/277/ttt.ts +66 -0
  48. package/components//346/250/241/346/235/277/ttt.vue +18 -0
  49. package/index.ts +2 -0
  50. package/package.json +1 -4
  51. package/vite.config.ts +30 -0
  52. package//345/205/266/344/273/226/core/dialog/elementPlus/dialogWarp.vue +151 -0
  53. package//345/205/266/344/273/226/core/dialog/index.ts +10 -0
  54. package//345/205/266/344/273/226/core/form/elementPlus/elementWarp.ts +15 -0
  55. package//345/205/266/344/273/226/core/form/elementPlus/elementWarp.vue +16 -0
  56. package//345/205/266/344/273/226/core/form/elementPlus/formRender.ts +55 -0
  57. package//345/205/266/344/273/226/core/form/index.ts +10 -0
  58. package//345/205/266/344/273/226/core/table/config.ts +5 -0
  59. package//345/205/266/344/273/226/core/table/render.ts +91 -0
  60. package//345/205/266/344/273/226/core/table/warp.ts +11 -0
  61. package//345/205/266/344/273/226/core/utils/fetch.ts +58 -0
  62. package//345/205/266/344/273/226/useMessage.ts +95 -0
  63. package/dist/index.css +0 -1
  64. package/dist/index.mjs +0 -1079
  65. package/dist/index.umd.js +0 -1
package/build.log ADDED
Binary file
@@ -0,0 +1,4 @@
1
+ import Button from "./src/index";
2
+ export * from "./src/index";
3
+ export { Button };
4
+ export default Button;
@@ -0,0 +1,50 @@
1
+ export const typeActiveMap = {
2
+ reset: {
3
+ name: "重置",
4
+ type: "info",
5
+ },
6
+ search: {
7
+ name: "查询",
8
+ type: "primary",
9
+ },
10
+ submit: {
11
+ name: "提交",
12
+ type: "primary",
13
+ },
14
+ save: {
15
+ name: "保存",
16
+ type: "primary",
17
+ },
18
+ create: {
19
+ name: "新增",
20
+ type: "primary",
21
+ },
22
+ delete: {
23
+ name: "删除",
24
+ type: "danger",
25
+ },
26
+ edit: {
27
+ name: "编辑",
28
+ type: "primary",
29
+ },
30
+ view: {
31
+ name: "查看",
32
+ type: "primary",
33
+ },
34
+ publish: {
35
+ name: "发布",
36
+ type: "primary",
37
+ },
38
+ import: {
39
+ name: "导入",
40
+ type: "primary",
41
+ },
42
+ export: {
43
+ name: "导出",
44
+ type: "primary",
45
+ },
46
+ exportAll: {
47
+ name: "导出全部",
48
+ type: "primary",
49
+ },
50
+ };
@@ -0,0 +1,264 @@
1
+ import { defineComponent, h, PropType } from "vue";
2
+ import {
3
+ ElButton,
4
+ ElDropdown,
5
+ ElDropdownMenu,
6
+ ElDropdownItem,
7
+ buttonProps,
8
+ } from "element-plus";
9
+
10
+ import "../style/index.scss";
11
+ import { typeActiveMap } from "./constants.ts";
12
+ import { has, isBoolean, isFunction, isArray } from "lodash-es";
13
+ import { tr } from "element-plus/es/locales.mjs";
14
+ export default defineComponent({
15
+ props: {
16
+ params: {
17
+ // 用于验证自定义函数的外部数据
18
+ type: Object,
19
+ default: () => ({}),
20
+ },
21
+ btnOptions: {
22
+ type: Array,
23
+ default: () => [],
24
+ },
25
+ // 权限验证函数
26
+ permit: {
27
+ type: Function,
28
+ },
29
+ size: {
30
+ type: String as PropType<"large" | "default" | "small">,
31
+ default: undefined,
32
+ },
33
+ plain: {
34
+ type: Boolean,
35
+ default: undefined,
36
+ },
37
+ text: {
38
+ type: Boolean,
39
+ default: undefined,
40
+ },
41
+ link: {
42
+ type: Boolean,
43
+ default: undefined,
44
+ },
45
+ // 折叠
46
+ fold: {
47
+ type: Boolean,
48
+ default: false,
49
+ },
50
+ // 折叠数量
51
+ foldNum: {
52
+ type: Number,
53
+ default: 0,
54
+ },
55
+ // // 权限函数
56
+ // hasRole: {
57
+ // type: Function,
58
+ // default: () => true
59
+ // },
60
+ },
61
+ emits: ["btnAction"],
62
+ setup(props, { emit, slots, attrs, expose }) {
63
+ // console.log('slots', slots);
64
+ // console.log('attrs', attrs);
65
+
66
+ // 解析按钮属性
67
+ const getAttrs = (item) => {
68
+ let defaultAttrs = {
69
+ size: props.size,
70
+ plain: props.plain,
71
+ text: props.text,
72
+ link: props.link,
73
+ class: `c-btn-alias-${item.alias || ""}`,
74
+ };
75
+
76
+ // 默认按钮类型 用样式控制?
77
+ // if (item?.alias && typeActiveMap[item.alias]) {
78
+ // defaultAttrs = {
79
+ // ...typeActiveMap[item.alias],
80
+ // ...defaultAttrs,
81
+ // };
82
+ // }
83
+
84
+ // 过滤掉非elbutton属性
85
+ const filterAttrsList = ["label", "alias", "permit", "vIf", "disable"];
86
+
87
+ Object.keys(item).map((key) => {
88
+ if (!filterAttrsList.includes(key)) {
89
+ defaultAttrs[key] = item[key];
90
+ }
91
+ });
92
+
93
+ // 处理禁用
94
+ if (isBoolean(item.disable)) {
95
+ defaultAttrs.disabled = item.disable;
96
+ }
97
+ if (
98
+ isFunction(item.disable) &&
99
+ item.disable(props.params) !== undefined
100
+ ) {
101
+ defaultAttrs.disabled = item.disable(props.params);
102
+ }
103
+ return defaultAttrs;
104
+ };
105
+ // 解析下拉菜单属性
106
+ const getDropdownAttrs = (item) => {
107
+ const obj = getAttrs(item);
108
+ const defaultAttrs = {
109
+ splitButton: true,
110
+ };
111
+ // 过滤下拉菜单属性
112
+ const l = [
113
+ "type",
114
+ "size",
115
+ "splitButton",
116
+ "disabled",
117
+ "placement",
118
+ "effect",
119
+ "trigger",
120
+ ];
121
+ l.forEach((key) => {
122
+ if (obj[key] !== undefined) {
123
+ defaultAttrs[key] = obj[key];
124
+ }
125
+ });
126
+ return defaultAttrs;
127
+ };
128
+ // 过滤权限与 vIf
129
+ const filterOptions = () => {
130
+ const list = [];
131
+ // 过滤权限
132
+ props.btnOptions.map((item) => {
133
+ if (
134
+ isArray(item.permit) &&
135
+ item.permit.length > 0 &&
136
+ isFunction(props.permit)
137
+ ) {
138
+ if (props.permit(item.permit)) {
139
+ list.push(item);
140
+ }
141
+ } else {
142
+ list.push(item);
143
+ }
144
+ });
145
+ const list2 = [];
146
+ // 过滤 vIf
147
+ list.map((item) => {
148
+ if (
149
+ has(item, "vIf") &&
150
+ isFunction(item.vIf) &&
151
+ item.vIf(props.params) !== undefined
152
+ ) {
153
+ if (item.vIf(props.params)) {
154
+ list2.push(item);
155
+ }
156
+ } else {
157
+ list2.push(item);
158
+ }
159
+ });
160
+ return list2;
161
+ };
162
+ // 按钮单个生成函数
163
+ const createBtn = (item) => {
164
+ return h(
165
+ ElButton,
166
+ {
167
+ ...getAttrs(item),
168
+ onClick: () => {
169
+ emit("btnAction", item.alias, props.params);
170
+ },
171
+ },
172
+ {
173
+ default: () => item?.label,
174
+ }
175
+ );
176
+ };
177
+ // 下拉菜单生成函数
178
+ const createDropdown = (finalList) => {
179
+ const dropdownList = []; // 不折叠的按钮
180
+ const dropdownMain = []; // 下拉占位
181
+ const dropdownItemList = []; // 折叠的按钮
182
+
183
+ finalList.map((itm, idx) => {
184
+ if (idx < props.foldNum) {
185
+ dropdownList.push(itm);
186
+ } else if (idx === props.foldNum) {
187
+ dropdownMain.push(itm);
188
+ } else {
189
+ dropdownItemList.push(itm);
190
+ }
191
+ });
192
+ // 处理只有一个下拉按钮的情况
193
+ if (dropdownMain.length > 0 && dropdownItemList.length === 0) {
194
+ dropdownList.push(dropdownMain[0]);
195
+ }
196
+
197
+ // 最终渲染的vdom
198
+ let renderVdom = [];
199
+ // 展示按钮vdom
200
+ const butsVdom = dropdownList.map((item) => {
201
+ return createBtn(item);
202
+ });
203
+
204
+ // 合并参数
205
+ if (butsVdom.length > 0) {
206
+ renderVdom = renderVdom.concat(butsVdom);
207
+ }
208
+
209
+ if (dropdownMain.length > 0 && dropdownItemList.length > 0) {
210
+ // 下拉菜单vdom
211
+ const dropdownVdom = h(
212
+ ElDropdown,
213
+ {
214
+ ...getDropdownAttrs(dropdownMain[0]),
215
+ class: "c-btn-dropdown",
216
+ buttonProps: getAttrs(dropdownMain[0]),
217
+ splitButton: true,
218
+ // splitButton: dropdownItemList.length > 0,
219
+ onClick: () => {
220
+ emit("btnAction", dropdownMain[0].alias, props.params);
221
+ },
222
+ onCommand: (command: string) => {
223
+ emit("btnAction", command, props.params);
224
+ },
225
+ },
226
+ {
227
+ default: () => {
228
+ return dropdownMain[0].label;
229
+ },
230
+ dropdown: () => {
231
+ return dropdownItemList.map((item) => {
232
+ return h(
233
+ ElDropdownItem,
234
+ {
235
+ command: item.alias,
236
+ },
237
+ {
238
+ default: () => item?.label,
239
+ }
240
+ );
241
+ });
242
+ },
243
+ }
244
+ );
245
+ renderVdom = renderVdom.concat(dropdownVdom);
246
+ }
247
+ return renderVdom;
248
+ };
249
+
250
+ const render = () => {
251
+ const finalList = filterOptions(); // 最终列表
252
+ // 是否折叠 折叠
253
+ if (props.fold) {
254
+ return createDropdown(finalList);
255
+ } else {
256
+ // 不折叠
257
+ return finalList.map((item) => {
258
+ return createBtn(item);
259
+ });
260
+ }
261
+ };
262
+ return () => render();
263
+ },
264
+ });
@@ -0,0 +1,3 @@
1
+ .el-button + .el-dropdown {
2
+ margin-left: 10px;
3
+ }
@@ -0,0 +1,4 @@
1
+ // 组件配置
2
+ // 组件名称前缀 组件标识 class 前缀
3
+ import { capitalize } from "lodash-es";
4
+ export const prefix = capitalize("C"); // 首字母大写 其他字母小写
@@ -0,0 +1,6 @@
1
+ import Dialog from "./src/index";
2
+ export * from "./src/index";
3
+ // 把变量 Dialog 导出为 CDialog
4
+ // export { Dialog, Dialog as CDialog };
5
+ export { Dialog };
6
+ export default Dialog;
@@ -0,0 +1,3 @@
1
+ export const defaultAttrs = {
2
+ destroyOnClose: true,
3
+ };
@@ -0,0 +1,54 @@
1
+ import {
2
+ defineComponent,
3
+ ref,
4
+ h,
5
+ computed,
6
+ toRefs,
7
+ type ExtractPropTypes,
8
+ } from "vue";
9
+ import { ElDialog } from "element-plus";
10
+ import { defaultAttrs } from "./constants.ts";
11
+ import { prefix } from "../../config.ts";
12
+ const propsAttrs = {};
13
+
14
+ export type PropsAttrs = ExtractPropTypes<typeof propsAttrs>;
15
+
16
+ export default defineComponent({
17
+ name: `${prefix}Dialog`,
18
+ // props: propsAttrs,
19
+ // emits: eventList,
20
+
21
+ // attrs, emit会继承, slots需要设置
22
+ setup(props: PropsAttrs, { attrs, emit, slots, expose }) {
23
+ // const dialogRef = ref();
24
+
25
+ // 暴露方法
26
+ // expose({
27
+ // dialogRef,
28
+ // });
29
+
30
+ // 属性处理
31
+ const getAttrs = () => {
32
+ const obj = {
33
+ ...defaultAttrs, // 设置默认值
34
+ };
35
+ return obj;
36
+ };
37
+
38
+ // 渲染组件
39
+ const render = () => {
40
+ return h(
41
+ ElDialog,
42
+ {
43
+ // ref: dialogRef,
44
+ ...getAttrs(),
45
+ class: "c-dialog",
46
+ },
47
+ slots
48
+ );
49
+ };
50
+
51
+ // 返回渲染函数
52
+ return () => render();
53
+ },
54
+ });
@@ -0,0 +1,18 @@
1
+ /* Bounce Animation */
2
+ .dialog-bounce-enter-active,
3
+ .dialog-bounce-leave-active,
4
+ .dialog-bounce-enter-active .el-dialog,
5
+ .dialog-bounce-leave-active .el-dialog {
6
+ transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
7
+ }
8
+
9
+ .dialog-bounce-enter-from,
10
+ .dialog-bounce-leave-to {
11
+ opacity: 0;
12
+ }
13
+
14
+ .dialog-bounce-enter-from .el-dialog,
15
+ .dialog-bounce-leave-to .el-dialog {
16
+ transform: scale(0.3) translateY(-50px);
17
+ opacity: 0;
18
+ }
@@ -0,0 +1,4 @@
1
+ import DictLabel from "./src/index.vue";
2
+ export * from "./src/index.vue";
3
+ export { DictLabel };
4
+ export default DictLabel;
@@ -0,0 +1,21 @@
1
+ <template>
2
+ {{ label }}
3
+ </template>
4
+ <script setup lang="ts">
5
+ import { computed, PropType } from 'vue'
6
+ const props = defineProps({
7
+ options: {
8
+ type: Array,
9
+ default: () => []
10
+ },
11
+ value: {
12
+ type: String as PropType<any>,
13
+ default: ''
14
+ },
15
+ })
16
+ const label = computed(() => {
17
+ // 处理value为数字的情况 后端字典都是字符串
18
+ const item = props.options?.find((item) => item.value == props.value.toString());
19
+ return item?.label || props.value;
20
+ });
21
+ </script>
@@ -0,0 +1,4 @@
1
+ import Drawer from "./src/index";
2
+ export * from "./src/index";
3
+ export { Drawer };
4
+ export default Drawer;
@@ -0,0 +1,3 @@
1
+ export const defaultAttrs = {
2
+ destroyOnClose: true,
3
+ };
@@ -0,0 +1,53 @@
1
+ import {
2
+ defineComponent,
3
+ ref,
4
+ h,
5
+ computed,
6
+ toRefs,
7
+ type ExtractPropTypes,
8
+ } from "vue";
9
+ import { ElDrawer } from "element-plus";
10
+ import { defaultAttrs } from "./constants.ts";
11
+
12
+ const propsAttrs = {};
13
+
14
+ export type PropsAttrs = ExtractPropTypes<typeof propsAttrs>;
15
+
16
+ export default defineComponent({
17
+ // props: propsAttrs,
18
+ // emits: eventList,
19
+
20
+ // attrs, emit会继承, slots需要设置
21
+ setup(props: PropsAttrs, { attrs, emit, slots, expose }) {
22
+ // const drawerRef = ref();
23
+
24
+ // 暴露方法
25
+ // expose({
26
+ // drawerRef,
27
+ // });
28
+
29
+ // 属性处理
30
+ const getAttrs = () => {
31
+ const obj = {
32
+ ...defaultAttrs, // 设置默认值
33
+ };
34
+ return obj;
35
+ };
36
+
37
+ // 渲染组件
38
+ const render = () => {
39
+ return h(
40
+ ElDrawer,
41
+ {
42
+ // ref: drawerRef,
43
+ ...getAttrs(),
44
+ class: "c-drawer",
45
+ },
46
+ slots
47
+ );
48
+ };
49
+
50
+ // 返回渲染函数
51
+ return () => render();
52
+ },
53
+ });
@@ -0,0 +1,18 @@
1
+ // /* Bounce Animation */
2
+ // .dialog-bounce-enter-active,
3
+ // .dialog-bounce-leave-active,
4
+ // .dialog-bounce-enter-active .el-dialog,
5
+ // .dialog-bounce-leave-active .el-dialog {
6
+ // transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
7
+ // }
8
+
9
+ // .dialog-bounce-enter-from,
10
+ // .dialog-bounce-leave-to {
11
+ // opacity: 0;
12
+ // }
13
+
14
+ // .dialog-bounce-enter-from .el-dialog,
15
+ // .dialog-bounce-leave-to .el-dialog {
16
+ // transform: scale(0.3) translateY(-50px);
17
+ // opacity: 0;
18
+ // }
@@ -0,0 +1,4 @@
1
+ import Form from "./src/index";
2
+ export * from "./src/index";
3
+ export { Form };
4
+ export default Form;