@visactor/vtable 1.13.3-alpha.0 → 1.13.3-alpha.10

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.
Files changed (75) hide show
  1. package/cjs/ListTable.d.ts +1 -1
  2. package/cjs/ListTable.js +5 -5
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/body-helper/style/CheckboxStyle.d.ts +14 -1
  5. package/cjs/body-helper/style/CheckboxStyle.js.map +1 -1
  6. package/cjs/body-helper/style/RadioStyle.d.ts +8 -1
  7. package/cjs/body-helper/style/RadioStyle.js.map +1 -1
  8. package/cjs/core/BaseTable.js +1 -1
  9. package/cjs/core/BaseTable.js.map +1 -1
  10. package/cjs/core/utils/get-cell-position.js +4 -3
  11. package/cjs/core/utils/get-cell-position.js.map +1 -1
  12. package/cjs/dataset/dataset-pivot-table.js +1 -2
  13. package/cjs/edit/editors.js +2 -1
  14. package/cjs/icons.js +0 -18
  15. package/cjs/icons.js.map +1 -1
  16. package/cjs/index.d.ts +1 -1
  17. package/cjs/index.js +1 -1
  18. package/cjs/index.js.map +1 -1
  19. package/cjs/layout/layout-helper.js +1 -1
  20. package/cjs/layout/pivot-header-layout.js +1 -1
  21. package/cjs/layout/pivot-layout.js +0 -2
  22. package/cjs/layout/row-height-map.js +1 -1
  23. package/cjs/layout/simple-header-layout.js +1 -1
  24. package/cjs/layout/tree-helper.js +2 -2
  25. package/cjs/plugins/chartModules.js +1 -1
  26. package/cjs/plugins/custom-cell-style.js +1 -1
  27. package/cjs/plugins/icons.js +1 -1
  28. package/cjs/plugins/invert-highlight.js +1 -1
  29. package/cjs/plugins/list-tree-stick-cell.js +1 -1
  30. package/cjs/plugins/themes.js +1 -1
  31. package/cjs/state/checkbox/checkbox.js +51 -82
  32. package/cjs/state/checkbox/checkbox.js.map +1 -1
  33. package/cjs/state/state.d.ts +1 -1
  34. package/cjs/state/state.js +4 -4
  35. package/cjs/state/state.js.map +1 -1
  36. package/cjs/vrender.js.map +1 -1
  37. package/dist/vtable.js +91 -154
  38. package/dist/vtable.min.js +2 -2
  39. package/es/ListTable.d.ts +1 -1
  40. package/es/ListTable.js +5 -5
  41. package/es/ListTable.js.map +1 -1
  42. package/es/body-helper/style/CheckboxStyle.d.ts +14 -1
  43. package/es/body-helper/style/CheckboxStyle.js.map +1 -1
  44. package/es/body-helper/style/RadioStyle.d.ts +8 -1
  45. package/es/body-helper/style/RadioStyle.js.map +1 -1
  46. package/es/core/BaseTable.js +1 -1
  47. package/es/core/BaseTable.js.map +1 -1
  48. package/es/core/utils/get-cell-position.js +4 -3
  49. package/es/core/utils/get-cell-position.js.map +1 -1
  50. package/es/dataset/dataset-pivot-table.js +1 -2
  51. package/es/edit/editors.js +2 -1
  52. package/es/icons.js +0 -18
  53. package/es/icons.js.map +1 -1
  54. package/es/index.d.ts +1 -1
  55. package/es/index.js +1 -1
  56. package/es/index.js.map +1 -1
  57. package/es/layout/layout-helper.js +1 -1
  58. package/es/layout/pivot-header-layout.js +1 -1
  59. package/es/layout/pivot-layout.js +0 -2
  60. package/es/layout/row-height-map.js +1 -1
  61. package/es/layout/simple-header-layout.js +1 -1
  62. package/es/layout/tree-helper.js +1 -1
  63. package/es/plugins/chartModules.js +1 -1
  64. package/es/plugins/custom-cell-style.js +1 -1
  65. package/es/plugins/icons.js +1 -1
  66. package/es/plugins/invert-highlight.js +1 -1
  67. package/es/plugins/list-tree-stick-cell.js +1 -1
  68. package/es/plugins/themes.js +1 -1
  69. package/es/state/checkbox/checkbox.js +52 -82
  70. package/es/state/checkbox/checkbox.js.map +1 -1
  71. package/es/state/state.d.ts +1 -1
  72. package/es/state/state.js +4 -4
  73. package/es/state/state.js.map +1 -1
  74. package/es/vrender.js.map +1 -1
  75. package/package.json +2 -2
