yaml-admin-front 0.0.100 → 0.0.102

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
@@ -86770,33 +86770,39 @@ const XC = /* @__PURE__ */ yn(FMe), $Me = typeof XC == "object" ? XC.default : X
86770
86770
  }
86771
86771
  ) });
86772
86772
  }, VMe = ({ component: t, custom: e, ...r }) => {
86773
- const { yml: n } = Vn(), [a, i] = Xe({});
86773
+ const { yml: n } = Vn(), [a, i] = Xe({}), o = $e(() => {
86774
+ const g = Array.isArray(t.sort) ? t.sort[0] : null;
86775
+ return g?.name ? {
86776
+ field: g.name,
86777
+ order: g.desc ? "DESC" : "ASC"
86778
+ } : { field: "id", order: "DESC" };
86779
+ }, [t.sort]);
86774
86780
  Te(() => {
86775
- const h = {};
86776
- t.filter && t.filter.forEach((g) => {
86777
- let v = g.value;
86778
- if (v != null)
86779
- if (typeof g.value == "string" && (g.value.includes("$lte ") || g.value.includes("$gte ") || g.value.includes("$lt ") || g.value.includes("$gt "))) {
86780
- const [m, y] = g.value.split(" ");
86781
- h[g.name] = m + " " + y;
86782
- } else typeof g.value == "string" && v.startsWith("$") && (v = localStorage.getItem(v.substring(1))), h[g.name] = v;
86783
- }), i(h);
86781
+ const g = {};
86782
+ t.filter && t.filter.forEach((v) => {
86783
+ let m = v.value;
86784
+ if (m != null)
86785
+ if (typeof v.value == "string" && (v.value.includes("$lte ") || v.value.includes("$gte ") || v.value.includes("$lt ") || v.value.includes("$gt "))) {
86786
+ const [y, b] = v.value.split(" ");
86787
+ g[v.name] = y + " " + b;
86788
+ } else typeof v.value == "string" && m.startsWith("$") && (m = localStorage.getItem(m.substring(1))), g[v.name] = m;
86789
+ }), i(g);
86784
86790
  }, [t.filter]);
86785
- const { data: o, total: l, isLoading: u, error: c } = rT(
86791
+ const { data: l, total: u, isLoading: c, error: d } = rT(
86786
86792
  t.entity,
86787
86793
  {
86788
86794
  pagination: { page: 1, perPage: t.limit || 10 },
86789
- sort: { field: "id", order: "DESC" },
86795
+ sort: o,
86790
86796
  filter: a
86791
86797
  },
86792
86798
  { enabled: Object.keys(a).length > 0 || !t.filter }
86793
- ), d = $e(() => ({
86794
- data: o,
86795
- isLoading: u,
86796
- total: l,
86799
+ ), f = $e(() => ({
86800
+ data: l,
86801
+ isLoading: c,
86802
+ total: u,
86797
86803
  page: 1,
86798
86804
  perPage: t.limit || 10,
86799
- sort: { field: "id", order: "DESC" },
86805
+ sort: o,
86800
86806
  filterValues: a,
86801
86807
  setSort: () => {
86802
86808
  },
@@ -86814,8 +86820,8 @@ const XC = /* @__PURE__ */ yn(FMe), $Me = typeof XC == "object" ? XC.default : X
86814
86820
  },
86815
86821
  onUnselectItems: () => {
86816
86822
  }
86817
- }), [o, u, l, a, t.entity, t.limit]);
86818
- if (u)
86823
+ }), [l, c, u, o, a, t.entity, t.limit]);
86824
+ if (c)
86819
86825
  return /* @__PURE__ */ L.jsx(nn, { sx: { width: "100%", height: t.height || 300 }, children: /* @__PURE__ */ L.jsx(
86820
86826
  vA,
86821
86827
  {
@@ -86825,17 +86831,17 @@ const XC = /* @__PURE__ */ yn(FMe), $Me = typeof XC == "object" ? XC.default : X
86825
86831
  sx: { borderRadius: 2, bgcolor: "rgba(0,0,0,0.04)" }
86826
86832
  }
86827
86833
  ) });
86828
- if (c)
86834
+ if (d)
86829
86835
  return /* @__PURE__ */ L.jsx(Ot, { color: "error", children: "Error loading data" });
86830
- if (!o || !n?.entity?.[t.entity])
86836
+ if (!l || !n?.entity?.[t.entity])
86831
86837
  return null;
86832
- const f = n.entity[t.entity];
86833
- return /* @__PURE__ */ L.jsx(Es, { value: t.entity, children: /* @__PURE__ */ L.jsx(pT, { value: d, children: /* @__PURE__ */ L.jsx(nn, { sx: { width: "100%", overflow: "auto" }, children: /* @__PURE__ */ L.jsx(jb, { bulkActionButtons: !1, rowClick: !1, empty: /* @__PURE__ */ L.jsx(nn, { sx: { p: 2 }, children: "No data" }), children: t.fields.map((h, g) => {
86834
- const v = typeof h == "string" ? h : h.name, m = f.fields.find((y) => y.name === v);
86835
- return m ? Xu({
86836
- field: m,
86838
+ const h = n.entity[t.entity];
86839
+ return /* @__PURE__ */ L.jsx(Es, { value: t.entity, children: /* @__PURE__ */ L.jsx(pT, { value: f, children: /* @__PURE__ */ L.jsx(nn, { sx: { width: "100%", overflow: "auto" }, children: /* @__PURE__ */ L.jsx(jb, { bulkActionButtons: !1, rowClick: !1, empty: /* @__PURE__ */ L.jsx(nn, { sx: { p: 2 }, children: "No data" }), children: t.fields.map((g, v) => {
86840
+ const m = typeof g == "string" ? g : g.name, y = h.fields.find((b) => b.name === m);
86841
+ return y ? Xu({
86842
+ field: y,
86837
86843
  isList: !0,
86838
- crud_field: typeof h == "object" ? h : { name: v }
86844
+ crud_field: typeof g == "object" ? g : { name: m }
86839
86845
  }) : null;
86840
86846
  }) }) }) }) });
86841
86847
  }, GC = [
@@ -87027,6 +87033,7 @@ const XC = /* @__PURE__ */ yn(FMe), $Me = typeof XC == "object" ? XC.default : X
87027
87033
  ) }) });
87028
87034
  };
87029
87035
  export {
87036
+ wke as ActionPopup,
87030
87037
  KY as AdminContext,
87031
87038
  jOe as AdminProvider,
87032
87039
  Q5 as AppBar,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yaml-admin-front",
3
- "version": "0.0.100",
3
+ "version": "0.0.102",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs.js",