@wangcheng051/plugin-kit 0.1.0 → 0.1.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/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +166 -181
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +2 -2
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o, { useState as T, useEffect as V, useRef as L, useMemo as F, useCallback as R } from "react";
|
|
2
2
|
import { Typography as Ce, Tooltip as de, Tag as be, Popover as fe, Checkbox as Ee, Button as ee, Input as me, Spin as Se, Pagination as we } from "antd";
|
|
3
3
|
import * as W from "@ant-design/icons";
|
|
4
4
|
import { useSelector as ge } from "react-redux";
|
|
@@ -8,11 +8,11 @@ function te(e) {
|
|
|
8
8
|
}
|
|
9
9
|
function Ne(e, n, t) {
|
|
10
10
|
if (!e || !n) return t;
|
|
11
|
-
const
|
|
11
|
+
const r = String(n).split(".");
|
|
12
12
|
let i = e;
|
|
13
|
-
for (let s = 0; s <
|
|
13
|
+
for (let s = 0; s < r.length; s += 1) {
|
|
14
14
|
if (i == null) return t;
|
|
15
|
-
i = i[
|
|
15
|
+
i = i[r[s]];
|
|
16
16
|
}
|
|
17
17
|
return i === void 0 ? t : i;
|
|
18
18
|
}
|
|
@@ -25,11 +25,11 @@ function oe(e, n = 0) {
|
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
function Re(e, n = {}) {
|
|
28
|
-
const { digits: t = 2, symbol:
|
|
28
|
+
const { digits: t = 2, symbol: r = "¥", showSymbol: i = !0, showZeroZero: s = !1 } = n;
|
|
29
29
|
if (te(e)) return "-";
|
|
30
30
|
const m = Number(e);
|
|
31
31
|
if (Number.isNaN(m)) return "-";
|
|
32
|
-
const E = oe(Math.abs(m), t), x = i ?
|
|
32
|
+
const E = oe(Math.abs(m), t), x = i ? r : "";
|
|
33
33
|
return m < 0 ? `-${x}${E}` : `${x}${E}`;
|
|
34
34
|
}
|
|
35
35
|
function Te(e, n = 2) {
|
|
@@ -39,9 +39,9 @@ function Te(e, n = 2) {
|
|
|
39
39
|
}
|
|
40
40
|
function lt(e, n) {
|
|
41
41
|
const t = {};
|
|
42
|
-
return (e || []).forEach((
|
|
43
|
-
const i = typeof n == "function" ? n(
|
|
44
|
-
t[i] || (t[i] = []), t[i].push(
|
|
42
|
+
return (e || []).forEach((r) => {
|
|
43
|
+
const i = typeof n == "function" ? n(r) : Ne(r, n);
|
|
44
|
+
t[i] || (t[i] = []), t[i].push(r);
|
|
45
45
|
}), t;
|
|
46
46
|
}
|
|
47
47
|
function it(e) {
|
|
@@ -66,59 +66,59 @@ function xe(e = [], n = "value") {
|
|
|
66
66
|
(e || []).map((t) => [(t == null ? void 0 : t[n]) ?? (t == null ? void 0 : t.id), t])
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function O(e, n = /* @__PURE__ */ new WeakMap()) {
|
|
70
70
|
if (e === null || typeof e != "object") return e;
|
|
71
71
|
if (n.has(e)) return n.get(e);
|
|
72
72
|
if (Array.isArray(e)) {
|
|
73
|
-
const
|
|
74
|
-
return n.set(e,
|
|
75
|
-
|
|
76
|
-
}),
|
|
73
|
+
const r = [];
|
|
74
|
+
return n.set(e, r), e.forEach((i, s) => {
|
|
75
|
+
r[s] = O(i, n);
|
|
76
|
+
}), r;
|
|
77
77
|
}
|
|
78
78
|
if (e instanceof Date) return new Date(e.getTime());
|
|
79
79
|
if (e instanceof RegExp) return new RegExp(e.source, e.flags);
|
|
80
80
|
const t = {};
|
|
81
|
-
return n.set(e, t), Object.keys(e).forEach((
|
|
82
|
-
t[
|
|
81
|
+
return n.set(e, t), Object.keys(e).forEach((r) => {
|
|
82
|
+
t[r] = O(e[r], n);
|
|
83
83
|
}), t;
|
|
84
84
|
}
|
|
85
|
-
const { Text:
|
|
85
|
+
const { Text: q } = Ce;
|
|
86
86
|
function dt({ value: e }) {
|
|
87
|
-
return e == null || e === "" ? /* @__PURE__ */
|
|
87
|
+
return e == null || e === "" ? /* @__PURE__ */ o.createElement(q, { type: "secondary" }, "-") : /* @__PURE__ */ o.createElement("span", null, String(e));
|
|
88
88
|
}
|
|
89
89
|
function ft({ value: e, digits: n = 2, showSymbol: t = !0 }) {
|
|
90
90
|
if (e == null || e === "")
|
|
91
|
-
return /* @__PURE__ */
|
|
92
|
-
const
|
|
93
|
-
return Number.isNaN(
|
|
91
|
+
return /* @__PURE__ */ o.createElement(q, { type: "secondary" }, "-");
|
|
92
|
+
const r = Number(e);
|
|
93
|
+
return Number.isNaN(r) ? /* @__PURE__ */ o.createElement(q, { type: "secondary" }, "-") : /* @__PURE__ */ o.createElement("span", { style: { color: r < 0 ? "#ff4d4f" : void 0 } }, Re(r, { digits: n, showSymbol: t }));
|
|
94
94
|
}
|
|
95
95
|
function mt({ value: e, digits: n = 0, percent: t = !1 }) {
|
|
96
96
|
if (e == null || e === "")
|
|
97
|
-
return /* @__PURE__ */
|
|
98
|
-
const
|
|
99
|
-
return Number.isNaN(
|
|
97
|
+
return /* @__PURE__ */ o.createElement(q, { type: "secondary" }, "-");
|
|
98
|
+
const r = Number(e);
|
|
99
|
+
return Number.isNaN(r) ? /* @__PURE__ */ o.createElement(q, { type: "secondary" }, "-") : /* @__PURE__ */ o.createElement("span", null, t ? Te(r, n) : oe(r, n));
|
|
100
100
|
}
|
|
101
101
|
function gt({ value: e, color: n, options: t }) {
|
|
102
102
|
if (e == null || e === "")
|
|
103
|
-
return /* @__PURE__ */
|
|
104
|
-
let
|
|
103
|
+
return /* @__PURE__ */ o.createElement(q, { type: "secondary" }, "-");
|
|
104
|
+
let r = n, i = e;
|
|
105
105
|
if (t && t.length) {
|
|
106
106
|
const s = t.find((m) => String(m.value) === String(e));
|
|
107
|
-
s && (i = s.label,
|
|
107
|
+
s && (i = s.label, r = r ?? s.color);
|
|
108
108
|
}
|
|
109
|
-
return /* @__PURE__ */
|
|
109
|
+
return /* @__PURE__ */ o.createElement(be, { color: r || "default" }, i);
|
|
110
110
|
}
|
|
111
111
|
function ht({ value: e, length: n = 30 }) {
|
|
112
112
|
if (e == null || e === "")
|
|
113
|
-
return /* @__PURE__ */
|
|
113
|
+
return /* @__PURE__ */ o.createElement(q, { type: "secondary" }, "-");
|
|
114
114
|
const t = String(e);
|
|
115
|
-
return t.length <= n ? /* @__PURE__ */
|
|
115
|
+
return t.length <= n ? /* @__PURE__ */ o.createElement("span", null, t) : /* @__PURE__ */ o.createElement(de, { title: t }, /* @__PURE__ */ o.createElement(q, { ellipsis: !0, style: { maxWidth: 240 } }, t));
|
|
116
116
|
}
|
|
117
117
|
function pt({ value: e, onClick: n }) {
|
|
118
|
-
return e == null || e === "" ? /* @__PURE__ */
|
|
118
|
+
return e == null || e === "" ? /* @__PURE__ */ o.createElement(q, { type: "secondary" }, "-") : /* @__PURE__ */ o.createElement("a", { onClick: () => n && n(e) }, String(e));
|
|
119
119
|
}
|
|
120
120
|
function yt({ value: e, actions: n = [] }) {
|
|
121
|
-
return /* @__PURE__ */
|
|
121
|
+
return /* @__PURE__ */ o.createElement("span", null, n.map((t) => /* @__PURE__ */ o.createElement(
|
|
122
122
|
"a",
|
|
123
123
|
{
|
|
124
124
|
key: t.key,
|
|
@@ -200,22 +200,22 @@ const St = {
|
|
|
200
200
|
contextRenderFooter: Qe
|
|
201
201
|
}, Ye = ({ onChange: e = () => {
|
|
202
202
|
}, columRef: n }) => {
|
|
203
|
-
const { language: t } = ge((
|
|
204
|
-
|
|
203
|
+
const { language: t } = ge((a) => a.controller), [r, i] = T(!1), [s, m] = T(
|
|
204
|
+
O(n.current)
|
|
205
205
|
);
|
|
206
206
|
V(() => {
|
|
207
|
-
const
|
|
208
|
-
!
|
|
209
|
-
}, [n == null ? void 0 : n.current,
|
|
207
|
+
const a = n == null ? void 0 : n.current;
|
|
208
|
+
!a || !a.length || r || m(O(a));
|
|
209
|
+
}, [n == null ? void 0 : n.current, r]);
|
|
210
210
|
const E = () => {
|
|
211
211
|
e({
|
|
212
212
|
column: s,
|
|
213
213
|
optType: "mergeColum"
|
|
214
214
|
}), i(!1);
|
|
215
|
-
}, x = (
|
|
216
|
-
s[
|
|
215
|
+
}, x = (a) => {
|
|
216
|
+
s[a].visible = !s[a].visible, m([...s]);
|
|
217
217
|
}, M = () => {
|
|
218
|
-
m(
|
|
218
|
+
m(O(n.current));
|
|
219
219
|
};
|
|
220
220
|
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
|
|
221
221
|
fe,
|
|
@@ -223,9 +223,9 @@ const St = {
|
|
|
223
223
|
placement: "bottomLeft",
|
|
224
224
|
trigger: "click",
|
|
225
225
|
className: _.poper,
|
|
226
|
-
open: !!
|
|
227
|
-
onOpenChange: (
|
|
228
|
-
i(
|
|
226
|
+
open: !!r,
|
|
227
|
+
onOpenChange: (a) => {
|
|
228
|
+
i(a);
|
|
229
229
|
},
|
|
230
230
|
content: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
231
231
|
"div",
|
|
@@ -248,7 +248,7 @@ const St = {
|
|
|
248
248
|
},
|
|
249
249
|
t ? "Custom List" : "自定义列表"
|
|
250
250
|
),
|
|
251
|
-
s.map((
|
|
251
|
+
s.map((a, S) => /* @__PURE__ */ React.createElement(
|
|
252
252
|
"div",
|
|
253
253
|
{
|
|
254
254
|
style: {
|
|
@@ -256,15 +256,15 @@ const St = {
|
|
|
256
256
|
display: "flex",
|
|
257
257
|
alignItems: "center"
|
|
258
258
|
},
|
|
259
|
-
key:
|
|
259
|
+
key: a + S
|
|
260
260
|
},
|
|
261
261
|
/* @__PURE__ */ React.createElement(
|
|
262
262
|
Ee,
|
|
263
263
|
{
|
|
264
264
|
color: "primary",
|
|
265
|
-
checked:
|
|
266
|
-
disabled:
|
|
267
|
-
onChange: (
|
|
265
|
+
checked: a.visible,
|
|
266
|
+
disabled: a.disabled,
|
|
267
|
+
onChange: (H) => x(S)
|
|
268
268
|
}
|
|
269
269
|
),
|
|
270
270
|
/* @__PURE__ */ React.createElement(
|
|
@@ -276,7 +276,7 @@ const St = {
|
|
|
276
276
|
marginLeft: "8px"
|
|
277
277
|
}
|
|
278
278
|
},
|
|
279
|
-
(t ?
|
|
279
|
+
(t ? a.enDisplay : a.cnDisplay) || a.field
|
|
280
280
|
)
|
|
281
281
|
))
|
|
282
282
|
), /* @__PURE__ */ React.createElement(
|
|
@@ -305,26 +305,26 @@ const St = {
|
|
|
305
305
|
xmlns: "http://www.w3.org/2000/svg",
|
|
306
306
|
width: "16",
|
|
307
307
|
height: "16"
|
|
308
|
-
}, Xe = (e) => /* @__PURE__ */
|
|
308
|
+
}, Xe = (e) => /* @__PURE__ */ o.createElement("svg", { ...ce, ...e, t: "1688438905306", "p-id": "2388" }, /* @__PURE__ */ o.createElement(
|
|
309
309
|
"path",
|
|
310
310
|
{
|
|
311
311
|
d: "M804.571 621.714a36.206 36.206 0 0 1-10.861 25.71l-256 256c-6.84 6.839-16.019 10.862-25.71 10.862s-18.87-3.987-25.71-10.862l-256-256a36.425 36.425 0 0 1-10.861-25.71c0-20.004 16.566-36.571 36.571-36.571h512c20.005 0 36.571 16.567 36.571 36.571z",
|
|
312
312
|
"p-id": "2389"
|
|
313
313
|
}
|
|
314
|
-
)), je = (e) => /* @__PURE__ */
|
|
314
|
+
)), je = (e) => /* @__PURE__ */ o.createElement("svg", { ...ce, ...e, t: "1688438923470", "p-id": "2523" }, /* @__PURE__ */ o.createElement(
|
|
315
315
|
"path",
|
|
316
316
|
{
|
|
317
317
|
d: "M804.571 402.286c0 20.004-16.566 36.571-36.571 36.571H256c-20.005 0-36.571-16.567-36.571-36.571a36.206 36.206 0 0 1 10.861-25.71l256-256c6.84-6.839 16.019-10.862 25.71-10.862s18.87 3.987 25.71 10.862l256 256a36.425 36.425 0 0 1 10.861 25.71z",
|
|
318
318
|
"p-id": "2524"
|
|
319
319
|
}
|
|
320
|
-
)), Ve = (e) => /* @__PURE__ */
|
|
320
|
+
)), Ve = (e) => /* @__PURE__ */ o.createElement("svg", { ...ce, ...e, t: "1688438886160", "p-id": "2253" }, /* @__PURE__ */ o.createElement(
|
|
321
321
|
"path",
|
|
322
322
|
{
|
|
323
323
|
d: "M804.571 621.714a36.206 36.206 0 0 1-10.861 25.71l-256 256c-6.84 6.839-16.019 10.862-25.71 10.862s-18.87-3.987-25.71-10.862l-256-256a36.425 36.425 0 0 1-10.861-25.71c0-20.004 16.566-36.571 36.571-36.571h512c20.005 0 36.571 16.567 36.571 36.571z m0-219.428c0 20.004-16.566 36.571-36.571 36.571H256c-20.005 0-36.571-16.567-36.571-36.571a36.206 36.206 0 0 1 10.861-25.71l256-256c6.84-6.839 16.019-10.862 25.71-10.862s18.87 3.987 25.71 10.862l256 256a36.425 36.425 0 0 1 10.861 25.71z",
|
|
324
324
|
"p-id": "2254"
|
|
325
325
|
}
|
|
326
326
|
)), et = (e) => {
|
|
327
|
-
const [n, t] = T("inactive"), [
|
|
327
|
+
const [n, t] = T("inactive"), [r, i] = T("inactive"), [s, m] = T("inactive"), E = L(null), [x, M] = T(!1), [a, S] = T(null), H = () => {
|
|
328
328
|
e.showColumnMenu(E.current);
|
|
329
329
|
};
|
|
330
330
|
V(() => {
|
|
@@ -334,7 +334,7 @@ const St = {
|
|
|
334
334
|
}, [e.filterKey, e.field]);
|
|
335
335
|
const b = () => {
|
|
336
336
|
const c = e.column.getSort();
|
|
337
|
-
t(c === "asc" ? "active" : "inactive"), i(c === "desc" ? "active" : "inactive"), m(c ? "inactive" : "active");
|
|
337
|
+
console.log(c, "sort"), t(c === "asc" ? "active" : "inactive"), i(c === "desc" ? "active" : "inactive"), m(c ? "inactive" : "active");
|
|
338
338
|
}, w = (c, g) => {
|
|
339
339
|
e.setSort(c, g.shiftKey);
|
|
340
340
|
};
|
|
@@ -345,51 +345,35 @@ const St = {
|
|
|
345
345
|
c.removeEventListener("sortChanged", b);
|
|
346
346
|
};
|
|
347
347
|
}, [e.column]), e.enableFilterButton && `${e.menuIcon}`;
|
|
348
|
-
let
|
|
349
|
-
e.enableSorting && (
|
|
350
|
-
"div",
|
|
351
|
-
{
|
|
352
|
-
onClick: (c) => w("asc", c),
|
|
353
|
-
onTouchEnd: (c) => w("asc", c),
|
|
354
|
-
className: `${_.customSort} ${_[n]}`
|
|
355
|
-
},
|
|
356
|
-
/* @__PURE__ */ r.createElement(Xe, null)
|
|
357
|
-
), /* @__PURE__ */ r.createElement(
|
|
348
|
+
let K = null;
|
|
349
|
+
e.enableSorting && (K = /* @__PURE__ */ o.createElement("div", { className: _.sortNames }, /* @__PURE__ */ o.createElement("div", { onClick: (c) => w("", c), onTouchEnd: (c) => w("", c), className: `${_.customSort} ${_[n]}` }, /* @__PURE__ */ o.createElement(je, null)), /* @__PURE__ */ o.createElement("div", { onClick: (c) => w("asc", c), onTouchEnd: (c) => w("desc", c), className: `${_.customSort} ${_[r]}` }, /* @__PURE__ */ o.createElement(Xe, null)), /* @__PURE__ */ o.createElement(
|
|
358
350
|
"div",
|
|
359
351
|
{
|
|
360
352
|
onClick: (c) => w("desc", c),
|
|
361
|
-
onTouchEnd: (c) => w("desc", c),
|
|
362
|
-
className: `${_.customSort} ${_[o]}`
|
|
363
|
-
},
|
|
364
|
-
/* @__PURE__ */ r.createElement(je, null)
|
|
365
|
-
), /* @__PURE__ */ r.createElement(
|
|
366
|
-
"div",
|
|
367
|
-
{
|
|
368
|
-
onClick: (c) => w("", c),
|
|
369
353
|
onTouchEnd: (c) => w("", c),
|
|
370
354
|
className: `${_.customSort} ${_.customUnSort} ${_[s]}`
|
|
371
355
|
},
|
|
372
|
-
/* @__PURE__ */
|
|
356
|
+
/* @__PURE__ */ o.createElement(Ve, null)
|
|
373
357
|
)));
|
|
374
358
|
const U = {
|
|
375
359
|
width: "100%"
|
|
376
360
|
}, J = F(() => {
|
|
377
361
|
var g, p;
|
|
378
362
|
let c = ((g = e.filterSearchRender[e.field]) == null ? void 0 : g.render) || me;
|
|
379
|
-
return /* @__PURE__ */
|
|
363
|
+
return /* @__PURE__ */ o.createElement(
|
|
380
364
|
c,
|
|
381
365
|
{
|
|
382
366
|
...((p = e.filterSearchRender[e.field]) == null ? void 0 : p.tPropty) || {},
|
|
383
|
-
value:
|
|
367
|
+
value: a,
|
|
384
368
|
onChange: (d) => {
|
|
385
369
|
S(d.target ? d.target.value : d);
|
|
386
370
|
},
|
|
387
371
|
style: U
|
|
388
372
|
}
|
|
389
373
|
);
|
|
390
|
-
}, [e.field,
|
|
391
|
-
let
|
|
392
|
-
return e.search && (
|
|
374
|
+
}, [e.field, a]);
|
|
375
|
+
let $ = null;
|
|
376
|
+
return e.search && ($ = /* @__PURE__ */ o.createElement("div", null, /* @__PURE__ */ o.createElement(
|
|
393
377
|
fe,
|
|
394
378
|
{
|
|
395
379
|
arrow: !1,
|
|
@@ -398,22 +382,22 @@ const St = {
|
|
|
398
382
|
overlayClassName: _.popoverContext,
|
|
399
383
|
onOpenChange: (c) => M(c),
|
|
400
384
|
placement: "bottom",
|
|
401
|
-
content: /* @__PURE__ */
|
|
385
|
+
content: /* @__PURE__ */ o.createElement("div", { className: _.contextRender }, J, /* @__PURE__ */ o.createElement("div", { className: _.contextRenderFooter }, /* @__PURE__ */ o.createElement(
|
|
402
386
|
ee,
|
|
403
387
|
{
|
|
404
388
|
type: "primary",
|
|
405
389
|
onClick: () => {
|
|
406
390
|
const c = e.filterKey.filter((p) => p.field != e.field);
|
|
407
|
-
|
|
391
|
+
a != null && a.length && c.push({
|
|
408
392
|
field: e.field,
|
|
409
|
-
value:
|
|
393
|
+
value: a
|
|
410
394
|
});
|
|
411
395
|
const g = c != null && c.length ? c : [];
|
|
412
396
|
e.onSearch(g), e.setfilterKey(g), M(!1);
|
|
413
397
|
}
|
|
414
398
|
},
|
|
415
399
|
e.language ? "Search" : "搜索"
|
|
416
|
-
), /* @__PURE__ */
|
|
400
|
+
), /* @__PURE__ */ o.createElement(
|
|
417
401
|
ee,
|
|
418
402
|
{
|
|
419
403
|
style: { marginLeft: 10 },
|
|
@@ -425,13 +409,13 @@ const St = {
|
|
|
425
409
|
e.language ? "Reset" : "重置"
|
|
426
410
|
)))
|
|
427
411
|
},
|
|
428
|
-
/* @__PURE__ */
|
|
429
|
-
))), /* @__PURE__ */
|
|
412
|
+
/* @__PURE__ */ o.createElement(ke, { style: { color: a ? "#1890ff" : "rgba(0, 0, 0, 0.25)", marginLeft: 10, cursor: "pointer" } })
|
|
413
|
+
))), /* @__PURE__ */ o.createElement("div", { className: _.customHead }, /* @__PURE__ */ o.createElement("div", { className: "customHeaderLabel" }, e.displayName), K, $);
|
|
430
414
|
}, tt = ({
|
|
431
415
|
columnDefs: e = [],
|
|
432
416
|
loading: n,
|
|
433
417
|
customBottomTotal: t = !1,
|
|
434
|
-
onChange:
|
|
418
|
+
onChange: r = () => {
|
|
435
419
|
},
|
|
436
420
|
tableRef: i,
|
|
437
421
|
tableData: s,
|
|
@@ -439,23 +423,23 @@ const St = {
|
|
|
439
423
|
reset: E = {},
|
|
440
424
|
customColumn: x = [],
|
|
441
425
|
filterSearchRender: M = {},
|
|
442
|
-
setfilterKey:
|
|
426
|
+
setfilterKey: a,
|
|
443
427
|
filterKey: S
|
|
444
428
|
}) => {
|
|
445
|
-
const
|
|
429
|
+
const H = F(() => ({ width: "100%", height: "100%", position: "relative" }), []), b = F(() => ({ height: "100%", width: "100%" }), []), w = ge((l) => l.controller.language), K = F(() => {
|
|
446
430
|
const l = m && typeof m == "object" ? m.total : void 0;
|
|
447
431
|
return typeof l == "number" && !Number.isNaN(l) ? l : Array.isArray(s) ? s.length : 0;
|
|
448
432
|
}, [m, s]), U = F(() => {
|
|
449
433
|
let l = {};
|
|
450
|
-
return e.map((
|
|
451
|
-
if (
|
|
452
|
-
l[
|
|
434
|
+
return e.map((u, k) => {
|
|
435
|
+
if (k == 0)
|
|
436
|
+
l[u.field] = "Total", l.fromData = "total";
|
|
453
437
|
else {
|
|
454
|
-
let
|
|
455
|
-
s.map((
|
|
456
|
-
let Q =
|
|
457
|
-
!isNaN(Number(
|
|
458
|
-
}), l[
|
|
438
|
+
let B = u.lockPosition ? "" : 0;
|
|
439
|
+
s.map((I) => {
|
|
440
|
+
let Q = u.field != u.key && u.key ? u.key : u.field, Y = ["jobCurrency", "industries", "jobSalaryRange"];
|
|
441
|
+
!isNaN(Number(I[Q])) && !Y.includes(u.field) && (B += Number(I[Q]));
|
|
442
|
+
}), l[u.field] = typeof B == "number" && B > 0 ? B : "--";
|
|
459
443
|
}
|
|
460
444
|
}), [l];
|
|
461
445
|
}, [s, e]), J = {
|
|
@@ -464,49 +448,50 @@ const St = {
|
|
|
464
448
|
active: !1,
|
|
465
449
|
unSortIcon: !0,
|
|
466
450
|
minWidth: 200,
|
|
467
|
-
comparator: (l,
|
|
451
|
+
comparator: (l, u, k, B, I) => 0,
|
|
468
452
|
headerComponent: et
|
|
469
453
|
// suppressMovable: !isDrag,
|
|
470
|
-
},
|
|
454
|
+
}, $ = F(() => ({
|
|
471
455
|
width: 170,
|
|
472
456
|
lockPinned: !0
|
|
473
457
|
}), []), c = R((l) => {
|
|
474
458
|
i && (i.current = l);
|
|
475
459
|
}, []), g = (l) => {
|
|
476
|
-
var
|
|
477
|
-
const { isNotTip:
|
|
478
|
-
return
|
|
460
|
+
var I;
|
|
461
|
+
const { isNotTip: u, render: k } = l.colDef || {}, B = ((I = l.data) == null ? void 0 : I.fromData) === "total";
|
|
462
|
+
return k && !B ? k(l) : /* @__PURE__ */ o.createElement(de, { title: u ? "" : l.value || "", arrow: !0, placement: "top" }, typeof l.value == "number" || l.value ? l.value : "--");
|
|
479
463
|
}, p = R((l) => {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
464
|
+
var k;
|
|
465
|
+
const u = ((k = l.api.getState().sort) == null ? void 0 : k.sortModel) ?? [];
|
|
466
|
+
r({
|
|
467
|
+
sort: u[0] ?? null,
|
|
483
468
|
optType: "sort"
|
|
484
469
|
});
|
|
485
|
-
}, []), d = (l) => {
|
|
486
|
-
|
|
487
|
-
column: l.api.getColumnDefs().filter((
|
|
488
|
-
...
|
|
470
|
+
}, [r]), d = (l) => {
|
|
471
|
+
r({
|
|
472
|
+
column: l.api.getColumnDefs().filter((u) => u.field).map((u) => ({
|
|
473
|
+
...u,
|
|
489
474
|
pinned: void 0,
|
|
490
|
-
field:
|
|
491
|
-
hide:
|
|
492
|
-
visible:
|
|
475
|
+
field: u.field,
|
|
476
|
+
hide: u.hide,
|
|
477
|
+
visible: u.visible
|
|
493
478
|
}))
|
|
494
479
|
});
|
|
495
|
-
}, Z = (l,
|
|
496
|
-
|
|
480
|
+
}, Z = (l, u) => {
|
|
481
|
+
r({
|
|
497
482
|
optType: "mergeColum",
|
|
498
483
|
pagination: {
|
|
499
484
|
page: l,
|
|
500
|
-
size:
|
|
485
|
+
size: u
|
|
501
486
|
}
|
|
502
487
|
});
|
|
503
488
|
};
|
|
504
|
-
return /* @__PURE__ */
|
|
489
|
+
return /* @__PURE__ */ o.createElement("div", { style: H }, n ? /* @__PURE__ */ o.createElement("div", { className: "loadingContent" }, /* @__PURE__ */ o.createElement(Se, null)) : null, /* @__PURE__ */ o.createElement("div", { style: b, className: "ag-theme-alpine AgGridReact" }, /* @__PURE__ */ o.createElement(
|
|
505
490
|
_e,
|
|
506
491
|
{
|
|
507
492
|
rowData: s,
|
|
508
493
|
pinnedBottomRowData: t ? U : [],
|
|
509
|
-
defaultColDef:
|
|
494
|
+
defaultColDef: $,
|
|
510
495
|
suppressRowTransform: !0,
|
|
511
496
|
onSortChanged: p,
|
|
512
497
|
onDragStopped: d,
|
|
@@ -522,12 +507,12 @@ const St = {
|
|
|
522
507
|
// crm写法
|
|
523
508
|
cellRenderer: g,
|
|
524
509
|
headerComponentParams: {
|
|
525
|
-
onSearch: (
|
|
526
|
-
console.log(
|
|
527
|
-
filter:
|
|
510
|
+
onSearch: (u) => {
|
|
511
|
+
console.log(u, "搜索"), r({
|
|
512
|
+
filter: u || {}
|
|
528
513
|
});
|
|
529
514
|
},
|
|
530
|
-
setfilterKey:
|
|
515
|
+
setfilterKey: a,
|
|
531
516
|
filterKey: S,
|
|
532
517
|
language: w,
|
|
533
518
|
filterSearchRender: M,
|
|
@@ -547,54 +532,54 @@ const St = {
|
|
|
547
532
|
},
|
|
548
533
|
onGridReady: c
|
|
549
534
|
}
|
|
550
|
-
)), m ? /* @__PURE__ */
|
|
535
|
+
)), m ? /* @__PURE__ */ o.createElement(we, { total: K, onChange: Z, ...m }) : null);
|
|
551
536
|
}, wt = (e = {}, n = {}) => {
|
|
552
537
|
var ie;
|
|
553
538
|
const {
|
|
554
539
|
sessionKey: t,
|
|
555
|
-
renderKey:
|
|
540
|
+
renderKey: r,
|
|
556
541
|
setParamsList: i,
|
|
557
542
|
configKey: s,
|
|
558
543
|
tableUrl: m,
|
|
559
544
|
tableRequest: E,
|
|
560
545
|
getColConfigRequest: x,
|
|
561
546
|
saveColConfigRequest: M
|
|
562
|
-
} = { ...n, ...e },
|
|
547
|
+
} = { ...n, ...e }, a = typeof window < "u" && !!window.sessionStorage, S = R(
|
|
563
548
|
(f) => {
|
|
564
|
-
if (
|
|
549
|
+
if (a)
|
|
565
550
|
try {
|
|
566
551
|
window.sessionStorage.setItem(t, JSON.stringify(f));
|
|
567
552
|
} catch (y) {
|
|
568
553
|
console.warn("[useTableModule] sessionStorage 写入失败:", y);
|
|
569
554
|
}
|
|
570
555
|
},
|
|
571
|
-
[t,
|
|
572
|
-
),
|
|
573
|
-
if (!
|
|
556
|
+
[t, a]
|
|
557
|
+
), H = R(() => {
|
|
558
|
+
if (!a) return null;
|
|
574
559
|
try {
|
|
575
560
|
const f = window.sessionStorage.getItem(t);
|
|
576
561
|
return f ? JSON.parse(f) : null;
|
|
577
562
|
} catch (f) {
|
|
578
563
|
return console.warn("[useTableModule] sessionStorage 读取失败:", f), null;
|
|
579
564
|
}
|
|
580
|
-
}, [t,
|
|
581
|
-
|
|
582
|
-
const
|
|
583
|
-
|
|
584
|
-
const
|
|
585
|
-
|
|
586
|
-
const Q =
|
|
587
|
-
Q.current =
|
|
588
|
-
const Y =
|
|
565
|
+
}, [t, a]), b = L([]), [w, K] = T([]), [U, J] = T([]), [$, c] = T(void 0), [g, p] = T(!0), d = L(H() || {}), [Z, l] = T(((ie = H()) == null ? void 0 : ie.filter) || []), u = L(0), k = L(E);
|
|
566
|
+
k.current = E;
|
|
567
|
+
const B = L(m);
|
|
568
|
+
B.current = m;
|
|
569
|
+
const I = L(i);
|
|
570
|
+
I.current = i;
|
|
571
|
+
const Q = L(r);
|
|
572
|
+
Q.current = r;
|
|
573
|
+
const Y = L(x);
|
|
589
574
|
Y.current = x;
|
|
590
|
-
const se =
|
|
575
|
+
const se = L(M);
|
|
591
576
|
se.current = M;
|
|
592
577
|
const X = R(() => {
|
|
593
578
|
const { sort: f } = d.current, y = b.current.map((v) => ({
|
|
594
579
|
...v,
|
|
595
580
|
sort: f && f.colId == v.field ? f.sort : void 0
|
|
596
581
|
}));
|
|
597
|
-
|
|
582
|
+
K(O(y));
|
|
598
583
|
}, []), ne = R(() => {
|
|
599
584
|
const f = se.current;
|
|
600
585
|
if (!f) {
|
|
@@ -610,38 +595,38 @@ const St = {
|
|
|
610
595
|
columnConfig: b.current
|
|
611
596
|
}
|
|
612
597
|
}, v = f(y);
|
|
613
|
-
v && typeof v.catch == "function" && v.catch((
|
|
614
|
-
}, [s]),
|
|
615
|
-
const f =
|
|
598
|
+
v && typeof v.catch == "function" && v.catch((A) => console.error("[useTableModule] 列配置保存失败:", A));
|
|
599
|
+
}, [s]), z = R(() => {
|
|
600
|
+
const f = k.current;
|
|
616
601
|
if (!f) {
|
|
617
602
|
console.warn("[useTableModule] 未注入 tableRequest,跳过列表加载"), p(!1);
|
|
618
603
|
return;
|
|
619
604
|
}
|
|
620
|
-
|
|
621
|
-
const y =
|
|
622
|
-
return p(!0), f(
|
|
623
|
-
(
|
|
624
|
-
if (y !==
|
|
625
|
-
const C =
|
|
626
|
-
typeof
|
|
605
|
+
u.current += 1;
|
|
606
|
+
const y = u.current, v = I.current, A = v ? v(d.current) : d.current;
|
|
607
|
+
return p(!0), f(A, B.current).then(
|
|
608
|
+
(P) => {
|
|
609
|
+
if (y !== u.current) return;
|
|
610
|
+
const C = P == null ? void 0 : P.response, N = Array.isArray(C) ? C : (C == null ? void 0 : C.data) || [], D = Array.isArray(C) || C == null ? void 0 : C.total;
|
|
611
|
+
typeof D == "number" && !Number.isNaN(D) && c(D);
|
|
627
612
|
const re = N.map((h) => ({
|
|
628
613
|
...h,
|
|
629
614
|
...h._source || {}
|
|
630
615
|
}));
|
|
631
616
|
J(re), p(!1);
|
|
632
617
|
},
|
|
633
|
-
(
|
|
634
|
-
y ===
|
|
618
|
+
(P) => {
|
|
619
|
+
y === u.current && (console.error("[useTableModule] 列表加载失败:", P), p(!1));
|
|
635
620
|
}
|
|
636
621
|
);
|
|
637
622
|
}, []), j = R(
|
|
638
623
|
(f) => {
|
|
639
|
-
const { column: y, optType: v, sort:
|
|
624
|
+
const { column: y, optType: v, sort: A, pagination: P, filter: C } = f;
|
|
640
625
|
let N = [];
|
|
641
626
|
if (y) {
|
|
642
|
-
const
|
|
627
|
+
const D = new Map(y.map((h) => [h.field, h]));
|
|
643
628
|
N = b.current.map((h) => {
|
|
644
|
-
const G =
|
|
629
|
+
const G = D.get(h.field);
|
|
645
630
|
if (!G) return { ...h };
|
|
646
631
|
const ae = G.visible !== void 0 ? G.visible : !G.hide;
|
|
647
632
|
return { ...h, hide: !ae, visible: ae };
|
|
@@ -654,18 +639,18 @@ const St = {
|
|
|
654
639
|
}
|
|
655
640
|
}), b.current = N, ne();
|
|
656
641
|
}
|
|
657
|
-
v == "mergeColum" &&
|
|
642
|
+
v == "mergeColum" && K(O(N != null && N.length ? N : b.current)), v == "sort" && (d.current = {
|
|
658
643
|
...d.current,
|
|
659
|
-
sort:
|
|
660
|
-
}, S(d.current), X(),
|
|
644
|
+
sort: A
|
|
645
|
+
}, S(d.current), X(), z()), P && (d.current = {
|
|
661
646
|
...d.current,
|
|
662
|
-
...
|
|
663
|
-
}, S(d.current),
|
|
647
|
+
...P
|
|
648
|
+
}, S(d.current), z()), C && (d.current = {
|
|
664
649
|
...d.current,
|
|
665
650
|
filter: C
|
|
666
|
-
}, d.current.page && d.current.page > 1 && (d.current.page = 1), S(d.current),
|
|
651
|
+
}, d.current.page && d.current.page > 1 && (d.current.page = 1), S(d.current), z());
|
|
667
652
|
},
|
|
668
|
-
[S, ne, X,
|
|
653
|
+
[S, ne, X, z]
|
|
669
654
|
), le = R(() => {
|
|
670
655
|
const f = Y.current;
|
|
671
656
|
if (!f) {
|
|
@@ -674,25 +659,25 @@ const St = {
|
|
|
674
659
|
}
|
|
675
660
|
const { sort: y } = d.current, v = Q.current;
|
|
676
661
|
f(s).then(
|
|
677
|
-
({ response:
|
|
662
|
+
({ response: A }) => {
|
|
678
663
|
var N;
|
|
679
|
-
const C = (((N =
|
|
680
|
-
...
|
|
681
|
-
hide: !
|
|
682
|
-
visible:
|
|
683
|
-
sort: y && y.colId ==
|
|
684
|
-
render: v ? v[
|
|
664
|
+
const C = (((N = A == null ? void 0 : A.userConfig) == null ? void 0 : N.columnConfig) || []).map((D) => ({
|
|
665
|
+
...D,
|
|
666
|
+
hide: !D.visible,
|
|
667
|
+
visible: D.visible,
|
|
668
|
+
sort: y && y.colId == D.field ? y.sort : void 0,
|
|
669
|
+
render: v ? v[D.field] : void 0
|
|
685
670
|
}));
|
|
686
|
-
|
|
671
|
+
K(O(C)), b.current = O(C), z();
|
|
687
672
|
},
|
|
688
|
-
(
|
|
689
|
-
console.error("[useTableModule] 列配置加载失败:",
|
|
673
|
+
(A) => {
|
|
674
|
+
console.error("[useTableModule] 列配置加载失败:", A), p(!1);
|
|
690
675
|
}
|
|
691
676
|
);
|
|
692
|
-
}, [s,
|
|
693
|
-
const f =
|
|
694
|
-
d.current = f, l(f.filter || []), X(),
|
|
695
|
-
}, [
|
|
677
|
+
}, [s, z]), pe = R(() => {
|
|
678
|
+
const f = H() || {};
|
|
679
|
+
d.current = f, l(f.filter || []), X(), z();
|
|
680
|
+
}, [H, X, z]);
|
|
696
681
|
V(() => {
|
|
697
682
|
s && le();
|
|
698
683
|
}, [s]);
|
|
@@ -710,20 +695,20 @@ const St = {
|
|
|
710
695
|
pagination: {
|
|
711
696
|
current: d.current.page,
|
|
712
697
|
pageSize: d.current.size,
|
|
713
|
-
total:
|
|
698
|
+
total: $
|
|
714
699
|
},
|
|
715
700
|
onChange: j,
|
|
716
701
|
tableData: U,
|
|
717
702
|
...f
|
|
718
703
|
}
|
|
719
704
|
),
|
|
720
|
-
[Z, g, w, U,
|
|
705
|
+
[Z, g, w, U, $, j]
|
|
721
706
|
);
|
|
722
707
|
return {
|
|
723
708
|
SettingTableRender: ye,
|
|
724
709
|
TableListRender: ve,
|
|
725
710
|
// 需要单独回调的就抛出去,特殊场景多个列表使用,平常用url回调一次
|
|
726
|
-
getTableData:
|
|
711
|
+
getTableData: z,
|
|
727
712
|
//获取列表数据
|
|
728
713
|
getColConfig: le,
|
|
729
714
|
//获取配置接口
|
|
@@ -737,23 +722,23 @@ const St = {
|
|
|
737
722
|
loading: g,
|
|
738
723
|
columnDefs: w,
|
|
739
724
|
paramsCurrent: d,
|
|
740
|
-
total:
|
|
725
|
+
total: $,
|
|
741
726
|
filterKey: Z
|
|
742
727
|
};
|
|
743
728
|
}, nt = {
|
|
744
729
|
width: "100%"
|
|
745
|
-
}, _t = ({ dataIndex: e, language: n, onChange: t, value:
|
|
730
|
+
}, _t = ({ dataIndex: e, language: n, onChange: t, value: r, ...i }) => {
|
|
746
731
|
const s = F(() => /* @__PURE__ */ React.createElement(
|
|
747
732
|
me,
|
|
748
733
|
{
|
|
749
|
-
value:
|
|
734
|
+
value: r != null && r.length ? r : null,
|
|
750
735
|
style: nt,
|
|
751
736
|
...i,
|
|
752
737
|
onChange: (m) => {
|
|
753
738
|
t(m.target.value);
|
|
754
739
|
}
|
|
755
740
|
}
|
|
756
|
-
), [e,
|
|
741
|
+
), [e, r]);
|
|
757
742
|
return /* @__PURE__ */ React.createElement(
|
|
758
743
|
"div",
|
|
759
744
|
{
|
|
@@ -789,7 +774,7 @@ export {
|
|
|
789
774
|
vt as crmTheme,
|
|
790
775
|
ut as cx,
|
|
791
776
|
at as debounce,
|
|
792
|
-
|
|
777
|
+
O as deepClone,
|
|
793
778
|
Re as formatMoney,
|
|
794
779
|
oe as formatNumber,
|
|
795
780
|
Te as formatPercent,
|