stk-table-vue 0.8.9 → 0.8.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.
@@ -214,7 +214,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
214
214
  rowHeight: number;
215
215
  autoRowHeight: boolean;
216
216
  rowHover: boolean;
217
- rowActive: boolean;
217
+ rowActive: () => Required<RowActiveOption<any>>;
218
218
  rowCurrentRevokable: boolean;
219
219
  headerRowHeight: number;
220
220
  virtual: boolean;
@@ -583,7 +583,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
583
583
  rowHeight: number;
584
584
  autoRowHeight: boolean;
585
585
  rowHover: boolean;
586
- rowActive: boolean;
586
+ rowActive: () => Required<RowActiveOption<any>>;
587
587
  rowCurrentRevokable: boolean;
588
588
  headerRowHeight: number;
589
589
  virtual: boolean;
@@ -18,7 +18,7 @@ export type CustomCellProps<T extends Record<string, any>> = {
18
18
  * - 不展开: null
19
19
  * - 展开: 返回column配置
20
20
  */
21
- expanded?: PrivateRowDT['__EXPANDED__'];
21
+ expanded?: PrivateRowDT['__EXP__'];
22
22
  };
23
23
  export type CustomHeaderCellProps<T extends Record<string, any>> = {
24
24
  col: StkTableColumn<T>;
@@ -134,25 +134,25 @@ export type PrivateRowDT = {
134
134
  /**
135
135
  * Only expanded row will add this key
136
136
  *
137
- * If user define the `__ROW_KEY__` in table data, this value will be used as the row key
137
+ * If user define the `__ROW_K__` in table data, this value will be used as the row key
138
138
  * @private
139
139
  */
140
- __ROW_KEY__?: string;
140
+ __ROW_K__?: string;
141
141
  /**
142
142
  * if row expanded
143
143
  * @private
144
144
  */
145
- __EXPANDED__?: StkTableColumn<any> | null;
145
+ __EXP__?: StkTableColumn<any> | null;
146
146
  /**
147
147
  * if tree node row expanded
148
148
  * @private
149
149
  */
150
- __T_EXPANDED__?: boolean;
150
+ __T_EXP__?: boolean;
151
151
  /**
152
152
  * tree parent key
153
153
  * @private
154
154
  */
155
- __T_PARENT_K__?: UniqKey;
155
+ __T_P_K__?: UniqKey;
156
156
  /**
157
157
  * tree level
158
158
  * @private
@@ -971,7 +971,7 @@ function useMergeCells({ rowActiveProp, tableHeaderLast, rowKeyGen, colKeyGen, v
971
971
  };
972
972
  }
973
973
  function useRowExpand({ dataSourceCopy, rowKeyGen, emits }) {
974
- const expandedKey = "__EXPANDED__";
974
+ const expandedKey = "__EXP__";
975
975
  function isExpanded(row, col) {
976
976
  return (row == null ? void 0 : row[expandedKey]) === col ? !(row == null ? void 0 : row[expandedKey]) : true;
977
977
  }
@@ -994,7 +994,7 @@ function useRowExpand({ dataSourceCopy, rowKeyGen, emits }) {
994
994
  }
995
995
  for (let i = index + 1; i < tempData.length; i++) {
996
996
  const item = tempData[i];
997
- const rowKey2 = item.__ROW_KEY__;
997
+ const rowKey2 = item.__ROW_K__;
998
998
  if (rowKey2 == null ? void 0 : rowKey2.startsWith(EXPANDED_ROW_KEY_PREFIX)) {
999
999
  tempData.splice(i, 1);
1000
1000
  i--;
@@ -1009,14 +1009,14 @@ function useRowExpand({ dataSourceCopy, rowKeyGen, emits }) {
1009
1009
  }
1010
1010
  if (expand) {
1011
1011
  const newExpandRow = {
1012
- __ROW_KEY__: EXPANDED_ROW_KEY_PREFIX + rowKey,
1012
+ __ROW_K__: EXPANDED_ROW_KEY_PREFIX + rowKey,
1013
1013
  __EXPANDED_ROW__: row,
1014
1014
  __EXPANDED_COL__: col
1015
1015
  };
1016
1016
  tempData.splice(index + 1, 0, newExpandRow);
1017
1017
  }
1018
1018
  if (row) {
1019
- row.__EXPANDED__ = expand ? col : null;
1019
+ row.__EXP__ = expand ? col : null;
1020
1020
  }
1021
1021
  dataSourceCopy.value = tempData;
1022
1022
  if (!(data == null ? void 0 : data.silent)) {
@@ -1253,7 +1253,7 @@ function useTrDrag({ props, emits, dataSourceCopy }) {
1253
1253
  function useTree({ props, dataSourceCopy, rowKeyGen, emits }) {
1254
1254
  const { defaultExpandAll, defaultExpandKeys, defaultExpandLevel } = props.treeConfig;
1255
1255
  function toggleTreeNode(row, col) {
1256
- const expand = row ? !row.__T_EXPANDED__ : false;
1256
+ const expand = row ? !row.__T_EXP__ : false;
1257
1257
  privateSetTreeExpand(row, { expand, col, isClick: true });
1258
1258
  }
1259
1259
  function privateSetTreeExpand(row, option) {
@@ -1276,7 +1276,7 @@ function useTree({ props, dataSourceCopy, rowKeyGen, emits }) {
1276
1276
  const level = row2.__T_LV__ || 0;
1277
1277
  let expanded = option == null ? void 0 : option.expand;
1278
1278
  if (expanded === void 0) {
1279
- expanded = !row2.__T_EXPANDED__;
1279
+ expanded = !row2.__T_EXP__;
1280
1280
  }
1281
1281
  if (expanded) {
1282
1282
  const children = expandNode(row2, level);
@@ -1296,13 +1296,10 @@ function useTree({ props, dataSourceCopy, rowKeyGen, emits }) {
1296
1296
  privateSetTreeExpand(row, { ...option, isClick: false });
1297
1297
  }
1298
1298
  function setNodeExpanded(row, expanded, level, parent) {
1299
- row.__T_EXPANDED__ = expanded;
1299
+ row.__T_EXP__ = expanded;
1300
1300
  if (level !== void 0) {
1301
1301
  row.__T_LV__ = level;
1302
1302
  }
1303
- if (parent) {
1304
- row.__T_PARENT_K__ = rowKeyGen(parent);
1305
- }
1306
1303
  }
1307
1304
  function flatTreeData(data) {
1308
1305
  const result = [];
@@ -1311,28 +1308,24 @@ function useTree({ props, dataSourceCopy, rowKeyGen, emits }) {
1311
1308
  for (let i = 0; i < data2.length; i++) {
1312
1309
  const item = data2[i];
1313
1310
  result.push(item);
1314
- const isExpanded = Boolean(item.__T_EXPANDED__);
1315
- setNodeExpanded(item, isExpanded, level, parent);
1311
+ const isExpanded = Boolean(item.__T_EXP__);
1312
+ setNodeExpanded(item, isExpanded, level);
1316
1313
  if (!isExpanded) {
1317
1314
  if (defaultExpandAll) {
1318
1315
  setNodeExpanded(item, true);
1319
1316
  } else {
1320
- if (defaultExpandLevel) {
1321
- if (level < defaultExpandLevel) {
1322
- setNodeExpanded(item, true);
1323
- }
1317
+ if (defaultExpandLevel && level < defaultExpandLevel) {
1318
+ setNodeExpanded(item, true);
1324
1319
  }
1325
- if (defaultExpandKeys) {
1326
- if (defaultExpandKeys.includes(rowKeyGen(item))) {
1327
- setNodeExpanded(item, true);
1328
- }
1320
+ if (defaultExpandKeys == null ? void 0 : defaultExpandKeys.includes(rowKeyGen(item))) {
1321
+ setNodeExpanded(item, true);
1329
1322
  }
1330
- if (!item.__T_EXPANDED__) {
1323
+ if (!item.__T_EXP__) {
1331
1324
  continue;
1332
1325
  }
1333
1326
  }
1334
1327
  }
1335
- recursion(item.children, level + 1, item);
1328
+ recursion(item.children, level + 1);
1336
1329
  }
1337
1330
  })(data, 0);
1338
1331
  return result;
@@ -1342,11 +1335,11 @@ function useTree({ props, dataSourceCopy, rowKeyGen, emits }) {
1342
1335
  row.children && row.children.forEach((child) => {
1343
1336
  result.push(child);
1344
1337
  const childLv = level + 1;
1345
- if (child.__T_EXPANDED__ && child.children) {
1338
+ if (child.__T_EXP__ && child.children) {
1346
1339
  const res = expandNode(child, childLv);
1347
1340
  result = result.concat(res);
1348
1341
  } else {
1349
- setNodeExpanded(child, false, childLv, row);
1342
+ setNodeExpanded(child, false, childLv);
1350
1343
  }
1351
1344
  });
1352
1345
  return result;
@@ -1740,7 +1733,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1740
1733
  rowHeight: { default: DEFAULT_ROW_HEIGHT },
1741
1734
  autoRowHeight: { type: Boolean, default: false },
1742
1735
  rowHover: { type: Boolean, default: true },
1743
- rowActive: { type: Boolean, default: true },
1736
+ rowActive: { type: Boolean, default: () => DEFAULT_ROW_ACTIVE_CONFIG },
1744
1737
  rowCurrentRevokable: { type: Boolean, default: true },
1745
1738
  headerRowHeight: { default: DEFAULT_ROW_HEIGHT },
1746
1739
  virtual: { type: Boolean, default: false },
@@ -1806,7 +1799,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1806
1799
  if (typeof rowActive === "boolean") {
1807
1800
  return {
1808
1801
  ...DEFAULT_ROW_ACTIVE_CONFIG,
1809
- enabled: rowActive,
1802
+ enabled: rowActive ?? true,
1810
1803
  revokable: Boolean(props.rowCurrentRevokable)
1811
1804
  };
1812
1805
  } else {
@@ -2076,7 +2069,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2076
2069
  }
2077
2070
  function rowKeyGen(row) {
2078
2071
  if (!row) return row;
2079
- let key = rowKeyGenCache.get(row) || row.__ROW_KEY__;
2072
+ let key = rowKeyGenCache.get(row) || row.__ROW_K__;
2080
2073
  if (!key) {
2081
2074
  key = rowKeyGenComputed.value(row);
2082
2075
  if (key === void 0) {
@@ -2251,22 +2244,27 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2251
2244
  }
2252
2245
  const dom = tableContainerRef.value;
2253
2246
  if (!dom) return;
2247
+ if (!virtual_on.value && !virtualX_on.value) return;
2254
2248
  const { containerHeight, scrollTop, scrollHeight } = virtualScroll.value;
2255
2249
  const { containerWidth, scrollLeft, scrollWidth } = virtualScrollX.value;
2256
2250
  const isScrollBottom = scrollHeight - containerHeight - scrollTop < 10;
2257
2251
  const isScrollRight = scrollWidth - containerWidth - scrollLeft < 10;
2258
- const { deltaY, deltaX } = e;
2259
- if (virtual_on.value && deltaY) {
2252
+ const { deltaY, deltaX, shiftKey } = e;
2253
+ if (virtual_on.value && deltaY && !shiftKey) {
2260
2254
  if (deltaY > 0 && !isScrollBottom || deltaY < 0 && scrollTop > 0) {
2261
2255
  e.preventDefault();
2262
2256
  }
2263
2257
  dom.scrollTop += deltaY;
2264
2258
  }
2265
- if (virtualX_on.value && deltaX) {
2266
- if (deltaX > 0 && !isScrollRight || deltaX < 0 && scrollLeft > 0) {
2259
+ if (virtualX_on.value) {
2260
+ let distance = deltaX;
2261
+ if (shiftKey && deltaY) {
2262
+ distance = deltaY;
2263
+ }
2264
+ if (distance > 0 && !isScrollRight || distance < 0 && scrollLeft > 0) {
2267
2265
  e.preventDefault();
2268
2266
  }
2269
- dom.scrollLeft += deltaX;
2267
+ dom.scrollLeft += distance;
2270
2268
  }
2271
2269
  }
2272
2270
  function onTableScroll(e) {
@@ -2693,7 +2691,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2693
2691
  active: _ctx.rowKey ? rowKeyGen(row) === currentRowKey.value : row === currentRow.value,
2694
2692
  hover: props.showTrHoverClass && (_ctx.rowKey ? rowKeyGen(row) === currentHoverRowKey.value : row === currentHoverRowKey.value),
2695
2693
  [_ctx.rowClassName(row, getRowIndex(rowIndex)) || ""]: true,
2696
- expanded: row == null ? void 0 : row.__EXPANDED__,
2694
+ expanded: row == null ? void 0 : row.__EXP__,
2697
2695
  "expanded-row": row && row.__EXPANDED_ROW__
2698
2696
  }),
2699
2697
  style: normalizeStyle({
@@ -2737,8 +2735,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2737
2735
  "cell-active": col.mergeCells && unref(activeMergedCells).has(cellKeyGen(row, col)),
2738
2736
  "seq-column": col.type === "seq",
2739
2737
  active: props.cellActive && currentSelectedCellKey.value === cellKeyGen(row, col),
2740
- expanded: col.type === "expand" && (row.__EXPANDED__ ? colKeyGen.value(row.__EXPANDED__) === colKeyGen.value(col) : false),
2741
- "tree-expanded": col.type === "tree-node" && row.__T_EXPANDED__,
2738
+ expanded: col.type === "expand" && (row.__EXP__ ? colKeyGen.value(row.__EXP__) === colKeyGen.value(col) : false),
2739
+ "tree-expanded": col.type === "tree-node" && row.__T_EXP__,
2742
2740
  "drag-row-cell": col.type === "dragRow"
2743
2741
  }
2744
2742
  ]
@@ -2762,8 +2760,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2762
2760
  rowIndex: getRowIndex(rowIndex),
2763
2761
  colIndex,
2764
2762
  cellValue: row && row[col.dataIndex],
2765
- expanded: row && row.__EXPANDED__ || null,
2766
- "tree-expanded": row && row.__T_EXPANDED__ || null
2763
+ expanded: row && row.__EXP__ || null,
2764
+ "tree-expanded": row && row.__T_EXP__ || null
2767
2765
  }, {
2768
2766
  stkFoldIcon: withCtx(() => [
2769
2767
  createVNode(TriangleIcon)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stk-table-vue",
3
- "version": "0.8.9",
3
+ "version": "0.8.10",
4
4
  "description": "Simple realtime virtual table for vue3 and vue2.7",
5
5
  "main": "./lib/stk-table-vue.js",
6
6
  "types": "./lib/src/StkTable/index.d.ts",
@@ -115,7 +115,7 @@
115
115
  active: rowKey ? rowKeyGen(row) === currentRowKey : row === currentRow,
116
116
  hover: props.showTrHoverClass && (rowKey ? rowKeyGen(row) === currentHoverRowKey : row === currentHoverRowKey),
117
117
  [rowClassName(row, getRowIndex(rowIndex)) || '']: true,
118
- expanded: row?.__EXPANDED__,
118
+ expanded: row?.__EXP__,
119
119
  'expanded-row': row && row.__EXPANDED_ROW__,
120
120
  }"
121
121
  :style="{
@@ -152,9 +152,8 @@
152
152
  'cell-active': col.mergeCells && activeMergedCells.has(cellKeyGen(row, col)),
153
153
  'seq-column': col.type === 'seq',
154
154
  active: props.cellActive && currentSelectedCellKey === cellKeyGen(row, col),
155
- expanded:
156
- col.type === 'expand' && (row.__EXPANDED__ ? colKeyGen(row.__EXPANDED__) === colKeyGen(col) : false),
157
- 'tree-expanded': col.type === 'tree-node' && row.__T_EXPANDED__,
155
+ expanded: col.type === 'expand' && (row.__EXP__ ? colKeyGen(row.__EXP__) === colKeyGen(col) : false),
156
+ 'tree-expanded': col.type === 'tree-node' && row.__T_EXP__,
158
157
  'drag-row-cell': col.type === 'dragRow',
159
158
  },
160
159
  ]"
@@ -179,8 +178,8 @@
179
178
  :rowIndex="getRowIndex(rowIndex)"
180
179
  :colIndex="colIndex"
181
180
  :cellValue="row && row[col.dataIndex]"
182
- :expanded="(row && row.__EXPANDED__) || null"
183
- :tree-expanded="(row && row.__T_EXPANDED__) || null"
181
+ :expanded="(row && row.__EXP__) || null"
182
+ :tree-expanded="(row && row.__T_EXP__) || null"
184
183
  >
185
184
  <template #stkFoldIcon>
186
185
  <TriangleIcon></TriangleIcon>
@@ -456,7 +455,7 @@ const props = withDefaults(
456
455
  rowHeight: DEFAULT_ROW_HEIGHT,
457
456
  autoRowHeight: false,
458
457
  rowHover: true,
459
- rowActive: true,
458
+ rowActive: () => DEFAULT_ROW_ACTIVE_CONFIG,
460
459
  rowCurrentRevokable: true,
461
460
  headerRowHeight: DEFAULT_ROW_HEIGHT,
462
461
  virtual: false,
@@ -721,7 +720,7 @@ const rowActiveProp = computed<Required<RowActiveOption<DT>>>(() => {
721
720
  if (typeof rowActive === 'boolean') {
722
721
  return {
723
722
  ...DEFAULT_ROW_ACTIVE_CONFIG,
724
- enabled: rowActive,
723
+ enabled: rowActive ?? true,
725
724
  revokable: Boolean(props.rowCurrentRevokable),
726
725
  };
727
726
  } else {
@@ -1063,7 +1062,7 @@ function dealColumns() {
1063
1062
  */
1064
1063
  function rowKeyGen(row: DT | null | undefined) {
1065
1064
  if (!row) return row;
1066
- let key = rowKeyGenCache.get(row) || (row as PrivateRowDT).__ROW_KEY__;
1065
+ let key = rowKeyGenCache.get(row) || (row as PrivateRowDT).__ROW_K__;
1067
1066
  if (!key) {
1068
1067
  key = rowKeyGenComputed.value(row);
1069
1068
 
@@ -1301,50 +1300,47 @@ function onCellMouseDown(e: MouseEvent, row: DT, col: StkTableColumn<DT>, rowInd
1301
1300
  }
1302
1301
 
1303
1302
  /**
1304
- * 鼠标滚轮事件监听。代理滚轮事件,防止滚动过快出现白屏。
1303
+ * proxy scroll, prevent white screen
1305
1304
  * @param e
1306
1305
  */
1307
1306
  function onTableWheel(e: WheelEvent) {
1308
1307
  if (props.smoothScroll) {
1309
1308
  return;
1310
1309
  }
1310
+ // if is resizing, not allow scroll
1311
1311
  if (isColResizing.value) {
1312
- // 正在调整列宽时,不允许用户滚动
1313
1312
  e.stopPropagation();
1314
1313
  return;
1315
1314
  }
1316
- // #region ---- 控制滚动,防止出现白屏--
1317
1315
  const dom = tableContainerRef.value;
1318
1316
  if (!dom) return;
1317
+ if (!virtual_on.value && !virtualX_on.value) return;
1318
+
1319
1319
  const { containerHeight, scrollTop, scrollHeight } = virtualScroll.value;
1320
1320
  const { containerWidth, scrollLeft, scrollWidth } = virtualScrollX.value;
1321
- /** 是否滚动在下面 */
1322
1321
  const isScrollBottom = scrollHeight - containerHeight - scrollTop < 10;
1323
- /** 是否滚动在右侧 */
1324
1322
  const isScrollRight = scrollWidth - containerWidth - scrollLeft < 10;
1325
- const { deltaY, deltaX } = e;
1323
+ const { deltaY, deltaX, shiftKey } = e;
1326
1324
 
1327
- /**
1328
- * 只有虚拟滚动时,才要用 wheel 代理scroll,防止滚动过快导致的白屏。
1329
- * 滚动条在边界情况时,not preventDefault 。因为会阻塞父级滚动条滚动。
1330
- */
1331
- if (virtual_on.value && deltaY) {
1325
+ if (virtual_on.value && deltaY && !shiftKey) {
1332
1326
  if ((deltaY > 0 && !isScrollBottom) || (deltaY < 0 && scrollTop > 0)) {
1333
- e.preventDefault();
1327
+ e.preventDefault(); // parent element scroll
1334
1328
  }
1335
1329
  dom.scrollTop += deltaY;
1336
1330
  }
1337
- if (virtualX_on.value && deltaX) {
1338
- if ((deltaX > 0 && !isScrollRight) || (deltaX < 0 && scrollLeft > 0)) {
1331
+ if (virtualX_on.value) {
1332
+ let distance = deltaX;
1333
+ if (shiftKey && deltaY) {
1334
+ distance = deltaY;
1335
+ }
1336
+ if ((distance > 0 && !isScrollRight) || (distance < 0 && scrollLeft > 0)) {
1339
1337
  e.preventDefault();
1340
1338
  }
1341
- dom.scrollLeft += deltaX;
1339
+ dom.scrollLeft += distance;
1342
1340
  }
1343
- //#endregion
1344
1341
  }
1345
1342
 
1346
1343
  /**
1347
- * 滚动条监听
1348
1344
  * @param e scrollEvent
1349
1345
  */
1350
1346
  function onTableScroll(e: Event) {
@@ -17,7 +17,7 @@ export type CustomCellProps<T extends Record<string, any>> = {
17
17
  * - 不展开: null
18
18
  * - 展开: 返回column配置
19
19
  */
20
- expanded?: PrivateRowDT['__EXPANDED__'];
20
+ expanded?: PrivateRowDT['__EXP__'];
21
21
  };
22
22
 
23
23
  export type CustomHeaderCellProps<T extends Record<string, any>> = {
@@ -139,25 +139,25 @@ export type PrivateRowDT = {
139
139
  /**
140
140
  * Only expanded row will add this key
141
141
  *
142
- * If user define the `__ROW_KEY__` in table data, this value will be used as the row key
142
+ * If user define the `__ROW_K__` in table data, this value will be used as the row key
143
143
  * @private
144
144
  */
145
- __ROW_KEY__?: string;
145
+ __ROW_K__?: string;
146
146
  /**
147
147
  * if row expanded
148
148
  * @private
149
149
  */
150
- __EXPANDED__?: StkTableColumn<any> | null;
150
+ __EXP__?: StkTableColumn<any> | null;
151
151
  /**
152
152
  * if tree node row expanded
153
153
  * @private
154
154
  */
155
- __T_EXPANDED__?: boolean;
155
+ __T_EXP__?: boolean;
156
156
  /**
157
157
  * tree parent key
158
158
  * @private
159
159
  */
160
- __T_PARENT_K__?: UniqKey;
160
+ __T_P_K__?: UniqKey;
161
161
  /**
162
162
  * tree level
163
163
  * @private
@@ -9,7 +9,7 @@ type Option<DT extends Record<string, any>> = {
9
9
  };
10
10
 
11
11
  export function useRowExpand({ dataSourceCopy, rowKeyGen, emits }: Option<DT>) {
12
- const expandedKey = '__EXPANDED__';
12
+ const expandedKey = '__EXP__';
13
13
 
14
14
  function isExpanded(row: DT, col?: StkTableColumn<DT> | null) {
15
15
  return row?.[expandedKey] === col ? !row?.[expandedKey] : true;
@@ -45,7 +45,7 @@ export function useRowExpand({ dataSourceCopy, rowKeyGen, emits }: Option<DT>) {
45
45
  // delete other expanded row below the target row
46
46
  for (let i = index + 1; i < tempData.length; i++) {
47
47
  const item: PrivateRowDT = tempData[i];
48
- const rowKey = item.__ROW_KEY__;
48
+ const rowKey = item.__ROW_K__;
49
49
  if (rowKey?.startsWith(EXPANDED_ROW_KEY_PREFIX)) {
50
50
  tempData.splice(i, 1);
51
51
  i--;
@@ -64,7 +64,7 @@ export function useRowExpand({ dataSourceCopy, rowKeyGen, emits }: Option<DT>) {
64
64
  if (expand) {
65
65
  // insert new expanded row
66
66
  const newExpandRow: ExpandedRow = {
67
- __ROW_KEY__: EXPANDED_ROW_KEY_PREFIX + rowKey,
67
+ __ROW_K__: EXPANDED_ROW_KEY_PREFIX + rowKey,
68
68
  __EXPANDED_ROW__: row,
69
69
  __EXPANDED_COL__: col,
70
70
  };
@@ -72,7 +72,7 @@ export function useRowExpand({ dataSourceCopy, rowKeyGen, emits }: Option<DT>) {
72
72
  }
73
73
 
74
74
  if (row) {
75
- row.__EXPANDED__ = expand ? col : null;
75
+ row.__EXP__ = expand ? col : null;
76
76
  }
77
77
 
78
78
  dataSourceCopy.value = tempData;
@@ -14,7 +14,7 @@ export function useTree({ props, dataSourceCopy, rowKeyGen, emits }: Option<DT>)
14
14
 
15
15
  /** click expended icon to toggle expand row */
16
16
  function toggleTreeNode(row: DT, col: any) {
17
- const expand = row ? !row.__T_EXPANDED__ : false;
17
+ const expand = row ? !row.__T_EXP__ : false;
18
18
  privateSetTreeExpand(row, { expand, col, isClick: true });
19
19
  }
20
20
 
@@ -47,7 +47,7 @@ export function useTree({ props, dataSourceCopy, rowKeyGen, emits }: Option<DT>)
47
47
  const level = row.__T_LV__ || 0;
48
48
  let expanded = option?.expand;
49
49
  if (expanded === void 0) {
50
- expanded = !row.__T_EXPANDED__;
50
+ expanded = !row.__T_EXP__;
51
51
  }
52
52
  if (expanded) {
53
53
  const children = expandNode(row, level);
@@ -73,13 +73,13 @@ export function useTree({ props, dataSourceCopy, rowKeyGen, emits }: Option<DT>)
73
73
  }
74
74
 
75
75
  function setNodeExpanded(row: DT, expanded: boolean, level?: number, parent?: DT) {
76
- row.__T_EXPANDED__ = expanded;
76
+ row.__T_EXP__ = expanded;
77
77
  if (level !== void 0) {
78
78
  row.__T_LV__ = level;
79
79
  }
80
- if (parent) {
81
- row.__T_PARENT_K__ = rowKeyGen(parent);
82
- }
80
+ // if (parent) {
81
+ // row.__T_P_K__ = rowKeyGen(parent);
82
+ // }
83
83
  }
84
84
 
85
85
  /**
@@ -94,23 +94,19 @@ export function useTree({ props, dataSourceCopy, rowKeyGen, emits }: Option<DT>)
94
94
  for (let i = 0; i < data.length; i++) {
95
95
  const item = data[i];
96
96
  result.push(item);
97
- const isExpanded = Boolean(item.__T_EXPANDED__);
97
+ const isExpanded = Boolean(item.__T_EXP__);
98
98
  setNodeExpanded(item, isExpanded, level, parent);
99
99
  if (!isExpanded) {
100
100
  if (defaultExpandAll) {
101
101
  setNodeExpanded(item, true);
102
102
  } else {
103
- if (defaultExpandLevel) {
104
- if (level < defaultExpandLevel) {
105
- setNodeExpanded(item, true);
106
- }
103
+ if (defaultExpandLevel && level < defaultExpandLevel) {
104
+ setNodeExpanded(item, true);
107
105
  }
108
- if (defaultExpandKeys) {
109
- if (defaultExpandKeys.includes(rowKeyGen(item))) {
110
- setNodeExpanded(item, true);
111
- }
106
+ if (defaultExpandKeys?.includes(rowKeyGen(item))) {
107
+ setNodeExpanded(item, true);
112
108
  }
113
- if (!item.__T_EXPANDED__) {
109
+ if (!item.__T_EXP__) {
114
110
  continue;
115
111
  }
116
112
  }
@@ -127,7 +123,7 @@ export function useTree({ props, dataSourceCopy, rowKeyGen, emits }: Option<DT>)
127
123
  row.children.forEach((child: DT) => {
128
124
  result.push(child);
129
125
  const childLv = level + 1;
130
- if (child.__T_EXPANDED__ && child.children) {
126
+ if (child.__T_EXP__ && child.children) {
131
127
  const res = expandNode(child, childLv);
132
128
  result = result.concat(res);
133
129
  } else {