@visactor/vtable-calendar 1.22.11-alpha.2 → 1.22.11-alpha.3
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 +46 -275
- package/dist/vtable-calendar.min.js +1 -1
- package/package.json +4 -4
package/dist/vtable-calendar.js
CHANGED
|
@@ -34879,7 +34879,6 @@
|
|
|
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",
|
|
34883
34882
|
DRAG_FILL_HANDLE_END: "drag_fill_handle_end",
|
|
34884
34883
|
MOUSEDOWN_FILL_HANDLE: "mousedown_fill_handle",
|
|
34885
34884
|
DBLCLICK_FILL_HANDLE: "dblclick_fill_handle",
|
|
@@ -36992,24 +36991,6 @@
|
|
|
36992
36991
|
}
|
|
36993
36992
|
}
|
|
36994
36993
|
}
|
|
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
|
-
}
|
|
37013
36994
|
cacheBeforeChangedRecord(dataIndex, table) {
|
|
37014
36995
|
var _a;
|
|
37015
36996
|
if (!this.beforeChangedRecordsMap.has(dataIndex.toString())) {
|
|
@@ -37075,16 +37056,9 @@
|
|
|
37075
37056
|
}
|
|
37076
37057
|
}
|
|
37077
37058
|
adjustBeforeChangedRecordsMap(insertIndex, insertCount, type = "add") {
|
|
37078
|
-
|
|
37079
|
-
|
|
37080
|
-
|
|
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);
|
|
37059
|
+
for (let key = this.beforeChangedRecordsMap.size - 1; key >= insertIndex; key--) {
|
|
37060
|
+
const record = this.beforeChangedRecordsMap.get(key.toString());
|
|
37061
|
+
this.beforeChangedRecordsMap.delete(key.toString()), this.beforeChangedRecordsMap.set((key + ("add" === type ? insertCount : -insertCount)).toString(), record);
|
|
37088
37062
|
}
|
|
37089
37063
|
}
|
|
37090
37064
|
deleteRecords(recordIndexs) {
|
|
@@ -53448,7 +53422,7 @@
|
|
|
53448
53422
|
};
|
|
53449
53423
|
class EventManager {
|
|
53450
53424
|
constructor(table) {
|
|
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.
|
|
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(() => {
|
|
53452
53426
|
this.bindSelfEvent();
|
|
53453
53427
|
}, 0));
|
|
53454
53428
|
}
|
|
@@ -53750,25 +53724,15 @@
|
|
|
53750
53724
|
} catch (error) {}
|
|
53751
53725
|
}
|
|
53752
53726
|
handleCut(e) {
|
|
53753
|
-
var _a;
|
|
53754
53727
|
return __awaiter$1(this, void 0, void 0, function* () {
|
|
53755
|
-
this.handleCopy(e, !0), this.cutWaitPaste = !0, this.cutCellRange = this.table.getSelectedCellInfos(), this.
|
|
53756
|
-
|
|
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);
|
|
53728
|
+
this.handleCopy(e, !0), this.cutWaitPaste = !0, this.cutCellRange = this.table.getSelectedCellInfos(), this.clipboardCheckTimer && clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = window.setTimeout(() => {
|
|
53729
|
+
this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.clipboardCheckTimer = null);
|
|
53766
53730
|
}, 3e4), this.saveClipboardContent();
|
|
53767
53731
|
});
|
|
53768
53732
|
}
|
|
53769
53733
|
handlePaste(e) {
|
|
53770
53734
|
this.cutWaitPaste ? this.checkClipboardChanged().then(changed => {
|
|
53771
|
-
this.executePaste(e), changed || this.clearCutArea(this.table), this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.
|
|
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));
|
|
53772
53736
|
}).catch(() => {
|
|
53773
53737
|
this.executePaste(e), this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.clipboardCheckTimer && (clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = null));
|
|
53774
53738
|
}) : this.executePaste(e);
|
|
@@ -53845,9 +53809,9 @@
|
|
|
53845
53809
|
}
|
|
53846
53810
|
clearCutArea(table) {
|
|
53847
53811
|
try {
|
|
53848
|
-
const
|
|
53849
|
-
if (!
|
|
53850
|
-
table.
|
|
53812
|
+
const selectCells = this.cutCellRange;
|
|
53813
|
+
if (!selectCells || 0 === selectCells.length) return;
|
|
53814
|
+
for (let i = 0; i < selectCells.length; i++) for (let j = 0; j < selectCells[i].length; j++) selectCells[i][j] && table.changeCellValue(selectCells[i][j].col, selectCells[i][j].row, void 0);
|
|
53851
53815
|
} catch (error) {}
|
|
53852
53816
|
}
|
|
53853
53817
|
checkClipboardChanged() {
|
|
@@ -56090,7 +56054,7 @@
|
|
|
56090
56054
|
}
|
|
56091
56055
|
constructor(container, options = {}) {
|
|
56092
56056
|
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;
|
|
56093
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.22.11-alpha.
|
|
56057
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.22.11-alpha.3", 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");
|
|
56094
56058
|
this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
|
|
56095
56059
|
options: options,
|
|
56096
56060
|
container: container
|
|
@@ -59714,9 +59678,9 @@
|
|
|
59714
59678
|
};
|
|
59715
59679
|
col === this.table.colCount - 1 ? referencePosition.rect.width = rect.width - 1 : referencePosition.rect.width = rect.width + 1, row === this.table.rowCount - 1 ? referencePosition.rect.height = rect.height - 1 : referencePosition.rect.height = rect.height + 1;
|
|
59716
59680
|
const editor = this.table.getEditor(col, row);
|
|
59717
|
-
setTimeout(() => {
|
|
59681
|
+
editor && setTimeout(() => {
|
|
59718
59682
|
var _a;
|
|
59719
|
-
this.editingEditor !== editor && (null === (_a = editor.prepareEdit) || void 0 === _a || _a.call(editor, {
|
|
59683
|
+
editor && this.editingEditor !== editor && (null === (_a = editor.prepareEdit) || void 0 === _a || _a.call(editor, {
|
|
59720
59684
|
referencePosition: referencePosition,
|
|
59721
59685
|
container: this.table.getElement(),
|
|
59722
59686
|
table: this.table,
|
|
@@ -59865,16 +59829,15 @@
|
|
|
59865
59829
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
59866
59830
|
});
|
|
59867
59831
|
};
|
|
59868
|
-
function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table
|
|
59832
|
+
function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table) {
|
|
59869
59833
|
if (workOnEditableCell && table.isHasEditorDefine(col, row) || !1 === workOnEditableCell) {
|
|
59870
|
-
const
|
|
59871
|
-
recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
|
|
59834
|
+
const recordIndex = table.getRecordShowIndexByCell(col, row),
|
|
59872
59835
|
{
|
|
59873
59836
|
field: field
|
|
59874
59837
|
} = table.internalProps.layoutMap.getBody(col, row),
|
|
59875
59838
|
beforeChangeValue = table.getCellRawValue(col, row),
|
|
59876
59839
|
oldValue = table.getCellOriginValue(col, row);
|
|
59877
|
-
table.isHeader(col, row) ? table.internalProps.layoutMap.updateColumnTitle(col, row, value) : table.dataSource.changeFieldValue(value,
|
|
59840
|
+
table.isHeader(col, row) ? table.internalProps.layoutMap.updateColumnTitle(col, row, value) : table.dataSource.changeFieldValue(value, recordIndex, field, col, row, table);
|
|
59878
59841
|
const range = table.getCellRange(col, row),
|
|
59879
59842
|
aggregators = table.internalProps.layoutMap.getAggregatorsByCell(col, row);
|
|
59880
59843
|
if (aggregators) {
|
|
@@ -59897,24 +59860,16 @@
|
|
|
59897
59860
|
table.scenegraph.updateRowHeight(row, newHeight - oldHeight);
|
|
59898
59861
|
}
|
|
59899
59862
|
const changedValue = table.getCellOriginValue(col, row);
|
|
59900
|
-
|
|
59901
|
-
|
|
59902
|
-
|
|
59903
|
-
|
|
59904
|
-
|
|
59905
|
-
|
|
59906
|
-
|
|
59907
|
-
currentValue: oldValue,
|
|
59908
|
-
changedValue: changedValue
|
|
59909
|
-
};
|
|
59910
|
-
table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), silentChangeCellValuesEvent || table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
|
|
59911
|
-
values: [changeValue]
|
|
59912
|
-
});
|
|
59913
|
-
}
|
|
59914
|
-
table.scenegraph.updateNextFrame();
|
|
59863
|
+
oldValue !== changedValue && triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
|
|
59864
|
+
col: col,
|
|
59865
|
+
row: row,
|
|
59866
|
+
rawValue: beforeChangeValue,
|
|
59867
|
+
currentValue: oldValue,
|
|
59868
|
+
changedValue: changedValue
|
|
59869
|
+
}), table.scenegraph.updateNextFrame();
|
|
59915
59870
|
}
|
|
59916
59871
|
}
|
|
59917
|
-
function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table
|
|
59872
|
+
function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table) {
|
|
59918
59873
|
var _a, _b;
|
|
59919
59874
|
return __awaiter(this, void 0, void 0, function* () {
|
|
59920
59875
|
const changedCellResults = [];
|
|
@@ -59936,7 +59891,6 @@
|
|
|
59936
59891
|
oldRowValues.push(oldValue);
|
|
59937
59892
|
}
|
|
59938
59893
|
}
|
|
59939
|
-
const resultChangeValues = [];
|
|
59940
59894
|
for (let i = 0; i < values.length && !(startRow + i > table.rowCount - 1); i++) {
|
|
59941
59895
|
changedCellResults[i] = [], pasteRowEnd = startRow + i;
|
|
59942
59896
|
const rowValues = values[i];
|
|
@@ -59960,34 +59914,25 @@
|
|
|
59960
59914
|
if (isCanChange) {
|
|
59961
59915
|
changedCellResults[i][j] = !0;
|
|
59962
59916
|
const value = rowValues[j],
|
|
59963
|
-
|
|
59964
|
-
recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
|
|
59917
|
+
recordIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i),
|
|
59965
59918
|
{
|
|
59966
59919
|
field: field
|
|
59967
59920
|
} = table.internalProps.layoutMap.getBody(startCol + j, startRow + i),
|
|
59968
59921
|
beforeChangeValue = beforeChangeValues[i][j],
|
|
59969
59922
|
oldValue = oldValues[i][j];
|
|
59970
|
-
table.isHeader(startCol + j, startRow + i) ? table.internalProps.layoutMap.updateColumnTitle(startCol + j, startRow + i, value) : table.dataSource.changeFieldValue(value,
|
|
59923
|
+
table.isHeader(startCol + j, startRow + i) ? table.internalProps.layoutMap.updateColumnTitle(startCol + j, startRow + i, value) : table.dataSource.changeFieldValue(value, recordIndex, field, startCol + j, startRow + i, table);
|
|
59971
59924
|
const changedValue = table.getCellOriginValue(startCol + j, startRow + i);
|
|
59972
|
-
|
|
59973
|
-
|
|
59974
|
-
|
|
59975
|
-
|
|
59976
|
-
|
|
59977
|
-
|
|
59978
|
-
|
|
59979
|
-
currentValue: oldValue,
|
|
59980
|
-
changedValue: changedValue
|
|
59981
|
-
};
|
|
59982
|
-
table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), resultChangeValues.push(changeValue);
|
|
59983
|
-
}
|
|
59925
|
+
oldValue !== changedValue && triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
|
|
59926
|
+
col: startCol + j,
|
|
59927
|
+
row: startRow + i,
|
|
59928
|
+
rawValue: beforeChangeValue,
|
|
59929
|
+
currentValue: oldValue,
|
|
59930
|
+
changedValue: changedValue
|
|
59931
|
+
});
|
|
59984
59932
|
} else changedCellResults[i][j] = !1;
|
|
59985
59933
|
}
|
|
59986
59934
|
pasteColEnd = Math.max(pasteColEnd, thisRowPasteColEnd);
|
|
59987
59935
|
}
|
|
59988
|
-
silentChangeCellValuesEvent || table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
|
|
59989
|
-
values: resultChangeValues
|
|
59990
|
-
});
|
|
59991
59936
|
const startRange = table.getCellRange(startCol, startRow),
|
|
59992
59937
|
range = table.getCellRange(pasteColEnd, pasteRowEnd),
|
|
59993
59938
|
aggregators = table.internalProps.layoutMap.getAggregatorsByCellRange(startRange.start.col, startRange.start.row, range.end.col, range.end.row);
|
|
@@ -60021,58 +59966,6 @@
|
|
|
60021
59966
|
return table.scenegraph.updateNextFrame(), changedCellResults;
|
|
60022
59967
|
});
|
|
60023
59968
|
}
|
|
60024
|
-
function listTableChangeCellValuesByIds(ranges, value, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
|
|
60025
|
-
var _a, _b;
|
|
60026
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
60027
|
-
const resultChangeValues = [],
|
|
60028
|
-
processed = new Set(),
|
|
60029
|
-
nextValue = null != value ? value : "";
|
|
60030
|
-
for (let i = 0; i < (null !== (_a = null == ranges ? void 0 : ranges.length) && void 0 !== _a ? _a : 0); i++) {
|
|
60031
|
-
const range = ranges[i],
|
|
60032
|
-
startCol = Math.min(range.start.col, range.end.col),
|
|
60033
|
-
endCol = Math.max(range.start.col, range.end.col),
|
|
60034
|
-
startRow = Math.min(range.start.row, range.end.row),
|
|
60035
|
-
endRow = Math.max(range.start.row, range.end.row);
|
|
60036
|
-
if (startCol > endCol || startRow > endRow) continue;
|
|
60037
|
-
const values = [],
|
|
60038
|
-
oldValues = [];
|
|
60039
|
-
for (let row = startRow; row <= endRow; row++) {
|
|
60040
|
-
const rowValues = [],
|
|
60041
|
-
rowOldValues = [];
|
|
60042
|
-
for (let col = startCol; col <= endCol; col++) rowValues.push(nextValue), rowOldValues.push(table.getCellOriginValue(col, row));
|
|
60043
|
-
values.push(rowValues), oldValues.push(rowOldValues);
|
|
60044
|
-
}
|
|
60045
|
-
const changedCellResults = yield listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, !0);
|
|
60046
|
-
for (let r = 0; r < values.length; r++) for (let c = 0; c < values[r].length; c++) {
|
|
60047
|
-
const col = startCol + c,
|
|
60048
|
-
row = startRow + r,
|
|
60049
|
-
key = `${col},${row}`;
|
|
60050
|
-
if (processed.has(key)) continue;
|
|
60051
|
-
if (processed.add(key), !triggerEvent || !(null === (_b = null == changedCellResults ? void 0 : changedCellResults[r]) || void 0 === _b ? void 0 : _b[c])) continue;
|
|
60052
|
-
const oldValue = oldValues[r][c],
|
|
60053
|
-
changedValue = table.getCellOriginValue(col, row);
|
|
60054
|
-
if (oldValue === changedValue) continue;
|
|
60055
|
-
const recordShowIndex = table.getRecordShowIndexByCell(col, row),
|
|
60056
|
-
recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
|
|
60057
|
-
{
|
|
60058
|
-
field: field
|
|
60059
|
-
} = table.internalProps.layoutMap.getBody(col, row);
|
|
60060
|
-
resultChangeValues.push({
|
|
60061
|
-
col: col,
|
|
60062
|
-
row: row,
|
|
60063
|
-
recordIndex: recordIndex,
|
|
60064
|
-
field: field,
|
|
60065
|
-
rawValue: oldValue,
|
|
60066
|
-
currentValue: oldValue,
|
|
60067
|
-
changedValue: changedValue
|
|
60068
|
-
});
|
|
60069
|
-
}
|
|
60070
|
-
}
|
|
60071
|
-
!silentChangeCellValuesEvent && triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
|
|
60072
|
-
values: resultChangeValues
|
|
60073
|
-
});
|
|
60074
|
-
});
|
|
60075
|
-
}
|
|
60076
59969
|
function getCellUpdateType(col, row, table, oldCellUpdateType) {
|
|
60077
59970
|
if ("group" === oldCellUpdateType) return oldCellUpdateType;
|
|
60078
59971
|
if ("sort" === oldCellUpdateType && !table.internalProps.groupBy) return oldCellUpdateType;
|
|
@@ -61236,165 +61129,43 @@
|
|
|
61236
61129
|
}
|
|
61237
61130
|
return isValid$1(editorDefine);
|
|
61238
61131
|
}
|
|
61239
|
-
changeCellValue(col, row, value, workOnEditableCell = !1, triggerEvent = !0
|
|
61240
|
-
return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this
|
|
61241
|
-
}
|
|
61242
|
-
changeCellValues(startCol, startRow, values, workOnEditableCell = !1, triggerEvent = !0, silentChangeCellValuesEvent) {
|
|
61243
|
-
return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
|
|
61244
|
-
}
|
|
61245
|
-
changeCellValuesByIds(ranges, value, workOnEditableCell = !1, triggerEvent = !0, silentChangeCellValuesEvent) {
|
|
61246
|
-
return listTableChangeCellValuesByIds(ranges, value, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
|
|
61247
|
-
}
|
|
61248
|
-
changeSourceCellValue(recordIndex, field, value) {
|
|
61249
|
-
const tableIndex = this.getTableIndexByRecordIndex(recordIndex),
|
|
61250
|
-
cellAddr = this.getCellAddrByFieldRecord(field, recordIndex);
|
|
61251
|
-
if (tableIndex < 0 || cellAddr.col < 0 || cellAddr.row < 0) return;
|
|
61252
|
-
this.dataSource.changeFieldValue(value, tableIndex, field, cellAddr.col, cellAddr.row, this);
|
|
61253
|
-
const beforeChangeValue = this.getCellRawValue(cellAddr.col, cellAddr.row),
|
|
61254
|
-
oldValue = this.getCellOriginValue(cellAddr.col, cellAddr.row),
|
|
61255
|
-
changedValue = this.getCellOriginValue(cellAddr.col, cellAddr.row);
|
|
61256
|
-
if (oldValue !== changedValue) {
|
|
61257
|
-
const changeValue = {
|
|
61258
|
-
col: cellAddr.col,
|
|
61259
|
-
row: cellAddr.row,
|
|
61260
|
-
recordIndex: recordIndex,
|
|
61261
|
-
field: field,
|
|
61262
|
-
rawValue: beforeChangeValue,
|
|
61263
|
-
currentValue: oldValue,
|
|
61264
|
-
changedValue: changedValue
|
|
61265
|
-
};
|
|
61266
|
-
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
|
|
61267
|
-
values: [changeValue]
|
|
61268
|
-
});
|
|
61269
|
-
}
|
|
61132
|
+
changeCellValue(col, row, value, workOnEditableCell = !1, triggerEvent = !0) {
|
|
61133
|
+
return listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, this);
|
|
61270
61134
|
}
|
|
61271
|
-
|
|
61272
|
-
|
|
61273
|
-
const triggerEvent = null === (_a = null == options ? void 0 : options.triggerEvent) || void 0 === _a || _a,
|
|
61274
|
-
silentChangeCellValuesEvent = null == options ? void 0 : options.silentChangeCellValuesEvent,
|
|
61275
|
-
autoRefresh = null === (_b = null == options ? void 0 : options.autoRefresh) || void 0 === _b || _b,
|
|
61276
|
-
records = null === (_c = this.dataSource.dataSourceObj) || void 0 === _c ? void 0 : _c.records;
|
|
61277
|
-
let record, oldValue;
|
|
61278
|
-
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;
|
|
61279
|
-
const changedValue = !record || "string" != typeof field && "number" != typeof field ? value : null == record ? void 0 : record[field];
|
|
61280
|
-
if (oldValue !== changedValue) {
|
|
61281
|
-
const cellAddr = this.getCellAddrByFieldRecord(field, recordIndex),
|
|
61282
|
-
changeValue = {
|
|
61283
|
-
col: null !== (_d = null == cellAddr ? void 0 : cellAddr.col) && void 0 !== _d ? _d : -1,
|
|
61284
|
-
row: null !== (_e = null == cellAddr ? void 0 : cellAddr.row) && void 0 !== _e ? _e : -1,
|
|
61285
|
-
recordIndex: recordIndex,
|
|
61286
|
-
field: field,
|
|
61287
|
-
rawValue: oldValue,
|
|
61288
|
-
currentValue: oldValue,
|
|
61289
|
-
changedValue: changedValue
|
|
61290
|
-
};
|
|
61291
|
-
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), silentChangeCellValuesEvent || this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
|
|
61292
|
-
values: [changeValue]
|
|
61293
|
-
});
|
|
61294
|
-
}
|
|
61295
|
-
autoRefresh && this.refreshAfterSourceChange();
|
|
61296
|
-
}
|
|
61297
|
-
changeCellValueBySource(recordIndex, field, value, triggerEvent = !0, silentChangeCellValuesEvent) {
|
|
61298
|
-
return this.changeCellValueByRecord(recordIndex, field, value, {
|
|
61299
|
-
triggerEvent: triggerEvent,
|
|
61300
|
-
silentChangeCellValuesEvent: silentChangeCellValuesEvent,
|
|
61301
|
-
autoRefresh: !0
|
|
61302
|
-
});
|
|
61135
|
+
changeCellValues(startCol, startRow, values, workOnEditableCell = !1, triggerEvent = !0) {
|
|
61136
|
+
return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this);
|
|
61303
61137
|
}
|
|
61304
|
-
|
|
61305
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
61306
|
-
const triggerEvent = null === (_a = null == options ? void 0 : options.triggerEvent) || void 0 === _a || _a,
|
|
61307
|
-
silentChangeCellValuesEvent = null == options ? void 0 : options.silentChangeCellValuesEvent,
|
|
61308
|
-
autoRefresh = null === (_b = null == options ? void 0 : options.autoRefresh) || void 0 === _b || _b,
|
|
61309
|
-
resultChangeValues = [];
|
|
61310
|
-
for (let i = 0; i < changeValues.length; i++) {
|
|
61311
|
-
const {
|
|
61312
|
-
recordIndex: recordIndex,
|
|
61313
|
-
field: field,
|
|
61314
|
-
value: value
|
|
61315
|
-
} = changeValues[i],
|
|
61316
|
-
records = null === (_c = this.dataSource.dataSourceObj) || void 0 === _c ? void 0 : _c.records;
|
|
61317
|
-
let record, oldValue;
|
|
61318
|
-
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) {
|
|
61319
|
-
const changedValue = !record || "string" != typeof field && "number" != typeof field ? value : null == record ? void 0 : record[field];
|
|
61320
|
-
if (oldValue !== changedValue) {
|
|
61321
|
-
const changeValue = {
|
|
61322
|
-
col: null !== (_e = null === (_d = this.getCellAddrByFieldRecord(field, recordIndex)) || void 0 === _d ? void 0 : _d.col) && void 0 !== _e ? _e : -1,
|
|
61323
|
-
row: null !== (_g = null === (_f = this.getCellAddrByFieldRecord(field, recordIndex)) || void 0 === _f ? void 0 : _f.row) && void 0 !== _g ? _g : -1,
|
|
61324
|
-
recordIndex: recordIndex,
|
|
61325
|
-
field: field,
|
|
61326
|
-
rawValue: oldValue,
|
|
61327
|
-
currentValue: oldValue,
|
|
61328
|
-
changedValue: changedValue
|
|
61329
|
-
};
|
|
61330
|
-
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), resultChangeValues.push(changeValue);
|
|
61331
|
-
}
|
|
61332
|
-
}
|
|
61333
|
-
}
|
|
61334
|
-
!silentChangeCellValuesEvent && resultChangeValues.length && triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
|
|
61335
|
-
values: resultChangeValues
|
|
61336
|
-
}), autoRefresh && this.refreshAfterSourceChange();
|
|
61337
|
-
}
|
|
61338
|
-
changeCellValuesBySource(changeValues, triggerEvent = !0, silentChangeCellValuesEvent) {
|
|
61339
|
-
return this.changeCellValuesByRecords(changeValues, {
|
|
61340
|
-
triggerEvent: triggerEvent,
|
|
61341
|
-
silentChangeCellValuesEvent: silentChangeCellValuesEvent,
|
|
61342
|
-
autoRefresh: !0
|
|
61343
|
-
});
|
|
61344
|
-
}
|
|
61345
|
-
refreshAfterSourceChange(options) {
|
|
61346
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
61347
|
-
const reapplyFilter = null === (_a = null == options ? void 0 : options.reapplyFilter) || void 0 === _a || _a,
|
|
61348
|
-
reapplySort = null === (_b = null == options ? void 0 : options.reapplySort) || void 0 === _b || _b,
|
|
61349
|
-
clearRowHeightCache = null === (_c = null == options ? void 0 : options.clearRowHeightCache) || void 0 === _c || _c;
|
|
61350
|
-
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);
|
|
61351
|
-
const traverseColumns = columns => {
|
|
61352
|
-
var _a, _b, _c, _d;
|
|
61353
|
-
for (let i = 0; i < (null !== (_a = null == columns ? void 0 : columns.length) && void 0 !== _a ? _a : 0); i++) {
|
|
61354
|
-
const column = columns[i],
|
|
61355
|
-
aggregators = null == column ? void 0 : column.vtable_aggregator;
|
|
61356
|
-
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);
|
|
61357
|
-
(null == column ? void 0 : column.columns) && traverseColumns(column.columns);
|
|
61358
|
-
}
|
|
61359
|
-
};
|
|
61360
|
-
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();
|
|
61361
|
-
}
|
|
61362
|
-
addRecord(record, recordIndex, triggerEvent = !0) {
|
|
61138
|
+
addRecord(record, recordIndex) {
|
|
61363
61139
|
var _a;
|
|
61364
61140
|
const success = listTableAddRecord(record, recordIndex, this);
|
|
61365
|
-
adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(),
|
|
61141
|
+
adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
|
|
61366
61142
|
records: [record],
|
|
61367
61143
|
recordIndex: recordIndex,
|
|
61368
61144
|
recordCount: 1
|
|
61369
61145
|
});
|
|
61370
61146
|
}
|
|
61371
|
-
addRecords(records, recordIndex
|
|
61147
|
+
addRecords(records, recordIndex) {
|
|
61372
61148
|
var _a;
|
|
61373
61149
|
const success = listTableAddRecords(records, recordIndex, this);
|
|
61374
|
-
"number" == typeof recordIndex && adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, records), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(),
|
|
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, {
|
|
61375
61151
|
records: records,
|
|
61376
61152
|
recordIndex: recordIndex,
|
|
61377
61153
|
recordCount: records.length
|
|
61378
61154
|
});
|
|
61379
61155
|
}
|
|
61380
|
-
deleteRecords(recordIndexs
|
|
61156
|
+
deleteRecords(recordIndexs) {
|
|
61381
61157
|
var _a;
|
|
61382
|
-
|
|
61383
|
-
(null == recordIndexs ? void 0 : recordIndexs.length) > 0 && recordIndexs.forEach(index => {
|
|
61384
|
-
let record = null;
|
|
61385
|
-
record = "number" == typeof index ? this.dataSource.get(index) : [], deletedRecords.push(record);
|
|
61386
|
-
}), listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
|
|
61158
|
+
listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
|
|
61387
61159
|
const rowIndexs = [];
|
|
61388
61160
|
for (let i = 0; i < recordIndexs.length; i++) rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
|
|
61389
|
-
|
|
61161
|
+
this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
|
|
61390
61162
|
recordIndexs: recordIndexs,
|
|
61391
|
-
records: deletedRecords,
|
|
61392
61163
|
rowIndexs: rowIndexs,
|
|
61393
61164
|
deletedCount: (Array.isArray(recordIndexs[0]), recordIndexs.length)
|
|
61394
61165
|
});
|
|
61395
61166
|
}
|
|
61396
|
-
updateRecords(records, recordIndexs
|
|
61397
|
-
listTableUpdateRecords(records, recordIndexs, this),
|
|
61167
|
+
updateRecords(records, recordIndexs) {
|
|
61168
|
+
listTableUpdateRecords(records, recordIndexs, this), this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
|
|
61398
61169
|
records: records,
|
|
61399
61170
|
recordIndexs: recordIndexs,
|
|
61400
61171
|
updateCount: records.length
|