@visactor/vtable 0.22.4-alpha.0 → 0.23.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/cjs/ListTable.d.ts +3 -3
- package/cjs/ListTable.js +40 -31
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotTable.d.ts +1 -1
- package/cjs/PivotTable.js +19 -17
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +1 -0
- package/cjs/core/BaseTable.js +5 -1
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/TABLE_EVENT_TYPE.d.ts +5 -0
- package/cjs/core/TABLE_EVENT_TYPE.js +6 -1
- package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/cjs/core/tableHelper.js +1 -2
- package/cjs/core/tableHelper.js.map +1 -1
- package/cjs/data/CachedDataSource.d.ts +1 -0
- package/cjs/data/CachedDataSource.js +10 -6
- package/cjs/data/CachedDataSource.js.map +1 -1
- package/cjs/data/DataSource.d.ts +10 -3
- package/cjs/data/DataSource.js +159 -95
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/event/event.d.ts +2 -0
- package/cjs/event/event.js +29 -1
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/container-dom.js +78 -39
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/event/listener/table-group.js +6 -5
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/event/media-click.js +2 -1
- package/cjs/event/sparkline-event.js +1 -2
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/simple-header-layout.d.ts +7 -3
- package/cjs/layout/simple-header-layout.js +47 -35
- package/cjs/layout/simple-header-layout.js.map +1 -1
- package/cjs/scenegraph/component/table-component.js +12 -7
- package/cjs/scenegraph/component/table-component.js.map +1 -1
- package/cjs/scenegraph/layout/frozen.js +2 -2
- package/cjs/scenegraph/layout/frozen.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +3 -0
- package/cjs/scenegraph/scenegraph.js +6 -3
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/select/create-select-border.d.ts +1 -1
- package/cjs/scenegraph/select/create-select-border.js +24 -5
- package/cjs/scenegraph/select/create-select-border.js.map +1 -1
- package/cjs/scenegraph/select/delete-select-border.d.ts +1 -0
- package/cjs/scenegraph/select/delete-select-border.js +15 -4
- package/cjs/scenegraph/select/delete-select-border.js.map +1 -1
- package/cjs/scenegraph/select/move-select-border.js +3 -1
- package/cjs/scenegraph/select/move-select-border.js.map +1 -1
- package/cjs/scenegraph/select/update-select-border.js +9 -2
- package/cjs/scenegraph/select/update-select-border.js.map +1 -1
- package/cjs/state/cell-move/index.js +1 -1
- package/cjs/state/cell-move/index.js.map +1 -1
- package/cjs/state/resize/update-resize-column.js +1 -1
- package/cjs/state/resize/update-resize-column.js.map +1 -1
- package/cjs/state/select/update-position.js +39 -8
- package/cjs/state/select/update-position.js.map +1 -1
- package/cjs/state/state.d.ts +16 -0
- package/cjs/state/state.js +63 -14
- package/cjs/state/state.js.map +1 -1
- package/cjs/themes/component.js +1 -1
- package/cjs/themes/theme.js +4 -0
- package/cjs/themes/theme.js.map +1 -1
- package/cjs/tools/util.d.ts +0 -1
- package/cjs/tools/util.js +3 -13
- package/cjs/tools/util.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +4 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/events.d.ts +26 -0
- package/cjs/ts-types/events.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +4 -4
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/ts-types/theme.d.ts +1 -0
- package/cjs/ts-types/theme.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +936 -357
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +3 -3
- package/es/ListTable.js +41 -32
- package/es/ListTable.js.map +1 -1
- package/es/PivotTable.d.ts +1 -1
- package/es/PivotTable.js +19 -17
- package/es/PivotTable.js.map +1 -1
- package/es/core/BaseTable.d.ts +1 -0
- package/es/core/BaseTable.js +6 -2
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/TABLE_EVENT_TYPE.d.ts +5 -0
- package/es/core/TABLE_EVENT_TYPE.js +6 -1
- package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/es/core/tableHelper.js +1 -2
- package/es/core/tableHelper.js.map +1 -1
- package/es/data/CachedDataSource.d.ts +1 -0
- package/es/data/CachedDataSource.js +9 -7
- package/es/data/CachedDataSource.js.map +1 -1
- package/es/data/DataSource.d.ts +10 -3
- package/es/data/DataSource.js +159 -95
- package/es/data/DataSource.js.map +1 -1
- package/es/event/event.d.ts +2 -0
- package/es/event/event.js +29 -1
- package/es/event/event.js.map +1 -1
- package/es/event/listener/container-dom.js +78 -39
- package/es/event/listener/container-dom.js.map +1 -1
- package/es/event/listener/table-group.js +6 -5
- package/es/event/listener/table-group.js.map +1 -1
- package/es/event/media-click.js +2 -1
- package/es/event/sparkline-event.js +1 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/simple-header-layout.d.ts +7 -3
- package/es/layout/simple-header-layout.js +47 -35
- package/es/layout/simple-header-layout.js.map +1 -1
- package/es/scenegraph/component/table-component.js +12 -7
- package/es/scenegraph/component/table-component.js.map +1 -1
- package/es/scenegraph/layout/frozen.js +2 -2
- package/es/scenegraph/layout/frozen.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +3 -0
- package/es/scenegraph/scenegraph.js +7 -4
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/select/create-select-border.d.ts +1 -1
- package/es/scenegraph/select/create-select-border.js +24 -5
- package/es/scenegraph/select/create-select-border.js.map +1 -1
- package/es/scenegraph/select/delete-select-border.d.ts +1 -0
- package/es/scenegraph/select/delete-select-border.js +12 -2
- package/es/scenegraph/select/delete-select-border.js.map +1 -1
- package/es/scenegraph/select/move-select-border.js +3 -1
- package/es/scenegraph/select/move-select-border.js.map +1 -1
- package/es/scenegraph/select/update-select-border.js +9 -2
- package/es/scenegraph/select/update-select-border.js.map +1 -1
- package/es/state/cell-move/index.js +1 -1
- package/es/state/cell-move/index.js.map +1 -1
- package/es/state/resize/update-resize-column.js +1 -1
- package/es/state/resize/update-resize-column.js.map +1 -1
- package/es/state/select/update-position.js +39 -8
- package/es/state/select/update-position.js.map +1 -1
- package/es/state/state.d.ts +16 -0
- package/es/state/state.js +63 -14
- package/es/state/state.js.map +1 -1
- package/es/themes/component.js +1 -1
- package/es/themes/theme.js +4 -0
- package/es/themes/theme.js.map +1 -1
- package/es/tools/util.d.ts +0 -1
- package/es/tools/util.js +0 -10
- package/es/tools/util.js.map +1 -1
- package/es/ts-types/base-table.d.ts +4 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/events.d.ts +26 -0
- package/es/ts-types/events.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +4 -4
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/ts-types/theme.d.ts +1 -0
- package/es/ts-types/theme.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +3 -3
package/dist/vtable.js
CHANGED
|
@@ -22795,22 +22795,6 @@
|
|
|
22795
22795
|
}
|
|
22796
22796
|
return res;
|
|
22797
22797
|
}
|
|
22798
|
-
function getValueFromDeepArray(array, index) {
|
|
22799
|
-
let result = array;
|
|
22800
|
-
for (let i = 0; i < index.length; i++) {
|
|
22801
|
-
const currentIdx = index[i];
|
|
22802
|
-
if (result[currentIdx]) {
|
|
22803
|
-
result = result[currentIdx];
|
|
22804
|
-
}
|
|
22805
|
-
else {
|
|
22806
|
-
return undefined;
|
|
22807
|
-
}
|
|
22808
|
-
if (result && result.children && i + 1 < index.length) {
|
|
22809
|
-
result = result.children;
|
|
22810
|
-
}
|
|
22811
|
-
}
|
|
22812
|
-
return result;
|
|
22813
|
-
}
|
|
22814
22798
|
function isAllDigits(str) {
|
|
22815
22799
|
const pattern = /^-?\d+(\.\d+)?$/;
|
|
22816
22800
|
return pattern.test(str);
|
|
@@ -23047,6 +23031,8 @@
|
|
|
23047
23031
|
SORT_CLICK: 'sort_click',
|
|
23048
23032
|
FREEZE_CLICK: 'freeze_click',
|
|
23049
23033
|
SCROLL: 'scroll',
|
|
23034
|
+
SCROLL_HORIZONTAL_END: 'scroll_horizontal_end',
|
|
23035
|
+
SCROLL_VERTICAL_END: 'scroll_vertical_end',
|
|
23050
23036
|
DROPDOWN_MENU_CLICK: 'dropdown_menu_click',
|
|
23051
23037
|
MOUSEOVER_CHART_SYMBOL: 'mouseover_chart_symbol',
|
|
23052
23038
|
DRAG_SELECT_END: 'drag_select_end',
|
|
@@ -23066,7 +23052,10 @@
|
|
|
23066
23052
|
CHECKBOX_STATE_CHANGE: 'checkbox_state_change',
|
|
23067
23053
|
AFTER_RENDER: 'after_render',
|
|
23068
23054
|
INITIALIZED: 'initialized',
|
|
23069
|
-
CHANGE_CELL_VALUE: 'change_cell_value'
|
|
23055
|
+
CHANGE_CELL_VALUE: 'change_cell_value',
|
|
23056
|
+
DRAG_FILL_HANDLE_END: 'drag_fill_handle_end',
|
|
23057
|
+
MOUSEDOWN_FILL_HANDLE: 'mousedown_fill_handle',
|
|
23058
|
+
DBLCLICK_FILL_HANDLE: 'dblclick_fill_handle'
|
|
23070
23059
|
};
|
|
23071
23060
|
|
|
23072
23061
|
const judgeType = (value) => {
|
|
@@ -24432,6 +24421,9 @@
|
|
|
24432
24421
|
},
|
|
24433
24422
|
get hoverOn() {
|
|
24434
24423
|
return scroll.hoverOn ?? true;
|
|
24424
|
+
},
|
|
24425
|
+
get barToSide() {
|
|
24426
|
+
return scroll.barToSide ?? false;
|
|
24435
24427
|
}
|
|
24436
24428
|
};
|
|
24437
24429
|
}
|
|
@@ -33576,16 +33568,18 @@
|
|
|
33576
33568
|
hasHierarchyStateExpand = false;
|
|
33577
33569
|
beforeChangedRecordsMap = [];
|
|
33578
33570
|
registedAggregators = {};
|
|
33571
|
+
rowHierarchyType;
|
|
33579
33572
|
fieldAggregators = [];
|
|
33580
33573
|
layoutColumnObjects = [];
|
|
33574
|
+
lastFilterRules;
|
|
33581
33575
|
constructor(dataSourceObj, dataConfig, pagination, columnObjs, rowHierarchyType, hierarchyExpandLevel) {
|
|
33582
33576
|
super();
|
|
33583
33577
|
this.registerAggregators();
|
|
33584
33578
|
this.dataSourceObj = dataSourceObj;
|
|
33585
33579
|
this.dataConfig = dataConfig;
|
|
33586
|
-
this._get = dataSourceObj?.get
|
|
33580
|
+
this._get = dataSourceObj?.get;
|
|
33587
33581
|
this.layoutColumnObjects = columnObjs;
|
|
33588
|
-
this._source = this.processRecords(dataSourceObj?.
|
|
33582
|
+
this._source = dataSourceObj?.records ? this.processRecords(dataSourceObj?.records) : dataSourceObj;
|
|
33589
33583
|
this._sourceLength = this._source?.length || 0;
|
|
33590
33584
|
this.sortedIndexMap = new Map();
|
|
33591
33585
|
this._currentPagerIndexedData = [];
|
|
@@ -33602,6 +33596,7 @@
|
|
|
33602
33596
|
if (rowHierarchyType === 'tree') {
|
|
33603
33597
|
this.initTreeHierarchyState();
|
|
33604
33598
|
}
|
|
33599
|
+
this.rowHierarchyType = rowHierarchyType;
|
|
33605
33600
|
this.updatePagerData();
|
|
33606
33601
|
}
|
|
33607
33602
|
initTreeHierarchyState() {
|
|
@@ -33610,7 +33605,8 @@
|
|
|
33610
33605
|
for (let i = 0; i < nodeLength; i++) {
|
|
33611
33606
|
const indexKey = this.currentIndexedData[i];
|
|
33612
33607
|
const nodeData = this.getOriginalRecord(indexKey);
|
|
33613
|
-
|
|
33608
|
+
const children = nodeData.filteredChildren ?? nodeData.children;
|
|
33609
|
+
if (children?.length > 0) {
|
|
33614
33610
|
if (this.hierarchyExpandLevel > 1) {
|
|
33615
33611
|
!nodeData.hierarchyState && (nodeData.hierarchyState = HierarchyState.expand);
|
|
33616
33612
|
}
|
|
@@ -33674,26 +33670,46 @@
|
|
|
33674
33670
|
this._generateFieldAggragations();
|
|
33675
33671
|
const filteredRecords = [];
|
|
33676
33672
|
const isHasAggregation = this.fieldAggregators.length >= 1;
|
|
33677
|
-
const isHasFilterRule = this.dataConfig?.filterRules?.length >= 1;
|
|
33673
|
+
const isHasFilterRule = this.dataConfig?.filterRules?.length >= 1 || this.lastFilterRules?.length >= 1;
|
|
33678
33674
|
if (isHasFilterRule || isHasAggregation) {
|
|
33679
33675
|
for (let i = 0, len = records.length; i < len; i++) {
|
|
33680
33676
|
const record = records[i];
|
|
33681
|
-
if (
|
|
33677
|
+
if (this.dataConfig?.filterRules?.length >= 1) {
|
|
33682
33678
|
if (this.filterRecord(record)) {
|
|
33683
33679
|
filteredRecords.push(record);
|
|
33680
|
+
if (this.rowHierarchyType === 'tree' && record.children) {
|
|
33681
|
+
record.filteredChildren = this.filteredChildren(record.children);
|
|
33682
|
+
}
|
|
33684
33683
|
isHasAggregation && this.processRecord(record);
|
|
33685
33684
|
}
|
|
33686
33685
|
}
|
|
33686
|
+
else if (this.lastFilterRules?.length >= 1) {
|
|
33687
|
+
this.clearFilteredChildren(record);
|
|
33688
|
+
isHasAggregation && this.processRecord(record);
|
|
33689
|
+
}
|
|
33687
33690
|
else if (isHasAggregation) {
|
|
33688
33691
|
this.processRecord(record);
|
|
33689
33692
|
}
|
|
33690
33693
|
}
|
|
33691
|
-
if (
|
|
33694
|
+
if (this.dataConfig?.filterRules?.length >= 1) {
|
|
33692
33695
|
return filteredRecords;
|
|
33693
33696
|
}
|
|
33694
33697
|
}
|
|
33695
33698
|
return records;
|
|
33696
33699
|
}
|
|
33700
|
+
filteredChildren(records) {
|
|
33701
|
+
const filteredRecords = [];
|
|
33702
|
+
for (let i = 0, len = records.length; i < len; i++) {
|
|
33703
|
+
const record = records[i];
|
|
33704
|
+
if (this.filterRecord(record)) {
|
|
33705
|
+
filteredRecords.push(record);
|
|
33706
|
+
if (record.children) {
|
|
33707
|
+
record.filteredChildren = this.filteredChildren(record.children);
|
|
33708
|
+
}
|
|
33709
|
+
}
|
|
33710
|
+
}
|
|
33711
|
+
return filteredRecords;
|
|
33712
|
+
}
|
|
33697
33713
|
processRecord(record) {
|
|
33698
33714
|
for (let i = 0; i < this.fieldAggregators.length; i++) {
|
|
33699
33715
|
const aggregator = this.fieldAggregators[i];
|
|
@@ -33702,17 +33718,17 @@
|
|
|
33702
33718
|
}
|
|
33703
33719
|
initChildrenNodeHierarchy(indexKey, hierarchyExpandLevel, currentLevel, nodeData) {
|
|
33704
33720
|
let childTotalLength = 0;
|
|
33705
|
-
const nodeLength = nodeData.children?.length ?? 0;
|
|
33721
|
+
const nodeLength = nodeData.filteredChildren ? nodeData.filteredChildren.length : nodeData.children?.length ?? 0;
|
|
33706
33722
|
for (let j = 0; j < nodeLength; j++) {
|
|
33707
33723
|
if (currentLevel <= hierarchyExpandLevel || nodeData.hierarchyState === HierarchyState.expand) {
|
|
33708
33724
|
childTotalLength += 1;
|
|
33709
33725
|
}
|
|
33710
|
-
const childNodeData = nodeData.children[j];
|
|
33726
|
+
const childNodeData = nodeData.filteredChildren ? nodeData.filteredChildren[j] : nodeData.children[j];
|
|
33711
33727
|
const childIndexKey = Array.isArray(indexKey) ? indexKey.concat(j) : [indexKey, j];
|
|
33712
33728
|
if (currentLevel <= hierarchyExpandLevel || nodeData.hierarchyState === HierarchyState.expand) {
|
|
33713
33729
|
this.currentIndexedData.splice(this.currentIndexedData.indexOf(indexKey) + childTotalLength, 0, childIndexKey);
|
|
33714
33730
|
}
|
|
33715
|
-
if (childNodeData.children?.length > 0) {
|
|
33731
|
+
if (childNodeData.filteredChildren ? childNodeData.filteredChildren.length > 0 : childNodeData.children?.length > 0) {
|
|
33716
33732
|
if (currentLevel < hierarchyExpandLevel || childNodeData.hierarchyState === HierarchyState.expand) {
|
|
33717
33733
|
!childNodeData.hierarchyState && (childNodeData.hierarchyState = HierarchyState.expand);
|
|
33718
33734
|
this.hasHierarchyStateExpand = true;
|
|
@@ -33760,6 +33776,9 @@
|
|
|
33760
33776
|
throw new Error(`currentIndexedData should has values!`);
|
|
33761
33777
|
}
|
|
33762
33778
|
}
|
|
33779
|
+
get records() {
|
|
33780
|
+
return Array.isArray(this._source) ? this._source : [];
|
|
33781
|
+
}
|
|
33763
33782
|
get source() {
|
|
33764
33783
|
return this._source;
|
|
33765
33784
|
}
|
|
@@ -33808,11 +33827,12 @@
|
|
|
33808
33827
|
if (!hierarchyState || hierarchyState === HierarchyState.collapse || hierarchyState === HierarchyState.none) {
|
|
33809
33828
|
return;
|
|
33810
33829
|
}
|
|
33811
|
-
|
|
33812
|
-
|
|
33830
|
+
const children = nodeData.filteredChildren ? nodeData.filteredChildren : nodeData.children;
|
|
33831
|
+
if (children) {
|
|
33832
|
+
for (let i = 0; i < children.length; i++) {
|
|
33813
33833
|
childrenLength += 1;
|
|
33814
33834
|
const childIndex = Array.isArray(indexKey) ? indexKey.concat([i]) : [indexKey, i];
|
|
33815
|
-
computeChildrenNodeLength(childIndex,
|
|
33835
|
+
computeChildrenNodeLength(childIndex, children[i].hierarchyState, children[i]);
|
|
33816
33836
|
}
|
|
33817
33837
|
}
|
|
33818
33838
|
};
|
|
@@ -33829,8 +33849,9 @@
|
|
|
33829
33849
|
return 0;
|
|
33830
33850
|
}
|
|
33831
33851
|
let childrenLength = 0;
|
|
33832
|
-
|
|
33833
|
-
|
|
33852
|
+
const children = nodeData.filteredChildren ? nodeData.filteredChildren : nodeData.children;
|
|
33853
|
+
if (children) {
|
|
33854
|
+
const subNodeSortedIndexArray = Array.from({ length: children.length }, (_, i) => i);
|
|
33834
33855
|
this.lastOrder &&
|
|
33835
33856
|
this.lastOrder !== 'normal' &&
|
|
33836
33857
|
this.lastOrderField &&
|
|
@@ -33838,7 +33859,7 @@
|
|
|
33838
33859
|
? subNodeSortedIndexArray[index]
|
|
33839
33860
|
: (subNodeSortedIndexArray[index] = index), (index, rel) => {
|
|
33840
33861
|
subNodeSortedIndexArray[index] = rel;
|
|
33841
|
-
},
|
|
33862
|
+
}, children.length, this.lastOrderFn, this.lastOrder, index => this.getOriginalField(Array.isArray(indexKey) ? indexKey.concat([index]) : [indexKey, index], this.lastOrderField));
|
|
33842
33863
|
for (let i = 0; i < subNodeSortedIndexArray.length; i++) {
|
|
33843
33864
|
childrenLength += 1;
|
|
33844
33865
|
const childIndex = Array.isArray(indexKey)
|
|
@@ -33846,10 +33867,10 @@
|
|
|
33846
33867
|
: [indexKey, subNodeSortedIndexArray[i]];
|
|
33847
33868
|
this.currentIndexedData.splice(this.currentIndexedData.indexOf(indexKey) + childrenLength, 0, childIndex);
|
|
33848
33869
|
const childData = this.getOriginalRecord(childIndex);
|
|
33849
|
-
if (!
|
|
33850
|
-
|
|
33870
|
+
if (!childData.hierarchyState && (childData.filteredChildren ?? childData.children)) {
|
|
33871
|
+
childData.hierarchyState = HierarchyState.collapse;
|
|
33851
33872
|
}
|
|
33852
|
-
childrenLength += this.pushChildrenNode(childIndex,
|
|
33873
|
+
childrenLength += this.pushChildrenNode(childIndex, childData.hierarchyState, children[subNodeSortedIndexArray[i]]);
|
|
33853
33874
|
}
|
|
33854
33875
|
}
|
|
33855
33876
|
return childrenLength;
|
|
@@ -33886,121 +33907,153 @@
|
|
|
33886
33907
|
}
|
|
33887
33908
|
}
|
|
33888
33909
|
setRecord(record, index) {
|
|
33889
|
-
|
|
33890
|
-
if (
|
|
33891
|
-
this.
|
|
33910
|
+
let isAdd = true;
|
|
33911
|
+
if (this.dataConfig?.filterRules?.length >= 1) {
|
|
33912
|
+
if (this.filterRecord(record)) {
|
|
33913
|
+
if (this.rowHierarchyType === 'tree' && record.children) {
|
|
33914
|
+
record.filteredChildren = this.filteredChildren(record.children);
|
|
33915
|
+
}
|
|
33916
|
+
}
|
|
33917
|
+
else {
|
|
33918
|
+
isAdd = false;
|
|
33919
|
+
}
|
|
33892
33920
|
}
|
|
33893
|
-
|
|
33894
|
-
const
|
|
33895
|
-
|
|
33896
|
-
|
|
33921
|
+
if (isAdd && Array.isArray(this.records)) {
|
|
33922
|
+
const indexed = this.getIndexKey(index);
|
|
33923
|
+
if (!Array.isArray(indexed)) {
|
|
33924
|
+
this.records.splice(indexed, 1, record);
|
|
33925
|
+
}
|
|
33897
33926
|
}
|
|
33898
33927
|
}
|
|
33899
33928
|
addRecord(record, index) {
|
|
33900
|
-
this.
|
|
33901
|
-
|
|
33902
|
-
|
|
33903
|
-
|
|
33904
|
-
|
|
33905
|
-
|
|
33906
|
-
|
|
33907
|
-
|
|
33908
|
-
|
|
33909
|
-
|
|
33929
|
+
if (Array.isArray(this.records)) {
|
|
33930
|
+
this.records.splice(index, 0, record);
|
|
33931
|
+
this.currentIndexedData.push(this.currentIndexedData.length);
|
|
33932
|
+
this._sourceLength += 1;
|
|
33933
|
+
if (this.rowHierarchyType === 'tree') {
|
|
33934
|
+
this.initTreeHierarchyState();
|
|
33935
|
+
}
|
|
33936
|
+
if (this.userPagination) {
|
|
33937
|
+
this.pagination.totalCount = this._sourceLength;
|
|
33938
|
+
const { perPageCount, currentPage } = this.pagination;
|
|
33939
|
+
const startIndex = perPageCount * (currentPage || 0);
|
|
33940
|
+
const endIndex = startIndex + perPageCount;
|
|
33941
|
+
if (index < endIndex) {
|
|
33942
|
+
this.updatePagerData();
|
|
33943
|
+
}
|
|
33944
|
+
}
|
|
33945
|
+
else {
|
|
33946
|
+
this.pagination.perPageCount = this._sourceLength;
|
|
33947
|
+
this.pagination.totalCount = this._sourceLength;
|
|
33910
33948
|
this.updatePagerData();
|
|
33911
33949
|
}
|
|
33912
|
-
|
|
33913
|
-
|
|
33914
|
-
|
|
33915
|
-
this.pagination.totalCount = this._sourceLength;
|
|
33916
|
-
this.updatePagerData();
|
|
33950
|
+
if (this.dataSourceObj?.added) {
|
|
33951
|
+
this.dataSourceObj.added(index, 1);
|
|
33952
|
+
}
|
|
33917
33953
|
}
|
|
33918
33954
|
}
|
|
33919
33955
|
addRecords(recordArr, index) {
|
|
33920
|
-
if (Array.isArray(
|
|
33921
|
-
|
|
33922
|
-
|
|
33923
|
-
|
|
33956
|
+
if (Array.isArray(this.records)) {
|
|
33957
|
+
if (Array.isArray(recordArr)) {
|
|
33958
|
+
this.records.splice(index, 0, ...recordArr);
|
|
33959
|
+
for (let i = 0; i < recordArr.length; i++) {
|
|
33960
|
+
this.currentIndexedData.push(this.currentIndexedData.length);
|
|
33961
|
+
}
|
|
33962
|
+
this._sourceLength += recordArr.length;
|
|
33924
33963
|
}
|
|
33925
|
-
this.
|
|
33926
|
-
|
|
33927
|
-
|
|
33928
|
-
|
|
33929
|
-
|
|
33930
|
-
|
|
33931
|
-
|
|
33932
|
-
|
|
33964
|
+
if (this.userPagination) {
|
|
33965
|
+
this.pagination.totalCount = this._sourceLength;
|
|
33966
|
+
const { perPageCount, currentPage } = this.pagination;
|
|
33967
|
+
const startIndex = perPageCount * (currentPage || 0);
|
|
33968
|
+
const endIndex = startIndex + perPageCount;
|
|
33969
|
+
if (index < endIndex) {
|
|
33970
|
+
this.updatePagerData();
|
|
33971
|
+
}
|
|
33972
|
+
}
|
|
33973
|
+
else {
|
|
33974
|
+
this.pagination.perPageCount = this._sourceLength;
|
|
33975
|
+
this.pagination.totalCount = this._sourceLength;
|
|
33933
33976
|
this.updatePagerData();
|
|
33934
33977
|
}
|
|
33935
|
-
|
|
33936
|
-
|
|
33937
|
-
|
|
33938
|
-
this.pagination.totalCount = this._sourceLength;
|
|
33939
|
-
this.updatePagerData();
|
|
33978
|
+
if (this.dataSourceObj?.added) {
|
|
33979
|
+
this.dataSourceObj.added(index, recordArr.length);
|
|
33980
|
+
}
|
|
33940
33981
|
}
|
|
33941
33982
|
}
|
|
33942
33983
|
addRecordForSorted(record) {
|
|
33943
|
-
this.
|
|
33944
|
-
|
|
33945
|
-
|
|
33946
|
-
|
|
33947
|
-
|
|
33948
|
-
this.
|
|
33949
|
-
|
|
33984
|
+
if (Array.isArray(this.records)) {
|
|
33985
|
+
this.records.push(record);
|
|
33986
|
+
this.currentIndexedData.push(this.currentIndexedData.length);
|
|
33987
|
+
this._sourceLength += 1;
|
|
33988
|
+
this.sortedIndexMap.clear();
|
|
33989
|
+
if (!this.userPagination) {
|
|
33990
|
+
this.pagination.perPageCount = this._sourceLength;
|
|
33991
|
+
this.pagination.totalCount = this._sourceLength;
|
|
33992
|
+
}
|
|
33950
33993
|
}
|
|
33951
33994
|
}
|
|
33952
33995
|
addRecordsForSorted(recordArr) {
|
|
33953
|
-
if (Array.isArray(
|
|
33954
|
-
|
|
33955
|
-
|
|
33956
|
-
|
|
33996
|
+
if (Array.isArray(this.records)) {
|
|
33997
|
+
if (Array.isArray(recordArr)) {
|
|
33998
|
+
this.records.push(...recordArr);
|
|
33999
|
+
for (let i = 0; i < recordArr.length; i++) {
|
|
34000
|
+
this.currentIndexedData.push(this.currentIndexedData.length);
|
|
34001
|
+
}
|
|
34002
|
+
this._sourceLength += recordArr.length;
|
|
34003
|
+
this.sortedIndexMap.clear();
|
|
34004
|
+
}
|
|
34005
|
+
if (!this.userPagination) {
|
|
34006
|
+
this.pagination.perPageCount = this._sourceLength;
|
|
34007
|
+
this.pagination.totalCount = this._sourceLength;
|
|
33957
34008
|
}
|
|
33958
|
-
this._sourceLength += recordArr.length;
|
|
33959
|
-
this.sortedIndexMap.clear();
|
|
33960
|
-
}
|
|
33961
|
-
if (!this.userPagination) {
|
|
33962
|
-
this.pagination.perPageCount = this._sourceLength;
|
|
33963
|
-
this.pagination.totalCount = this._sourceLength;
|
|
33964
34009
|
}
|
|
33965
34010
|
}
|
|
33966
34011
|
deleteRecords(recordIndexs) {
|
|
33967
|
-
|
|
33968
|
-
|
|
33969
|
-
|
|
33970
|
-
|
|
33971
|
-
|
|
33972
|
-
|
|
34012
|
+
if (Array.isArray(this.records)) {
|
|
34013
|
+
const realDeletedRecordIndexs = [];
|
|
34014
|
+
const recordIndexsMaxToMin = recordIndexs.sort((a, b) => b - a);
|
|
34015
|
+
for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
|
|
34016
|
+
const recordIndex = recordIndexsMaxToMin[index];
|
|
34017
|
+
if (recordIndex >= this._sourceLength || recordIndex < 0) {
|
|
34018
|
+
continue;
|
|
34019
|
+
}
|
|
34020
|
+
realDeletedRecordIndexs.push(recordIndex);
|
|
34021
|
+
this.records.splice(recordIndex, 1);
|
|
34022
|
+
this.currentIndexedData.pop();
|
|
34023
|
+
this._sourceLength -= 1;
|
|
33973
34024
|
}
|
|
33974
|
-
|
|
33975
|
-
|
|
33976
|
-
|
|
33977
|
-
|
|
33978
|
-
|
|
33979
|
-
|
|
33980
|
-
|
|
33981
|
-
|
|
33982
|
-
|
|
33983
|
-
|
|
33984
|
-
|
|
33985
|
-
|
|
34025
|
+
if (this.userPagination) {
|
|
34026
|
+
this.updatePagerData();
|
|
34027
|
+
}
|
|
34028
|
+
else {
|
|
34029
|
+
this.pagination.perPageCount = this._sourceLength;
|
|
34030
|
+
this.pagination.totalCount = this._sourceLength;
|
|
34031
|
+
this.updatePagerData();
|
|
34032
|
+
}
|
|
34033
|
+
if (this.dataSourceObj?.deleted) {
|
|
34034
|
+
this.dataSourceObj.deleted(realDeletedRecordIndexs);
|
|
34035
|
+
}
|
|
34036
|
+
return realDeletedRecordIndexs;
|
|
33986
34037
|
}
|
|
33987
|
-
return
|
|
34038
|
+
return [];
|
|
33988
34039
|
}
|
|
33989
34040
|
deleteRecordsForSorted(recordIndexs) {
|
|
33990
|
-
|
|
33991
|
-
|
|
33992
|
-
|
|
33993
|
-
|
|
33994
|
-
|
|
34041
|
+
if (Array.isArray(this.records)) {
|
|
34042
|
+
const recordIndexsMaxToMin = recordIndexs.sort((a, b) => b - a);
|
|
34043
|
+
for (let index = 0; index < recordIndexsMaxToMin.length; index++) {
|
|
34044
|
+
const recordIndex = recordIndexsMaxToMin[index];
|
|
34045
|
+
if (recordIndex >= this._sourceLength || recordIndex < 0) {
|
|
34046
|
+
continue;
|
|
34047
|
+
}
|
|
34048
|
+
const rawIndex = this.currentIndexedData[recordIndex];
|
|
34049
|
+
this.records.splice(rawIndex, 1);
|
|
34050
|
+
this._sourceLength -= 1;
|
|
34051
|
+
}
|
|
34052
|
+
this.sortedIndexMap.clear();
|
|
34053
|
+
if (!this.userPagination) {
|
|
34054
|
+
this.pagination.perPageCount = this._sourceLength;
|
|
34055
|
+
this.pagination.totalCount = this._sourceLength;
|
|
33995
34056
|
}
|
|
33996
|
-
const rawIndex = this.currentIndexedData[recordIndex];
|
|
33997
|
-
this.source.splice(rawIndex, 1);
|
|
33998
|
-
this._sourceLength -= 1;
|
|
33999
|
-
}
|
|
34000
|
-
this.sortedIndexMap.clear();
|
|
34001
|
-
if (!this.userPagination) {
|
|
34002
|
-
this.pagination.perPageCount = this._sourceLength;
|
|
34003
|
-
this.pagination.totalCount = this._sourceLength;
|
|
34004
34057
|
}
|
|
34005
34058
|
}
|
|
34006
34059
|
updateRecords(records, recordIndexs) {
|
|
@@ -34011,7 +34064,7 @@
|
|
|
34011
34064
|
continue;
|
|
34012
34065
|
}
|
|
34013
34066
|
realDeletedRecordIndexs.push(recordIndex);
|
|
34014
|
-
this.
|
|
34067
|
+
this.records[recordIndex] = records[index];
|
|
34015
34068
|
}
|
|
34016
34069
|
if (this.userPagination) {
|
|
34017
34070
|
this.updatePagerData();
|
|
@@ -34028,7 +34081,7 @@
|
|
|
34028
34081
|
if (typeof rawIndex !== 'number') {
|
|
34029
34082
|
return;
|
|
34030
34083
|
}
|
|
34031
|
-
this.
|
|
34084
|
+
this.records[rawIndex] = records[index];
|
|
34032
34085
|
}
|
|
34033
34086
|
this.sortedIndexMap.clear();
|
|
34034
34087
|
}
|
|
@@ -34079,9 +34132,15 @@
|
|
|
34079
34132
|
this.updatePagerData();
|
|
34080
34133
|
this.fireListeners(EVENT_TYPE.CHANGE_ORDER, null);
|
|
34081
34134
|
}
|
|
34135
|
+
clearFilteredChildren(record) {
|
|
34136
|
+
record.filteredChildren = undefined;
|
|
34137
|
+
for (let i = 0; i < record.children?.length ?? 0; i++) {
|
|
34138
|
+
this.clearFilteredChildren(record.children[i]);
|
|
34139
|
+
}
|
|
34140
|
+
}
|
|
34082
34141
|
filterRecord(record) {
|
|
34083
34142
|
let isReserved = true;
|
|
34084
|
-
for (let i = 0; i < this.dataConfig.filterRules
|
|
34143
|
+
for (let i = 0; i < this.dataConfig.filterRules?.length; i++) {
|
|
34085
34144
|
const filterRule = this.dataConfig?.filterRules[i];
|
|
34086
34145
|
if (filterRule.filterKey) {
|
|
34087
34146
|
const filterValue = record[filterRule.filterKey];
|
|
@@ -34098,8 +34157,9 @@
|
|
|
34098
34157
|
return isReserved;
|
|
34099
34158
|
}
|
|
34100
34159
|
updateFilterRulesForSorted(filterRules) {
|
|
34160
|
+
this.lastFilterRules = this.dataConfig.filterRules;
|
|
34101
34161
|
this.dataConfig.filterRules = filterRules;
|
|
34102
|
-
this._source = this.processRecords(this.dataSourceObj?.
|
|
34162
|
+
this._source = this.processRecords(this.dataSourceObj?.records ?? this.dataSourceObj);
|
|
34103
34163
|
this._sourceLength = this._source?.length || 0;
|
|
34104
34164
|
this.sortedIndexMap.clear();
|
|
34105
34165
|
this.currentIndexedData = Array.from({ length: this._sourceLength }, (_, i) => i);
|
|
@@ -34109,8 +34169,9 @@
|
|
|
34109
34169
|
}
|
|
34110
34170
|
}
|
|
34111
34171
|
updateFilterRules(filterRules) {
|
|
34172
|
+
this.lastFilterRules = this.dataConfig.filterRules;
|
|
34112
34173
|
this.dataConfig.filterRules = filterRules;
|
|
34113
|
-
this._source = this.processRecords(this.dataSourceObj?.
|
|
34174
|
+
this._source = this.processRecords(this.dataSourceObj?.records ?? this.dataSourceObj);
|
|
34114
34175
|
this._sourceLength = this._source?.length || 0;
|
|
34115
34176
|
this.currentIndexedData = Array.from({ length: this._sourceLength }, (_, i) => i);
|
|
34116
34177
|
if (this.userPagination) {
|
|
@@ -34119,6 +34180,9 @@
|
|
|
34119
34180
|
else {
|
|
34120
34181
|
this.pagination.perPageCount = this._sourceLength;
|
|
34121
34182
|
this.pagination.totalCount = this._sourceLength;
|
|
34183
|
+
if (this.rowHierarchyType === 'tree') {
|
|
34184
|
+
this.initTreeHierarchyState();
|
|
34185
|
+
}
|
|
34122
34186
|
this.updatePagerData();
|
|
34123
34187
|
}
|
|
34124
34188
|
}
|
|
@@ -34167,6 +34231,7 @@
|
|
|
34167
34231
|
}
|
|
34168
34232
|
release() {
|
|
34169
34233
|
super.release?.();
|
|
34234
|
+
this.lastFilterRules = null;
|
|
34170
34235
|
}
|
|
34171
34236
|
clearSortedMap() {
|
|
34172
34237
|
this.currentIndexedData && (this.currentIndexedData.length = 0);
|
|
@@ -34182,10 +34247,19 @@
|
|
|
34182
34247
|
this.currentPagerIndexedData.length = 0;
|
|
34183
34248
|
}
|
|
34184
34249
|
getOriginalRecord(dataIndex) {
|
|
34185
|
-
|
|
34186
|
-
|
|
34250
|
+
let data;
|
|
34251
|
+
if (!this.dataSourceObj.records) {
|
|
34252
|
+
data = this._get(dataIndex);
|
|
34187
34253
|
}
|
|
34188
|
-
|
|
34254
|
+
else {
|
|
34255
|
+
if (Array.isArray(dataIndex)) {
|
|
34256
|
+
data = getValueFromDeepArray(this.records, dataIndex);
|
|
34257
|
+
}
|
|
34258
|
+
else {
|
|
34259
|
+
data = this.records[dataIndex];
|
|
34260
|
+
}
|
|
34261
|
+
}
|
|
34262
|
+
return getValue(data, (val) => {
|
|
34189
34263
|
this.recordPromiseCallBack(dataIndex, val);
|
|
34190
34264
|
});
|
|
34191
34265
|
}
|
|
@@ -34193,7 +34267,19 @@
|
|
|
34193
34267
|
if (this.beforeChangedRecordsMap?.[dataIndex]) {
|
|
34194
34268
|
return this.beforeChangedRecordsMap[dataIndex];
|
|
34195
34269
|
}
|
|
34196
|
-
|
|
34270
|
+
let data;
|
|
34271
|
+
if (!this.dataSourceObj.records) {
|
|
34272
|
+
data = this._get(dataIndex);
|
|
34273
|
+
}
|
|
34274
|
+
else {
|
|
34275
|
+
if (Array.isArray(dataIndex)) {
|
|
34276
|
+
data = getValueFromDeepArray(this.records, dataIndex);
|
|
34277
|
+
}
|
|
34278
|
+
else {
|
|
34279
|
+
data = this.records[dataIndex];
|
|
34280
|
+
}
|
|
34281
|
+
}
|
|
34282
|
+
return getValue(data, (val) => {
|
|
34197
34283
|
this.recordPromiseCallBack(dataIndex, val);
|
|
34198
34284
|
});
|
|
34199
34285
|
}
|
|
@@ -34317,30 +34403,32 @@
|
|
|
34317
34403
|
targetI = targetIndexs.splice(targetIndexs.length - 1, 1)[0];
|
|
34318
34404
|
if (sourceIndexs.length >= 1) {
|
|
34319
34405
|
const parent = this.getOriginalRecord(sourceIndexs);
|
|
34320
|
-
const sourceIds = parent.
|
|
34406
|
+
const sourceIds = parent.filteredChildren
|
|
34407
|
+
? parent.filteredChildren.splice(sourceI, 1)
|
|
34408
|
+
: parent.children.splice(sourceI, 1);
|
|
34321
34409
|
sourceIds.unshift(targetI, 0);
|
|
34322
|
-
Array.prototype.splice.apply(parent.children, sourceIds);
|
|
34410
|
+
Array.prototype.splice.apply(parent.filteredChildren ?? parent.children, sourceIds);
|
|
34323
34411
|
}
|
|
34324
34412
|
else {
|
|
34325
|
-
const sourceIds = this.
|
|
34413
|
+
const sourceIds = this.records.splice(sourceI, 1);
|
|
34326
34414
|
sourceIds.unshift(targetI, 0);
|
|
34327
|
-
Array.prototype.splice.apply(this.
|
|
34415
|
+
Array.prototype.splice.apply(this.records, sourceIds);
|
|
34328
34416
|
}
|
|
34329
34417
|
}
|
|
34330
34418
|
else {
|
|
34331
34419
|
sourceI = this.currentPagerIndexedData[sourceIndex];
|
|
34332
34420
|
targetI = this.currentPagerIndexedData[targetIndex];
|
|
34333
|
-
const records = this.
|
|
34421
|
+
const records = this.records.splice(sourceI, 1);
|
|
34334
34422
|
records.unshift(targetI, 0);
|
|
34335
|
-
Array.prototype.splice.apply(this.
|
|
34423
|
+
Array.prototype.splice.apply(this.records, records);
|
|
34336
34424
|
}
|
|
34337
34425
|
this.restoreTreeHierarchyState();
|
|
34338
34426
|
this.updatePagerData();
|
|
34339
34427
|
}
|
|
34340
34428
|
else {
|
|
34341
|
-
const records = this.
|
|
34429
|
+
const records = this.records.splice(sourceIndex, 1);
|
|
34342
34430
|
records.unshift(targetIndex, 0);
|
|
34343
|
-
Array.prototype.splice.apply(this.
|
|
34431
|
+
Array.prototype.splice.apply(this.records, records);
|
|
34344
34432
|
}
|
|
34345
34433
|
}
|
|
34346
34434
|
}
|
|
@@ -34348,14 +34436,16 @@
|
|
|
34348
34436
|
if (this.hierarchyExpandLevel) {
|
|
34349
34437
|
for (let i = 0; i < this._sourceLength; i++) {
|
|
34350
34438
|
const nodeData = this.getOriginalRecord(i);
|
|
34351
|
-
|
|
34439
|
+
const children = nodeData.filteredChildren ?? nodeData.children;
|
|
34440
|
+
children && !nodeData.hierarchyState && (nodeData.hierarchyState = HierarchyState.collapse);
|
|
34352
34441
|
}
|
|
34353
34442
|
this.currentIndexedData = Array.from({ length: this._sourceLength }, (_, i) => i);
|
|
34354
34443
|
let nodeLength = this._sourceLength;
|
|
34355
34444
|
for (let i = 0; i < nodeLength; i++) {
|
|
34356
34445
|
const indexKey = this.currentIndexedData[i];
|
|
34357
34446
|
const nodeData = this.getOriginalRecord(indexKey);
|
|
34358
|
-
|
|
34447
|
+
const children = nodeData.filteredChildren ?? nodeData.children;
|
|
34448
|
+
if (children?.length > 0 && nodeData.hierarchyState === HierarchyState.expand) {
|
|
34359
34449
|
this.hasHierarchyStateExpand = true;
|
|
34360
34450
|
const childrenLength = this.restoreChildrenNodeHierarchy(indexKey, nodeData);
|
|
34361
34451
|
i += childrenLength;
|
|
@@ -34369,12 +34459,13 @@
|
|
|
34369
34459
|
}
|
|
34370
34460
|
restoreChildrenNodeHierarchy(indexKey, nodeData) {
|
|
34371
34461
|
let childTotalLength = 0;
|
|
34372
|
-
const
|
|
34462
|
+
const children = nodeData.filteredChildren ?? nodeData.children;
|
|
34463
|
+
const nodeLength = children?.length ?? 0;
|
|
34373
34464
|
for (let j = 0; j < nodeLength; j++) {
|
|
34374
34465
|
if (nodeData.hierarchyState === HierarchyState.expand) {
|
|
34375
34466
|
childTotalLength += 1;
|
|
34376
34467
|
}
|
|
34377
|
-
const childNodeData =
|
|
34468
|
+
const childNodeData = children[j];
|
|
34378
34469
|
const childIndexKey = Array.isArray(indexKey) ? indexKey.concat(j) : [indexKey, j];
|
|
34379
34470
|
if (nodeData.hierarchyState === HierarchyState.expand) {
|
|
34380
34471
|
this.currentIndexedData.splice(this.currentIndexedData.indexOf(indexKey) + childTotalLength, 0, childIndexKey);
|
|
@@ -34384,6 +34475,23 @@
|
|
|
34384
34475
|
return childTotalLength;
|
|
34385
34476
|
}
|
|
34386
34477
|
}
|
|
34478
|
+
function getValueFromDeepArray(array, index) {
|
|
34479
|
+
let result = array;
|
|
34480
|
+
for (let i = 0; i < index.length; i++) {
|
|
34481
|
+
const currentIdx = index[i];
|
|
34482
|
+
if (result[currentIdx]) {
|
|
34483
|
+
result = result[currentIdx];
|
|
34484
|
+
}
|
|
34485
|
+
else {
|
|
34486
|
+
return undefined;
|
|
34487
|
+
}
|
|
34488
|
+
const children = result.filteredChildren ?? result?.children;
|
|
34489
|
+
if (children && i + 1 < index.length) {
|
|
34490
|
+
result = children;
|
|
34491
|
+
}
|
|
34492
|
+
}
|
|
34493
|
+
return result;
|
|
34494
|
+
}
|
|
34387
34495
|
|
|
34388
34496
|
function _setFieldCache(fCache, index, field, value) {
|
|
34389
34497
|
const recCache = fCache[index] || (fCache[index] = new Map());
|
|
@@ -34398,18 +34506,15 @@
|
|
|
34398
34506
|
static ofArray(array, dataConfig, pagination, columnObjs, rowHierarchyType, hierarchyExpandLevel) {
|
|
34399
34507
|
return new CachedDataSource({
|
|
34400
34508
|
get: (index) => {
|
|
34401
|
-
if (Array.isArray(index)) {
|
|
34402
|
-
return getValueFromDeepArray(array, index);
|
|
34403
|
-
}
|
|
34404
34509
|
return array[index];
|
|
34405
34510
|
},
|
|
34406
34511
|
length: array.length,
|
|
34407
|
-
|
|
34512
|
+
records: array
|
|
34408
34513
|
}, dataConfig, pagination, columnObjs, rowHierarchyType, hierarchyExpandLevel);
|
|
34409
34514
|
}
|
|
34410
34515
|
constructor(opt, dataConfig, pagination, columnObjs, rowHierarchyType, hierarchyExpandLevel) {
|
|
34411
34516
|
super(opt, dataConfig, pagination, columnObjs, rowHierarchyType, hierarchyExpandLevel);
|
|
34412
|
-
this._recordCache =
|
|
34517
|
+
this._recordCache = [];
|
|
34413
34518
|
this._fieldCache = {};
|
|
34414
34519
|
}
|
|
34415
34520
|
getOriginalRecord(index) {
|
|
@@ -34430,7 +34535,7 @@
|
|
|
34430
34535
|
}
|
|
34431
34536
|
clearCache() {
|
|
34432
34537
|
if (this._recordCache) {
|
|
34433
|
-
this._recordCache =
|
|
34538
|
+
this._recordCache = [];
|
|
34434
34539
|
}
|
|
34435
34540
|
if (this._fieldCache) {
|
|
34436
34541
|
this._fieldCache = {};
|
|
@@ -34442,8 +34547,13 @@
|
|
|
34442
34547
|
recordPromiseCallBack(index, record) {
|
|
34443
34548
|
this._recordCache[index] = record;
|
|
34444
34549
|
}
|
|
34550
|
+
get records() {
|
|
34551
|
+
return Array.isArray(this._recordCache) && this._recordCache.length > 0 ? this._recordCache : super.records;
|
|
34552
|
+
}
|
|
34445
34553
|
release() {
|
|
34446
34554
|
super.release?.();
|
|
34555
|
+
this._recordCache = null;
|
|
34556
|
+
this._fieldCache = null;
|
|
34447
34557
|
}
|
|
34448
34558
|
}
|
|
34449
34559
|
|
|
@@ -34926,9 +35036,8 @@
|
|
|
34926
35036
|
}
|
|
34927
35037
|
function _setRecords(table, records = []) {
|
|
34928
35038
|
_dealWithUpdateDataSource(table, () => {
|
|
34929
|
-
const data = records;
|
|
34930
35039
|
table.internalProps.records = records;
|
|
34931
|
-
const newDataSource = (table.internalProps.dataSource = CachedDataSource.ofArray(
|
|
35040
|
+
const newDataSource = (table.internalProps.dataSource = CachedDataSource.ofArray(records, table.internalProps.dataConfig, table.pagination, table.internalProps.layoutMap.columnObjects, table.internalProps.layoutMap.rowHierarchyType, table.options.hierarchyExpandLevel ?? (table._hasHierarchyTreeHeader?.() ? 1 : undefined)));
|
|
34932
35041
|
table.addReleaseObj(newDataSource);
|
|
34933
35042
|
});
|
|
34934
35043
|
}
|
|
@@ -41460,7 +41569,8 @@
|
|
|
41460
41569
|
componentGroup.addChild(this.columnResizeBgLine);
|
|
41461
41570
|
componentGroup.addChild(this.columnResizeLine);
|
|
41462
41571
|
componentGroup.addChild(this.columnResizeLabel);
|
|
41463
|
-
|
|
41572
|
+
const hoverOn = this.table.theme.scrollStyle.hoverOn;
|
|
41573
|
+
if (hoverOn && !this.table.theme.scrollStyle.barToSide) {
|
|
41464
41574
|
componentGroup.addChild(this.hScrollBar);
|
|
41465
41575
|
componentGroup.addChild(this.vScrollBar);
|
|
41466
41576
|
}
|
|
@@ -41531,9 +41641,17 @@
|
|
|
41531
41641
|
if (totalWidth > tableWidth) {
|
|
41532
41642
|
const y = Math.min(tableHeight, totalHeight);
|
|
41533
41643
|
const rangeEnd = Math.max(0.05, (tableWidth - frozenColsWidth) / (totalWidth - frozenColsWidth));
|
|
41644
|
+
const hoverOn = this.table.theme.scrollStyle.hoverOn;
|
|
41645
|
+
let attrY = 0;
|
|
41646
|
+
if (this.table.theme.scrollStyle.barToSide) {
|
|
41647
|
+
attrY = this.table.tableNoFrameHeight - (hoverOn ? width : -this.table.scenegraph.tableGroup.attribute.y);
|
|
41648
|
+
}
|
|
41649
|
+
else {
|
|
41650
|
+
attrY = y - (hoverOn ? width : -this.table.scenegraph.tableGroup.attribute.y);
|
|
41651
|
+
}
|
|
41534
41652
|
this.hScrollBar.setAttributes({
|
|
41535
|
-
x: frozenColsWidth + (!
|
|
41536
|
-
y:
|
|
41653
|
+
x: frozenColsWidth + (!hoverOn ? this.table.scenegraph.tableGroup.attribute.x : 0),
|
|
41654
|
+
y: attrY,
|
|
41537
41655
|
width: tableWidth - frozenColsWidth - rightFrozenColsWidth,
|
|
41538
41656
|
range: [0, rangeEnd],
|
|
41539
41657
|
visible: visible === 'always'
|
|
@@ -41558,9 +41676,17 @@
|
|
|
41558
41676
|
if (totalHeight > tableHeight) {
|
|
41559
41677
|
const x = Math.min(tableWidth, totalWidth);
|
|
41560
41678
|
const rangeEnd = Math.max(0.05, (tableHeight - frozenRowsHeight) / (totalHeight - frozenRowsHeight));
|
|
41679
|
+
let attrX = 0;
|
|
41680
|
+
const hoverOn = this.table.theme.scrollStyle.hoverOn;
|
|
41681
|
+
if (this.table.theme.scrollStyle.barToSide) {
|
|
41682
|
+
attrX = this.table.tableNoFrameWidth - (hoverOn ? width : -this.table.scenegraph.tableGroup.attribute.x);
|
|
41683
|
+
}
|
|
41684
|
+
else {
|
|
41685
|
+
attrX = x - (hoverOn ? width : -this.table.scenegraph.tableGroup.attribute.x);
|
|
41686
|
+
}
|
|
41561
41687
|
this.vScrollBar.setAttributes({
|
|
41562
|
-
x:
|
|
41563
|
-
y: frozenRowsHeight + (!
|
|
41688
|
+
x: attrX,
|
|
41689
|
+
y: frozenRowsHeight + (!hoverOn ? this.table.scenegraph.tableGroup.attribute.y : 0),
|
|
41564
41690
|
height: tableHeight - frozenRowsHeight - bottomFrozenRowsHeight,
|
|
41565
41691
|
range: [0, rangeEnd],
|
|
41566
41692
|
visible: visible === 'always'
|
|
@@ -45371,6 +45497,7 @@
|
|
|
45371
45497
|
const colsWidth = scene.table.getColsWidth(computeRectCellRangeStartCol, computeRectCellRangeEndCol);
|
|
45372
45498
|
const rowsHeight = scene.table.getRowsHeight(computeRectCellRangeStartRow, computeRectCellRangeEndRow);
|
|
45373
45499
|
const firstCellBound = scene.highPerformanceGetCell(computeRectCellRangeStartCol, computeRectCellRangeStartRow).globalAABBBounds;
|
|
45500
|
+
const lastCellBound = scene.highPerformanceGetCell(computeRectCellRangeEndCol, computeRectCellRangeEndRow).globalAABBBounds;
|
|
45374
45501
|
selectComp.rect.setAttributes({
|
|
45375
45502
|
x: firstCellBound.x1 - scene.tableGroup.attribute.x,
|
|
45376
45503
|
y: firstCellBound.y1 - scene.tableGroup.attribute.y,
|
|
@@ -45378,6 +45505,15 @@
|
|
|
45378
45505
|
height: rowsHeight,
|
|
45379
45506
|
visible: true
|
|
45380
45507
|
});
|
|
45508
|
+
if (selectComp.fillhandle) {
|
|
45509
|
+
selectComp.fillhandle.setAttributes({
|
|
45510
|
+
x: lastCellBound.x2 - scene.tableGroup.attribute.x - 3,
|
|
45511
|
+
y: lastCellBound.y2 - scene.tableGroup.attribute.y - 3,
|
|
45512
|
+
width: 6,
|
|
45513
|
+
height: 6,
|
|
45514
|
+
visible: true
|
|
45515
|
+
});
|
|
45516
|
+
}
|
|
45381
45517
|
const isNearRowHeader = scene.table.frozenColCount ? startCol === scene.table.frozenColCount : false;
|
|
45382
45518
|
const isNearRightRowHeader = scene.table.rightFrozenColCount
|
|
45383
45519
|
? scene.table.rightFrozenColCount > 0 && endCol === scene.table.colCount - scene.table.rightFrozenColCount - 1
|
|
@@ -45581,6 +45717,7 @@
|
|
|
45581
45717
|
ifExtendSelectRange && extendSelectRange();
|
|
45582
45718
|
scene.selectingRangeComponents.forEach((selectComp, key) => {
|
|
45583
45719
|
selectComp.rect.delete();
|
|
45720
|
+
selectComp.fillhandle?.delete();
|
|
45584
45721
|
});
|
|
45585
45722
|
scene.selectingRangeComponents = new Map();
|
|
45586
45723
|
let needRowHeader = false;
|
|
@@ -45710,11 +45847,27 @@
|
|
|
45710
45847
|
}
|
|
45711
45848
|
|
|
45712
45849
|
function createCellSelectBorder(scene, start_Col, start_Row, end_Col, end_Row, selectRangeType, selectId, strokes) {
|
|
45850
|
+
let isHasFillHandleRect = !!scene.table.options.excelOptions?.fillHandle;
|
|
45851
|
+
if (scene.table.stateManager.select.ranges?.length > 1) {
|
|
45852
|
+
isHasFillHandleRect = false;
|
|
45853
|
+
scene.removeFillHandleFromSelectComponents();
|
|
45854
|
+
}
|
|
45855
|
+
else if (scene.table.stateManager.select.ranges?.length === 1) {
|
|
45856
|
+
const maxRow = Math.max(scene.table.stateManager.select.ranges[0].start.row, scene.table.stateManager.select.ranges[0].end.row);
|
|
45857
|
+
const maxCol = Math.max(scene.table.stateManager.select.ranges[0].start.col, scene.table.stateManager.select.ranges[0].end.col);
|
|
45858
|
+
if (scene.table.isHeader(maxCol, maxRow)) {
|
|
45859
|
+
isHasFillHandleRect = false;
|
|
45860
|
+
}
|
|
45861
|
+
}
|
|
45862
|
+
if (Array.isArray(strokes) && (strokes[1] === false || strokes[2] === false)) {
|
|
45863
|
+
isHasFillHandleRect = false;
|
|
45864
|
+
}
|
|
45713
45865
|
const startCol = Math.min(start_Col, end_Col);
|
|
45714
45866
|
const startRow = Math.min(start_Row, end_Row);
|
|
45715
45867
|
const endCol = Math.max(start_Col, end_Col);
|
|
45716
45868
|
const endRow = Math.max(start_Row, end_Row);
|
|
45717
45869
|
const firstCellBound = scene.highPerformanceGetCell(startCol, startRow).globalAABBBounds;
|
|
45870
|
+
const lastCellBound = scene.highPerformanceGetCell(endCol, endRow).globalAABBBounds;
|
|
45718
45871
|
const theme = scene.table.theme;
|
|
45719
45872
|
const bodyClickBorderColor = theme.selectionStyle?.cellBorderColor;
|
|
45720
45873
|
const bodyClickLineWidth = theme.selectionStyle?.cellBorderLineWidth;
|
|
@@ -45734,9 +45887,23 @@
|
|
|
45734
45887
|
height: 0,
|
|
45735
45888
|
visible: true
|
|
45736
45889
|
});
|
|
45890
|
+
let fillhandle;
|
|
45891
|
+
if (isHasFillHandleRect) {
|
|
45892
|
+
fillhandle = createRect({
|
|
45893
|
+
pickable: false,
|
|
45894
|
+
fill: bodyClickBorderColor,
|
|
45895
|
+
stroke: bodyClickBorderColor,
|
|
45896
|
+
x: lastCellBound.x2 - 3,
|
|
45897
|
+
y: lastCellBound.y2 - 3,
|
|
45898
|
+
width: 6,
|
|
45899
|
+
height: 6,
|
|
45900
|
+
visible: true
|
|
45901
|
+
});
|
|
45902
|
+
}
|
|
45737
45903
|
scene.lastSelectId = selectId;
|
|
45738
45904
|
scene.selectingRangeComponents.set(`${startCol}-${startRow}-${endCol}-${endRow}-${selectId}`, {
|
|
45739
45905
|
rect,
|
|
45906
|
+
fillhandle,
|
|
45740
45907
|
role: selectRangeType
|
|
45741
45908
|
});
|
|
45742
45909
|
scene.tableGroup.insertAfter(rect, selectRangeType === 'body'
|
|
@@ -45756,12 +45923,31 @@
|
|
|
45756
45923
|
: selectRangeType === 'bottomFrozen'
|
|
45757
45924
|
? scene.bottomFrozenGroup
|
|
45758
45925
|
: scene.rightBottomCornerGroup);
|
|
45926
|
+
isHasFillHandleRect &&
|
|
45927
|
+
scene.tableGroup.insertAfter(fillhandle, selectRangeType === 'body'
|
|
45928
|
+
? scene.bodyGroup
|
|
45929
|
+
: selectRangeType === 'columnHeader'
|
|
45930
|
+
? scene.colHeaderGroup
|
|
45931
|
+
: selectRangeType === 'rowHeader'
|
|
45932
|
+
? scene.rowHeaderGroup
|
|
45933
|
+
: selectRangeType === 'cornerHeader'
|
|
45934
|
+
? scene.cornerHeaderGroup
|
|
45935
|
+
: selectRangeType === 'rightTopCorner'
|
|
45936
|
+
? scene.rightTopCornerGroup
|
|
45937
|
+
: selectRangeType === 'rightFrozen'
|
|
45938
|
+
? scene.rightFrozenGroup
|
|
45939
|
+
: selectRangeType === 'leftBottomCorner'
|
|
45940
|
+
? scene.leftBottomCornerGroup
|
|
45941
|
+
: selectRangeType === 'bottomFrozen'
|
|
45942
|
+
? scene.bottomFrozenGroup
|
|
45943
|
+
: scene.rightBottomCornerGroup);
|
|
45759
45944
|
}
|
|
45760
45945
|
|
|
45761
45946
|
function moveSelectingRangeComponentsToSelectedRangeComponents(scene) {
|
|
45762
45947
|
scene.selectingRangeComponents.forEach((rangeComponent, key) => {
|
|
45763
45948
|
if (scene.selectedRangeComponents.get(key)) {
|
|
45764
|
-
scene.
|
|
45949
|
+
scene.selectingRangeComponents.get(key).rect.delete();
|
|
45950
|
+
scene.selectingRangeComponents.get(key).fillhandle?.delete();
|
|
45765
45951
|
}
|
|
45766
45952
|
scene.selectedRangeComponents.set(key, rangeComponent);
|
|
45767
45953
|
});
|
|
@@ -45774,6 +45960,7 @@
|
|
|
45774
45960
|
const lastSelectId = key.split('-')[4];
|
|
45775
45961
|
if (lastSelectId === scene.lastSelectId) {
|
|
45776
45962
|
selectComp.rect.delete();
|
|
45963
|
+
selectComp.fillhandle?.delete();
|
|
45777
45964
|
scene.selectedRangeComponents.delete(key);
|
|
45778
45965
|
}
|
|
45779
45966
|
});
|
|
@@ -45781,9 +45968,16 @@
|
|
|
45781
45968
|
function deleteAllSelectBorder(scene) {
|
|
45782
45969
|
scene.selectedRangeComponents.forEach((selectComp, key) => {
|
|
45783
45970
|
selectComp.rect.delete();
|
|
45971
|
+
selectComp.fillhandle?.delete();
|
|
45784
45972
|
});
|
|
45785
45973
|
scene.selectedRangeComponents = new Map();
|
|
45786
45974
|
}
|
|
45975
|
+
function removeFillHandleFromSelectComponents(scene) {
|
|
45976
|
+
scene.selectedRangeComponents.forEach((selectComp, key) => {
|
|
45977
|
+
selectComp.fillhandle?.delete();
|
|
45978
|
+
selectComp.fillhandle = undefined;
|
|
45979
|
+
});
|
|
45980
|
+
}
|
|
45787
45981
|
|
|
45788
45982
|
function updateRow(removeCells, addCells, updateCells, table) {
|
|
45789
45983
|
const scene = table.scenegraph;
|
|
@@ -46429,6 +46623,9 @@
|
|
|
46429
46623
|
if (!scene.isPivot && !scene.table.transpose) {
|
|
46430
46624
|
scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1);
|
|
46431
46625
|
}
|
|
46626
|
+
else if (scene.table.options.frozenColCount) {
|
|
46627
|
+
scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1);
|
|
46628
|
+
}
|
|
46432
46629
|
scene.hasFrozen = true;
|
|
46433
46630
|
scene.frozenColCount = scene.table.frozenColCount;
|
|
46434
46631
|
scene.frozenRowCount = scene.colHeaderGroup.firstChild?.childrenCount ?? 0;
|
|
@@ -46465,6 +46662,9 @@
|
|
|
46465
46662
|
if (!scene.isPivot && !scene.table.transpose) {
|
|
46466
46663
|
scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1);
|
|
46467
46664
|
}
|
|
46665
|
+
else if (scene.table.options.frozenColCount) {
|
|
46666
|
+
scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1);
|
|
46667
|
+
}
|
|
46468
46668
|
scene.hasFrozen = true;
|
|
46469
46669
|
}
|
|
46470
46670
|
function moveColumnFromBodyToRowHeader(scene) {
|
|
@@ -47956,6 +48156,9 @@
|
|
|
47956
48156
|
updateCellSelectBorder(newStartCol, newStartRow, newEndCol, newEndRow, extendSelectRange = true) {
|
|
47957
48157
|
updateCellSelectBorder(this, newStartCol, newStartRow, newEndCol, newEndRow, extendSelectRange);
|
|
47958
48158
|
}
|
|
48159
|
+
removeFillHandleFromSelectComponents() {
|
|
48160
|
+
removeFillHandleFromSelectComponents(this);
|
|
48161
|
+
}
|
|
47959
48162
|
recreateAllSelectRangeComponents() {
|
|
47960
48163
|
deleteAllSelectBorder(this);
|
|
47961
48164
|
this.table.stateManager.select.ranges.forEach((cellRange) => {
|
|
@@ -48314,6 +48517,9 @@
|
|
|
48314
48517
|
if (!this.isPivot && !this.table.transpose) {
|
|
48315
48518
|
this.component.setFrozenColumnShadow(this.table.frozenColCount - 1);
|
|
48316
48519
|
}
|
|
48520
|
+
else if (this.table.options.frozenColCount) {
|
|
48521
|
+
this.component.setFrozenColumnShadow(this.table.frozenColCount - 1);
|
|
48522
|
+
}
|
|
48317
48523
|
this.table.stateManager.checkFrozen();
|
|
48318
48524
|
this.updateContainer();
|
|
48319
48525
|
this.createFrameBorder();
|
|
@@ -48730,6 +48936,9 @@
|
|
|
48730
48936
|
if (!this.isPivot && !this.table.transpose) {
|
|
48731
48937
|
this.component.setFrozenColumnShadow(this.table.frozenColCount - 1);
|
|
48732
48938
|
}
|
|
48939
|
+
else if (this.table.options.frozenColCount) {
|
|
48940
|
+
this.component.setFrozenColumnShadow(this.table.frozenColCount - 1);
|
|
48941
|
+
}
|
|
48733
48942
|
this.component.updateScrollBar();
|
|
48734
48943
|
this.updateNextFrame();
|
|
48735
48944
|
}
|
|
@@ -48741,6 +48950,9 @@
|
|
|
48741
48950
|
if (!this.isPivot && !this.table.transpose) {
|
|
48742
48951
|
this.component.setFrozenColumnShadow(this.table.frozenColCount - 1);
|
|
48743
48952
|
}
|
|
48953
|
+
else if (this.table.options.frozenColCount) {
|
|
48954
|
+
this.component.setFrozenColumnShadow(this.table.frozenColCount - 1);
|
|
48955
|
+
}
|
|
48744
48956
|
this.component.updateScrollBar();
|
|
48745
48957
|
this.updateNextFrame();
|
|
48746
48958
|
}
|
|
@@ -49175,10 +49387,76 @@
|
|
|
49175
49387
|
};
|
|
49176
49388
|
}
|
|
49177
49389
|
else {
|
|
49178
|
-
|
|
49179
|
-
|
|
49180
|
-
|
|
49181
|
-
|
|
49390
|
+
if (state.fillHandle.isFilling) {
|
|
49391
|
+
if (state.fillHandle.direction === 'top') {
|
|
49392
|
+
if (row === state.fillHandle.beforeFillMinRow && row === state.fillHandle.beforeFillMaxRow) {
|
|
49393
|
+
currentRange.start.row = currentRange.end.row = row;
|
|
49394
|
+
}
|
|
49395
|
+
else if (row <= state.fillHandle.beforeFillMinRow) {
|
|
49396
|
+
if (currentRange.start.row < currentRange.end.row) {
|
|
49397
|
+
const temp = currentRange.start.row;
|
|
49398
|
+
currentRange.start.row = currentRange.end.row;
|
|
49399
|
+
currentRange.end.row = temp;
|
|
49400
|
+
}
|
|
49401
|
+
currentRange.end.row = row;
|
|
49402
|
+
}
|
|
49403
|
+
else if (row === state.fillHandle.beforeFillMaxRow) {
|
|
49404
|
+
if (currentRange.start.row > currentRange.end.row) {
|
|
49405
|
+
currentRange.start.row = row;
|
|
49406
|
+
}
|
|
49407
|
+
else {
|
|
49408
|
+
currentRange.end.row = row;
|
|
49409
|
+
}
|
|
49410
|
+
}
|
|
49411
|
+
}
|
|
49412
|
+
else if (state.fillHandle.direction === 'bottom') {
|
|
49413
|
+
if (row >= state.fillHandle.beforeFillMaxRow) {
|
|
49414
|
+
if (currentRange.start.row > currentRange.end.row) {
|
|
49415
|
+
const temp = currentRange.start.row;
|
|
49416
|
+
currentRange.start.row = currentRange.end.row;
|
|
49417
|
+
currentRange.end.row = temp;
|
|
49418
|
+
}
|
|
49419
|
+
currentRange.end.row = row;
|
|
49420
|
+
}
|
|
49421
|
+
}
|
|
49422
|
+
else if (state.fillHandle.direction === 'left') {
|
|
49423
|
+
if (col === state.fillHandle.beforeFillMinCol && col === state.fillHandle.beforeFillMaxCol) {
|
|
49424
|
+
currentRange.start.col = currentRange.end.col = col;
|
|
49425
|
+
}
|
|
49426
|
+
else if (col <= state.fillHandle.beforeFillMinCol) {
|
|
49427
|
+
if (currentRange.start.col < currentRange.end.col) {
|
|
49428
|
+
const temp = currentRange.start.col;
|
|
49429
|
+
currentRange.start.col = currentRange.end.col;
|
|
49430
|
+
currentRange.end.col = temp;
|
|
49431
|
+
}
|
|
49432
|
+
currentRange.end.col = col;
|
|
49433
|
+
}
|
|
49434
|
+
else if (col === state.fillHandle.beforeFillMaxCol) {
|
|
49435
|
+
if (currentRange.start.col > currentRange.end.col) {
|
|
49436
|
+
currentRange.start.col = col;
|
|
49437
|
+
}
|
|
49438
|
+
else {
|
|
49439
|
+
currentRange.end.col = col;
|
|
49440
|
+
}
|
|
49441
|
+
}
|
|
49442
|
+
}
|
|
49443
|
+
else if (state.fillHandle.direction === 'right') {
|
|
49444
|
+
if (col >= state.fillHandle.beforeFillMaxCol) {
|
|
49445
|
+
if (currentRange.start.col > currentRange.end.col) {
|
|
49446
|
+
const temp = currentRange.start.col;
|
|
49447
|
+
currentRange.start.col = currentRange.end.col;
|
|
49448
|
+
currentRange.end.col = temp;
|
|
49449
|
+
}
|
|
49450
|
+
currentRange.end.col = col;
|
|
49451
|
+
}
|
|
49452
|
+
}
|
|
49453
|
+
}
|
|
49454
|
+
else {
|
|
49455
|
+
currentRange.end = {
|
|
49456
|
+
col,
|
|
49457
|
+
row
|
|
49458
|
+
};
|
|
49459
|
+
}
|
|
49182
49460
|
}
|
|
49183
49461
|
scenegraph.updateCellSelectBorder(currentRange.start.col, currentRange.start.row, currentRange.end.col, currentRange.end.row, extendSelectRange);
|
|
49184
49462
|
}
|
|
@@ -49544,6 +49822,9 @@
|
|
|
49544
49822
|
!state.table.transpose) {
|
|
49545
49823
|
state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1, state.columnResize.isRightFrozen);
|
|
49546
49824
|
}
|
|
49825
|
+
else if (state.table.options.frozenColCount) {
|
|
49826
|
+
state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1);
|
|
49827
|
+
}
|
|
49547
49828
|
state.table.scenegraph.updateNextFrame();
|
|
49548
49829
|
}
|
|
49549
49830
|
function clearWidthsAndHeightsCache(colMin, colMax, rowMin, rowMax, table) {
|
|
@@ -49668,6 +49949,9 @@
|
|
|
49668
49949
|
!state.table.transpose) {
|
|
49669
49950
|
state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1, state.columnResize.isRightFrozen);
|
|
49670
49951
|
}
|
|
49952
|
+
else if (state.table.options.frozenColCount) {
|
|
49953
|
+
state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1);
|
|
49954
|
+
}
|
|
49671
49955
|
state.table.scenegraph.updateNextFrame();
|
|
49672
49956
|
}
|
|
49673
49957
|
function updateResizeColForColumn(detaX, state) {
|
|
@@ -49750,6 +50034,7 @@
|
|
|
49750
50034
|
table;
|
|
49751
50035
|
interactionState;
|
|
49752
50036
|
select;
|
|
50037
|
+
fillHandle;
|
|
49753
50038
|
hover;
|
|
49754
50039
|
hoverIcon;
|
|
49755
50040
|
residentHoverIcon;
|
|
@@ -49852,6 +50137,11 @@
|
|
|
49852
50137
|
},
|
|
49853
50138
|
selecting: false
|
|
49854
50139
|
};
|
|
50140
|
+
this.fillHandle = {
|
|
50141
|
+
isFilling: false,
|
|
50142
|
+
startX: undefined,
|
|
50143
|
+
startY: undefined
|
|
50144
|
+
};
|
|
49855
50145
|
this.hover = {
|
|
49856
50146
|
highlightScope: HighlightScope.single,
|
|
49857
50147
|
cellPos: {
|
|
@@ -50055,6 +50345,9 @@
|
|
|
50055
50345
|
isResizeCol() {
|
|
50056
50346
|
return this.columnResize.resizing;
|
|
50057
50347
|
}
|
|
50348
|
+
isFillHandle() {
|
|
50349
|
+
return this.fillHandle.isFilling;
|
|
50350
|
+
}
|
|
50058
50351
|
isSelecting() {
|
|
50059
50352
|
return this.select.selecting;
|
|
50060
50353
|
}
|
|
@@ -50088,9 +50381,41 @@
|
|
|
50088
50381
|
this.columnResize.x = x;
|
|
50089
50382
|
this.columnResize.isRightFrozen = isRightFrozen;
|
|
50090
50383
|
this.table.scenegraph.component.showResizeCol(col, y, isRightFrozen);
|
|
50091
|
-
this.
|
|
50384
|
+
this.updateSelectPos(-1, -1);
|
|
50092
50385
|
this.table.scenegraph.updateNextFrame();
|
|
50093
50386
|
}
|
|
50387
|
+
startFillSelect(x, y) {
|
|
50388
|
+
this.fillHandle.isFilling = true;
|
|
50389
|
+
this.fillHandle.startX = x;
|
|
50390
|
+
this.fillHandle.startY = y;
|
|
50391
|
+
const currentRange = this.select.ranges[this.select.ranges.length - 1];
|
|
50392
|
+
this.fillHandle.beforeFillMinCol = Math.min(currentRange.start.col, currentRange.end.col);
|
|
50393
|
+
this.fillHandle.beforeFillMinRow = Math.min(currentRange.start.row, currentRange.end.row);
|
|
50394
|
+
this.fillHandle.beforeFillMaxCol = Math.max(currentRange.start.col, currentRange.end.col);
|
|
50395
|
+
this.fillHandle.beforeFillMaxRow = Math.max(currentRange.start.row, currentRange.end.row);
|
|
50396
|
+
this.table.fireListeners(TABLE_EVENT_TYPE.MOUSEDOWN_FILL_HANDLE, {});
|
|
50397
|
+
}
|
|
50398
|
+
endFillSelect() {
|
|
50399
|
+
this.fillHandle.isFilling = false;
|
|
50400
|
+
this.fillHandle.startX = undefined;
|
|
50401
|
+
this.fillHandle.startY = undefined;
|
|
50402
|
+
this.fillHandle.directionRow = undefined;
|
|
50403
|
+
const currentMinCol = Math.min(this.select.ranges[0].start.col, this.select.ranges[0].end.col);
|
|
50404
|
+
const currentMinRow = Math.min(this.select.ranges[0].start.row, this.select.ranges[0].end.row);
|
|
50405
|
+
const currentMaxCol = Math.max(this.select.ranges[0].start.col, this.select.ranges[0].end.col);
|
|
50406
|
+
const currentMaxRow = Math.max(this.select.ranges[0].start.row, this.select.ranges[0].end.row);
|
|
50407
|
+
if (this.fillHandle.beforeFillMinCol !== currentMinCol ||
|
|
50408
|
+
this.fillHandle.beforeFillMinRow !== currentMinRow ||
|
|
50409
|
+
this.fillHandle.beforeFillMaxCol !== currentMaxCol ||
|
|
50410
|
+
this.fillHandle.beforeFillMaxRow !== currentMaxRow) {
|
|
50411
|
+
this.table.eventManager.isDraging &&
|
|
50412
|
+
this.table.fireListeners(TABLE_EVENT_TYPE.DRAG_FILL_HANDLE_END, { direction: this.fillHandle.direction });
|
|
50413
|
+
}
|
|
50414
|
+
this.fillHandle.beforeFillMaxCol = undefined;
|
|
50415
|
+
this.fillHandle.beforeFillMaxRow = undefined;
|
|
50416
|
+
this.fillHandle.beforeFillMinCol = undefined;
|
|
50417
|
+
this.fillHandle.beforeFillMinRow = undefined;
|
|
50418
|
+
}
|
|
50094
50419
|
updateResizeCol(xInTable, yInTable) {
|
|
50095
50420
|
updateResizeColumn(xInTable, yInTable, this);
|
|
50096
50421
|
}
|
|
@@ -50136,13 +50461,44 @@
|
|
|
50136
50461
|
this.table.scenegraph.updateFrozenIcon(0, this.table.colCount - 1);
|
|
50137
50462
|
}
|
|
50138
50463
|
}
|
|
50464
|
+
checkVerticalScrollBarEnd() {
|
|
50465
|
+
const totalHeight = this.table.getAllRowsHeight();
|
|
50466
|
+
const scrollTop = this.scroll.verticalBarPos;
|
|
50467
|
+
const viewHeight = this.table.tableNoFrameHeight;
|
|
50468
|
+
if (scrollTop + viewHeight >= totalHeight) {
|
|
50469
|
+
this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL_VERTICAL_END, {
|
|
50470
|
+
scrollTop,
|
|
50471
|
+
scrollLeft: this.scroll.horizontalBarPos,
|
|
50472
|
+
scrollHeight: this.table.theme.scrollStyle?.width,
|
|
50473
|
+
scrollWidth: this.table.theme.scrollStyle?.width,
|
|
50474
|
+
viewHeight,
|
|
50475
|
+
viewWidth: this.table.tableNoFrameWidth
|
|
50476
|
+
});
|
|
50477
|
+
}
|
|
50478
|
+
}
|
|
50479
|
+
checkHorizontalScrollBarEnd() {
|
|
50480
|
+
const totalWidth = this.table.getAllColsWidth();
|
|
50481
|
+
const scrollLeft = this.scroll.horizontalBarPos;
|
|
50482
|
+
const viewWidth = this.table.tableNoFrameWidth;
|
|
50483
|
+
if (scrollLeft + viewWidth >= totalWidth) {
|
|
50484
|
+
this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL_HORIZONTAL_END, {
|
|
50485
|
+
scrollTop: this.scroll.verticalBarPos,
|
|
50486
|
+
scrollLeft,
|
|
50487
|
+
scrollHeight: this.table.theme.scrollStyle?.width,
|
|
50488
|
+
scrollWidth: this.table.theme.scrollStyle?.width,
|
|
50489
|
+
viewHeight: this.table.tableNoFrameHeight,
|
|
50490
|
+
viewWidth
|
|
50491
|
+
});
|
|
50492
|
+
}
|
|
50493
|
+
}
|
|
50139
50494
|
updateVerticalScrollBar(yRatio) {
|
|
50140
50495
|
const totalHeight = this.table.getAllRowsHeight();
|
|
50496
|
+
const oldVerticalBarPos = this.scroll.verticalBarPos;
|
|
50141
50497
|
this.scroll.verticalBarPos = Math.ceil(yRatio * (totalHeight - this.table.scenegraph.height));
|
|
50142
50498
|
this.table.scenegraph.setY(-this.scroll.verticalBarPos, yRatio === 1);
|
|
50143
50499
|
this.scroll.verticalBarPos -= this.table.scenegraph.proxy.deltaY;
|
|
50144
50500
|
this.table.scenegraph.proxy.deltaY = 0;
|
|
50145
|
-
this.
|
|
50501
|
+
this.updateHoverPos(-1, -1);
|
|
50146
50502
|
this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL, {
|
|
50147
50503
|
scrollTop: this.scroll.verticalBarPos,
|
|
50148
50504
|
scrollLeft: this.scroll.horizontalBarPos,
|
|
@@ -50153,14 +50509,18 @@
|
|
|
50153
50509
|
scrollDirection: 'vertical',
|
|
50154
50510
|
scrollRatioY: yRatio
|
|
50155
50511
|
});
|
|
50512
|
+
if (oldVerticalBarPos !== this.scroll.verticalBarPos) {
|
|
50513
|
+
this.checkVerticalScrollBarEnd();
|
|
50514
|
+
}
|
|
50156
50515
|
}
|
|
50157
50516
|
updateHorizontalScrollBar(xRatio) {
|
|
50158
50517
|
const totalWidth = this.table.getAllColsWidth();
|
|
50518
|
+
const oldHorizontalBarPos = this.scroll.horizontalBarPos;
|
|
50159
50519
|
this.scroll.horizontalBarPos = Math.ceil(xRatio * (totalWidth - this.table.scenegraph.width));
|
|
50160
50520
|
this.table.scenegraph.setX(-this.scroll.horizontalBarPos, xRatio === 1);
|
|
50161
50521
|
this.scroll.horizontalBarPos -= this.table.scenegraph.proxy.deltaX;
|
|
50162
50522
|
this.table.scenegraph.proxy.deltaX = 0;
|
|
50163
|
-
this.
|
|
50523
|
+
this.updateHoverPos(-1, -1);
|
|
50164
50524
|
this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL, {
|
|
50165
50525
|
scrollTop: this.scroll.verticalBarPos,
|
|
50166
50526
|
scrollLeft: this.scroll.horizontalBarPos,
|
|
@@ -50171,14 +50531,18 @@
|
|
|
50171
50531
|
scrollDirection: 'horizontal',
|
|
50172
50532
|
scrollRatioX: xRatio
|
|
50173
50533
|
});
|
|
50534
|
+
if (oldHorizontalBarPos !== this.scroll.horizontalBarPos) {
|
|
50535
|
+
this.checkHorizontalScrollBarEnd();
|
|
50536
|
+
}
|
|
50174
50537
|
}
|
|
50175
50538
|
setScrollTop(top) {
|
|
50176
50539
|
const totalHeight = this.table.getAllRowsHeight();
|
|
50177
50540
|
top = Math.max(0, Math.min(top, totalHeight - this.table.scenegraph.height));
|
|
50178
50541
|
top = Math.ceil(top);
|
|
50179
50542
|
if (top !== this.scroll.verticalBarPos || this.table.isPivotChart()) {
|
|
50180
|
-
this.
|
|
50543
|
+
this.updateHoverPos(-1, -1);
|
|
50181
50544
|
}
|
|
50545
|
+
const oldVerticalBarPos = this.scroll.verticalBarPos;
|
|
50182
50546
|
this.scroll.verticalBarPos = top;
|
|
50183
50547
|
this.table.scenegraph.setY(-top);
|
|
50184
50548
|
const yRatio = top / (totalHeight - this.table.scenegraph.height);
|
|
@@ -50193,6 +50557,9 @@
|
|
|
50193
50557
|
scrollDirection: 'vertical',
|
|
50194
50558
|
scrollRatioY: yRatio
|
|
50195
50559
|
});
|
|
50560
|
+
if (oldVerticalBarPos !== top) {
|
|
50561
|
+
this.checkVerticalScrollBarEnd();
|
|
50562
|
+
}
|
|
50196
50563
|
}
|
|
50197
50564
|
setScrollLeft(left) {
|
|
50198
50565
|
const totalWidth = this.table.getAllColsWidth();
|
|
@@ -50200,8 +50567,9 @@
|
|
|
50200
50567
|
left = Math.max(0, Math.min(left, totalWidth - this.table.scenegraph.width));
|
|
50201
50568
|
left = Math.ceil(left);
|
|
50202
50569
|
if (left !== this.scroll.horizontalBarPos) {
|
|
50203
|
-
this.
|
|
50570
|
+
this.updateHoverPos(-1, -1);
|
|
50204
50571
|
}
|
|
50572
|
+
const oldHorizontalBarPos = this.scroll.horizontalBarPos;
|
|
50205
50573
|
this.scroll.horizontalBarPos = left;
|
|
50206
50574
|
this.table.scenegraph.setX(-left);
|
|
50207
50575
|
const xRatio = left / (totalWidth - this.table.scenegraph.width);
|
|
@@ -50216,6 +50584,9 @@
|
|
|
50216
50584
|
scrollDirection: 'horizontal',
|
|
50217
50585
|
scrollRatioX: xRatio
|
|
50218
50586
|
});
|
|
50587
|
+
if (oldHorizontalBarPos !== left) {
|
|
50588
|
+
this.checkHorizontalScrollBarEnd();
|
|
50589
|
+
}
|
|
50219
50590
|
}
|
|
50220
50591
|
hideVerticalScrollBar() {
|
|
50221
50592
|
this.table.scenegraph.component.hideVerticalScrollBar();
|
|
@@ -50834,6 +51205,9 @@
|
|
|
50834
51205
|
else if (stateManager.isMoveCol()) {
|
|
50835
51206
|
eventManager.dealColumnMover(eventArgsSet);
|
|
50836
51207
|
}
|
|
51208
|
+
else if (stateManager.isFillHandle()) {
|
|
51209
|
+
eventManager.dealFillSelect(eventArgsSet, true);
|
|
51210
|
+
}
|
|
50837
51211
|
else {
|
|
50838
51212
|
eventManager.dealTableSelect(eventArgsSet, true);
|
|
50839
51213
|
}
|
|
@@ -50841,7 +51215,12 @@
|
|
|
50841
51215
|
return;
|
|
50842
51216
|
}
|
|
50843
51217
|
if (stateManager.isResizeCol() || eventManager.checkColumnResize(eventArgsSet)) {
|
|
50844
|
-
stateManager.
|
|
51218
|
+
if (table.stateManager.select && eventManager.checkCellFillhandle(eventArgsSet)) {
|
|
51219
|
+
stateManager.updateCursor('crosshair');
|
|
51220
|
+
}
|
|
51221
|
+
else {
|
|
51222
|
+
stateManager.updateCursor('col-resize');
|
|
51223
|
+
}
|
|
50845
51224
|
}
|
|
50846
51225
|
else {
|
|
50847
51226
|
stateManager.updateCursor();
|
|
@@ -51076,7 +51455,7 @@
|
|
|
51076
51455
|
eventManager.dealTableHover(eventArgsSet);
|
|
51077
51456
|
}
|
|
51078
51457
|
else {
|
|
51079
|
-
if (eventManager.checkColumnResize(eventArgsSet, true)) {
|
|
51458
|
+
if (!eventManager.checkCellFillhandle(eventArgsSet) && eventManager.checkColumnResize(eventArgsSet, true)) {
|
|
51080
51459
|
table.scenegraph.updateChartState(null);
|
|
51081
51460
|
stateManager.updateInteractionState(InteractionState.grabing);
|
|
51082
51461
|
return;
|
|
@@ -51085,6 +51464,10 @@
|
|
|
51085
51464
|
stateManager.updateInteractionState(InteractionState.grabing);
|
|
51086
51465
|
return;
|
|
51087
51466
|
}
|
|
51467
|
+
if (eventManager.checkCellFillhandle(eventArgsSet, true) && eventManager.dealFillSelect(eventArgsSet)) {
|
|
51468
|
+
stateManager.updateInteractionState(InteractionState.grabing);
|
|
51469
|
+
return;
|
|
51470
|
+
}
|
|
51088
51471
|
if (eventManager.dealTableSelect(eventArgsSet)) {
|
|
51089
51472
|
stateManager.updateInteractionState(InteractionState.grabing);
|
|
51090
51473
|
}
|
|
@@ -51130,8 +51513,13 @@
|
|
|
51130
51513
|
}
|
|
51131
51514
|
else if (stateManager.isSelecting()) {
|
|
51132
51515
|
table.stateManager.endSelectCells();
|
|
51516
|
+
if (table.stateManager.isFillHandle()) {
|
|
51517
|
+
table.stateManager.endFillSelect();
|
|
51518
|
+
}
|
|
51133
51519
|
const eventArgsSet = getCellEventArgsSet(e);
|
|
51134
|
-
if (
|
|
51520
|
+
if (table.eventManager.isDraging &&
|
|
51521
|
+
eventArgsSet.eventArgs &&
|
|
51522
|
+
table.hasListeners(TABLE_EVENT_TYPE.DRAG_SELECT_END)) {
|
|
51135
51523
|
const cellsEvent = {
|
|
51136
51524
|
event: e.nativeEvent,
|
|
51137
51525
|
cells: [],
|
|
@@ -51727,84 +52115,13 @@
|
|
|
51727
52115
|
return;
|
|
51728
52116
|
}
|
|
51729
52117
|
if (table.stateManager.select.ranges?.length > 0) {
|
|
51730
|
-
const ranges = table.stateManager.select.ranges;
|
|
51731
|
-
const col = Math.min(ranges[0].start.col, ranges[0].end.col);
|
|
51732
|
-
const row = Math.min(ranges[0].start.row, ranges[0].end.row);
|
|
51733
|
-
const values = [];
|
|
51734
52118
|
navigator.clipboard.read().then(clipboardItems => {
|
|
51735
52119
|
for (const item of clipboardItems) {
|
|
51736
52120
|
if (item.types.includes('text/html')) {
|
|
51737
|
-
item
|
|
51738
|
-
blob.text().then(pastedData => {
|
|
51739
|
-
if (pastedData && /(<table)|(<TABLE)/g.test(pastedData)) {
|
|
51740
|
-
const regex = /<tr[^>]*>(.*?)<\/tr>/gs;
|
|
51741
|
-
const matches = Array.from(pastedData.matchAll(regex));
|
|
51742
|
-
for (const match of matches) {
|
|
51743
|
-
const rowContent = match[1];
|
|
51744
|
-
const cellRegex = /<td[^>]*>(.*?)<\/td>/gs;
|
|
51745
|
-
const cellMatches = Array.from(rowContent.matchAll(cellRegex));
|
|
51746
|
-
const rowValues = cellMatches.map(cellMatch => {
|
|
51747
|
-
return (cellMatch[1]
|
|
51748
|
-
.replace(/(<(?!br)([^>]+)>)/gi, '')
|
|
51749
|
-
.replace(/<br(\s*|\/)>[\r\n]?/gim, '\n')
|
|
51750
|
-
.replace(/&/g, '&')
|
|
51751
|
-
.replace(/</g, '<')
|
|
51752
|
-
.replace(/>/g, '>')
|
|
51753
|
-
.replace(/	/gi, '\t')
|
|
51754
|
-
.replace(/ /g, ' '));
|
|
51755
|
-
});
|
|
51756
|
-
values.push(rowValues);
|
|
51757
|
-
}
|
|
51758
|
-
table.changeCellValues(col, row, values, true);
|
|
51759
|
-
}
|
|
51760
|
-
else {
|
|
51761
|
-
navigator.clipboard.read().then(clipboardItems => {
|
|
51762
|
-
for (const item of clipboardItems) {
|
|
51763
|
-
if (item.types.includes('text/plain')) {
|
|
51764
|
-
item.getType('text/plain').then(blob => {
|
|
51765
|
-
blob.text().then(pastedData => {
|
|
51766
|
-
const rows = pastedData.split('\n');
|
|
51767
|
-
rows.forEach(function (rowCells, rowIndex) {
|
|
51768
|
-
const cells = rowCells.split('\t');
|
|
51769
|
-
const rowValues = [];
|
|
51770
|
-
values.push(rowValues);
|
|
51771
|
-
cells.forEach(function (cell, cellIndex) {
|
|
51772
|
-
if (cellIndex === cells.length - 1) {
|
|
51773
|
-
cell = cell.trim();
|
|
51774
|
-
}
|
|
51775
|
-
rowValues.push(cell);
|
|
51776
|
-
});
|
|
51777
|
-
});
|
|
51778
|
-
table.changeCellValues(col, row, values, true);
|
|
51779
|
-
});
|
|
51780
|
-
});
|
|
51781
|
-
}
|
|
51782
|
-
}
|
|
51783
|
-
});
|
|
51784
|
-
}
|
|
51785
|
-
});
|
|
51786
|
-
});
|
|
52121
|
+
pasteHtmlToTable(item);
|
|
51787
52122
|
}
|
|
51788
52123
|
else if (item.types.length === 1 && item.types[0] === 'text/plain') {
|
|
51789
|
-
item
|
|
51790
|
-
blob.text().then(pastedData => {
|
|
51791
|
-
const rows = pastedData.replace(/\r(?!\n)/g, '\r\n').split('\r\n');
|
|
51792
|
-
if (rows.length > 1 && rows[rows.length - 1] === '') {
|
|
51793
|
-
rows.pop();
|
|
51794
|
-
}
|
|
51795
|
-
rows.forEach(function (rowCells, rowIndex) {
|
|
51796
|
-
const cells = rowCells.split('\t');
|
|
51797
|
-
cells.forEach(function (cell, cellIndex) {
|
|
51798
|
-
if (cell.includes('\n')) {
|
|
51799
|
-
cell = cell
|
|
51800
|
-
.replace(/^"(.*)"$/, '$1')
|
|
51801
|
-
.replace(/["]*/g, match => new Array(Math.floor(match.length / 2)).fill('"').join(''));
|
|
51802
|
-
}
|
|
51803
|
-
});
|
|
51804
|
-
});
|
|
51805
|
-
});
|
|
51806
|
-
});
|
|
51807
|
-
table.changeCellValues(col, row, values, true);
|
|
52124
|
+
pasteTextToTable(item);
|
|
51808
52125
|
}
|
|
51809
52126
|
else ;
|
|
51810
52127
|
}
|
|
@@ -51823,6 +52140,138 @@
|
|
|
51823
52140
|
}
|
|
51824
52141
|
table.resize();
|
|
51825
52142
|
});
|
|
52143
|
+
function pasteHtmlToTable(item) {
|
|
52144
|
+
const ranges = table.stateManager.select.ranges;
|
|
52145
|
+
const selectRangeLength = ranges.length;
|
|
52146
|
+
const col = Math.min(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col);
|
|
52147
|
+
const row = Math.min(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
|
|
52148
|
+
const maxCol = Math.max(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col);
|
|
52149
|
+
const maxRow = Math.max(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
|
|
52150
|
+
let pasteValuesColCount = 0;
|
|
52151
|
+
let pasteValuesRowCount = 0;
|
|
52152
|
+
let values = [];
|
|
52153
|
+
item.getType('text/html').then((blob) => {
|
|
52154
|
+
blob.text().then((pastedData) => {
|
|
52155
|
+
if (pastedData && /(<table)|(<TABLE)/g.test(pastedData)) {
|
|
52156
|
+
const regex = /<tr[^>]*>(.*?)<\/tr>/gs;
|
|
52157
|
+
const matches = Array.from(pastedData.matchAll(regex));
|
|
52158
|
+
for (const match of matches) {
|
|
52159
|
+
const rowContent = match[1];
|
|
52160
|
+
const cellRegex = /<td[^>]*>(.*?)<\/td>/gs;
|
|
52161
|
+
const cellMatches = Array.from(rowContent.matchAll(cellRegex));
|
|
52162
|
+
const rowValues = cellMatches.map(cellMatch => {
|
|
52163
|
+
return (cellMatch[1]
|
|
52164
|
+
.replace(/(<(?!br)([^>]+)>)/gi, '')
|
|
52165
|
+
.replace(/<br(\s*|\/)>[\r\n]?/gim, '\n')
|
|
52166
|
+
.replace(/&/g, '&')
|
|
52167
|
+
.replace(/</g, '<')
|
|
52168
|
+
.replace(/>/g, '>')
|
|
52169
|
+
.replace(/	/gi, '\t')
|
|
52170
|
+
.replace(/ /g, ' '));
|
|
52171
|
+
});
|
|
52172
|
+
values.push(rowValues);
|
|
52173
|
+
pasteValuesColCount = Math.max(pasteValuesColCount, rowValues?.length ?? 0);
|
|
52174
|
+
}
|
|
52175
|
+
pasteValuesRowCount = values.length ?? 0;
|
|
52176
|
+
values = handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1);
|
|
52177
|
+
table.changeCellValues(col, row, values, true);
|
|
52178
|
+
}
|
|
52179
|
+
else {
|
|
52180
|
+
navigator.clipboard.read().then(clipboardItems => {
|
|
52181
|
+
for (const item of clipboardItems) {
|
|
52182
|
+
if (item.types.includes('text/plain')) {
|
|
52183
|
+
item.getType('text/plain').then((blob) => {
|
|
52184
|
+
blob.text().then(_pasteValue);
|
|
52185
|
+
});
|
|
52186
|
+
}
|
|
52187
|
+
}
|
|
52188
|
+
});
|
|
52189
|
+
}
|
|
52190
|
+
});
|
|
52191
|
+
});
|
|
52192
|
+
}
|
|
52193
|
+
function _pasteValue(pastedData) {
|
|
52194
|
+
const ranges = table.stateManager.select.ranges;
|
|
52195
|
+
const selectRangeLength = ranges.length;
|
|
52196
|
+
const col = Math.min(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col);
|
|
52197
|
+
const row = Math.min(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
|
|
52198
|
+
const maxCol = Math.max(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col);
|
|
52199
|
+
const maxRow = Math.max(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
|
|
52200
|
+
let pasteValuesColCount = 0;
|
|
52201
|
+
let pasteValuesRowCount = 0;
|
|
52202
|
+
let values = [];
|
|
52203
|
+
const rows = pastedData.split('\n');
|
|
52204
|
+
rows.forEach(function (rowCells, rowIndex) {
|
|
52205
|
+
const cells = rowCells.split('\t');
|
|
52206
|
+
const rowValues = [];
|
|
52207
|
+
values.push(rowValues);
|
|
52208
|
+
cells.forEach(function (cell, cellIndex) {
|
|
52209
|
+
if (cellIndex === cells.length - 1) {
|
|
52210
|
+
cell = cell.trim();
|
|
52211
|
+
}
|
|
52212
|
+
rowValues.push(cell);
|
|
52213
|
+
});
|
|
52214
|
+
pasteValuesColCount = Math.max(pasteValuesColCount, rowValues?.length ?? 0);
|
|
52215
|
+
});
|
|
52216
|
+
pasteValuesRowCount = values.length ?? 0;
|
|
52217
|
+
values = handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1);
|
|
52218
|
+
table.changeCellValues(col, row, values, true);
|
|
52219
|
+
}
|
|
52220
|
+
function pasteTextToTable(item) {
|
|
52221
|
+
const ranges = table.stateManager.select.ranges;
|
|
52222
|
+
const selectRangeLength = ranges.length;
|
|
52223
|
+
const col = Math.min(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col);
|
|
52224
|
+
const row = Math.min(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
|
|
52225
|
+
const maxCol = Math.max(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col);
|
|
52226
|
+
const maxRow = Math.max(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
|
|
52227
|
+
let pasteValuesColCount = 0;
|
|
52228
|
+
let pasteValuesRowCount = 0;
|
|
52229
|
+
item.getType('text/plain').then((blob) => {
|
|
52230
|
+
blob.text().then((pastedData) => {
|
|
52231
|
+
const rows = pastedData.replace(/\r(?!\n)/g, '\r\n').split('\r\n');
|
|
52232
|
+
let values = [];
|
|
52233
|
+
if (rows.length > 1 && rows[rows.length - 1] === '') {
|
|
52234
|
+
rows.pop();
|
|
52235
|
+
}
|
|
52236
|
+
rows.forEach(function (rowCells, rowIndex) {
|
|
52237
|
+
const cells = rowCells.split('\t');
|
|
52238
|
+
const rowValues = [];
|
|
52239
|
+
values.push(rowValues);
|
|
52240
|
+
cells.forEach(function (cell, cellIndex) {
|
|
52241
|
+
if (cell.includes('\n')) {
|
|
52242
|
+
cell = cell
|
|
52243
|
+
.replace(/^"(.*)"$/, '$1')
|
|
52244
|
+
.replace(/["]*/g, match => new Array(Math.floor(match.length / 2)).fill('"').join(''));
|
|
52245
|
+
}
|
|
52246
|
+
rowValues.push(cell);
|
|
52247
|
+
});
|
|
52248
|
+
pasteValuesColCount = Math.max(pasteValuesColCount, rowValues?.length ?? 0);
|
|
52249
|
+
});
|
|
52250
|
+
pasteValuesRowCount = values.length ?? 0;
|
|
52251
|
+
values = handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1);
|
|
52252
|
+
table.changeCellValues(col, row, values, true);
|
|
52253
|
+
});
|
|
52254
|
+
});
|
|
52255
|
+
}
|
|
52256
|
+
function handlePasteValues(values, rowCount, colCount, selectedRowCount, selectedColCount) {
|
|
52257
|
+
if (selectedColCount > colCount || selectedRowCount > rowCount) {
|
|
52258
|
+
if (selectedColCount % colCount === 0 && selectedRowCount % rowCount === 0) {
|
|
52259
|
+
const toPasteValues = [];
|
|
52260
|
+
for (let i = 0; i < selectedRowCount; i++) {
|
|
52261
|
+
const rowPasteValue = [];
|
|
52262
|
+
toPasteValues.push(rowPasteValue);
|
|
52263
|
+
for (let j = 0; j < selectedColCount; j++) {
|
|
52264
|
+
const copiedRow = i % rowCount;
|
|
52265
|
+
const copiedCol = j % colCount;
|
|
52266
|
+
rowPasteValue.push(values[copiedRow][copiedCol]);
|
|
52267
|
+
}
|
|
52268
|
+
}
|
|
52269
|
+
return toPasteValues;
|
|
52270
|
+
}
|
|
52271
|
+
return values;
|
|
52272
|
+
}
|
|
52273
|
+
return values;
|
|
52274
|
+
}
|
|
51826
52275
|
const globalPointerdownCallback = (e) => {
|
|
51827
52276
|
table.eventManager.LastBodyPointerXY = { x: e.x, y: e.y };
|
|
51828
52277
|
table.eventManager.isDown = true;
|
|
@@ -52212,7 +52661,10 @@
|
|
|
52212
52661
|
if (e.federatedEvent) {
|
|
52213
52662
|
const eventArgsSet = getCellEventArgsSet(e.federatedEvent);
|
|
52214
52663
|
const resizeCol = this.table.scenegraph.getResizeColAt(eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y, eventArgsSet.eventArgs?.targetCell);
|
|
52215
|
-
if (this.table.
|
|
52664
|
+
if (this.table.eventManager.checkCellFillhandle(eventArgsSet)) {
|
|
52665
|
+
this.table.fireListeners(TABLE_EVENT_TYPE.DBLCLICK_FILL_HANDLE, {});
|
|
52666
|
+
}
|
|
52667
|
+
else if (this.table._canResizeColumn(resizeCol.col, resizeCol.row) && resizeCol.col >= 0) {
|
|
52216
52668
|
this.table.scenegraph.updateAutoColWidth(resizeCol.col);
|
|
52217
52669
|
this.table.internalProps._widthResizedColMap.add(resizeCol.col);
|
|
52218
52670
|
this.table.scenegraph.updateChartSize(resizeCol.col);
|
|
@@ -52298,6 +52750,58 @@
|
|
|
52298
52750
|
}
|
|
52299
52751
|
return false;
|
|
52300
52752
|
}
|
|
52753
|
+
dealFillSelect(eventArgsSet, isSelectMoving) {
|
|
52754
|
+
const { eventArgs } = eventArgsSet;
|
|
52755
|
+
if (eventArgs) {
|
|
52756
|
+
if (this.table.stateManager.select?.ranges?.length && this.table.stateManager.isFillHandle()) {
|
|
52757
|
+
let updateRow;
|
|
52758
|
+
let updateCol;
|
|
52759
|
+
const currentRange = this.table.stateManager.select.ranges[this.table.stateManager.select.ranges.length - 1];
|
|
52760
|
+
if (isSelectMoving) {
|
|
52761
|
+
if (!isValid$3(this.table.stateManager.fillHandle.directionRow)) {
|
|
52762
|
+
if (Math.abs(this.table.stateManager.fillHandle.startY - eventArgsSet.abstractPos.y) >=
|
|
52763
|
+
Math.abs(this.table.stateManager.fillHandle.startX - eventArgsSet.abstractPos.x)) {
|
|
52764
|
+
this.table.stateManager.fillHandle.directionRow = true;
|
|
52765
|
+
}
|
|
52766
|
+
else {
|
|
52767
|
+
this.table.stateManager.fillHandle.directionRow = false;
|
|
52768
|
+
}
|
|
52769
|
+
}
|
|
52770
|
+
if (Math.abs(this.table.stateManager.fillHandle.startY - eventArgsSet.abstractPos.y) >=
|
|
52771
|
+
Math.abs(this.table.stateManager.fillHandle.startX - eventArgsSet.abstractPos.x)) {
|
|
52772
|
+
if (this.table.stateManager.fillHandle.startY - eventArgsSet.abstractPos.y > 0) {
|
|
52773
|
+
this.table.stateManager.fillHandle.direction = 'top';
|
|
52774
|
+
}
|
|
52775
|
+
else {
|
|
52776
|
+
this.table.stateManager.fillHandle.direction = 'bottom';
|
|
52777
|
+
}
|
|
52778
|
+
}
|
|
52779
|
+
else {
|
|
52780
|
+
if (this.table.stateManager.fillHandle.startX - eventArgsSet.abstractPos.x > 0) {
|
|
52781
|
+
this.table.stateManager.fillHandle.direction = 'left';
|
|
52782
|
+
}
|
|
52783
|
+
else {
|
|
52784
|
+
this.table.stateManager.fillHandle.direction = 'right';
|
|
52785
|
+
}
|
|
52786
|
+
}
|
|
52787
|
+
if (this.table.stateManager.fillHandle.directionRow) {
|
|
52788
|
+
updateRow = eventArgs.row;
|
|
52789
|
+
updateCol = currentRange.end.col;
|
|
52790
|
+
}
|
|
52791
|
+
else {
|
|
52792
|
+
updateRow = currentRange.end.row;
|
|
52793
|
+
updateCol = eventArgs.col;
|
|
52794
|
+
}
|
|
52795
|
+
}
|
|
52796
|
+
this.table.stateManager.updateSelectPos(isSelectMoving ? updateCol : currentRange.end.col, isSelectMoving ? updateRow : currentRange.end.row, true, eventArgs.event.ctrlKey || eventArgs.event.metaKey);
|
|
52797
|
+
}
|
|
52798
|
+
else {
|
|
52799
|
+
this.table.stateManager.updateSelectPos(eventArgs.col, eventArgs.row, eventArgs.event.shiftKey, eventArgs.event.ctrlKey || eventArgs.event.metaKey);
|
|
52800
|
+
}
|
|
52801
|
+
return true;
|
|
52802
|
+
}
|
|
52803
|
+
return false;
|
|
52804
|
+
}
|
|
52301
52805
|
deelTableSelectAll() {
|
|
52302
52806
|
this.table.stateManager.updateSelectPos(-1, -1, false, false, true);
|
|
52303
52807
|
}
|
|
@@ -52316,6 +52820,29 @@
|
|
|
52316
52820
|
}
|
|
52317
52821
|
return false;
|
|
52318
52822
|
}
|
|
52823
|
+
checkCellFillhandle(eventArgsSet, update) {
|
|
52824
|
+
if (this.table.options.excelOptions?.fillHandle) {
|
|
52825
|
+
const { eventArgs } = eventArgsSet;
|
|
52826
|
+
if (eventArgs) {
|
|
52827
|
+
if (this.table.stateManager.select?.ranges?.length) {
|
|
52828
|
+
const lastCol = Math.max(this.table.stateManager.select.ranges[this.table.stateManager.select.ranges.length - 1].start.col, this.table.stateManager.select.ranges[this.table.stateManager.select.ranges.length - 1].end.col);
|
|
52829
|
+
const lastRow = Math.max(this.table.stateManager.select.ranges[this.table.stateManager.select.ranges.length - 1].start.row, this.table.stateManager.select.ranges[this.table.stateManager.select.ranges.length - 1].end.row);
|
|
52830
|
+
const lastCellBound = this.table.scenegraph.highPerformanceGetCell(lastCol, lastRow).globalAABBBounds;
|
|
52831
|
+
const distanceX = Math.abs(eventArgsSet.abstractPos.x - lastCellBound.x2);
|
|
52832
|
+
const distanceY = Math.abs(eventArgsSet.abstractPos.y - lastCellBound.y2);
|
|
52833
|
+
const squareSize = 6 * 3;
|
|
52834
|
+
if (this.table.stateManager.fillHandle?.isFilling ||
|
|
52835
|
+
(distanceX <= squareSize / 2 && distanceY <= squareSize / 2)) {
|
|
52836
|
+
if (update) {
|
|
52837
|
+
this.table.stateManager.startFillSelect(eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y);
|
|
52838
|
+
}
|
|
52839
|
+
return true;
|
|
52840
|
+
}
|
|
52841
|
+
}
|
|
52842
|
+
}
|
|
52843
|
+
}
|
|
52844
|
+
return false;
|
|
52845
|
+
}
|
|
52319
52846
|
dealColumnResize(xInTable, yInTable) {
|
|
52320
52847
|
this.table.stateManager.updateResizeCol(xInTable, yInTable);
|
|
52321
52848
|
}
|
|
@@ -55606,7 +56133,7 @@
|
|
|
55606
56133
|
return TABLE_EVENT_TYPE;
|
|
55607
56134
|
}
|
|
55608
56135
|
options;
|
|
55609
|
-
version = "0.
|
|
56136
|
+
version = "0.23.0";
|
|
55610
56137
|
pagination;
|
|
55611
56138
|
id = `VTable${Date.now()}`;
|
|
55612
56139
|
headerStyleCache;
|
|
@@ -57843,6 +58370,13 @@
|
|
|
57843
58370
|
}
|
|
57844
58371
|
return cellInfoArray;
|
|
57845
58372
|
}
|
|
58373
|
+
getSelectedCellRanges() {
|
|
58374
|
+
const ranges = this.stateManager.select.ranges;
|
|
58375
|
+
if (!ranges.length) {
|
|
58376
|
+
return [];
|
|
58377
|
+
}
|
|
58378
|
+
return cloneDeep(ranges);
|
|
58379
|
+
}
|
|
57846
58380
|
measureText(text, font) {
|
|
57847
58381
|
return textMeasure.measureText(text, font);
|
|
57848
58382
|
}
|
|
@@ -59245,11 +59779,32 @@
|
|
|
59245
59779
|
get hasAggregationOnBottomCount() {
|
|
59246
59780
|
return this._hasAggregationOnBottomCount;
|
|
59247
59781
|
}
|
|
59248
|
-
|
|
59782
|
+
getAggregatorsByCell(col, row) {
|
|
59249
59783
|
const column = this.getBody(col, row);
|
|
59250
59784
|
const aggregators = column.aggregator;
|
|
59251
59785
|
return aggregators;
|
|
59252
59786
|
}
|
|
59787
|
+
getAggregatorsByCellRange(startCol, startRow, endCol, endRow) {
|
|
59788
|
+
let aggregators = [];
|
|
59789
|
+
if (this.transpose) {
|
|
59790
|
+
for (let i = startRow; i <= endRow; i++) {
|
|
59791
|
+
const column = this.getBody(startCol, i);
|
|
59792
|
+
if (column.aggregator) {
|
|
59793
|
+
aggregators = aggregators.concat(Array.isArray(column.aggregator) ? column.aggregator : [column.aggregator]);
|
|
59794
|
+
}
|
|
59795
|
+
}
|
|
59796
|
+
}
|
|
59797
|
+
else {
|
|
59798
|
+
for (let i = startCol; i <= endCol; i++) {
|
|
59799
|
+
const column = this.getBody(i, startRow);
|
|
59800
|
+
if (column.aggregator) {
|
|
59801
|
+
aggregators = aggregators.concat(Array.isArray(column.aggregator) ? column.aggregator : [column.aggregator]);
|
|
59802
|
+
}
|
|
59803
|
+
}
|
|
59804
|
+
return aggregators;
|
|
59805
|
+
}
|
|
59806
|
+
return [];
|
|
59807
|
+
}
|
|
59253
59808
|
getAggregatorOnTop(col, row) {
|
|
59254
59809
|
const column = this.getBody(col, row);
|
|
59255
59810
|
const aggregators = column.aggregator;
|
|
@@ -59300,26 +59855,34 @@
|
|
|
59300
59855
|
}
|
|
59301
59856
|
return null;
|
|
59302
59857
|
}
|
|
59303
|
-
|
|
59858
|
+
getAggregatorCellAddress(startCol, startRow, endCol, endRow) {
|
|
59304
59859
|
const cellAddrs = [];
|
|
59860
|
+
const topCount = this.hasAggregationOnTopCount;
|
|
59861
|
+
const bottomCount = this.hasAggregationOnBottomCount;
|
|
59305
59862
|
if (this.transpose) {
|
|
59306
|
-
|
|
59307
|
-
|
|
59308
|
-
|
|
59309
|
-
|
|
59310
|
-
|
|
59311
|
-
|
|
59312
|
-
|
|
59863
|
+
for (let row = startRow; row <= endRow; row++) {
|
|
59864
|
+
const column = this.getBody(startCol, row);
|
|
59865
|
+
if (column.aggregator) {
|
|
59866
|
+
for (let i = 0; i < topCount; i++) {
|
|
59867
|
+
cellAddrs.push({ col: this.headerLevelCount + i, row });
|
|
59868
|
+
}
|
|
59869
|
+
for (let i = 0; i < bottomCount; i++) {
|
|
59870
|
+
cellAddrs.push({ col: this.rowCount - bottomCount + i, row });
|
|
59871
|
+
}
|
|
59872
|
+
}
|
|
59313
59873
|
}
|
|
59314
59874
|
}
|
|
59315
59875
|
else {
|
|
59316
|
-
|
|
59317
|
-
|
|
59318
|
-
|
|
59319
|
-
|
|
59320
|
-
|
|
59321
|
-
|
|
59322
|
-
|
|
59876
|
+
for (let col = startCol; col <= endCol; col++) {
|
|
59877
|
+
const column = this.getBody(col, startRow);
|
|
59878
|
+
if (column.aggregator) {
|
|
59879
|
+
for (let i = 0; i < topCount; i++) {
|
|
59880
|
+
cellAddrs.push({ col, row: this.headerLevelCount + i });
|
|
59881
|
+
}
|
|
59882
|
+
for (let i = 0; i < bottomCount; i++) {
|
|
59883
|
+
cellAddrs.push({ col, row: this.rowCount - bottomCount + i });
|
|
59884
|
+
}
|
|
59885
|
+
}
|
|
59323
59886
|
}
|
|
59324
59887
|
}
|
|
59325
59888
|
return cellAddrs;
|
|
@@ -60124,12 +60687,8 @@
|
|
|
60124
60687
|
const addCellPositions = diffDataIndices.add.map(index => {
|
|
60125
60688
|
return { col: 0, row: this._table.frozenRowCount + index };
|
|
60126
60689
|
});
|
|
60127
|
-
const removeCellPositions =
|
|
60128
|
-
|
|
60129
|
-
if (this._table.frozenRowCount + index >= this._table.scenegraph.proxy.rowStart &&
|
|
60130
|
-
this._table.frozenRowCount + index <= this._table.scenegraph.proxy.rowEnd) {
|
|
60131
|
-
removeCellPositions.push({ col: 0, row: this._table.frozenRowCount + index });
|
|
60132
|
-
}
|
|
60690
|
+
const removeCellPositions = diffDataIndices.remove.map(index => {
|
|
60691
|
+
return { col: 0, row: this._table.frozenRowCount + index };
|
|
60133
60692
|
});
|
|
60134
60693
|
return {
|
|
60135
60694
|
addCellPositions,
|
|
@@ -60546,10 +61105,10 @@
|
|
|
60546
61105
|
return this.internalProps.sortState;
|
|
60547
61106
|
}
|
|
60548
61107
|
get records() {
|
|
60549
|
-
return this.dataSource?.
|
|
61108
|
+
return this.dataSource?.records;
|
|
60550
61109
|
}
|
|
60551
61110
|
get recordsCount() {
|
|
60552
|
-
return this.dataSource.
|
|
61111
|
+
return this.dataSource.records.length;
|
|
60553
61112
|
}
|
|
60554
61113
|
updateColumns(columns) {
|
|
60555
61114
|
const oldHoverState = { col: this.stateManager.hover.cellPos.col, row: this.stateManager.hover.cellPos.row };
|
|
@@ -61114,7 +61673,6 @@
|
|
|
61114
61673
|
}
|
|
61115
61674
|
updateFilterRules(filterRules) {
|
|
61116
61675
|
this.scenegraph.clearCells();
|
|
61117
|
-
this.internalProps.dataConfig.filterRules = filterRules;
|
|
61118
61676
|
if (this.sortState) {
|
|
61119
61677
|
this.dataSource.updateFilterRulesForSorted(filterRules);
|
|
61120
61678
|
sortRecords(this);
|
|
@@ -61263,69 +61821,72 @@
|
|
|
61263
61821
|
}
|
|
61264
61822
|
return isValid$3(editorDefine);
|
|
61265
61823
|
}
|
|
61266
|
-
changeCellValue(col, row, value) {
|
|
61267
|
-
|
|
61268
|
-
|
|
61269
|
-
|
|
61270
|
-
|
|
61271
|
-
this.
|
|
61272
|
-
|
|
61273
|
-
else {
|
|
61274
|
-
this.dataSource.changeFieldValue(value, recordIndex, field, col, row, this);
|
|
61275
|
-
}
|
|
61276
|
-
const aggregators = this.internalProps.layoutMap.getAggregators(col, row);
|
|
61277
|
-
if (aggregators) {
|
|
61278
|
-
if (Array.isArray(aggregators)) {
|
|
61279
|
-
for (let i = 0; i < aggregators?.length; i++) {
|
|
61280
|
-
aggregators[i].recalculate();
|
|
61281
|
-
}
|
|
61824
|
+
changeCellValue(col, row, value, workOnEditableCell = false) {
|
|
61825
|
+
if ((workOnEditableCell && this.isHasEditorDefine(col, row)) || workOnEditableCell === false) {
|
|
61826
|
+
const recordIndex = this.getRecordShowIndexByCell(col, row);
|
|
61827
|
+
const { field } = this.internalProps.layoutMap.getBody(col, row);
|
|
61828
|
+
const beforeChangeValue = this.getCellRawValue(col, row);
|
|
61829
|
+
if (this.isHeader(col, row)) {
|
|
61830
|
+
this.internalProps.layoutMap.updateColumnTitle(col, row, value);
|
|
61282
61831
|
}
|
|
61283
61832
|
else {
|
|
61284
|
-
|
|
61285
|
-
}
|
|
61286
|
-
const
|
|
61287
|
-
|
|
61288
|
-
|
|
61289
|
-
|
|
61290
|
-
for (let
|
|
61291
|
-
|
|
61833
|
+
this.dataSource.changeFieldValue(value, recordIndex, field, col, row, this);
|
|
61834
|
+
}
|
|
61835
|
+
const range = this.getCellRange(col, row);
|
|
61836
|
+
const aggregators = this.internalProps.layoutMap.getAggregatorsByCell(col, row);
|
|
61837
|
+
if (aggregators) {
|
|
61838
|
+
if (Array.isArray(aggregators)) {
|
|
61839
|
+
for (let i = 0; i < aggregators?.length; i++) {
|
|
61840
|
+
aggregators[i].recalculate();
|
|
61841
|
+
}
|
|
61842
|
+
}
|
|
61843
|
+
else {
|
|
61844
|
+
aggregators.recalculate();
|
|
61845
|
+
}
|
|
61846
|
+
const aggregatorCells = this.internalProps.layoutMap.getAggregatorCellAddress(range.start.col, range.start.row, range.end.col, range.end.row);
|
|
61847
|
+
for (let i = 0; i < aggregatorCells.length; i++) {
|
|
61848
|
+
const range = this.getCellRange(aggregatorCells[i].col, aggregatorCells[i].row);
|
|
61849
|
+
for (let sCol = range.start.col; sCol <= range.end.col; sCol++) {
|
|
61850
|
+
for (let sRow = range.start.row; sRow <= range.end.row; sRow++) {
|
|
61851
|
+
this.scenegraph.updateCellContent(sCol, sRow);
|
|
61852
|
+
}
|
|
61292
61853
|
}
|
|
61293
61854
|
}
|
|
61294
61855
|
}
|
|
61295
|
-
|
|
61296
|
-
|
|
61297
|
-
|
|
61298
|
-
|
|
61299
|
-
this.scenegraph.updateCellContent(sCol, sRow);
|
|
61856
|
+
for (let sCol = range.start.col; sCol <= range.end.col; sCol++) {
|
|
61857
|
+
for (let sRow = range.start.row; sRow <= range.end.row; sRow++) {
|
|
61858
|
+
this.scenegraph.updateCellContent(sCol, sRow);
|
|
61859
|
+
}
|
|
61300
61860
|
}
|
|
61301
|
-
|
|
61302
|
-
|
|
61303
|
-
|
|
61304
|
-
|
|
61861
|
+
if (this.widthMode === 'adaptive' || (this.autoFillWidth && this.getAllColsWidth() <= this.tableNoFrameWidth)) {
|
|
61862
|
+
if (this.internalProps._widthResizedColMap.size === 0) {
|
|
61863
|
+
this.scenegraph.recalculateColWidths();
|
|
61864
|
+
}
|
|
61305
61865
|
}
|
|
61306
|
-
|
|
61307
|
-
|
|
61308
|
-
|
|
61309
|
-
|
|
61310
|
-
|
|
61311
|
-
|
|
61866
|
+
else if (!this.internalProps._widthResizedColMap.has(col)) {
|
|
61867
|
+
const oldWidth = this.getColWidth(col);
|
|
61868
|
+
const newWidth = computeColWidth(col, 0, this.rowCount - 1, this, false);
|
|
61869
|
+
if (newWidth !== oldWidth) {
|
|
61870
|
+
this.scenegraph.updateColWidth(col, newWidth - oldWidth);
|
|
61871
|
+
}
|
|
61312
61872
|
}
|
|
61873
|
+
if (this.heightMode === 'adaptive' ||
|
|
61874
|
+
(this.autoFillHeight && this.getAllRowsHeight() <= this.tableNoFrameHeight)) {
|
|
61875
|
+
this.scenegraph.recalculateRowHeights();
|
|
61876
|
+
}
|
|
61877
|
+
else if (this.heightMode === 'autoHeight') {
|
|
61878
|
+
const oldHeight = this.getRowHeight(row);
|
|
61879
|
+
const newHeight = computeRowHeight(row, 0, this.colCount - 1, this);
|
|
61880
|
+
this.scenegraph.updateRowHeight(row, newHeight - oldHeight);
|
|
61881
|
+
}
|
|
61882
|
+
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
|
|
61883
|
+
col,
|
|
61884
|
+
row,
|
|
61885
|
+
rawValue: beforeChangeValue,
|
|
61886
|
+
changedValue: this.getCellOriginValue(col, row)
|
|
61887
|
+
});
|
|
61888
|
+
this.scenegraph.updateNextFrame();
|
|
61313
61889
|
}
|
|
61314
|
-
if (this.heightMode === 'adaptive' || (this.autoFillHeight && this.getAllRowsHeight() <= this.tableNoFrameHeight)) {
|
|
61315
|
-
this.scenegraph.recalculateRowHeights();
|
|
61316
|
-
}
|
|
61317
|
-
else if (this.heightMode === 'autoHeight') {
|
|
61318
|
-
const oldHeight = this.getRowHeight(row);
|
|
61319
|
-
const newHeight = computeRowHeight(row, 0, this.colCount - 1, this);
|
|
61320
|
-
this.scenegraph.updateRowHeight(row, newHeight - oldHeight);
|
|
61321
|
-
}
|
|
61322
|
-
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
|
|
61323
|
-
col,
|
|
61324
|
-
row,
|
|
61325
|
-
rawValue: beforeChangeValue,
|
|
61326
|
-
changedValue: this.getCellOriginValue(col, row)
|
|
61327
|
-
});
|
|
61328
|
-
this.scenegraph.updateNextFrame();
|
|
61329
61890
|
}
|
|
61330
61891
|
changeCellValues(startCol, startRow, values, workOnEditableCell = false) {
|
|
61331
61892
|
let pasteColEnd = startCol;
|
|
@@ -61366,6 +61927,21 @@
|
|
|
61366
61927
|
}
|
|
61367
61928
|
const startRange = this.getCellRange(startCol, startRow);
|
|
61368
61929
|
const range = this.getCellRange(pasteColEnd, pasteRowEnd);
|
|
61930
|
+
const aggregators = this.internalProps.layoutMap.getAggregatorsByCellRange(startRange.start.col, startRange.start.row, range.end.col, range.end.row);
|
|
61931
|
+
if (aggregators) {
|
|
61932
|
+
for (let i = 0; i < aggregators?.length; i++) {
|
|
61933
|
+
aggregators[i].recalculate();
|
|
61934
|
+
}
|
|
61935
|
+
const aggregatorCells = this.internalProps.layoutMap.getAggregatorCellAddress(startRange.start.col, startRange.start.row, range.end.col, range.end.row);
|
|
61936
|
+
for (let i = 0; i < aggregatorCells.length; i++) {
|
|
61937
|
+
const range = this.getCellRange(aggregatorCells[i].col, aggregatorCells[i].row);
|
|
61938
|
+
for (let sCol = range.start.col; sCol <= range.end.col; sCol++) {
|
|
61939
|
+
for (let sRow = range.start.row; sRow <= range.end.row; sRow++) {
|
|
61940
|
+
this.scenegraph.updateCellContent(sCol, sRow);
|
|
61941
|
+
}
|
|
61942
|
+
}
|
|
61943
|
+
}
|
|
61944
|
+
}
|
|
61369
61945
|
for (let sCol = startRange.start.col; sCol <= range.end.col; sCol++) {
|
|
61370
61946
|
for (let sRow = startRange.start.row; sRow <= range.end.row; sRow++) {
|
|
61371
61947
|
this.scenegraph.updateCellContent(sCol, sRow);
|
|
@@ -66149,41 +66725,44 @@
|
|
|
66149
66725
|
}
|
|
66150
66726
|
return isValid$3(editorDefine);
|
|
66151
66727
|
}
|
|
66152
|
-
changeCellValue(col, row, value) {
|
|
66153
|
-
|
|
66154
|
-
|
|
66155
|
-
|
|
66156
|
-
|
|
66157
|
-
|
|
66158
|
-
this._changeCellValueToDataSet(col, row, newValue);
|
|
66159
|
-
this.scenegraph.updateCellContent(col, row);
|
|
66160
|
-
if (this.widthMode === 'adaptive' || (this.autoFillWidth && this.getAllColsWidth() <= this.tableNoFrameWidth)) {
|
|
66161
|
-
if (this.internalProps._widthResizedColMap.size === 0) {
|
|
66162
|
-
this.scenegraph.recalculateColWidths();
|
|
66728
|
+
changeCellValue(col, row, value, workOnEditableCell = false) {
|
|
66729
|
+
if ((workOnEditableCell && this.isHasEditorDefine(col, row)) || workOnEditableCell === false) {
|
|
66730
|
+
let newValue = value;
|
|
66731
|
+
const rawValue = this.getCellRawValue(col, row);
|
|
66732
|
+
if (typeof rawValue === 'number' && isAllDigits(value)) {
|
|
66733
|
+
newValue = parseFloat(value);
|
|
66163
66734
|
}
|
|
66164
|
-
|
|
66165
|
-
|
|
66166
|
-
|
|
66167
|
-
|
|
66168
|
-
|
|
66169
|
-
|
|
66735
|
+
this._changeCellValueToDataSet(col, row, newValue);
|
|
66736
|
+
this.scenegraph.updateCellContent(col, row);
|
|
66737
|
+
if (this.widthMode === 'adaptive' || (this.autoFillWidth && this.getAllColsWidth() <= this.tableNoFrameWidth)) {
|
|
66738
|
+
if (this.internalProps._widthResizedColMap.size === 0) {
|
|
66739
|
+
this.scenegraph.recalculateColWidths();
|
|
66740
|
+
}
|
|
66170
66741
|
}
|
|
66742
|
+
else if (!this.internalProps._widthResizedColMap.has(col)) {
|
|
66743
|
+
const oldWidth = this.getColWidth(col);
|
|
66744
|
+
const newWidth = computeColWidth(col, 0, this.rowCount - 1, this, false);
|
|
66745
|
+
if (newWidth !== oldWidth) {
|
|
66746
|
+
this.scenegraph.updateColWidth(col, newWidth - oldWidth);
|
|
66747
|
+
}
|
|
66748
|
+
}
|
|
66749
|
+
if (this.heightMode === 'adaptive' ||
|
|
66750
|
+
(this.autoFillHeight && this.getAllRowsHeight() <= this.tableNoFrameHeight)) {
|
|
66751
|
+
this.scenegraph.recalculateRowHeights();
|
|
66752
|
+
}
|
|
66753
|
+
else if (this.heightMode === 'autoHeight') {
|
|
66754
|
+
const oldHeight = this.getRowHeight(row);
|
|
66755
|
+
const newHeight = computeRowHeight(row, 0, this.colCount - 1, this);
|
|
66756
|
+
this.scenegraph.updateRowHeight(row, newHeight - oldHeight);
|
|
66757
|
+
}
|
|
66758
|
+
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
|
|
66759
|
+
col,
|
|
66760
|
+
row,
|
|
66761
|
+
rawValue: this.getCellRawValue(col, row),
|
|
66762
|
+
changedValue: newValue
|
|
66763
|
+
});
|
|
66764
|
+
this.scenegraph.updateNextFrame();
|
|
66171
66765
|
}
|
|
66172
|
-
if (this.heightMode === 'adaptive' || (this.autoFillHeight && this.getAllRowsHeight() <= this.tableNoFrameHeight)) {
|
|
66173
|
-
this.scenegraph.recalculateRowHeights();
|
|
66174
|
-
}
|
|
66175
|
-
else if (this.heightMode === 'autoHeight') {
|
|
66176
|
-
const oldHeight = this.getRowHeight(row);
|
|
66177
|
-
const newHeight = computeRowHeight(row, 0, this.colCount - 1, this);
|
|
66178
|
-
this.scenegraph.updateRowHeight(row, newHeight - oldHeight);
|
|
66179
|
-
}
|
|
66180
|
-
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
|
|
66181
|
-
col,
|
|
66182
|
-
row,
|
|
66183
|
-
rawValue: this.getCellRawValue(col, row),
|
|
66184
|
-
changedValue: newValue
|
|
66185
|
-
});
|
|
66186
|
-
this.scenegraph.updateNextFrame();
|
|
66187
66766
|
}
|
|
66188
66767
|
changeCellValues(startCol, startRow, values, workOnEditableCell = false) {
|
|
66189
66768
|
let pasteColEnd = startCol;
|
|
@@ -67720,7 +68299,7 @@
|
|
|
67720
68299
|
}
|
|
67721
68300
|
|
|
67722
68301
|
registerForVrender();
|
|
67723
|
-
const version = "0.
|
|
68302
|
+
const version = "0.23.0";
|
|
67724
68303
|
function getIcons() {
|
|
67725
68304
|
return get$2();
|
|
67726
68305
|
}
|