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