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
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
import { defineComponent, useSlots, ref, shallowRef, reactive, computed, watch, h, onMounted, onBeforeUnmount, provide, openBlock, createElementBlock, createCommentVNode, createBlock, unref, createSlots, withCtx, renderSlot, withDirectives, normalizeStyle, createVNode, mergeProps } from 'vue';
|
|
2
|
+
import { debounce } from 'lodash-es';
|
|
3
|
+
import { ElAutoResizer, ElTableV2, ElEmpty, vLoading } from 'element-plus';
|
|
4
|
+
import { PlusPagination } from '../../pagination/index.mjs';
|
|
5
|
+
import '../../../constants/index.mjs';
|
|
6
|
+
import '../../utils/index.mjs';
|
|
7
|
+
import '../../table/index.mjs';
|
|
8
|
+
import '../../../hooks/index.mjs';
|
|
9
|
+
import { buildDataColumns } from './column-converter.mjs';
|
|
10
|
+
import { buildRadioColumn, buildSelectionColumn, buildIndexColumn } from './special-columns.mjs';
|
|
11
|
+
import { toColumnNumber, useTableV2Columns } from './use-table-v2-columns.mjs';
|
|
12
|
+
import TableV2Cell from './table-v2-cell.mjs';
|
|
13
|
+
import { useLocale } from '../../../hooks/useLocale.mjs';
|
|
14
|
+
import { DefaultPageInfo } from '../../../constants/page.mjs';
|
|
15
|
+
import { useTableColumns } from '../../table/src/use-columns.mjs';
|
|
16
|
+
import { isPlainObject } from '../../utils/is.mjs';
|
|
17
|
+
import PlusTableActionBarContent from '../../table/src/table-action-bar-content.vue.mjs';
|
|
18
|
+
import { TableFormRefInjectionKey, TableFormFieldRefInjectionKey } from '../../../constants/form.mjs';
|
|
19
|
+
import PlusTableTitleBar from '../../table/src/table-title-bar.vue.mjs';
|
|
20
|
+
|
|
21
|
+
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
22
|
+
...{
|
|
23
|
+
name: "PlusTableV2",
|
|
24
|
+
inheritAttrs: false
|
|
25
|
+
},
|
|
26
|
+
__name: "index",
|
|
27
|
+
props: {
|
|
28
|
+
tableData: { default: () => [] },
|
|
29
|
+
data: { default: () => [] },
|
|
30
|
+
columns: { default: () => [] },
|
|
31
|
+
defaultSize: { default: "default" },
|
|
32
|
+
pagination: { type: [Boolean, Object], default: false },
|
|
33
|
+
actionBar: { type: [Boolean, Object], default: false },
|
|
34
|
+
hasIndexColumn: { type: Boolean, default: false },
|
|
35
|
+
titleBar: { type: [Boolean, Object], default: true },
|
|
36
|
+
isSelection: { type: Boolean, default: false },
|
|
37
|
+
isRadio: { type: Boolean, default: false },
|
|
38
|
+
specialColumnsOrder: { default: () => ["radio", "selection", "index"] },
|
|
39
|
+
loadingStatus: { type: Boolean, default: false },
|
|
40
|
+
height: { default: void 0 },
|
|
41
|
+
width: { default: void 0 },
|
|
42
|
+
rowHeight: { default: void 0 },
|
|
43
|
+
headerHeight: { default: 50 },
|
|
44
|
+
headerCellStyle: { default: () => ({
|
|
45
|
+
"background-color": "var(--el-fill-color-light)"
|
|
46
|
+
}) },
|
|
47
|
+
rowKey: { default: "id" },
|
|
48
|
+
defaultSelectedRadioRow: { default: void 0 },
|
|
49
|
+
radioProps: { default: void 0 },
|
|
50
|
+
selectionTableColumnProps: { default: () => ({ width: 40 }) },
|
|
51
|
+
radioTableColumnProps: { default: () => ({ width: 50 }) },
|
|
52
|
+
indexTableColumnProps: { default: () => ({}) },
|
|
53
|
+
indexContentStyle: { type: [Object, Function], default: () => ({}) },
|
|
54
|
+
editable: { type: [Boolean, String], default: false },
|
|
55
|
+
adaptive: { type: [Boolean, Object], default: false },
|
|
56
|
+
emptyValue: { default: void 0 }
|
|
57
|
+
},
|
|
58
|
+
emits: ["paginationChange", "clickAction", "clickActionConfirmCancel", "formChange", "refresh", "edited", "cell-click", "cell-dblclick", "filterTableHeader", "radioChange", "selection-change", "row-click", "row-dblclick"],
|
|
59
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
60
|
+
var _a, _b;
|
|
61
|
+
const props = __props;
|
|
62
|
+
const emit = __emit;
|
|
63
|
+
const { t } = useLocale();
|
|
64
|
+
const slots = useSlots();
|
|
65
|
+
const tableWrapperInstance = ref(null);
|
|
66
|
+
const tableInstance = shallowRef(null);
|
|
67
|
+
const paginationInstance = ref(null);
|
|
68
|
+
const state = reactive({
|
|
69
|
+
size: props.defaultSize,
|
|
70
|
+
subPageInfo: {
|
|
71
|
+
...((_a = props.pagination) == null ? void 0 : _a.modelValue) || DefaultPageInfo
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
const __tableData = computed(
|
|
75
|
+
() => {
|
|
76
|
+
var _a2;
|
|
77
|
+
return ((_a2 = props.tableData) == null ? void 0 : _a2.length) ? props.tableData : props.data;
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
const { subColumns, filterColumns, columnsIsChange, setFilterColumns } = useTableColumns({
|
|
81
|
+
columns: () => props.columns
|
|
82
|
+
});
|
|
83
|
+
const formRefs = shallowRef({});
|
|
84
|
+
const formFieldRefs = shallowRef({});
|
|
85
|
+
const sizeRowHeightMap = {
|
|
86
|
+
default: 50,
|
|
87
|
+
large: 60,
|
|
88
|
+
small: 40
|
|
89
|
+
};
|
|
90
|
+
const currentRowHeight = computed(() => {
|
|
91
|
+
var _a2, _b2;
|
|
92
|
+
return (_b2 = (_a2 = props.rowHeight) != null ? _a2 : sizeRowHeightMap[state.size]) != null ? _b2 : 50;
|
|
93
|
+
});
|
|
94
|
+
const containerWidth = ref(0);
|
|
95
|
+
const fillHeight = ref(400);
|
|
96
|
+
const tableWidth = computed(() => {
|
|
97
|
+
if (props.width !== void 0) return toColumnNumber(props.width);
|
|
98
|
+
return Math.max(containerWidth.value, 1);
|
|
99
|
+
});
|
|
100
|
+
const tableHeight = computed(() => {
|
|
101
|
+
if (props.height !== void 0) return toColumnNumber(props.height);
|
|
102
|
+
return fillHeight.value;
|
|
103
|
+
});
|
|
104
|
+
const bodyHeight = computed(() => `${tableHeight.value}px`);
|
|
105
|
+
const calcFillHeight = () => {
|
|
106
|
+
var _a2;
|
|
107
|
+
if (!tableWrapperInstance.value) return;
|
|
108
|
+
let offsetBottom = 20;
|
|
109
|
+
if (isPlainObject(props.adaptive)) {
|
|
110
|
+
offsetBottom = (_a2 = props.adaptive.offsetBottom) != null ? _a2 : offsetBottom;
|
|
111
|
+
}
|
|
112
|
+
const paginationHeight = paginationInstance.value && props.pagination ? paginationInstance.value.$el.offsetHeight : 0;
|
|
113
|
+
const top = tableWrapperInstance.value.getBoundingClientRect().top;
|
|
114
|
+
fillHeight.value = Math.max(window.innerHeight - top - offsetBottom - paginationHeight, 100);
|
|
115
|
+
};
|
|
116
|
+
const handleResize = ({ width }) => {
|
|
117
|
+
containerWidth.value = width;
|
|
118
|
+
};
|
|
119
|
+
const debounceCalcFillHeight = debounce(
|
|
120
|
+
calcFillHeight,
|
|
121
|
+
isPlainObject(props.adaptive) ? (_b = props.adaptive.timeout) != null ? _b : 60 : 60
|
|
122
|
+
);
|
|
123
|
+
const radioRow = ref({});
|
|
124
|
+
watch(
|
|
125
|
+
() => props.defaultSelectedRadioRow,
|
|
126
|
+
(val) => {
|
|
127
|
+
radioRow.value = val != null ? val : {};
|
|
128
|
+
},
|
|
129
|
+
{ immediate: true }
|
|
130
|
+
);
|
|
131
|
+
const selectedRows = ref([]);
|
|
132
|
+
const getRowKeyValue = (row) => row == null ? void 0 : row[props.rowKey];
|
|
133
|
+
const isRowSelected = (row) => {
|
|
134
|
+
const key = getRowKeyValue(row);
|
|
135
|
+
return selectedRows.value.some((item) => getRowKeyValue(item) === key);
|
|
136
|
+
};
|
|
137
|
+
const isAllSelected = () => __tableData.value.length > 0 && selectedRows.value.length === __tableData.value.length;
|
|
138
|
+
const isIndeterminate = () => selectedRows.value.length > 0 && selectedRows.value.length < __tableData.value.length;
|
|
139
|
+
const handleToggleRow = (row, checked) => {
|
|
140
|
+
const key = getRowKeyValue(row);
|
|
141
|
+
const rest = selectedRows.value.filter((item) => getRowKeyValue(item) !== key);
|
|
142
|
+
selectedRows.value = checked ? [...rest, row] : rest;
|
|
143
|
+
emit("selection-change", selectedRows.value);
|
|
144
|
+
};
|
|
145
|
+
const handleToggleAll = (checked) => {
|
|
146
|
+
selectedRows.value = checked ? [...__tableData.value] : [];
|
|
147
|
+
emit("selection-change", selectedRows.value);
|
|
148
|
+
};
|
|
149
|
+
const handleRadioChange = (value, row) => {
|
|
150
|
+
radioRow.value = value ? row : {};
|
|
151
|
+
emit("radioChange", row, __tableData.value.indexOf(row), !!value);
|
|
152
|
+
};
|
|
153
|
+
const handleFormChange = (data) => {
|
|
154
|
+
emit("formChange", data);
|
|
155
|
+
};
|
|
156
|
+
const handleRefresh = () => {
|
|
157
|
+
emit("refresh");
|
|
158
|
+
};
|
|
159
|
+
const handleClickDensity = (size) => {
|
|
160
|
+
state.size = size;
|
|
161
|
+
};
|
|
162
|
+
const handleFilterTableConfirm = (list, eventType) => {
|
|
163
|
+
setFilterColumns(list);
|
|
164
|
+
emit("filterTableHeader", list, eventType);
|
|
165
|
+
};
|
|
166
|
+
const handlePaginationChange = () => {
|
|
167
|
+
emit("paginationChange", { ...state.subPageInfo });
|
|
168
|
+
};
|
|
169
|
+
const getCellForm = (row, column) => {
|
|
170
|
+
var _a2;
|
|
171
|
+
const rowIndex = __tableData.value.indexOf(row);
|
|
172
|
+
const columnIndex = subColumns.value.findIndex((item) => item.prop === column.prop);
|
|
173
|
+
if (rowIndex < 0 || columnIndex < 0) return null;
|
|
174
|
+
return ((_a2 = formRefs.value[rowIndex]) == null ? void 0 : _a2[columnIndex]) || null;
|
|
175
|
+
};
|
|
176
|
+
const currentForm = shallowRef(null);
|
|
177
|
+
const startCellEdit = (row, column) => {
|
|
178
|
+
var _a2;
|
|
179
|
+
const cellForm = getCellForm(row, column);
|
|
180
|
+
if (!cellForm) return;
|
|
181
|
+
document.addEventListener("click", handleStopEditClick);
|
|
182
|
+
(_a2 = currentForm.value) == null ? void 0 : _a2.stopCellEdit();
|
|
183
|
+
currentForm.value = cellForm;
|
|
184
|
+
cellForm.startCellEdit();
|
|
185
|
+
const unwatch = watch(
|
|
186
|
+
() => formFieldRefs.value.valueIsReady,
|
|
187
|
+
(val) => {
|
|
188
|
+
var _a3, _b2;
|
|
189
|
+
if ((val == null ? void 0 : val.value) && ((_b2 = (_a3 = formFieldRefs.value) == null ? void 0 : _a3.fieldInstance) == null ? void 0 : _b2.focus)) {
|
|
190
|
+
formFieldRefs.value.fieldInstance.focus();
|
|
191
|
+
unwatch();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
};
|
|
196
|
+
const handleStopEditClick = (event) => {
|
|
197
|
+
var _a2;
|
|
198
|
+
if (!tableWrapperInstance.value || !currentForm.value) return;
|
|
199
|
+
const target = event == null ? void 0 : event.target;
|
|
200
|
+
if ((_a2 = target == null ? void 0 : target.classList) == null ? void 0 : _a2.contains("el-icon")) return;
|
|
201
|
+
if (tableWrapperInstance.value.contains(target)) return;
|
|
202
|
+
currentForm.value.stopCellEdit();
|
|
203
|
+
currentForm.value = null;
|
|
204
|
+
emit("edited");
|
|
205
|
+
document.removeEventListener("click", handleStopEditClick);
|
|
206
|
+
};
|
|
207
|
+
const handleCellClick = (row, column, event) => {
|
|
208
|
+
if (props.editable === "click") startCellEdit(row, column);
|
|
209
|
+
emit("cell-click", row, column, event.currentTarget, event);
|
|
210
|
+
};
|
|
211
|
+
const handleCellDblclick = (row, column, event) => {
|
|
212
|
+
if (props.editable === "dblclick") startCellEdit(row, column);
|
|
213
|
+
emit("cell-dblclick", row, column, event.currentTarget, event);
|
|
214
|
+
};
|
|
215
|
+
const getCellSlots = () => {
|
|
216
|
+
const cellSlots = {};
|
|
217
|
+
Object.keys(slots).forEach((key) => {
|
|
218
|
+
if (key.startsWith("plus-") || key === "edit-icon") {
|
|
219
|
+
cellSlots[key] = slots[key];
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
return cellSlots;
|
|
223
|
+
};
|
|
224
|
+
const renderCell = ({
|
|
225
|
+
column,
|
|
226
|
+
row,
|
|
227
|
+
rowIndex,
|
|
228
|
+
columnIndex
|
|
229
|
+
}) => h(
|
|
230
|
+
TableV2Cell,
|
|
231
|
+
{
|
|
232
|
+
column,
|
|
233
|
+
row,
|
|
234
|
+
index: rowIndex,
|
|
235
|
+
cellIndex: columnIndex,
|
|
236
|
+
editable: props.editable,
|
|
237
|
+
emptyValue: props.emptyValue,
|
|
238
|
+
onCellClick: handleCellClick,
|
|
239
|
+
onCellDblclick: handleCellDblclick,
|
|
240
|
+
onFormChange: handleFormChange
|
|
241
|
+
},
|
|
242
|
+
getCellSlots()
|
|
243
|
+
);
|
|
244
|
+
const dataColumns = computed(
|
|
245
|
+
() => buildDataColumns({
|
|
246
|
+
columns: subColumns.value,
|
|
247
|
+
renderCell,
|
|
248
|
+
slots
|
|
249
|
+
})
|
|
250
|
+
);
|
|
251
|
+
const actionBarColumn = computed(() => {
|
|
252
|
+
var _a2;
|
|
253
|
+
if (!props.actionBar) return null;
|
|
254
|
+
const actionBar = props.actionBar;
|
|
255
|
+
return {
|
|
256
|
+
key: "actionBar",
|
|
257
|
+
title: actionBar.label || t("plus.table.action"),
|
|
258
|
+
width: toColumnNumber(actionBar.width) || 200,
|
|
259
|
+
fixed: actionBar.fixed || "right",
|
|
260
|
+
align: (_a2 = actionBar.actionBarTableColumnProps) == null ? void 0 : _a2.align,
|
|
261
|
+
cellRenderer: ({ rowData, rowIndex }) => h(
|
|
262
|
+
PlusTableActionBarContent,
|
|
263
|
+
{
|
|
264
|
+
row: rowData,
|
|
265
|
+
index: rowIndex,
|
|
266
|
+
type: actionBar.type,
|
|
267
|
+
buttons: actionBar.buttons,
|
|
268
|
+
showNumber: actionBar.showNumber,
|
|
269
|
+
showLimitIncludeMore: actionBar.showLimitIncludeMore,
|
|
270
|
+
confirmType: actionBar.confirmType,
|
|
271
|
+
moreType: actionBar.moreType,
|
|
272
|
+
onClickAction: (data) => emit("clickAction", data),
|
|
273
|
+
onClickActionConfirmCancel: (data) => emit("clickActionConfirmCancel", data)
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"action-bar-more-icon": () => {
|
|
277
|
+
var _a3;
|
|
278
|
+
return (_a3 = slots["action-bar-more-icon"]) == null ? void 0 : _a3.call(slots);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
)
|
|
282
|
+
};
|
|
283
|
+
});
|
|
284
|
+
const specialColumns = computed(() => {
|
|
285
|
+
const activeList = [];
|
|
286
|
+
if (props.isRadio) activeList.push("radio");
|
|
287
|
+
if (props.isSelection) activeList.push("selection");
|
|
288
|
+
if (props.hasIndexColumn) activeList.push("index");
|
|
289
|
+
const defaultOrder = ["radio", "selection", "index"];
|
|
290
|
+
const order = [...props.specialColumnsOrder || [], ...defaultOrder].filter(
|
|
291
|
+
(item, index, array) => array.indexOf(item) === index
|
|
292
|
+
);
|
|
293
|
+
return order.filter((item) => activeList.includes(item)).map((item) => {
|
|
294
|
+
if (item === "radio") {
|
|
295
|
+
return buildRadioColumn({
|
|
296
|
+
radioRow: () => radioRow.value,
|
|
297
|
+
onChange: handleRadioChange,
|
|
298
|
+
radioProps: props.radioProps,
|
|
299
|
+
columnProps: props.radioTableColumnProps
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
if (item === "selection") {
|
|
303
|
+
return buildSelectionColumn({
|
|
304
|
+
isSelected: isRowSelected,
|
|
305
|
+
isAllSelected,
|
|
306
|
+
isIndeterminate,
|
|
307
|
+
onToggleRow: handleToggleRow,
|
|
308
|
+
onToggleAll: handleToggleAll,
|
|
309
|
+
columnProps: props.selectionTableColumnProps
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
return buildIndexColumn({
|
|
313
|
+
pageInfo: state.subPageInfo,
|
|
314
|
+
indexContentStyle: props.indexContentStyle,
|
|
315
|
+
columnProps: props.indexTableColumnProps
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
const allColumns = computed(() => {
|
|
320
|
+
const list = [...specialColumns.value, ...dataColumns.value];
|
|
321
|
+
if (actionBarColumn.value) list.push(actionBarColumn.value);
|
|
322
|
+
return list;
|
|
323
|
+
});
|
|
324
|
+
const { resolvedColumns } = useTableV2Columns({
|
|
325
|
+
columns: () => allColumns.value,
|
|
326
|
+
containerWidth: () => tableWidth.value
|
|
327
|
+
});
|
|
328
|
+
const headerCellProps = () => ({ style: props.headerCellStyle });
|
|
329
|
+
const rowEventHandlers = computed(() => ({
|
|
330
|
+
onClick: ({ rowData, rowIndex, event }) => {
|
|
331
|
+
emit("row-click", rowData, rowIndex, event);
|
|
332
|
+
},
|
|
333
|
+
onDblclick: ({ rowData, rowIndex, event }) => {
|
|
334
|
+
emit("row-dblclick", rowData, rowIndex, event);
|
|
335
|
+
}
|
|
336
|
+
}));
|
|
337
|
+
onMounted(() => {
|
|
338
|
+
calcFillHeight();
|
|
339
|
+
window.addEventListener("resize", debounceCalcFillHeight);
|
|
340
|
+
});
|
|
341
|
+
onBeforeUnmount(() => {
|
|
342
|
+
window.removeEventListener("resize", debounceCalcFillHeight);
|
|
343
|
+
document.removeEventListener("click", handleStopEditClick);
|
|
344
|
+
});
|
|
345
|
+
provide(TableFormRefInjectionKey, formRefs);
|
|
346
|
+
provide(TableFormFieldRefInjectionKey, formFieldRefs);
|
|
347
|
+
__expose({
|
|
348
|
+
formRefs,
|
|
349
|
+
tableInstance,
|
|
350
|
+
/** 滚动到指定垂直位置 */
|
|
351
|
+
scrollToTop: (top) => {
|
|
352
|
+
var _a2;
|
|
353
|
+
return (_a2 = tableInstance.value) == null ? void 0 : _a2.scrollToTop(top);
|
|
354
|
+
},
|
|
355
|
+
/** 滚动到指定水平位置 */
|
|
356
|
+
scrollToLeft: (left) => {
|
|
357
|
+
var _a2;
|
|
358
|
+
return (_a2 = tableInstance.value) == null ? void 0 : _a2.scrollToLeft(left);
|
|
359
|
+
},
|
|
360
|
+
/** 滚动到指定行 */
|
|
361
|
+
scrollToRow: (row, strategy) => {
|
|
362
|
+
var _a2;
|
|
363
|
+
return (_a2 = tableInstance.value) == null ? void 0 : _a2.scrollToRow(row, strategy);
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
return (_ctx, _cache) => {
|
|
367
|
+
return openBlock(), createElementBlock(
|
|
368
|
+
"div",
|
|
369
|
+
{
|
|
370
|
+
ref_key: "tableWrapperInstance",
|
|
371
|
+
ref: tableWrapperInstance,
|
|
372
|
+
class: "plus-table-v2"
|
|
373
|
+
},
|
|
374
|
+
[
|
|
375
|
+
createCommentVNode(" \u6807\u9898\u680F\uFF1A\u5237\u65B0 / \u5BC6\u5EA6 / \u5217\u8BBE\u7F6E\uFF0C\u4E0E el-table \u7248\u672C\u590D\u7528\u540C\u4E00\u7EC4\u4EF6 "),
|
|
376
|
+
_ctx.titleBar ? (openBlock(), createBlock(unref(PlusTableTitleBar), {
|
|
377
|
+
key: 0,
|
|
378
|
+
"origin-columns": _ctx.columns,
|
|
379
|
+
columns: unref(filterColumns),
|
|
380
|
+
"default-size": state.size,
|
|
381
|
+
"columns-is-change": unref(columnsIsChange),
|
|
382
|
+
"title-bar": _ctx.titleBar,
|
|
383
|
+
onClickDensity: handleClickDensity,
|
|
384
|
+
onFilterTableHeader: handleFilterTableConfirm,
|
|
385
|
+
onRefresh: handleRefresh
|
|
386
|
+
}, createSlots({
|
|
387
|
+
title: withCtx(() => [
|
|
388
|
+
renderSlot(_ctx.$slots, "title")
|
|
389
|
+
]),
|
|
390
|
+
toolbar: withCtx(() => [
|
|
391
|
+
renderSlot(_ctx.$slots, "toolbar")
|
|
392
|
+
]),
|
|
393
|
+
_: 2
|
|
394
|
+
/* DYNAMIC */
|
|
395
|
+
}, [
|
|
396
|
+
_ctx.$slots["column-settings-icon"] ? {
|
|
397
|
+
name: "column-settings-icon",
|
|
398
|
+
fn: withCtx(() => [
|
|
399
|
+
renderSlot(_ctx.$slots, "column-settings-icon")
|
|
400
|
+
]),
|
|
401
|
+
key: "0"
|
|
402
|
+
} : void 0,
|
|
403
|
+
_ctx.$slots["density-icon"] ? {
|
|
404
|
+
name: "density-icon",
|
|
405
|
+
fn: withCtx(() => [
|
|
406
|
+
renderSlot(_ctx.$slots, "density-icon")
|
|
407
|
+
]),
|
|
408
|
+
key: "1"
|
|
409
|
+
} : void 0
|
|
410
|
+
]), 1032, ["origin-columns", "columns", "default-size", "columns-is-change", "title-bar"])) : createCommentVNode("v-if", true),
|
|
411
|
+
createCommentVNode(" \u865A\u62DF\u8868\u683C\u4E3B\u4F53\uFF1A\u5BBD\u5EA6\u6491\u6EE1\u7236\u5BB9\u5668\uFF0C\u9AD8\u5EA6\u6309 props.height / adaptive \u8BA1\u7B97 "),
|
|
412
|
+
withDirectives((openBlock(), createElementBlock(
|
|
413
|
+
"div",
|
|
414
|
+
{
|
|
415
|
+
class: "plus-table-v2__body",
|
|
416
|
+
style: normalizeStyle({ height: bodyHeight.value })
|
|
417
|
+
},
|
|
418
|
+
[
|
|
419
|
+
createVNode(unref(ElAutoResizer), {
|
|
420
|
+
"disable-height": true,
|
|
421
|
+
"on-resize": handleResize
|
|
422
|
+
}, {
|
|
423
|
+
default: withCtx(() => [
|
|
424
|
+
createVNode(unref(ElTableV2), mergeProps({
|
|
425
|
+
ref_key: "tableInstance",
|
|
426
|
+
ref: tableInstance,
|
|
427
|
+
columns: unref(resolvedColumns),
|
|
428
|
+
data: __tableData.value,
|
|
429
|
+
width: tableWidth.value,
|
|
430
|
+
height: tableHeight.value,
|
|
431
|
+
"row-height": currentRowHeight.value,
|
|
432
|
+
"header-height": _ctx.headerHeight,
|
|
433
|
+
"row-key": _ctx.rowKey,
|
|
434
|
+
"header-cell-props": headerCellProps,
|
|
435
|
+
"row-event-handlers": rowEventHandlers.value,
|
|
436
|
+
fixed: true,
|
|
437
|
+
"scrollbar-always-on": true
|
|
438
|
+
}, _ctx.$attrs), {
|
|
439
|
+
empty: withCtx(() => [
|
|
440
|
+
renderSlot(_ctx.$slots, "empty", {}, () => [
|
|
441
|
+
createVNode(unref(ElEmpty))
|
|
442
|
+
])
|
|
443
|
+
]),
|
|
444
|
+
_: 3
|
|
445
|
+
/* FORWARDED */
|
|
446
|
+
}, 16, ["columns", "data", "width", "height", "row-height", "header-height", "row-key", "row-event-handlers"])
|
|
447
|
+
]),
|
|
448
|
+
_: 3
|
|
449
|
+
/* FORWARDED */
|
|
450
|
+
})
|
|
451
|
+
],
|
|
452
|
+
4
|
|
453
|
+
/* STYLE */
|
|
454
|
+
)), [
|
|
455
|
+
[unref(vLoading), _ctx.loadingStatus]
|
|
456
|
+
]),
|
|
457
|
+
createCommentVNode(" \u5206\u9875 "),
|
|
458
|
+
_ctx.pagination ? (openBlock(), createBlock(unref(PlusPagination), mergeProps({
|
|
459
|
+
key: 1,
|
|
460
|
+
ref_key: "paginationInstance",
|
|
461
|
+
ref: paginationInstance,
|
|
462
|
+
modelValue: state.subPageInfo,
|
|
463
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => state.subPageInfo = $event)
|
|
464
|
+
}, _ctx.pagination, { onChange: handlePaginationChange }), createSlots({
|
|
465
|
+
_: 2
|
|
466
|
+
/* DYNAMIC */
|
|
467
|
+
}, [
|
|
468
|
+
_ctx.$slots["pagination-left"] ? {
|
|
469
|
+
name: "pagination-left",
|
|
470
|
+
fn: withCtx(() => [
|
|
471
|
+
renderSlot(_ctx.$slots, "pagination-left")
|
|
472
|
+
]),
|
|
473
|
+
key: "0"
|
|
474
|
+
} : void 0,
|
|
475
|
+
_ctx.$slots["pagination-right"] ? {
|
|
476
|
+
name: "pagination-right",
|
|
477
|
+
fn: withCtx(() => [
|
|
478
|
+
renderSlot(_ctx.$slots, "pagination-right")
|
|
479
|
+
]),
|
|
480
|
+
key: "1"
|
|
481
|
+
} : void 0
|
|
482
|
+
]), 1040, ["modelValue"])) : createCommentVNode("v-if", true)
|
|
483
|
+
],
|
|
484
|
+
512
|
|
485
|
+
/* NEED_PATCH */
|
|
486
|
+
);
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { PageInfo, RecordType } from 'tabula-vue/es/types';
|
|
2
|
+
import { PlusRadioProps } from 'tabula-vue/es/components/radio';
|
|
3
|
+
import { Column } from 'element-plus';
|
|
4
|
+
import { CSSProperties } from 'vue';
|
|
5
|
+
|
|
6
|
+
/** 列配置的宽松类型(兼容 el-table 的 width / fixed / align 等) */
|
|
7
|
+
type ColumnConfig = RecordType;
|
|
8
|
+
/**
|
|
9
|
+
* 序号列参数
|
|
10
|
+
*/
|
|
11
|
+
export interface BuildIndexColumnParams {
|
|
12
|
+
/** 当前页码信息,用于计算跨页序号 */
|
|
13
|
+
pageInfo?: PageInfo;
|
|
14
|
+
/** 单元格样式 */
|
|
15
|
+
indexContentStyle?: Partial<CSSProperties> | ((row: RecordType, index: number) => Partial<CSSProperties>);
|
|
16
|
+
/** 列配置(兼容 el-table 的 width / fixed / align 等) */
|
|
17
|
+
columnProps?: ColumnConfig;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 构建序号列
|
|
21
|
+
*/
|
|
22
|
+
export declare const buildIndexColumn: ({ pageInfo, indexContentStyle, columnProps }: BuildIndexColumnParams) => Column;
|
|
23
|
+
/**
|
|
24
|
+
* 单选列参数
|
|
25
|
+
*/
|
|
26
|
+
export interface BuildRadioColumnParams {
|
|
27
|
+
/** 当前选中的行 */
|
|
28
|
+
radioRow: () => RecordType;
|
|
29
|
+
/** 选中变化 */
|
|
30
|
+
onChange: (value: PlusRadioProps['modelValue'], row: RecordType) => void;
|
|
31
|
+
/** PlusRadio 的 props */
|
|
32
|
+
radioProps?: Partial<PlusRadioProps>;
|
|
33
|
+
/** 列配置 */
|
|
34
|
+
columnProps?: ColumnConfig;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 构建单选列
|
|
38
|
+
*/
|
|
39
|
+
export declare const buildRadioColumn: ({ radioRow, onChange, radioProps, columnProps }: BuildRadioColumnParams) => Column;
|
|
40
|
+
/**
|
|
41
|
+
* 多选列参数
|
|
42
|
+
*/
|
|
43
|
+
export interface BuildSelectionColumnParams {
|
|
44
|
+
/** 判断某行是否选中 */
|
|
45
|
+
isSelected: (row: RecordType) => boolean;
|
|
46
|
+
/** 当前是否全选 */
|
|
47
|
+
isAllSelected: () => boolean;
|
|
48
|
+
/** 是否半选 */
|
|
49
|
+
isIndeterminate: () => boolean;
|
|
50
|
+
/** 单行选中变化 */
|
|
51
|
+
onToggleRow: (row: RecordType, checked: boolean) => void;
|
|
52
|
+
/** 全选变化 */
|
|
53
|
+
onToggleAll: (checked: boolean) => void;
|
|
54
|
+
/** 列配置 */
|
|
55
|
+
columnProps?: ColumnConfig;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 构建多选列(含表头全选)
|
|
59
|
+
*/
|
|
60
|
+
export declare const buildSelectionColumn: ({ isSelected, isAllSelected, isIndeterminate, onToggleRow, onToggleAll, columnProps }: BuildSelectionColumnParams) => Column;
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { h } from 'vue';
|
|
2
|
+
import { TableV2FixedDir, ElCheckbox } from 'element-plus';
|
|
3
|
+
import { PlusRadio } from '../../radio/index.mjs';
|
|
4
|
+
import '../../utils/index.mjs';
|
|
5
|
+
import { isNumber, isEqual } from 'lodash-es';
|
|
6
|
+
import { isFunction, isPlainObject } from '../../utils/is.mjs';
|
|
7
|
+
|
|
8
|
+
const toNumber = (value, fallback) => {
|
|
9
|
+
const num = Number(value);
|
|
10
|
+
return Number.isFinite(num) && num > 0 ? num : fallback;
|
|
11
|
+
};
|
|
12
|
+
const buildIndexColumn = ({
|
|
13
|
+
pageInfo,
|
|
14
|
+
indexContentStyle,
|
|
15
|
+
columnProps = {}
|
|
16
|
+
}) => {
|
|
17
|
+
const getIndex = isNumber(columnProps.index) ? () => columnProps.index : isFunction(columnProps.index) ? columnProps.index : (index) => (((pageInfo == null ? void 0 : pageInfo.page) || 1) - 1) * ((pageInfo == null ? void 0 : pageInfo.pageSize) || 10) + index + 1;
|
|
18
|
+
const resolveStyle = (row, index) => {
|
|
19
|
+
if (isFunction(indexContentStyle)) return indexContentStyle(row, index);
|
|
20
|
+
if (isPlainObject(indexContentStyle)) return indexContentStyle;
|
|
21
|
+
return {};
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
key: "index",
|
|
25
|
+
title: "#",
|
|
26
|
+
width: toNumber(columnProps.width, 60),
|
|
27
|
+
fixed: TableV2FixedDir.LEFT,
|
|
28
|
+
align: "center",
|
|
29
|
+
cellRenderer: ({ rowData, rowIndex }) => h("div", { class: "plus-table-v2-index", style: resolveStyle(rowData, rowIndex) }, [
|
|
30
|
+
String(getIndex(rowIndex))
|
|
31
|
+
])
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
const buildRadioColumn = ({
|
|
35
|
+
radioRow,
|
|
36
|
+
onChange,
|
|
37
|
+
radioProps,
|
|
38
|
+
columnProps = {}
|
|
39
|
+
}) => ({
|
|
40
|
+
key: "radio",
|
|
41
|
+
title: "",
|
|
42
|
+
width: toNumber(columnProps.width, 50),
|
|
43
|
+
fixed: TableV2FixedDir.LEFT,
|
|
44
|
+
align: "center",
|
|
45
|
+
cellRenderer: ({ rowData }) => h(PlusRadio, {
|
|
46
|
+
modelValue: isEqual(radioRow(), rowData),
|
|
47
|
+
options: [{ value: true }],
|
|
48
|
+
...radioProps,
|
|
49
|
+
onChange: (value) => onChange(value, rowData)
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
const buildSelectionColumn = ({
|
|
53
|
+
isSelected,
|
|
54
|
+
isAllSelected,
|
|
55
|
+
isIndeterminate,
|
|
56
|
+
onToggleRow,
|
|
57
|
+
onToggleAll,
|
|
58
|
+
columnProps = {}
|
|
59
|
+
}) => ({
|
|
60
|
+
key: "selection",
|
|
61
|
+
title: "",
|
|
62
|
+
width: toNumber(columnProps.width, 40),
|
|
63
|
+
fixed: TableV2FixedDir.LEFT,
|
|
64
|
+
align: "center",
|
|
65
|
+
headerCellRenderer: () => h(ElCheckbox, {
|
|
66
|
+
modelValue: isAllSelected(),
|
|
67
|
+
indeterminate: isIndeterminate(),
|
|
68
|
+
"onUpdate:modelValue": (checked) => onToggleAll(Boolean(checked))
|
|
69
|
+
}),
|
|
70
|
+
cellRenderer: ({ rowData }) => h(ElCheckbox, {
|
|
71
|
+
modelValue: isSelected(rowData),
|
|
72
|
+
"onUpdate:modelValue": (checked) => onToggleRow(rowData, Boolean(checked))
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
export { buildIndexColumn, buildRadioColumn, buildSelectionColumn };
|