@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/es/PivotTable.js
CHANGED
|
@@ -346,37 +346,14 @@ export class PivotTable extends BaseTable {
|
|
|
346
346
|
})), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
|
|
347
347
|
var _a;
|
|
348
348
|
return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
|
|
349
|
-
})), treeNode = this.flatDataToObjects.getTreeNode(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey);
|
|
349
|
+
})), treeNode = this.flatDataToObjects.getTreeNode(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey, !1);
|
|
350
350
|
return null == treeNode ? void 0 : treeNode.record;
|
|
351
351
|
}
|
|
352
352
|
const rowIndex = this.getBodyIndexByRow(row), colIndex = this.getBodyIndexByCol(col);
|
|
353
353
|
return null === (_a = this.records[rowIndex]) || void 0 === _a ? void 0 : _a[colIndex];
|
|
354
354
|
}
|
|
355
355
|
getCellRawRecord(col, row) {
|
|
356
|
-
|
|
357
|
-
if (this.internalProps.layoutMap.isHeader(col, row)) return;
|
|
358
|
-
if (this.dataset) {
|
|
359
|
-
const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row), colKeys = cellDimensionPath.colHeaderPaths.map((colPath => {
|
|
360
|
-
var _a;
|
|
361
|
-
return null !== (_a = colPath.indicatorKey) && void 0 !== _a ? _a : colPath.value;
|
|
362
|
-
})), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
|
|
363
|
-
var _a;
|
|
364
|
-
return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
|
|
365
|
-
}));
|
|
366
|
-
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;
|
|
367
|
-
}
|
|
368
|
-
if (this.flatDataToObjects) {
|
|
369
|
-
const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row), colKeys = cellDimensionPath.colHeaderPaths.map((colPath => {
|
|
370
|
-
var _a;
|
|
371
|
-
return null !== (_a = colPath.indicatorKey) && void 0 !== _a ? _a : colPath.value;
|
|
372
|
-
})), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
|
|
373
|
-
var _a;
|
|
374
|
-
return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
|
|
375
|
-
})), treeNode = this.flatDataToObjects.getTreeNode(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey, !1);
|
|
376
|
-
return null == treeNode ? void 0 : treeNode.record;
|
|
377
|
-
}
|
|
378
|
-
const rowIndex = this.getBodyIndexByRow(row), colIndex = this.getBodyIndexByCol(col);
|
|
379
|
-
return null === (_a = this.records[rowIndex]) || void 0 === _a ? void 0 : _a[colIndex];
|
|
356
|
+
return this.getCellOriginRecord(col, row);
|
|
380
357
|
}
|
|
381
358
|
updateSortRules(sortRules) {
|
|
382
359
|
this.internalProps.dataConfig.sortRules = sortRules, this.dataset.updateSortRules(sortRules),
|
|
@@ -529,15 +506,9 @@ export class PivotTable extends BaseTable {
|
|
|
529
506
|
this.editorManager.completeEdit();
|
|
530
507
|
}
|
|
531
508
|
getEditor(col, row) {
|
|
532
|
-
var _a
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
const define = this.getHeaderDefine(col, row);
|
|
536
|
-
editorDefine = null !== (_a = null == define ? void 0 : define.headerEditor) && void 0 !== _a ? _a : this.options.headerEditor;
|
|
537
|
-
} else {
|
|
538
|
-
const define = this.getBodyColumnDefine(col, row);
|
|
539
|
-
editorDefine = null !== (_b = null == define ? void 0 : define.editor) && void 0 !== _b ? _b : this.options.editor;
|
|
540
|
-
}
|
|
509
|
+
var _a;
|
|
510
|
+
const define = this.getBodyColumnDefine(col, row);
|
|
511
|
+
let editorDefine = null !== (_a = null == define ? void 0 : define.editor) && void 0 !== _a ? _a : this.options.editor;
|
|
541
512
|
if ("function" == typeof editorDefine) {
|
|
542
513
|
editorDefine = editorDefine({
|
|
543
514
|
col: col,
|
|
@@ -567,12 +538,9 @@ export class PivotTable extends BaseTable {
|
|
|
567
538
|
changeCellValue(col, row, value, workOnEditableCell = !1) {
|
|
568
539
|
if (workOnEditableCell && this.isHasEditorDefine(col, row) || !1 === workOnEditableCell) {
|
|
569
540
|
let newValue = value;
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
this.
|
|
573
|
-
const range = this.getCellRange(col, row);
|
|
574
|
-
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);
|
|
575
|
-
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)) {
|
|
541
|
+
if ("number" == typeof this.getCellRawValue(col, row) && isAllDigits(value) && (newValue = parseFloat(value)),
|
|
542
|
+
this._changeCellValueToDataSet(col, row, newValue), this.scenegraph.updateCellContent(col, row),
|
|
543
|
+
"adaptive" === this.widthMode || this.autoFillWidth && this.getAllColsWidth() <= this.tableNoFrameWidth) 0 === this.internalProps._widthResizedColMap.size && this.scenegraph.recalculateColWidths(); else if (!this.internalProps._widthResizedColMap.has(col)) {
|
|
576
544
|
const oldWidth = this.getColWidth(col), newWidth = computeColWidth(col, 0, this.rowCount - 1, this, !1);
|
|
577
545
|
newWidth !== oldWidth && this.scenegraph.updateColWidth(col, newWidth - oldWidth);
|
|
578
546
|
}
|
|
@@ -598,10 +566,9 @@ export class PivotTable extends BaseTable {
|
|
|
598
566
|
workOnEditableCell && this.isHasEditorDefine(startCol + j, startRow + i) || !1 === workOnEditableCell) {
|
|
599
567
|
const value = rowValues[j];
|
|
600
568
|
let newValue = value;
|
|
601
|
-
const
|
|
569
|
+
const rawValue = this.getCellRawValue(startCol + j, startRow + i);
|
|
602
570
|
"number" == typeof rawValue && isAllDigits(value) && (newValue = parseFloat(value)),
|
|
603
|
-
this._changeCellValueToDataSet(startCol + j, startRow + i,
|
|
604
|
-
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
|
|
571
|
+
this._changeCellValueToDataSet(startCol + j, startRow + i, newValue), this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
|
|
605
572
|
col: startCol + j,
|
|
606
573
|
row: startRow + i,
|
|
607
574
|
rawValue: rawValue,
|
|
@@ -626,34 +593,25 @@ export class PivotTable extends BaseTable {
|
|
|
626
593
|
}
|
|
627
594
|
this.scenegraph.updateNextFrame();
|
|
628
595
|
}
|
|
629
|
-
_changeCellValueToDataSet(col, row,
|
|
630
|
-
var _a, _b, _c, _d, _e, _f;
|
|
596
|
+
_changeCellValueToDataSet(col, row, newValue) {
|
|
631
597
|
if (this.dataset) {
|
|
632
|
-
const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row)
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
|
|
641
|
-
}));
|
|
642
|
-
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);
|
|
643
|
-
}
|
|
598
|
+
const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row), colKeys = cellDimensionPath.colHeaderPaths.map((colPath => {
|
|
599
|
+
var _a;
|
|
600
|
+
return null !== (_a = colPath.indicatorKey) && void 0 !== _a ? _a : colPath.value;
|
|
601
|
+
})), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
|
|
602
|
+
var _a;
|
|
603
|
+
return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
|
|
604
|
+
}));
|
|
605
|
+
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);
|
|
644
606
|
} else if (this.flatDataToObjects) {
|
|
645
|
-
const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row)
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
|
|
654
|
-
}));
|
|
655
|
-
this.flatDataToObjects.changeTreeNodeValue(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey, newValue);
|
|
656
|
-
}
|
|
607
|
+
const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row), colKeys = cellDimensionPath.colHeaderPaths.map((colPath => {
|
|
608
|
+
var _a;
|
|
609
|
+
return null !== (_a = colPath.indicatorKey) && void 0 !== _a ? _a : colPath.value;
|
|
610
|
+
})), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
|
|
611
|
+
var _a;
|
|
612
|
+
return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
|
|
613
|
+
}));
|
|
614
|
+
this.flatDataToObjects.changeTreeNodeValue(rowKeys, colKeys, this.internalProps.layoutMap.getBody(col, row).indicatorKey, newValue);
|
|
657
615
|
} else {
|
|
658
616
|
const rowIndex = this.getBodyIndexByRow(row), colIndex = this.getBodyIndexByCol(col);
|
|
659
617
|
this.records[rowIndex][colIndex] = newValue;
|