@kingteza/crud-component 1.0.56 → 1.0.58
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/App.d.ts +5 -0
- package/common/button/Button.cjs.js +1 -1
- package/common/button/Button.d.ts +2 -3
- package/common/button/Button.es.js +54 -61
- package/crud/CrudComponent.cjs.js +1 -1
- package/crud/CrudComponent.d.ts +5 -1
- package/crud/CrudComponent.es.js +138 -137
- package/crud/CrudField.cjs.js +1 -1
- package/crud/CrudField.es.js +160 -159
- package/crud/CrudForm.cjs.js +1 -1
- package/crud/CrudForm.es.js +57 -56
- package/crud/CrudFormWizard.cjs.js +1 -1
- package/crud/CrudFormWizard.es.js +53 -52
- package/crud/CrudSearchComponent.cjs.js +1 -1
- package/crud/CrudSearchComponent.es.js +39 -38
- package/crud/CrudTextAreaComponent.cjs.js +1 -1
- package/crud/CrudTextAreaComponent.es.js +29 -28
- package/crud/FileCrudField.cjs.js +1 -1
- package/crud/FileCrudField.es.js +70 -69
- package/crud/view/CrudDecListView.cjs.js +1 -1
- package/crud/view/CrudDecListView.es.js +29 -25
- package/crud/view/CrudViewer.cjs.js +1 -1
- package/crud/view/CrudViewer.es.js +137 -133
- package/crud/view/CrudViewerUtil.cjs.js +1 -1
- package/crud/view/CrudViewerUtil.es.js +51 -48
- package/hooks/NavigatorHooks.cjs.js +1 -1
- package/hooks/NavigatorHooks.d.ts +1 -1
- package/hooks/NavigatorHooks.es.js +4 -3
- package/package.json +2 -2
- package/util/CrudUtil.cjs.js +1 -0
- package/util/CrudUtil.d.ts +5 -0
- package/util/CrudUtil.es.js +8 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsxs as D, Fragment as G, jsx as
|
|
1
|
+
import { jsxs as D, Fragment as G, jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import { Modal as It } from "antd";
|
|
3
3
|
import { DndContext as St } from "@dnd-kit/core";
|
|
4
|
-
import { restrictToVerticalAxis as
|
|
5
|
-
import { CSS as
|
|
6
|
-
import { arrayMove as
|
|
4
|
+
import { restrictToVerticalAxis as Bt } from "@dnd-kit/modifiers";
|
|
5
|
+
import { CSS as Ct } from "@dnd-kit/utilities";
|
|
6
|
+
import { arrayMove as et, SortableContext as Rt, verticalListSortingStrategy as xt, useSortable as Nt } from "@dnd-kit/sortable";
|
|
7
7
|
import Dt from "../../common/button/Button.es.js";
|
|
8
8
|
import Et from "../../common/button/CloneButtonTable.es.js";
|
|
9
9
|
import Lt from "../../common/button/DeleteButtonTable.es.js";
|
|
@@ -13,28 +13,29 @@ import { RefreshButton as jt } from "../../common/button/RefreshButton.es.js";
|
|
|
13
13
|
import zt from "../../common/button/UpdateButtonTable.es.js";
|
|
14
14
|
import Vt from "../../common/button/ViewButtonTable.es.js";
|
|
15
15
|
import wt from "../../common/table/table.es.js";
|
|
16
|
-
import
|
|
17
|
-
import { useTranslationLib as
|
|
18
|
-
import
|
|
19
|
-
import { CrudDecListView as
|
|
16
|
+
import ut, { useMemo as T, useState as J, useEffect as st, useCallback as K, useContext as _t } from "react";
|
|
17
|
+
import { useTranslationLib as $t } from "../../locale/index.es.js";
|
|
18
|
+
import qt from "../CrudSearchComponent.es.js";
|
|
19
|
+
import { CrudDecListView as Gt } from "./CrudDecListView.es.js";
|
|
20
20
|
import { getRendererValueCrudViewer as mt } from "./CrudViewerUtil.es.js";
|
|
21
|
-
import { HolderOutlined as
|
|
22
|
-
import
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
import { HolderOutlined as Jt } from "@ant-design/icons";
|
|
22
|
+
import ct from "../../util/CrudUtil.es.js";
|
|
23
|
+
import Kt from "../../common/layout/VerticalSpace.es.js";
|
|
24
|
+
const Qt = ut.memo(wt);
|
|
25
|
+
function yo({
|
|
25
26
|
idField: o = "id",
|
|
26
|
-
loadingData:
|
|
27
|
+
loadingData: I,
|
|
27
28
|
fields: u,
|
|
28
|
-
isDeleting:
|
|
29
|
-
isHiding:
|
|
29
|
+
isDeleting: R,
|
|
30
|
+
isHiding: S,
|
|
30
31
|
viewable: f = !1,
|
|
31
32
|
paginateProps: h,
|
|
32
33
|
onDelete: y,
|
|
33
|
-
onHide:
|
|
34
|
-
onUpdate:
|
|
34
|
+
onHide: x,
|
|
35
|
+
onUpdate: v,
|
|
35
36
|
data: B = [],
|
|
36
37
|
extraAction: C,
|
|
37
|
-
onClickUpdate:
|
|
38
|
+
onClickUpdate: l,
|
|
38
39
|
minusHeight: O,
|
|
39
40
|
scroll: Q,
|
|
40
41
|
onClickClone: E,
|
|
@@ -42,86 +43,89 @@ function io({
|
|
|
42
43
|
expandable: Y,
|
|
43
44
|
size: Z,
|
|
44
45
|
bordered: A,
|
|
45
|
-
descListColumn:
|
|
46
|
+
descListColumn: it,
|
|
46
47
|
extraView: j,
|
|
47
|
-
decListLayout:
|
|
48
|
-
scrollToTop:
|
|
48
|
+
decListLayout: ht,
|
|
49
|
+
scrollToTop: Zt,
|
|
49
50
|
onClickRefresh: P,
|
|
50
51
|
closeViewOnClickUpdate: W,
|
|
51
52
|
onExport: z,
|
|
52
53
|
confirmHiding: k,
|
|
53
54
|
confirmDeleting: H,
|
|
54
55
|
rowClassName: U,
|
|
55
|
-
actionWidth:
|
|
56
|
+
actionWidth: a = 190,
|
|
56
57
|
draggable: r,
|
|
57
|
-
...
|
|
58
|
+
...yt
|
|
58
59
|
}) {
|
|
59
|
-
const { t:
|
|
60
|
+
const { t: b } = $t(), d = T(
|
|
60
61
|
() => u.map(
|
|
61
|
-
({ hideInTable: t, hidden: n, width: m,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
62
|
+
({ hideInTable: t, hidden: n, width: m, label: e, halign: $, ...N }) => {
|
|
63
|
+
const M = ct.getRealName(N.name);
|
|
64
|
+
return {
|
|
65
|
+
title: e,
|
|
66
|
+
width: m,
|
|
67
|
+
key: M,
|
|
68
|
+
dataIndex: M,
|
|
69
|
+
hidden: t || n,
|
|
70
|
+
align: $ ?? (N.type === "number" ? "right" : void 0),
|
|
71
|
+
render: mt(N)
|
|
72
|
+
};
|
|
73
|
+
}
|
|
70
74
|
),
|
|
71
75
|
[u]
|
|
72
|
-
), [
|
|
73
|
-
|
|
74
|
-
B &&
|
|
75
|
-
}, [B]),
|
|
76
|
+
), [c, L] = J(), [V, w] = J(), [p, F] = J([]);
|
|
77
|
+
st(() => {
|
|
78
|
+
B && F(B);
|
|
79
|
+
}, [B]), st(() => {
|
|
76
80
|
B && L((t) => {
|
|
77
81
|
if (t)
|
|
78
82
|
return B.find((n) => n[o] === t[o]);
|
|
79
83
|
});
|
|
80
|
-
}, [B, o,
|
|
81
|
-
const
|
|
84
|
+
}, [B, o, c]);
|
|
85
|
+
const _ = K(
|
|
82
86
|
(t) => {
|
|
83
87
|
var m;
|
|
84
88
|
const n = C == null ? void 0 : C(t);
|
|
85
|
-
return (Array.isArray(n) ? (m = n == null ? void 0 : n.filter(Boolean)) != null && m.length : n) ||
|
|
89
|
+
return (Array.isArray(n) ? (m = n == null ? void 0 : n.filter(Boolean)) != null && m.length : n) || v || l || E || y ? /* @__PURE__ */ D(G, { children: [
|
|
86
90
|
n,
|
|
87
|
-
(
|
|
91
|
+
(v || l) && /* @__PURE__ */ s(
|
|
88
92
|
zt,
|
|
89
93
|
{
|
|
90
94
|
value: t,
|
|
91
|
-
onClick: (
|
|
92
|
-
w(
|
|
95
|
+
onClick: (e) => {
|
|
96
|
+
w(e[o]), l == null || l(t), W && L(void 0);
|
|
93
97
|
}
|
|
94
98
|
}
|
|
95
99
|
),
|
|
96
|
-
E && /* @__PURE__ */
|
|
97
|
-
z && /* @__PURE__ */
|
|
100
|
+
E && /* @__PURE__ */ s(Et, { value: t, onClick: (e) => E(e) }),
|
|
101
|
+
z && /* @__PURE__ */ s(
|
|
98
102
|
Mt,
|
|
99
103
|
{
|
|
100
104
|
value: t,
|
|
101
|
-
onClick: async (
|
|
105
|
+
onClick: async (e) => await z(e)
|
|
102
106
|
}
|
|
103
107
|
),
|
|
104
|
-
|
|
108
|
+
x && /* @__PURE__ */ s(
|
|
105
109
|
Ot,
|
|
106
110
|
{
|
|
107
111
|
value: t,
|
|
108
|
-
disabled:
|
|
112
|
+
disabled: S,
|
|
109
113
|
shouldConfirm: k,
|
|
110
|
-
loading:
|
|
111
|
-
onClick: async (
|
|
112
|
-
w(
|
|
114
|
+
loading: S && t[o] === V,
|
|
115
|
+
onClick: async (e) => {
|
|
116
|
+
w(e[o]), await x({ [o]: e[o] });
|
|
113
117
|
}
|
|
114
118
|
}
|
|
115
119
|
),
|
|
116
|
-
y && /* @__PURE__ */
|
|
120
|
+
y && /* @__PURE__ */ s(
|
|
117
121
|
Lt,
|
|
118
122
|
{
|
|
119
123
|
value: t,
|
|
120
|
-
disabled:
|
|
124
|
+
disabled: R,
|
|
121
125
|
shouldConfirm: H,
|
|
122
|
-
loading:
|
|
123
|
-
onClick: async (
|
|
124
|
-
w(
|
|
126
|
+
loading: R && t[o] === V,
|
|
127
|
+
onClick: async (e) => {
|
|
128
|
+
w(e[o]), await y({ [o]: e[o] });
|
|
125
129
|
}
|
|
126
130
|
}
|
|
127
131
|
)
|
|
@@ -133,51 +137,51 @@ function io({
|
|
|
133
137
|
k,
|
|
134
138
|
C,
|
|
135
139
|
o,
|
|
136
|
-
|
|
137
|
-
|
|
140
|
+
R,
|
|
141
|
+
S,
|
|
138
142
|
E,
|
|
139
|
-
|
|
143
|
+
l,
|
|
140
144
|
y,
|
|
141
145
|
z,
|
|
142
|
-
|
|
143
|
-
|
|
146
|
+
x,
|
|
147
|
+
v,
|
|
144
148
|
V
|
|
145
149
|
]
|
|
146
150
|
), g = K(
|
|
147
151
|
(t) => {
|
|
148
|
-
var
|
|
152
|
+
var e;
|
|
149
153
|
const { active: n, over: m } = t;
|
|
150
154
|
if (r != null && r.onDragEnd && (r == null || r.onDragEnd(t)), n.id !== (m == null ? void 0 : m.id)) {
|
|
151
|
-
const
|
|
155
|
+
const $ = p.findIndex(
|
|
152
156
|
(i) => i[o] === n.id
|
|
153
|
-
),
|
|
157
|
+
), N = p.findIndex(
|
|
154
158
|
(i) => i[o] === (m == null ? void 0 : m.id)
|
|
155
|
-
), M =
|
|
156
|
-
|
|
159
|
+
), M = et(p, $, N);
|
|
160
|
+
F((i) => {
|
|
157
161
|
const vt = i.findIndex(
|
|
158
162
|
(q) => q[o] === (n == null ? void 0 : n.id)
|
|
159
163
|
), Tt = i.findIndex(
|
|
160
164
|
(q) => q[o] === (m == null ? void 0 : m.id)
|
|
161
165
|
);
|
|
162
|
-
return
|
|
163
|
-
}), (
|
|
166
|
+
return et(i, vt, Tt);
|
|
167
|
+
}), (e = r == null ? void 0 : r.onDrag) == null || e.call(r, {
|
|
164
168
|
newOrder: M.map((i) => i[o])
|
|
165
169
|
});
|
|
166
170
|
}
|
|
167
171
|
},
|
|
168
|
-
[
|
|
169
|
-
),
|
|
170
|
-
let t = typeof f == "string" ?
|
|
172
|
+
[p, o, r]
|
|
173
|
+
), lt = T(() => {
|
|
174
|
+
let t = typeof f == "string" ? c == null ? void 0 : c[f] : void 0;
|
|
171
175
|
if (typeof t == "object") {
|
|
172
|
-
const n = u.find((m) => m.name === f);
|
|
176
|
+
const n = u.find((m) => ct.getRealName(m.name) === f);
|
|
173
177
|
t = mt(n)(
|
|
174
178
|
t,
|
|
175
|
-
|
|
179
|
+
c,
|
|
176
180
|
0
|
|
177
181
|
);
|
|
178
182
|
}
|
|
179
183
|
return t;
|
|
180
|
-
}, [f,
|
|
184
|
+
}, [f, c, u]), tt = T(
|
|
181
185
|
() => ({
|
|
182
186
|
rowClassName: U,
|
|
183
187
|
className: X,
|
|
@@ -188,7 +192,7 @@ function io({
|
|
|
188
192
|
expandable: Y
|
|
189
193
|
}),
|
|
190
194
|
[U, X, Q, O, A, Z, Y]
|
|
191
|
-
), ot =
|
|
195
|
+
), ot = T(
|
|
192
196
|
() => h ? {
|
|
193
197
|
total: h.count,
|
|
194
198
|
onChange: h.setPage,
|
|
@@ -196,50 +200,50 @@ function io({
|
|
|
196
200
|
pageSize: h.pageSize
|
|
197
201
|
} : void 0,
|
|
198
202
|
[h]
|
|
199
|
-
), nt =
|
|
200
|
-
const t =
|
|
203
|
+
), nt = T(() => {
|
|
204
|
+
const t = v || l || y || C || f, n = [];
|
|
201
205
|
return r && n.push({
|
|
202
206
|
key: "key",
|
|
203
207
|
align: "center",
|
|
204
208
|
width: 5,
|
|
205
209
|
title: r == null ? void 0 : r.columnLabel,
|
|
206
|
-
render: () => /* @__PURE__ */
|
|
207
|
-
}), n.push(...
|
|
208
|
-
title:
|
|
210
|
+
render: () => /* @__PURE__ */ s(Xt, { tooltip: r == null ? void 0 : r.tooltip })
|
|
211
|
+
}), n.push(...d), t && t && n.push({
|
|
212
|
+
title: b("str.action"),
|
|
209
213
|
fixed: "right",
|
|
210
|
-
width:
|
|
211
|
-
render: (m,
|
|
212
|
-
f && /* @__PURE__ */
|
|
213
|
-
|
|
214
|
+
width: a,
|
|
215
|
+
render: (m, e) => /* @__PURE__ */ D(G, { children: [
|
|
216
|
+
f && /* @__PURE__ */ s(Vt, { value: e, onClick: L }),
|
|
217
|
+
_(e)
|
|
214
218
|
] })
|
|
215
219
|
}), n;
|
|
216
220
|
}, [
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
221
|
+
d,
|
|
222
|
+
v,
|
|
223
|
+
l,
|
|
220
224
|
y,
|
|
221
225
|
C,
|
|
222
226
|
f,
|
|
223
|
-
d,
|
|
224
227
|
b,
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
[
|
|
228
|
+
a,
|
|
229
|
+
_
|
|
230
|
+
]), rt = T(
|
|
231
|
+
() => p.map((t) => t[o]),
|
|
232
|
+
[p, o]
|
|
229
233
|
), pt = K(() => {
|
|
230
|
-
const t = /* @__PURE__ */
|
|
231
|
-
|
|
234
|
+
const t = /* @__PURE__ */ s(
|
|
235
|
+
Qt,
|
|
232
236
|
{
|
|
233
237
|
...tt,
|
|
234
|
-
dataSource:
|
|
235
|
-
loading:
|
|
236
|
-
components: r ? { body: { row:
|
|
238
|
+
dataSource: p,
|
|
239
|
+
loading: I,
|
|
240
|
+
components: r ? { body: { row: Yt } } : void 0,
|
|
237
241
|
pagination: ot,
|
|
238
242
|
columns: nt
|
|
239
243
|
}
|
|
240
244
|
);
|
|
241
|
-
return r ? /* @__PURE__ */
|
|
242
|
-
|
|
245
|
+
return r ? /* @__PURE__ */ s(St, { modifiers: [Bt], onDragEnd: g, children: /* @__PURE__ */ s(
|
|
246
|
+
Rt,
|
|
243
247
|
{
|
|
244
248
|
items: rt,
|
|
245
249
|
strategy: xt,
|
|
@@ -248,8 +252,8 @@ function io({
|
|
|
248
252
|
) }) : t;
|
|
249
253
|
}, [
|
|
250
254
|
tt,
|
|
251
|
-
|
|
252
|
-
|
|
255
|
+
p,
|
|
256
|
+
I,
|
|
253
257
|
ot,
|
|
254
258
|
nt,
|
|
255
259
|
r,
|
|
@@ -257,71 +261,71 @@ function io({
|
|
|
257
261
|
g
|
|
258
262
|
]);
|
|
259
263
|
return /* @__PURE__ */ D("div", { children: [
|
|
260
|
-
f && /* @__PURE__ */
|
|
264
|
+
f && /* @__PURE__ */ s(
|
|
261
265
|
It,
|
|
262
266
|
{
|
|
263
267
|
width: "100%",
|
|
264
|
-
open: !!
|
|
265
|
-
title:
|
|
266
|
-
footer: /* @__PURE__ */
|
|
268
|
+
open: !!c,
|
|
269
|
+
title: lt ?? /* @__PURE__ */ s("div", { children: " " }),
|
|
270
|
+
footer: /* @__PURE__ */ s(G, {}),
|
|
267
271
|
closable: !0,
|
|
268
272
|
onCancel: () => L(void 0),
|
|
269
|
-
children: !!
|
|
270
|
-
/* @__PURE__ */
|
|
271
|
-
|
|
273
|
+
children: !!c && /* @__PURE__ */ D("div", { children: [
|
|
274
|
+
/* @__PURE__ */ s(
|
|
275
|
+
Gt,
|
|
272
276
|
{
|
|
273
|
-
layout:
|
|
274
|
-
descListColumn:
|
|
275
|
-
data:
|
|
277
|
+
layout: ht,
|
|
278
|
+
descListColumn: it,
|
|
279
|
+
data: c,
|
|
276
280
|
fields: u,
|
|
277
|
-
action:
|
|
281
|
+
action: _(c)
|
|
278
282
|
}
|
|
279
283
|
),
|
|
280
|
-
j == null ? void 0 : j(
|
|
281
|
-
] },
|
|
284
|
+
j == null ? void 0 : j(c)
|
|
285
|
+
] }, c == null ? void 0 : c[o])
|
|
282
286
|
}
|
|
283
287
|
),
|
|
284
|
-
/* @__PURE__ */
|
|
285
|
-
/* @__PURE__ */ D(
|
|
286
|
-
!!P && /* @__PURE__ */
|
|
288
|
+
/* @__PURE__ */ s(qt, { fields: u, ...yt }),
|
|
289
|
+
/* @__PURE__ */ D(Kt, { children: [
|
|
290
|
+
!!P && /* @__PURE__ */ s(jt, { onClick: P }),
|
|
287
291
|
pt()
|
|
288
292
|
] })
|
|
289
293
|
] });
|
|
290
294
|
}
|
|
291
|
-
const
|
|
292
|
-
const { setActivatorNodeRef:
|
|
293
|
-
return /* @__PURE__ */
|
|
295
|
+
const ft = ut.createContext({}), Xt = ({ tooltip: o }) => {
|
|
296
|
+
const { setActivatorNodeRef: I, listeners: u } = _t(ft);
|
|
297
|
+
return /* @__PURE__ */ s(
|
|
294
298
|
Dt,
|
|
295
299
|
{
|
|
296
300
|
type: "text",
|
|
297
301
|
size: "small",
|
|
298
302
|
tooltip: o,
|
|
299
|
-
icon: /* @__PURE__ */
|
|
303
|
+
icon: /* @__PURE__ */ s(Jt, {}),
|
|
300
304
|
style: { cursor: "move", border: "none" },
|
|
301
|
-
ref:
|
|
305
|
+
ref: I,
|
|
302
306
|
...u
|
|
303
307
|
}
|
|
304
308
|
);
|
|
305
|
-
},
|
|
309
|
+
}, Yt = (o) => {
|
|
306
310
|
const {
|
|
307
|
-
attributes:
|
|
311
|
+
attributes: I,
|
|
308
312
|
listeners: u,
|
|
309
|
-
setNodeRef:
|
|
310
|
-
setActivatorNodeRef:
|
|
313
|
+
setNodeRef: R,
|
|
314
|
+
setActivatorNodeRef: S,
|
|
311
315
|
transform: f,
|
|
312
316
|
transition: h,
|
|
313
317
|
isDragging: y
|
|
314
|
-
} =
|
|
318
|
+
} = Nt({ id: o["data-row-key"] }), x = {
|
|
315
319
|
...o.style,
|
|
316
|
-
transform:
|
|
320
|
+
transform: Ct.Translate.toString(f),
|
|
317
321
|
transition: h,
|
|
318
322
|
...y ? { position: "relative", zIndex: 9999 } : {}
|
|
319
|
-
},
|
|
320
|
-
() => ({ setActivatorNodeRef:
|
|
321
|
-
[
|
|
323
|
+
}, v = T(
|
|
324
|
+
() => ({ setActivatorNodeRef: S, listeners: u }),
|
|
325
|
+
[S, u]
|
|
322
326
|
);
|
|
323
|
-
return /* @__PURE__ */
|
|
327
|
+
return /* @__PURE__ */ s(ft.Provider, { value: v, children: /* @__PURE__ */ s("tr", { ...o, ref: R, style: x, ...I }) });
|
|
324
328
|
};
|
|
325
329
|
export {
|
|
326
|
-
|
|
330
|
+
yo as default
|
|
327
331
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),b=require("@ant-design/icons"),m=require("antd"),A=require("../../common/show-more/index.cjs.js"),F=require("../FileCrudField.cjs.js"),S=require("../ImageCrudField.cjs.js"),y=require("../../util/DateUtil.cjs.js"),q=require("../../util/NumberUtil.cjs.js"),j=require("../../locale/index.cjs.js"),T=require("../../util/CrudUtil.cjs.js");function R({type:u,render:e,...r}){try{return u==="object"?(t,i,o)=>typeof e=="function"?e(t,i,o):"":u==="select"?(t,i,o)=>{const n=r,a=t||(n.items??[]).find(s=>s[n.innerFieldId??"key"]===i[T.getRealName(r.name,"upsertFieldName")]),f=n.multiple?Array.isArray(a)?a.map(s=>s==null?void 0:s[n.innerFieldLabel??"name"]):void 0:a==null?void 0:a[n.innerFieldLabel??"value"];return typeof e=="function"?e(f,i,o):Array.isArray(f)?f.join(", "):f}:u==="number"?(t,i,o)=>typeof e=="function"?e(t,i,o):r!=null&&r.int?q.default.toInt(t,r.formatted):q.default.toMoney(t):u==="enum"?(t,i,o)=>{var s;const n=r;if(typeof e=="function")return e(t,i,o);if(n.multiple){const c=Array.isArray(t)?t:t?[t]:[];return typeof n.tagRender=="object"?l.jsx(m.Space,{wrap:!0,children:c.map((d,g)=>{var x,C;const v=(x=n.tagRender)==null?void 0:x[d],h=j.t(((C=n==null?void 0:n.translation)==null?void 0:C[d??""])??d);return v?l.jsx(m.Tag,{color:v.color,children:h},g+d):h})}):n!=null&&n.translation?c==null?void 0:c.map(d=>{var g;return j.t(((g=n==null?void 0:n.translation)==null?void 0:g[d??""])??d)}).join(", "):c==null?void 0:c.join(", ")}const a=((s=n==null?void 0:n.translation)==null?void 0:s[t??""])??t,f=j.t(a);if(typeof n.tagRender=="object"){const c=n.tagRender[t];if(c)return l.jsx(m.Tag,{color:c.color,children:f})}return f}:u==="date"?(t,i,o)=>{if(!t)return"-";const n=r!=null&&r.formatTime?y.formatDateTime(t):y.formatDate(t);return typeof e=="function"?e(t,i,o):n}:u==="checkbox"?(t,i,o)=>typeof e=="function"?e(t,i,o):t?l.jsx(b.CheckOutlined,{}):l.jsx(b.CloseOutlined,{}):u==="image"?(t,i,o)=>typeof e=="function"?e(t,i,o):l.jsx(S.ImageCrudCellValue,{value:t,provider:r.provider}):u==="file"?(t,i,o)=>typeof e=="function"?e(t,i,o):l.jsx(F.FileCrudCellValue,{value:t,provider:r.provider}):u==="time"?(t,i,o)=>{if(!t)return"-";const n=r==null?void 0:r.format,a=r==null?void 0:r.use12Hours,f=y.formatTime(t,n||(a?"hh:mm:ss A":void 0));return typeof e=="function"?e(t,i,o):f}:u==="color"?(t,i,o)=>typeof e=="function"?e(t,i,o):typeof t=="string"&&t.startsWith("#")?l.jsx(m.Tooltip,{title:t,children:l.jsx(m.Avatar,{style:{backgroundColor:t}})}):String(t):u==="textarea"?(t,i,o)=>{const n=r,a=n.truncated??1;return typeof e=="function"?e(t,i,o):a?l.jsx(A.ShowMore,{lines:a===!0?1:a,children:n.rich?l.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:t}}):t}):n.rich?l.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:t}}):t}:typeof e=="function"?e:(t,i,o)=>t}catch(t){return console.warn("An error occurred while rendering the value for field: "+String(r.name),t),"-"}}exports.getRendererValueCrudViewer=R;
|
|
@@ -1,85 +1,88 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { CheckOutlined as S, CloseOutlined as T } from "@ant-design/icons";
|
|
3
|
-
import { Space as
|
|
4
|
-
import { ShowMore as
|
|
5
|
-
import { FileCrudCellValue as
|
|
6
|
-
import { ImageCrudCellValue as
|
|
7
|
-
import
|
|
3
|
+
import { Space as F, Tag as C, Tooltip as R, Avatar as w } from "antd";
|
|
4
|
+
import { ShowMore as I } from "../../common/show-more/index.es.js";
|
|
5
|
+
import { FileCrudCellValue as V } from "../FileCrudField.es.js";
|
|
6
|
+
import { ImageCrudCellValue as k } from "../ImageCrudField.es.js";
|
|
7
|
+
import g from "../../util/DateUtil.es.js";
|
|
8
8
|
import j from "../../util/NumberUtil.es.js";
|
|
9
|
-
import { t as
|
|
10
|
-
|
|
9
|
+
import { t as y } from "../../locale/index.es.js";
|
|
10
|
+
import x from "../../util/CrudUtil.es.js";
|
|
11
|
+
function q({
|
|
11
12
|
type: u,
|
|
12
13
|
render: n,
|
|
13
14
|
...r
|
|
14
15
|
}) {
|
|
15
16
|
try {
|
|
16
|
-
return u === "object" ? (t,
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
return u === "object" ? (t, o, a) => typeof n == "function" ? n(t, o, a) : "" : u === "select" ? (t, o, a) => {
|
|
18
|
+
const i = r, l = t || (i.items ?? []).find(
|
|
19
|
+
(m) => m[i.innerFieldId ?? "key"] === o[x.getRealName(r.name, "upsertFieldName")]
|
|
20
|
+
), f = i.multiple ? Array.isArray(l) ? l.map((m) => m == null ? void 0 : m[i.innerFieldLabel ?? "name"]) : void 0 : l == null ? void 0 : l[i.innerFieldLabel ?? "value"];
|
|
21
|
+
return typeof n == "function" ? n(f, o, a) : Array.isArray(f) ? f.join(", ") : f;
|
|
22
|
+
} : u === "number" ? (t, o, a) => typeof n == "function" ? n(t, o, a) : r != null && r.int ? j.toInt(t, r.formatted) : j.toMoney(t) : u === "enum" ? (t, o, a) => {
|
|
23
|
+
var m;
|
|
24
|
+
const i = r;
|
|
22
25
|
if (typeof n == "function")
|
|
23
|
-
return n(t,
|
|
24
|
-
if (
|
|
25
|
-
const
|
|
26
|
-
return typeof
|
|
26
|
+
return n(t, o, a);
|
|
27
|
+
if (i.multiple) {
|
|
28
|
+
const c = Array.isArray(t) ? t : t ? [t] : [];
|
|
29
|
+
return typeof i.tagRender == "object" ? /* @__PURE__ */ e(F, { wrap: !0, children: c.map((s, d) => {
|
|
27
30
|
var b, A;
|
|
28
|
-
const
|
|
29
|
-
((A =
|
|
31
|
+
const h = (b = i.tagRender) == null ? void 0 : b[s], v = y(
|
|
32
|
+
((A = i == null ? void 0 : i.translation) == null ? void 0 : A[s ?? ""]) ?? s
|
|
30
33
|
);
|
|
31
|
-
return
|
|
32
|
-
}) }) :
|
|
33
|
-
var
|
|
34
|
-
return
|
|
35
|
-
}).join(", ") :
|
|
34
|
+
return h ? /* @__PURE__ */ e(C, { color: h.color, children: v }, d + s) : v;
|
|
35
|
+
}) }) : i != null && i.translation ? c == null ? void 0 : c.map((s) => {
|
|
36
|
+
var d;
|
|
37
|
+
return y(((d = i == null ? void 0 : i.translation) == null ? void 0 : d[s ?? ""]) ?? s);
|
|
38
|
+
}).join(", ") : c == null ? void 0 : c.join(", ");
|
|
36
39
|
}
|
|
37
|
-
const l = ((
|
|
38
|
-
if (typeof
|
|
39
|
-
const
|
|
40
|
-
if (
|
|
41
|
-
return /* @__PURE__ */
|
|
40
|
+
const l = ((m = i == null ? void 0 : i.translation) == null ? void 0 : m[t ?? ""]) ?? t, f = y(l);
|
|
41
|
+
if (typeof i.tagRender == "object") {
|
|
42
|
+
const c = i.tagRender[t];
|
|
43
|
+
if (c)
|
|
44
|
+
return /* @__PURE__ */ e(C, { color: c.color, children: f });
|
|
42
45
|
}
|
|
43
|
-
return
|
|
44
|
-
} : u === "date" ? (t,
|
|
46
|
+
return f;
|
|
47
|
+
} : u === "date" ? (t, o, a) => {
|
|
45
48
|
if (!t) return "-";
|
|
46
|
-
const
|
|
47
|
-
return typeof n == "function" ? n(t,
|
|
48
|
-
} : u === "checkbox" ? (t,
|
|
49
|
-
|
|
49
|
+
const i = r != null && r.formatTime ? g.formatDateTime(t) : g.formatDate(t);
|
|
50
|
+
return typeof n == "function" ? n(t, o, a) : i;
|
|
51
|
+
} : u === "checkbox" ? (t, o, a) => typeof n == "function" ? n(t, o, a) : t ? /* @__PURE__ */ e(S, {}) : /* @__PURE__ */ e(T, {}) : u === "image" ? (t, o, a) => typeof n == "function" ? n(t, o, a) : /* @__PURE__ */ e(
|
|
52
|
+
k,
|
|
50
53
|
{
|
|
51
54
|
value: t,
|
|
52
55
|
provider: r.provider
|
|
53
56
|
}
|
|
54
|
-
) : u === "file" ? (t,
|
|
55
|
-
|
|
57
|
+
) : u === "file" ? (t, o, a) => typeof n == "function" ? n(t, o, a) : /* @__PURE__ */ e(
|
|
58
|
+
V,
|
|
56
59
|
{
|
|
57
60
|
value: t,
|
|
58
61
|
provider: r.provider
|
|
59
62
|
}
|
|
60
|
-
) : u === "time" ? (t,
|
|
63
|
+
) : u === "time" ? (t, o, a) => {
|
|
61
64
|
if (!t) return "-";
|
|
62
|
-
const
|
|
65
|
+
const i = r == null ? void 0 : r.format, l = r == null ? void 0 : r.use12Hours, f = g.formatTime(
|
|
63
66
|
t,
|
|
64
|
-
|
|
67
|
+
i || (l ? "hh:mm:ss A" : void 0)
|
|
65
68
|
);
|
|
66
|
-
return typeof n == "function" ? n(t,
|
|
67
|
-
} : u === "color" ? (t,
|
|
68
|
-
const
|
|
69
|
-
return typeof n == "function" ? n(t,
|
|
69
|
+
return typeof n == "function" ? n(t, o, a) : f;
|
|
70
|
+
} : u === "color" ? (t, o, a) => typeof n == "function" ? n(t, o, a) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ e(R, { title: t, children: /* @__PURE__ */ e(w, { style: { backgroundColor: t } }) }) : String(t) : u === "textarea" ? (t, o, a) => {
|
|
71
|
+
const i = r, l = i.truncated ?? 1;
|
|
72
|
+
return typeof n == "function" ? n(t, o, a) : l ? /* @__PURE__ */ e(I, { lines: l === !0 ? 1 : l, children: i.rich ? /* @__PURE__ */ e(
|
|
70
73
|
"div",
|
|
71
74
|
{
|
|
72
75
|
style: { all: "unset" },
|
|
73
76
|
dangerouslySetInnerHTML: { __html: t }
|
|
74
77
|
}
|
|
75
|
-
) : t }) :
|
|
78
|
+
) : t }) : i.rich ? /* @__PURE__ */ e(
|
|
76
79
|
"div",
|
|
77
80
|
{
|
|
78
81
|
style: { all: "unset" },
|
|
79
82
|
dangerouslySetInnerHTML: { __html: t }
|
|
80
83
|
}
|
|
81
84
|
) : t;
|
|
82
|
-
} : typeof n == "function" ? n : (t,
|
|
85
|
+
} : typeof n == "function" ? n : (t, o, a) => t;
|
|
83
86
|
} catch (t) {
|
|
84
87
|
return console.warn(
|
|
85
88
|
"An error occurred while rendering the value for field: " + String(r.name),
|
|
@@ -88,5 +91,5 @@ function N({
|
|
|
88
91
|
}
|
|
89
92
|
}
|
|
90
93
|
export {
|
|
91
|
-
|
|
94
|
+
q as getRendererValueCrudViewer
|
|
92
95
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react-router-dom");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react-router-dom");function o(){return e.useInRouterContext()?e.useNavigate():(t=>{console.warn("React router not found, navigating to",t)})}exports.useNavigateOptional=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useNavigateOptional(): import('react-router-dom').NavigateFunction
|
|
1
|
+
export declare function useNavigateOptional(): import('react-router-dom').NavigateFunction;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { useInRouterContext as
|
|
1
|
+
import { useInRouterContext as e, useNavigate as n } from "react-router-dom";
|
|
2
2
|
function r() {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
return e() ? n() : ((t) => {
|
|
4
|
+
console.warn("React router not found, navigating to", t);
|
|
5
|
+
});
|
|
5
6
|
}
|
|
6
7
|
export {
|
|
7
8
|
r as useNavigateOptional
|