@visactor/vtable 1.5.3-alpha.1 → 1.6.0-alpha.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.d.ts +1 -1
- package/cjs/ListTable.js +6 -86
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotTable.d.ts +1 -1
- package/cjs/PivotTable.js +3 -3
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/core/BaseTable.js +1 -1
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/record-helper.d.ts +2 -0
- package/cjs/core/record-helper.js +109 -2
- package/cjs/core/record-helper.js.map +1 -1
- package/cjs/core/tableHelper.js.map +1 -1
- package/cjs/data/CachedDataSource.d.ts +1 -1
- package/cjs/data/CachedDataSource.js +25 -1
- package/cjs/data/CachedDataSource.js.map +1 -1
- package/cjs/dataset/dataset.js +0 -1
- package/cjs/dataset/statistics-helper.js +1 -0
- package/cjs/edit/edit-manager.d.ts +1 -1
- package/cjs/edit/edit-manager.js +3 -3
- package/cjs/edit/edit-manager.js.map +1 -1
- package/cjs/event/listener/container-dom.js +6 -5
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/event/scroll.js +6 -4
- package/cjs/event/scroll.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/scenegraph/group-creater/cell-helper.js +3 -1
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/column-helper.js +3 -1
- package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
- package/cjs/state/select/is-cell-select-highlight.d.ts +1 -0
- package/cjs/state/select/is-cell-select-highlight.js +8 -2
- package/cjs/state/select/is-cell-select-highlight.js.map +1 -1
- package/cjs/themes/theme.js +3 -2
- package/cjs/themes/theme.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +2 -1
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +303 -196
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +1 -1
- package/es/ListTable.js +6 -90
- package/es/ListTable.js.map +1 -1
- package/es/PivotTable.d.ts +1 -1
- package/es/PivotTable.js +3 -3
- package/es/PivotTable.js.map +1 -1
- package/es/core/BaseTable.js +1 -1
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/record-helper.d.ts +2 -0
- package/es/core/record-helper.js +112 -0
- package/es/core/record-helper.js.map +1 -1
- package/es/core/tableHelper.js.map +1 -1
- package/es/data/CachedDataSource.d.ts +1 -1
- package/es/data/CachedDataSource.js +25 -1
- package/es/data/CachedDataSource.js.map +1 -1
- package/es/dataset/dataset.js +1 -2
- package/es/dataset/statistics-helper.js +2 -1
- package/es/edit/edit-manager.d.ts +1 -1
- package/es/edit/edit-manager.js +4 -2
- package/es/edit/edit-manager.js.map +1 -1
- package/es/event/listener/container-dom.js +7 -4
- package/es/event/listener/container-dom.js.map +1 -1
- package/es/event/scroll.js +6 -4
- package/es/event/scroll.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/scenegraph/group-creater/cell-helper.js +2 -1
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/column-helper.js +2 -1
- package/es/scenegraph/group-creater/column-helper.js.map +1 -1
- package/es/state/select/is-cell-select-highlight.d.ts +1 -0
- package/es/state/select/is-cell-select-highlight.js +5 -0
- package/es/state/select/is-cell-select-highlight.js.map +1 -1
- package/es/themes/theme.js +3 -1
- package/es/themes/theme.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +2 -1
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +4 -4
package/es/ListTable.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ export declare class ListTable extends BaseTable implements ListTableAPI {
|
|
|
68
68
|
sortState?: SortState | SortState[];
|
|
69
69
|
}): void;
|
|
70
70
|
setRecordChildren(records: any[], col: number, row: number): void;
|
|
71
|
-
startEditCell(col?: number, row?: number): void;
|
|
71
|
+
startEditCell(col?: number, row?: number, value?: string | number): void;
|
|
72
72
|
completeEditCell(): void;
|
|
73
73
|
getEditor(col: number, row: number): IEditor<any>;
|
|
74
74
|
isHasEditorDefine(col: number, row: number): boolean;
|
package/es/ListTable.js
CHANGED
|
@@ -16,10 +16,6 @@ import * as editors from "./edit/editors";
|
|
|
16
16
|
|
|
17
17
|
import { EditManeger } from "./edit/edit-manager";
|
|
18
18
|
|
|
19
|
-
import { computeColWidth } from "./scenegraph/layout/compute-col-width";
|
|
20
|
-
|
|
21
|
-
import { computeRowHeight } from "./scenegraph/layout/compute-row-height";
|
|
22
|
-
|
|
23
19
|
import { defaultOrderFn } from "./tools/util";
|
|
24
20
|
|
|
25
21
|
import { getCellRadioState, setCellRadioState } from "./state/radio/radio";
|
|
@@ -32,7 +28,7 @@ import { Factory } from "./core/factory";
|
|
|
32
28
|
|
|
33
29
|
import { getGroupByDataConfig } from "./core/group-helper";
|
|
34
30
|
|
|
35
|
-
import { listTableAddRecord, listTableAddRecords, listTableDeleteRecords, listTableUpdateRecords, sortRecords } from "./core/record-helper";
|
|
31
|
+
import { listTableAddRecord, listTableAddRecords, listTableChangeCellValue, listTableChangeCellValues, listTableDeleteRecords, listTableUpdateRecords, sortRecords } from "./core/record-helper";
|
|
36
32
|
|
|
37
33
|
export class ListTable extends BaseTable {
|
|
38
34
|
constructor(container, options) {
|
|
@@ -489,12 +485,12 @@ export class ListTable extends BaseTable {
|
|
|
489
485
|
const index = this.getRecordShowIndexByCell(col, row);
|
|
490
486
|
this.dataSource.setRecord(record, index), this._refreshHierarchyState(col, row);
|
|
491
487
|
}
|
|
492
|
-
startEditCell(col, row) {
|
|
488
|
+
startEditCell(col, row, value) {
|
|
493
489
|
var _a;
|
|
494
490
|
if (isValid(col) && isValid(row)) this.eventManager.isDraging = !1, this.selectCell(col, row),
|
|
495
|
-
this.editorManager.startEditCell(col, row); else if (null === (_a = this.stateManager.select) || void 0 === _a ? void 0 : _a.cellPos) {
|
|
491
|
+
this.editorManager.startEditCell(col, row, value); else if (null === (_a = this.stateManager.select) || void 0 === _a ? void 0 : _a.cellPos) {
|
|
496
492
|
const {col: col, row: row} = this.stateManager.select.cellPos;
|
|
497
|
-
isValid(col) && isValid(row) && this.editorManager.startEditCell(col, row);
|
|
493
|
+
isValid(col) && isValid(row) && this.editorManager.startEditCell(col, row, value);
|
|
498
494
|
}
|
|
499
495
|
}
|
|
500
496
|
completeEditCell() {
|
|
@@ -531,90 +527,10 @@ export class ListTable extends BaseTable {
|
|
|
531
527
|
return isValid(editorDefine);
|
|
532
528
|
}
|
|
533
529
|
changeCellValue(col, row, value, workOnEditableCell = !1) {
|
|
534
|
-
|
|
535
|
-
const recordIndex = this.getRecordShowIndexByCell(col, row), {field: field} = this.internalProps.layoutMap.getBody(col, row), beforeChangeValue = this.getCellRawValue(col, row), oldValue = this.getCellOriginValue(col, row);
|
|
536
|
-
this.isHeader(col, row) ? this.internalProps.layoutMap.updateColumnTitle(col, row, value) : this.dataSource.changeFieldValue(value, recordIndex, field, col, row, this);
|
|
537
|
-
const range = this.getCellRange(col, row), aggregators = this.internalProps.layoutMap.getAggregatorsByCell(col, row);
|
|
538
|
-
if (aggregators) {
|
|
539
|
-
if (Array.isArray(aggregators)) for (let i = 0; i < (null == aggregators ? void 0 : aggregators.length); i++) aggregators[i].recalculate(); else aggregators.recalculate();
|
|
540
|
-
const aggregatorCells = this.internalProps.layoutMap.getAggregatorCellAddress(range.start.col, range.start.row, range.end.col, range.end.row);
|
|
541
|
-
for (let i = 0; i < aggregatorCells.length; i++) {
|
|
542
|
-
const range = this.getCellRange(aggregatorCells[i].col, aggregatorCells[i].row);
|
|
543
|
-
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);
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
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);
|
|
547
|
-
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)) {
|
|
548
|
-
const oldWidth = this.getColWidth(col), newWidth = computeColWidth(col, 0, this.rowCount - 1, this, !1);
|
|
549
|
-
newWidth !== oldWidth && this.scenegraph.updateColWidth(col, newWidth - oldWidth);
|
|
550
|
-
}
|
|
551
|
-
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)) {
|
|
552
|
-
const oldHeight = this.getRowHeight(row), newHeight = computeRowHeight(row, 0, this.colCount - 1, this);
|
|
553
|
-
this.scenegraph.updateRowHeight(row, newHeight - oldHeight);
|
|
554
|
-
}
|
|
555
|
-
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
|
|
556
|
-
col: col,
|
|
557
|
-
row: row,
|
|
558
|
-
rawValue: beforeChangeValue,
|
|
559
|
-
currentValue: oldValue,
|
|
560
|
-
changedValue: this.getCellOriginValue(col, row)
|
|
561
|
-
}), this.scenegraph.updateNextFrame();
|
|
562
|
-
}
|
|
530
|
+
return listTableChangeCellValue(col, row, value, workOnEditableCell, this);
|
|
563
531
|
}
|
|
564
532
|
changeCellValues(startCol, startRow, values, workOnEditableCell = !1) {
|
|
565
|
-
|
|
566
|
-
const beforeChangeValues = [], oldValues = [];
|
|
567
|
-
for (let i = 0; i < values.length && !(startRow + i > this.rowCount - 1); i++) {
|
|
568
|
-
const rowValues = values[i], rawRowValues = [], oldRowValues = [];
|
|
569
|
-
beforeChangeValues.push(rawRowValues), oldValues.push(oldRowValues);
|
|
570
|
-
for (let j = 0; j < rowValues.length && !(startCol + j > this.colCount - 1); j++) {
|
|
571
|
-
const beforeChangeValue = this.getCellRawValue(startCol + j, startRow + i);
|
|
572
|
-
rawRowValues.push(beforeChangeValue);
|
|
573
|
-
const oldValue = this.getCellOriginValue(startCol + j, startRow + i);
|
|
574
|
-
oldRowValues.push(oldValue);
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
for (let i = 0; i < values.length && !(startRow + i > this.rowCount - 1); i++) {
|
|
578
|
-
pasteRowEnd = startRow + i;
|
|
579
|
-
const rowValues = values[i];
|
|
580
|
-
let thisRowPasteColEnd = startCol;
|
|
581
|
-
for (let j = 0; j < rowValues.length && !(startCol + j > this.colCount - 1); j++) if (thisRowPasteColEnd = startCol + j,
|
|
582
|
-
workOnEditableCell && this.isHasEditorDefine(startCol + j, startRow + i) || !1 === workOnEditableCell) {
|
|
583
|
-
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];
|
|
584
|
-
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),
|
|
585
|
-
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
|
|
586
|
-
col: startCol + j,
|
|
587
|
-
row: startRow + i,
|
|
588
|
-
rawValue: beforeChangeValue,
|
|
589
|
-
currentValue: oldValue,
|
|
590
|
-
changedValue: this.getCellOriginValue(startCol + j, startRow + i)
|
|
591
|
-
});
|
|
592
|
-
}
|
|
593
|
-
pasteColEnd = Math.max(pasteColEnd, thisRowPasteColEnd);
|
|
594
|
-
}
|
|
595
|
-
const startRange = this.getCellRange(startCol, startRow), range = this.getCellRange(pasteColEnd, pasteRowEnd), aggregators = this.internalProps.layoutMap.getAggregatorsByCellRange(startRange.start.col, startRange.start.row, range.end.col, range.end.row);
|
|
596
|
-
if (aggregators) {
|
|
597
|
-
for (let i = 0; i < (null == aggregators ? void 0 : aggregators.length); i++) aggregators[i].recalculate();
|
|
598
|
-
const aggregatorCells = this.internalProps.layoutMap.getAggregatorCellAddress(startRange.start.col, startRange.start.row, range.end.col, range.end.row);
|
|
599
|
-
for (let i = 0; i < aggregatorCells.length; i++) {
|
|
600
|
-
const range = this.getCellRange(aggregatorCells[i].col, aggregatorCells[i].row);
|
|
601
|
-
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);
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
for (let sCol = startRange.start.col; sCol <= range.end.col; sCol++) for (let sRow = startRange.start.row; sRow <= range.end.row; sRow++) this.scenegraph.updateCellContent(sCol, sRow);
|
|
605
|
-
if ("adaptive" === this.widthMode || this.autoFillWidth && this.getAllColsWidth() <= this.tableNoFrameWidth) 0 === this.internalProps._widthResizedColMap.size && this.scenegraph.recalculateColWidths(); else for (let sCol = startCol; sCol <= range.end.col; sCol++) if (!this.internalProps._widthResizedColMap.has(sCol)) {
|
|
606
|
-
const oldWidth = this.getColWidth(sCol), newWidth = computeColWidth(sCol, 0, this.rowCount - 1, this, !1);
|
|
607
|
-
newWidth !== oldWidth && this.scenegraph.updateColWidth(sCol, newWidth - oldWidth);
|
|
608
|
-
}
|
|
609
|
-
if ("adaptive" === this.heightMode || this.autoFillHeight && this.getAllRowsHeight() <= this.tableNoFrameHeight) this.scenegraph.recalculateRowHeights(); else if ("autoHeight" === this.heightMode) {
|
|
610
|
-
const rows = [], deltaYs = [];
|
|
611
|
-
for (let sRow = startRow; sRow <= range.end.row; sRow++) if (this.rowHeightsMap.get(sRow)) {
|
|
612
|
-
const oldHeight = this.getRowHeight(sRow), newHeight = computeRowHeight(sRow, 0, this.colCount - 1, this);
|
|
613
|
-
rows.push(sRow), deltaYs.push(newHeight - oldHeight);
|
|
614
|
-
}
|
|
615
|
-
this.scenegraph.updateRowsHeight(rows, deltaYs);
|
|
616
|
-
}
|
|
617
|
-
this.scenegraph.updateNextFrame();
|
|
533
|
+
return listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, this);
|
|
618
534
|
}
|
|
619
535
|
addRecord(record, recordIndex) {
|
|
620
536
|
listTableAddRecord(record, recordIndex, this);
|