stk-table-vue 1.0.0-beta.4 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{Dropdown-CtiuG-7-.js → Dropdown-Clc70S1z.js} +2 -2
- package/lib/{StkTable-Bz-71TiQ.js → StkTable-QUd4TJCF.js} +12 -8
- package/lib/stk-table-vue.js +27 -11
- package/lib/style.css +2 -1
- package/package.json +89 -85
- package/src/StkTable/StkTable.vue +3 -3
- package/src/StkTable/custom-cells/CheckboxCell/{Checkbox.vue → CheckboxCell.vue} +17 -2
- package/src/StkTable/custom-cells/CheckboxCell/createCheckboxCell.ts +1 -1
- package/src/StkTable/custom-cells/CheckboxCell/index.ts +1 -1
- package/src/StkTable/custom-cells/EditableCell/EditableCell.less +1 -0
- package/src/StkTable/features/useAreaSelection.ts +1 -0
- package/src/StkTable/useVirtualScroll.ts +4 -1
- /package/lib/src/StkTable/custom-cells/CheckboxCell/{Checkbox.vue.d.ts → CheckboxCell.vue.d.ts} +0 -0
- /package/src/StkTable/custom-cells/CheckboxCell/{Checkbox.less → CheckboxCell.less} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: stk-table-vue
|
|
3
|
-
* version: v1.0.0
|
|
3
|
+
* version: v1.0.0
|
|
4
4
|
* description: High performance realtime virtual table for vue3 and vue2.7
|
|
5
5
|
* author: japlus
|
|
6
6
|
* homepage: https://ja-plus.github.io/stk-table-vue/
|
|
7
7
|
* license: MIT
|
|
8
8
|
*/
|
|
9
|
-
import { t as StkTable_default } from "./StkTable-
|
|
9
|
+
import { t as StkTable_default } from "./StkTable-QUd4TJCF.js";
|
|
10
10
|
import { createElementBlock, createElementVNode, createVNode, defineComponent, h, nextTick, normalizeClass, normalizeStyle, onMounted, onUnmounted, openBlock, reactive, ref, withModifiers } from "vue";
|
|
11
11
|
//#region src/StkTable/custom-cells/FilterCell/Dropdown/index.vue?vue&type=script&setup=true&lang.ts
|
|
12
12
|
var DROPDOWN_DEFAULT_WIDTH = 300;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: stk-table-vue
|
|
3
|
-
* version: v1.0.0
|
|
3
|
+
* version: v1.0.0
|
|
4
4
|
* description: High performance realtime virtual table for vue3 and vue2.7
|
|
5
5
|
* author: japlus
|
|
6
6
|
* homepage: https://ja-plus.github.io/stk-table-vue/
|
|
@@ -543,6 +543,7 @@ function useAreaSelection(props, emits, tableContainerRef, dataSourceCopy, table
|
|
|
543
543
|
return [
|
|
544
544
|
ranges.length,
|
|
545
545
|
ranges.length > 0 ? JSON.stringify(ranges.map((r) => r.index)) : "",
|
|
546
|
+
vsx.scrollLeft,
|
|
546
547
|
vs.startIndex,
|
|
547
548
|
vs.endIndex,
|
|
548
549
|
vsx.startIndex,
|
|
@@ -3201,7 +3202,10 @@ function useVirtualScroll(props, tableContainerRef, trRef, dataSourceCopy, table
|
|
|
3201
3202
|
updateVirtualScrollX(scrollLeft);
|
|
3202
3203
|
}
|
|
3203
3204
|
let vue2ScrollYTimeout = null;
|
|
3204
|
-
/**
|
|
3205
|
+
/**
|
|
3206
|
+
* every row actual height.
|
|
3207
|
+
* FIXME: use a weak map instead of a plain map
|
|
3208
|
+
*/
|
|
3205
3209
|
const autoRowHeightMap = /* @__PURE__ */ new Map();
|
|
3206
3210
|
/** 如果行高度有变化,则要调用此方法清除保存的行高 */
|
|
3207
3211
|
function setAutoHeight(rowKey, height) {
|
|
@@ -4631,8 +4635,8 @@ var StkTable_default = /* @__PURE__ */ defineComponent({
|
|
|
4631
4635
|
class: "vt-x-left",
|
|
4632
4636
|
style: normalizeStyle(`min-width:${unref(theadVirtualX).offsetLeft}px;width:${unref(theadVirtualX).offsetLeft}px`)
|
|
4633
4637
|
}, null, 4)) : createCommentVNode("", true),
|
|
4634
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(virtualX_columnPart), (col) => {
|
|
4635
|
-
return openBlock(), createElementBlock(Fragment, { key: col.__VT_C_SP__ ?
|
|
4638
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(virtualX_columnPart), (col, _colIdx) => {
|
|
4639
|
+
return openBlock(), createElementBlock(Fragment, { key: col.__VT_C_SP__ ? `spacer-${_colIdx}` : colKeyGen.value(col) }, [col.__VT_C_SP__ ? (openBlock(), createElementBlock("td", {
|
|
4636
4640
|
key: 0,
|
|
4637
4641
|
class: "vt-x-spacer",
|
|
4638
4642
|
colspan: col.__VT_C_SP__
|
|
@@ -4686,8 +4690,8 @@ var StkTable_default = /* @__PURE__ */ defineComponent({
|
|
|
4686
4690
|
class: "vt-x-left",
|
|
4687
4691
|
style: normalizeStyle(`min-width:${unref(theadVirtualX).offsetLeft}px;width:${unref(theadVirtualX).offsetLeft}px`)
|
|
4688
4692
|
}, null, 4)) : createCommentVNode("", true),
|
|
4689
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(virtualX_columnPart), (col) => {
|
|
4690
|
-
return openBlock(), createElementBlock(Fragment, { key: col.__VT_C_SP__ ?
|
|
4693
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(virtualX_columnPart), (col, _colIdx) => {
|
|
4694
|
+
return openBlock(), createElementBlock(Fragment, { key: col.__VT_C_SP__ ? `spacer-${_colIdx}` : colKeyGen.value(col) }, [col.__VT_C_SP__ ? (openBlock(), createElementBlock("td", {
|
|
4691
4695
|
key: 0,
|
|
4692
4696
|
class: "vt-x-spacer",
|
|
4693
4697
|
colspan: col.__VT_C_SP__
|
|
@@ -4716,8 +4720,8 @@ var StkTable_default = /* @__PURE__ */ defineComponent({
|
|
|
4716
4720
|
col: row.__EXP_C__
|
|
4717
4721
|
}, () => [createTextVNode(toDisplayString(row.__EXP_R__ && row.__EXP_C__ && row.__EXP_R__[row.__EXP_C__.dataIndex] || ""), 1)])])], 8, _hoisted_12)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
4718
4722
|
unref(virtualX_on) ? (openBlock(), createElementBlock("td", _hoisted_14)) : createCommentVNode("", true),
|
|
4719
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(virtualX_columnPart), (col) => {
|
|
4720
|
-
return openBlock(), createElementBlock(Fragment, { key: col.__VT_C_SP__ ?
|
|
4723
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(virtualX_columnPart), (col, _colIdx) => {
|
|
4724
|
+
return openBlock(), createElementBlock(Fragment, { key: col.__VT_C_SP__ ? `spacer-${_colIdx}` : colKeyGen.value(col) }, [col.__VT_C_SP__ ? (openBlock(), createElementBlock("td", {
|
|
4721
4725
|
key: 0,
|
|
4722
4726
|
class: "vt-x-spacer",
|
|
4723
4727
|
colspan: col.__VT_C_SP__
|
package/lib/stk-table-vue.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: stk-table-vue
|
|
3
|
-
* version: v1.0.0
|
|
3
|
+
* version: v1.0.0
|
|
4
4
|
* description: High performance realtime virtual table for vue3 and vue2.7
|
|
5
5
|
* author: japlus
|
|
6
6
|
* homepage: https://ja-plus.github.io/stk-table-vue/
|
|
7
7
|
* license: MIT
|
|
8
8
|
*/
|
|
9
|
-
import { a as insertToOrderedArray, i as binarySearch, n as registerFeature, o as strCompare, r as useAreaSelection, s as tableSort, t as StkTable_default } from "./StkTable-
|
|
9
|
+
import { a as insertToOrderedArray, i as binarySearch, n as registerFeature, o as strCompare, r as useAreaSelection, s as tableSort, t as StkTable_default } from "./StkTable-QUd4TJCF.js";
|
|
10
10
|
import { Fragment, computed, createApp, createBlock, createElementBlock, createElementVNode, createTextVNode, defineComponent, getCurrentInstance, h, markRaw, nextTick, normalizeClass, openBlock, ref, renderSlot, resolveDynamicComponent, toDisplayString, watch, withModifiers } from "vue";
|
|
11
11
|
//#region src/StkTable/custom-cells/FilterCell/Dropdown/index.ts
|
|
12
12
|
var DropdownIns = null;
|
|
@@ -15,7 +15,7 @@ async function getDropdownIns() {
|
|
|
15
15
|
const div = document.createElement("div");
|
|
16
16
|
div.classList.add("stk-filter-dropdown-wrapper");
|
|
17
17
|
document.body.appendChild(div);
|
|
18
|
-
DropdownIns = createApp(await import("./Dropdown-
|
|
18
|
+
DropdownIns = createApp(await import("./Dropdown-Clc70S1z.js").then((module) => module.default)).mount(div);
|
|
19
19
|
}
|
|
20
20
|
return DropdownIns;
|
|
21
21
|
}
|
|
@@ -311,13 +311,13 @@ function createEditableCell(option) {
|
|
|
311
311
|
return { EditableCell: EditableCellComponent };
|
|
312
312
|
}
|
|
313
313
|
//#endregion
|
|
314
|
-
//#region src/StkTable/custom-cells/CheckboxCell/
|
|
314
|
+
//#region src/StkTable/custom-cells/CheckboxCell/CheckboxCell.vue?vue&type=script&setup=true&lang.ts
|
|
315
315
|
var _hoisted_1 = { class: "stk-checkbox-cell" };
|
|
316
316
|
var _hoisted_2 = ["checked", ".indeterminate"];
|
|
317
317
|
//#endregion
|
|
318
|
-
//#region src/StkTable/custom-cells/CheckboxCell/
|
|
319
|
-
var
|
|
320
|
-
__name: "
|
|
318
|
+
//#region src/StkTable/custom-cells/CheckboxCell/CheckboxCell.vue
|
|
319
|
+
var CheckboxCell_default = /* @__PURE__ */ defineComponent({
|
|
320
|
+
__name: "CheckboxCell",
|
|
321
321
|
props: {
|
|
322
322
|
checked: { type: Boolean },
|
|
323
323
|
indeterminate: { type: Boolean },
|
|
@@ -326,17 +326,33 @@ var Checkbox_default = /* @__PURE__ */ defineComponent({
|
|
|
326
326
|
emits: ["change"],
|
|
327
327
|
setup(__props, { emit: __emit }) {
|
|
328
328
|
const emit = __emit;
|
|
329
|
+
/** 防重保护:部分 UI 库(Element Plus / Arco Design)会同时触发多个事件 */
|
|
330
|
+
let _lastValue;
|
|
329
331
|
function handleChange(e) {
|
|
330
|
-
|
|
332
|
+
var _e$target;
|
|
333
|
+
let checked;
|
|
334
|
+
if (typeof e === "boolean") checked = e;
|
|
335
|
+
else if ((e === null || e === void 0 || (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.checked) !== void 0) checked = e.target.checked;
|
|
336
|
+
else checked = !!e;
|
|
337
|
+
if (checked === _lastValue) return;
|
|
338
|
+
_lastValue = checked;
|
|
339
|
+
emit("change", checked);
|
|
331
340
|
}
|
|
332
341
|
return (_ctx, _cache) => {
|
|
333
342
|
return openBlock(), createElementBlock("div", _hoisted_1, [__props.customComponent ? (openBlock(), createBlock(resolveDynamicComponent(__props.customComponent), {
|
|
334
343
|
key: 0,
|
|
335
344
|
"model-value": __props.checked,
|
|
345
|
+
checked: __props.checked,
|
|
336
346
|
indeterminate: __props.indeterminate,
|
|
337
347
|
"onUpdate:modelValue": handleChange,
|
|
348
|
+
"onUpdate:checked": handleChange,
|
|
349
|
+
onChange: handleChange,
|
|
338
350
|
onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"]))
|
|
339
|
-
}, null,
|
|
351
|
+
}, null, 40, [
|
|
352
|
+
"model-value",
|
|
353
|
+
"checked",
|
|
354
|
+
"indeterminate"
|
|
355
|
+
])) : (openBlock(), createElementBlock("input", {
|
|
340
356
|
key: 1,
|
|
341
357
|
type: "checkbox",
|
|
342
358
|
checked: __props.checked,
|
|
@@ -409,7 +425,7 @@ function createCheckboxCell(options) {
|
|
|
409
425
|
props.row[field] = checked;
|
|
410
426
|
options === null || options === void 0 || (_options$onChange = options.onChange) === null || _options$onChange === void 0 || _options$onChange.call(options, checked, props.row);
|
|
411
427
|
}
|
|
412
|
-
return () => h(
|
|
428
|
+
return () => h(CheckboxCell_default, {
|
|
413
429
|
checked: isChecked.value,
|
|
414
430
|
customComponent,
|
|
415
431
|
onChange: handleChange
|
|
@@ -447,7 +463,7 @@ function createCheckboxCell(options) {
|
|
|
447
463
|
});
|
|
448
464
|
options === null || options === void 0 || (_options$onSelectAll = options.onSelectAll) === null || _options$onSelectAll === void 0 || _options$onSelectAll.call(options, checked);
|
|
449
465
|
}
|
|
450
|
-
return () => h(
|
|
466
|
+
return () => h(CheckboxCell_default, {
|
|
451
467
|
checked: isCheckAll.value,
|
|
452
468
|
indeterminate: isIndeterminate.value,
|
|
453
469
|
customComponent,
|
package/lib/style.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: stk-table-vue
|
|
3
|
-
* version: v1.0.0
|
|
3
|
+
* version: v1.0.0
|
|
4
4
|
* description: High performance realtime virtual table for vue3 and vue2.7
|
|
5
5
|
* author: japlus
|
|
6
6
|
* homepage: https://ja-plus.github.io/stk-table-vue/
|
|
@@ -119,6 +119,7 @@
|
|
|
119
119
|
width:100%;
|
|
120
120
|
font-size:inherit;
|
|
121
121
|
line-height:inherit;
|
|
122
|
+
font-family:inherit;
|
|
122
123
|
box-sizing:border-box;
|
|
123
124
|
outline:none;
|
|
124
125
|
padding:0 4px;
|
package/package.json
CHANGED
|
@@ -1,85 +1,89 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "stk-table-vue",
|
|
3
|
-
"version": "1.0.0
|
|
4
|
-
"description": "High performance realtime virtual table for vue3 and vue2.7",
|
|
5
|
-
"main": "./lib/stk-table-vue.js",
|
|
6
|
-
"types": "./lib/src/StkTable/index.d.ts",
|
|
7
|
-
"homepage": "https://ja-plus.github.io/stk-table-vue/",
|
|
8
|
-
"author": "japlus",
|
|
9
|
-
"license": "MIT",
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "https://github.com/ja-plus/stk-table-vue"
|
|
13
|
-
},
|
|
14
|
-
"bugs": {
|
|
15
|
-
"url": "https://github.com/ja-plus/stk-table-vue/issues"
|
|
16
|
-
},
|
|
17
|
-
"packageManager": "pnpm@10.7.0",
|
|
18
|
-
"directories": {
|
|
19
|
-
"test": "test"
|
|
20
|
-
},
|
|
21
|
-
"type": "module",
|
|
22
|
-
"scripts": {
|
|
23
|
-
"dev": "vite",
|
|
24
|
-
"build": "vite build",
|
|
25
|
-
"test": "vitest",
|
|
26
|
-
"docs:dev": "vitepress dev docs-src",
|
|
27
|
-
"docs:build": "vitepress build docs-src",
|
|
28
|
-
"docs:preview": "vitepress preview docs-src",
|
|
29
|
-
"docs:update": "cp -rf ./docs-src/.vitepress/dist/* ./docs"
|
|
30
|
-
},
|
|
31
|
-
"keywords": [
|
|
32
|
-
"vue",
|
|
33
|
-
"table",
|
|
34
|
-
"vue-table",
|
|
35
|
-
"virtual table",
|
|
36
|
-
"virtual-scroll",
|
|
37
|
-
"data-table",
|
|
38
|
-
"vue-component",
|
|
39
|
-
"grid",
|
|
40
|
-
"vue2",
|
|
41
|
-
"vue3",
|
|
42
|
-
"highlight",
|
|
43
|
-
"sticky",
|
|
44
|
-
"virtual",
|
|
45
|
-
"list"
|
|
46
|
-
],
|
|
47
|
-
"files": [
|
|
48
|
-
"lib",
|
|
49
|
-
"src"
|
|
50
|
-
],
|
|
51
|
-
"devDependencies": {
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"@types/
|
|
55
|
-
"@
|
|
56
|
-
"@typescript-eslint/
|
|
57
|
-
"@
|
|
58
|
-
"@
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"eslint
|
|
63
|
-
"eslint-
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
|
|
85
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "stk-table-vue",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "High performance realtime virtual table for vue3 and vue2.7",
|
|
5
|
+
"main": "./lib/stk-table-vue.js",
|
|
6
|
+
"types": "./lib/src/StkTable/index.d.ts",
|
|
7
|
+
"homepage": "https://ja-plus.github.io/stk-table-vue/",
|
|
8
|
+
"author": "japlus",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/ja-plus/stk-table-vue"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/ja-plus/stk-table-vue/issues"
|
|
16
|
+
},
|
|
17
|
+
"packageManager": "pnpm@10.7.0",
|
|
18
|
+
"directories": {
|
|
19
|
+
"test": "test"
|
|
20
|
+
},
|
|
21
|
+
"type": "module",
|
|
22
|
+
"scripts": {
|
|
23
|
+
"dev": "vite",
|
|
24
|
+
"build": "vite build",
|
|
25
|
+
"test": "vitest",
|
|
26
|
+
"docs:dev": "vitepress dev docs-src",
|
|
27
|
+
"docs:build": "vitepress build docs-src",
|
|
28
|
+
"docs:preview": "vitepress preview docs-src",
|
|
29
|
+
"docs:update": "cp -rf ./docs-src/.vitepress/dist/* ./docs"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"vue",
|
|
33
|
+
"table",
|
|
34
|
+
"vue-table",
|
|
35
|
+
"virtual table",
|
|
36
|
+
"virtual-scroll",
|
|
37
|
+
"data-table",
|
|
38
|
+
"vue-component",
|
|
39
|
+
"grid",
|
|
40
|
+
"vue2",
|
|
41
|
+
"vue3",
|
|
42
|
+
"highlight",
|
|
43
|
+
"sticky",
|
|
44
|
+
"virtual",
|
|
45
|
+
"list"
|
|
46
|
+
],
|
|
47
|
+
"files": [
|
|
48
|
+
"lib",
|
|
49
|
+
"src"
|
|
50
|
+
],
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@arco-design/web-vue": "^2.58.0",
|
|
53
|
+
"@chenglou/pretext": "^0.0.8",
|
|
54
|
+
"@types/mockjs": "^1.0.10",
|
|
55
|
+
"@types/node": "^22.18.10",
|
|
56
|
+
"@typescript-eslint/eslint-plugin": "^7.7.0",
|
|
57
|
+
"@typescript-eslint/parser": "^7.7.0",
|
|
58
|
+
"@vitejs/plugin-vue": "^6.0.5",
|
|
59
|
+
"@vue/test-utils": "^2.4.6",
|
|
60
|
+
"ant-design-vue": "4",
|
|
61
|
+
"element-plus": "^2.14.3",
|
|
62
|
+
"eslint": "^8.57.0",
|
|
63
|
+
"eslint-config-prettier": "^9.1.0",
|
|
64
|
+
"eslint-plugin-html": "^8.1.0",
|
|
65
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
66
|
+
"eslint-plugin-vue": "^9.25.0",
|
|
67
|
+
"happy-dom": "^18.0.1",
|
|
68
|
+
"ja-contextmenu": "^1.11.0",
|
|
69
|
+
"less": "^4.2.0",
|
|
70
|
+
"mitt": "^3.0.1",
|
|
71
|
+
"mockjs": "^1.1.0",
|
|
72
|
+
"naive-ui": "2",
|
|
73
|
+
"postcss": "^8.4.47",
|
|
74
|
+
"postcss-discard-comments": "^6.0.2",
|
|
75
|
+
"postcss-preset-env": "^9.5.11",
|
|
76
|
+
"prettier": "^3.2.5",
|
|
77
|
+
"stk-table-vue": "^0.11.15",
|
|
78
|
+
"typescript": "^5.8.3",
|
|
79
|
+
"vite": "^8.1.2",
|
|
80
|
+
"vite-plugin-banner": "^0.8.1",
|
|
81
|
+
"vite-plugin-dts": "3.9.1",
|
|
82
|
+
"vitepress": "^1.6.4",
|
|
83
|
+
"vitepress-demo-plugin": "^1.5.1",
|
|
84
|
+
"vitepress-plugin-llms": "^1.13.2",
|
|
85
|
+
"vitest": "^4.1.9",
|
|
86
|
+
"vue": "^3.5.39",
|
|
87
|
+
"vue-eslint-parser": "^9.4.2"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
class="vt-x-left"
|
|
120
120
|
:style="`min-width:${theadVirtualX.offsetLeft}px;width:${theadVirtualX.offsetLeft}px`"
|
|
121
121
|
></td>
|
|
122
|
-
<template v-for="col in virtualX_columnPart" :key="col.__VT_C_SP__ ?
|
|
122
|
+
<template v-for="(col, _colIdx) in virtualX_columnPart" :key="col.__VT_C_SP__ ? `spacer-${_colIdx}` : colKeyGen(col)">
|
|
123
123
|
<td v-if="col.__VT_C_SP__" class="vt-x-spacer" :colspan="col.__VT_C_SP__"></td>
|
|
124
124
|
<td v-else v-bind="getTFProps(col)">
|
|
125
125
|
<component
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
class="vt-x-left"
|
|
158
158
|
:style="`min-width:${theadVirtualX.offsetLeft}px;width:${theadVirtualX.offsetLeft}px`"
|
|
159
159
|
></td>
|
|
160
|
-
<template v-for="col in virtualX_columnPart" :key="col.__VT_C_SP__ ?
|
|
160
|
+
<template v-for="(col, _colIdx) in virtualX_columnPart" :key="col.__VT_C_SP__ ? `spacer-${_colIdx}` : colKeyGen(col)">
|
|
161
161
|
<td v-if="col.__VT_C_SP__" class="vt-x-spacer" :colspan="col.__VT_C_SP__"></td>
|
|
162
162
|
<td v-else :style="cellStyleMap[TagType.TD].get(colKeyGen(col))"></td>
|
|
163
163
|
</template>
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
</td>
|
|
179
179
|
<template v-else>
|
|
180
180
|
<td v-if="virtualX_on" class="vt-x-left"></td>
|
|
181
|
-
<template v-for="col in virtualX_columnPart" :key="col.__VT_C_SP__ ?
|
|
181
|
+
<template v-for="(col, _colIdx) in virtualX_columnPart" :key="col.__VT_C_SP__ ? `spacer-${_colIdx}` : colKeyGen(col)">
|
|
182
182
|
<td v-if="col.__VT_C_SP__" class="vt-x-spacer" :colspan="col.__VT_C_SP__"></td>
|
|
183
183
|
<td
|
|
184
184
|
v-else-if="!shouldHideCell(row, col)"
|
|
@@ -4,8 +4,11 @@
|
|
|
4
4
|
:is="customComponent"
|
|
5
5
|
v-if="customComponent"
|
|
6
6
|
:model-value="checked"
|
|
7
|
+
:checked="checked"
|
|
7
8
|
:indeterminate="indeterminate"
|
|
8
9
|
@update:model-value="handleChange"
|
|
10
|
+
@update:checked="handleChange"
|
|
11
|
+
@change="handleChange"
|
|
9
12
|
@click.stop
|
|
10
13
|
/>
|
|
11
14
|
<input
|
|
@@ -34,8 +37,20 @@ const emit = defineEmits<{
|
|
|
34
37
|
(e: 'change', checked: boolean): void;
|
|
35
38
|
}>();
|
|
36
39
|
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
/** 防重保护:部分 UI 库(Element Plus / Arco Design)会同时触发多个事件 */
|
|
41
|
+
let _lastValue: boolean | undefined;
|
|
42
|
+
|
|
43
|
+
function handleChange(e: any) {
|
|
44
|
+
let checked: boolean;
|
|
45
|
+
if (typeof e === 'boolean') {
|
|
46
|
+
checked = e;
|
|
47
|
+
} else if (e?.target?.checked !== undefined) {
|
|
48
|
+
checked = e.target.checked;
|
|
49
|
+
} else {
|
|
50
|
+
checked = !!e;
|
|
51
|
+
}
|
|
52
|
+
if (checked === _lastValue) return;
|
|
53
|
+
_lastValue = checked;
|
|
39
54
|
emit('change', checked);
|
|
40
55
|
}
|
|
41
56
|
</script>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable vue/one-component-per-file */
|
|
2
2
|
import type { CustomCellProps } from '../../types';
|
|
3
3
|
import { computed, defineComponent, getCurrentInstance, h, markRaw } from 'vue';
|
|
4
|
-
import CheckboxVue from './
|
|
4
|
+
import CheckboxVue from './CheckboxCell.vue';
|
|
5
5
|
|
|
6
6
|
/** createCheckboxCell 配置选项 */
|
|
7
7
|
export interface createCheckboxCellOptions<T = any> {
|
|
@@ -402,7 +402,10 @@ export function useVirtualScroll(
|
|
|
402
402
|
|
|
403
403
|
let vue2ScrollYTimeout: null | number = null;
|
|
404
404
|
|
|
405
|
-
/**
|
|
405
|
+
/**
|
|
406
|
+
* every row actual height.
|
|
407
|
+
* FIXME: use a weak map instead of a plain map
|
|
408
|
+
*/
|
|
406
409
|
const autoRowHeightMap = new Map<string, number>();
|
|
407
410
|
/** 如果行高度有变化,则要调用此方法清除保存的行高 */
|
|
408
411
|
function setAutoHeight(rowKey: UniqKey, height?: number | null) {
|
/package/lib/src/StkTable/custom-cells/CheckboxCell/{Checkbox.vue.d.ts → CheckboxCell.vue.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|