react-admin-crud-manager 1.1.0 → 1.1.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 (40) hide show
  1. package/dist/index.cjs.js +5 -5
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.es.js +31 -31
  4. package/dist/index.es.js.map +1 -1
  5. package/dist/types/OptionalSnackbarProvider.d.ts +6 -0
  6. package/dist/types/components/Button/Button.d.ts +11 -0
  7. package/dist/types/components/Chip/Chip.d.ts +8 -0
  8. package/dist/types/components/CrudPage.d.ts +4 -0
  9. package/dist/types/components/Details/Details.d.ts +12 -0
  10. package/dist/types/components/Details/components/CardGroup.d.ts +6 -0
  11. package/dist/types/components/Details/components/DetailRow.d.ts +6 -0
  12. package/dist/types/components/Details/components/GroupRow.d.ts +6 -0
  13. package/dist/types/components/Filter/FilterDrawer.d.ts +17 -0
  14. package/dist/types/components/Form/Form.d.ts +21 -0
  15. package/dist/types/components/Form/components/AudioPicker.d.ts +18 -0
  16. package/dist/types/components/Form/components/Checkbox.d.ts +19 -0
  17. package/dist/types/components/Form/components/ImageCropperModal.d.ts +12 -0
  18. package/dist/types/components/Form/components/ImagePicker.d.ts +19 -0
  19. package/dist/types/components/Form/components/Input.d.ts +18 -0
  20. package/dist/types/components/Form/components/InputLabel.d.ts +8 -0
  21. package/dist/types/components/Form/components/PhoneInput.d.ts +15 -0
  22. package/dist/types/components/Form/components/Radio.d.ts +17 -0
  23. package/dist/types/components/Form/components/RenderFields.d.ts +42 -0
  24. package/dist/types/components/Form/components/Select.d.ts +25 -0
  25. package/dist/types/components/Form/components/Switch.d.ts +13 -0
  26. package/dist/types/components/Form/components/TextArea.d.ts +9 -0
  27. package/dist/types/components/Form/components/TinyEditor.d.ts +20 -0
  28. package/dist/types/components/Form/components/VideoPicker.d.ts +18 -0
  29. package/dist/types/components/Loader/Spinner.d.ts +7 -0
  30. package/dist/types/components/Modal/Modal.d.ts +20 -0
  31. package/dist/types/components/Table/Table.d.ts +10 -0
  32. package/dist/types/components/Table/components/ImagePreview.d.ts +8 -0
  33. package/dist/types/components/Table/components/SortDropdown.d.ts +13 -0
  34. package/dist/types/components/Table/components/TableSkeleton.d.ts +6 -0
  35. package/dist/types/components/Table/utils/sortUtils.d.ts +58 -0
  36. package/dist/types/data/countries.d.ts +6 -0
  37. package/dist/types/index.d.ts +2 -0
  38. package/dist/types/lib/utils.d.ts +2 -0
  39. package/dist/types/types/crudtypes.d.ts +217 -0
  40. package/package.json +6 -2
