@kingteza/crud-component 1.0.4 → 1.0.6

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 (322) hide show
  1. package/dist/App.d.ts +2 -0
  2. package/dist/_virtual/_commonjsHelpers.cjs +1 -0
  3. package/dist/_virtual/_commonjsHelpers.js +6 -1
  4. package/dist/_virtual/advancedFormat.cjs +1 -0
  5. package/dist/_virtual/advancedFormat.js +7 -1
  6. package/dist/_virtual/advancedFormat2.js +4 -1
  7. package/dist/_virtual/customParseFormat.cjs +1 -0
  8. package/dist/_virtual/customParseFormat.js +7 -1
  9. package/dist/_virtual/customParseFormat2.js +4 -1
  10. package/dist/_virtual/dayjs.min.cjs +1 -0
  11. package/dist/_virtual/dayjs.min.js +7 -1
  12. package/dist/_virtual/dayjs.min2.js +4 -1
  13. package/dist/_virtual/index.cjs +1 -0
  14. package/dist/_virtual/index.js +7 -1
  15. package/dist/_virtual/index2.cjs +1 -0
  16. package/dist/_virtual/index2.js +7 -1
  17. package/dist/_virtual/index3.cjs +1 -0
  18. package/dist/_virtual/index3.js +4 -1
  19. package/dist/_virtual/index4.js +4 -1
  20. package/dist/_virtual/index5.cjs +1 -0
  21. package/dist/_virtual/index5.js +4 -1
  22. package/dist/_virtual/jsx-runtime.cjs +1 -0
  23. package/dist/_virtual/jsx-runtime.js +5 -1
  24. package/dist/_virtual/jsx-runtime2.cjs +1 -0
  25. package/dist/_virtual/jsx-runtime2.js +4 -1
  26. package/dist/_virtual/localeData.cjs +1 -0
  27. package/dist/_virtual/localeData.js +7 -1
  28. package/dist/_virtual/localeData2.cjs +1 -0
  29. package/dist/_virtual/localeData2.js +4 -1
  30. package/dist/_virtual/react-is.development.js +4 -1
  31. package/dist/_virtual/react-is.production.min.js +4 -1
  32. package/dist/_virtual/react-jsx-runtime.development.js +4 -1
  33. package/dist/_virtual/react-jsx-runtime.production.min.cjs +1 -0
  34. package/dist/_virtual/react-jsx-runtime.production.min.js +4 -1
  35. package/dist/_virtual/weekOfYear.cjs +1 -0
  36. package/dist/_virtual/weekOfYear.js +7 -1
  37. package/dist/_virtual/weekOfYear2.cjs +1 -0
  38. package/dist/_virtual/weekOfYear2.js +4 -1
  39. package/dist/_virtual/weekYear.cjs +1 -0
  40. package/dist/_virtual/weekYear.js +7 -1
  41. package/dist/_virtual/weekYear2.cjs +1 -0
  42. package/dist/_virtual/weekYear2.js +4 -1
  43. package/dist/_virtual/weekday.cjs +1 -0
  44. package/dist/_virtual/weekday.js +7 -1
  45. package/dist/_virtual/weekday2.cjs +1 -0
  46. package/dist/_virtual/weekday2.js +4 -1
  47. package/dist/common/index.cjs +1 -0
  48. package/dist/common/index.js +75 -1
  49. package/dist/components/common/DatePicker/DatePicker.d.ts +37 -0
  50. package/dist/components/common/DatePicker/TimePicker.d.ts +34 -0
  51. package/dist/components/common/DatePicker/index.d.ts +3 -0
  52. package/dist/components/common/appearance/Hider.d.ts +6 -0
  53. package/dist/components/common/appearance/index.d.ts +0 -0
  54. package/dist/components/common/button/Button.d.ts +12 -0
  55. package/dist/components/common/button/CloneButtonTable.d.ts +6 -0
  56. package/dist/components/common/button/DeleteButtonTable.d.ts +13 -0
  57. package/dist/components/common/button/ExportButton.d.ts +4 -0
  58. package/dist/components/common/button/HideButtonTable.d.ts +13 -0
  59. package/dist/components/common/button/ImportButton.d.ts +9 -0
  60. package/dist/components/common/button/NewButton.d.ts +12 -0
  61. package/dist/components/common/button/PrintButton.d.ts +12 -0
  62. package/dist/components/common/button/RefreshButton.d.ts +11 -0
  63. package/dist/components/common/button/UnHideButton.d.ts +14 -0
  64. package/dist/components/common/button/UpdateButtonTable.d.ts +6 -0
  65. package/dist/components/common/button/ViewButtonTable.d.ts +6 -0
  66. package/dist/components/common/button/index.d.ts +14 -0
  67. package/dist/components/common/check-box/CheckBox.d.ts +9 -0
  68. package/dist/components/common/check-box/index.d.ts +2 -0
  69. package/dist/components/common/description/DescList.d.ts +18 -0
  70. package/dist/components/common/description/DescriptionComponent.d.ts +7 -0
  71. package/dist/components/common/description/index.d.ts +3 -0
  72. package/dist/components/common/index.d.ts +22 -0
  73. package/dist/components/common/layout/VerticalSpace.d.ts +5 -0
  74. package/dist/components/common/layout/index.d.ts +2 -0
  75. package/dist/components/common/loading/LoadingIndicator.d.ts +6 -0
  76. package/dist/components/common/loading/index.d.ts +2 -0
  77. package/dist/components/common/picker/ImagePicker.d.ts +56 -0
  78. package/dist/components/common/picker/index.d.ts +2 -0
  79. package/dist/components/common/radio/RadioGroupComponent.d.ts +18 -0
  80. package/dist/components/common/radio/index.d.ts +2 -0
  81. package/dist/components/common/report/SelectFieldInReport.d.ts +16 -0
  82. package/dist/components/common/report/index.d.ts +3 -0
  83. package/dist/components/common/select/CustomSelectOption.d.ts +7 -0
  84. package/dist/components/common/select/SelectComponent.d.ts +21 -0
  85. package/dist/components/common/select/index.d.ts +3 -0
  86. package/dist/components/common/show-more/index.d.ts +4 -0
  87. package/dist/components/common/tab/TabViewWithRoute.d.ts +13 -0
  88. package/dist/components/common/tab/index.d.ts +2 -0
  89. package/dist/components/common/table/index.d.ts +3 -0
  90. package/dist/components/common/table/table.d.ts +19 -0
  91. package/dist/components/common/tag/StatusTag.d.ts +14 -0
  92. package/dist/components/common/tag/index.d.ts +2 -0
  93. package/dist/components/common/text/index.d.ts +3 -0
  94. package/dist/components/common/text/title/TitleWithHeadTitle.d.ts +7 -0
  95. package/dist/components/common/text/title/index.d.ts +1 -0
  96. package/dist/components/common/text-field/NumberField.d.ts +13 -0
  97. package/dist/components/common/text-field/PhoneNumberField.d.ts +4 -0
  98. package/dist/components/common/text-field/TextArea.d.ts +17 -0
  99. package/dist/components/common/text-field/TextField.d.ts +27 -0
  100. package/dist/components/common/text-field/index.d.ts +5 -0
  101. package/dist/components/common/tooltip/TooltipComponent.d.ts +5 -0
  102. package/dist/components/common/tooltip/index.d.ts +2 -0
  103. package/dist/components/common/wizard/WizardResult.d.ts +16 -0
  104. package/dist/components/common/wizard/WizardViewForm.d.ts +24 -0
  105. package/dist/components/common/wizard/index.d.ts +3 -0
  106. package/dist/components/crud/CrudComponent.d.ts +237 -0
  107. package/dist/components/crud/CrudField.d.ts +4 -0
  108. package/dist/components/crud/CrudForm.d.ts +14 -0
  109. package/dist/components/crud/CrudFormWizard.d.ts +14 -0
  110. package/dist/components/crud/CrudReportComponent.d.ts +44 -0
  111. package/dist/components/crud/CrudSearchComponent.d.ts +21 -0
  112. package/dist/components/crud/FileCrudField.d.ts +25 -0
  113. package/dist/components/crud/ImageCrudField.d.ts +38 -0
  114. package/dist/components/crud/import/CrudImportButton.d.ts +3 -0
  115. package/dist/components/crud/import/CrudImportComponent.d.ts +14 -0
  116. package/dist/components/crud/index.d.ts +15 -0
  117. package/dist/components/crud/view/CrudDecListView.d.ts +14 -0
  118. package/dist/components/crud/view/CrudViewer.d.ts +43 -0
  119. package/dist/components/crud/view/CrudViewerUtil.d.ts +2 -0
  120. package/dist/components/crud/view/index.d.ts +5 -0
  121. package/dist/context/WindowDimension.d.ts +4 -0
  122. package/dist/index.cjs +1 -0
  123. package/dist/index.d.ts +4 -63
  124. package/dist/index.js +32 -1
  125. package/dist/locale/hooks/translation-constants.d.ts +1 -0
  126. package/dist/locale/index.d.ts +69 -0
  127. package/dist/locale/translations/en.d.ts +58 -0
  128. package/dist/main.d.ts +0 -0
  129. package/dist/src/components/common/DatePicker/DatePicker.cjs +1 -0
  130. package/dist/src/components/common/DatePicker/DatePicker.js +88 -0
  131. package/dist/src/components/common/DatePicker/TimePicker.cjs +1 -0
  132. package/dist/src/components/common/DatePicker/TimePicker.js +78 -0
  133. package/dist/src/components/common/appearance/Hider.cjs +1 -0
  134. package/dist/src/components/common/appearance/Hider.js +5 -0
  135. package/dist/src/components/common/button/Button.cjs +1 -0
  136. package/dist/src/components/common/button/Button.js +64 -0
  137. package/dist/src/components/common/button/CloneButtonTable.cjs +1 -0
  138. package/dist/src/components/common/button/CloneButtonTable.js +20 -0
  139. package/dist/src/components/common/button/DeleteButtonTable.cjs +1 -0
  140. package/dist/src/components/common/button/DeleteButtonTable.js +68 -0
  141. package/dist/src/components/common/button/ExportButton.cjs +1 -0
  142. package/dist/src/components/common/button/ExportButton.js +27 -0
  143. package/dist/src/components/common/button/HideButtonTable.cjs +1 -0
  144. package/dist/src/components/common/button/HideButtonTable.js +68 -0
  145. package/dist/src/components/common/button/ImportButton.cjs +1 -0
  146. package/dist/src/components/common/button/ImportButton.js +56 -0
  147. package/dist/src/components/common/button/NewButton.cjs +1 -0
  148. package/dist/src/components/common/button/NewButton.js +24 -0
  149. package/dist/src/components/common/button/PrintButton.cjs +1 -0
  150. package/dist/src/components/common/button/PrintButton.js +26 -0
  151. package/dist/src/components/common/button/RefreshButton.cjs +1 -0
  152. package/dist/src/components/common/button/RefreshButton.js +24 -0
  153. package/dist/src/components/common/button/UnHideButton.cjs +1 -0
  154. package/dist/src/components/common/button/UnHideButton.js +70 -0
  155. package/dist/src/components/common/button/UpdateButtonTable.cjs +1 -0
  156. package/dist/src/components/common/button/UpdateButtonTable.js +20 -0
  157. package/dist/src/components/common/button/ViewButtonTable.cjs +1 -0
  158. package/dist/src/components/common/button/ViewButtonTable.js +20 -0
  159. package/dist/src/components/common/check-box/CheckBox.cjs +1 -0
  160. package/dist/src/components/common/check-box/CheckBox.js +40 -0
  161. package/dist/src/components/common/description/DescList.cjs +1 -0
  162. package/dist/src/components/common/description/DescList.js +16 -0
  163. package/dist/src/components/common/layout/VerticalSpace.cjs +1 -0
  164. package/dist/src/components/common/layout/VerticalSpace.js +6 -0
  165. package/dist/src/components/common/loading/LoadingIndicator.cjs +1 -0
  166. package/dist/src/components/common/loading/LoadingIndicator.js +24 -0
  167. package/dist/src/components/common/picker/ImagePicker.cjs +1 -0
  168. package/dist/src/components/common/picker/ImagePicker.js +282 -0
  169. package/dist/src/components/common/radio/RadioGroupComponent.cjs +1 -0
  170. package/dist/src/components/common/radio/RadioGroupComponent.js +19 -0
  171. package/dist/src/components/common/report/SelectFieldInReport.cjs +1 -0
  172. package/dist/src/components/common/report/SelectFieldInReport.js +30 -0
  173. package/dist/src/components/common/select/CustomSelectOption.cjs +1 -0
  174. package/dist/src/components/common/select/CustomSelectOption.js +13 -0
  175. package/dist/src/components/common/select/SelectComponent.cjs +1 -0
  176. package/dist/src/components/common/select/SelectComponent.js +89 -0
  177. package/dist/src/components/common/show-more/index.cjs +1 -0
  178. package/dist/src/components/common/show-more/index.js +8 -0
  179. package/dist/src/components/common/tab/TabViewWithRoute.cjs +1 -0
  180. package/dist/src/components/common/tab/TabViewWithRoute.js +38 -0
  181. package/dist/src/components/common/table/table.cjs +1 -0
  182. package/dist/src/components/common/table/table.js +40 -0
  183. package/dist/src/components/common/tag/StatusTag.cjs +1 -0
  184. package/dist/src/components/common/tag/StatusTag.js +30 -0
  185. package/dist/src/components/common/text/index.js +5 -0
  186. package/dist/src/components/common/text/title/index.js +5 -0
  187. package/dist/src/components/common/text-field/NumberField.cjs +1 -0
  188. package/dist/src/components/common/text-field/NumberField.js +83 -0
  189. package/dist/src/components/common/text-field/PhoneNumberField.cjs +1 -0
  190. package/dist/src/components/common/text-field/PhoneNumberField.js +18 -0
  191. package/dist/src/components/common/text-field/TextArea.cjs +1 -0
  192. package/dist/src/components/common/text-field/TextArea.js +47 -0
  193. package/dist/src/components/common/text-field/TextField.cjs +1 -0
  194. package/dist/src/components/common/text-field/TextField.js +73 -0
  195. package/dist/src/components/common/tooltip/TooltipComponent.cjs +1 -0
  196. package/dist/src/components/common/tooltip/TooltipComponent.js +9 -0
  197. package/dist/src/components/common/wizard/WizardResult.cjs +1 -0
  198. package/dist/src/components/common/wizard/WizardResult.js +60 -0
  199. package/dist/src/components/common/wizard/WizardViewForm.cjs +1 -0
  200. package/dist/src/components/common/wizard/WizardViewForm.js +74 -0
  201. package/dist/src/components/crud/CrudComponent.cjs +1 -0
  202. package/dist/src/components/crud/CrudComponent.js +210 -0
  203. package/dist/src/components/crud/CrudField.cjs +1 -0
  204. package/dist/src/components/crud/CrudField.js +459 -0
  205. package/dist/src/components/crud/CrudForm.cjs +1 -0
  206. package/dist/src/components/crud/CrudForm.js +91 -0
  207. package/dist/src/components/crud/CrudFormWizard.cjs +1 -0
  208. package/dist/src/components/crud/CrudFormWizard.js +140 -0
  209. package/dist/src/components/crud/CrudReportComponent.cjs +4 -0
  210. package/dist/src/components/crud/CrudReportComponent.js +255 -0
  211. package/dist/src/components/crud/CrudSearchComponent.cjs +1 -0
  212. package/dist/src/components/crud/CrudSearchComponent.js +95 -0
  213. package/dist/src/components/crud/FileCrudField.cjs +1 -0
  214. package/dist/src/components/crud/FileCrudField.js +220 -0
  215. package/dist/src/components/crud/ImageCrudField.cjs +1 -0
  216. package/dist/src/components/crud/ImageCrudField.js +113 -0
  217. package/dist/src/components/crud/import/CrudImportButton.cjs +1 -0
  218. package/dist/src/components/crud/import/CrudImportButton.js +31 -0
  219. package/dist/src/components/crud/import/CrudImportComponent.cjs +2 -0
  220. package/dist/src/components/crud/import/CrudImportComponent.js +221 -0
  221. package/dist/src/components/crud/view/CrudDecListView.cjs +1 -0
  222. package/dist/src/components/crud/view/CrudDecListView.js +42 -0
  223. package/dist/src/components/crud/view/CrudViewer.cjs +1 -0
  224. package/dist/src/components/crud/view/CrudViewer.js +217 -0
  225. package/dist/src/components/crud/view/CrudViewerUtil.cjs +1 -0
  226. package/dist/src/components/crud/view/CrudViewerUtil.js +57 -0
  227. package/dist/src/context/WindowDimension.cjs +1 -0
  228. package/dist/src/context/WindowDimension.js +8 -0
  229. package/dist/src/locale/hooks/translation-constants.js +4 -0
  230. package/dist/src/locale/index.cjs +1 -0
  231. package/dist/src/locale/index.js +33 -0
  232. package/dist/src/locale/translations/en.cjs +1 -0
  233. package/dist/src/locale/translations/en.js +60 -0
  234. package/dist/src/util/DateUtil.cjs +1 -0
  235. package/dist/src/util/DateUtil.js +6 -0
  236. package/dist/src/util/ImageUtil.cjs +1 -0
  237. package/dist/src/util/ImageUtil.js +63 -0
  238. package/dist/src/util/NumberUtil.js +60 -0
  239. package/dist/src/util/ValidationUtil.cjs +1 -0
  240. package/dist/src/util/ValidationUtil.js +60 -0
  241. package/dist/types/DialogComponentProp.d.ts +8 -0
  242. package/dist/types/Id.d.ts +10 -0
  243. package/dist/util/DateUtil.d.ts +7 -0
  244. package/dist/util/ImageUtil.d.ts +14 -0
  245. package/dist/util/NumberUtil.d.ts +17 -0
  246. package/dist/util/ValidationUtil.d.ts +14 -0
  247. package/dist/util/index.cjs +1 -0
  248. package/dist/util/index.js +10 -1
  249. package/dist/vite-env.d.ts +1 -0
  250. package/package.json +1 -1
  251. package/dist/_virtual/FileSaver.min.js +0 -1
  252. package/dist/_virtual/ShowMoreText.js +0 -1
  253. package/dist/_virtual/index6.js +0 -1
  254. package/dist/_virtual/index7.js +0 -1
  255. package/dist/_virtual/index8.js +0 -1
  256. package/dist/_virtual/main.js +0 -1
  257. package/dist/_virtual/papaparse.min.js +0 -1
  258. package/dist/components/common/DatePicker/DatePicker.js +0 -1
  259. package/dist/components/common/DatePicker/TimePicker.js +0 -1
  260. package/dist/components/common/appearance/Hider.js +0 -1
  261. package/dist/components/common/button/Button.js +0 -1
  262. package/dist/components/common/button/CloneButtonTable.js +0 -1
  263. package/dist/components/common/button/DeleteButtonTable.js +0 -1
  264. package/dist/components/common/button/ExportButton.js +0 -1
  265. package/dist/components/common/button/HideButtonTable.js +0 -1
  266. package/dist/components/common/button/ImportButton.js +0 -1
  267. package/dist/components/common/button/NewButton.js +0 -1
  268. package/dist/components/common/button/PrintButton.js +0 -1
  269. package/dist/components/common/button/RefreshButton.js +0 -1
  270. package/dist/components/common/button/UnHideButton.js +0 -1
  271. package/dist/components/common/button/UpdateButtonTable.js +0 -1
  272. package/dist/components/common/button/ViewButtonTable.js +0 -1
  273. package/dist/components/common/check-box/CheckBox.js +0 -1
  274. package/dist/components/common/description/DescList.js +0 -1
  275. package/dist/components/common/layout/VerticalSpace.js +0 -1
  276. package/dist/components/common/loading/LoadingIndicator.js +0 -1
  277. package/dist/components/common/picker/ImagePicker.js +0 -1
  278. package/dist/components/common/radio/RadioGroupComponent.js +0 -1
  279. package/dist/components/common/report/SelectFieldInReport.js +0 -1
  280. package/dist/components/common/select/CustomSelectOption.js +0 -1
  281. package/dist/components/common/select/SelectComponent.js +0 -1
  282. package/dist/components/common/show-more/index.js +0 -1
  283. package/dist/components/common/tab/TabViewWithRoute.js +0 -1
  284. package/dist/components/common/table/table.js +0 -1
  285. package/dist/components/common/tag/StatusTag.js +0 -1
  286. package/dist/components/common/text-field/NumberField.js +0 -1
  287. package/dist/components/common/text-field/PhoneNumberField.js +0 -1
  288. package/dist/components/common/text-field/TextArea.js +0 -1
  289. package/dist/components/common/text-field/TextField.js +0 -1
  290. package/dist/components/common/tooltip/TooltipComponent.js +0 -1
  291. package/dist/components/common/wizard/WizardResult.js +0 -1
  292. package/dist/components/common/wizard/WizardViewForm.js +0 -1
  293. package/dist/components/crud/CrudComponent.js +0 -1
  294. package/dist/components/crud/CrudField.js +0 -1
  295. package/dist/components/crud/CrudForm.js +0 -1
  296. package/dist/components/crud/CrudFormWizard.js +0 -1
  297. package/dist/components/crud/CrudReportComponent.js +0 -4
  298. package/dist/components/crud/CrudSearchComponent.js +0 -1
  299. package/dist/components/crud/FileCrudField.js +0 -1
  300. package/dist/components/crud/ImageCrudField.js +0 -1
  301. package/dist/components/crud/import/CrudImportButton.js +0 -1
  302. package/dist/components/crud/import/CrudImportComponent.js +0 -2
  303. package/dist/components/crud/view/CrudDecListView.js +0 -1
  304. package/dist/components/crud/view/CrudViewer.js +0 -1
  305. package/dist/components/crud/view/CrudViewerUtil.js +0 -1
  306. package/dist/context/WindowDimension.js +0 -1
  307. package/dist/locale/index.js +0 -1
  308. package/dist/locale/translations/en.js +0 -1
  309. package/dist/util/DateUtil.js +0 -1
  310. package/dist/util/ImageUtil.js +0 -1
  311. package/dist/util/ValidationUtil.js +0 -1
  312. /package/dist/_virtual/{FileSaver.min2.js → advancedFormat2.cjs} +0 -0
  313. /package/dist/_virtual/{main2.js → customParseFormat2.cjs} +0 -0
  314. /package/dist/_virtual/{papaparse.min2.js → dayjs.min2.cjs} +0 -0
  315. /package/dist/_virtual/{ShowMoreText2.js → index4.cjs} +0 -0
  316. /package/dist/_virtual/{Truncate.js → react-is.development.cjs} +0 -0
  317. /package/dist/_virtual/{index10.js → react-is.production.min.cjs} +0 -0
  318. /package/dist/_virtual/{index9.js → react-jsx-runtime.development.cjs} +0 -0
  319. /package/dist/{components/common/text/index.js → src/components/common/text/index.cjs} +0 -0
  320. /package/dist/{components/common/text/title/index.js → src/components/common/text/title/index.cjs} +0 -0
  321. /package/dist/{locale/hooks/translation-constants.js → src/locale/hooks/translation-constants.cjs} +0 -0
  322. /package/dist/{util/NumberUtil.js → src/util/NumberUtil.cjs} +0 -0
