@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
@@ -0,0 +1,104 @@
1
+ .search-btn {
2
+ margin-right: 20px;
3
+ margin-left: auto;
4
+ }
5
+
6
+ .c-search {
7
+ position: relative;
8
+ height: 50px;
9
+
10
+ .c-search-simple {
11
+ display: flex;
12
+ justify-content: space-between;
13
+ }
14
+ .c-search-simple-form {
15
+ flex: 1; // 占满剩余空间
16
+ overflow: auto; // 开启滚动条
17
+ // 滚动条宽度
18
+ scrollbar-width: none; // 隐藏滚动条
19
+ }
20
+ .c-simple-form-container {
21
+ display: inline-block;
22
+ > .c-form {
23
+ white-space: nowrap; // 防止表单内容换行
24
+ }
25
+ }
26
+ .c-search-simple-btn {
27
+ display: flex;
28
+ margin-left: auto;
29
+ }
30
+
31
+ .c-search-simple-icon {
32
+ display: flex;
33
+ justify-content: center;
34
+ align-items: center;
35
+ cursor: pointer;
36
+ height: 32px;
37
+ width: 32px;
38
+ margin-right: 10px;
39
+ border-radius: 4px;
40
+ background-color: #409eff;
41
+ transition: all 0.2s;
42
+
43
+ &:hover {
44
+ background-color: rgb(121, 187, 255);
45
+ }
46
+
47
+ &:active {
48
+ background-color: rgb(51, 126, 204);
49
+ }
50
+ }
51
+
52
+ .c-search-icon {
53
+ // 添加鼠标悬停效果
54
+ color: #fff;
55
+ transition: all 0.2s;
56
+ }
57
+
58
+ .icon-rotate {
59
+ background-color: rgb(51, 126, 204);
60
+ .c-search-icon {
61
+ transform: rotate(180deg);
62
+ }
63
+ }
64
+
65
+ .c-search-form {
66
+ width: 100%;
67
+ position: absolute;
68
+ top: 50px;
69
+ left: 0;
70
+ overflow: hidden;
71
+ z-index: 10;
72
+ background-color: #fff;
73
+ }
74
+ }
75
+
76
+ /* 下拉动画效果 */
77
+ .search-form-transition {
78
+ &-enter-active,
79
+ &-leave-active {
80
+ transition: all 0.3s ease;
81
+ /* 动画过渡时间和缓动函数 */
82
+ overflow: hidden;
83
+ max-height: 500px;
84
+ /* 确保足够大的最大高度以容纳内容 */
85
+ }
86
+
87
+ &-enter-from {
88
+ max-height: 0;
89
+ /* 入场开始时高度为0 */
90
+ opacity: 0;
91
+ /* 可以添加透明度效果增强视觉体验 */
92
+ padding-top: 0;
93
+ padding-bottom: 0;
94
+ }
95
+
96
+ &-leave-to {
97
+ max-height: 0;
98
+ /* 出场结束时高度为0 */
99
+ opacity: 0;
100
+ /* 可以添加透明度效果增强视觉体验 */
101
+ padding-top: 0;
102
+ padding-bottom: 0;
103
+ }
104
+ }
@@ -0,0 +1,4 @@
1
+ import Table from "./src/index";
2
+ export * from "./src/index";
3
+ export { Table };
4
+ export default Table;
@@ -0,0 +1,116 @@
1
+ import {
2
+ defineComponent,
3
+ h,
4
+ getCurrentInstance,
5
+ type ExtractPropTypes,
6
+ } from "vue";
7
+ import { ElTableColumn } from "element-plus";
8
+ import {
9
+ defaultAttrs,
10
+ tableSlots,
11
+ tablecolumnSlots,
12
+ selectionColumn,
13
+ indexColumn,
14
+ } from "./constants.ts";
15
+ import { isArray, isObject } from "lodash-es";
16
+ const propsAttrs = {
17
+ module: {
18
+ // 公共参数用于业务判断
19
+ type: Object,
20
+ default: () => {},
21
+ },
22
+ // isRadio: { // 是否为单选框
23
+ // type: Boolean,
24
+ // default: false,
25
+ // },
26
+ // isCheckbox: { // 是否为复选框
27
+ // type: Boolean,
28
+ // default: false,
29
+ // },
30
+ columnsItem: {
31
+ // 列数据
32
+ type: Array,
33
+ default: () => [],
34
+ },
35
+ showSelection: {
36
+ // 是否显示选择列
37
+ type: Boolean,
38
+ default: false,
39
+ },
40
+ showIndex: {
41
+ // 是否显示索引列
42
+ type: Boolean,
43
+ default: false,
44
+ },
45
+ prop: {
46
+ // 列数据prop
47
+ type: String,
48
+ default: undefined,
49
+ },
50
+ // 字典 暂不实现
51
+ dictType: { type: String, default: undefined },
52
+ // 字典选项
53
+ options: { type: Array, default: () => [] },
54
+ };
55
+
56
+ export type PropsAttrs = ExtractPropTypes<typeof propsAttrs>;
57
+
58
+ export default defineComponent({
59
+ props: propsAttrs,
60
+ // emits: eventList,
61
+
62
+ // attrs, emit会继承, slots需要设置
63
+ setup(props: PropsAttrs, { attrs, emit, slots, expose }) {
64
+ const { tableSlots, events } = inject("tableContext");
65
+
66
+ // 属性处理
67
+ const getAttrs = () => {
68
+ const obj = {
69
+ ...defaultAttrs, // 设置默认值
70
+ };
71
+ return obj;
72
+ };
73
+ // 事件处理
74
+ const getEvents = () => {
75
+ const obj = {
76
+ ...defaultAttrs, // 设置默认值
77
+ };
78
+ return obj;
79
+ };
80
+ // 插槽处理
81
+ const getSlots = () => {
82
+ // 处理插槽
83
+ const obj = {};
84
+ // column 自带插槽
85
+ tablecolumnSlots.map((name) => {
86
+ const slotName = `${prop}.${name}`;
87
+ if (tableSlots[slotName]) {
88
+ obj[name] = tableSlots[slotName];
89
+ }
90
+ });
91
+ // column 列业务插槽
92
+ if (tableSlots[prop]) {
93
+ obj["default"] = tableSlots[prop];
94
+ }
95
+ return obj;
96
+ };
97
+
98
+ // 渲染表格列
99
+ const renderTableColumn = () => {
100
+ return h(
101
+ ElTableColumn,
102
+ {
103
+ ...attrs,
104
+ class: "c-table-column",
105
+ },
106
+ {
107
+ // default: () => renderTableColumn(),
108
+ // ...getSlots(),
109
+ }
110
+ );
111
+ };
112
+
113
+ // 返回渲染函数
114
+ return () => renderTableColumn();
115
+ },
116
+ });
@@ -0,0 +1,42 @@
1
+ export const defaultAttrs = {
2
+ // destroyOnClose: true,
3
+ };
4
+ export const tableEvents = [
5
+ "select",
6
+ "select-all",
7
+ "selection-change",
8
+ "cell-mouse-enter",
9
+ "cell-mouse-leave",
10
+ "cell-click",
11
+ "cell-dblclick",
12
+ "cell-contextmenu",
13
+ "row-click",
14
+ "row-contextmenu",
15
+ "row-dblclick",
16
+ "header-click",
17
+ "header-contextmenu",
18
+ "sort-change",
19
+ "filter-change",
20
+ "current-change",
21
+ "header-dragend",
22
+ "expand-change",
23
+ "scroll",
24
+ ];
25
+
26
+ export const tableSlots = ["default", "append", "empty"];
27
+ export const tablecolumnSlots = ["default", "header", "filter-icon", "expand"];
28
+
29
+ export const selectionColumn = {
30
+ type: "selection",
31
+ width: 50,
32
+ align: "center",
33
+ };
34
+ export const indexColumn = {
35
+ type: "index",
36
+ width: 50,
37
+ align: "center",
38
+ };
39
+ export const actionColumn = {
40
+ prop: "action",
41
+ align: "center",
42
+ };
@@ -0,0 +1,250 @@
1
+ import {
2
+ defineComponent,
3
+ h,
4
+ getCurrentInstance,
5
+ type ExtractPropTypes,
6
+ } from "vue";
7
+ import { ElTable, ElTableColumn } from "element-plus";
8
+ import TableDictLabel from "./tableDictLabel.vue";
9
+ import {
10
+ defaultAttrs,
11
+ tableSlots,
12
+ tablecolumnSlots,
13
+ selectionColumn,
14
+ indexColumn,
15
+ } from "./constants.ts";
16
+ import { isArray, isObject, isFunction } from "lodash-es";
17
+ const propsAttrs = {
18
+ module: {
19
+ type: Object,
20
+ default: () => {},
21
+ },
22
+ params: {
23
+ // 额外业务全局参数
24
+ type: Object,
25
+ default: () => {},
26
+ },
27
+ // isRadio: { // 是否为单选框
28
+ // type: Boolean,
29
+ // default: false,
30
+ // },
31
+ // isCheckbox: { // 是否为复选框
32
+ // type: Boolean,
33
+ // default: false,
34
+ // },
35
+ columns: {
36
+ // 列数据
37
+ type: Array,
38
+ default: () => [],
39
+ },
40
+ showSelection: {
41
+ // 是否显示选择列
42
+ type: Boolean,
43
+ default: false,
44
+ },
45
+ showIndex: {
46
+ // 是否显示索引列
47
+ type: Boolean,
48
+ default: false,
49
+ },
50
+ };
51
+
52
+ export type PropsAttrs = ExtractPropTypes<typeof propsAttrs>;
53
+
54
+ export default defineComponent({
55
+ props: propsAttrs,
56
+ // emits: eventList,
57
+
58
+ // attrs, emit会继承, slots需要设置
59
+ setup(props: PropsAttrs, { attrs, emit, slots, expose }) {
60
+ // 暴露elTable组件上的方法
61
+ const vm = getCurrentInstance(); // 获取虚拟DOM实例
62
+ const cTableFnRef = (el) => {
63
+ if (!el) return;
64
+ vm.exposed = el; // 设置暴露对象
65
+ vm.exposeProxy = el; // 设置代理暴露对象
66
+ };
67
+
68
+ // 暴露方法
69
+ // expose({
70
+ // // tableRef,
71
+ // });
72
+
73
+ // // 属性处理
74
+ // const getAttrs = () => {
75
+ // const obj = {
76
+ // ...defaultAttrs, // 设置默认值
77
+ // };
78
+ // return obj;
79
+ // };
80
+ // // 事件处理
81
+ // const getEvents = () => {
82
+ // const obj = {
83
+ // ...defaultAttrs, // 设置默认值
84
+ // };
85
+ // return obj;
86
+ // };
87
+
88
+ // // 处理列数据-数组
89
+ // const getArrayColumn = () => {
90
+ // // 递归处理数据
91
+ // const list = [];
92
+
93
+ // const columnsRecursion = (columns, list) => {
94
+ // columns?.map((item) => {
95
+ // const { children, ...p } = item;
96
+ // // 递归处理子列
97
+ // if (isArray(item.children)) {
98
+ // item.children = c(item.children, list);
99
+ // }
100
+ // list.push(p);
101
+ // });
102
+ // };
103
+ // columnsRecursion(props.columns, list);
104
+ // return list;
105
+ // };
106
+
107
+ // 渲染表格列
108
+ const renderTableColumn = () => {
109
+ const list = [];
110
+ // 处理多选与序号列
111
+ if (props.showSelection) {
112
+ list.push(
113
+ h(ElTableColumn, {
114
+ type: "selection",
115
+ width: 50,
116
+ align: "center",
117
+ })
118
+ );
119
+ }
120
+ if (props.showIndex) {
121
+ list.push(
122
+ h(ElTableColumn, {
123
+ label: "序号",
124
+ type: "index",
125
+ width: 60,
126
+ align: "center",
127
+ })
128
+ );
129
+ }
130
+
131
+ // 列递归渲染
132
+ const rColumn = (columns, list) => {
133
+ columns.map((item) => {
134
+ const { children, ...p } = item;
135
+ // 处理 vIf true 显示 false 隐藏
136
+ if (
137
+ isFunction(item.vIf) &&
138
+ item.vIf(props.params) !== undefined &&
139
+ !item.vIf(props.params)
140
+ ) {
141
+ return;
142
+ }
143
+
144
+ // 处理多级表头
145
+ const listSub = [];
146
+ if (children?.length) {
147
+ rColumn(children, listSub);
148
+ }
149
+
150
+ // 处理插槽
151
+ const itemSlot = {};
152
+ // column 自带插槽
153
+ tablecolumnSlots.map((name) => {
154
+ const slotName = `${item.prop}.${name}`;
155
+ if (slots[slotName]) {
156
+ itemSlot[name] = slots[slotName];
157
+ }
158
+ });
159
+
160
+ // column 列插槽
161
+ if (slots[item.prop]) {
162
+ itemSlot["default"] = slots[item.prop];
163
+ } else if (isFunction(item.render)) {
164
+ // column render 渲染函数
165
+ itemSlot["default"] = item.render;
166
+ } else if (isArray(item.options)) {
167
+ // column 字典数组
168
+ itemSlot["default"] = (scope: any) =>
169
+ h(TableDictLabel, {
170
+ options: item.options,
171
+ value: scope.row[item.prop],
172
+ });
173
+ }
174
+
175
+ // 赋值 有插槽
176
+ if (Object.keys(itemSlot).length) {
177
+ const getColumnContent = () => {
178
+ let content = undefined;
179
+ if (listSub.length) {
180
+ content = { ...itemSlot, default: () => listSub };
181
+ } else {
182
+ content = { ...itemSlot };
183
+ }
184
+ return content;
185
+ };
186
+ list.push(
187
+ h(
188
+ ElTableColumn,
189
+ { ...p, class: "c-table-column" },
190
+ getColumnContent()
191
+ )
192
+ );
193
+ } else {
194
+ const getColumnContent = () => {
195
+ let content = undefined;
196
+ if (listSub.length) {
197
+ content = { default: () => listSub };
198
+ }
199
+ return content;
200
+ };
201
+ // 无插槽
202
+ list.push(
203
+ h(
204
+ ElTableColumn,
205
+ { ...p, class: "c-table-column" },
206
+ getColumnContent()
207
+ )
208
+ );
209
+ }
210
+ });
211
+ };
212
+ rColumn(props.columns, list);
213
+ return list;
214
+ };
215
+
216
+ // 插槽处理
217
+ const getSlots = () => {
218
+ const obj = {};
219
+ tableSlots.map((name) => {
220
+ if (slots[name]) {
221
+ obj[name] = slots[name];
222
+ }
223
+ });
224
+ return obj;
225
+ };
226
+ // 渲染表格组件
227
+ const renderTable = () => {
228
+ // getColumnList();
229
+ // console.log("props", props);
230
+ // console.log("attrs", attrs);
231
+ // 先拼接好子数据不然会重复执行多次
232
+ const columnList = renderTableColumn();
233
+ return h(
234
+ ElTable,
235
+ {
236
+ ref: cTableFnRef,
237
+ ...attrs,
238
+ class: "c-table",
239
+ },
240
+ {
241
+ default: () => columnList,
242
+ ...getSlots(),
243
+ }
244
+ );
245
+ };
246
+
247
+ // 返回渲染函数
248
+ return () => renderTable();
249
+ },
250
+ });