package/dist/index.es.js CHANGED
@@ -160,7 +160,7 @@ const or = ({
160
160
  );
161
161
  const X = s ? (_ || []).map(L) : L(_), ae = x.filter(
162
162
  (C) => C.label.toLowerCase().includes(I.toLowerCase())
163
- ), H = (C) => {
163
+ ), W = (C) => {
164
164
  const N = L(C);
165
165
  return s ? X.includes(N) : N === X;
166
166
  };
@@ -190,7 +190,7 @@ const or = ({
190
190
  } else
191
191
  t == null || t(N), P(!1);
192
192
  T("");
193
- }, q = s ? x.filter((C) => H(C.value)).map((C) => C.label).join(", ") : ($ = x.find((C) => H(C.value))) == null ? void 0 : $.label;
193
+ }, q = s ? x.filter((C) => W(C.value)).map((C) => C.label).join(", ") : ($ = x.find((C) => W(C.value))) == null ? void 0 : $.label;
194
194
  return U(() => {
195
195
  (_ || _ === !1) && setTimeout(() => {
196
196
  t == null || t(_);
@@ -264,10 +264,10 @@ const or = ({
264
264
  type: "button",
265
265
  onClick: () => R(String(C.value)),
266
266
  className: `w-full px-3 py-2 text-left text-sm flex items-center justify-between hover:bg-gray-100 dark:hover:bg-gray-600
267
- ${H(C.value) ? "bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300" : ""}`,
267
+ ${W(C.value) ? "bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300" : ""}`,
268
268
  children: [
269
269
  /* @__PURE__ */ n("span", { children: C.label }),
270
- s && H(C.value) && /* @__PURE__ */ n(Ht, { className: "w-4 h-4" })
270
+ s && W(C.value) && /* @__PURE__ */ n(Ht, { className: "w-4 h-4" })
271
271
  ]
272
272
  },
273
273
  String(C.value)
@@ -1773,7 +1773,7 @@ const mt = ie, Tr = (a) => new Promise((r, e) => {
1773
1773
  pe(M.current), M.current = Y, s({ file: B, preview: Y }), e == null || e(B);
1774
1774
  }, ae = (N) => {
1775
1775
  N && N.stopPropagation(), pe(M.current), M.current = "", s(null), e == null || e(null), y.current && (y.current.value = "");
1776
- }, H = (N) => {
1776
+ }, W = (N) => {
1777
1777
  c && (N.preventDefault(), g(!0));
1778
1778
  }, R = (N) => {
1779
1779
  c && (N.preventDefault(), g(!1));
@@ -1791,7 +1791,7 @@ const mt = ie, Tr = (a) => new Promise((r, e) => {
1791
1791
  "div",
1792
1792
  {
1793
1793
  className: `relative rounded-md p-2 transition-all ${m ? "border-2 border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900/20" : "border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800"}`,
1794
- onDragOver: H,
1794
+ onDragOver: W,
1795
1795
  onDragLeave: R,
1796
1796
  onDrop: q,
1797
1797
  children: [
@@ -2682,7 +2682,7 @@ const Br = ({
2682
2682
  pattern: L,
2683
2683
  renderType: X,
2684
2684
  cropImage: ae,
2685
- aspectRatio: H,
2685
+ aspectRatio: W,
2686
2686
  dependencyKey: R,
2687
2687
  mask: q,
2688
2688
  maskApplyOnValue: $,
@@ -2811,7 +2811,7 @@ const Br = ({
2811
2811
  onChange: (F) => e(t, F),
2812
2812
  required: m,
2813
2813
  accept: h || "image/*",
2814
- aspect: H,
2814
+ aspect: W,
2815
2815
  id: `file-${t}`,
2816
2816
  dragDrop: k,
2817
2817
  cropImage: ae,
@@ -3225,7 +3225,7 @@ const Br = ({
3225
3225
  onFilterApply: w,
3226
3226
  filterConfig: P = null,
3227
3227
  rowClick: I = null
3228
- } = a, [T, D] = S(""), [O, A] = S(null), [y, x] = S([]), [M, _] = S({ top: 0, left: 0 }), [L, X] = S(!1), [ae, H] = S({}), R = be(() => Yr(h), [h]), q = be(
3228
+ } = a, [T, D] = S(""), [O, A] = S(null), [y, x] = S([]), [M, _] = S({ top: 0, left: 0 }), [L, X] = S(!1), [ae, W] = S({}), R = be(() => Yr(h), [h]), q = be(
3229
3229
  () => Vr(c),
3230
3230
  [c]
3231
3231
  ), $ = be(() => Jr(R, q), [R, q]), [C, N] = S(
@@ -3367,7 +3367,7 @@ const Br = ({
3367
3367
  return g == null ? void 0 : g("view", v);
3368
3368
  if (typeof u.handleClick == "function")
3369
3369
  return u.handleClick(v);
3370
- }, W = () => I || typeof I == "function", se = (u) => u.onClickDetails || typeof u.handleClick == "function";
3370
+ }, H = () => I || typeof I == "function", se = (u) => u.onClickDetails || typeof u.handleClick == "function";
3371
3371
  return U(() => {
3372
3372
  const u = () => {
3373
3373
  O && A(null);
@@ -3506,9 +3506,9 @@ const Br = ({
3506
3506
  ) }) : Se.map((u, v) => /* @__PURE__ */ n(
3507
3507
  "tr",
3508
3508
  {
3509
- className: `table-row ${W() ? "cursor-pointer" : ""}`,
3509
+ className: `table-row ${H() ? "cursor-pointer" : ""}`,
3510
3510
  onClick: () => {
3511
- W() && E(u);
3511
+ H() && E(u);
3512
3512
  },
3513
3513
  children: c.map((j) => /* @__PURE__ */ n(
3514
3514
  "td",
@@ -3651,7 +3651,7 @@ const Br = ({
3651
3651
  onClose: () => X(!1),
3652
3652
  config: P,
3653
3653
  onApply: (u) => {
3654
- H(u), w == null || w(u);
3654
+ W(u), w == null || w(u);
3655
3655
  }
3656
3656
  }
3657
3657
  ),
@@ -3865,16 +3865,16 @@ const ta = ({ config: a }) => {
3865
3865
  current_page: 1,
3866
3866
  sort_by: "",
3867
3867
  sort_order: ""
3868
- }), [I, T] = S({}), [D, O] = S(!1), [A, y] = S(!1), [x, M] = S(!1), [_, L] = S(!1), [X, ae] = S(!1), [H, R] = S(
3868
+ }), [I, T] = S({}), [D, O] = S(!1), [A, y] = S(!1), [x, M] = S(!1), [_, L] = S(!1), [X, ae] = S(!1), [W, R] = S(
3869
3869
  null
3870
3870
  ), q = (E, z) => {
3871
3871
  E === "edit" ? (R(z), M(!0)) : E === "view" ? (R(z), ae(!0)) : E === "delete" && (R(z), L(!0));
3872
- }, $ = async (E, z, W = "", se = "") => {
3872
+ }, $ = async (E, z, H = "", se = "") => {
3873
3873
  h(!0);
3874
3874
  try {
3875
3875
  if (!E) return;
3876
3876
  const u = await E();
3877
- (W || u != null && u.message) && ge(W || u.message || "Success", {
3877
+ (H || u != null && u.message) && ge(H || u.message || "Success", {
3878
3878
  variant: "success"
3879
3879
  }), z == null || z(u);
3880
3880
  } catch (u) {
@@ -3886,18 +3886,18 @@ const ta = ({ config: a }) => {
3886
3886
  }
3887
3887
  }, C = (E) => {
3888
3888
  const z = E.newObject;
3889
- o ? (m((W) => [z, ...W]), k((W) => ({
3890
- ...W,
3889
+ o ? (m((H) => [z, ...H]), k((H) => ({
3890
+ ...H,
3891
3891
  current_page: 1
3892
- }))) : (P((W) => ({
3893
- ...W,
3892
+ }))) : (P((H) => ({
3893
+ ...H,
3894
3894
  current_page: 1
3895
3895
  })), w.current_page === 1 && ne()), y(!1);
3896
3896
  }, N = (E) => {
3897
- const { newObject: z, targetObject: W } = E;
3897
+ const { newObject: z, targetObject: H } = E;
3898
3898
  o ? m(
3899
3899
  (se) => se.map(
3900
- (u) => u.id === W.id ? { ...u, ...z } : u
3900
+ (u) => u.id === H.id ? { ...u, ...z } : u
3901
3901
  )
3902
3902
  ) : ne(), M(!1);
3903
3903
  }, B = (E) => {
@@ -3906,7 +3906,7 @@ const ta = ({ config: a }) => {
3906
3906
  return;
3907
3907
  }
3908
3908
  o ? m(
3909
- (z) => z.filter((W) => W.id !== E.targetObject.id)
3909
+ (z) => z.filter((H) => H.id !== E.targetObject.id)
3910
3910
  ) : s.length === 1 && w.current_page > 1 ? P((z) => ({
3911
3911
  ...z,
3912
3912
  current_page: z.current_page - 1
@@ -3920,7 +3920,7 @@ const ta = ({ config: a }) => {
3920
3920
  ), F = (E) => $(
3921
3921
  () => {
3922
3922
  var z;
3923
- return (z = i == null ? void 0 : i.editModal) != null && z.handleSubmit ? i.editModal.handleSubmit(E, H) : Promise.resolve({ newObject: null, targetObject: null });
3923
+ return (z = i == null ? void 0 : i.editModal) != null && z.handleSubmit ? i.editModal.handleSubmit(E, W) : Promise.resolve({ newObject: null, targetObject: null });
3924
3924
  },
3925
3925
  N
3926
3926
  ), ne = async () => {
@@ -3940,9 +3940,9 @@ const ta = ({ config: a }) => {
3940
3940
  }
3941
3941
  }, me = (E) => {
3942
3942
  var z;
3943
- T((W) => ({ ...E })), (z = l == null ? void 0 : l.filter) != null && z.useServerSideFilters && O((W) => !W);
3943
+ T(() => ({ ...E })), (z = l == null ? void 0 : l.filter) != null && z.useServerSideFilters && O((H) => !H);
3944
3944
  }, le = (E, z) => E.filter(
3945
- (W) => Object.entries(z).every(([se, u]) => W[se] === u)
3945
+ (H) => Object.entries(z).every(([se, u]) => H[se] === u)
3946
3946
  ), J = be(() => {
3947
3947
  var E;
3948
3948
  return (E = l == null ? void 0 : l.filter) != null && E.useServerSideFilters ? s : le(s, I);
@@ -4029,7 +4029,7 @@ const ta = ({ config: a }) => {
4029
4029
  {
4030
4030
  config: (i == null ? void 0 : i.editModal) || {},
4031
4031
  onSubmit: F,
4032
- initialData: H,
4032
+ initialData: W,
4033
4033
  type: "edit",
4034
4034
  loading: p,
4035
4035
  fetchRowDetails: t
@@ -4050,10 +4050,10 @@ const ta = ({ config: a }) => {
4050
4050
  loading: p,
4051
4051
  actionButtons: ((Le = i == null ? void 0 : i.deleteModal) == null ? void 0 : Le.actionButtons) || [],
4052
4052
  executeFunction: $,
4053
- selectedItem: H,
4053
+ selectedItem: W,
4054
4054
  children: /* @__PURE__ */ n("div", { className: "flex items-center space-x-2 py-3", children: /* @__PURE__ */ f("div", { children: [
4055
4055
  /* @__PURE__ */ n("p", { className: "text-md text-gray-700 dark:text-white", children: ((Te = i == null ? void 0 : i.deleteModal) == null ? void 0 : Te.confirmText) || "Are you sure you want to delete this item?" }),
4056
- ((Re = i == null ? void 0 : i.deleteModal) == null ? void 0 : Re.referenceKey) && /* @__PURE__ */ n("p", { className: "text-md font-semibold text-gray-700 dark:text-white", children: H == null ? void 0 : H[(Fe = i == null ? void 0 : i.deleteModal) == null ? void 0 : Fe.referenceKey] })
4056
+ ((Re = i == null ? void 0 : i.deleteModal) == null ? void 0 : Re.referenceKey) && /* @__PURE__ */ n("p", { className: "text-md font-semibold text-gray-700 dark:text-white", children: W == null ? void 0 : W[(Fe = i == null ? void 0 : i.deleteModal) == null ? void 0 : Fe.referenceKey] })
4057
4057
  ] }) })
4058
4058
  }
4059
4059
  ),
@@ -4068,10 +4068,10 @@ const ta = ({ config: a }) => {
4068
4068
  title: ((Oe = i == null ? void 0 : i.viewModal) == null ? void 0 : Oe.title) || "View Details",
4069
4069
  size: ((je = i == null ? void 0 : i.viewModal) == null ? void 0 : je.size) || "lg",
4070
4070
  footerConfig: i == null ? void 0 : i.viewModal.footer,
4071
- children: oe ? /* @__PURE__ */ n(oe, { data: H }) : /* @__PURE__ */ n(
4071
+ children: oe ? /* @__PURE__ */ n(oe, { data: W }) : /* @__PURE__ */ n(
4072
4072
  ea,
4073
4073
  {
4074
- data: H,
4074
+ data: W,
4075
4075
  fetchRowDetails: t,
4076
4076
  config: (i == null ? void 0 : i.viewModal) || {}
4077
4077
  }