@declarion/react 0.43.0 → 0.45.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,4 +1,4 @@
1
- import { Dt as e, Et as t, Ot as n, er as r, jt as i, r as a, t as o, yt as s } from "./useCurrentScreen-CpQjVmrT.js";
1
+ import { Dt as e, Et as t, Ot as n, jt as r, r as i, t as a, tr as o, yt as s } from "./useCurrentScreen-A3xZDs7U.js";
2
2
  import { useState as c } from "react";
3
3
  import { MemoryRouter as l } from "react-router";
4
4
  import { QueryClient as u, QueryClientProvider as d } from "@tanstack/react-query";
@@ -70,7 +70,7 @@ function S() {
70
70
  created_at: "2026-01-01T00:00:00Z",
71
71
  updated_at: "2026-01-01T00:00:00Z"
72
72
  };
73
- i.getState().setUser(t, e);
73
+ r.getState().setUser(t, e);
74
74
  }
75
75
  function C(e) {
76
76
  if (e === void 0) return { rows: [] };
@@ -125,7 +125,7 @@ function w(r) {
125
125
  });
126
126
  }
127
127
  function T() {
128
- n(null), e(null), t(null), i.setState({
128
+ n(null), e(null), t(null), r.setState({
129
129
  user: null,
130
130
  isAuthenticated: !1,
131
131
  activeTenant: null,
@@ -138,28 +138,28 @@ function E(e, t = {}) {
138
138
  gcTime: Infinity
139
139
  } } });
140
140
  S(), n.setQueryData(["schema", !0], t.schema ?? g()), w(t);
141
- let i = t.screenCode ? /* @__PURE__ */ p(o, {
141
+ let r = t.screenCode ? /* @__PURE__ */ p(a, {
142
142
  code: t.screenCode,
143
143
  children: e
144
144
  }) : e, s = /* @__PURE__ */ m(d, {
145
145
  client: n,
146
146
  children: [/* @__PURE__ */ p(l, {
147
147
  initialEntries: [t.route ?? "/"],
148
- children: /* @__PURE__ */ p(a, { children: i })
148
+ children: /* @__PURE__ */ p(i, { children: r })
149
149
  }), /* @__PURE__ */ p(f, {})]
150
- }), c = h(t.viewport ? /* @__PURE__ */ p(r, {
150
+ }), c = h(t.viewport ? /* @__PURE__ */ p(o, {
151
151
  viewportOverride: t.viewport,
152
152
  children: s
153
153
  }) : s);
154
154
  return Object.assign(c, { queryClient: n });
155
155
  }
156
156
  function D({ children: e, authenticated: t = !0, ...n }) {
157
- let [r] = c(() => {
157
+ let [a] = c(() => {
158
158
  let e = new u({ defaultOptions: { queries: {
159
159
  retry: !1,
160
160
  gcTime: Infinity
161
161
  } } });
162
- return t ? (S(), e.setQueryData(["schema", !0], n.schema ?? g())) : i.setState({
162
+ return t ? (S(), e.setQueryData(["schema", !0], n.schema ?? g())) : r.setState({
163
163
  user: null,
164
164
  isAuthenticated: !1,
165
165
  activeTenant: null,
@@ -167,10 +167,10 @@ function D({ children: e, authenticated: t = !0, ...n }) {
167
167
  }), w(n), e;
168
168
  });
169
169
  return /* @__PURE__ */ m(d, {
170
- client: r,
170
+ client: a,
171
171
  children: [/* @__PURE__ */ p(l, {
172
172
  initialEntries: [n.route ?? "/"],
173
- children: /* @__PURE__ */ p(a, { children: e })
173
+ children: /* @__PURE__ */ p(i, { children: e })
174
174
  }), /* @__PURE__ */ p(f, {})]
175
175
  });
176
176
  }
@@ -1,5 +1,6 @@
1
1
  import type { AccentDef, LocalizedString } from "./schema";
2
2
  import type { HydratedFile } from "./files";
3
+ import type { FilterNode } from "../lib/filters";
3
4
  export interface ListMeta {
4
5
  /**
5
6
  * Total matching rows. Present only when the request asked for a count
@@ -390,7 +391,7 @@ export interface ListParams {
390
391
  sort?: string;
391
392
  search?: string;
392
393
  /** JSON filter nodes (recursive AND/OR tree). */
393
- filters?: FilterNodeParam[];
394
+ filters?: FilterNode[];
394
395
  include_deleted?: boolean;
395
396
  expand?: string[];
396
397
  screen?: string;
@@ -414,14 +415,6 @@ export interface ListParams {
414
415
  */
415
416
  count?: "window" | "only" | "with" | "exact";
416
417
  }
417
- /** Minimal filter node type for API params (matches backend FilterNode). */
418
- export interface FilterNodeParam {
419
- field?: string;
420
- op?: string;
421
- value?: unknown;
422
- or?: FilterNodeParam[][];
423
- and?: FilterNodeParam[];
424
- }
425
418
  /** Cursor-based pagination metadata returned by v2 List. */
426
419
  export interface V2Meta {
427
420
  total: number;
@@ -492,7 +485,7 @@ export interface V2ListParams {
492
485
  expand?: string[];
493
486
  sort?: string;
494
487
  search?: string;
495
- filters?: FilterNodeParam[];
488
+ filters?: FilterNode[];
496
489
  limit?: number;
497
490
  after?: string;
498
491
  include_deleted?: boolean;
@@ -1,6 +1,7 @@
1
1
  import { OrderedMap } from "./ordmap";
2
2
  import type { FileFieldDef } from "./files";
3
3
  import type { IconDef } from "../stores/icon-registry";
4
+ import type { FilterNode } from "../lib/filters";
4
5
  export { OrderedMap };
5
6
  export type { IconDef };
6
7
  export type LocalizedString = Record<string, string>;
@@ -55,15 +56,6 @@ export declare function fieldDisplayName(field: EntityField, fieldName: string,
55
56
  export interface RefDisplay {
56
57
  field: string;
57
58
  }
58
- /** A single declarative filter condition ({field, op, value}). Shared by
59
- * ViewDefinition.filters (screen views) and RefConfig.options_filter (ref
60
- * dropdown option narrowing); mirrors engine.ViewFilter. Structurally a subset
61
- * of the wire FilterNodeParam, so it can feed a list query's `filters`. */
62
- export interface FilterCondition {
63
- field: string;
64
- op: string;
65
- value?: unknown;
66
- }
67
59
  export interface RefConfig {
68
60
  entity: string;
69
61
  field?: string;
@@ -71,9 +63,10 @@ export interface RefConfig {
71
63
  fields?: string[];
72
64
  /** Narrows the option set offered by this ref's entity-select dropdown (edit
73
65
  * combobox or action-param picker) to rows matching these conditions - e.g.
74
- * only `is_active = true`. Read-side only (not a write/security boundary);
75
- * mirrors engine RefConfig.OptionsFilter. */
76
- options_filter?: FilterCondition[];
66
+ * only `is_active = true`. Read-side only (not a write/security boundary).
67
+ * The shared filter tree, so a declared narrowing takes the same shapes a
68
+ * list query's `filters` takes. */
69
+ options_filter?: FilterNode[];
77
70
  }
78
71
  /** One declared filter-only option ({code, label}). `code` is stored into the
79
72
  * filter when chosen (a literal or a `$user.*` token resolved server-side);
@@ -368,6 +361,16 @@ export interface Entity {
368
361
  properties?: Record<string, PropertyDef>;
369
362
  search_fields?: string[];
370
363
  actions?: Record<string, Action>;
364
+ /**
365
+ * Platform-default action codes the engine must NOT inject for this entity
366
+ * (`__new`, `__edit`, `__create`, ...). Declared in the entity's YAML.
367
+ *
368
+ * A disabled `__new` closes the CREATE ROUTE too, not only the toolbar
369
+ * button: `<list>/new` is the detail route with the literal id `new`, so
370
+ * without this the form the removed button pointed at still rendered for
371
+ * anyone who typed the address or kept a bookmark.
372
+ */
373
+ disable_defaults?: string[];
371
374
  handlers?: Record<string, HandlerDef>;
372
375
  associations?: Record<string, AssociationDef>;
373
376
  files?: OrderedMap<FileFieldDef>;
@@ -475,6 +478,7 @@ export interface ExportConfig {
475
478
  enabled?: boolean;
476
479
  }
477
480
  export declare function entityAllowsMutation(entity: Pick<Entity, "readonly" | "mutations"> | undefined, op: EntityMutationOp): boolean;
481
+ export declare function entityAllowsCreateRoute(entity: Pick<Entity, "disable_defaults"> | undefined): boolean;
478
482
  export declare function getPrimaryKeyFields(entity: Entity): string[];
479
483
  export type PkValues = Record<string, string>;
480
484
  export declare function extractPkValues(entity: Entity, record: Record<string, unknown>): PkValues;
@@ -661,6 +665,14 @@ export interface Screen {
661
665
  * field code. Append/replace/clear the entity field's declared values for
662
666
  * just this screen. Mirrors engine.Screen.FilterSpecialValues. */
663
667
  filter_special_values?: Record<string, ScreenFilterSpecialValues>;
668
+ /** Per-field operator lists, keyed by filter field code, published by the
669
+ * server from the ONE vocabulary the query builder enforces
670
+ * (engine.OperatorsByFieldType, plus the $status / $property sets). The
671
+ * filter drawer renders exactly these; it keeps no table of its own,
672
+ * because a client-side guess had already diverged - array, multilang,
673
+ * json and bytes fields were offered two operators the builder rejects
674
+ * and denied `contains`, the one that works. */
675
+ filter_operators?: Record<string, string[]>;
664
676
  views?: ViewDefinition[];
665
677
  /** Action slot promotion for list screens (rule-of-2). UI honors first 2.
666
678
  * Note: primary_record_actions (detail header) was removed in Task 5 of plan
@@ -720,7 +732,7 @@ export interface ViewDefinition {
720
732
  name: LocalizedString;
721
733
  description?: LocalizedString;
722
734
  icon?: string;
723
- filters?: FilterCondition[];
735
+ filters?: FilterNode[];
724
736
  columns?: string[];
725
737
  sort?: string;
726
738
  }