package/dist/vtable.js CHANGED
@@ -35035,24 +35035,6 @@
35035
35035
  cursor: 'pointer'
35036
35036
  };
35037
35037
  },
35038
- get loading() {
35039
- return {
35040
- type: 'image',
35041
- src: 'https://lf9-dp-fe-cms-tos.' + 'byt' + 'eorg.com/obj/bit-cloud/VTable/media/loading-circle.gif',
35042
- width: collapse_size,
35043
- height: collapse_size,
35044
- name: 'loading',
35045
- positionType: IconPosition.contentLeft,
35046
- marginLeft: 0,
35047
- marginRight: 4,
35048
- hover: {
35049
- width: collapse_size_2,
35050
- height: collapse_size_2,
35051
- bgColor: 'rgba(101, 117, 168, 0.1)'
35052
- },
35053
- isGif: true
35054
- };
35055
- },
35056
35038
  get drillDown() {
35057
35039
  return {
35058
35040
  name: 'drillDown',
@@ -50115,14 +50097,13 @@
50115
50097
  function setCheckedState(col, row, field, checked, state) {
50116
50098
  const recordIndex = state.table.getRecordShowIndexByCell(col, row);
50117
50099
  if (recordIndex >= 0) {
50118
- const dataIndex = state.table.dataSource.getIndexKey(recordIndex).toString();
50119
- if (state.checkedState.has(dataIndex)) {
50120
- state.checkedState.get(dataIndex)[field] = checked;
50100
+ const dataIndex = state.table.dataSource.getIndexKey(recordIndex);
50101
+ if (state.checkedState[dataIndex]) {
50102
+ state.checkedState[dataIndex][field] = checked;
50121
50103
  }
50122
50104
  else {
50123
- state.checkedState.set(dataIndex, {
50124
- [field]: checked
50125
- });
50105
+ state.checkedState[dataIndex] = {};
50106
+ state.checkedState[dataIndex][field] = checked;
50126
50107
  }
50127
50108
  }
50128
50109
  }
@@ -50143,7 +50124,7 @@
50143
50124
  else if (isValid$1(checked)) {
50144
50125
  state.headerCheckedState[field] = checked;
50145
50126
  }
50146
- else if (state.checkedState?.size > 0) {
50127
+ else if (state.checkedState?.length > 0) {
50147
50128
  const isAllChecked = state.updateHeaderCheckedState(field, col, row);
50148
50129
  return isAllChecked;
50149
50130
  }
@@ -50151,23 +50132,22 @@
50151
50132
  }
50152
50133
  const recordIndex = state.table.getRecordShowIndexByCell(col, row);
50153
50134
  if (recordIndex >= 0) {
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];
50135
+ const dataIndex = state.table.dataSource.getIndexKey(recordIndex);
50136
+ if (isValid$1(state.checkedState[dataIndex]?.[field])) {
50137
+ return state.checkedState[dataIndex][field];
50157
50138
  }
50158
- if (state.checkedState.has(dataIndex)) {
50159
- state.checkedState.get(dataIndex)[field] = checked;
50139
+ if (state.checkedState[dataIndex]) {
50140
+ state.checkedState[dataIndex][field] = checked;
50160
50141
  }
50161
50142
  else {
50162
- state.checkedState.set(dataIndex, {
50163
- [field]: checked
50164
- });
50143
+ state.checkedState[dataIndex] = {};
50144
+ state.checkedState[dataIndex][field] = checked;
50165
50145
  }
50166
50146
  }
50167
50147
  return checked;
50168
50148
  }
50169
50149
  function initCheckedState(records, state) {
50170
- state.checkedState.clear();
50150
+ state.checkedState = [];
50171
50151
  state.headerCheckedState = {};
50172
50152
  state.radioState = {};
50173
50153
  let isNeedInitHeaderCheckedStateFromRecord = false;
@@ -50203,46 +50183,70 @@
50203
50183
  isNeedInitHeaderCheckedStateFromRecord = true;
50204
50184
  }
50205
50185
  if (isNeedInitHeaderCheckedStateFromRecord) {
50206
- initRecordCheckState(state);
50186
+ records?.forEach((record, index) => {
50187
+ state._checkboxCellTypeFields.forEach(field => {
50188
+ const value = record[field];
50189
+ let isChecked;
50190
+ if (isObject$4(value)) {
50191
+ isChecked = value.checked;
50192
+ }
50193
+ else if (typeof value === 'boolean') {
50194
+ isChecked = value;
50195
+ }
50196
+ if (isChecked === undefined || isChecked === null) {
50197
+ const headerCheckFunc = state._headerCheckFuncs[field];
50198
+ if (headerCheckFunc) {
50199
+ const cellAddr = state.table.getCellAddrByFieldRecord(field, index);
50200
+ const globalChecked = getOrApply(headerCheckFunc, {
50201
+ col: cellAddr.col,
50202
+ row: cellAddr.row,
50203
+ table: state.table,
50204
+ context: null,
50205
+ value
50206
+ });
50207
+ isChecked = globalChecked;
50208
+ }
50209
+ }
50210
+ if (!state.checkedState[index]) {
50211
+ state.checkedState[index] = {};
50212
+ }
50213
+ state.checkedState[index][field] = isChecked;
50214
+ });
50215
+ });
50207
50216
  }
50208
50217
  }
50209
50218
  function updateHeaderCheckedState(field, state, col, row) {
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
- }
50219
+ const allChecked = state.checkedState.every((check_state, index) => {
50222
50220
  const tableIndex = state.table.getTableIndexByRecordIndex(index);
50223
50221
  const mergeCell = state.table.transpose
50224
50222
  ? state.table.getCustomMerge(tableIndex, row)
50225
50223
  : state.table.getCustomMerge(col, tableIndex);
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;
50224
+ if (mergeCell) {
50225
+ return true;
50236
50226
  }
50227
+ return check_state?.[field] === true;
50237
50228
  });
50238
50229
  if (allChecked) {
50239
50230
  state.headerCheckedState[field] = true;
50240
50231
  return allChecked;
50241
50232
  }
50233
+ const allUnChecked = state.checkedState.every((check_state, index) => {
50234
+ const tableIndex = state.table.getTableIndexByRecordIndex(index);
50235
+ const mergeCell = state.table.transpose
50236
+ ? state.table.getCustomMerge(tableIndex, row)
50237
+ : state.table.getCustomMerge(col, tableIndex);
50238
+ if (mergeCell) {
50239
+ return true;
50240
+ }
50241
+ return check_state?.[field] === false;
50242
+ });
50242
50243
  if (allUnChecked) {
50243
50244
  state.headerCheckedState[field] = false;
50244
50245
  return false;
50245
50246
  }
50247
+ const hasChecked = state.checkedState.find((check_state) => {
50248
+ return check_state?.[field] === true;
50249
+ });
50246
50250
  if (hasChecked) {
50247
50251
  state.headerCheckedState[field] = 'indeterminate';
50248
50252
  return 'indeterminate';
@@ -50250,7 +50254,7 @@
50250
50254
  return false;
50251
50255
  }
50252
50256
  function initLeftRecordsCheckState(records, state) {
50253
- for (let index = state.checkedState.size; index < records.length; index++) {
50257
+ for (let index = state.checkedState.length; index < records.length; index++) {
50254
50258
  const record = records[index];
50255
50259
  state._checkboxCellTypeFields.forEach(field => {
50256
50260
  const value = record[field];
@@ -50261,11 +50265,10 @@
50261
50265
  else if (typeof value === 'boolean') {
50262
50266
  isChecked = value;
50263
50267
  }
50264
- const dataIndex = index.toString();
50265
- if (!state.checkedState.get(dataIndex)) {
50266
- state.checkedState.set(dataIndex, {});
50268
+ if (!state.checkedState[index]) {
50269
+ state.checkedState[index] = {};
50267
50270
  }
50268
- state.checkedState.get(dataIndex)[field] = isChecked;
50271
+ state.checkedState[index][field] = isChecked;
50269
50272
  });
50270
50273
  }
50271
50274
  }
@@ -50318,57 +50321,27 @@
50318
50321
  }
50319
50322
  function changeCheckboxOrder(sourceIndex, targetIndex, state) {
50320
50323
  const { checkedState, table } = state;
50321
- let source;
50322
- let target;
50323
50324
  if (table.internalProps.transpose) {
50324
50325
  sourceIndex = table.getRecordShowIndexByCell(sourceIndex, 0);
50325
50326
  targetIndex = table.getRecordShowIndexByCell(targetIndex, 0);
50326
50327
  }
50327
50328
  else {
50328
- source = table.getRecordIndexByCell(0, sourceIndex);
50329
- target = table.getRecordIndexByCell(0, targetIndex);
50329
+ sourceIndex = table.getRecordShowIndexByCell(0, sourceIndex);
50330
+ targetIndex = table.getRecordShowIndexByCell(0, targetIndex);
50330
50331
  }
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);
50332
+ if (sourceIndex > targetIndex) {
50333
+ const sourceRecord = checkedState[sourceIndex];
50334
+ for (let i = sourceIndex; i > targetIndex; i--) {
50335
+ checkedState[i] = checkedState[i - 1];
50345
50336
  }
50337
+ checkedState[targetIndex] = sourceRecord;
50346
50338
  }
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);
50339
+ else if (sourceIndex < targetIndex) {
50340
+ const sourceRecord = checkedState[sourceIndex];
50341
+ for (let i = sourceIndex; i < targetIndex; i++) {
50342
+ checkedState[i] = checkedState[i + 1];
50371
50343
  }
50344
+ checkedState[targetIndex] = sourceRecord;
50372
50345
  }
50373
50346
  }
