@visactor/vtable-gantt 1.22.11-alpha.1 → 1.22.11-alpha.2
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/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/dist/vtable-gantt.js +192 -50
- package/dist/vtable-gantt.min.js +2 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/package.json +5 -5
package/cjs/index.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ import * as tools from './tools';
|
|
|
6
6
|
import * as VRender from './vrender';
|
|
7
7
|
import * as VTable from './vtable';
|
|
8
8
|
import * as plugins from './plugins';
|
|
9
|
-
export declare const version = "1.22.11-alpha.
|
|
9
|
+
export declare const version = "1.22.11-alpha.2";
|
|
10
10
|
export { TYPES, GanttConstructorOptions, Gantt, ColumnsDefine, ColumnDefine, LinkColumnDefine, ChartColumnDefine, ImageColumnDefine, SparklineColumnDefine, ProgressbarColumnDefine, TextColumnDefine, GroupColumnDefine, TextAlignType, TextBaselineType, tools, VRender, VTable, plugins };
|
package/cjs/index.js
CHANGED
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAAoC;AAwBlC,sBAAK;AAVP,mCAAgC;AAY9B,sFAZO,aAAK,OAYP;AAXP,+CAAiC;AAuB/B,sBAAK;AAtBP,mDAAqC;AAuBnC,0BAAO;AAtBT,iDAAmC;AAuBjC,wBAAM;AAtBR,mDAAqC;AAuBnC,0BAAO;AAtBI,QAAA,OAAO,GAAG,iBAAiB,CAAC","file":"index.js","sourcesContent":["import type { GanttConstructorOptions } from './ts-types';\nimport * as TYPES from './ts-types';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType\n} from '@visactor/vtable';\nimport { Gantt } from './Gantt';\nimport * as tools from './tools';\nimport * as VRender from './vrender';\nimport * as VTable from './vtable';\nimport * as plugins from './plugins';\nexport const version = \"1.22.11-alpha.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAAoC;AAwBlC,sBAAK;AAVP,mCAAgC;AAY9B,sFAZO,aAAK,OAYP;AAXP,+CAAiC;AAuB/B,sBAAK;AAtBP,mDAAqC;AAuBnC,0BAAO;AAtBT,iDAAmC;AAuBjC,wBAAM;AAtBR,mDAAqC;AAuBnC,0BAAO;AAtBI,QAAA,OAAO,GAAG,iBAAiB,CAAC","file":"index.js","sourcesContent":["import type { GanttConstructorOptions } from './ts-types';\nimport * as TYPES from './ts-types';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType\n} from '@visactor/vtable';\nimport { Gantt } from './Gantt';\nimport * as tools from './tools';\nimport * as VRender from './vrender';\nimport * as VTable from './vtable';\nimport * as plugins from './plugins';\nexport const version = \"1.22.11-alpha.2\";\n/**\n * @namespace VTableGantt\n */\nexport {\n TYPES,\n GanttConstructorOptions,\n Gantt,\n ColumnsDefine,\n ColumnDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType,\n tools,\n VRender,\n VTable,\n plugins\n};\n"]}
|
package/dist/vtable-gantt.js
CHANGED
|
@@ -40845,6 +40845,24 @@
|
|
|
40845
40845
|
}
|
|
40846
40846
|
}
|
|
40847
40847
|
}
|
|
40848
|
+
changeFieldValueByRecordIndex(value, recordIndex, field, table) {
|
|
40849
|
+
var _a, _b, _c, _d;
|
|
40850
|
+
if (null === field) return;
|
|
40851
|
+
if (null == recordIndex) return;
|
|
40852
|
+
const rawKey = recordIndex.toString();
|
|
40853
|
+
if (!this.beforeChangedRecordsMap.has(rawKey)) {
|
|
40854
|
+
const rawRecords = Array.isArray(null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.records) ? this.dataSourceObj.records : null,
|
|
40855
|
+
originRecord = rawRecords ? Array.isArray(recordIndex) ? getValueFromDeepArray(rawRecords, recordIndex) : rawRecords[recordIndex] : void 0;
|
|
40856
|
+
this.beforeChangedRecordsMap.set(rawKey, null !== (_b = cloneDeep(originRecord, void 0, ["vtable_gantt_linkedFrom", "vtable_gantt_linkedTo"])) && void 0 !== _b ? _b : {});
|
|
40857
|
+
}
|
|
40858
|
+
if ("string" == typeof field || "number" == typeof field) {
|
|
40859
|
+
const beforeChangedValue = null === (_c = this.beforeChangedRecordsMap.get(rawKey)) || void 0 === _c ? void 0 : _c[field],
|
|
40860
|
+
rawRecords = Array.isArray(null === (_d = this.dataSourceObj) || void 0 === _d ? void 0 : _d.records) ? this.dataSourceObj.records : null,
|
|
40861
|
+
record = rawRecords ? Array.isArray(recordIndex) ? getValueFromDeepArray(rawRecords, recordIndex) : rawRecords[recordIndex] : void 0;
|
|
40862
|
+
let formatValue = value;
|
|
40863
|
+
"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);
|
|
40864
|
+
}
|
|
40865
|
+
}
|
|
40848
40866
|
cacheBeforeChangedRecord(dataIndex, table) {
|
|
40849
40867
|
var _a;
|
|
40850
40868
|
if (!this.beforeChangedRecordsMap.has(dataIndex.toString())) {
|
|
@@ -40910,9 +40928,16 @@
|
|
|
40910
40928
|
}
|
|
40911
40929
|
}
|
|
40912
40930
|
adjustBeforeChangedRecordsMap(insertIndex, insertCount, type = "add") {
|
|
40913
|
-
|
|
40914
|
-
|
|
40915
|
-
|
|
40931
|
+
const delta = "add" === type ? insertCount : -insertCount,
|
|
40932
|
+
numericKeys = [];
|
|
40933
|
+
this.beforeChangedRecordsMap.forEach((_, key) => {
|
|
40934
|
+
const numKey = Number(key);
|
|
40935
|
+
Number.isInteger(numKey) && numKey.toString() === key && numKey >= insertIndex && numericKeys.push(numKey);
|
|
40936
|
+
}), numericKeys.sort((a, b) => "add" === type ? b - a : a - b);
|
|
40937
|
+
for (let i = 0; i < numericKeys.length; i++) {
|
|
40938
|
+
const key = numericKeys[i],
|
|
40939
|
+
record = this.beforeChangedRecordsMap.get(key.toString());
|
|
40940
|
+
this.beforeChangedRecordsMap.delete(key.toString()), this.beforeChangedRecordsMap.set((key + delta).toString(), record);
|
|
40916
40941
|
}
|
|
40917
40942
|
}
|
|
40918
40943
|
deleteRecords(recordIndexs) {
|
|
@@ -57276,7 +57301,7 @@
|
|
|
57276
57301
|
};
|
|
57277
57302
|
let EventManager$1 = class EventManager {
|
|
57278
57303
|
constructor(table) {
|
|
57279
|
-
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(() => {
|
|
57304
|
+
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(() => {
|
|
57280
57305
|
this.bindSelfEvent();
|
|
57281
57306
|
}, 0));
|
|
57282
57307
|
}
|
|
@@ -57578,15 +57603,25 @@
|
|
|
57578
57603
|
} catch (error) {}
|
|
57579
57604
|
}
|
|
57580
57605
|
handleCut(e) {
|
|
57606
|
+
var _a;
|
|
57581
57607
|
return __awaiter$1(this, void 0, void 0, function* () {
|
|
57582
|
-
this.handleCopy(e, !0), this.cutWaitPaste = !0, this.cutCellRange = this.table.getSelectedCellInfos(), this.
|
|
57583
|
-
|
|
57608
|
+
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 => ({
|
|
57609
|
+
start: {
|
|
57610
|
+
col: r.start.col,
|
|
57611
|
+
row: r.start.row
|
|
57612
|
+
},
|
|
57613
|
+
end: {
|
|
57614
|
+
col: r.end.col,
|
|
57615
|
+
row: r.end.row
|
|
57616
|
+
}
|
|
57617
|
+
})), this.clipboardCheckTimer && clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = window.setTimeout(() => {
|
|
57618
|
+
this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.cutRanges = null, this.clipboardCheckTimer = null);
|
|
57584
57619
|
}, 3e4), this.saveClipboardContent();
|
|
57585
57620
|
});
|
|
57586
57621
|
}
|
|
57587
57622
|
handlePaste(e) {
|
|
57588
57623
|
this.cutWaitPaste ? this.checkClipboardChanged().then(changed => {
|
|
57589
|
-
this.executePaste(e), changed || this.clearCutArea(this.table), this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.clipboardCheckTimer && (clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = null));
|
|
57624
|
+
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));
|
|
57590
57625
|
}).catch(() => {
|
|
57591
57626
|
this.executePaste(e), this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.clipboardCheckTimer && (clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = null));
|
|
57592
57627
|
}) : this.executePaste(e);
|
|
@@ -57663,15 +57698,9 @@
|
|
|
57663
57698
|
}
|
|
57664
57699
|
clearCutArea(table) {
|
|
57665
57700
|
try {
|
|
57666
|
-
const
|
|
57667
|
-
if (!
|
|
57668
|
-
|
|
57669
|
-
for (let i = 0; i < selectCells.length; i++) for (let j = 0; j < selectCells[i].length; j++) selectCells[i][j] && changeValues.push({
|
|
57670
|
-
col: selectCells[i][j].col,
|
|
57671
|
-
row: selectCells[i][j].row,
|
|
57672
|
-
value: void 0
|
|
57673
|
-
});
|
|
57674
|
-
table.changeCellValuesByIds(changeValues);
|
|
57701
|
+
const ranges = this.cutRanges;
|
|
57702
|
+
if (!ranges || 0 === ranges.length) return;
|
|
57703
|
+
table.changeCellValuesByIds(ranges, "");
|
|
57675
57704
|
} catch (error) {}
|
|
57676
57705
|
}
|
|
57677
57706
|
checkClipboardChanged() {
|
|
@@ -59914,7 +59943,7 @@
|
|
|
59914
59943
|
}
|
|
59915
59944
|
constructor(container, options = {}) {
|
|
59916
59945
|
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;
|
|
59917
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.22.11-alpha.
|
|
59946
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.22.11-alpha.2", 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");
|
|
59918
59947
|
this.pluginManager = new PluginManager$1(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
|
|
59919
59948
|
options: options,
|
|
59920
59949
|
container: container
|
|
@@ -63881,32 +63910,54 @@
|
|
|
63881
63910
|
return table.scenegraph.updateNextFrame(), changedCellResults;
|
|
63882
63911
|
});
|
|
63883
63912
|
}
|
|
63884
|
-
function listTableChangeCellValuesByIds(
|
|
63913
|
+
function listTableChangeCellValuesByIds(ranges, value, workOnEditableCell, triggerEvent, table, silentChangeCellValuesEvent) {
|
|
63914
|
+
var _a, _b;
|
|
63885
63915
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63886
|
-
const resultChangeValues = []
|
|
63887
|
-
|
|
63888
|
-
|
|
63916
|
+
const resultChangeValues = [],
|
|
63917
|
+
processed = new Set(),
|
|
63918
|
+
nextValue = null != value ? value : "";
|
|
63919
|
+
for (let i = 0; i < (null !== (_a = null == ranges ? void 0 : ranges.length) && void 0 !== _a ? _a : 0); i++) {
|
|
63920
|
+
const range = ranges[i],
|
|
63921
|
+
startCol = Math.min(range.start.col, range.end.col),
|
|
63922
|
+
endCol = Math.max(range.start.col, range.end.col),
|
|
63923
|
+
startRow = Math.min(range.start.row, range.end.row),
|
|
63924
|
+
endRow = Math.max(range.start.row, range.end.row);
|
|
63925
|
+
if (startCol > endCol || startRow > endRow) continue;
|
|
63926
|
+
const values = [],
|
|
63927
|
+
oldValues = [];
|
|
63928
|
+
for (let row = startRow; row <= endRow; row++) {
|
|
63929
|
+
const rowValues = [],
|
|
63930
|
+
rowOldValues = [];
|
|
63931
|
+
for (let col = startCol; col <= endCol; col++) rowValues.push(nextValue), rowOldValues.push(table.getCellOriginValue(col, row));
|
|
63932
|
+
values.push(rowValues), oldValues.push(rowOldValues);
|
|
63933
|
+
}
|
|
63934
|
+
const changedCellResults = yield listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, !0);
|
|
63935
|
+
for (let r = 0; r < values.length; r++) for (let c = 0; c < values[r].length; c++) {
|
|
63936
|
+
const col = startCol + c,
|
|
63937
|
+
row = startRow + r,
|
|
63938
|
+
key = `${col},${row}`;
|
|
63939
|
+
if (processed.has(key)) continue;
|
|
63940
|
+
if (processed.add(key), !triggerEvent || !(null === (_b = null == changedCellResults ? void 0 : changedCellResults[r]) || void 0 === _b ? void 0 : _b[c])) continue;
|
|
63941
|
+
const oldValue = oldValues[r][c],
|
|
63942
|
+
changedValue = table.getCellOriginValue(col, row);
|
|
63943
|
+
if (oldValue === changedValue) continue;
|
|
63944
|
+
const recordShowIndex = table.getRecordShowIndexByCell(col, row),
|
|
63945
|
+
recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
|
|
63946
|
+
{
|
|
63947
|
+
field: field
|
|
63948
|
+
} = table.internalProps.layoutMap.getBody(col, row);
|
|
63949
|
+
resultChangeValues.push({
|
|
63889
63950
|
col: col,
|
|
63890
63951
|
row: row,
|
|
63891
|
-
|
|
63892
|
-
|
|
63893
|
-
|
|
63894
|
-
|
|
63895
|
-
|
|
63896
|
-
|
|
63897
|
-
|
|
63898
|
-
oldValue = table.getCellOriginValue(col, row);
|
|
63899
|
-
listTableChangeCellValue(col, row, value, !1, triggerEvent, table, !0), oldValue !== value && triggerEvent && resultChangeValues.push({
|
|
63900
|
-
col: col,
|
|
63901
|
-
row: row,
|
|
63902
|
-
recordIndex: recordIndex,
|
|
63903
|
-
field: field,
|
|
63904
|
-
rawValue: oldValue,
|
|
63905
|
-
currentValue: oldValue,
|
|
63906
|
-
changedValue: value
|
|
63907
|
-
});
|
|
63952
|
+
recordIndex: recordIndex,
|
|
63953
|
+
field: field,
|
|
63954
|
+
rawValue: oldValue,
|
|
63955
|
+
currentValue: oldValue,
|
|
63956
|
+
changedValue: changedValue
|
|
63957
|
+
});
|
|
63958
|
+
}
|
|
63908
63959
|
}
|
|
63909
|
-
silentChangeCellValuesEvent
|
|
63960
|
+
!silentChangeCellValuesEvent && triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
|
|
63910
63961
|
values: resultChangeValues
|
|
63911
63962
|
});
|
|
63912
63963
|
});
|
|
@@ -65080,8 +65131,8 @@
|
|
|
65080
65131
|
changeCellValues(startCol, startRow, values, workOnEditableCell = !1, triggerEvent = !0, silentChangeCellValuesEvent) {
|
|
65081
65132
|
return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
|
|
65082
65133
|
}
|
|
65083
|
-
changeCellValuesByIds(
|
|
65084
|
-
return listTableChangeCellValuesByIds(
|
|
65134
|
+
changeCellValuesByIds(ranges, value, workOnEditableCell = !1, triggerEvent = !0, silentChangeCellValuesEvent) {
|
|
65135
|
+
return listTableChangeCellValuesByIds(ranges, value, workOnEditableCell, triggerEvent, this, silentChangeCellValuesEvent);
|
|
65085
65136
|
}
|
|
65086
65137
|
changeSourceCellValue(recordIndex, field, value) {
|
|
65087
65138
|
const tableIndex = this.getTableIndexByRecordIndex(recordIndex),
|
|
@@ -65106,25 +65157,116 @@
|
|
|
65106
65157
|
});
|
|
65107
65158
|
}
|
|
65108
65159
|
}
|
|
65109
|
-
|
|
65160
|
+
changeCellValueByRecord(recordIndex, field, value, options) {
|
|
65161
|
+
var _a, _b, _c, _d, _e;
|
|
65162
|
+
const triggerEvent = null === (_a = null == options ? void 0 : options.triggerEvent) || void 0 === _a || _a,
|
|
65163
|
+
silentChangeCellValuesEvent = null == options ? void 0 : options.silentChangeCellValuesEvent,
|
|
65164
|
+
autoRefresh = null === (_b = null == options ? void 0 : options.autoRefresh) || void 0 === _b || _b,
|
|
65165
|
+
records = null === (_c = this.dataSource.dataSourceObj) || void 0 === _c ? void 0 : _c.records;
|
|
65166
|
+
let record, oldValue;
|
|
65167
|
+
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;
|
|
65168
|
+
const changedValue = !record || "string" != typeof field && "number" != typeof field ? value : null == record ? void 0 : record[field];
|
|
65169
|
+
if (oldValue !== changedValue) {
|
|
65170
|
+
const cellAddr = this.getCellAddrByFieldRecord(field, recordIndex),
|
|
65171
|
+
changeValue = {
|
|
65172
|
+
col: null !== (_d = null == cellAddr ? void 0 : cellAddr.col) && void 0 !== _d ? _d : -1,
|
|
65173
|
+
row: null !== (_e = null == cellAddr ? void 0 : cellAddr.row) && void 0 !== _e ? _e : -1,
|
|
65174
|
+
recordIndex: recordIndex,
|
|
65175
|
+
field: field,
|
|
65176
|
+
rawValue: oldValue,
|
|
65177
|
+
currentValue: oldValue,
|
|
65178
|
+
changedValue: changedValue
|
|
65179
|
+
};
|
|
65180
|
+
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), silentChangeCellValuesEvent || this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
|
|
65181
|
+
values: [changeValue]
|
|
65182
|
+
});
|
|
65183
|
+
}
|
|
65184
|
+
autoRefresh && this.refreshAfterSourceChange();
|
|
65185
|
+
}
|
|
65186
|
+
changeCellValueBySource(recordIndex, field, value, triggerEvent = !0, silentChangeCellValuesEvent) {
|
|
65187
|
+
return this.changeCellValueByRecord(recordIndex, field, value, {
|
|
65188
|
+
triggerEvent: triggerEvent,
|
|
65189
|
+
silentChangeCellValuesEvent: silentChangeCellValuesEvent,
|
|
65190
|
+
autoRefresh: !0
|
|
65191
|
+
});
|
|
65192
|
+
}
|
|
65193
|
+
changeCellValuesByRecords(changeValues, options) {
|
|
65194
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
65195
|
+
const triggerEvent = null === (_a = null == options ? void 0 : options.triggerEvent) || void 0 === _a || _a,
|
|
65196
|
+
silentChangeCellValuesEvent = null == options ? void 0 : options.silentChangeCellValuesEvent,
|
|
65197
|
+
autoRefresh = null === (_b = null == options ? void 0 : options.autoRefresh) || void 0 === _b || _b,
|
|
65198
|
+
resultChangeValues = [];
|
|
65199
|
+
for (let i = 0; i < changeValues.length; i++) {
|
|
65200
|
+
const {
|
|
65201
|
+
recordIndex: recordIndex,
|
|
65202
|
+
field: field,
|
|
65203
|
+
value: value
|
|
65204
|
+
} = changeValues[i],
|
|
65205
|
+
records = null === (_c = this.dataSource.dataSourceObj) || void 0 === _c ? void 0 : _c.records;
|
|
65206
|
+
let record, oldValue;
|
|
65207
|
+
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) {
|
|
65208
|
+
const changedValue = !record || "string" != typeof field && "number" != typeof field ? value : null == record ? void 0 : record[field];
|
|
65209
|
+
if (oldValue !== changedValue) {
|
|
65210
|
+
const changeValue = {
|
|
65211
|
+
col: null !== (_e = null === (_d = this.getCellAddrByFieldRecord(field, recordIndex)) || void 0 === _d ? void 0 : _d.col) && void 0 !== _e ? _e : -1,
|
|
65212
|
+
row: null !== (_g = null === (_f = this.getCellAddrByFieldRecord(field, recordIndex)) || void 0 === _f ? void 0 : _f.row) && void 0 !== _g ? _g : -1,
|
|
65213
|
+
recordIndex: recordIndex,
|
|
65214
|
+
field: field,
|
|
65215
|
+
rawValue: oldValue,
|
|
65216
|
+
currentValue: oldValue,
|
|
65217
|
+
changedValue: changedValue
|
|
65218
|
+
};
|
|
65219
|
+
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, changeValue), resultChangeValues.push(changeValue);
|
|
65220
|
+
}
|
|
65221
|
+
}
|
|
65222
|
+
}
|
|
65223
|
+
!silentChangeCellValuesEvent && resultChangeValues.length && triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUES, {
|
|
65224
|
+
values: resultChangeValues
|
|
65225
|
+
}), autoRefresh && this.refreshAfterSourceChange();
|
|
65226
|
+
}
|
|
65227
|
+
changeCellValuesBySource(changeValues, triggerEvent = !0, silentChangeCellValuesEvent) {
|
|
65228
|
+
return this.changeCellValuesByRecords(changeValues, {
|
|
65229
|
+
triggerEvent: triggerEvent,
|
|
65230
|
+
silentChangeCellValuesEvent: silentChangeCellValuesEvent,
|
|
65231
|
+
autoRefresh: !0
|
|
65232
|
+
});
|
|
65233
|
+
}
|
|
65234
|
+
refreshAfterSourceChange(options) {
|
|
65235
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
65236
|
+
const reapplyFilter = null === (_a = null == options ? void 0 : options.reapplyFilter) || void 0 === _a || _a,
|
|
65237
|
+
reapplySort = null === (_b = null == options ? void 0 : options.reapplySort) || void 0 === _b || _b,
|
|
65238
|
+
clearRowHeightCache = null === (_c = null == options ? void 0 : options.clearRowHeightCache) || void 0 === _c || _c;
|
|
65239
|
+
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);
|
|
65240
|
+
const traverseColumns = columns => {
|
|
65241
|
+
var _a, _b, _c, _d;
|
|
65242
|
+
for (let i = 0; i < (null !== (_a = null == columns ? void 0 : columns.length) && void 0 !== _a ? _a : 0); i++) {
|
|
65243
|
+
const column = columns[i],
|
|
65244
|
+
aggregators = null == column ? void 0 : column.vtable_aggregator;
|
|
65245
|
+
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);
|
|
65246
|
+
(null == column ? void 0 : column.columns) && traverseColumns(column.columns);
|
|
65247
|
+
}
|
|
65248
|
+
};
|
|
65249
|
+
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();
|
|
65250
|
+
}
|
|
65251
|
+
addRecord(record, recordIndex, triggerEvent = !0) {
|
|
65110
65252
|
var _a;
|
|
65111
65253
|
const success = listTableAddRecord(record, recordIndex, this);
|
|
65112
|
-
adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
|
|
65254
|
+
adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
|
|
65113
65255
|
records: [record],
|
|
65114
65256
|
recordIndex: recordIndex,
|
|
65115
65257
|
recordCount: 1
|
|
65116
65258
|
});
|
|
65117
65259
|
}
|
|
65118
|
-
addRecords(records, recordIndex) {
|
|
65260
|
+
addRecords(records, recordIndex, triggerEvent = !0) {
|
|
65119
65261
|
var _a;
|
|
65120
65262
|
const success = listTableAddRecords(records, recordIndex, this);
|
|
65121
|
-
"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, {
|
|
65263
|
+
"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, {
|
|
65122
65264
|
records: records,
|
|
65123
65265
|
recordIndex: recordIndex,
|
|
65124
65266
|
recordCount: records.length
|
|
65125
65267
|
});
|
|
65126
65268
|
}
|
|
65127
|
-
deleteRecords(recordIndexs) {
|
|
65269
|
+
deleteRecords(recordIndexs, triggerEvent = !0) {
|
|
65128
65270
|
var _a;
|
|
65129
65271
|
const deletedRecords = [];
|
|
65130
65272
|
(null == recordIndexs ? void 0 : recordIndexs.length) > 0 && recordIndexs.forEach(index => {
|
|
@@ -65133,15 +65275,15 @@
|
|
|
65133
65275
|
}), listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
|
|
65134
65276
|
const rowIndexs = [];
|
|
65135
65277
|
for (let i = 0; i < recordIndexs.length; i++) rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
|
|
65136
|
-
this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
|
|
65278
|
+
triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
|
|
65137
65279
|
recordIndexs: recordIndexs,
|
|
65138
65280
|
records: deletedRecords,
|
|
65139
65281
|
rowIndexs: rowIndexs,
|
|
65140
65282
|
deletedCount: (Array.isArray(recordIndexs[0]), recordIndexs.length)
|
|
65141
65283
|
});
|
|
65142
65284
|
}
|
|
65143
|
-
updateRecords(records, recordIndexs) {
|
|
65144
|
-
listTableUpdateRecords(records, recordIndexs, this), this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
|
|
65285
|
+
updateRecords(records, recordIndexs, triggerEvent = !0) {
|
|
65286
|
+
listTableUpdateRecords(records, recordIndexs, this), triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
|
|
65145
65287
|
records: records,
|
|
65146
65288
|
recordIndexs: recordIndexs,
|
|
65147
65289
|
updateCount: records.length
|
|
@@ -76299,7 +76441,7 @@
|
|
|
76299
76441
|
PluginManager: PluginManager
|
|
76300
76442
|
});
|
|
76301
76443
|
|
|
76302
|
-
const version = "1.22.11-alpha.
|
|
76444
|
+
const version = "1.22.11-alpha.2";
|
|
76303
76445
|
|
|
76304
76446
|
exports.Gantt = Gantt;
|
|
76305
76447
|
exports.TYPES = index$4;
|