@hzab/edit-table 0.1.12 → 0.1.13-alpha.1
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/CHANGELOG.md +18 -0
- package/dist/common/useDynamicHeight.d.ts +8 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +436 -261
- package/dist/index.js.map +1 -1
- package/dist/project-manifest.json +5 -5
- package/dist/project.json +3 -3
- package/package.json +5 -5
- package/src/Template/GetBaseTemplate.tsx +2 -2
- package/src/common/WidthWrapHoc.tsx +56 -0
- package/src/common/useDynamicHeight.ts +239 -0
- package/src/index.less +20 -2
- package/src/index.tsx +111 -56
package/dist/index.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { forwardRef as e,
|
|
2
|
-
import { Checkbox as
|
|
3
|
-
import { ReactGrid as
|
|
4
|
-
import { antdComponents as
|
|
5
|
-
import { InfoCircleOutlined as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { c as
|
|
8
|
-
import { getVal as
|
|
1
|
+
import { forwardRef as e, useCallback as t, useEffect as n, useImperativeHandle as r, useMemo as i, useRef as a, useState as o } from "react";
|
|
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
|
+
import { ReactGrid as m, getCellProperty as h, isAlphaNumericKey as g, isNavigationKey as _ } from "@silevis/reactgrid";
|
|
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";
|
|
9
9
|
import "@silevis/reactgrid/styles.css";
|
|
10
10
|
//#region src/common/childAntdComponent.ts
|
|
11
|
-
var
|
|
12
|
-
"DatePicker.MonthPicker":
|
|
13
|
-
"DatePicker.QuarterPicker":
|
|
14
|
-
"DatePicker.RangePicker":
|
|
15
|
-
"DatePicker.TimePicker":
|
|
16
|
-
"DatePicker.WeekPicker":
|
|
17
|
-
"DatePicker.YearPicker":
|
|
18
|
-
"Input.Password":
|
|
19
|
-
"Input.Search":
|
|
20
|
-
"Input.TextArea":
|
|
21
|
-
"TimePicker.RangePicker":
|
|
22
|
-
},
|
|
11
|
+
var O = {
|
|
12
|
+
"DatePicker.MonthPicker": c.MonthPicker,
|
|
13
|
+
"DatePicker.QuarterPicker": c.QuarterPicker,
|
|
14
|
+
"DatePicker.RangePicker": c.RangePicker,
|
|
15
|
+
"DatePicker.TimePicker": c.TimePicker,
|
|
16
|
+
"DatePicker.WeekPicker": c.WeekPicker,
|
|
17
|
+
"DatePicker.YearPicker": c.YearPicker,
|
|
18
|
+
"Input.Password": u.Password,
|
|
19
|
+
"Input.Search": u.Search,
|
|
20
|
+
"Input.TextArea": u.TextArea,
|
|
21
|
+
"TimePicker.RangePicker": p.RangePicker
|
|
22
|
+
}, k = [
|
|
23
23
|
"DatePicker",
|
|
24
24
|
"DatePicker.MonthPicker",
|
|
25
25
|
"DatePicker.QuarterPicker",
|
|
@@ -28,18 +28,18 @@ var D = {
|
|
|
28
28
|
"DatePicker.WeekPicker",
|
|
29
29
|
"DatePicker.YearPicker",
|
|
30
30
|
"TimePicker.RangePicker"
|
|
31
|
-
],
|
|
32
|
-
class
|
|
31
|
+
], A = (e, t = {}) => {
|
|
32
|
+
class r {
|
|
33
33
|
getCompatibleCell(e) {
|
|
34
34
|
let t;
|
|
35
35
|
try {
|
|
36
|
-
t =
|
|
36
|
+
t = h(e, "values", "object");
|
|
37
37
|
} catch (e) {
|
|
38
38
|
t = [];
|
|
39
39
|
}
|
|
40
40
|
let n = e.selectedValue ? parseFloat(e.selectedValue) : NaN, r = !0;
|
|
41
41
|
try {
|
|
42
|
-
r =
|
|
42
|
+
r = h(e, "isDisabled", "boolean");
|
|
43
43
|
} catch (e) {
|
|
44
44
|
r = !1;
|
|
45
45
|
}
|
|
@@ -69,30 +69,59 @@ var D = {
|
|
|
69
69
|
enableEditMode: !1
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
|
-
render(
|
|
72
|
+
render(r, s, c) {
|
|
73
73
|
var l;
|
|
74
|
-
let [
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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 t = Array.from(e.children);
|
|
76
|
+
if (t.length === 0) return e.clientHeight;
|
|
77
|
+
let n = Infinity, r = -Infinity;
|
|
78
|
+
for (let e of t) {
|
|
79
|
+
let t = e.getBoundingClientRect(), i = getComputedStyle(e), a = parseFloat(i.marginTop) || 0, o = parseFloat(i.marginBottom) || 0;
|
|
80
|
+
n = Math.min(n, t.top - a), r = Math.max(r, t.bottom + o);
|
|
81
|
+
}
|
|
82
|
+
return Math.max(0, Math.ceil(r - n));
|
|
83
|
+
};
|
|
84
|
+
n(() => {
|
|
85
|
+
let e = D.current, t = r == null ? void 0 : r.onRowHeightChange;
|
|
86
|
+
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
|
+
let n = e.firstElementChild, i = n || e;
|
|
88
|
+
if (O.current === null) {
|
|
89
|
+
let t = getComputedStyle(e);
|
|
90
|
+
O.current = (parseFloat(t.paddingTop) || 0) + (parseFloat(t.paddingBottom) || 0);
|
|
91
|
+
}
|
|
92
|
+
let a = n ? O.current : 0, o = new ResizeObserver(() => {
|
|
93
|
+
Array.from(i.children).forEach((e) => o.observe(e));
|
|
94
|
+
let e = A(i) + a;
|
|
95
|
+
t(r == null ? void 0 : r.rowId, e, r == null ? void 0 : r.columnId);
|
|
96
|
+
});
|
|
97
|
+
return o.observe(i), Array.from(i.children).forEach((e) => o.observe(e)), () => o.disconnect();
|
|
98
|
+
}, [
|
|
99
|
+
r == null ? void 0 : r.rowId,
|
|
100
|
+
r == null ? void 0 : r.columnId,
|
|
101
|
+
r == null ? void 0 : r.onRowHeightChange,
|
|
102
|
+
u,
|
|
103
|
+
v
|
|
104
|
+
]), n(() => {
|
|
105
|
+
y(r == null ? void 0 : r.text), C.current = r == null ? void 0 : r.text;
|
|
106
|
+
}, [r == null ? void 0 : r.text]), n(() => {
|
|
78
107
|
function e(e) {
|
|
79
|
-
window.gridEditId !=
|
|
108
|
+
window.gridEditId != h && f(!1);
|
|
80
109
|
}
|
|
81
110
|
return document.addEventListener("click", e), () => {
|
|
82
111
|
document.removeEventListener("click", e);
|
|
83
112
|
};
|
|
84
113
|
}, []);
|
|
85
|
-
let
|
|
114
|
+
let j = (e) => {
|
|
86
115
|
var t;
|
|
87
|
-
let n = !1,
|
|
88
|
-
for (let t of (
|
|
89
|
-
var
|
|
90
|
-
t != null && (
|
|
116
|
+
let n = !1, i = !1;
|
|
117
|
+
for (let t of (r == null ? void 0 : r.validatorList) || []) {
|
|
118
|
+
var a;
|
|
119
|
+
t != null && (a = t.pattern) != null && a.test(e) && (n = !0);
|
|
91
120
|
break;
|
|
92
121
|
}
|
|
93
|
-
|
|
122
|
+
i = !n && Array.isArray(r == null ? void 0 : r.validatorList) && (r == null || (t = r.validatorList) == null ? void 0 : t.length) > 0, S(i);
|
|
94
123
|
};
|
|
95
|
-
|
|
124
|
+
n(() => {
|
|
96
125
|
if (!p) return;
|
|
97
126
|
let e = setTimeout(() => {
|
|
98
127
|
let e = document.querySelector(".ant-picker-dropdown");
|
|
@@ -106,30 +135,31 @@ var D = {
|
|
|
106
135
|
}, 0);
|
|
107
136
|
return () => clearTimeout(e);
|
|
108
137
|
}, [p]);
|
|
109
|
-
let
|
|
110
|
-
let e =
|
|
138
|
+
let M = () => {
|
|
139
|
+
let e = C.current;
|
|
111
140
|
c(this.getCompatibleCell({
|
|
112
|
-
...
|
|
141
|
+
...r,
|
|
113
142
|
text: e,
|
|
114
143
|
selectedValue: e
|
|
115
144
|
}), !0);
|
|
116
|
-
},
|
|
145
|
+
}, N = i(() => k != null && k.includes(r == null ? void 0 : r.type) ? {
|
|
117
146
|
open: p,
|
|
118
147
|
onOpenChange: (e) => {
|
|
119
148
|
E.current && clearTimeout(E.current), E.current = setTimeout(() => {
|
|
120
149
|
m(e);
|
|
121
150
|
}, 80);
|
|
122
151
|
}
|
|
123
|
-
} : {}, [
|
|
124
|
-
return
|
|
125
|
-
!
|
|
126
|
-
}, [
|
|
127
|
-
|
|
152
|
+
} : {}, [r]);
|
|
153
|
+
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,
|
|
157
|
+
className: `base-hoc ${u ? "base-hoc-edit" : ""}`,
|
|
128
158
|
onDoubleClick: (e) => {
|
|
129
|
-
|
|
159
|
+
r != null && r.nonEditable || (r.type === "Upload" && (window.uploadEdit = h), f(!0));
|
|
130
160
|
},
|
|
131
|
-
children: [/* @__PURE__ */
|
|
132
|
-
...
|
|
161
|
+
children: [/* @__PURE__ */ w(e, {
|
|
162
|
+
...t,
|
|
133
163
|
onPointerDown: (e) => e.stopPropagation(),
|
|
134
164
|
componentProps: {
|
|
135
165
|
style: {
|
|
@@ -138,67 +168,67 @@ var D = {
|
|
|
138
168
|
alignItems: "center"
|
|
139
169
|
},
|
|
140
170
|
value: v,
|
|
141
|
-
options:
|
|
171
|
+
options: r.values,
|
|
142
172
|
onChange: (e) => {
|
|
143
173
|
var t, n;
|
|
144
174
|
let r = (t = e == null || (n = e.target) == null ? void 0 : n.value) == null ? e : t;
|
|
145
|
-
|
|
175
|
+
y(r), C.current = r, j(r);
|
|
146
176
|
},
|
|
147
177
|
onBlur: (e) => {
|
|
148
|
-
|
|
178
|
+
M(), k != null && k.includes(r == null ? void 0 : r.type) || f(!1);
|
|
149
179
|
},
|
|
150
180
|
onPointerDown: (e) => {
|
|
151
181
|
e.stopPropagation();
|
|
152
182
|
},
|
|
153
183
|
onKeyDown: (e) => {
|
|
154
|
-
(
|
|
184
|
+
(g(e.keyCode) || _(e.keyCode)) && e.stopPropagation();
|
|
155
185
|
},
|
|
156
|
-
...
|
|
157
|
-
...(
|
|
186
|
+
...N,
|
|
187
|
+
...(r == null ? void 0 : r.getField) && (r == null ? void 0 : r.getField()["x-component-props"]) || {}
|
|
158
188
|
},
|
|
159
|
-
pattern:
|
|
160
|
-
cell:
|
|
161
|
-
}), x && /* @__PURE__ */
|
|
162
|
-
content: (l =
|
|
163
|
-
children: /* @__PURE__ */
|
|
189
|
+
pattern: u ? "" : "readPretty",
|
|
190
|
+
cell: r
|
|
191
|
+
}), x && /* @__PURE__ */ w(d, {
|
|
192
|
+
content: (l = r == null ? void 0 : r.validatorMessage) == null ? "该字段不合法" : l,
|
|
193
|
+
children: /* @__PURE__ */ w(b, { className: "validator-icon" })
|
|
164
194
|
})]
|
|
165
195
|
});
|
|
166
196
|
}
|
|
167
197
|
}
|
|
168
|
-
return new
|
|
169
|
-
},
|
|
170
|
-
let { pattern: t, cell: n, componentProps:
|
|
198
|
+
return new r();
|
|
199
|
+
}, j = (e) => {
|
|
200
|
+
let { pattern: t, cell: n, componentProps: r, Com: a, cellRender: o } = e, s = i(() => {
|
|
171
201
|
var e;
|
|
172
|
-
if (n != null && n.getField) return
|
|
202
|
+
if (n != null && n.getField) return D({
|
|
173
203
|
...(n == null ? void 0 : n.getField) && (n == null ? void 0 : n.getField()),
|
|
174
204
|
enum: (n == null || (e = n.getField()) == null ? void 0 : e.enum) || (n == null ? void 0 : n.values)
|
|
175
205
|
}, { [(n == null ? void 0 : n.getField) && (n == null ? void 0 : n.getField().name)]: n.text });
|
|
176
206
|
}, [n]);
|
|
177
|
-
return o && o(e) ? /* @__PURE__ */
|
|
178
|
-
className: "base-hoc",
|
|
179
|
-
children: t == "readPretty" ? /* @__PURE__ */
|
|
207
|
+
return o && o(e) ? /* @__PURE__ */ w(o, { ...e }) : /* @__PURE__ */ w("div", {
|
|
208
|
+
className: "base-hoc-inner",
|
|
209
|
+
children: t == "readPretty" ? /* @__PURE__ */ w("div", { children: s }) : /* @__PURE__ */ w(a, {
|
|
180
210
|
className: "rg-input",
|
|
181
211
|
ref: (e) => {
|
|
182
|
-
e && e.focus();
|
|
212
|
+
e && e.focus({ preventScroll: !0 });
|
|
183
213
|
},
|
|
184
|
-
...
|
|
214
|
+
...r
|
|
185
215
|
})
|
|
186
216
|
});
|
|
187
|
-
},
|
|
188
|
-
let t =
|
|
217
|
+
}, M = (e) => {
|
|
218
|
+
let t = E(5), n = e == null ? void 0 : e.componentProps, r;
|
|
189
219
|
t[0] === n ? r = t[1] : (r = {
|
|
190
220
|
...n,
|
|
191
221
|
type: "number"
|
|
192
222
|
}, t[0] = n, t[1] = r);
|
|
193
223
|
let i;
|
|
194
|
-
return t[2] !== e || t[3] !== r ? (i = /* @__PURE__ */
|
|
224
|
+
return t[2] !== e || t[3] !== r ? (i = /* @__PURE__ */ w(j, {
|
|
195
225
|
...e,
|
|
196
226
|
componentProps: r,
|
|
197
|
-
Com:
|
|
227
|
+
Com: u
|
|
198
228
|
}), t[2] = e, t[3] = r, t[4] = i) : i = t[4], i;
|
|
199
|
-
},
|
|
200
|
-
let
|
|
201
|
-
|
|
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;
|
|
231
|
+
t[0] !== l || t[1] !== s || t[2] !== c ? (f = (e) => {
|
|
202
232
|
c((t) => {
|
|
203
233
|
var n;
|
|
204
234
|
let r = [...t], i = l == null || (n = l.children) == null ? void 0 : n.map((e) => e == null ? void 0 : e[s]);
|
|
@@ -208,36 +238,36 @@ var D = {
|
|
|
208
238
|
}
|
|
209
239
|
return t == null ? void 0 : t.filter((e) => !(i != null && i.includes(e == null ? void 0 : e[s])));
|
|
210
240
|
});
|
|
211
|
-
},
|
|
241
|
+
}, t[0] = l, t[1] = s, t[2] = c, t[3] = f) : f = t[3];
|
|
212
242
|
let p = f, m;
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
},
|
|
243
|
+
t[4] !== a || t[5] !== p || t[6] !== l || t[7] !== s ? (m = () => {
|
|
244
|
+
a != null && a.includes(l == null ? void 0 : l[s]) && (d(!0), p(!0));
|
|
245
|
+
}, t[4] = a, t[5] = p, t[6] = l, t[7] = s, t[8] = m) : m = t[8];
|
|
216
246
|
let h = r == null ? void 0 : r.record, g;
|
|
217
|
-
|
|
247
|
+
t[9] === h ? g = t[10] : (g = [h], t[9] = h, t[10] = g), n(m, g);
|
|
218
248
|
let _;
|
|
219
|
-
|
|
249
|
+
t[11] !== u || t[12] !== p || t[13] !== l || t[14] !== s || t[15] !== i ? (_ = () => {
|
|
220
250
|
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);
|
|
221
|
-
},
|
|
251
|
+
}, t[11] = u, t[12] = p, t[13] = l, t[14] = s, t[15] = i, t[16] = _) : _ = t[16];
|
|
222
252
|
let v = _, y;
|
|
223
|
-
return
|
|
253
|
+
return t[17] !== u || t[18] !== v || t[19] !== (l == null ? void 0 : l.children) ? (y = /* @__PURE__ */ w("div", {
|
|
224
254
|
className: "expandList-template",
|
|
225
|
-
children: l != null && l.children ? /* @__PURE__ */ C
|
|
255
|
+
children: l != null && l.children ? /* @__PURE__ */ w(C, { children: w(u ? x : S, {
|
|
226
256
|
className: "expandList-template-icon",
|
|
227
257
|
onClick: v
|
|
228
|
-
}) }) : /* @__PURE__ */
|
|
229
|
-
}),
|
|
258
|
+
}) }) : /* @__PURE__ */ w("div", { style: { width: 14 } })
|
|
259
|
+
}), t[17] = u, t[18] = v, t[19] = l == null ? void 0 : l.children, t[20] = y) : y = t[20], y;
|
|
230
260
|
};
|
|
231
261
|
//#endregion
|
|
232
262
|
//#region src/common/utils.ts
|
|
233
|
-
function
|
|
263
|
+
function P(e) {
|
|
234
264
|
return typeof e == "object" && !!e;
|
|
235
265
|
}
|
|
236
|
-
var
|
|
266
|
+
var F = (e) => {
|
|
237
267
|
var t;
|
|
238
|
-
return typeof (e == null ? void 0 : e.title) == "function" ?
|
|
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) || "";
|
|
239
269
|
};
|
|
240
|
-
function
|
|
270
|
+
function ee(e, t = 40) {
|
|
241
271
|
let n = (e) => e.reduce((e, t) => {
|
|
242
272
|
var r;
|
|
243
273
|
return (r = t.children) != null && r.length ? [...e, ...n(t.children)] : [...e, t];
|
|
@@ -268,14 +298,14 @@ function ne(e, t = 40) {
|
|
|
268
298
|
cells: []
|
|
269
299
|
})), u = (e) => {
|
|
270
300
|
var t;
|
|
271
|
-
return (t = ["rowSelection", "ExpandListTemplate"]) != null && t.includes(e == null ? void 0 : e.type) ? e == null ? void 0 : e.type :
|
|
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";
|
|
272
302
|
}, d = (e, t = 0) => {
|
|
273
303
|
e.forEach((e) => {
|
|
274
304
|
if (e._isLeaf) {
|
|
275
305
|
let n = {
|
|
276
306
|
...e,
|
|
277
307
|
type: u(e),
|
|
278
|
-
text:
|
|
308
|
+
text: F(e),
|
|
279
309
|
dataIndex: e.dataIndex,
|
|
280
310
|
width: e.width,
|
|
281
311
|
rowspan: e.rowspan,
|
|
@@ -289,7 +319,7 @@ function ne(e, t = 40) {
|
|
|
289
319
|
} else l[t].cells.push({
|
|
290
320
|
...e,
|
|
291
321
|
type: u(e),
|
|
292
|
-
text:
|
|
322
|
+
text: F(e),
|
|
293
323
|
colspan: e.colspan,
|
|
294
324
|
style: e != null && e.style ? e == null ? void 0 : e.style : {
|
|
295
325
|
background: "rgba(128, 128, 128, 0.1)",
|
|
@@ -308,7 +338,7 @@ function ne(e, t = 40) {
|
|
|
308
338
|
n.push({
|
|
309
339
|
...e,
|
|
310
340
|
type: u(e),
|
|
311
|
-
text:
|
|
341
|
+
text: F(e),
|
|
312
342
|
dataIndex: e.dataIndex,
|
|
313
343
|
width: e.width,
|
|
314
344
|
rowspan: t === a - 1 ? 1 : void 0,
|
|
@@ -339,7 +369,7 @@ function ne(e, t = 40) {
|
|
|
339
369
|
n ? p.push(n) : p.push({
|
|
340
370
|
...e,
|
|
341
371
|
type: u(e),
|
|
342
|
-
text:
|
|
372
|
+
text: F(e),
|
|
343
373
|
dataIndex: e.dataIndex,
|
|
344
374
|
width: e.width,
|
|
345
375
|
rowspan: 1,
|
|
@@ -356,7 +386,7 @@ function ne(e, t = 40) {
|
|
|
356
386
|
});
|
|
357
387
|
}), l;
|
|
358
388
|
}
|
|
359
|
-
function
|
|
389
|
+
function te(e) {
|
|
360
390
|
let t = [];
|
|
361
391
|
function n(e) {
|
|
362
392
|
e.forEach((e) => {
|
|
@@ -379,23 +409,174 @@ function re(e) {
|
|
|
379
409
|
return n(e), t;
|
|
380
410
|
}
|
|
381
411
|
//#endregion
|
|
412
|
+
//#region src/common/useDynamicHeight.ts
|
|
413
|
+
var ne = (e) => {
|
|
414
|
+
let { wrapRef: r, rowHeight: i, setRows: s } = e, c = a({}), l = a(), u = a({
|
|
415
|
+
top: 0,
|
|
416
|
+
left: 0
|
|
417
|
+
}), d = a(0), f = a([]), [p, m] = o({}), h = t((e = 500) => {
|
|
418
|
+
let t = r.current;
|
|
419
|
+
t && (u.current = {
|
|
420
|
+
top: t.scrollTop,
|
|
421
|
+
left: t.scrollLeft
|
|
422
|
+
}, d.current = Math.max(d.current || 0, Date.now() + e));
|
|
423
|
+
}, []), g = t(() => {
|
|
424
|
+
let e = r.current;
|
|
425
|
+
if (!e) return;
|
|
426
|
+
let { top: t, left: n } = u.current;
|
|
427
|
+
requestAnimationFrame(() => {
|
|
428
|
+
requestAnimationFrame(() => {
|
|
429
|
+
e.scrollTop !== t && (e.scrollTop = t), e.scrollLeft !== n && (e.scrollLeft = n);
|
|
430
|
+
});
|
|
431
|
+
});
|
|
432
|
+
}, []);
|
|
433
|
+
n(() => {
|
|
434
|
+
let e = r.current;
|
|
435
|
+
if (!e) return;
|
|
436
|
+
let t = () => {
|
|
437
|
+
e.querySelectorAll(".rg-hidden-element").forEach((e) => {
|
|
438
|
+
if (e.__focusScrollPatched) return;
|
|
439
|
+
e.__focusScrollPatched = !0;
|
|
440
|
+
let t = e.focus.bind(e);
|
|
441
|
+
e.focus = (e) => t({
|
|
442
|
+
preventScroll: !0,
|
|
443
|
+
...e || {}
|
|
444
|
+
});
|
|
445
|
+
});
|
|
446
|
+
};
|
|
447
|
+
t();
|
|
448
|
+
let n = new MutationObserver(t);
|
|
449
|
+
return n.observe(e, {
|
|
450
|
+
childList: !0,
|
|
451
|
+
subtree: !0
|
|
452
|
+
}), () => n.disconnect();
|
|
453
|
+
}, []), n(() => {
|
|
454
|
+
let e = r.current;
|
|
455
|
+
if (!e || e.__scrollGuard) return;
|
|
456
|
+
e.__scrollGuard = !0;
|
|
457
|
+
let t = Object.getOwnPropertyDescriptor(Element.prototype, "scrollTop");
|
|
458
|
+
Object.defineProperty(e, "scrollTop", {
|
|
459
|
+
configurable: !0,
|
|
460
|
+
get() {
|
|
461
|
+
return t.get.call(e);
|
|
462
|
+
},
|
|
463
|
+
set(n) {
|
|
464
|
+
let r = Number(n) || 0, i = t.get.call(e), a = r - i;
|
|
465
|
+
a !== 0 && Math.abs(a) <= 3 || (r === 0 && i > 50 && console.warn("[CellEditTable] 检测到程序化滚动回顶部: ", i, "->", r, (/* @__PURE__ */ Error()).stack), t.set.call(e, r));
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
let n = e.scrollTo.bind(e);
|
|
469
|
+
e.scrollTo = (r, i) => {
|
|
470
|
+
if (typeof r == "object" && r) {
|
|
471
|
+
if (r.top != null) {
|
|
472
|
+
let n = t.get.call(e), i = Number(r.top) - n;
|
|
473
|
+
if (i !== 0 && Math.abs(i) <= 3) return;
|
|
474
|
+
}
|
|
475
|
+
return n(r);
|
|
476
|
+
}
|
|
477
|
+
if (typeof r == "number" && typeof i == "number") {
|
|
478
|
+
let n = i - t.get.call(e);
|
|
479
|
+
if (n !== 0 && Math.abs(n) <= 3) return;
|
|
480
|
+
}
|
|
481
|
+
return n(r, i);
|
|
482
|
+
};
|
|
483
|
+
let i = e.scrollBy.bind(e);
|
|
484
|
+
e.scrollBy = (e, t) => {
|
|
485
|
+
if (typeof e == "object" && e) return e.top != null && Math.abs(Number(e.top)) <= 3 ? void 0 : i(e);
|
|
486
|
+
if (!(typeof e == "number" && typeof t == "number" && Math.abs(t) <= 3)) return i(e, t);
|
|
487
|
+
};
|
|
488
|
+
}, []), n(() => {
|
|
489
|
+
let e = r.current;
|
|
490
|
+
if (!e) return;
|
|
491
|
+
let t = () => {
|
|
492
|
+
if (Date.now() < d.current && (e.scrollTop === 0 && u.current.top > 50 || e.scrollLeft === 0 && u.current.left > 50)) {
|
|
493
|
+
e.scrollTop = u.current.top, e.scrollLeft = u.current.left;
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
u.current = {
|
|
497
|
+
top: e.scrollTop,
|
|
498
|
+
left: e.scrollLeft
|
|
499
|
+
};
|
|
500
|
+
};
|
|
501
|
+
return e.addEventListener("scroll", t, !0), () => e.removeEventListener("scroll", t, !0);
|
|
502
|
+
}, []);
|
|
503
|
+
let _ = t(() => {
|
|
504
|
+
l.current = void 0;
|
|
505
|
+
let e = c.current;
|
|
506
|
+
Object.keys(e).length !== 0 && (c.current = {}, m((t) => {
|
|
507
|
+
let n = t;
|
|
508
|
+
for (let r in e) {
|
|
509
|
+
let i = { ...n[r] || {} }, a = !1;
|
|
510
|
+
for (let t in e[r]) {
|
|
511
|
+
let n = e[r][t];
|
|
512
|
+
i[t] !== n && (i[t] = n, a = !0);
|
|
513
|
+
}
|
|
514
|
+
a && (n === t && (n = { ...t }), n[r] = i);
|
|
515
|
+
}
|
|
516
|
+
return n === t ? t : n;
|
|
517
|
+
}));
|
|
518
|
+
}, []), v = t((e, t, n) => {
|
|
519
|
+
let r = Math.max(Number(t) || 0, i), a = String(e), o = n || "_", s = c.current[a] = c.current[a] || {};
|
|
520
|
+
s[o] !== r && (s[o] = r, l.current || (l.current = requestAnimationFrame(_)));
|
|
521
|
+
}, [i, _]);
|
|
522
|
+
return n(() => () => {
|
|
523
|
+
l.current && cancelAnimationFrame(l.current);
|
|
524
|
+
}, []), n(() => {
|
|
525
|
+
s((e) => {
|
|
526
|
+
if (!Array.isArray(e) || e.length === 0) return e;
|
|
527
|
+
let t = !1, n = e.map((e) => {
|
|
528
|
+
if (typeof (e == null ? void 0 : e.rowId) == "string" && e.rowId.indexOf("header-") === 0) return e;
|
|
529
|
+
let n = p[e.rowId], r = n && Object.keys(n).length > 0 ? Math.max(i, ...Object.values(n).map(Number)) : i;
|
|
530
|
+
return e.height === r ? e : (t = !0, {
|
|
531
|
+
...e,
|
|
532
|
+
height: r
|
|
533
|
+
});
|
|
534
|
+
}), r = t ? n : e;
|
|
535
|
+
return f.current = r, r;
|
|
536
|
+
});
|
|
537
|
+
}, [p, i]), {
|
|
538
|
+
handleRowHeightChange: v,
|
|
539
|
+
armScrollProtect: h,
|
|
540
|
+
restoreScroll: g,
|
|
541
|
+
SCROLL_RESET_GUARD_MS: 3e3,
|
|
542
|
+
rowsRef: f,
|
|
543
|
+
rowHeights: p
|
|
544
|
+
};
|
|
545
|
+
};
|
|
546
|
+
//#endregion
|
|
382
547
|
//#region src/index.tsx
|
|
383
|
-
function
|
|
384
|
-
var
|
|
385
|
-
let { columns: u, dataSource:
|
|
386
|
-
|
|
387
|
-
let
|
|
548
|
+
function I(e, t) {
|
|
549
|
+
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([]);
|
|
551
|
+
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([]);
|
|
553
|
+
Y.current = G;
|
|
554
|
+
let { handleRowHeightChange: me, armScrollProtect: X, restoreScroll: Z, SCROLL_RESET_GUARD_MS: he, rowsRef: Q, rowHeights: ge } = ne({
|
|
555
|
+
wrapRef: J,
|
|
556
|
+
rowHeight: x,
|
|
557
|
+
setRows: B
|
|
558
|
+
});
|
|
559
|
+
r(t, () => ({ rows: z }));
|
|
560
|
+
let $ = (e, t = 0) => {
|
|
388
561
|
e == null || e.forEach((e) => {
|
|
389
|
-
e.level = t + 1, e != null && e.children &&
|
|
562
|
+
e.level = t + 1, e != null && e.children && $(e == null ? void 0 : e.children, e.level);
|
|
390
563
|
});
|
|
391
564
|
};
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
565
|
+
n(() => {
|
|
566
|
+
$(d), W(((e) => {
|
|
567
|
+
let t = [], n = (e) => {
|
|
568
|
+
for (let a of e || []) {
|
|
569
|
+
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);
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
return n(e), t;
|
|
574
|
+
})(d));
|
|
575
|
+
}, [d]), n(() => {
|
|
576
|
+
let e = z.map((e) => e.rowId);
|
|
396
577
|
e != null && e.includes(q.current) || K([]);
|
|
397
|
-
}, [
|
|
398
|
-
let
|
|
578
|
+
}, [z]);
|
|
579
|
+
let _e = (e) => {
|
|
399
580
|
var t, n;
|
|
400
581
|
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 };
|
|
401
582
|
return e == null || (n = e.cells) == null || n.forEach((e) => {
|
|
@@ -405,218 +586,211 @@ function N(e, s) {
|
|
|
405
586
|
...a
|
|
406
587
|
};
|
|
407
588
|
};
|
|
408
|
-
|
|
589
|
+
n(() => {
|
|
409
590
|
if (Array.isArray(u) && (u == null ? void 0 : u.length) > 0) {
|
|
410
|
-
|
|
591
|
+
re && u.unshift({
|
|
411
592
|
type: "ExpandListTemplate",
|
|
412
593
|
width: 14,
|
|
413
594
|
key: "ExpandListTemplate",
|
|
414
595
|
nonEditable: !0,
|
|
415
|
-
style: (
|
|
416
|
-
}),
|
|
596
|
+
style: (D == null ? void 0 : D.style) || { background: "rgba(128, 128, 128, 0.1)" }
|
|
597
|
+
}), D && u.unshift({
|
|
417
598
|
type: "rowSelection",
|
|
418
599
|
nonEditable: !0,
|
|
419
|
-
width: (
|
|
600
|
+
width: (D == null ? void 0 : D.width) || 30,
|
|
420
601
|
key: "rowSelection",
|
|
421
|
-
style: (
|
|
602
|
+
style: (D == null ? void 0 : D.style) || {
|
|
422
603
|
background: "rgba(128, 128, 128, 0.1)",
|
|
423
604
|
display: "flex",
|
|
424
605
|
justifyContent: "center"
|
|
425
606
|
}
|
|
426
|
-
}), ae(
|
|
427
|
-
let e =
|
|
607
|
+
}), ae(ee(u, b));
|
|
608
|
+
let e = te(u);
|
|
428
609
|
oe(e == null ? void 0 : e.map((e, t) => ({
|
|
429
610
|
...e,
|
|
430
611
|
columnId: (e == null ? void 0 : e.dataIndex) || (e == null ? void 0 : e.key) || (e == null ? void 0 : e.name) || ""
|
|
431
612
|
})));
|
|
432
613
|
}
|
|
433
|
-
}, [u,
|
|
434
|
-
let
|
|
614
|
+
}, [u, D]);
|
|
615
|
+
let ve = {}, ye = (e) => {
|
|
435
616
|
e == null || e.forEach((e) => {
|
|
436
|
-
if (
|
|
617
|
+
if (P(typeof (e == null ? void 0 : e.title) == "function" ? e == null ? void 0 : e.title() : null)) {
|
|
437
618
|
let t = e == null ? void 0 : e.title;
|
|
438
|
-
|
|
619
|
+
ve[e == null ? void 0 : e.dataIndex] = A(t);
|
|
439
620
|
}
|
|
440
|
-
e != null && e.children &&
|
|
621
|
+
e != null && e.children && ye(e == null ? void 0 : e.children);
|
|
441
622
|
});
|
|
442
623
|
};
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
}, [u]),
|
|
446
|
-
let e = V == null ? void 0 : V.map((e) => e == null ? void 0 : e.columnId), t = U == null ? void 0 : U.map((t, n) =>
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
624
|
+
n(() => {
|
|
625
|
+
ye(u), ue(ve);
|
|
626
|
+
}, [u]), n(() => {
|
|
627
|
+
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;
|
|
629
|
+
return {
|
|
630
|
+
rowId: t[k],
|
|
631
|
+
height: i,
|
|
632
|
+
cells: e == null ? void 0 : e.map((e, r) => {
|
|
633
|
+
var i;
|
|
634
|
+
let a = {}, o = V[r], s = t[e], c = (i = o == null ? void 0 : o.type) == null ? "text" : i;
|
|
635
|
+
if (p) {
|
|
636
|
+
for (let n in p) if (n == e) {
|
|
637
|
+
let e = p[n];
|
|
638
|
+
a = {
|
|
639
|
+
text: (e == null ? void 0 : e.setCellData) && (e == null ? void 0 : e.setCellData(t)),
|
|
640
|
+
value: (e == null ? void 0 : e.setCellData) && (e == null ? void 0 : e.setCellData(t)),
|
|
641
|
+
style: (e == null ? void 0 : e.setCellStyle) && (e == null ? void 0 : e.setCellStyle((e == null ? void 0 : e.setCellData) && (e == null ? void 0 : e.setCellData(t)) || t))
|
|
642
|
+
};
|
|
643
|
+
}
|
|
460
644
|
}
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
645
|
+
return {
|
|
646
|
+
...o,
|
|
647
|
+
record: t,
|
|
648
|
+
rowId: t[k] || (o == null ? void 0 : o.type),
|
|
649
|
+
type: c,
|
|
650
|
+
nonEditable: (o == null ? void 0 : o.pattern) == "readPretty" ? !0 : o == null ? void 0 : o.nonEditable,
|
|
651
|
+
text: String(s || ""),
|
|
652
|
+
value: s,
|
|
653
|
+
selectedValue: s || "",
|
|
654
|
+
style: (o == null ? void 0 : o.type) == "rowSelection" ? {
|
|
655
|
+
display: "flex",
|
|
656
|
+
justifyContent: "center"
|
|
657
|
+
} : {},
|
|
658
|
+
...L && L(t, n, r) || {},
|
|
659
|
+
...(o == null ? void 0 : o.onCell) && (o == null ? void 0 : o.onCell(t, n, r)) || {},
|
|
660
|
+
...(o == null ? void 0 : o.cellProps) || {},
|
|
661
|
+
setNewDataSource: W,
|
|
662
|
+
setExpandKeys: ce,
|
|
663
|
+
rowKey: k,
|
|
664
|
+
expandKeys: G,
|
|
665
|
+
Slots: E,
|
|
666
|
+
onRowHeightChange: me,
|
|
667
|
+
...a
|
|
668
|
+
};
|
|
669
|
+
})
|
|
670
|
+
};
|
|
671
|
+
}), n = [...R, ...t];
|
|
672
|
+
Q.current = n, X(), B(n), Z();
|
|
488
673
|
}, [
|
|
489
674
|
U,
|
|
490
675
|
V,
|
|
491
|
-
|
|
492
|
-
])
|
|
493
|
-
|
|
494
|
-
var e;
|
|
495
|
-
let t = R == null ? void 0 : R.find((e) => {
|
|
496
|
-
var t;
|
|
497
|
-
return (e == null ? void 0 : e.rowId) == ((t = J.current) == null ? void 0 : t.rowId);
|
|
498
|
-
});
|
|
499
|
-
t == null || (e = t.cells) == null || e.find((e) => {
|
|
500
|
-
var t;
|
|
501
|
-
return (e == null ? void 0 : e.columnId) == ((t = J.current) == null ? void 0 : t.columnId);
|
|
502
|
-
}), { ...J.current }, B.current = R;
|
|
503
|
-
}
|
|
504
|
-
}, [P, R]);
|
|
505
|
-
let me = async (e) => {
|
|
506
|
-
let t = [];
|
|
676
|
+
R
|
|
677
|
+
]);
|
|
678
|
+
let be = async (e) => {
|
|
507
679
|
if (!Array.isArray(e) || e.length === 0) return;
|
|
508
|
-
let n =
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
680
|
+
let t = [], n = (Q.current || []).map((e) => ({
|
|
681
|
+
...e,
|
|
682
|
+
cells: [...e.cells]
|
|
683
|
+
}));
|
|
684
|
+
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) {
|
|
688
|
+
let t = p[e], i = V.findIndex((t) => t.columnId == e);
|
|
689
|
+
if (i === -1) continue;
|
|
690
|
+
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]))
|
|
695
|
+
};
|
|
696
|
+
n[r].cells[i] = a;
|
|
697
|
+
}
|
|
698
|
+
h && h(n[r]);
|
|
524
699
|
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
y && await y(t);
|
|
700
|
+
}), Q.current = n, X(he), B(n), Z(), _) try {
|
|
701
|
+
await _(t);
|
|
528
702
|
} catch (e) {
|
|
529
|
-
|
|
703
|
+
ie && ie();
|
|
530
704
|
}
|
|
531
|
-
},
|
|
705
|
+
}, xe = i(() => {
|
|
532
706
|
let t = {
|
|
533
|
-
..._ || {},
|
|
534
707
|
...v || {},
|
|
535
|
-
...
|
|
708
|
+
...y || {},
|
|
709
|
+
...O
|
|
536
710
|
}, n = {};
|
|
537
|
-
for (let r in t) n[r] =
|
|
711
|
+
for (let r in t) n[r] = A((n) => /* @__PURE__ */ w(j, {
|
|
538
712
|
...n,
|
|
539
713
|
...e,
|
|
540
714
|
Com: t[r]
|
|
541
715
|
}));
|
|
542
716
|
return n;
|
|
543
|
-
}, [
|
|
544
|
-
let t =
|
|
717
|
+
}, [v, y]), Se = (e) => {
|
|
718
|
+
let t = z == null ? void 0 : z.find((t) => {
|
|
545
719
|
var n;
|
|
546
720
|
return (t == null ? void 0 : t.rowId) == (e == null || (n = e.cell) == null ? void 0 : n.rowId);
|
|
547
721
|
});
|
|
548
|
-
return /* @__PURE__ */
|
|
722
|
+
return /* @__PURE__ */ T("div", {
|
|
549
723
|
onPointerDown: (e) => e.stopPropagation(),
|
|
550
724
|
children: [
|
|
551
|
-
(E == null ? void 0 : E.tableActionsSlot) && /* @__PURE__ */
|
|
725
|
+
(E == null ? void 0 : E.tableActionsSlot) && /* @__PURE__ */ w(E.tableActionsSlot, {
|
|
552
726
|
...e == null ? void 0 : e.cell,
|
|
553
727
|
rowData: t
|
|
554
728
|
}),
|
|
555
|
-
(E == null ? void 0 : E.actionPrefixSlot) && /* @__PURE__ */
|
|
729
|
+
(E == null ? void 0 : E.actionPrefixSlot) && /* @__PURE__ */ w(E.actionPrefixSlot, {
|
|
556
730
|
...e == null ? void 0 : e.cell,
|
|
557
731
|
rowData: t
|
|
558
732
|
}),
|
|
559
|
-
(E == null ? void 0 : E.actionCenterSlot) && /* @__PURE__ */
|
|
733
|
+
(E == null ? void 0 : E.actionCenterSlot) && /* @__PURE__ */ w(E.actionCenterSlot, {
|
|
560
734
|
...e == null ? void 0 : e.cell,
|
|
561
735
|
rowData: t
|
|
562
736
|
}),
|
|
563
|
-
(E == null ? void 0 : E.actionSuffixSlot) && /* @__PURE__ */
|
|
737
|
+
(E == null ? void 0 : E.actionSuffixSlot) && /* @__PURE__ */ w(E.actionSuffixSlot, {
|
|
564
738
|
...e == null ? void 0 : e.cell,
|
|
565
739
|
rowData: t
|
|
566
740
|
})
|
|
567
741
|
]
|
|
568
742
|
});
|
|
569
743
|
};
|
|
570
|
-
function
|
|
744
|
+
function Ce(e) {
|
|
571
745
|
let t = [];
|
|
572
746
|
function n(e) {
|
|
573
747
|
for (let r of e) t.push(r), r.children && r.children.length && n(r.children);
|
|
574
748
|
}
|
|
575
749
|
return n(e), t;
|
|
576
750
|
}
|
|
577
|
-
let
|
|
578
|
-
var t, n, r, i, a,
|
|
579
|
-
let { record: c, rowId: l } = e == null ? void 0 : e.cell, u = (t =
|
|
751
|
+
let we = (e) => {
|
|
752
|
+
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) => {
|
|
580
754
|
var t;
|
|
581
|
-
return !(
|
|
582
|
-
}),
|
|
583
|
-
return /* @__PURE__ */
|
|
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, {
|
|
584
758
|
...e == null ? void 0 : e.componentProps,
|
|
585
|
-
checked: (
|
|
586
|
-
indeterminate: !l && (
|
|
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),
|
|
587
761
|
onChange: (e) => {
|
|
588
762
|
if (e.target.checked && l) {
|
|
589
|
-
let e = [...
|
|
590
|
-
|
|
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);
|
|
591
765
|
} else if (!e.target.checked && l) {
|
|
592
766
|
var t, n;
|
|
593
|
-
let e =
|
|
594
|
-
|
|
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);
|
|
595
769
|
} else if (e.target.checked && !l) {
|
|
596
|
-
let e = u == null ? void 0 : u.map((e) => e[
|
|
597
|
-
|
|
598
|
-
} else !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([], []));
|
|
599
773
|
},
|
|
600
|
-
...
|
|
774
|
+
...f
|
|
601
775
|
});
|
|
602
776
|
};
|
|
603
|
-
|
|
604
|
-
if (
|
|
777
|
+
n(() => {
|
|
778
|
+
if (D) {
|
|
605
779
|
var e;
|
|
606
|
-
let t = (e =
|
|
780
|
+
let t = (e = Ce(d)) == null ? void 0 : e.filter((e) => {
|
|
607
781
|
var t;
|
|
608
|
-
return !(
|
|
609
|
-
}), n = t == null ? void 0 : t.filter((e) => H == null ? void 0 : H.includes(e[
|
|
610
|
-
|
|
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);
|
|
611
785
|
}
|
|
612
|
-
}, [H,
|
|
786
|
+
}, [H, d]), n(() => {
|
|
613
787
|
se([]);
|
|
614
|
-
}, [
|
|
615
|
-
let
|
|
788
|
+
}, [F == null ? void 0 : F.pageNum]);
|
|
789
|
+
let Te = i(() => {
|
|
616
790
|
let e = {};
|
|
617
|
-
for (let t in g == null ? void 0 : g.customCellTemplates) e[t] =
|
|
791
|
+
for (let t in g == null ? void 0 : g.customCellTemplates) e[t] = A(g == null ? void 0 : g.customCellTemplates[t]);
|
|
618
792
|
return e;
|
|
619
|
-
}, [g == null ? void 0 : g.customCellTemplates]),
|
|
793
|
+
}, [g == null ? void 0 : g.customCellTemplates]), Ee = (e, t) => {
|
|
620
794
|
var n;
|
|
621
795
|
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) => ({
|
|
622
796
|
columnId: t == null ? void 0 : t.columnId,
|
|
@@ -626,48 +800,49 @@ function N(e, s) {
|
|
|
626
800
|
}));
|
|
627
801
|
q.current = e == null ? void 0 : e.rowId, K(r);
|
|
628
802
|
};
|
|
629
|
-
return /* @__PURE__ */
|
|
630
|
-
spinning:
|
|
631
|
-
children: /* @__PURE__ */
|
|
632
|
-
|
|
803
|
+
return /* @__PURE__ */ w(f, {
|
|
804
|
+
spinning: I,
|
|
805
|
+
children: /* @__PURE__ */ T("div", {
|
|
806
|
+
ref: J,
|
|
807
|
+
className: `grid-container ${C}`,
|
|
633
808
|
style: S,
|
|
634
|
-
children: [/* @__PURE__ */
|
|
809
|
+
children: [/* @__PURE__ */ w(m, {
|
|
635
810
|
ref: fe,
|
|
636
|
-
rows:
|
|
811
|
+
rows: z,
|
|
637
812
|
columns: V,
|
|
638
|
-
onCellsChanged:
|
|
813
|
+
onCellsChanged: be,
|
|
639
814
|
enableFillHandle: !0,
|
|
640
815
|
enableRangeSelection: !0,
|
|
641
816
|
horizontalStickyBreakpoint: 120,
|
|
642
817
|
...g,
|
|
643
|
-
highlights: (
|
|
818
|
+
highlights: (c = g == null ? void 0 : g.highlights) == null ? de : c,
|
|
644
819
|
onFocusLocationChanging: (e) => {
|
|
645
820
|
var t, n;
|
|
646
821
|
let r = (e == null ? void 0 : e.columnId) + (e == null ? void 0 : e.rowId);
|
|
647
|
-
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 &&
|
|
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 = [
|
|
648
823
|
"_$actions",
|
|
649
824
|
"rowSelection",
|
|
650
825
|
"ExpandListTemplate"
|
|
651
|
-
]) != null && n.includes(e == null ? void 0 : e.columnId)) ? !1 : g != null && g.onFocusLocationChanging ? g == null ? void 0 : g.onFocusLocationChanging(e,
|
|
826
|
+
]) != null && n.includes(e == null ? void 0 : e.columnId)) ? !1 : g != null && g.onFocusLocationChanging ? g == null ? void 0 : g.onFocusLocationChanging(e, z) : e;
|
|
652
827
|
},
|
|
653
828
|
customCellTemplates: {
|
|
654
|
-
ExpandListTemplate:
|
|
655
|
-
...
|
|
656
|
-
...
|
|
829
|
+
ExpandListTemplate: A(N),
|
|
830
|
+
...xe,
|
|
831
|
+
...Te,
|
|
657
832
|
...le,
|
|
658
|
-
_$actions:
|
|
659
|
-
rowSelection:
|
|
660
|
-
Number:
|
|
833
|
+
_$actions: A(Se),
|
|
834
|
+
rowSelection: A(we),
|
|
835
|
+
Number: A(M, e)
|
|
661
836
|
}
|
|
662
|
-
}, (
|
|
837
|
+
}, (d == null ? void 0 : d.length) == 0 ? 0 : 1), (d == null ? void 0 : d.length) <= 0 && /* @__PURE__ */ w("div", {
|
|
663
838
|
className: "grid-container-empty",
|
|
664
|
-
children: /* @__PURE__ */
|
|
839
|
+
children: /* @__PURE__ */ w(l, { image: l.PRESENTED_IMAGE_SIMPLE })
|
|
665
840
|
})]
|
|
666
841
|
})
|
|
667
842
|
});
|
|
668
843
|
}
|
|
669
|
-
var
|
|
844
|
+
var re = e(I);
|
|
670
845
|
//#endregion
|
|
671
|
-
export {
|
|
846
|
+
export { re as default };
|
|
672
847
|
|
|
673
848
|
//# sourceMappingURL=index.js.map
|