k-vtable 1.0.34 → 1.0.35
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/cjs/ListTable.d.ts +1 -0
- package/cjs/ListTable.js +184 -25
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.js +3 -2
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.d.ts +1 -0
- package/cjs/PivotTable.js +95 -15
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +14 -0
- package/cjs/core/BaseTable.js +149 -41
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/TABLE_EVENT_TYPE.d.ts +2 -0
- package/cjs/core/TABLE_EVENT_TYPE.js +2 -0
- package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/cjs/core/record-helper.js +83 -13
- package/cjs/core/record-helper.js.map +1 -1
- package/cjs/core/tableHelper.js +5 -3
- package/cjs/core/tableHelper.js.map +1 -1
- package/cjs/core/utils/get-cell-position.js +23 -12
- package/cjs/core/utils/get-cell-position.js.map +1 -1
- package/cjs/data/DataSource.js +3 -2
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/dataset/dataset.js +5 -1
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/edit/edit-manager.js +24 -16
- package/cjs/edit/edit-manager.js.map +1 -1
- package/cjs/event/EventTarget.js +3 -1
- package/cjs/event/EventTarget.js.map +1 -1
- package/cjs/event/helper.js +1 -1
- package/cjs/event/listener/container-dom.js +11 -6
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/event/listener/scroll-bar.js +77 -6
- package/cjs/event/listener/scroll-bar.js.map +1 -1
- package/cjs/event/listener/table-group.js +53 -23
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/event/media-click.js +1 -1
- package/cjs/event/scroll.js +35 -12
- package/cjs/event/scroll.js.map +1 -1
- package/cjs/event/sparkline-event.js +1 -1
- package/cjs/event/util.d.ts +2 -0
- package/cjs/event/util.js +29 -4
- package/cjs/event/util.js.map +1 -1
- package/cjs/header-helper/header-helper.js +2 -2
- package/cjs/header-helper/header-helper.js.map +1 -1
- package/cjs/header-helper/style.js +2 -1
- package/cjs/index.d.ts +3 -3
- package/cjs/index.js +51 -12
- package/cjs/index.js.map +1 -1
- package/cjs/layout/cell-range/simple-cell-range.js +14 -5
- package/cjs/layout/cell-range/simple-cell-range.js.map +1 -1
- package/cjs/plugins/index.js +1 -1
- package/cjs/plugins/interface.js +1 -1
- package/cjs/plugins/invert-highlight.js +1 -1
- package/cjs/plugins/list-tree-stick-cell.js +1 -1
- package/cjs/plugins/plugin-manager.js +1 -1
- package/cjs/scenegraph/component/table-component.d.ts +6 -1
- package/cjs/scenegraph/component/table-component.js +143 -17
- package/cjs/scenegraph/component/table-component.js.map +1 -1
- package/cjs/scenegraph/component/util.js +5 -2
- package/cjs/scenegraph/component/util.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +29 -10
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +7 -4
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/init-scenegraph.js +37 -7
- package/cjs/scenegraph/group-creater/init-scenegraph.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.js +4 -2
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +13 -0
- package/cjs/scenegraph/scenegraph.js +194 -23
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/select/create-select-border.js +9 -10
- package/cjs/scenegraph/select/create-select-border.js.map +1 -1
- package/cjs/scenegraph/select/delete-select-border.js.map +1 -1
- package/cjs/scenegraph/select/move-select-border.js.map +1 -1
- package/cjs/scenegraph/select/update-custom-select-border.js +9 -9
- package/cjs/scenegraph/select/update-custom-select-border.js.map +1 -1
- package/cjs/scenegraph/select/update-select-border.js +27 -122
- package/cjs/scenegraph/select/update-select-border.js.map +1 -1
- package/cjs/scenegraph/select/update-select-style.js.map +1 -1
- package/cjs/state/select/update-position.js +2 -1
- package/cjs/state/select/update-position.js.map +1 -1
- package/cjs/state/state.d.ts +8 -1
- package/cjs/state/state.js +82 -40
- package/cjs/state/state.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +15 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/dataset/aggregation.js +94 -39
- package/cjs/ts-types/dataset/aggregation.js.map +1 -1
- package/cjs/ts-types/events.d.ts +16 -0
- package/cjs/ts-types/events.js.map +1 -1
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +2381 -733
- package/dist/vtable.min.js +1 -15
- package/es/ListTable.d.ts +1 -0
- package/es/ListTable.js +178 -25
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.js +2 -2
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.d.ts +1 -0
- package/es/PivotTable.js +93 -15
- package/es/PivotTable.js.map +1 -1
- package/es/core/BaseTable.d.ts +14 -0
- package/es/core/BaseTable.js +148 -40
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/TABLE_EVENT_TYPE.d.ts +2 -0
- package/es/core/TABLE_EVENT_TYPE.js +2 -0
- package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/es/core/record-helper.js +83 -12
- package/es/core/record-helper.js.map +1 -1
- package/es/core/tableHelper.js +5 -3
- package/es/core/tableHelper.js.map +1 -1
- package/es/core/utils/get-cell-position.js +23 -12
- package/es/core/utils/get-cell-position.js.map +1 -1
- package/es/data/DataSource.js +3 -2
- package/es/data/DataSource.js.map +1 -1
- package/es/dataset/dataset.js +5 -1
- package/es/dataset/dataset.js.map +1 -1
- package/es/edit/edit-manager.js +22 -16
- package/es/edit/edit-manager.js.map +1 -1
- package/es/event/EventTarget.js +3 -1
- package/es/event/EventTarget.js.map +1 -1
- package/es/event/helper.js +1 -1
- package/es/event/listener/container-dom.js +10 -5
- package/es/event/listener/container-dom.js.map +1 -1
- package/es/event/listener/scroll-bar.js +75 -6
- package/es/event/listener/scroll-bar.js.map +1 -1
- package/es/event/listener/table-group.js +53 -24
- package/es/event/listener/table-group.js.map +1 -1
- package/es/event/media-click.js +1 -1
- package/es/event/scroll.js +35 -12
- package/es/event/scroll.js.map +1 -1
- package/es/event/sparkline-event.js +1 -1
- package/es/event/util.d.ts +2 -0
- package/es/event/util.js +25 -1
- package/es/event/util.js.map +1 -1
- package/es/header-helper/header-helper.js +2 -2
- package/es/header-helper/header-helper.js.map +1 -1
- package/es/header-helper/style.js +2 -1
- package/es/index.d.ts +3 -3
- package/es/index.js +5 -3
- package/es/index.js.map +1 -1
- package/es/layout/cell-range/simple-cell-range.js +14 -5
- package/es/layout/cell-range/simple-cell-range.js.map +1 -1
- package/es/plugins/index.js +1 -1
- package/es/plugins/interface.js +1 -1
- package/es/plugins/invert-highlight.js +1 -1
- package/es/plugins/list-tree-stick-cell.js +1 -1
- package/es/plugins/plugin-manager.js +1 -1
- package/es/scenegraph/component/table-component.d.ts +6 -1
- package/es/scenegraph/component/table-component.js +141 -17
- package/es/scenegraph/component/table-component.js.map +1 -1
- package/es/scenegraph/component/util.js +5 -2
- package/es/scenegraph/component/util.js.map +1 -1
- package/es/scenegraph/graphic/contributions/group-contribution-render.js +29 -10
- package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +7 -4
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/init-scenegraph.js +37 -7
- package/es/scenegraph/group-creater/init-scenegraph.js.map +1 -1
- package/es/scenegraph/group-creater/progress/proxy.js +4 -2
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +13 -0
- package/es/scenegraph/scenegraph.js +185 -18
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/select/create-select-border.js +9 -10
- package/es/scenegraph/select/create-select-border.js.map +1 -1
- package/es/scenegraph/select/delete-select-border.js.map +1 -1
- package/es/scenegraph/select/move-select-border.js.map +1 -1
- package/es/scenegraph/select/update-custom-select-border.js +9 -9
- package/es/scenegraph/select/update-custom-select-border.js.map +1 -1
- package/es/scenegraph/select/update-select-border.js +25 -118
- package/es/scenegraph/select/update-select-border.js.map +1 -1
- package/es/scenegraph/select/update-select-style.js.map +1 -1
- package/es/state/select/update-position.js +3 -0
- package/es/state/select/update-position.js.map +1 -1
- package/es/state/state.d.ts +8 -1
- package/es/state/state.js +81 -40
- package/es/state/state.js.map +1 -1
- package/es/ts-types/base-table.d.ts +15 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/dataset/aggregation.js +68 -38
- package/es/ts-types/dataset/aggregation.js.map +1 -1
- package/es/ts-types/events.d.ts +16 -0
- package/es/ts-types/events.js.map +1 -1
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +12 -11
package/es/state/state.js
CHANGED
|
@@ -55,7 +55,8 @@ export class StateManager {
|
|
|
55
55
|
this.resetInteractionState = debounce((state => {
|
|
56
56
|
this.updateInteractionState(null != state ? state : InteractionState.default);
|
|
57
57
|
}), 100), this.table = table, this.initState(), this.updateVerticalScrollBar = this.updateVerticalScrollBar.bind(this),
|
|
58
|
-
this.updateHorizontalScrollBar = this.updateHorizontalScrollBar.bind(this)
|
|
58
|
+
this.updateHorizontalScrollBar = this.updateHorizontalScrollBar.bind(this), this.updateFrozenHorizontalScrollBar = this.updateFrozenHorizontalScrollBar.bind(this),
|
|
59
|
+
this.updateRightFrozenHorizontalScrollBar = this.updateRightFrozenHorizontalScrollBar.bind(this);
|
|
59
60
|
}
|
|
60
61
|
initState() {
|
|
61
62
|
this._initState(), this.setHoverState(), this.setSelectState(), this.setFrozenState();
|
|
@@ -63,8 +64,13 @@ export class StateManager {
|
|
|
63
64
|
updateOptionSetState() {
|
|
64
65
|
this._updateOptionSetState(), this.setHoverState(), this.setSelectState(), this.setFrozenState();
|
|
65
66
|
}
|
|
67
|
+
endResizeIfResizing() {
|
|
68
|
+
this.columnResize.resizing && (this.table.scenegraph.component.hideResizeCol(),
|
|
69
|
+
this.columnResize.resizing = !1), this.rowResize.resizing && (this.table.scenegraph.component.hideResizeRow(),
|
|
70
|
+
this.rowResize.resizing = !1), this.interactionState === InteractionState.grabing && (this.interactionState = InteractionState.default);
|
|
71
|
+
}
|
|
66
72
|
_updateOptionSetState() {
|
|
67
|
-
this.interactionState = InteractionState.default, this.hoverIcon = {
|
|
73
|
+
this.endResizeIfResizing(), this.interactionState = InteractionState.default, this.hoverIcon = {
|
|
68
74
|
col: -1,
|
|
69
75
|
row: -1,
|
|
70
76
|
icon: null
|
|
@@ -172,7 +178,9 @@ export class StateManager {
|
|
|
172
178
|
row: -1
|
|
173
179
|
}, this.scroll = {
|
|
174
180
|
horizontalBarPos: 0,
|
|
175
|
-
verticalBarPos: 0
|
|
181
|
+
verticalBarPos: 0,
|
|
182
|
+
frozenHorizontalBarPos: 0,
|
|
183
|
+
rightFrozenHorizontalBarPos: 0
|
|
176
184
|
}, this.tablePosition = {
|
|
177
185
|
absoluteX: 0,
|
|
178
186
|
absoluteY: 0
|
|
@@ -225,13 +233,13 @@ export class StateManager {
|
|
|
225
233
|
setSortState(sortState) {
|
|
226
234
|
const state = this;
|
|
227
235
|
const sort = (sortState = !sortState || Array.isArray(sortState) ? sortState : [ sortState ]) && sortState.reduce(((prev, item) => {
|
|
228
|
-
var _a, _b, _c;
|
|
236
|
+
var _a, _b, _c, _d, _e;
|
|
229
237
|
const column = null === (_a = function(columns) {
|
|
230
238
|
const result = [];
|
|
231
239
|
return function flatten(cols, parentStartIndex = 0) {
|
|
232
240
|
cols.forEach((col => {
|
|
233
241
|
var _a;
|
|
234
|
-
const startIndex = col.startInTotal ? null !== (_a =
|
|
242
|
+
const startIndex = col.startInTotal ? col.startInTotal + (null !== (_a = state.table.internalProps.layoutMap.leftRowSeriesNumberColumnCount) && void 0 !== _a ? _a : 0) : parentStartIndex;
|
|
235
243
|
col.columns ? flatten(col.columns, startIndex) : result.push(Object.assign(Object.assign({}, col), {
|
|
236
244
|
startIndex: startIndex
|
|
237
245
|
}));
|
|
@@ -241,12 +249,12 @@ export class StateManager {
|
|
|
241
249
|
return this.table.internalProps.transpose ? prev.push({
|
|
242
250
|
field: item.field,
|
|
243
251
|
order: item.order,
|
|
244
|
-
row: null !== (_b =
|
|
252
|
+
row: (null !== (_b = null == column ? void 0 : column.startInTotal) && void 0 !== _b ? _b : 0) + (null !== (_c = this.table.internalProps.layoutMap.leftRowSeriesNumberColumnCount) && void 0 !== _c ? _c : 0),
|
|
245
253
|
col: null == column ? void 0 : column.level
|
|
246
254
|
}) : prev.push({
|
|
247
255
|
field: item.field,
|
|
248
256
|
order: item.order,
|
|
249
|
-
col: null !== (
|
|
257
|
+
col: (null !== (_d = null == column ? void 0 : column.startInTotal) && void 0 !== _d ? _d : 0) + (null !== (_e = this.table.internalProps.layoutMap.leftRowSeriesNumberColumnCount) && void 0 !== _e ? _e : 0),
|
|
250
258
|
row: null == column ? void 0 : column.level
|
|
251
259
|
}), prev;
|
|
252
260
|
}), []);
|
|
@@ -417,14 +425,46 @@ export class StateManager {
|
|
|
417
425
|
}), 0);
|
|
418
426
|
})), void this._frozenObserver.observe(container);
|
|
419
427
|
}
|
|
420
|
-
if (this.table.getColsWidth(0, originalFrozenColCount - 1) > this.table._getMaxFrozenWidth()) if (this.table.
|
|
428
|
+
if (this.table.getColsWidth(0, originalFrozenColCount - 1) > this.table._getMaxFrozenWidth()) if (this.table.options.scrollFrozenCols) this.table.frozenColCount !== originalFrozenColCount && (this.table._setFrozenColCount(originalFrozenColCount),
|
|
429
|
+
this.setFrozenCol(originalFrozenColCount)); else if (this.table.internalProps.unfreezeAllOnExceedsMaxWidth) this.table._setFrozenColCount(0),
|
|
421
430
|
this.setFrozenCol(-1); else {
|
|
422
431
|
const computedFrozenColCount = this.table._getComputedFrozenColCount(originalFrozenColCount);
|
|
423
432
|
this.table._setFrozenColCount(computedFrozenColCount), this.setFrozenCol(computedFrozenColCount);
|
|
424
433
|
} else this.table.frozenColCount !== originalFrozenColCount && (this.table._setFrozenColCount(originalFrozenColCount),
|
|
425
434
|
this.setFrozenCol(originalFrozenColCount));
|
|
435
|
+
this.table.options.scrollFrozenCols && 0 !== this.table.getFrozenColsOffset() ? this.setFrozenColsScrollLeft(this.scroll.frozenHorizontalBarPos, !1) : this.setFrozenColsScrollLeft(0, !1),
|
|
436
|
+
this.table.options.scrollRightFrozenCols && 0 !== this.table.getRightFrozenColsOffset() ? this.setRightFrozenColsScrollLeft(this.scroll.rightFrozenHorizontalBarPos, !1) : this.setRightFrozenColsScrollLeft(0, !1);
|
|
426
437
|
} else this.clearFrozenObserver();
|
|
427
438
|
}
|
|
439
|
+
setFrozenColsScrollLeft(left, triggerRender = !0) {
|
|
440
|
+
if (!this.table || !this.table.scenegraph) return;
|
|
441
|
+
const maxScrollLeft = this.table.getFrozenColsOffset();
|
|
442
|
+
if (left = Math.max(0, Math.min(left, maxScrollLeft)), left = Math.ceil(left), this.scroll.frozenHorizontalBarPos === left) return;
|
|
443
|
+
this.scroll.frozenHorizontalBarPos = left;
|
|
444
|
+
const ratio = maxScrollLeft ? left / maxScrollLeft : 0;
|
|
445
|
+
this.table.scenegraph.component.updateFrozenHorizontalScrollBarPos(ratio), triggerRender && this.table.scenegraph.setFrozenColsScrollLeft(left);
|
|
446
|
+
}
|
|
447
|
+
setRightFrozenColsScrollLeft(left, triggerRender = !0) {
|
|
448
|
+
if (!this.table || !this.table.scenegraph) return;
|
|
449
|
+
const maxScrollLeft = this.table.getRightFrozenColsOffset();
|
|
450
|
+
if (left = Math.max(0, Math.min(left, maxScrollLeft)), left = Math.ceil(left), this.scroll.rightFrozenHorizontalBarPos === left) return;
|
|
451
|
+
this.scroll.rightFrozenHorizontalBarPos = left;
|
|
452
|
+
const ratio = maxScrollLeft ? 1 - left / maxScrollLeft : 1;
|
|
453
|
+
this.table.scenegraph.component.updateRightFrozenHorizontalScrollBarPos(ratio),
|
|
454
|
+
triggerRender && this.table.scenegraph.setRightFrozenColsScrollLeft(left);
|
|
455
|
+
}
|
|
456
|
+
updateFrozenHorizontalScrollBar(xRatio) {
|
|
457
|
+
var _a, _b, _c;
|
|
458
|
+
const maxScrollLeft = null !== (_c = null === (_b = (_a = this.table).getFrozenColsOffset) || void 0 === _b ? void 0 : _b.call(_a)) && void 0 !== _c ? _c : 0;
|
|
459
|
+
let left = Math.ceil(xRatio * maxScrollLeft);
|
|
460
|
+
isValid(left) && !isNaN(left) || (left = 0), this.setFrozenColsScrollLeft(left, !0);
|
|
461
|
+
}
|
|
462
|
+
updateRightFrozenHorizontalScrollBar(xRatio) {
|
|
463
|
+
var _a, _b, _c;
|
|
464
|
+
const maxScrollLeft = null !== (_c = null === (_b = (_a = this.table).getRightFrozenColsOffset) || void 0 === _b ? void 0 : _b.call(_a)) && void 0 !== _c ? _c : 0;
|
|
465
|
+
let left = Math.ceil((1 - xRatio) * maxScrollLeft);
|
|
466
|
+
isValid(left) && !isNaN(left) || (left = 0), this.setRightFrozenColsScrollLeft(left, !0);
|
|
467
|
+
}
|
|
428
468
|
clearFrozenObserver() {
|
|
429
469
|
this._frozenObserver && (this._frozenObserver.disconnect(), this._frozenObserver = null);
|
|
430
470
|
}
|
|
@@ -497,24 +537,24 @@ export class StateManager {
|
|
|
497
537
|
}), oldVerticalBarPos !== this.scroll.verticalBarPos && this.checkVerticalScrollBarEnd();
|
|
498
538
|
}
|
|
499
539
|
updateHorizontalScrollBar(xRatio) {
|
|
500
|
-
var _a, _b, _c, _d;
|
|
501
|
-
const totalWidth = this.table.getAllColsWidth(), oldHorizontalBarPos = this.scroll.horizontalBarPos;
|
|
502
|
-
let horizontalBarPos = Math.ceil(xRatio *
|
|
540
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
541
|
+
const totalWidth = this.table.getAllColsWidth(), oldHorizontalBarPos = this.scroll.horizontalBarPos, frozenOffset = null !== (_c = null === (_b = (_a = this.table).getFrozenColsOffset) || void 0 === _b ? void 0 : _b.call(_a)) && void 0 !== _c ? _c : 0, rightFrozenOffset = null !== (_f = null === (_e = (_d = this.table).getRightFrozenColsOffset) || void 0 === _e ? void 0 : _e.call(_d)) && void 0 !== _f ? _f : 0, scrollRange = Math.max(0, totalWidth - this.table.scenegraph.width - frozenOffset - rightFrozenOffset);
|
|
542
|
+
let horizontalBarPos = Math.ceil(xRatio * scrollRange);
|
|
503
543
|
isValid(horizontalBarPos) && !isNaN(horizontalBarPos) || (horizontalBarPos = 0);
|
|
504
544
|
const dx = horizontalBarPos - this.table.scenegraph.proxy.deltaX - oldHorizontalBarPos;
|
|
505
545
|
if (this.table.fireListeners(TABLE_EVENT_TYPE.CAN_SCROLL, {
|
|
506
546
|
event: void 0,
|
|
507
547
|
scrollTop: this.scroll.verticalBarPos,
|
|
508
548
|
scrollLeft: horizontalBarPos - this.table.scenegraph.proxy.deltaX,
|
|
509
|
-
scrollHeight: null === (
|
|
510
|
-
scrollWidth: null === (
|
|
549
|
+
scrollHeight: null === (_g = this.table.theme.scrollStyle) || void 0 === _g ? void 0 : _g.width,
|
|
550
|
+
scrollWidth: null === (_h = this.table.theme.scrollStyle) || void 0 === _h ? void 0 : _h.width,
|
|
511
551
|
viewHeight: this.table.tableNoFrameHeight,
|
|
512
552
|
viewWidth: this.table.tableNoFrameWidth,
|
|
513
553
|
scrollDirection: "horizontal",
|
|
514
554
|
scrollRatioX: xRatio,
|
|
515
555
|
dx: dx
|
|
516
556
|
}).some((value => !1 === value))) {
|
|
517
|
-
const xRatio = this.scroll.horizontalBarPos /
|
|
557
|
+
const xRatio = scrollRange ? this.scroll.horizontalBarPos / scrollRange : 0;
|
|
518
558
|
this.table.scenegraph.component.updateHorizontalScrollBarPos(xRatio);
|
|
519
559
|
} else this.scroll.horizontalBarPos = horizontalBarPos, this.table.scenegraph.setX(-this.scroll.horizontalBarPos, 1 === xRatio),
|
|
520
560
|
this.scroll.horizontalBarPos -= this.table.scenegraph.proxy.deltaX, this.table.scenegraph.proxy.deltaX = 0,
|
|
@@ -522,8 +562,8 @@ export class StateManager {
|
|
|
522
562
|
event: void 0,
|
|
523
563
|
scrollTop: this.scroll.verticalBarPos,
|
|
524
564
|
scrollLeft: this.scroll.horizontalBarPos,
|
|
525
|
-
scrollHeight: null === (
|
|
526
|
-
scrollWidth: null === (
|
|
565
|
+
scrollHeight: null === (_j = this.table.theme.scrollStyle) || void 0 === _j ? void 0 : _j.width,
|
|
566
|
+
scrollWidth: null === (_k = this.table.theme.scrollStyle) || void 0 === _k ? void 0 : _k.width,
|
|
527
567
|
viewHeight: this.table.tableNoFrameHeight,
|
|
528
568
|
viewWidth: this.table.tableNoFrameWidth,
|
|
529
569
|
scrollDirection: "horizontal",
|
|
@@ -576,15 +616,13 @@ export class StateManager {
|
|
|
576
616
|
}), oldVerticalBarPos !== top && triggerEvent && this.checkVerticalScrollBarEnd();
|
|
577
617
|
}
|
|
578
618
|
setScrollLeft(left, event, triggerEvent = !0) {
|
|
579
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
619
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
580
620
|
if (!this.table || !this.table.scenegraph) return;
|
|
581
621
|
this.table.scrollLeft;
|
|
582
|
-
const totalWidth = this.table.getAllColsWidth(),
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
left =
|
|
586
|
-
const oldHorizontalBarPos = this.scroll.horizontalBarPos, xRatio = left / (totalWidth - this.table.scenegraph.width);
|
|
587
|
-
if ((oldHorizontalBarPos !== left || !0 === (null === (_c = null === (_b = this.table.options) || void 0 === _b ? void 0 : _b.customConfig) || void 0 === _c ? void 0 : _c.scrollEventAlwaysTrigger)) && triggerEvent) {
|
|
622
|
+
const totalWidth = this.table.getAllColsWidth(), frozenOffset = null !== (_c = null === (_b = (_a = this.table).getFrozenColsOffset) || void 0 === _b ? void 0 : _b.call(_a)) && void 0 !== _c ? _c : 0, rightFrozenOffset = null !== (_f = null === (_e = (_d = this.table).getRightFrozenColsOffset) || void 0 === _e ? void 0 : _e.call(_d)) && void 0 !== _f ? _f : 0, scrollRange = Math.max(0, totalWidth - this.table.scenegraph.width - frozenOffset - rightFrozenOffset), sizeTolerance = (null === (_g = this.table.options.customConfig) || void 0 === _g ? void 0 : _g._disableColumnAndRowSizeRound) ? 1 : 0;
|
|
623
|
+
left = Math.max(0, Math.min(left, scrollRange - sizeTolerance)), left = Math.ceil(left);
|
|
624
|
+
const oldHorizontalBarPos = this.scroll.horizontalBarPos, xRatio = scrollRange ? left / scrollRange : 0;
|
|
625
|
+
if ((oldHorizontalBarPos !== left || !0 === (null === (_j = null === (_h = this.table.options) || void 0 === _h ? void 0 : _h.customConfig) || void 0 === _j ? void 0 : _j.scrollEventAlwaysTrigger)) && triggerEvent) {
|
|
588
626
|
let horizontalBarPos = left;
|
|
589
627
|
isValid(horizontalBarPos) && !isNaN(horizontalBarPos) || (horizontalBarPos = 0);
|
|
590
628
|
const dx = horizontalBarPos - oldHorizontalBarPos;
|
|
@@ -592,15 +630,15 @@ export class StateManager {
|
|
|
592
630
|
event: null == event ? void 0 : event.nativeEvent,
|
|
593
631
|
scrollTop: this.scroll.verticalBarPos,
|
|
594
632
|
scrollLeft: horizontalBarPos,
|
|
595
|
-
scrollHeight: null === (
|
|
596
|
-
scrollWidth: null === (
|
|
633
|
+
scrollHeight: null === (_k = this.table.theme.scrollStyle) || void 0 === _k ? void 0 : _k.width,
|
|
634
|
+
scrollWidth: null === (_l = this.table.theme.scrollStyle) || void 0 === _l ? void 0 : _l.width,
|
|
597
635
|
viewHeight: this.table.tableNoFrameHeight,
|
|
598
636
|
viewWidth: this.table.tableNoFrameWidth,
|
|
599
637
|
scrollDirection: "horizontal",
|
|
600
638
|
scrollRatioX: xRatio,
|
|
601
639
|
dx: dx
|
|
602
640
|
}).some((value => !1 === value))) {
|
|
603
|
-
const xRatio = this.scroll.horizontalBarPos /
|
|
641
|
+
const xRatio = scrollRange ? this.scroll.horizontalBarPos / scrollRange : 0;
|
|
604
642
|
return void this.table.scenegraph.component.updateHorizontalScrollBarPos(xRatio);
|
|
605
643
|
}
|
|
606
644
|
}
|
|
@@ -612,8 +650,8 @@ export class StateManager {
|
|
|
612
650
|
event: null == event ? void 0 : event.nativeEvent,
|
|
613
651
|
scrollTop: this.scroll.verticalBarPos,
|
|
614
652
|
scrollLeft: this.scroll.horizontalBarPos,
|
|
615
|
-
scrollHeight: null === (
|
|
616
|
-
scrollWidth: null === (
|
|
653
|
+
scrollHeight: null === (_m = this.table.theme.scrollStyle) || void 0 === _m ? void 0 : _m.width,
|
|
654
|
+
scrollWidth: null === (_o = this.table.theme.scrollStyle) || void 0 === _o ? void 0 : _o.width,
|
|
617
655
|
viewHeight: this.table.tableNoFrameHeight,
|
|
618
656
|
viewWidth: this.table.tableNoFrameWidth,
|
|
619
657
|
scrollDirection: "horizontal",
|
|
@@ -625,8 +663,8 @@ export class StateManager {
|
|
|
625
663
|
this.table.scenegraph.component.hideVerticalScrollBar();
|
|
626
664
|
}
|
|
627
665
|
showVerticalScrollBar(autoHide) {
|
|
628
|
-
this.table.scenegraph.component.showVerticalScrollBar(),
|
|
629
|
-
this._clearVerticalScrollBar = setTimeout((() => {
|
|
666
|
+
this.table.scenegraph.component.showVerticalScrollBar(), clearTimeout(this._clearVerticalScrollBar),
|
|
667
|
+
autoHide && (this._clearVerticalScrollBar = setTimeout((() => {
|
|
630
668
|
var _a;
|
|
631
669
|
null === (_a = this.table.scenegraph) || void 0 === _a || _a.component.hideVerticalScrollBar();
|
|
632
670
|
}), 1e3));
|
|
@@ -634,10 +672,10 @@ export class StateManager {
|
|
|
634
672
|
hideHorizontalScrollBar() {
|
|
635
673
|
this.table.scenegraph.component.hideHorizontalScrollBar();
|
|
636
674
|
}
|
|
637
|
-
showHorizontalScrollBar(autoHide) {
|
|
675
|
+
showHorizontalScrollBar(autoHide, target = "all") {
|
|
638
676
|
var _a;
|
|
639
|
-
this.table.scenegraph.component.showHorizontalScrollBar(), null === (_a = this.table.scenegraph) || void 0 === _a || _a.component.showFrozenColumnShadow(),
|
|
640
|
-
|
|
677
|
+
this.table.scenegraph.component.showHorizontalScrollBar(target), null === (_a = this.table.scenegraph) || void 0 === _a || _a.component.showFrozenColumnShadow(),
|
|
678
|
+
clearTimeout(this._clearHorizontalScrollBar), autoHide && (this._clearHorizontalScrollBar = setTimeout((() => {
|
|
641
679
|
var _a, _b;
|
|
642
680
|
null === (_a = this.table.scenegraph) || void 0 === _a || _a.component.hideFrozenColumnShadow(),
|
|
643
681
|
null === (_b = this.table.scenegraph) || void 0 === _b || _b.component.hideHorizontalScrollBar();
|
|
@@ -773,12 +811,15 @@ export class StateManager {
|
|
|
773
811
|
this.select.selectInline = selectInline;
|
|
774
812
|
}
|
|
775
813
|
updateSortState(sortState) {
|
|
776
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
777
|
-
sortState = Array.isArray(sortState) ? sortState : [ sortState ]
|
|
814
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
815
|
+
const isSame = (sortState = Array.isArray(sortState) ? sortState : [ sortState ]).length === this.sort.length && sortState.every(((item, index) => {
|
|
816
|
+
var _a, _b;
|
|
817
|
+
return (null == item ? void 0 : item.field) === (null === (_a = this.sort[index]) || void 0 === _a ? void 0 : _a.field) && (null == item ? void 0 : item.order) === (null === (_b = this.sort[index]) || void 0 === _b ? void 0 : _b.order);
|
|
818
|
+
}));
|
|
819
|
+
if (isSame) return;
|
|
778
820
|
for (let index = 0; index < sortState.length; index++) {
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
"asc" === (null === (_e = this.sort[index]) || void 0 === _e ? void 0 : _e.order) || (null === (_f = this.sort[index]) || void 0 === _f || _f.order);
|
|
821
|
+
const oldSortCol = this.table.internalProps.multipleSort ? null : (null === (_a = this.sort[index]) || void 0 === _a ? void 0 : _a.col) || null, oldSortRow = this.table.internalProps.multipleSort ? null : (null === (_b = this.sort[index]) || void 0 === _b ? void 0 : _b.row) || null;
|
|
822
|
+
"asc" === (null === (_c = this.sort[index]) || void 0 === _c ? void 0 : _c.order) || (null === (_d = this.sort[index]) || void 0 === _d || _d.order);
|
|
782
823
|
this.setSortState(sortState.slice(0, index + 1));
|
|
783
824
|
const cellAddress = this.table.internalProps.layoutMap.getHeaderCellAddressByField(sortState[index].field);
|
|
784
825
|
this.sort[index].col = cellAddress.col, this.sort[index].row = cellAddress.row;
|
|
@@ -792,7 +833,7 @@ export class StateManager {
|
|
|
792
833
|
order: this.sort[index].order,
|
|
793
834
|
oldSortCol: oldSortCol,
|
|
794
835
|
oldSortRow: oldSortRow,
|
|
795
|
-
oldIconMark: null === (
|
|
836
|
+
oldIconMark: null === (_e = this.sort[index]) || void 0 === _e ? void 0 : _e.icon
|
|
796
837
|
});
|
|
797
838
|
}
|
|
798
839
|
const normalHeaders = [];
|
|
@@ -806,7 +847,7 @@ export class StateManager {
|
|
|
806
847
|
row: null,
|
|
807
848
|
iconMark: null,
|
|
808
849
|
order: null,
|
|
809
|
-
oldSortCol: null !== (
|
|
850
|
+
oldSortCol: (null !== (_f = column.startInTotal) && void 0 !== _f ? _f : 0) + (null !== (_g = this.table.internalProps.layoutMap.leftRowSeriesNumberColumnCount) && void 0 !== _g ? _g : 0),
|
|
810
851
|
oldSortRow: column.level,
|
|
811
852
|
oldIconMark: null
|
|
812
853
|
});
|