@nivaro/react 0.3.107 → 0.3.109

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 (31) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +149 -0
  4. package/dist/index.js +742 -738
  5. package/dist/layout-editor.d.ts +4 -0
  6. package/dist/shared/components/CollectionBrowserView.js +410 -416
  7. package/dist/shared/components/ItemEditForm.js +2413 -2384
  8. package/dist/shared/components/collections-directory/CollectionHoverCard.js +177 -0
  9. package/dist/shared/components/collections-directory/CollectionRow.js +359 -0
  10. package/dist/shared/components/collections-directory/CollectionRowMenu.js +213 -0
  11. package/dist/shared/components/collections-directory/CollectionsDirectory.js +543 -0
  12. package/dist/shared/components/collections-directory/CollectionsToolbar.js +287 -0
  13. package/dist/shared/components/collections-directory/PinnedSection.js +97 -0
  14. package/dist/shared/components/collections-directory/directory-data.js +159 -0
  15. package/dist/shared/components/collections-directory/page-model.js +122 -0
  16. package/dist/shared/components/collections-directory/sections.js +108 -0
  17. package/dist/shared/components/collections-directory/shared-pins.js +70 -0
  18. package/dist/shared/components/imports/CollectionImportPanel.js +631 -595
  19. package/dist/shared/components/imports/import-picker-options.js +44 -0
  20. package/dist/shared/components/item-edit/InlineTableField.js +441 -438
  21. package/dist/shared/components/item-edit/NestedRelationEditor.js +36 -36
  22. package/dist/shared/components/item-edit/RelationCombobox.js +1 -1
  23. package/dist/shared/components/item-edit/StepsBar.js +24 -23
  24. package/dist/shared/components/item-edit/form-density.js +1 -0
  25. package/dist/shared/components/item-edit/section-rows.js +39 -0
  26. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +88 -66
  27. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  28. package/dist/shared/lib/activity-sentence.js +4 -4
  29. package/dist/shared/lib/layout-ops.js +24 -22
  30. package/dist/shared/lib/template-paths.js +17 -0
  31. package/package.json +1 -1
@@ -0,0 +1,44 @@
1
+ const p = (n) => n.replace(/_/g, " ").replace(/\s+/g, " ").trim().replace(/\b\w/g, (i) => i.toUpperCase()), h = /^(nivaro_|directus_)/i, d = (n) => (n.display_name || n.plural || "").trim() || p(n.collection);
2
+ function _(n, i = /* @__PURE__ */ new Set(), t = "") {
3
+ const l = n.filter((e) => (e == null ? void 0 : e.collection) && !h.test(e.collection)), r = new Set(l.map((e) => e.group).filter((e) => !!e)), s = new Map(
4
+ l.filter((e) => r.has(e.collection)).map((e) => [e.collection, e])
5
+ ), f = (e) => e.collection === t || !r.has(e.collection) && !e.hidden && !e.singleton && !i.has(e.collection), a = (e) => e && r.has(e) ? d(s.get(e) ?? { collection: e }) : "Other", c = (e) => {
6
+ var o;
7
+ return ((o = s.get(e)) == null ? void 0 : o.sort) ?? 9999;
8
+ }, g = [...r].sort(
9
+ (e, o) => c(e) - c(o) || a(e).localeCompare(a(o))
10
+ ), u = new Map(g.map((e, o) => [e, o]));
11
+ return l.filter(f).map((e) => ({
12
+ value: e.collection,
13
+ label: d(e),
14
+ hint: e.collection,
15
+ group: a(e.group),
16
+ _rank: e.group && u.has(e.group) ? u.get(e.group) : 1e6
17
+ })).sort((e, o) => e._rank - o._rank || e.label.localeCompare(o.label)).map(({ _rank: e, ...o }) => o);
18
+ }
19
+ const m = (n) => (Array.isArray(n.special) ? n.special : String(n.special ?? "").split(",")).map((i) => i.trim().toLowerCase()).filter(Boolean), S = /* @__PURE__ */ new Set(["user-created", "user-updated", "date-created", "date-updated", "uuid"]);
20
+ function w(n) {
21
+ const i = m(n), t = String(n.interface ?? "").toLowerCase();
22
+ return i.includes("m2m") || t.includes("m2m") ? "links several" : i.includes("m2o") || t.includes("m2o") ? "link" : i.includes("cast-boolean") || n.type === "boolean" ? "yes / no" : /date|time/.test(String(n.type ?? "")) ? "date" : /integer|decimal|float|bigint/.test(String(n.type ?? "")) ? "number" : "";
23
+ }
24
+ function b(n, i = "") {
25
+ return n.filter((t) => {
26
+ if (!(t != null && t.field)) return !1;
27
+ if (t.field === i) return !0;
28
+ const l = m(t), r = String(t.interface ?? "").toLowerCase();
29
+ return !(t.hidden || t.readonly || t.computed_type || l.some((s) => S.has(s)) || l.includes("o2m") || r.includes("o2m") || l.includes("alias") && !l.includes("m2m"));
30
+ }).map((t, l) => ({ f: t, i: l })).sort((t, l) => (t.f.sort ?? 1e6) - (l.f.sort ?? 1e6) || t.i - l.i).map(({ f: t }) => {
31
+ const l = w(t);
32
+ return {
33
+ value: t.field,
34
+ label: p(t.field),
35
+ hint: l ? `${t.field} · ${l}` : t.field
36
+ };
37
+ });
38
+ }
39
+ export {
40
+ d as collectionName,
41
+ _ as collectionPickerOptions,
42
+ b as fieldPickerOptions,
43
+ p as titleCase
44
+ };