@visactor/vtable-calendar 1.13.3-alpha.0 → 1.13.3-alpha.1
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 +66 -97
- package/dist/vtable-calendar.min.js +1 -1
- package/package.json +4 -4
package/dist/vtable-calendar.js
CHANGED
|
@@ -34088,12 +34088,16 @@
|
|
|
34088
34088
|
}
|
|
34089
34089
|
function computeRowHeight(row, startCol, endCol, table) {
|
|
34090
34090
|
var _a;
|
|
34091
|
-
if (!("autoHeight" === table.heightMode || "adaptive" === table.heightMode && !1 !== table.options.autoHeightInAdaptiveMode) && "auto" !== table.getDefaultRowHeight(row)) return table.getDefaultRowHeight(row);
|
|
34091
|
+
if (!("autoHeight" === table.heightMode || table.options.customComputeRowHeight || "adaptive" === table.heightMode && !1 !== table.options.autoHeightInAdaptiveMode) && "auto" !== table.getDefaultRowHeight(row)) return table.getDefaultRowHeight(row);
|
|
34092
34092
|
let maxHeight;
|
|
34093
|
-
if (table.options.customComputeRowHeight)
|
|
34094
|
-
|
|
34095
|
-
|
|
34096
|
-
|
|
34093
|
+
if (table.options.customComputeRowHeight) {
|
|
34094
|
+
const customRowHeight = table.options.customComputeRowHeight({
|
|
34095
|
+
row: row,
|
|
34096
|
+
table: table
|
|
34097
|
+
});
|
|
34098
|
+
if ("number" == typeof customRowHeight) return customRowHeight;
|
|
34099
|
+
if ("auto" !== customRowHeight) return table.getDefaultRowHeight(row);
|
|
34100
|
+
}
|
|
34097
34101
|
if (table.isPivotChart() && row >= table.columnHeaderLevelCount && row < table.rowCount - table.bottomFrozenRowCount) if (table.internalProps.layoutMap.indicatorsAsCol) {
|
|
34098
34102
|
const optimunHeight = table.internalProps.layoutMap.getOptimunHeightForChart(row);
|
|
34099
34103
|
if (optimunHeight > 0) return optimunHeight;
|
|
@@ -38304,12 +38308,12 @@
|
|
|
38304
38308
|
}
|
|
38305
38309
|
updateCellGroups(count) {
|
|
38306
38310
|
const distRow = Math.min(this.bodyBottomRow, this.rowUpdatePos + count);
|
|
38307
|
-
"autoHeight" === this.table.heightMode && computeRowsHeight(this.table, this.rowUpdatePos, distRow, !1), updateRowContent(this.rowUpdatePos, distRow, this), "autoHeight" === this.table.heightMode && (updateAutoRow(this.bodyLeftCol, this.bodyRightCol, this.rowUpdatePos, distRow, this.table, this.rowUpdateDirection, !0), updateAutoRow(0, this.table.frozenColCount - 1, this.rowUpdatePos, distRow, this.table, this.rowUpdateDirection, !0), updateAutoRow(this.table.colCount - this.table.rightFrozenColCount, this.table.colCount - 1, this.rowUpdatePos, distRow, this.table, this.rowUpdateDirection, !0)), this.rowUpdatePos = distRow + 1;
|
|
38311
|
+
("autoHeight" === this.table.heightMode || this.table.options.customComputeRowHeight) && computeRowsHeight(this.table, this.rowUpdatePos, distRow, !1), updateRowContent(this.rowUpdatePos, distRow, this), "autoHeight" === this.table.heightMode && (updateAutoRow(this.bodyLeftCol, this.bodyRightCol, this.rowUpdatePos, distRow, this.table, this.rowUpdateDirection, !0), updateAutoRow(0, this.table.frozenColCount - 1, this.rowUpdatePos, distRow, this.table, this.rowUpdateDirection, !0), updateAutoRow(this.table.colCount - this.table.rightFrozenColCount, this.table.colCount - 1, this.rowUpdatePos, distRow, this.table, this.rowUpdateDirection, !0)), this.rowUpdatePos = distRow + 1;
|
|
38308
38312
|
}
|
|
38309
38313
|
updateBottomFrozenCellGroups() {
|
|
38310
38314
|
const startRow = this.table.rowCount - this.table.bottomFrozenRowCount,
|
|
38311
38315
|
endRow = this.table.rowCount - 1;
|
|
38312
|
-
"autoHeight" === this.table.heightMode && computeRowsHeight(this.table, startRow, endRow, !1), updateRowContent(startRow, endRow, this), "autoHeight" === this.table.heightMode && (updateAutoRow(this.bodyLeftCol, this.bodyRightCol, startRow, endRow, this.table, this.rowUpdateDirection), updateAutoRow(0, this.table.frozenColCount - 1, startRow, endRow, this.table, this.rowUpdateDirection), updateAutoRow(this.table.colCount - this.table.rightFrozenColCount, this.table.colCount - 1, startRow, endRow, this.table, this.rowUpdateDirection));
|
|
38316
|
+
("autoHeight" === this.table.heightMode || this.table.options.customComputeRowHeight) && computeRowsHeight(this.table, startRow, endRow, !1), updateRowContent(startRow, endRow, this), "autoHeight" === this.table.heightMode && (updateAutoRow(this.bodyLeftCol, this.bodyRightCol, startRow, endRow, this.table, this.rowUpdateDirection), updateAutoRow(0, this.table.frozenColCount - 1, startRow, endRow, this.table, this.rowUpdateDirection), updateAutoRow(this.table.colCount - this.table.rightFrozenColCount, this.table.colCount - 1, startRow, endRow, this.table, this.rowUpdateDirection));
|
|
38313
38317
|
}
|
|
38314
38318
|
updateRightFrozenCellGroups() {
|
|
38315
38319
|
const startCol = this.table.colCount - this.table.rightFrozenColCount,
|
|
@@ -41544,10 +41548,8 @@
|
|
|
41544
41548
|
function setCheckedState(col, row, field, checked, state) {
|
|
41545
41549
|
const recordIndex = state.table.getRecordShowIndexByCell(col, row);
|
|
41546
41550
|
if (recordIndex >= 0) {
|
|
41547
|
-
const dataIndex = state.table.dataSource.getIndexKey(recordIndex)
|
|
41548
|
-
state.checkedState
|
|
41549
|
-
[field]: checked
|
|
41550
|
-
});
|
|
41551
|
+
const dataIndex = state.table.dataSource.getIndexKey(recordIndex);
|
|
41552
|
+
state.checkedState[dataIndex] || (state.checkedState[dataIndex] = {}), state.checkedState[dataIndex][field] = checked;
|
|
41551
41553
|
}
|
|
41552
41554
|
}
|
|
41553
41555
|
function setHeaderCheckedState(field, checked, state) {
|
|
@@ -41561,23 +41563,21 @@
|
|
|
41561
41563
|
if (state.table.isHeader(col, row)) {
|
|
41562
41564
|
if (isValid$1(state.headerCheckedState[field])) return state.headerCheckedState[field];
|
|
41563
41565
|
if ("function" == typeof checked) return;
|
|
41564
|
-
if (isValid$1(checked)) state.headerCheckedState[field] = checked;else if ((null === (_a = state.checkedState) || void 0 === _a ? void 0 : _a.
|
|
41566
|
+
if (isValid$1(checked)) state.headerCheckedState[field] = checked;else if ((null === (_a = state.checkedState) || void 0 === _a ? void 0 : _a.length) > 0) {
|
|
41565
41567
|
return state.updateHeaderCheckedState(field, col, row);
|
|
41566
41568
|
}
|
|
41567
41569
|
return state.headerCheckedState[field];
|
|
41568
41570
|
}
|
|
41569
41571
|
const recordIndex = state.table.getRecordShowIndexByCell(col, row);
|
|
41570
41572
|
if (recordIndex >= 0) {
|
|
41571
|
-
const dataIndex = state.table.dataSource.getIndexKey(recordIndex)
|
|
41572
|
-
if (isValid$1(null === (_b = state.checkedState
|
|
41573
|
-
state.checkedState
|
|
41574
|
-
[field]: checked
|
|
41575
|
-
});
|
|
41573
|
+
const dataIndex = state.table.dataSource.getIndexKey(recordIndex);
|
|
41574
|
+
if (isValid$1(null === (_b = state.checkedState[dataIndex]) || void 0 === _b ? void 0 : _b[field])) return state.checkedState[dataIndex][field];
|
|
41575
|
+
state.checkedState[dataIndex] || (state.checkedState[dataIndex] = {}), state.checkedState[dataIndex][field] = checked;
|
|
41576
41576
|
}
|
|
41577
41577
|
return checked;
|
|
41578
41578
|
}
|
|
41579
41579
|
function initCheckedState(records, state) {
|
|
41580
|
-
state.checkedState
|
|
41580
|
+
state.checkedState = [], state.headerCheckedState = {}, state.radioState = {};
|
|
41581
41581
|
let isNeedInitHeaderCheckedStateFromRecord = !1;
|
|
41582
41582
|
if (state._checkboxCellTypeFields = [], state._headerCheckFuncs = {}, state.table.internalProps.layoutMap.headerObjects.forEach((hd, index) => {
|
|
41583
41583
|
if ("checkbox" === hd.headerType) {
|
|
@@ -41588,29 +41588,46 @@
|
|
|
41588
41588
|
for (let i = 0; i < state.table.leftRowSeriesNumberCount; i++) state.headerCheckedState[`_vtable_rowSeries_number_${i}`] = !1, state._checkboxCellTypeFields.push(`_vtable_rowSeries_number_${i}`);
|
|
41589
41589
|
isNeedInitHeaderCheckedStateFromRecord = !0;
|
|
41590
41590
|
}
|
|
41591
|
-
isNeedInitHeaderCheckedStateFromRecord &&
|
|
41591
|
+
isNeedInitHeaderCheckedStateFromRecord && (null == records || records.forEach((record, index) => {
|
|
41592
|
+
state._checkboxCellTypeFields.forEach(field => {
|
|
41593
|
+
const value = record[field];
|
|
41594
|
+
let isChecked;
|
|
41595
|
+
if (isObject$4(value) ? isChecked = value.checked : "boolean" == typeof value && (isChecked = value), null == isChecked) {
|
|
41596
|
+
const headerCheckFunc = state._headerCheckFuncs[field];
|
|
41597
|
+
if (headerCheckFunc) {
|
|
41598
|
+
const cellAddr = state.table.getCellAddrByFieldRecord(field, index);
|
|
41599
|
+
isChecked = getOrApply(headerCheckFunc, {
|
|
41600
|
+
col: cellAddr.col,
|
|
41601
|
+
row: cellAddr.row,
|
|
41602
|
+
table: state.table,
|
|
41603
|
+
context: null,
|
|
41604
|
+
value: value
|
|
41605
|
+
});
|
|
41606
|
+
}
|
|
41607
|
+
}
|
|
41608
|
+
state.checkedState[index] || (state.checkedState[index] = {}), state.checkedState[index][field] = isChecked;
|
|
41609
|
+
});
|
|
41610
|
+
}));
|
|
41592
41611
|
}
|
|
41593
41612
|
function updateHeaderCheckedState(field, state, col, row) {
|
|
41594
|
-
|
|
41595
|
-
|
|
41596
|
-
|
|
41597
|
-
|
|
41598
|
-
|
|
41599
|
-
|
|
41600
|
-
|
|
41601
|
-
|
|
41602
|
-
|
|
41603
|
-
|
|
41613
|
+
const allChecked = state.checkedState.every((check_state, index) => {
|
|
41614
|
+
const tableIndex = state.table.getTableIndexByRecordIndex(index);
|
|
41615
|
+
return !!(state.table.transpose ? state.table.getCustomMerge(tableIndex, row) : state.table.getCustomMerge(col, tableIndex)) || !0 === (null == check_state ? void 0 : check_state[field]);
|
|
41616
|
+
});
|
|
41617
|
+
if (allChecked) return state.headerCheckedState[field] = !0, allChecked;
|
|
41618
|
+
if (state.checkedState.every((check_state, index) => {
|
|
41619
|
+
const tableIndex = state.table.getTableIndexByRecordIndex(index);
|
|
41620
|
+
return !!(state.table.transpose ? state.table.getCustomMerge(tableIndex, row) : state.table.getCustomMerge(col, tableIndex)) || !1 === (null == check_state ? void 0 : check_state[field]);
|
|
41621
|
+
})) return state.headerCheckedState[field] = !1, !1;
|
|
41622
|
+
return !!state.checkedState.find(check_state => !0 === (null == check_state ? void 0 : check_state[field])) && (state.headerCheckedState[field] = "indeterminate", "indeterminate");
|
|
41604
41623
|
}
|
|
41605
41624
|
function initLeftRecordsCheckState(records, state) {
|
|
41606
|
-
for (let index = state.checkedState.
|
|
41625
|
+
for (let index = state.checkedState.length; index < records.length; index++) {
|
|
41607
41626
|
const record = records[index];
|
|
41608
41627
|
state._checkboxCellTypeFields.forEach(field => {
|
|
41609
41628
|
const value = record[field];
|
|
41610
41629
|
let isChecked;
|
|
41611
|
-
isObject$4(value) ? isChecked = value.checked : "boolean" == typeof value && (isChecked = value);
|
|
41612
|
-
const dataIndex = index.toString();
|
|
41613
|
-
state.checkedState.get(dataIndex) || state.checkedState.set(dataIndex, {}), state.checkedState.get(dataIndex)[field] = isChecked;
|
|
41630
|
+
isObject$4(value) ? isChecked = value.checked : "boolean" == typeof value && (isChecked = value), state.checkedState[index] || (state.checkedState[index] = {}), state.checkedState[index][field] = isChecked;
|
|
41614
41631
|
});
|
|
41615
41632
|
}
|
|
41616
41633
|
}
|
|
@@ -41643,35 +41660,14 @@
|
|
|
41643
41660
|
checkedState: checkedState,
|
|
41644
41661
|
table: table
|
|
41645
41662
|
} = state;
|
|
41646
|
-
|
|
41647
|
-
|
|
41648
|
-
|
|
41649
|
-
|
|
41650
|
-
for (let i = sourceIndex; i > targetIndex; i--) checkedState.set(i.toString(), checkedState.get((i - 1).toString()));
|
|
41651
|
-
checkedState.set(targetIndex.toString(), sourceRecord);
|
|
41652
|
-
} else if (sourceIndex < targetIndex) {
|
|
41653
|
-
const sourceRecord = checkedState.get(sourceIndex.toString());
|
|
41654
|
-
for (let i = sourceIndex; i < targetIndex; i++) checkedState.set(i.toString(), checkedState.get((i + 1).toString()));
|
|
41655
|
-
checkedState.set(targetIndex.toString(), sourceRecord);
|
|
41656
|
-
}
|
|
41657
|
-
} else if (isArray$1(source) && isArray$1(target)) if ((sourceIndex = source[source.length - 1]) > (targetIndex = target[target.length - 1])) {
|
|
41658
|
-
const sourceRecord = checkedState.get(source.toString());
|
|
41659
|
-
for (let i = sourceIndex; i > targetIndex; i--) {
|
|
41660
|
-
const now = [...source];
|
|
41661
|
-
now[now.length - 1] = i;
|
|
41662
|
-
const last = [...source];
|
|
41663
|
-
last[last.length - 1] = i - 1, checkedState.set(now.toString(), checkedState.get(last.toString()));
|
|
41664
|
-
}
|
|
41665
|
-
checkedState.set(target.toString(), sourceRecord);
|
|
41663
|
+
if (table.internalProps.transpose ? (sourceIndex = table.getRecordShowIndexByCell(sourceIndex, 0), targetIndex = table.getRecordShowIndexByCell(targetIndex, 0)) : (sourceIndex = table.getRecordShowIndexByCell(0, sourceIndex), targetIndex = table.getRecordShowIndexByCell(0, targetIndex)), sourceIndex > targetIndex) {
|
|
41664
|
+
const sourceRecord = checkedState[sourceIndex];
|
|
41665
|
+
for (let i = sourceIndex; i > targetIndex; i--) checkedState[i] = checkedState[i - 1];
|
|
41666
|
+
checkedState[targetIndex] = sourceRecord;
|
|
41666
41667
|
} else if (sourceIndex < targetIndex) {
|
|
41667
|
-
const sourceRecord = checkedState
|
|
41668
|
-
for (let i = sourceIndex; i < targetIndex; i++)
|
|
41669
|
-
|
|
41670
|
-
now[now.length - 1] = i;
|
|
41671
|
-
const next = [...source];
|
|
41672
|
-
next[next.length - 1] = i + 1, checkedState.set(now.toString(), checkedState.get(next.toString()));
|
|
41673
|
-
}
|
|
41674
|
-
checkedState.set(target.toString(), sourceRecord);
|
|
41668
|
+
const sourceRecord = checkedState[sourceIndex];
|
|
41669
|
+
for (let i = sourceIndex; i < targetIndex; i++) checkedState[i] = checkedState[i + 1];
|
|
41670
|
+
checkedState[targetIndex] = sourceRecord;
|
|
41675
41671
|
}
|
|
41676
41672
|
}
|
|
41677
41673
|
function getGroupCheckboxState(table) {
|
|
@@ -41683,37 +41679,10 @@
|
|
|
41683
41679
|
const {
|
|
41684
41680
|
vtableOriginIndex: vtableOriginIndex
|
|
41685
41681
|
} = dataSource.getRawRecord(indexArr);
|
|
41686
|
-
result[vtableOriginIndex] = table.stateManager.checkedState
|
|
41682
|
+
result[vtableOriginIndex] = table.stateManager.checkedState[indexArr];
|
|
41687
41683
|
}
|
|
41688
41684
|
}), result;
|
|
41689
41685
|
}
|
|
41690
|
-
function initRecordCheckState(state) {
|
|
41691
|
-
const table = state.table,
|
|
41692
|
-
start = table.internalProps.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount,
|
|
41693
|
-
end = table.internalProps.transpose ? table.colCount : table.rowCount;
|
|
41694
|
-
for (let index = 0; index + start < end; index++) {
|
|
41695
|
-
const record = table.dataSource.get(index);
|
|
41696
|
-
state._checkboxCellTypeFields.forEach(field => {
|
|
41697
|
-
const value = record[field];
|
|
41698
|
-
let isChecked;
|
|
41699
|
-
if (isObject$4(value) ? isChecked = value.checked : "boolean" == typeof value && (isChecked = value), null == isChecked) {
|
|
41700
|
-
const headerCheckFunc = state._headerCheckFuncs[field];
|
|
41701
|
-
if (headerCheckFunc) {
|
|
41702
|
-
const cellAddr = state.table.getCellAddrByFieldRecord(field, index);
|
|
41703
|
-
isChecked = getOrApply(headerCheckFunc, {
|
|
41704
|
-
col: cellAddr.col,
|
|
41705
|
-
row: cellAddr.row,
|
|
41706
|
-
table: state.table,
|
|
41707
|
-
context: null,
|
|
41708
|
-
value: value
|
|
41709
|
-
});
|
|
41710
|
-
}
|
|
41711
|
-
}
|
|
41712
|
-
const dataIndex = state.table.dataSource.getIndexKey(index).toString();
|
|
41713
|
-
state.checkedState.get(dataIndex) || state.checkedState.set(dataIndex, {}), state.checkedState.get(dataIndex)[field] = isChecked;
|
|
41714
|
-
});
|
|
41715
|
-
}
|
|
41716
|
-
}
|
|
41717
41686
|
|
|
41718
41687
|
function updateResizeRow(xInTable, yInTable, state) {
|
|
41719
41688
|
xInTable = Math.ceil(xInTable), yInTable = Math.ceil(yInTable);
|
|
@@ -41801,7 +41770,7 @@
|
|
|
41801
41770
|
|
|
41802
41771
|
class StateManager {
|
|
41803
41772
|
constructor(table) {
|
|
41804
|
-
this.fastScrolling = !1, this.checkedState =
|
|
41773
|
+
this.fastScrolling = !1, this.checkedState = [], this.headerCheckedState = {}, this._checkboxCellTypeFields = [], this._headerCheckFuncs = {}, this.radioState = {}, this.resetInteractionState = debounce(state => {
|
|
41805
41774
|
this.updateInteractionState(null != state ? state : InteractionState.default);
|
|
41806
41775
|
}, 100), this.table = table, this.initState(), this.updateVerticalScrollBar = this.updateVerticalScrollBar.bind(this), this.updateHorizontalScrollBar = this.updateHorizontalScrollBar.bind(this);
|
|
41807
41776
|
}
|
|
@@ -42481,7 +42450,7 @@
|
|
|
42481
42450
|
return syncRadioState(col, row, field, radioType, indexInCell, isChecked, this);
|
|
42482
42451
|
}
|
|
42483
42452
|
changeCheckboxAndRadioOrder(sourceIndex, targetIndex) {
|
|
42484
|
-
this.checkedState.
|
|
42453
|
+
this.checkedState.length && changeCheckboxOrder(sourceIndex, targetIndex, this), this.radioState.length && changeRadioOrder(sourceIndex, targetIndex, this);
|
|
42485
42454
|
}
|
|
42486
42455
|
setCustomSelectRanges(customSelectRanges) {
|
|
42487
42456
|
deletaCustomSelectRanges(this), addCustomSelectRanges(customSelectRanges, this);
|
|
@@ -46407,7 +46376,7 @@
|
|
|
46407
46376
|
constructor(container) {
|
|
46408
46377
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
46409
46378
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
46410
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.13.3-alpha.
|
|
46379
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.13.3-alpha.1", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
|
|
46411
46380
|
const {
|
|
46412
46381
|
frozenColCount = 0,
|
|
46413
46382
|
frozenRowCount: frozenRowCount,
|
|
@@ -50609,11 +50578,11 @@
|
|
|
50609
50578
|
this.scenegraph.clearCells(), this.sortState ? (this.dataSource.updateFilterRulesForSorted(filterRules), sortRecords(this)) : this.dataSource.updateFilterRules(filterRules), this.refreshRowColCount(), this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph();
|
|
50610
50579
|
}
|
|
50611
50580
|
getCheckboxState(field) {
|
|
50612
|
-
if (this.stateManager.checkedState.
|
|
50613
|
-
let stateArr = this.stateManager.checkedState
|
|
50581
|
+
if (this.stateManager.checkedState.length < this.rowCount - this.columnHeaderLevelCount && this.stateManager.initLeftRecordsCheckState(this.records), isValid$1(field)) {
|
|
50582
|
+
let stateArr = this.stateManager.checkedState;
|
|
50614
50583
|
return this.options.groupBy && (stateArr = getGroupCheckboxState(this)), stateArr.map(state => state[field]);
|
|
50615
50584
|
}
|
|
50616
|
-
return
|
|
50585
|
+
return this.stateManager.checkedState;
|
|
50617
50586
|
}
|
|
50618
50587
|
getCellCheckboxState(col, row) {
|
|
50619
50588
|
var _a;
|
|
@@ -50621,8 +50590,8 @@
|
|
|
50621
50590
|
field = null == define ? void 0 : define.field,
|
|
50622
50591
|
cellType = this.getCellType(col, row);
|
|
50623
50592
|
if (isValid$1(field) && "checkbox" === cellType) {
|
|
50624
|
-
const dataIndex = this.dataSource.getIndexKey(this.getRecordShowIndexByCell(col, row))
|
|
50625
|
-
return null === (_a = this.stateManager.checkedState
|
|
50593
|
+
const dataIndex = this.dataSource.getIndexKey(this.getRecordShowIndexByCell(col, row));
|
|
50594
|
+
return null === (_a = this.stateManager.checkedState[dataIndex]) || void 0 === _a ? void 0 : _a[field];
|
|
50626
50595
|
}
|
|
50627
50596
|
}
|
|
50628
50597
|
getRadioState(field) {
|