@declarion/react 0.36.6 → 0.37.0

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.
@@ -1,6 +1,6 @@
1
1
  import { s as e, t } from "./DynamicIcon-BWO6QtNF.js";
2
- import { $ as n, C as r, E as i, F as a, Gn as o, Hn as s, K as c, Kn as l, Nn as u, O as d, On as f, Pn as p, S as m, T as h, U as g, Wn as _, a as v, an as y, at as b, bn as x, cn as S, ct as C, dt as w, en as T, f as E, fn as D, g as O, gn as k, gt as A, h as j, ht as M, i as N, it as P, j as F, jn as I, jt as L, k as R, ln as z, nt as B, o as ee, on as V, ot as te, p as ne, pn as H, q as U, rt as re, sn as ie, un as W, ut as ae, vn as oe, w as se, x as ce, xn as le, y as ue, zn as de } from "./useCurrentScreen-Bgp6_vne.js";
3
- import { a as fe, c as pe, d as me, f as he, i as ge, l as _e, n as ve, o as ye, p as be, r as xe, s as Se, t as Ce, u as we } from "./value-CUVtVjKI.js";
2
+ import { $ as n, C as r, E as i, F as a, Gn as o, Hn as s, K as c, Kn as l, Nn as u, O as d, On as f, Pn as p, S as m, T as h, U as g, Wn as _, a as v, an as y, at as b, bn as x, cn as S, ct as C, dt as w, en as T, f as E, fn as D, g as O, gn as k, gt as A, h as j, ht as M, i as N, it as P, j as F, jn as I, jt as L, k as R, ln as z, nt as B, o as ee, on as V, ot as te, p as ne, pn as H, q as U, rt as re, sn as ie, un as W, ut as ae, vn as oe, w as se, x as ce, xn as le, y as ue, zn as de } from "./useCurrentScreen-CD6xJlyU.js";
3
+ import { a as fe, c as pe, d as me, f as he, i as ge, l as _e, n as ve, o as ye, p as be, r as xe, s as Se, t as Ce, u as we } from "./value-DFxS49M5.js";
4
4
  import { n as Te, r as Ee, t as De } from "./dataTableStyles-vwD1mVOP.js";
5
5
  import { Component as Oe, Suspense as ke, lazy as Ae, useCallback as G, useEffect as K, useId as je, useLayoutEffect as Me, useMemo as q, useRef as J, useState as Y } from "react";
6
6
  import { parsePath as Ne, useNavigate as Pe } from "react-router-dom";
@@ -1142,7 +1142,7 @@ function nn(e) {
1142
1142
  }
1143
1143
  //#endregion
1144
1144
  //#region src/components/file-widgets/GridLazy.tsx
1145
- var rn = Ae(() => import("./Grid-D0ckegd1.js").then((e) => ({ default: e.Grid })));
1145
+ var rn = Ae(() => import("./Grid-k1alUfJH.js").then((e) => ({ default: e.Grid })));
1146
1146
  function an() {
1147
1147
  return /* @__PURE__ */ Z("div", { className: "h-24 w-full rounded-md bg-muted animate-pulse" });
1148
1148
  }
@@ -2199,7 +2199,7 @@ function $n(e) {
2199
2199
  return t ?? e;
2200
2200
  }
2201
2201
  function er(e) {
2202
- return e == null ? !1 : typeof e == "boolean" ? e : typeof e == "string" ? e !== "" : typeof e == "number" ? e !== 0 : !0;
2202
+ return e == null ? !1 : typeof e == "boolean" ? e : typeof e == "string" ? e !== "" : typeof e != "number" || e !== 0;
2203
2203
  }
