evui 3.3.9 → 3.3.12
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/dist/evui.common.js +3546 -973
- package/dist/evui.common.js.map +1 -1
- package/dist/evui.umd.js +3546 -973
- package/dist/evui.umd.js.map +1 -1
- package/dist/evui.umd.min.js +1 -1
- package/dist/evui.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/chart/Chart.vue +15 -6
- package/src/components/chart/chart.core.js +86 -31
- package/src/components/chart/element/element.bar.js +7 -1
- package/src/components/chart/element/element.heatmap.js +213 -0
- package/src/components/chart/element/element.line.js +20 -9
- package/src/components/chart/element/element.pie.js +13 -5
- package/src/components/chart/element/element.scatter.js +26 -9
- package/src/components/chart/element/element.tip.js +154 -13
- package/src/components/chart/helpers/helpers.constant.js +15 -0
- package/src/components/chart/model/model.series.js +4 -0
- package/src/components/chart/model/model.store.js +160 -2
- package/src/components/chart/plugins/plugins.interaction.js +82 -10
- package/src/components/chart/plugins/plugins.legend.js +213 -42
- package/src/components/chart/plugins/plugins.tooltip.js +249 -6
- package/src/components/chart/scale/scale.js +9 -0
- package/src/components/chart/scale/scale.step.js +20 -5
- package/src/components/chart/scale/scale.time.category.js +20 -2
- package/src/components/chart/uses.js +20 -3
- package/src/components/grid/Grid.vue +276 -132
- package/src/components/grid/grid.filter.window.vue +1 -0
- package/src/components/grid/grid.pagination.vue +75 -0
- package/src/components/grid/grid.summary.vue +235 -0
- package/src/components/grid/style/grid.scss +0 -14
- package/src/components/grid/uses.js +158 -79
- package/src/components/pagination/Pagination.vue +20 -17
- package/src/components/treeGrid/TreeGrid.vue +253 -34
- package/src/components/treeGrid/TreeGridNode.vue +8 -9
- package/src/components/treeGrid/uses.js +152 -37
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
v-if="
|
|
3
|
+
v-if="$slots.toolbar"
|
|
4
4
|
class="toolbar-wrapper"
|
|
5
5
|
:style="`width: ${gridWidth};`"
|
|
6
6
|
>
|
|
7
7
|
<!-- Toolbar -->
|
|
8
|
-
<toolbar
|
|
8
|
+
<toolbar>
|
|
9
9
|
<template #toolbarWrapper>
|
|
10
10
|
<slot
|
|
11
11
|
name="toolbar"
|
|
12
12
|
:item="{ onSearch: onSearch }"
|
|
13
|
-
|
|
14
|
-
</slot>
|
|
13
|
+
/>
|
|
15
14
|
</template>
|
|
16
15
|
</toolbar>
|
|
17
16
|
</div>
|
|
@@ -26,7 +25,7 @@
|
|
|
26
25
|
class="grid-wrapper"
|
|
27
26
|
:style="`width: ${gridWidth}; height: ${gridHeight};`"
|
|
28
27
|
>
|
|
29
|
-
<!--Table-->
|
|
28
|
+
<!-- Table -->
|
|
30
29
|
<div
|
|
31
30
|
v-cloak
|
|
32
31
|
ref="grid"
|
|
@@ -37,7 +36,7 @@
|
|
|
37
36
|
'non-header': !showHeader,
|
|
38
37
|
}"
|
|
39
38
|
>
|
|
40
|
-
<!--Header-->
|
|
39
|
+
<!-- Header -->
|
|
41
40
|
<div
|
|
42
41
|
v-show="showHeader"
|
|
43
42
|
ref="header"
|
|
@@ -47,7 +46,7 @@
|
|
|
47
46
|
}"
|
|
48
47
|
>
|
|
49
48
|
<ul class="column-list">
|
|
50
|
-
<!--Header Checkbox-->
|
|
49
|
+
<!-- Header Checkbox -->
|
|
51
50
|
<li
|
|
52
51
|
v-if="useCheckbox.use"
|
|
53
52
|
:class="{
|
|
@@ -57,14 +56,12 @@
|
|
|
57
56
|
:style="`width: ${minWidth}px;`"
|
|
58
57
|
>
|
|
59
58
|
<ev-checkbox
|
|
60
|
-
v-if="useCheckbox.use
|
|
61
|
-
&& useCheckbox.headerCheck
|
|
62
|
-
&& useCheckbox.mode !== 'single'"
|
|
59
|
+
v-if="useCheckbox.use && useCheckbox.headerCheck && useCheckbox.mode !== 'single'"
|
|
63
60
|
v-model="isHeaderChecked"
|
|
64
61
|
@change="onCheckAll"
|
|
65
62
|
/>
|
|
66
63
|
</li>
|
|
67
|
-
<!--Column List-->
|
|
64
|
+
<!-- Column List -->
|
|
68
65
|
<template
|
|
69
66
|
v-for="(column, index) in orderedColumns"
|
|
70
67
|
:key="index"
|
|
@@ -78,18 +75,19 @@
|
|
|
78
75
|
'non-border': !!borderStyle,
|
|
79
76
|
[column.field]: column.field,
|
|
80
77
|
}"
|
|
81
|
-
:style="
|
|
82
|
-
width:
|
|
83
|
-
min-width:
|
|
78
|
+
:style="{
|
|
79
|
+
width: `${column.width}px`,
|
|
80
|
+
'min-width': `${isRenderer(column) ? rendererMinWidth : minWidth}px`,
|
|
81
|
+
}"
|
|
84
82
|
>
|
|
85
|
-
<!--Filter Status-->
|
|
83
|
+
<!-- Filter Status -->
|
|
86
84
|
<span
|
|
87
85
|
v-if="isFiltering && filterList[column.field]?.find(item => item.use)"
|
|
88
86
|
class="column-filter-status"
|
|
89
87
|
>
|
|
90
88
|
<ev-icon icon="ev-icon-filter"/>
|
|
91
89
|
</span>
|
|
92
|
-
<!--Column Name-->
|
|
90
|
+
<!-- Column Name -->
|
|
93
91
|
<span
|
|
94
92
|
:title="column.caption"
|
|
95
93
|
class="column-name"
|
|
@@ -97,7 +95,7 @@
|
|
|
97
95
|
>
|
|
98
96
|
{{ column.caption }}
|
|
99
97
|
</span>
|
|
100
|
-
<!--Sort Icon-->
|
|
98
|
+
<!-- Sort Icon -->
|
|
101
99
|
<template v-if="sortField === column.field">
|
|
102
100
|
<ev-icon
|
|
103
101
|
v-if="sortOrder === 'desc'"
|
|
@@ -108,15 +106,15 @@
|
|
|
108
106
|
icon="ev-icon-triangle-up"
|
|
109
107
|
/>
|
|
110
108
|
</template>
|
|
111
|
-
<!--Filter Button-->
|
|
109
|
+
<!-- Filter Button -->
|
|
112
110
|
<span
|
|
113
|
-
v-if="
|
|
111
|
+
v-if="isFiltering"
|
|
114
112
|
class="column-filter"
|
|
115
113
|
@click.capture="onClickFilter(column)"
|
|
116
114
|
>
|
|
117
115
|
<ev-icon icon="ev-icon-hamburger2"/>
|
|
118
116
|
</span>
|
|
119
|
-
<!--Column Resize-->
|
|
117
|
+
<!-- Column Resize -->
|
|
120
118
|
<span
|
|
121
119
|
class="column-resize"
|
|
122
120
|
@mousedown.stop.left="onColumnResize(index, $event)"
|
|
@@ -125,7 +123,7 @@
|
|
|
125
123
|
</template>
|
|
126
124
|
</ul>
|
|
127
125
|
</div>
|
|
128
|
-
<!--Body-->
|
|
126
|
+
<!-- Body -->
|
|
129
127
|
<div
|
|
130
128
|
ref="body"
|
|
131
129
|
:class="{
|
|
@@ -138,106 +136,106 @@
|
|
|
138
136
|
@contextmenu="onContextMenu($event)"
|
|
139
137
|
@contextmenu.prevent="menu.show"
|
|
140
138
|
>
|
|
141
|
-
<!--vScroll Top-->
|
|
139
|
+
<!-- vScroll Top -->
|
|
142
140
|
<div
|
|
143
141
|
:style="`height: ${vScrollTopHeight}px;`"
|
|
144
142
|
class="vscroll-spacer"
|
|
145
143
|
/>
|
|
146
144
|
<table>
|
|
147
145
|
<tbody>
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
:class="{
|
|
154
|
-
row: true,
|
|
155
|
-
selected: row[2] === selectedRow,
|
|
156
|
-
'non-border': !!borderStyle && borderStyle !== 'rows',
|
|
157
|
-
highlight: row[0] === highlightIdx,
|
|
158
|
-
}"
|
|
159
|
-
@click="onRowClick($event, row)"
|
|
160
|
-
@dblclick="onRowDblClick($event, row)"
|
|
161
|
-
>
|
|
162
|
-
<!--Row Checkbox-->
|
|
163
|
-
<td
|
|
164
|
-
v-if="useCheckbox.use"
|
|
146
|
+
<!-- Row List -->
|
|
147
|
+
<tr
|
|
148
|
+
v-for="(row, rowIndex) in viewStore"
|
|
149
|
+
:key="rowIndex"
|
|
150
|
+
:data-index="row[0]"
|
|
165
151
|
:class="{
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
'non-border': !!borderStyle,
|
|
152
|
+
row: true,
|
|
153
|
+
selected: row[3],
|
|
154
|
+
'non-border': !!borderStyle && borderStyle !== 'rows',
|
|
155
|
+
highlight: row[0] === highlightIdx,
|
|
169
156
|
}"
|
|
170
|
-
|
|
157
|
+
@click="onRowClick($event, row)"
|
|
158
|
+
@dblclick="onRowDblClick($event, row)"
|
|
171
159
|
>
|
|
172
|
-
|
|
173
|
-
v-model="row[1]"
|
|
174
|
-
class="row-checkbox-input"
|
|
175
|
-
@change="onCheck($event, row)"
|
|
176
|
-
/>
|
|
177
|
-
</td>
|
|
178
|
-
<!--Cell-->
|
|
179
|
-
<template v-for="(column, cellIndex) in orderedColumns" :key="cellIndex">
|
|
160
|
+
<!-- Row Checkbox -->
|
|
180
161
|
<td
|
|
181
|
-
v-if="
|
|
182
|
-
:data-name="column.field"
|
|
183
|
-
:data-index="column.index"
|
|
162
|
+
v-if="useCheckbox.use"
|
|
184
163
|
:class="{
|
|
185
164
|
cell: true,
|
|
186
|
-
|
|
187
|
-
[column.align]: column.align,
|
|
188
|
-
render: isRenderer(column),
|
|
165
|
+
'row-checkbox': true,
|
|
189
166
|
'non-border': !!borderStyle,
|
|
190
|
-
[column.field]: column.field,
|
|
191
167
|
}"
|
|
192
|
-
:style="`
|
|
193
|
-
width: ${column.width}px;
|
|
194
|
-
height: ${rowHeight}px;
|
|
195
|
-
line-height: ${rowHeight}px;
|
|
196
|
-
min-width: ${isRenderer(column) ? rendererMinWidth : minWidth}px;`"
|
|
168
|
+
:style="`width: ${minWidth}px; height: ${rowHeight}px;`"
|
|
197
169
|
>
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
row,
|
|
204
|
-
column,
|
|
205
|
-
}"
|
|
206
|
-
>
|
|
207
|
-
</slot>
|
|
208
|
-
</template>
|
|
209
|
-
<!-- cell value -->
|
|
210
|
-
<template v-else>
|
|
211
|
-
<div :title="getConvertValue(column.type, row[2][column.index])">
|
|
212
|
-
{{ getConvertValue(column.type, row[2][column.index]) }}
|
|
213
|
-
</div>
|
|
214
|
-
</template>
|
|
170
|
+
<ev-checkbox
|
|
171
|
+
v-model="row[1]"
|
|
172
|
+
class="row-checkbox-input"
|
|
173
|
+
@change="onCheck($event, row)"
|
|
174
|
+
/>
|
|
215
175
|
</td>
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
176
|
+
<!-- Cell -->
|
|
177
|
+
<template
|
|
178
|
+
v-for="(column, cellIndex) in orderedColumns"
|
|
179
|
+
:key="cellIndex"
|
|
180
|
+
>
|
|
181
|
+
<td
|
|
182
|
+
v-if="!column.hide"
|
|
183
|
+
:data-name="column.field"
|
|
184
|
+
:data-index="column.index"
|
|
185
|
+
:class="{
|
|
186
|
+
cell: true,
|
|
187
|
+
[column.type]: column.type,
|
|
188
|
+
[column.align]: column.align,
|
|
189
|
+
render: isRenderer(column),
|
|
190
|
+
'non-border': !!borderStyle,
|
|
191
|
+
[column.field]: column.field,
|
|
192
|
+
}"
|
|
193
|
+
:style="{
|
|
194
|
+
width: `${column.width}px`,
|
|
195
|
+
height: `${rowHeight}px`,
|
|
196
|
+
'line-height': `${rowHeight}px`,
|
|
197
|
+
'min-width': `${isRenderer(column) ? rendererMinWidth : minWidth}px`,
|
|
198
|
+
}"
|
|
199
|
+
>
|
|
200
|
+
<!-- Cell Renderer -->
|
|
201
|
+
<template v-if="!!$slots[column.field]">
|
|
202
|
+
<slot
|
|
203
|
+
:name="column.field"
|
|
204
|
+
:item="{ row, column }"
|
|
205
|
+
/>
|
|
206
|
+
</template>
|
|
207
|
+
<!-- Cell Value -->
|
|
208
|
+
<template v-else>
|
|
209
|
+
<div :title="getConvertValue(column, row[2][column.index])">
|
|
210
|
+
{{ getConvertValue(column, row[2][column.index]) }}
|
|
211
|
+
</div>
|
|
212
|
+
</template>
|
|
213
|
+
</td>
|
|
214
|
+
</template>
|
|
215
|
+
</tr>
|
|
216
|
+
<tr v-if="!viewStore.length">
|
|
217
|
+
<td class="is-empty">No records</td>
|
|
218
|
+
</tr>
|
|
221
219
|
</tbody>
|
|
222
220
|
</table>
|
|
223
|
-
<!--vScroll Bottom-->
|
|
221
|
+
<!-- vScroll Bottom -->
|
|
224
222
|
<div
|
|
225
223
|
:style="`height: ${vScrollBottomHeight}px;`"
|
|
226
224
|
class="vscroll-spacer"
|
|
227
225
|
/>
|
|
228
|
-
<!--Context Menu-->
|
|
226
|
+
<!-- Context Menu -->
|
|
229
227
|
<ev-context-menu
|
|
230
228
|
ref="menu"
|
|
231
229
|
:items="contextMenuItems"
|
|
232
230
|
/>
|
|
233
231
|
</div>
|
|
234
|
-
<!--Resize Line-->
|
|
232
|
+
<!-- Resize Line -->
|
|
235
233
|
<div
|
|
236
234
|
v-show="showResizeLine"
|
|
237
235
|
ref="resizeLine"
|
|
238
236
|
class="table-resize-line"
|
|
239
237
|
/>
|
|
240
|
-
<!--Filter Window-->
|
|
238
|
+
<!-- Filter Window -->
|
|
241
239
|
<filter-window
|
|
242
240
|
v-show="showFilterWindow"
|
|
243
241
|
:is-show="showFilterWindow"
|
|
@@ -248,12 +246,36 @@
|
|
|
248
246
|
/>
|
|
249
247
|
</div>
|
|
250
248
|
</div>
|
|
249
|
+
<!-- Summary -->
|
|
250
|
+
<grid-summary
|
|
251
|
+
v-if="useSummary"
|
|
252
|
+
:ordered-columns="orderedColumns"
|
|
253
|
+
:stores="stores"
|
|
254
|
+
:use-checkbox="useCheckbox.use"
|
|
255
|
+
:style-option="{
|
|
256
|
+
borderStyle,
|
|
257
|
+
minWidth,
|
|
258
|
+
rowHeight,
|
|
259
|
+
}"
|
|
260
|
+
/>
|
|
261
|
+
<!-- Pagination -->
|
|
262
|
+
<grid-pagination
|
|
263
|
+
v-if="usePage && !isInfinite"
|
|
264
|
+
v-model="currentPage"
|
|
265
|
+
:total="store.length"
|
|
266
|
+
:per-page="perPage"
|
|
267
|
+
:visible-page="visiblePage"
|
|
268
|
+
:show-page-info="showPageInfo"
|
|
269
|
+
:order="order"
|
|
270
|
+
/>
|
|
251
271
|
</template>
|
|
252
272
|
|
|
253
273
|
<script>
|
|
254
|
-
import { reactive, toRefs, computed, watch, onMounted, onActivated } from 'vue';
|
|
255
|
-
import FilterWindow from './grid.filter.window';
|
|
274
|
+
import { reactive, toRefs, computed, watch, onMounted, onActivated, nextTick } from 'vue';
|
|
256
275
|
import Toolbar from './grid.toolbar';
|
|
276
|
+
import FilterWindow from './grid.filter.window';
|
|
277
|
+
import GridPagination from './grid.pagination';
|
|
278
|
+
import GridSummary from './grid.summary';
|
|
257
279
|
import {
|
|
258
280
|
commonFunctions,
|
|
259
281
|
scrollEvent,
|
|
@@ -264,13 +286,16 @@ import {
|
|
|
264
286
|
filterEvent,
|
|
265
287
|
contextMenuEvent,
|
|
266
288
|
storeEvent,
|
|
289
|
+
pagingEvent,
|
|
267
290
|
} from './uses';
|
|
268
291
|
|
|
269
292
|
export default {
|
|
270
293
|
name: 'EvGrid',
|
|
271
294
|
components: {
|
|
272
|
-
FilterWindow,
|
|
273
295
|
Toolbar,
|
|
296
|
+
FilterWindow,
|
|
297
|
+
GridPagination,
|
|
298
|
+
GridSummary,
|
|
274
299
|
},
|
|
275
300
|
props: {
|
|
276
301
|
columns: {
|
|
@@ -309,9 +334,13 @@ export default {
|
|
|
309
334
|
'update:checked': null,
|
|
310
335
|
'check-row': null,
|
|
311
336
|
'check-all': null,
|
|
312
|
-
'
|
|
337
|
+
'page-change': null,
|
|
313
338
|
},
|
|
314
339
|
setup(props) {
|
|
340
|
+
// const ROW_INDEX = 0;
|
|
341
|
+
const ROW_CHECK_INDEX = 1;
|
|
342
|
+
const ROW_DATA_INDEX = 2;
|
|
343
|
+
const ROW_SELECT_INDEX = 3;
|
|
315
344
|
const {
|
|
316
345
|
isRenderer,
|
|
317
346
|
getComponentName,
|
|
@@ -319,11 +348,11 @@ export default {
|
|
|
319
348
|
getColumnIndex,
|
|
320
349
|
setPixelUnit,
|
|
321
350
|
} = commonFunctions();
|
|
322
|
-
const showHeader = computed(() =>
|
|
323
|
-
|
|
351
|
+
const showHeader = computed(() => (props.option.showHeader ?? true));
|
|
352
|
+
const useSummary = computed(() => (props.option?.useSummary || false));
|
|
324
353
|
const stripeStyle = computed(() => (props.option.style?.stripe || false));
|
|
325
354
|
const borderStyle = computed(() => (props.option.style?.border || ''));
|
|
326
|
-
const highlightIdx = computed(() => (props.option.style?.highlight
|
|
355
|
+
const highlightIdx = computed(() => (props.option.style?.highlight ?? -1));
|
|
327
356
|
const rowMinHeight = props.option.rowMinHeight || 35;
|
|
328
357
|
const elementInfo = reactive({
|
|
329
358
|
body: null,
|
|
@@ -333,8 +362,7 @@ export default {
|
|
|
333
362
|
});
|
|
334
363
|
const filterInfo = reactive({
|
|
335
364
|
filterList: {},
|
|
336
|
-
isFiltering: computed(() =>
|
|
337
|
-
(props.option.useFilter === undefined ? true : props.option.useFilter)),
|
|
365
|
+
isFiltering: computed(() => (props.option.useFilter ?? false)),
|
|
338
366
|
setFiltering: false,
|
|
339
367
|
showFilterWindow: false,
|
|
340
368
|
currentFilter: {
|
|
@@ -348,6 +376,7 @@ export default {
|
|
|
348
376
|
viewStore: [],
|
|
349
377
|
originStore: [],
|
|
350
378
|
filterStore: [],
|
|
379
|
+
pagingStore: [],
|
|
351
380
|
store: computed(() => {
|
|
352
381
|
const store = filterInfo.isFiltering ? stores.filterStore : stores.originStore;
|
|
353
382
|
return filterInfo.isSearch ? stores.searchStore : store;
|
|
@@ -355,11 +384,27 @@ export default {
|
|
|
355
384
|
orderedColumns: computed(() =>
|
|
356
385
|
(props.columns.map((column, index) => ({ index, ...column })))),
|
|
357
386
|
});
|
|
387
|
+
const pageInfo = reactive({
|
|
388
|
+
usePage: computed(() => (props.option.page?.use || false)),
|
|
389
|
+
useClient: props.option.page?.useClient || false,
|
|
390
|
+
isInfinite: computed(() => (props.option.page?.isInfinite || false)),
|
|
391
|
+
startIndex: 0,
|
|
392
|
+
prevPage: 0,
|
|
393
|
+
currentPage: 0,
|
|
394
|
+
total: computed(() => (props.option.page?.total || 0)),
|
|
395
|
+
perPage: computed(() => (props.option.page?.perPage || 20)),
|
|
396
|
+
visiblePage: computed(() => (props.option.page?.visiblePage || 8)),
|
|
397
|
+
order: computed(() => (props.option.page?.order || 'center')),
|
|
398
|
+
showPageInfo: computed(() => (props.option.page?.showPageInfo || false)),
|
|
399
|
+
isClientPaging: computed(() =>
|
|
400
|
+
pageInfo.useClient && pageInfo.usePage && !pageInfo.isInfinite),
|
|
401
|
+
isHighlight: false,
|
|
402
|
+
highlightPage: 0,
|
|
403
|
+
});
|
|
358
404
|
const checkInfo = reactive({
|
|
359
405
|
prevCheckedRow: [],
|
|
360
406
|
isHeaderChecked: false,
|
|
361
407
|
checkedRows: props.checked,
|
|
362
|
-
checkedIndex: new Set(),
|
|
363
408
|
useCheckbox: computed(() => (props.option.useCheckbox || {})),
|
|
364
409
|
});
|
|
365
410
|
const scrollInfo = reactive({
|
|
@@ -372,8 +417,14 @@ export default {
|
|
|
372
417
|
hasVerticalScrollBar: false,
|
|
373
418
|
});
|
|
374
419
|
const selectInfo = reactive({
|
|
375
|
-
useSelect: props.option.useSelect === undefined ? true : props.option.useSelect,
|
|
376
420
|
selectedRow: props.selected,
|
|
421
|
+
useSelect: computed(() => props.option?.useSelection?.use ?? true),
|
|
422
|
+
limitCount: computed(() => {
|
|
423
|
+
let limit = props.option?.useSelection?.limitCount;
|
|
424
|
+
limit = !!limit && limit >= 2 ? limit : 0;
|
|
425
|
+
return limit;
|
|
426
|
+
}),
|
|
427
|
+
multiple: computed(() => props.option?.useSelection?.multiple ?? false),
|
|
377
428
|
});
|
|
378
429
|
const sortInfo = reactive({
|
|
379
430
|
isSorting: false,
|
|
@@ -398,35 +449,60 @@ export default {
|
|
|
398
449
|
gridWidth: computed(() => (props.width ? setPixelUnit(props.width) : '100%')),
|
|
399
450
|
gridHeight: computed(() => (props.height ? setPixelUnit(props.height) : '100%')),
|
|
400
451
|
});
|
|
401
|
-
const
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
452
|
+
const clearCheckInfo = () => {
|
|
453
|
+
checkInfo.checkedRows = [];
|
|
454
|
+
checkInfo.isHeaderChecked = false;
|
|
455
|
+
stores.store.forEach((row) => {
|
|
456
|
+
row[ROW_CHECK_INDEX] = false;
|
|
457
|
+
});
|
|
458
|
+
};
|
|
459
|
+
const clearSelectInfo = () => {
|
|
460
|
+
selectInfo.selectedRow = [];
|
|
461
|
+
stores.store.forEach((row) => {
|
|
462
|
+
row[ROW_SELECT_INDEX] = false;
|
|
463
|
+
});
|
|
464
|
+
};
|
|
465
|
+
const {
|
|
466
|
+
getPagingData,
|
|
467
|
+
updatePagingInfo,
|
|
468
|
+
changePage,
|
|
469
|
+
} = pagingEvent({
|
|
470
|
+
stores,
|
|
471
|
+
pageInfo,
|
|
472
|
+
sortInfo,
|
|
473
|
+
filterInfo,
|
|
474
|
+
elementInfo,
|
|
475
|
+
clearCheckInfo,
|
|
408
476
|
});
|
|
409
477
|
|
|
410
478
|
const {
|
|
411
479
|
updateVScroll,
|
|
412
480
|
updateHScroll,
|
|
413
481
|
onScroll,
|
|
414
|
-
} = scrollEvent({
|
|
482
|
+
} = scrollEvent({
|
|
483
|
+
scrollInfo,
|
|
484
|
+
stores,
|
|
485
|
+
elementInfo,
|
|
486
|
+
resizeInfo,
|
|
487
|
+
pageInfo,
|
|
488
|
+
getPagingData,
|
|
489
|
+
updatePagingInfo,
|
|
490
|
+
});
|
|
415
491
|
|
|
416
492
|
const {
|
|
417
493
|
onRowClick,
|
|
418
494
|
onRowDblClick,
|
|
419
|
-
} = clickEvent(selectInfo);
|
|
495
|
+
} = clickEvent({ selectInfo });
|
|
420
496
|
|
|
421
497
|
const {
|
|
422
498
|
onCheck,
|
|
423
499
|
onCheckAll,
|
|
424
|
-
} = checkEvent({ checkInfo, stores,
|
|
500
|
+
} = checkEvent({ checkInfo, stores, pageInfo, getPagingData, updatePagingInfo });
|
|
425
501
|
|
|
426
502
|
const {
|
|
427
503
|
onSort,
|
|
428
504
|
setSort,
|
|
429
|
-
} = sortEvent({ sortInfo, stores, getColumnIndex });
|
|
505
|
+
} = sortEvent({ sortInfo, stores, getColumnIndex, updatePagingInfo });
|
|
430
506
|
|
|
431
507
|
const {
|
|
432
508
|
onClickFilter,
|
|
@@ -438,14 +514,16 @@ export default {
|
|
|
438
514
|
filterInfo,
|
|
439
515
|
stores,
|
|
440
516
|
checkInfo,
|
|
517
|
+
pageInfo,
|
|
441
518
|
getColumnIndex,
|
|
442
519
|
getConvertValue,
|
|
443
520
|
updateVScroll,
|
|
521
|
+
getPagingData,
|
|
522
|
+
updatePagingInfo,
|
|
444
523
|
});
|
|
445
524
|
|
|
446
525
|
const {
|
|
447
526
|
setStore,
|
|
448
|
-
updateData,
|
|
449
527
|
} = storeEvent({
|
|
450
528
|
selectInfo,
|
|
451
529
|
checkInfo,
|
|
@@ -463,7 +541,15 @@ export default {
|
|
|
463
541
|
onResize,
|
|
464
542
|
onShow,
|
|
465
543
|
onColumnResize,
|
|
466
|
-
} = resizeEvent({
|
|
544
|
+
} = resizeEvent({
|
|
545
|
+
resizeInfo,
|
|
546
|
+
elementInfo,
|
|
547
|
+
checkInfo,
|
|
548
|
+
stores,
|
|
549
|
+
filterInfo,
|
|
550
|
+
isRenderer,
|
|
551
|
+
updateVScroll,
|
|
552
|
+
});
|
|
467
553
|
|
|
468
554
|
const {
|
|
469
555
|
setContextMenu,
|
|
@@ -477,14 +563,6 @@ export default {
|
|
|
477
563
|
onActivated(() => {
|
|
478
564
|
onResize();
|
|
479
565
|
});
|
|
480
|
-
const ROW_INDEX = 0;
|
|
481
|
-
const ROW_CHECK_INDEX = 1;
|
|
482
|
-
const ROW_DATA_INDEX = 2;
|
|
483
|
-
const clearCheckInfo = () => {
|
|
484
|
-
checkInfo.checkedRows = [];
|
|
485
|
-
checkInfo.checkedIndex.clear();
|
|
486
|
-
checkInfo.isHeaderChecked = false;
|
|
487
|
-
};
|
|
488
566
|
watch(
|
|
489
567
|
() => props.columns,
|
|
490
568
|
() => {
|
|
@@ -499,6 +577,11 @@ export default {
|
|
|
499
577
|
if (value) {
|
|
500
578
|
setStore(stores.originStore, false);
|
|
501
579
|
sortInfo.isSorting = !value;
|
|
580
|
+
if (pageInfo.isClientPaging) {
|
|
581
|
+
pageInfo.currentPage = 1;
|
|
582
|
+
stores.pagingStore = getPagingData();
|
|
583
|
+
clearCheckInfo();
|
|
584
|
+
}
|
|
502
585
|
}
|
|
503
586
|
},
|
|
504
587
|
);
|
|
@@ -525,14 +608,13 @@ export default {
|
|
|
525
608
|
(checkedList) => {
|
|
526
609
|
checkInfo.checkedRows = checkedList;
|
|
527
610
|
checkInfo.isHeaderChecked = false;
|
|
528
|
-
|
|
529
|
-
|
|
611
|
+
let store = stores.store;
|
|
612
|
+
if (pageInfo.isClientPaging) {
|
|
613
|
+
store = getPagingData();
|
|
614
|
+
}
|
|
530
615
|
if (store.length) {
|
|
531
616
|
store.forEach((row) => {
|
|
532
617
|
row[ROW_CHECK_INDEX] = checkedList.includes(row[ROW_DATA_INDEX]);
|
|
533
|
-
if (row[ROW_CHECK_INDEX]) {
|
|
534
|
-
checkInfo.checkedIndex.add(row[ROW_INDEX]);
|
|
535
|
-
}
|
|
536
618
|
});
|
|
537
619
|
checkInfo.isHeaderChecked = checkedList.length === store.length;
|
|
538
620
|
}
|
|
@@ -541,8 +623,31 @@ export default {
|
|
|
541
623
|
);
|
|
542
624
|
watch(
|
|
543
625
|
() => props.selected,
|
|
544
|
-
(
|
|
545
|
-
selectInfo.
|
|
626
|
+
(selectedList) => {
|
|
627
|
+
if (selectInfo.useSelect) {
|
|
628
|
+
selectInfo.selectedRow = selectedList;
|
|
629
|
+
stores.store.forEach((row) => {
|
|
630
|
+
row[ROW_SELECT_INDEX] = selectInfo.selectedRow.includes(row[ROW_DATA_INDEX]);
|
|
631
|
+
});
|
|
632
|
+
updateVScroll();
|
|
633
|
+
}
|
|
634
|
+
},
|
|
635
|
+
);
|
|
636
|
+
watch(
|
|
637
|
+
() => highlightIdx.value,
|
|
638
|
+
async (index) => {
|
|
639
|
+
await nextTick();
|
|
640
|
+
if (index >= 0) {
|
|
641
|
+
if (pageInfo.usePage && !pageInfo.isInfinite) {
|
|
642
|
+
pageInfo.highlightPage = Math.ceil(index / pageInfo.perPage) || 1;
|
|
643
|
+
if (pageInfo.highlightPage !== pageInfo.currentPage) {
|
|
644
|
+
pageInfo.currentPage = pageInfo.highlightPage;
|
|
645
|
+
pageInfo.isHighlight = true;
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
elementInfo.body.scrollTop = resizeInfo.rowHeight * highlightIdx.value;
|
|
650
|
+
}
|
|
546
651
|
},
|
|
547
652
|
);
|
|
548
653
|
watch(
|
|
@@ -551,6 +656,18 @@ export default {
|
|
|
551
656
|
clearCheckInfo();
|
|
552
657
|
},
|
|
553
658
|
);
|
|
659
|
+
watch(
|
|
660
|
+
() => selectInfo.useSelect,
|
|
661
|
+
() => {
|
|
662
|
+
clearSelectInfo();
|
|
663
|
+
},
|
|
664
|
+
);
|
|
665
|
+
watch(
|
|
666
|
+
() => selectInfo.multiple,
|
|
667
|
+
() => {
|
|
668
|
+
clearSelectInfo();
|
|
669
|
+
},
|
|
670
|
+
);
|
|
554
671
|
watch(
|
|
555
672
|
() => props.checked.length,
|
|
556
673
|
(checkedSize) => {
|
|
@@ -590,15 +707,44 @@ export default {
|
|
|
590
707
|
(value) => {
|
|
591
708
|
if (value !== undefined) {
|
|
592
709
|
onSearch(value?.value ?? value);
|
|
710
|
+
if (pageInfo.isClientPaging) {
|
|
711
|
+
clearCheckInfo();
|
|
712
|
+
clearSelectInfo();
|
|
713
|
+
}
|
|
593
714
|
}
|
|
594
|
-
}, { immediate: true
|
|
715
|
+
}, { immediate: true },
|
|
716
|
+
);
|
|
717
|
+
watch(
|
|
718
|
+
() => props.option.page?.currentPage,
|
|
719
|
+
(value) => {
|
|
720
|
+
const current = !value ? 1 : value;
|
|
721
|
+
pageInfo.currentPage = !props.option.page?.isInfinite ? current : 1;
|
|
722
|
+
}, { immediate: true },
|
|
723
|
+
);
|
|
724
|
+
watch(
|
|
725
|
+
() => pageInfo.currentPage,
|
|
726
|
+
(current, before) => {
|
|
727
|
+
nextTick(() => {
|
|
728
|
+
changePage(before);
|
|
729
|
+
if (pageInfo.isClientPaging && current !== before) {
|
|
730
|
+
clearCheckInfo();
|
|
731
|
+
clearSelectInfo();
|
|
732
|
+
}
|
|
733
|
+
updateVScroll();
|
|
734
|
+
if (current === pageInfo.highlightPage && pageInfo.isHighlight) {
|
|
735
|
+
elementInfo.body.scrollTop = resizeInfo.rowHeight * highlightIdx.value;
|
|
736
|
+
pageInfo.isHighlight = !pageInfo.isHighlight;
|
|
737
|
+
}
|
|
738
|
+
});
|
|
739
|
+
},
|
|
595
740
|
);
|
|
596
|
-
const isFilterButton = field => filterInfo.isFiltering && field !== 'db-icon' && field !== 'user-icon';
|
|
597
741
|
return {
|
|
598
742
|
showHeader,
|
|
599
743
|
stripeStyle,
|
|
600
744
|
borderStyle,
|
|
601
745
|
highlightIdx,
|
|
746
|
+
useSummary,
|
|
747
|
+
stores,
|
|
602
748
|
...toRefs(elementInfo),
|
|
603
749
|
...toRefs(stores),
|
|
604
750
|
...toRefs(filterInfo),
|
|
@@ -632,11 +778,9 @@ export default {
|
|
|
632
778
|
onApplyFilter,
|
|
633
779
|
setFilter,
|
|
634
780
|
setStore,
|
|
635
|
-
updateData,
|
|
636
781
|
setContextMenu,
|
|
637
782
|
onContextMenu,
|
|
638
783
|
onSearch,
|
|
639
|
-
isFilterButton,
|
|
640
784
|
};
|
|
641
785
|
},
|
|
642
786
|
};
|