@kingteza/crud-component 1.0.14 → 1.0.16

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 (105) hide show
  1. package/dist/components/common/DatePicker/DatePicker.cjs +1 -1
  2. package/dist/components/common/DatePicker/DatePicker.js +42 -42
  3. package/dist/components/common/DatePicker/TimePicker.cjs +1 -1
  4. package/dist/components/common/DatePicker/TimePicker.js +39 -39
  5. package/dist/components/common/appearance/Hider.cjs +1 -1
  6. package/dist/components/common/appearance/Hider.js +3 -3
  7. package/dist/components/common/button/Button.cjs +1 -1
  8. package/dist/components/common/button/Button.js +19 -19
  9. package/dist/components/common/button/CloneButtonTable.cjs +1 -1
  10. package/dist/components/common/button/CloneButtonTable.js +11 -11
  11. package/dist/components/common/button/DeleteButtonTable.cjs +1 -1
  12. package/dist/components/common/button/DeleteButtonTable.js +29 -29
  13. package/dist/components/common/button/ExportButton.cjs +1 -1
  14. package/dist/components/common/button/ExportButton.js +17 -17
  15. package/dist/components/common/button/HideButtonTable.cjs +1 -1
  16. package/dist/components/common/button/HideButtonTable.js +35 -35
  17. package/dist/components/common/button/ImportButton.cjs +1 -1
  18. package/dist/components/common/button/ImportButton.js +28 -28
  19. package/dist/components/common/button/NewButton.cjs +1 -1
  20. package/dist/components/common/button/NewButton.js +14 -14
  21. package/dist/components/common/button/PrintButton.cjs +1 -1
  22. package/dist/components/common/button/PrintButton.js +14 -14
  23. package/dist/components/common/button/RefreshButton.cjs +1 -1
  24. package/dist/components/common/button/RefreshButton.js +16 -16
  25. package/dist/components/common/button/UnHideButton.cjs +1 -1
  26. package/dist/components/common/button/UnHideButton.js +37 -37
  27. package/dist/components/common/button/UpdateButtonTable.cjs +1 -1
  28. package/dist/components/common/button/UpdateButtonTable.js +11 -11
  29. package/dist/components/common/button/ViewButtonTable.cjs +1 -1
  30. package/dist/components/common/button/ViewButtonTable.js +10 -10
  31. package/dist/components/common/check-box/CheckBox.cjs +1 -1
  32. package/dist/components/common/check-box/CheckBox.js +20 -20
  33. package/dist/components/common/description/DescList.cjs +1 -1
  34. package/dist/components/common/description/DescList.js +9 -9
  35. package/dist/components/common/layout/VerticalSpace.cjs +1 -1
  36. package/dist/components/common/layout/VerticalSpace.js +3 -3
  37. package/dist/components/common/loading/LoadingIndicator.cjs +1 -1
  38. package/dist/components/common/loading/LoadingIndicator.js +12 -12
  39. package/dist/components/common/picker/ImagePicker.cjs +1 -1
  40. package/dist/components/common/picker/ImagePicker.js +173 -176
  41. package/dist/components/common/radio/RadioGroupComponent.cjs +1 -1
  42. package/dist/components/common/radio/RadioGroupComponent.js +6 -6
  43. package/dist/components/common/report/SelectFieldInReport.cjs +1 -1
  44. package/dist/components/common/report/SelectFieldInReport.js +11 -11
  45. package/dist/components/common/select/CustomSelectOption.cjs +1 -1
  46. package/dist/components/common/select/CustomSelectOption.js +7 -7
  47. package/dist/components/common/select/SelectComponent.cjs +1 -1
  48. package/dist/components/common/select/SelectComponent.js +36 -36
  49. package/dist/components/common/show-more/index.cjs +1 -1
  50. package/dist/components/common/show-more/index.js +5 -5
  51. package/dist/components/common/tab/TabViewWithRoute.cjs +1 -1
  52. package/dist/components/common/tab/TabViewWithRoute.js +23 -22
  53. package/dist/components/common/table/table.cjs +1 -1
  54. package/dist/components/common/table/table.js +12 -12
  55. package/dist/components/common/tag/StatusTag.cjs +1 -1
  56. package/dist/components/common/tag/StatusTag.js +13 -13
  57. package/dist/components/common/text-field/NumberField.cjs +1 -1
  58. package/dist/components/common/text-field/NumberField.js +43 -43
  59. package/dist/components/common/text-field/PhoneNumberField.cjs +1 -1
  60. package/dist/components/common/text-field/PhoneNumberField.js +4 -4
  61. package/dist/components/common/text-field/TextArea.cjs +1 -1
  62. package/dist/components/common/text-field/TextArea.js +20 -20
  63. package/dist/components/common/text-field/TextField.cjs +1 -1
  64. package/dist/components/common/text-field/TextField.js +47 -47
  65. package/dist/components/common/tooltip/TooltipComponent.cjs +1 -1
  66. package/dist/components/common/tooltip/TooltipComponent.js +3 -3
  67. package/dist/components/common/wizard/WizardResult.cjs +1 -1
  68. package/dist/components/common/wizard/WizardResult.js +37 -38
  69. package/dist/components/common/wizard/WizardViewForm.cjs +1 -1
  70. package/dist/components/common/wizard/WizardViewForm.js +43 -43
  71. package/dist/components/crud/CrudComponent.cjs +1 -1
  72. package/dist/components/crud/CrudComponent.js +130 -130
  73. package/dist/components/crud/CrudField.cjs +1 -1
  74. package/dist/components/crud/CrudField.js +217 -217
  75. package/dist/components/crud/CrudForm.cjs +1 -1
  76. package/dist/components/crud/CrudForm.js +55 -55
  77. package/dist/components/crud/CrudFormWizard.cjs +1 -1
  78. package/dist/components/crud/CrudFormWizard.js +82 -84
  79. package/dist/components/crud/CrudReportComponent.cjs +3 -3
  80. package/dist/components/crud/CrudReportComponent.js +123 -123
  81. package/dist/components/crud/CrudSearchComponent.cjs +1 -1
  82. package/dist/components/crud/CrudSearchComponent.js +43 -43
  83. package/dist/components/crud/FileCrudField.cjs +1 -1
  84. package/dist/components/crud/FileCrudField.js +118 -125
  85. package/dist/components/crud/ImageCrudField.cjs +1 -1
  86. package/dist/components/crud/ImageCrudField.js +56 -56
  87. package/dist/components/crud/import/CrudImportButton.cjs +1 -1
  88. package/dist/components/crud/import/CrudImportButton.js +18 -18
  89. package/dist/components/crud/import/CrudImportComponent.cjs +2 -2
  90. package/dist/components/crud/import/CrudImportComponent.js +108 -109
  91. package/dist/components/crud/view/CrudDecListView.cjs +1 -1
  92. package/dist/components/crud/view/CrudDecListView.js +22 -22
  93. package/dist/components/crud/view/CrudViewer.cjs +1 -1
  94. package/dist/components/crud/view/CrudViewer.js +152 -152
  95. package/dist/components/crud/view/CrudViewerUtil.cjs +1 -1
  96. package/dist/components/crud/view/CrudViewerUtil.js +33 -34
  97. package/dist/locale/index.cjs +1 -1
  98. package/dist/locale/index.js +2 -2
  99. package/dist/util/DateUtil.cjs +1 -1
  100. package/dist/util/DateUtil.js +4 -4
  101. package/dist/util/ImageUtil.cjs +1 -1
  102. package/dist/util/ImageUtil.js +1 -1
  103. package/dist/util/ValidationUtil.cjs +1 -1
  104. package/dist/util/ValidationUtil.js +1 -1
  105. package/package.json +1 -1
