@espresso-lab/mantine-data-table 1.9.5 → 1.9.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.
package/dist/index.es.js CHANGED
@@ -4578,7 +4578,7 @@ ${new this._window.XMLSerializer().serializeToString(d)}`;
4578
4578
  }
4579
4579
  U2();
4580
4580
  const Oh = hl(void 0);
4581
- function Cx(i) {
4581
+ function Sx(i) {
4582
4582
  const n = kn.c(9), {
4583
4583
  children: r,
4584
4584
  baseUrl: s,
@@ -4654,7 +4654,7 @@ async function V2(i, n) {
4654
4654
  return r;
4655
4655
  }).then((r) => r.status == 204 ? n : r.json()).then((r) => r);
4656
4656
  }
4657
- async function Sx(i, n, r) {
4657
+ async function Dx(i, n, r) {
4658
4658
  return fetch(n, {
4659
4659
  method: i,
4660
4660
  headers: await hi(),
@@ -11630,14 +11630,14 @@ function Zb(i) {
11630
11630
  isPending: fe
11631
11631
  } = Rh(p, u);
11632
11632
  let Z;
11633
- n[1] !== r ? (Z = new Set(r.filter(rx).map(nx)), n[1] = r, n[2] = Z) : Z = n[2];
11633
+ n[1] !== r ? (Z = new Set(r.filter(ix).map(rx)), n[1] = r, n[2] = Z) : Z = n[2];
11634
11634
  let ae;
11635
11635
  n[3] !== Z ? (ae = [...Z], n[3] = Z, n[4] = ae) : ae = n[4];
11636
11636
  const Q = ae;
11637
11637
  let ee;
11638
- n[5] !== r ? (ee = r.reduce(tx, {}), n[5] = r, n[6] = ee) : ee = n[6];
11638
+ n[5] !== r ? (ee = r.reduce(nx, {}), n[5] = r, n[6] = ee) : ee = n[6];
11639
11639
  let he;
11640
- n[7] !== r ? (he = r.filter(ex).reduce(Jb, {}), n[7] = r, n[8] = he) : he = n[8];
11640
+ n[7] !== r ? (he = r.filter(tx).reduce(Xb, {}), n[7] = r, n[8] = he) : he = n[8];
11641
11641
  let ue;
11642
11642
  n[9] !== ee || n[10] !== he ? (ue = {
11643
11643
  mode: "uncontrolled",
@@ -11648,11 +11648,12 @@ function Zb(i) {
11648
11648
  let Ce;
11649
11649
  n[12] !== j || n[13] !== r || n[14] !== te ? (Ce = () => {
11650
11650
  if (j) {
11651
+ console.log("[UpdateModal] Processing API data:", j), console.log("[UpdateModal] Available fields:", r.map(Jb));
11651
11652
  const m = r.reduce((b, $) => {
11652
11653
  const W = $.id;
11653
11654
  return b[W] = Array.isArray(j[W]) ? j[W] : $.type === "boolean" ? j[W] ?? !1 : $.type === "date" ? j[W] ? new Date(j[W]) : "" : j[W] ?? "", b;
11654
11655
  }, {});
11655
- te.initialize(m), te.setValues(m), I(m);
11656
+ console.log("[UpdateModal] Final form values:", m), te.initialize(m), te.setValues(m), I(m);
11656
11657
  }
11657
11658
  }, n[12] = j, n[13] = r, n[14] = te, n[15] = Ce) : Ce = n[15];
11658
11659
  let De;
@@ -11674,12 +11675,17 @@ function Zb(i) {
11674
11675
  ...te.getValues(),
11675
11676
  ...L
11676
11677
  };
11677
- return console.log(`[UpdateModal] renderField ${b.id}:`, {
11678
- hasConditional: !!b.conditional,
11679
- currentValues: $,
11680
- watchedValues: L,
11681
- formValues: te.getValues()
11682
- }), b.conditional && !b.conditional($) ? (console.log(`[UpdateModal] Field ${b.id} hidden by conditional`), null) : /* @__PURE__ */ A.jsxs(sh, { children: [
11678
+ if (b.conditional) {
11679
+ const W = b.conditional($);
11680
+ if (console.log(`[UpdateModal] Field ${b.id} conditional evaluation:`, {
11681
+ currentValues: $,
11682
+ type: $.type,
11683
+ conditionalResult: W,
11684
+ willShow: W
11685
+ }), !W)
11686
+ return null;
11687
+ }
11688
+ return /* @__PURE__ */ A.jsxs(sh, { children: [
11683
11689
  (b.type === void 0 || b.type == "text") && /* @__PURE__ */ A.jsx(lh, { label: b.column.title, placeholder: b.placeholder ?? "", ...te.getInputProps(b.id), type: b.id.includes("email") ? "email" : void 0 }, te.key(b.id)),
11684
11690
  b.type === "number" && /* @__PURE__ */ A.jsx(uh, { decimalSeparator: ",", label: b.column.title, placeholder: b.placeholder ?? "", ...te.getInputProps(b.id) }, te.key(b.id)),
11685
11691
  b.type === "date" && /* @__PURE__ */ A.jsx(bs, { label: b.column.title, placeholder: b.placeholder ?? "", valueFormat: "DD.MM.YYYY", clearable: !0, ...te.getInputProps(b.id) }, te.key(b.id)),
@@ -11727,25 +11733,28 @@ function Zb(i) {
11727
11733
  function Qb(i, n) {
11728
11734
  return /* @__PURE__ */ A.jsx(si, { height: 35 }, `skeleton-field-${n}`);
11729
11735
  }
11730
- function Jb(i, n) {
11731
- return i[n.id] = Xb, i;
11736
+ function Jb(i) {
11737
+ return i.id;
11732
11738
  }
11733
- function Xb(i) {
11734
- return i ? null : "Pflichtfeld";
11739
+ function Xb(i, n) {
11740
+ return i[n.id] = ex, i;
11735
11741
  }
11736
11742
  function ex(i) {
11743
+ return i ? null : "Pflichtfeld";
11744
+ }
11745
+ function tx(i) {
11737
11746
  return i.required;
11738
11747
  }
11739
- function tx(i, n) {
11748
+ function nx(i, n) {
11740
11749
  return i[n.id] = n.type === "boolean" ? n.defaultValue ?? !1 : n.defaultValue ?? "", i;
11741
11750
  }
11742
- function nx(i) {
11751
+ function rx(i) {
11743
11752
  return i.step;
11744
11753
  }
11745
- function rx(i) {
11754
+ function ix(i) {
11746
11755
  return typeof i.step == "number";
11747
11756
  }
11748
- function ix({
11757
+ function ox({
11749
11758
  queryKey: i,
11750
11759
  apiPath: n,
11751
11760
  onClose: r,
@@ -11775,7 +11784,7 @@ function ix({
11775
11784
  ] })
11776
11785
  ] }) : /* @__PURE__ */ A.jsx(A.Fragment, {});
11777
11786
  }
11778
- function ox(i, n) {
11787
+ function sx(i, n) {
11779
11788
  const r = kn.c(8);
11780
11789
  let s;
11781
11790
  r[0] !== i || r[1] !== n ? (s = () => {
@@ -11792,7 +11801,7 @@ function ox(i, n) {
11792
11801
  return r[5] !== h || r[6] !== u ? (S = [u, h], r[5] = h, r[6] = u, r[7] = S) : S = r[7], S;
11793
11802
  }
11794
11803
  const ih = [10, 15, 20, 50, 100, 500];
11795
- function sx(i) {
11804
+ function ax(i) {
11796
11805
  const n = kn.c(147), {
11797
11806
  title: r,
11798
11807
  queryKey: s,
@@ -11824,7 +11833,7 @@ function sx(i) {
11824
11833
  he = {
11825
11834
  ...j,
11826
11835
  ...Ve
11827
- }, ue = he ? "?" + Object.entries(he).filter(vx).map(mx).join("&") : "", n[3] = ae, n[4] = j, n[5] = K, n[6] = he, n[7] = ue;
11836
+ }, ue = he ? "?" + Object.entries(he).filter(yx).map(vx).join("&") : "", n[3] = ae, n[4] = j, n[5] = K, n[6] = he, n[7] = ue;
11828
11837
  } else
11829
11838
  he = n[6], ue = n[7];
11830
11839
  const te = ue;
@@ -11896,7 +11905,7 @@ function sx(i) {
11896
11905
  }, n[29] = f, n[30] = X.columnAccessor, n[31] = X.direction, n[32] = V) : V = n[32];
11897
11906
  let F;
11898
11907
  n[33] !== f || n[34] !== X ? (F = [X, f], n[33] = f, n[34] = X, n[35] = F) : F = n[35], xt(V, F);
11899
- const [G, ne] = ox(ih[1], "mantine-table-page-size"), [xe, l] = Ke(1);
11908
+ const [G, ne] = sx(ih[1], "mantine-table-page-size"), [xe, l] = Ke(1);
11900
11909
  let c;
11901
11910
  n[36] !== G || n[37] !== D || n[38] !== ge ? (c = D ? ge.slice(0, G) : ge, n[36] = G, n[37] = D, n[38] = ge, n[39] = c) : c = n[39];
11902
11911
  const [_, T] = Ke(c);
@@ -11939,18 +11948,18 @@ function sx(i) {
11939
11948
  let gt;
11940
11949
  n[64] !== Ft ? (gt = /* @__PURE__ */ A.jsx(Xo, { variant: "subtle", onClick: Ft, "aria-label": "Neuladen", children: Dn }), n[64] = Ft, n[65] = gt) : gt = n[65];
11941
11950
  let sn;
11942
- n[66] !== N || n[67] !== h || n[68] !== me || n[69] !== S ? (sn = (h.some(gx) || S) && /* @__PURE__ */ A.jsxs(Tr, { shadow: "md", children: [
11951
+ n[66] !== N || n[67] !== h || n[68] !== me || n[69] !== S ? (sn = (h.some(mx) || S) && /* @__PURE__ */ A.jsxs(Tr, { shadow: "md", children: [
11943
11952
  /* @__PURE__ */ A.jsx(Tr.Target, { children: /* @__PURE__ */ A.jsx(rr, { variant: "outline", rightSection: /* @__PURE__ */ A.jsx(cy, { size: 14 }), disabled: !me.length, children: "Aktionen" }) }),
11944
11953
  /* @__PURE__ */ A.jsxs(Tr.Dropdown, { children: [
11945
- h.find(px) && /* @__PURE__ */ A.jsx(Tr.Item, { leftSection: /* @__PURE__ */ A.jsx(fy, { size: 14 }), onClick: () => nt(!0), disabled: me.length !== 1, children: "Bearbeiten" }),
11954
+ h.find(gx) && /* @__PURE__ */ A.jsx(Tr.Item, { leftSection: /* @__PURE__ */ A.jsx(fy, { size: 14 }), onClick: () => nt(!0), disabled: me.length !== 1, children: "Bearbeiten" }),
11946
11955
  (N ?? []).map((Ve, lt) => /* @__PURE__ */ Ko(Tr.Item, { ...Ve.icon && {
11947
11956
  leftSection: Ve.icon
11948
11957
  }, key: `custom_action_${lt}`, onClick: () => Ve.onClick(me) }, Ve.label)),
11949
- h.find(dx) && /* @__PURE__ */ A.jsx(Tr.Item, { leftSection: /* @__PURE__ */ A.jsx(hy, { size: 14 }), onClick: () => Ct(!0), color: "red", children: "Löschen" })
11958
+ h.find(px) && /* @__PURE__ */ A.jsx(Tr.Item, { leftSection: /* @__PURE__ */ A.jsx(hy, { size: 14 }), onClick: () => Ct(!0), color: "red", children: "Löschen" })
11950
11959
  ] })
11951
11960
  ] }), n[66] = N, n[67] = h, n[68] = me, n[69] = S, n[70] = sn) : sn = n[70];
11952
11961
  let an;
11953
- n[71] !== I || n[72] !== h || n[73] !== P ? (an = h.find(hx) && /* @__PURE__ */ A.jsx(rr, { onClick: () => Rt(!0), disabled: P, children: I ?? "Erstellen" }), n[71] = I, n[72] = h, n[73] = P, n[74] = an) : an = n[74];
11962
+ n[71] !== I || n[72] !== h || n[73] !== P ? (an = h.find(dx) && /* @__PURE__ */ A.jsx(rr, { onClick: () => Rt(!0), disabled: P, children: I ?? "Erstellen" }), n[71] = I, n[72] = h, n[73] = P, n[74] = an) : an = n[74];
11954
11963
  let Wt;
11955
11964
  n[75] !== g || n[76] !== gt || n[77] !== sn || n[78] !== an ? (Wt = /* @__PURE__ */ A.jsxs(nr, { align: "center", gap: "xs", children: [
11956
11965
  gt,
@@ -11964,13 +11973,13 @@ function sx(i) {
11964
11973
  Wt
11965
11974
  ] }), n[80] = Sn, n[81] = St, n[82] = Wt, n[83] = Tt) : Tt = n[83];
11966
11975
  let Ut;
11967
- n[84] !== ae || n[85] !== ee || n[86] !== K ? (Ut = K && K.length > 0 && /* @__PURE__ */ A.jsx(Ja, { value: ae, onChange: ee, mt: "md", children: /* @__PURE__ */ A.jsx(Ja.List, { children: K.map(fx) }) }), n[84] = ae, n[85] = ee, n[86] = K, n[87] = Ut) : Ut = n[87];
11976
+ n[84] !== ae || n[85] !== ee || n[86] !== K ? (Ut = K && K.length > 0 && /* @__PURE__ */ A.jsx(Ja, { value: ae, onChange: ee, mt: "md", children: /* @__PURE__ */ A.jsx(Ja.List, { children: K.map(hx) }) }), n[84] = ae, n[85] = ee, n[86] = K, n[87] = Ut) : Ut = n[87];
11968
11977
  let zt;
11969
11978
  n[88] !== O ? (zt = O && /* @__PURE__ */ A.jsx(os, { mt: "md", variant: "light", color: "red", title: "Es ist ein Fehler aufgetreten.", icon: /* @__PURE__ */ A.jsx(py, {}), children: "Bitte versuche es später erneut oder sende eine Nachricht an unseren Support." }), n[88] = O, n[89] = zt) : zt = n[89];
11970
11979
  let Qt;
11971
11980
  n[90] !== P || n[91] !== v ? (Qt = (P || v) && /* @__PURE__ */ A.jsxs(dl, { my: "md", children: [
11972
11981
  /* @__PURE__ */ A.jsx(si, { height: 40 }),
11973
- Array(5).fill(0).map(cx)
11982
+ Array(5).fill(0).map(fx)
11974
11983
  ] }), n[90] = P, n[91] = v, n[92] = Qt) : Qt = n[92];
11975
11984
  let qt;
11976
11985
  n[93] !== h || n[94] !== O || n[95] !== P || n[96] !== v || n[97] !== xe || n[98] !== G || n[99] !== D || n[100] !== _ || n[101] !== me || n[102] !== S || n[103] !== ne || n[104] !== X || n[105] !== ge ? (qt = !P && !v && /* @__PURE__ */ A.jsx(Gb, { my: "md", striped: !0, minHeight: 150, fetching: O, records: _, sortStatus: X, onSortStatusChange: _e, ...S && {
@@ -11984,14 +11993,14 @@ function sx(i) {
11984
11993
  recordsPerPageOptions: ih,
11985
11994
  onRecordsPerPageChange: ne,
11986
11995
  recordsPerPageLabel: "Einträge pro Seite"
11987
- }, columns: h.map(ux), noRecordsText: "Keine Einträge gefunden" }), n[93] = h, n[94] = O, n[95] = P, n[96] = v, n[97] = xe, n[98] = G, n[99] = D, n[100] = _, n[101] = me, n[102] = S, n[103] = ne, n[104] = X, n[105] = ge, n[106] = qt) : qt = n[106];
11996
+ }, columns: h.map(cx), noRecordsText: "Keine Einträge gefunden" }), n[93] = h, n[94] = O, n[95] = P, n[96] = v, n[97] = xe, n[98] = G, n[99] = D, n[100] = _, n[101] = me, n[102] = S, n[103] = ne, n[104] = X, n[105] = ge, n[106] = qt) : qt = n[106];
11988
11997
  let We;
11989
11998
  n[107] === Symbol.for("react.memo_cache_sentinel") ? (We = () => {
11990
11999
  nt(!1), Me([]);
11991
12000
  }, n[107] = We) : We = n[107];
11992
12001
  const ot = r ?? "Bearbeiten";
11993
12002
  let kt;
11994
- n[108] !== p || n[109] !== h || n[110] !== s || n[111] !== me[0] || n[112] !== me.length || n[113] !== k ? (kt = me.length > 0 && /* @__PURE__ */ A.jsx(Zb, { fields: h.filter(lx), queryKey: s, apiPath: p, id: me[0].id, onClose: () => {
12003
+ n[108] !== p || n[109] !== h || n[110] !== s || n[111] !== me[0] || n[112] !== me.length || n[113] !== k ? (kt = me.length > 0 && /* @__PURE__ */ A.jsx(Zb, { fields: h.filter(ux), queryKey: s, apiPath: p, id: me[0].id, onClose: () => {
11995
12004
  nt(!1), Me([]);
11996
12005
  }, steps: k }), n[108] = p, n[109] = h, n[110] = s, n[111] = me[0], n[112] = me.length, n[113] = k, n[114] = kt) : kt = n[114];
11997
12006
  let Jt;
@@ -11999,7 +12008,7 @@ function sx(i) {
11999
12008
  let Ln;
12000
12009
  n[119] !== p || n[120] !== Cn || n[121] !== s || n[122] !== me || n[123] !== r ? (Ln = me.length > 0 && /* @__PURE__ */ A.jsx(Ia, { opened: Cn, onClose: () => {
12001
12010
  Ct(!1), Me([]);
12002
- }, title: r ?? "Löschen", children: /* @__PURE__ */ A.jsx(ix, { onClose: () => {
12011
+ }, title: r ?? "Löschen", children: /* @__PURE__ */ A.jsx(ox, { onClose: () => {
12003
12012
  Ct(!1), Me([]);
12004
12013
  }, queryKey: s, apiPath: p, selectedRecords: me }) }), n[119] = p, n[120] = Cn, n[121] = s, n[122] = me, n[123] = r, n[124] = Ln) : Ln = n[124];
12005
12014
  let ln;
@@ -12012,7 +12021,7 @@ function sx(i) {
12012
12021
  Rt(!1);
12013
12022
  }, n[126] = un) : un = n[126];
12014
12023
  let Nn;
12015
- n[127] !== h ? (Nn = h.filter(ax), n[127] = h, n[128] = Nn) : Nn = n[128];
12024
+ n[127] !== h ? (Nn = h.filter(lx), n[127] = h, n[128] = Nn) : Nn = n[128];
12016
12025
  let cn;
12017
12026
  n[129] !== p || n[130] !== s || n[131] !== k || n[132] !== Nn ? (cn = /* @__PURE__ */ A.jsx(Jw, { queryKey: s, apiPath: p, onClose: un, fields: Nn, steps: k }), n[129] = p, n[130] = s, n[131] = k, n[132] = Nn, n[133] = cn) : cn = n[133];
12018
12027
  let fn;
@@ -12029,54 +12038,54 @@ function sx(i) {
12029
12038
  fn
12030
12039
  ] }), n[138] = Tt, n[139] = Ut, n[140] = zt, n[141] = Qt, n[142] = qt, n[143] = Jt, n[144] = Ln, n[145] = fn, n[146] = mt) : mt = n[146], mt;
12031
12040
  }
12032
- function ax(i) {
12041
+ function lx(i) {
12033
12042
  return i.create;
12034
12043
  }
12035
- function lx(i) {
12044
+ function ux(i) {
12036
12045
  return i.update;
12037
12046
  }
12038
- function ux(i) {
12047
+ function cx(i) {
12039
12048
  return i.column;
12040
12049
  }
12041
- function cx(i, n) {
12050
+ function fx(i, n) {
12042
12051
  return /* @__PURE__ */ A.jsx(si, { height: 35 }, `skeleton-${n}`);
12043
12052
  }
12044
- function fx(i) {
12045
- return /* @__PURE__ */ A.jsx(Ja.Tab, { value: i.value, leftSection: i.icon, children: i.label }, i.value);
12046
- }
12047
12053
  function hx(i) {
12048
- return i.create;
12054
+ return /* @__PURE__ */ A.jsx(Ja.Tab, { value: i.value, leftSection: i.icon, children: i.label }, i.value);
12049
12055
  }
12050
12056
  function dx(i) {
12051
- return i.delete;
12057
+ return i.create;
12052
12058
  }
12053
12059
  function px(i) {
12054
- return i.update;
12060
+ return i.delete;
12055
12061
  }
12056
12062
  function gx(i) {
12057
12063
  return i.update;
12058
12064
  }
12059
12065
  function mx(i) {
12066
+ return i.update;
12067
+ }
12068
+ function vx(i) {
12060
12069
  const [n, r] = i;
12061
12070
  return `${n}=${encodeURIComponent(r ?? "")}`;
12062
12071
  }
12063
- function vx(i) {
12072
+ function yx(i) {
12064
12073
  const [, n] = i;
12065
12074
  return n != null;
12066
12075
  }
12067
- function Dx(i) {
12076
+ function Ax(i) {
12068
12077
  const n = kn.c(5), {
12069
12078
  queryClient: r
12070
12079
  } = $r();
12071
12080
  let s;
12072
- n[0] !== i ? (s = /* @__PURE__ */ A.jsx(sx, { ...i }), n[0] = i, n[1] = s) : s = n[1];
12081
+ n[0] !== i ? (s = /* @__PURE__ */ A.jsx(ax, { ...i }), n[0] = i, n[1] = s) : s = n[1];
12073
12082
  let u;
12074
12083
  return n[2] !== r || n[3] !== s ? (u = /* @__PURE__ */ A.jsx(bh, { client: r, children: s }), n[2] = r, n[3] = s, n[4] = u) : u = n[4], u;
12075
12084
  }
12076
12085
  export {
12077
- Dx as DataTable,
12078
- Cx as DataTableProvider,
12079
- Sx as api,
12086
+ Ax as DataTable,
12087
+ Sx as DataTableProvider,
12088
+ Dx as api,
12080
12089
  V2 as createOne,
12081
12090
  G2 as deleteOne,
12082
12091
  q2 as getAll,
@@ -12088,7 +12097,7 @@ export {
12088
12097
  ow as useDeleteOne,
12089
12098
  J2 as useGetAll,
12090
12099
  Z2 as useGetOne,
12091
- ox as usePersistentState,
12100
+ sx as usePersistentState,
12092
12101
  Rh as useUpdateOne
12093
12102
  };
12094
12103
  //# sourceMappingURL=index.es.js.map