@kingteza/crud-component 1.0.9 → 1.0.12

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 (217) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/util/index.cjs +1 -1
  3. package/package.json +18 -9
  4. package/dist/_virtual/FileSaver.min.cjs +0 -1
  5. package/dist/_virtual/FileSaver.min.js +0 -5
  6. package/dist/_virtual/FileSaver.min2.cjs +0 -1
  7. package/dist/_virtual/FileSaver.min2.js +0 -4
  8. package/dist/_virtual/ShowMoreText.cjs +0 -1
  9. package/dist/_virtual/ShowMoreText.js +0 -7
  10. package/dist/_virtual/ShowMoreText2.cjs +0 -1
  11. package/dist/_virtual/ShowMoreText2.js +0 -4
  12. package/dist/_virtual/Truncate.cjs +0 -1
  13. package/dist/_virtual/Truncate.js +0 -4
  14. package/dist/_virtual/_commonjsHelpers.cjs +0 -1
  15. package/dist/_virtual/_commonjsHelpers.js +0 -8
  16. package/dist/_virtual/advancedFormat.cjs +0 -1
  17. package/dist/_virtual/advancedFormat.js +0 -7
  18. package/dist/_virtual/advancedFormat2.cjs +0 -1
  19. package/dist/_virtual/advancedFormat2.js +0 -4
  20. package/dist/_virtual/customParseFormat.cjs +0 -1
  21. package/dist/_virtual/customParseFormat.js +0 -7
  22. package/dist/_virtual/customParseFormat2.cjs +0 -1
  23. package/dist/_virtual/customParseFormat2.js +0 -4
  24. package/dist/_virtual/dayjs.min.cjs +0 -1
  25. package/dist/_virtual/dayjs.min.js +0 -7
  26. package/dist/_virtual/dayjs.min2.cjs +0 -1
  27. package/dist/_virtual/dayjs.min2.js +0 -4
  28. package/dist/_virtual/index.cjs +0 -1
  29. package/dist/_virtual/index.js +0 -7
  30. package/dist/_virtual/index10.cjs +0 -1
  31. package/dist/_virtual/index10.js +0 -7
  32. package/dist/_virtual/index11.cjs +0 -1
  33. package/dist/_virtual/index11.js +0 -7
  34. package/dist/_virtual/index12.cjs +0 -1
  35. package/dist/_virtual/index12.js +0 -4
  36. package/dist/_virtual/index13.cjs +0 -1
  37. package/dist/_virtual/index13.js +0 -4
  38. package/dist/_virtual/index2.cjs +0 -1
  39. package/dist/_virtual/index2.js +0 -5
  40. package/dist/_virtual/index3.cjs +0 -1
  41. package/dist/_virtual/index3.js +0 -7
  42. package/dist/_virtual/index4.cjs +0 -1
  43. package/dist/_virtual/index4.js +0 -4
  44. package/dist/_virtual/index5.cjs +0 -1
  45. package/dist/_virtual/index5.js +0 -4
  46. package/dist/_virtual/index6.cjs +0 -1
  47. package/dist/_virtual/index6.js +0 -4
  48. package/dist/_virtual/index7.cjs +0 -1
  49. package/dist/_virtual/index7.js +0 -4
  50. package/dist/_virtual/index8.cjs +0 -1
  51. package/dist/_virtual/index8.js +0 -2
  52. package/dist/_virtual/index9.cjs +0 -1
  53. package/dist/_virtual/index9.js +0 -7
  54. package/dist/_virtual/jsx-runtime.cjs +0 -1
  55. package/dist/_virtual/jsx-runtime.js +0 -5
  56. package/dist/_virtual/jsx-runtime2.cjs +0 -1
  57. package/dist/_virtual/jsx-runtime2.js +0 -4
  58. package/dist/_virtual/localeData.cjs +0 -1
  59. package/dist/_virtual/localeData.js +0 -7
  60. package/dist/_virtual/localeData2.cjs +0 -1
  61. package/dist/_virtual/localeData2.js +0 -4
  62. package/dist/_virtual/main.cjs +0 -1
  63. package/dist/_virtual/main.js +0 -7
  64. package/dist/_virtual/main2.cjs +0 -1
  65. package/dist/_virtual/main2.js +0 -4
  66. package/dist/_virtual/papaparse.min.cjs +0 -1
  67. package/dist/_virtual/papaparse.min.js +0 -7
  68. package/dist/_virtual/papaparse.min2.cjs +0 -1
  69. package/dist/_virtual/papaparse.min2.js +0 -4
  70. package/dist/_virtual/react-is.development.cjs +0 -1
  71. package/dist/_virtual/react-is.development.js +0 -4
  72. package/dist/_virtual/react-is.development2.cjs +0 -1
  73. package/dist/_virtual/react-is.development2.js +0 -4
  74. package/dist/_virtual/react-is.production.min.cjs +0 -1
  75. package/dist/_virtual/react-is.production.min.js +0 -4
  76. package/dist/_virtual/react-is.production.min2.cjs +0 -1
  77. package/dist/_virtual/react-is.production.min2.js +0 -4
  78. package/dist/_virtual/react-jsx-runtime.development.cjs +0 -1
  79. package/dist/_virtual/react-jsx-runtime.development.js +0 -4
  80. package/dist/_virtual/react-jsx-runtime.production.min.cjs +0 -1
  81. package/dist/_virtual/react-jsx-runtime.production.min.js +0 -4
  82. package/dist/_virtual/weekOfYear.cjs +0 -1
  83. package/dist/_virtual/weekOfYear.js +0 -7
  84. package/dist/_virtual/weekOfYear2.cjs +0 -1
  85. package/dist/_virtual/weekOfYear2.js +0 -4
  86. package/dist/_virtual/weekYear.cjs +0 -1
  87. package/dist/_virtual/weekYear.js +0 -7
  88. package/dist/_virtual/weekYear2.cjs +0 -1
  89. package/dist/_virtual/weekYear2.js +0 -4
  90. package/dist/_virtual/weekday.cjs +0 -1
  91. package/dist/_virtual/weekday.js +0 -7
  92. package/dist/_virtual/weekday2.cjs +0 -1
  93. package/dist/_virtual/weekday2.js +0 -4
  94. package/dist/common/index.cjs +0 -1
  95. package/dist/common/index.d.ts +0 -2
  96. package/dist/common/index.js +0 -75
  97. package/dist/context/WindowDimension.d.ts +0 -4
  98. package/dist/crud-component.css +0 -9
  99. package/dist/src/components/common/DatePicker/DatePicker.cjs +0 -1
  100. package/dist/src/components/common/DatePicker/DatePicker.js +0 -89
  101. package/dist/src/components/common/DatePicker/TimePicker.cjs +0 -1
  102. package/dist/src/components/common/DatePicker/TimePicker.js +0 -79
  103. package/dist/src/components/common/appearance/Hider.cjs +0 -1
  104. package/dist/src/components/common/appearance/Hider.js +0 -5
  105. package/dist/src/components/common/button/Button.cjs +0 -1
  106. package/dist/src/components/common/button/Button.js +0 -65
  107. package/dist/src/components/common/button/CloneButtonTable.cjs +0 -1
  108. package/dist/src/components/common/button/CloneButtonTable.js +0 -20
  109. package/dist/src/components/common/button/DeleteButtonTable.cjs +0 -1
  110. package/dist/src/components/common/button/DeleteButtonTable.js +0 -68
  111. package/dist/src/components/common/button/ExportButton.cjs +0 -1
  112. package/dist/src/components/common/button/ExportButton.js +0 -27
  113. package/dist/src/components/common/button/HideButtonTable.cjs +0 -1
  114. package/dist/src/components/common/button/HideButtonTable.js +0 -68
  115. package/dist/src/components/common/button/ImportButton.cjs +0 -1
  116. package/dist/src/components/common/button/ImportButton.js +0 -56
  117. package/dist/src/components/common/button/NewButton.cjs +0 -1
  118. package/dist/src/components/common/button/NewButton.js +0 -24
  119. package/dist/src/components/common/button/PrintButton.cjs +0 -1
  120. package/dist/src/components/common/button/PrintButton.js +0 -26
  121. package/dist/src/components/common/button/RefreshButton.cjs +0 -1
  122. package/dist/src/components/common/button/RefreshButton.js +0 -24
  123. package/dist/src/components/common/button/UnHideButton.cjs +0 -1
  124. package/dist/src/components/common/button/UnHideButton.js +0 -70
  125. package/dist/src/components/common/button/UpdateButtonTable.cjs +0 -1
  126. package/dist/src/components/common/button/UpdateButtonTable.js +0 -20
  127. package/dist/src/components/common/button/ViewButtonTable.cjs +0 -1
  128. package/dist/src/components/common/button/ViewButtonTable.js +0 -20
  129. package/dist/src/components/common/check-box/CheckBox.cjs +0 -1
  130. package/dist/src/components/common/check-box/CheckBox.js +0 -42
  131. package/dist/src/components/common/description/DescList.cjs +0 -1
  132. package/dist/src/components/common/description/DescList.js +0 -16
  133. package/dist/src/components/common/layout/VerticalSpace.cjs +0 -1
  134. package/dist/src/components/common/layout/VerticalSpace.js +0 -6
  135. package/dist/src/components/common/loading/LoadingIndicator.cjs +0 -1
  136. package/dist/src/components/common/loading/LoadingIndicator.js +0 -25
  137. package/dist/src/components/common/picker/ImagePicker.cjs +0 -1
  138. package/dist/src/components/common/picker/ImagePicker.js +0 -287
  139. package/dist/src/components/common/radio/RadioGroupComponent.cjs +0 -1
  140. package/dist/src/components/common/radio/RadioGroupComponent.js +0 -20
  141. package/dist/src/components/common/report/SelectFieldInReport.cjs +0 -1
  142. package/dist/src/components/common/report/SelectFieldInReport.js +0 -31
  143. package/dist/src/components/common/select/CustomSelectOption.cjs +0 -1
  144. package/dist/src/components/common/select/CustomSelectOption.js +0 -13
  145. package/dist/src/components/common/select/SelectComponent.cjs +0 -1
  146. package/dist/src/components/common/select/SelectComponent.js +0 -92
  147. package/dist/src/components/common/show-more/index.cjs +0 -1
  148. package/dist/src/components/common/show-more/index.js +0 -8
  149. package/dist/src/components/common/tab/TabViewWithRoute.cjs +0 -1
  150. package/dist/src/components/common/tab/TabViewWithRoute.js +0 -38
  151. package/dist/src/components/common/table/table.cjs +0 -1
  152. package/dist/src/components/common/table/table.js +0 -40
  153. package/dist/src/components/common/tag/StatusTag.cjs +0 -1
  154. package/dist/src/components/common/tag/StatusTag.js +0 -30
  155. package/dist/src/components/common/text/index.cjs +0 -1
  156. package/dist/src/components/common/text/index.js +0 -5
  157. package/dist/src/components/common/text/title/index.cjs +0 -1
  158. package/dist/src/components/common/text/title/index.js +0 -5
  159. package/dist/src/components/common/text-field/NumberField.cjs +0 -1
  160. package/dist/src/components/common/text-field/NumberField.js +0 -84
  161. package/dist/src/components/common/text-field/PhoneNumberField.cjs +0 -1
  162. package/dist/src/components/common/text-field/PhoneNumberField.js +0 -18
  163. package/dist/src/components/common/text-field/TextArea.cjs +0 -1
  164. package/dist/src/components/common/text-field/TextArea.js +0 -48
  165. package/dist/src/components/common/text-field/TextField.cjs +0 -1
  166. package/dist/src/components/common/text-field/TextField.js +0 -74
  167. package/dist/src/components/common/tooltip/TooltipComponent.cjs +0 -1
  168. package/dist/src/components/common/tooltip/TooltipComponent.js +0 -9
  169. package/dist/src/components/common/wizard/WizardResult.cjs +0 -1
  170. package/dist/src/components/common/wizard/WizardResult.js +0 -61
  171. package/dist/src/components/common/wizard/WizardViewForm.cjs +0 -1
  172. package/dist/src/components/common/wizard/WizardViewForm.js +0 -74
  173. package/dist/src/components/crud/CrudComponent.cjs +0 -1
  174. package/dist/src/components/crud/CrudComponent.js +0 -213
  175. package/dist/src/components/crud/CrudField.cjs +0 -1
  176. package/dist/src/components/crud/CrudField.js +0 -462
  177. package/dist/src/components/crud/CrudForm.cjs +0 -1
  178. package/dist/src/components/crud/CrudForm.js +0 -94
  179. package/dist/src/components/crud/CrudFormWizard.cjs +0 -1
  180. package/dist/src/components/crud/CrudFormWizard.js +0 -145
  181. package/dist/src/components/crud/CrudReportComponent.cjs +0 -4
  182. package/dist/src/components/crud/CrudReportComponent.js +0 -259
  183. package/dist/src/components/crud/CrudSearchComponent.cjs +0 -1
  184. package/dist/src/components/crud/CrudSearchComponent.js +0 -97
  185. package/dist/src/components/crud/FileCrudField.cjs +0 -1
  186. package/dist/src/components/crud/FileCrudField.js +0 -229
  187. package/dist/src/components/crud/ImageCrudField.cjs +0 -1
  188. package/dist/src/components/crud/ImageCrudField.js +0 -116
  189. package/dist/src/components/crud/import/CrudImportButton.cjs +0 -1
  190. package/dist/src/components/crud/import/CrudImportButton.js +0 -31
  191. package/dist/src/components/crud/import/CrudImportComponent.cjs +0 -2
  192. package/dist/src/components/crud/import/CrudImportComponent.js +0 -226
  193. package/dist/src/components/crud/view/CrudDecListView.cjs +0 -1
  194. package/dist/src/components/crud/view/CrudDecListView.js +0 -42
  195. package/dist/src/components/crud/view/CrudViewer.cjs +0 -1
  196. package/dist/src/components/crud/view/CrudViewer.js +0 -217
  197. package/dist/src/components/crud/view/CrudViewerUtil.cjs +0 -1
  198. package/dist/src/components/crud/view/CrudViewerUtil.js +0 -59
  199. package/dist/src/context/WindowDimension.cjs +0 -1
  200. package/dist/src/context/WindowDimension.js +0 -8
  201. package/dist/src/locale/hooks/translation-constants.cjs +0 -1
  202. package/dist/src/locale/hooks/translation-constants.js +0 -4
  203. package/dist/src/locale/index.cjs +0 -1
  204. package/dist/src/locale/index.js +0 -33
  205. package/dist/src/locale/translations/en.cjs +0 -1
  206. package/dist/src/locale/translations/en.js +0 -60
  207. package/dist/src/util/DateUtil.cjs +0 -1
  208. package/dist/src/util/DateUtil.js +0 -6
  209. package/dist/src/util/ImageUtil.cjs +0 -1
  210. package/dist/src/util/ImageUtil.js +0 -63
  211. package/dist/src/util/NumberUtil.cjs +0 -1
  212. package/dist/src/util/NumberUtil.js +0 -60
  213. package/dist/src/util/ValidationUtil.cjs +0 -1
  214. package/dist/src/util/ValidationUtil.js +0 -60
  215. package/dist/types/DialogComponentProp.d.ts +0 -8
  216. package/dist/types/Id.d.ts +0 -10
  217. package/dist/vite.svg +0 -1
