@visactor/vtable 0.24.2-alpha.3 → 0.24.2-alpha.4
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/PivotTable.js +27 -69
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/core/BaseTable.js +1 -1
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/dataset/dataset.d.ts +0 -1
- package/cjs/dataset/dataset.js +0 -14
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/dataset/flatDataToObject.d.ts +3 -8
- package/cjs/dataset/flatDataToObject.js +8 -39
- package/cjs/dataset/flatDataToObject.js.map +1 -1
- package/cjs/edit/edit-manager.js +1 -0
- package/cjs/edit/edit-manager.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.d.ts +0 -1
- package/cjs/layout/pivot-header-layout.js +4 -16
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/tree-helper.js +1 -1
- package/cjs/layout/tree-helper.js.map +1 -1
- package/cjs/ts-types/pivot-table/dimension/basic-dimension.d.ts +1 -6
- package/cjs/ts-types/pivot-table/dimension/basic-dimension.js.map +1 -1
- package/cjs/ts-types/pivot-table/indicator/basic-indicator.d.ts +0 -3
- package/cjs/ts-types/pivot-table/indicator/basic-indicator.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +0 -3
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +43 -218
- package/dist/vtable.min.js +1 -1
- package/es/PivotTable.js +27 -69
- package/es/PivotTable.js.map +1 -1
- package/es/core/BaseTable.js +1 -1
- package/es/core/BaseTable.js.map +1 -1
- package/es/dataset/dataset.d.ts +0 -1
- package/es/dataset/dataset.js +0 -14
- package/es/dataset/dataset.js.map +1 -1
- package/es/dataset/flatDataToObject.d.ts +3 -8
- package/es/dataset/flatDataToObject.js +8 -38
- package/es/dataset/flatDataToObject.js.map +1 -1
- package/es/edit/edit-manager.js +1 -0
- package/es/edit/edit-manager.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.d.ts +0 -1
- package/es/layout/pivot-header-layout.js +2 -12
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/tree-helper.js +1 -1
- package/es/layout/tree-helper.js.map +1 -1
- package/es/ts-types/pivot-table/dimension/basic-dimension.d.ts +1 -6
- package/es/ts-types/pivot-table/dimension/basic-dimension.js.map +1 -1
- package/es/ts-types/pivot-table/indicator/basic-indicator.d.ts +0 -3
- package/es/ts-types/pivot-table/indicator/basic-indicator.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +0 -3
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +4 -4
package/cjs/PivotTable.js
CHANGED
|
@@ -348,37 +348,14 @@ class PivotTable extends BaseTable_1.BaseTable {
|
|
|
348
348
|
})), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
|
|
349
349
|
var _a;
|
|
350
350
|
return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
|
|
351
|
-
})), treeNode = this.flatDataToObjects.getTreeNode(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey);
|
|
351
|
+
})), treeNode = this.flatDataToObjects.getTreeNode(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey, !1);
|
|
352
352
|
return null == treeNode ? void 0 : treeNode.record;
|
|
353
353
|
}
|
|
354
354
|
const rowIndex = this.getBodyIndexByRow(row), colIndex = this.getBodyIndexByCol(col);
|
|
355
355
|
return null === (_a = this.records[rowIndex]) || void 0 === _a ? void 0 : _a[colIndex];
|
|
356
356
|
}
|
|
357
357
|
getCellRawRecord(col, row) {
|
|
358
|
-
|
|
359
|
-
if (this.internalProps.layoutMap.isHeader(col, row)) return;
|
|
360
|
-
if (this.dataset) {
|
|
361
|
-
const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row), colKeys = cellDimensionPath.colHeaderPaths.map((colPath => {
|
|
362
|
-
var _a;
|
|
363
|
-
return null !== (_a = colPath.indicatorKey) && void 0 !== _a ? _a : colPath.value;
|
|
364
|
-
})), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
|
|
365
|
-
var _a;
|
|
366
|
-
return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
|
|
367
|
-
}));
|
|
368
|
-
return this.dataset.getAggregator(this.internalProps.layoutMap.indicatorsAsCol ? rowKeys : rowKeys.slice(0, -1), this.internalProps.layoutMap.indicatorsAsCol ? colKeys.slice(0, -1) : colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row)).records;
|
|
369
|
-
}
|
|
370
|
-
if (this.flatDataToObjects) {
|
|
371
|
-
const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row), colKeys = cellDimensionPath.colHeaderPaths.map((colPath => {
|
|
372
|
-
var _a;
|
|
373
|
-
return null !== (_a = colPath.indicatorKey) && void 0 !== _a ? _a : colPath.value;
|
|
374
|
-
})), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
|
|
375
|
-
var _a;
|
|
376
|
-
return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
|
|
377
|
-
})), treeNode = this.flatDataToObjects.getTreeNode(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey, !1);
|
|
378
|
-
return null == treeNode ? void 0 : treeNode.record;
|
|
379
|
-
}
|
|
380
|
-
const rowIndex = this.getBodyIndexByRow(row), colIndex = this.getBodyIndexByCol(col);
|
|
381
|
-
return null === (_a = this.records[rowIndex]) || void 0 === _a ? void 0 : _a[colIndex];
|
|
358
|
+
return this.getCellOriginRecord(col, row);
|
|
382
359
|
}
|
|
383
360
|
updateSortRules(sortRules) {
|
|
384
361
|
this.internalProps.dataConfig.sortRules = sortRules, this.dataset.updateSortRules(sortRules),
|
|
@@ -532,15 +509,9 @@ class PivotTable extends BaseTable_1.BaseTable {
|
|
|
532
509
|
this.editorManager.completeEdit();
|
|
533
510
|
}
|
|
534
511
|
getEditor(col, row) {
|
|
535
|
-
var _a
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
const define = this.getHeaderDefine(col, row);
|
|
539
|
-
editorDefine = null !== (_a = null == define ? void 0 : define.headerEditor) && void 0 !== _a ? _a : this.options.headerEditor;
|
|
540
|
-
} else {
|
|
541
|
-
const define = this.getBodyColumnDefine(col, row);
|
|
542
|
-
editorDefine = null !== (_b = null == define ? void 0 : define.editor) && void 0 !== _b ? _b : this.options.editor;
|
|
543
|
-
}
|
|
512
|
+
var _a;
|
|
513
|
+
const define = this.getBodyColumnDefine(col, row);
|
|
514
|
+
let editorDefine = null !== (_a = null == define ? void 0 : define.editor) && void 0 !== _a ? _a : this.options.editor;
|
|
544
515
|
if ("function" == typeof editorDefine) {
|
|
545
516
|
editorDefine = editorDefine({
|
|
546
517
|
col: col,
|
|
@@ -570,12 +541,9 @@ class PivotTable extends BaseTable_1.BaseTable {
|
|
|
570
541
|
changeCellValue(col, row, value, workOnEditableCell = !1) {
|
|
571
542
|
if (workOnEditableCell && this.isHasEditorDefine(col, row) || !1 === workOnEditableCell) {
|
|
572
543
|
let newValue = value;
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
this.
|
|
576
|
-
const range = this.getCellRange(col, row);
|
|
577
|
-
for (let sCol = range.start.col; sCol <= range.end.col; sCol++) for (let sRow = range.start.row; sRow <= range.end.row; sRow++) this.scenegraph.updateCellContent(sCol, sRow);
|
|
578
|
-
if ("adaptive" === this.widthMode || this.autoFillWidth && this.getAllColsWidth() <= this.tableNoFrameWidth) 0 === this.internalProps._widthResizedColMap.size && this.scenegraph.recalculateColWidths(); else if (!this.internalProps._widthResizedColMap.has(col)) {
|
|
544
|
+
if ("number" == typeof this.getCellRawValue(col, row) && (0, util_1.isAllDigits)(value) && (newValue = parseFloat(value)),
|
|
545
|
+
this._changeCellValueToDataSet(col, row, newValue), this.scenegraph.updateCellContent(col, row),
|
|
546
|
+
"adaptive" === this.widthMode || this.autoFillWidth && this.getAllColsWidth() <= this.tableNoFrameWidth) 0 === this.internalProps._widthResizedColMap.size && this.scenegraph.recalculateColWidths(); else if (!this.internalProps._widthResizedColMap.has(col)) {
|
|
579
547
|
const oldWidth = this.getColWidth(col), newWidth = (0, compute_col_width_1.computeColWidth)(col, 0, this.rowCount - 1, this, !1);
|
|
580
548
|
newWidth !== oldWidth && this.scenegraph.updateColWidth(col, newWidth - oldWidth);
|
|
581
549
|
}
|
|
@@ -601,10 +569,9 @@ class PivotTable extends BaseTable_1.BaseTable {
|
|
|
601
569
|
workOnEditableCell && this.isHasEditorDefine(startCol + j, startRow + i) || !1 === workOnEditableCell) {
|
|
602
570
|
const value = rowValues[j];
|
|
603
571
|
let newValue = value;
|
|
604
|
-
const
|
|
572
|
+
const rawValue = this.getCellRawValue(startCol + j, startRow + i);
|
|
605
573
|
"number" == typeof rawValue && (0, util_1.isAllDigits)(value) && (newValue = parseFloat(value)),
|
|
606
|
-
this._changeCellValueToDataSet(startCol + j, startRow + i,
|
|
607
|
-
this.fireListeners(TABLE_EVENT_TYPE_1.TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
|
|
574
|
+
this._changeCellValueToDataSet(startCol + j, startRow + i, newValue), this.fireListeners(TABLE_EVENT_TYPE_1.TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
|
|
608
575
|
col: startCol + j,
|
|
609
576
|
row: startRow + i,
|
|
610
577
|
rawValue: rawValue,
|
|
@@ -629,34 +596,25 @@ class PivotTable extends BaseTable_1.BaseTable {
|
|
|
629
596
|
}
|
|
630
597
|
this.scenegraph.updateNextFrame();
|
|
631
598
|
}
|
|
632
|
-
_changeCellValueToDataSet(col, row,
|
|
633
|
-
var _a, _b, _c, _d, _e, _f;
|
|
599
|
+
_changeCellValueToDataSet(col, row, newValue) {
|
|
634
600
|
if (this.dataset) {
|
|
635
|
-
const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row)
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
|
|
644
|
-
}));
|
|
645
|
-
this.dataset.changeTreeNodeValue(this.internalProps.layoutMap.indicatorsAsCol ? rowKeys : rowKeys.slice(0, -1), this.internalProps.layoutMap.indicatorsAsCol ? colKeys.slice(0, -1) : colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row), newValue);
|
|
646
|
-
}
|
|
601
|
+
const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row), colKeys = cellDimensionPath.colHeaderPaths.map((colPath => {
|
|
602
|
+
var _a;
|
|
603
|
+
return null !== (_a = colPath.indicatorKey) && void 0 !== _a ? _a : colPath.value;
|
|
604
|
+
})), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
|
|
605
|
+
var _a;
|
|
606
|
+
return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
|
|
607
|
+
}));
|
|
608
|
+
this.dataset.changeTreeNodeValue(this.internalProps.layoutMap.indicatorsAsCol ? rowKeys : rowKeys.slice(0, -1), this.internalProps.layoutMap.indicatorsAsCol ? colKeys.slice(0, -1) : colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row), newValue);
|
|
647
609
|
} else if (this.flatDataToObjects) {
|
|
648
|
-
const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row)
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
|
|
657
|
-
}));
|
|
658
|
-
this.flatDataToObjects.changeTreeNodeValue(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey, newValue);
|
|
659
|
-
}
|
|
610
|
+
const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row), colKeys = cellDimensionPath.colHeaderPaths.map((colPath => {
|
|
611
|
+
var _a;
|
|
612
|
+
return null !== (_a = colPath.indicatorKey) && void 0 !== _a ? _a : colPath.value;
|
|
613
|
+
})), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
|
|
614
|
+
var _a;
|
|
615
|
+
return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
|
|
616
|
+
}));
|
|
617
|
+
this.flatDataToObjects.changeTreeNodeValue(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey, newValue);
|
|
660
618
|
} else {
|
|
661
619
|
const rowIndex = this.getBodyIndexByRow(row), colIndex = this.getBodyIndexByCol(col);
|
|
662
620
|
this.records[rowIndex][colIndex] = newValue;
|