@visactor/vtable-calendar 1.22.11-alpha.3 → 1.22.11-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vtable-calendar.js +282 -44
- package/dist/vtable-calendar.min.js +1 -1
- package/package.json +3 -3
package/dist/vtable-calendar.js
CHANGED
|
@@ -34879,6 +34879,7 @@
|
|
|
34879
34879
|
AFTER_UPDATE_CELL_CONTENT_WIDTH: "after_update_cell_content_width",
|
|
34880
34880
|
AFTER_UPDATE_SELECT_BORDER_HEIGHT: "after_update_select_border_height",
|
|
34881
34881
|
CHANGE_CELL_VALUE: "change_cell_value",
|
|
34882
|
+
CHANGE_CELL_VALUES: "change_cell_values",
|
|
34882
34883
|
DRAG_FILL_HANDLE_END: "drag_fill_handle_end",
|
|
34883
34884
|
MOUSEDOWN_FILL_HANDLE: "mousedown_fill_handle",
|
|
34884
34885
|
DBLCLICK_FILL_HANDLE: "dblclick_fill_handle",
|
|
@@ -36991,6 +36992,24 @@
|
|
|
36991
36992
|
}
|
|
36992
36993
|
}
|
|
36993
36994
|
}
|
|
36995
|
+
changeFieldValueByRecordIndex(value, recordIndex, field, table) {
|
|
36996
|
+
var _a, _b, _c, _d;
|
|
36997
|
+
if (null === field) return;
|
|
36998
|
+
if (null == recordIndex) return;
|
|
36999
|
+
const rawKey = recordIndex.toString();
|
|
37000
|
+
if (!this.beforeChangedRecordsMap.has(rawKey)) {
|
|
37001
|
+
const rawRecords = Array.isArray(null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.records) ? this.dataSourceObj.records : null,
|
|
37002
|
+
originRecord = rawRecords ? Array.isArray(recordIndex) ? getValueFromDeepArray(rawRecords, recordIndex) : rawRecords[recordIndex] : void 0;
|
|
37003
|
+
this.beforeChangedRecordsMap.set(rawKey, null !== (_b = cloneDeep(originRecord, void 0, ["vtable_gantt_linkedFrom", "vtable_gantt_linkedTo"])) && void 0 !== _b ? _b : {});
|
|
37004
|
+
}
|
|
37005
|
+
if ("string" == typeof field || "number" == typeof field) {
|
|
37006
|
+
const beforeChangedValue = null === (_c = this.beforeChangedRecordsMap.get(rawKey)) || void 0 === _c ? void 0 : _c[field],
|
|
37007
|
+
rawRecords = Array.isArray(null === (_d = this.dataSourceObj) || void 0 === _d ? void 0 : _d.records) ? this.dataSourceObj.records : null,
|
|
37008
|
+
record = rawRecords ? Array.isArray(recordIndex) ? getValueFromDeepArray(rawRecords, recordIndex) : rawRecords[recordIndex] : void 0;
|
|
37009
|
+
let formatValue = value;
|
|
37010
|
+
"number" == typeof beforeChangedValue && isAllDigits(value) && (formatValue = parseFloat(value)), record ? record[field] = formatValue : rawRecords && "number" == typeof recordIndex && (rawRecords[recordIndex] = "Array" === this.addRecordRule ? [] : {}, rawRecords[recordIndex][field] = formatValue);
|
|
37011
|
+
}
|
|
37012
|
+
}
|
|
36994
37013
|
cacheBeforeChangedRecord(dataIndex, table) {
|
|
36995
37014
|
var _a;
|
|
36996
37015
|
if (!this.beforeChangedRecordsMap.has(dataIndex.toString())) {
|
|
@@ -37056,9 +37075,16 @@
|
|
|
37056
37075
|
}
|
|
37057
37076
|
}
|
|
37058
37077
|
adjustBeforeChangedRecordsMap(insertIndex, insertCount, type = "add") {
|
|
37059
|
-
|
|
37060
|
-
|
|
37061
|
-
|
|
37078
|
+
const delta = "add" === type ? insertCount : -insertCount,
|
|
37079
|
+
numericKeys = [];
|
|
37080
|
+
this.beforeChangedRecordsMap.forEach((_, key) => {
|
|
37081
|
+
const numKey = Number(key);
|
|
37082
|
+
Number.isInteger(numKey) && numKey.toString() === key && numKey >= insertIndex && numericKeys.push(numKey);
|
|
37083
|
+
}), numericKeys.sort((a, b) => "add" === type ? b - a : a - b);
|
|
37084
|
+
for (let i = 0; i < numericKeys.length; i++) {
|
|
37085
|
+
const key = numericKeys[i],
|
|
37086
|
+
record = this.beforeChangedRecordsMap.get(key.toString());
|
|
37087
|
+
this.beforeChangedRecordsMap.delete(key.toString()), this.beforeChangedRecordsMap.set((key + delta).toString(), record);
|
|
37062
37088
|
}
|
|
37063
37089
|
}
|
|
37064
37090
|
deleteRecords(recordIndexs) {
|
|
@@ -53422,7 +53448,7 @@
|
|
|
53422
53448
|
};
|
|
53423
53449
|
class EventManager {
|
|
53424
53450
|
constructor(table) {
|
|
53425
|
-
this.isDown = !1, this.isDraging = !1, this.globalEventListeners = [], this._enableTableScroll = !0, this.cutWaitPaste = !1, this.clipboardCheckTimer = null, this.cutOperationTime = 0, this.lastClipboardContent = "", this.cutCellRange = null, this.copySourceRange = null, this.table = table, this.handleTextStickBindId = [], this.inertiaScroll = new InertiaScroll(table.stateManager), "node" === Env.mode || table.options.disableInteraction || (this.bindOuterEvent(), setTimeout(() => {
|
|
53451
|
+
this.isDown = !1, this.isDraging = !1, this.globalEventListeners = [], this._enableTableScroll = !0, this.cutWaitPaste = !1, this.clipboardCheckTimer = null, this.cutOperationTime = 0, this.lastClipboardContent = "", this.cutCellRange = null, this.cutRanges = null, this.copySourceRange = null, this.table = table, this.handleTextStickBindId = [], this.inertiaScroll = new InertiaScroll(table.stateManager), "node" === Env.mode || table.options.disableInteraction || (this.bindOuterEvent(), setTimeout(() => {
|
|
53426
53452
|
this.bindSelfEvent();
|
|
53427
53453
|
}, 0));
|
|
53428
53454
|
}
|
|
@@ -53724,15 +53750,25 @@
|
|
|
53724
53750
|
} catch (error) {}
|
|
53725
53751
|
}
|
|
53726
53752
|
handleCut(e) {
|
|
53753
|
+
var _a;
|
|
53727
53754
|
return __awaiter$1(this, void 0, void 0, function* () {
|
|
53728
|
-
this.handleCopy(e, !0), this.cutWaitPaste = !0, this.cutCellRange = this.table.getSelectedCellInfos(), this.
|
|
53729
|
-
|
|
53755
|
+
this.handleCopy(e, !0), this.cutWaitPaste = !0, this.cutCellRange = this.table.getSelectedCellInfos(), this.cutRanges = null === (_a = this.table.stateManager.select.ranges) || void 0 === _a ? void 0 : _a.map(r => ({
|
|
53756
|
+
start: {
|
|
53757
|
+
col: r.start.col,
|
|
53758
|
+
row: r.start.row
|
|
53759
|
+
},
|
|
53760
|
+
end: {
|
|
53761
|
+
col: r.end.col,
|
|
53762
|
+
row: r.end.row
|
|
53763
|
+
}
|
|
53764
|
+
})), this.clipboardCheckTimer && clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = window.setTimeout(() => {
|
|
53765
|
+
this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.cutRanges = null, this.clipboardCheckTimer = null);
|
|
53730
53766
|
}, 3e4), this.saveClipboardContent();
|
|
53731
53767
|
});
|
|
53732
53768
|
}
|
|
53733
53769
|
handlePaste(e) {
|
|
53734
53770
|
this.cutWaitPaste ? this.checkClipboardChanged().then(changed => {
|
|
53735
|
-
this.executePaste(e), changed || this.clearCutArea(this.table), this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.clipboardCheckTimer && (clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = null));
|
|
53771
|
+
this.executePaste(e), changed || this.clearCutArea(this.table), this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.cutRanges = null, this.clipboardCheckTimer && (clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = null));
|
|
53736
53772
|
}).catch(() => {
|
|
53737
53773
|
this.executePaste(e), this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.clipboardCheckTimer && (clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = null));
|
|
53738
53774
|
}) : this.executePaste(e);
|
|
@@ -53809,9 +53845,9 @@
|
|
|
53809
53845
|
}
|
|
53810
53846
|
clearCutArea(table) {
|
|
53811
53847
|
try {
|
|
53812
|
-
const
|
|
53813
|
-
if (!
|
|
53814
|
-
|
|
53848
|
+
const ranges = this.cutRanges;
|
|
53849
|
+
if (!ranges || 0 === ranges.length) return;
|
|
53850
|
+
table.changeCellValuesByIds(ranges, "");
|
|
53815
53851
|
} catch (error) {}
|
|
53816
53852
|
}
|
|
53817
53853
|
checkClipboardChanged() {
|
|
@@ -55749,6 +55785,15 @@
|
|
|
55749
55785
|
constructor(table, customCellStyle, customCellStyleArrangement) {
|
|
55750
55786
|
this.table = table, this.customCellStyle = customCellStyle, this.customCellStyleArrangement = customCellStyleArrangement;
|
|
55751
55787
|
}
|
|
55788
|
+
clearCustomCellStyleArrangement() {
|
|
55789
|
+
this.customCellStyleArrangement = [];
|
|
55790
|
+
}
|
|
55791
|
+
addCustomCellStyleArrangement(cellPosition, customStyleId) {
|
|
55792
|
+
this.customCellStyleArrangement.push({
|
|
55793
|
+
cellPosition: cellPosition,
|
|
55794
|
+
customStyleId: customStyleId
|
|
55795
|
+
});
|
|
55796
|
+
}
|
|
55752
55797
|
getCustomCellStyle(col, row) {
|
|
55753
55798
|
const customStyleIds = this.getCustomCellStyleIds(col, row);
|
|
55754
55799
|
if (customStyleIds.length) {
|
|
@@ -56054,7 +56099,7 @@
|
|
|
56054
56099
|
}
|
|
56055
56100
|
constructor(container, options = {}) {
|
|
56056
56101
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
56057
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.22.11-alpha.
|
|
56102
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.22.11-alpha.5", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
|
|
56058
56103
|
this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
|
|
56059
56104
|
options: options,
|
|
56060
56105
|
container: container
|
|
@@ -59829,15 +59874,16 @@
|
|
|
59829
59874
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
59830
59875
|
});
|
|
59831
59876
|
};
|
|
59832
|
-
function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table) {
|
|
59877
|
+
function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
|
|
59833
59878
|
if (workOnEditableCell && table.isHasEditorDefine(col, row) || !1 === workOnEditableCell) {
|
|
59834
|
-
const
|
|
59879
|
+
const recordShowIndex = table.getRecordShowIndexByCell(col, row),
|
|
59880
|
+
recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
|
|
59835
59881
|
{
|
|
59836
59882
|
field: field
|
|
59837
59883
|
} = table.internalProps.layoutMap.getBody(col, row),
|
|
59838
59884
|
beforeChangeValue = table.getCellRawValue(col, row),
|
|
59839
59885
|
oldValue = table.getCellOriginValue(col, row);
|
|
59840
|
-
table.isHeader(col, row) ? table.internalProps.layoutMap.updateColumnTitle(col, row, value) : table.dataSource.changeFieldValue(value,
|
|
59886
|
+
table.isHeader(col, row) ? table.internalProps.layoutMap.updateColumnTitle(col, row, value) : table.dataSource.changeFieldValue(value, recordShowIndex, field, col, row, table);
|
|
59841
59887
|
const range = table.getCellRange(col, row),
|
|
59842
59888
|
aggregators = table.internalProps.layoutMap.getAggregatorsByCell(col, row);
|
|
59843
59889
|
if (aggregators) {
|
|
@@ -59860,16 +59906,24 @@
|
|
|
59860
59906
|
table.scenegraph.updateRowHeight(row, newHeight - oldHeight);
|
|
59861
59907
|
}
|
|
59862
59908
|
const changedValue = table.getCellOriginValue(col, row);
|
|
59863
|
-
oldValue !== changedValue && triggerEvent
|
|
59864
|
-
|
|
59865
|
-
|
|
59866
|
-
|
|
59867
|
-
|
|
59868
|
-
|
|
59869
|
-
|
|
59909
|
+
if (oldValue !== changedValue && triggerEvent) {
|
|
59910
|
+
const changeValue = {
|
|
59911
|
+
col: col,
|
|
59912
|
+
row: row,
|
|
59913
|
+
recordIndex: recordIndex,
|
|
59914
|
+
field: field,
|
|
59915
|
+
rawValue: beforeChangeValue,
|
|
59916
|
+
currentValue: oldValue,
|
|
59917
|
+
changedValue: changedValue
|
|
59918
|
+
};
|
|
59919
|
+
table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), silentChangeCellValuesEvent || table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
|
|
59920
|
+
values: [changeValue]
|
|
59921
|
+
});
|
|
59922
|
+
}
|
|
59923
|
+
table.scenegraph.updateNextFrame();
|
|
59870
59924
|
}
|
|
59871
59925
|
}
|
|
59872
|
-
function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table) {
|
|
59926
|
+
function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
|
|
59873
59927
|
var _a, _b;
|
|
59874
59928
|
return __awaiter(this, void 0, void 0, function* () {
|
|
59875
59929
|
const changedCellResults = [];
|
|
@@ -59891,6 +59945,7 @@
|
|
|
59891
59945
|
oldRowValues.push(oldValue);
|
|
59892
59946
|
}
|
|
59893
59947
|
}
|
|
59948
|
+
const resultChangeValues = [];
|
|
59894
59949
|
for (let i = 0; i < values.length && !(startRow + i > table.rowCount - 1); i++) {
|
|
59895
59950
|
changedCellResults[i] = [], pasteRowEnd = startRow + i;
|
|
59896
59951
|
const rowValues = values[i];
|
|
@@ -59914,25 +59969,34 @@
|
|
|
59914
59969
|
if (isCanChange) {
|
|
59915
59970
|
changedCellResults[i][j] = !0;
|
|
59916
59971
|
const value = rowValues[j],
|
|
59917
|
-
|
|
59972
|
+
recordShowIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i),
|
|
59973
|
+
recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
|
|
59918
59974
|
{
|
|
59919
59975
|
field: field
|
|
59920
59976
|
} = table.internalProps.layoutMap.getBody(startCol + j, startRow + i),
|
|
59921
59977
|
beforeChangeValue = beforeChangeValues[i][j],
|
|
59922
59978
|
oldValue = oldValues[i][j];
|
|
59923
|
-
table.isHeader(startCol + j, startRow + i) ? table.internalProps.layoutMap.updateColumnTitle(startCol + j, startRow + i, value) : table.dataSource.changeFieldValue(value,
|
|
59979
|
+
table.isHeader(startCol + j, startRow + i) ? table.internalProps.layoutMap.updateColumnTitle(startCol + j, startRow + i, value) : table.dataSource.changeFieldValue(value, recordShowIndex, field, startCol + j, startRow + i, table);
|
|
59924
59980
|
const changedValue = table.getCellOriginValue(startCol + j, startRow + i);
|
|
59925
|
-
oldValue !== changedValue && triggerEvent
|
|
59926
|
-
|
|
59927
|
-
|
|
59928
|
-
|
|
59929
|
-
|
|
59930
|
-
|
|
59931
|
-
|
|
59981
|
+
if (oldValue !== changedValue && triggerEvent) {
|
|
59982
|
+
const changeValue = {
|
|
59983
|
+
col: startCol + j,
|
|
59984
|
+
row: startRow + i,
|
|
59985
|
+
recordIndex: recordIndex,
|
|
59986
|
+
field: field,
|
|
59987
|
+
rawValue: beforeChangeValue,
|
|
59988
|
+
currentValue: oldValue,
|
|
59989
|
+
changedValue: changedValue
|
|
59990
|
+
};
|
|
59991
|
+
table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), resultChangeValues.push(changeValue);
|
|
59992
|
+
}
|
|
59932
59993
|
} else changedCellResults[i][j] = !1;
|
|
59933
59994
|
}
|
|
59934
59995
|
pasteColEnd = Math.max(pasteColEnd, thisRowPasteColEnd);
|
|
59935
59996
|
}
|
|
59997
|
+
silentChangeCellValuesEvent || table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
|
|
59998
|
+
values: resultChangeValues
|
|
59999
|
+
});
|
|
59936
60000
|
const startRange = table.getCellRange(startCol, startRow),
|
|
59937
60001
|
range = table.getCellRange(pasteColEnd, pasteRowEnd),
|
|
59938
60002
|
aggregators = table.internalProps.layoutMap.getAggregatorsByCellRange(startRange.start.col, startRange.start.row, range.end.col, range.end.row);
|
|
@@ -59966,6 +60030,58 @@
|
|
|
59966
60030
|
return table.scenegraph.updateNextFrame(), changedCellResults;
|
|
59967
60031
|
});
|
|
59968
60032
|
}
|
|
60033
|
+
function listTableChangeCellValuesByIds(ranges, value, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
|
|
60034
|
+
var _a, _b;
|
|
60035
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60036
|
+
const resultChangeValues = [],
|
|
60037
|
+
processed = new Set(),
|
|
60038
|
+
nextValue = null != value ? value : "";
|
|
60039
|
+
for (let i = 0; i < (null !== (_a = null == ranges ? void 0 : ranges.length) && void 0 !== _a ? _a : 0); i++) {
|
|
60040
|
+
const range = ranges[i],
|
|
60041
|
+
startCol = Math.min(range.start.col, range.end.col),
|
|
60042
|
+
endCol = Math.max(range.start.col, range.end.col),
|
|
60043
|
+
startRow = Math.min(range.start.row, range.end.row),
|
|
60044
|
+
endRow = Math.max(range.start.row, range.end.row);
|
|
60045
|
+
if (startCol > endCol || startRow > endRow) continue;
|
|
60046
|
+
const values = [],
|
|
60047
|
+
oldValues = [];
|
|
60048
|
+
for (let row = startRow; row <= endRow; row++) {
|
|
60049
|
+
const rowValues = [],
|
|
60050
|
+
rowOldValues = [];
|
|
60051
|
+
for (let col = startCol; col <= endCol; col++) rowValues.push(nextValue), rowOldValues.push(table.getCellOriginValue(col, row));
|
|
60052
|
+
values.push(rowValues), oldValues.push(rowOldValues);
|
|
60053
|
+
}
|
|
60054
|
+
const changedCellResults = yield listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, !0);
|
|
60055
|
+
for (let r = 0; r < values.length; r++) for (let c = 0; c < values[r].length; c++) {
|
|
60056
|
+
const col = startCol + c,
|
|
60057
|
+
row = startRow + r,
|
|
60058
|
+
key = `${col},${row}`;
|
|
60059
|
+
if (processed.has(key)) continue;
|
|
60060
|
+
if (processed.add(key), !triggerEvent || !(null === (_b = null == changedCellResults ? void 0 : changedCellResults[r]) || void 0 === _b ? void 0 : _b[c])) continue;
|
|
60061
|
+
const oldValue = oldValues[r][c],
|
|
60062
|
+
changedValue = table.getCellOriginValue(col, row);
|
|
60063
|
+
if (oldValue === changedValue) continue;
|
|
60064
|
+
const recordShowIndex = table.getRecordShowIndexByCell(col, row),
|
|
60065
|
+
recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
|
|
60066
|
+
{
|
|
60067
|
+
field: field
|
|
60068
|
+
} = table.internalProps.layoutMap.getBody(col, row);
|
|
60069
|
+
resultChangeValues.push({
|
|
60070
|
+
col: col,
|
|
60071
|
+
row: row,
|
|
60072
|
+
recordIndex: recordIndex,
|
|
60073
|
+
field: field,
|
|
60074
|
+
rawValue: oldValue,
|
|
60075
|
+
currentValue: oldValue,
|
|
60076
|
+
changedValue: changedValue
|
|
60077
|
+
});
|
|
60078
|
+
}
|
|
60079
|
+
}
|
|
60080
|
+
!silentChangeCellValuesEvent && triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
|
|
60081
|
+
values: resultChangeValues
|
|
60082
|
+
});
|
|
60083
|
+
});
|
|
60084
|
+
}
|
|
59969
60085
|
function getCellUpdateType(col, row, table, oldCellUpdateType) {
|
|
59970
60086
|
if ("group" === oldCellUpdateType) return oldCellUpdateType;
|
|
59971
60087
|
if ("sort" === oldCellUpdateType && !table.internalProps.groupBy) return oldCellUpdateType;
|
|
@@ -61129,43 +61245,165 @@
|
|
|
61129
61245
|
}
|
|
61130
61246
|
return isValid$1(editorDefine);
|
|
61131
61247
|
}
|
|
61132
|
-
changeCellValue(col, row, value, workOnEditableCell = !1, triggerEvent = !0) {
|
|
61133
|
-
return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this);
|
|
61248
|
+
changeCellValue(col, row, value, workOnEditableCell = !1, triggerEvent = !0, silentChangeCellValuesEvent) {
|
|
61249
|
+
return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
|
|
61250
|
+
}
|
|
61251
|
+
changeCellValues(startCol, startRow, values, workOnEditableCell = !1, triggerEvent = !0, silentChangeCellValuesEvent) {
|
|
61252
|
+
return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
|
|
61253
|
+
}
|
|
61254
|
+
changeCellValuesByIds(ranges, value, workOnEditableCell = !1, triggerEvent = !0, silentChangeCellValuesEvent) {
|
|
61255
|
+
return listTableChangeCellValuesByIds(ranges, value, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
|
|
61256
|
+
}
|
|
61257
|
+
changeSourceCellValue(recordIndex, field, value) {
|
|
61258
|
+
const tableIndex = this.getTableIndexByRecordIndex(recordIndex),
|
|
61259
|
+
cellAddr = this.getCellAddrByFieldRecord(field, recordIndex);
|
|
61260
|
+
if (tableIndex < 0 || cellAddr.col < 0 || cellAddr.row < 0) return;
|
|
61261
|
+
this.dataSource.changeFieldValue(value, tableIndex, field, cellAddr.col, cellAddr.row, this);
|
|
61262
|
+
const beforeChangeValue = this.getCellRawValue(cellAddr.col, cellAddr.row),
|
|
61263
|
+
oldValue = this.getCellOriginValue(cellAddr.col, cellAddr.row),
|
|
61264
|
+
changedValue = this.getCellOriginValue(cellAddr.col, cellAddr.row);
|
|
61265
|
+
if (oldValue !== changedValue) {
|
|
61266
|
+
const changeValue = {
|
|
61267
|
+
col: cellAddr.col,
|
|
61268
|
+
row: cellAddr.row,
|
|
61269
|
+
recordIndex: recordIndex,
|
|
61270
|
+
field: field,
|
|
61271
|
+
rawValue: beforeChangeValue,
|
|
61272
|
+
currentValue: oldValue,
|
|
61273
|
+
changedValue: changedValue
|
|
61274
|
+
};
|
|
61275
|
+
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
|
|
61276
|
+
values: [changeValue]
|
|
61277
|
+
});
|
|
61278
|
+
}
|
|
61279
|
+
}
|
|
61280
|
+
changeCellValueByRecord(recordIndex, field, value, options) {
|
|
61281
|
+
var _a, _b, _c, _d, _e;
|
|
61282
|
+
const triggerEvent = null === (_a = null == options ? void 0 : options.triggerEvent) || void 0 === _a || _a,
|
|
61283
|
+
silentChangeCellValuesEvent = null == options ? void 0 : options.silentChangeCellValuesEvent,
|
|
61284
|
+
autoRefresh = null === (_b = null == options ? void 0 : options.autoRefresh) || void 0 === _b || _b,
|
|
61285
|
+
records = null === (_c = this.dataSource.dataSourceObj) || void 0 === _c ? void 0 : _c.records;
|
|
61286
|
+
let record, oldValue;
|
|
61287
|
+
if (!Array.isArray(records) || "string" != typeof field && "number" != typeof field || (record = Array.isArray(recordIndex) ? getValueFromDeepArray(records, recordIndex) : records[recordIndex], oldValue = null == record ? void 0 : record[field]), this.dataSource.changeFieldValueByRecordIndex(value, recordIndex, field, this), !triggerEvent) return;
|
|
61288
|
+
const changedValue = !record || "string" != typeof field && "number" != typeof field ? value : null == record ? void 0 : record[field];
|
|
61289
|
+
if (oldValue !== changedValue) {
|
|
61290
|
+
const cellAddr = this.getCellAddrByFieldRecord(field, recordIndex),
|
|
61291
|
+
changeValue = {
|
|
61292
|
+
col: null !== (_d = null == cellAddr ? void 0 : cellAddr.col) && void 0 !== _d ? _d : -1,
|
|
61293
|
+
row: null !== (_e = null == cellAddr ? void 0 : cellAddr.row) && void 0 !== _e ? _e : -1,
|
|
61294
|
+
recordIndex: recordIndex,
|
|
61295
|
+
field: field,
|
|
61296
|
+
rawValue: oldValue,
|
|
61297
|
+
currentValue: oldValue,
|
|
61298
|
+
changedValue: changedValue
|
|
61299
|
+
};
|
|
61300
|
+
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), silentChangeCellValuesEvent || this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
|
|
61301
|
+
values: [changeValue]
|
|
61302
|
+
});
|
|
61303
|
+
}
|
|
61304
|
+
autoRefresh && this.refreshAfterSourceChange();
|
|
61134
61305
|
}
|
|
61135
|
-
|
|
61136
|
-
return
|
|
61306
|
+
changeCellValueBySource(recordIndex, field, value, triggerEvent = !0, silentChangeCellValuesEvent) {
|
|
61307
|
+
return this.changeCellValueByRecord(recordIndex, field, value, {
|
|
61308
|
+
triggerEvent: triggerEvent,
|
|
61309
|
+
silentChangeCellValuesEvent: silentChangeCellValuesEvent,
|
|
61310
|
+
autoRefresh: !0
|
|
61311
|
+
});
|
|
61137
61312
|
}
|
|
61138
|
-
|
|
61313
|
+
changeCellValuesByRecords(changeValues, options) {
|
|
61314
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
61315
|
+
const triggerEvent = null === (_a = null == options ? void 0 : options.triggerEvent) || void 0 === _a || _a,
|
|
61316
|
+
silentChangeCellValuesEvent = null == options ? void 0 : options.silentChangeCellValuesEvent,
|
|
61317
|
+
autoRefresh = null === (_b = null == options ? void 0 : options.autoRefresh) || void 0 === _b || _b,
|
|
61318
|
+
resultChangeValues = [];
|
|
61319
|
+
for (let i = 0; i < changeValues.length; i++) {
|
|
61320
|
+
const {
|
|
61321
|
+
recordIndex: recordIndex,
|
|
61322
|
+
field: field,
|
|
61323
|
+
value: value
|
|
61324
|
+
} = changeValues[i],
|
|
61325
|
+
records = null === (_c = this.dataSource.dataSourceObj) || void 0 === _c ? void 0 : _c.records;
|
|
61326
|
+
let record, oldValue;
|
|
61327
|
+
if (!Array.isArray(records) || "string" != typeof field && "number" != typeof field || (record = Array.isArray(recordIndex) ? getValueFromDeepArray(records, recordIndex) : records[recordIndex], oldValue = null == record ? void 0 : record[field]), this.dataSource.changeFieldValueByRecordIndex(value, recordIndex, field, this), triggerEvent) {
|
|
61328
|
+
const changedValue = !record || "string" != typeof field && "number" != typeof field ? value : null == record ? void 0 : record[field];
|
|
61329
|
+
if (oldValue !== changedValue) {
|
|
61330
|
+
const changeValue = {
|
|
61331
|
+
col: null !== (_e = null === (_d = this.getCellAddrByFieldRecord(field, recordIndex)) || void 0 === _d ? void 0 : _d.col) && void 0 !== _e ? _e : -1,
|
|
61332
|
+
row: null !== (_g = null === (_f = this.getCellAddrByFieldRecord(field, recordIndex)) || void 0 === _f ? void 0 : _f.row) && void 0 !== _g ? _g : -1,
|
|
61333
|
+
recordIndex: recordIndex,
|
|
61334
|
+
field: field,
|
|
61335
|
+
rawValue: oldValue,
|
|
61336
|
+
currentValue: oldValue,
|
|
61337
|
+
changedValue: changedValue
|
|
61338
|
+
};
|
|
61339
|
+
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), resultChangeValues.push(changeValue);
|
|
61340
|
+
}
|
|
61341
|
+
}
|
|
61342
|
+
}
|
|
61343
|
+
!silentChangeCellValuesEvent && resultChangeValues.length && triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
|
|
61344
|
+
values: resultChangeValues
|
|
61345
|
+
}), autoRefresh && this.refreshAfterSourceChange();
|
|
61346
|
+
}
|
|
61347
|
+
changeCellValuesBySource(changeValues, triggerEvent = !0, silentChangeCellValuesEvent) {
|
|
61348
|
+
return this.changeCellValuesByRecords(changeValues, {
|
|
61349
|
+
triggerEvent: triggerEvent,
|
|
61350
|
+
silentChangeCellValuesEvent: silentChangeCellValuesEvent,
|
|
61351
|
+
autoRefresh: !0
|
|
61352
|
+
});
|
|
61353
|
+
}
|
|
61354
|
+
refreshAfterSourceChange(options) {
|
|
61355
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
61356
|
+
const reapplyFilter = null === (_a = null == options ? void 0 : options.reapplyFilter) || void 0 === _a || _a,
|
|
61357
|
+
reapplySort = null === (_b = null == options ? void 0 : options.reapplySort) || void 0 === _b || _b,
|
|
61358
|
+
clearRowHeightCache = null === (_c = null == options ? void 0 : options.clearRowHeightCache) || void 0 === _c || _c;
|
|
61359
|
+
this.scenegraph.clearCells(), this.sortState && reapplySort && (null === (_e = (_d = this.dataSource).clearSortedIndexMap) || void 0 === _e || _e.call(_d), null === (_g = null === (_f = this.dataSource.sortedIndexMap) || void 0 === _f ? void 0 : _f.clear) || void 0 === _g || _g.call(_f)), reapplyFilter ? this.sortState && reapplySort ? (this.dataSource.updateFilterRulesForSorted(null === (_h = this.dataSource.dataConfig) || void 0 === _h ? void 0 : _h.filterRules), sortRecords(this)) : this.dataSource.updateFilterRules(null === (_j = this.dataSource.dataConfig) || void 0 === _j ? void 0 : _j.filterRules) : this.sortState && reapplySort && sortRecords(this);
|
|
61360
|
+
const traverseColumns = columns => {
|
|
61361
|
+
var _a, _b, _c, _d;
|
|
61362
|
+
for (let i = 0; i < (null !== (_a = null == columns ? void 0 : columns.length) && void 0 !== _a ? _a : 0); i++) {
|
|
61363
|
+
const column = columns[i],
|
|
61364
|
+
aggregators = null == column ? void 0 : column.vtable_aggregator;
|
|
61365
|
+
if (aggregators) if (Array.isArray(aggregators)) for (let j = 0; j < aggregators.length; j++) null === (_c = null === (_b = aggregators[j]) || void 0 === _b ? void 0 : _b.recalculate) || void 0 === _c || _c.call(_b);else null === (_d = null == aggregators ? void 0 : aggregators.recalculate) || void 0 === _d || _d.call(aggregators);
|
|
61366
|
+
(null == column ? void 0 : column.columns) && traverseColumns(column.columns);
|
|
61367
|
+
}
|
|
61368
|
+
};
|
|
61369
|
+
traverseColumns(this.internalProps.columns), this.refreshRowColCount(), this.internalProps.layoutMap.clearCellRangeMap(), this.internalProps.useOneRowHeightFillAll = !1, this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(!clearRowHeightCache), null === (_k = this.internalProps.emptyTip) || void 0 === _k || _k.resetVisible(), this.resize();
|
|
61370
|
+
}
|
|
61371
|
+
addRecord(record, recordIndex, triggerEvent = !0) {
|
|
61139
61372
|
var _a;
|
|
61140
61373
|
const success = listTableAddRecord(record, recordIndex, this);
|
|
61141
|
-
adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
|
|
61374
|
+
adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
|
|
61142
61375
|
records: [record],
|
|
61143
61376
|
recordIndex: recordIndex,
|
|
61144
61377
|
recordCount: 1
|
|
61145
61378
|
});
|
|
61146
61379
|
}
|
|
61147
|
-
addRecords(records, recordIndex) {
|
|
61380
|
+
addRecords(records, recordIndex, triggerEvent = !0) {
|
|
61148
61381
|
var _a;
|
|
61149
61382
|
const success = listTableAddRecords(records, recordIndex, this);
|
|
61150
|
-
"number" == typeof recordIndex && adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, records), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
|
|
61383
|
+
"number" == typeof recordIndex && adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, records), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
|
|
61151
61384
|
records: records,
|
|
61152
61385
|
recordIndex: recordIndex,
|
|
61153
61386
|
recordCount: records.length
|
|
61154
61387
|
});
|
|
61155
61388
|
}
|
|
61156
|
-
deleteRecords(recordIndexs) {
|
|
61389
|
+
deleteRecords(recordIndexs, triggerEvent = !0) {
|
|
61157
61390
|
var _a;
|
|
61158
|
-
|
|
61391
|
+
const deletedRecords = [];
|
|
61392
|
+
(null == recordIndexs ? void 0 : recordIndexs.length) > 0 && recordIndexs.forEach(index => {
|
|
61393
|
+
let record = null;
|
|
61394
|
+
record = "number" == typeof index ? this.dataSource.get(index) : [], deletedRecords.push(record);
|
|
61395
|
+
}), listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
|
|
61159
61396
|
const rowIndexs = [];
|
|
61160
61397
|
for (let i = 0; i < recordIndexs.length; i++) rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
|
|
61161
|
-
this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
|
|
61398
|
+
triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
|
|
61162
61399
|
recordIndexs: recordIndexs,
|
|
61400
|
+
records: deletedRecords,
|
|
61163
61401
|
rowIndexs: rowIndexs,
|
|
61164
61402
|
deletedCount: (Array.isArray(recordIndexs[0]), recordIndexs.length)
|
|
61165
61403
|
});
|
|
61166
61404
|
}
|
|
61167
|
-
updateRecords(records, recordIndexs) {
|
|
61168
|
-
listTableUpdateRecords(records, recordIndexs, this), this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
|
|
61405
|
+
updateRecords(records, recordIndexs, triggerEvent = !0) {
|
|
61406
|
+
listTableUpdateRecords(records, recordIndexs, this), triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
|
|
61169
61407
|
records: records,
|
|
61170
61408
|
recordIndexs: recordIndexs,
|
|
61171
61409
|
updateCount: records.length
|