@visactor/vtable 1.13.2 → 1.13.3-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 +5 -5
- package/cjs/ListTable.js.map +1 -1
- package/cjs/core/BaseTable.js +1 -1
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/dataset/dataset-pivot-table.js +2 -1
- package/cjs/edit/editors.js +1 -2
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/layout-helper.js +1 -1
- package/cjs/layout/pivot-header-layout.js +1 -1
- package/cjs/layout/pivot-layout.js +2 -0
- package/cjs/layout/row-height-map.js +1 -1
- package/cjs/layout/simple-header-layout.js +1 -1
- package/cjs/layout/tree-helper.js +2 -2
- package/cjs/plugins/chartModules.js +1 -1
- package/cjs/plugins/custom-cell-style.js +1 -1
- package/cjs/plugins/icons.js +1 -1
- package/cjs/plugins/invert-highlight.js +1 -1
- package/cjs/plugins/list-tree-stick-cell.js +1 -1
- package/cjs/plugins/themes.js +1 -1
- package/cjs/state/checkbox/checkbox.js +82 -51
- package/cjs/state/checkbox/checkbox.js.map +1 -1
- package/cjs/state/state.d.ts +1 -1
- package/cjs/state/state.js +4 -4
- package/cjs/state/state.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +134 -88
- package/dist/vtable.min.js +1 -1
- package/es/ListTable.d.ts +1 -1
- package/es/ListTable.js +5 -5
- package/es/ListTable.js.map +1 -1
- package/es/core/BaseTable.js +1 -1
- package/es/core/BaseTable.js.map +1 -1
- package/es/dataset/dataset-pivot-table.js +2 -1
- package/es/edit/editors.js +1 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/layout-helper.js +1 -1
- package/es/layout/pivot-header-layout.js +1 -1
- package/es/layout/pivot-layout.js +2 -0
- package/es/layout/row-height-map.js +1 -1
- package/es/layout/simple-header-layout.js +1 -1
- package/es/layout/tree-helper.js +1 -1
- package/es/plugins/chartModules.js +1 -1
- package/es/plugins/custom-cell-style.js +1 -1
- package/es/plugins/icons.js +1 -1
- package/es/plugins/invert-highlight.js +1 -1
- package/es/plugins/list-tree-stick-cell.js +1 -1
- package/es/plugins/themes.js +1 -1
- package/es/state/checkbox/checkbox.js +82 -52
- package/es/state/checkbox/checkbox.js.map +1 -1
- package/es/state/state.d.ts +1 -1
- package/es/state/state.js +4 -4
- package/es/state/state.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +5 -5
package/dist/vtable.js
CHANGED
|
@@ -50115,13 +50115,14 @@
|
|
|
50115
50115
|
function setCheckedState(col, row, field, checked, state) {
|
|
50116
50116
|
const recordIndex = state.table.getRecordShowIndexByCell(col, row);
|
|
50117
50117
|
if (recordIndex >= 0) {
|
|
50118
|
-
const dataIndex = state.table.dataSource.getIndexKey(recordIndex);
|
|
50119
|
-
if (state.checkedState
|
|
50120
|
-
state.checkedState
|
|
50118
|
+
const dataIndex = state.table.dataSource.getIndexKey(recordIndex).toString();
|
|
50119
|
+
if (state.checkedState.has(dataIndex)) {
|
|
50120
|
+
state.checkedState.get(dataIndex)[field] = checked;
|
|
50121
50121
|
}
|
|
50122
50122
|
else {
|
|
50123
|
-
state.checkedState
|
|
50124
|
-
|
|
50123
|
+
state.checkedState.set(dataIndex, {
|
|
50124
|
+
[field]: checked
|
|
50125
|
+
});
|
|
50125
50126
|
}
|
|
50126
50127
|
}
|
|
50127
50128
|
}
|
|
@@ -50142,7 +50143,7 @@
|
|
|
50142
50143
|
else if (isValid$1(checked)) {
|
|
50143
50144
|
state.headerCheckedState[field] = checked;
|
|
50144
50145
|
}
|
|
50145
|
-
else if (state.checkedState?.
|
|
50146
|
+
else if (state.checkedState?.size > 0) {
|
|
50146
50147
|
const isAllChecked = state.updateHeaderCheckedState(field, col, row);
|
|
50147
50148
|
return isAllChecked;
|
|
50148
50149
|
}
|
|
@@ -50150,22 +50151,23 @@
|
|
|
50150
50151
|
}
|
|
50151
50152
|
const recordIndex = state.table.getRecordShowIndexByCell(col, row);
|
|
50152
50153
|
if (recordIndex >= 0) {
|
|
50153
|
-
const dataIndex = state.table.dataSource.getIndexKey(recordIndex);
|
|
50154
|
-
if (isValid$1(state.checkedState
|
|
50155
|
-
return state.checkedState
|
|
50154
|
+
const dataIndex = state.table.dataSource.getIndexKey(recordIndex).toString();
|
|
50155
|
+
if (isValid$1(state.checkedState.get(dataIndex)?.[field])) {
|
|
50156
|
+
return state.checkedState.get(dataIndex)[field];
|
|
50156
50157
|
}
|
|
50157
|
-
if (state.checkedState
|
|
50158
|
-
state.checkedState
|
|
50158
|
+
if (state.checkedState.has(dataIndex)) {
|
|
50159
|
+
state.checkedState.get(dataIndex)[field] = checked;
|
|
50159
50160
|
}
|
|
50160
50161
|
else {
|
|
50161
|
-
state.checkedState
|
|
50162
|
-
|
|
50162
|
+
state.checkedState.set(dataIndex, {
|
|
50163
|
+
[field]: checked
|
|
50164
|
+
});
|
|
50163
50165
|
}
|
|
50164
50166
|
}
|
|
50165
50167
|
return checked;
|
|
50166
50168
|
}
|
|
50167
50169
|
function initCheckedState(records, state) {
|
|
50168
|
-
state.checkedState
|
|
50170
|
+
state.checkedState.clear();
|
|
50169
50171
|
state.headerCheckedState = {};
|
|
50170
50172
|
state.radioState = {};
|
|
50171
50173
|
let isNeedInitHeaderCheckedStateFromRecord = false;
|
|
@@ -50201,70 +50203,46 @@
|
|
|
50201
50203
|
isNeedInitHeaderCheckedStateFromRecord = true;
|
|
50202
50204
|
}
|
|
50203
50205
|
if (isNeedInitHeaderCheckedStateFromRecord) {
|
|
50204
|
-
|
|
50205
|
-
state._checkboxCellTypeFields.forEach(field => {
|
|
50206
|
-
const value = record[field];
|
|
50207
|
-
let isChecked;
|
|
50208
|
-
if (isObject$4(value)) {
|
|
50209
|
-
isChecked = value.checked;
|
|
50210
|
-
}
|
|
50211
|
-
else if (typeof value === 'boolean') {
|
|
50212
|
-
isChecked = value;
|
|
50213
|
-
}
|
|
50214
|
-
if (isChecked === undefined || isChecked === null) {
|
|
50215
|
-
const headerCheckFunc = state._headerCheckFuncs[field];
|
|
50216
|
-
if (headerCheckFunc) {
|
|
50217
|
-
const cellAddr = state.table.getCellAddrByFieldRecord(field, index);
|
|
50218
|
-
const globalChecked = getOrApply(headerCheckFunc, {
|
|
50219
|
-
col: cellAddr.col,
|
|
50220
|
-
row: cellAddr.row,
|
|
50221
|
-
table: state.table,
|
|
50222
|
-
context: null,
|
|
50223
|
-
value
|
|
50224
|
-
});
|
|
50225
|
-
isChecked = globalChecked;
|
|
50226
|
-
}
|
|
50227
|
-
}
|
|
50228
|
-
if (!state.checkedState[index]) {
|
|
50229
|
-
state.checkedState[index] = {};
|
|
50230
|
-
}
|
|
50231
|
-
state.checkedState[index][field] = isChecked;
|
|
50232
|
-
});
|
|
50233
|
-
});
|
|
50206
|
+
initRecordCheckState(state);
|
|
50234
50207
|
}
|
|
50235
50208
|
}
|
|
50236
50209
|
function updateHeaderCheckedState(field, state, col, row) {
|
|
50237
|
-
|
|
50210
|
+
let allChecked = true;
|
|
50211
|
+
let allUnChecked = true;
|
|
50212
|
+
let hasChecked = false;
|
|
50213
|
+
state.checkedState.forEach((check_state, index) => {
|
|
50214
|
+
if (index.includes(',')) {
|
|
50215
|
+
index = index.split(',').map(item => {
|
|
50216
|
+
return Number(item);
|
|
50217
|
+
});
|
|
50218
|
+
}
|
|
50219
|
+
else {
|
|
50220
|
+
index = Number(index);
|
|
50221
|
+
}
|
|
50238
50222
|
const tableIndex = state.table.getTableIndexByRecordIndex(index);
|
|
50239
50223
|
const mergeCell = state.table.transpose
|
|
50240
50224
|
? state.table.getCustomMerge(tableIndex, row)
|
|
50241
50225
|
: state.table.getCustomMerge(col, tableIndex);
|
|
50242
|
-
|
|
50243
|
-
|
|
50226
|
+
const data = state.table.dataSource.get(index);
|
|
50227
|
+
if (mergeCell || data.vtableMerge) {
|
|
50228
|
+
return;
|
|
50229
|
+
}
|
|
50230
|
+
if (check_state?.[field] !== true) {
|
|
50231
|
+
allChecked = false;
|
|
50232
|
+
}
|
|
50233
|
+
else {
|
|
50234
|
+
allUnChecked = false;
|
|
50235
|
+
hasChecked = true;
|
|
50244
50236
|
}
|
|
50245
|
-
return check_state?.[field] === true;
|
|
50246
50237
|
});
|
|
50247
50238
|
if (allChecked) {
|
|
50248
50239
|
state.headerCheckedState[field] = true;
|
|
50249
50240
|
return allChecked;
|
|
50250
50241
|
}
|
|
50251
|
-
const allUnChecked = state.checkedState.every((check_state, index) => {
|
|
50252
|
-
const tableIndex = state.table.getTableIndexByRecordIndex(index);
|
|
50253
|
-
const mergeCell = state.table.transpose
|
|
50254
|
-
? state.table.getCustomMerge(tableIndex, row)
|
|
50255
|
-
: state.table.getCustomMerge(col, tableIndex);
|
|
50256
|
-
if (mergeCell) {
|
|
50257
|
-
return true;
|
|
50258
|
-
}
|
|
50259
|
-
return check_state?.[field] === false;
|
|
50260
|
-
});
|
|
50261
50242
|
if (allUnChecked) {
|
|
50262
50243
|
state.headerCheckedState[field] = false;
|
|
50263
50244
|
return false;
|
|
50264
50245
|
}
|
|
50265
|
-
const hasChecked = state.checkedState.find((check_state) => {
|
|
50266
|
-
return check_state?.[field] === true;
|
|
50267
|
-
});
|
|
50268
50246
|
if (hasChecked) {
|
|
50269
50247
|
state.headerCheckedState[field] = 'indeterminate';
|
|
50270
50248
|
return 'indeterminate';
|
|
@@ -50272,7 +50250,7 @@
|
|
|
50272
50250
|
return false;
|
|
50273
50251
|
}
|
|
50274
50252
|
function initLeftRecordsCheckState(records, state) {
|
|
50275
|
-
for (let index = state.checkedState.
|
|
50253
|
+
for (let index = state.checkedState.size; index < records.length; index++) {
|
|
50276
50254
|
const record = records[index];
|
|
50277
50255
|
state._checkboxCellTypeFields.forEach(field => {
|
|
50278
50256
|
const value = record[field];
|
|
@@ -50283,10 +50261,11 @@
|
|
|
50283
50261
|
else if (typeof value === 'boolean') {
|
|
50284
50262
|
isChecked = value;
|
|
50285
50263
|
}
|
|
50286
|
-
|
|
50287
|
-
|
|
50264
|
+
const dataIndex = index.toString();
|
|
50265
|
+
if (!state.checkedState.get(dataIndex)) {
|
|
50266
|
+
state.checkedState.set(dataIndex, {});
|
|
50288
50267
|
}
|
|
50289
|
-
state.checkedState[
|
|
50268
|
+
state.checkedState.get(dataIndex)[field] = isChecked;
|
|
50290
50269
|
});
|
|
50291
50270
|
}
|
|
50292
50271
|
}
|
|
@@ -50339,27 +50318,57 @@
|
|
|
50339
50318
|
}
|
|
50340
50319
|
function changeCheckboxOrder(sourceIndex, targetIndex, state) {
|
|
50341
50320
|
const { checkedState, table } = state;
|
|
50321
|
+
let source;
|
|
50322
|
+
let target;
|
|
50342
50323
|
if (table.internalProps.transpose) {
|
|
50343
50324
|
sourceIndex = table.getRecordShowIndexByCell(sourceIndex, 0);
|
|
50344
50325
|
targetIndex = table.getRecordShowIndexByCell(targetIndex, 0);
|
|
50345
50326
|
}
|
|
50346
50327
|
else {
|
|
50347
|
-
|
|
50348
|
-
|
|
50328
|
+
source = table.getRecordIndexByCell(0, sourceIndex);
|
|
50329
|
+
target = table.getRecordIndexByCell(0, targetIndex);
|
|
50349
50330
|
}
|
|
50350
|
-
if (
|
|
50351
|
-
|
|
50352
|
-
|
|
50353
|
-
|
|
50331
|
+
if (isNumber$2(source) && isNumber$2(target)) {
|
|
50332
|
+
if (sourceIndex > targetIndex) {
|
|
50333
|
+
const sourceRecord = checkedState.get(sourceIndex.toString());
|
|
50334
|
+
for (let i = sourceIndex; i > targetIndex; i--) {
|
|
50335
|
+
checkedState.set(i.toString(), checkedState.get((i - 1).toString()));
|
|
50336
|
+
}
|
|
50337
|
+
checkedState.set(targetIndex.toString(), sourceRecord);
|
|
50338
|
+
}
|
|
50339
|
+
else if (sourceIndex < targetIndex) {
|
|
50340
|
+
const sourceRecord = checkedState.get(sourceIndex.toString());
|
|
50341
|
+
for (let i = sourceIndex; i < targetIndex; i++) {
|
|
50342
|
+
checkedState.set(i.toString(), checkedState.get((i + 1).toString()));
|
|
50343
|
+
}
|
|
50344
|
+
checkedState.set(targetIndex.toString(), sourceRecord);
|
|
50354
50345
|
}
|
|
50355
|
-
checkedState[targetIndex] = sourceRecord;
|
|
50356
50346
|
}
|
|
50357
|
-
else if (
|
|
50358
|
-
|
|
50359
|
-
|
|
50360
|
-
|
|
50347
|
+
else if (isArray$1(source) && isArray$1(target)) {
|
|
50348
|
+
sourceIndex = source[source.length - 1];
|
|
50349
|
+
targetIndex = target[target.length - 1];
|
|
50350
|
+
if (sourceIndex > targetIndex) {
|
|
50351
|
+
const sourceRecord = checkedState.get(source.toString());
|
|
50352
|
+
for (let i = sourceIndex; i > targetIndex; i--) {
|
|
50353
|
+
const now = [...source];
|
|
50354
|
+
now[now.length - 1] = i;
|
|
50355
|
+
const last = [...source];
|
|
50356
|
+
last[last.length - 1] = i - 1;
|
|
50357
|
+
checkedState.set(now.toString(), checkedState.get(last.toString()));
|
|
50358
|
+
}
|
|
50359
|
+
checkedState.set(target.toString(), sourceRecord);
|
|
50360
|
+
}
|
|
50361
|
+
else if (sourceIndex < targetIndex) {
|
|
50362
|
+
const sourceRecord = checkedState.get(source.toString());
|
|
50363
|
+
for (let i = sourceIndex; i < targetIndex; i++) {
|
|
50364
|
+
const now = [...source];
|
|
50365
|
+
now[now.length - 1] = i;
|
|
50366
|
+
const next = [...source];
|
|
50367
|
+
next[next.length - 1] = i + 1;
|
|
50368
|
+
checkedState.set(now.toString(), checkedState.get(next.toString()));
|
|
50369
|
+
}
|
|
50370
|
+
checkedState.set(target.toString(), sourceRecord);
|
|
50361
50371
|
}
|
|
50362
|
-
checkedState[targetIndex] = sourceRecord;
|
|
50363
50372
|
}
|
|
50364
50373
|
}
|
|
50365
50374
|
function getGroupCheckboxState(table) {
|
|
@@ -50369,11 +50378,48 @@
|
|
|
50369
50378
|
dataSource.currentIndexedData.forEach((indexArr, index) => {
|
|
50370
50379
|
if (isArray$1(indexArr) && indexArr.length === groupKeyLength) {
|
|
50371
50380
|
const { vtableOriginIndex } = dataSource.getRawRecord(indexArr);
|
|
50372
|
-
result[vtableOriginIndex] = table.stateManager.checkedState
|
|
50381
|
+
result[vtableOriginIndex] = table.stateManager.checkedState.get(indexArr.toString());
|
|
50373
50382
|
}
|
|
50374
50383
|
});
|
|
50375
50384
|
return result;
|
|
50376
50385
|
}
|
|
50386
|
+
function initRecordCheckState(state) {
|
|
50387
|
+
const table = state.table;
|
|
50388
|
+
const start = table.internalProps.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount;
|
|
50389
|
+
const end = table.internalProps.transpose ? table.colCount : table.rowCount;
|
|
50390
|
+
for (let index = 0; index + start < end; index++) {
|
|
50391
|
+
const record = table.dataSource.get(index);
|
|
50392
|
+
state._checkboxCellTypeFields.forEach(field => {
|
|
50393
|
+
const value = record[field];
|
|
50394
|
+
let isChecked;
|
|
50395
|
+
if (isObject$4(value)) {
|
|
50396
|
+
isChecked = value.checked;
|
|
50397
|
+
}
|
|
50398
|
+
else if (typeof value === 'boolean') {
|
|
50399
|
+
isChecked = value;
|
|
50400
|
+
}
|
|
50401
|
+
if (isChecked === undefined || isChecked === null) {
|
|
50402
|
+
const headerCheckFunc = state._headerCheckFuncs[field];
|
|
50403
|
+
if (headerCheckFunc) {
|
|
50404
|
+
const cellAddr = state.table.getCellAddrByFieldRecord(field, index);
|
|
50405
|
+
const globalChecked = getOrApply(headerCheckFunc, {
|
|
50406
|
+
col: cellAddr.col,
|
|
50407
|
+
row: cellAddr.row,
|
|
50408
|
+
table: state.table,
|
|
50409
|
+
context: null,
|
|
50410
|
+
value
|
|
50411
|
+
});
|
|
50412
|
+
isChecked = globalChecked;
|
|
50413
|
+
}
|
|
50414
|
+
}
|
|
50415
|
+
const dataIndex = state.table.dataSource.getIndexKey(index).toString();
|
|
50416
|
+
if (!state.checkedState.get(dataIndex)) {
|
|
50417
|
+
state.checkedState.set(dataIndex, {});
|
|
50418
|
+
}
|
|
50419
|
+
state.checkedState.get(dataIndex)[field] = isChecked;
|
|
50420
|
+
});
|
|
50421
|
+
}
|
|
50422
|
+
}
|
|
50377
50423
|
|
|
50378
50424
|
function updateResizeRow(xInTable, yInTable, state) {
|
|
50379
50425
|
xInTable = Math.ceil(xInTable);
|
|
@@ -50538,7 +50584,7 @@
|
|
|
50538
50584
|
_clearVerticalScrollBar;
|
|
50539
50585
|
_clearHorizontalScrollBar;
|
|
50540
50586
|
fastScrolling = false;
|
|
50541
|
-
checkedState =
|
|
50587
|
+
checkedState = new Map();
|
|
50542
50588
|
headerCheckedState = {};
|
|
50543
50589
|
_checkboxCellTypeFields = [];
|
|
50544
50590
|
_headerCheckFuncs = {};
|
|
@@ -51571,7 +51617,7 @@
|
|
|
51571
51617
|
return syncRadioState(col, row, field, radioType, indexInCell, isChecked, this);
|
|
51572
51618
|
}
|
|
51573
51619
|
changeCheckboxAndRadioOrder(sourceIndex, targetIndex) {
|
|
51574
|
-
if (this.checkedState.
|
|
51620
|
+
if (this.checkedState.size) {
|
|
51575
51621
|
changeCheckboxOrder(sourceIndex, targetIndex, this);
|
|
51576
51622
|
}
|
|
51577
51623
|
if (this.radioState.length) {
|
|
@@ -58365,7 +58411,7 @@
|
|
|
58365
58411
|
return TABLE_EVENT_TYPE;
|
|
58366
58412
|
}
|
|
58367
58413
|
options;
|
|
58368
|
-
version = "1.13.
|
|
58414
|
+
version = "1.13.3-alpha.0";
|
|
58369
58415
|
pagination;
|
|
58370
58416
|
id = `VTable${Date.now()}`;
|
|
58371
58417
|
headerStyleCache;
|
|
@@ -65017,27 +65063,27 @@
|
|
|
65017
65063
|
this.scenegraph.createSceneGraph();
|
|
65018
65064
|
}
|
|
65019
65065
|
getCheckboxState(field) {
|
|
65020
|
-
if (this.stateManager.checkedState.
|
|
65066
|
+
if (this.stateManager.checkedState.size < this.rowCount - this.columnHeaderLevelCount) {
|
|
65021
65067
|
this.stateManager.initLeftRecordsCheckState(this.records);
|
|
65022
65068
|
}
|
|
65023
65069
|
if (isValid$1(field)) {
|
|
65024
|
-
let stateArr = this.stateManager.checkedState;
|
|
65070
|
+
let stateArr = this.stateManager.checkedState.values();
|
|
65025
65071
|
if (this.options.groupBy) {
|
|
65026
65072
|
stateArr = getGroupCheckboxState(this);
|
|
65027
65073
|
}
|
|
65028
|
-
return stateArr.map(state => {
|
|
65074
|
+
return stateArr.map((state) => {
|
|
65029
65075
|
return state[field];
|
|
65030
65076
|
});
|
|
65031
65077
|
}
|
|
65032
|
-
return this.stateManager.checkedState;
|
|
65078
|
+
return new Array(...this.stateManager.checkedState.values());
|
|
65033
65079
|
}
|
|
65034
65080
|
getCellCheckboxState(col, row) {
|
|
65035
65081
|
const define = this.getBodyColumnDefine(col, row);
|
|
65036
65082
|
const field = define?.field;
|
|
65037
65083
|
const cellType = this.getCellType(col, row);
|
|
65038
65084
|
if (isValid$1(field) && cellType === 'checkbox') {
|
|
65039
|
-
const dataIndex = this.dataSource.getIndexKey(this.getRecordShowIndexByCell(col, row));
|
|
65040
|
-
return this.stateManager.checkedState
|
|
65085
|
+
const dataIndex = this.dataSource.getIndexKey(this.getRecordShowIndexByCell(col, row)).toString();
|
|
65086
|
+
return this.stateManager.checkedState.get(dataIndex)?.[field];
|
|
65041
65087
|
}
|
|
65042
65088
|
return undefined;
|
|
65043
65089
|
}
|
|
@@ -78839,7 +78885,7 @@
|
|
|
78839
78885
|
}
|
|
78840
78886
|
|
|
78841
78887
|
registerForVrender();
|
|
78842
|
-
const version = "1.13.
|
|
78888
|
+
const version = "1.13.3-alpha.0";
|
|
78843
78889
|
function getIcons() {
|
|
78844
78890
|
return get$2();
|
|
78845
78891
|
}
|