@hzab/edit-table 0.1.13-alpha.1 → 0.1.13

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/dist/index.js CHANGED
@@ -2,13 +2,13 @@ import { forwardRef as e, useCallback as t, useEffect as n, useImperativeHandle
2
2
  import { Checkbox as s, DatePicker as c, Empty as l, Input as u, Popover as d, Spin as f, TimePicker as p } from "antd";
3
3
  import { ReactGrid as m, getCellProperty as h, isAlphaNumericKey as g, isNavigationKey as _ } from "@silevis/reactgrid";
4
4
  import { antdComponents as v, customComponents as y } from "@hzab/form-render";
5
- import { InfoCircleOutlined as b, MinusCircleOutlined as x, PlusCircleOutlined as S } from "@ant-design/icons";
6
- import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
7
- import { c as E } from "react/compiler-runtime";
8
- import { getVal as D } from "@hzab/utils/src/formily/field";
5
+ import { InfoCircleOutlined as ee, MinusCircleOutlined as b, PlusCircleOutlined as x } from "@ant-design/icons";
6
+ import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
7
+ import { c as T } from "react/compiler-runtime";
8
+ import { getVal as E } from "@hzab/utils/src/formily/field";
9
9
  import "@silevis/reactgrid/styles.css";
10
10
  //#region src/common/childAntdComponent.ts
11
- var O = {
11
+ var D = {
12
12
  "DatePicker.MonthPicker": c.MonthPicker,
13
13
  "DatePicker.QuarterPicker": c.QuarterPicker,
14
14
  "DatePicker.RangePicker": c.RangePicker,
@@ -19,7 +19,7 @@ var O = {
19
19
  "Input.Search": u.Search,
20
20
  "Input.TextArea": u.TextArea,
21
21
  "TimePicker.RangePicker": p.RangePicker
22
- }, k = [
22
+ }, O = [
23
23
  "DatePicker",
24
24
  "DatePicker.MonthPicker",
25
25
  "DatePicker.QuarterPicker",
@@ -28,7 +28,7 @@ var O = {
28
28
  "DatePicker.WeekPicker",
29
29
  "DatePicker.YearPicker",
30
30
  "TimePicker.RangePicker"
31
- ], A = (e, t = {}) => {
31
+ ], k = (e, t = {}) => {
32
32
  class r {
33
33
  getCompatibleCell(e) {
34
34
  let t;
@@ -61,7 +61,8 @@ var O = {
61
61
  });
62
62
  }
63
63
  getClassName(e, t) {
64
- return "";
64
+ let n = window.gridHighlightRowId;
65
+ return n && e.rowId === n ? "custom-highlights-row" : "";
65
66
  }
66
67
  handleCompositionEnd(e, t) {
67
68
  return {
@@ -71,7 +72,7 @@ var O = {
71
72
  }
72
73
  render(r, s, c) {
73
74
  var l;
74
- let [u, f] = o(!1), [p, m] = o(!1), h = (r == null ? void 0 : r.columnId) + (r == null ? void 0 : r.rowId), [v, y] = o(r == null ? void 0 : r.text), [x, S] = o(!1), C = a(r == null ? void 0 : r.text), E = a(), D = a(null), O = a(null), A = (e) => {
75
+ let [u, f] = o(!1), [p, m] = o(!1), h = (r == null ? void 0 : r.columnId) + (r == null ? void 0 : r.rowId), [v, y] = o(r == null ? void 0 : r.text), [b, x] = o(!1), S = a(r == null ? void 0 : r.text), T = a(), E = a(null), D = a(null), k = (e) => {
75
76
  let t = Array.from(e.children);
76
77
  if (t.length === 0) return e.clientHeight;
77
78
  let n = Infinity, r = -Infinity;
@@ -82,16 +83,16 @@ var O = {
82
83
  return Math.max(0, Math.ceil(r - n));
83
84
  };
84
85
  n(() => {
85
- let e = D.current, t = r == null ? void 0 : r.onRowHeightChange;
86
+ let e = E.current, t = r == null ? void 0 : r.onRowHeightChange;
86
87
  if (!e || !t || (r == null ? void 0 : r.rowId) == null || typeof (r == null ? void 0 : r.rowId) == "string" && r.rowId.indexOf("header-") === 0) return;
87
88
  let n = e.firstElementChild, i = n || e;
88
- if (O.current === null) {
89
+ if (D.current === null) {
89
90
  let t = getComputedStyle(e);
90
- O.current = (parseFloat(t.paddingTop) || 0) + (parseFloat(t.paddingBottom) || 0);
91
+ D.current = (parseFloat(t.paddingTop) || 0) + (parseFloat(t.paddingBottom) || 0);
91
92
  }
92
- let a = n ? O.current : 0, o = new ResizeObserver(() => {
93
+ let a = n ? D.current : 0, o = new ResizeObserver(() => {
93
94
  Array.from(i.children).forEach((e) => o.observe(e));
94
- let e = A(i) + a;
95
+ let e = k(i) + a;
95
96
  t(r == null ? void 0 : r.rowId, e, r == null ? void 0 : r.columnId);
96
97
  });
97
98
  return o.observe(i), Array.from(i.children).forEach((e) => o.observe(e)), () => o.disconnect();
@@ -102,7 +103,7 @@ var O = {
102
103
  u,
103
104
  v
104
105
  ]), n(() => {
105
- y(r == null ? void 0 : r.text), C.current = r == null ? void 0 : r.text;
106
+ y(r == null ? void 0 : r.text), S.current = r == null ? void 0 : r.text;
106
107
  }, [r == null ? void 0 : r.text]), n(() => {
107
108
  function e(e) {
108
109
  window.gridEditId != h && f(!1);
@@ -111,7 +112,7 @@ var O = {
111
112
  document.removeEventListener("click", e);
112
113
  };
113
114
  }, []);
114
- let j = (e) => {
115
+ let A = (e) => {
115
116
  var t;
116
117
  let n = !1, i = !1;
117
118
  for (let t of (r == null ? void 0 : r.validatorList) || []) {
@@ -119,7 +120,7 @@ var O = {
119
120
  t != null && (a = t.pattern) != null && a.test(e) && (n = !0);
120
121
  break;
121
122
  }
122
- i = !n && Array.isArray(r == null ? void 0 : r.validatorList) && (r == null || (t = r.validatorList) == null ? void 0 : t.length) > 0, S(i);
123
+ i = !n && Array.isArray(r == null ? void 0 : r.validatorList) && (r == null || (t = r.validatorList) == null ? void 0 : t.length) > 0, x(i);
123
124
  };
124
125
  n(() => {
125
126
  if (!p) return;
@@ -135,30 +136,30 @@ var O = {
135
136
  }, 0);
136
137
  return () => clearTimeout(e);
137
138
  }, [p]);
138
- let M = () => {
139
- let e = C.current;
139
+ let j = () => {
140
+ let e = S.current;
140
141
  c(this.getCompatibleCell({
141
142
  ...r,
142
143
  text: e,
143
144
  selectedValue: e
144
145
  }), !0);
145
- }, N = i(() => k != null && k.includes(r == null ? void 0 : r.type) ? {
146
+ }, M = i(() => O != null && O.includes(r == null ? void 0 : r.type) ? {
146
147
  open: p,
147
148
  onOpenChange: (e) => {
148
- E.current && clearTimeout(E.current), E.current = setTimeout(() => {
149
+ T.current && clearTimeout(T.current), T.current = setTimeout(() => {
149
150
  m(e);
150
151
  }, 80);
151
152
  }
152
153
  } : {}, [r]);
153
154
  return n(() => {
154
- !u && r.type == "Upload" && window.uploadEdit && window.uploadEdit == h && (window.uploadEdit = null, M());
155
- }, [u, v]), /* @__PURE__ */ T("div", {
156
- ref: D,
155
+ !u && r.type == "Upload" && window.uploadEdit && window.uploadEdit == h && (window.uploadEdit = null, j());
156
+ }, [u, v]), /* @__PURE__ */ w("div", {
157
+ ref: E,
157
158
  className: `base-hoc ${u ? "base-hoc-edit" : ""}`,
158
159
  onDoubleClick: (e) => {
159
160
  r != null && r.nonEditable || (r.type === "Upload" && (window.uploadEdit = h), f(!0));
160
161
  },
161
- children: [/* @__PURE__ */ w(e, {
162
+ children: [/* @__PURE__ */ C(e, {
162
163
  ...t,
163
164
  onPointerDown: (e) => e.stopPropagation(),
164
165
  componentProps: {
@@ -172,10 +173,10 @@ var O = {
172
173
  onChange: (e) => {
173
174
  var t, n;
174
175
  let r = (t = e == null || (n = e.target) == null ? void 0 : n.value) == null ? e : t;
175
- y(r), C.current = r, j(r);
176
+ y(r), S.current = r, A(r);
176
177
  },
177
178
  onBlur: (e) => {
178
- M(), k != null && k.includes(r == null ? void 0 : r.type) || f(!1);
179
+ j(), O != null && O.includes(r == null ? void 0 : r.type) || f(!1);
179
180
  },
180
181
  onPointerDown: (e) => {
181
182
  e.stopPropagation();
@@ -183,30 +184,30 @@ var O = {
183
184
  onKeyDown: (e) => {
184
185
  (g(e.keyCode) || _(e.keyCode)) && e.stopPropagation();
185
186
  },
186
- ...N,
187
+ ...M,
187
188
  ...(r == null ? void 0 : r.getField) && (r == null ? void 0 : r.getField()["x-component-props"]) || {}
188
189
  },
189
190
  pattern: u ? "" : "readPretty",
190
191
  cell: r
191
- }), x && /* @__PURE__ */ w(d, {
192
+ }), b && /* @__PURE__ */ C(d, {
192
193
  content: (l = r == null ? void 0 : r.validatorMessage) == null ? "该字段不合法" : l,
193
- children: /* @__PURE__ */ w(b, { className: "validator-icon" })
194
+ children: /* @__PURE__ */ C(ee, { className: "validator-icon" })
194
195
  })]
195
196
  });
196
197
  }
197
198
  }
198
199
  return new r();
199
- }, j = (e) => {
200
+ }, A = (e) => {
200
201
  let { pattern: t, cell: n, componentProps: r, Com: a, cellRender: o } = e, s = i(() => {
201
202
  var e;
202
- if (n != null && n.getField) return D({
203
+ if (n != null && n.getField) return E({
203
204
  ...(n == null ? void 0 : n.getField) && (n == null ? void 0 : n.getField()),
204
205
  enum: (n == null || (e = n.getField()) == null ? void 0 : e.enum) || (n == null ? void 0 : n.values)
205
206
  }, { [(n == null ? void 0 : n.getField) && (n == null ? void 0 : n.getField().name)]: n.text });
206
207
  }, [n]);
207
- return o && o(e) ? /* @__PURE__ */ w(o, { ...e }) : /* @__PURE__ */ w("div", {
208
+ return o && o(e) ? /* @__PURE__ */ C(o, { ...e }) : /* @__PURE__ */ C("div", {
208
209
  className: "base-hoc-inner",
209
- children: t == "readPretty" ? /* @__PURE__ */ w("div", { children: s }) : /* @__PURE__ */ w(a, {
210
+ children: t == "readPretty" ? /* @__PURE__ */ C("div", { children: s }) : /* @__PURE__ */ C(a, {
210
211
  className: "rg-input",
211
212
  ref: (e) => {
212
213
  e && e.focus({ preventScroll: !0 });
@@ -214,20 +215,20 @@ var O = {
214
215
  ...r
215
216
  })
216
217
  });
217
- }, M = (e) => {
218
- let t = E(5), n = e == null ? void 0 : e.componentProps, r;
218
+ }, j = (e) => {
219
+ let t = T(5), n = e == null ? void 0 : e.componentProps, r;
219
220
  t[0] === n ? r = t[1] : (r = {
220
221
  ...n,
221
222
  type: "number"
222
223
  }, t[0] = n, t[1] = r);
223
224
  let i;
224
- return t[2] !== e || t[3] !== r ? (i = /* @__PURE__ */ w(j, {
225
+ return t[2] !== e || t[3] !== r ? (i = /* @__PURE__ */ C(A, {
225
226
  ...e,
226
227
  componentProps: r,
227
228
  Com: u
228
229
  }), t[2] = e, t[3] = r, t[4] = i) : i = t[4], i;
229
- }, N = (e) => {
230
- let t = E(21), { cell: r } = e, { setExpandKeys: i, expandKeys: a, rowKey: s, setNewDataSource: c, record: l } = r, [u, d] = o(!1), f;
230
+ }, M = (e) => {
231
+ let t = T(21), { cell: r } = e, { setExpandKeys: i, expandKeys: a, rowKey: s, setNewDataSource: c, record: l } = r, [u, d] = o(!1), f;
231
232
  t[0] !== l || t[1] !== s || t[2] !== c ? (f = (e) => {
232
233
  c((t) => {
233
234
  var n;
@@ -250,24 +251,24 @@ var O = {
250
251
  i((e) => e != null && e.includes(l == null ? void 0 : l[s]) ? e == null ? void 0 : e.filter((e) => e != (l == null ? void 0 : l[s])) : [...e, l == null ? void 0 : l[s]]), d(!u), p(!u);
251
252
  }, t[11] = u, t[12] = p, t[13] = l, t[14] = s, t[15] = i, t[16] = _) : _ = t[16];
252
253
  let v = _, y;
253
- return t[17] !== u || t[18] !== v || t[19] !== (l == null ? void 0 : l.children) ? (y = /* @__PURE__ */ w("div", {
254
+ return t[17] !== u || t[18] !== v || t[19] !== (l == null ? void 0 : l.children) ? (y = /* @__PURE__ */ C("div", {
254
255
  className: "expandList-template",
255
- children: l != null && l.children ? /* @__PURE__ */ w(C, { children: w(u ? x : S, {
256
+ children: l != null && l.children ? /* @__PURE__ */ C(S, { children: C(u ? b : x, {
256
257
  className: "expandList-template-icon",
257
258
  onClick: v
258
- }) }) : /* @__PURE__ */ w("div", { style: { width: 14 } })
259
+ }) }) : /* @__PURE__ */ C("div", { style: { width: 14 } })
259
260
  }), t[17] = u, t[18] = v, t[19] = l == null ? void 0 : l.children, t[20] = y) : y = t[20], y;
260
261
  };
261
262
  //#endregion
262
263
  //#region src/common/utils.ts
263
- function P(e) {
264
+ function N(e) {
264
265
  return typeof e == "object" && !!e;
265
266
  }
266
- var F = (e) => {
267
+ var P = (e) => {
267
268
  var t;
268
- return typeof (e == null ? void 0 : e.title) == "function" ? P(e == null ? void 0 : e.title()) ? e == null || (t = e.title()) == null ? void 0 : t.props.children : String(e == null ? void 0 : e.title()) || "" : String(e == null ? void 0 : e.title) || "";
269
+ return typeof (e == null ? void 0 : e.title) == "function" ? N(e == null ? void 0 : e.title()) ? e == null || (t = e.title()) == null ? void 0 : t.props.children : String(e == null ? void 0 : e.title()) || "" : String(e == null ? void 0 : e.title) || "";
269
270
  };
270
- function ee(e, t = 40) {
271
+ function te(e, t = 40) {
271
272
  let n = (e) => e.reduce((e, t) => {
272
273
  var r;
273
274
  return (r = t.children) != null && r.length ? [...e, ...n(t.children)] : [...e, t];
@@ -298,14 +299,14 @@ function ee(e, t = 40) {
298
299
  cells: []
299
300
  })), u = (e) => {
300
301
  var t;
301
- return (t = ["rowSelection", "ExpandListTemplate"]) != null && t.includes(e == null ? void 0 : e.type) ? e == null ? void 0 : e.type : P(typeof (e == null ? void 0 : e.title) == "function" ? e == null ? void 0 : e.title() : null) ? `${e == null ? void 0 : e.dataIndex}` : "header";
302
+ return (t = ["rowSelection", "ExpandListTemplate"]) != null && t.includes(e == null ? void 0 : e.type) ? e == null ? void 0 : e.type : N(typeof (e == null ? void 0 : e.title) == "function" ? e == null ? void 0 : e.title() : null) ? `${e == null ? void 0 : e.dataIndex}` : "header";
302
303
  }, d = (e, t = 0) => {
303
304
  e.forEach((e) => {
304
305
  if (e._isLeaf) {
305
306
  let n = {
306
307
  ...e,
307
308
  type: u(e),
308
- text: F(e),
309
+ text: P(e),
309
310
  dataIndex: e.dataIndex,
310
311
  width: e.width,
311
312
  rowspan: e.rowspan,
@@ -319,7 +320,7 @@ function ee(e, t = 40) {
319
320
  } else l[t].cells.push({
320
321
  ...e,
321
322
  type: u(e),
322
- text: F(e),
323
+ text: P(e),
323
324
  colspan: e.colspan,
324
325
  style: e != null && e.style ? e == null ? void 0 : e.style : {
325
326
  background: "rgba(128, 128, 128, 0.1)",
@@ -338,7 +339,7 @@ function ee(e, t = 40) {
338
339
  n.push({
339
340
  ...e,
340
341
  type: u(e),
341
- text: F(e),
342
+ text: P(e),
342
343
  dataIndex: e.dataIndex,
343
344
  width: e.width,
344
345
  rowspan: t === a - 1 ? 1 : void 0,
@@ -369,7 +370,7 @@ function ee(e, t = 40) {
369
370
  n ? p.push(n) : p.push({
370
371
  ...e,
371
372
  type: u(e),
372
- text: F(e),
373
+ text: P(e),
373
374
  dataIndex: e.dataIndex,
374
375
  width: e.width,
375
376
  rowspan: 1,
@@ -386,7 +387,7 @@ function ee(e, t = 40) {
386
387
  });
387
388
  }), l;
388
389
  }
389
- function te(e) {
390
+ function ne(e) {
390
391
  let t = [];
391
392
  function n(e) {
392
393
  e.forEach((e) => {
@@ -410,7 +411,7 @@ function te(e) {
410
411
  }
411
412
  //#endregion
412
413
  //#region src/common/useDynamicHeight.ts
413
- var ne = (e) => {
414
+ var re = (e) => {
414
415
  let { wrapRef: r, rowHeight: i, setRows: s } = e, c = a({}), l = a(), u = a({
415
416
  top: 0,
416
417
  left: 0
@@ -545,38 +546,60 @@ var ne = (e) => {
545
546
  };
546
547
  //#endregion
547
548
  //#region src/index.tsx
548
- function I(e, t) {
549
+ function ie(e, t, n) {
550
+ if (!Array.isArray(e) || !Array.isArray(t) || t.length === 0) return e;
551
+ let r = /* @__PURE__ */ new Map();
552
+ t.forEach((e) => {
553
+ (e == null ? void 0 : e[n]) != null && r.set(String(e[n]), e), (e == null ? void 0 : e.id) != null && r.set(String(e.id), e);
554
+ });
555
+ let i = (e) => Array.isArray(e) ? e.map((e) => {
556
+ var t;
557
+ let a = r.get(String((t = e == null ? void 0 : e[n]) == null ? e == null ? void 0 : e.id : t)), o = e == null ? void 0 : e.children, s = o && i(o);
558
+ if (!a) return s === o ? e : {
559
+ ...e,
560
+ children: s
561
+ };
562
+ let { children: c, ...l } = a;
563
+ return {
564
+ ...e,
565
+ ...l,
566
+ ...o === void 0 ? {} : { children: s }
567
+ };
568
+ }) : e;
569
+ return i(e);
570
+ }
571
+ function F(e, t) {
549
572
  var c;
550
- let { columns: u, dataSource: d, formulaConfig: p, onChange: h, reactGridProps: g = {}, onEditSubmit: _, headerRowHeight: b = 44, rowHeight: x = 44, reactGridStyle: S, className: C, Slots: E, rowSelection: D, rowKey: k = "id", query: F, loading: I, isExpand: re = !1, getList: ie, onRow: L } = e, [R, ae] = o([]), [z, B] = o([]);
573
+ let { columns: u, dataSource: d, formulaConfig: p, onChange: h, reactGridProps: g = {}, onEditSubmit: _, headerRowHeight: ee = 48, rowHeight: b = 48, reactGridStyle: x, className: S, Slots: T, rowSelection: E, rowKey: O = "id", query: P, loading: F, isExpand: ae = !1, getList: oe, setList: I, onRow: L } = e, [R, se] = o([]), [z, B] = o([]);
551
574
  a([]);
552
- let [V, oe] = o([]), [H, se] = o([]), [U, W] = o([]), [G, ce] = o([]), [le, ue] = o([]), [de, K] = o([]), q = a(), fe = a(), J = a(null), pe = a(), Y = a([]);
575
+ let [V, ce] = o([]), [H, le] = o([]), [U, W] = o([]), [G, ue] = o([]), [de, fe] = o([]), [pe, K] = o([]), q = a(), me = a(), J = a(null), he = a(), Y = a([]);
553
576
  Y.current = G;
554
- let { handleRowHeightChange: me, armScrollProtect: X, restoreScroll: Z, SCROLL_RESET_GUARD_MS: he, rowsRef: Q, rowHeights: ge } = ne({
577
+ let { handleRowHeightChange: ge, armScrollProtect: X, restoreScroll: Z, SCROLL_RESET_GUARD_MS: _e, rowsRef: Q, rowHeights: ve } = re({
555
578
  wrapRef: J,
556
- rowHeight: x,
579
+ rowHeight: b,
557
580
  setRows: B
558
581
  });
559
582
  r(t, () => ({ rows: z }));
560
- let $ = (e, t = 0) => {
583
+ let ye = (e, t = 0) => {
561
584
  e == null || e.forEach((e) => {
562
- e.level = t + 1, e != null && e.children && $(e == null ? void 0 : e.children, e.level);
585
+ e.level = t + 1, e != null && e.children && ye(e == null ? void 0 : e.children, e.level);
563
586
  });
564
587
  };
565
588
  n(() => {
566
- $(d), W(((e) => {
589
+ ye(d), W(((e) => {
567
590
  let t = [], n = (e) => {
568
591
  for (let a of e || []) {
569
592
  var r, i;
570
- t.push(a), a != null && (r = a.children) != null && r.length && (i = Y.current) != null && i.includes(a == null ? void 0 : a[k]) && n(a.children);
593
+ t.push(a), a != null && (r = a.children) != null && r.length && (i = Y.current) != null && i.includes(a == null ? void 0 : a[O]) && n(a.children);
571
594
  }
572
595
  };
573
596
  return n(e), t;
574
597
  })(d));
575
598
  }, [d]), n(() => {
576
599
  let e = z.map((e) => e.rowId);
577
- e != null && e.includes(q.current) || K([]);
600
+ e != null && e.includes(q.current) || (K([]), window.gridHighlightRowId = null);
578
601
  }, [z]);
579
- let _e = (e) => {
602
+ let be = (e) => {
580
603
  var t, n;
581
604
  let r = e == null || (t = e.cells) == null || (t = t[0]) == null ? void 0 : t.record, i = ["_$actions", "rowSelection"], a = { id: e == null ? void 0 : e.rowId };
582
605
  return e == null || (n = e.cells) == null || n.forEach((e) => {
@@ -588,46 +611,46 @@ function I(e, t) {
588
611
  };
589
612
  n(() => {
590
613
  if (Array.isArray(u) && (u == null ? void 0 : u.length) > 0) {
591
- re && u.unshift({
614
+ ae && u.unshift({
592
615
  type: "ExpandListTemplate",
593
616
  width: 14,
594
617
  key: "ExpandListTemplate",
595
618
  nonEditable: !0,
596
- style: (D == null ? void 0 : D.style) || { background: "rgba(128, 128, 128, 0.1)" }
597
- }), D && u.unshift({
619
+ style: (E == null ? void 0 : E.style) || { background: "rgba(128, 128, 128, 0.1)" }
620
+ }), E && u.unshift({
598
621
  type: "rowSelection",
599
622
  nonEditable: !0,
600
- width: (D == null ? void 0 : D.width) || 30,
623
+ width: (E == null ? void 0 : E.width) || 30,
601
624
  key: "rowSelection",
602
- style: (D == null ? void 0 : D.style) || {
625
+ style: (E == null ? void 0 : E.style) || {
603
626
  background: "rgba(128, 128, 128, 0.1)",
604
627
  display: "flex",
605
628
  justifyContent: "center"
606
629
  }
607
- }), ae(ee(u, b));
608
- let e = te(u);
609
- oe(e == null ? void 0 : e.map((e, t) => ({
630
+ }), se(te(u, ee));
631
+ let e = ne(u);
632
+ ce(e == null ? void 0 : e.map((e, t) => ({
610
633
  ...e,
611
634
  columnId: (e == null ? void 0 : e.dataIndex) || (e == null ? void 0 : e.key) || (e == null ? void 0 : e.name) || ""
612
635
  })));
613
636
  }
614
- }, [u, D]);
615
- let ve = {}, ye = (e) => {
637
+ }, [u, E]);
638
+ let $ = {}, xe = (e) => {
616
639
  e == null || e.forEach((e) => {
617
- if (P(typeof (e == null ? void 0 : e.title) == "function" ? e == null ? void 0 : e.title() : null)) {
640
+ if (N(typeof (e == null ? void 0 : e.title) == "function" ? e == null ? void 0 : e.title() : null)) {
618
641
  let t = e == null ? void 0 : e.title;
619
- ve[e == null ? void 0 : e.dataIndex] = A(t);
642
+ $[e == null ? void 0 : e.dataIndex] = k(t);
620
643
  }
621
- e != null && e.children && ye(e == null ? void 0 : e.children);
644
+ e != null && e.children && xe(e == null ? void 0 : e.children);
622
645
  });
623
646
  };
624
647
  n(() => {
625
- ye(u), ue(ve);
648
+ xe(u), fe($);
626
649
  }, [u]), n(() => {
627
650
  let e = V == null ? void 0 : V.map((e) => e == null ? void 0 : e.columnId), t = U == null ? void 0 : U.map((t, n) => {
628
- let r = ge[t[k]], i = r && Object.keys(r).length > 0 ? Math.max(x, ...Object.values(r).map(Number)) : x;
651
+ let r = ve[t[O]], i = r && Object.keys(r).length > 0 ? Math.max(b, ...Object.values(r).map(Number)) : b;
629
652
  return {
630
- rowId: t[k],
653
+ rowId: t[O],
631
654
  height: i,
632
655
  cells: e == null ? void 0 : e.map((e, r) => {
633
656
  var i;
@@ -645,7 +668,7 @@ function I(e, t) {
645
668
  return {
646
669
  ...o,
647
670
  record: t,
648
- rowId: t[k] || (o == null ? void 0 : o.type),
671
+ rowId: t[O] || (o == null ? void 0 : o.type),
649
672
  type: c,
650
673
  nonEditable: (o == null ? void 0 : o.pattern) == "readPretty" ? !0 : o == null ? void 0 : o.nonEditable,
651
674
  text: String(s || ""),
@@ -659,11 +682,11 @@ function I(e, t) {
659
682
  ...(o == null ? void 0 : o.onCell) && (o == null ? void 0 : o.onCell(t, n, r)) || {},
660
683
  ...(o == null ? void 0 : o.cellProps) || {},
661
684
  setNewDataSource: W,
662
- setExpandKeys: ce,
663
- rowKey: k,
685
+ setExpandKeys: ue,
686
+ rowKey: O,
664
687
  expandKeys: G,
665
- Slots: E,
666
- onRowHeightChange: me,
688
+ Slots: T,
689
+ onRowHeightChange: ge,
667
690
  ...a
668
691
  };
669
692
  })
@@ -675,122 +698,133 @@ function I(e, t) {
675
698
  V,
676
699
  R
677
700
  ]);
678
- let be = async (e) => {
701
+ let Se = async (e) => {
679
702
  if (!Array.isArray(e) || e.length === 0) return;
680
- let t = [], n = (Q.current || []).map((e) => ({
703
+ let t = [], n = d, r = (Q.current || []).map((e) => ({
681
704
  ...e,
682
705
  cells: [...e.cells]
683
- }));
706
+ })), i = [];
684
707
  if (e.forEach((e) => {
685
- let r = n.findIndex((t) => t.rowId == e.rowId), i = V.findIndex((t) => t.columnId == e.columnId);
686
- if (r !== -1 && i !== -1) {
687
- if (n[r].cells[i] = { ...e.newCell }, pe.current = { ...e.newCell }, t.push(_e(n[r])), p) for (let e in p) {
708
+ let n = r.findIndex((t) => t.rowId == e.rowId), a = V.findIndex((t) => t.columnId == e.columnId);
709
+ if (n !== -1 && a !== -1) {
710
+ if (i.push({
711
+ rowId: e.rowId,
712
+ columnId: e.columnId,
713
+ previousCell: e.previousCell
714
+ }), r[n].cells[a] = { ...e.newCell }, he.current = { ...e.newCell }, t.push(be(r[n])), p) for (let e in p) {
688
715
  let t = p[e], i = V.findIndex((t) => t.columnId == e);
689
716
  if (i === -1) continue;
690
717
  let a = {
691
- ...n[r].cells[i],
692
- text: (t == null ? void 0 : t.setCellData) && (t == null ? void 0 : t.setCellData(n[r])),
693
- value: (t == null ? void 0 : t.setCellData) && (t == null ? void 0 : t.setCellData(n[r])),
694
- style: (t == null ? void 0 : t.setCellStyle) && (t == null ? void 0 : t.setCellStyle((t == null ? void 0 : t.setCellData) && (t == null ? void 0 : t.setCellData(n[r])) || n[r]))
718
+ ...r[n].cells[i],
719
+ text: (t == null ? void 0 : t.setCellData) && (t == null ? void 0 : t.setCellData(r[n])),
720
+ value: (t == null ? void 0 : t.setCellData) && (t == null ? void 0 : t.setCellData(r[n])),
721
+ style: (t == null ? void 0 : t.setCellStyle) && (t == null ? void 0 : t.setCellStyle((t == null ? void 0 : t.setCellData) && (t == null ? void 0 : t.setCellData(r[n])) || r[n]))
695
722
  };
696
- n[r].cells[i] = a;
723
+ r[n].cells[i] = a;
697
724
  }
698
- h && h(n[r]);
725
+ h && h(r[n]);
699
726
  }
700
- }), Q.current = n, X(he), B(n), Z(), _) try {
727
+ }), Q.current = r, X(_e), B(r), Z(), I && t.length > 0 && I((e) => ie(e, t, O)), _) try {
701
728
  await _(t);
702
729
  } catch (e) {
703
- ie && ie();
730
+ let t = (Q.current || []).map((e) => ({
731
+ ...e,
732
+ cells: [...e.cells]
733
+ }));
734
+ i.forEach(({ rowId: e, columnId: n, previousCell: r }) => {
735
+ let i = t.findIndex((t) => t.rowId == e), a = V.findIndex((e) => e.columnId == n);
736
+ i === -1 || a === -1 || !r || (t[i].cells[a] = { ...r });
737
+ }), Q.current = t, B(t), Z(), I == null || I(n), oe && oe();
704
738
  }
705
- }, xe = i(() => {
739
+ }, Ce = i(() => {
706
740
  let t = {
707
741
  ...v || {},
708
742
  ...y || {},
709
- ...O
743
+ ...D
710
744
  }, n = {};
711
- for (let r in t) n[r] = A((n) => /* @__PURE__ */ w(j, {
745
+ for (let r in t) n[r] = k((n) => /* @__PURE__ */ C(A, {
712
746
  ...n,
713
747
  ...e,
714
748
  Com: t[r]
715
749
  }));
716
750
  return n;
717
- }, [v, y]), Se = (e) => {
751
+ }, [v, y]), we = (e) => {
718
752
  let t = z == null ? void 0 : z.find((t) => {
719
753
  var n;
720
754
  return (t == null ? void 0 : t.rowId) == (e == null || (n = e.cell) == null ? void 0 : n.rowId);
721
755
  });
722
- return /* @__PURE__ */ T("div", {
756
+ return /* @__PURE__ */ w("div", {
723
757
  onPointerDown: (e) => e.stopPropagation(),
724
758
  children: [
725
- (E == null ? void 0 : E.tableActionsSlot) && /* @__PURE__ */ w(E.tableActionsSlot, {
759
+ (T == null ? void 0 : T.tableActionsSlot) && /* @__PURE__ */ C(T.tableActionsSlot, {
726
760
  ...e == null ? void 0 : e.cell,
727
761
  rowData: t
728
762
  }),
729
- (E == null ? void 0 : E.actionPrefixSlot) && /* @__PURE__ */ w(E.actionPrefixSlot, {
763
+ (T == null ? void 0 : T.actionPrefixSlot) && /* @__PURE__ */ C(T.actionPrefixSlot, {
730
764
  ...e == null ? void 0 : e.cell,
731
765
  rowData: t
732
766
  }),
733
- (E == null ? void 0 : E.actionCenterSlot) && /* @__PURE__ */ w(E.actionCenterSlot, {
767
+ (T == null ? void 0 : T.actionCenterSlot) && /* @__PURE__ */ C(T.actionCenterSlot, {
734
768
  ...e == null ? void 0 : e.cell,
735
769
  rowData: t
736
770
  }),
737
- (E == null ? void 0 : E.actionSuffixSlot) && /* @__PURE__ */ w(E.actionSuffixSlot, {
771
+ (T == null ? void 0 : T.actionSuffixSlot) && /* @__PURE__ */ C(T.actionSuffixSlot, {
738
772
  ...e == null ? void 0 : e.cell,
739
773
  rowData: t
740
774
  })
741
775
  ]
742
776
  });
743
777
  };
744
- function Ce(e) {
778
+ function Te(e) {
745
779
  let t = [];
746
780
  function n(e) {
747
781
  for (let r of e) t.push(r), r.children && r.children.length && n(r.children);
748
782
  }
749
783
  return n(e), t;
750
784
  }
751
- let we = (e) => {
785
+ let Ee = (e) => {
752
786
  var t, n, r, i, a, o;
753
- let { record: c, rowId: l } = e == null ? void 0 : e.cell, u = (t = Ce(d)) == null ? void 0 : t.filter((e) => {
787
+ let { record: c, rowId: l } = e == null ? void 0 : e.cell, u = (t = Te(d)) == null ? void 0 : t.filter((e) => {
754
788
  var t;
755
- return !(D != null && (t = D.getCheckboxProps) != null && (t = t.call(D, e)) != null && t.disabled);
756
- }), f = typeof (D == null ? void 0 : D.getCheckboxProps) == "function" ? D == null || (n = D.getCheckboxProps) == null ? void 0 : n.call(D, c) : {};
757
- return /* @__PURE__ */ w(s, {
789
+ return !(E != null && (t = E.getCheckboxProps) != null && (t = t.call(E, e)) != null && t.disabled);
790
+ }), f = typeof (E == null ? void 0 : E.getCheckboxProps) == "function" ? E == null || (n = E.getCheckboxProps) == null ? void 0 : n.call(E, c) : {};
791
+ return /* @__PURE__ */ C(s, {
758
792
  ...e == null ? void 0 : e.componentProps,
759
- checked: (D == null || (r = D.selectedRowKeys) == null ? void 0 : r.includes(c && c[k] || "")) || !l && (D == null || (i = D.selectedRowKeys) == null ? void 0 : i.length) == (u == null ? void 0 : u.length) && (u == null ? void 0 : u.length) > 0,
760
- indeterminate: !l && (D == null || (a = D.selectedRowKeys) == null ? void 0 : a.length) > 0 && (D == null || (o = D.selectedRowKeys) == null ? void 0 : o.length) < (u == null ? void 0 : u.length),
793
+ checked: (E == null || (r = E.selectedRowKeys) == null ? void 0 : r.includes(c && c[O] || "")) || !l && (E == null || (i = E.selectedRowKeys) == null ? void 0 : i.length) == (u == null ? void 0 : u.length) && (u == null ? void 0 : u.length) > 0,
794
+ indeterminate: !l && (E == null || (a = E.selectedRowKeys) == null ? void 0 : a.length) > 0 && (E == null || (o = E.selectedRowKeys) == null ? void 0 : o.length) < (u == null ? void 0 : u.length),
761
795
  onChange: (e) => {
762
796
  if (e.target.checked && l) {
763
- let e = [...D == null ? void 0 : D.selectedRowKeys, c[k]], t = u == null ? void 0 : u.filter((t) => e == null ? void 0 : e.includes(t[k]));
764
- D == null || D.onChange(e, t);
797
+ let e = [...E == null ? void 0 : E.selectedRowKeys, c[O]], t = u == null ? void 0 : u.filter((t) => e == null ? void 0 : e.includes(t[O]));
798
+ E == null || E.onChange(e, t);
765
799
  } else if (!e.target.checked && l) {
766
800
  var t, n;
767
- let e = D == null || (t = D.selectedRowKeys) == null ? void 0 : t.filter((e) => e != c[k]), r = u == null ? void 0 : u.filter((t) => e == null ? void 0 : e.includes(t[k]));
768
- D == null || D.onChange(D == null || (n = D.selectedRowKeys) == null ? void 0 : n.filter((e) => e != c[k]), r);
801
+ let e = E == null || (t = E.selectedRowKeys) == null ? void 0 : t.filter((e) => e != c[O]), r = u == null ? void 0 : u.filter((t) => e == null ? void 0 : e.includes(t[O]));
802
+ E == null || E.onChange(E == null || (n = E.selectedRowKeys) == null ? void 0 : n.filter((e) => e != c[O]), r);
769
803
  } else if (e.target.checked && !l) {
770
- let e = u == null ? void 0 : u.map((e) => e[k]), t = u == null ? void 0 : u.filter((t) => e == null ? void 0 : e.includes(t[k]));
771
- D == null || D.onChange(u == null ? void 0 : u.map((e) => e[k]), t);
772
- } else !e.target.checked && !l && (D == null || D.onChange([], []));
804
+ let e = u == null ? void 0 : u.map((e) => e[O]), t = u == null ? void 0 : u.filter((t) => e == null ? void 0 : e.includes(t[O]));
805
+ E == null || E.onChange(u == null ? void 0 : u.map((e) => e[O]), t);
806
+ } else !e.target.checked && !l && (E == null || E.onChange([], []));
773
807
  },
774
808
  ...f
775
809
  });
776
810
  };
777
811
  n(() => {
778
- if (D) {
812
+ if (E) {
779
813
  var e;
780
- let t = (e = Ce(d)) == null ? void 0 : e.filter((e) => {
814
+ let t = (e = Te(d)) == null ? void 0 : e.filter((e) => {
781
815
  var t;
782
- return !(D != null && (t = D.getCheckboxProps) != null && (t = t.call(D, e)) != null && t.disabled);
783
- }), n = t == null ? void 0 : t.filter((e) => H == null ? void 0 : H.includes(e[k]));
784
- D == null || D.onChange(H, n);
816
+ return !(E != null && (t = E.getCheckboxProps) != null && (t = t.call(E, e)) != null && t.disabled);
817
+ }), n = t == null ? void 0 : t.filter((e) => H == null ? void 0 : H.includes(e[O]));
818
+ E == null || E.onChange(H, n);
785
819
  }
786
820
  }, [H, d]), n(() => {
787
- se([]);
788
- }, [F == null ? void 0 : F.pageNum]);
789
- let Te = i(() => {
821
+ le([]);
822
+ }, [P == null ? void 0 : P.pageNum]);
823
+ let De = i(() => {
790
824
  let e = {};
791
- for (let t in g == null ? void 0 : g.customCellTemplates) e[t] = A(g == null ? void 0 : g.customCellTemplates[t]);
825
+ for (let t in g == null ? void 0 : g.customCellTemplates) e[t] = k(g == null ? void 0 : g.customCellTemplates[t]);
792
826
  return e;
793
- }, [g == null ? void 0 : g.customCellTemplates]), Ee = (e, t) => {
827
+ }, [g == null ? void 0 : g.customCellTemplates]), Oe = (e, t) => {
794
828
  var n;
795
829
  let r = t == null || (n = t.find((t) => (t == null ? void 0 : t.rowId) == (e == null ? void 0 : e.rowId))) == null || (n = n.cells) == null ? void 0 : n.map((t) => ({
796
830
  columnId: t == null ? void 0 : t.columnId,
@@ -798,51 +832,51 @@ function I(e, t) {
798
832
  className: "custom-highlights-row",
799
833
  borderColor: "transparent"
800
834
  }));
801
- q.current = e == null ? void 0 : e.rowId, K(r);
835
+ q.current = e == null ? void 0 : e.rowId, window.gridHighlightRowId = e == null ? void 0 : e.rowId, K(r);
802
836
  };
803
- return /* @__PURE__ */ w(f, {
804
- spinning: I,
805
- children: /* @__PURE__ */ T("div", {
837
+ return /* @__PURE__ */ C(f, {
838
+ spinning: F,
839
+ children: /* @__PURE__ */ w("div", {
806
840
  ref: J,
807
- className: `grid-container ${C}`,
808
- style: S,
809
- children: [/* @__PURE__ */ w(m, {
810
- ref: fe,
841
+ className: `grid-container ${S}`,
842
+ style: x,
843
+ children: [/* @__PURE__ */ C(m, {
844
+ ref: me,
811
845
  rows: z,
812
846
  columns: V,
813
- onCellsChanged: be,
847
+ onCellsChanged: Se,
814
848
  enableFillHandle: !0,
815
849
  enableRangeSelection: !0,
816
850
  horizontalStickyBreakpoint: 120,
817
851
  ...g,
818
- highlights: (c = g == null ? void 0 : g.highlights) == null ? de : c,
852
+ highlights: (c = g == null ? void 0 : g.highlights) == null ? pe : c,
819
853
  onFocusLocationChanging: (e) => {
820
854
  var t, n;
821
855
  let r = (e == null ? void 0 : e.columnId) + (e == null ? void 0 : e.rowId);
822
- return window.gridEditId = r, typeof (e == null ? void 0 : e.rowId) == "string" && (e == null || (t = e.rowId) == null ? void 0 : t.indexOf("header-")) > -1 || (g != null && g.isRowHighlights && e != null && e.columnId && Ee(e, z), (n = [
856
+ return window.gridEditId = r, typeof (e == null ? void 0 : e.rowId) == "string" && (e == null || (t = e.rowId) == null ? void 0 : t.indexOf("header-")) > -1 || (g != null && g.isRowHighlights && e != null && e.columnId && Oe(e, z), (n = [
823
857
  "_$actions",
824
858
  "rowSelection",
825
859
  "ExpandListTemplate"
826
860
  ]) != null && n.includes(e == null ? void 0 : e.columnId)) ? !1 : g != null && g.onFocusLocationChanging ? g == null ? void 0 : g.onFocusLocationChanging(e, z) : e;
827
861
  },
828
862
  customCellTemplates: {
829
- ExpandListTemplate: A(N),
830
- ...xe,
831
- ...Te,
832
- ...le,
833
- _$actions: A(Se),
834
- rowSelection: A(we),
835
- Number: A(M, e)
863
+ ExpandListTemplate: k(M),
864
+ ...Ce,
865
+ ...De,
866
+ ...de,
867
+ _$actions: k(we),
868
+ rowSelection: k(Ee),
869
+ Number: k(j, e)
836
870
  }
837
- }, (d == null ? void 0 : d.length) == 0 ? 0 : 1), (d == null ? void 0 : d.length) <= 0 && /* @__PURE__ */ w("div", {
871
+ }, (d == null ? void 0 : d.length) == 0 ? 0 : 1), (d == null ? void 0 : d.length) <= 0 && /* @__PURE__ */ C("div", {
838
872
  className: "grid-container-empty",
839
- children: /* @__PURE__ */ w(l, { image: l.PRESENTED_IMAGE_SIMPLE })
873
+ children: /* @__PURE__ */ C(l, { image: l.PRESENTED_IMAGE_SIMPLE })
840
874
  })]
841
875
  })
842
876
  });
843
877
  }
844
- var re = e(I);
878
+ var ae = e(F);
845
879
  //#endregion
846
- export { re as default };
880
+ export { ae as default };
847
881
 
848
882
  //# sourceMappingURL=index.js.map