@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/es/ListTable.js
CHANGED
|
@@ -40,7 +40,7 @@ export class ListTable extends BaseTable {
|
|
|
40
40
|
this.showHeader = !0;
|
|
41
41
|
const internalProps = this.internalProps;
|
|
42
42
|
internalProps.frozenColDragHeaderMode = options.frozenColDragHeaderMode, this.pagination = options.pagination,
|
|
43
|
-
internalProps.sortState = options.sortState, internalProps.dataConfig = {}, internalProps.columns = options.columns ? cloneDeepSpec(options.columns) : options.header ? cloneDeepSpec(options.header) : [],
|
|
43
|
+
internalProps.sortState = options.sortState, internalProps.dataConfig = {}, internalProps.columns = options.columns ? cloneDeepSpec(options.columns, [ "children" ]) : options.header ? cloneDeepSpec(options.header, [ "children" ]) : [],
|
|
44
44
|
this.internalProps.headerHelper.setTableColumnsEditor(), this.showHeader = null === (_a = options.showHeader) || void 0 === _a || _a,
|
|
45
45
|
this.transpose = null !== (_b = options.transpose) && void 0 !== _b && _b, "node" !== Env.mode && (this.editorManager = new EditManeger(this)),
|
|
46
46
|
this.refreshHeader(), this.internalProps.useOneRowHeightFillAll = !1, options.dataSource ? _setDataSource(this, options.dataSource) : options.records ? this.setRecords(options.records, {
|
|
@@ -75,7 +75,7 @@ export class ListTable extends BaseTable {
|
|
|
75
75
|
col: this.stateManager.hover.cellPos.col,
|
|
76
76
|
row: this.stateManager.hover.cellPos.row
|
|
77
77
|
};
|
|
78
|
-
this.internalProps.columns = cloneDeepSpec(columns), this.options.columns = columns,
|
|
78
|
+
this.internalProps.columns = cloneDeepSpec(columns, [ "children" ]), this.options.columns = columns,
|
|
79
79
|
this.internalProps.headerHelper.setTableColumnsEditor(), this._hasAutoImageColumn = void 0,
|
|
80
80
|
this.refreshHeader(), this.internalProps.useOneRowHeightFillAll = !1, this.scenegraph.clearCells(),
|
|
81
81
|
this.headerStyleCache = new Map, this.bodyStyleCache = new Map, this.bodyBottomStyleCache = new Map,
|
|
@@ -218,7 +218,7 @@ export class ListTable extends BaseTable {
|
|
|
218
218
|
return super.updateOption(options), internalProps.frozenColDragHeaderMode = options.frozenColDragHeaderMode,
|
|
219
219
|
this.pagination = options.pagination, internalProps.sortState = options.sortState,
|
|
220
220
|
internalProps.dataConfig = {}, this.showHeader = null === (_a = options.showHeader) || void 0 === _a || _a,
|
|
221
|
-
internalProps.columns = options.columns ? cloneDeepSpec(options.columns) : options.header ? cloneDeepSpec(options.header) : [],
|
|
221
|
+
internalProps.columns = options.columns ? cloneDeepSpec(options.columns, [ "children" ]) : options.header ? cloneDeepSpec(options.header, [ "children" ]) : [],
|
|
222
222
|
this.internalProps.headerHelper.setTableColumnsEditor(), this.transpose = null !== (_b = options.transpose) && void 0 !== _b && _b,
|
|
223
223
|
this.refreshHeader(), this.internalProps.useOneRowHeightFillAll = !1, internalProps.releaseList && (internalProps.releaseList.forEach((releaseObj => {
|
|
224
224
|
var _a;
|
|
@@ -391,18 +391,16 @@ export class ListTable extends BaseTable {
|
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
393
|
updateSortState(sortState, executeSort = !0) {
|
|
394
|
-
var _a;
|
|
395
|
-
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++) {
|
|
396
|
-
this.internalProps.sortState[i].order = "normal";
|
|
397
|
-
} else this.internalProps.sortState.order = "normal";
|
|
394
|
+
var _a, _b, _c;
|
|
398
395
|
let order, field;
|
|
399
|
-
if (Array.isArray(this.internalProps.sortState) ? (
|
|
396
|
+
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",
|
|
397
|
+
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),
|
|
400
398
|
field && executeSort) {
|
|
401
399
|
const sortFunc = this._getSortFuncFromHeaderOption(this.internalProps.columns, field), hd = this.internalProps.layoutMap.headerObjects.find((col => col && col.field === field));
|
|
402
400
|
!1 !== hd.define.sort && (this.dataSource.sort(hd.field, order, sortFunc), this.internalProps.layoutMap.clearCellRangeMap(),
|
|
403
401
|
this.internalProps.useOneRowHeightFillAll = !1, this.scenegraph.sortCell());
|
|
404
402
|
}
|
|
405
|
-
this.stateManager.updateSortState(sortState);
|
|
403
|
+
sortState && this.stateManager.updateSortState(sortState);
|
|
406
404
|
}
|
|
407
405
|
updateFilterRules(filterRules) {
|
|
408
406
|
this.scenegraph.clearCells(), this.sortState ? (this.dataSource.updateFilterRulesForSorted(filterRules),
|
|
@@ -471,7 +469,8 @@ export class ListTable extends BaseTable {
|
|
|
471
469
|
}
|
|
472
470
|
startEditCell(col, row) {
|
|
473
471
|
var _a;
|
|
474
|
-
if (isValid(col) && isValid(row)) this.
|
|
472
|
+
if (isValid(col) && isValid(row)) this.eventManager.isDraging = !1, this.selectCell(col, row),
|
|
473
|
+
this.editorManager.startEditCell(col, row); else if (null === (_a = this.stateManager.select) || void 0 === _a ? void 0 : _a.cellPos) {
|
|
475
474
|
const {col: col, row: row} = this.stateManager.select.cellPos;
|
|
476
475
|
isValid(col) && isValid(row) && this.editorManager.startEditCell(col, row);
|
|
477
476
|
}
|
|
@@ -542,13 +541,24 @@ export class ListTable extends BaseTable {
|
|
|
542
541
|
}
|
|
543
542
|
changeCellValues(startCol, startRow, values, workOnEditableCell = !1) {
|
|
544
543
|
let pasteColEnd = startCol, pasteRowEnd = startRow;
|
|
544
|
+
const beforeChangeValues = [], oldValues = [];
|
|
545
|
+
for (let i = 0; i < values.length && !(startRow + i > this.rowCount - 1); i++) {
|
|
546
|
+
const rowValues = values[i], rawRowValues = [], oldRowValues = [];
|
|
547
|
+
beforeChangeValues.push(rawRowValues), oldValues.push(oldRowValues);
|
|
548
|
+
for (let j = 0; j < rowValues.length && !(startCol + j > this.colCount - 1); j++) {
|
|
549
|
+
const beforeChangeValue = this.getCellRawValue(startCol + j, startRow + i);
|
|
550
|
+
rawRowValues.push(beforeChangeValue);
|
|
551
|
+
const oldValue = this.getCellOriginValue(startCol + j, startRow + i);
|
|
552
|
+
oldRowValues.push(oldValue);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
545
555
|
for (let i = 0; i < values.length && !(startRow + i > this.rowCount - 1); i++) {
|
|
546
556
|
pasteRowEnd = startRow + i;
|
|
547
557
|
const rowValues = values[i];
|
|
548
558
|
let thisRowPasteColEnd = startCol;
|
|
549
559
|
for (let j = 0; j < rowValues.length && !(startCol + j > this.colCount - 1); j++) if (thisRowPasteColEnd = startCol + j,
|
|
550
560
|
workOnEditableCell && this.isHasEditorDefine(startCol + j, startRow + i) || !1 === workOnEditableCell) {
|
|
551
|
-
const value = rowValues[j], recordIndex = this.getRecordShowIndexByCell(startCol + j, startRow + i), {field: field} = this.internalProps.layoutMap.getBody(startCol + j, startRow + i), beforeChangeValue =
|
|
561
|
+
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];
|
|
552
562
|
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),
|
|
553
563
|
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
|
|
554
564
|
col: startCol + j,
|