@visactor/vtable 0.24.2-alpha.3 → 0.25.0
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 +5 -3
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.js +14 -12
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.js +22 -18
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +1 -0
- package/cjs/core/BaseTable.js +62 -16
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/TABLE_EVENT_TYPE.d.ts +3 -1
- package/cjs/core/TABLE_EVENT_TYPE.js +3 -0
- package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/cjs/edit/edit-manager.js +0 -1
- package/cjs/edit/edit-manager.js.map +1 -1
- package/cjs/event/event.d.ts +2 -0
- package/cjs/event/event.js +12 -2
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/container-dom.js +5 -2
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/event/listener/scroll-bar.js +8 -0
- package/cjs/event/listener/scroll-bar.js.map +1 -1
- package/cjs/event/listener/table-group.js +23 -8
- package/cjs/event/listener/table-group.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/tree-helper.js +1 -1
- package/cjs/layout/tree-helper.js.map +1 -1
- package/cjs/scenegraph/component/table-component.d.ts +8 -0
- package/cjs/scenegraph/component/table-component.js +180 -2
- package/cjs/scenegraph/component/table-component.js.map +1 -1
- package/cjs/scenegraph/component/util.d.ts +1 -0
- package/cjs/scenegraph/component/util.js +8 -2
- package/cjs/scenegraph/component/util.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +18 -9
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +5 -5
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.js +4 -2
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/scenegraph/layout/frozen.js +4 -2
- package/cjs/scenegraph/layout/frozen.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +7 -0
- package/cjs/scenegraph/scenegraph.js +42 -19
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/select/update-select-border.js +4 -4
- package/cjs/scenegraph/select/update-select-border.js.map +1 -1
- package/cjs/state/cell-move/index.js +2 -1
- package/cjs/state/cell-move/index.js.map +1 -1
- package/cjs/state/resize/update-resize-column.js +4 -3
- package/cjs/state/resize/update-resize-column.js.map +1 -1
- package/cjs/state/resize/update-resize-row.d.ts +2 -0
- package/cjs/state/resize/update-resize-row.js +63 -0
- package/cjs/state/resize/update-resize-row.js.map +1 -0
- package/cjs/state/state.d.ts +11 -1
- package/cjs/state/state.js +30 -5
- package/cjs/state/state.js.map +1 -1
- package/cjs/themes/component.js +1 -1
- package/cjs/tools/global.d.ts +1 -0
- package/cjs/tools/global.js +2 -2
- package/cjs/tools/global.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +7 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/events.d.ts +11 -0
- package/cjs/ts-types/events.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +2 -0
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +700 -68
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.js +5 -3
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.js +14 -12
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.js +22 -18
- package/es/PivotTable.js.map +1 -1
- package/es/core/BaseTable.d.ts +1 -0
- package/es/core/BaseTable.js +62 -17
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/TABLE_EVENT_TYPE.d.ts +3 -1
- package/es/core/TABLE_EVENT_TYPE.js +3 -0
- package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/es/edit/edit-manager.js +0 -1
- package/es/edit/edit-manager.js.map +1 -1
- package/es/event/event.d.ts +2 -0
- package/es/event/event.js +12 -2
- package/es/event/event.js.map +1 -1
- package/es/event/listener/container-dom.js +5 -2
- package/es/event/listener/container-dom.js.map +1 -1
- package/es/event/listener/scroll-bar.js +8 -0
- package/es/event/listener/scroll-bar.js.map +1 -1
- package/es/event/listener/table-group.js +23 -8
- package/es/event/listener/table-group.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/tree-helper.js +1 -1
- package/es/layout/tree-helper.js.map +1 -1
- package/es/scenegraph/component/table-component.d.ts +8 -0
- package/es/scenegraph/component/table-component.js +181 -3
- package/es/scenegraph/component/table-component.js.map +1 -1
- package/es/scenegraph/component/util.d.ts +1 -0
- package/es/scenegraph/component/util.js +7 -1
- package/es/scenegraph/component/util.js.map +1 -1
- package/es/scenegraph/graphic/contributions/group-contribution-render.js +18 -9
- package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +5 -4
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/es/scenegraph/group-creater/progress/proxy.js +4 -2
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/scenegraph/layout/frozen.js +4 -2
- package/es/scenegraph/layout/frozen.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +7 -0
- package/es/scenegraph/scenegraph.js +44 -19
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/select/update-select-border.js +4 -4
- package/es/scenegraph/select/update-select-border.js.map +1 -1
- package/es/state/cell-move/index.js +2 -1
- package/es/state/cell-move/index.js.map +1 -1
- package/es/state/resize/update-resize-column.js +4 -3
- package/es/state/resize/update-resize-column.js.map +1 -1
- package/es/state/resize/update-resize-row.d.ts +2 -0
- package/es/state/resize/update-resize-row.js +57 -0
- package/es/state/resize/update-resize-row.js.map +1 -0
- package/es/state/state.d.ts +11 -1
- package/es/state/state.js +31 -4
- package/es/state/state.js.map +1 -1
- package/es/themes/component.js +1 -1
- package/es/tools/global.d.ts +1 -0
- package/es/tools/global.js +2 -0
- package/es/tools/global.js.map +1 -1
- package/es/ts-types/base-table.d.ts +7 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/events.d.ts +11 -0
- package/es/ts-types/events.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +2 -0
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +5 -5
package/cjs/PivotTable.js
CHANGED
|
@@ -33,7 +33,7 @@ const ts_types_1 = require("./ts-types"), pivot_header_layout_1 = require("./lay
|
|
|
33
33
|
|
|
34
34
|
class PivotTable extends BaseTable_1.BaseTable {
|
|
35
35
|
constructor(container, options) {
|
|
36
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
36
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
37
37
|
"node" === env_1.Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container,
|
|
38
38
|
container = container.container ? container.container : null), super(container, options),
|
|
39
39
|
options.layout && Object.assign(options, options.layout), this.internalProps.columns = (0,
|
|
@@ -45,19 +45,20 @@ class PivotTable extends BaseTable_1.BaseTable {
|
|
|
45
45
|
vutils_1.cloneDeep)(options.columnTree) : [], this.internalProps.rowTree = options.indicatorsAsCol || (null === (_c = options.rows) || void 0 === _c ? void 0 : _c.length) || options.rowTree ? (0,
|
|
46
46
|
vutils_1.cloneDeep)(options.rowTree) : [], this.internalProps.records = options.records,
|
|
47
47
|
this.pagination = options.pagination, this.internalProps.columnResizeType = null !== (_d = options.columnResizeType) && void 0 !== _d ? _d : "column",
|
|
48
|
+
this.internalProps.rowResizeType = null !== (_e = options.rowResizeType) && void 0 !== _e ? _e : "row",
|
|
48
49
|
this.internalProps.dataConfig = (0, vutils_1.cloneDeep)(options.dataConfig), options.rowTree || options.columnTree ? this.internalProps.enableDataAnalysis = !1 : this.internalProps.enableDataAnalysis = !0;
|
|
49
50
|
const records = this.internalProps.records;
|
|
50
51
|
if (this.internalProps.enableDataAnalysis && (options.rows || options.columns)) {
|
|
51
|
-
const rowKeys = null !== (
|
|
52
|
-
keys)), [])) && void 0 !==
|
|
53
|
-
keys)), [])) && void 0 !==
|
|
54
|
-
keys)), [])) && void 0 !==
|
|
55
|
-
this.dataset = new dataset_1.Dataset(this.internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, null === (
|
|
52
|
+
const rowKeys = null !== (_g = null === (_f = options.rows) || void 0 === _f ? void 0 : _f.reduce(((keys, rowObj) => ("string" == typeof rowObj ? keys.push(rowObj) : keys.push(rowObj.dimensionKey),
|
|
53
|
+
keys)), [])) && void 0 !== _g ? _g : [], columnKeys = null !== (_j = null === (_h = options.columns) || void 0 === _h ? void 0 : _h.reduce(((keys, columnObj) => ("string" == typeof columnObj ? keys.push(columnObj) : keys.push(columnObj.dimensionKey),
|
|
54
|
+
keys)), [])) && void 0 !== _j ? _j : [], indicatorKeys = null !== (_l = null === (_k = options.indicators) || void 0 === _k ? void 0 : _k.reduce(((keys, indicatorObj) => ("string" == typeof indicatorObj ? keys.push(indicatorObj) : keys.push(indicatorObj.indicatorKey),
|
|
55
|
+
keys)), [])) && void 0 !== _l ? _l : [];
|
|
56
|
+
this.dataset = new dataset_1.Dataset(this.internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, null === (_m = options.indicatorsAsCol) || void 0 === _m || _m, options.records, options.rowHierarchyType, this.internalProps.columnTree, this.internalProps.rowTree),
|
|
56
57
|
this.internalProps.layoutMap = new pivot_header_layout_1.PivotHeaderLayoutMap(this, this.dataset);
|
|
57
58
|
} else {
|
|
58
59
|
if (!Array.isArray(this.internalProps.columnTree) && !Array.isArray(this.internalProps.rowTree)) return;
|
|
59
60
|
this.internalProps.layoutMap = new pivot_header_layout_1.PivotHeaderLayoutMap(this, null),
|
|
60
|
-
(null === (
|
|
61
|
+
(null === (_o = null == records ? void 0 : records[0]) || void 0 === _o ? void 0 : _o.constructor) !== Array && (this.flatDataToObjects = new flatDataToObject_1.FlatDataToObjects({
|
|
61
62
|
rows: this.internalProps.layoutMap.fullRowDimensionKeys,
|
|
62
63
|
columns: this.internalProps.layoutMap.colDimensionKeys,
|
|
63
64
|
indicators: this.internalProps.layoutMap.indicatorKeys,
|
|
@@ -98,7 +99,7 @@ class PivotTable extends BaseTable_1.BaseTable {
|
|
|
98
99
|
return ifCan;
|
|
99
100
|
}
|
|
100
101
|
updateOption(options) {
|
|
101
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
102
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
102
103
|
const internalProps = this.internalProps;
|
|
103
104
|
if (super.updateOption(options), this.internalProps.columns = (0, vutils_1.cloneDeep)(options.columns),
|
|
104
105
|
this.internalProps.rows = (0, vutils_1.cloneDeep)(options.rows), this.internalProps.indicators = (null === (_a = options.indicators) || void 0 === _a ? void 0 : _a.length) ? (0,
|
|
@@ -109,26 +110,27 @@ class PivotTable extends BaseTable_1.BaseTable {
|
|
|
109
110
|
vutils_1.cloneDeep)(options.rowTree) : [], options.records && (this.internalProps.records = options.records),
|
|
110
111
|
this.stateManager.initCheckedState(this.internalProps.records), this.stateManager.updateDrillState(void 0, void 0, !1, !1, -1, -1),
|
|
111
112
|
this.pagination = options.pagination, internalProps.columnResizeType = null !== (_e = options.columnResizeType) && void 0 !== _e ? _e : "column",
|
|
113
|
+
internalProps.rowResizeType = null !== (_f = options.rowResizeType) && void 0 !== _f ? _f : "row",
|
|
112
114
|
internalProps.dataConfig = (0, vutils_1.cloneDeep)(options.dataConfig), options.rowTree || options.columnTree ? internalProps.enableDataAnalysis = !1 : internalProps.enableDataAnalysis = !0,
|
|
113
115
|
"tree" === (null == options ? void 0 : options.rowHierarchyType) && "tree" === this.internalProps.layoutMap.rowHierarchyType && this.internalProps.layoutMap.rowExpandLevel === (null == options ? void 0 : options.rowExpandLevel)) {
|
|
114
116
|
const beforeRowDimensions = this.internalProps.layoutMap.rowDimensionTree.tree.children;
|
|
115
|
-
null === (
|
|
117
|
+
null === (_g = this.internalProps.rowTree) || void 0 === _g || _g.forEach(((node, index) => {
|
|
116
118
|
const beforeRowDimension = beforeRowDimensions.find((item => item.dimensionKey === node.dimensionKey && item.value === node.value));
|
|
117
119
|
beforeRowDimension && this.syncHierarchyState(beforeRowDimension, node);
|
|
118
120
|
}));
|
|
119
121
|
}
|
|
120
122
|
const records = this.internalProps.records;
|
|
121
123
|
if (this.internalProps.enableDataAnalysis && (options.rows || options.columns)) {
|
|
122
|
-
const rowKeys = null === (
|
|
123
|
-
keys)), []), columnKeys = null === (
|
|
124
|
-
keys)), []), indicatorKeys = null === (
|
|
124
|
+
const rowKeys = null === (_h = options.rows) || void 0 === _h ? void 0 : _h.reduce(((keys, rowObj) => ("string" == typeof rowObj ? keys.push(rowObj) : keys.push(rowObj.dimensionKey),
|
|
125
|
+
keys)), []), columnKeys = null === (_j = options.columns) || void 0 === _j ? void 0 : _j.reduce(((keys, columnObj) => ("string" == typeof columnObj ? keys.push(columnObj) : keys.push(columnObj.dimensionKey),
|
|
126
|
+
keys)), []), indicatorKeys = null === (_k = options.indicators) || void 0 === _k ? void 0 : _k.reduce(((keys, indicatorObj) => ("string" == typeof indicatorObj ? keys.push(indicatorObj) : keys.push(indicatorObj.indicatorKey),
|
|
125
127
|
keys)), []);
|
|
126
|
-
this.dataset = new dataset_1.Dataset(internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, null === (
|
|
128
|
+
this.dataset = new dataset_1.Dataset(internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, null === (_l = options.indicatorsAsCol) || void 0 === _l || _l, options.records, options.rowHierarchyType, this.internalProps.columnTree, this.internalProps.rowTree),
|
|
127
129
|
internalProps.layoutMap = new pivot_header_layout_1.PivotHeaderLayoutMap(this, this.dataset);
|
|
128
130
|
} else {
|
|
129
131
|
if (!Array.isArray(this.internalProps.columnTree) && !Array.isArray(this.internalProps.rowTree)) return this;
|
|
130
132
|
internalProps.layoutMap = new pivot_header_layout_1.PivotHeaderLayoutMap(this, null),
|
|
131
|
-
(null === (
|
|
133
|
+
(null === (_m = null == records ? void 0 : records[0]) || void 0 === _m ? void 0 : _m.constructor) !== Array && (this.flatDataToObjects = new flatDataToObject_1.FlatDataToObjects({
|
|
132
134
|
rows: internalProps.layoutMap.fullRowDimensionKeys,
|
|
133
135
|
columns: internalProps.layoutMap.colDimensionKeys,
|
|
134
136
|
indicators: internalProps.layoutMap.indicatorKeys,
|
|
@@ -570,8 +572,8 @@ class PivotTable extends BaseTable_1.BaseTable {
|
|
|
570
572
|
changeCellValue(col, row, value, workOnEditableCell = !1) {
|
|
571
573
|
if (workOnEditableCell && this.isHasEditorDefine(col, row) || !1 === workOnEditableCell) {
|
|
572
574
|
let newValue = value;
|
|
573
|
-
const oldValue = this.getCellOriginValue(col, row);
|
|
574
|
-
"number" == typeof
|
|
575
|
+
const oldValue = this.getCellOriginValue(col, row), rawValue = this.getCellRawValue(col, row);
|
|
576
|
+
"number" == typeof rawValue && (0, util_1.isAllDigits)(value) && (newValue = parseFloat(value)),
|
|
575
577
|
this._changeCellValueToDataSet(col, row, oldValue, newValue);
|
|
576
578
|
const range = this.getCellRange(col, row);
|
|
577
579
|
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);
|
|
@@ -579,14 +581,15 @@ class PivotTable extends BaseTable_1.BaseTable {
|
|
|
579
581
|
const oldWidth = this.getColWidth(col), newWidth = (0, compute_col_width_1.computeColWidth)(col, 0, this.rowCount - 1, this, !1);
|
|
580
582
|
newWidth !== oldWidth && this.scenegraph.updateColWidth(col, newWidth - oldWidth);
|
|
581
583
|
}
|
|
582
|
-
if ("adaptive" === this.heightMode || this.autoFillHeight && this.getAllRowsHeight() <= this.tableNoFrameHeight) this.scenegraph.recalculateRowHeights(); else if ("autoHeight" === this.heightMode) {
|
|
584
|
+
if ("adaptive" === this.heightMode || this.autoFillHeight && this.getAllRowsHeight() <= this.tableNoFrameHeight) 0 === this.internalProps._heightResizedRowMap.size && this.scenegraph.recalculateRowHeights(); else if ("autoHeight" === this.heightMode && !this.internalProps._heightResizedRowMap.has(row)) {
|
|
583
585
|
const oldHeight = this.getRowHeight(row), newHeight = (0, compute_row_height_1.computeRowHeight)(row, 0, this.colCount - 1, this);
|
|
584
586
|
this.scenegraph.updateRowHeight(row, newHeight - oldHeight);
|
|
585
587
|
}
|
|
586
588
|
this.fireListeners(TABLE_EVENT_TYPE_1.TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
|
|
587
589
|
col: col,
|
|
588
590
|
row: row,
|
|
589
|
-
rawValue:
|
|
591
|
+
rawValue: rawValue,
|
|
592
|
+
currentValue: oldValue,
|
|
590
593
|
changedValue: newValue
|
|
591
594
|
}), this.scenegraph.updateNextFrame();
|
|
592
595
|
}
|
|
@@ -608,6 +611,7 @@ class PivotTable extends BaseTable_1.BaseTable {
|
|
|
608
611
|
col: startCol + j,
|
|
609
612
|
row: startRow + i,
|
|
610
613
|
rawValue: rawValue,
|
|
614
|
+
currentValue: oldValue,
|
|
611
615
|
changedValue: this.getCellOriginValue(startCol + j, startRow + i)
|
|
612
616
|
});
|
|
613
617
|
}
|