2204
2204
  function tr(e, t, n) {
2205
2205
  switch (n) {
@@ -2406,7 +2406,7 @@ function Cr(e, t) {
2406
2406
  //#endregion
2407
2407
  //#region src/components/shared/ActionButton.tsx
2408
2408
  function wr({ actionCode: n, action: r, entityCode: i, objectIds: a = [], row: s, variant: c = "outline", size: u = "default", onSuccess: d, onBatchStart: f, onBatchError: p, onBatchPartial: m }) {
2409
- let [h, _] = Y(!1), [y, b] = Y(!1), [x, S] = Y(!1), [C, w] = Y(null), T = qn(i), { data: D } = A(), O = It(), k = sr(r), j = ar(r), M = !!r.confirmation && Object.keys(r.confirmation).length > 0, N = s ? Xn(r.conditions, s) : !0, P = G(async () => {
2409
+ let [h, _] = Y(!1), [y, b] = Y(!1), [x, S] = Y(!1), [C, w] = Y(null), T = qn(i), { data: D } = A(), O = It(), k = sr(r), j = ar(r), M = !!r.confirmation && Object.keys(r.confirmation).length > 0, N = !s || Xn(r.conditions, s), P = G(async () => {
2410
2410
  if (!(!r.association || a.length === 0)) {
2411
2411
  S(!0);
2412
2412
  try {
@@ -2609,7 +2609,7 @@ function Tr({ actions: t, objectIds: n, row: r, onSuccess: i, preMenu: a, divide
2609
2609
  a,
2610
2610
  a && c && t.length > 0 && /* @__PURE__ */ Z(p, { divider: !0 }),
2611
2611
  t.map(({ code: t, action: a }) => {
2612
- let o = r ? Xn(a.conditions, r) : !0, s = W(a.display?.name) || t, c = a.display?.icon, l = c && e[c] ? e[c] : void 0;
2612
+ let o = !r || Xn(a.conditions, r), s = W(a.display?.name) || t, c = a.display?.icon, l = c && e[c] ? e[c] : void 0;
2613
2613
  return /* @__PURE__ */ Z(p, {
2614
2614
  icon: l ? /* @__PURE__ */ Z(l, { size: 12 }) : null,
2615
2615
  danger: a.destructive,
@@ -3493,7 +3493,7 @@ function ii({ node: e, ctx: t }) {
3493
3493
  });
3494
3494
  }
3495
3495
  function ai({ node: n, ctx: r, assocCode: i, assocEntity: a, fkField: o }) {
3496
- let s = n.columns && n.columns.length > 0 ? n.columns.filter((e) => e === o ? !1 : !!a.fields.get(e)) : a.fields.names().filter((e) => {
3496
+ let s = n.columns && n.columns.length > 0 ? n.columns.filter((e) => e !== o && !!a.fields.get(e)) : a.fields.names().filter((e) => {
3497
3497
  if (e === o) return !1;
3498
3498
  let t = a.fields.get(e);
3499
3499
  return !(!t || t.primary || t.display?.is_listable === !1);
@@ -4815,11 +4815,11 @@ function Ei(e) {
4815
4815
  //#region src/lib/field-classification.ts
4816
4816
  function Di(e, t) {
4817
4817
  let n = e?.field_access?.[t];
4818
- return n ? n.read === "granted" : !0;
4818
+ return !n || n.read === "granted";
4819
4819
  }
4820
4820
  function Oi(e, t) {
4821
4821
  let n = e?.field_access?.[t];
4822
- return n ? n.write === "granted" : !0;
4822
+ return !n || n.write === "granted";
4823
4823
  }
4824
4824
  function ki(e, t) {
4825
4825
  return e?.field_access?.[t]?.classification;
@@ -4953,7 +4953,7 @@ function qi(e, t, n) {
4953
4953
  let r = Zi(e, t, { explicit: !1 }), i = Pi, a = Qi(e, e?.display?.display_field, { explicit: !1 }), o = a ?? $i(e, r, {
4954
4954
  allowLong: !1,
4955
4955
  allowAuto: !1
4956
- }), s = a !== void 0, c = o ? /* @__PURE__ */ new Set([o]) : void 0, l = r.find((t) => c?.has(t) ? !1 : ta(e, t)), u = new Set([o, l].filter((e) => !!e)), d = ra(e, r).filter((e) => !u.has(e)).slice(0, Fi);
4956
+ }), s = a !== void 0, c = o ? /* @__PURE__ */ new Set([o]) : void 0, l = r.find((t) => !c?.has(t) && ta(e, t)), u = new Set([o, l].filter((e) => !!e)), d = ra(e, r).filter((e) => !u.has(e)).slice(0, Fi);
4957
4957
  for (let e of d) u.add(e);
4958
4958
  let f = r.filter((t) => !u.has(t) && ia(e, t)).slice(0, Ii);
4959
4959
  for (let e of f) u.add(e);
@@ -1,4 +1,4 @@
1
- import { Ln as e, _t as t, at as n, ft as r, mt as i, pt as a, r as o, t as s } from "./useCurrentScreen-Bgp6_vne.js";
1
+ import { Ln as e, _t as t, at as n, ft as r, mt as i, pt as a, r as o, t as s } from "./useCurrentScreen-CD6xJlyU.js";
2
2
  import { useState as c } from "react";
3
3
  import { MemoryRouter as l } from "react-router-dom";
4
4
  import { QueryClient as u, QueryClientProvider as d } from "@tanstack/react-query";
@@ -52,11 +52,25 @@ export declare function fieldDisplayName(field: EntityField, fieldName: string,
52
52
  export interface RefDisplay {
53
53
  field: string;
54
54
  }
55
+ /** A single declarative filter condition ({field, op, value}). Shared by
56
+ * ViewDefinition.filters (screen views) and RefConfig.options_filter (ref
57
+ * dropdown option narrowing); mirrors engine.ViewFilter. Structurally a subset
58
+ * of the wire FilterNodeParam, so it can feed a list query's `filters`. */
59
+ export interface FilterCondition {
60
+ field: string;
61
+ op: string;
62
+ value?: unknown;
63
+ }
55
64
  export interface RefConfig {
56
65
  entity: string;
57
66
  field?: string;
58
67
  display?: RefDisplay;
59
68
  fields?: string[];
69
+ /** Narrows the option set offered by this ref's entity-select dropdown (edit
70
+ * combobox or action-param picker) to rows matching these conditions - e.g.
71
+ * only `is_active = true`. Read-side only (not a write/security boundary);
72
+ * mirrors engine RefConfig.OptionsFilter. */
73
+ options_filter?: FilterCondition[];
60
74
  }
61
75
  /** One declared filter-only option ({code, label}). `code` is stored into the
62
76
  * filter when chosen (a literal or a `$user.*` token resolved server-side);
@@ -694,11 +708,7 @@ export interface ViewDefinition {
694
708
  name: LocalizedString;
695
709
  description?: LocalizedString;
696
710
  icon?: string;
697
- filters?: Array<{
698
- field: string;
699
- op: string;
700
- value?: unknown;
701
- }>;
711
+ filters?: FilterCondition[];
702
712
  columns?: string[];
703
713
  sort?: string;
704
714
  }
@@ -1456,7 +1456,7 @@ function Ct() {
1456
1456
  return H.parentOrigin;
1457
1457
  }
1458
1458
  function wt() {
1459
- return H.current ? Date.now() >= H.current.expiresAt - yt : !0;
1459
+ return !H.current || Date.now() >= H.current.expiresAt - yt;
1460
1460
  }
1461
1461
  function Tt(e) {
1462
1462
  if (!e.token || typeof e.token != "string") return;
@@ -2755,7 +2755,7 @@ var Z = {
2755
2755
  update: Ur,
2756
2756
  dismiss: (e) => g.dismiss(e),
2757
2757
  dismissAll: () => g.dismiss()
2758
- }, Wr = a(() => import("./MarkdownRenderer-14LG1clY.js").then((e) => ({ default: e.MarkdownRenderer })));
2758
+ }, Wr = a(() => import("./MarkdownRenderer-jhYOLGsz.js").then((e) => ({ default: e.MarkdownRenderer })));
2759
2759
  function Gr() {
2760
2760
  return /* @__PURE__ */ v("div", { className: "h-4 w-2/3 rounded bg-muted animate-pulse" });
2761
2761
  }
@@ -3351,7 +3351,8 @@ function ji({ ref: e, value: t, onChange: n, refs: r, displayFieldOverride: i, i
3351
3351
  let m = e?.entity, h = ki(m), g = i ?? e?.display?.field ?? h?.display?.display_field ?? "$display", _ = u(() => h ? z(h)[0] ?? "id" : "id", [h]), y = e?.field || _, [b, x] = f(""), S = Oi(b, 300), { data: C, isLoading: w } = Ei(m, {
3352
3352
  per_page: Ai,
3353
3353
  sort: g ? `${g}:asc` : void 0,
3354
- search: S || void 0
3354
+ search: S || void 0,
3355
+ filters: e?.options_filter
3355
3356
  }), T = u(() => C?.data ?? [], [C?.data]), E = t == null ? "" : I(t), D = u(() => T.some((e) => String(e[y]) === E), [
3356
3357
  T,
3357
3358
  y,
@@ -3479,7 +3480,7 @@ function Pi() {
3479
3480
  return /* @__PURE__ */ v("div", { className: "h-20 rounded-md border border-border bg-muted animate-pulse" });
3480
3481
  }
3481
3482
  function Fi(e) {
3482
- return e == null ? !0 : typeof e == "string" ? e.trim() === "" : Array.isArray(e) ? e.length === 0 : typeof e == "object" ? Object.keys(e).length === 0 : !1;
3483
+ return e == null ? !0 : typeof e == "string" ? e.trim() === "" : Array.isArray(e) ? e.length === 0 : typeof e == "object" && Object.keys(e).length === 0;
3483
3484
  }
3484
3485
  function Ii({ value: e, mode: t, onChange: r, fieldId: i }) {
3485
3486
  return t === "display" ? Fi(e) ? /* @__PURE__ */ v("span", {
@@ -4759,7 +4760,7 @@ function eo(e) {
4759
4760
  let t = e.split(".");
4760
4761
  if (t.length < 3) return !0;
4761
4762
  let n = t[0].toLowerCase();
4762
- return /^(com|org|net|edu|gov)$/.test(n) ? !1 : /^(io|app|dev)$/.test(n) ? $a(t[t.length - 1]) : !0;
4763
+ return /^(com|org|net|edu|gov)$/.test(n) ? !1 : !/^(io|app|dev)$/.test(n) || $a(t[t.length - 1]);
4763
4764
  }
4764
4765
  function to(e) {
4765
4766
  if (Za.test(e)) return e;
@@ -6217,6 +6218,16 @@ function Xs({ field: t }) {
6217
6218
  fontWeight: 500,
6218
6219
  textDecoration: "none",
6219
6220
  whiteSpace: "nowrap"
6221
+ }, p = i && !r, m = {
6222
+ flex: 1,
6223
+ minWidth: 0,
6224
+ display: "inline-flex",
6225
+ alignItems: "center",
6226
+ gap: 6,
6227
+ color: "var(--accent)",
6228
+ textDecoration: "underline",
6229
+ fontSize: 12.5,
6230
+ lineHeight: 1.4
6220
6231
  };
6221
6232
  return /* @__PURE__ */ y("div", {
6222
6233
  style: {
@@ -6233,7 +6244,7 @@ function Xs({ field: t }) {
6233
6244
  },
6234
6245
  children: t.label
6235
6246
  }),
6236
- i && a ? r ? /* @__PURE__ */ y("button", {
6247
+ r && a && /* @__PURE__ */ y("button", {
6237
6248
  type: "button",
6238
6249
  onClick: u,
6239
6250
  disabled: o,
@@ -6242,13 +6253,7 @@ function Xs({ field: t }) {
6242
6253
  cursor: o ? "default" : "pointer"
6243
6254
  },
6244
6255
  children: [v(o ? e.loader : e.download, { size: 14 }), /* @__PURE__ */ v("span", { children: o ? "Downloading…" : "Download" })]
6245
- }) : /* @__PURE__ */ y("a", {
6246
- href: a,
6247
- target: "_blank",
6248
- rel: "noopener noreferrer",
6249
- style: d,
6250
- children: [/* @__PURE__ */ v(e.download, { size: 14 }), /* @__PURE__ */ v("span", { children: t.value })]
6251
- }) : null,
6256
+ }),
6252
6257
  c && /* @__PURE__ */ v("div", {
6253
6258
  style: {
6254
6259
  fontSize: 11.5,
@@ -6256,7 +6261,32 @@ function Xs({ field: t }) {
6256
6261
  },
6257
6262
  children: c
6258
6263
  }),
6259
- /* @__PURE__ */ y("div", {
6264
+ p && a ? /* @__PURE__ */ y("div", {
6265
+ style: {
6266
+ display: "flex",
6267
+ alignItems: "center",
6268
+ gap: 8,
6269
+ minWidth: 0
6270
+ },
6271
+ children: [/* @__PURE__ */ y("a", {
6272
+ href: a,
6273
+ target: "_blank",
6274
+ rel: "noopener noreferrer",
6275
+ style: m,
6276
+ title: t.value,
6277
+ children: [/* @__PURE__ */ v(e.link, {
6278
+ size: 14,
6279
+ style: { flexShrink: 0 }
6280
+ }), /* @__PURE__ */ v("span", {
6281
+ style: {
6282
+ overflow: "hidden",
6283
+ textOverflow: "ellipsis",
6284
+ whiteSpace: "nowrap"
6285
+ },
6286
+ children: t.value
6287
+ })]
6288
+ }), t.copyable && /* @__PURE__ */ v(ti, { value: t.value })]
6289
+ }) : /* @__PURE__ */ y("div", {
6260
6290
  style: {
6261
6291
  position: "relative",
6262
6292
  width: "100%"
@@ -1,5 +1,5 @@
1
- import { $ as e, $t as t, Mt as n, U as r, bn as i, jt as a, ot as o, un as s } from "./useCurrentScreen-Bgp6_vne.js";
2
- import { vt as c } from "./registry-C2vvLLHm.js";
1
+ import { $ as e, $t as t, Mt as n, U as r, bn as i, jt as a, ot as o, un as s } from "./useCurrentScreen-CD6xJlyU.js";
2
+ import { vt as c } from "./registry-D6uzF1n6.js";
3
3
  import { useEffect as l, useMemo as u } from "react";
4
4
  import { useSearchParams as d } from "react-router-dom";
5
5
  import { useInfiniteQuery as f, useMutation as p, useQueryClient as m } from "@tanstack/react-query";
@@ -199,7 +199,7 @@ function O(e, t, n) {
199
199
  preview: t.preview,
200
200
  limit: t.limit,
201
201
  after: e ?? void 0,
202
- count: e ? void 0 : !0
202
+ count: !e || void 0
203
203
  }),
204
204
  getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
205
205
  initialPageParam: void 0,
@@ -1,4 +1,4 @@
1
- import { Bt as e, Ut as t, zt as n } from "./useCurrentScreen-Bgp6_vne.js";
1
+ import { Bt as e, Ut as t, zt as n } from "./useCurrentScreen-CD6xJlyU.js";
2
2
  import { useCallback as r, useEffect as i, useRef as a, useState as o } from "react";
3
3
  //#region src/embed/file-src.ts
4
4
  var s = "/api/files";
@@ -1,4 +1,4 @@
1
- import type { Plugin } from "../vite";
1
+ import type { Plugin } from "vite";
2
2
  export interface DeclarionFingerprintPluginOptions {
3
3
  /**
4
4
  * Subdirectory of `outDir` to walk. Defaults to "assets" — Vite's
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@declarion/react",
3
- "version": "0.36.6",
3
+ "version": "0.37.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "React SDK for Declarion, the schema-driven business apps platform.",
@@ -58,20 +58,20 @@
58
58
  "@dnd-kit/sortable": "^10.0.0",
59
59
  "@dnd-kit/utilities": "^3.2.2",
60
60
  "@monaco-editor/react": "^4.7.0",
61
- "@radix-ui/react-alert-dialog": "^1.1.18",
62
- "@radix-ui/react-dialog": "^1.1.18",
63
- "@radix-ui/react-dropdown-menu": "^2.1.19",
61
+ "@radix-ui/react-alert-dialog": "^1.1.19",
62
+ "@radix-ui/react-dialog": "^1.1.19",
63
+ "@radix-ui/react-dropdown-menu": "^2.1.20",
64
64
  "@radix-ui/react-label": "^2.1.11",
65
- "@radix-ui/react-select": "^2.3.2",
65
+ "@radix-ui/react-select": "^2.3.3",
66
66
  "@radix-ui/react-separator": "^1.1.11",
67
67
  "@radix-ui/react-slot": "^1.3.0",
68
68
  "@tanstack/react-query": "^5.101.2",
69
69
  "@tanstack/react-table": "^8.21.3",
70
- "@tanstack/react-virtual": "^3.14.5",
70
+ "@tanstack/react-virtual": "^3.14.6",
71
71
  "class-variance-authority": "^0.7.1",
72
72
  "clsx": "^2.1.1",
73
73
  "date-fns": "^4.4.0",
74
- "lucide-react": "^1.23.0",
74
+ "lucide-react": "^1.24.0",
75
75
  "mdast-util-to-string": "^4.0.0",
76
76
  "monaco-editor": "^0.55.1",
77
77
  "react-markdown": "^10.1.0",
@@ -100,18 +100,18 @@
100
100
  "@vitejs/plugin-react": "^6.0.3",
101
101
  "@vitest/coverage-v8": "^4.1.10",
102
102
  "axe-core": "^4.12.1",
103
- "eslint": "^10.6.0",
103
+ "eslint": "^10.7.0",
104
104
  "eslint-plugin-react-hooks": "^7.1.1",
105
105
  "jsdom": "^29.1.1",
106
- "msw": "^2.14.6",
106
+ "msw": "^2.15.0",
107
107
  "publint": "^0.3.0",
108
108
  "react": "^19.2.7",
109
109
  "react-dom": "^19.2.7",
110
110
  "tailwindcss": "^4.3.2",
111
- "tsc-alias": "^1.9.0",
111
+ "tsc-alias": "^1.9.1",
112
112
  "typescript": "^6.0.3",
113
- "typescript-eslint": "^8.63.0",
114
- "vite": "^8.1.3",
113
+ "typescript-eslint": "^8.64.0",
114
+ "vite": "^8.1.4",
115
115
  "vitest": "^4.1.10"
116
116
  },
117
117
  "scripts": {