50374
50347
  function getGroupCheckboxState(table) {
@@ -50378,48 +50351,11 @@
50378
50351
  dataSource.currentIndexedData.forEach((indexArr, index) => {
50379
50352
  if (isArray$1(indexArr) && indexArr.length === groupKeyLength) {
50380
50353
  const { vtableOriginIndex } = dataSource.getRawRecord(indexArr);
50381
- result[vtableOriginIndex] = table.stateManager.checkedState.get(indexArr.toString());
50354
+ result[vtableOriginIndex] = table.stateManager.checkedState[indexArr];
50382
50355
  }
50383
50356
  });
50384
50357
  return result;
50385
50358
  }
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
- }
50423
50359
 
50424
50360
  function updateResizeRow(xInTable, yInTable, state) {
50425
50361
  xInTable = Math.ceil(xInTable);
@@ -50584,7 +50520,7 @@
50584
50520
  _clearVerticalScrollBar;
50585
50521
  _clearHorizontalScrollBar;
50586
50522
  fastScrolling = false;
50587
- checkedState = new Map();
50523
+ checkedState = [];
50588
50524
  headerCheckedState = {};
50589
50525
  _checkboxCellTypeFields = [];
50590
50526
  _headerCheckFuncs = {};
@@ -51617,7 +51553,7 @@
51617
51553
  return syncRadioState(col, row, field, radioType, indexInCell, isChecked, this);
51618
51554
  }
