@kingteza/crud-component 1.0.14 → 1.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/components/common/DatePicker/DatePicker.cjs +1 -1
  2. package/dist/components/common/DatePicker/DatePicker.js +42 -42
  3. package/dist/components/common/DatePicker/TimePicker.cjs +1 -1
  4. package/dist/components/common/DatePicker/TimePicker.js +39 -39
  5. package/dist/components/common/appearance/Hider.cjs +1 -1
  6. package/dist/components/common/appearance/Hider.js +3 -3
  7. package/dist/components/common/button/Button.cjs +1 -1
  8. package/dist/components/common/button/Button.js +19 -19
  9. package/dist/components/common/button/CloneButtonTable.cjs +1 -1
  10. package/dist/components/common/button/CloneButtonTable.js +11 -11
  11. package/dist/components/common/button/DeleteButtonTable.cjs +1 -1
  12. package/dist/components/common/button/DeleteButtonTable.js +29 -29
  13. package/dist/components/common/button/ExportButton.cjs +1 -1
  14. package/dist/components/common/button/ExportButton.js +17 -17
  15. package/dist/components/common/button/HideButtonTable.cjs +1 -1
  16. package/dist/components/common/button/HideButtonTable.js +35 -35
  17. package/dist/components/common/button/ImportButton.cjs +1 -1
  18. package/dist/components/common/button/ImportButton.js +28 -28
  19. package/dist/components/common/button/NewButton.cjs +1 -1
  20. package/dist/components/common/button/NewButton.js +14 -14
  21. package/dist/components/common/button/PrintButton.cjs +1 -1
  22. package/dist/components/common/button/PrintButton.js +14 -14
  23. package/dist/components/common/button/RefreshButton.cjs +1 -1
  24. package/dist/components/common/button/RefreshButton.js +16 -16
  25. package/dist/components/common/button/UnHideButton.cjs +1 -1
  26. package/dist/components/common/button/UnHideButton.js +37 -37
  27. package/dist/components/common/button/UpdateButtonTable.cjs +1 -1
  28. package/dist/components/common/button/UpdateButtonTable.js +11 -11
  29. package/dist/components/common/button/ViewButtonTable.cjs +1 -1
  30. package/dist/components/common/button/ViewButtonTable.js +10 -10
  31. package/dist/components/common/check-box/CheckBox.cjs +1 -1
  32. package/dist/components/common/check-box/CheckBox.js +20 -20
  33. package/dist/components/common/description/DescList.cjs +1 -1
  34. package/dist/components/common/description/DescList.js +9 -9
  35. package/dist/components/common/layout/VerticalSpace.cjs +1 -1
  36. package/dist/components/common/layout/VerticalSpace.js +3 -3
  37. package/dist/components/common/loading/LoadingIndicator.cjs +1 -1
  38. package/dist/components/common/loading/LoadingIndicator.js +12 -12
  39. package/dist/components/common/picker/ImagePicker.cjs +1 -1
  40. package/dist/components/common/picker/ImagePicker.js +173 -176
  41. package/dist/components/common/radio/RadioGroupComponent.cjs +1 -1
  42. package/dist/components/common/radio/RadioGroupComponent.js +6 -6
  43. package/dist/components/common/report/SelectFieldInReport.cjs +1 -1
  44. package/dist/components/common/report/SelectFieldInReport.js +11 -11
  45. package/dist/components/common/select/CustomSelectOption.cjs +1 -1
  46. package/dist/components/common/select/CustomSelectOption.js +7 -7
  47. package/dist/components/common/select/SelectComponent.cjs +1 -1
  48. package/dist/components/common/select/SelectComponent.js +36 -36
  49. package/dist/components/common/show-more/index.cjs +1 -1
  50. package/dist/components/common/show-more/index.js +5 -5
  51. package/dist/components/common/tab/TabViewWithRoute.cjs +1 -1
  52. package/dist/components/common/tab/TabViewWithRoute.js +23 -22
  53. package/dist/components/common/table/table.cjs +1 -1
  54. package/dist/components/common/table/table.js +12 -12
  55. package/dist/components/common/tag/StatusTag.cjs +1 -1
  56. package/dist/components/common/tag/StatusTag.js +13 -13
  57. package/dist/components/common/text-field/NumberField.cjs +1 -1
  58. package/dist/components/common/text-field/NumberField.js +43 -43
  59. package/dist/components/common/text-field/PhoneNumberField.cjs +1 -1
  60. package/dist/components/common/text-field/PhoneNumberField.js +4 -4
  61. package/dist/components/common/text-field/TextArea.cjs +1 -1
  62. package/dist/components/common/text-field/TextArea.js +20 -20
  63. package/dist/components/common/text-field/TextField.cjs +1 -1
  64. package/dist/components/common/text-field/TextField.js +47 -47
  65. package/dist/components/common/tooltip/TooltipComponent.cjs +1 -1
  66. package/dist/components/common/tooltip/TooltipComponent.js +3 -3
  67. package/dist/components/common/wizard/WizardResult.cjs +1 -1
  68. package/dist/components/common/wizard/WizardResult.js +37 -38
  69. package/dist/components/common/wizard/WizardViewForm.cjs +1 -1
  70. package/dist/components/common/wizard/WizardViewForm.js +43 -43
  71. package/dist/components/crud/CrudComponent.cjs +1 -1
  72. package/dist/components/crud/CrudComponent.js +130 -130
  73. package/dist/components/crud/CrudField.cjs +1 -1
  74. package/dist/components/crud/CrudField.js +217 -217
  75. package/dist/components/crud/CrudForm.cjs +1 -1
  76. package/dist/components/crud/CrudForm.js +55 -55
  77. package/dist/components/crud/CrudFormWizard.cjs +1 -1
  78. package/dist/components/crud/CrudFormWizard.js +82 -84
  79. package/dist/components/crud/CrudReportComponent.cjs +3 -3
  80. package/dist/components/crud/CrudReportComponent.js +123 -123
  81. package/dist/components/crud/CrudSearchComponent.cjs +1 -1
  82. package/dist/components/crud/CrudSearchComponent.js +43 -43
  83. package/dist/components/crud/FileCrudField.cjs +1 -1
  84. package/dist/components/crud/FileCrudField.js +118 -125
  85. package/dist/components/crud/ImageCrudField.cjs +1 -1
  86. package/dist/components/crud/ImageCrudField.js +56 -56
  87. package/dist/components/crud/import/CrudImportButton.cjs +1 -1
  88. package/dist/components/crud/import/CrudImportButton.js +18 -18
  89. package/dist/components/crud/import/CrudImportComponent.cjs +2 -2
  90. package/dist/components/crud/import/CrudImportComponent.js +108 -109
  91. package/dist/components/crud/view/CrudDecListView.cjs +1 -1
  92. package/dist/components/crud/view/CrudDecListView.js +22 -22
  93. package/dist/components/crud/view/CrudViewer.cjs +1 -1
  94. package/dist/components/crud/view/CrudViewer.js +152 -152
  95. package/dist/components/crud/view/CrudViewerUtil.cjs +1 -1
  96. package/dist/components/crud/view/CrudViewerUtil.js +33 -34
  97. package/dist/locale/index.cjs +1 -1
  98. package/dist/locale/index.js +2 -2
  99. package/dist/util/DateUtil.cjs +1 -1
  100. package/dist/util/DateUtil.js +4 -4
  101. package/dist/util/ImageUtil.cjs +1 -1
  102. package/dist/util/ImageUtil.js +1 -1
  103. package/dist/util/ValidationUtil.cjs +1 -1
  104. package/dist/util/ValidationUtil.js +1 -1
  105. package/package.json +1 -1
