@kingteza/crud-component 1.2.1 → 1.2.2

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 (241) hide show
  1. package/dist/Play.d.ts +2 -0
  2. package/dist/README.md +89 -0
  3. package/dist/common/appearance/Hider.cjs.js +1 -0
  4. package/dist/common/appearance/Hider.d.ts +6 -0
  5. package/dist/common/appearance/Hider.es.js +5 -0
  6. package/dist/common/appearance/index.d.ts +1 -0
  7. package/dist/common/button/Button.cjs.js +1 -0
  8. package/dist/common/button/Button.d.ts +11 -0
  9. package/dist/common/button/Button.es.js +57 -0
  10. package/dist/common/button/CloneButtonTable.cjs.js +1 -0
  11. package/dist/common/button/CloneButtonTable.d.ts +6 -0
  12. package/dist/common/button/CloneButtonTable.es.js +19 -0
  13. package/dist/common/button/DeleteButtonTable.cjs.js +1 -0
  14. package/dist/common/button/DeleteButtonTable.d.ts +13 -0
  15. package/dist/common/button/DeleteButtonTable.es.js +64 -0
  16. package/dist/common/button/ExportButton.cjs.js +1 -0
  17. package/dist/common/button/ExportButton.d.ts +4 -0
  18. package/dist/common/button/ExportButton.es.js +26 -0
  19. package/dist/common/button/HideButtonTable.cjs.js +1 -0
  20. package/dist/common/button/HideButtonTable.d.ts +13 -0
  21. package/dist/common/button/HideButtonTable.es.js +67 -0
  22. package/dist/common/button/ImportButton.cjs.js +1 -0
  23. package/dist/common/button/ImportButton.d.ts +9 -0
  24. package/dist/common/button/ImportButton.es.js +55 -0
  25. package/dist/common/button/NewButton.cjs.js +1 -0
  26. package/dist/common/button/NewButton.d.ts +12 -0
  27. package/dist/common/button/NewButton.es.js +23 -0
  28. package/dist/common/button/PrintButton.cjs.js +1 -0
  29. package/dist/common/button/PrintButton.d.ts +12 -0
  30. package/dist/common/button/PrintButton.es.js +25 -0
  31. package/dist/common/button/RefreshButton.cjs.js +1 -0
  32. package/dist/common/button/RefreshButton.d.ts +11 -0
  33. package/dist/common/button/RefreshButton.es.js +23 -0
  34. package/dist/common/button/UnHideButton.cjs.js +1 -0
  35. package/dist/common/button/UnHideButton.d.ts +14 -0
  36. package/dist/common/button/UnHideButton.es.js +69 -0
  37. package/dist/common/button/UpdateButtonTable.cjs.js +1 -0
  38. package/dist/common/button/UpdateButtonTable.d.ts +6 -0
  39. package/dist/common/button/UpdateButtonTable.es.js +19 -0
  40. package/dist/common/button/ViewButtonTable.cjs.js +1 -0
  41. package/dist/common/button/ViewButtonTable.d.ts +6 -0
  42. package/dist/common/button/ViewButtonTable.es.js +19 -0
  43. package/dist/common/button/index.d.ts +14 -0
  44. package/dist/common/check-box/CheckBox.cjs.js +1 -0
  45. package/dist/common/check-box/CheckBox.d.ts +9 -0
  46. package/dist/common/check-box/CheckBox.es.js +40 -0
  47. package/dist/common/check-box/index.d.ts +2 -0
  48. package/dist/common/date-picker/DatePicker.cjs.js +1 -0
  49. package/dist/common/date-picker/DatePicker.d.ts +37 -0
  50. package/dist/common/date-picker/DatePicker.es.js +87 -0
  51. package/dist/common/date-picker/TimePicker.cjs.js +1 -0
  52. package/dist/common/date-picker/TimePicker.d.ts +34 -0
  53. package/dist/common/date-picker/TimePicker.es.js +77 -0
  54. package/dist/common/date-picker/index.d.ts +3 -0
  55. package/dist/common/description/DescList.cjs.js +1 -0
  56. package/dist/common/description/DescList.d.ts +18 -0
  57. package/dist/common/description/DescList.es.js +16 -0
  58. package/dist/common/description/DescriptionComponent.d.ts +7 -0
  59. package/dist/common/description/index.d.ts +3 -0
  60. package/dist/common/icon/KIcon.cjs.js +1 -0
  61. package/dist/common/icon/KIcon.d.ts +9 -0
  62. package/dist/common/icon/KIcon.es.js +11 -0
  63. package/dist/common/index.cjs.js +1 -0
  64. package/dist/common/index.d.ts +20 -0
  65. package/dist/common/index.es.js +78 -0
  66. package/dist/common/layout/VerticalSpace.cjs.js +1 -0
  67. package/dist/common/layout/VerticalSpace.d.ts +5 -0
  68. package/dist/common/layout/VerticalSpace.es.js +6 -0
  69. package/dist/common/layout/index.d.ts +2 -0
  70. package/dist/common/loading/LoadingIndicator.cjs.js +1 -0
  71. package/dist/common/loading/LoadingIndicator.d.ts +6 -0
  72. package/dist/common/loading/LoadingIndicator.es.js +23 -0
  73. package/dist/common/loading/index.d.ts +2 -0
  74. package/dist/common/picker/ImagePicker.cjs.js +1 -0
  75. package/dist/common/picker/ImagePicker.d.ts +56 -0
  76. package/dist/common/picker/ImagePicker.es.js +320 -0
  77. package/dist/common/picker/index.d.ts +2 -0
  78. package/dist/common/radio/RadioGroupComponent.cjs.js +1 -0
  79. package/dist/common/radio/RadioGroupComponent.d.ts +18 -0
  80. package/dist/common/radio/RadioGroupComponent.es.js +19 -0
  81. package/dist/common/radio/index.d.ts +2 -0
  82. package/dist/common/report/SelectFieldInReport.cjs.js +1 -0
  83. package/dist/common/report/SelectFieldInReport.d.ts +16 -0
  84. package/dist/common/report/SelectFieldInReport.es.js +30 -0
  85. package/dist/common/report/index.d.ts +3 -0
  86. package/dist/common/rich/index.cjs.js +1 -0
  87. package/dist/common/rich/index.d.ts +10 -0
  88. package/dist/common/rich/index.es.js +66 -0
  89. package/dist/common/select/CustomSelectOption.cjs.js +1 -0
  90. package/dist/common/select/CustomSelectOption.d.ts +7 -0
  91. package/dist/common/select/CustomSelectOption.es.js +13 -0
  92. package/dist/common/select/SelectComponent.cjs.js +1 -0
  93. package/dist/common/select/SelectComponent.d.ts +21 -0
  94. package/dist/common/select/SelectComponent.es.js +85 -0
  95. package/dist/common/select/index.d.ts +3 -0
  96. package/dist/common/show-more/index.cjs.js +1 -0
  97. package/dist/common/show-more/index.d.ts +4 -0
  98. package/dist/common/show-more/index.es.js +8 -0
  99. package/dist/common/tab/TabViewWithRoute.cjs.js +1 -0
  100. package/dist/common/tab/TabViewWithRoute.d.ts +13 -0
  101. package/dist/common/tab/TabViewWithRoute.es.js +38 -0
  102. package/dist/common/tab/index.d.ts +2 -0
  103. package/dist/common/table/index.d.ts +3 -0
  104. package/dist/common/table/table.cjs.js +1 -0
  105. package/dist/common/table/table.d.ts +19 -0
  106. package/dist/common/table/table.es.js +40 -0
  107. package/dist/common/tag/StatusTag.cjs.js +1 -0
  108. package/dist/common/tag/StatusTag.d.ts +14 -0
  109. package/dist/common/tag/StatusTag.es.js +29 -0
  110. package/dist/common/tag/index.d.ts +2 -0
  111. package/dist/common/text/index.cjs.js +1 -0
  112. package/dist/common/text/index.d.ts +3 -0
  113. package/dist/common/text/index.es.js +5 -0
  114. package/dist/common/text/title/TitleWithHeadTitle.d.ts +7 -0
  115. package/dist/common/text/title/index.cjs.js +1 -0
  116. package/dist/common/text/title/index.d.ts +1 -0
  117. package/dist/common/text/title/index.es.js +5 -0
  118. package/dist/common/text-field/NumberField.cjs.js +1 -0
  119. package/dist/common/text-field/NumberField.d.ts +13 -0
  120. package/dist/common/text-field/NumberField.es.js +83 -0
  121. package/dist/common/text-field/PhoneNumberField.cjs.js +1 -0
  122. package/dist/common/text-field/PhoneNumberField.d.ts +4 -0
  123. package/dist/common/text-field/PhoneNumberField.es.js +18 -0
  124. package/dist/common/text-field/TextArea.cjs.js +1 -0
  125. package/dist/common/text-field/TextArea.d.ts +17 -0
  126. package/dist/common/text-field/TextArea.es.js +46 -0
  127. package/dist/common/text-field/TextField.cjs.js +1 -0
  128. package/dist/common/text-field/TextField.d.ts +27 -0
  129. package/dist/common/text-field/TextField.es.js +72 -0
  130. package/dist/common/text-field/index.d.ts +5 -0
  131. package/dist/common/tooltip/TooltipComponent.cjs.js +1 -0
  132. package/dist/common/tooltip/TooltipComponent.d.ts +5 -0
  133. package/dist/common/tooltip/TooltipComponent.es.js +9 -0
  134. package/dist/common/tooltip/index.d.ts +2 -0
  135. package/dist/common/wizard/WizardResult.cjs.js +1 -0
  136. package/dist/common/wizard/WizardResult.d.ts +16 -0
  137. package/dist/common/wizard/WizardResult.es.js +58 -0
  138. package/dist/common/wizard/WizardViewForm.cjs.js +1 -0
  139. package/dist/common/wizard/WizardViewForm.d.ts +24 -0
  140. package/dist/common/wizard/WizardViewForm.es.js +74 -0
  141. package/dist/common/wizard/index.d.ts +3 -0
  142. package/dist/context/WindowDimension.cjs.js +1 -0
  143. package/dist/context/WindowDimension.d.ts +4 -0
  144. package/dist/context/WindowDimension.es.js +8 -0
  145. package/dist/context/index.d.ts +1 -0
  146. package/dist/crud/CrudComponent.cjs.js +1 -0
  147. package/dist/crud/CrudComponent.d.ts +245 -0
  148. package/dist/crud/CrudComponent.es.js +123 -0
  149. package/dist/crud/CrudField.cjs.js +1 -0
  150. package/dist/crud/CrudField.d.ts +4 -0
  151. package/dist/crud/CrudField.es.js +461 -0
  152. package/dist/crud/CrudForm.cjs.js +1 -0
  153. package/dist/crud/CrudForm.d.ts +14 -0
  154. package/dist/crud/CrudForm.es.js +103 -0
  155. package/dist/crud/CrudFormWizard.cjs.js +1 -0
  156. package/dist/crud/CrudFormWizard.d.ts +14 -0
  157. package/dist/crud/CrudFormWizard.es.js +140 -0
  158. package/dist/crud/CrudReportComponent.cjs.js +4 -0
  159. package/dist/crud/CrudReportComponent.d.ts +44 -0
  160. package/dist/crud/CrudReportComponent.es.js +255 -0
  161. package/dist/crud/CrudSearchComponent.cjs.js +1 -0
  162. package/dist/crud/CrudSearchComponent.d.ts +21 -0
  163. package/dist/crud/CrudSearchComponent.es.js +96 -0
  164. package/dist/crud/CrudTextAreaComponent.cjs.js +1 -0
  165. package/dist/crud/CrudTextAreaComponent.d.ts +22 -0
  166. package/dist/crud/CrudTextAreaComponent.es.js +52 -0
  167. package/dist/crud/FileCrudField.cjs.js +1 -0
  168. package/dist/crud/FileCrudField.d.ts +25 -0
  169. package/dist/crud/FileCrudField.es.js +221 -0
  170. package/dist/crud/ImageCrudField.cjs.js +1 -0
  171. package/dist/crud/ImageCrudField.d.ts +38 -0
  172. package/dist/crud/ImageCrudField.es.js +115 -0
  173. package/dist/crud/actions/index.cjs.js +1 -0
  174. package/dist/crud/actions/index.d.ts +26 -0
  175. package/dist/crud/actions/index.es.js +88 -0
  176. package/dist/crud/import/CrudImportButton.cjs.js +1 -0
  177. package/dist/crud/import/CrudImportButton.d.ts +3 -0
  178. package/dist/crud/import/CrudImportButton.es.js +30 -0
  179. package/dist/crud/import/CrudImportComponent.cjs.js +2 -0
  180. package/dist/crud/import/CrudImportComponent.d.ts +14 -0
  181. package/dist/crud/import/CrudImportComponent.es.js +222 -0
  182. package/dist/crud/index.d.ts +23 -0
  183. package/dist/crud/modal/index.cjs.js +1 -0
  184. package/dist/crud/modal/index.d.ts +24 -0
  185. package/dist/crud/modal/index.es.js +146 -0
  186. package/dist/crud/view/CrudDecListView.cjs.js +1 -0
  187. package/dist/crud/view/CrudDecListView.d.ts +15 -0
  188. package/dist/crud/view/CrudDecListView.es.js +57 -0
  189. package/dist/crud/view/CrudViewer.cjs.js +1 -0
  190. package/dist/crud/view/CrudViewer.d.ts +43 -0
  191. package/dist/crud/view/CrudViewer.es.js +304 -0
  192. package/dist/crud/view/CrudViewerUtil.cjs.js +1 -0
  193. package/dist/crud/view/CrudViewerUtil.d.ts +2 -0
  194. package/dist/crud/view/CrudViewerUtil.es.js +98 -0
  195. package/dist/crud/view/index.d.ts +5 -0
  196. package/dist/crud-component.css +6 -0
  197. package/dist/hooks/NavigatorHooks.cjs.js +1 -0
  198. package/dist/hooks/NavigatorHooks.d.ts +1 -0
  199. package/dist/hooks/NavigatorHooks.es.js +9 -0
  200. package/dist/icons/FlipHIcon.cjs.js +1 -0
  201. package/dist/icons/FlipHIcon.d.ts +3 -0
  202. package/dist/icons/FlipHIcon.es.js +28 -0
  203. package/dist/icons/FlipVIcon.cjs.js +1 -0
  204. package/dist/icons/FlipVIcon.d.ts +3 -0
  205. package/dist/icons/FlipVIcon.es.js +28 -0
  206. package/dist/index.cjs.js +1 -0
  207. package/dist/index.d.ts +4 -0
  208. package/dist/index.es.js +46 -0
  209. package/dist/locale/hooks/translation-constants.cjs.js +1 -0
  210. package/dist/locale/hooks/translation-constants.d.ts +1 -0
  211. package/dist/locale/hooks/translation-constants.es.js +4 -0
  212. package/dist/locale/index.cjs.js +1 -0
  213. package/dist/locale/index.d.ts +85 -0
  214. package/dist/locale/index.es.js +57 -0
  215. package/dist/locale/translations/en.cjs.js +1 -0
  216. package/dist/locale/translations/en.d.ts +63 -0
  217. package/dist/locale/translations/en.es.js +65 -0
  218. package/dist/package.json +122 -0
  219. package/dist/types/DialogComponentProp.d.ts +8 -0
  220. package/dist/types/Id.d.ts +10 -0
  221. package/dist/util/CrudUtil.cjs.js +1 -0
  222. package/dist/util/CrudUtil.d.ts +5 -0
  223. package/dist/util/CrudUtil.es.js +8 -0
  224. package/dist/util/DateUtil.cjs.js +1 -0
  225. package/dist/util/DateUtil.d.ts +7 -0
  226. package/dist/util/DateUtil.es.js +18 -0
  227. package/dist/util/ImageUtil.cjs.js +1 -0
  228. package/dist/util/ImageUtil.d.ts +14 -0
  229. package/dist/util/ImageUtil.es.js +63 -0
  230. package/dist/util/NumberUtil.cjs.js +1 -0
  231. package/dist/util/NumberUtil.d.ts +17 -0
  232. package/dist/util/NumberUtil.es.js +60 -0
  233. package/dist/util/ValidationUtil.cjs.js +1 -0
  234. package/dist/util/ValidationUtil.d.ts +14 -0
  235. package/dist/util/ValidationUtil.es.js +63 -0
  236. package/dist/util/index.cjs.js +1 -0
  237. package/dist/util/index.d.ts +4 -0
  238. package/dist/util/index.es.js +10 -0
  239. package/dist/vite-env.d.ts +1 -0
  240. package/package.json +4 -12
  241. package/release.config.cjs +0 -27
