@hzab/edit-table 0.1.9 → 0.1.12
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 +59 -28
- package/LICENSE +20 -20
- package/README.md +170 -170
- package/dist/index.cjs +1 -1
- package/dist/index.js +263 -216
- package/dist/index.js.map +1 -0
- package/dist/project-manifest.json +28 -0
- package/dist/project.json +8 -0
- package/package.json +6 -5
- package/src/Template/ExpandListTemplate/index.less +16 -18
- package/src/Template/ExpandListTemplate/index.tsx +58 -58
- package/src/Template/GetBaseTemplate.tsx +37 -37
- package/src/Template/NumberCellTemplate/index.less +5 -5
- package/src/Template/NumberCellTemplate/index.tsx +16 -16
- package/src/Template/TextCellTemplate/index.less +5 -5
- package/src/Template/TextCellTemplate/index.tsx +8 -8
- package/src/common/WidthWrapHoc.tsx +255 -242
- package/src/common/childAntdComponent.ts +24 -16
- package/src/common/utils.ts +295 -288
- package/src/index.less +98 -104
- package/src/index.tsx +489 -464
- package/src/vite-env.d.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -34,13 +34,13 @@ var D = {
|
|
|
34
34
|
let t;
|
|
35
35
|
try {
|
|
36
36
|
t = m(e, "values", "object");
|
|
37
|
-
} catch {
|
|
37
|
+
} catch (e) {
|
|
38
38
|
t = [];
|
|
39
39
|
}
|
|
40
40
|
let n = e.selectedValue ? parseFloat(e.selectedValue) : NaN, r = !0;
|
|
41
41
|
try {
|
|
42
42
|
r = m(e, "isDisabled", "boolean");
|
|
43
|
-
} catch {
|
|
43
|
+
} catch (e) {
|
|
44
44
|
r = !1;
|
|
45
45
|
}
|
|
46
46
|
let i = e.selectedValue, a = i || "";
|
|
@@ -54,7 +54,7 @@ var D = {
|
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
update(e, t) {
|
|
57
|
-
let n = e.values.some((e) => e.value == t.text) ? t.text : t
|
|
57
|
+
let n = e.values.some((e) => e.value == t.text) ? t.text : (t == null ? void 0 : t.text) || void 0;
|
|
58
58
|
return this.getCompatibleCell({
|
|
59
59
|
...e,
|
|
60
60
|
selectedValue: n
|
|
@@ -70,27 +70,30 @@ var D = {
|
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
render(o, s, c) {
|
|
73
|
-
|
|
73
|
+
var l;
|
|
74
|
+
let [d, f] = a(!1), [p, m] = a(!1), _ = (o == null ? void 0 : o.columnId) + (o == null ? void 0 : o.rowId), [v, b] = a(o == null ? void 0 : o.text), [x, S] = a(!1), T = i(o == null ? void 0 : o.text), E = i();
|
|
74
75
|
t(() => {
|
|
75
|
-
|
|
76
|
-
}, [o
|
|
76
|
+
b(o == null ? void 0 : o.text), T.current = o == null ? void 0 : o.text;
|
|
77
|
+
}, [o == null ? void 0 : o.text]), t(() => {
|
|
77
78
|
function e(e) {
|
|
78
|
-
window.gridEditId !=
|
|
79
|
+
window.gridEditId != _ && f(!1);
|
|
79
80
|
}
|
|
80
81
|
return document.addEventListener("click", e), () => {
|
|
81
82
|
document.removeEventListener("click", e);
|
|
82
83
|
};
|
|
83
84
|
}, []);
|
|
84
|
-
let
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
let D = (e) => {
|
|
86
|
+
var t;
|
|
87
|
+
let n = !1, r = !1;
|
|
88
|
+
for (let t of (o == null ? void 0 : o.validatorList) || []) {
|
|
89
|
+
var i;
|
|
90
|
+
t != null && (i = t.pattern) != null && i.test(e) && (n = !0);
|
|
88
91
|
break;
|
|
89
92
|
}
|
|
90
|
-
|
|
93
|
+
r = !n && Array.isArray(o == null ? void 0 : o.validatorList) && (o == null || (t = o.validatorList) == null ? void 0 : t.length) > 0, S(r);
|
|
91
94
|
};
|
|
92
95
|
t(() => {
|
|
93
|
-
if (!
|
|
96
|
+
if (!p) return;
|
|
94
97
|
let e = setTimeout(() => {
|
|
95
98
|
let e = document.querySelector(".ant-picker-dropdown");
|
|
96
99
|
if (!e) return;
|
|
@@ -102,28 +105,28 @@ var D = {
|
|
|
102
105
|
};
|
|
103
106
|
}, 0);
|
|
104
107
|
return () => clearTimeout(e);
|
|
105
|
-
}, [
|
|
106
|
-
let
|
|
107
|
-
let e =
|
|
108
|
+
}, [p]);
|
|
109
|
+
let k = () => {
|
|
110
|
+
let e = T.current;
|
|
108
111
|
c(this.getCompatibleCell({
|
|
109
112
|
...o,
|
|
110
113
|
text: e,
|
|
111
114
|
selectedValue: e
|
|
112
115
|
}), !0);
|
|
113
|
-
},
|
|
114
|
-
open:
|
|
116
|
+
}, A = r(() => O != null && O.includes(o == null ? void 0 : o.type) ? {
|
|
117
|
+
open: p,
|
|
115
118
|
onOpenChange: (e) => {
|
|
116
|
-
|
|
117
|
-
|
|
119
|
+
E.current && clearTimeout(E.current), E.current = setTimeout(() => {
|
|
120
|
+
m(e);
|
|
118
121
|
}, 80);
|
|
119
122
|
}
|
|
120
123
|
} : {}, [o]);
|
|
121
124
|
return t(() => {
|
|
122
|
-
!
|
|
123
|
-
}, [
|
|
124
|
-
className: `base-hoc ${
|
|
125
|
+
!d && o.type == "Upload" && window.uploadEdit && window.uploadEdit == _ && (window.uploadEdit = null, k());
|
|
126
|
+
}, [d, v]), /* @__PURE__ */ w("div", {
|
|
127
|
+
className: `base-hoc ${d ? "base-hoc-edit" : ""}`,
|
|
125
128
|
onDoubleClick: (e) => {
|
|
126
|
-
o
|
|
129
|
+
o != null && o.nonEditable || (o.type === "Upload" && (window.uploadEdit = _), f(!0));
|
|
127
130
|
},
|
|
128
131
|
children: [/* @__PURE__ */ C(e, {
|
|
129
132
|
...n,
|
|
@@ -134,14 +137,15 @@ var D = {
|
|
|
134
137
|
display: "flex",
|
|
135
138
|
alignItems: "center"
|
|
136
139
|
},
|
|
137
|
-
value:
|
|
140
|
+
value: v,
|
|
138
141
|
options: o.values,
|
|
139
142
|
onChange: (e) => {
|
|
140
|
-
|
|
141
|
-
|
|
143
|
+
var t, n;
|
|
144
|
+
let r = (t = e == null || (n = e.target) == null ? void 0 : n.value) == null ? e : t;
|
|
145
|
+
b(r), T.current = r, D(r);
|
|
142
146
|
},
|
|
143
147
|
onBlur: (e) => {
|
|
144
|
-
|
|
148
|
+
k(), O != null && O.includes(o == null ? void 0 : o.type) || f(!1);
|
|
145
149
|
},
|
|
146
150
|
onPointerDown: (e) => {
|
|
147
151
|
e.stopPropagation();
|
|
@@ -149,13 +153,13 @@ var D = {
|
|
|
149
153
|
onKeyDown: (e) => {
|
|
150
154
|
(h(e.keyCode) || g(e.keyCode)) && e.stopPropagation();
|
|
151
155
|
},
|
|
152
|
-
...
|
|
153
|
-
...o
|
|
156
|
+
...A,
|
|
157
|
+
...(o == null ? void 0 : o.getField) && (o == null ? void 0 : o.getField()["x-component-props"]) || {}
|
|
154
158
|
},
|
|
155
|
-
pattern:
|
|
159
|
+
pattern: d ? "" : "readPretty",
|
|
156
160
|
cell: o
|
|
157
|
-
}),
|
|
158
|
-
content: o
|
|
161
|
+
}), x && /* @__PURE__ */ C(u, {
|
|
162
|
+
content: (l = o == null ? void 0 : o.validatorMessage) == null ? "该字段不合法" : l,
|
|
159
163
|
children: /* @__PURE__ */ C(y, { className: "validator-icon" })
|
|
160
164
|
})]
|
|
161
165
|
});
|
|
@@ -164,10 +168,11 @@ var D = {
|
|
|
164
168
|
return new o();
|
|
165
169
|
}, A = (e) => {
|
|
166
170
|
let { pattern: t, cell: n, componentProps: i, Com: a, cellRender: o } = e, s = r(() => {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
+
var e;
|
|
172
|
+
if (n != null && n.getField) return E({
|
|
173
|
+
...(n == null ? void 0 : n.getField) && (n == null ? void 0 : n.getField()),
|
|
174
|
+
enum: (n == null || (e = n.getField()) == null ? void 0 : e.enum) || (n == null ? void 0 : n.values)
|
|
175
|
+
}, { [(n == null ? void 0 : n.getField) && (n == null ? void 0 : n.getField().name)]: n.text });
|
|
171
176
|
}, [n]);
|
|
172
177
|
return o && o(e) ? /* @__PURE__ */ C(o, { ...e }) : /* @__PURE__ */ C("div", {
|
|
173
178
|
className: "base-hoc",
|
|
@@ -179,8 +184,8 @@ var D = {
|
|
|
179
184
|
...i
|
|
180
185
|
})
|
|
181
186
|
});
|
|
182
|
-
},
|
|
183
|
-
let t = T(5), n = e
|
|
187
|
+
}, ee = (e) => {
|
|
188
|
+
let t = T(5), n = e == null ? void 0 : e.componentProps, r;
|
|
184
189
|
t[0] === n ? r = t[1] : (r = {
|
|
185
190
|
...n,
|
|
186
191
|
type: "number"
|
|
@@ -191,57 +196,68 @@ var D = {
|
|
|
191
196
|
componentProps: r,
|
|
192
197
|
Com: l
|
|
193
198
|
}), t[2] = e, t[3] = r, t[4] = i) : i = t[4], i;
|
|
194
|
-
},
|
|
199
|
+
}, te = (e) => {
|
|
195
200
|
let n = T(21), { cell: r } = e, { setExpandKeys: i, expandKeys: o, rowKey: s, setNewDataSource: c, record: l } = r, [u, d] = a(!1), f;
|
|
196
201
|
n[0] !== l || n[1] !== s || n[2] !== c ? (f = (e) => {
|
|
197
202
|
c((t) => {
|
|
198
|
-
|
|
203
|
+
var n;
|
|
204
|
+
let r = [...t], i = l == null || (n = l.children) == null ? void 0 : n.map((e) => e == null ? void 0 : e[s]);
|
|
199
205
|
if (e) {
|
|
200
|
-
let e = t
|
|
201
|
-
return (
|
|
206
|
+
let e = t == null ? void 0 : t.findIndex((e) => (e == null ? void 0 : e[s]) == (l == null ? void 0 : l[s])), n = (t == null ? void 0 : t.filter((e) => i == null ? void 0 : i.includes(e == null ? void 0 : e[s]))) || [];
|
|
207
|
+
return (n == null ? void 0 : n.length) == 0 && r.splice(e + 1, 0, ...(l == null ? void 0 : l.children) || []), [...r];
|
|
202
208
|
}
|
|
203
|
-
return t
|
|
209
|
+
return t == null ? void 0 : t.filter((e) => !(i != null && i.includes(e == null ? void 0 : e[s])));
|
|
204
210
|
});
|
|
205
211
|
}, n[0] = l, n[1] = s, n[2] = c, n[3] = f) : f = n[3];
|
|
206
212
|
let p = f, m;
|
|
207
213
|
n[4] !== o || n[5] !== p || n[6] !== l || n[7] !== s ? (m = () => {
|
|
208
|
-
o
|
|
214
|
+
o != null && o.includes(l == null ? void 0 : l[s]) && (d(!0), p(!0));
|
|
209
215
|
}, n[4] = o, n[5] = p, n[6] = l, n[7] = s, n[8] = m) : m = n[8];
|
|
210
|
-
let h = r
|
|
216
|
+
let h = r == null ? void 0 : r.record, g;
|
|
211
217
|
n[9] === h ? g = n[10] : (g = [h], n[9] = h, n[10] = g), t(m, g);
|
|
212
218
|
let _;
|
|
213
219
|
n[11] !== u || n[12] !== p || n[13] !== l || n[14] !== s || n[15] !== i ? (_ = () => {
|
|
214
|
-
i((e) => e
|
|
220
|
+
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);
|
|
215
221
|
}, n[11] = u, n[12] = p, n[13] = l, n[14] = s, n[15] = i, n[16] = _) : _ = n[16];
|
|
216
222
|
let v = _, y;
|
|
217
|
-
return n[17] !== u || n[18] !== v || n[19] !== l
|
|
223
|
+
return n[17] !== u || n[18] !== v || n[19] !== (l == null ? void 0 : l.children) ? (y = /* @__PURE__ */ C("div", {
|
|
218
224
|
className: "expandList-template",
|
|
219
|
-
children: l
|
|
225
|
+
children: l != null && l.children ? /* @__PURE__ */ C(S, { children: C(u ? b : x, {
|
|
220
226
|
className: "expandList-template-icon",
|
|
221
227
|
onClick: v
|
|
222
228
|
}) }) : /* @__PURE__ */ C("div", { style: { width: 14 } })
|
|
223
|
-
}), n[17] = u, n[18] = v, n[19] = l
|
|
229
|
+
}), n[17] = u, n[18] = v, n[19] = l == null ? void 0 : l.children, n[20] = y) : y = n[20], y;
|
|
224
230
|
};
|
|
225
231
|
//#endregion
|
|
226
232
|
//#region src/common/utils.ts
|
|
227
|
-
function
|
|
233
|
+
function j(e) {
|
|
228
234
|
return typeof e == "object" && !!e;
|
|
229
235
|
}
|
|
230
|
-
var
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
236
|
+
var M = (e) => {
|
|
237
|
+
var t;
|
|
238
|
+
return typeof (e == null ? void 0 : e.title) == "function" ? j(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
|
+
};
|
|
240
|
+
function ne(e, t = 40) {
|
|
241
|
+
let n = (e) => e.reduce((e, t) => {
|
|
242
|
+
var r;
|
|
243
|
+
return (r = t.children) != null && r.length ? [...e, ...n(t.children)] : [...e, t];
|
|
244
|
+
}, []), r = (e, t = 1) => e.reduce((e, n) => {
|
|
245
|
+
var i;
|
|
246
|
+
return (i = n.children) != null && i.length ? Math.max(e, r(n.children, t + 1)) : Math.max(e, t);
|
|
247
|
+
}, t), i = n(e), a = r(e), o = i.length, s = (e, t = 0) => e.map((e) => {
|
|
248
|
+
var r;
|
|
249
|
+
if (!(((r = e.children) == null ? void 0 : r.length) > 0)) return {
|
|
234
250
|
...e,
|
|
235
251
|
rowspan: a - t,
|
|
236
252
|
colspan: 1,
|
|
237
253
|
_depth: t,
|
|
238
254
|
_isLeaf: !0
|
|
239
255
|
};
|
|
240
|
-
let
|
|
256
|
+
let i = n(e.children).length;
|
|
241
257
|
return {
|
|
242
258
|
...e,
|
|
243
259
|
rowspan: 1,
|
|
244
|
-
colspan:
|
|
260
|
+
colspan: i,
|
|
245
261
|
_depth: t,
|
|
246
262
|
_isLeaf: !1,
|
|
247
263
|
children: s(e.children, t + 1)
|
|
@@ -250,17 +266,20 @@ function te(e, t = 40) {
|
|
|
250
266
|
rowId: `header-${n}`,
|
|
251
267
|
height: t,
|
|
252
268
|
cells: []
|
|
253
|
-
})), u = (e) =>
|
|
269
|
+
})), u = (e) => {
|
|
270
|
+
var t;
|
|
271
|
+
return (t = ["rowSelection", "ExpandListTemplate"]) != null && t.includes(e == null ? void 0 : e.type) ? e == null ? void 0 : e.type : j(typeof (e == null ? void 0 : e.title) == "function" ? e == null ? void 0 : e.title() : null) ? `${e == null ? void 0 : e.dataIndex}` : "header";
|
|
272
|
+
}, d = (e, t = 0) => {
|
|
254
273
|
e.forEach((e) => {
|
|
255
274
|
if (e._isLeaf) {
|
|
256
275
|
let n = {
|
|
257
276
|
...e,
|
|
258
277
|
type: u(e),
|
|
259
|
-
text:
|
|
278
|
+
text: M(e),
|
|
260
279
|
dataIndex: e.dataIndex,
|
|
261
280
|
width: e.width,
|
|
262
281
|
rowspan: e.rowspan,
|
|
263
|
-
style: e
|
|
282
|
+
style: e != null && e.style ? e == null ? void 0 : e.style : {
|
|
264
283
|
background: "rgba(128, 128, 128, 0.1)",
|
|
265
284
|
display: "flex",
|
|
266
285
|
justifyContent: "center"
|
|
@@ -270,9 +289,9 @@ function te(e, t = 40) {
|
|
|
270
289
|
} else l[t].cells.push({
|
|
271
290
|
...e,
|
|
272
291
|
type: u(e),
|
|
273
|
-
text:
|
|
292
|
+
text: M(e),
|
|
274
293
|
colspan: e.colspan,
|
|
275
|
-
style: e
|
|
294
|
+
style: e != null && e.style ? e == null ? void 0 : e.style : {
|
|
276
295
|
background: "rgba(128, 128, 128, 0.1)",
|
|
277
296
|
display: "flex",
|
|
278
297
|
justifyContent: "center"
|
|
@@ -289,11 +308,11 @@ function te(e, t = 40) {
|
|
|
289
308
|
n.push({
|
|
290
309
|
...e,
|
|
291
310
|
type: u(e),
|
|
292
|
-
text:
|
|
311
|
+
text: M(e),
|
|
293
312
|
dataIndex: e.dataIndex,
|
|
294
313
|
width: e.width,
|
|
295
314
|
rowspan: t === a - 1 ? 1 : void 0,
|
|
296
|
-
style: e
|
|
315
|
+
style: e != null && e.style ? e == null ? void 0 : e.style : {
|
|
297
316
|
background: "rgba(128, 128, 128, 0.1)",
|
|
298
317
|
display: "flex",
|
|
299
318
|
justifyContent: "center"
|
|
@@ -320,11 +339,11 @@ function te(e, t = 40) {
|
|
|
320
339
|
n ? p.push(n) : p.push({
|
|
321
340
|
...e,
|
|
322
341
|
type: u(e),
|
|
323
|
-
text:
|
|
342
|
+
text: M(e),
|
|
324
343
|
dataIndex: e.dataIndex,
|
|
325
344
|
width: e.width,
|
|
326
345
|
rowspan: 1,
|
|
327
|
-
style: e
|
|
346
|
+
style: e != null && e.style ? e == null ? void 0 : e.style : {
|
|
328
347
|
background: "rgba(128, 128, 128, 0.1)",
|
|
329
348
|
display: "flex",
|
|
330
349
|
justifyContent: "center"
|
|
@@ -337,7 +356,7 @@ function te(e, t = 40) {
|
|
|
337
356
|
});
|
|
338
357
|
}), l;
|
|
339
358
|
}
|
|
340
|
-
function
|
|
359
|
+
function re(e) {
|
|
341
360
|
let t = [];
|
|
342
361
|
function n(e) {
|
|
343
362
|
e.forEach((e) => {
|
|
@@ -361,141 +380,155 @@ function ne(e) {
|
|
|
361
380
|
}
|
|
362
381
|
//#endregion
|
|
363
382
|
//#region src/index.tsx
|
|
364
|
-
function
|
|
365
|
-
|
|
366
|
-
|
|
383
|
+
function N(e, s) {
|
|
384
|
+
var l;
|
|
385
|
+
let { columns: u, dataSource: f, formulaConfig: m, onChange: h, reactGridProps: g = {}, onEditSubmit: y, headerRowHeight: b = 44, rowHeight: x = 44, reactGridStyle: S, className: T, Slots: E, rowSelection: O, rowKey: M = "id", query: N, loading: P, isExpand: ie = !1, getList: F, onRow: I } = e, [L, ae] = a([]), [R, z] = a([]), B = i([]), [V, oe] = a([]), [H, se] = a([]), [U, W] = a([]), [G, ce] = a([]), [le, ue] = a([]), [de, K] = a([]), q = i(), fe = i(), J = i();
|
|
386
|
+
n(s, () => ({ rows: R }));
|
|
367
387
|
let Y = (e, t = 0) => {
|
|
368
|
-
e
|
|
369
|
-
e.level = t + 1, e
|
|
388
|
+
e == null || e.forEach((e) => {
|
|
389
|
+
e.level = t + 1, e != null && e.children && Y(e == null ? void 0 : e.children, e.level);
|
|
370
390
|
});
|
|
371
391
|
};
|
|
372
392
|
t(() => {
|
|
373
|
-
Y(
|
|
374
|
-
}, [
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
393
|
+
Y(f), W(f);
|
|
394
|
+
}, [f]), t(() => {
|
|
395
|
+
let e = R.map((e) => e.rowId);
|
|
396
|
+
e != null && e.includes(q.current) || K([]);
|
|
397
|
+
}, [R]);
|
|
398
|
+
let pe = (e) => {
|
|
399
|
+
var t, n;
|
|
400
|
+
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
|
+
return e == null || (n = e.cells) == null || n.forEach((e) => {
|
|
402
|
+
e != null && e.columnId && !(i != null && i.includes(e == null ? void 0 : e.columnId)) && (a[e == null ? void 0 : e.columnId] = (e == null ? void 0 : e.text) || (e == null ? void 0 : e.value) || (e == null ? void 0 : e.selectedValue) || "", (e == null ? void 0 : e.type) == "Number" && (a[e == null ? void 0 : e.columnId] = e == null ? void 0 : e.value));
|
|
381
403
|
}), {
|
|
382
|
-
...
|
|
383
|
-
...
|
|
404
|
+
...r,
|
|
405
|
+
...a
|
|
384
406
|
};
|
|
385
407
|
};
|
|
386
408
|
t(() => {
|
|
387
|
-
if (Array.isArray(
|
|
388
|
-
|
|
409
|
+
if (Array.isArray(u) && (u == null ? void 0 : u.length) > 0) {
|
|
410
|
+
ie && u.unshift({
|
|
389
411
|
type: "ExpandListTemplate",
|
|
390
412
|
width: 14,
|
|
391
413
|
key: "ExpandListTemplate",
|
|
392
414
|
nonEditable: !0,
|
|
393
|
-
style:
|
|
394
|
-
}),
|
|
415
|
+
style: (O == null ? void 0 : O.style) || { background: "rgba(128, 128, 128, 0.1)" }
|
|
416
|
+
}), O && u.unshift({
|
|
395
417
|
type: "rowSelection",
|
|
396
418
|
nonEditable: !0,
|
|
397
|
-
width:
|
|
419
|
+
width: (O == null ? void 0 : O.width) || 30,
|
|
398
420
|
key: "rowSelection",
|
|
399
|
-
style:
|
|
421
|
+
style: (O == null ? void 0 : O.style) || {
|
|
400
422
|
background: "rgba(128, 128, 128, 0.1)",
|
|
401
423
|
display: "flex",
|
|
402
424
|
justifyContent: "center"
|
|
403
425
|
}
|
|
404
|
-
}),
|
|
405
|
-
let e =
|
|
406
|
-
|
|
426
|
+
}), ae(ne(u, b));
|
|
427
|
+
let e = re(u);
|
|
428
|
+
oe(e == null ? void 0 : e.map((e, t) => ({
|
|
407
429
|
...e,
|
|
408
|
-
columnId: e
|
|
430
|
+
columnId: (e == null ? void 0 : e.dataIndex) || (e == null ? void 0 : e.key) || (e == null ? void 0 : e.name) || ""
|
|
409
431
|
})));
|
|
410
432
|
}
|
|
411
|
-
}, [
|
|
433
|
+
}, [u, O]);
|
|
412
434
|
let X = {}, Z = (e) => {
|
|
413
|
-
e
|
|
414
|
-
if (
|
|
415
|
-
let t = e
|
|
416
|
-
X[e
|
|
435
|
+
e == null || e.forEach((e) => {
|
|
436
|
+
if (j(typeof (e == null ? void 0 : e.title) == "function" ? e == null ? void 0 : e.title() : null)) {
|
|
437
|
+
let t = e == null ? void 0 : e.title;
|
|
438
|
+
X[e == null ? void 0 : e.dataIndex] = k(t);
|
|
417
439
|
}
|
|
418
|
-
e
|
|
440
|
+
e != null && e.children && Z(e == null ? void 0 : e.children);
|
|
419
441
|
});
|
|
420
442
|
};
|
|
421
443
|
t(() => {
|
|
422
|
-
Z(
|
|
423
|
-
}, [
|
|
424
|
-
let e =
|
|
425
|
-
rowId: t[
|
|
426
|
-
height:
|
|
427
|
-
cells: e
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
444
|
+
Z(u), ue(X);
|
|
445
|
+
}, [u]), t(() => {
|
|
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
|
+
rowId: t[M],
|
|
448
|
+
height: x,
|
|
449
|
+
cells: e == null ? void 0 : e.map((e, r) => {
|
|
450
|
+
var i;
|
|
451
|
+
let a = {}, o = V[r], s = t[e], c = (i = o == null ? void 0 : o.type) == null ? "text" : i;
|
|
452
|
+
if (m) {
|
|
453
|
+
for (let n in m) if (n == e) {
|
|
454
|
+
let e = m[n];
|
|
455
|
+
a = {
|
|
456
|
+
text: (e == null ? void 0 : e.setCellData) && (e == null ? void 0 : e.setCellData(t)),
|
|
457
|
+
value: (e == null ? void 0 : e.setCellData) && (e == null ? void 0 : e.setCellData(t)),
|
|
458
|
+
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))
|
|
436
459
|
};
|
|
437
460
|
}
|
|
438
461
|
}
|
|
439
462
|
return {
|
|
440
|
-
...
|
|
463
|
+
...o,
|
|
441
464
|
record: t,
|
|
442
|
-
rowId: t[
|
|
443
|
-
type:
|
|
444
|
-
nonEditable:
|
|
445
|
-
text: String(
|
|
446
|
-
value:
|
|
447
|
-
selectedValue:
|
|
448
|
-
style:
|
|
465
|
+
rowId: t[M] || (o == null ? void 0 : o.type),
|
|
466
|
+
type: c,
|
|
467
|
+
nonEditable: (o == null ? void 0 : o.pattern) == "readPretty" ? !0 : o == null ? void 0 : o.nonEditable,
|
|
468
|
+
text: String(s || ""),
|
|
469
|
+
value: s,
|
|
470
|
+
selectedValue: s || "",
|
|
471
|
+
style: (o == null ? void 0 : o.type) == "rowSelection" ? {
|
|
449
472
|
display: "flex",
|
|
450
473
|
justifyContent: "center"
|
|
451
474
|
} : {},
|
|
452
|
-
...
|
|
453
|
-
...
|
|
454
|
-
...
|
|
455
|
-
setNewDataSource:
|
|
456
|
-
setExpandKeys:
|
|
457
|
-
rowKey:
|
|
458
|
-
expandKeys:
|
|
459
|
-
Slots:
|
|
460
|
-
...
|
|
475
|
+
...I && I(t, n, r) || {},
|
|
476
|
+
...(o == null ? void 0 : o.onCell) && (o == null ? void 0 : o.onCell(t, n, r)) || {},
|
|
477
|
+
...(o == null ? void 0 : o.cellProps) || {},
|
|
478
|
+
setNewDataSource: W,
|
|
479
|
+
setExpandKeys: ce,
|
|
480
|
+
rowKey: M,
|
|
481
|
+
expandKeys: G,
|
|
482
|
+
Slots: E,
|
|
483
|
+
...a
|
|
461
484
|
};
|
|
462
485
|
})
|
|
463
|
-
})), n = [...
|
|
464
|
-
|
|
486
|
+
})), n = [...L, ...t];
|
|
487
|
+
z(n);
|
|
465
488
|
}, [
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
489
|
+
U,
|
|
490
|
+
V,
|
|
491
|
+
L
|
|
469
492
|
]), t(() => {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
493
|
+
if (P) {
|
|
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) => {
|
|
473
506
|
let t = [];
|
|
474
507
|
if (!Array.isArray(e) || e.length === 0) return;
|
|
475
508
|
let n = !1;
|
|
476
|
-
if (e
|
|
477
|
-
let i = r.findIndex((t) => t.rowId == e.rowId), a =
|
|
478
|
-
if (r[i].cells[a] = { ...e.newCell }, J.current = { ...e.newCell }, t.push(
|
|
479
|
-
let t =
|
|
509
|
+
if ((e == null ? void 0 : e.length) > 1 && (n = !0), z((r) => (e.forEach(async (e) => {
|
|
510
|
+
let i = r.findIndex((t) => t.rowId == e.rowId), a = V.findIndex((t) => t.columnId == e.columnId);
|
|
511
|
+
if (r[i].cells[a] = { ...e.newCell }, J.current = { ...e.newCell }, t.push(pe(r[i])), m) for (let e in m) {
|
|
512
|
+
let t = m[e], n = V.findIndex((t) => t.columnId == e), a = {
|
|
480
513
|
...r[i].cells[n],
|
|
481
|
-
text: t
|
|
482
|
-
value: t
|
|
483
|
-
style: t
|
|
514
|
+
text: (t == null ? void 0 : t.setCellData) && (t == null ? void 0 : t.setCellData(r[i])),
|
|
515
|
+
value: (t == null ? void 0 : t.setCellData) && (t == null ? void 0 : t.setCellData(r[i])),
|
|
516
|
+
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[i])) || r[i]))
|
|
484
517
|
};
|
|
485
518
|
r[i].cells[n] = a;
|
|
486
519
|
}
|
|
487
|
-
if (
|
|
488
|
-
await
|
|
489
|
-
} catch {
|
|
490
|
-
|
|
520
|
+
if (y && !n) try {
|
|
521
|
+
await y(t);
|
|
522
|
+
} catch (e) {
|
|
523
|
+
F && F();
|
|
491
524
|
}
|
|
492
|
-
|
|
525
|
+
h && h(r[i]);
|
|
493
526
|
}), [...r])), n) try {
|
|
494
|
-
|
|
495
|
-
} catch {
|
|
496
|
-
|
|
527
|
+
y && await y(t);
|
|
528
|
+
} catch (e) {
|
|
529
|
+
F && F();
|
|
497
530
|
}
|
|
498
|
-
},
|
|
531
|
+
}, Q = r(() => {
|
|
499
532
|
let t = {
|
|
500
533
|
..._ || {},
|
|
501
534
|
...v || {},
|
|
@@ -507,25 +540,28 @@ function P(e, s) {
|
|
|
507
540
|
Com: t[r]
|
|
508
541
|
}));
|
|
509
542
|
return n;
|
|
510
|
-
}, [_, v]),
|
|
511
|
-
let t =
|
|
543
|
+
}, [_, v]), he = (e) => {
|
|
544
|
+
let t = R == null ? void 0 : R.find((t) => {
|
|
545
|
+
var n;
|
|
546
|
+
return (t == null ? void 0 : t.rowId) == (e == null || (n = e.cell) == null ? void 0 : n.rowId);
|
|
547
|
+
});
|
|
512
548
|
return /* @__PURE__ */ w("div", {
|
|
513
549
|
onPointerDown: (e) => e.stopPropagation(),
|
|
514
550
|
children: [
|
|
515
|
-
|
|
516
|
-
...e
|
|
551
|
+
(E == null ? void 0 : E.tableActionsSlot) && /* @__PURE__ */ C(E.tableActionsSlot, {
|
|
552
|
+
...e == null ? void 0 : e.cell,
|
|
517
553
|
rowData: t
|
|
518
554
|
}),
|
|
519
|
-
|
|
520
|
-
...e
|
|
555
|
+
(E == null ? void 0 : E.actionPrefixSlot) && /* @__PURE__ */ C(E.actionPrefixSlot, {
|
|
556
|
+
...e == null ? void 0 : e.cell,
|
|
521
557
|
rowData: t
|
|
522
558
|
}),
|
|
523
|
-
|
|
524
|
-
...e
|
|
559
|
+
(E == null ? void 0 : E.actionCenterSlot) && /* @__PURE__ */ C(E.actionCenterSlot, {
|
|
560
|
+
...e == null ? void 0 : e.cell,
|
|
525
561
|
rowData: t
|
|
526
562
|
}),
|
|
527
|
-
|
|
528
|
-
...e
|
|
563
|
+
(E == null ? void 0 : E.actionSuffixSlot) && /* @__PURE__ */ C(E.actionSuffixSlot, {
|
|
564
|
+
...e == null ? void 0 : e.cell,
|
|
529
565
|
rowData: t
|
|
530
566
|
})
|
|
531
567
|
]
|
|
@@ -538,89 +574,100 @@ function P(e, s) {
|
|
|
538
574
|
}
|
|
539
575
|
return n(e), t;
|
|
540
576
|
}
|
|
541
|
-
let
|
|
542
|
-
|
|
577
|
+
let ge = (e) => {
|
|
578
|
+
var t, n, r, i, a, s;
|
|
579
|
+
let { record: c, rowId: l } = e == null ? void 0 : e.cell, u = (t = $(f)) == null ? void 0 : t.filter((e) => {
|
|
580
|
+
var t;
|
|
581
|
+
return !(O != null && (t = O.getCheckboxProps) != null && (t = t.call(O, e)) != null && t.disabled);
|
|
582
|
+
}), d = typeof (O == null ? void 0 : O.getCheckboxProps) == "function" ? O == null || (n = O.getCheckboxProps) == null ? void 0 : n.call(O, c) : {};
|
|
543
583
|
return /* @__PURE__ */ C(o, {
|
|
544
|
-
...e
|
|
545
|
-
checked:
|
|
546
|
-
indeterminate: !
|
|
584
|
+
...e == null ? void 0 : e.componentProps,
|
|
585
|
+
checked: (O == null || (r = O.selectedRowKeys) == null ? void 0 : r.includes(c && c[M] || "")) || !l && (O == null || (i = O.selectedRowKeys) == null ? void 0 : i.length) == (u == null ? void 0 : u.length) && (u == null ? void 0 : u.length) > 0,
|
|
586
|
+
indeterminate: !l && (O == null || (a = O.selectedRowKeys) == null ? void 0 : a.length) > 0 && (O == null || (s = O.selectedRowKeys) == null ? void 0 : s.length) < (u == null ? void 0 : u.length),
|
|
547
587
|
onChange: (e) => {
|
|
548
|
-
if (e.target.checked &&
|
|
549
|
-
let e = [...
|
|
550
|
-
|
|
551
|
-
} else if (!e.target.checked &&
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
588
|
+
if (e.target.checked && l) {
|
|
589
|
+
let e = [...O == null ? void 0 : O.selectedRowKeys, c[M]], t = u == null ? void 0 : u.filter((t) => e == null ? void 0 : e.includes(t[M]));
|
|
590
|
+
O == null || O.onChange(e, t);
|
|
591
|
+
} else if (!e.target.checked && l) {
|
|
592
|
+
var t, n;
|
|
593
|
+
let e = O == null || (t = O.selectedRowKeys) == null ? void 0 : t.filter((e) => e != c[M]), r = u == null ? void 0 : u.filter((t) => e == null ? void 0 : e.includes(t[M]));
|
|
594
|
+
O == null || O.onChange(O == null || (n = O.selectedRowKeys) == null ? void 0 : n.filter((e) => e != c[M]), r);
|
|
595
|
+
} else if (e.target.checked && !l) {
|
|
596
|
+
let e = u == null ? void 0 : u.map((e) => e[M]), t = u == null ? void 0 : u.filter((t) => e == null ? void 0 : e.includes(t[M]));
|
|
597
|
+
O == null || O.onChange(u == null ? void 0 : u.map((e) => e[M]), t);
|
|
598
|
+
} else !e.target.checked && !l && (O == null || O.onChange([], []));
|
|
599
|
+
},
|
|
600
|
+
...d
|
|
559
601
|
});
|
|
560
602
|
};
|
|
561
603
|
t(() => {
|
|
562
|
-
if (
|
|
563
|
-
|
|
564
|
-
|
|
604
|
+
if (O) {
|
|
605
|
+
var e;
|
|
606
|
+
let t = (e = $(f)) == null ? void 0 : e.filter((e) => {
|
|
607
|
+
var t;
|
|
608
|
+
return !(O != null && (t = O.getCheckboxProps) != null && (t = t.call(O, e)) != null && t.disabled);
|
|
609
|
+
}), n = t == null ? void 0 : t.filter((e) => H == null ? void 0 : H.includes(e[M]));
|
|
610
|
+
O == null || O.onChange(H, n);
|
|
565
611
|
}
|
|
566
|
-
}, [
|
|
567
|
-
|
|
568
|
-
}, [N
|
|
569
|
-
let
|
|
612
|
+
}, [H, f]), t(() => {
|
|
613
|
+
se([]);
|
|
614
|
+
}, [N == null ? void 0 : N.pageNum]);
|
|
615
|
+
let _e = r(() => {
|
|
570
616
|
let e = {};
|
|
571
|
-
for (let t in
|
|
572
|
-
let n = h?.customCellTemplates[t];
|
|
573
|
-
e[t] = k(n);
|
|
574
|
-
}
|
|
617
|
+
for (let t in g == null ? void 0 : g.customCellTemplates) e[t] = k(g == null ? void 0 : g.customCellTemplates[t]);
|
|
575
618
|
return e;
|
|
576
|
-
}, [
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
619
|
+
}, [g == null ? void 0 : g.customCellTemplates]), ve = (e, t) => {
|
|
620
|
+
var n;
|
|
621
|
+
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
|
+
columnId: t == null ? void 0 : t.columnId,
|
|
623
|
+
rowId: e == null ? void 0 : e.rowId,
|
|
580
624
|
className: "custom-highlights-row",
|
|
581
625
|
borderColor: "transparent"
|
|
582
626
|
}));
|
|
583
|
-
q.current = e
|
|
627
|
+
q.current = e == null ? void 0 : e.rowId, K(r);
|
|
584
628
|
};
|
|
585
629
|
return /* @__PURE__ */ C(d, {
|
|
586
630
|
spinning: P,
|
|
587
631
|
children: /* @__PURE__ */ w("div", {
|
|
588
|
-
className: `grid-container ${
|
|
589
|
-
style:
|
|
632
|
+
className: `grid-container ${T}`,
|
|
633
|
+
style: S,
|
|
590
634
|
children: [/* @__PURE__ */ C(p, {
|
|
591
|
-
ref:
|
|
592
|
-
rows: P ?
|
|
593
|
-
columns:
|
|
594
|
-
onCellsChanged:
|
|
635
|
+
ref: fe,
|
|
636
|
+
rows: P ? B.current : R,
|
|
637
|
+
columns: V,
|
|
638
|
+
onCellsChanged: me,
|
|
595
639
|
enableFillHandle: !0,
|
|
596
640
|
enableRangeSelection: !0,
|
|
597
641
|
horizontalStickyBreakpoint: 120,
|
|
598
|
-
...
|
|
599
|
-
highlights:
|
|
642
|
+
...g,
|
|
643
|
+
highlights: (l = g == null ? void 0 : g.highlights) == null ? de : l,
|
|
600
644
|
onFocusLocationChanging: (e) => {
|
|
601
|
-
|
|
602
|
-
|
|
645
|
+
var t, n;
|
|
646
|
+
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 && ve(e, R), (n = [
|
|
603
648
|
"_$actions",
|
|
604
649
|
"rowSelection",
|
|
605
650
|
"ExpandListTemplate"
|
|
606
|
-
].includes(e
|
|
651
|
+
]) != null && n.includes(e == null ? void 0 : e.columnId)) ? !1 : g != null && g.onFocusLocationChanging ? g == null ? void 0 : g.onFocusLocationChanging(e, R) : e;
|
|
607
652
|
},
|
|
608
653
|
customCellTemplates: {
|
|
609
|
-
ExpandListTemplate: k(
|
|
610
|
-
...
|
|
611
|
-
...
|
|
612
|
-
...
|
|
613
|
-
_$actions: k(
|
|
614
|
-
rowSelection: k(
|
|
615
|
-
Number: k(
|
|
654
|
+
ExpandListTemplate: k(te),
|
|
655
|
+
...Q,
|
|
656
|
+
..._e,
|
|
657
|
+
...le,
|
|
658
|
+
_$actions: k(he),
|
|
659
|
+
rowSelection: k(ge),
|
|
660
|
+
Number: k(ee, e)
|
|
616
661
|
}
|
|
617
|
-
},
|
|
662
|
+
}, (f == null ? void 0 : f.length) == 0 ? 0 : 1), (f == null ? void 0 : f.length) <= 0 && /* @__PURE__ */ C("div", {
|
|
618
663
|
className: "grid-container-empty",
|
|
619
664
|
children: /* @__PURE__ */ C(c, { image: c.PRESENTED_IMAGE_SIMPLE })
|
|
620
665
|
})]
|
|
621
666
|
})
|
|
622
667
|
});
|
|
623
668
|
}
|
|
624
|
-
var
|
|
669
|
+
var P = e(N);
|
|
625
670
|
//#endregion
|
|
626
|
-
export {
|
|
671
|
+
export { P as default };
|
|
672
|
+
|
|
673
|
+
//# sourceMappingURL=index.js.map
|