venus-design 1.0.24 → 1.0.26

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.
@@ -140,9 +140,11 @@ export default function VirtTable(props) {
140
140
  /* 3. 过滤触发:先剪枝 → 把新树重新 load 进去 */
141
141
  useEffect(function () {
142
142
  if (!grid) return;
143
- var snap = flattenSnap(fullForestRef.current); // 快照
143
+ //@ts-ignore
144
+ var snap = flattenSnap(fullForestRef.current, [], config.ROW_KEY); // 快照
144
145
  var keepSet = new Set();
145
-
146
+ console.log(snap);
147
+ if (snap.length == 0) return;
146
148
  /* 3-1 跑你的匹配逻辑 */
147
149
  snap.forEach(function (r) {
148
150
  var ok = true;
@@ -157,8 +159,15 @@ export default function VirtTable(props) {
157
159
  type = _step$value$.type,
158
160
  val = _step$value$.val;
159
161
  var cellVal = String((_r$k = r[k]) !== null && _r$k !== void 0 ? _r$k : '');
162
+ //@ts-ignore
163
+ if (r[config.ROW_KEY] == null) return; // ← 排除脏数据
160
164
  if (type === 'text') {
161
- if (val && !cellVal.includes(val.toString())) ok = false;
165
+ var filterVal = val === null || val === void 0 ? void 0 : val.toString().trim().toLowerCase();
166
+ if (filterVal) {
167
+ // 只有输入框真的打了字才过滤
168
+ var cellValLower = cellVal.trim().toLowerCase(); // ← 关键:cellVal 也 trim
169
+ if (!cellValLower.includes(filterVal)) ok = false;
170
+ }
162
171
  } else if (type === 'select') {
163
172
  if (val && val.length && !val.includes(cellVal.toString())) ok = false;
164
173
  } else if (type === 'date') {
@@ -169,16 +178,18 @@ export default function VirtTable(props) {
169
178
  }
170
179
  if (!ok) break;
171
180
  }
181
+ //@ts-ignore
172
182
  } catch (err) {
173
183
  _iterator.e(err);
174
184
  } finally {
175
185
  _iterator.f();
176
186
  }
177
- if (ok) keepSet.add(r.id);
187
+ if (ok) keepSet.add(r[config.ROW_KEY]);
178
188
  });
179
189
 
180
190
  /* 3-2 剪枝得到新树 */
181
- var clipped = pruneTree(fullForestRef.current, keepSet);
191
+ //@ts-ignore
192
+ var clipped = pruneTree(fullForestRef.current, keepSet, config.ROW_KEY);
182
193
  grid.loadData(clipped !== null && clipped !== void 0 ? clipped : []); // ← 重新灌数据,Grid 会重新渲染树
183
194
  }, [filterMap, grid]);
184
195
  /* 初始化 */
@@ -336,6 +336,8 @@ export default class Config {
336
336
  ROW_BUTTON_BG_COLOR: string;
337
337
  /** 父级ID字段 */
338
338
  PARENT_ID: string;
339
+ /**是否启用跨节点拖拽 */
340
+ ENABLE_CROSS_NODE_DRAG: boolean;
339
341
  constructor(config: Partial<Config>);
340
342
  /** 初始化 */
341
343
  init(config: ConfigType): void;
@@ -387,6 +387,8 @@ var Config = /*#__PURE__*/function () {
387
387
  _defineProperty(this, "ROW_BUTTON_BG_COLOR", '#f0f7ff');
388
388
  /** 父级ID字段 */
389
389
  _defineProperty(this, "PARENT_ID", 'parentIid');
390
+ /**是否启用跨节点拖拽 */
391
+ _defineProperty(this, "ENABLE_CROSS_NODE_DRAG", false);
390
392
  this._config = config;
391
393
  this.updateCssVar();
392
394
  }
@@ -13,49 +13,39 @@ export type DragEndPayload = {
13
13
  };
14
14
  export default class DragGhost {
15
15
  private ctx;
16
+ private dragRowKey;
16
17
  private dragIndex;
17
- private dragInAllIndex;
18
18
  private ghostEl;
19
- private dragRowKey;
20
19
  private expandSnapshot;
21
20
  private asyncSnapshot;
22
21
  private snapshotOrder;
23
- private flatData;
22
+ private lastSwapTargetKey;
23
+ private isSwapping;
24
24
  constructor(ctx: Context);
25
25
  private getParentKey;
26
26
  private getParentChildren;
27
- private lastSwapIndex;
28
- private isSwapping;
29
- /**
30
- * 在原始树中递归找到某个 rowKey 所在的“兄弟数组”和它在数组中的索引
31
- * @returns [siblings: any[], index: number] | null
32
- */
27
+ /** 在树中找兄弟数组及索引 */
33
28
  private findSiblingsAndIndex;
34
- private isMouseAtLeft40;
35
- /** 设置 parentId 并返回同一对象 */
29
+ /** 设置 parentId 字段并返回同一对象 */
36
30
  private setParentId;
37
- /** 原来的同级交换 */
38
- private swapSibling;
39
- /** 交换行(节流) */
31
+ /** 从兄弟数组中删除某行 */
32
+ private removeFromSiblings;
40
33
  private throttleSwap;
41
- /** dragRowKey 从原父级移除,插入到 targetRowKey 的父级,并放在 target 前面 */
34
+ /** 同级交换(仅同父) */
35
+ private swapSibling;
36
+ /** 把 dragRowKey 提到 targetRowKey 的父级,并放在 target 前面 */
42
37
  private promoteToSibling;
43
- /** 把 dragRowKey 插入到 targetRowKey children 首部,并自动展开 */
38
+ /** 把 dragRowKey 插入为 targetRowKey 的第一个子级,并自动展开 */
44
39
  private insertAsChild;
45
- /** 把某行从它当前的兄弟数组里删掉 */
46
- private removeFromSiblings;
47
- private get viewRows();
48
- private onMouseDown;
49
- private calcDiff;
50
- private createGhost;
51
- private lastMoveTime;
52
- private slideTimer;
53
- private hasMoved;
54
40
  private slideRow;
41
+ private onMouseDown;
55
42
  private onMouseMove;
56
43
  private onMouseUp;
57
- private cleanup;
44
+ private isMouseAtLeft40;
45
+ private calcDiff;
58
46
  private getCellFromEvent;
47
+ private createGhost;
48
+ private cleanup;
59
49
  private takeExpandSnapshot;
60
50
  private collapseTreeUnder;
61
51
  private restoreExpandSnapshot;