@@ -0,0 +1,72 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { LoadingOutlined as D } from "@ant-design/icons";
3
+ import { Input as d, Form as M } from "antd";
4
+ import { useMemo as O } from "react";
5
+ import { useTranslationLib as k } from "../../locale/index.es.js";
6
+ import q from "../tooltip/TooltipComponent.es.js";
7
+ const z = (n, o, t, e) => {
8
+ var i;
9
+ o && t && (n.preventDefault(), (i = t == null ? void 0 : t.getFieldInstance(o)) == null || i.focus()), e && e(n);
10
+ }, R = ({
11
+ type: n,
12
+ required: o,
13
+ label: t,
14
+ disabled: e,
15
+ rules: i = [],
16
+ placeholder: a,
17
+ onEnter: p,
18
+ size: f,
19
+ form: l,
20
+ addonAfter: u,
21
+ addonBefore: c,
22
+ nextFocus: g,
23
+ autoComplete: v = "off",
24
+ defaultValue: I,
25
+ readOnly: T,
26
+ value: h,
27
+ loading: x,
28
+ onBlur: C,
29
+ inputRef: F,
30
+ status: P,
31
+ autoFocus: w,
32
+ onChange: B,
33
+ tooltip: E,
34
+ ...L
35
+ }) => {
36
+ const { t: m } = k(), $ = O(() => {
37
+ const r = [
38
+ ...i,
39
+ {
40
+ required: o,
41
+ message: `${t ?? a ?? ""} ${m(
42
+ "err.validation.required"
43
+ )}`
44
+ }
45
+ ];
46
+ return n === "email" && r.push({
47
+ type: "email",
48
+ message: m("err.validation.invalidEmail")
49
+ }), r;
50
+ }, [i, o, t, a, m, n]), j = {
51
+ disabled: e,
52
+ value: h,
53
+ readOnly: T,
54
+ defaultValue: I,
55
+ autoFocus: w,
56
+ addonBefore: c,
57
+ ref: F,
58
+ onBlur: C,
59
+ addonAfter: x ? /* @__PURE__ */ s(D, {}) : u,
60
+ status: P,
61
+ size: f,
62
+ autoComplete: v,
63
+ onPressEnter: (r) => z(r, g, l, p),
64
+ type: n,
65
+ placeholder: a ?? t
66
+ }, A = n == "password" ? d.Password : d;
67
+ return /* @__PURE__ */ s(q, { title: E, children: /* @__PURE__ */ s(M.Item, { ...L, label: t, rules: $, children: /* @__PURE__ */ s(A, { ...j }) }) });
68
+ };
69
+ export {
70
+ R as default,
71
+ z as onEnterInternalTextField
72
+ };
@@ -0,0 +1,5 @@
1
+ import { default as NumberTextField } from './NumberField';
2
+ import { default as PhoneField } from './PhoneNumberField';
3
+ import { default as TextField } from './TextField';
4
+ import { default as TextAreaComponent } from './TextArea';
5
+ export { NumberTextField, PhoneField, TextField, TextAreaComponent };
@@ -0,0 +1 @@
1
+ "use strict";const r=require("react/jsx-runtime"),e=require("antd"),n=({children:t,title:o})=>o?r.jsx(e.Tooltip,{title:o,children:t}):t;module.exports=n;
@@ -0,0 +1,5 @@
1
+ import { FC, PropsWithChildren, ReactElement } from 'react';
2
+ declare const TooltipComponent: FC<PropsWithChildren<{
3
+ title?: ReactElement;
4
+ }>>;
5
+ export default TooltipComponent;
@@ -0,0 +1,9 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { Tooltip as p } from "antd";
3
+ const n = ({
4
+ children: o,
5
+ title: r
6
+ }) => r ? /* @__PURE__ */ t(p, { title: r, children: o }) : o;
7
+ export {
8
+ n as default
9
+ };
@@ -0,0 +1,2 @@
1
+ import { default as TooltipComponent } from './TooltipComponent';
2
+ export { TooltipComponent };
@@ -0,0 +1 @@
1
+ "use strict";const t=require("react/jsx-runtime"),l=require("@ant-design/icons"),r=require("antd"),x=require("../button/Button.cjs.js"),b=require("../../locale/index.cjs.js"),F=({errorChildren:v,children:a,onRetry:c,onClickBack:u,success:e,loading:o,error:i,successTitle:j,successMessage:p,errorMessage:n,errorTitle:m,loadingTitle:y,loadingMessage:T})=>{const{t:s}=b.useTranslationLib(),f=j??s("str.success"),q=m??s("str.error"),d=n?typeof n=="function"?n():n:s("err.save"),h=y??s("message.loading.saving");return t.jsx(r.Result,{status:o?void 0:e?"success":i?["403","404","500"].includes(i==null?void 0:i.code)?i.code:i?"error":void 0:void 0,title:o?h:e?f:i?q:void 0,icon:o?t.jsx(l.LoadingOutlined,{}):void 0,subTitle:o?T:e?p:i?typeof n=="function"?n()??d:n??d:void 0,extra:[e?t.jsx(t.Fragment,{children:a}):i?t.jsxs(t.Fragment,{children:[!!u&&t.jsx(x,{onClick:u,htmlType:"button",type:"primary",icon:t.jsx(l.ArrowLeftOutlined,{}),children:s("str.previous")}),!!c&&t.jsx(x,{type:"primary",onClick:()=>c(void 0,void 0,!0),children:s("str.retry")},"retry"),v]}):t.jsx(t.Fragment,{})]})};module.exports=F;
@@ -0,0 +1,16 @@
1
+ import { default as React, FC, PropsWithChildren } from 'react';
2
+ declare const WizardResult: FC<{
3
+ onRetry?: (_: undefined, __: undefined, retry: true) => void;
4
+ onClickBack?: () => void;
5
+ loading: boolean;
6
+ error: any;
7
+ success: boolean;
8
+ successTitle?: string;
9
+ successMessage?: string;
10
+ errorTitle?: string;
11
+ errorMessage?: string | (() => string | undefined);
12
+ loadingTitle?: string;
13
+ loadingMessage?: string;
14
+ errorChildren?: React.ReactNode;
15
+ } & PropsWithChildren>;
16
+ export default WizardResult;
@@ -0,0 +1,58 @@
1
+ import { jsx as o, jsxs as j, Fragment as s } from "react/jsx-runtime";
2
+ import { ArrowLeftOutlined as B, LoadingOutlined as C } from "@ant-design/icons";
3
+ import { Result as O } from "antd";
4
+ import e from "../button/Button.es.js";
5
+ import { useTranslationLib as r } from "../../locale/index.es.js";
6
+ const W = ({
7
+ errorChildren: p,
8
+ children: f,
9
+ onRetry: c,
10
+ onClickBack: m,
11
+ success: d,
12
+ loading: l,
13
+ error: t,
14
+ successTitle: v,
15
+ successMessage: a,
16
+ errorMessage: i,
17
+ errorTitle: y,
18
+ loadingTitle: T,
19
+ loadingMessage: h
20
+ }) => {
21
+ const { t: n } = r(), x = v ?? n("str.success"), b = y ?? n("str.error"), u = i ? typeof i == "function" ? i() : i : n("err.save"), L = T ?? n("message.loading.saving");
22
+ return /* @__PURE__ */ o(
23
+ O,
24
+ {
25
+ status: l ? void 0 : d ? "success" : t ? ["403", "404", "500"].includes(t == null ? void 0 : t.code) ? t.code : t ? "error" : void 0 : void 0,
26
+ title: l ? L : d ? x : t ? b : void 0,
27
+ icon: l ? /* @__PURE__ */ o(C, {}) : void 0,
28
+ subTitle: l ? h : d ? a : t ? typeof i == "function" ? i() ?? u : i ?? u : void 0,
29
+ extra: [
30
+ d ? /* @__PURE__ */ o(s, { children: f }) : t ? /* @__PURE__ */ j(s, { children: [
31
+ !!m && /* @__PURE__ */ o(
32
+ e,
33
+ {
34
+ onClick: m,
35
+ htmlType: "button",
36
+ type: "primary",
37
+ icon: /* @__PURE__ */ o(B, {}),
38
+ children: n("str.previous")
39
+ }
40
+ ),
41
+ !!c && /* @__PURE__ */ o(
42
+ e,
43
+ {
44
+ type: "primary",
45
+ onClick: () => c(void 0, void 0, !0),
46
+ children: n("str.retry")
47
+ },
48
+ "retry"
49
+ ),
50
+ p
51
+ ] }) : /* @__PURE__ */ o(s, {})
52
+ ]
53
+ }
54
+ );
55
+ };
56
+ export {
57
+ W as default
58
+ };
@@ -0,0 +1 @@
1
+ "use strict";const c=require("react/jsx-runtime"),w=require("antd"),o=require("react"),F=require("../appearance/Hider.cjs.js"),{Step:R}=w.Steps,y=o.forwardRef(({pages:d,onSubmit:u,initPosition:f=0,progressDot:v,type:b,labelPlacement:g,className:k,pageStyle:q},C)=>{const[s,i]=o.useState(0),[r,p]=o.useState([]);o.useEffect(()=>{i(f)},[f]),o.useImperativeHandle(C,()=>({gotTo:t=>i(t)}),[]);const m=o.useCallback((t,a=!1,l=!1)=>{const e=[...r];if(t!==void 0&&(e[s]=t,p(e)),l||i(s+1),a&&u){const n={};for(const x of e)for(const S in x)n[S]=x[S];u(e,n)}},[s,r,u]),h=o.useCallback(()=>{const t=[...r];t[s]=void 0,p(t),i(s-1)},[s,r]),j=o.useMemo(()=>{const t=[],a=[],l=d.filter(e=>!e.hidden);for(let e=0;e<l.length;e++){const n=l[e];a.push(c.jsx(F,{hide:s!==e,children:n.component({forward:m,backward:h},r,s===e)},`${n.title}${e}`)),t.push(c.jsx(R,{icon:n.icon,title:n.title},n.title))}return{_pages:a,steps:t}},[h,s,r,m,d]);return c.jsxs(c.Fragment,{children:[c.jsx(w.Steps,{labelPlacement:g,progressDot:v,className:[k,"pb-3"].join(" "),current:s,type:b,children:j.steps}),c.jsx("div",{style:q,children:j._pages})]})});module.exports=y;
@@ -0,0 +1,24 @@
1
+ import { default as React, ReactElement } from 'react';
2
+ interface WizardViewFormProps {
3
+ pages: {
4
+ hidden?: boolean;
5
+ icon?: React.ReactNode;
6
+ title: string;
7
+ component: (func: {
8
+ forward: (value?: any, submit?: boolean, isRetry?: boolean) => void;
9
+ backward: () => void;
10
+ }, formSubmissionData: any[], isActive: boolean) => ReactElement;
11
+ }[];
12
+ labelPlacement?: "vertical" | "horizontal";
13
+ initPosition?: number;
14
+ onSubmit?: (val: (any | undefined)[], combinedValue: any) => void;
15
+ type?: "default" | "navigation" | "inline";
16
+ className?: string;
17
+ progressDot?: boolean;
18
+ pageStyle?: React.CSSProperties;
19
+ }
20
+ export interface WizardViewFormRef {
21
+ gotTo: (index: number) => void;
22
+ }
23
+ declare const WizardViewForm: React.ForwardRefExoticComponent<WizardViewFormProps & React.RefAttributes<WizardViewFormRef>>;
24
+ export default WizardViewForm;
@@ -0,0 +1,74 @@
1
+ import { jsx as f, jsxs as H, Fragment as _ } from "react/jsx-runtime";
2
+ import { Steps as b } from "antd";
3
+ import { forwardRef as $, useState as S, useEffect as z, useImperativeHandle as E, useCallback as g, useMemo as I } from "react";
4
+ import M from "../appearance/Hider.es.js";
5
+ const { Step: N } = b, q = $(
6
+ ({
7
+ pages: a,
8
+ onSubmit: l,
9
+ initPosition: d = 0,
10
+ progressDot: j,
11
+ type: k,
12
+ labelPlacement: x,
13
+ className: F,
14
+ pageStyle: y
15
+ }, C) => {
16
+ const [t, n] = S(0), [r, m] = S(
17
+ []
18
+ );
19
+ z(() => {
20
+ n(d);
21
+ }, [d]), E(
22
+ C,
23
+ () => ({
24
+ gotTo: (s) => n(s)
25
+ }),
26
+ []
27
+ );
28
+ const p = g(
29
+ (s, c = !1, i = !1) => {
30
+ const e = [...r];
31
+ if (s !== void 0 && (e[t] = s, m(e)), i || n(t + 1), c && l) {
32
+ const o = {};
33
+ for (const w of e)
34
+ for (const v in w)
35
+ o[v] = w[v];
36
+ l(e, o);
37
+ }
38
+ },
39
+ [t, r, l]
40
+ ), u = g(() => {
41
+ const s = [...r];
42
+ s[t] = void 0, m(s), n(t - 1);
43
+ }, [t, r]), h = I(() => {
44
+ const s = [], c = [], i = a.filter((e) => !e.hidden);
45
+ for (let e = 0; e < i.length; e++) {
46
+ const o = i[e];
47
+ c.push(
48
+ /* @__PURE__ */ f(M, { hide: t !== e, children: o.component({ forward: p, backward: u }, r, t === e) }, `${o.title}${e}`)
49
+ ), s.push(/* @__PURE__ */ f(N, { icon: o.icon, title: o.title }, o.title));
50
+ }
51
+ return {
52
+ _pages: c,
53
+ steps: s
54
+ };
55
+ }, [u, t, r, p, a]);
56
+ return /* @__PURE__ */ H(_, { children: [
57
+ /* @__PURE__ */ f(
58
+ b,
59
+ {
60
+ labelPlacement: x,
61
+ progressDot: j,
62
+ className: [F, "pb-3"].join(" "),
63
+ current: t,
64
+ type: k,
65
+ children: h.steps
66
+ }
67
+ ),
68
+ /* @__PURE__ */ f("div", { style: y, children: h._pages })
69
+ ] });
70
+ }
71
+ );
72
+ export {
73
+ q as default
74
+ };
@@ -0,0 +1,3 @@
1
+ import { default as WizardResult } from './WizardResult';
2
+ import { default as WizardViewForm } from './WizardViewForm';
3
+ export { WizardResult, WizardViewForm };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react-responsive");function t(){const s=e.useMediaQuery({minWidth:768}),i=e.useMediaQuery({maxWidth:767});return{isDesktop:s,isMobile:i}}module.exports=t;
@@ -0,0 +1,4 @@
1
+ export default function useWindowDimensions(): {
2
+ isDesktop: boolean;
3
+ isMobile: boolean;
4
+ };
@@ -0,0 +1,8 @@
1
+ import { useMediaQuery as i } from "react-responsive";
2
+ function t() {
3
+ const e = i({ minWidth: 768 }), o = i({ maxWidth: 767 });
4
+ return { isDesktop: e, isMobile: o };
5
+ }
6
+ export {
7
+ t as default
8
+ };
@@ -0,0 +1 @@
1
+ export { default as useWindowDimensions } from './WindowDimension';
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react/jsx-runtime"),l=require("antd"),t=require("react"),H=require("./modal/index.cjs.js"),J=require("./import/CrudImportButton.cjs.js"),K=require("./view/CrudViewer.cjs.js"),L=require("../common/button/NewButton.cjs.js"),M=require("../common/button/PrintButton.cjs.js"),{useForm:Q}=l.Form;function O({idField:a="id",onCreate:C,onDelete:j,onHide:m,onUpdate:n,fields:r,data:f,grid:k,isHiding:q,isCreating:h,isDeleting:p,isUpdating:B,paginateProps:w,onPrint:i,printing:N,viewable:v,loadingData:R,formBuilder:g,extraAction:y,minusHeight:b,cloneable:F,fullWidthModal:P=!0,wizard:S,extraView:I,importable:u,onClickNew:d,size:V,...z}){const c=t.useRef(null),A=t.useCallback(()=>{var s;(s=c.current)==null||s.create()},[]),o=t.useCallback(async(s,E=!0,G=!1)=>{var x;await((x=c.current)==null?void 0:x.update(s,E,G))},[]),D=t.useCallback(async s=>{o(s,!1,!0)},[o]);return e.jsxs(e.Fragment,{children:[e.jsxs(l.Space,{direction:"vertical",className:"w-100",children:[e.jsxs("div",{className:"w-100 d-flex",children:[e.jsx("div",{style:{flex:1},children:e.jsx(L.NewButton,{onClick:()=>{d?d():A()},className:"flex-1"})}),e.jsxs(l.Space,{children:[!!i&&e.jsx(M.PrintButton,{className:"float-right",loading:N,onClick:i}),!!u&&e.jsx(J,{fields:r,importProps:u})]})]}),e.jsx(K,{...z,minusHeight:b,data:f,size:V,fields:r,extraAction:y,idField:a,isDeleting:p,loadingData:R,onClickUpdate:n?o:void 0,onHide:m,isHiding:q,onDelete:j,onUpdate:n,onClickClone:F?D:void 0,paginateProps:w,viewable:v,extraView:I})]}),e.jsx(H,{ref:c,fields:r,wizard:S,grid:k,fullWidthModal:P,isCreating:h,isUpdating:B,onCreate:C,onUpdate:n,idField:a,formBuilder:g})]})}module.exports=O;
@@ -0,0 +1,245 @@
1
+ import { ColorPickerProps } from 'antd';
2
+ import { Rule } from 'antd/es/form';
3
+ import { FormInstance } from 'antd/lib';
4
+ import { Dayjs } from 'dayjs';
5
+ import { default as React, ReactElement, ReactNode } from 'react';
6
+ import { CrudSearchComponentProps } from './CrudSearchComponent';
7
+ import { FileCrudField } from './FileCrudField';
8
+ import { ImageCrudField } from './ImageCrudField';
9
+ import { CrudImportProps } from './import/CrudImportComponent';
10
+ import { CrudDragableProps, CrudViewableProps } from './view/CrudViewer';
11
+ import { SelectTagRenderProps } from '../common/select/SelectComponent';
12
+ import { default as IdProps } from '../types/Id';
13
+ import { TextAreaBasedFieldProps } from './CrudTextAreaComponent';
14
+ import { SizeType } from 'antd/es/config-provider/SizeContext';
15
+ export type SelectFieldItem = {
16
+ key?: string | number;
17
+ value: string | number;
18
+ disabled?: boolean;
19
+ };
20
+ export interface InitialCrudField<T> {
21
+ label: string;
22
+ fieldHelper?: ReactNode;
23
+ updatingValue?: T;
24
+ render?: (value: any, obj: T, index: number) => any;
25
+ required?: boolean;
26
+ updatable?: boolean;
27
+ fieldTooltip?: string;
28
+ hideInTable?: boolean;
29
+ hideInDescList?: boolean;
30
+ readonly?: boolean;
31
+ fieldClassName?: string;
32
+ halign?: "right" | "left";
33
+ /**
34
+ * Indicates the fields is visible or not
35
+ */
36
+ hidden?: boolean;
37
+ width?: number | string;
38
+ name: keyof T | (string | number)[];
39
+ rules?: Rule[];
40
+ grid?: CrudFieldGrid;
41
+ report?: {
42
+ searchable?: boolean;
43
+ sortable?: boolean;
44
+ defaultSort?: boolean | "ASC" | "DESC";
45
+ lock?: boolean;
46
+ alreadySelected?: boolean;
47
+ customRender?: (form: FormInstance<any>) => ReactElement;
48
+ };
49
+ customFormFieldRender?: (form: FormInstance<T>, props: InitialCrudField<T>) => React.ReactElement;
50
+ importProps?: {
51
+ extraFields?: string[];
52
+ hidden?: boolean;
53
+ };
54
+ hideLabel?: boolean;
55
+ }
56
+ export type CrudFieldGrid = {
57
+ xs?: number;
58
+ sm?: number;
59
+ md?: number;
60
+ lg?: number;
61
+ xl?: number;
62
+ xxl?: number;
63
+ };
64
+ export interface SelectCrudField<T, ItemType extends SelectFieldItem = SelectFieldItem> extends Omit<InitialCrudField<T>, "name">, AddonFieldProps {
65
+ name: InitialCrudField<T>["name"] | {
66
+ name: keyof T | (string | number)[];
67
+ upsertFieldName: keyof T | (string | number)[];
68
+ };
69
+ type: "select";
70
+ placeholder?: string;
71
+ /**
72
+ * @default true
73
+ */
74
+ allowClear?: boolean;
75
+ /**
76
+ * Used when the type is 'select'
77
+ */
78
+ innerFieldId?: string;
79
+ innerFieldLabel?: string;
80
+ /**
81
+ * Used when the type is 'select'
82
+ */
83
+ items: ItemType[];
84
+ tagRender?: SelectTagRenderProps;
85
+ /**
86
+ * Whether the search should be highlighted
87
+ */
88
+ highlightSearch?: boolean;
89
+ /**
90
+ * Used when the type is 'select'
91
+ */
92
+ loading?: boolean;
93
+ /**
94
+ * Used when the type is 'select'
95
+ */
96
+ onSearch?: (keyword: any, form: FormInstance<T>, record: T | undefined) => void;
97
+ /**
98
+ * Used when the type is 'select'. Wether the result should refresh if the search value is changed.
99
+ */
100
+ searchOnType?: boolean;
101
+ multiple?: boolean;
102
+ report?: InitialCrudField<T>["report"] & {
103
+ multiple?: boolean;
104
+ };
105
+ onChange?: (value: any, form: FormInstance<T>) => void;
106
+ onSet?: (value: any | any[], items: SelectFieldItem[], form: FormInstance<T>) => void;
107
+ }
108
+ export interface EnumCrudField<T> extends InitialCrudField<T> {
109
+ type: "enum";
110
+ placeholder?: string;
111
+ name: keyof T;
112
+ enum: object | object[];
113
+ radio?: boolean;
114
+ translation?: object;
115
+ multiple?: boolean;
116
+ tagRender?: Record<string, {
117
+ color: string;
118
+ }> | SelectTagRenderProps;
119
+ onChange?: (value: T[keyof T], form: FormInstance<T>) => void;
120
+ onSearch?: (keyword: string, form: FormInstance<T>) => void;
121
+ }
122
+ export type AddonFieldProps = {
123
+ addonAfter?: ReactNode;
124
+ addonBefore?: ReactNode;
125
+ };
126
+ export interface ObjectCrudField<T> extends InitialCrudField<T> {
127
+ type: "object";
128
+ render: (value: any, obj: T, index: number) => any;
129
+ translation?: object;
130
+ }
131
+ export interface TextBasedFieldProps<T> extends InitialCrudField<T>, AddonFieldProps {
132
+ placeholder?: string;
133
+ type: "text" | "time" | "email" | "password";
134
+ onChange?: (value: string, form: FormInstance<T>) => void;
135
+ }
136
+ export interface ColorPickerFieldProps<T> extends Omit<InitialCrudField<T>, "placeholder"> {
137
+ type: "color";
138
+ innerProps?: ColorPickerProps;
139
+ }
140
+ export interface CheckboxBasedFieldProps<T> extends InitialCrudField<T> {
141
+ type: "checkbox";
142
+ onChange?: (value: boolean, form: FormInstance<T>) => void;
143
+ }
144
+ export interface NumberBasedFieldProps<T> extends InitialCrudField<T>, AddonFieldProps {
145
+ type: "number";
146
+ placeholder?: string;
147
+ allowMinus?: boolean;
148
+ min?: number;
149
+ max?: number;
150
+ /**
151
+ * If it is number field making this true will convert the value to comma separated number field
152
+ */
153
+ formatted?: boolean;
154
+ int?: boolean;
155
+ onChange?: (value: number, form: FormInstance<T>) => void;
156
+ }
157
+ export interface DateBasedFieldProps<T> extends InitialCrudField<T> {
158
+ type: "date";
159
+ format?: string;
160
+ placeholder?: string;
161
+ /**
162
+ * If it is number field making this true will convert the value to comma separated number field
163
+ */
164
+ formatTime?: boolean;
165
+ range?: boolean;
166
+ disableToday?: boolean;
167
+ disabledFutureDays?: boolean;
168
+ disabledPastDays?: boolean;
169
+ report?: InitialCrudField<T>["report"] & {
170
+ range?: boolean;
171
+ required?: boolean;
172
+ };
173
+ onChange?: (value: Dayjs | undefined, form: FormInstance<T>) => void;
174
+ }
175
+ export interface TimeBasedFieldProps<T> extends InitialCrudField<T> {
176
+ type: "time";
177
+ placeholder?: string;
178
+ use12Hours?: boolean;
179
+ range?: boolean;
180
+ format?: "h:mm:ss" | "h:mm:ss A" | "h:mm" | "h:mm A" | "mm" | "h" | "h A";
181
+ disableCurrent?: boolean;
182
+ disabledFuture?: boolean;
183
+ disabledPast?: boolean;
184
+ report?: InitialCrudField<T>["report"] & {
185
+ range?: boolean;
186
+ };
187
+ onChange?: (value: Dayjs | undefined, form: FormInstance<T>) => void;
188
+ }
189
+ export type CrudPurpose = "new" | "clone" | "update";
190
+ export type GetFormFieldOptions = {
191
+ onChange?: (value: any) => void;
192
+ render?: (component: React.JSX.Element) => React.ReactElement;
193
+ };
194
+ export type FormBuilderFunc0<T> = (name: keyof T, options?: GetFormFieldOptions) => ReactElement;
195
+ export type FormBuilderFunc<T> = (i: FormBuilderFunc0<T>, otherUtils: {
196
+ isAnyFieldHidden: (...name: Array<keyof T>) => boolean;
197
+ isAllFieldsHidden: (...name: Array<keyof T>) => boolean;
198
+ purpose?: CrudPurpose;
199
+ }) => ReactElement;
200
+ export type CrudFieldProps<T> = SelectCrudField<T> | TextBasedFieldProps<T> | TextAreaBasedFieldProps<T> | ImageCrudField<T> | EnumCrudField<T> | DateBasedFieldProps<T> | TimeBasedFieldProps<T> | ObjectCrudField<T> | NumberBasedFieldProps<T> | CheckboxBasedFieldProps<T> | ColorPickerFieldProps<T> | FileCrudField<T>;
201
+ export type CrudPaginateProps = false | {
202
+ page?: number;
203
+ setPage?: (page: number, pageSize?: number) => void;
204
+ pageSize?: number;
205
+ count?: number;
206
+ };
207
+ export type CrudWizardProp<T> = {
208
+ title: string;
209
+ fields: Array<keyof T>;
210
+ icon?: ReactElement;
211
+ formBuilder?: FormBuilderFunc<T>;
212
+ grid?: boolean;
213
+ };
214
+ export type CrudComponentProps<T, FormType = T> = {
215
+ fields: CrudFieldProps<T>[];
216
+ data: T[] | undefined;
217
+ idField?: string;
218
+ grid?: boolean;
219
+ onPrint?: () => void;
220
+ printing?: boolean;
221
+ onCreate?: (t: FormType) => Promise<any>;
222
+ onHide?: (id: any) => Promise<any>;
223
+ onDelete?: (id: any) => Promise<any>;
224
+ onUpdate?: (t: FormType & IdProps) => Promise<any>;
225
+ loadingData?: boolean;
226
+ isCreating?: boolean;
227
+ isHiding?: boolean;
228
+ isDeleting?: boolean;
229
+ isUpdating?: boolean;
230
+ viewable?: CrudViewableProps<T>;
231
+ extraAction?: (t: T) => ReactElement;
232
+ paginateProps?: CrudPaginateProps;
233
+ formBuilder?: FormBuilderFunc<T>;
234
+ minusHeight?: string;
235
+ cloneable?: boolean;
236
+ fullWidthModal?: boolean;
237
+ wizard?: CrudWizardProp<T>[];
238
+ extraView?: (t: T) => React.ReactElement;
239
+ importable?: CrudImportProps<T>;
240
+ onClickNew?: () => void;
241
+ draggable?: CrudDragableProps<T>;
242
+ size?: SizeType;
243
+ } & CrudSearchComponentProps<T, FormType>;
244
+ declare function CrudComponent<T, FormType = T>({ idField, onCreate, onDelete, onHide, onUpdate, fields, data, grid, isHiding, isCreating, isDeleting, isUpdating, paginateProps, onPrint, printing, viewable, loadingData, formBuilder, extraAction, minusHeight, cloneable, fullWidthModal, wizard, extraView, importable, onClickNew, size, ...props }: CrudComponentProps<T, FormType>): import("react/jsx-runtime").JSX.Element;
245
+ export default CrudComponent;