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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { unref, toRef } from 'vue';
|
|
2
|
-
import { genValueByProp } from '../../../utils/form.mjs';
|
|
3
2
|
import { funRunHandler, mergeDeep } from '../../../utils/handler.mjs';
|
|
4
3
|
import { isArray, isObject } from '../../../utils/is.mjs';
|
|
4
|
+
import { genValueByProp } from '../../../utils/form.mjs';
|
|
5
5
|
import { useLocale } from '../../../hooks/useLocale.mjs';
|
|
6
6
|
|
|
7
7
|
const genDefaultLabel = (config) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, useModel, useTemplateRef, ref, computed, watch, openBlock, createElementBlock, createElementVNode, normalizeStyle, createVNode, unref, renderSlot, toDisplayString, createCommentVNode, createBlock, normalizeClass, mergeModels } from 'vue';
|
|
2
2
|
import { ElCascader } from 'element-plus';
|
|
3
|
-
import { useLocale } from '../../hooks/useLocale.mjs';
|
|
4
3
|
import { useApi } from '../../hooks/useApi.mjs';
|
|
4
|
+
import { useLocale } from '../../hooks/useLocale.mjs';
|
|
5
5
|
|
|
6
6
|
import "./style/orgCascader.scss";
|
|
7
7
|
|
|
@@ -75,7 +75,7 @@ const _sfc_main = {
|
|
|
75
75
|
prop: columnProp.value
|
|
76
76
|
}, {
|
|
77
77
|
default: withCtx(() => [
|
|
78
|
-
createElementVNode("div", { class: "flex bg-background-2 rounded
|
|
78
|
+
createElementVNode("div", { class: "flex bg-background-2 rounded outline outline-1 outline-transparent outline-offset-0 hover:outline-theme box-border" }, [
|
|
79
79
|
createElementVNode(
|
|
80
80
|
"div",
|
|
81
81
|
{
|
|
@@ -92,10 +92,7 @@ const _sfc_main = {
|
|
|
92
92
|
}])
|
|
93
93
|
},
|
|
94
94
|
[
|
|
95
|
-
__props.column.labelSlot && _ctx.$slots[__props.column.labelSlot] ? renderSlot(_ctx.$slots, __props.column.labelSlot, {
|
|
96
|
-
key: 0,
|
|
97
|
-
column: __props.column
|
|
98
|
-
}) : (openBlock(), createElementBlock(
|
|
95
|
+
__props.column.labelSlot && _ctx.$slots[__props.column.labelSlot] ? renderSlot(_ctx.$slots, __props.column.labelSlot, { column: __props.column }, void 0, void 0, 0) : (openBlock(), createElementBlock(
|
|
99
96
|
"span",
|
|
100
97
|
{ key: 1 },
|
|
101
98
|
toDisplayString(__props.column.label),
|
|
@@ -115,10 +112,7 @@ const _sfc_main = {
|
|
|
115
112
|
},
|
|
116
113
|
[
|
|
117
114
|
createCommentVNode(" \u81EA\u5B9A\u4E49\u5177\u540D\u63D2\u69FD "),
|
|
118
|
-
__props.column.slot ? renderSlot(_ctx.$slots, __props.column.slot, {
|
|
119
|
-
key: 0,
|
|
120
|
-
column: __props.column
|
|
121
|
-
}) : __props.column.type === "input" ? (openBlock(), createElementBlock(
|
|
115
|
+
__props.column.slot ? renderSlot(_ctx.$slots, __props.column.slot, { column: __props.column }, void 0, void 0, 0) : __props.column.type === "input" ? (openBlock(), createElementBlock(
|
|
122
116
|
Fragment,
|
|
123
117
|
{ key: 1 },
|
|
124
118
|
[
|
|
@@ -55,13 +55,13 @@ function useShrink(props, formItemWrapper) {
|
|
|
55
55
|
function getContainerPickUpHeight() {
|
|
56
56
|
switch (props.size) {
|
|
57
57
|
case "large":
|
|
58
|
-
return
|
|
58
|
+
return 44;
|
|
59
59
|
case "small":
|
|
60
|
-
return
|
|
60
|
+
return 28;
|
|
61
61
|
case "":
|
|
62
62
|
case "default":
|
|
63
63
|
default:
|
|
64
|
-
return
|
|
64
|
+
return 36;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
function switchShrink() {
|
|
@@ -74,7 +74,7 @@ function useShrink(props, formItemWrapper) {
|
|
|
74
74
|
if (container.children.length) {
|
|
75
75
|
for (let i = 0; i < container.children.length; i++) {
|
|
76
76
|
const element = container.children[i];
|
|
77
|
-
if (i > 0 && element.offsetLeft
|
|
77
|
+
if (i > 0 && element.offsetLeft <= 1) {
|
|
78
78
|
showShrink.value = true;
|
|
79
79
|
break;
|
|
80
80
|
} else if (i === container.children.length - 1) {
|
|
@@ -2,9 +2,10 @@ import { useTemplateRef, ref, computed, unref, watch, openBlock, createBlock, wi
|
|
|
2
2
|
import Sortable from 'sortablejs';
|
|
3
3
|
import { ElPopover, ElIcon, ElCheckboxGroup, ElMessage } from 'element-plus';
|
|
4
4
|
import { CircleClose, Warning, Edit } from '@element-plus/icons-vue';
|
|
5
|
-
import { tableColumnHandler } from '../js/index.mjs';
|
|
5
|
+
import { tableColumnShowHandler, tableColumnHandler } from '../js/index.mjs';
|
|
6
6
|
import _sfc_main$1 from './columnSelectItem.vue.mjs';
|
|
7
7
|
import { useLocale } from '../../../hooks/useLocale.mjs';
|
|
8
|
+
import { HyTooltip } from '../../hyTooltip/index.mjs';
|
|
8
9
|
import { HyButton } from '../../hyButton/index.mjs';
|
|
9
10
|
import { isEmpty } from '../../../utils/is.mjs';
|
|
10
11
|
|
|
@@ -35,11 +36,11 @@ const _sfc_main = {
|
|
|
35
36
|
const tableEditableColumns = ref([]);
|
|
36
37
|
const showColumnsLength = computed(() => {
|
|
37
38
|
return (tableColumns.value || []).reduce((total, column) => {
|
|
38
|
-
return total + (
|
|
39
|
+
return total + (isShowColumn(column) ? 1 : 0);
|
|
39
40
|
}, 0);
|
|
40
41
|
});
|
|
41
|
-
function
|
|
42
|
-
return
|
|
42
|
+
function isShowColumn(column) {
|
|
43
|
+
return tableColumnShowHandler(column) && column.editable.edit;
|
|
43
44
|
}
|
|
44
45
|
function showPopover() {
|
|
45
46
|
initColumnsInfo(props.columns, props.columnsEditable);
|
|
@@ -52,26 +53,20 @@ const _sfc_main = {
|
|
|
52
53
|
popoverRef.value?.hide?.();
|
|
53
54
|
}
|
|
54
55
|
function initColumnsInfo(columns, columnsEditable) {
|
|
56
|
+
const columnArr = [];
|
|
55
57
|
const checkedArr = [];
|
|
56
|
-
|
|
57
|
-
if (
|
|
58
|
-
|
|
58
|
+
for (const column of columns) {
|
|
59
|
+
if (isShowColumn(column) && !column.editable.lock) {
|
|
60
|
+
columnArr.push({
|
|
59
61
|
...column,
|
|
60
|
-
sortIndex:
|
|
62
|
+
sortIndex: columnsEditable[column.prop].sortIndex
|
|
61
63
|
});
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
for (const key in columnsEditable || {}) {
|
|
66
|
-
const target = columnsEditable[key];
|
|
67
|
-
const { column } = target;
|
|
68
|
-
if (isFilterColumn(column) || column.editable.lock) {
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
if (target.checked) {
|
|
72
|
-
checkedArr.push(column.prop);
|
|
64
|
+
if (columnsEditable[column.prop].checked) {
|
|
65
|
+
checkedArr.push(column.prop);
|
|
66
|
+
}
|
|
73
67
|
}
|
|
74
68
|
}
|
|
69
|
+
tableEditableColumns.value = columnArr;
|
|
75
70
|
checkedList.value = checkedArr;
|
|
76
71
|
}
|
|
77
72
|
const showClear = ref(true);
|
|
@@ -104,7 +99,7 @@ const _sfc_main = {
|
|
|
104
99
|
}
|
|
105
100
|
const editableObj = tableEditableColumns.value.reduce(
|
|
106
101
|
(editableObj2, column) => {
|
|
107
|
-
editableObj2[column.prop].
|
|
102
|
+
editableObj2[column.prop].sortIndex = column.sortIndex;
|
|
108
103
|
editableObj2[column.prop].checked = checkMap.value.has(column.prop);
|
|
109
104
|
return editableObj2;
|
|
110
105
|
},
|
|
@@ -132,29 +127,19 @@ const _sfc_main = {
|
|
|
132
127
|
const { oldIndex, newIndex } = event;
|
|
133
128
|
if (isEmpty(oldIndex) || isEmpty(newIndex) || oldIndex === newIndex)
|
|
134
129
|
return;
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
tableEditableColumns.value.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
} else {
|
|
149
|
-
tableEditableColumns.value.splice(
|
|
150
|
-
newIndex,
|
|
151
|
-
1,
|
|
152
|
-
tableEditableColumns.value.splice(
|
|
153
|
-
oldIndex,
|
|
154
|
-
1,
|
|
155
|
-
tableEditableColumns.value[newIndex]
|
|
156
|
-
)[0]
|
|
157
|
-
);
|
|
130
|
+
const minIndex = Math.min(oldIndex, newIndex);
|
|
131
|
+
const maxIndex = Math.max(oldIndex, newIndex);
|
|
132
|
+
const sortList = [];
|
|
133
|
+
for (let i = minIndex; i <= maxIndex; i++) {
|
|
134
|
+
sortList[i] = tableEditableColumns.value[i].sortIndex;
|
|
135
|
+
}
|
|
136
|
+
tableEditableColumns.value.splice(
|
|
137
|
+
newIndex,
|
|
138
|
+
0,
|
|
139
|
+
tableEditableColumns.value.splice(oldIndex, 1)[0]
|
|
140
|
+
);
|
|
141
|
+
for (let i = minIndex; i <= maxIndex; i++) {
|
|
142
|
+
tableEditableColumns.value[i].sortIndex = sortList[i];
|
|
158
143
|
}
|
|
159
144
|
showClear.value = true;
|
|
160
145
|
}
|
|
@@ -228,7 +213,7 @@ const _sfc_main = {
|
|
|
228
213
|
/* STABLE */
|
|
229
214
|
})
|
|
230
215
|
]),
|
|
231
|
-
createElementVNode("div", { class: "h-[364px] px-4 pt-[11px] pb-1 overflow-y-auto" }, [
|
|
216
|
+
createElementVNode("div", { class: "h-[364px] px-4 pt-[11px] pb-1 scroll-body overflow-y-auto" }, [
|
|
232
217
|
createVNode(unref(ElCheckboxGroup), {
|
|
233
218
|
modelValue: checkedList.value,
|
|
234
219
|
"onUpdate:modelValue": ($event) => checkedList.value = $event
|
|
@@ -249,7 +234,7 @@ const _sfc_main = {
|
|
|
249
234
|
Fragment,
|
|
250
235
|
{ key: index },
|
|
251
236
|
[
|
|
252
|
-
|
|
237
|
+
isShowColumn(item) && item.editable.lock ? (openBlock(), createBlock(_sfc_main$1, {
|
|
253
238
|
key: 0,
|
|
254
239
|
column: item,
|
|
255
240
|
checkMap: checkMap.value
|
|
@@ -299,48 +284,44 @@ const _sfc_main = {
|
|
|
299
284
|
/* STABLE */
|
|
300
285
|
}, 8, ["modelValue", "onUpdate:modelValue"])
|
|
301
286
|
]),
|
|
302
|
-
createElementVNode("div", { class: "flex items-center pt-[5px] pb-4 pl-[14px] pr-3" }, [
|
|
303
|
-
createElementVNode(
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
287
|
+
createElementVNode("div", { class: "flex items-center pt-[5px] pb-4 pl-[14px] pr-3 overflow-hidden" }, [
|
|
288
|
+
createElementVNode("div", { class: "flex items-center" }, [
|
|
289
|
+
createElementVNode(
|
|
290
|
+
"span",
|
|
291
|
+
null,
|
|
292
|
+
toDisplayString(unref(t)("table.selectedNumberItems", [checkedList.value?.length || 0])),
|
|
293
|
+
1
|
|
294
|
+
/* TEXT */
|
|
295
|
+
),
|
|
296
|
+
showClear.value ? (openBlock(), createElementBlock(
|
|
297
|
+
"span",
|
|
298
|
+
{
|
|
299
|
+
key: 0,
|
|
300
|
+
class: "clickBox text-danger-2 ml-3",
|
|
301
|
+
onClick: onClearHandler
|
|
302
|
+
},
|
|
303
|
+
toDisplayString(unref(t)("table.clear")),
|
|
304
|
+
1
|
|
305
|
+
/* TEXT */
|
|
306
|
+
)) : createCommentVNode("v-if", true)
|
|
307
|
+
]),
|
|
308
|
+
createElementVNode("div", { class: "w-0 flex-1 flex items-center justify-end ml-3" }, [
|
|
309
|
+
createVNode(unref(ElIcon), {
|
|
310
|
+
class: "mr-1.5",
|
|
311
|
+
color: "rgb(var(--hy-auxiliary))"
|
|
312
|
+
}, {
|
|
313
|
+
default: withCtx(() => [
|
|
314
|
+
createVNode(unref(Warning))
|
|
315
|
+
]),
|
|
316
|
+
_: 1
|
|
317
|
+
/* STABLE */
|
|
318
|
+
}),
|
|
319
|
+
checkedList.value?.length >= 8 ? (openBlock(), createBlock(unref(HyTooltip), {
|
|
323
320
|
key: 0,
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
color: "rgb(var(--hy-auxiliary))"
|
|
329
|
-
}, {
|
|
330
|
-
default: withCtx(() => [
|
|
331
|
-
createVNode(unref(Warning))
|
|
332
|
-
]),
|
|
333
|
-
_: 1
|
|
334
|
-
/* STABLE */
|
|
335
|
-
}),
|
|
336
|
-
createElementVNode(
|
|
337
|
-
"span",
|
|
338
|
-
null,
|
|
339
|
-
toDisplayString(unref(t)("table.tooManyFieldsWillAffectReadability")),
|
|
340
|
-
1
|
|
341
|
-
/* TEXT */
|
|
342
|
-
)
|
|
343
|
-
])) : createCommentVNode("v-if", true),
|
|
321
|
+
"is-always": false,
|
|
322
|
+
content: unref(t)("table.tooManyFieldsWillAffectReadability"),
|
|
323
|
+
class: "mr-2 text-auxiliary"
|
|
324
|
+
}, null, 8, ["content"])) : createCommentVNode("v-if", true),
|
|
344
325
|
createVNode(unref(HyButton), {
|
|
345
326
|
type: "primary",
|
|
346
327
|
size: "small",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { openBlock, createBlock, unref, withCtx, createElementVNode, toDisplayString, createElementBlock, createCommentVNode, Fragment, renderList, normalizeClass, createVNode, withModifiers } from 'vue';
|
|
2
2
|
import { ElPopover, ElIcon, ElCheckbox } from 'element-plus';
|
|
3
|
-
import { Lock
|
|
3
|
+
import { Lock } from '@element-plus/icons-vue';
|
|
4
4
|
import { renderHeaderHandler } from '../js/index.mjs';
|
|
5
5
|
import { useLocale } from '../../../hooks/useLocale.mjs';
|
|
6
6
|
import { HyTooltip } from '../../hyTooltip/index.mjs';
|
|
@@ -90,16 +90,13 @@ const _sfc_main = {
|
|
|
90
90
|
)),
|
|
91
91
|
__props.columnsLength > 1 ? (openBlock(), createElementBlock("div", {
|
|
92
92
|
key: 2,
|
|
93
|
-
class: "
|
|
93
|
+
class: "h-full flex items-center justify-center handle cursor-grab ml-3",
|
|
94
94
|
onClick: withModifiers(() => {
|
|
95
95
|
}, ["stop"])
|
|
96
96
|
}, [
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
]),
|
|
101
|
-
_: 1
|
|
102
|
-
/* STABLE */
|
|
97
|
+
createElementVNode("div", {
|
|
98
|
+
class: "w-5 h-2.5",
|
|
99
|
+
style: { "background": "radial-gradient(\n circle,\n rgba(var(--hy-theme)) 1px,\n transparent 2px\n )\n 0px 0px / 5px 5px" }
|
|
103
100
|
})
|
|
104
101
|
], 8, ["onClick"])) : createCommentVNode("v-if", true)
|
|
105
102
|
])) : createCommentVNode("v-if", true)
|
|
@@ -90,7 +90,7 @@ const _sfc_main = {
|
|
|
90
90
|
}, 8, ["color", "onClick"])
|
|
91
91
|
]),
|
|
92
92
|
renderSlot(_ctx.$slots, "default")
|
|
93
|
-
], 8, ["onClick"])) : renderSlot(_ctx.$slots, "default", {
|
|
93
|
+
], 8, ["onClick"])) : renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 1);
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
96
|
};
|
|
@@ -308,8 +308,8 @@ const _sfc_main = {
|
|
|
308
308
|
width: __props.width,
|
|
309
309
|
height: __props.height,
|
|
310
310
|
"header-height": __props.showHeader ? 44 : 0,
|
|
311
|
-
"row-height":
|
|
312
|
-
"estimated-row-height":
|
|
311
|
+
"row-height": 64,
|
|
312
|
+
"estimated-row-height": 64,
|
|
313
313
|
"expand-column-key": expandColumn.value?.key,
|
|
314
314
|
fixed: "",
|
|
315
315
|
"row-class": rowClass,
|
|
@@ -355,9 +355,8 @@ const _sfc_main = {
|
|
|
355
355
|
row: withCtx(({ columns, depth, rowData: row, rowIndex: $index }) => [
|
|
356
356
|
createCommentVNode(" \u5C55\u5F00\u5185\u5BB9 "),
|
|
357
357
|
depth > 0 && isExpandTable.value ? renderSlot(_ctx.$slots, expandColumn.value.slot, {
|
|
358
|
-
key: 0,
|
|
359
358
|
row: dataSourceMap.value.get(row.dataKey)
|
|
360
|
-
}) : (openBlock(), createElementBlock(
|
|
359
|
+
}, void 0, void 0, 0) : (openBlock(), createElementBlock(
|
|
361
360
|
Fragment,
|
|
362
361
|
{ key: 1 },
|
|
363
362
|
[
|
|
@@ -422,10 +421,7 @@ const _sfc_main = {
|
|
|
422
421
|
indeterminate: indeterminateKeys.value.has(getRowKey(row)),
|
|
423
422
|
disabled: !isSelectable(row),
|
|
424
423
|
onClick: withModifiers(($event) => switchCheckHandler(row), ["stop"])
|
|
425
|
-
}, null, 8, ["model-value", "indeterminate", "disabled", "onClick"])) : column?.slot && (column.type !== "expand" || !isExpandTable.value) ? renderSlot(_ctx.$slots, column?.slot, mergeProps({
|
|
426
|
-
key: 2,
|
|
427
|
-
ref_for: true
|
|
428
|
-
}, { column, row, $index, cellIndex })) : column.type === "index" ? (openBlock(), createElementBlock(
|
|
424
|
+
}, null, 8, ["model-value", "indeterminate", "disabled", "onClick"])) : column?.slot && (column.type !== "expand" || !isExpandTable.value) ? renderSlot(_ctx.$slots, column?.slot, mergeProps({ ref_for: true }, { column, row, $index, cellIndex }), void 0, void 0, 2) : column.type === "index" ? (openBlock(), createElementBlock(
|
|
429
425
|
Fragment,
|
|
430
426
|
{ key: 3 },
|
|
431
427
|
[
|
|
@@ -439,7 +435,7 @@ const _sfc_main = {
|
|
|
439
435
|
/* STABLE_FRAGMENT */
|
|
440
436
|
)) : column.type === "operator" ? (openBlock(), createElementBlock("div", {
|
|
441
437
|
key: 4,
|
|
442
|
-
class: "w-full flex items-center justify-
|
|
438
|
+
class: "w-full flex items-center justify-end gap-3 text-main",
|
|
443
439
|
onClick: withModifiers(() => {
|
|
444
440
|
}, ["stop"]),
|
|
445
441
|
onContextmenu: withModifiers(() => {
|
|
@@ -457,7 +453,7 @@ const _sfc_main = {
|
|
|
457
453
|
key: cindex,
|
|
458
454
|
"is-always": "",
|
|
459
455
|
overLine: 1,
|
|
460
|
-
content: citem.
|
|
456
|
+
content: citem.desc
|
|
461
457
|
}, {
|
|
462
458
|
default: withCtx(() => [
|
|
463
459
|
createElementVNode("div", {
|
|
@@ -473,13 +469,13 @@ const _sfc_main = {
|
|
|
473
469
|
"svg-name": citem.svgName,
|
|
474
470
|
"class-name": "!w-4 !h-4"
|
|
475
471
|
}, null, 8, ["svg-name"]),
|
|
476
|
-
citem.
|
|
472
|
+
citem.label ? (openBlock(), createElementBlock(
|
|
477
473
|
"div",
|
|
478
474
|
{
|
|
479
475
|
key: 0,
|
|
480
476
|
class: "mt-1 whitespace-nowrap"
|
|
481
477
|
},
|
|
482
|
-
toDisplayString(citem.
|
|
478
|
+
toDisplayString(citem.label),
|
|
483
479
|
1
|
|
484
480
|
/* TEXT */
|
|
485
481
|
)) : (openBlock(), createElementBlock("div", {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ref, computed, watchEffect, unref, nextTick } from 'vue';
|
|
2
2
|
import { ElLoading } from 'element-plus';
|
|
3
|
-
import { isString, isBoolean, isFunction, isPermission,
|
|
3
|
+
import { isString, isBoolean, isFunction, isPermission, isNumber, isArray } from '../../../utils/is.mjs';
|
|
4
4
|
import { useLocale } from '../../../hooks/useLocale.mjs';
|
|
5
5
|
import { usePermissionMap } from '../../../hooks/usePermissionMap.mjs';
|
|
6
6
|
|
|
@@ -13,67 +13,67 @@ function tableColumnShowHandler(column) {
|
|
|
13
13
|
if (isFunction(show)) return show(column);
|
|
14
14
|
return true;
|
|
15
15
|
}
|
|
16
|
-
function tableColumnsEditableleHandler(columns, columnsEditablele
|
|
17
|
-
const searchLabelSet = /* @__PURE__ */ new Set();
|
|
16
|
+
function tableColumnsEditableleHandler(columns, columnsEditablele) {
|
|
18
17
|
const columnsEditableleObj = {};
|
|
18
|
+
const sortSet = /* @__PURE__ */ new Set();
|
|
19
19
|
for (const column of columns) {
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
if (!columnsEditableleObj[
|
|
24
|
-
columnsEditableleObj[
|
|
20
|
+
const columnsEditableleItem = columnsEditablele[column.prop];
|
|
21
|
+
const { sortIndex } = columnsEditableleItem;
|
|
22
|
+
sortSet.add(sortIndex);
|
|
23
|
+
if (!columnsEditableleObj[sortIndex]) {
|
|
24
|
+
columnsEditableleObj[sortIndex] = [];
|
|
25
25
|
}
|
|
26
|
-
columnsEditableleObj[
|
|
27
|
-
|
|
26
|
+
columnsEditableleObj[sortIndex].push({
|
|
27
|
+
editable: columnsEditableleItem,
|
|
28
28
|
column
|
|
29
29
|
});
|
|
30
|
-
if (column.isSearch) {
|
|
31
|
-
searchLabelSet.add(column.label);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
if (searchArr?.length > 0) {
|
|
35
|
-
searchArr.forEach((item) => {
|
|
36
|
-
searchLabelSet.add(item.label);
|
|
37
|
-
});
|
|
38
30
|
}
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
Array.from(sortSet.values()).reduce((a, b) => a - b);
|
|
32
|
+
const columnsList = Object.keys(columnsEditableleObj).reduce(
|
|
33
|
+
(columnsList2, key) => {
|
|
41
34
|
const list = columnsEditableleObj[key];
|
|
42
35
|
for (let i = 0; i < list.length; i++) {
|
|
43
36
|
const target = list[i];
|
|
44
|
-
|
|
45
|
-
...target,
|
|
46
|
-
index: columnsList.length + i
|
|
47
|
-
};
|
|
48
|
-
columnsList.push(target.column);
|
|
37
|
+
columnsList2.push(target.column);
|
|
49
38
|
}
|
|
50
|
-
return
|
|
39
|
+
return columnsList2;
|
|
51
40
|
},
|
|
52
|
-
|
|
53
|
-
columnsEditablele: {},
|
|
54
|
-
columnsList: [],
|
|
55
|
-
searchText: Array.from(searchLabelSet.values()).join("\u3001")
|
|
56
|
-
}
|
|
41
|
+
[]
|
|
57
42
|
);
|
|
43
|
+
return {
|
|
44
|
+
columnsList,
|
|
45
|
+
columnsEditablele
|
|
46
|
+
};
|
|
58
47
|
}
|
|
59
|
-
function tableColumnHandler(columns, cacheKey
|
|
60
|
-
const cacheColumnsValue = cacheKey ? JSON.parse(sessionStorage.getItem(cacheKey) || "{}") :
|
|
48
|
+
function tableColumnHandler(columns, cacheKey) {
|
|
49
|
+
const cacheColumnsValue = cacheKey && sessionStorage.getItem(cacheKey) ? JSON.parse(sessionStorage.getItem(cacheKey) || "{}") : null;
|
|
50
|
+
const otherColumns = [];
|
|
51
|
+
let maxIndex = 0;
|
|
61
52
|
const cacheColumnsEditablele = columns.reduce((obj, column) => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
53
|
+
const { editable, prop, type, permission } = column;
|
|
54
|
+
if (cacheColumnsValue && (!cacheColumnsValue[prop] || type === "operator") || permission && !isPermission(permission)) {
|
|
55
|
+
otherColumns.push(column);
|
|
56
|
+
} else {
|
|
57
|
+
let { sortIndex, checked } = cacheColumnsValue?.[prop] || {};
|
|
58
|
+
obj[prop] = {
|
|
59
|
+
prop,
|
|
60
|
+
sortIndex: isNumber(sortIndex) ? sortIndex : editable.index,
|
|
61
|
+
checked: isBoolean(checked) ? checked : editable.checked
|
|
62
|
+
};
|
|
63
|
+
maxIndex = Math.max(maxIndex, obj[prop].sortIndex);
|
|
64
|
+
}
|
|
70
65
|
return obj;
|
|
71
66
|
}, {});
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
otherColumns.forEach((item, index) => {
|
|
68
|
+
const { prop, type } = item;
|
|
69
|
+
maxIndex = maxIndex < item.editable.index ? item.editable.index : maxIndex + index + 1;
|
|
70
|
+
cacheColumnsEditablele[prop] = {
|
|
71
|
+
prop,
|
|
72
|
+
sortIndex: maxIndex,
|
|
73
|
+
checked: type !== "checked"
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
return tableColumnsEditableleHandler(columns, cacheColumnsEditablele);
|
|
77
77
|
}
|
|
78
78
|
function operatorShowHandler(operator, scope) {
|
|
79
79
|
if (operator.permission && !isPermission(operator.permission)) {
|
|
@@ -159,17 +159,35 @@ const useAppTableWrapper = (hy) => {
|
|
|
159
159
|
const tableColumnsList = computed(() => {
|
|
160
160
|
return tableColumns.value.filter((column) => tableColumnShowHandler(column));
|
|
161
161
|
});
|
|
162
|
-
const searchPlaceholder =
|
|
162
|
+
const searchPlaceholder = computed(() => {
|
|
163
|
+
const searchLabelSet = tableColumnsList.value.reduce(
|
|
164
|
+
(searchLabelSet2, column) => {
|
|
165
|
+
if (column.isSearch) {
|
|
166
|
+
searchLabelSet2.add(column.label);
|
|
167
|
+
}
|
|
168
|
+
return searchLabelSet2;
|
|
169
|
+
},
|
|
170
|
+
/* @__PURE__ */ new Set()
|
|
171
|
+
);
|
|
172
|
+
if (props.searchArr?.length > 0) {
|
|
173
|
+
props.searchArr.forEach((item) => {
|
|
174
|
+
searchLabelSet.add(item.label);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
return Array.from(searchLabelSet.values());
|
|
178
|
+
});
|
|
163
179
|
function getRowKey(row = {}) {
|
|
164
180
|
if (isString(props.rowKey)) return row[props.rowKey];
|
|
165
181
|
if (isFunction(props.rowKey)) return props.rowKey(row);
|
|
166
182
|
return row.id;
|
|
167
183
|
}
|
|
168
184
|
function onTableColumnsSelectHandler(value) {
|
|
169
|
-
const {
|
|
185
|
+
const { columnsList, searchText } = tableColumnsEditableleHandler(
|
|
186
|
+
props.tableColumns,
|
|
187
|
+
value
|
|
188
|
+
);
|
|
170
189
|
tableColumns.value = columnsList;
|
|
171
|
-
tableColumnsEditablele.value =
|
|
172
|
-
searchPlaceholder.value = searchText;
|
|
190
|
+
tableColumnsEditablele.value = value;
|
|
173
191
|
sessionStorage.setItem(CACHE_COLUMNS_KEY, JSON.stringify(value));
|
|
174
192
|
}
|
|
175
193
|
function doLayout() {
|
|
@@ -316,7 +334,7 @@ const useAppTableWrapper = (hy) => {
|
|
|
316
334
|
}
|
|
317
335
|
function onTableRowExpandChangeHandler(row, expandedRows) {
|
|
318
336
|
if (isBoolean(expandedRows) || props.expandMode !== "accordion" || expandedRows.length <= 1) {
|
|
319
|
-
props.onExpandChange(row, expandedRows);
|
|
337
|
+
props.onExpandChange && props.onExpandChange(row, expandedRows);
|
|
320
338
|
return;
|
|
321
339
|
} else {
|
|
322
340
|
expandedRows.forEach((item) => {
|
|
@@ -335,12 +353,10 @@ const useAppTableWrapper = (hy) => {
|
|
|
335
353
|
watchEffect(() => {
|
|
336
354
|
const { columnsList, columnsEditablele, searchText } = tableColumnHandler(
|
|
337
355
|
props.tableColumns,
|
|
338
|
-
CACHE_COLUMNS_KEY
|
|
339
|
-
props.searchArr
|
|
356
|
+
CACHE_COLUMNS_KEY
|
|
340
357
|
);
|
|
341
358
|
tableColumns.value = columnsList;
|
|
342
359
|
tableColumnsEditablele.value = columnsEditablele;
|
|
343
|
-
searchPlaceholder.value = searchText;
|
|
344
360
|
});
|
|
345
361
|
return {
|
|
346
362
|
// 表格配置项
|