stk-table-vue 1.0.0-beta.5 → 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/README.md +173 -173
- package/lib/Dropdown-Clc70S1z.js +1 -1
- package/lib/StkTable-QUd4TJCF.js +1 -1
- package/lib/stk-table-vue.js +25 -9
- package/lib/style.css +2 -1
- package/package.json +5 -1
- package/src/StkTable/StkTable.vue +1849 -1849
- package/src/StkTable/components/DragHandle.vue +9 -9
- package/src/StkTable/components/SortIcon.vue +6 -6
- package/src/StkTable/components/TreeNodeCell.vue +19 -19
- package/src/StkTable/components/TriangleIcon.vue +3 -3
- package/src/StkTable/const.ts +50 -50
- package/src/StkTable/custom-cells/CheckboxCell/{Checkbox.less → CheckboxCell.less} +14 -14
- package/src/StkTable/custom-cells/CheckboxCell/{Checkbox.vue → CheckboxCell.vue} +56 -41
- package/src/StkTable/custom-cells/CheckboxCell/createCheckboxCell.ts +146 -146
- package/src/StkTable/custom-cells/CheckboxCell/index.ts +5 -5
- package/src/StkTable/custom-cells/EditableCell/EditableCell.less +1 -0
- package/src/StkTable/custom-cells/FilterCell/Dropdown/index.ts +16 -16
- package/src/StkTable/custom-cells/FilterCell/Dropdown/index.vue +184 -184
- package/src/StkTable/custom-cells/FilterCell/Filter.less +118 -118
- package/src/StkTable/custom-cells/FilterCell/Filter.vue +66 -66
- package/src/StkTable/custom-cells/FilterCell/createFilterCell.ts +120 -120
- package/src/StkTable/custom-cells/FilterCell/index.ts +6 -6
- package/src/StkTable/custom-cells/FilterCell/types.ts +43 -43
- package/src/StkTable/features/const.ts +1 -1
- package/src/StkTable/features/index.ts +1 -1
- package/src/StkTable/features/useAreaSelection.bak.ts +951 -951
- package/src/StkTable/features/useAreaSelection.ts +1079 -1079
- package/src/StkTable/index.ts +14 -14
- package/src/StkTable/registerFeature.ts +40 -40
- package/src/StkTable/style.less +767 -767
- package/src/StkTable/types/highlightDimOptions.ts +28 -28
- package/src/StkTable/types/index.ts +452 -452
- package/src/StkTable/useAutoResize.ts +87 -87
- package/src/StkTable/useColResize.ts +202 -202
- package/src/StkTable/useFixedCol.ts +142 -142
- package/src/StkTable/useFixedStyle.ts +75 -75
- package/src/StkTable/useGetFixedColPosition.ts +63 -63
- package/src/StkTable/useHighlight.ts +270 -270
- package/src/StkTable/useIndexResolver.ts +29 -29
- package/src/StkTable/useKeyboardArrowScroll.ts +114 -114
- package/src/StkTable/useMaxRowSpan.ts +50 -50
- package/src/StkTable/useMergeCells.ts +138 -138
- package/src/StkTable/useRowExpand.ts +81 -81
- package/src/StkTable/useScrollRowByRow.ts +96 -96
- package/src/StkTable/useScrollbar.ts +177 -177
- package/src/StkTable/useSorter.ts +259 -259
- package/src/StkTable/useTableColumns.ts +131 -131
- package/src/StkTable/useThDrag.ts +94 -94
- package/src/StkTable/useTrDrag.ts +100 -100
- package/src/StkTable/useTree.ts +152 -152
- package/src/StkTable/useVirtualScroll.ts +693 -693
- package/src/StkTable/useWheeling.ts +23 -23
- package/src/StkTable/utils/constRefUtils.ts +29 -29
- package/src/StkTable/utils/index.ts +331 -331
- package/src/StkTable/utils/useTriggerRef.ts +33 -33
- package/src/VirtualTree.vue +622 -622
- package/src/VirtualTreeSelect.vue +367 -367
- package/src/vite-env.d.ts +10 -10
- /package/lib/src/StkTable/custom-cells/CheckboxCell/{Checkbox.vue.d.ts → CheckboxCell.vue.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,173 +1,173 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<a href="https://ja-plus.github.io/stk-table-vue/">
|
|
3
|
-
<img src="./docs-src/public/assets/logo.svg" width="152">
|
|
4
|
-
</a>
|
|
5
|
-
<h3 align='center'>Stk Table Vue</h3>
|
|
6
|
-
<p align="center">
|
|
7
|
-
<a href="https://www.npmjs.com/package/stk-table-vue"><img src="https://img.shields.io/npm/v/stk-table-vue"></a>
|
|
8
|
-
<a href="https://www.npmjs.com/package/stk-table-vue"><img src="https://img.shields.io/npm/dw/stk-table-vue"></a>
|
|
9
|
-
<a href="https://github.com/ja-plus/stk-table-vue/stargazers"><img src="https://img.shields.io/github/stars/ja-plus/stk-table-vue.svg"></a>
|
|
10
|
-
<a href="https://raw.githubusercontent.com/ja-plus/stk-table-vue/master/LICENSE"><img src="https://img.shields.io/npm/l/stk-table-vue"></a>
|
|
11
|
-
<a href="https://github.com/ja-plus/stk-table-vue"><img src="https://img.shields.io/npm/types/stk-table-vue"></a>
|
|
12
|
-
</p>
|
|
13
|
-
</p>
|
|
14
|
-
|
|
15
|
-
Stk Table Vue(Sticky Table) is a high-performance virtual list component based on Vue.
|
|
16
|
-
|
|
17
|
-
Smooth performance with tens of thousands of rows
|
|
18
|
-
|
|
19
|
-
Used for real-time data display, with data highlighting and dynamic effects.
|
|
20
|
-
|
|
21
|
-
Support Vue3 and Vue2.7
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
## Documentation
|
|
25
|
-
### [Stk Table Vue Official](https://ja-plus.github.io/stk-table-vue/)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
## Repo:
|
|
29
|
-
- [Github](https://github.com/ja-plus/stk-table-vue)
|
|
30
|
-
- [Gitee](https://gitee.com/japlus/stk-table-vue)
|
|
31
|
-
|
|
32
|
-
## Demo
|
|
33
|
-
[<span style="font-size: 16px;font-weight: bold;">Online Demo in stackblitz</span>](https://stackblitz.com/edit/vitejs-vite-ad91hh?file=src%2FDemo%2Findex.vue)
|
|
34
|
-
|
|
35
|
-
## Usage
|
|
36
|
-
> npm install stk-table-vue
|
|
37
|
-
|
|
38
|
-
```html
|
|
39
|
-
<script setup>
|
|
40
|
-
import { StkTable } from 'stk-table-vue'
|
|
41
|
-
import { ref, useTemplateRef } from 'vue'
|
|
42
|
-
const stkTableRef = ref<InstanceType<typeof StkTable>>();
|
|
43
|
-
// or Vue 3.5 useTemplateRef
|
|
44
|
-
const stkTableRef = useTemplateRef('stkTableRef');
|
|
45
|
-
|
|
46
|
-
// highlight row
|
|
47
|
-
stkTableRef.value.setHighlightDimRow([rowKey], {
|
|
48
|
-
method: 'css' | 'animation', // default animation
|
|
49
|
-
className: 'custom-class-name', // for method 'css'
|
|
50
|
-
keyframe: [{ backgroundColor: '#aaa' }, { backgroundColor: '#222' }], // same as https://developer.mozilla.org/zh-CN/docs/Web/API/Web_Animations_API/Keyframe_Formats
|
|
51
|
-
duration: 2000,
|
|
52
|
-
});
|
|
53
|
-
// highlight cell
|
|
54
|
-
stkTableRef.value.setHighlightDimCell(rowKey, colDataIndex, {
|
|
55
|
-
method: 'css' | 'animation',
|
|
56
|
-
className: 'custom-class-name', // for method 'css'
|
|
57
|
-
keyframe: [{ backgroundColor: '#aaa' }, { backgroundColor: '#222' }], // for method 'animation'
|
|
58
|
-
duration: 2000,
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
const columns = [
|
|
62
|
-
{title: 'name', dataIndex: 'name'},
|
|
63
|
-
{title: 'age', dataIndex: 'age'},
|
|
64
|
-
{title: 'address', dataIndex: 'address'},
|
|
65
|
-
];
|
|
66
|
-
|
|
67
|
-
const dataSource = [
|
|
68
|
-
{id: 1, name: 'John', age: 32, address: 'New York'},
|
|
69
|
-
{id: 2, name: 'Jim', age: 42, address: 'London'},
|
|
70
|
-
{id: 3, name: 'Joe', age: 52, address: 'Tokyo'},
|
|
71
|
-
{id: 4, name: 'Jack', age: 62, address: 'Sydney'},
|
|
72
|
-
{id: 5, name: 'Jill', age: 72, address: 'Paris'},
|
|
73
|
-
]
|
|
74
|
-
|
|
75
|
-
</script>
|
|
76
|
-
|
|
77
|
-
<template>
|
|
78
|
-
<StkTable ref='stkTableRef' row-key="id" :data-source="dataSource" :columns="columns"></StkTable>
|
|
79
|
-
</template>
|
|
80
|
-
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### Vue2.7 Usage
|
|
84
|
-
[Vue2.7 Usage](https://ja-plus.github.io/stk-table-vue/main/start/vue2-usage.html)
|
|
85
|
-
|
|
86
|
-
## API
|
|
87
|
-
* [Props](https://ja-plus.github.io/stk-table-vue/main/api/table-props.html)
|
|
88
|
-
|
|
89
|
-
* [Emits](https://ja-plus.github.io/stk-table-vue/main/api/emits.html)
|
|
90
|
-
|
|
91
|
-
* [Slots](https://ja-plus.github.io/stk-table-vue/main/api/slots.html)
|
|
92
|
-
|
|
93
|
-
* [Expose](https://ja-plus.github.io/stk-table-vue/main/api/expose.html)
|
|
94
|
-
|
|
95
|
-
* [StkTableColumn: Define column type](https://ja-plus.github.io/stk-table-vue/main/api/stk-table-column.html)
|
|
96
|
-
|
|
97
|
-
* [Highlight: setHighlightDimCell & setHighlightDimRow](https://ja-plus.github.io/stk-table-vue/main/api/expose.html#sethighlightdimcell)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
### Example
|
|
101
|
-
```vue
|
|
102
|
-
<template>
|
|
103
|
-
<StkTable
|
|
104
|
-
ref="stkTable"
|
|
105
|
-
row-key="name"
|
|
106
|
-
v-model:columns="columns"
|
|
107
|
-
:style="{height:props.height}"
|
|
108
|
-
theme='dark'
|
|
109
|
-
height='200px'
|
|
110
|
-
bordered="h"
|
|
111
|
-
:row-height="28"
|
|
112
|
-
:show-overflow="false"
|
|
113
|
-
:show-header-overflow="false"
|
|
114
|
-
:sort-remote="false"
|
|
115
|
-
col-resizable
|
|
116
|
-
header-drag
|
|
117
|
-
virtual
|
|
118
|
-
virtual-x
|
|
119
|
-
no-data-full
|
|
120
|
-
col-resizable
|
|
121
|
-
auto-resize
|
|
122
|
-
fixed-col-shadow
|
|
123
|
-
:col-min-width="10"
|
|
124
|
-
:headless="false"
|
|
125
|
-
:data-source="dataSource"
|
|
126
|
-
@current-change="onCurrentChange"
|
|
127
|
-
@row-menu="onRowMenu"
|
|
128
|
-
@header-row-menu="onHeaderRowMenu"
|
|
129
|
-
@row-click="onRowClick"
|
|
130
|
-
@row-dblclick="onRowDblclick"
|
|
131
|
-
@sort-change="handleSortChange"
|
|
132
|
-
@cell-click="onCellClick"
|
|
133
|
-
@header-cell-click="onHeaderCellClick"
|
|
134
|
-
@scroll="onTableScroll"
|
|
135
|
-
@scroll-x="onTableScrollX"
|
|
136
|
-
@col-order-change="onColOrderChange"
|
|
137
|
-
/>
|
|
138
|
-
</template>
|
|
139
|
-
<script setup>
|
|
140
|
-
import { h, defineComponent } from 'vue';
|
|
141
|
-
const columns = [
|
|
142
|
-
{
|
|
143
|
-
title: 'Name',
|
|
144
|
-
dataIndex: 'name',
|
|
145
|
-
fixed: 'left',
|
|
146
|
-
width: '200px',
|
|
147
|
-
headerClassName: 'my-th',
|
|
148
|
-
className: 'my-td',
|
|
149
|
-
sorter: true,
|
|
150
|
-
customHeaderCell: function FunctionalComponent(props){
|
|
151
|
-
return h(
|
|
152
|
-
'span',
|
|
153
|
-
{ style: 'overflow:hidden;text-overflow:ellipsis;white-space:nowrap' },
|
|
154
|
-
props.col.title + '(render) text-overflow,',
|
|
155
|
-
);
|
|
156
|
-
},
|
|
157
|
-
customCell: defineComponent({
|
|
158
|
-
setup(){
|
|
159
|
-
//...
|
|
160
|
-
return () => <div></div> // vue jsx
|
|
161
|
-
}
|
|
162
|
-
})
|
|
163
|
-
},
|
|
164
|
-
]
|
|
165
|
-
</script>
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
## Compare
|
|
169
|
-
Compare performance with other vue table [vue-table-compare](https://github.com/ja-plus/vue-table-compare)
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
## Other
|
|
173
|
-
* `$*$`
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://ja-plus.github.io/stk-table-vue/">
|
|
3
|
+
<img src="./docs-src/public/assets/logo.svg" width="152">
|
|
4
|
+
</a>
|
|
5
|
+
<h3 align='center'>Stk Table Vue</h3>
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="https://www.npmjs.com/package/stk-table-vue"><img src="https://img.shields.io/npm/v/stk-table-vue"></a>
|
|
8
|
+
<a href="https://www.npmjs.com/package/stk-table-vue"><img src="https://img.shields.io/npm/dw/stk-table-vue"></a>
|
|
9
|
+
<a href="https://github.com/ja-plus/stk-table-vue/stargazers"><img src="https://img.shields.io/github/stars/ja-plus/stk-table-vue.svg"></a>
|
|
10
|
+
<a href="https://raw.githubusercontent.com/ja-plus/stk-table-vue/master/LICENSE"><img src="https://img.shields.io/npm/l/stk-table-vue"></a>
|
|
11
|
+
<a href="https://github.com/ja-plus/stk-table-vue"><img src="https://img.shields.io/npm/types/stk-table-vue"></a>
|
|
12
|
+
</p>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
Stk Table Vue(Sticky Table) is a high-performance virtual list component based on Vue.
|
|
16
|
+
|
|
17
|
+
Smooth performance with tens of thousands of rows
|
|
18
|
+
|
|
19
|
+
Used for real-time data display, with data highlighting and dynamic effects.
|
|
20
|
+
|
|
21
|
+
Support Vue3 and Vue2.7
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## Documentation
|
|
25
|
+
### [Stk Table Vue Official](https://ja-plus.github.io/stk-table-vue/)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## Repo:
|
|
29
|
+
- [Github](https://github.com/ja-plus/stk-table-vue)
|
|
30
|
+
- [Gitee](https://gitee.com/japlus/stk-table-vue)
|
|
31
|
+
|
|
32
|
+
## Demo
|
|
33
|
+
[<span style="font-size: 16px;font-weight: bold;">Online Demo in stackblitz</span>](https://stackblitz.com/edit/vitejs-vite-ad91hh?file=src%2FDemo%2Findex.vue)
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
> npm install stk-table-vue
|
|
37
|
+
|
|
38
|
+
```html
|
|
39
|
+
<script setup>
|
|
40
|
+
import { StkTable } from 'stk-table-vue'
|
|
41
|
+
import { ref, useTemplateRef } from 'vue'
|
|
42
|
+
const stkTableRef = ref<InstanceType<typeof StkTable>>();
|
|
43
|
+
// or Vue 3.5 useTemplateRef
|
|
44
|
+
const stkTableRef = useTemplateRef('stkTableRef');
|
|
45
|
+
|
|
46
|
+
// highlight row
|
|
47
|
+
stkTableRef.value.setHighlightDimRow([rowKey], {
|
|
48
|
+
method: 'css' | 'animation', // default animation
|
|
49
|
+
className: 'custom-class-name', // for method 'css'
|
|
50
|
+
keyframe: [{ backgroundColor: '#aaa' }, { backgroundColor: '#222' }], // same as https://developer.mozilla.org/zh-CN/docs/Web/API/Web_Animations_API/Keyframe_Formats
|
|
51
|
+
duration: 2000,
|
|
52
|
+
});
|
|
53
|
+
// highlight cell
|
|
54
|
+
stkTableRef.value.setHighlightDimCell(rowKey, colDataIndex, {
|
|
55
|
+
method: 'css' | 'animation',
|
|
56
|
+
className: 'custom-class-name', // for method 'css'
|
|
57
|
+
keyframe: [{ backgroundColor: '#aaa' }, { backgroundColor: '#222' }], // for method 'animation'
|
|
58
|
+
duration: 2000,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const columns = [
|
|
62
|
+
{title: 'name', dataIndex: 'name'},
|
|
63
|
+
{title: 'age', dataIndex: 'age'},
|
|
64
|
+
{title: 'address', dataIndex: 'address'},
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
const dataSource = [
|
|
68
|
+
{id: 1, name: 'John', age: 32, address: 'New York'},
|
|
69
|
+
{id: 2, name: 'Jim', age: 42, address: 'London'},
|
|
70
|
+
{id: 3, name: 'Joe', age: 52, address: 'Tokyo'},
|
|
71
|
+
{id: 4, name: 'Jack', age: 62, address: 'Sydney'},
|
|
72
|
+
{id: 5, name: 'Jill', age: 72, address: 'Paris'},
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<template>
|
|
78
|
+
<StkTable ref='stkTableRef' row-key="id" :data-source="dataSource" :columns="columns"></StkTable>
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Vue2.7 Usage
|
|
84
|
+
[Vue2.7 Usage](https://ja-plus.github.io/stk-table-vue/main/start/vue2-usage.html)
|
|
85
|
+
|
|
86
|
+
## API
|
|
87
|
+
* [Props](https://ja-plus.github.io/stk-table-vue/main/api/table-props.html)
|
|
88
|
+
|
|
89
|
+
* [Emits](https://ja-plus.github.io/stk-table-vue/main/api/emits.html)
|
|
90
|
+
|
|
91
|
+
* [Slots](https://ja-plus.github.io/stk-table-vue/main/api/slots.html)
|
|
92
|
+
|
|
93
|
+
* [Expose](https://ja-plus.github.io/stk-table-vue/main/api/expose.html)
|
|
94
|
+
|
|
95
|
+
* [StkTableColumn: Define column type](https://ja-plus.github.io/stk-table-vue/main/api/stk-table-column.html)
|
|
96
|
+
|
|
97
|
+
* [Highlight: setHighlightDimCell & setHighlightDimRow](https://ja-plus.github.io/stk-table-vue/main/api/expose.html#sethighlightdimcell)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
### Example
|
|
101
|
+
```vue
|
|
102
|
+
<template>
|
|
103
|
+
<StkTable
|
|
104
|
+
ref="stkTable"
|
|
105
|
+
row-key="name"
|
|
106
|
+
v-model:columns="columns"
|
|
107
|
+
:style="{height:props.height}"
|
|
108
|
+
theme='dark'
|
|
109
|
+
height='200px'
|
|
110
|
+
bordered="h"
|
|
111
|
+
:row-height="28"
|
|
112
|
+
:show-overflow="false"
|
|
113
|
+
:show-header-overflow="false"
|
|
114
|
+
:sort-remote="false"
|
|
115
|
+
col-resizable
|
|
116
|
+
header-drag
|
|
117
|
+
virtual
|
|
118
|
+
virtual-x
|
|
119
|
+
no-data-full
|
|
120
|
+
col-resizable
|
|
121
|
+
auto-resize
|
|
122
|
+
fixed-col-shadow
|
|
123
|
+
:col-min-width="10"
|
|
124
|
+
:headless="false"
|
|
125
|
+
:data-source="dataSource"
|
|
126
|
+
@current-change="onCurrentChange"
|
|
127
|
+
@row-menu="onRowMenu"
|
|
128
|
+
@header-row-menu="onHeaderRowMenu"
|
|
129
|
+
@row-click="onRowClick"
|
|
130
|
+
@row-dblclick="onRowDblclick"
|
|
131
|
+
@sort-change="handleSortChange"
|
|
132
|
+
@cell-click="onCellClick"
|
|
133
|
+
@header-cell-click="onHeaderCellClick"
|
|
134
|
+
@scroll="onTableScroll"
|
|
135
|
+
@scroll-x="onTableScrollX"
|
|
136
|
+
@col-order-change="onColOrderChange"
|
|
137
|
+
/>
|
|
138
|
+
</template>
|
|
139
|
+
<script setup>
|
|
140
|
+
import { h, defineComponent } from 'vue';
|
|
141
|
+
const columns = [
|
|
142
|
+
{
|
|
143
|
+
title: 'Name',
|
|
144
|
+
dataIndex: 'name',
|
|
145
|
+
fixed: 'left',
|
|
146
|
+
width: '200px',
|
|
147
|
+
headerClassName: 'my-th',
|
|
148
|
+
className: 'my-td',
|
|
149
|
+
sorter: true,
|
|
150
|
+
customHeaderCell: function FunctionalComponent(props){
|
|
151
|
+
return h(
|
|
152
|
+
'span',
|
|
153
|
+
{ style: 'overflow:hidden;text-overflow:ellipsis;white-space:nowrap' },
|
|
154
|
+
props.col.title + '(render) text-overflow,',
|
|
155
|
+
);
|
|
156
|
+
},
|
|
157
|
+
customCell: defineComponent({
|
|
158
|
+
setup(){
|
|
159
|
+
//...
|
|
160
|
+
return () => <div></div> // vue jsx
|
|
161
|
+
}
|
|
162
|
+
})
|
|
163
|
+
},
|
|
164
|
+
]
|
|
165
|
+
</script>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Compare
|
|
169
|
+
Compare performance with other vue table [vue-table-compare](https://github.com/ja-plus/vue-table-compare)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
## Other
|
|
173
|
+
* `$*$`
|
package/lib/Dropdown-Clc70S1z.js
CHANGED
package/lib/StkTable-QUd4TJCF.js
CHANGED
package/lib/stk-table-vue.js
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/
|
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stk-table-vue",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "High performance realtime virtual table for vue3 and vue2.7",
|
|
5
5
|
"main": "./lib/stk-table-vue.js",
|
|
6
6
|
"types": "./lib/src/StkTable/index.d.ts",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"src"
|
|
50
50
|
],
|
|
51
51
|
"devDependencies": {
|
|
52
|
+
"@arco-design/web-vue": "^2.58.0",
|
|
52
53
|
"@chenglou/pretext": "^0.0.8",
|
|
53
54
|
"@types/mockjs": "^1.0.10",
|
|
54
55
|
"@types/node": "^22.18.10",
|
|
@@ -56,6 +57,8 @@
|
|
|
56
57
|
"@typescript-eslint/parser": "^7.7.0",
|
|
57
58
|
"@vitejs/plugin-vue": "^6.0.5",
|
|
58
59
|
"@vue/test-utils": "^2.4.6",
|
|
60
|
+
"ant-design-vue": "4",
|
|
61
|
+
"element-plus": "^2.14.3",
|
|
59
62
|
"eslint": "^8.57.0",
|
|
60
63
|
"eslint-config-prettier": "^9.1.0",
|
|
61
64
|
"eslint-plugin-html": "^8.1.0",
|
|
@@ -66,6 +69,7 @@
|
|
|
66
69
|
"less": "^4.2.0",
|
|
67
70
|
"mitt": "^3.0.1",
|
|
68
71
|
"mockjs": "^1.1.0",
|
|
72
|
+
"naive-ui": "2",
|
|
69
73
|
"postcss": "^8.4.47",
|
|
70
74
|
"postcss-discard-comments": "^6.0.2",
|
|
71
75
|
"postcss-preset-env": "^9.5.11",
|