@visactor/vtable-calendar 1.13.1-alpha.6 → 1.13.1-alpha.8
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 +78 -90
- package/dist/vtable-calendar.min.js +1 -1
- package/package.json +4 -4
package/dist/vtable-calendar.js
CHANGED
|
@@ -1794,19 +1794,10 @@
|
|
|
1794
1794
|
}
|
|
1795
1795
|
function isRotateAABBIntersect(box1, box2) {
|
|
1796
1796
|
let isDeg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
|
|
1797
|
-
let ctx = arguments.length > 3 ? arguments[3] : undefined;
|
|
1798
1797
|
const rect1 = toRect(box1, isDeg),
|
|
1799
1798
|
rect2 = toRect(box2, isDeg),
|
|
1800
|
-
vector = (start, end) => [end.x - start.x, end.y - start.y]
|
|
1801
|
-
|
|
1802
|
-
0 === index ? ctx.moveTo(item.x, item.y) : ctx.lineTo(item.x, item.y);
|
|
1803
|
-
}), ctx.fill(), ctx.restore(), ctx.save(), ctx.fillStyle = "green", ctx.globalAlpha = .6, rect2.forEach((item, index) => {
|
|
1804
|
-
0 === index ? ctx.moveTo(item.x, item.y) : ctx.lineTo(item.x, item.y);
|
|
1805
|
-
}), ctx.fill(), ctx.restore());
|
|
1806
|
-
const p1 = getCenterPoint(box1),
|
|
1807
|
-
p2 = getCenterPoint(box2);
|
|
1808
|
-
ctx && ctx.fillRect(p1.x, p1.y, 2, 2), ctx && ctx.fillRect(p2.x, p2.y, 2, 2);
|
|
1809
|
-
const vp1p2 = vector(p1, p2),
|
|
1799
|
+
vector = (start, end) => [end.x - start.x, end.y - start.y],
|
|
1800
|
+
vp1p2 = vector(getCenterPoint(box1), getCenterPoint(box2)),
|
|
1810
1801
|
AB = vector(rect1[0], rect1[1]),
|
|
1811
1802
|
BC = vector(rect1[1], rect1[2]),
|
|
1812
1803
|
A1B1 = vector(rect2[0], rect2[1]),
|
|
@@ -2195,7 +2186,8 @@
|
|
|
2195
2186
|
class OBBBounds extends Bounds$1 {
|
|
2196
2187
|
constructor(bounds) {
|
|
2197
2188
|
let angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
2198
|
-
|
|
2189
|
+
var _a;
|
|
2190
|
+
super(bounds), bounds && (this.angle = null !== (_a = bounds.angle) && void 0 !== _a ? _a : angle);
|
|
2199
2191
|
}
|
|
2200
2192
|
intersects(b) {
|
|
2201
2193
|
return isRotateAABBIntersect(this, b);
|
|
@@ -2208,6 +2200,9 @@
|
|
|
2208
2200
|
let angle = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
2209
2201
|
return super.setValue(x1, y1, x2, y2), this.angle = angle, this;
|
|
2210
2202
|
}
|
|
2203
|
+
clone() {
|
|
2204
|
+
return new OBBBounds(this);
|
|
2205
|
+
}
|
|
2211
2206
|
}
|
|
2212
2207
|
|
|
2213
2208
|
class Matrix {
|
|
@@ -2658,6 +2653,8 @@
|
|
|
2658
2653
|
return color.getLuminance2();
|
|
2659
2654
|
case "lum3":
|
|
2660
2655
|
return color.getLuminance3();
|
|
2656
|
+
case "wcag":
|
|
2657
|
+
return color.getLuminanceWCAG();
|
|
2661
2658
|
}
|
|
2662
2659
|
}
|
|
2663
2660
|
static parseColorString(value) {
|
|
@@ -2759,6 +2756,14 @@
|
|
|
2759
2756
|
getLuminance3() {
|
|
2760
2757
|
return (.299 * this.color.r + .587 * this.color.g + .114 * this.color.b) / 255;
|
|
2761
2758
|
}
|
|
2759
|
+
getLuminanceWCAG() {
|
|
2760
|
+
const RsRGB = this.color.r / 255,
|
|
2761
|
+
GsRGB = this.color.g / 255,
|
|
2762
|
+
BsRGB = this.color.b / 255;
|
|
2763
|
+
let R, G, B;
|
|
2764
|
+
R = RsRGB <= .03928 ? RsRGB / 12.92 : Math.pow((RsRGB + .055) / 1.055, 2.4), G = GsRGB <= .03928 ? GsRGB / 12.92 : Math.pow((GsRGB + .055) / 1.055, 2.4), B = BsRGB <= .03928 ? BsRGB / 12.92 : Math.pow((BsRGB + .055) / 1.055, 2.4);
|
|
2765
|
+
return .2126 * R + .7152 * G + .0722 * B;
|
|
2766
|
+
}
|
|
2762
2767
|
clone() {
|
|
2763
2768
|
return new Color(this.color.toString());
|
|
2764
2769
|
}
|
|
@@ -4799,6 +4804,9 @@
|
|
|
4799
4804
|
}
|
|
4800
4805
|
compatibleMetrics(metrics, options) {
|
|
4801
4806
|
if (null == metrics.actualBoundingBoxAscent || null == metrics.actualBoundingBoxDescent || null == metrics.fontBoundingBoxAscent || null == metrics.fontBoundingBoxDescent) {
|
|
4807
|
+
metrics = {
|
|
4808
|
+
width: metrics.width
|
|
4809
|
+
};
|
|
4802
4810
|
const {
|
|
4803
4811
|
ascent: ascent,
|
|
4804
4812
|
descent: descent
|
|
@@ -4806,6 +4814,13 @@
|
|
|
4806
4814
|
metrics.actualBoundingBoxAscent = ascent, metrics.actualBoundingBoxDescent = descent, metrics.fontBoundingBoxAscent = ascent, metrics.fontBoundingBoxDescent = descent;
|
|
4807
4815
|
}
|
|
4808
4816
|
if (null == metrics.actualBoundingBoxLeft || null == metrics.actualBoundingBoxRight) {
|
|
4817
|
+
metrics = {
|
|
4818
|
+
width: metrics.width,
|
|
4819
|
+
actualBoundingBoxAscent: metrics.actualBoundingBoxAscent,
|
|
4820
|
+
actualBoundingBoxDescent: metrics.actualBoundingBoxDescent,
|
|
4821
|
+
fontBoundingBoxAscent: metrics.fontBoundingBoxAscent,
|
|
4822
|
+
fontBoundingBoxDescent: metrics.fontBoundingBoxDescent
|
|
4823
|
+
};
|
|
4809
4824
|
const {
|
|
4810
4825
|
left: left,
|
|
4811
4826
|
right: right
|
|
@@ -12229,10 +12244,7 @@
|
|
|
12229
12244
|
const {
|
|
12230
12245
|
context: context
|
|
12231
12246
|
} = drawContext;
|
|
12232
|
-
context.highPerformanceSave()
|
|
12233
|
-
const t1 = graphic.parent.globalTransMatrix,
|
|
12234
|
-
t2 = graphic.stage.window.getViewBoxTransform().clone().multiply(t1.a, t1.b, t1.c, t1.d, t1.e, t1.f);
|
|
12235
|
-
if (graphic.parent && context.setTransformFromMatrix(t2, !0), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {
|
|
12247
|
+
if (context.highPerformanceSave(), context.transformFromMatrix(graphic.transMatrix, !0), drawContribution.dirtyBounds && drawContribution.backupDirtyBounds) {
|
|
12236
12248
|
tempDirtyBounds.copy(drawContribution.dirtyBounds), tempBackupDirtyBounds.copy(drawContribution.backupDirtyBounds);
|
|
12237
12249
|
const m = graphic.globalTransMatrix.getInverse();
|
|
12238
12250
|
drawContribution.dirtyBounds.copy(drawContribution.backupDirtyBounds).transformWithMatrix(m), drawContribution.backupDirtyBounds.copy(drawContribution.dirtyBounds);
|
|
@@ -41524,10 +41536,8 @@
|
|
|
41524
41536
|
function setCheckedState(col, row, field, checked, state) {
|
|
41525
41537
|
const recordIndex = state.table.getRecordShowIndexByCell(col, row);
|
|
41526
41538
|
if (recordIndex >= 0) {
|
|
41527
|
-
const dataIndex = state.table.dataSource.getIndexKey(recordIndex)
|
|
41528
|
-
state.checkedState
|
|
41529
|
-
[field]: checked
|
|
41530
|
-
});
|
|
41539
|
+
const dataIndex = state.table.dataSource.getIndexKey(recordIndex);
|
|
41540
|
+
state.checkedState[dataIndex] || (state.checkedState[dataIndex] = {}), state.checkedState[dataIndex][field] = checked;
|
|
41531
41541
|
}
|
|
41532
41542
|
}
|
|
41533
41543
|
function setHeaderCheckedState(field, checked, state) {
|
|
@@ -41541,23 +41551,21 @@
|
|
|
41541
41551
|
if (state.table.isHeader(col, row)) {
|
|
41542
41552
|
if (isValid$1(state.headerCheckedState[field])) return state.headerCheckedState[field];
|
|
41543
41553
|
if ("function" == typeof checked) return;
|
|
41544
|
-
if (isValid$1(checked)) state.headerCheckedState[field] = checked;else if ((null === (_a = state.checkedState) || void 0 === _a ? void 0 : _a.
|
|
41554
|
+
if (isValid$1(checked)) state.headerCheckedState[field] = checked;else if ((null === (_a = state.checkedState) || void 0 === _a ? void 0 : _a.length) > 0) {
|
|
41545
41555
|
return state.updateHeaderCheckedState(field, col, row);
|
|
41546
41556
|
}
|
|
41547
41557
|
return state.headerCheckedState[field];
|
|
41548
41558
|
}
|
|
41549
41559
|
const recordIndex = state.table.getRecordShowIndexByCell(col, row);
|
|
41550
41560
|
if (recordIndex >= 0) {
|
|
41551
|
-
const dataIndex = state.table.dataSource.getIndexKey(recordIndex)
|
|
41552
|
-
if (isValid$1(null === (_b = state.checkedState
|
|
41553
|
-
state.checkedState
|
|
41554
|
-
[field]: checked
|
|
41555
|
-
});
|
|
41561
|
+
const dataIndex = state.table.dataSource.getIndexKey(recordIndex);
|
|
41562
|
+
if (isValid$1(null === (_b = state.checkedState[dataIndex]) || void 0 === _b ? void 0 : _b[field])) return state.checkedState[dataIndex][field];
|
|
41563
|
+
state.checkedState[dataIndex] || (state.checkedState[dataIndex] = {}), state.checkedState[dataIndex][field] = checked;
|
|
41556
41564
|
}
|
|
41557
41565
|
return checked;
|
|
41558
41566
|
}
|
|
41559
41567
|
function initCheckedState(records, state) {
|
|
41560
|
-
state.checkedState
|
|
41568
|
+
state.checkedState = [], state.headerCheckedState = {}, state.radioState = {};
|
|
41561
41569
|
let isNeedInitHeaderCheckedStateFromRecord = !1;
|
|
41562
41570
|
if (state._checkboxCellTypeFields = [], state._headerCheckFuncs = {}, state.table.internalProps.layoutMap.headerObjects.forEach((hd, index) => {
|
|
41563
41571
|
if ("checkbox" === hd.headerType) {
|
|
@@ -41585,32 +41593,29 @@
|
|
|
41585
41593
|
});
|
|
41586
41594
|
}
|
|
41587
41595
|
}
|
|
41588
|
-
|
|
41589
|
-
state.checkedState.get(dataIndex) || state.checkedState.set(dataIndex, {}), state.checkedState.get(dataIndex)[field] = isChecked;
|
|
41596
|
+
state.checkedState[index] || (state.checkedState[index] = {}), state.checkedState[index][field] = isChecked;
|
|
41590
41597
|
});
|
|
41591
41598
|
}));
|
|
41592
41599
|
}
|
|
41593
41600
|
function updateHeaderCheckedState(field, state, col, row) {
|
|
41594
|
-
|
|
41595
|
-
|
|
41596
|
-
|
|
41597
|
-
|
|
41598
|
-
|
|
41599
|
-
|
|
41600
|
-
|
|
41601
|
-
|
|
41602
|
-
|
|
41603
|
-
|
|
41601
|
+
const allChecked = state.checkedState.every((check_state, index) => {
|
|
41602
|
+
const tableIndex = state.table.getTableIndexByRecordIndex(index);
|
|
41603
|
+
return !!(state.table.transpose ? state.table.getCustomMerge(tableIndex, row) : state.table.getCustomMerge(col, tableIndex)) || !0 === (null == check_state ? void 0 : check_state[field]);
|
|
41604
|
+
});
|
|
41605
|
+
if (allChecked) return state.headerCheckedState[field] = !0, allChecked;
|
|
41606
|
+
if (state.checkedState.every((check_state, index) => {
|
|
41607
|
+
const tableIndex = state.table.getTableIndexByRecordIndex(index);
|
|
41608
|
+
return !!(state.table.transpose ? state.table.getCustomMerge(tableIndex, row) : state.table.getCustomMerge(col, tableIndex)) || !1 === (null == check_state ? void 0 : check_state[field]);
|
|
41609
|
+
})) return state.headerCheckedState[field] = !1, !1;
|
|
41610
|
+
return !!state.checkedState.find(check_state => !0 === (null == check_state ? void 0 : check_state[field])) && (state.headerCheckedState[field] = "indeterminate", "indeterminate");
|
|
41604
41611
|
}
|
|
41605
41612
|
function initLeftRecordsCheckState(records, state) {
|
|
41606
|
-
for (let index = state.checkedState.
|
|
41613
|
+
for (let index = state.checkedState.length; index < records.length; index++) {
|
|
41607
41614
|
const record = records[index];
|
|
41608
41615
|
state._checkboxCellTypeFields.forEach(field => {
|
|
41609
41616
|
const value = record[field];
|
|
41610
41617
|
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;
|
|
41618
|
+
isObject$4(value) ? isChecked = value.checked : "boolean" == typeof value && (isChecked = value), state.checkedState[index] || (state.checkedState[index] = {}), state.checkedState[index][field] = isChecked;
|
|
41614
41619
|
});
|
|
41615
41620
|
}
|
|
41616
41621
|
}
|
|
@@ -41643,35 +41648,14 @@
|
|
|
41643
41648
|
checkedState: checkedState,
|
|
41644
41649
|
table: table
|
|
41645
41650
|
} = 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);
|
|
41651
|
+
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) {
|
|
41652
|
+
const sourceRecord = checkedState[sourceIndex];
|
|
41653
|
+
for (let i = sourceIndex; i > targetIndex; i--) checkedState[i] = checkedState[i - 1];
|
|
41654
|
+
checkedState[targetIndex] = sourceRecord;
|
|
41666
41655
|
} 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);
|
|
41656
|
+
const sourceRecord = checkedState[sourceIndex];
|
|
41657
|
+
for (let i = sourceIndex; i < targetIndex; i++) checkedState[i] = checkedState[i + 1];
|
|
41658
|
+
checkedState[targetIndex] = sourceRecord;
|
|
41675
41659
|
}
|
|
41676
41660
|
}
|
|
41677
41661
|
function getGroupCheckboxState(table) {
|
|
@@ -41683,7 +41667,7 @@
|
|
|
41683
41667
|
const {
|
|
41684
41668
|
vtableOriginIndex: vtableOriginIndex
|
|
41685
41669
|
} = dataSource.getRawRecord(indexArr);
|
|
41686
|
-
result[vtableOriginIndex] = table.stateManager.checkedState
|
|
41670
|
+
result[vtableOriginIndex] = table.stateManager.checkedState[indexArr];
|
|
41687
41671
|
}
|
|
41688
41672
|
}), result;
|
|
41689
41673
|
}
|
|
@@ -41774,7 +41758,7 @@
|
|
|
41774
41758
|
|
|
41775
41759
|
class StateManager {
|
|
41776
41760
|
constructor(table) {
|
|
41777
|
-
this.fastScrolling = !1, this.checkedState =
|
|
41761
|
+
this.fastScrolling = !1, this.checkedState = [], this.headerCheckedState = {}, this._checkboxCellTypeFields = [], this._headerCheckFuncs = {}, this.radioState = {}, this.resetInteractionState = debounce(state => {
|
|
41778
41762
|
this.updateInteractionState(null != state ? state : InteractionState.default);
|
|
41779
41763
|
}, 100), this.table = table, this.initState(), this.updateVerticalScrollBar = this.updateVerticalScrollBar.bind(this), this.updateHorizontalScrollBar = this.updateHorizontalScrollBar.bind(this);
|
|
41780
41764
|
}
|
|
@@ -42457,7 +42441,7 @@
|
|
|
42457
42441
|
return syncRadioState(col, row, field, radioType, indexInCell, isChecked, this);
|
|
42458
42442
|
}
|
|
42459
42443
|
changeCheckboxAndRadioOrder(sourceIndex, targetIndex) {
|
|
42460
|
-
this.checkedState.
|
|
42444
|
+
this.checkedState.length && changeCheckboxOrder(sourceIndex, targetIndex, this), this.radioState.length && changeRadioOrder(sourceIndex, targetIndex, this);
|
|
42461
42445
|
}
|
|
42462
42446
|
setCustomSelectRanges(customSelectRanges) {
|
|
42463
42447
|
deletaCustomSelectRanges(this), addCustomSelectRanges(customSelectRanges, this);
|
|
@@ -46166,7 +46150,7 @@
|
|
|
46166
46150
|
if (cellStyle.customStyleId === customStyleId) if (cellPos.range) for (let col = Math.max(0, cellPos.range.start.col); col <= Math.min(this.table.colCount - 1, cellPos.range.end.col); col++) for (let row = Math.max(0, cellPos.range.start.row); row <= Math.min(this.table.rowCount - 1, cellPos.range.end.row); row++) this.table.scenegraph.updateCellContent(col, row);else this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row);
|
|
46167
46151
|
}), this.table.scenegraph.updateNextFrame();
|
|
46168
46152
|
}
|
|
46169
|
-
arrangeCustomCellStyle(cellPos, customStyleId) {
|
|
46153
|
+
arrangeCustomCellStyle(cellPos, customStyleId, forceFastUpdate) {
|
|
46170
46154
|
var _a;
|
|
46171
46155
|
const index = this.customCellStyleArrangement.findIndex(style => style.cellPosition.range && cellPos.range ? style.cellPosition.range.start.col === cellPos.range.start.col && style.cellPosition.range.start.row === cellPos.range.start.row && style.cellPosition.range.end.col === cellPos.range.end.col && style.cellPosition.range.end.row === cellPos.range.end.row : style.cellPosition.col === cellPos.col && style.cellPosition.row === cellPos.row);
|
|
46172
46156
|
if (-1 === index && !customStyleId) return;
|
|
@@ -46182,7 +46166,6 @@
|
|
|
46182
46166
|
customStyleId ? this.customCellStyleArrangement[index].customStyleId = customStyleId : this.customCellStyleArrangement.splice(index, 1);
|
|
46183
46167
|
}
|
|
46184
46168
|
const style = null === (_a = this.getCustomCellStyleOption(customStyleId)) || void 0 === _a ? void 0 : _a.style;
|
|
46185
|
-
let forceFastUpdate;
|
|
46186
46169
|
if (style) {
|
|
46187
46170
|
forceFastUpdate = !0;
|
|
46188
46171
|
for (const key in style) if (-1 === cellStyleKeys.indexOf(key)) {
|
|
@@ -46354,7 +46337,7 @@
|
|
|
46354
46337
|
constructor(container) {
|
|
46355
46338
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
46356
46339
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
46357
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.13.1-alpha.
|
|
46340
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.13.1-alpha.8", 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");
|
|
46358
46341
|
const {
|
|
46359
46342
|
frozenColCount = 0,
|
|
46360
46343
|
frozenRowCount: frozenRowCount,
|
|
@@ -48049,9 +48032,9 @@
|
|
|
48049
48032
|
var _a;
|
|
48050
48033
|
null === (_a = this.customCellStylePlugin) || void 0 === _a || _a.registerCustomCellStyle(customStyleId, customStyle);
|
|
48051
48034
|
}
|
|
48052
|
-
arrangeCustomCellStyle(cellPos, customStyleId) {
|
|
48035
|
+
arrangeCustomCellStyle(cellPos, customStyleId, forceFastUpdate) {
|
|
48053
48036
|
var _a;
|
|
48054
|
-
null === (_a = this.customCellStylePlugin) || void 0 === _a || _a.arrangeCustomCellStyle(cellPos, customStyleId);
|
|
48037
|
+
null === (_a = this.customCellStylePlugin) || void 0 === _a || _a.arrangeCustomCellStyle(cellPos, customStyleId, forceFastUpdate);
|
|
48055
48038
|
}
|
|
48056
48039
|
isSeriesNumber(col, row) {
|
|
48057
48040
|
return this.internalProps.layoutMap.isSeriesNumber(col, row);
|
|
@@ -49538,7 +49521,7 @@
|
|
|
49538
49521
|
}
|
|
49539
49522
|
}
|
|
49540
49523
|
|
|
49541
|
-
class
|
|
49524
|
+
class EditManager {
|
|
49542
49525
|
constructor(table) {
|
|
49543
49526
|
this.isValidatingValue = !1, this.table = table, this.bindEvent();
|
|
49544
49527
|
}
|
|
@@ -49614,14 +49597,16 @@
|
|
|
49614
49597
|
} else if (!editor.isEditorElement || editor.isEditorElement(target)) return !1;
|
|
49615
49598
|
if (this.editingEditor.getValue, this.editingEditor.validateValue) {
|
|
49616
49599
|
this.isValidatingValue = !0;
|
|
49617
|
-
const
|
|
49600
|
+
const newValue = this.editingEditor.getValue(),
|
|
49601
|
+
oldValue = this.table.getCellOriginValue(this.editCell.col, this.editCell.row),
|
|
49602
|
+
maybePromiseOrValue = null === (_b = (_a = this.editingEditor).validateValue) || void 0 === _b ? void 0 : _b.call(_a, newValue, oldValue, this.editCell, this.table);
|
|
49618
49603
|
return isPromise(maybePromiseOrValue) ? new Promise((resolve, reject) => {
|
|
49619
49604
|
maybePromiseOrValue.then(result => {
|
|
49620
|
-
result
|
|
49605
|
+
dealWithValidateValue(result, this, oldValue, resolve);
|
|
49621
49606
|
}).catch(err => {
|
|
49622
49607
|
this.isValidatingValue = !1, reject(err);
|
|
49623
49608
|
});
|
|
49624
|
-
}) :
|
|
49609
|
+
}) : dealWithValidateValue(maybePromiseOrValue, this, oldValue);
|
|
49625
49610
|
}
|
|
49626
49611
|
return this.doExit(), !0;
|
|
49627
49612
|
}
|
|
@@ -49642,6 +49627,9 @@
|
|
|
49642
49627
|
this.editingEditor && (null === (_b = (_a = this.editingEditor).exit) || void 0 === _b || _b.call(_a), null === (_d = (_c = this.editingEditor).onEnd) || void 0 === _d || _d.call(_c), this.editingEditor = null);
|
|
49643
49628
|
}
|
|
49644
49629
|
}
|
|
49630
|
+
function dealWithValidateValue(validateValue, editManager, oldValue, resolve) {
|
|
49631
|
+
return editManager.isValidatingValue = !1, "validate-return" === validateValue ? (editManager.doExit(), null == resolve || resolve(!0), !0) : "invalidate-return" === validateValue ? (editManager.editingEditor.setValue(oldValue), editManager.doExit(), null == resolve || resolve(!0), !0) : "validate-not-return" === validateValue || "invalidate-not-return" === validateValue ? (null == resolve || resolve(!1), !1) : !0 === validateValue ? (editManager.doExit(), null == resolve || resolve(!0), !0) : (null == resolve || resolve(!1), !1);
|
|
49632
|
+
}
|
|
49645
49633
|
|
|
49646
49634
|
function getGroupByDataConfig(groupByOption) {
|
|
49647
49635
|
if (isString$2(groupByOption)) return {
|
|
@@ -49726,7 +49714,7 @@
|
|
|
49726
49714
|
oldValue = oldValues[i][j],
|
|
49727
49715
|
value = rowValues[j],
|
|
49728
49716
|
maybePromiseOrValue = null === (_b = null === (_a = null == editor ? void 0 : editor.validateValue) || void 0 === _a ? void 0 : _a.call(editor, value, oldValue)) || void 0 === _b || _b;
|
|
49729
|
-
isCanChange = !!isPromise(maybePromiseOrValue) || maybePromiseOrValue;
|
|
49717
|
+
isCanChange = !!isPromise(maybePromiseOrValue) || !0 === maybePromiseOrValue || "validate-return" === maybePromiseOrValue || "invalidate-return" === maybePromiseOrValue;
|
|
49730
49718
|
}
|
|
49731
49719
|
if (isCanChange) {
|
|
49732
49720
|
const value = rowValues[j],
|
|
@@ -50143,7 +50131,7 @@
|
|
|
50143
50131
|
var _a, _b, _c, _d, _e, _f;
|
|
50144
50132
|
"node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), super(container, options), this.showHeader = !0;
|
|
50145
50133
|
const internalProps = this.internalProps;
|
|
50146
|
-
if (internalProps.frozenColDragHeaderMode = options.frozenColDragHeaderMode, this.pagination = options.pagination, internalProps.sortState = options.sortState, internalProps.multipleSort = !!options.multipleSort, internalProps.dataConfig = options.groupBy ? getGroupByDataConfig(options.groupBy) : {}, internalProps.columns = options.columns ? cloneDeepSpec(options.columns, ["children"]) : options.header ? cloneDeepSpec(options.header, ["children"]) : [], generateAggregationForColumn(this), internalProps.enableTreeNodeMerge = null !== (_b = null !== (_a = options.enableTreeNodeMerge) && void 0 !== _a ? _a : isValid$1(options.groupBy)) && void 0 !== _b && _b, this.internalProps.headerHelper.setTableColumnsEditor(), this.showHeader = null === (_c = options.showHeader) || void 0 === _c || _c, this.transpose = null !== (_d = options.transpose) && void 0 !== _d && _d, "node" !== Env.mode && (this.editorManager = new
|
|
50134
|
+
if (internalProps.frozenColDragHeaderMode = options.frozenColDragHeaderMode, this.pagination = options.pagination, internalProps.sortState = options.sortState, internalProps.multipleSort = !!options.multipleSort, internalProps.dataConfig = options.groupBy ? getGroupByDataConfig(options.groupBy) : {}, internalProps.columns = options.columns ? cloneDeepSpec(options.columns, ["children"]) : options.header ? cloneDeepSpec(options.header, ["children"]) : [], generateAggregationForColumn(this), internalProps.enableTreeNodeMerge = null !== (_b = null !== (_a = options.enableTreeNodeMerge) && void 0 !== _a ? _a : isValid$1(options.groupBy)) && void 0 !== _b && _b, this.internalProps.headerHelper.setTableColumnsEditor(), this.showHeader = null === (_c = options.showHeader) || void 0 === _c || _c, this.transpose = null !== (_d = options.transpose) && void 0 !== _d && _d, "node" !== Env.mode && (this.editorManager = new EditManager(this)), this.refreshHeader(), this.internalProps.useOneRowHeightFillAll = !1, options.dataSource ? _setDataSource(this, options.dataSource) : options.records ? this.setRecords(options.records, {
|
|
50147
50135
|
sortState: internalProps.sortState
|
|
50148
50136
|
}) : this.setRecords([]), options.title) {
|
|
50149
50137
|
const Title = Factory.getComponent("title");
|
|
@@ -50556,11 +50544,11 @@
|
|
|
50556
50544
|
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();
|
|
50557
50545
|
}
|
|
50558
50546
|
getCheckboxState(field) {
|
|
50559
|
-
if (this.stateManager.checkedState.
|
|
50560
|
-
let stateArr = this.stateManager.checkedState
|
|
50547
|
+
if (this.stateManager.checkedState.length < this.rowCount - this.columnHeaderLevelCount && this.stateManager.initLeftRecordsCheckState(this.records), isValid$1(field)) {
|
|
50548
|
+
let stateArr = this.stateManager.checkedState;
|
|
50561
50549
|
return this.options.groupBy && (stateArr = getGroupCheckboxState(this)), stateArr.map(state => state[field]);
|
|
50562
50550
|
}
|
|
50563
|
-
return
|
|
50551
|
+
return this.stateManager.checkedState;
|
|
50564
50552
|
}
|
|
50565
50553
|
getCellCheckboxState(col, row) {
|
|
50566
50554
|
var _a;
|
|
@@ -50568,8 +50556,8 @@
|
|
|
50568
50556
|
field = null == define ? void 0 : define.field,
|
|
50569
50557
|
cellType = this.getCellType(col, row);
|
|
50570
50558
|
if (isValid$1(field) && "checkbox" === cellType) {
|
|
50571
|
-
const dataIndex = this.dataSource.getIndexKey(this.getRecordShowIndexByCell(col, row))
|
|
50572
|
-
return null === (_a = this.stateManager.checkedState
|
|
50559
|
+
const dataIndex = this.dataSource.getIndexKey(this.getRecordShowIndexByCell(col, row));
|
|
50560
|
+
return null === (_a = this.stateManager.checkedState[dataIndex]) || void 0 === _a ? void 0 : _a[field];
|
|
50573
50561
|
}
|
|
50574
50562
|
}
|
|
50575
50563
|
getRadioState(field) {
|