@@ -1,118 +1,118 @@
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 { TRANSLATION_NAMESPACE as fr } from "../../../locale/hooks/translation-constants.js";
14
- import cr from "../CrudSearchComponent.js";
15
- import { CrudDecListView as lr } from "./CrudDecListView.js";
16
- import { getRendererValueCrudViewer as V } from "./CrudViewerUtil.js";
17
- import { useTranslation as jr } from "../../../node_modules/react-i18next/dist/es/useTranslation.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 = [],
1
+ import { jsxs as v, Fragment as M, jsx as n } from "react/jsx-runtime";
2
+ import { Modal as U } from "antd";
3
+ import F from "../../common/button/CloneButtonTable.js";
4
+ import rr from "../../common/button/DeleteButtonTable.js";
5
+ import { ExportButton as or } from "../../common/button/ExportButton.js";
6
+ import tr from "../../common/button/HideButtonTable.js";
7
+ import { RefreshButton as mr } from "../../common/button/RefreshButton.js";
8
+ import ur from "../../common/button/UpdateButtonTable.js";
9
+ import nr from "../../common/button/ViewButtonTable.js";
10
+ import fr from "../../common/layout/VerticalSpace.js";
11
+ import cr from "../../common/table/table.js";
12
+ import { useMemo as $, useState as q, useEffect as er, useCallback as lr } from "react";
13
+ import { useTranslation as sr } from "react-i18next";
14
+ import { TRANSLATION_NAMESPACE as hr } from "../../../locale/hooks/translation-constants.js";
15
+ import ar from "../CrudSearchComponent.js";
16
+ import { CrudDecListView as vr } from "./CrudDecListView.js";
17
+ import { getRendererValueCrudViewer as A } from "./CrudViewerUtil.js";
18
+ function _r({
19
+ idField: t = "id",
20
+ loadingData: G,
21
+ fields: e,
22
+ isDeleting: S,
23
+ isHiding: b,
24
+ viewable: f = !1,
25
+ paginateProps: s,
26
+ onDelete: h,
27
+ onHide: i,
28
+ onUpdate: T,
29
+ data: y = [],
30
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,
31
+ onClickUpdate: c,
32
+ minusHeight: N,
33
+ scroll: J,
34
+ onClickClone: B,
35
+ className: K,
36
+ expandable: Q,
37
+ size: W,
38
+ bordered: X,
39
+ descListColumn: Y,
40
+ extraView: g,
41
+ decListLayout: Z,
42
+ scrollToTop: Tr,
43
+ onClickRefresh: O,
44
44
  closeViewOnClickUpdate: R,
45
- onExport: S,
46
- confirmHiding: E,
47
- confirmDeleting: M,
48
- rowClassName: X,
49
- actionWidth: Y = 190,
50
- ...Z
45
+ onExport: I,
46
+ confirmHiding: z,
47
+ confirmDeleting: E,
48
+ rowClassName: d,
49
+ actionWidth: P = 190,
50
+ ...w
51
51
  }) {
52
- const { t: d } = jr(fr), 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,
52
+ const { t: D } = sr(hr), L = $(
53
+ () => e.map(
54
+ ({ hideInTable: r, hidden: o, width: l, name: u, label: H, halign: x, ...V }) => ({
55
+ title: H,
56
+ width: l,
57
57
  key: u,
58
58
  dataIndex: u,
59
- hidden: o || t,
60
- align: D ?? (z.type === "number" ? "right" : void 0),
61
- render: V(z)
59
+ hidden: r || o,
60
+ align: x ?? (V.type === "number" ? "right" : void 0),
61
+ render: A(V)
62
62
  })
63
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]);
64
+ [e]
65
+ ), [m, p] = q(), [C, j] = q();
66
+ er(() => {
67
+ y && p((r) => {
68
+ if (r)
69
+ return y.find((o) => o[t] === r[t]);
70
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,
71
+ }, [y, t, m]);
72
+ const _ = lr(
73
+ (r) => {
74
+ var l;
75
+ const o = a == null ? void 0 : a(r);
76
+ return (Array.isArray(o) ? (l = o == null ? void 0 : o.filter(Boolean)) != null && l.length : o) || T || c || B || h ? /* @__PURE__ */ v(M, { children: [
77
+ o,
78
+ (T || c) && /* @__PURE__ */ n(
79
+ ur,
80
80
  {
81
- value: o,
81
+ value: r,
82
82
  onClick: (u) => {
83
- g(u[s]), e == null || e(o), R && x(void 0);
83
+ j(u[t]), c == null || c(r), R && p(void 0);
84
84
  }
85
85
  }
86
86
  ),
87
- T && /* @__PURE__ */ r.jsx(H, { value: o, onClick: (u) => T(u) }),
88
- S && /* @__PURE__ */ r.jsx(
89
- F,
87
+ B && /* @__PURE__ */ n(F, { value: r, onClick: (u) => B(u) }),
88
+ I && /* @__PURE__ */ n(
89
+ or,
90
90
  {
91
- value: o,
92
- onClick: async (u) => await S(u)
91
+ value: r,
92
+ onClick: async (u) => await I(u)
93
93
  }
94
94
  ),
95
- p && /* @__PURE__ */ r.jsx(
96
- rr,
95
+ i && /* @__PURE__ */ n(
96
+ tr,
97
97
  {
98
- value: o,
99
- disabled: B,
100
- shouldConfirm: E,
101
- loading: B && o[s] === b,
98
+ value: r,
99
+ disabled: b,
100
+ shouldConfirm: z,
101
+ loading: b && r[t] === C,
102
102
  onClick: async (u) => {
103
- g(u[s]), await p({ [s]: u[s] });
103
+ j(u[t]), await i({ [t]: u[t] });
104
104
  }
105
105
  }
106
106
  ),
107
- j && /* @__PURE__ */ r.jsx(
108
- U,
107
+ h && /* @__PURE__ */ n(
108
+ rr,
109
109
  {
110
- value: o,
111
- disabled: y,
112
- shouldConfirm: M,
113
- loading: y && o[s] === b,
110
+ value: r,
111
+ disabled: S,
112
+ shouldConfirm: E,
113
+ loading: S && r[t] === C,
114
114
  onClick: async (u) => {
115
- g(u[s]), await j({ [s]: u[s] });
115
+ j(u[t]), await h({ [t]: u[t] });
116
116
  }
117
117
  }
118
118
  )
@@ -120,98 +120,98 @@ function Or({
120
120
  },
121
121
  [
122
122
  R,
123
- M,
124
123
  E,
124
+ z,
125
125
  a,
126
- s,
127
- y,
128
- B,
129
- T,
130
- e,
131
- j,
126
+ t,
132
127
  S,
133
- p,
128
+ b,
129
+ B,
130
+ c,
134
131
  h,
135
- b
132
+ I,
133
+ i,
134
+ T,
135
+ C
136
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,
137
+ ), k = $(() => {
138
+ let r = typeof f == "string" ? m == null ? void 0 : m[f] : void 0;
139
+ if (typeof r == "object") {
140
+ const o = e.find((l) => l.name === f);
141
+ r = A(o)(
142
+ r,
143
143
  m,
144
144
  0
145
145
  );
146
146
  }
147
- return o;
148
- }, [n, m, f]);
149
- return /* @__PURE__ */ r.jsxs("div", { children: [
150
- n && /* @__PURE__ */ r.jsx(
151
- k,
147
+ return r;
148
+ }, [f, m, e]);
149
+ return /* @__PURE__ */ v("div", { children: [
150
+ f && /* @__PURE__ */ n(
151
+ U,
152
152
  {
153
153
  width: "100%",
154
154
  open: !!m,
155
- title: P ?? /* @__PURE__ */ r.jsx("div", { children: " " }),
156
- footer: /* @__PURE__ */ r.jsx(r.Fragment, {}),
155
+ title: k ?? /* @__PURE__ */ n("div", { children: " " }),
156
+ footer: /* @__PURE__ */ n(M, {}),
157
157
  closable: !0,
158
- onCancel: () => x(void 0),
159
- children: !!m && /* @__PURE__ */ r.jsxs("div", { children: [
160
- /* @__PURE__ */ r.jsx(
161
- lr,
158
+ onCancel: () => p(void 0),
159
+ children: !!m && /* @__PURE__ */ v("div", { children: [
160
+ /* @__PURE__ */ n(
161
+ vr,
162
162
  {
163
- layout: W,
164
- descListColumn: Q,
163
+ layout: Z,
164
+ descListColumn: Y,
165
165
  data: m,
166
- fields: f,
167
- action: O(m)
166
+ fields: e,
167
+ action: _(m)
168
168
  }
169
169
  ),
170
- i == null ? void 0 : i(m)
171
- ] }, m == null ? void 0 : m[s])
170
+ g == null ? void 0 : g(m)
171
+ ] }, m == null ? void 0 : m[t])
172
172
  }
173
173
  ),
174
- /* @__PURE__ */ r.jsx(cr, { fields: f, ...Z }),
175
- /* @__PURE__ */ r.jsxs(mr, { children: [
176
- !!C && /* @__PURE__ */ r.jsx(or, { onClick: C }),
177
- /* @__PURE__ */ r.jsx(
178
- ur,
174
+ /* @__PURE__ */ n(ar, { fields: e, ...w }),
175
+ /* @__PURE__ */ v(fr, { children: [
176
+ !!O && /* @__PURE__ */ n(mr, { onClick: O }),
177
+ /* @__PURE__ */ n(
178
+ cr,
179
179
  {
180
- rowClassName: X,
181
- className: A,
182
- scroll: q ?? (I ? {
183
- y: `calc(100vh - ${I})`
180
+ rowClassName: d,
181
+ className: K,
182
+ scroll: J ?? (N ? {
183
+ y: `calc(100vh - ${N})`
184
184
  } : void 0),
185
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
186
+ dataSource: y,
187
+ loading: G,
188
+ bordered: X,
189
+ size: W,
190
+ expandable: Q,
191
+ pagination: s ? {
192
+ total: s.count,
193
+ onChange: s.setPage,
194
+ current: s.page,
195
+ pageSize: s.pageSize
196
196
  } : void 0,
197
- columns: h || e || j || a || n ? [
198
- ...N,
197
+ columns: T || c || h || a || f ? [
198
+ ...L,
199
199
  {
200
- title: d("str.action"),
200
+ title: D("str.action"),
201
201
  dataIndex: "",
202
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)
203
+ width: P,
204
+ render: (r, o) => /* @__PURE__ */ v(M, { children: [
205
+ f && /* @__PURE__ */ n(nr, { value: o, onClick: p }),
206
+ _(o)
207
207
  ] })
208
208
  }
209
- ] : N
209
+ ] : L
210
210
  }
211
211
  )
212
212
  ] })
213
213
  ] });
214
214
  }
215
215
  export {
216
- Or as default
216
+ _r as default
217
217
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../../../_virtual/jsx-runtime.cjs"),m=require("antd"),x=require("../../common/show-more/index.cjs"),j=require("../FileCrudField.cjs"),v=require("../ImageCrudField.cjs"),y=require("../../../locale/hooks/translation-constants.cjs"),C=require("../../../node_modules/i18next/dist/esm/i18next.cjs"),r=require("../../../util/DateUtil.cjs"),s=require("../../../util/NumberUtil.cjs"),g=require("../../../node_modules/@ant-design/icons/es/icons/CheckOutlined.cjs"),d=require("../../../node_modules/@ant-design/icons/es/icons/CloseOutlined.cjs");function q({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 c=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(!c&&typeof t=="string"||typeof t=="number")&&(c=t),typeof i=="function"?i(c,u,e):Array.isArray(c)?c.join(", "):c}:a==="number"?(t,u,e)=>typeof i=="function"?i(t,u,e):n!=null&&n.int?s.default.toInt(t,n.formatted):s.default.toMoney(t):a==="enum"?(t,u,e)=>{var c;const o=C.t(((c=n==null?void 0:n.translation)==null?void 0:c[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.formatDateTime(t):r.formatDate(t);return typeof i=="function"?i(t,u,e):o}:a==="checkbox"?(t,u,e)=>typeof i=="function"?i(t,u,e):t?l.jsxRuntimeExports.jsx(g,{}):l.jsxRuntimeExports.jsx(d,{}):a==="image"?(t,u,e)=>typeof i=="function"?i(t,u,e):l.jsxRuntimeExports.jsx(v.ImageCrudCellValue,{value:t,provider:n.provider}):a==="file"?(t,u,e)=>typeof i=="function"?i(t,u,e):l.jsxRuntimeExports.jsx(j.FileCrudCellValue,{value:t,provider:n.provider}):a==="time"?(t,u,e)=>{if(!t)return"-";const o=n==null?void 0:n.format,c=n==null?void 0:n.use12Hours,f=r.formatTime(t,o||(c?"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("#")?l.jsxRuntimeExports.jsx(m.Tooltip,{title:t,children:l.jsxRuntimeExports.jsx(m.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?l.jsxRuntimeExports.jsx(x.ShowMore,{lines:o===!0?1:o,children:t}):t}:typeof i=="function"?i:t=>t}exports.getRendererValueCrudViewer=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),m=require("@ant-design/icons"),s=require("antd"),y=require("../../common/show-more/index.cjs"),C=require("../FileCrudField.cjs"),g=require("../ImageCrudField.cjs"),x=require("../../../locale/hooks/translation-constants.cjs"),d=require("i18next"),r=require("../../../util/DateUtil.cjs"),v=require("../../../util/NumberUtil.cjs");function j({type:a,render:i,...n}){return a==="object"?(t,u,o)=>typeof i=="function"?i(t,u,o):"":a==="select"?(t,u,o)=>{const e=n;let c=e.multiple?Array.isArray(t)?t.map(f=>f==null?void 0:f[e.innerFieldLabel??"name"]):void 0:t==null?void 0:t[e.innerFieldLabel??"name"];return(!c&&typeof t=="string"||typeof t=="number")&&(c=t),typeof i=="function"?i(c,u,o):Array.isArray(c)?c.join(", "):c}:a==="number"?(t,u,o)=>typeof i=="function"?i(t,u,o):n!=null&&n.int?v.default.toInt(t,n.formatted):v.default.toMoney(t):a==="enum"?(t,u,o)=>{var c;const e=d.t(((c=n==null?void 0:n.translation)==null?void 0:c[t??""])??t,{ns:x.TRANSLATION_NAMESPACE});return typeof i=="function"?i(t,u,o):e}:a==="date"?(t,u,o)=>{if(!t)return"-";const e=n!=null&&n.formatTime?r.formatDateTime(t):r.formatDate(t);return typeof i=="function"?i(t,u,o):e}:a==="checkbox"?(t,u,o)=>typeof i=="function"?i(t,u,o):t?l.jsx(m.CheckOutlined,{}):l.jsx(m.CloseOutlined,{}):a==="image"?(t,u,o)=>typeof i=="function"?i(t,u,o):l.jsx(g.ImageCrudCellValue,{value:t,provider:n.provider}):a==="file"?(t,u,o)=>typeof i=="function"?i(t,u,o):l.jsx(C.FileCrudCellValue,{value:t,provider:n.provider}):a==="time"?(t,u,o)=>{if(!t)return"-";const e=n==null?void 0:n.format,c=n==null?void 0:n.use12Hours,f=r.formatTime(t,e||(c?"hh:mm:ss A":void 0));return typeof i=="function"?i(t,u,o):f}:a==="color"?(t,u,o)=>typeof i=="function"?i(t,u,o):typeof t=="string"&&t.startsWith("#")?l.jsx(s.Tooltip,{title:t,children:l.jsx(s.Avatar,{style:{backgroundColor:t}})}):String(t):a==="textarea"?(t,u,o)=>{const e=(n==null?void 0:n.truncated)??1;return typeof i=="function"?i(t,u,o):e?l.jsx(y.ShowMore,{lines:e===!0?1:e,children:t}):t}:typeof i=="function"?i:t=>t}exports.getRendererValueCrudViewer=j;
@@ -1,58 +1,57 @@
1
- import { j as c } from "../../../_virtual/jsx-runtime.js";
2
- import { Tooltip as x, Avatar as j } from "antd";
3
- import { ShowMore as y } from "../../common/show-more/index.js";
4
- import { FileCrudCellValue as A } from "../FileCrudField.js";
5
- import { ImageCrudCellValue as b } from "../ImageCrudField.js";
6
- import { TRANSLATION_NAMESPACE as e } from "../../../locale/hooks/translation-constants.js";
7
- import { t as g } from "../../../node_modules/i18next/dist/esm/i18next.js";
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { CheckOutlined as y, CloseOutlined as A } from "@ant-design/icons";
3
+ import { Tooltip as e, Avatar as C } from "antd";
4
+ import { ShowMore as b } from "../../common/show-more/index.js";
5
+ import { FileCrudCellValue as g } from "../FileCrudField.js";
6
+ import { ImageCrudCellValue as h } from "../ImageCrudField.js";
7
+ import { TRANSLATION_NAMESPACE as T } from "../../../locale/hooks/translation-constants.js";
8
+ import { t as S } from "i18next";
8
9
  import r from "../../../util/DateUtil.js";
9
10
  import v from "../../../util/NumberUtil.js";
10
- import h from "../../../node_modules/@ant-design/icons/es/icons/CheckOutlined.js";
11
- import C from "../../../node_modules/@ant-design/icons/es/icons/CloseOutlined.js";
12
- function M({
13
- type: u,
11
+ function O({
12
+ type: m,
14
13
  render: i,
15
14
  ...o
16
15
  }) {
17
- return u === "object" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : "" : u === "select" ? (t, f, n) => {
18
- const m = o;
19
- let a = m.multiple ? Array.isArray(t) ? t.map((l) => l == null ? void 0 : l[m.innerFieldLabel ?? "name"]) : void 0 : t == null ? void 0 : t[m.innerFieldLabel ?? "name"];
20
- return (!a && typeof t == "string" || typeof t == "number") && (a = t), typeof i == "function" ? i(a, f, n) : Array.isArray(a) ? a.join(", ") : a;
21
- } : u === "number" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : o != null && o.int ? v.toInt(t, o.formatted) : v.toMoney(t) : u === "enum" ? (t, f, n) => {
16
+ return m === "object" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : "" : m === "select" ? (t, n, f) => {
17
+ const u = o;
18
+ let a = u.multiple ? Array.isArray(t) ? t.map((c) => c == null ? void 0 : c[u.innerFieldLabel ?? "name"]) : void 0 : t == null ? void 0 : t[u.innerFieldLabel ?? "name"];
19
+ return (!a && typeof t == "string" || typeof t == "number") && (a = t), typeof i == "function" ? i(a, n, f) : Array.isArray(a) ? a.join(", ") : a;
20
+ } : m === "number" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : o != null && o.int ? v.toInt(t, o.formatted) : v.toMoney(t) : m === "enum" ? (t, n, f) => {
22
21
  var a;
23
- const m = g(
22
+ const u = S(
24
23
  ((a = o == null ? void 0 : o.translation) == null ? void 0 : a[t ?? ""]) ?? t,
25
- { ns: e }
24
+ { ns: T }
26
25
  );
27
- return typeof i == "function" ? i(t, f, n) : m;
28
- } : u === "date" ? (t, f, n) => {
26
+ return typeof i == "function" ? i(t, n, f) : u;
27
+ } : m === "date" ? (t, n, f) => {
29
28
  if (!t) return "-";
30
- const m = o != null && o.formatTime ? r.formatDateTime(t) : r.formatDate(t);
31
- return typeof i == "function" ? i(t, f, n) : m;
32
- } : u === "checkbox" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : t ? /* @__PURE__ */ c.jsx(h, {}) : /* @__PURE__ */ c.jsx(C, {}) : u === "image" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : /* @__PURE__ */ c.jsx(
33
- b,
29
+ const u = o != null && o.formatTime ? r.formatDateTime(t) : r.formatDate(t);
30
+ return typeof i == "function" ? i(t, n, f) : u;
31
+ } : m === "checkbox" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : t ? /* @__PURE__ */ l(y, {}) : /* @__PURE__ */ l(A, {}) : m === "image" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : /* @__PURE__ */ l(
32
+ h,
34
33
  {
35
34
  value: t,
36
35
  provider: o.provider
37
36
  }
38
- ) : u === "file" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : /* @__PURE__ */ c.jsx(
39
- A,
37
+ ) : m === "file" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : /* @__PURE__ */ l(
38
+ g,
40
39
  {
41
40
  value: t,
42
41
  provider: o.provider
43
42
  }
44
- ) : u === "time" ? (t, f, n) => {
43
+ ) : m === "time" ? (t, n, f) => {
45
44
  if (!t) return "-";
46
- const m = o == null ? void 0 : o.format, a = o == null ? void 0 : o.use12Hours, l = r.formatTime(
45
+ const u = o == null ? void 0 : o.format, a = o == null ? void 0 : o.use12Hours, c = r.formatTime(
47
46
  t,
48
- m || (a ? "hh:mm:ss A" : void 0)
47
+ u || (a ? "hh:mm:ss A" : void 0)
49
48
  );
50
- return typeof i == "function" ? i(t, f, n) : l;
51
- } : u === "color" ? (t, f, n) => typeof i == "function" ? i(t, f, n) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ c.jsx(x, { title: t, children: /* @__PURE__ */ c.jsx(j, { style: { backgroundColor: t } }) }) : String(t) : u === "textarea" ? (t, f, n) => {
52
- const m = (o == null ? void 0 : o.truncated) ?? 1;
53
- return typeof i == "function" ? i(t, f, n) : m ? /* @__PURE__ */ c.jsx(y, { lines: m === !0 ? 1 : m, children: t }) : t;
49
+ return typeof i == "function" ? i(t, n, f) : c;
50
+ } : m === "color" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ l(e, { title: t, children: /* @__PURE__ */ l(C, { style: { backgroundColor: t } }) }) : String(t) : m === "textarea" ? (t, n, f) => {
51
+ const u = (o == null ? void 0 : o.truncated) ?? 1;
52
+ return typeof i == "function" ? i(t, n, f) : u ? /* @__PURE__ */ l(b, { lines: u === !0 ? 1 : u, children: t }) : t;
54
53
  } : typeof i == "function" ? i : (t) => t;
55
54
  }
56
55
  export {
57
- M as getRendererValueCrudViewer
56
+ O as getRendererValueCrudViewer
58
57
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./hooks/translation-constants.cjs"),u=require("./translations/en.cjs"),n=require("../node_modules/i18next/dist/esm/i18next.cjs"),o=require("../node_modules/react-i18next/dist/es/initReactI18next.cjs"),s={en:{[a.TRANSLATION_NAMESPACE]:u}},i=(e={})=>{const{translations:t=s,language:r="en"}=e;return n.default.use(o.initReactI18next).init({resources:t,lng:r,fallbackLng:"en",ns:a.TRANSLATION_NAMESPACE,interpolation:{escapeValue:!1}}),n.default},l=(e,t)=>{n.default.addResourceBundle(e,a.TRANSLATION_NAMESPACE,t,!0,!0)};exports.defaultTranslations=s;exports.setupI18n=i;exports.updateTranslations=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./hooks/translation-constants.cjs"),o=require("./translations/en.cjs"),t=require("i18next"),u=require("react-i18next"),a={en:{[s.TRANSLATION_NAMESPACE]:o}},i=(e={})=>{const{translations:n=a,language:r="en"}=e;return t.use(u.initReactI18next).init({resources:n,lng:r,fallbackLng:"en",ns:s.TRANSLATION_NAMESPACE,interpolation:{escapeValue:!1}}),t},l=(e,n)=>{t.addResourceBundle(e,s.TRANSLATION_NAMESPACE,n,!0,!0)};exports.defaultTranslations=a;exports.setupI18n=i;exports.updateTranslations=l;
@@ -1,7 +1,7 @@
1
1
  import { TRANSLATION_NAMESPACE as o } from "./hooks/translation-constants.js";
2
2
  import a from "./translations/en.js";
3
- import t from "../node_modules/i18next/dist/esm/i18next.js";
4
- import { initReactI18next as s } from "../node_modules/react-i18next/dist/es/initReactI18next.js";
3
+ import t from "i18next";
4
+ import { initReactI18next as s } from "react-i18next";
5
5
  const i = {
6
6
  en: {
7
7
  [o]: a
@@ -1 +1 @@
1
- "use strict";const e=require("../_virtual/dayjs.min.cjs"),a=require("../node_modules/i18next/dist/esm/i18next.cjs"),o=t=>e(t).locale(a.default.language).format("YYYY-MM-DD HH:mm"),m=t=>e(t).locale(a.default.language).format("YYYY-MM-DD HH:mm:ss"),n=t=>e(t).locale(a.default.language).format("YYYY-MM-DD"),l=(t,r="HH:mm:ss")=>e(t).locale(a.default.language).format(r),s={formatDateTime:o,formatDate:n,formatDateTimeWithSecond:m,formatTime:l};module.exports=s;
1
+ "use strict";const e=require("dayjs"),a=require("i18next"),o=t=>e(t).locale(a.language).format("YYYY-MM-DD HH:mm"),m=t=>e(t).locale(a.language).format("YYYY-MM-DD HH:mm:ss"),n=t=>e(t).locale(a.language).format("YYYY-MM-DD"),s=(t,r="HH:mm:ss")=>e(t).locale(a.language).format(r),c={formatDateTime:o,formatDate:n,formatDateTimeWithSecond:m,formatTime:s};module.exports=c;
@@ -1,6 +1,6 @@
1
- import t from "../_virtual/dayjs.min.js";
2
- import e from "../node_modules/i18next/dist/esm/i18next.js";
3
- const m = (a) => t(a).locale(e.language).format("YYYY-MM-DD HH:mm"), r = (a) => t(a).locale(e.language).format("YYYY-MM-DD HH:mm:ss"), n = (a) => t(a).locale(e.language).format("YYYY-MM-DD"), l = (a, o = "HH:mm:ss") => t(a).locale(e.language).format(o), c = { formatDateTime: m, formatDate: n, formatDateTimeWithSecond: r, formatTime: l };
1
+ import a from "dayjs";
2
+ import e from "i18next";
3
+ const m = (t) => a(t).locale(e.language).format("YYYY-MM-DD HH:mm"), r = (t) => a(t).locale(e.language).format("YYYY-MM-DD HH:mm:ss"), n = (t) => a(t).locale(e.language).format("YYYY-MM-DD"), l = (t, o = "HH:mm:ss") => a(t).locale(e.language).format(o), s = { formatDateTime: m, formatDate: n, formatDateTimeWithSecond: r, formatTime: l };
4
4
  export {
5
- c as default
5
+ s as default
6
6
  };
@@ -1 +1 @@
1
- "use strict";const c=require("../node_modules/browser-image-compression/dist/browser-image-compression.cjs");class g{async resizeImage(t){const e=await c(t,{maxSizeMB:1,maxWidthOrHeight:1920,useWebWorker:!0}),a=t.uid;return Object.assign(e,{uid:a,lastModifiedDate:new Date})}async getImageData(t){const e=await this.getImageData0(t);if(e){const a=new Image;a.src=e.data;const r=await new Promise(n=>{a.onload=function(){n({height:a.height,width:a.width})}});return Object.assign(e,r),e}else return null}async getImageData0(t){try{if(t.startsWith("data:image/")){const e=t.match(/^data:image\/(png|jpeg|jpg);base64,(.*)$/);if(!e)throw new Error("Invalid base64 image data");return{data:t,type:e[1]}}else{const e=await fetch(t);if(!e.ok)throw new Error("Network response was not ok");const a=await e.blob();return new Promise((r,n)=>{const s=new FileReader;s.onloadend=function(){const o=s.result,i=o.match(/^data:image\/(png|jpeg|jpg);base64,/);i?r({data:o,type:i[1]}):n(new Error("Could not determine image type"))},s.onerror=n,s.readAsDataURL(a)})}}catch(e){return console.warn(e),null}}}const d=new g;module.exports=d;
1
+ "use strict";const c=require("browser-image-compression");class g{async resizeImage(t){const e=await c(t,{maxSizeMB:1,maxWidthOrHeight:1920,useWebWorker:!0}),a=t.uid;return Object.assign(e,{uid:a,lastModifiedDate:new Date})}async getImageData(t){const e=await this.getImageData0(t);if(e){const a=new Image;a.src=e.data;const o=await new Promise(n=>{a.onload=function(){n({height:a.height,width:a.width})}});return Object.assign(e,o),e}else return null}async getImageData0(t){try{if(t.startsWith("data:image/")){const e=t.match(/^data:image\/(png|jpeg|jpg);base64,(.*)$/);if(!e)throw new Error("Invalid base64 image data");return{data:t,type:e[1]}}else{const e=await fetch(t);if(!e.ok)throw new Error("Network response was not ok");const a=await e.blob();return new Promise((o,n)=>{const s=new FileReader;s.onloadend=function(){const r=s.result,i=r.match(/^data:image\/(png|jpeg|jpg);base64,/);i?o({data:r,type:i[1]}):n(new Error("Could not determine image type"))},s.onerror=n,s.readAsDataURL(a)})}}catch(e){return console.warn(e),null}}}const d=new g;module.exports=d;
@@ -1,4 +1,4 @@
1
- import c from "../node_modules/browser-image-compression/dist/browser-image-compression.js";
1
+ import c from "browser-image-compression";
2
2
  class g {
3
3
  async resizeImage(t) {
4
4
  const e = await c(t, {
@@ -1 +1 @@
1
- "use strict";const i=require("../node_modules/i18next/dist/esm/i18next.cjs"),a=require("./NumberUtil.cjs"),o=e=>[{required:!0,message:`${e} ${i.t("err.validation.required")}`}],s=()=>[{min:8,message:i.t("err.validation.minLength8")}],d=()=>[{type:"number",validator(e,r,t){const n=Number(r);isNaN(n)&&r||n<0||n>100?t(i.t("err.validation.percentage")):t()},message:i.t("err.validation.percentage")}],u=e=>[{max:Number(e),min:0,type:"number",message:i.t("err.validation.maximumValueExceeded").replace("%maxValue%",a.default.toMoney(e))}],l=()=>[{validator:(e,r,t)=>(r.length===12||r.length===10)&&r.search(/^([0-9]{9}[x|X|v|V])|([0-9]{12})$/)!==-1?t():t(i.t("err.validation.invalidNic"))}],m=e=>[{message:`${i.t("err.validation.invalid")} ${e}`,pattern:/^(?:0|94|\+94|0094)?(?:(11|21|23|24|25|26|27|31|32|33|34|35|36|37|38|41|45|47|51|52|54|55|57|63|65|66|67|81|91)(0|2|3|4|5|7|9)|7(0|1|2|4|5|6|7|8)\d)\d{6}$/}],v=()=>[{message:`${i.t("err.validation.positiveNumber")}`,type:"number",validator(e,r,t){r<=0?t(e.message):t()}}],g={percentageValidation:d,required:o,maxValidation:u,passwordValidation:s,nicValidation:l,phoneValidation:m,positiveNumberValidation:v};module.exports=g;
1
+ "use strict";const i=require("i18next"),a=require("./NumberUtil.cjs"),o=e=>[{required:!0,message:`${e} ${i.t("err.validation.required")}`}],s=()=>[{min:8,message:i.t("err.validation.minLength8")}],d=()=>[{type:"number",validator(e,r,t){const n=Number(r);isNaN(n)&&r||n<0||n>100?t(i.t("err.validation.percentage")):t()},message:i.t("err.validation.percentage")}],u=e=>[{max:Number(e),min:0,type:"number",message:i.t("err.validation.maximumValueExceeded").replace("%maxValue%",a.default.toMoney(e))}],l=()=>[{validator:(e,r,t)=>(r.length===12||r.length===10)&&r.search(/^([0-9]{9}[x|X|v|V])|([0-9]{12})$/)!==-1?t():t(i.t("err.validation.invalidNic"))}],m=e=>[{message:`${i.t("err.validation.invalid")} ${e}`,pattern:/^(?:0|94|\+94|0094)?(?:(11|21|23|24|25|26|27|31|32|33|34|35|36|37|38|41|45|47|51|52|54|55|57|63|65|66|67|81|91)(0|2|3|4|5|7|9)|7(0|1|2|4|5|6|7|8)\d)\d{6}$/}],v=()=>[{message:`${i.t("err.validation.positiveNumber")}`,type:"number",validator(e,r,t){r<=0?t(e.message):t()}}],g={percentageValidation:d,required:o,maxValidation:u,passwordValidation:s,nicValidation:l,phoneValidation:m,positiveNumberValidation:v};module.exports=g;
@@ -1,4 +1,4 @@
1
- import { t as r } from "../node_modules/i18next/dist/esm/i18next.js";
1
+ import { t as r } from "i18next";
2
2
  import n from "./NumberUtil.js";
3
3
  const o = (e) => [
4
4
  {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kingteza/crud-component",
3
3
  "private": false,
4
- "version": "1.0.14",
4
+ "version": "1.0.16",
5
5
  "description": "React CRUD component library with Ant Design",
6
6
  "keywords": [
7
7
  "react",