51619
51555
  changeCheckboxAndRadioOrder(sourceIndex, targetIndex) {
51620
- if (this.checkedState.size) {
51556
+ if (this.checkedState.length) {
51621
51557
  changeCheckboxOrder(sourceIndex, targetIndex, this);
51622
51558
  }
51623
51559
  if (this.radioState.length) {
@@ -57070,12 +57006,13 @@
57070
57006
  if (absoluteY === 0) {
57071
57007
  return { top: 0, row: 0, bottom: 0, height: 0 };
57072
57008
  }
57009
+ const floorOrRound = _this.options.customConfig?._disableColumnAndRowSizeRound === true ? Math.floor : Math.round;
57073
57010
  const findBefore = (startRow, startBottom) => {
57074
57011
  let bottom = startBottom;
57075
57012
  for (let row = startRow; row >= 0; row--) {
57076
57013
  const height = _this.getRowHeight(row);
57077
57014
  const top = bottom - height;
57078
- if (Math.round(top) <= Math.round(absoluteY) && Math.round(absoluteY) < Math.round(bottom)) {
57015
+ if (floorOrRound(top) <= floorOrRound(absoluteY) && floorOrRound(absoluteY) < floorOrRound(bottom)) {
57079
57016
  return {
57080
57017
  top,
57081
57018
  row,
@@ -57093,7 +57030,7 @@
57093
57030
  for (let row = startRow; row < rowCount; row++) {
57094
57031
  const height = _this.getRowHeight(row);
57095
57032
  const bottom = top + height;
57096
- if (Math.round(top) <= Math.round(absoluteY) && Math.round(absoluteY) < Math.round(bottom)) {
57033
+ if (floorOrRound(top) <= floorOrRound(absoluteY) && floorOrRound(absoluteY) < floorOrRound(bottom)) {
57097
57034
  return {
57098
57035
  top,
57099
57036
  row,
@@ -58411,7 +58348,7 @@
58411
58348
  return TABLE_EVENT_TYPE;
58412
58349
  }
58413
58350
  options;
58414
- version = "1.13.3-alpha.0";
58351
+ version = "1.13.3-alpha.10";
58415
58352
  pagination;
58416
58353
  id = `VTable${Date.now()}`;
58417
58354
  headerStyleCache;
@@ -65063,27 +65000,27 @@
65063
65000
  this.scenegraph.createSceneGraph();
65064
65001
  }
65065
65002
  getCheckboxState(field) {
65066
- if (this.stateManager.checkedState.size < this.rowCount - this.columnHeaderLevelCount) {
65003
+ if (this.stateManager.checkedState.length < this.rowCount - this.columnHeaderLevelCount) {
65067
65004
  this.stateManager.initLeftRecordsCheckState(this.records);
65068
65005
  }
65069
65006
  if (isValid$1(field)) {
65070
- let stateArr = this.stateManager.checkedState.values();
65007
+ let stateArr = this.stateManager.checkedState;
65071
65008
  if (this.options.groupBy) {
65072
65009
  stateArr = getGroupCheckboxState(this);
65073
65010
  }
65074
- return stateArr.map((state) => {
65011
+ return stateArr.map(state => {
65075
65012
  return state[field];
65076
65013
  });
65077
65014
  }
65078
- return new Array(...this.stateManager.checkedState.values());
65015
+ return this.stateManager.checkedState;
65079
65016
  }
65080
65017
  getCellCheckboxState(col, row) {
65081
65018
  const define = this.getBodyColumnDefine(col, row);
65082
65019
  const field = define?.field;
65083
65020
  const cellType = this.getCellType(col, row);
65084
65021
  if (isValid$1(field) && cellType === 'checkbox') {
65085
- const dataIndex = this.dataSource.getIndexKey(this.getRecordShowIndexByCell(col, row)).toString();
65086
- return this.stateManager.checkedState.get(dataIndex)?.[field];
65022
+ const dataIndex = this.dataSource.getIndexKey(this.getRecordShowIndexByCell(col, row));
65023
+ return this.stateManager.checkedState[dataIndex]?.[field];
65087
65024
  }
65088
65025
  return undefined;
65089
65026
  }
@@ -78885,7 +78822,7 @@
78885
78822
  }
78886
78823
 
78887
78824
  registerForVrender();
78888
- const version = "1.13.3-alpha.0";
78825
+ const version = "1.13.3-alpha.10";
78889
78826
  function getIcons() {
78890
78827
  return get$2();
78891
78828
  }