@kingteza/crud-component 1.0.55 → 1.0.57

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.
Files changed (38) hide show
  1. package/App.d.ts +5 -0
  2. package/common/button/Button.cjs.js +1 -1
  3. package/common/button/Button.d.ts +2 -3
  4. package/common/button/Button.es.js +54 -61
  5. package/crud/CrudComponent.cjs.js +1 -1
  6. package/crud/CrudComponent.d.ts +5 -1
  7. package/crud/CrudComponent.es.js +138 -137
  8. package/crud/CrudField.cjs.js +1 -1
  9. package/crud/CrudField.es.js +160 -159
  10. package/crud/CrudForm.cjs.js +1 -1
  11. package/crud/CrudForm.es.js +57 -56
  12. package/crud/CrudFormWizard.cjs.js +1 -1
  13. package/crud/CrudFormWizard.es.js +53 -52
  14. package/crud/CrudSearchComponent.cjs.js +1 -1
  15. package/crud/CrudSearchComponent.es.js +39 -38
  16. package/crud/CrudTextAreaComponent.cjs.js +1 -1
  17. package/crud/CrudTextAreaComponent.es.js +29 -28
  18. package/crud/FileCrudField.cjs.js +1 -1
  19. package/crud/FileCrudField.es.js +70 -69
  20. package/crud/view/CrudDecListView.cjs.js +1 -1
  21. package/crud/view/CrudDecListView.es.js +29 -25
  22. package/crud/view/CrudViewer.cjs.js +1 -1
  23. package/crud/view/CrudViewer.es.js +137 -133
  24. package/crud/view/CrudViewerUtil.cjs.js +1 -1
  25. package/crud/view/CrudViewerUtil.es.js +51 -48
  26. package/hooks/NavigatorHooks.cjs.js +1 -0
  27. package/hooks/NavigatorHooks.d.ts +1 -0
  28. package/hooks/NavigatorHooks.es.js +9 -0
  29. package/icons/FlipHIcon.cjs.js +1 -0
  30. package/icons/FlipHIcon.d.ts +3 -0
  31. package/icons/FlipHIcon.es.js +28 -0
  32. package/icons/FlipVIcon.cjs.js +1 -0
  33. package/icons/FlipVIcon.d.ts +3 -0
  34. package/icons/FlipVIcon.es.js +28 -0
  35. package/package.json +3 -2
  36. package/util/CrudUtil.cjs.js +1 -0
  37. package/util/CrudUtil.d.ts +5 -0
  38. package/util/CrudUtil.es.js +8 -0
