@visactor/vtable 1.3.3 → 1.4.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 +25 -15
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.d.ts +1 -2
- package/cjs/PivotChart.js +0 -7
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.d.ts +1 -1
- package/cjs/PivotTable.js +34 -14
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/components/react/react-custom-layout.d.ts +21 -0
- package/cjs/components/react/react-custom-layout.js +48 -0
- package/cjs/components/react/react-custom-layout.js.map +1 -0
- package/cjs/core/BaseTable.d.ts +5 -0
- package/cjs/core/BaseTable.js +37 -23
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/style.js +1 -1
- package/cjs/core/style.js.map +1 -1
- package/cjs/data/DataSource.d.ts +6 -1
- package/cjs/data/DataSource.js +12 -2
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/dataset/dataset.d.ts +15 -2
- package/cjs/dataset/dataset.js +187 -72
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/dataset/statistics-helper.d.ts +43 -3
- package/cjs/dataset/statistics-helper.js +61 -26
- package/cjs/dataset/statistics-helper.js.map +1 -1
- package/cjs/event/listener/table-group.js +2 -2
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/index.d.ts +3 -1
- package/cjs/index.js +14 -5
- package/cjs/index.js.map +1 -1
- package/cjs/layout/pivot-header-layout.d.ts +1 -0
- package/cjs/layout/pivot-header-layout.js +7 -0
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/scenegraph/component/custom.js +6 -4
- package/cjs/scenegraph/component/custom.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +4 -0
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js +2 -2
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js +3 -3
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +2 -1
- package/cjs/scenegraph/scenegraph.js +12 -3
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +8 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/customLayout.d.ts +1 -1
- package/cjs/ts-types/customLayout.js.map +1 -1
- package/cjs/ts-types/new-data-set.d.ts +9 -1
- package/cjs/ts-types/new-data-set.js +1 -1
- package/cjs/ts-types/new-data-set.js.map +1 -1
- package/cjs/ts-types/pivot-table/corner.d.ts +12 -0
- package/cjs/ts-types/pivot-table/corner.js.map +1 -1
- package/cjs/vrender.d.ts +4 -0
- package/cjs/vrender.js +39 -11
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +25311 -9542
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.js +21 -11
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.d.ts +1 -2
- package/es/PivotChart.js +0 -7
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.d.ts +1 -1
- package/es/PivotTable.js +34 -14
- package/es/PivotTable.js.map +1 -1
- package/es/components/react/react-custom-layout.d.ts +21 -0
- package/es/components/react/react-custom-layout.js +38 -0
- package/es/components/react/react-custom-layout.js.map +1 -0
- package/es/core/BaseTable.d.ts +5 -0
- package/es/core/BaseTable.js +40 -23
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/style.js +1 -1
- package/es/core/style.js.map +1 -1
- package/es/data/DataSource.d.ts +6 -1
- package/es/data/DataSource.js +12 -2
- package/es/data/DataSource.js.map +1 -1
- package/es/dataset/dataset.d.ts +15 -2
- package/es/dataset/dataset.js +187 -73
- package/es/dataset/dataset.js.map +1 -1
- package/es/dataset/statistics-helper.d.ts +43 -3
- package/es/dataset/statistics-helper.js +55 -23
- package/es/dataset/statistics-helper.js.map +1 -1
- package/es/event/listener/table-group.js +2 -2
- package/es/event/listener/table-group.js.map +1 -1
- package/es/index.d.ts +3 -1
- package/es/index.js +5 -1
- package/es/index.js.map +1 -1
- package/es/layout/pivot-header-layout.d.ts +1 -0
- package/es/layout/pivot-header-layout.js +7 -0
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/scenegraph/component/custom.js +7 -3
- package/es/scenegraph/component/custom.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +4 -0
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.js +3 -3
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.js +4 -4
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +2 -1
- package/es/scenegraph/scenegraph.js +12 -3
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/ts-types/base-table.d.ts +8 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/customLayout.d.ts +1 -1
- package/es/ts-types/customLayout.js.map +1 -1
- package/es/ts-types/new-data-set.d.ts +9 -1
- package/es/ts-types/new-data-set.js +1 -1
- package/es/ts-types/new-data-set.js.map +1 -1
- package/es/ts-types/pivot-table/corner.d.ts +12 -0
- package/es/ts-types/pivot-table/corner.js.map +1 -1
- package/es/vrender.d.ts +4 -0
- package/es/vrender.js +9 -3
- package/es/vrender.js.map +1 -1
- package/package.json +8 -8
package/cjs/ListTable.js
CHANGED
|
@@ -40,9 +40,10 @@ class ListTable extends core_1.BaseTable {
|
|
|
40
40
|
const internalProps = this.internalProps;
|
|
41
41
|
internalProps.frozenColDragHeaderMode = options.frozenColDragHeaderMode, this.pagination = options.pagination,
|
|
42
42
|
internalProps.sortState = options.sortState, internalProps.dataConfig = {}, internalProps.columns = options.columns ? (0,
|
|
43
|
-
vutil_extension_temp_1.cloneDeepSpec)(options.columns) : options.header ? (0,
|
|
44
|
-
|
|
45
|
-
this.
|
|
43
|
+
vutil_extension_temp_1.cloneDeepSpec)(options.columns, [ "children" ]) : options.header ? (0,
|
|
44
|
+
vutil_extension_temp_1.cloneDeepSpec)(options.header, [ "children" ]) : [], this.internalProps.headerHelper.setTableColumnsEditor(),
|
|
45
|
+
this.showHeader = null === (_a = options.showHeader) || void 0 === _a || _a, this.transpose = null !== (_b = options.transpose) && void 0 !== _b && _b,
|
|
46
|
+
"node" !== env_1.Env.mode && (this.editorManager = new edit_manager_1.EditManeger(this)),
|
|
46
47
|
this.refreshHeader(), this.internalProps.useOneRowHeightFillAll = !1, options.dataSource ? (0,
|
|
47
48
|
tableHelper_1._setDataSource)(this, options.dataSource) : options.records ? this.setRecords(options.records, {
|
|
48
49
|
sortState: internalProps.sortState
|
|
@@ -76,7 +77,7 @@ class ListTable extends core_1.BaseTable {
|
|
|
76
77
|
col: this.stateManager.hover.cellPos.col,
|
|
77
78
|
row: this.stateManager.hover.cellPos.row
|
|
78
79
|
};
|
|
79
|
-
this.internalProps.columns = (0, vutil_extension_temp_1.cloneDeepSpec)(columns),
|
|
80
|
+
this.internalProps.columns = (0, vutil_extension_temp_1.cloneDeepSpec)(columns, [ "children" ]),
|
|
80
81
|
this.options.columns = columns, this.internalProps.headerHelper.setTableColumnsEditor(),
|
|
81
82
|
this._hasAutoImageColumn = void 0, this.refreshHeader(), this.internalProps.useOneRowHeightFillAll = !1,
|
|
82
83
|
this.scenegraph.clearCells(), this.headerStyleCache = new Map, this.bodyStyleCache = new Map,
|
|
@@ -219,8 +220,8 @@ class ListTable extends core_1.BaseTable {
|
|
|
219
220
|
return super.updateOption(options), internalProps.frozenColDragHeaderMode = options.frozenColDragHeaderMode,
|
|
220
221
|
this.pagination = options.pagination, internalProps.sortState = options.sortState,
|
|
221
222
|
internalProps.dataConfig = {}, this.showHeader = null === (_a = options.showHeader) || void 0 === _a || _a,
|
|
222
|
-
internalProps.columns = options.columns ? (0, vutil_extension_temp_1.cloneDeepSpec)(options.columns) : options.header ? (0,
|
|
223
|
-
vutil_extension_temp_1.cloneDeepSpec)(options.header) : [], this.internalProps.headerHelper.setTableColumnsEditor(),
|
|
223
|
+
internalProps.columns = options.columns ? (0, vutil_extension_temp_1.cloneDeepSpec)(options.columns, [ "children" ]) : options.header ? (0,
|
|
224
|
+
vutil_extension_temp_1.cloneDeepSpec)(options.header, [ "children" ]) : [], this.internalProps.headerHelper.setTableColumnsEditor(),
|
|
224
225
|
this.transpose = null !== (_b = options.transpose) && void 0 !== _b && _b, this.refreshHeader(),
|
|
225
226
|
this.internalProps.useOneRowHeightFillAll = !1, internalProps.releaseList && (internalProps.releaseList.forEach((releaseObj => {
|
|
226
227
|
var _a;
|
|
@@ -393,18 +394,16 @@ class ListTable extends core_1.BaseTable {
|
|
|
393
394
|
}
|
|
394
395
|
}
|
|
395
396
|
updateSortState(sortState, executeSort = !0) {
|
|
396
|
-
var _a;
|
|
397
|
-
if (sortState) this.internalProps.sortState = sortState; else if (this.internalProps.sortState) if (Array.isArray(this.internalProps.sortState)) for (let i = 0; i < this.internalProps.sortState.length; i++) {
|
|
398
|
-
this.internalProps.sortState[i].order = "normal";
|
|
399
|
-
} else this.internalProps.sortState.order = "normal";
|
|
397
|
+
var _a, _b, _c;
|
|
400
398
|
let order, field;
|
|
401
|
-
if (Array.isArray(this.internalProps.sortState) ? (
|
|
399
|
+
if (sortState ? this.internalProps.sortState = sortState : this.internalProps.sortState && (Array.isArray(this.internalProps.sortState) ? (sortState = null === (_a = this.internalProps.sortState) || void 0 === _a ? void 0 : _a[0]) && (sortState.order = "normal") : (this.internalProps.sortState.order = "normal",
|
|
400
|
+
sortState = this.internalProps.sortState)), Array.isArray(this.internalProps.sortState) ? (null === (_b = this.internalProps.sortState) || void 0 === _b ? void 0 : _b[0]) && ({order: order, field: field} = null === (_c = this.internalProps.sortState) || void 0 === _c ? void 0 : _c[0]) : this.internalProps.sortState && ({order: order, field: field} = this.internalProps.sortState),
|
|
402
401
|
field && executeSort) {
|
|
403
402
|
const sortFunc = this._getSortFuncFromHeaderOption(this.internalProps.columns, field), hd = this.internalProps.layoutMap.headerObjects.find((col => col && col.field === field));
|
|
404
403
|
!1 !== hd.define.sort && (this.dataSource.sort(hd.field, order, sortFunc), this.internalProps.layoutMap.clearCellRangeMap(),
|
|
405
404
|
this.internalProps.useOneRowHeightFillAll = !1, this.scenegraph.sortCell());
|
|
406
405
|
}
|
|
407
|
-
this.stateManager.updateSortState(sortState);
|
|
406
|
+
sortState && this.stateManager.updateSortState(sortState);
|
|
408
407
|
}
|
|
409
408
|
updateFilterRules(filterRules) {
|
|
410
409
|
this.scenegraph.clearCells(), this.sortState ? (this.dataSource.updateFilterRulesForSorted(filterRules),
|
|
@@ -474,8 +473,8 @@ class ListTable extends core_1.BaseTable {
|
|
|
474
473
|
}
|
|
475
474
|
startEditCell(col, row) {
|
|
476
475
|
var _a;
|
|
477
|
-
if ((0, vutils_1.isValid)(col) && (0, vutils_1.isValid)(row)) this.
|
|
478
|
-
this.editorManager.startEditCell(col, row); else if (null === (_a = this.stateManager.select) || void 0 === _a ? void 0 : _a.cellPos) {
|
|
476
|
+
if ((0, vutils_1.isValid)(col) && (0, vutils_1.isValid)(row)) this.eventManager.isDraging = !1,
|
|
477
|
+
this.selectCell(col, row), this.editorManager.startEditCell(col, row); else if (null === (_a = this.stateManager.select) || void 0 === _a ? void 0 : _a.cellPos) {
|
|
479
478
|
const {col: col, row: row} = this.stateManager.select.cellPos;
|
|
480
479
|
(0, vutils_1.isValid)(col) && (0, vutils_1.isValid)(row) && this.editorManager.startEditCell(col, row);
|
|
481
480
|
}
|
|
@@ -546,13 +545,24 @@ class ListTable extends core_1.BaseTable {
|
|
|
546
545
|
}
|
|
547
546
|
changeCellValues(startCol, startRow, values, workOnEditableCell = !1) {
|
|
548
547
|
let pasteColEnd = startCol, pasteRowEnd = startRow;
|
|
548
|
+
const beforeChangeValues = [], oldValues = [];
|
|
549
|
+
for (let i = 0; i < values.length && !(startRow + i > this.rowCount - 1); i++) {
|
|
550
|
+
const rowValues = values[i], rawRowValues = [], oldRowValues = [];
|
|
551
|
+
beforeChangeValues.push(rawRowValues), oldValues.push(oldRowValues);
|
|
552
|
+
for (let j = 0; j < rowValues.length && !(startCol + j > this.colCount - 1); j++) {
|
|
553
|
+
const beforeChangeValue = this.getCellRawValue(startCol + j, startRow + i);
|
|
554
|
+
rawRowValues.push(beforeChangeValue);
|
|
555
|
+
const oldValue = this.getCellOriginValue(startCol + j, startRow + i);
|
|
556
|
+
oldRowValues.push(oldValue);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
549
559
|
for (let i = 0; i < values.length && !(startRow + i > this.rowCount - 1); i++) {
|
|
550
560
|
pasteRowEnd = startRow + i;
|
|
551
561
|
const rowValues = values[i];
|
|
552
562
|
let thisRowPasteColEnd = startCol;
|
|
553
563
|
for (let j = 0; j < rowValues.length && !(startCol + j > this.colCount - 1); j++) if (thisRowPasteColEnd = startCol + j,
|
|
554
564
|
workOnEditableCell && this.isHasEditorDefine(startCol + j, startRow + i) || !1 === workOnEditableCell) {
|
|
555
|
-
const value = rowValues[j], recordIndex = this.getRecordShowIndexByCell(startCol + j, startRow + i), {field: field} = this.internalProps.layoutMap.getBody(startCol + j, startRow + i), beforeChangeValue =
|
|
565
|
+
const value = rowValues[j], recordIndex = this.getRecordShowIndexByCell(startCol + j, startRow + i), {field: field} = this.internalProps.layoutMap.getBody(startCol + j, startRow + i), beforeChangeValue = beforeChangeValues[i][j], oldValue = oldValues[i][j];
|
|
556
566
|
this.isHeader(startCol + j, startRow + i) ? this.internalProps.layoutMap.updateColumnTitle(startCol + j, startRow + i, value) : this.dataSource.changeFieldValue(value, recordIndex, field, startCol + j, startRow + i, this),
|
|
557
567
|
this.fireListeners(TABLE_EVENT_TYPE_1.TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
|
|
558
568
|
col: startCol + j,
|