@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;
|
package/es/core/record-helper.js
CHANGED
|
@@ -49,6 +49,22 @@ function refreshCustomMergeCellGroups(table) {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
function isSameRecordIndex(sourceRecordIndex, currentRecordIndex) {
|
|
53
|
+
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;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function isTargetCellSnapshotCurrent(table, snapshot) {
|
|
57
|
+
if (table.isHeader(snapshot.col, snapshot.row) !== snapshot.isHeader) return !1;
|
|
58
|
+
if (snapshot.isHeader) return !0;
|
|
59
|
+
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);
|
|
60
|
+
return isSameRecordIndex(snapshot.recordIndex, recordIndex) && snapshot.field === field;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function areTargetCellSnapshotsCurrent(table, snapshots) {
|
|
64
|
+
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;
|
|
65
|
+
return !0;
|
|
66
|
+
}
|
|
67
|
+
|
|
52
68
|
export function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table, noTriggerChangeCellValuesEvent) {
|
|
53
69
|
var _a, _b;
|
|
54
70
|
if (workOnEditableCell && table.isHasEditorDefine(col, row) || !1 === workOnEditableCell) {
|
|
@@ -96,25 +112,53 @@ export function listTableChangeCellValue(col, row, value, workOnEditableCell, tr
|
|
|
96
112
|
}
|
|
97
113
|
}
|
|
98
114
|
|
|
99
|
-
export function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, noTriggerChangeCellValuesEvent) {
|
|
100
|
-
var _a, _b;
|
|
115
|
+
export function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table, noTriggerChangeCellValuesEvent, shouldCancel) {
|
|
116
|
+
var _a, _b, _c, _d, _e;
|
|
101
117
|
return __awaiter(this, void 0, void 0, (function*() {
|
|
102
118
|
const changedCellResults = [];
|
|
103
119
|
let pasteColEnd = startCol, pasteRowEnd = startRow;
|
|
104
|
-
const beforeChangeValues = [], oldValues = [];
|
|
120
|
+
const beforeChangeValues = [], oldValues = [], targetSnapshots = [];
|
|
105
121
|
let cellUpdateType;
|
|
106
122
|
for (let i = 0; i < values.length && !(startRow + i > table.rowCount - 1); i++) {
|
|
107
|
-
const rowValues = values[i], rawRowValues = [], oldRowValues = [];
|
|
108
|
-
beforeChangeValues.push(rawRowValues), oldValues.push(oldRowValues);
|
|
123
|
+
const rowValues = values[i], rawRowValues = [], oldRowValues = [], rowTargetSnapshots = [];
|
|
124
|
+
beforeChangeValues.push(rawRowValues), oldValues.push(oldRowValues), targetSnapshots.push(rowTargetSnapshots);
|
|
109
125
|
for (let j = 0; j < rowValues.length && !(startCol + j > table.colCount - 1); j++) {
|
|
126
|
+
const col = startCol + j, row = startRow + i;
|
|
110
127
|
cellUpdateType = getCellUpdateType(startCol + j, startRow + i, table, cellUpdateType);
|
|
111
|
-
const beforeChangeValue = table.getCellRawValue(
|
|
128
|
+
const beforeChangeValue = table.getCellRawValue(col, row);
|
|
112
129
|
rawRowValues.push(beforeChangeValue);
|
|
113
|
-
const oldValue = table.getCellOriginValue(
|
|
130
|
+
const oldValue = table.getCellOriginValue(col, row);
|
|
114
131
|
oldRowValues.push(oldValue);
|
|
132
|
+
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);
|
|
133
|
+
rowTargetSnapshots.push({
|
|
134
|
+
col: col,
|
|
135
|
+
row: row,
|
|
136
|
+
isHeader: isHeader,
|
|
137
|
+
recordIndex: recordIndex,
|
|
138
|
+
field: field
|
|
139
|
+
});
|
|
115
140
|
}
|
|
116
141
|
}
|
|
117
|
-
const resultChangeValues = [];
|
|
142
|
+
const resultChangeValues = [], preValidatedCellResults = shouldCancel && workOnEditableCell ? [] : null;
|
|
143
|
+
if (preValidatedCellResults) for (let i = 0; i < values.length; i++) {
|
|
144
|
+
if (null == shouldCancel ? void 0 : shouldCancel()) return changedCellResults;
|
|
145
|
+
if (startRow + i > table.rowCount - 1) break;
|
|
146
|
+
preValidatedCellResults[i] = [];
|
|
147
|
+
const rowValues = values[i];
|
|
148
|
+
for (let j = 0; j < rowValues.length && !(startCol + j > table.colCount - 1); j++) {
|
|
149
|
+
let isCanChange = !1;
|
|
150
|
+
if (table.isHasEditorDefine(startCol + j, startRow + i)) {
|
|
151
|
+
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, {
|
|
152
|
+
col: startCol + j,
|
|
153
|
+
row: startRow + i
|
|
154
|
+
}, table)) || void 0 === _b || _b, validateResult = isPromise(maybePromiseOrValue) ? yield maybePromiseOrValue : maybePromiseOrValue;
|
|
155
|
+
if (null == shouldCancel ? void 0 : shouldCancel()) return changedCellResults;
|
|
156
|
+
isCanChange = !0 === validateResult || "validate-exit" === validateResult || "validate-not-exit" === validateResult;
|
|
157
|
+
}
|
|
158
|
+
preValidatedCellResults[i][j] = isCanChange;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if ((null == shouldCancel ? void 0 : shouldCancel()) || !areTargetCellSnapshotsCurrent(table, targetSnapshots)) return changedCellResults;
|
|
118
162
|
for (let i = 0; i < values.length && !(startRow + i > table.rowCount - 1); i++) {
|
|
119
163
|
changedCellResults[i] = [], pasteRowEnd = startRow + i;
|
|
120
164
|
const rowValues = values[i];
|
|
@@ -122,20 +166,24 @@ export function listTableChangeCellValues(startCol, startRow, values, workOnEdit
|
|
|
122
166
|
for (let j = 0; j < rowValues.length && !(startCol + j > table.colCount - 1); j++) {
|
|
123
167
|
thisRowPasteColEnd = startCol + j;
|
|
124
168
|
let isCanChange = !1;
|
|
125
|
-
if (!1 === workOnEditableCell) isCanChange = !0; else if (table.isHasEditorDefine(startCol + j, startRow + i)) {
|
|
126
|
-
const editor = table.getEditor(startCol + j, startRow + i), oldValue = oldValues[i][j], value = rowValues[j], maybePromiseOrValue = null === (
|
|
169
|
+
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)) {
|
|
170
|
+
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, {
|
|
127
171
|
col: startCol + j,
|
|
128
172
|
row: startRow + i
|
|
129
|
-
}, table)) || void 0 ===
|
|
173
|
+
}, table)) || void 0 === _e || _e;
|
|
130
174
|
if (isPromise(maybePromiseOrValue)) {
|
|
131
175
|
const validateResult = yield maybePromiseOrValue;
|
|
176
|
+
if (null == shouldCancel ? void 0 : shouldCancel()) return changedCellResults;
|
|
132
177
|
isCanChange = !0 === validateResult || "validate-exit" === validateResult || "validate-not-exit" === validateResult;
|
|
133
178
|
} else isCanChange = !0 === maybePromiseOrValue || "validate-exit" === maybePromiseOrValue || "validate-not-exit" === maybePromiseOrValue;
|
|
134
179
|
}
|
|
135
180
|
if (isCanChange) {
|
|
136
181
|
changedCellResults[i][j] = !0;
|
|
137
182
|
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];
|
|
138
|
-
table.isHeader(startCol + j, startRow + i)
|
|
183
|
+
if (table.isHeader(startCol + j, startRow + i)) table.internalProps.layoutMap.updateColumnTitle(startCol + j, startRow + i, value); else {
|
|
184
|
+
const changeResult = table.dataSource.changeFieldValue(value, recordShowIndex, field, startCol + j, startRow + i, table);
|
|
185
|
+
isPromise(changeResult) && (yield changeResult);
|
|
186
|
+
}
|
|
139
187
|
const changedValue = table.getCellOriginValue(startCol + j, startRow + i);
|
|
140
188
|
if (oldValue !== changedValue && triggerEvent) {
|
|
141
189
|
const changeValue = {
|