@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/es/PivotTable.js
CHANGED
|
@@ -106,7 +106,8 @@ export class PivotTable extends BaseTable {
|
|
|
106
106
|
})), this.internalProps.columnTree = !options.indicatorsAsCol || (null === (_c = options.columns) || void 0 === _c ? void 0 : _c.length) || options.columnTree ? cloneDeep(options.columnTree) : [],
|
|
107
107
|
this.internalProps.rowTree = options.indicatorsAsCol || (null === (_d = options.rows) || void 0 === _d ? void 0 : _d.length) || options.rowTree ? cloneDeep(options.rowTree) : [],
|
|
108
108
|
options.records && (this.internalProps.records = options.records), this.stateManager.initCheckedState(this.internalProps.records),
|
|
109
|
-
this.
|
|
109
|
+
this.stateManager.updateDrillState(void 0, void 0, !1, !1, -1, -1), this.pagination = options.pagination,
|
|
110
|
+
internalProps.columnResizeType = null !== (_e = options.columnResizeType) && void 0 !== _e ? _e : "column",
|
|
110
111
|
internalProps.dataConfig = cloneDeep(options.dataConfig), options.rowTree || options.columnTree ? internalProps.enableDataAnalysis = !1 : internalProps.enableDataAnalysis = !0,
|
|
111
112
|
"tree" === (null == options ? void 0 : options.rowHierarchyType) && "tree" === this.internalProps.layoutMap.rowHierarchyType && this.internalProps.layoutMap.rowExpandLevel === (null == options ? void 0 : options.rowExpandLevel)) {
|
|
112
113
|
const beforeRowDimensions = this.internalProps.layoutMap.rowDimensionTree.tree.children;
|
|
@@ -155,15 +156,7 @@ export class PivotTable extends BaseTable {
|
|
|
155
156
|
this.refreshRowColCount(), this.scenegraph.createSceneGraph(), this.render());
|
|
156
157
|
}
|
|
157
158
|
refreshHeader() {
|
|
158
|
-
|
|
159
|
-
const internalProps = this.internalProps;
|
|
160
|
-
for (let col = 0; col < internalProps.layoutMap.columnWidths.length; col++) {
|
|
161
|
-
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 : {};
|
|
162
|
-
width && ("string" == typeof width && "auto" !== width || "number" == typeof width && width > 0) && this._setColWidth(col, width),
|
|
163
|
-
minWidth && ("number" == typeof minWidth && minWidth > 0 || "string" == typeof minWidth) && this.setMinColWidth(col, minWidth),
|
|
164
|
-
maxWidth && ("number" == typeof maxWidth && maxWidth > 0 || "string" == typeof maxWidth) && this.setMaxColWidth(col, maxWidth);
|
|
165
|
-
}
|
|
166
|
-
this.refreshRowColCount();
|
|
159
|
+
this.setMinMaxLimitWidth(!0), this.refreshRowColCount();
|
|
167
160
|
}
|
|
168
161
|
refreshRowColCount() {
|
|
169
162
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -386,7 +379,7 @@ export class PivotTable extends BaseTable {
|
|
|
386
379
|
}
|
|
387
380
|
}
|
|
388
381
|
_moveHeaderPosition(source, target) {
|
|
389
|
-
var _a, _b, _c, _d
|
|
382
|
+
var _a, _b, _c, _d;
|
|
390
383
|
const sourceCellRange = this.getCellRange(source.col, source.row), targetCellRange = this.getCellRange(target.col, target.row), moveContext = this.internalProps.layoutMap.moveHeaderPosition(source, target);
|
|
391
384
|
if (moveContext) {
|
|
392
385
|
if ("column" === moveContext.moveType) {
|
|
@@ -394,14 +387,10 @@ export class PivotTable extends BaseTable {
|
|
|
394
387
|
const sourceColumns = this.internalProps.records[row].splice(moveContext.sourceIndex - this.rowHeaderLevelCount, moveContext.sourceSize);
|
|
395
388
|
sourceColumns.unshift(moveContext.targetIndex - this.rowHeaderLevelCount, 0), Array.prototype.splice.apply(this.internalProps.records[row], sourceColumns);
|
|
396
389
|
}
|
|
397
|
-
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)
|
|
398
|
-
|
|
399
|
-
const {minWidth: minWidth, maxWidth: maxWidth} = null !== (_d = null === (_c = this.internalProps.layoutMap.columnWidths) || void 0 === _c ? void 0 : _c[col]) && void 0 !== _d ? _d : {};
|
|
400
|
-
minWidth && ("number" == typeof minWidth && minWidth > 0 || "string" == typeof minWidth) && this.setMinColWidth(col, minWidth),
|
|
401
|
-
maxWidth && ("number" == typeof maxWidth && maxWidth > 0 || "string" == typeof maxWidth) && this.setMaxColWidth(col, maxWidth);
|
|
402
|
-
}
|
|
390
|
+
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),
|
|
391
|
+
this.setMinMaxLimitWidth();
|
|
403
392
|
} else if ("row" === moveContext.moveType) {
|
|
404
|
-
if ((null === (
|
|
393
|
+
if ((null === (_d = null === (_c = this.options.records) || void 0 === _c ? void 0 : _c[0]) || void 0 === _d ? void 0 : _d.constructor) === Array) {
|
|
405
394
|
const sourceRows = this.internalProps.records.splice(moveContext.sourceIndex - this.columnHeaderLevelCount, moveContext.sourceSize);
|
|
406
395
|
sourceRows.unshift(moveContext.targetIndex - this.columnHeaderLevelCount, 0), Array.prototype.splice.apply(this.internalProps.records, sourceRows);
|
|
407
396
|
}
|
|
@@ -429,15 +418,15 @@ export class PivotTable extends BaseTable {
|
|
|
429
418
|
});
|
|
430
419
|
}
|
|
431
420
|
}
|
|
432
|
-
_refreshHierarchyState(col, row) {
|
|
421
|
+
_refreshHierarchyState(col, row, beforeUpdateCell) {
|
|
433
422
|
let notFillWidth = !1, notFillHeight = !1;
|
|
434
423
|
this.stateManager.updateHoverIcon(col, row, void 0, void 0);
|
|
435
424
|
const checkHasChart = this.internalProps.layoutMap.checkHasChart();
|
|
436
425
|
checkHasChart && (this.autoFillWidth && (notFillWidth = this.getAllColsWidth() <= this.tableNoFrameWidth),
|
|
437
426
|
this.autoFillHeight && (notFillHeight = this.getAllRowsHeight() <= this.tableNoFrameHeight));
|
|
438
427
|
const result = this.internalProps.layoutMap.toggleHierarchyState(col, row);
|
|
439
|
-
|
|
440
|
-
this.scenegraph.updateRow(result.removeCellPositions, result.addCellPositions, result.updateCellPositions),
|
|
428
|
+
beforeUpdateCell && beforeUpdateCell(), this.refreshRowColCount(), this.clearCellStyleCache(),
|
|
429
|
+
this.scenegraph.updateHierarchyIcon(col, row), this.scenegraph.updateRow(result.removeCellPositions, result.addCellPositions, result.updateCellPositions),
|
|
441
430
|
checkHasChart && (this.autoFillWidth && !notFillWidth && (notFillWidth = this.getAllColsWidth() <= this.tableNoFrameWidth),
|
|
442
431
|
this.autoFillHeight && !notFillHeight && (notFillHeight = this.getAllRowsHeight() <= this.tableNoFrameHeight),
|
|
443
432
|
("adaptive" === this.widthMode || notFillWidth || "adaptive" === this.heightMode || notFillHeight) && this.scenegraph.updateChartSize(0));
|
|
@@ -506,6 +495,13 @@ export class PivotTable extends BaseTable {
|
|
|
506
495
|
this.internalProps.title && !this.internalProps.title.isReleased && (this._updateSize(),
|
|
507
496
|
this.internalProps.title.resize(), this.scenegraph.resize()), this.eventManager.updateEventBinder();
|
|
508
497
|
}
|
|
498
|
+
startEditCell(col, row) {
|
|
499
|
+
var _a;
|
|
500
|
+
if (isValid(col) && isValid(row)) this.selectCell(col, row), this.editorManager.startEditCell(col, row); else if (null === (_a = this.stateManager.select) || void 0 === _a ? void 0 : _a.cellPos) {
|
|
501
|
+
const {col: col, row: row} = this.stateManager.select.cellPos;
|
|
502
|
+
isValid(col) && isValid(row) && this.editorManager.startEditCell(col, row);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
509
505
|
completeEditCell() {
|
|
510
506
|
this.editorManager.completeEdit();
|
|
511
507
|
}
|
|
@@ -639,13 +635,20 @@ export class PivotTable extends BaseTable {
|
|
|
639
635
|
return !1;
|
|
640
636
|
}
|
|
641
637
|
changeRecordOrder(source, target) {}
|
|
642
|
-
setTreeNodeChildren(records, col, row) {
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
638
|
+
setTreeNodeChildren(children, records, col, row) {
|
|
639
|
+
if (this.flatDataToObjects) {
|
|
640
|
+
const headerPaths = this.internalProps.layoutMap.getCellHeaderPaths(col, row);
|
|
641
|
+
this.internalProps.layoutMap.getHeadNode(headerPaths.rowHeaderPaths.slice(0, headerPaths.rowHeaderPaths.length)).children = children,
|
|
642
|
+
this._refreshHierarchyState(col, row, (() => {
|
|
643
|
+
this.flatDataToObjects.changeDataConfig({
|
|
644
|
+
rows: this.internalProps.layoutMap.fullRowDimensionKeys,
|
|
645
|
+
columns: this.internalProps.layoutMap.colDimensionKeys,
|
|
646
|
+
indicators: this.internalProps.layoutMap.indicatorKeys,
|
|
647
|
+
indicatorsAsCol: this.internalProps.layoutMap.indicatorsAsCol,
|
|
648
|
+
indicatorDimensionKey: this.internalProps.layoutMap.indicatorDimensionKey
|
|
649
|
+
}), this.flatDataToObjects.addRecords(records);
|
|
650
|
+
}));
|
|
651
|
+
}
|
|
649
652
|
}
|
|
650
653
|
}
|
|
651
654
|
//# sourceMappingURL=PivotTable.js.map
|