@@ -1,9 +1,9 @@
1
- import { jsxs as D, Fragment as G, jsx as c } from "react/jsx-runtime";
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 lt } from "@dnd-kit/modifiers";
5
- import { CSS as Bt } from "@dnd-kit/utilities";
6
- import { arrayMove as st, SortableContext as Ct, verticalListSortingStrategy as xt, useSortable as Rt } from "@dnd-kit/sortable";
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 et, { useMemo as I, useState as J, useEffect as ct, useCallback as K, useContext as Nt } from "react";
17
- import { useTranslationLib as _t } from "../../locale/index.es.js";
18
- import $t from "../CrudSearchComponent.es.js";
19
- import { CrudDecListView as qt } from "./CrudDecListView.es.js";
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 Gt } from "@ant-design/icons";
22
- import Jt from "../../common/layout/VerticalSpace.es.js";
23
- const Kt = et.memo(wt);
24
- function io({
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: S,
27
+ loadingData: I,
27
28
  fields: u,
28
- isDeleting: x,
29
- isHiding: l,
29
+ isDeleting: R,
30
+ isHiding: S,
30
31
  viewable: f = !1,
31
32
  paginateProps: h,
32
33
  onDelete: y,
33
- onHide: R,
34
- onUpdate: T,
34
+ onHide: x,
35
+ onUpdate: v,
35
36
  data: B = [],
36
37
  extraAction: C,
37
- onClickUpdate: p,
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: ft,
46
+ descListColumn: it,
46
47
  extraView: j,
47
- decListLayout: it,
48
- scrollToTop: Yt,
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: b = 190,
56
+ actionWidth: a = 190,
56
57
  draggable: r,
57
- ...ht
58
+ ...yt
58
59
  }) {
59
- const { t: d } = _t(), F = I(
60
+ const { t: b } = $t(), d = T(
60
61
  () => u.map(
61
- ({ hideInTable: t, hidden: n, width: m, name: s, label: _, halign: $, ...M }) => ({
62
- title: _,
63
- width: m,
64
- key: s,
65
- dataIndex: s,
66
- hidden: t || n,
67
- align: $ ?? (M.type === "number" ? "right" : void 0),
68
- render: mt(M)
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
- ), [e, L] = J(), [V, w] = J(), [v, a] = J([]);
73
- ct(() => {
74
- B && a(B);
75
- }, [B]), ct(() => {
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, e]);
81
- const N = K(
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) || T || p || E || y ? /* @__PURE__ */ D(G, { children: [
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
- (T || p) && /* @__PURE__ */ c(
91
+ (v || l) && /* @__PURE__ */ s(
88
92
  zt,
89
93
  {
90
94
  value: t,
91
- onClick: (s) => {
92
- w(s[o]), p == null || p(t), W && L(void 0);
95
+ onClick: (e) => {
96
+ w(e[o]), l == null || l(t), W && L(void 0);
93
97
  }
94
98
  }
95
99
  ),
96
- E && /* @__PURE__ */ c(Et, { value: t, onClick: (s) => E(s) }),
97
- z && /* @__PURE__ */ c(
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 (s) => await z(s)
105
+ onClick: async (e) => await z(e)
102
106
  }
103
107
  ),
104
- R && /* @__PURE__ */ c(
108
+ x && /* @__PURE__ */ s(
105
109
  Ot,
106
110
  {
107
111
  value: t,
108
- disabled: l,
112
+ disabled: S,
109
113
  shouldConfirm: k,
110
- loading: l && t[o] === V,
111
- onClick: async (s) => {
112
- w(s[o]), await R({ [o]: s[o] });
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__ */ c(
120
+ y && /* @__PURE__ */ s(
117
121
  Lt,
118
122
  {
119
123
  value: t,
120
- disabled: x,
124
+ disabled: R,
121
125
  shouldConfirm: H,
122
- loading: x && t[o] === V,
123
- onClick: async (s) => {
124
- w(s[o]), await y({ [o]: s[o] });
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
- x,
137
- l,
140
+ R,
141
+ S,
138
142
  E,
139
- p,
143
+ l,
140
144
  y,
141
145
  z,
142
- R,
143
- T,
146
+ x,
147
+ v,
144
148
  V
145
149
  ]
146
150
  ), g = K(
147
151
  (t) => {
148
- var s;
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 _ = v.findIndex(
155
+ const $ = p.findIndex(
152
156
  (i) => i[o] === n.id
153
- ), $ = v.findIndex(
157
+ ), N = p.findIndex(
154
158
  (i) => i[o] === (m == null ? void 0 : m.id)
155
- ), M = st(v, _, $);
156
- a((i) => {
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 st(i, vt, Tt);
163
- }), (s = r == null ? void 0 : r.onDrag) == null || s.call(r, {
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
- [v, o, r]
169
- ), yt = I(() => {
170
- let t = typeof f == "string" ? e == null ? void 0 : e[f] : void 0;
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
- e,
179
+ c,
176
180
  0
177
181
  );
178
182
  }
179
183
  return t;
180
- }, [f, e, u]), tt = I(
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 = I(
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 = I(() => {
200
- const t = T || p || y || C || f, n = [];
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__ */ c(Qt, { tooltip: r == null ? void 0 : r.tooltip })
207
- }), n.push(...F), t && t && n.push({
208
- title: d("str.action"),
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: b,
211
- render: (m, s) => /* @__PURE__ */ D(G, { children: [
212
- f && /* @__PURE__ */ c(Vt, { value: s, onClick: L }),
213
- N(s)
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
- F,
218
- T,
219
- p,
221
+ d,
222
+ v,
223
+ l,
220
224
  y,
221
225
  C,
222
226
  f,
223
- d,
224
227
  b,
225
- N
226
- ]), rt = I(
227
- () => v.map((t) => t[o]),
228
- [v, o]
228
+ a,
229
+ _
230
+ ]), rt = T(
231
+ () => p.map((t) => t[o]),
232
+ [p, o]
229
233
  ), pt = K(() => {
230
- const t = /* @__PURE__ */ c(
231
- Kt,
234
+ const t = /* @__PURE__ */ s(
235
+ Qt,
232
236
  {
233
237
  ...tt,
234
- dataSource: v,
235
- loading: S,
236
- components: r ? { body: { row: Xt } } : void 0,
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__ */ c(St, { modifiers: [lt], onDragEnd: g, children: /* @__PURE__ */ c(
242
- Ct,
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
- v,
252
- S,
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__ */ c(
264
+ f && /* @__PURE__ */ s(
261
265
  It,
262
266
  {
263
267
  width: "100%",
264
- open: !!e,
265
- title: yt ?? /* @__PURE__ */ c("div", { children: " " }),
266
- footer: /* @__PURE__ */ c(G, {}),
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: !!e && /* @__PURE__ */ D("div", { children: [
270
- /* @__PURE__ */ c(
271
- qt,
273
+ children: !!c && /* @__PURE__ */ D("div", { children: [
274
+ /* @__PURE__ */ s(
275
+ Gt,
272
276
  {
273
- layout: it,
274
- descListColumn: ft,
275
- data: e,
277
+ layout: ht,
278
+ descListColumn: it,
279
+ data: c,
276
280
  fields: u,
277
- action: N(e)
281
+ action: _(c)
278
282
  }
279
283
  ),
280
- j == null ? void 0 : j(e)
281
- ] }, e == null ? void 0 : e[o])
284
+ j == null ? void 0 : j(c)
285
+ ] }, c == null ? void 0 : c[o])
282
286
  }
283
287
  ),
284
- /* @__PURE__ */ c($t, { fields: u, ...ht }),
285
- /* @__PURE__ */ D(Jt, { children: [
286
- !!P && /* @__PURE__ */ c(jt, { onClick: P }),
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 ut = et.createContext({}), Qt = ({ tooltip: o }) => {
292
- const { setActivatorNodeRef: S, listeners: u } = Nt(ut);
293
- return /* @__PURE__ */ c(
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__ */ c(Gt, {}),
303
+ icon: /* @__PURE__ */ s(Jt, {}),
300
304
  style: { cursor: "move", border: "none" },
301
- ref: S,
305
+ ref: I,
302
306
  ...u
303
307
  }
304
308
  );
305
- }, Xt = (o) => {
309
+ }, Yt = (o) => {
306
310
  const {
307
- attributes: S,
311
+ attributes: I,
308
312
  listeners: u,
309
- setNodeRef: x,
310
- setActivatorNodeRef: l,
313
+ setNodeRef: R,
314
+ setActivatorNodeRef: S,
311
315
  transform: f,
312
316
  transition: h,
313
317
  isDragging: y
314
- } = Rt({ id: o["data-row-key"] }), R = {
318
+ } = Nt({ id: o["data-row-key"] }), x = {
315
319
  ...o.style,
316
- transform: Bt.Translate.toString(f),
320
+ transform: Ct.Translate.toString(f),
317
321
  transition: h,
318
322
  ...y ? { position: "relative", zIndex: 9999 } : {}
319
- }, T = I(
320
- () => ({ setActivatorNodeRef: l, listeners: u }),
321
- [l, u]
323
+ }, v = T(
324
+ () => ({ setActivatorNodeRef: S, listeners: u }),
325
+ [S, u]
322
326
  );
323
- return /* @__PURE__ */ c(ut.Provider, { value: T, children: /* @__PURE__ */ c("tr", { ...o, ref: x, style: R, ...S }) });
327
+ return /* @__PURE__ */ s(ft.Provider, { value: v, children: /* @__PURE__ */ s("tr", { ...o, ref: R, style: x, ...I }) });
324
328
  };
325
329
  export {
326
- io as default
330
+ yo as default
327
331
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),C=require("@ant-design/icons"),d=require("antd"),A=require("../../common/show-more/index.cjs.js"),S=require("../FileCrudField.cjs.js"),T=require("../ImageCrudField.cjs.js"),m=require("../../util/DateUtil.cjs.js"),q=require("../../util/NumberUtil.cjs.js"),j=require("../../locale/index.cjs.js");function F({type:l,render:i,...a}){try{return l==="object"?(t,e,o)=>typeof i=="function"?i(t,e,o):"":l==="select"?(t,e,o)=>{const n=a,r=n.multiple?Array.isArray(t)?t.map(f=>f==null?void 0:f[n.innerFieldLabel??"name"]):void 0:t==null?void 0:t[n.innerFieldLabel??"name"];return typeof i=="function"?i(r,e,o):Array.isArray(r)?r.join(", "):r}:l==="number"?(t,e,o)=>typeof i=="function"?i(t,e,o):a!=null&&a.int?q.default.toInt(t,a.formatted):q.default.toMoney(t):l==="enum"?(t,e,o)=>{var y;const n=a;if(typeof i=="function")return i(t,e,o);if(n.multiple){const c=Array.isArray(t)?t:t?[t]:[];return typeof n.tagRender=="object"?u.jsx(d.Space,{wrap:!0,children:c.map((s,g)=>{var x,b;const v=(x=n.tagRender)==null?void 0:x[s],h=j.t(((b=n==null?void 0:n.translation)==null?void 0:b[s??""])??s);return v?u.jsx(d.Tag,{color:v.color,children:h},g+s):h})}):n!=null&&n.translation?c==null?void 0:c.map(s=>{var g;return j.t(((g=n==null?void 0:n.translation)==null?void 0:g[s??""])??s)}).join(", "):c==null?void 0:c.join(", ")}const r=((y=n==null?void 0:n.translation)==null?void 0:y[t??""])??t,f=j.t(r);if(typeof n.tagRender=="object"){const c=n.tagRender[t];if(c)return u.jsx(d.Tag,{color:c.color,children:f})}return f}:l==="date"?(t,e,o)=>{if(!t)return"-";const n=a!=null&&a.formatTime?m.formatDateTime(t):m.formatDate(t);return typeof i=="function"?i(t,e,o):n}:l==="checkbox"?(t,e,o)=>typeof i=="function"?i(t,e,o):t?u.jsx(C.CheckOutlined,{}):u.jsx(C.CloseOutlined,{}):l==="image"?(t,e,o)=>typeof i=="function"?i(t,e,o):u.jsx(T.ImageCrudCellValue,{value:t,provider:a.provider}):l==="file"?(t,e,o)=>typeof i=="function"?i(t,e,o):u.jsx(S.FileCrudCellValue,{value:t,provider:a.provider}):l==="time"?(t,e,o)=>{if(!t)return"-";const n=a==null?void 0:a.format,r=a==null?void 0:a.use12Hours,f=m.formatTime(t,n||(r?"hh:mm:ss A":void 0));return typeof i=="function"?i(t,e,o):f}:l==="color"?(t,e,o)=>typeof i=="function"?i(t,e,o):typeof t=="string"&&t.startsWith("#")?u.jsx(d.Tooltip,{title:t,children:u.jsx(d.Avatar,{style:{backgroundColor:t}})}):String(t):l==="textarea"?(t,e,o)=>{const n=a,r=n.truncated??1;return typeof i=="function"?i(t,e,o):r?u.jsx(A.ShowMore,{lines:r===!0?1:r,children:n.rich?u.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:t}}):t}):n.rich?u.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:t}}):t}:typeof i=="function"?i:(t,e,o)=>t}catch(t){return console.warn("An error occurred while rendering the value for field: "+String(a.name),t),"-"}}exports.getRendererValueCrudViewer=F;
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 c } from "react/jsx-runtime";
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 w, Tag as C, Tooltip as R, Avatar as V } from "antd";
4
- import { ShowMore as x } from "../../common/show-more/index.es.js";
5
- import { FileCrudCellValue as F } from "../FileCrudField.es.js";
6
- import { ImageCrudCellValue as H } from "../ImageCrudField.es.js";
7
- import h from "../../util/DateUtil.es.js";
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 s } from "../../locale/index.es.js";
10
- function N({
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, i, a) => typeof n == "function" ? n(t, i, a) : "" : u === "select" ? (t, i, a) => {
17
- const o = r, l = o.multiple ? Array.isArray(t) ? t.map((e) => e == null ? void 0 : e[o.innerFieldLabel ?? "name"]) : void 0 : t == null ? void 0 : t[o.innerFieldLabel ?? "name"];
18
- return typeof n == "function" ? n(l, i, a) : Array.isArray(l) ? l.join(", ") : l;
19
- } : u === "number" ? (t, i, a) => typeof n == "function" ? n(t, i, a) : r != null && r.int ? j.toInt(t, r.formatted) : j.toMoney(t) : u === "enum" ? (t, i, a) => {
20
- var v;
21
- const o = r;
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, i, a);
24
- if (o.multiple) {
25
- const f = Array.isArray(t) ? t : t ? [t] : [];
26
- return typeof o.tagRender == "object" ? /* @__PURE__ */ c(w, { wrap: !0, children: f.map((m, g) => {
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 y = (b = o.tagRender) == null ? void 0 : b[m], d = s(
29
- ((A = o == null ? void 0 : o.translation) == null ? void 0 : A[m ?? ""]) ?? m
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 y ? /* @__PURE__ */ c(C, { color: y.color, children: d }, g + m) : d;
32
- }) }) : o != null && o.translation ? f == null ? void 0 : f.map((m) => {
33
- var g;
34
- return s(((g = o == null ? void 0 : o.translation) == null ? void 0 : g[m ?? ""]) ?? m);
35
- }).join(", ") : f == null ? void 0 : f.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 = ((v = o == null ? void 0 : o.translation) == null ? void 0 : v[t ?? ""]) ?? t, e = s(l);
38
- if (typeof o.tagRender == "object") {
39
- const f = o.tagRender[t];
40
- if (f)
41
- return /* @__PURE__ */ c(C, { color: f.color, children: e });
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 e;
44
- } : u === "date" ? (t, i, a) => {
46
+ return f;
47
+ } : u === "date" ? (t, o, a) => {
45
48
  if (!t) return "-";
46
- const o = r != null && r.formatTime ? h.formatDateTime(t) : h.formatDate(t);
47
- return typeof n == "function" ? n(t, i, a) : o;
48
- } : u === "checkbox" ? (t, i, a) => typeof n == "function" ? n(t, i, a) : t ? /* @__PURE__ */ c(S, {}) : /* @__PURE__ */ c(T, {}) : u === "image" ? (t, i, a) => typeof n == "function" ? n(t, i, a) : /* @__PURE__ */ c(
49
- H,
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, i, a) => typeof n == "function" ? n(t, i, a) : /* @__PURE__ */ c(
55
- F,
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, i, a) => {
63
+ ) : u === "time" ? (t, o, a) => {
61
64
  if (!t) return "-";
62
- const o = r == null ? void 0 : r.format, l = r == null ? void 0 : r.use12Hours, e = h.formatTime(
65
+ const i = r == null ? void 0 : r.format, l = r == null ? void 0 : r.use12Hours, f = g.formatTime(
63
66
  t,
64
- o || (l ? "hh:mm:ss A" : void 0)
67
+ i || (l ? "hh:mm:ss A" : void 0)
65
68
  );
66
- return typeof n == "function" ? n(t, i, a) : e;
67
- } : u === "color" ? (t, i, a) => typeof n == "function" ? n(t, i, a) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ c(R, { title: t, children: /* @__PURE__ */ c(V, { style: { backgroundColor: t } }) }) : String(t) : u === "textarea" ? (t, i, a) => {
68
- const o = r, l = o.truncated ?? 1;
69
- return typeof n == "function" ? n(t, i, a) : l ? /* @__PURE__ */ c(x, { lines: l === !0 ? 1 : l, children: o.rich ? /* @__PURE__ */ c(
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 }) : o.rich ? /* @__PURE__ */ c(
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, i, a) => 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
- N as getRendererValueCrudViewer
94
+ q as getRendererValueCrudViewer
92
95
  };
@@ -0,0 +1 @@
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;
@@ -0,0 +1 @@
1
+ export declare function useNavigateOptional(): import('react-router-dom').NavigateFunction;
@@ -0,0 +1,9 @@
1
+ import { useInRouterContext as e, useNavigate as n } from "react-router-dom";
2
+ function r() {
3
+ return e() ? n() : ((t) => {
4
+ console.warn("React router not found, navigating to", t);
5
+ });
6
+ }
7
+ export {
8
+ r as useNavigateOptional
9
+ };
@@ -0,0 +1 @@
1
+ "use strict";const t=require("react/jsx-runtime"),n=require("../common/icon/KIcon.cjs.js");function s(i){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...i,children:t.jsxs("g",{fill:i.fill,children:[t.jsx("path",{fillOpacity:.5,d:"M18 7a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1h-3v2h3a3 3 0 0 0 3-3V8a3 3 0 0 0-3-3h-3v2z"}),t.jsx("path",{d:"M13 3h-2v18h2zM5 8a1 1 0 0 1 1-1h3V5H6a3 3 0 0 0-3 3v8a3 3 0 0 0 3 3h3v-2H6a1 1 0 0 1-1-1z"})]})})}const h=s,e=i=>t.jsx(n,{component:h,...i});module.exports=e;