@visactor/vtable 0.24.0 → 0.24.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/cjs/ListTable.js +7 -25
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.js +5 -17
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.d.ts +4 -4
- package/cjs/PivotTable.js +32 -29
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +1 -0
- package/cjs/core/BaseTable.js +17 -6
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/dataset/flatDataToObject.d.ts +7 -0
- package/cjs/dataset/flatDataToObject.js +3 -0
- package/cjs/dataset/flatDataToObject.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/pivot-header-layout.js +8 -6
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/row-height-map.js +3 -1
- package/cjs/layout/row-height-map.js.map +1 -1
- package/cjs/layout/simple-header-layout.js +17 -1
- package/cjs/layout/simple-header-layout.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/scenegraph/scenegraph.js +1 -1
- package/cjs/themes/component.js +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +110 -97
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.js +7 -25
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.js +5 -17
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.d.ts +4 -4
- package/es/PivotTable.js +31 -28
- package/es/PivotTable.js.map +1 -1
- package/es/core/BaseTable.d.ts +1 -0
- package/es/core/BaseTable.js +17 -6
- package/es/core/BaseTable.js.map +1 -1
- package/es/dataset/flatDataToObject.d.ts +7 -0
- package/es/dataset/flatDataToObject.js +3 -0
- package/es/dataset/flatDataToObject.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/pivot-header-layout.js +8 -6
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/row-height-map.js +3 -1
- package/es/layout/row-height-map.js.map +1 -1
- package/es/layout/simple-header-layout.js +17 -1
- package/es/layout/simple-header-layout.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.js +1 -1
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.js +1 -1
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/scenegraph/scenegraph.js +1 -1
- package/es/themes/component.js +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +2 -2
package/cjs/PivotTable.js
CHANGED
|
@@ -107,8 +107,8 @@ class PivotTable extends BaseTable_1.BaseTable {
|
|
|
107
107
|
})), this.internalProps.columnTree = !options.indicatorsAsCol || (null === (_c = options.columns) || void 0 === _c ? void 0 : _c.length) || options.columnTree ? (0,
|
|
108
108
|
vutils_1.cloneDeep)(options.columnTree) : [], this.internalProps.rowTree = options.indicatorsAsCol || (null === (_d = options.rows) || void 0 === _d ? void 0 : _d.length) || options.rowTree ? (0,
|
|
109
109
|
vutils_1.cloneDeep)(options.rowTree) : [], options.records && (this.internalProps.records = options.records),
|
|
110
|
-
this.stateManager.initCheckedState(this.internalProps.records), this.
|
|
111
|
-
internalProps.columnResizeType = null !== (_e = options.columnResizeType) && void 0 !== _e ? _e : "column",
|
|
110
|
+
this.stateManager.initCheckedState(this.internalProps.records), this.stateManager.updateDrillState(void 0, void 0, !1, !1, -1, -1),
|
|
111
|
+
this.pagination = options.pagination, internalProps.columnResizeType = null !== (_e = options.columnResizeType) && void 0 !== _e ? _e : "column",
|
|
112
112
|
internalProps.dataConfig = (0, vutils_1.cloneDeep)(options.dataConfig), options.rowTree || options.columnTree ? internalProps.enableDataAnalysis = !1 : internalProps.enableDataAnalysis = !0,
|
|
113
113
|
"tree" === (null == options ? void 0 : options.rowHierarchyType) && "tree" === this.internalProps.layoutMap.rowHierarchyType && this.internalProps.layoutMap.rowExpandLevel === (null == options ? void 0 : options.rowExpandLevel)) {
|
|
114
114
|
const beforeRowDimensions = this.internalProps.layoutMap.rowDimensionTree.tree.children;
|
|
@@ -158,15 +158,7 @@ class PivotTable extends BaseTable_1.BaseTable {
|
|
|
158
158
|
this.refreshRowColCount(), this.scenegraph.createSceneGraph(), this.render());
|
|
159
159
|
}
|
|
160
160
|
refreshHeader() {
|
|
161
|
-
|
|
162
|
-
const internalProps = this.internalProps;
|
|
163
|
-
for (let col = 0; col < internalProps.layoutMap.columnWidths.length; col++) {
|
|
164
|
-
const {width: width, minWidth: minWidth, maxWidth: maxWidth} = null !== (_b = null === (_a = internalProps.layoutMap.columnWidths) || void 0 === _a ? void 0 : _a[col]) && void 0 !== _b ? _b : {};
|
|
165
|
-
width && ("string" == typeof width && "auto" !== width || "number" == typeof width && width > 0) && this._setColWidth(col, width),
|
|
166
|
-
minWidth && ("number" == typeof minWidth && minWidth > 0 || "string" == typeof minWidth) && this.setMinColWidth(col, minWidth),
|
|
167
|
-
maxWidth && ("number" == typeof maxWidth && maxWidth > 0 || "string" == typeof maxWidth) && this.setMaxColWidth(col, maxWidth);
|
|
168
|
-
}
|
|
169
|
-
this.refreshRowColCount();
|
|
161
|
+
this.setMinMaxLimitWidth(!0), this.refreshRowColCount();
|
|
170
162
|
}
|
|
171
163
|
refreshRowColCount() {
|
|
172
164
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -389,7 +381,7 @@ class PivotTable extends BaseTable_1.BaseTable {
|
|
|
389
381
|
}
|
|
390
382
|
}
|
|
391
383
|
_moveHeaderPosition(source, target) {
|
|
392
|
-
var _a, _b, _c, _d
|
|
384
|
+
var _a, _b, _c, _d;
|
|
393
385
|
const sourceCellRange = this.getCellRange(source.col, source.row), targetCellRange = this.getCellRange(target.col, target.row), moveContext = this.internalProps.layoutMap.moveHeaderPosition(source, target);
|
|
394
386
|
if (moveContext) {
|
|
395
387
|
if ("column" === moveContext.moveType) {
|
|
@@ -397,14 +389,10 @@ class PivotTable extends BaseTable_1.BaseTable {
|
|
|
397
389
|
const sourceColumns = this.internalProps.records[row].splice(moveContext.sourceIndex - this.rowHeaderLevelCount, moveContext.sourceSize);
|
|
398
390
|
sourceColumns.unshift(moveContext.targetIndex - this.rowHeaderLevelCount, 0), Array.prototype.splice.apply(this.internalProps.records[row], sourceColumns);
|
|
399
391
|
}
|
|
400
|
-
this.colWidthsMap.exchangeOrder(sourceCellRange.start.col, sourceCellRange.end.col - sourceCellRange.start.col + 1, targetCellRange.start.col, targetCellRange.end.col - targetCellRange.start.col + 1, moveContext.targetIndex)
|
|
401
|
-
|
|
402
|
-
const {minWidth: minWidth, maxWidth: maxWidth} = null !== (_d = null === (_c = this.internalProps.layoutMap.columnWidths) || void 0 === _c ? void 0 : _c[col]) && void 0 !== _d ? _d : {};
|
|
403
|
-
minWidth && ("number" == typeof minWidth && minWidth > 0 || "string" == typeof minWidth) && this.setMinColWidth(col, minWidth),
|
|
404
|
-
maxWidth && ("number" == typeof maxWidth && maxWidth > 0 || "string" == typeof maxWidth) && this.setMaxColWidth(col, maxWidth);
|
|
405
|
-
}
|
|
392
|
+
this.colWidthsMap.exchangeOrder(sourceCellRange.start.col, sourceCellRange.end.col - sourceCellRange.start.col + 1, targetCellRange.start.col, targetCellRange.end.col - targetCellRange.start.col + 1, moveContext.targetIndex),
|
|
393
|
+
this.setMinMaxLimitWidth();
|
|
406
394
|
} else if ("row" === moveContext.moveType) {
|
|
407
|
-
if ((null === (
|
|
395
|
+
if ((null === (_d = null === (_c = this.options.records) || void 0 === _c ? void 0 : _c[0]) || void 0 === _d ? void 0 : _d.constructor) === Array) {
|
|
408
396
|
const sourceRows = this.internalProps.records.splice(moveContext.sourceIndex - this.columnHeaderLevelCount, moveContext.sourceSize);
|
|
409
397
|
sourceRows.unshift(moveContext.targetIndex - this.columnHeaderLevelCount, 0), Array.prototype.splice.apply(this.internalProps.records, sourceRows);
|
|
410
398
|
}
|
|
@@ -432,15 +420,15 @@ class PivotTable extends BaseTable_1.BaseTable {
|
|
|
432
420
|
});
|
|
433
421
|
}
|
|
434
422
|
}
|
|
435
|
-
_refreshHierarchyState(col, row) {
|
|
423
|
+
_refreshHierarchyState(col, row, beforeUpdateCell) {
|
|
436
424
|
let notFillWidth = !1, notFillHeight = !1;
|
|
437
425
|
this.stateManager.updateHoverIcon(col, row, void 0, void 0);
|
|
438
426
|
const checkHasChart = this.internalProps.layoutMap.checkHasChart();
|
|
439
427
|
checkHasChart && (this.autoFillWidth && (notFillWidth = this.getAllColsWidth() <= this.tableNoFrameWidth),
|
|
440
428
|
this.autoFillHeight && (notFillHeight = this.getAllRowsHeight() <= this.tableNoFrameHeight));
|
|
441
429
|
const result = this.internalProps.layoutMap.toggleHierarchyState(col, row);
|
|
442
|
-
|
|
443
|
-
this.scenegraph.updateRow(result.removeCellPositions, result.addCellPositions, result.updateCellPositions),
|
|
430
|
+
beforeUpdateCell && beforeUpdateCell(), this.refreshRowColCount(), this.clearCellStyleCache(),
|
|
431
|
+
this.scenegraph.updateHierarchyIcon(col, row), this.scenegraph.updateRow(result.removeCellPositions, result.addCellPositions, result.updateCellPositions),
|
|
444
432
|
checkHasChart && (this.autoFillWidth && !notFillWidth && (notFillWidth = this.getAllColsWidth() <= this.tableNoFrameWidth),
|
|
445
433
|
this.autoFillHeight && !notFillHeight && (notFillHeight = this.getAllRowsHeight() <= this.tableNoFrameHeight),
|
|
446
434
|
("adaptive" === this.widthMode || notFillWidth || "adaptive" === this.heightMode || notFillHeight) && this.scenegraph.updateChartSize(0));
|
|
@@ -509,6 +497,14 @@ class PivotTable extends BaseTable_1.BaseTable {
|
|
|
509
497
|
this.internalProps.title && !this.internalProps.title.isReleased && (this._updateSize(),
|
|
510
498
|
this.internalProps.title.resize(), this.scenegraph.resize()), this.eventManager.updateEventBinder();
|
|
511
499
|
}
|
|
500
|
+
startEditCell(col, row) {
|
|
501
|
+
var _a;
|
|
502
|
+
if ((0, vutils_1.isValid)(col) && (0, vutils_1.isValid)(row)) this.selectCell(col, row),
|
|
503
|
+
this.editorManager.startEditCell(col, row); else if (null === (_a = this.stateManager.select) || void 0 === _a ? void 0 : _a.cellPos) {
|
|
504
|
+
const {col: col, row: row} = this.stateManager.select.cellPos;
|
|
505
|
+
(0, vutils_1.isValid)(col) && (0, vutils_1.isValid)(row) && this.editorManager.startEditCell(col, row);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
512
508
|
completeEditCell() {
|
|
513
509
|
this.editorManager.completeEdit();
|
|
514
510
|
}
|
|
@@ -642,13 +638,20 @@ class PivotTable extends BaseTable_1.BaseTable {
|
|
|
642
638
|
return !1;
|
|
643
639
|
}
|
|
644
640
|
changeRecordOrder(source, target) {}
|
|
645
|
-
setTreeNodeChildren(records, col, row) {
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
641
|
+
setTreeNodeChildren(children, records, col, row) {
|
|
642
|
+
if (this.flatDataToObjects) {
|
|
643
|
+
const headerPaths = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
|
|
644
|
+
this.internalProps.layoutMap.getHeadNode(headerPaths.rowHeaderPaths.slice(0, headerPaths.rowHeaderPaths.length)).children = children,
|
|
645
|
+
this._refreshHierarchyState(col, row, (() => {
|
|
646
|
+
this.flatDataToObjects.changeDataConfig({
|
|
647
|
+
rows: this.internalProps.layoutMap.fullRowDimensionKeys,
|
|
648
|
+
columns: this.internalProps.layoutMap.colDimensionKeys,
|
|
649
|
+
indicators: this.internalProps.layoutMap.indicatorKeys,
|
|
650
|
+
indicatorsAsCol: this.internalProps.layoutMap.indicatorsAsCol,
|
|
651
|
+
indicatorDimensionKey: this.internalProps.layoutMap.indicatorDimensionKey
|
|
652
|
+
}), this.flatDataToObjects.addRecords(records);
|
|
653
|
+
}));
|
|
654
|
+
}
|
|
652
655
|
}
|
|
653
656
|
}
|
|
654
657
|
|