hy-dispatch-ui-v3 0.2.33 → 0.2.35
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.
- package/dist/tailwind.css +20 -8
- package/es/components/hyAudioPlayer/audioPlayer.vue.mjs +1 -1
- package/es/components/hyAudioPlayer/js/index.mjs +1 -1
- package/es/components/hyButton/button.vue.mjs +49 -34
- package/es/components/hyConfirmDialog/confirmDialog.vue.mjs +1 -1
- package/es/components/hyConfirmDialog/confirmMethod.mjs +1 -1
- package/es/components/hyConfirmDialog/index.mjs +1 -1
- package/es/components/hyCutter/cutter.vue.mjs +1 -1
- package/es/components/hyDatePicker/datePicker.vue.mjs +1 -1
- package/es/components/hyDialog/dialog.vue.mjs +176 -137
- package/es/components/hyDialog/style/dialog.scss +13 -0
- package/es/components/hyForm/cpns/formItem.vue.mjs +3 -4
- package/es/components/hyForm/js/useAppForm.mjs +1 -1
- package/es/components/hyForm/style/form.scss +0 -4
- package/es/components/hyNoPermissions/noPermissions.vue.mjs +1 -1
- package/es/components/hyNoPermissionsMap/noPermissionsMap.vue.mjs +1 -1
- package/es/components/hyOrgCascader/orgCascader.vue.mjs +1 -1
- package/es/components/hySearch/cpns/searchItem.vue.mjs +3 -9
- package/es/components/hySearch/js/index.mjs +4 -4
- package/es/components/hySearch/style/search.scss +1 -0
- package/es/components/hyTable/cpns/columnSelect.vue.mjs +67 -86
- package/es/components/hyTable/cpns/columnSelectItem.vue.mjs +5 -8
- package/es/components/hyTable/cpns/headerItem.vue.mjs +1 -1
- package/es/components/hyTable/cpns/virtualTable.vue.mjs +8 -12
- package/es/components/hyTable/js/index.mjs +70 -54
- package/es/components/hyTable/js/useAppTable.mjs +20 -6
- package/es/components/hyTable/style/table.scss +22 -4
- package/es/components/hyTable/table.vue.mjs +22 -18
- package/es/components/hyTableForm/js/useAppTableForm.mjs +1 -1
- package/es/components/hyTableForm/tableForm.vue.mjs +3 -3
- package/es/components/hyTooltip/tooltip.vue.mjs +4 -4
- package/es/components/hyTree/style/index.css +1 -0
- package/es/components/hyTree/tree.vue.mjs +2 -0
- package/es/components/hyUserAvatar/userAvatar.vue.mjs +2 -2
- package/es/components/hyVideoPlayer/js/index.mjs +1 -1
- package/es/locale/en.mjs +1 -1
- package/es/locale/zh_CN.mjs +1 -1
- package/es/style/element/hy-element.scss +3 -2
- package/es/version.mjs +1 -1
- package/lib/components/hyAudioPlayer/js/index.js +1 -1
- package/lib/components/hyButton/button.vue.js +49 -34
- package/lib/components/hyConfirmDialog/confirmDialog.vue.js +1 -1
- package/lib/components/hyConfirmDialog/confirmMethod.js +1 -1
- package/lib/components/hyConfirmDialog/index.js +1 -1
- package/lib/components/hyCutter/cutter.vue.js +1 -1
- package/lib/components/hyDatePicker/datePicker.vue.js +1 -1
- package/lib/components/hyDialog/dialog.vue.js +175 -136
- package/lib/components/hyDialog/style/dialog.scss +13 -0
- package/lib/components/hyForm/cpns/formItem.vue.js +3 -4
- package/lib/components/hyForm/js/useAppForm.js +1 -1
- package/lib/components/hyForm/style/form.scss +0 -4
- package/lib/components/hyNoPermissions/noPermissions.vue.js +1 -1
- package/lib/components/hyNoPermissionsMap/noPermissionsMap.vue.js +1 -1
- package/lib/components/hyOrgCascader/orgCascader.vue.js +1 -1
- package/lib/components/hySearch/cpns/searchItem.vue.js +3 -9
- package/lib/components/hySearch/js/index.js +4 -4
- package/lib/components/hySearch/style/search.scss +1 -0
- package/lib/components/hyTable/cpns/columnSelect.vue.js +70 -89
- package/lib/components/hyTable/cpns/columnSelectItem.vue.js +4 -7
- package/lib/components/hyTable/cpns/headerItem.vue.js +1 -1
- package/lib/components/hyTable/cpns/virtualTable.vue.js +8 -12
- package/lib/components/hyTable/js/index.js +69 -53
- package/lib/components/hyTable/js/useAppTable.js +20 -6
- package/lib/components/hyTable/style/table.scss +22 -4
- package/lib/components/hyTable/table.vue.js +21 -17
- package/lib/components/hyTableForm/js/useAppTableForm.js +1 -1
- package/lib/components/hyTableForm/tableForm.vue.js +3 -3
- package/lib/components/hyTooltip/tooltip.vue.js +4 -4
- package/lib/components/hyTree/style/index.css +1 -0
- package/lib/components/hyTree/tree.vue.js +2 -0
- package/lib/components/hyUserAvatar/userAvatar.vue.js +2 -2
- package/lib/components/hyVideoPlayer/js/index.js +1 -1
- package/lib/locale/en.js +1 -1
- package/lib/locale/zh_CN.js +1 -1
- package/lib/style/element/hy-element.scss +3 -2
- package/lib/version.js +1 -1
- package/package.json +1 -1
|
@@ -6,10 +6,11 @@ var vue = require('vue');
|
|
|
6
6
|
var Sortable = require('sortablejs');
|
|
7
7
|
var elementPlus = require('element-plus');
|
|
8
8
|
var iconsVue = require('@element-plus/icons-vue');
|
|
9
|
-
var index
|
|
9
|
+
var index = require('../js/index.js');
|
|
10
10
|
var columnSelectItem = require('./columnSelectItem.vue.js');
|
|
11
11
|
var useLocale = require('../../../hooks/useLocale.js');
|
|
12
|
-
var index = require('../../
|
|
12
|
+
var index$1 = require('../../hyTooltip/index.js');
|
|
13
|
+
var index$2 = require('../../hyButton/index.js');
|
|
13
14
|
var is = require('../../../utils/is.js');
|
|
14
15
|
|
|
15
16
|
const _sfc_main = {
|
|
@@ -39,11 +40,11 @@ const _sfc_main = {
|
|
|
39
40
|
const tableEditableColumns = vue.ref([]);
|
|
40
41
|
const showColumnsLength = vue.computed(() => {
|
|
41
42
|
return (tableColumns.value || []).reduce((total, column) => {
|
|
42
|
-
return total + (
|
|
43
|
+
return total + (isShowColumn(column) ? 1 : 0);
|
|
43
44
|
}, 0);
|
|
44
45
|
});
|
|
45
|
-
function
|
|
46
|
-
return
|
|
46
|
+
function isShowColumn(column) {
|
|
47
|
+
return index.tableColumnShowHandler(column) && column.editable.edit;
|
|
47
48
|
}
|
|
48
49
|
function showPopover() {
|
|
49
50
|
initColumnsInfo(props.columns, props.columnsEditable);
|
|
@@ -56,26 +57,20 @@ const _sfc_main = {
|
|
|
56
57
|
popoverRef.value?.hide?.();
|
|
57
58
|
}
|
|
58
59
|
function initColumnsInfo(columns, columnsEditable) {
|
|
60
|
+
const columnArr = [];
|
|
59
61
|
const checkedArr = [];
|
|
60
|
-
|
|
61
|
-
if (
|
|
62
|
-
|
|
62
|
+
for (const column of columns) {
|
|
63
|
+
if (isShowColumn(column) && !column.editable.lock) {
|
|
64
|
+
columnArr.push({
|
|
63
65
|
...column,
|
|
64
|
-
sortIndex:
|
|
66
|
+
sortIndex: columnsEditable[column.prop].sortIndex
|
|
65
67
|
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
for (const key in columnsEditable || {}) {
|
|
70
|
-
const target = columnsEditable[key];
|
|
71
|
-
const { column } = target;
|
|
72
|
-
if (isFilterColumn(column) || column.editable.lock) {
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
if (target.checked) {
|
|
76
|
-
checkedArr.push(column.prop);
|
|
68
|
+
if (columnsEditable[column.prop].checked) {
|
|
69
|
+
checkedArr.push(column.prop);
|
|
70
|
+
}
|
|
77
71
|
}
|
|
78
72
|
}
|
|
73
|
+
tableEditableColumns.value = columnArr;
|
|
79
74
|
checkedList.value = checkedArr;
|
|
80
75
|
}
|
|
81
76
|
const showClear = vue.ref(true);
|
|
@@ -108,7 +103,7 @@ const _sfc_main = {
|
|
|
108
103
|
}
|
|
109
104
|
const editableObj = tableEditableColumns.value.reduce(
|
|
110
105
|
(editableObj2, column) => {
|
|
111
|
-
editableObj2[column.prop].
|
|
106
|
+
editableObj2[column.prop].sortIndex = column.sortIndex;
|
|
112
107
|
editableObj2[column.prop].checked = checkMap.value.has(column.prop);
|
|
113
108
|
return editableObj2;
|
|
114
109
|
},
|
|
@@ -118,7 +113,7 @@ const _sfc_main = {
|
|
|
118
113
|
closePopover();
|
|
119
114
|
}
|
|
120
115
|
function onClearHandler() {
|
|
121
|
-
const { columnsList, columnsEditablele } = index
|
|
116
|
+
const { columnsList, columnsEditablele } = index.tableColumnHandler(
|
|
122
117
|
props.originColumns
|
|
123
118
|
);
|
|
124
119
|
initColumnsInfo(columnsList, columnsEditablele);
|
|
@@ -136,29 +131,19 @@ const _sfc_main = {
|
|
|
136
131
|
const { oldIndex, newIndex } = event;
|
|
137
132
|
if (is.isEmpty(oldIndex) || is.isEmpty(newIndex) || oldIndex === newIndex)
|
|
138
133
|
return;
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
tableEditableColumns.value.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
} else {
|
|
153
|
-
tableEditableColumns.value.splice(
|
|
154
|
-
newIndex,
|
|
155
|
-
1,
|
|
156
|
-
tableEditableColumns.value.splice(
|
|
157
|
-
oldIndex,
|
|
158
|
-
1,
|
|
159
|
-
tableEditableColumns.value[newIndex]
|
|
160
|
-
)[0]
|
|
161
|
-
);
|
|
134
|
+
const minIndex = Math.min(oldIndex, newIndex);
|
|
135
|
+
const maxIndex = Math.max(oldIndex, newIndex);
|
|
136
|
+
const sortList = [];
|
|
137
|
+
for (let i = minIndex; i <= maxIndex; i++) {
|
|
138
|
+
sortList[i] = tableEditableColumns.value[i].sortIndex;
|
|
139
|
+
}
|
|
140
|
+
tableEditableColumns.value.splice(
|
|
141
|
+
newIndex,
|
|
142
|
+
0,
|
|
143
|
+
tableEditableColumns.value.splice(oldIndex, 1)[0]
|
|
144
|
+
);
|
|
145
|
+
for (let i = minIndex; i <= maxIndex; i++) {
|
|
146
|
+
tableEditableColumns.value[i].sortIndex = sortList[i];
|
|
162
147
|
}
|
|
163
148
|
showClear.value = true;
|
|
164
149
|
}
|
|
@@ -232,7 +217,7 @@ const _sfc_main = {
|
|
|
232
217
|
/* STABLE */
|
|
233
218
|
})
|
|
234
219
|
]),
|
|
235
|
-
vue.createElementVNode("div", { class: "h-[364px] px-4 pt-[11px] pb-1 overflow-y-auto" }, [
|
|
220
|
+
vue.createElementVNode("div", { class: "h-[364px] px-4 pt-[11px] pb-1 scroll-body overflow-y-auto" }, [
|
|
236
221
|
vue.createVNode(vue.unref(elementPlus.ElCheckboxGroup), {
|
|
237
222
|
modelValue: checkedList.value,
|
|
238
223
|
"onUpdate:modelValue": ($event) => checkedList.value = $event
|
|
@@ -253,7 +238,7 @@ const _sfc_main = {
|
|
|
253
238
|
vue.Fragment,
|
|
254
239
|
{ key: index },
|
|
255
240
|
[
|
|
256
|
-
|
|
241
|
+
isShowColumn(item) && item.editable.lock ? (vue.openBlock(), vue.createBlock(columnSelectItem.default, {
|
|
257
242
|
key: 0,
|
|
258
243
|
column: item,
|
|
259
244
|
checkMap: checkMap.value
|
|
@@ -303,49 +288,45 @@ const _sfc_main = {
|
|
|
303
288
|
/* STABLE */
|
|
304
289
|
}, 8, ["modelValue", "onUpdate:modelValue"])
|
|
305
290
|
]),
|
|
306
|
-
vue.createElementVNode("div", { class: "flex items-center pt-[5px] pb-4 pl-[14px] pr-3" }, [
|
|
307
|
-
vue.createElementVNode(
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
291
|
+
vue.createElementVNode("div", { class: "flex items-center pt-[5px] pb-4 pl-[14px] pr-3 overflow-hidden" }, [
|
|
292
|
+
vue.createElementVNode("div", { class: "flex items-center" }, [
|
|
293
|
+
vue.createElementVNode(
|
|
294
|
+
"span",
|
|
295
|
+
null,
|
|
296
|
+
vue.toDisplayString(vue.unref(t)("table.selectedNumberItems", [checkedList.value?.length || 0])),
|
|
297
|
+
1
|
|
298
|
+
/* TEXT */
|
|
299
|
+
),
|
|
300
|
+
showClear.value ? (vue.openBlock(), vue.createElementBlock(
|
|
301
|
+
"span",
|
|
302
|
+
{
|
|
303
|
+
key: 0,
|
|
304
|
+
class: "clickBox text-danger-2 ml-3",
|
|
305
|
+
onClick: onClearHandler
|
|
306
|
+
},
|
|
307
|
+
vue.toDisplayString(vue.unref(t)("table.clear")),
|
|
308
|
+
1
|
|
309
|
+
/* TEXT */
|
|
310
|
+
)) : vue.createCommentVNode("v-if", true)
|
|
311
|
+
]),
|
|
312
|
+
vue.createElementVNode("div", { class: "w-0 flex-1 flex items-center justify-end ml-3" }, [
|
|
313
|
+
vue.createVNode(vue.unref(elementPlus.ElIcon), {
|
|
314
|
+
class: "mr-1.5",
|
|
315
|
+
color: "rgb(var(--hy-auxiliary))"
|
|
316
|
+
}, {
|
|
317
|
+
default: vue.withCtx(() => [
|
|
318
|
+
vue.createVNode(vue.unref(iconsVue.Warning))
|
|
319
|
+
]),
|
|
320
|
+
_: 1
|
|
321
|
+
/* STABLE */
|
|
322
|
+
}),
|
|
323
|
+
checkedList.value?.length >= 8 ? (vue.openBlock(), vue.createBlock(vue.unref(index$1.HyTooltip), {
|
|
327
324
|
key: 0,
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}, {
|
|
334
|
-
default: vue.withCtx(() => [
|
|
335
|
-
vue.createVNode(vue.unref(iconsVue.Warning))
|
|
336
|
-
]),
|
|
337
|
-
_: 1
|
|
338
|
-
/* STABLE */
|
|
339
|
-
}),
|
|
340
|
-
vue.createElementVNode(
|
|
341
|
-
"span",
|
|
342
|
-
null,
|
|
343
|
-
vue.toDisplayString(vue.unref(t)("table.tooManyFieldsWillAffectReadability")),
|
|
344
|
-
1
|
|
345
|
-
/* TEXT */
|
|
346
|
-
)
|
|
347
|
-
])) : vue.createCommentVNode("v-if", true),
|
|
348
|
-
vue.createVNode(vue.unref(index.HyButton), {
|
|
325
|
+
"is-always": false,
|
|
326
|
+
content: vue.unref(t)("table.tooManyFieldsWillAffectReadability"),
|
|
327
|
+
class: "mr-2 text-auxiliary"
|
|
328
|
+
}, null, 8, ["content"])) : vue.createCommentVNode("v-if", true),
|
|
329
|
+
vue.createVNode(vue.unref(index$2.HyButton), {
|
|
349
330
|
type: "primary",
|
|
350
331
|
size: "small",
|
|
351
332
|
onClick: onConfirmHandler
|
|
@@ -94,16 +94,13 @@ const _sfc_main = {
|
|
|
94
94
|
)),
|
|
95
95
|
__props.columnsLength > 1 ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
96
96
|
key: 2,
|
|
97
|
-
class: "
|
|
97
|
+
class: "h-full flex items-center justify-center handle cursor-grab ml-3",
|
|
98
98
|
onClick: vue.withModifiers(() => {
|
|
99
99
|
}, ["stop"])
|
|
100
100
|
}, [
|
|
101
|
-
vue.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
]),
|
|
105
|
-
_: 1
|
|
106
|
-
/* STABLE */
|
|
101
|
+
vue.createElementVNode("div", {
|
|
102
|
+
class: "w-5 h-2.5",
|
|
103
|
+
style: { "background": "radial-gradient(\n circle,\n rgba(var(--hy-theme)) 1px,\n transparent 2px\n )\n 0px 0px / 5px 5px" }
|
|
107
104
|
})
|
|
108
105
|
], 8, ["onClick"])) : vue.createCommentVNode("v-if", true)
|
|
109
106
|
])) : vue.createCommentVNode("v-if", true)
|
|
@@ -94,7 +94,7 @@ const _sfc_main = {
|
|
|
94
94
|
}, 8, ["color", "onClick"])
|
|
95
95
|
]),
|
|
96
96
|
vue.renderSlot(_ctx.$slots, "default")
|
|
97
|
-
], 8, ["onClick"])) : vue.renderSlot(_ctx.$slots, "default", {
|
|
97
|
+
], 8, ["onClick"])) : vue.renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 1);
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
100
|
};
|
|
@@ -312,8 +312,8 @@ const _sfc_main = {
|
|
|
312
312
|
width: __props.width,
|
|
313
313
|
height: __props.height,
|
|
314
314
|
"header-height": __props.showHeader ? 44 : 0,
|
|
315
|
-
"row-height":
|
|
316
|
-
"estimated-row-height":
|
|
315
|
+
"row-height": 64,
|
|
316
|
+
"estimated-row-height": 64,
|
|
317
317
|
"expand-column-key": expandColumn.value?.key,
|
|
318
318
|
fixed: "",
|
|
319
319
|
"row-class": rowClass,
|
|
@@ -359,9 +359,8 @@ const _sfc_main = {
|
|
|
359
359
|
row: vue.withCtx(({ columns, depth, rowData: row, rowIndex: $index }) => [
|
|
360
360
|
vue.createCommentVNode(" \u5C55\u5F00\u5185\u5BB9 "),
|
|
361
361
|
depth > 0 && isExpandTable.value ? vue.renderSlot(_ctx.$slots, expandColumn.value.slot, {
|
|
362
|
-
key: 0,
|
|
363
362
|
row: dataSourceMap.value.get(row.dataKey)
|
|
364
|
-
}) : (vue.openBlock(), vue.createElementBlock(
|
|
363
|
+
}, void 0, void 0, 0) : (vue.openBlock(), vue.createElementBlock(
|
|
365
364
|
vue.Fragment,
|
|
366
365
|
{ key: 1 },
|
|
367
366
|
[
|
|
@@ -426,10 +425,7 @@ const _sfc_main = {
|
|
|
426
425
|
indeterminate: indeterminateKeys.value.has(getRowKey(row)),
|
|
427
426
|
disabled: !isSelectable(row),
|
|
428
427
|
onClick: vue.withModifiers(($event) => switchCheckHandler(row), ["stop"])
|
|
429
|
-
}, null, 8, ["model-value", "indeterminate", "disabled", "onClick"])) : column?.slot && (column.type !== "expand" || !isExpandTable.value) ? vue.renderSlot(_ctx.$slots, column?.slot, vue.mergeProps({
|
|
430
|
-
key: 2,
|
|
431
|
-
ref_for: true
|
|
432
|
-
}, { column, row, $index, cellIndex })) : column.type === "index" ? (vue.openBlock(), vue.createElementBlock(
|
|
428
|
+
}, null, 8, ["model-value", "indeterminate", "disabled", "onClick"])) : column?.slot && (column.type !== "expand" || !isExpandTable.value) ? vue.renderSlot(_ctx.$slots, column?.slot, vue.mergeProps({ ref_for: true }, { column, row, $index, cellIndex }), void 0, void 0, 2) : column.type === "index" ? (vue.openBlock(), vue.createElementBlock(
|
|
433
429
|
vue.Fragment,
|
|
434
430
|
{ key: 3 },
|
|
435
431
|
[
|
|
@@ -443,7 +439,7 @@ const _sfc_main = {
|
|
|
443
439
|
/* STABLE_FRAGMENT */
|
|
444
440
|
)) : column.type === "operator" ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
445
441
|
key: 4,
|
|
446
|
-
class: "w-full flex items-center justify-
|
|
442
|
+
class: "w-full flex items-center justify-end gap-3 text-main",
|
|
447
443
|
onClick: vue.withModifiers(() => {
|
|
448
444
|
}, ["stop"]),
|
|
449
445
|
onContextmenu: vue.withModifiers(() => {
|
|
@@ -461,7 +457,7 @@ const _sfc_main = {
|
|
|
461
457
|
key: cindex,
|
|
462
458
|
"is-always": "",
|
|
463
459
|
overLine: 1,
|
|
464
|
-
content: citem.
|
|
460
|
+
content: citem.desc
|
|
465
461
|
}, {
|
|
466
462
|
default: vue.withCtx(() => [
|
|
467
463
|
vue.createElementVNode("div", {
|
|
@@ -477,13 +473,13 @@ const _sfc_main = {
|
|
|
477
473
|
"svg-name": citem.svgName,
|
|
478
474
|
"class-name": "!w-4 !h-4"
|
|
479
475
|
}, null, 8, ["svg-name"]),
|
|
480
|
-
citem.
|
|
476
|
+
citem.label ? (vue.openBlock(), vue.createElementBlock(
|
|
481
477
|
"div",
|
|
482
478
|
{
|
|
483
479
|
key: 0,
|
|
484
480
|
class: "mt-1 whitespace-nowrap"
|
|
485
481
|
},
|
|
486
|
-
vue.toDisplayString(citem.
|
|
482
|
+
vue.toDisplayString(citem.label),
|
|
487
483
|
1
|
|
488
484
|
/* TEXT */
|
|
489
485
|
)) : (vue.openBlock(), vue.createElementBlock("div", {
|
|
@@ -15,67 +15,67 @@ function tableColumnShowHandler(column) {
|
|
|
15
15
|
if (is.isFunction(show)) return show(column);
|
|
16
16
|
return true;
|
|
17
17
|
}
|
|
18
|
-
function tableColumnsEditableleHandler(columns, columnsEditablele
|
|
19
|
-
const searchLabelSet = /* @__PURE__ */ new Set();
|
|
18
|
+
function tableColumnsEditableleHandler(columns, columnsEditablele) {
|
|
20
19
|
const columnsEditableleObj = {};
|
|
20
|
+
const sortSet = /* @__PURE__ */ new Set();
|
|
21
21
|
for (const column of columns) {
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
if (!columnsEditableleObj[
|
|
26
|
-
columnsEditableleObj[
|
|
22
|
+
const columnsEditableleItem = columnsEditablele[column.prop];
|
|
23
|
+
const { sortIndex } = columnsEditableleItem;
|
|
24
|
+
sortSet.add(sortIndex);
|
|
25
|
+
if (!columnsEditableleObj[sortIndex]) {
|
|
26
|
+
columnsEditableleObj[sortIndex] = [];
|
|
27
27
|
}
|
|
28
|
-
columnsEditableleObj[
|
|
29
|
-
|
|
28
|
+
columnsEditableleObj[sortIndex].push({
|
|
29
|
+
editable: columnsEditableleItem,
|
|
30
30
|
column
|
|
31
31
|
});
|
|
32
|
-
if (column.isSearch) {
|
|
33
|
-
searchLabelSet.add(column.label);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
if (searchArr?.length > 0) {
|
|
37
|
-
searchArr.forEach((item) => {
|
|
38
|
-
searchLabelSet.add(item.label);
|
|
39
|
-
});
|
|
40
32
|
}
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
Array.from(sortSet.values()).reduce((a, b) => a - b);
|
|
34
|
+
const columnsList = Object.keys(columnsEditableleObj).reduce(
|
|
35
|
+
(columnsList2, key) => {
|
|
43
36
|
const list = columnsEditableleObj[key];
|
|
44
37
|
for (let i = 0; i < list.length; i++) {
|
|
45
38
|
const target = list[i];
|
|
46
|
-
|
|
47
|
-
...target,
|
|
48
|
-
index: columnsList.length + i
|
|
49
|
-
};
|
|
50
|
-
columnsList.push(target.column);
|
|
39
|
+
columnsList2.push(target.column);
|
|
51
40
|
}
|
|
52
|
-
return
|
|
41
|
+
return columnsList2;
|
|
53
42
|
},
|
|
54
|
-
|
|
55
|
-
columnsEditablele: {},
|
|
56
|
-
columnsList: [],
|
|
57
|
-
searchText: Array.from(searchLabelSet.values()).join("\u3001")
|
|
58
|
-
}
|
|
43
|
+
[]
|
|
59
44
|
);
|
|
45
|
+
return {
|
|
46
|
+
columnsList,
|
|
47
|
+
columnsEditablele
|
|
48
|
+
};
|
|
60
49
|
}
|
|
61
|
-
function tableColumnHandler(columns, cacheKey
|
|
62
|
-
const cacheColumnsValue = cacheKey ? JSON.parse(sessionStorage.getItem(cacheKey) || "{}") :
|
|
50
|
+
function tableColumnHandler(columns, cacheKey) {
|
|
51
|
+
const cacheColumnsValue = cacheKey && sessionStorage.getItem(cacheKey) ? JSON.parse(sessionStorage.getItem(cacheKey) || "{}") : null;
|
|
52
|
+
const otherColumns = [];
|
|
53
|
+
let maxIndex = 0;
|
|
63
54
|
const cacheColumnsEditablele = columns.reduce((obj, column) => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
55
|
+
const { editable, prop, type, permission } = column;
|
|
56
|
+
if (cacheColumnsValue && (!cacheColumnsValue[prop] || type === "operator") || permission && !is.isPermission(permission)) {
|
|
57
|
+
otherColumns.push(column);
|
|
58
|
+
} else {
|
|
59
|
+
let { sortIndex, checked } = cacheColumnsValue?.[prop] || {};
|
|
60
|
+
obj[prop] = {
|
|
61
|
+
prop,
|
|
62
|
+
sortIndex: is.isNumber(sortIndex) ? sortIndex : editable.index,
|
|
63
|
+
checked: is.isBoolean(checked) ? checked : editable.checked
|
|
64
|
+
};
|
|
65
|
+
maxIndex = Math.max(maxIndex, obj[prop].sortIndex);
|
|
66
|
+
}
|
|
72
67
|
return obj;
|
|
73
68
|
}, {});
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
69
|
+
otherColumns.forEach((item, index) => {
|
|
70
|
+
const { prop, type } = item;
|
|
71
|
+
maxIndex = maxIndex < item.editable.index ? item.editable.index : maxIndex + index + 1;
|
|
72
|
+
cacheColumnsEditablele[prop] = {
|
|
73
|
+
prop,
|
|
74
|
+
sortIndex: maxIndex,
|
|
75
|
+
checked: type !== "checked"
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
return tableColumnsEditableleHandler(columns, cacheColumnsEditablele);
|
|
79
79
|
}
|
|
80
80
|
function operatorShowHandler(operator, scope) {
|
|
81
81
|
if (operator.permission && !is.isPermission(operator.permission)) {
|
|
@@ -161,17 +161,35 @@ const useAppTableWrapper = (hy) => {
|
|
|
161
161
|
const tableColumnsList = vue.computed(() => {
|
|
162
162
|
return tableColumns.value.filter((column) => tableColumnShowHandler(column));
|
|
163
163
|
});
|
|
164
|
-
const searchPlaceholder = vue.
|
|
164
|
+
const searchPlaceholder = vue.computed(() => {
|
|
165
|
+
const searchLabelSet = tableColumnsList.value.reduce(
|
|
166
|
+
(searchLabelSet2, column) => {
|
|
167
|
+
if (column.isSearch) {
|
|
168
|
+
searchLabelSet2.add(column.label);
|
|
169
|
+
}
|
|
170
|
+
return searchLabelSet2;
|
|
171
|
+
},
|
|
172
|
+
/* @__PURE__ */ new Set()
|
|
173
|
+
);
|
|
174
|
+
if (props.searchArr?.length > 0) {
|
|
175
|
+
props.searchArr.forEach((item) => {
|
|
176
|
+
searchLabelSet.add(item.label);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
return Array.from(searchLabelSet.values());
|
|
180
|
+
});
|
|
165
181
|
function getRowKey(row = {}) {
|
|
166
182
|
if (is.isString(props.rowKey)) return row[props.rowKey];
|
|
167
183
|
if (is.isFunction(props.rowKey)) return props.rowKey(row);
|
|
168
184
|
return row.id;
|
|
169
185
|
}
|
|
170
186
|
function onTableColumnsSelectHandler(value) {
|
|
171
|
-
const {
|
|
187
|
+
const { columnsList, searchText } = tableColumnsEditableleHandler(
|
|
188
|
+
props.tableColumns,
|
|
189
|
+
value
|
|
190
|
+
);
|
|
172
191
|
tableColumns.value = columnsList;
|
|
173
|
-
tableColumnsEditablele.value =
|
|
174
|
-
searchPlaceholder.value = searchText;
|
|
192
|
+
tableColumnsEditablele.value = value;
|
|
175
193
|
sessionStorage.setItem(CACHE_COLUMNS_KEY, JSON.stringify(value));
|
|
176
194
|
}
|
|
177
195
|
function doLayout() {
|
|
@@ -318,7 +336,7 @@ const useAppTableWrapper = (hy) => {
|
|
|
318
336
|
}
|
|
319
337
|
function onTableRowExpandChangeHandler(row, expandedRows) {
|
|
320
338
|
if (is.isBoolean(expandedRows) || props.expandMode !== "accordion" || expandedRows.length <= 1) {
|
|
321
|
-
props.onExpandChange(row, expandedRows);
|
|
339
|
+
props.onExpandChange && props.onExpandChange(row, expandedRows);
|
|
322
340
|
return;
|
|
323
341
|
} else {
|
|
324
342
|
expandedRows.forEach((item) => {
|
|
@@ -337,12 +355,10 @@ const useAppTableWrapper = (hy) => {
|
|
|
337
355
|
vue.watchEffect(() => {
|
|
338
356
|
const { columnsList, columnsEditablele, searchText } = tableColumnHandler(
|
|
339
357
|
props.tableColumns,
|
|
340
|
-
CACHE_COLUMNS_KEY
|
|
341
|
-
props.searchArr
|
|
358
|
+
CACHE_COLUMNS_KEY
|
|
342
359
|
);
|
|
343
360
|
tableColumns.value = columnsList;
|
|
344
361
|
tableColumnsEditablele.value = columnsEditablele;
|
|
345
|
-
searchPlaceholder.value = searchText;
|
|
346
362
|
});
|
|
347
363
|
return {
|
|
348
364
|
// 表格配置项
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var vue = require('vue');
|
|
4
|
-
var useAppSearch = require('../../hySearch/js/useAppSearch.js');
|
|
5
4
|
var is = require('../../../utils/is.js');
|
|
5
|
+
var useAppSearch = require('../../hySearch/js/useAppSearch.js');
|
|
6
6
|
var useLocale = require('../../../hooks/useLocale.js');
|
|
7
7
|
|
|
8
8
|
function getColumnDefaultConfig(column) {
|
|
@@ -15,7 +15,7 @@ function getColumnDefaultConfig(column) {
|
|
|
15
15
|
};
|
|
16
16
|
case "index":
|
|
17
17
|
return {
|
|
18
|
-
|
|
18
|
+
prop: `${column.type}_prop`,
|
|
19
19
|
label: t("table.index")
|
|
20
20
|
};
|
|
21
21
|
case "expand":
|
|
@@ -36,7 +36,21 @@ function getColumnDefaultWidth(column) {
|
|
|
36
36
|
if (column.type === "expand" && column.expandType === "expand") return 40;
|
|
37
37
|
if (column.type === "selection") return 40;
|
|
38
38
|
if (column.type === "index") return 80;
|
|
39
|
-
if (column.type === "operator")
|
|
39
|
+
if (column.type === "operator") {
|
|
40
|
+
const length = (column.operator || []).reduce((total, item) => {
|
|
41
|
+
if (!item.permission && is.isPermission(item.permission)) {
|
|
42
|
+
total++;
|
|
43
|
+
}
|
|
44
|
+
return total;
|
|
45
|
+
}, 0);
|
|
46
|
+
if (length >= 3) {
|
|
47
|
+
return 168;
|
|
48
|
+
} else if (length === 2) {
|
|
49
|
+
return 168 - 52;
|
|
50
|
+
} else {
|
|
51
|
+
return 168 - 52 * 2;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
40
54
|
return;
|
|
41
55
|
}
|
|
42
56
|
function generateColumnItem(column) {
|
|
@@ -60,13 +74,13 @@ function getColumnEditable(column, index) {
|
|
|
60
74
|
};
|
|
61
75
|
}
|
|
62
76
|
return {
|
|
63
|
-
index: type === "operator" ? 1e3 : index,
|
|
64
77
|
lock: false,
|
|
65
78
|
edit: !type || type === "default",
|
|
66
79
|
checked: !type || type !== "default" || type === "operator",
|
|
67
80
|
desc: void 0,
|
|
68
81
|
examples: [],
|
|
69
|
-
...editable || {}
|
|
82
|
+
...editable || {},
|
|
83
|
+
index: type === "operator" ? 1e3 : index
|
|
70
84
|
};
|
|
71
85
|
}
|
|
72
86
|
function getColumnSort(column) {
|
|
@@ -90,7 +104,7 @@ function getColumnSort(column) {
|
|
|
90
104
|
return sort;
|
|
91
105
|
}
|
|
92
106
|
const useAppTable = (config = {}) => {
|
|
93
|
-
const { columns, filterModel, filterColumns } = config || {};
|
|
107
|
+
const { columns, filterModel = {}, filterColumns } = config || {};
|
|
94
108
|
const tableColumns = [];
|
|
95
109
|
let defaultSortInfo = null;
|
|
96
110
|
try {
|
|
@@ -6,21 +6,26 @@
|
|
|
6
6
|
color: rgb(var(--hy-main));
|
|
7
7
|
font-size: 14px;
|
|
8
8
|
background-color: rgb(var(--hy-background));
|
|
9
|
-
.el-table {
|
|
9
|
+
.hy-el-table {
|
|
10
10
|
&.hideSelect {
|
|
11
11
|
/* 禁用全选 */
|
|
12
|
-
.el-table__header-wrapper .el-checkbox {
|
|
12
|
+
.hy-el-table__header-wrapper .hy-el-checkbox {
|
|
13
13
|
display: none !important;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
.el-table__cell .cell {
|
|
16
|
+
.hy-el-table__cell .cell {
|
|
17
17
|
display: flex;
|
|
18
18
|
align-items: center;
|
|
19
|
-
.el-table__expand-icon {
|
|
19
|
+
.hy-el-table__expand-icon {
|
|
20
20
|
flex-shrink: 0;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
+
.hy-el-table-v2 {
|
|
25
|
+
.hy-el-table-v2__row-cell {
|
|
26
|
+
padding: 8px 12px;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
24
29
|
.hy-table-search {
|
|
25
30
|
width: 160px;
|
|
26
31
|
.hy-el-input__inner::placeholder {
|
|
@@ -38,3 +43,16 @@
|
|
|
38
43
|
}
|
|
39
44
|
}
|
|
40
45
|
}
|
|
46
|
+
|
|
47
|
+
.hy-table-dropdown-menu.hy-el-dropdown-menu {
|
|
48
|
+
--hy-el-text-color-regular: rgba(var(--hy-main));
|
|
49
|
+
border: 1px solid rgba(var(--hy-main));
|
|
50
|
+
padding: 0px;
|
|
51
|
+
.hy-el-dropdown-menu__item {
|
|
52
|
+
padding: 9px 16px 10px;
|
|
53
|
+
border-bottom: 1px solid rgba(var(--hy-border));
|
|
54
|
+
&:last-child {
|
|
55
|
+
border-bottom: none;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|