@@ -0,0 +1,113 @@
1
+ var O = Object.defineProperty;
2
+ var _ = (e, a, t) => a in e ? O(e, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[a] = t;
3
+ var h = (e, a, t) => _(e, typeof a != "symbol" ? a + "" : a, t);
4
+ import { j as l } from "../../../_virtual/jsx-runtime.js";
5
+ /* empty css */
6
+ import { EyeOutlined as A } from "@ant-design/icons";
7
+ import { Form as x, Input as S, Avatar as D, Image as W } from "antd";
8
+ import N from "path-browserify";
9
+ import { useState as F, useCallback as q, useEffect as d } from "react";
10
+ import z from "../../util/NumberUtil.js";
11
+ import B from "../../util/ValidationUtil.js";
12
+ import { v4 as G } from "uuid";
13
+ import H from "../common/picker/ImagePicker.js";
14
+ class J {
15
+ }
16
+ class te extends J {
17
+ constructor(t = "", s = "") {
18
+ super();
19
+ h(this, "rootPath");
20
+ h(this, "subPath");
21
+ this.rootPath = t, this.subPath = s;
22
+ }
23
+ cloneFilePath(t) {
24
+ const s = N.parse(t), r = `${s.name}_cloned_${z.randInt(1e5)}`;
25
+ return N.format({
26
+ dir: s.dir,
27
+ ext: s.ext,
28
+ name: r
29
+ });
30
+ }
31
+ generateFileName(t) {
32
+ return `${t.split(".")[0]}_${G().replace("-", "")}`;
33
+ }
34
+ }
35
+ function se({
36
+ name: e,
37
+ label: a,
38
+ required: t,
39
+ provider: s,
40
+ onUploading: r,
41
+ aspectRatio: P,
42
+ onRemoved: c,
43
+ fieldClassName: w,
44
+ hideLabel: V = !1,
45
+ listType: y
46
+ }) {
47
+ const i = x.useFormInstance(), u = x.useWatch(e, i), [p, C] = F(!1), I = q(
48
+ async (n, $) => {
49
+ if ($) {
50
+ r == null || r(!0);
51
+ const m = n.name, o = m.split("."), g = o[o.length - 1], b = s.generateFileName(m), k = `${await s.getInitialPath()}/${b}.${g}`, E = await s.upload(n, k);
52
+ C(!0), r == null || r(!1), i.setFieldValue(e, E);
53
+ } else {
54
+ console.log(n);
55
+ const m = i.getFieldsValue(), o = await s.delete(m[e]);
56
+ c == null || c(), o && i.setFieldsValue({ [e]: null });
57
+ }
58
+ },
59
+ [i, e, c, r, s]
60
+ ), [f, j] = F();
61
+ return d(() => {
62
+ !p && u ? s.getRealUrl(u).then(j) : j(f);
63
+ }, [u, p, s, f]), /* @__PURE__ */ l.jsx(l.Fragment, { children: /* @__PURE__ */ l.jsxs(
64
+ x.Item,
65
+ {
66
+ rules: t ? B.required(a) : [],
67
+ label: V ? null : a,
68
+ required: t,
69
+ name: e,
70
+ children: [
71
+ /* @__PURE__ */ l.jsx(
72
+ H,
73
+ {
74
+ noStyle: !0,
75
+ listType: y,
76
+ aspectRatio: P,
77
+ values: f,
78
+ onRemove: (n) => {
79
+ n && I(n, !1);
80
+ },
81
+ onAdd: async (n) => {
82
+ n && await I(n, !0);
83
+ },
84
+ className: w
85
+ }
86
+ ),
87
+ /* @__PURE__ */ l.jsx(S, { hidden: !0 })
88
+ ]
89
+ }
90
+ ) });
91
+ }
92
+ const ae = ({ provider: e, value: a }) => {
93
+ const [t, s] = F();
94
+ return d(() => {
95
+ a && e.getRealUrl(a).then(s);
96
+ }, [e, a]), t ? /* @__PURE__ */ l.jsx(K, { url: t }) : /* @__PURE__ */ l.jsx(l.Fragment, {});
97
+ }, K = ({ url: e }) => /* @__PURE__ */ l.jsx(D, { className: "p-0", children: /* @__PURE__ */ l.jsx(
98
+ W,
99
+ {
100
+ className: "m-0 p-0 position-relative",
101
+ src: e,
102
+ preview: {
103
+ mask: /* @__PURE__ */ l.jsx(A, {})
104
+ }
105
+ }
106
+ ) });
107
+ export {
108
+ J as FileDownloadProvider,
109
+ te as FileUploadProvider,
110
+ K as ImageCellValue,
111
+ ae as ImageCrudCellValue,
112
+ se as default
113
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../../../_virtual/jsx-runtime.cjs"),s=require("@ant-design/icons"),u=require("react"),i=require("react-i18next"),c=require("../../../locale/hooks/translation-constants.cjs"),a=require("./CrudImportComponent.cjs"),l=require("../../common/button/Button.cjs");function p(n){const{t:r}=i.useTranslation(c.TRANSLATION_NAMESPACE),[o,e]=u.useState(!1);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(a.default,{open:o,onCloseMethod:e,...n}),t.jsxRuntimeExports.jsx(l.default,{icon:t.jsxRuntimeExports.jsx(s.ImportOutlined,{}),onClick:()=>e(!0),children:r("str.import")})]})}exports.default=p;
@@ -0,0 +1,31 @@
1
+ import { j as o } from "../../../../_virtual/jsx-runtime.js";
2
+ import { ImportOutlined as e } from "@ant-design/icons";
3
+ import { useState as p } from "react";
4
+ import { useTranslation as s } from "react-i18next";
5
+ import { TRANSLATION_NAMESPACE as i } from "../../../locale/hooks/translation-constants.js";
6
+ import u from "./CrudImportComponent.js";
7
+ import f from "../../common/button/Button.js";
8
+ function I(r) {
9
+ const { t: m } = s(i), [n, t] = p(!1);
10
+ return /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
11
+ /* @__PURE__ */ o.jsx(
12
+ u,
13
+ {
14
+ open: n,
15
+ onCloseMethod: t,
16
+ ...r
17
+ }
18
+ ),
19
+ /* @__PURE__ */ o.jsx(
20
+ f,
21
+ {
22
+ icon: /* @__PURE__ */ o.jsx(e, {}),
23
+ onClick: () => t(!0),
24
+ children: m("str.import")
25
+ }
26
+ )
27
+ ] });
28
+ }
29
+ export {
30
+ I as default
31
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("../../../../_virtual/jsx-runtime.cjs"),g=require("@ant-design/icons"),M=require("papaparse"),d=require("antd"),B=require("file-saver"),o=require("react"),O=require("react-i18next"),V=require("../../../locale/hooks/translation-constants.cjs"),W=require("../view/CrudViewer.cjs"),_=require("../../../util/DateUtil.cjs"),L=require("../../common/button/Button.cjs"),z=require("../../common/button/ImportButton.cjs");function $({onCloseMethod:b,open:C,fields:T,importProps:a}){const[u,q]=o.useState([]),[E,h]=o.useState(!1),[w,v]=o.useState(0);o.useEffect(()=>{C||(q([]),h(!1))},[C]);const f=o.useMemo(()=>new Map(T.filter(e=>{var t;return!e.hidden&&!((t=e.importProps)!=null&&t.hidden)&&!e.readonly}).map(e=>[e.name,e])),[T]),S=o.useMemo(()=>Array.from(f.values()).flatMap(e=>{var t;return[e.name,...((t=e.importProps)==null?void 0:t.extraFields)??[]]}),[f]),D=o.useCallback(async function(){const e=`${S.join(",")}
2
+ `,t=new Blob([e],{type:"text/csv;charset=utf-8;"});B.saveAs(t,(a==null?void 0:a.name)+" - "+_.default.formatDateTimeWithSecond(new Date).replaceAll(":","-")+".csv")},[S,a==null?void 0:a.name]),{t:l}=O.useTranslation(V.TRANSLATION_NAMESPACE),I=o.useCallback(async e=>{const t=new FileReader;t.onerror=console.error,t.onload=async r=>{var n;const c=(n=r==null?void 0:r.target)==null?void 0:n.result,i=M.parse(c,{header:!0});q(i.data)},t.readAsText(e)},[]),y=o.useMemo(()=>{var t,r,c;let e=!1;for(const i of u)for(const[n,x]of f.entries()){const j=i[n],m=j||!isNaN(j);if(x.required&&!m)if((r=(t=x.importProps)==null?void 0:t.extraFields)!=null&&r.length)for(const R of((c=x.importProps)==null?void 0:c.extraFields)??[])if(i[R]||!isNaN(i[R])){e=!1;break}else return!0;else return!0}return e},[u,f]),p=o.useCallback(e=>(t,r)=>{var i,n,x;const c=t||!isNaN(t);if(e.required&&!c){let j=l("err.validation.required");if((n=(i=e.importProps)==null?void 0:i.extraFields)!=null&&n.length){const m=(x=e.importProps)==null?void 0:x.extraFields;(m==null?void 0:m.find(N=>!r[N]))&&(j="Either one of these fields is required: "+[e.name,...m].join(", "))}return s.jsxRuntimeExports.jsxs(d.Tooltip,{className:"d-flex",title:j,children:[s.jsxRuntimeExports.jsx(g.WarningTwoTone,{twoToneColor:"#ee9702"}),t]})}return t},[l]),A=o.useCallback(async e=>{v(e)},[]),k=o.useCallback(async()=>{try{h(!0),await a.onClickImport(u,A),b(!1)}finally{h(!1),v(0)}},[u,a,b,A]),F=o.useCallback(async()=>{y?d.Modal.warn({title:l("str.warning"),content:l("qus.importWithIssues"),okText:l("str.import"),onOk:k,okCancel:!0,closable:!0}):k()},[y,k,l]);return s.jsxRuntimeExports.jsxs(d.Modal,{title:[l("str.import"),a==null?void 0:a.name].filter(Boolean).join(" "),width:"100%",open:C,onOk:F,destroyOnClose:!0,onCancel:()=>b(!1),okText:l("str.import"),confirmLoading:E,okButtonProps:{disabled:!(u!=null&&u.length)},footer:(e,{OkBtn:t,CancelBtn:r})=>s.jsxRuntimeExports.jsxs(d.Space,{children:[s.jsxRuntimeExports.jsx(r,{}),s.jsxRuntimeExports.jsx(t,{}),y&&s.jsxRuntimeExports.jsx(d.Tooltip,{className:"d-flex",title:"Some fields have issue. Please review before submit.",children:s.jsxRuntimeExports.jsx(g.WarningTwoTone,{twoToneColor:"#ee9702"})})]}),children:[s.jsxRuntimeExports.jsxs(d.Space,{children:[s.jsxRuntimeExports.jsx(L.default,{onClick:D,icon:s.jsxRuntimeExports.jsx(g.DownloadOutlined,{}),children:l("str.downloadCsvTemplate")}),s.jsxRuntimeExports.jsx(z.ImportButton,{disabled:E,type:"default",onClick:I,accept:".csv",children:l("str.importCsvFile")})]}),s.jsxRuntimeExports.jsx(d.Spin,{spinning:E,indicator:w?s.jsxRuntimeExports.jsx(d.Progress,{type:"circle",percent:w*100,size:50,format:e=>`${parseInt(e)}%`}):void 0,children:s.jsxRuntimeExports.jsx(W.default,{data:u,bordered:!0,size:"small",fields:Array.from(f.values()).flatMap(e=>{var t,r,c,i;return e.type==="text"?[{...e,label:e.name,render:p(e)},...((r=(t=e.importProps)==null?void 0:t.extraFields)==null?void 0:r.map(n=>({...e,name:n,label:n,render:p(e)})))??[]]:e.type==="select"?[{...e,label:e.name,type:"text",render:p(e)},...((i=(c=e.importProps)==null?void 0:c.extraFields)==null?void 0:i.map(n=>({...e,name:n,label:n,type:"text",render:p(e)})))??[]]:[{...e,label:e.name,render:p(e)}]})})})]})}exports.default=$;
@@ -0,0 +1,221 @@
1
+ import { j as r } from "../../../../_virtual/jsx-runtime.js";
2
+ import { WarningTwoTone as S, DownloadOutlined as R } from "@ant-design/icons";
3
+ import W from "papaparse";
4
+ import { Tooltip as q, Modal as B, Space as O, Spin as z, Progress as _ } from "antd";
5
+ import { saveAs as $ } from "file-saver";
6
+ import { useState as k, useEffect as U, useMemo as T, useCallback as m } from "react";
7
+ import { useTranslation as G } from "react-i18next";
8
+ import { TRANSLATION_NAMESPACE as H } from "../../../locale/hooks/translation-constants.js";
9
+ import J from "../view/CrudViewer.js";
10
+ import K from "../../../util/DateUtil.js";
11
+ import Q from "../../common/button/Button.js";
12
+ import { ImportButton as X } from "../../common/button/ImportButton.js";
13
+ function ce({
14
+ onCloseMethod: h,
15
+ open: y,
16
+ fields: v,
17
+ importProps: o
18
+ }) {
19
+ const [c, A] = k([]), [j, b] = k(!1), [N, D] = k(0);
20
+ U(() => {
21
+ y || (A([]), b(!1));
22
+ }, [y]);
23
+ const u = T(
24
+ () => new Map(
25
+ v.filter((e) => {
26
+ var t;
27
+ return !e.hidden && !((t = e.importProps) != null && t.hidden) && !e.readonly;
28
+ }).map((e) => [e.name, e])
29
+ ),
30
+ [v]
31
+ ), E = T(
32
+ () => Array.from(u.values()).flatMap((e) => {
33
+ var t;
34
+ return [
35
+ e.name,
36
+ ...((t = e.importProps) == null ? void 0 : t.extraFields) ?? []
37
+ ];
38
+ }),
39
+ [u]
40
+ ), V = m(
41
+ async function() {
42
+ const e = `${E.join(",")}
43
+ `, t = new Blob([e], { type: "text/csv;charset=utf-8;" });
44
+ $(
45
+ t,
46
+ (o == null ? void 0 : o.name) + " - " + K.formatDateTimeWithSecond(/* @__PURE__ */ new Date()).replaceAll(":", "-") + ".csv"
47
+ );
48
+ },
49
+ [E, o == null ? void 0 : o.name]
50
+ ), { t: l } = G(H), M = m(async (e) => {
51
+ const t = new FileReader();
52
+ t.onerror = console.error, t.onload = async (n) => {
53
+ var s;
54
+ const i = (s = n == null ? void 0 : n.target) == null ? void 0 : s.result, a = W.parse(i, { header: !0 });
55
+ A(a.data);
56
+ }, t.readAsText(e);
57
+ }, []), C = T(() => {
58
+ var t, n, i;
59
+ let e = !1;
60
+ for (const a of c)
61
+ for (const [s, d] of u.entries()) {
62
+ const x = a[s], f = x || !isNaN(x);
63
+ if (d.required && !f)
64
+ if ((n = (t = d.importProps) == null ? void 0 : t.extraFields) != null && n.length)
65
+ for (const g of ((i = d.importProps) == null ? void 0 : i.extraFields) ?? [])
66
+ if (a[g] || !isNaN(a[g])) {
67
+ e = !1;
68
+ break;
69
+ } else return !0;
70
+ else return !0;
71
+ }
72
+ return e;
73
+ }, [c, u]), p = m(
74
+ (e) => (t, n) => {
75
+ var a, s, d;
76
+ const i = t || !isNaN(t);
77
+ if (e.required && !i) {
78
+ let x = l("err.validation.required");
79
+ if ((s = (a = e.importProps) == null ? void 0 : a.extraFields) != null && s.length) {
80
+ const f = (d = e.importProps) == null ? void 0 : d.extraFields;
81
+ (f == null ? void 0 : f.find((I) => !n[I])) && (x = "Either one of these fields is required: " + [e.name, ...f].join(", "));
82
+ }
83
+ return /* @__PURE__ */ r.jsxs(q, { className: "d-flex", title: x, children: [
84
+ /* @__PURE__ */ r.jsx(S, { twoToneColor: "#ee9702" }),
85
+ t
86
+ ] });
87
+ }
88
+ return t;
89
+ },
90
+ [l]
91
+ ), F = m(async (e) => {
92
+ D(e);
93
+ }, []), w = m(async () => {
94
+ try {
95
+ b(!0), await o.onClickImport(c, F), h(!1);
96
+ } finally {
97
+ b(!1), D(0);
98
+ }
99
+ }, [c, o, h, F]), L = m(async () => {
100
+ C ? B.warn({
101
+ title: l("str.warning"),
102
+ content: l("qus.importWithIssues"),
103
+ okText: l("str.import"),
104
+ onOk: w,
105
+ okCancel: !0,
106
+ closable: !0
107
+ }) : w();
108
+ }, [C, w, l]);
109
+ return /* @__PURE__ */ r.jsxs(
110
+ B,
111
+ {
112
+ title: [l("str.import"), o == null ? void 0 : o.name].filter(Boolean).join(" "),
113
+ width: "100%",
114
+ open: y,
115
+ onOk: L,
116
+ destroyOnClose: !0,
117
+ onCancel: () => h(!1),
118
+ okText: l("str.import"),
119
+ confirmLoading: j,
120
+ okButtonProps: {
121
+ disabled: !(c != null && c.length)
122
+ },
123
+ footer: (e, { OkBtn: t, CancelBtn: n }) => /* @__PURE__ */ r.jsxs(O, { children: [
124
+ /* @__PURE__ */ r.jsx(n, {}),
125
+ /* @__PURE__ */ r.jsx(t, {}),
126
+ C && /* @__PURE__ */ r.jsx(
127
+ q,
128
+ {
129
+ className: "d-flex",
130
+ title: "Some fields have issue. Please review before submit.",
131
+ children: /* @__PURE__ */ r.jsx(S, { twoToneColor: "#ee9702" })
132
+ }
133
+ )
134
+ ] }),
135
+ children: [
136
+ /* @__PURE__ */ r.jsxs(O, { children: [
137
+ /* @__PURE__ */ r.jsx(
138
+ Q,
139
+ {
140
+ onClick: V,
141
+ icon: /* @__PURE__ */ r.jsx(R, {}),
142
+ children: l("str.downloadCsvTemplate")
143
+ }
144
+ ),
145
+ /* @__PURE__ */ r.jsx(
146
+ X,
147
+ {
148
+ disabled: j,
149
+ type: "default",
150
+ onClick: M,
151
+ accept: ".csv",
152
+ children: l("str.importCsvFile")
153
+ }
154
+ )
155
+ ] }),
156
+ /* @__PURE__ */ r.jsx(
157
+ z,
158
+ {
159
+ spinning: j,
160
+ indicator: N ? /* @__PURE__ */ r.jsx(
161
+ _,
162
+ {
163
+ type: "circle",
164
+ percent: N * 100,
165
+ size: 50,
166
+ format: (e) => `${parseInt(e)}%`
167
+ }
168
+ ) : void 0,
169
+ children: /* @__PURE__ */ r.jsx(
170
+ J,
171
+ {
172
+ data: c,
173
+ bordered: !0,
174
+ size: "small",
175
+ fields: Array.from(u.values()).flatMap((e) => {
176
+ var t, n, i, a;
177
+ return e.type === "text" ? [
178
+ {
179
+ ...e,
180
+ label: e.name,
181
+ render: p(e)
182
+ },
183
+ ...((n = (t = e.importProps) == null ? void 0 : t.extraFields) == null ? void 0 : n.map((s) => ({
184
+ ...e,
185
+ name: s,
186
+ label: s,
187
+ render: p(e)
188
+ }))) ?? []
189
+ ] : e.type === "select" ? [
190
+ {
191
+ ...e,
192
+ label: e.name,
193
+ type: "text",
194
+ render: p(e)
195
+ },
196
+ ...((a = (i = e.importProps) == null ? void 0 : i.extraFields) == null ? void 0 : a.map((s) => ({
197
+ ...e,
198
+ name: s,
199
+ label: s,
200
+ type: "text",
201
+ render: p(e)
202
+ }))) ?? []
203
+ ] : [
204
+ {
205
+ ...e,
206
+ label: e.name,
207
+ render: p(e)
208
+ }
209
+ ];
210
+ })
211
+ }
212
+ )
213
+ }
214
+ )
215
+ ]
216
+ }
217
+ );
218
+ }
219
+ export {
220
+ ce as default
221
+ };
@@ -0,0 +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"),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;
@@ -0,0 +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 { 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
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../../../_virtual/jsx-runtime.cjs"),D=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"),et=require("../../common/button/UpdateButtonTable.cjs"),st=require("../../common/button/ViewButtonTable.cjs"),rt=require("../../common/layout/VerticalSpace.cjs"),ut=require("../../common/table/table.cjs"),l=require("react"),nt=require("react-i18next"),ot=require("../../../locale/hooks/translation-constants.cjs"),xt=require("../CrudSearchComponent.cjs"),ct=require("./CrudDecListView.cjs"),_=require("./CrudViewerUtil.cjs");function jt({idField:r="id",loadingData:L,fields:c,isDeleting:q,isHiding:d,viewable:o=!1,paginateProps:i,onDelete:a,onHide:v,onUpdate:R,data:E=[],extraAction:m,onClickUpdate:x,minusHeight:S,scroll:N,onClickClone:f,className:z,expandable:$,size:w,bordered:A,descListColumn:G,extraView:p,decListLayout:J,scrollToTop:lt,onClickRefresh:g,closeViewOnClickUpdate:b,onExport:B,confirmHiding:C,confirmDeleting:I,rowClassName:K,actionWidth:Q=190,...W}){const{t:X}=nt.useTranslation(ot.TRANSLATION_NAMESPACE),M=l.useMemo(()=>c.map(({hideInTable:e,hidden:s,width:j,name:n,label:Z,halign:P,...O})=>({title:Z,width:j,key:n,dataIndex:n,hidden:e||s,align:P??(O.type==="number"?"right":void 0),render:_.getRendererValueCrudViewer(O)})),[c]),[u,h]=l.useState(),[T,y]=l.useState();l.useEffect(()=>{E&&h(e=>{if(e)return E.find(s=>s[r]===e[r])})},[E,r,u]);const V=l.useCallback(e=>{var j;const s=m==null?void 0:m(e);return(Array.isArray(s)?(j=s==null?void 0:s.filter(Boolean))!=null&&j.length:s)||R||x||f||a?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[s,(R||x)&&t.jsxRuntimeExports.jsx(et.default,{value:e,onClick:n=>{y(n[r]),x==null||x(e),b&&h(void 0)}}),f&&t.jsxRuntimeExports.jsx(k.default,{value:e,onClick:n=>f(n)}),B&&t.jsxRuntimeExports.jsx(U.ExportButton,{value:e,onClick:async n=>await B(n)}),v&&t.jsxRuntimeExports.jsx(F.default,{value:e,disabled:d,shouldConfirm:C,loading:d&&e[r]===T,onClick:async n=>{y(n[r]),await v({[r]:n[r]})}}),a&&t.jsxRuntimeExports.jsx(H.default,{value:e,disabled:q,shouldConfirm:I,loading:q&&e[r]===T,onClick:async n=>{y(n[r]),await a({[r]:n[r]})}})]}):void 0},[b,I,C,m,r,q,d,f,x,a,B,v,R,T]),Y=l.useMemo(()=>{let e=typeof o=="string"?u==null?void 0:u[o]:void 0;if(typeof e=="object"){const s=c.find(j=>j.name===o);e=_.getRendererValueCrudViewer(s)(e,u,0)}return e},[o,u,c]);return t.jsxRuntimeExports.jsxs("div",{children:[o&&t.jsxRuntimeExports.jsx(D.Modal,{width:"100%",open:!!u,title:Y??t.jsxRuntimeExports.jsx("div",{children:" "}),footer:t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{}),closable:!0,onCancel:()=>h(void 0),children:!!u&&t.jsxRuntimeExports.jsxs("div",{children:[t.jsxRuntimeExports.jsx(ct.CrudDecListView,{layout:J,descListColumn:G,data:u,fields:c,action:V(u)}),p==null?void 0:p(u)]},u==null?void 0:u[r])}),t.jsxRuntimeExports.jsx(xt.default,{fields:c,...W}),t.jsxRuntimeExports.jsxs(rt.default,{children:[!!g&&t.jsxRuntimeExports.jsx(tt.RefreshButton,{onClick:g}),t.jsxRuntimeExports.jsx(ut.default,{rowClassName:K,className:z,scroll:N??(S?{y:`calc(100vh - ${S})`}:void 0),id:"crud-table",dataSource:E,loading:L,bordered:A,size:w,expandable:$,pagination:i?{total:i.count,onChange:i.setPage,current:i.page,pageSize:i.pageSize}:void 0,columns:R||x||a||m||o?[...M,{title:X("str.action"),dataIndex:"",fixed:"right",width:Q,render:(e,s)=>t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[o&&t.jsxRuntimeExports.jsx(st.default,{value:s,onClick:h}),V(s)]})}]:M})]})]})}exports.default=jt;
@@ -0,0 +1,217 @@
1
+ import { j as r } from "../../../../_virtual/jsx-runtime.js";
2
+ import { Modal as k } from "antd";
3
+ import H from "../../common/button/CloneButtonTable.js";
4
+ import U from "../../common/button/DeleteButtonTable.js";
5
+ import { ExportButton as F } from "../../common/button/ExportButton.js";
6
+ import rr from "../../common/button/HideButtonTable.js";
7
+ import { RefreshButton as or } from "../../common/button/RefreshButton.js";
8
+ import tr from "../../common/button/UpdateButtonTable.js";
9
+ import sr from "../../common/button/ViewButtonTable.js";
10
+ import mr from "../../common/layout/VerticalSpace.js";
11
+ import ur from "../../common/table/table.js";
12
+ import { useMemo as L, useState as _, useEffect as nr, useCallback as er } from "react";
13
+ import { useTranslation as fr } from "react-i18next";
14
+ import { TRANSLATION_NAMESPACE as cr } from "../../../locale/hooks/translation-constants.js";
15
+ import lr from "../CrudSearchComponent.js";
16
+ import { CrudDecListView as jr } from "./CrudDecListView.js";
17
+ import { getRendererValueCrudViewer as V } from "./CrudViewerUtil.js";
18
+ function Or({
19
+ idField: s = "id",
20
+ loadingData: $,
21
+ fields: f,
22
+ isDeleting: y,
23
+ isHiding: B,
24
+ viewable: n = !1,
25
+ paginateProps: l,
26
+ onDelete: j,
27
+ onHide: p,
28
+ onUpdate: h,
29
+ data: v = [],
30
+ extraAction: a,
31
+ onClickUpdate: e,
32
+ minusHeight: I,
33
+ scroll: q,
34
+ onClickClone: T,
35
+ className: A,
36
+ expandable: G,
37
+ size: J,
38
+ bordered: K,
39
+ descListColumn: Q,
40
+ extraView: i,
41
+ decListLayout: W,
42
+ scrollToTop: ar,
43
+ onClickRefresh: C,
44
+ closeViewOnClickUpdate: R,
45
+ onExport: S,
46
+ confirmHiding: E,
47
+ confirmDeleting: M,
48
+ rowClassName: X,
49
+ actionWidth: Y = 190,
50
+ ...Z
51
+ }) {
52
+ const { t: d } = fr(cr), N = L(
53
+ () => f.map(
54
+ ({ hideInTable: o, hidden: t, width: c, name: u, label: w, halign: D, ...z }) => ({
55
+ title: w,
56
+ width: c,
57
+ key: u,
58
+ dataIndex: u,
59
+ hidden: o || t,
60
+ align: D ?? (z.type === "number" ? "right" : void 0),
61
+ render: V(z)
62
+ })
63
+ ),
64
+ [f]
65
+ ), [m, x] = _(), [b, g] = _();
66
+ nr(() => {
67
+ v && x((o) => {
68
+ if (o)
69
+ return v.find((t) => t[s] === o[s]);
70
+ });
71
+ }, [v, s, m]);
72
+ const O = er(
73
+ (o) => {
74
+ var c;
75
+ const t = a == null ? void 0 : a(o);
76
+ return (Array.isArray(t) ? (c = t == null ? void 0 : t.filter(Boolean)) != null && c.length : t) || h || e || T || j ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
77
+ t,
78
+ (h || e) && /* @__PURE__ */ r.jsx(
79
+ tr,
80
+ {
81
+ value: o,
82
+ onClick: (u) => {
83
+ g(u[s]), e == null || e(o), R && x(void 0);
84
+ }
85
+ }
86
+ ),
87
+ T && /* @__PURE__ */ r.jsx(H, { value: o, onClick: (u) => T(u) }),
88
+ S && /* @__PURE__ */ r.jsx(
89
+ F,
90
+ {
91
+ value: o,
92
+ onClick: async (u) => await S(u)
93
+ }
94
+ ),
95
+ p && /* @__PURE__ */ r.jsx(
96
+ rr,
97
+ {
98
+ value: o,
99
+ disabled: B,
100
+ shouldConfirm: E,
101
+ loading: B && o[s] === b,
102
+ onClick: async (u) => {
103
+ g(u[s]), await p({ [s]: u[s] });
104
+ }
105
+ }
106
+ ),
107
+ j && /* @__PURE__ */ r.jsx(
108
+ U,
109
+ {
110
+ value: o,
111
+ disabled: y,
112
+ shouldConfirm: M,
113
+ loading: y && o[s] === b,
114
+ onClick: async (u) => {
115
+ g(u[s]), await j({ [s]: u[s] });
116
+ }
117
+ }
118
+ )
119
+ ] }) : void 0;
120
+ },
121
+ [
122
+ R,
123
+ M,
124
+ E,
125
+ a,
126
+ s,
127
+ y,
128
+ B,
129
+ T,
130
+ e,
131
+ j,
132
+ S,
133
+ p,
134
+ h,
135
+ b
136
+ ]
137
+ ), P = L(() => {
138
+ let o = typeof n == "string" ? m == null ? void 0 : m[n] : void 0;
139
+ if (typeof o == "object") {
140
+ const t = f.find((c) => c.name === n);
141
+ o = V(t)(
142
+ o,
143
+ m,
144
+ 0
145
+ );
146
+ }
147
+ return o;
148
+ }, [n, m, f]);
149
+ return /* @__PURE__ */ r.jsxs("div", { children: [
150
+ n && /* @__PURE__ */ r.jsx(
151
+ k,
152
+ {
153
+ width: "100%",
154
+ open: !!m,
155
+ title: P ?? /* @__PURE__ */ r.jsx("div", { children: " " }),
156
+ footer: /* @__PURE__ */ r.jsx(r.Fragment, {}),
157
+ closable: !0,
158
+ onCancel: () => x(void 0),
159
+ children: !!m && /* @__PURE__ */ r.jsxs("div", { children: [
160
+ /* @__PURE__ */ r.jsx(
161
+ jr,
162
+ {
163
+ layout: W,
164
+ descListColumn: Q,
165
+ data: m,
166
+ fields: f,
167
+ action: O(m)
168
+ }
169
+ ),
170
+ i == null ? void 0 : i(m)
171
+ ] }, m == null ? void 0 : m[s])
172
+ }
173
+ ),
174
+ /* @__PURE__ */ r.jsx(lr, { fields: f, ...Z }),
175
+ /* @__PURE__ */ r.jsxs(mr, { children: [
176
+ !!C && /* @__PURE__ */ r.jsx(or, { onClick: C }),
177
+ /* @__PURE__ */ r.jsx(
178
+ ur,
179
+ {
180
+ rowClassName: X,
181
+ className: A,
182
+ scroll: q ?? (I ? {
183
+ y: `calc(100vh - ${I})`
184
+ } : void 0),
185
+ id: "crud-table",
186
+ dataSource: v,
187
+ loading: $,
188
+ bordered: K,
189
+ size: J,
190
+ expandable: G,
191
+ pagination: l ? {
192
+ total: l.count,
193
+ onChange: l.setPage,
194
+ current: l.page,
195
+ pageSize: l.pageSize
196
+ } : void 0,
197
+ columns: h || e || j || a || n ? [
198
+ ...N,
199
+ {
200
+ title: d("str.action"),
201
+ dataIndex: "",
202
+ fixed: "right",
203
+ width: Y,
204
+ render: (o, t) => /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
205
+ n && /* @__PURE__ */ r.jsx(sr, { value: t, onClick: x }),
206
+ O(t)
207
+ ] })
208
+ }
209
+ ] : N
210
+ }
211
+ )
212
+ ] })
213
+ ] });
214
+ }
215
+ export {
216
+ Or as default
217
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../../../_virtual/jsx-runtime.cjs"),m=require("@ant-design/icons"),s=require("antd"),j=require("../../common/show-more/index.cjs"),d=require("../FileCrudField.cjs"),v=require("../ImageCrudField.cjs"),y=require("../../../locale/hooks/translation-constants.cjs"),C=require("i18next"),r=require("../../../util/DateUtil.cjs"),x=require("../../../util/NumberUtil.cjs");function g({type:a,render:i,...n}){return a==="object"?(t,u,e)=>typeof i=="function"?i(t,u,e):"":a==="select"?(t,u,e)=>{const o=n;let l=o.multiple?Array.isArray(t)?t.map(f=>f==null?void 0:f[o.innerFieldLabel??"name"]):void 0:t==null?void 0:t[o.innerFieldLabel??"name"];return(!l&&typeof t=="string"||typeof t=="number")&&(l=t),typeof i=="function"?i(l,u,e):Array.isArray(l)?l.join(", "):l}:a==="number"?(t,u,e)=>typeof i=="function"?i(t,u,e):n!=null&&n.int?x.default.toInt(t,n.formatted):x.default.toMoney(t):a==="enum"?(t,u,e)=>{var l;const o=C.t(((l=n==null?void 0:n.translation)==null?void 0:l[t??""])??t,{ns:y.TRANSLATION_NAMESPACE});return typeof i=="function"?i(t,u,e):o}:a==="date"?(t,u,e)=>{if(!t)return"-";const o=n!=null&&n.formatTime?r.default.formatDateTime(t):r.default.formatDate(t);return typeof i=="function"?i(t,u,e):o}:a==="checkbox"?(t,u,e)=>typeof i=="function"?i(t,u,e):t?c.jsxRuntimeExports.jsx(m.CheckOutlined,{}):c.jsxRuntimeExports.jsx(m.CloseOutlined,{}):a==="image"?(t,u,e)=>typeof i=="function"?i(t,u,e):c.jsxRuntimeExports.jsx(v.ImageCrudCellValue,{value:t,provider:n.provider}):a==="file"?(t,u,e)=>typeof i=="function"?i(t,u,e):c.jsxRuntimeExports.jsx(d.FileCrudCellValue,{value:t,provider:n.provider}):a==="time"?(t,u,e)=>{if(!t)return"-";const o=n==null?void 0:n.format,l=n==null?void 0:n.use12Hours,f=r.default.formatTime(t,o||(l?"hh:mm:ss A":void 0));return typeof i=="function"?i(t,u,e):f}:a==="color"?(t,u,e)=>typeof i=="function"?i(t,u,e):typeof t=="string"&&t.startsWith("#")?c.jsxRuntimeExports.jsx(s.Tooltip,{title:t,children:c.jsxRuntimeExports.jsx(s.Avatar,{style:{backgroundColor:t}})}):String(t):a==="textarea"?(t,u,e)=>{const o=(n==null?void 0:n.truncated)??1;return typeof i=="function"?i(t,u,e):o?c.jsxRuntimeExports.jsx(j.ShowMore,{lines:o===!0?1:o,children:t}):t}:typeof i=="function"?i:t=>t}exports.getRendererValueCrudViewer=g;