tabula-vue 1.0.0 → 1.0.2
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/es/component.mjs +4 -0
- package/es/components/dialog/index.d.ts +30 -30
- package/es/components/dialog/src/index.vue.d.ts +2 -2
- package/es/components/dialog-form/index.d.ts +2 -2
- package/es/components/dialog-form/src/index.vue.d.ts +2 -2
- package/es/components/display-item/index.d.ts +25 -25
- package/es/components/display-item/src/index.vue.d.ts +7 -7
- package/es/components/drawer-form/index.d.ts +50 -50
- package/es/components/drawer-form/src/index.vue.d.ts +10 -10
- package/es/components/form/index.d.ts +99 -99
- package/es/components/form/src/form-content.vue.d.ts +12 -12
- package/es/components/form/src/index.vue.d.ts +11 -11
- package/es/components/form-item/index.d.ts +80 -80
- package/es/components/form-item/src/index.vue.d.ts +9 -9
- package/es/components/index.d.ts +2 -0
- package/es/components/index.mjs +6 -0
- package/es/components/input-tag/index.d.ts +6 -6
- package/es/components/input-tag/src/index.vue.d.ts +6 -6
- package/es/components/layout/index.d.ts +30 -30
- package/es/components/layout/src/index.vue.d.ts +10 -10
- package/es/components/page/index.d.ts +9087 -4864
- package/es/components/page/src/index.vue.d.ts +1903 -513
- package/es/components/page/src/index.vue2.mjs +43 -12
- package/es/components/popover/index.d.ts +49 -49
- package/es/components/popover/src/index.vue.d.ts +3 -3
- package/es/components/render/index.d.ts +14 -14
- package/es/components/render/src/index.vue.d.ts +1 -1
- package/es/components/search/index.d.ts +298 -298
- package/es/components/search/src/index.vue.d.ts +84 -84
- package/es/components/sidebar/index.d.ts +31 -31
- package/es/components/sidebar/src/index.vue.d.ts +5 -5
- package/es/components/table/index.d.ts +165 -180
- package/es/components/table/index.mjs +3 -0
- package/es/components/table/src/index.vue.d.ts +12 -21
- package/es/components/table/src/index.vue2.mjs +11 -34
- package/es/components/table/src/table-action-bar-content.vue.d.ts +78 -0
- package/es/components/table/src/table-action-bar-content.vue.mjs +6 -0
- package/es/components/table/src/table-action-bar-content.vue2.mjs +395 -0
- package/es/components/table/src/table-action-bar.vue.d.ts +4 -4
- package/es/components/table/src/table-action-bar.vue2.mjs +30 -353
- package/es/components/table/src/table-column-drag-sort.vue.d.ts +1 -1
- package/es/components/table/src/table-column-index.vue.d.ts +1 -1
- package/es/components/table/src/table-column.vue.d.ts +22 -29
- package/es/components/table/src/table-column.vue2.mjs +4 -57
- package/es/components/table/src/table-title-bar.vue.d.ts +2 -2
- package/es/components/table/src/type.d.ts +0 -11
- package/es/components/table/src/use-columns.d.ts +26 -0
- package/es/components/table/src/use-columns.mjs +40 -0
- package/es/components/table-lite/index.d.ts +1783 -0
- package/es/components/table-lite/index.mjs +6 -0
- package/es/components/table-lite/src/index.vue.d.ts +672 -0
- package/es/components/table-lite/src/index.vue.mjs +6 -0
- package/es/components/table-lite/src/index.vue2.mjs +681 -0
- package/es/components/table-lite/src/type.d.ts +91 -0
- package/es/components/table-lite/src/type.mjs +1 -0
- package/es/components/table-lite/style/css.d.ts +16 -0
- package/es/components/table-lite/style/css.mjs +16 -0
- package/es/components/table-lite/style/index.d.ts +16 -0
- package/es/components/table-lite/style/index.mjs +16 -0
- package/es/components/table-v2/index.d.ts +174 -0
- package/es/components/table-v2/index.mjs +7 -0
- package/es/components/table-v2/src/column-converter.d.ts +27 -0
- package/es/components/table-v2/src/column-converter.mjs +42 -0
- package/es/components/table-v2/src/index.vue.d.ts +157 -0
- package/es/components/table-v2/src/index.vue.mjs +6 -0
- package/es/components/table-v2/src/index.vue2.mjs +491 -0
- package/es/components/table-v2/src/special-columns.d.ts +61 -0
- package/es/components/table-v2/src/special-columns.mjs +76 -0
- package/es/components/table-v2/src/table-v2-cell.d.ts +104 -0
- package/es/components/table-v2/src/table-v2-cell.mjs +139 -0
- package/es/components/table-v2/src/table-v2-header-cell.vue.d.ts +61 -0
- package/es/components/table-v2/src/table-v2-header-cell.vue.mjs +6 -0
- package/es/components/table-v2/src/table-v2-header-cell.vue2.mjs +92 -0
- package/es/components/table-v2/src/type.d.ts +95 -0
- package/es/components/table-v2/src/type.mjs +1 -0
- package/es/components/table-v2/src/use-table-v2-columns.d.ts +43 -0
- package/es/components/table-v2/src/use-table-v2-columns.mjs +47 -0
- package/es/components/table-v2/style/css.d.ts +17 -0
- package/es/components/table-v2/style/css.mjs +17 -0
- package/es/components/table-v2/style/index.d.ts +17 -0
- package/es/components/table-v2/style/index.mjs +17 -0
- package/es/index.mjs +6 -0
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/index.css +1 -1
- package/index.js +1850 -279
- package/index.min.js +9 -6
- package/index.min.mjs +9 -6
- package/index.mjs +1813 -248
- package/lib/component.js +42 -38
- package/lib/components/dialog/index.d.ts +30 -30
- package/lib/components/dialog/src/index.vue.d.ts +2 -2
- package/lib/components/dialog-form/index.d.ts +2 -2
- package/lib/components/dialog-form/src/index.vue.d.ts +2 -2
- package/lib/components/display-item/index.d.ts +25 -25
- package/lib/components/display-item/src/index.vue.d.ts +7 -7
- package/lib/components/drawer-form/index.d.ts +50 -50
- package/lib/components/drawer-form/src/index.vue.d.ts +10 -10
- package/lib/components/form/index.d.ts +99 -99
- package/lib/components/form/src/form-content.vue.d.ts +12 -12
- package/lib/components/form/src/index.vue.d.ts +11 -11
- package/lib/components/form-item/index.d.ts +80 -80
- package/lib/components/form-item/src/index.vue.d.ts +9 -9
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +51 -39
- package/lib/components/input-tag/index.d.ts +6 -6
- package/lib/components/input-tag/src/index.vue.d.ts +6 -6
- package/lib/components/layout/index.d.ts +30 -30
- package/lib/components/layout/src/index.vue.d.ts +10 -10
- package/lib/components/page/index.d.ts +9087 -4864
- package/lib/components/page/src/index.vue.d.ts +1903 -513
- package/lib/components/page/src/index.vue2.js +46 -15
- package/lib/components/popover/index.d.ts +49 -49
- package/lib/components/popover/src/index.vue.d.ts +3 -3
- package/lib/components/render/index.d.ts +14 -14
- package/lib/components/render/src/index.vue.d.ts +1 -1
- package/lib/components/search/index.d.ts +298 -298
- package/lib/components/search/src/index.vue.d.ts +84 -84
- package/lib/components/sidebar/index.d.ts +31 -31
- package/lib/components/sidebar/src/index.vue.d.ts +5 -5
- package/lib/components/table/index.d.ts +165 -180
- package/lib/components/table/index.js +6 -0
- package/lib/components/table/src/index.vue.d.ts +12 -21
- package/lib/components/table/src/index.vue2.js +10 -33
- package/lib/components/table/src/table-action-bar-content.vue.d.ts +78 -0
- package/lib/components/table/src/table-action-bar-content.vue.js +10 -0
- package/lib/components/table/src/table-action-bar-content.vue2.js +399 -0
- package/lib/components/table/src/table-action-bar.vue.d.ts +4 -4
- package/lib/components/table/src/table-action-bar.vue2.js +28 -351
- package/lib/components/table/src/table-column-drag-sort.vue.d.ts +1 -1
- package/lib/components/table/src/table-column-index.vue.d.ts +1 -1
- package/lib/components/table/src/table-column.vue.d.ts +22 -29
- package/lib/components/table/src/table-column.vue2.js +2 -55
- package/lib/components/table/src/table-title-bar.vue.d.ts +2 -2
- package/lib/components/table/src/type.d.ts +0 -11
- package/lib/components/table/src/use-columns.d.ts +26 -0
- package/lib/components/table/src/use-columns.js +42 -0
- package/lib/components/table-lite/index.d.ts +1783 -0
- package/lib/components/table-lite/index.js +8 -0
- package/lib/components/table-lite/src/index.vue.d.ts +672 -0
- package/lib/components/table-lite/src/index.vue.js +10 -0
- package/lib/components/table-lite/src/index.vue2.js +685 -0
- package/lib/components/table-lite/src/type.d.ts +91 -0
- package/lib/components/table-lite/src/type.js +2 -0
- package/lib/components/table-lite/style/css.d.ts +16 -0
- package/lib/components/table-lite/style/css.js +19 -0
- package/lib/components/table-lite/style/index.d.ts +16 -0
- package/lib/components/table-lite/style/index.js +19 -0
- package/lib/components/table-v2/index.d.ts +174 -0
- package/lib/components/table-v2/index.js +10 -0
- package/lib/components/table-v2/src/column-converter.d.ts +27 -0
- package/lib/components/table-v2/src/column-converter.js +44 -0
- package/lib/components/table-v2/src/index.vue.d.ts +157 -0
- package/lib/components/table-v2/src/index.vue.js +10 -0
- package/lib/components/table-v2/src/index.vue2.js +495 -0
- package/lib/components/table-v2/src/special-columns.d.ts +61 -0
- package/lib/components/table-v2/src/special-columns.js +80 -0
- package/lib/components/table-v2/src/table-v2-cell.d.ts +104 -0
- package/lib/components/table-v2/src/table-v2-cell.js +143 -0
- package/lib/components/table-v2/src/table-v2-header-cell.vue.d.ts +61 -0
- package/lib/components/table-v2/src/table-v2-header-cell.vue.js +10 -0
- package/lib/components/table-v2/src/table-v2-header-cell.vue2.js +96 -0
- package/lib/components/table-v2/src/type.d.ts +95 -0
- package/lib/components/table-v2/src/type.js +2 -0
- package/lib/components/table-v2/src/use-table-v2-columns.d.ts +43 -0
- package/lib/components/table-v2/src/use-table-v2-columns.js +51 -0
- package/lib/components/table-v2/style/css.d.ts +17 -0
- package/lib/components/table-v2/style/css.js +20 -0
- package/lib/components/table-v2/style/index.d.ts +17 -0
- package/lib/components/table-v2/style/index.js +20 -0
- package/lib/index.js +51 -39
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/locale/en.js +1 -1
- package/locale/en.min.js +1 -1
- package/locale/en.min.mjs +1 -1
- package/locale/en.mjs +1 -1
- package/locale/ja.js +1 -1
- package/locale/ja.min.js +1 -1
- package/locale/ja.min.mjs +1 -1
- package/locale/ja.mjs +1 -1
- package/locale/ko.js +1 -1
- package/locale/ko.min.js +1 -1
- package/locale/ko.min.mjs +1 -1
- package/locale/ko.mjs +1 -1
- package/locale/zh-cn.js +1 -1
- package/locale/zh-cn.min.js +1 -1
- package/locale/zh-cn.min.mjs +1 -1
- package/locale/zh-cn.mjs +1 -1
- package/locale/zh-hk.js +1 -1
- package/locale/zh-hk.min.js +1 -1
- package/locale/zh-hk.min.mjs +1 -1
- package/locale/zh-hk.mjs +1 -1
- package/locale/zh-tw.js +1 -1
- package/locale/zh-tw.min.js +1 -1
- package/locale/zh-tw.min.mjs +1 -1
- package/locale/zh-tw.mjs +1 -1
- package/package.json +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/plus-table-lite.css +1 -0
- package/theme-chalk/plus-table-v2.css +1 -0
- package/theme-chalk/src/index.scss +2 -0
- package/theme-chalk/src/table-lite.scss +53 -0
- package/theme-chalk/src/table-v2.scss +71 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, getCurrentInstance, computed, watch, ref, inject, resolveComponent, openBlock, createElementBlock, Fragment, renderList, createBlock, unref, mergeProps, withCtx, createElementVNode, createCommentVNode, renderSlot, createTextVNode, toDisplayString, createVNode, createSlots, normalizeProps, guardReactiveProps } from 'vue';
|
|
2
2
|
import { PlusDisplayItem } from '../../display-item/index.mjs';
|
|
3
|
-
import {
|
|
3
|
+
import { getTableKey, getLabel, getTableHeaderSlotName, getTooltip } from '../../utils/index.mjs';
|
|
4
4
|
import '../../../constants/index.mjs';
|
|
5
5
|
import { QuestionFilled } from '@element-plus/icons-vue';
|
|
6
6
|
import { PlusRender } from '../../render/index.mjs';
|
|
@@ -10,7 +10,6 @@ import { TableFormRefInjectionKey } from '../../../constants/form.mjs';
|
|
|
10
10
|
import { isFunction } from '../../utils/is.mjs';
|
|
11
11
|
|
|
12
12
|
const _hoisted_1 = { class: "plus-table-column__header" };
|
|
13
|
-
const _hoisted_2 = { class: "plus-display-item" };
|
|
14
13
|
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
15
14
|
...{
|
|
16
15
|
name: "PlusTableColumn"
|
|
@@ -21,14 +20,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
21
20
|
editable: { type: [Boolean, String], default: false },
|
|
22
21
|
tableDataLength: { default: 0 },
|
|
23
22
|
subPageInfo: { default: () => ({}) },
|
|
24
|
-
emptyValue: { default: void 0 }
|
|
25
|
-
plainTextCell: { type: Boolean, default: false }
|
|
23
|
+
emptyValue: { default: void 0 }
|
|
26
24
|
},
|
|
27
25
|
emits: ["formChange"],
|
|
28
26
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
29
27
|
const props = __props;
|
|
30
28
|
const emit = __emit;
|
|
31
|
-
const slots = useSlots();
|
|
32
29
|
const instance = getCurrentInstance();
|
|
33
30
|
const store = computed(() => {
|
|
34
31
|
var _a;
|
|
@@ -47,36 +44,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
47
44
|
);
|
|
48
45
|
const plusDisplayItemInstance = ref();
|
|
49
46
|
const formRefs = inject(TableFormRefInjectionKey);
|
|
50
|
-
const PLAIN_VALUE_TYPE_SET = /* @__PURE__ */ new Set([void 0, "", "input"]);
|
|
51
|
-
const isPlainColumn = (item) => {
|
|
52
|
-
if (!props.plainTextCell) return false;
|
|
53
|
-
if (props.editable !== false) return false;
|
|
54
|
-
if (item.editable === true) return false;
|
|
55
|
-
if (!PLAIN_VALUE_TYPE_SET.has(item.valueType)) return false;
|
|
56
|
-
if (item.render || item.renderHTML || item.formatter || item.customGetStatus) return false;
|
|
57
|
-
if (item.fieldProps !== void 0 && item.fieldProps !== null) return false;
|
|
58
|
-
if (item.formProps !== void 0 && item.formProps !== null) return false;
|
|
59
|
-
if (item.fieldSlots && Object.keys(item.fieldSlots).length) return false;
|
|
60
|
-
if (slots && slots[getTableCellSlotName(item.prop)]) return false;
|
|
61
|
-
return true;
|
|
62
|
-
};
|
|
63
|
-
const plainColumnSet = computed(() => {
|
|
64
|
-
const set2 = /* @__PURE__ */ new Set();
|
|
65
|
-
props.columns.forEach((item) => {
|
|
66
|
-
var _a;
|
|
67
|
-
if ((_a = item.children) == null ? void 0 : _a.length) return;
|
|
68
|
-
if (isPlainColumn(item)) set2.add(item);
|
|
69
|
-
});
|
|
70
|
-
return set2;
|
|
71
|
-
});
|
|
72
|
-
const getPlainValue = (item, row) => {
|
|
73
|
-
var _a, _b;
|
|
74
|
-
const value = getValue(row, item.prop);
|
|
75
|
-
if (value === null || value === void 0 || value === "") {
|
|
76
|
-
return (_b = (_a = item.emptyValue) != null ? _a : props.emptyValue) != null ? _b : "";
|
|
77
|
-
}
|
|
78
|
-
return value;
|
|
79
|
-
};
|
|
80
47
|
const setFormRef = () => {
|
|
81
48
|
var _a, _b;
|
|
82
49
|
if (!((_a = plusDisplayItemInstance.value) == null ? void 0 : _a.length)) return;
|
|
@@ -89,11 +56,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
89
56
|
set(formRefs.value[item.rowIndex], item.cellIndex, item);
|
|
90
57
|
}
|
|
91
58
|
};
|
|
92
|
-
const needFormRefs = computed(
|
|
93
|
-
() => props.editable !== false || !props.plainTextCell || props.columns.some((item) => item.editable === true)
|
|
94
|
-
);
|
|
95
59
|
const cellInstanceSignature = computed(() => {
|
|
96
|
-
if (!needFormRefs.value) return "";
|
|
97
60
|
const list = plusDisplayItemInstance.value;
|
|
98
61
|
if (!(list == null ? void 0 : list.length)) return "";
|
|
99
62
|
return list.map((item) => {
|
|
@@ -104,7 +67,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
104
67
|
watch(
|
|
105
68
|
() => [props.tableDataLength, cellInstanceSignature.value, props.subPageInfo],
|
|
106
69
|
() => {
|
|
107
|
-
if (!needFormRefs.value) return;
|
|
108
70
|
setFormRef();
|
|
109
71
|
},
|
|
110
72
|
{
|
|
@@ -239,23 +201,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
239
201
|
],
|
|
240
202
|
64
|
|
241
203
|
/* STABLE_FRAGMENT */
|
|
242
|
-
)) : plainColumnSet.value.has(item) ? (openBlock(), createElementBlock(
|
|
243
|
-
Fragment,
|
|
244
|
-
{ key: 1 },
|
|
245
|
-
[
|
|
246
|
-
createCommentVNode(" \u7EAF\u6587\u672C\u5217\u5FEB\u8DEF\u5F84\uFF1A\u4E0D\u521B\u5EFA\u7EC4\u4EF6\u5B9E\u4F8B\u3001\u4E0D\u6CE8\u518C\u4EFB\u4F55 watcher "),
|
|
247
|
-
createElementVNode(
|
|
248
|
-
"span",
|
|
249
|
-
_hoisted_2,
|
|
250
|
-
toDisplayString(getPlainValue(item, row)),
|
|
251
|
-
1
|
|
252
|
-
/* TEXT */
|
|
253
|
-
)
|
|
254
|
-
],
|
|
255
|
-
2112
|
|
256
|
-
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
257
204
|
)) : (openBlock(), createBlock(unref(PlusDisplayItem), {
|
|
258
|
-
key:
|
|
205
|
+
key: 1,
|
|
259
206
|
ref_for: true,
|
|
260
207
|
ref_key: "plusDisplayItemInstance",
|
|
261
208
|
ref: plusDisplayItemInstance,
|
|
@@ -46,7 +46,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
46
46
|
onClickDensity?: ((size: "" | "default" | "small" | "large") => any) | undefined;
|
|
47
47
|
}, {
|
|
48
48
|
columns: PlusColumn[];
|
|
49
|
-
|
|
49
|
+
originColumns: PlusColumn[];
|
|
50
50
|
titleBar: boolean | Partial<Partial<{
|
|
51
51
|
title?: string | undefined;
|
|
52
52
|
refresh?: boolean | undefined;
|
|
@@ -57,7 +57,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
57
57
|
color?: string | undefined;
|
|
58
58
|
} | undefined;
|
|
59
59
|
}>>;
|
|
60
|
-
|
|
60
|
+
defaultSize: "" | "default" | "small" | "large";
|
|
61
61
|
columnsIsChange: boolean;
|
|
62
62
|
}, {}>, {
|
|
63
63
|
title?(_: {}): any;
|
|
@@ -469,17 +469,6 @@ export type PlusTableSelfProps = {
|
|
|
469
469
|
* @version 0.1.31
|
|
470
470
|
*/
|
|
471
471
|
emptyValue?: PlusColumn['emptyValue'];
|
|
472
|
-
/**
|
|
473
|
-
* 纯文本单元格快路径。
|
|
474
|
-
* 开启后,不涉及自定义渲染 / 格式化 / 插槽 / 编辑的普通文本列将直接用 span 输出,
|
|
475
|
-
* 不再为每个单元格创建 PlusDisplayItem 组件实例。
|
|
476
|
-
* 大数据量只读表格(数百行以上)开启可显著降低渲染开销。
|
|
477
|
-
*
|
|
478
|
-
* 注意:开启后这些列不再注册进 `formRefs`,
|
|
479
|
-
* 因此无法再通过 `formRefs[行索引][列索引].startCellEdit()` 程序化编辑它们。
|
|
480
|
-
* @default false
|
|
481
|
-
*/
|
|
482
|
-
plainTextCell?: boolean;
|
|
483
472
|
};
|
|
484
473
|
export type PlusTableProps = PlusTableSelfProps & Partial<TableProps<any[]>> & RecordType;
|
|
485
474
|
/**
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ShallowRef, Ref } from 'vue';
|
|
2
|
+
import { PlusColumn } from 'tabula-vue/es/types';
|
|
3
|
+
|
|
4
|
+
export interface UseTableColumnsOptions {
|
|
5
|
+
/**
|
|
6
|
+
* 原始列配置,支持传入 getter
|
|
7
|
+
*/
|
|
8
|
+
columns: () => PlusColumn[];
|
|
9
|
+
/**
|
|
10
|
+
* 列配置内容完全一致时跳过重建,避免父组件任意一次 re-render 都重建全部单元格
|
|
11
|
+
* @default true
|
|
12
|
+
*/
|
|
13
|
+
skipEqual?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 表格列过滤逻辑(el-table 与 el-table-v2 共用)
|
|
17
|
+
*
|
|
18
|
+
* - filterColumns:用于表头过滤(列设置)的完整列
|
|
19
|
+
* - subColumns:实际展示的列(剔除 hideInTable 与未勾选的列)
|
|
20
|
+
*/
|
|
21
|
+
export declare const useTableColumns: ({ columns, skipEqual }: UseTableColumnsOptions) => {
|
|
22
|
+
filterColumns: ShallowRef<PlusColumn[]>;
|
|
23
|
+
subColumns: ShallowRef<PlusColumn[]>;
|
|
24
|
+
columnsIsChange: Ref<boolean>;
|
|
25
|
+
setFilterColumns: (_columns: PlusColumn[]) => void;
|
|
26
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { shallowRef, ref, unref, watch } from 'vue';
|
|
2
|
+
import { isEqual } from 'lodash-es';
|
|
3
|
+
|
|
4
|
+
const useTableColumns = ({ columns, skipEqual = true }) => {
|
|
5
|
+
const filterColumns = shallowRef([]);
|
|
6
|
+
const subColumns = shallowRef([]);
|
|
7
|
+
const columnsIsChange = ref(false);
|
|
8
|
+
const resolveSubColumns = (list) => list.filter((item) => unref(item.hideInTable) !== true && item.headerIsChecked !== false);
|
|
9
|
+
watch(
|
|
10
|
+
columns,
|
|
11
|
+
(val, oldVal) => {
|
|
12
|
+
if (skipEqual && oldVal && isEqual(val, oldVal)) return;
|
|
13
|
+
const filterOriginColumns = val.filter((item) => unref(item.hideInTable) !== true);
|
|
14
|
+
filterColumns.value = filterOriginColumns.map((item) => {
|
|
15
|
+
var _a;
|
|
16
|
+
return {
|
|
17
|
+
...item,
|
|
18
|
+
headerIsChecked: (_a = item.headerIsChecked) != null ? _a : true
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
subColumns.value = filterOriginColumns.filter((item) => unref(item.headerIsChecked) !== false);
|
|
22
|
+
columnsIsChange.value = !columnsIsChange.value;
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
immediate: true
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
const setFilterColumns = (_columns) => {
|
|
29
|
+
filterColumns.value = _columns;
|
|
30
|
+
subColumns.value = resolveSubColumns(_columns);
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
filterColumns,
|
|
34
|
+
subColumns,
|
|
35
|
+
columnsIsChange,
|
|
36
|
+
setFilterColumns
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { useTableColumns };
|