@visactor/vtable 1.13.1-alpha.6 → 1.13.2-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/event/listener/container-dom.js +33 -3
- package/cjs/event/listener/container-dom.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/state/checkbox/checkbox.js +31 -56
- 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 +64 -102
- 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/event/listener/container-dom.js +33 -3
- package/es/event/listener/container-dom.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/state/checkbox/checkbox.js +32 -56
- 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 +2 -2
package/dist/vtable.js
CHANGED
|
@@ -50094,14 +50094,13 @@
|
|
|
50094
50094
|
function setCheckedState(col, row, field, checked, state) {
|
|
50095
50095
|
const recordIndex = state.table.getRecordShowIndexByCell(col, row);
|
|
50096
50096
|
if (recordIndex >= 0) {
|
|
50097
|
-
const dataIndex = state.table.dataSource.getIndexKey(recordIndex)
|
|
50098
|
-
if (state.checkedState
|
|
50099
|
-
state.checkedState
|
|
50097
|
+
const dataIndex = state.table.dataSource.getIndexKey(recordIndex);
|
|
50098
|
+
if (state.checkedState[dataIndex]) {
|
|
50099
|
+
state.checkedState[dataIndex][field] = checked;
|
|
50100
50100
|
}
|
|
50101
50101
|
else {
|
|
50102
|
-
state.checkedState
|
|
50103
|
-
|
|
50104
|
-
});
|
|
50102
|
+
state.checkedState[dataIndex] = {};
|
|
50103
|
+
state.checkedState[dataIndex][field] = checked;
|
|
50105
50104
|
}
|
|
50106
50105
|
}
|
|
50107
50106
|
}
|
|
@@ -50122,7 +50121,7 @@
|
|
|
50122
50121
|
else if (isValid$1(checked)) {
|
|
50123
50122
|
state.headerCheckedState[field] = checked;
|
|
50124
50123
|
}
|
|
50125
|
-
else if (state.checkedState?.
|
|
50124
|
+
else if (state.checkedState?.length > 0) {
|
|
50126
50125
|
const isAllChecked = state.updateHeaderCheckedState(field, col, row);
|
|
50127
50126
|
return isAllChecked;
|
|
50128
50127
|
}
|
|
@@ -50130,23 +50129,22 @@
|
|
|
50130
50129
|
}
|
|
50131
50130
|
const recordIndex = state.table.getRecordShowIndexByCell(col, row);
|
|
50132
50131
|
if (recordIndex >= 0) {
|
|
50133
|
-
const dataIndex = state.table.dataSource.getIndexKey(recordIndex)
|
|
50134
|
-
if (isValid$1(state.checkedState
|
|
50135
|
-
return state.checkedState
|
|
50132
|
+
const dataIndex = state.table.dataSource.getIndexKey(recordIndex);
|
|
50133
|
+
if (isValid$1(state.checkedState[dataIndex]?.[field])) {
|
|
50134
|
+
return state.checkedState[dataIndex][field];
|
|
50136
50135
|
}
|
|
50137
|
-
if (state.checkedState
|
|
50138
|
-
state.checkedState
|
|
50136
|
+
if (state.checkedState[dataIndex]) {
|
|
50137
|
+
state.checkedState[dataIndex][field] = checked;
|
|
50139
50138
|
}
|
|
50140
50139
|
else {
|
|
50141
|
-
state.checkedState
|
|
50142
|
-
|
|
50143
|
-
});
|
|
50140
|
+
state.checkedState[dataIndex] = {};
|
|
50141
|
+
state.checkedState[dataIndex][field] = checked;
|
|
50144
50142
|
}
|
|
50145
50143
|
}
|
|
50146
50144
|
return checked;
|
|
50147
50145
|
}
|
|
50148
50146
|
function initCheckedState(records, state) {
|
|
50149
|
-
state.checkedState
|
|
50147
|
+
state.checkedState = [];
|
|
50150
50148
|
state.headerCheckedState = {};
|
|
50151
50149
|
state.radioState = {};
|
|
50152
50150
|
let isNeedInitHeaderCheckedStateFromRecord = false;
|
|
@@ -50206,52 +50204,46 @@
|
|
|
50206
50204
|
isChecked = globalChecked;
|
|
50207
50205
|
}
|
|
50208
50206
|
}
|
|
50209
|
-
|
|
50210
|
-
|
|
50211
|
-
state.checkedState.set(dataIndex, {});
|
|
50207
|
+
if (!state.checkedState[index]) {
|
|
50208
|
+
state.checkedState[index] = {};
|
|
50212
50209
|
}
|
|
50213
|
-
state.checkedState
|
|
50210
|
+
state.checkedState[index][field] = isChecked;
|
|
50214
50211
|
});
|
|
50215
50212
|
});
|
|
50216
50213
|
}
|
|
50217
50214
|
}
|
|
50218
50215
|
function updateHeaderCheckedState(field, state, col, row) {
|
|
50219
|
-
|
|
50220
|
-
let allUnChecked = true;
|
|
50221
|
-
let hasChecked = false;
|
|
50222
|
-
state.checkedState.forEach((check_state, index) => {
|
|
50223
|
-
if (index.includes(',')) {
|
|
50224
|
-
index = index.split(',').map(item => {
|
|
50225
|
-
return Number(item);
|
|
50226
|
-
});
|
|
50227
|
-
}
|
|
50228
|
-
else {
|
|
50229
|
-
index = Number(index);
|
|
50230
|
-
}
|
|
50216
|
+
const allChecked = state.checkedState.every((check_state, index) => {
|
|
50231
50217
|
const tableIndex = state.table.getTableIndexByRecordIndex(index);
|
|
50232
50218
|
const mergeCell = state.table.transpose
|
|
50233
50219
|
? state.table.getCustomMerge(tableIndex, row)
|
|
50234
50220
|
: state.table.getCustomMerge(col, tableIndex);
|
|
50235
|
-
|
|
50236
|
-
|
|
50237
|
-
return;
|
|
50238
|
-
}
|
|
50239
|
-
if (check_state?.[field] !== true) {
|
|
50240
|
-
allChecked = false;
|
|
50241
|
-
}
|
|
50242
|
-
else {
|
|
50243
|
-
allUnChecked = false;
|
|
50244
|
-
hasChecked = true;
|
|
50221
|
+
if (mergeCell) {
|
|
50222
|
+
return true;
|
|
50245
50223
|
}
|
|
50224
|
+
return check_state?.[field] === true;
|
|
50246
50225
|
});
|
|
50247
50226
|
if (allChecked) {
|
|
50248
50227
|
state.headerCheckedState[field] = true;
|
|
50249
50228
|
return allChecked;
|
|
50250
50229
|
}
|
|
50230
|
+
const allUnChecked = state.checkedState.every((check_state, index) => {
|
|
50231
|
+
const tableIndex = state.table.getTableIndexByRecordIndex(index);
|
|
50232
|
+
const mergeCell = state.table.transpose
|
|
50233
|
+
? state.table.getCustomMerge(tableIndex, row)
|
|
50234
|
+
: state.table.getCustomMerge(col, tableIndex);
|
|
50235
|
+
if (mergeCell) {
|
|
50236
|
+
return true;
|
|
50237
|
+
}
|
|
50238
|
+
return check_state?.[field] === false;
|
|
50239
|
+
});
|
|
50251
50240
|
if (allUnChecked) {
|
|
50252
50241
|
state.headerCheckedState[field] = false;
|
|
50253
50242
|
return false;
|
|
50254
50243
|
}
|
|
50244
|
+
const hasChecked = state.checkedState.find((check_state) => {
|
|
50245
|
+
return check_state?.[field] === true;
|
|
50246
|
+
});
|
|
50255
50247
|
if (hasChecked) {
|
|
50256
50248
|
state.headerCheckedState[field] = 'indeterminate';
|
|
50257
50249
|
return 'indeterminate';
|
|
@@ -50259,7 +50251,7 @@
|
|
|
50259
50251
|
return false;
|
|
50260
50252
|
}
|
|
50261
50253
|
function initLeftRecordsCheckState(records, state) {
|
|
50262
|
-
for (let index = state.checkedState.
|
|
50254
|
+
for (let index = state.checkedState.length; index < records.length; index++) {
|
|
50263
50255
|
const record = records[index];
|
|
50264
50256
|
state._checkboxCellTypeFields.forEach(field => {
|
|
50265
50257
|
const value = record[field];
|
|
@@ -50270,11 +50262,10 @@
|
|
|
50270
50262
|
else if (typeof value === 'boolean') {
|
|
50271
50263
|
isChecked = value;
|
|
50272
50264
|
}
|
|
50273
|
-
|
|
50274
|
-
|
|
50275
|
-
state.checkedState.set(dataIndex, {});
|
|
50265
|
+
if (!state.checkedState[index]) {
|
|
50266
|
+
state.checkedState[index] = {};
|
|
50276
50267
|
}
|
|
50277
|
-
state.checkedState
|
|
50268
|
+
state.checkedState[index][field] = isChecked;
|
|
50278
50269
|
});
|
|
50279
50270
|
}
|
|
50280
50271
|
}
|
|
@@ -50327,57 +50318,27 @@
|
|
|
50327
50318
|
}
|
|
50328
50319
|
function changeCheckboxOrder(sourceIndex, targetIndex, state) {
|
|
50329
50320
|
const { checkedState, table } = state;
|
|
50330
|
-
let source;
|
|
50331
|
-
let target;
|
|
50332
50321
|
if (table.internalProps.transpose) {
|
|
50333
50322
|
sourceIndex = table.getRecordShowIndexByCell(sourceIndex, 0);
|
|
50334
50323
|
targetIndex = table.getRecordShowIndexByCell(targetIndex, 0);
|
|
50335
50324
|
}
|
|
50336
50325
|
else {
|
|
50337
|
-
|
|
50338
|
-
|
|
50326
|
+
sourceIndex = table.getRecordShowIndexByCell(0, sourceIndex);
|
|
50327
|
+
targetIndex = table.getRecordShowIndexByCell(0, targetIndex);
|
|
50339
50328
|
}
|
|
50340
|
-
if (
|
|
50341
|
-
|
|
50342
|
-
|
|
50343
|
-
|
|
50344
|
-
checkedState.set(i.toString(), checkedState.get((i - 1).toString()));
|
|
50345
|
-
}
|
|
50346
|
-
checkedState.set(targetIndex.toString(), sourceRecord);
|
|
50347
|
-
}
|
|
50348
|
-
else if (sourceIndex < targetIndex) {
|
|
50349
|
-
const sourceRecord = checkedState.get(sourceIndex.toString());
|
|
50350
|
-
for (let i = sourceIndex; i < targetIndex; i++) {
|
|
50351
|
-
checkedState.set(i.toString(), checkedState.get((i + 1).toString()));
|
|
50352
|
-
}
|
|
50353
|
-
checkedState.set(targetIndex.toString(), sourceRecord);
|
|
50329
|
+
if (sourceIndex > targetIndex) {
|
|
50330
|
+
const sourceRecord = checkedState[sourceIndex];
|
|
50331
|
+
for (let i = sourceIndex; i > targetIndex; i--) {
|
|
50332
|
+
checkedState[i] = checkedState[i - 1];
|
|
50354
50333
|
}
|
|
50334
|
+
checkedState[targetIndex] = sourceRecord;
|
|
50355
50335
|
}
|
|
50356
|
-
else if (
|
|
50357
|
-
|
|
50358
|
-
|
|
50359
|
-
|
|
50360
|
-
const sourceRecord = checkedState.get(source.toString());
|
|
50361
|
-
for (let i = sourceIndex; i > targetIndex; i--) {
|
|
50362
|
-
const now = [...source];
|
|
50363
|
-
now[now.length - 1] = i;
|
|
50364
|
-
const last = [...source];
|
|
50365
|
-
last[last.length - 1] = i - 1;
|
|
50366
|
-
checkedState.set(now.toString(), checkedState.get(last.toString()));
|
|
50367
|
-
}
|
|
50368
|
-
checkedState.set(target.toString(), sourceRecord);
|
|
50369
|
-
}
|
|
50370
|
-
else if (sourceIndex < targetIndex) {
|
|
50371
|
-
const sourceRecord = checkedState.get(source.toString());
|
|
50372
|
-
for (let i = sourceIndex; i < targetIndex; i++) {
|
|
50373
|
-
const now = [...source];
|
|
50374
|
-
now[now.length - 1] = i;
|
|
50375
|
-
const next = [...source];
|
|
50376
|
-
next[next.length - 1] = i + 1;
|
|
50377
|
-
checkedState.set(now.toString(), checkedState.get(next.toString()));
|
|
50378
|
-
}
|
|
50379
|
-
checkedState.set(target.toString(), sourceRecord);
|
|
50336
|
+
else if (sourceIndex < targetIndex) {
|
|
50337
|
+
const sourceRecord = checkedState[sourceIndex];
|
|
50338
|
+
for (let i = sourceIndex; i < targetIndex; i++) {
|
|
50339
|
+
checkedState[i] = checkedState[i + 1];
|
|
50380
50340
|
}
|
|
50341
|
+
checkedState[targetIndex] = sourceRecord;
|
|
50381
50342
|
}
|
|
50382
50343
|
}
|
|
50383
50344
|
function getGroupCheckboxState(table) {
|
|
@@ -50387,7 +50348,7 @@
|
|
|
50387
50348
|
dataSource.currentIndexedData.forEach((indexArr, index) => {
|
|
50388
50349
|
if (isArray$1(indexArr) && indexArr.length === groupKeyLength) {
|
|
50389
50350
|
const { vtableOriginIndex } = dataSource.getRawRecord(indexArr);
|
|
50390
|
-
result[vtableOriginIndex] = table.stateManager.checkedState
|
|
50351
|
+
result[vtableOriginIndex] = table.stateManager.checkedState[indexArr];
|
|
50391
50352
|
}
|
|
50392
50353
|
});
|
|
50393
50354
|
return result;
|
|
@@ -50556,7 +50517,7 @@
|
|
|
50556
50517
|
_clearVerticalScrollBar;
|
|
50557
50518
|
_clearHorizontalScrollBar;
|
|
50558
50519
|
fastScrolling = false;
|
|
50559
|
-
checkedState =
|
|
50520
|
+
checkedState = [];
|
|
50560
50521
|
headerCheckedState = {};
|
|
50561
50522
|
_checkboxCellTypeFields = [];
|
|
50562
50523
|
_headerCheckFuncs = {};
|
|
@@ -51592,7 +51553,7 @@
|
|
|
51592
51553
|
return syncRadioState(col, row, field, radioType, indexInCell, isChecked, this);
|
|
51593
51554
|
}
|
|
51594
51555
|
changeCheckboxAndRadioOrder(sourceIndex, targetIndex) {
|
|
51595
|
-
if (this.checkedState.
|
|
51556
|
+
if (this.checkedState.length) {
|
|
51596
51557
|
changeCheckboxOrder(sourceIndex, targetIndex, this);
|
|
51597
51558
|
}
|
|
51598
51559
|
if (this.radioState.length) {
|
|
@@ -53073,12 +53034,13 @@
|
|
|
53073
53034
|
table.fireListeners(TABLE_EVENT_TYPE.KEYDOWN, cellsEvent);
|
|
53074
53035
|
}
|
|
53075
53036
|
}
|
|
53076
|
-
handler.on(table.getElement(), 'copy', (e) => {
|
|
53037
|
+
handler.on(table.getElement(), 'copy', async (e) => {
|
|
53077
53038
|
if (table.keyboardOptions?.copySelected) {
|
|
53078
53039
|
const data = table.getCopyValue();
|
|
53079
53040
|
if (isValid$1(data)) {
|
|
53080
53041
|
e.preventDefault();
|
|
53081
|
-
|
|
53042
|
+
const permissionState = await navigator.permissions.query({ name: 'clipboard-write' });
|
|
53043
|
+
if (navigator.clipboard?.write && permissionState.state === 'granted') {
|
|
53082
53044
|
const setDataToHTML = (data) => {
|
|
53083
53045
|
const result = ['<table>'];
|
|
53084
53046
|
const META_HEAD = [
|
|
@@ -58379,7 +58341,7 @@
|
|
|
58379
58341
|
return TABLE_EVENT_TYPE;
|
|
58380
58342
|
}
|
|
58381
58343
|
options;
|
|
58382
|
-
version = "1.13.
|
|
58344
|
+
version = "1.13.2-alpha.0";
|
|
58383
58345
|
pagination;
|
|
58384
58346
|
id = `VTable${Date.now()}`;
|
|
58385
58347
|
headerStyleCache;
|
|
@@ -65031,27 +64993,27 @@
|
|
|
65031
64993
|
this.scenegraph.createSceneGraph();
|
|
65032
64994
|
}
|
|
65033
64995
|
getCheckboxState(field) {
|
|
65034
|
-
if (this.stateManager.checkedState.
|
|
64996
|
+
if (this.stateManager.checkedState.length < this.rowCount - this.columnHeaderLevelCount) {
|
|
65035
64997
|
this.stateManager.initLeftRecordsCheckState(this.records);
|
|
65036
64998
|
}
|
|
65037
64999
|
if (isValid$1(field)) {
|
|
65038
|
-
let stateArr = this.stateManager.checkedState
|
|
65000
|
+
let stateArr = this.stateManager.checkedState;
|
|
65039
65001
|
if (this.options.groupBy) {
|
|
65040
65002
|
stateArr = getGroupCheckboxState(this);
|
|
65041
65003
|
}
|
|
65042
|
-
return stateArr.map(
|
|
65004
|
+
return stateArr.map(state => {
|
|
65043
65005
|
return state[field];
|
|
65044
65006
|
});
|
|
65045
65007
|
}
|
|
65046
|
-
return
|
|
65008
|
+
return this.stateManager.checkedState;
|
|
65047
65009
|
}
|
|
65048
65010
|
getCellCheckboxState(col, row) {
|
|
65049
65011
|
const define = this.getBodyColumnDefine(col, row);
|
|
65050
65012
|
const field = define?.field;
|
|
65051
65013
|
const cellType = this.getCellType(col, row);
|
|
65052
65014
|
if (isValid$1(field) && cellType === 'checkbox') {
|
|
65053
|
-
const dataIndex = this.dataSource.getIndexKey(this.getRecordShowIndexByCell(col, row))
|
|
65054
|
-
return this.stateManager.checkedState
|
|
65015
|
+
const dataIndex = this.dataSource.getIndexKey(this.getRecordShowIndexByCell(col, row));
|
|
65016
|
+
return this.stateManager.checkedState[dataIndex]?.[field];
|
|
65055
65017
|
}
|
|
65056
65018
|
return undefined;
|
|
65057
65019
|
}
|
|
@@ -78853,7 +78815,7 @@
|
|
|
78853
78815
|
}
|
|
78854
78816
|
|
|
78855
78817
|
registerForVrender();
|
|
78856
|
-
const version = "1.13.
|
|
78818
|
+
const version = "1.13.2-alpha.0";
|
|
78857
78819
|
function getIcons() {
|
|
78858
78820
|
return get$2();
|
|
78859
78821
|
}
|