@visactor/vtable 1.26.7 → 1.26.8
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 +21 -13
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.js +16 -16
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.d.ts +1 -1
- package/cjs/PivotTable.js +65 -63
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/body-helper/body-helper.js +2 -1
- package/cjs/components/index.js +1 -2
- package/cjs/core/BaseTable.js +2 -2
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/record-helper.d.ts +1 -1
- package/cjs/core/record-helper.js +60 -12
- package/cjs/core/record-helper.js.map +1 -1
- package/cjs/core/tableHelper.js +2 -1
- package/cjs/data/DataSource.d.ts +3 -1
- package/cjs/data/DataSource.js +71 -23
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/dataset/dataset.d.ts +9 -1
- package/cjs/dataset/dataset.js +344 -187
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/event/event.d.ts +94 -8
- package/cjs/event/event.js +698 -191
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/helper.js +1 -1
- package/cjs/event/media-click.js +4 -1
- package/cjs/event/media-click.js.map +1 -1
- package/cjs/event/scroll.js +1 -1
- package/cjs/event/sparkline-event.js +1 -2
- package/cjs/event/util.js +2 -2
- package/cjs/event/util.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.js +33 -17
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/plugins/custom-cell-style.js +1 -1
- package/cjs/plugins/index.js +2 -1
- package/cjs/plugins/interface.js +1 -1
- package/cjs/plugins/invert-highlight.js +1 -1
- package/cjs/plugins/list-tree-stick-cell.js +1 -1
- package/cjs/plugins/plugin-manager.js +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +27 -10
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/text-cell.d.ts +1 -1
- package/cjs/scenegraph/group-creater/cell-type/text-cell.js +14 -10
- package/cjs/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +17 -4
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js +6 -1
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js +11 -3
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/scenegraph/layout/update-height.d.ts +4 -3
- package/cjs/scenegraph/layout/update-height.js +43 -29
- package/cjs/scenegraph/layout/update-height.js.map +1 -1
- package/cjs/scenegraph/layout/update-width.d.ts +2 -1
- package/cjs/scenegraph/layout/update-width.js +49 -37
- package/cjs/scenegraph/layout/update-width.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +2 -2
- package/cjs/scenegraph/scenegraph.js +6 -5
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/utils/corner-custom-merge.d.ts +10 -0
- package/cjs/scenegraph/utils/corner-custom-merge.js +68 -0
- package/cjs/scenegraph/utils/corner-custom-merge.js.map +1 -0
- package/cjs/state/resize/update-resize-column.js +25 -13
- package/cjs/state/resize/update-resize-column.js.map +1 -1
- package/cjs/state/resize/update-resize-row.js +24 -12
- package/cjs/state/resize/update-resize-row.js.map +1 -1
- package/cjs/themes.d.ts +4 -2
- package/cjs/themes.js +12 -4
- package/cjs/themes.js.map +1 -1
- package/cjs/tools/get-data-path/create-dataset.js +4 -4
- package/cjs/tools/get-data-path/create-dataset.js.map +1 -1
- package/cjs/tools/get-data-path/index.js +4 -4
- package/cjs/tools/get-data-path/index.js.map +1 -1
- package/cjs/tools/style.d.ts +3 -1
- package/cjs/tools/style.js +2 -2
- package/cjs/tools/style.js.map +1 -1
- package/cjs/ts-types/common.d.ts +1 -0
- package/cjs/ts-types/common.js.map +1 -1
- package/cjs/ts-types/dataset/aggregation.d.ts +1 -0
- package/cjs/ts-types/dataset/aggregation.js +21 -3
- package/cjs/ts-types/dataset/aggregation.js.map +1 -1
- package/cjs/ts-types/new-data-set.d.ts +1 -0
- package/cjs/ts-types/new-data-set.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +3 -2
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +2224 -779
- package/dist/vtable.min.js +1 -1
- package/es/ListTable.d.ts +1 -1
- package/es/ListTable.js +21 -15
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.js +16 -16
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.d.ts +1 -1
- package/es/PivotTable.js +65 -63
- package/es/PivotTable.js.map +1 -1
- package/es/body-helper/body-helper.js +2 -1
- package/es/components/index.js +1 -2
- package/es/core/BaseTable.js +2 -2
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/record-helper.d.ts +1 -1
- package/es/core/record-helper.js +60 -12
- package/es/core/record-helper.js.map +1 -1
- package/es/core/tableHelper.js +2 -1
- package/es/data/DataSource.d.ts +3 -1
- package/es/data/DataSource.js +70 -23
- package/es/data/DataSource.js.map +1 -1
- package/es/dataset/dataset.d.ts +9 -1
- package/es/dataset/dataset.js +341 -187
- package/es/dataset/dataset.js.map +1 -1
- package/es/event/event.d.ts +94 -8
- package/es/event/event.js +696 -191
- package/es/event/event.js.map +1 -1
- package/es/event/helper.js +1 -1
- package/es/event/media-click.js +4 -1
- package/es/event/media-click.js.map +1 -1
- package/es/event/scroll.js +1 -1
- package/es/event/sparkline-event.js +1 -2
- package/es/event/util.js +2 -2
- package/es/event/util.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.js +29 -17
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/plugins/custom-cell-style.js +1 -1
- package/es/plugins/index.js +2 -1
- package/es/plugins/interface.js +1 -1
- package/es/plugins/invert-highlight.js +1 -1
- package/es/plugins/list-tree-stick-cell.js +1 -1
- package/es/plugins/plugin-manager.js +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +23 -9
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/text-cell.d.ts +1 -1
- package/es/scenegraph/group-creater/cell-type/text-cell.js +13 -8
- package/es/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +17 -5
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.js +6 -1
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.js +11 -3
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/scenegraph/layout/update-height.d.ts +4 -3
- package/es/scenegraph/layout/update-height.js +40 -26
- package/es/scenegraph/layout/update-height.js.map +1 -1
- package/es/scenegraph/layout/update-width.d.ts +2 -1
- package/es/scenegraph/layout/update-width.js +46 -34
- package/es/scenegraph/layout/update-width.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +2 -2
- package/es/scenegraph/scenegraph.js +7 -5
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/utils/corner-custom-merge.d.ts +10 -0
- package/es/scenegraph/utils/corner-custom-merge.js +59 -0
- package/es/scenegraph/utils/corner-custom-merge.js.map +1 -0
- package/es/state/resize/update-resize-column.js +19 -10
- package/es/state/resize/update-resize-column.js.map +1 -1
- package/es/state/resize/update-resize-row.js +19 -9
- package/es/state/resize/update-resize-row.js.map +1 -1
- package/es/themes.d.ts +4 -2
- package/es/themes.js +11 -3
- package/es/themes.js.map +1 -1
- package/es/tools/get-data-path/create-dataset.js +4 -4
- package/es/tools/get-data-path/create-dataset.js.map +1 -1
- package/es/tools/get-data-path/index.js +4 -4
- package/es/tools/get-data-path/index.js.map +1 -1
- package/es/tools/style.d.ts +3 -1
- package/es/tools/style.js +2 -2
- package/es/tools/style.js.map +1 -1
- package/es/ts-types/common.d.ts +1 -0
- package/es/ts-types/common.js.map +1 -1
- package/es/ts-types/dataset/aggregation.d.ts +1 -0
- package/es/ts-types/dataset/aggregation.js +21 -3
- package/es/ts-types/dataset/aggregation.js.map +1 -1
- package/es/ts-types/new-data-set.d.ts +1 -0
- package/es/ts-types/new-data-set.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +3 -2
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +9 -9
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ListTable } from '../ListTable';
|
|
2
2
|
import type { CellRange } from '../ts-types';
|
|
3
3
|
export declare function listTableChangeCellValue(col: number, row: number, value: string | number | null, workOnEditableCell: boolean, triggerEvent: boolean, table: ListTable, noTriggerChangeCellValuesEvent?: boolean): void;
|
|
4
|
-
export declare function listTableChangeCellValues(startCol: number, startRow: number, values: (string | number)[][], workOnEditableCell: boolean, triggerEvent: boolean, table: ListTable, noTriggerChangeCellValuesEvent?: boolean): Promise<boolean[][]>;
|
|
4
|
+
export declare function listTableChangeCellValues(startCol: number, startRow: number, values: (string | number)[][], workOnEditableCell: boolean, triggerEvent: boolean, table: ListTable, noTriggerChangeCellValuesEvent?: boolean, shouldCancel?: () => boolean): Promise<boolean[][]>;
|
|
5
5
|
export declare function listTableChangeCellValuesByRanges(ranges: CellRange[], value: string | number | null, workOnEditableCell: boolean, triggerEvent: boolean, table: ListTable, noTriggerChangeCellValuesEvent?: boolean): Promise<void>;
|
|
6
6
|
export declare function sortRecords(table: ListTable): void;
|
|
7
7
|
export declare function listTableAddRecord(record: any, recordIndex: number | number[], table: ListTable): boolean;
|
|
@@ -43,6 +43,22 @@ function refreshCustomMergeCellGroups(table) {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
function isSameRecordIndex(sourceRecordIndex, currentRecordIndex) {
|
|
47
|
+
return Array.isArray(sourceRecordIndex) || Array.isArray(currentRecordIndex) ? Array.isArray(sourceRecordIndex) && Array.isArray(currentRecordIndex) && sourceRecordIndex.length === currentRecordIndex.length && sourceRecordIndex.every(((value, index) => value === currentRecordIndex[index])) : sourceRecordIndex === currentRecordIndex;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function isTargetCellSnapshotCurrent(table, snapshot) {
|
|
51
|
+
if (table.isHeader(snapshot.col, snapshot.row) !== snapshot.isHeader) return !1;
|
|
52
|
+
if (snapshot.isHeader) return !0;
|
|
53
|
+
const recordShowIndex = table.getRecordShowIndexByCell(snapshot.col, snapshot.row), recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0, {field: field} = table.internalProps.layoutMap.getBody(snapshot.col, snapshot.row);
|
|
54
|
+
return isSameRecordIndex(snapshot.recordIndex, recordIndex) && snapshot.field === field;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function areTargetCellSnapshotsCurrent(table, snapshots) {
|
|
58
|
+
for (let i = 0; i < snapshots.length; i++) for (let j = 0; j < snapshots[i].length; j++) if (!isTargetCellSnapshotCurrent(table, snapshots[i][j])) return !1;
|
|
59
|
+
return !0;
|
|
60
|
+
}
|
|
61
|
+
|
|
46
62
|
function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table, noTriggerChangeCellValuesEvent) {
|
|
47
63
|
var _a, _b;
|
|
48
64
|
if (workOnEditableCell && table.isHasEditorDefine(col, row) || !1 === workOnEditableCell) {
|
|
@@ -91,25 +107,53 @@ function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEv
|
|
|
91
107
|
}
|
|
92
108
|
}
|
|
93
109
|
|
|
94
|
-
function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, noTriggerChangeCellValuesEvent) {
|
|
95
|
-
var _a, _b;
|
|
110
|
+
function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, noTriggerChangeCellValuesEvent, shouldCancel) {
|
|
111
|
+
var _a, _b, _c, _d, _e;
|
|
96
112
|
return __awaiter(this, void 0, void 0, (function*() {
|
|
97
113
|
const changedCellResults = [];
|
|
98
114
|
let pasteColEnd = startCol, pasteRowEnd = startRow;
|
|
99
|
-
const beforeChangeValues = [], oldValues = [];
|
|
115
|
+
const beforeChangeValues = [], oldValues = [], targetSnapshots = [];
|
|
100
116
|
let cellUpdateType;
|
|
101
117
|
for (let i = 0; i < values.length && !(startRow + i > table.rowCount - 1); i++) {
|
|
102
|
-
const rowValues = values[i], rawRowValues = [], oldRowValues = [];
|
|
103
|
-
beforeChangeValues.push(rawRowValues), oldValues.push(oldRowValues);
|
|
118
|
+
const rowValues = values[i], rawRowValues = [], oldRowValues = [], rowTargetSnapshots = [];
|
|
119
|
+
beforeChangeValues.push(rawRowValues), oldValues.push(oldRowValues), targetSnapshots.push(rowTargetSnapshots);
|
|
104
120
|
for (let j = 0; j < rowValues.length && !(startCol + j > table.colCount - 1); j++) {
|
|
121
|
+
const col = startCol + j, row = startRow + i;
|
|
105
122
|
cellUpdateType = getCellUpdateType(startCol + j, startRow + i, table, cellUpdateType);
|
|
106
|
-
const beforeChangeValue = table.getCellRawValue(
|
|
123
|
+
const beforeChangeValue = table.getCellRawValue(col, row);
|
|
107
124
|
rawRowValues.push(beforeChangeValue);
|
|
108
|
-
const oldValue = table.getCellOriginValue(
|
|
125
|
+
const oldValue = table.getCellOriginValue(col, row);
|
|
109
126
|
oldRowValues.push(oldValue);
|
|
127
|
+
const isHeader = table.isHeader(col, row), recordShowIndex = table.getRecordShowIndexByCell(col, row), recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0, {field: field} = table.internalProps.layoutMap.getBody(col, row);
|
|
128
|
+
rowTargetSnapshots.push({
|
|
129
|
+
col: col,
|
|
130
|
+
row: row,
|
|
131
|
+
isHeader: isHeader,
|
|
132
|
+
recordIndex: recordIndex,
|
|
133
|
+
field: field
|
|
134
|
+
});
|
|
110
135
|
}
|
|
111
136
|
}
|
|
112
|
-
const resultChangeValues = [];
|
|
137
|
+
const resultChangeValues = [], preValidatedCellResults = shouldCancel && workOnEditableCell ? [] : null;
|
|
138
|
+
if (preValidatedCellResults) for (let i = 0; i < values.length; i++) {
|
|
139
|
+
if (null == shouldCancel ? void 0 : shouldCancel()) return changedCellResults;
|
|
140
|
+
if (startRow + i > table.rowCount - 1) break;
|
|
141
|
+
preValidatedCellResults[i] = [];
|
|
142
|
+
const rowValues = values[i];
|
|
143
|
+
for (let j = 0; j < rowValues.length && !(startCol + j > table.colCount - 1); j++) {
|
|
144
|
+
let isCanChange = !1;
|
|
145
|
+
if (table.isHasEditorDefine(startCol + j, startRow + i)) {
|
|
146
|
+
const editor = table.getEditor(startCol + j, startRow + i), oldValue = oldValues[i][j], value = rowValues[j], maybePromiseOrValue = null === (_b = null === (_a = null == editor ? void 0 : editor.validateValue) || void 0 === _a ? void 0 : _a.call(editor, value, oldValue, {
|
|
147
|
+
col: startCol + j,
|
|
148
|
+
row: startRow + i
|
|
149
|
+
}, table)) || void 0 === _b || _b, validateResult = (0, helper_1.isPromise)(maybePromiseOrValue) ? yield maybePromiseOrValue : maybePromiseOrValue;
|
|
150
|
+
if (null == shouldCancel ? void 0 : shouldCancel()) return changedCellResults;
|
|
151
|
+
isCanChange = !0 === validateResult || "validate-exit" === validateResult || "validate-not-exit" === validateResult;
|
|
152
|
+
}
|
|
153
|
+
preValidatedCellResults[i][j] = isCanChange;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if ((null == shouldCancel ? void 0 : shouldCancel()) || !areTargetCellSnapshotsCurrent(table, targetSnapshots)) return changedCellResults;
|
|
113
157
|
for (let i = 0; i < values.length && !(startRow + i > table.rowCount - 1); i++) {
|
|
114
158
|
changedCellResults[i] = [], pasteRowEnd = startRow + i;
|
|
115
159
|
const rowValues = values[i];
|
|
@@ -117,20 +161,24 @@ function listTableChangeCellValues(startCol, startRow, values, workOnEditableCel
|
|
|
117
161
|
for (let j = 0; j < rowValues.length && !(startCol + j > table.colCount - 1); j++) {
|
|
118
162
|
thisRowPasteColEnd = startCol + j;
|
|
119
163
|
let isCanChange = !1;
|
|
120
|
-
if (!1 === workOnEditableCell) isCanChange = !0; else if (table.isHasEditorDefine(startCol + j, startRow + i)) {
|
|
121
|
-
const editor = table.getEditor(startCol + j, startRow + i), oldValue = oldValues[i][j], value = rowValues[j], maybePromiseOrValue = null === (
|
|
164
|
+
if (preValidatedCellResults) isCanChange = !0 === (null === (_c = preValidatedCellResults[i]) || void 0 === _c ? void 0 : _c[j]); else if (!1 === workOnEditableCell) isCanChange = !0; else if (table.isHasEditorDefine(startCol + j, startRow + i)) {
|
|
165
|
+
const editor = table.getEditor(startCol + j, startRow + i), oldValue = oldValues[i][j], value = rowValues[j], maybePromiseOrValue = null === (_e = null === (_d = null == editor ? void 0 : editor.validateValue) || void 0 === _d ? void 0 : _d.call(editor, value, oldValue, {
|
|
122
166
|
col: startCol + j,
|
|
123
167
|
row: startRow + i
|
|
124
|
-
}, table)) || void 0 ===
|
|
168
|
+
}, table)) || void 0 === _e || _e;
|
|
125
169
|
if ((0, helper_1.isPromise)(maybePromiseOrValue)) {
|
|
126
170
|
const validateResult = yield maybePromiseOrValue;
|
|
171
|
+
if (null == shouldCancel ? void 0 : shouldCancel()) return changedCellResults;
|
|
127
172
|
isCanChange = !0 === validateResult || "validate-exit" === validateResult || "validate-not-exit" === validateResult;
|
|
128
173
|
} else isCanChange = !0 === maybePromiseOrValue || "validate-exit" === maybePromiseOrValue || "validate-not-exit" === maybePromiseOrValue;
|
|
129
174
|
}
|
|
130
175
|
if (isCanChange) {
|
|
131
176
|
changedCellResults[i][j] = !0;
|
|
132
177
|
const value = rowValues[j], recordShowIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i), recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0, {field: field} = table.internalProps.layoutMap.getBody(startCol + j, startRow + i), beforeChangeValue = beforeChangeValues[i][j], oldValue = oldValues[i][j];
|
|
133
|
-
table.isHeader(startCol + j, startRow + i)
|
|
178
|
+
if (table.isHeader(startCol + j, startRow + i)) table.internalProps.layoutMap.updateColumnTitle(startCol + j, startRow + i, value); else {
|
|
179
|
+
const changeResult = table.dataSource.changeFieldValue(value, recordShowIndex, field, startCol + j, startRow + i, table);
|
|
180
|
+
(0, helper_1.isPromise)(changeResult) && (yield changeResult);
|
|
181
|
+
}
|
|
134
182
|
const changedValue = table.getCellOriginValue(startCol + j, startRow + i);
|
|
135
183
|
if (oldValue !== changedValue && triggerEvent) {
|
|
136
184
|
const changeValue = {
|