stk-table-vue 0.0.1-beta.1
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 +136 -0
- package/lib/StkTable/StkTable.vue.d.ts +169 -0
- package/lib/StkTable/const.d.ts +20 -0
- package/lib/StkTable/index.d.ts +2 -0
- package/lib/StkTable/types/index.d.ts +82 -0
- package/lib/StkTable/useColResize.d.ts +18 -0
- package/lib/StkTable/useThDrag.d.ts +14 -0
- package/lib/StkTable/useVirtualScroll.d.ts +35 -0
- package/lib/StkTable/utils.d.ts +23 -0
- package/lib/StkTableC/store.d.ts +12 -0
- package/lib/stk-table-vue.js +1054 -0
- package/lib/style.css +225 -0
- package/package.json +56 -0
- package/src/StkTable/StkTable.vue +1042 -0
- package/src/StkTable/const.ts +26 -0
- package/src/StkTable/index.ts +2 -0
- package/src/StkTable/types/index.ts +109 -0
- package/src/StkTable/useColResize.ts +172 -0
- package/src/StkTable/useHighlight.ts +150 -0
- package/src/StkTable/useThDrag.ts +43 -0
- package/src/StkTable/useVirtualScroll.ts +186 -0
- package/src/StkTable/utils.ts +132 -0
- package/src/StkTable.d.ts +17 -0
- package/src/StkTable.vue +1686 -0
- package/src/StkTableC/index.vue +193 -0
- package/src/StkTableC/store.js +6 -0
- package/src/StkTable_compatible.vue +590 -0
- package/src/VirtualTree.vue +617 -0
- package/src/VirtualTreeSelect.vue +338 -0
- package/src/images/sort-btn.svg +7 -0
- package/src/vite-env.d.ts +5 -0
package/lib/style.css
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
.stk-table[data-v-12388195] {
|
|
2
|
+
--row-height: 28px;
|
|
3
|
+
--cell-padding-x: 8px;
|
|
4
|
+
--resize-handle-width: 4px;
|
|
5
|
+
--border-color: #e8eaec;
|
|
6
|
+
--border-width: 1px;
|
|
7
|
+
--td-bgc: #fff;
|
|
8
|
+
--th-bgc: #f8f8f9;
|
|
9
|
+
--tr-active-bgc: #e6f7ff;
|
|
10
|
+
--tr-hover-bgc: rgba(230, 247, 255, 0.7);
|
|
11
|
+
--bg-border-top: linear-gradient(180deg, var(--border-color) var(--border-width), transparent var(--border-width));
|
|
12
|
+
--bg-border-right: linear-gradient(270deg, var(--border-color) var(--border-width), transparent var(--border-width));
|
|
13
|
+
--bg-border-bottom: linear-gradient(0deg, var(--border-color) var(--border-width), transparent var(--border-width));
|
|
14
|
+
--bg-border-left: linear-gradient(90deg, var(--border-color) var(--border-width), transparent var(--border-width));
|
|
15
|
+
--highlight-color: #71a2fd;
|
|
16
|
+
--sort-arrow-color: #5d5f69;
|
|
17
|
+
--sort-arrow-hover-color: #8f90b5;
|
|
18
|
+
--sort-arrow-active-color: #1b63d9;
|
|
19
|
+
--sort-arrow-active-sub-color: #cbcbe1;
|
|
20
|
+
/** 列宽拖动指示器颜色 */
|
|
21
|
+
--col-resize-indicator-color: #cbcbe1;
|
|
22
|
+
position: relative;
|
|
23
|
+
overflow: auto;
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
/**深色模式 */
|
|
27
|
+
/** 调整列宽的时候不要触发th事件。否则会导致触发表头点击排序 */
|
|
28
|
+
/** 列宽调整指示器 */
|
|
29
|
+
/**虚拟滚动模式 */
|
|
30
|
+
}
|
|
31
|
+
.stk-table.dark[data-v-12388195] {
|
|
32
|
+
--th-bgc: #181c21;
|
|
33
|
+
--td-bgc: #181c21;
|
|
34
|
+
--border-color: #26292e;
|
|
35
|
+
--tr-active-bgc: #283f63;
|
|
36
|
+
--tr-hover-bgc: #1a2b46;
|
|
37
|
+
--table-bgc: #181c21;
|
|
38
|
+
--highlight-color: #1e4c99;
|
|
39
|
+
--sort-arrow-color: #5d6064;
|
|
40
|
+
--sort-arrow-hover-color: #727782;
|
|
41
|
+
--sort-arrow-active-color: #d0d1d2;
|
|
42
|
+
--sort-arrow-active-sub-color: #5d6064;
|
|
43
|
+
--col-resize-indicator-color: #5d6064;
|
|
44
|
+
color: #d0d1d2;
|
|
45
|
+
}
|
|
46
|
+
.stk-table.headless[data-v-12388195] {
|
|
47
|
+
border-top: 1px solid var(--border-color);
|
|
48
|
+
}
|
|
49
|
+
.stk-table.is-col-resizing th[data-v-12388195] {
|
|
50
|
+
pointer-events: none;
|
|
51
|
+
}
|
|
52
|
+
.stk-table .column-resize-indicator[data-v-12388195] {
|
|
53
|
+
width: 0;
|
|
54
|
+
height: 100%;
|
|
55
|
+
border-left: 1px dashed var(--col-resize-indicator-color);
|
|
56
|
+
position: absolute;
|
|
57
|
+
z-index: 10;
|
|
58
|
+
display: none;
|
|
59
|
+
pointer-events: none;
|
|
60
|
+
}
|
|
61
|
+
.stk-table .stk-table-main[data-v-12388195] {
|
|
62
|
+
border-spacing: 0;
|
|
63
|
+
border-collapse: separate;
|
|
64
|
+
}
|
|
65
|
+
.stk-table .stk-table-main th[data-v-12388195],
|
|
66
|
+
.stk-table .stk-table-main td[data-v-12388195] {
|
|
67
|
+
z-index: 1;
|
|
68
|
+
height: var(--row-height);
|
|
69
|
+
font-size: 14px;
|
|
70
|
+
box-sizing: border-box;
|
|
71
|
+
padding: 0 var(--cell-padding-x);
|
|
72
|
+
background-image: var(--bg-border-right), var(--bg-border-bottom);
|
|
73
|
+
}
|
|
74
|
+
.stk-table .stk-table-main thead tr:first-child th[data-v-12388195] {
|
|
75
|
+
position: sticky;
|
|
76
|
+
top: 0;
|
|
77
|
+
background-image: var(--bg-border-top), var(--bg-border-right), var(--bg-border-bottom);
|
|
78
|
+
}
|
|
79
|
+
.stk-table .stk-table-main thead tr:first-child th[data-v-12388195]:first-child {
|
|
80
|
+
background-image: var(--bg-border-top), var(--bg-border-right), var(--bg-border-bottom), var(--bg-border-left);
|
|
81
|
+
}
|
|
82
|
+
.stk-table .stk-table-main thead tr th[data-v-12388195] {
|
|
83
|
+
background-color: var(--th-bgc);
|
|
84
|
+
}
|
|
85
|
+
.stk-table .stk-table-main thead tr th.sortable[data-v-12388195] {
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
}
|
|
88
|
+
.stk-table .stk-table-main thead tr th[data-v-12388195]:first-child {
|
|
89
|
+
background-image: var(--bg-border-right), var(--bg-border-bottom), var(--bg-border-left);
|
|
90
|
+
}
|
|
91
|
+
.stk-table .stk-table-main thead tr th.text-overflow .table-header-cell-wrapper[data-v-12388195] {
|
|
92
|
+
white-space: nowrap;
|
|
93
|
+
overflow: hidden;
|
|
94
|
+
}
|
|
95
|
+
.stk-table .stk-table-main thead tr th.text-overflow .table-header-cell-wrapper .table-header-title[data-v-12388195] {
|
|
96
|
+
text-overflow: ellipsis;
|
|
97
|
+
overflow: hidden;
|
|
98
|
+
}
|
|
99
|
+
.stk-table .stk-table-main thead tr th:not(.sorter-desc):not(.sorter-asc):hover .table-header-cell-wrapper .table-header-sorter #arrow-up[data-v-12388195] {
|
|
100
|
+
fill: var(--sort-arrow-hover-color);
|
|
101
|
+
}
|
|
102
|
+
.stk-table .stk-table-main thead tr th:not(.sorter-desc):not(.sorter-asc):hover .table-header-cell-wrapper .table-header-sorter #arrow-down[data-v-12388195] {
|
|
103
|
+
fill: var(--sort-arrow-hover-color);
|
|
104
|
+
}
|
|
105
|
+
.stk-table .stk-table-main thead tr th.sorter-desc .table-header-cell-wrapper .table-header-sorter #arrow-up[data-v-12388195] {
|
|
106
|
+
fill: var(--sort-arrow-active-sub-color);
|
|
107
|
+
}
|
|
108
|
+
.stk-table .stk-table-main thead tr th.sorter-desc .table-header-cell-wrapper .table-header-sorter #arrow-down[data-v-12388195] {
|
|
109
|
+
fill: var(--sort-arrow-active-color);
|
|
110
|
+
}
|
|
111
|
+
.stk-table .stk-table-main thead tr th.sorter-asc .table-header-cell-wrapper .table-header-sorter #arrow-up[data-v-12388195] {
|
|
112
|
+
fill: var(--sort-arrow-active-color);
|
|
113
|
+
}
|
|
114
|
+
.stk-table .stk-table-main thead tr th.sorter-asc .table-header-cell-wrapper .table-header-sorter #arrow-down[data-v-12388195] {
|
|
115
|
+
fill: var(--sort-arrow-active-sub-color);
|
|
116
|
+
}
|
|
117
|
+
.stk-table .stk-table-main thead tr th .table-header-cell-wrapper[data-v-12388195] {
|
|
118
|
+
max-width: 100%;
|
|
119
|
+
display: inline-flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
}
|
|
122
|
+
.stk-table .stk-table-main thead tr th .table-header-cell-wrapper .table-header-title[data-v-12388195] {
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
align-self: flex-start;
|
|
125
|
+
}
|
|
126
|
+
.stk-table .stk-table-main thead tr th .table-header-cell-wrapper .table-header-sorter[data-v-12388195] {
|
|
127
|
+
flex-shrink: 0;
|
|
128
|
+
margin-left: 4px;
|
|
129
|
+
width: 16px;
|
|
130
|
+
height: 16px;
|
|
131
|
+
}
|
|
132
|
+
.stk-table .stk-table-main thead tr th .table-header-cell-wrapper .table-header-sorter #arrow-up[data-v-12388195],
|
|
133
|
+
.stk-table .stk-table-main thead tr th .table-header-cell-wrapper .table-header-sorter #arrow-down[data-v-12388195] {
|
|
134
|
+
fill: var(--sort-arrow-color);
|
|
135
|
+
}
|
|
136
|
+
.stk-table .stk-table-main thead tr th .table-header-cell-wrapper .table-header-resizer[data-v-12388195] {
|
|
137
|
+
position: absolute;
|
|
138
|
+
top: 0;
|
|
139
|
+
cursor: col-resize;
|
|
140
|
+
width: var(--resize-handle-width);
|
|
141
|
+
height: var(--row-height);
|
|
142
|
+
}
|
|
143
|
+
.stk-table .stk-table-main thead tr th .table-header-cell-wrapper .table-header-resizer.left[data-v-12388195] {
|
|
144
|
+
left: 0;
|
|
145
|
+
}
|
|
146
|
+
.stk-table .stk-table-main thead tr th .table-header-cell-wrapper .table-header-resizer.right[data-v-12388195] {
|
|
147
|
+
right: 0;
|
|
148
|
+
}
|
|
149
|
+
.stk-table .stk-table-main tbody[data-v-12388195] {
|
|
150
|
+
/**高亮渐暗 */
|
|
151
|
+
}
|
|
152
|
+
@keyframes dim-12388195 {
|
|
153
|
+
from {
|
|
154
|
+
background-color: var(--highlight-color);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
.stk-table .stk-table-main tbody tr[data-v-12388195] {
|
|
158
|
+
background-color: var(--td-bgc);
|
|
159
|
+
}
|
|
160
|
+
.stk-table .stk-table-main tbody tr.highlight-row[data-v-12388195] {
|
|
161
|
+
animation: dim-12388195 2s linear;
|
|
162
|
+
}
|
|
163
|
+
.stk-table .stk-table-main tbody tr.hover[data-v-12388195],
|
|
164
|
+
.stk-table .stk-table-main tbody tr[data-v-12388195]:hover {
|
|
165
|
+
background-color: var(--tr-hover-bgc);
|
|
166
|
+
}
|
|
167
|
+
.stk-table .stk-table-main tbody tr.active[data-v-12388195] {
|
|
168
|
+
background-color: var(--tr-active-bgc);
|
|
169
|
+
}
|
|
170
|
+
.stk-table .stk-table-main tbody tr td.fixed-cell[data-v-12388195] {
|
|
171
|
+
background-color: inherit;
|
|
172
|
+
}
|
|
173
|
+
.stk-table .stk-table-main tbody tr td[data-v-12388195]:first-child {
|
|
174
|
+
background-image: var(--bg-border-right), var(--bg-border-bottom), var(--bg-border-left);
|
|
175
|
+
}
|
|
176
|
+
.stk-table .stk-table-main tbody tr td.highlight-cell[data-v-12388195] {
|
|
177
|
+
animation: dim-12388195 2s linear;
|
|
178
|
+
}
|
|
179
|
+
.stk-table .stk-table-main tbody tr td.text-overflow .table-cell-wrapper[data-v-12388195] {
|
|
180
|
+
white-space: nowrap;
|
|
181
|
+
overflow: hidden;
|
|
182
|
+
text-overflow: ellipsis;
|
|
183
|
+
}
|
|
184
|
+
.stk-table .stk-table-no-data[data-v-12388195] {
|
|
185
|
+
background-color: var(--table-bgc);
|
|
186
|
+
line-height: var(--row-height);
|
|
187
|
+
text-align: center;
|
|
188
|
+
font-size: 14px;
|
|
189
|
+
position: sticky;
|
|
190
|
+
left: 0px;
|
|
191
|
+
border-left: var(--border-width) solid var(--border-color);
|
|
192
|
+
border-right: var(--border-width) solid var(--border-color);
|
|
193
|
+
border-bottom: var(--border-width) solid var(--border-color);
|
|
194
|
+
display: flex;
|
|
195
|
+
flex-direction: column;
|
|
196
|
+
align-items: center;
|
|
197
|
+
justify-content: center;
|
|
198
|
+
}
|
|
199
|
+
.stk-table .stk-table-no-data.no-data-full[data-v-12388195] {
|
|
200
|
+
flex: 1;
|
|
201
|
+
}
|
|
202
|
+
.stk-table.virtual .stk-table-main thead tr th .table-header-cell-wrapper[data-v-12388195] {
|
|
203
|
+
overflow: hidden;
|
|
204
|
+
max-height: var(--row-height);
|
|
205
|
+
}
|
|
206
|
+
.stk-table.virtual .stk-table-main tbody[data-v-12388195] {
|
|
207
|
+
position: relative;
|
|
208
|
+
}
|
|
209
|
+
.stk-table.virtual .stk-table-main tbody tr td[data-v-12388195] {
|
|
210
|
+
height: var(--row-height);
|
|
211
|
+
line-height: 1;
|
|
212
|
+
}
|
|
213
|
+
.stk-table.virtual .stk-table-main tbody tr td .table-cell-wrapper[data-v-12388195] {
|
|
214
|
+
max-height: var(--row-height);
|
|
215
|
+
overflow: hidden;
|
|
216
|
+
}
|
|
217
|
+
.stk-table.virtual-x .stk-table-main .virtual-x-left[data-v-12388195] {
|
|
218
|
+
padding: 0;
|
|
219
|
+
}
|
|
220
|
+
.stk-table.virtual-x .stk-table-main thead tr:first-child .virtual-x-left + th[data-v-12388195] {
|
|
221
|
+
background-image: var(--bg-border-top), var(--bg-border-right), var(--bg-border-bottom), var(--bg-border-left);
|
|
222
|
+
}
|
|
223
|
+
.stk-table.virtual-x .stk-table-main tr .virtual-x-left + th[data-v-12388195] {
|
|
224
|
+
background-image: var(--bg-border-right), var(--bg-border-bottom), var(--bg-border-left);
|
|
225
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "stk-table-vue",
|
|
3
|
+
"version": "0.0.1-beta.1",
|
|
4
|
+
"description": "simple realtime virtual table for vue3",
|
|
5
|
+
"main": "./lib/stk-table-vue.js",
|
|
6
|
+
"types": "./lib/StkTable/index.d.ts",
|
|
7
|
+
"packageManager": "pnpm@8.11.0",
|
|
8
|
+
"directories": {
|
|
9
|
+
"test": "test"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"scripts": {
|
|
13
|
+
"dev": "vite",
|
|
14
|
+
"build": "vite build"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"virtual table",
|
|
18
|
+
"vue",
|
|
19
|
+
"highlight",
|
|
20
|
+
"sticky"
|
|
21
|
+
],
|
|
22
|
+
"files": [
|
|
23
|
+
"lib",
|
|
24
|
+
"src"
|
|
25
|
+
],
|
|
26
|
+
"author": "japlus",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://gitee.com/japlus/stk-table-vue"
|
|
30
|
+
},
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/d3-interpolate": "^3.0.4",
|
|
34
|
+
"@typescript-eslint/eslint-plugin": "^5.32.0",
|
|
35
|
+
"@typescript-eslint/parser": "^5.32.0",
|
|
36
|
+
"@vitejs/plugin-vue": "^4.5.0",
|
|
37
|
+
"@vitejs/plugin-vue-jsx": "^3.1.0",
|
|
38
|
+
"eslint": "^8.31.0",
|
|
39
|
+
"eslint-config-prettier": "^8.6.0",
|
|
40
|
+
"eslint-plugin-html": "^7.1.0",
|
|
41
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
42
|
+
"eslint-plugin-vue": "^9.8.0",
|
|
43
|
+
"less": "^4.2.0",
|
|
44
|
+
"prettier": "^2.7.1",
|
|
45
|
+
"pug": "^3.0.2",
|
|
46
|
+
"typescript": "^5.3.2",
|
|
47
|
+
"vite": "^5.0.6",
|
|
48
|
+
"vite-plugin-dts": "^3.6.4",
|
|
49
|
+
"vue": "^3.3.9",
|
|
50
|
+
"vue-eslint-parser": "^9.1.0",
|
|
51
|
+
"vue-loader": "^17.2.2"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"d3-interpolate": "^3.0.1"
|
|
55
|
+
}
|
|
56
|
+
}
|