@@ -1,229 +0,0 @@
1
- import { j as e } from "../../../_virtual/jsx-runtime.js";
2
- /* empty css */
3
- import M from "../../../node_modules/mime/dist/src/index.js";
4
- import { useState as d, useCallback as N, useEffect as S, useMemo as E } from "react";
5
- import { useTranslation as H } from "react-i18next";
6
- import { TRANSLATION_NAMESPACE as W } from "../../locale/hooks/translation-constants.js";
7
- import z from "../../util/ValidationUtil.js";
8
- import g from "../common/button/Button.js";
9
- import G from "../common/layout/VerticalSpace.js";
10
- import F from "../../../node_modules/antd/es/form/index.js";
11
- import J from "../../../node_modules/antd/es/upload/index.js";
12
- import K from "../../../node_modules/@ant-design/icons/es/icons/FileOutlined.js";
13
- import Q from "../../../node_modules/@ant-design/icons/es/icons/FilePptOutlined.js";
14
- import X from "../../../node_modules/@ant-design/icons/es/icons/FileExcelOutlined.js";
15
- import Y from "../../../node_modules/@ant-design/icons/es/icons/FileTextOutlined.js";
16
- import Z from "../../../node_modules/@ant-design/icons/es/icons/FileWordOutlined.js";
17
- import v from "../../../node_modules/@ant-design/icons/es/icons/FilePdfOutlined.js";
18
- import y from "../../../node_modules/@ant-design/icons/es/icons/FileImageOutlined.js";
19
- import T from "../../../node_modules/antd/es/modal/index.js";
20
- import tt from "../../../node_modules/@ant-design/icons/es/icons/ExportOutlined.js";
21
- function Pt({
22
- name: o,
23
- label: t,
24
- required: r,
25
- provider: s,
26
- onUploading: l,
27
- onRemoved: f,
28
- fieldClassName: x,
29
- accept: I,
30
- rules: U,
31
- maxCount: C = 1,
32
- block: k,
33
- ...O
34
- }) {
35
- const u = F.useFormInstance(), h = F.useWatch(o, u), [P, $] = d(!1), [R, _] = d(!1), m = N(
36
- async (n) => {
37
- var c, a;
38
- try {
39
- const { file: i } = n, j = i.name;
40
- $(!0), _(!0), l == null || l(!0);
41
- const w = j ?? "", b = w.split("."), q = b[b.length - 1], B = s.generateFileName(w), A = `${await s.getInitialPath()}/${B}.${q}`;
42
- console.log({ filePath: A });
43
- const D = await s.upload(
44
- { ...i, originFileObj: i },
45
- A
46
- );
47
- l == null || l(!1), u.setFieldValue(o, D), (c = n.onSuccess) == null || c.call(n, D);
48
- } catch (i) {
49
- (a = n.onError) == null || a.call(n, i);
50
- } finally {
51
- $(!1);
52
- }
53
- },
54
- [u, o, l, s]
55
- ), [p, V] = d([]);
56
- S(() => {
57
- !R && h && Promise.all(
58
- (Array.isArray(h) ? h : [h]).map(
59
- async (n) => {
60
- const c = M.getType(n), a = n.split("/").pop(), i = await s.getRealUrl(n);
61
- return {
62
- uid: n,
63
- url: i,
64
- type: c,
65
- name: a
66
- };
67
- }
68
- )
69
- ).then((n) => V(() => {
70
- const c = n.map(({ url: a, type: i, uid: j, name: w }) => ({ uid: j, url: a, type: i, response: j, thumbUrl: a, name: w }));
71
- return console.log(c), c;
72
- }));
73
- }, [h, R, P, s]);
74
- const L = N(
75
- async (n) => {
76
- const c = n.response, a = c || u.getFieldValue(o);
77
- await s.delete(a), f == null || f(), n && u.setFieldsValue({ [o]: null });
78
- },
79
- [u, o, f, s]
80
- );
81
- return /* @__PURE__ */ e.jsxs(
82
- F.Item,
83
- {
84
- label: t,
85
- required: r,
86
- name: o,
87
- className: x,
88
- rules: [
89
- ...r ? z.required(t) : [],
90
- ...U ?? []
91
- ],
92
- children: [
93
- /* @__PURE__ */ e.jsx("input", { hidden: !0 }),
94
- /* @__PURE__ */ e.jsx(
95
- J,
96
- {
97
- ...O,
98
- fileList: p,
99
- className: ((p == null ? void 0 : p.length) ?? 0) >= C ? "hide-upload" : "",
100
- maxCount: C,
101
- customRequest: m,
102
- onRemove: L,
103
- listType: "picture",
104
- onChange: ({ fileList: n }) => {
105
- V(n);
106
- },
107
- style: k ? { width: "100%" } : void 0,
108
- children: /* @__PURE__ */ e.jsx(g, { loading: P, children: "Upload File" })
109
- }
110
- )
111
- ]
112
- }
113
- );
114
- }
115
- const $t = ({ provider: o, value: t }) => {
116
- const [r, s] = d();
117
- return S(() => {
118
- t && o.getRealUrl(t).then((l) => {
119
- s({
120
- mimeType: M.getType(t),
121
- url: l,
122
- fileName: t.split("/").pop() ?? t
123
- });
124
- });
125
- }, [o, t]), r ? /* @__PURE__ */ e.jsx(
126
- et,
127
- {
128
- fileName: r.fileName,
129
- url: r == null ? void 0 : r.url,
130
- mimeType: r == null ? void 0 : r.mimeType
131
- }
132
- ) : /* @__PURE__ */ e.jsx(e.Fragment, {});
133
- }, et = ({ url: o, mimeType: t = "", fileName: r }) => {
134
- const s = E(() => t != null && t.includes("image") ? "image" : t != null && t.includes("pdf") ? "pdf" : t != null && t.includes("word") ? "word" : t != null && t.includes("text") ? "text" : t != null && t.includes("presentation") ? "presentation" : t != null && t.includes("excel") || t != null && t.includes("spreadsheet") ? "excel" : "file", [t]), l = E(() => {
135
- switch (s) {
136
- case "image":
137
- return /* @__PURE__ */ e.jsx(y, {});
138
- case "pdf":
139
- return /* @__PURE__ */ e.jsx(v, {});
140
- case "word":
141
- return /* @__PURE__ */ e.jsx(Z, {});
142
- case "text":
143
- return /* @__PURE__ */ e.jsx(Y, {});
144
- case "excel":
145
- return /* @__PURE__ */ e.jsx(X, {});
146
- case "presentation":
147
- return /* @__PURE__ */ e.jsx(Q, {});
148
- default:
149
- return /* @__PURE__ */ e.jsx(K, {});
150
- }
151
- }, [s]), [f, x] = d(!1), { t: I } = H(W);
152
- return s !== "file" && s !== "text" ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
153
- /* @__PURE__ */ e.jsx(
154
- T,
155
- {
156
- open: f,
157
- title: r,
158
- onCancel: () => x(!1),
159
- footer: /* @__PURE__ */ e.jsx(e.Fragment, {}),
160
- width: "100%",
161
- style: { top: "8px", minHeight: "700px" },
162
- destroyOnClose: !0,
163
- children: /* @__PURE__ */ e.jsxs(G, { children: [
164
- /* @__PURE__ */ e.jsx(
165
- g,
166
- {
167
- tooltip: r,
168
- icon: /* @__PURE__ */ e.jsx(tt, {}),
169
- target: "_blank",
170
- href: o,
171
- style: { textDecoration: "none" },
172
- children: I("str.openInNewTab")
173
- }
174
- ),
175
- s === "image" ? /* @__PURE__ */ e.jsx("img", { src: o, alt: r, style: { width: "100%" } }) : s === "pdf" ? /* @__PURE__ */ e.jsxs("iframe", { title: r, src: o, width: "100%", height: "700px", children: [
176
- "This browser does not support PDFs. Please download the PDF to view it:",
177
- /* @__PURE__ */ e.jsx("a", { href: o, children: "Download PDF" }),
178
- "."
179
- ] }) : /* @__PURE__ */ e.jsxs(
180
- "iframe",
181
- {
182
- title: r,
183
- src: `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(
184
- o
185
- )}`,
186
- width: "100%",
187
- height: "700px",
188
- children: [
189
- "This browser does not support open ",
190
- s.toUpperCase(),
191
- ". Please download the",
192
- s.toUpperCase(),
193
- " to view it:",
194
- /* @__PURE__ */ e.jsxs("a", { href: o, children: [
195
- "Download ",
196
- s.toUpperCase()
197
- ] }),
198
- "."
199
- ]
200
- }
201
- )
202
- ] })
203
- }
204
- ),
205
- /* @__PURE__ */ e.jsx(
206
- g,
207
- {
208
- tooltip: r,
209
- icon: l,
210
- shape: "circle",
211
- onClick: () => x(!0)
212
- }
213
- )
214
- ] }) : /* @__PURE__ */ e.jsx(
215
- g,
216
- {
217
- tooltip: r,
218
- icon: l,
219
- target: "_blank",
220
- href: o,
221
- shape: "circle"
222
- }
223
- );
224
- };
225
- export {
226
- et as FileCellValue,
227
- $t as FileCrudCellValue,
228
- Pt as default
229
- };
@@ -1 +0,0 @@
1
- "use strict";var S=Object.defineProperty;var _=(e,l,t)=>l in e?S(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t;var d=(e,l,t)=>_(e,typeof l!="symbol"?l+"":l,t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("../../../_virtual/jsx-runtime.cjs");;/* empty css */const q=require("../../../_virtual/index.cjs"),n=require("react"),O=require("../../util/NumberUtil.cjs"),k=require("../../util/ValidationUtil.cjs"),D=require("../common/picker/ImagePicker.cjs"),j=require("../../../node_modules/antd/es/form/index.cjs"),M=require("../../../node_modules/antd/es/input/index.cjs"),A=require("../../../node_modules/uuid/dist/esm-browser/v4.cjs"),T=require("../../../node_modules/antd/es/avatar/index.cjs"),W=require("../../../node_modules/antd/es/image/index.cjs"),z=require("../../../node_modules/@ant-design/icons/es/icons/EyeOutlined.cjs");class I{}class B extends I{constructor(t="",s=""){super();d(this,"rootPath");d(this,"subPath");this.rootPath=t,this.subPath=s}cloneFilePath(t){const s=q.default.parse(t),r=`${s.name}_cloned_${O.default.randInt(1e5)}`;return q.default.format({dir:s.dir,ext:s.ext,name:r})}generateFileName(t){return`${t.split(".")[0]}_${A.default().replace("-","")}`}}function G({name:e,label:l,required:t,provider:s,onUploading:r,aspectRatio:h,onRemoved:c,fieldClassName:R,hideLabel:$=!1,listType:w}){const i=j.default.useFormInstance(),x=j.default.useWatch(e,i),[F,C]=n.useState(!1),P=n.useCallback(async(u,N)=>{if(N){r==null||r(!0);const o=u.name,f=o.split("."),V=f[f.length-1],g=s.generateFileName(o),y=`${await s.getInitialPath()}/${g}.${V}`,b=await s.upload(u,y);C(!0),r==null||r(!1),i.setFieldValue(e,b)}else{console.log(u);const o=i.getFieldsValue(),f=await s.delete(o[e]);c==null||c(),f&&i.setFieldsValue({[e]:null})}},[i,e,c,r,s]),[m,E]=n.useState();return n.useEffect(()=>{!F&&x?s.getRealUrl(x).then(E):E(m)},[x,F,s,m]),a.jsxRuntimeExports.jsx(a.jsxRuntimeExports.Fragment,{children:a.jsxRuntimeExports.jsxs(j.default.Item,{rules:t?k.default.required(l):[],label:$?null:l,required:t,name:e,children:[a.jsxRuntimeExports.jsx(D.default,{noStyle:!0,listType:w,aspectRatio:h,values:m,onRemove:u=>{u&&P(u,!1)},onAdd:async u=>{u&&await P(u,!0)},className:R}),a.jsxRuntimeExports.jsx(M.default,{hidden:!0})]})})}const H=({provider:e,value:l})=>{const[t,s]=n.useState();return n.useEffect(()=>{l&&e.getRealUrl(l).then(s)},[e,l]),t?a.jsxRuntimeExports.jsx(p,{url:t}):a.jsxRuntimeExports.jsx(a.jsxRuntimeExports.Fragment,{})},p=({url:e})=>a.jsxRuntimeExports.jsx(T.default,{className:"p-0",children:a.jsxRuntimeExports.jsx(W.default,{className:"m-0 p-0 position-relative",src:e,preview:{mask:a.jsxRuntimeExports.jsx(z.default,{})}})});exports.FileDownloadProvider=I;exports.FileUploadProvider=B;exports.ImageCellValue=p;exports.ImageCrudCellValue=H;exports.default=G;
@@ -1,116 +0,0 @@
1
- var A = Object.defineProperty;
2
- var E = (e, a, t) => a in e ? A(e, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[a] = t;
3
- var h = (e, a, t) => E(e, typeof a != "symbol" ? a + "" : a, t);
4
- import { j as r } from "../../../_virtual/jsx-runtime.js";
5
- /* empty css */
6
- import N from "../../../_virtual/index.js";
7
- import { useState as F, useCallback as O, useEffect as w } from "react";
8
- import S from "../../util/NumberUtil.js";
9
- import D from "../../util/ValidationUtil.js";
10
- import W from "../common/picker/ImagePicker.js";
11
- import x from "../../../node_modules/antd/es/form/index.js";
12
- import q from "../../../node_modules/antd/es/input/index.js";
13
- import z from "../../../node_modules/uuid/dist/esm-browser/v4.js";
14
- import B from "../../../node_modules/antd/es/avatar/index.js";
15
- import G from "../../../node_modules/antd/es/image/index.js";
16
- import H from "../../../node_modules/@ant-design/icons/es/icons/EyeOutlined.js";
17
- class J {
18
- }
19
- class re extends J {
20
- constructor(t = "", s = "") {
21
- super();
22
- h(this, "rootPath");
23
- h(this, "subPath");
24
- this.rootPath = t, this.subPath = s;
25
- }
26
- cloneFilePath(t) {
27
- const s = N.parse(t), l = `${s.name}_cloned_${S.randInt(1e5)}`;
28
- return N.format({
29
- dir: s.dir,
30
- ext: s.ext,
31
- name: l
32
- });
33
- }
34
- generateFileName(t) {
35
- return `${t.split(".")[0]}_${z().replace("-", "")}`;
36
- }
37
- }
38
- function le({
39
- name: e,
40
- label: a,
41
- required: t,
42
- provider: s,
43
- onUploading: l,
44
- aspectRatio: p,
45
- onRemoved: m,
46
- fieldClassName: d,
47
- hideLabel: V = !1,
48
- listType: C
49
- }) {
50
- const n = x.useFormInstance(), u = x.useWatch(e, n), [I, $] = F(!1), P = O(
51
- async (i, g) => {
52
- if (g) {
53
- l == null || l(!0);
54
- const o = i.name, c = o.split("."), y = c[c.length - 1], b = s.generateFileName(o), k = `${await s.getInitialPath()}/${b}.${y}`, _ = await s.upload(i, k);
55
- $(!0), l == null || l(!1), n.setFieldValue(e, _);
56
- } else {
57
- console.log(i);
58
- const o = n.getFieldsValue(), c = await s.delete(o[e]);
59
- m == null || m(), c && n.setFieldsValue({ [e]: null });
60
- }
61
- },
62
- [n, e, m, l, s]
63
- ), [f, j] = F();
64
- return w(() => {
65
- !I && u ? s.getRealUrl(u).then(j) : j(f);
66
- }, [u, I, s, f]), /* @__PURE__ */ r.jsx(r.Fragment, { children: /* @__PURE__ */ r.jsxs(
67
- x.Item,
68
- {
69
- rules: t ? D.required(a) : [],
70
- label: V ? null : a,
71
- required: t,
72
- name: e,
73
- children: [
74
- /* @__PURE__ */ r.jsx(
75
- W,
76
- {
77
- noStyle: !0,
78
- listType: C,
79
- aspectRatio: p,
80
- values: f,
81
- onRemove: (i) => {
82
- i && P(i, !1);
83
- },
84
- onAdd: async (i) => {
85
- i && await P(i, !0);
86
- },
87
- className: d
88
- }
89
- ),
90
- /* @__PURE__ */ r.jsx(q, { hidden: !0 })
91
- ]
92
- }
93
- ) });
94
- }
95
- const ie = ({ provider: e, value: a }) => {
96
- const [t, s] = F();
97
- return w(() => {
98
- a && e.getRealUrl(a).then(s);
99
- }, [e, a]), t ? /* @__PURE__ */ r.jsx(K, { url: t }) : /* @__PURE__ */ r.jsx(r.Fragment, {});
100
- }, K = ({ url: e }) => /* @__PURE__ */ r.jsx(B, { className: "p-0", children: /* @__PURE__ */ r.jsx(
101
- G,
102
- {
103
- className: "m-0 p-0 position-relative",
104
- src: e,
105
- preview: {
106
- mask: /* @__PURE__ */ r.jsx(H, {})
107
- }
108
- }
109
- ) });
110
- export {
111
- J as FileDownloadProvider,
112
- re as FileUploadProvider,
113
- K as ImageCellValue,
114
- ie as ImageCrudCellValue,
115
- le as default
116
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../../../_virtual/jsx-runtime.cjs"),s=require("react"),u=require("react-i18next"),i=require("../../../locale/hooks/translation-constants.cjs"),c=require("./CrudImportComponent.cjs"),a=require("../../common/button/Button.cjs"),l=require("../../../../node_modules/@ant-design/icons/es/icons/ImportOutlined.cjs");function p(r){const{t:n}=u.useTranslation(i.TRANSLATION_NAMESPACE),[o,e]=s.useState(!1);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(c.default,{open:o,onCloseMethod:e,...r}),t.jsxRuntimeExports.jsx(a.default,{icon:t.jsxRuntimeExports.jsx(l.default,{}),onClick:()=>e(!0),children:n("str.import")})]})}exports.default=p;
@@ -1,31 +0,0 @@
1
- import { j as o } from "../../../../_virtual/jsx-runtime.js";
2
- import { useState as e } from "react";
3
- import { useTranslation as p } from "react-i18next";
4
- import { TRANSLATION_NAMESPACE as s } from "../../../locale/hooks/translation-constants.js";
5
- import i from "./CrudImportComponent.js";
6
- import f from "../../common/button/Button.js";
7
- import u from "../../../../node_modules/@ant-design/icons/es/icons/ImportOutlined.js";
8
- function I(r) {
9
- const { t: n } = p(s), [m, t] = e(!1);
10
- return /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
11
- /* @__PURE__ */ o.jsx(
12
- i,
13
- {
14
- open: m,
15
- onCloseMethod: t,
16
- ...r
17
- }
18
- ),
19
- /* @__PURE__ */ o.jsx(
20
- f,
21
- {
22
- icon: /* @__PURE__ */ o.jsx(u, {}),
23
- onClick: () => t(!0),
24
- children: n("str.import")
25
- }
26
- )
27
- ] });
28
- }
29
- export {
30
- I as default
31
- };
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("../../../../_virtual/jsx-runtime.cjs"),B=require("../../../../_virtual/papaparse.min.cjs"),O=require("../../../../_virtual/FileSaver.min.cjs"),a=require("react"),$=require("react-i18next"),V=require("../../../locale/hooks/translation-constants.cjs"),L=require("../view/CrudViewer.cjs"),W=require("../../../util/DateUtil.cjs"),z=require("../../common/button/Button.cjs"),U=require("../../common/button/ImportButton.cjs"),N=require("../../../../node_modules/antd/es/tooltip/index.cjs"),S=require("../../../../node_modules/@ant-design/icons/es/icons/WarningTwoTone.cjs"),F=require("../../../../node_modules/antd/es/modal/index.cjs"),D=require("../../../../node_modules/antd/es/space/index.cjs"),G=require("../../../../node_modules/@ant-design/icons/es/icons/DownloadOutlined.cjs"),H=require("../../../../node_modules/antd/es/spin/index.cjs"),J=require("../../../../node_modules/antd/es/progress/progress.cjs");function K({onCloseMethod:j,open:b,fields:k,importProps:o}){const[c,R]=a.useState([]),[E,C]=a.useState(!1),[g,v]=a.useState(0);a.useEffect(()=>{b||(R([]),C(!1))},[b]);const f=a.useMemo(()=>new Map(k.filter(e=>{var t;return!e.hidden&&!((t=e.importProps)!=null&&t.hidden)&&!e.readonly}).map(e=>[e.name,e])),[k]),w=a.useMemo(()=>Array.from(f.values()).flatMap(e=>{var t;return[e.name,...((t=e.importProps)==null?void 0:t.extraFields)??[]]}),[f]),I=a.useCallback(async function(){const e=`${w.join(",")}
2
- `,t=new Blob([e],{type:"text/csv;charset=utf-8;"});O.FileSaver_minExports.saveAs(t,(o==null?void 0:o.name)+" - "+W.default.formatDateTimeWithSecond(new Date).replaceAll(":","-")+".csv")},[w,o==null?void 0:o.name]),{t:l}=$.useTranslation(V.TRANSLATION_NAMESPACE),M=a.useCallback(async e=>{const t=new FileReader;t.onerror=console.error,t.onload=async r=>{var n;const u=(n=r==null?void 0:r.target)==null?void 0:n.result,i=B.default.parse(u,{header:!0});R(i.data)},t.readAsText(e)},[]),h=a.useMemo(()=>{var t,r,u;let e=!1;for(const i of c)for(const[n,d]of f.entries()){const p=i[n],x=p||!isNaN(p);if(d.required&&!x)if((r=(t=d.importProps)==null?void 0:t.extraFields)!=null&&r.length)for(const y of((u=d.importProps)==null?void 0:u.extraFields)??[])if(i[y]||!isNaN(i[y])){e=!1;break}else return!0;else return!0}return e},[c,f]),m=a.useCallback(e=>(t,r)=>{var i,n,d;const u=t||!isNaN(t);if(e.required&&!u){let p=l("err.validation.required");if((n=(i=e.importProps)==null?void 0:i.extraFields)!=null&&n.length){const x=(d=e.importProps)==null?void 0:d.extraFields;(x==null?void 0:x.find(A=>!r[A]))&&(p="Either one of these fields is required: "+[e.name,...x].join(", "))}return s.jsxRuntimeExports.jsxs(N.default,{className:"d-flex",title:p,children:[s.jsxRuntimeExports.jsx(S.default,{twoToneColor:"#ee9702"}),t]})}return t},[l]),T=a.useCallback(async e=>{v(e)},[]),q=a.useCallback(async()=>{try{C(!0),await o.onClickImport(c,T),j(!1)}finally{C(!1),v(0)}},[c,o,j,T]),_=a.useCallback(async()=>{h?F.default.warn({title:l("str.warning"),content:l("qus.importWithIssues"),okText:l("str.import"),onOk:q,okCancel:!0,closable:!0}):q()},[h,q,l]);return s.jsxRuntimeExports.jsxs(F.default,{title:[l("str.import"),o==null?void 0:o.name].filter(Boolean).join(" "),width:"100%",open:b,onOk:_,destroyOnClose:!0,onCancel:()=>j(!1),okText:l("str.import"),confirmLoading:E,okButtonProps:{disabled:!(c!=null&&c.length)},footer:(e,{OkBtn:t,CancelBtn:r})=>s.jsxRuntimeExports.jsxs(D.default,{children:[s.jsxRuntimeExports.jsx(r,{}),s.jsxRuntimeExports.jsx(t,{}),h&&s.jsxRuntimeExports.jsx(N.default,{className:"d-flex",title:"Some fields have issue. Please review before submit.",children:s.jsxRuntimeExports.jsx(S.default,{twoToneColor:"#ee9702"})})]}),children:[s.jsxRuntimeExports.jsxs(D.default,{children:[s.jsxRuntimeExports.jsx(z.default,{onClick:I,icon:s.jsxRuntimeExports.jsx(G.default,{}),children:l("str.downloadCsvTemplate")}),s.jsxRuntimeExports.jsx(U.ImportButton,{disabled:E,type:"default",onClick:M,accept:".csv",children:l("str.importCsvFile")})]}),s.jsxRuntimeExports.jsx(H.default,{spinning:E,indicator:g?s.jsxRuntimeExports.jsx(J.default,{type:"circle",percent:g*100,size:50,format:e=>`${parseInt(e)}%`}):void 0,children:s.jsxRuntimeExports.jsx(L.default,{data:c,bordered:!0,size:"small",fields:Array.from(f.values()).flatMap(e=>{var t,r,u,i;return e.type==="text"?[{...e,label:e.name,render:m(e)},...((r=(t=e.importProps)==null?void 0:t.extraFields)==null?void 0:r.map(n=>({...e,name:n,label:n,render:m(e)})))??[]]:e.type==="select"?[{...e,label:e.name,type:"text",render:m(e)},...((i=(u=e.importProps)==null?void 0:u.extraFields)==null?void 0:i.map(n=>({...e,name:n,label:n,type:"text",render:m(e)})))??[]]:[{...e,label:e.name,render:m(e)}]})})})]})}exports.default=K;
@@ -1,226 +0,0 @@
1
- import { j as t } from "../../../../_virtual/jsx-runtime.js";
2
- import L from "../../../../_virtual/papaparse.min.js";
3
- import { F as _ } from "../../../../_virtual/FileSaver.min.js";
4
- import { useState as w, useEffect as $, useMemo as v, useCallback as d } from "react";
5
- import { useTranslation as z } from "react-i18next";
6
- import { TRANSLATION_NAMESPACE as W } from "../../../locale/hooks/translation-constants.js";
7
- import U from "../view/CrudViewer.js";
8
- import G from "../../../util/DateUtil.js";
9
- import H from "../../common/button/Button.js";
10
- import { ImportButton as J } from "../../common/button/ImportButton.js";
11
- import S from "../../../../node_modules/antd/es/tooltip/index.js";
12
- import q from "../../../../node_modules/@ant-design/icons/es/icons/WarningTwoTone.js";
13
- import B from "../../../../node_modules/antd/es/modal/index.js";
14
- import R from "../../../../node_modules/antd/es/space/index.js";
15
- import K from "../../../../node_modules/@ant-design/icons/es/icons/DownloadOutlined.js";
16
- import Q from "../../../../node_modules/antd/es/spin/index.js";
17
- import X from "../../../../node_modules/antd/es/progress/progress.js";
18
- function pe({
19
- onCloseMethod: h,
20
- open: y,
21
- fields: A,
22
- importProps: s
23
- }) {
24
- const [c, N] = w([]), [j, b] = w(!1), [T, E] = w(0);
25
- $(() => {
26
- y || (N([]), b(!1));
27
- }, [y]);
28
- const u = v(
29
- () => new Map(
30
- A.filter((e) => {
31
- var r;
32
- return !e.hidden && !((r = e.importProps) != null && r.hidden) && !e.readonly;
33
- }).map((e) => [e.name, e])
34
- ),
35
- [A]
36
- ), F = v(
37
- () => Array.from(u.values()).flatMap((e) => {
38
- var r;
39
- return [
40
- e.name,
41
- ...((r = e.importProps) == null ? void 0 : r.extraFields) ?? []
42
- ];
43
- }),
44
- [u]
45
- ), V = d(
46
- async function() {
47
- const e = `${F.join(",")}
48
- `, r = new Blob([e], { type: "text/csv;charset=utf-8;" });
49
- _.saveAs(
50
- r,
51
- (s == null ? void 0 : s.name) + " - " + G.formatDateTimeWithSecond(/* @__PURE__ */ new Date()).replaceAll(":", "-") + ".csv"
52
- );
53
- },
54
- [F, s == null ? void 0 : s.name]
55
- ), { t: i } = z(W), M = d(async (e) => {
56
- const r = new FileReader();
57
- r.onerror = console.error, r.onload = async (o) => {
58
- var n;
59
- const l = (n = o == null ? void 0 : o.target) == null ? void 0 : n.result, a = L.parse(l, { header: !0 });
60
- N(a.data);
61
- }, r.readAsText(e);
62
- }, []), C = v(() => {
63
- var r, o, l;
64
- let e = !1;
65
- for (const a of c)
66
- for (const [n, m] of u.entries()) {
67
- const x = a[n], f = x || !isNaN(x);
68
- if (m.required && !f)
69
- if ((o = (r = m.importProps) == null ? void 0 : r.extraFields) != null && o.length)
70
- for (const g of ((l = m.importProps) == null ? void 0 : l.extraFields) ?? [])
71
- if (a[g] || !isNaN(a[g])) {
72
- e = !1;
73
- break;
74
- } else return !0;
75
- else return !0;
76
- }
77
- return e;
78
- }, [c, u]), p = d(
79
- (e) => (r, o) => {
80
- var a, n, m;
81
- const l = r || !isNaN(r);
82
- if (e.required && !l) {
83
- let x = i("err.validation.required");
84
- if ((n = (a = e.importProps) == null ? void 0 : a.extraFields) != null && n.length) {
85
- const f = (m = e.importProps) == null ? void 0 : m.extraFields;
86
- (f == null ? void 0 : f.find((D) => !o[D])) && (x = "Either one of these fields is required: " + [e.name, ...f].join(", "));
87
- }
88
- return /* @__PURE__ */ t.jsxs(S, { className: "d-flex", title: x, children: [
89
- /* @__PURE__ */ t.jsx(q, { twoToneColor: "#ee9702" }),
90
- r
91
- ] });
92
- }
93
- return r;
94
- },
95
- [i]
96
- ), I = d(async (e) => {
97
- E(e);
98
- }, []), k = d(async () => {
99
- try {
100
- b(!0), await s.onClickImport(c, I), h(!1);
101
- } finally {
102
- b(!1), E(0);
103
- }
104
- }, [c, s, h, I]), O = d(async () => {
105
- C ? B.warn({
106
- title: i("str.warning"),
107
- content: i("qus.importWithIssues"),
108
- okText: i("str.import"),
109
- onOk: k,
110
- okCancel: !0,
111
- closable: !0
112
- }) : k();
113
- }, [C, k, i]);
114
- return /* @__PURE__ */ t.jsxs(
115
- B,
116
- {
117
- title: [i("str.import"), s == null ? void 0 : s.name].filter(Boolean).join(" "),
118
- width: "100%",
119
- open: y,
120
- onOk: O,
121
- destroyOnClose: !0,
122
- onCancel: () => h(!1),
123
- okText: i("str.import"),
124
- confirmLoading: j,
125
- okButtonProps: {
126
- disabled: !(c != null && c.length)
127
- },
128
- footer: (e, { OkBtn: r, CancelBtn: o }) => /* @__PURE__ */ t.jsxs(R, { children: [
129
- /* @__PURE__ */ t.jsx(o, {}),
130
- /* @__PURE__ */ t.jsx(r, {}),
131
- C && /* @__PURE__ */ t.jsx(
132
- S,
133
- {
134
- className: "d-flex",
135
- title: "Some fields have issue. Please review before submit.",
136
- children: /* @__PURE__ */ t.jsx(q, { twoToneColor: "#ee9702" })
137
- }
138
- )
139
- ] }),
140
- children: [
141
- /* @__PURE__ */ t.jsxs(R, { children: [
142
- /* @__PURE__ */ t.jsx(
143
- H,
144
- {
145
- onClick: V,
146
- icon: /* @__PURE__ */ t.jsx(K, {}),
147
- children: i("str.downloadCsvTemplate")
148
- }
149
- ),
150
- /* @__PURE__ */ t.jsx(
151
- J,
152
- {
153
- disabled: j,
154
- type: "default",
155
- onClick: M,
156
- accept: ".csv",
157
- children: i("str.importCsvFile")
158
- }
159
- )
160
- ] }),
161
- /* @__PURE__ */ t.jsx(
162
- Q,
163
- {
164
- spinning: j,
165
- indicator: T ? /* @__PURE__ */ t.jsx(
166
- X,
167
- {
168
- type: "circle",
169
- percent: T * 100,
170
- size: 50,
171
- format: (e) => `${parseInt(e)}%`
172
- }
173
- ) : void 0,
174
- children: /* @__PURE__ */ t.jsx(
175
- U,
176
- {
177
- data: c,
178
- bordered: !0,
179
- size: "small",
180
- fields: Array.from(u.values()).flatMap((e) => {
181
- var r, o, l, a;
182
- return e.type === "text" ? [
183
- {
184
- ...e,
185
- label: e.name,
186
- render: p(e)
187
- },
188
- ...((o = (r = e.importProps) == null ? void 0 : r.extraFields) == null ? void 0 : o.map((n) => ({
189
- ...e,
190
- name: n,
191
- label: n,
192
- render: p(e)
193
- }))) ?? []
194
- ] : e.type === "select" ? [
195
- {
196
- ...e,
197
- label: e.name,
198
- type: "text",
199
- render: p(e)
200
- },
201
- ...((a = (l = e.importProps) == null ? void 0 : l.extraFields) == null ? void 0 : a.map((n) => ({
202
- ...e,
203
- name: n,
204
- label: n,
205
- type: "text",
206
- render: p(e)
207
- }))) ?? []
208
- ] : [
209
- {
210
- ...e,
211
- label: e.name,
212
- render: p(e)
213
- }
214
- ];
215
- })
216
- }
217
- )
218
- }
219
- )
220
- ]
221
- }
222
- );
223
- }
224
- export {
225
- pe as default
226
- };
@@ -1 +0,0 @@
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"),f=require("react-i18next"),g=require("../../../locale/hooks/translation-constants.cjs"),p=require("./CrudViewerUtil.cjs");function q({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}=f.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.default,{keepEmptyValues:x,bordered:!0,column:c,className:l,layout:m,list:j}):n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{})}exports.CrudDecListView=q;
@@ -1,42 +0,0 @@
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 { useTranslation as g } from "react-i18next";
5
- import { TRANSLATION_NAMESPACE as j } from "../../../locale/hooks/translation-constants.js";
6
- import { getRendererValueCrudViewer as A } from "./CrudViewerUtil.js";
7
- function V({
8
- className: u,
9
- fields: s,
10
- data: r,
11
- descListColumn: l = { xs: 1, md: 3, sm: 2, lg: 4 },
12
- layout: f,
13
- action: o,
14
- keepEmptyValues: p
15
- }) {
16
- const { t: i } = g(j), c = b(() => {
17
- const n = s.filter(({ hidden: e, hideInDescList: t }) => !e && !t).map((e, t) => ({
18
- label: e.label,
19
- noFormatting: !0,
20
- value: A(e)(
21
- r == null ? void 0 : r[e.name],
22
- r,
23
- t
24
- )
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,
30
- {
31
- keepEmptyValues: p,
32
- bordered: !0,
33
- column: l,
34
- className: u,
35
- layout: f,
36
- list: c
37
- }
38
- ) : /* @__PURE__ */ m.jsx(m.Fragment, {});
39
- }
40
- export {
41
- V as CrudDecListView
42
- };