@@ -1,70 +1,69 @@
1
- import { j as t } from "../../../_virtual/jsx-runtime.js";
2
- import L from "../../../_virtual/papaparse.min.js";
3
- import { Tooltip as S, Modal as q, Space as B, Spin as _, Progress as $ } from "antd";
4
- import { F as z } from "../../../_virtual/FileSaver.min.js";
5
- import { useState as w, useEffect as W, useMemo as v, useCallback as m } from "react";
6
- import { TRANSLATION_NAMESPACE as U } from "../../../locale/hooks/translation-constants.js";
7
- import G from "../view/CrudViewer.js";
8
- import H from "../../../util/DateUtil.js";
9
- import J from "../../common/button/Button.js";
10
- import { ImportButton as K } from "../../common/button/ImportButton.js";
11
- import { useTranslation as Q } from "../../../node_modules/react-i18next/dist/es/useTranslation.js";
12
- import R from "../../../node_modules/@ant-design/icons/es/icons/WarningTwoTone.js";
13
- import X from "../../../node_modules/@ant-design/icons/es/icons/DownloadOutlined.js";
1
+ import { jsxs as y, jsx as s } from "react/jsx-runtime";
2
+ import { WarningTwoTone as q, DownloadOutlined as z } from "@ant-design/icons";
3
+ import R from "papaparse";
4
+ import { Tooltip as B, Modal as O, Space as V, Spin as _, Progress as $ } from "antd";
5
+ import { saveAs as U } from "file-saver";
6
+ import { useState as v, useEffect as G, useMemo as A, useCallback as m } from "react";
7
+ import { useTranslation as H } from "react-i18next";
8
+ import { TRANSLATION_NAMESPACE as J } from "../../../locale/hooks/translation-constants.js";
9
+ import K from "../view/CrudViewer.js";
10
+ import Q from "../../../util/DateUtil.js";
11
+ import X from "../../common/button/Button.js";
12
+ import { ImportButton as Y } from "../../common/button/ImportButton.js";
14
13
  function de({
15
- onCloseMethod: h,
16
- open: y,
17
- fields: A,
14
+ onCloseMethod: x,
15
+ open: b,
16
+ fields: N,
18
17
  importProps: o
19
18
  }) {
20
- const [c, N] = w([]), [j, b] = w(!1), [T, E] = w(0);
21
- W(() => {
22
- y || (N([]), b(!1));
23
- }, [y]);
24
- const u = v(
19
+ const [c, D] = v([]), [C, w] = v(!1), [E, F] = v(0);
20
+ G(() => {
21
+ b || (D([]), w(!1));
22
+ }, [b]);
23
+ const u = A(
25
24
  () => new Map(
26
- A.filter((e) => {
27
- var r;
28
- return !e.hidden && !((r = e.importProps) != null && r.hidden) && !e.readonly;
25
+ N.filter((e) => {
26
+ var t;
27
+ return !e.hidden && !((t = e.importProps) != null && t.hidden) && !e.readonly;
29
28
  }).map((e) => [e.name, e])
30
29
  ),
31
- [A]
32
- ), F = v(
30
+ [N]
31
+ ), I = A(
33
32
  () => Array.from(u.values()).flatMap((e) => {
34
- var r;
33
+ var t;
35
34
  return [
36
35
  e.name,
37
- ...((r = e.importProps) == null ? void 0 : r.extraFields) ?? []
36
+ ...((t = e.importProps) == null ? void 0 : t.extraFields) ?? []
38
37
  ];
39
38
  }),
40
39
  [u]
41
- ), V = m(
40
+ ), M = m(
42
41
  async function() {
43
- const e = `${F.join(",")}
44
- `, r = new Blob([e], { type: "text/csv;charset=utf-8;" });
45
- z.saveAs(
46
- r,
47
- (o == null ? void 0 : o.name) + " - " + H.formatDateTimeWithSecond(/* @__PURE__ */ new Date()).replaceAll(":", "-") + ".csv"
42
+ const e = `${I.join(",")}
43
+ `, t = new Blob([e], { type: "text/csv;charset=utf-8;" });
44
+ U(
45
+ t,
46
+ (o == null ? void 0 : o.name) + " - " + Q.formatDateTimeWithSecond(/* @__PURE__ */ new Date()).replaceAll(":", "-") + ".csv"
48
47
  );
49
48
  },
50
- [F, o == null ? void 0 : o.name]
51
- ), { t: i } = Q(U), M = m(async (e) => {
52
- const r = new FileReader();
53
- r.onerror = console.error, r.onload = async (n) => {
54
- var s;
55
- const l = (s = n == null ? void 0 : n.target) == null ? void 0 : s.result, a = L.parse(l, { header: !0 });
56
- N(a.data);
57
- }, r.readAsText(e);
58
- }, []), C = v(() => {
59
- var r, n, l;
49
+ [I, o == null ? void 0 : o.name]
50
+ ), { t: l } = H(J), L = m(async (e) => {
51
+ const t = new FileReader();
52
+ t.onerror = console.error, t.onload = async (r) => {
53
+ var n;
54
+ const i = (n = r == null ? void 0 : r.target) == null ? void 0 : n.result, a = R.parse(i, { header: !0 });
55
+ D(a.data);
56
+ }, t.readAsText(e);
57
+ }, []), g = A(() => {
58
+ var t, r, i;
60
59
  let e = !1;
61
60
  for (const a of c)
62
- for (const [s, d] of u.entries()) {
63
- const x = a[s], f = x || !isNaN(x);
61
+ for (const [n, d] of u.entries()) {
62
+ const h = a[n], f = h || !isNaN(h);
64
63
  if (d.required && !f)
65
- if ((n = (r = d.importProps) == null ? void 0 : r.extraFields) != null && n.length)
66
- for (const g of ((l = d.importProps) == null ? void 0 : l.extraFields) ?? [])
67
- if (a[g] || !isNaN(a[g])) {
64
+ if ((r = (t = d.importProps) == null ? void 0 : t.extraFields) != null && r.length)
65
+ for (const T of ((i = d.importProps) == null ? void 0 : i.extraFields) ?? [])
66
+ if (a[T] || !isNaN(a[T])) {
68
67
  e = !1;
69
68
  break;
70
69
  } else return !0;
@@ -72,119 +71,119 @@ function de({
72
71
  }
73
72
  return e;
74
73
  }, [c, u]), p = m(
75
- (e) => (r, n) => {
76
- var a, s, d;
77
- const l = r || !isNaN(r);
78
- if (e.required && !l) {
79
- let x = i("err.validation.required");
80
- if ((s = (a = e.importProps) == null ? void 0 : a.extraFields) != null && s.length) {
74
+ (e) => (t, r) => {
75
+ var a, n, d;
76
+ const i = t || !isNaN(t);
77
+ if (e.required && !i) {
78
+ let h = l("err.validation.required");
79
+ if ((n = (a = e.importProps) == null ? void 0 : a.extraFields) != null && n.length) {
81
80
  const f = (d = e.importProps) == null ? void 0 : d.extraFields;
82
- (f == null ? void 0 : f.find((D) => !n[D])) && (x = "Either one of these fields is required: " + [e.name, ...f].join(", "));
81
+ (f == null ? void 0 : f.find((j) => !r[j])) && (h = "Either one of these fields is required: " + [e.name, ...f].join(", "));
83
82
  }
84
- return /* @__PURE__ */ t.jsxs(S, { className: "d-flex", title: x, children: [
85
- /* @__PURE__ */ t.jsx(R, { twoToneColor: "#ee9702" }),
86
- r
83
+ return /* @__PURE__ */ y(B, { className: "d-flex", title: h, children: [
84
+ /* @__PURE__ */ s(q, { twoToneColor: "#ee9702" }),
85
+ t
87
86
  ] });
88
87
  }
89
- return r;
88
+ return t;
90
89
  },
91
- [i]
92
- ), I = m(async (e) => {
93
- E(e);
90
+ [l]
91
+ ), S = m(async (e) => {
92
+ F(e);
94
93
  }, []), k = m(async () => {
95
94
  try {
96
- b(!0), await o.onClickImport(c, I), h(!1);
95
+ w(!0), await o.onClickImport(c, S), x(!1);
97
96
  } finally {
98
- b(!1), E(0);
97
+ w(!1), F(0);
99
98
  }
100
- }, [c, o, h, I]), O = m(async () => {
101
- C ? q.warn({
102
- title: i("str.warning"),
103
- content: i("qus.importWithIssues"),
104
- okText: i("str.import"),
99
+ }, [c, o, x, S]), W = m(async () => {
100
+ g ? O.warn({
101
+ title: l("str.warning"),
102
+ content: l("qus.importWithIssues"),
103
+ okText: l("str.import"),
105
104
  onOk: k,
106
105
  okCancel: !0,
107
106
  closable: !0
108
107
  }) : k();
109
- }, [C, k, i]);
110
- return /* @__PURE__ */ t.jsxs(
111
- q,
108
+ }, [g, k, l]);
109
+ return /* @__PURE__ */ y(
110
+ O,
112
111
  {
113
- title: [i("str.import"), o == null ? void 0 : o.name].filter(Boolean).join(" "),
112
+ title: [l("str.import"), o == null ? void 0 : o.name].filter(Boolean).join(" "),
114
113
  width: "100%",
115
- open: y,
116
- onOk: O,
114
+ open: b,
115
+ onOk: W,
117
116
  destroyOnClose: !0,
118
- onCancel: () => h(!1),
119
- okText: i("str.import"),
120
- confirmLoading: j,
117
+ onCancel: () => x(!1),
118
+ okText: l("str.import"),
119
+ confirmLoading: C,
121
120
  okButtonProps: {
122
121
  disabled: !(c != null && c.length)
123
122
  },
124
- footer: (e, { OkBtn: r, CancelBtn: n }) => /* @__PURE__ */ t.jsxs(B, { children: [
125
- /* @__PURE__ */ t.jsx(n, {}),
126
- /* @__PURE__ */ t.jsx(r, {}),
127
- C && /* @__PURE__ */ t.jsx(
128
- S,
123
+ footer: (e, { OkBtn: t, CancelBtn: r }) => /* @__PURE__ */ y(V, { children: [
124
+ /* @__PURE__ */ s(r, {}),
125
+ /* @__PURE__ */ s(t, {}),
126
+ g && /* @__PURE__ */ s(
127
+ B,
129
128
  {
130
129
  className: "d-flex",
131
130
  title: "Some fields have issue. Please review before submit.",
132
- children: /* @__PURE__ */ t.jsx(R, { twoToneColor: "#ee9702" })
131
+ children: /* @__PURE__ */ s(q, { twoToneColor: "#ee9702" })
133
132
  }
134
133
  )
135
134
  ] }),
136
135
  children: [
137
- /* @__PURE__ */ t.jsxs(B, { children: [
138
- /* @__PURE__ */ t.jsx(
139
- J,
136
+ /* @__PURE__ */ y(V, { children: [
137
+ /* @__PURE__ */ s(
138
+ X,
140
139
  {
141
- onClick: V,
142
- icon: /* @__PURE__ */ t.jsx(X, {}),
143
- children: i("str.downloadCsvTemplate")
140
+ onClick: M,
141
+ icon: /* @__PURE__ */ s(z, {}),
142
+ children: l("str.downloadCsvTemplate")
144
143
  }
145
144
  ),
146
- /* @__PURE__ */ t.jsx(
147
- K,
145
+ /* @__PURE__ */ s(
146
+ Y,
148
147
  {
149
- disabled: j,
148
+ disabled: C,
150
149
  type: "default",
151
- onClick: M,
150
+ onClick: L,
152
151
  accept: ".csv",
153
- children: i("str.importCsvFile")
152
+ children: l("str.importCsvFile")
154
153
  }
155
154
  )
156
155
  ] }),
157
- /* @__PURE__ */ t.jsx(
156
+ /* @__PURE__ */ s(
158
157
  _,
159
158
  {
160
- spinning: j,
161
- indicator: T ? /* @__PURE__ */ t.jsx(
159
+ spinning: C,
160
+ indicator: E ? /* @__PURE__ */ s(
162
161
  $,
163
162
  {
164
163
  type: "circle",
165
- percent: T * 100,
164
+ percent: E * 100,
166
165
  size: 50,
167
166
  format: (e) => `${parseInt(e)}%`
168
167
  }
169
168
  ) : void 0,
170
- children: /* @__PURE__ */ t.jsx(
171
- G,
169
+ children: /* @__PURE__ */ s(
170
+ K,
172
171
  {
173
172
  data: c,
174
173
  bordered: !0,
175
174
  size: "small",
176
175
  fields: Array.from(u.values()).flatMap((e) => {
177
- var r, n, l, a;
176
+ var t, r, i, a;
178
177
  return e.type === "text" ? [
179
178
  {
180
179
  ...e,
181
180
  label: e.name,
182
181
  render: p(e)
183
182
  },
184
- ...((n = (r = e.importProps) == null ? void 0 : r.extraFields) == null ? void 0 : n.map((s) => ({
183
+ ...((r = (t = e.importProps) == null ? void 0 : t.extraFields) == null ? void 0 : r.map((n) => ({
185
184
  ...e,
186
- name: s,
187
- label: s,
185
+ name: n,
186
+ label: n,
188
187
  render: p(e)
189
188
  }))) ?? []
190
189
  ] : e.type === "select" ? [
@@ -194,10 +193,10 @@ function de({
194
193
  type: "text",
195
194
  render: p(e)
196
195
  },
197
- ...((a = (l = e.importProps) == null ? void 0 : l.extraFields) == null ? void 0 : a.map((s) => ({
196
+ ...((a = (i = e.importProps) == null ? void 0 : i.extraFields) == null ? void 0 : a.map((n) => ({
198
197
  ...e,
199
- name: s,
200
- label: s,
198
+ name: n,
199
+ label: n,
201
200
  type: "text",
202
201
  render: p(e)
203
202
  }))) ?? []
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../../_virtual/jsx-runtime.cjs"),R=require("../../common/description/DescList.cjs"),b=require("react"),g=require("../../../locale/hooks/translation-constants.cjs"),p=require("./CrudViewerUtil.cjs"),q=require("../../../node_modules/react-i18next/dist/es/useTranslation.cjs");function C({className:l,fields:u,data:e,descListColumn:c={xs:1,md:3,sm:2,lg:4},layout:m,action:t,keepEmptyValues:x}){const{t:i}=q.useTranslation(g.TRANSLATION_NAMESPACE),j=b.useMemo(()=>{const o=u.filter(({hidden:r,hideInDescList:s})=>!r&&!s).map((r,s)=>({label:r.label,noFormatting:!0,value:p.getRendererValueCrudViewer(r)(e==null?void 0:e[r.name],e,s)}));return t&&o.push({label:i("str.action"),value:t}),o},[t,e,u,i]);return e?n.jsxRuntimeExports.jsx(R,{keepEmptyValues:x,bordered:!0,column:c,className:l,layout:m,list:j}):n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{})}exports.CrudDecListView=C;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),q=require("../../common/description/DescList.cjs"),C=require("react"),f=require("react-i18next"),x=require("../../../locale/hooks/translation-constants.cjs"),V=require("./CrudViewerUtil.cjs");function a({className:l,fields:u,data:e,descListColumn:c={xs:1,md:3,sm:2,lg:4},layout:m,action:t,keepEmptyValues:b}){const{t:i}=f.useTranslation(x.TRANSLATION_NAMESPACE),g=C.useMemo(()=>{const o=u.filter(({hidden:r,hideInDescList:s})=>!r&&!s).map((r,s)=>({label:r.label,noFormatting:!0,value:V.getRendererValueCrudViewer(r)(e==null?void 0:e[r.name],e,s)}));return t&&o.push({label:i("str.action"),value:t}),o},[t,e,u,i]);return e?n.jsx(q,{keepEmptyValues:b,bordered:!0,column:c,className:l,layout:m,list:g}):n.jsx(n.Fragment,{})}exports.CrudDecListView=a;
@@ -1,42 +1,42 @@
1
- import { j as m } from "../../../_virtual/jsx-runtime.js";
2
- import x from "../../common/description/DescList.js";
3
- import { useMemo as b } from "react";
4
- import { TRANSLATION_NAMESPACE as g } from "../../../locale/hooks/translation-constants.js";
5
- import { getRendererValueCrudViewer as j } from "./CrudViewerUtil.js";
6
- import { useTranslation as A } from "../../../node_modules/react-i18next/dist/es/useTranslation.js";
7
- function V({
8
- className: u,
9
- fields: s,
1
+ import { jsx as l, Fragment as b } from "react/jsx-runtime";
2
+ import g from "../../common/description/DescList.js";
3
+ import { useMemo as A } from "react";
4
+ import { useTranslation as x } from "react-i18next";
5
+ import { TRANSLATION_NAMESPACE as C } from "../../../locale/hooks/translation-constants.js";
6
+ import { getRendererValueCrudViewer as L } from "./CrudViewerUtil.js";
7
+ function E({
8
+ className: n,
9
+ fields: t,
10
10
  data: r,
11
- descListColumn: l = { xs: 1, md: 3, sm: 2, lg: 4 },
11
+ descListColumn: u = { xs: 1, md: 3, sm: 2, lg: 4 },
12
12
  layout: f,
13
13
  action: o,
14
14
  keepEmptyValues: p
15
15
  }) {
16
- const { t: i } = A(g), c = b(() => {
17
- const n = s.filter(({ hidden: e, hideInDescList: t }) => !e && !t).map((e, t) => ({
16
+ const { t: i } = x(C), c = A(() => {
17
+ const s = t.filter(({ hidden: e, hideInDescList: m }) => !e && !m).map((e, m) => ({
18
18
  label: e.label,
19
19
  noFormatting: !0,
20
- value: j(e)(
20
+ value: L(e)(
21
21
  r == null ? void 0 : r[e.name],
22
22
  r,
23
- t
23
+ m
24
24
  )
25
25
  }));
26
- return o && n.push({ label: i("str.action"), value: o }), n;
27
- }, [o, r, s, i]);
28
- return r ? /* @__PURE__ */ m.jsx(
29
- x,
26
+ return o && s.push({ label: i("str.action"), value: o }), s;
27
+ }, [o, r, t, i]);
28
+ return r ? /* @__PURE__ */ l(
29
+ g,
30
30
  {
31
31
  keepEmptyValues: p,
32
32
  bordered: !0,
33
- column: l,
34
- className: u,
33
+ column: u,
34
+ className: n,
35
35
  layout: f,
36
36
  list: c
37
37
  }
38
- ) : /* @__PURE__ */ m.jsx(m.Fragment, {});
38
+ ) : /* @__PURE__ */ l(b, {});
39
39
  }
40
40
  export {
41
- V as CrudDecListView
41
+ E as CrudDecListView
42
42
  };
@@ -1 +1 @@
1
- "use strict";const t=require("../../../_virtual/jsx-runtime.cjs"),P=require("antd"),k=require("../../common/button/CloneButtonTable.cjs"),H=require("../../common/button/DeleteButtonTable.cjs"),U=require("../../common/button/ExportButton.cjs"),F=require("../../common/button/HideButtonTable.cjs"),tt=require("../../common/button/RefreshButton.cjs"),st=require("../../common/button/UpdateButtonTable.cjs"),rt=require("../../common/button/ViewButtonTable.cjs"),et=require("../../common/layout/VerticalSpace.cjs"),ut=require("../../common/table/table.cjs"),i=require("react"),nt=require("../../../locale/hooks/translation-constants.cjs"),ot=require("../CrudSearchComponent.cjs"),xt=require("./CrudDecListView.cjs"),N=require("./CrudViewerUtil.cjs"),ct=require("../../../node_modules/react-i18next/dist/es/useTranslation.cjs");function jt({idField:e="id",loadingData:O,fields:c,isDeleting:p,isHiding:v,viewable:o=!1,paginateProps:m,onDelete:l,onHide:B,onUpdate:a,data:E=[],extraAction:R,onClickUpdate:x,minusHeight:g,scroll:z,onClickClone:h,className:_,expandable:$,size:w,bordered:A,descListColumn:G,extraView:T,decListLayout:J,scrollToTop:it,onClickRefresh:b,closeViewOnClickUpdate:C,onExport:f,confirmHiding:I,confirmDeleting:V,rowClassName:K,actionWidth:Q=190,...W}){const{t:X}=ct.useTranslation(nt.TRANSLATION_NAMESPACE),M=i.useMemo(()=>c.map(({hideInTable:s,hidden:r,width:j,name:n,label:Z,halign:D,...L})=>({title:Z,width:j,key:n,dataIndex:n,hidden:s||r,align:D??(L.type==="number"?"right":void 0),render:N.getRendererValueCrudViewer(L)})),[c]),[u,q]=i.useState(),[y,S]=i.useState();i.useEffect(()=>{E&&q(s=>{if(s)return E.find(r=>r[e]===s[e])})},[E,e,u]);const d=i.useCallback(s=>{var j;const r=R==null?void 0:R(s);return(Array.isArray(r)?(j=r==null?void 0:r.filter(Boolean))!=null&&j.length:r)||a||x||h||l?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[r,(a||x)&&t.jsxRuntimeExports.jsx(st,{value:s,onClick:n=>{S(n[e]),x==null||x(s),C&&q(void 0)}}),h&&t.jsxRuntimeExports.jsx(k,{value:s,onClick:n=>h(n)}),f&&t.jsxRuntimeExports.jsx(U.ExportButton,{value:s,onClick:async n=>await f(n)}),B&&t.jsxRuntimeExports.jsx(F,{value:s,disabled:v,shouldConfirm:I,loading:v&&s[e]===y,onClick:async n=>{S(n[e]),await B({[e]:n[e]})}}),l&&t.jsxRuntimeExports.jsx(H,{value:s,disabled:p,shouldConfirm:V,loading:p&&s[e]===y,onClick:async n=>{S(n[e]),await l({[e]:n[e]})}})]}):void 0},[C,V,I,R,e,p,v,h,x,l,f,B,a,y]),Y=i.useMemo(()=>{let s=typeof o=="string"?u==null?void 0:u[o]:void 0;if(typeof s=="object"){const r=c.find(j=>j.name===o);s=N.getRendererValueCrudViewer(r)(s,u,0)}return s},[o,u,c]);return t.jsxRuntimeExports.jsxs("div",{children:[o&&t.jsxRuntimeExports.jsx(P.Modal,{width:"100%",open:!!u,title:Y??t.jsxRuntimeExports.jsx("div",{children:" "}),footer:t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{}),closable:!0,onCancel:()=>q(void 0),children:!!u&&t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsx(xt.CrudDecListView,{layout:J,descListColumn:G,data:u,fields:c,action:d(u)}),T==null?void 0:T(u)]},u==null?void 0:u[e])}),t.jsxRuntimeExports.jsx(ot,{fields:c,...W}),t.jsxRuntimeExports.jsxs(et,{children:[!!b&&t.jsxRuntimeExports.jsx(tt.RefreshButton,{onClick:b}),t.jsxRuntimeExports.jsx(ut,{rowClassName:K,className:_,scroll:z??(g?{y:`calc(100vh - ${g})`}:void 0),id:"crud-table",dataSource:E,loading:O,bordered:A,size:w,expandable:$,pagination:m?{total:m.count,onChange:m.setPage,current:m.page,pageSize:m.pageSize}:void 0,columns:a||x||l||R||o?[...M,{title:X("str.action"),dataIndex:"",fixed:"right",width:Q,render:(s,r)=>t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[o&&t.jsxRuntimeExports.jsx(rt,{value:r,onClick:q}),d(r)]})}]:M})]})]})}module.exports=jt;
1
+ "use strict";const r=require("react/jsx-runtime"),k=require("antd"),H=require("../../common/button/CloneButtonTable.cjs"),p=require("../../common/button/DeleteButtonTable.cjs"),U=require("../../common/button/ExportButton.cjs"),F=require("../../common/button/HideButtonTable.cjs"),rr=require("../../common/button/RefreshButton.cjs"),er=require("../../common/button/UpdateButtonTable.cjs"),tr=require("../../common/button/ViewButtonTable.cjs"),sr=require("../../common/layout/VerticalSpace.cjs"),ur=require("../../common/table/table.cjs"),j=require("react"),nr=require("react-i18next"),or=require("../../../locale/hooks/translation-constants.cjs"),cr=require("../CrudSearchComponent.cjs"),lr=require("./CrudDecListView.cjs"),O=require("./CrudViewerUtil.cjs");function ar({idField:s="id",loadingData:z,fields:l,isDeleting:T,isHiding:m,viewable:o=!1,paginateProps:h,onDelete:q,onHide:y,onUpdate:v,data:x=[],extraAction:i,onClickUpdate:c,minusHeight:R,scroll:_,onClickClone:B,className:$,expandable:w,size:A,bordered:G,descListColumn:J,extraView:S,decListLayout:K,scrollToTop:jr,onClickRefresh:I,closeViewOnClickUpdate:V,onExport:g,confirmHiding:M,confirmDeleting:d,rowClassName:Q,actionWidth:W=190,...X}){const{t:Y}=nr.useTranslation(or.TRANSLATION_NAMESPACE),E=j.useMemo(()=>l.map(({hideInTable:e,hidden:t,width:a,name:n,label:D,halign:P,...N})=>({title:D,width:a,key:n,dataIndex:n,hidden:e||t,align:P??(N.type==="number"?"right":void 0),render:O.getRendererValueCrudViewer(N)})),[l]),[u,f]=j.useState(),[b,C]=j.useState();j.useEffect(()=>{x&&f(e=>{if(e)return x.find(t=>t[s]===e[s])})},[x,s,u]);const L=j.useCallback(e=>{var a;const t=i==null?void 0:i(e);return(Array.isArray(t)?(a=t==null?void 0:t.filter(Boolean))!=null&&a.length:t)||v||c||B||q?r.jsxs(r.Fragment,{children:[t,(v||c)&&r.jsx(er,{value:e,onClick:n=>{C(n[s]),c==null||c(e),V&&f(void 0)}}),B&&r.jsx(H,{value:e,onClick:n=>B(n)}),g&&r.jsx(U.ExportButton,{value:e,onClick:async n=>await g(n)}),y&&r.jsx(F,{value:e,disabled:m,shouldConfirm:M,loading:m&&e[s]===b,onClick:async n=>{C(n[s]),await y({[s]:n[s]})}}),q&&r.jsx(p,{value:e,disabled:T,shouldConfirm:d,loading:T&&e[s]===b,onClick:async n=>{C(n[s]),await q({[s]:n[s]})}})]}):void 0},[V,d,M,i,s,T,m,B,c,q,g,y,v,b]),Z=j.useMemo(()=>{let e=typeof o=="string"?u==null?void 0:u[o]:void 0;if(typeof e=="object"){const t=l.find(a=>a.name===o);e=O.getRendererValueCrudViewer(t)(e,u,0)}return e},[o,u,l]);return r.jsxs("div",{children:[o&&r.jsx(k.Modal,{width:"100%",open:!!u,title:Z??r.jsx("div",{children:" "}),footer:r.jsx(r.Fragment,{}),closable:!0,onCancel:()=>f(void 0),children:!!u&&r.jsxs("div",{children:[r.jsx(lr.CrudDecListView,{layout:K,descListColumn:J,data:u,fields:l,action:L(u)}),S==null?void 0:S(u)]},u==null?void 0:u[s])}),r.jsx(cr,{fields:l,...X}),r.jsxs(sr,{children:[!!I&&r.jsx(rr.RefreshButton,{onClick:I}),r.jsx(ur,{rowClassName:Q,className:$,scroll:_??(R?{y:`calc(100vh - ${R})`}:void 0),id:"crud-table",dataSource:x,loading:z,bordered:G,size:A,expandable:w,pagination:h?{total:h.count,onChange:h.setPage,current:h.page,pageSize:h.pageSize}:void 0,columns:v||c||q||i||o?[...E,{title:Y("str.action"),dataIndex:"",fixed:"right",width:W,render:(e,t)=>r.jsxs(r.Fragment,{children:[o&&r.jsx(tr,{value:t,onClick:f}),L(t)]})}]:E})]})]})}module.exports=ar;