@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,5 +1,5 @@
1
- import { Gt as e, In as t, Kt as n, bt as r, pn as i, pt as a, rt as o, wn as s } from "./useCurrentScreen-CpQjVmrT.js";
2
- import { ut as c } from "./registry-r4hiflwC.js";
1
+ import { Gt as e, Kt as t, Ln as n, Tn as r, bt as i, pn as a, pt as o, rt as s } from "./useCurrentScreen-A3xZDs7U.js";
2
+ import { ut as c } from "./registry-DJKp0yaV.js";
3
3
  import { useEffect as l, useLayoutEffect as u, useMemo as d } from "react";
4
4
  import { useSearchParams as f } from "react-router";
5
5
  import { useInfiniteQuery as p, useMutation as m, useQueryClient as h } from "@tanstack/react-query";
@@ -54,11 +54,11 @@ var x = class {
54
54
  let n, r = !1;
55
55
  try {
56
56
  n = await e(b(this.entity, t));
57
- } catch (a) {
58
- if (t.after && i(a)) {
57
+ } catch (i) {
58
+ if (t.after && a(i)) {
59
59
  let { after: i, ...a } = t;
60
60
  n = await e(b(this.entity, a)), r = !0;
61
- } else throw a;
61
+ } else throw i;
62
62
  }
63
63
  return this.refs.merge(n.$refs), {
64
64
  data: n.data.map((e) => v(e)),
@@ -72,7 +72,7 @@ var x = class {
72
72
  }
73
73
  async createMany(e) {
74
74
  if (e.length === 0) return [];
75
- let t = await n("system.batch", {
75
+ let n = await t("system.batch", {
76
76
  actions: e.map((e) => ({
77
77
  action: `${this.entity}.__create`,
78
78
  params: {
@@ -82,7 +82,7 @@ var x = class {
82
82
  })),
83
83
  atomic: !0
84
84
  });
85
- return S(t, `${this.entity}.__create`), t.results.map((e) => v(C(e)));
85
+ return S(n, `${this.entity}.__create`), n.results.map((e) => v(C(e)));
86
86
  }
87
87
  async update(e, t) {
88
88
  return (await this.updateMany([{
@@ -92,7 +92,7 @@ var x = class {
92
92
  }
93
93
  async updateMany(e) {
94
94
  if (e.length === 0) return [];
95
- let t = await n("system.batch", {
95
+ let n = await t("system.batch", {
96
96
  actions: e.map(({ id: e, ...t }) => ({
97
97
  action: `${this.entity}.__update`,
98
98
  params: {
@@ -103,13 +103,13 @@ var x = class {
103
103
  })),
104
104
  atomic: !0
105
105
  });
106
- return S(t, `${this.entity}.__update`), t.results.map((e) => v(C(e)));
106
+ return S(n, `${this.entity}.__update`), n.results.map((e) => v(C(e)));
107
107
  }
108
108
  async delete(e) {
109
109
  await this.deleteMany([e]);
110
110
  }
111
111
  async deleteMany(e) {
112
- return e.length === 0 ? { count: 0 } : { count: (await r(`${this.entity}.__delete`, {
112
+ return e.length === 0 ? { count: 0 } : { count: (await i(`${this.entity}.__delete`, {
113
113
  object_ids: e,
114
114
  entity: this.entity
115
115
  })).object_count ?? e.length };
@@ -118,7 +118,7 @@ var x = class {
118
118
  await this.restoreMany([e]);
119
119
  }
120
120
  async restoreMany(e) {
121
- return e.length === 0 ? { count: 0 } : { count: (await r(`${this.entity}.__restore`, {
121
+ return e.length === 0 ? { count: 0 } : { count: (await i(`${this.entity}.__restore`, {
122
122
  object_ids: e,
123
123
  entity: this.entity
124
124
  })).object_count ?? e.length };
@@ -126,15 +126,15 @@ var x = class {
126
126
  async upsert(e, t) {
127
127
  return (await this.upsertMany([e], t))[0];
128
128
  }
129
- async upsertMany(e, t) {
129
+ async upsertMany(e, n) {
130
130
  if (e.length === 0) return [];
131
- let r = await n("system.batch", {
131
+ let r = await t("system.batch", {
132
132
  actions: e.map((e) => ({
133
133
  action: `${this.entity}.__upsert`,
134
134
  params: {
135
135
  entity: this.entity,
136
136
  fields: e,
137
- unique_by: t
137
+ unique_by: n
138
138
  }
139
139
  })),
140
140
  atomic: !0
@@ -233,7 +233,7 @@ function k(e, t, n) {
233
233
  //#endregion
234
234
  //#region src/hooks/useTabSearchMirror.ts
235
235
  function A(e) {
236
- let t = a(), [n] = f();
236
+ let t = o(), [n] = f();
237
237
  u(() => {
238
238
  if (!e || t.enabled) return;
239
239
  let r = c.getState(), i = r.findTabByPathname(e);
@@ -247,7 +247,7 @@ function A(e) {
247
247
  //#endregion
248
248
  //#region src/hooks/useRegisterScreenTab.ts
249
249
  function j(e, t, n, r) {
250
- let i = a();
250
+ let i = o();
251
251
  l(() => {
252
252
  !e || i.enabled || c.getState().openTab({
253
253
  pathname: e,
@@ -264,8 +264,8 @@ function j(e, t, n, r) {
264
264
  ]);
265
265
  }
266
266
  function M(e, t, n) {
267
- let r = e?.route, i = t ? s(e?.display?.name) || s(t.display.name_plural) : "", a = e?.display?.icon || t?.display.icon;
268
- j(t ? r : void 0, i, a, n);
267
+ let i = e?.route, a = t ? r(e?.display?.name) || r(t.display.name_plural) : "", o = e?.display?.icon || t?.display.icon;
268
+ j(t ? i : void 0, a, o, n);
269
269
  }
270
270
  //#endregion
271
271
  //#region src/lib/filters.ts
@@ -328,16 +328,16 @@ function z(e) {
328
328
  function B(e) {
329
329
  return z(e).length;
330
330
  }
331
- function V(e, n) {
331
+ function V(e, t) {
332
332
  if (!e.field || !e.op) return "";
333
333
  let r = F[e.op] || e.op;
334
334
  if (N.has(e.op)) return `${r}`;
335
335
  let i = e.field, a = (e) => {
336
- if (n) {
337
- let t = n(i, e);
338
- return t.label != null && (t.status === "special" || t.status === "resolved") ? t.label : t.raw;
336
+ if (t) {
337
+ let n = t(i, e);
338
+ return n.label != null && (n.status === "special" || n.status === "resolved") ? n.label : n.raw;
339
339
  }
340
- return t(e);
340
+ return n(e);
341
341
  };
342
342
  return `${r} ${Array.isArray(e.value) ? e.value.map(a).join(", ") : a(e.value)}`;
343
343
  }
@@ -373,13 +373,13 @@ function U(e, t) {
373
373
  }
374
374
  //#endregion
375
375
  //#region src/api/status.ts
376
- async function W(e, t, n, i, a) {
376
+ async function W(e, t, n, r, a) {
377
377
  let o = {
378
378
  status_group_code: n,
379
- status_code: i
379
+ status_code: r
380
380
  };
381
381
  a != null && (o.note = a);
382
- let s = (await r(`${e}.__update`, {
382
+ let s = (await i(`${e}.__update`, {
383
383
  object_ids: [t],
384
384
  entity: e,
385
385
  fields: { $statuses: [o] }
@@ -396,25 +396,25 @@ function G(e, t) {
396
396
  n.invalidateQueries({ queryKey: ["entity-item", e] });
397
397
  },
398
398
  onError: (e) => {
399
- o.error(e.message);
399
+ s.error(e.message);
400
400
  }
401
401
  });
402
402
  }
403
403
  //#endregion
404
404
  //#region src/api/properties.ts
405
- async function K(e, t, n, i) {
406
- let a = (await r(`${e}.__update`, {
405
+ async function K(e, t, n, r) {
406
+ let a = (await i(`${e}.__update`, {
407
407
  object_ids: [t],
408
408
  entity: e,
409
409
  fields: { $properties: [{
410
410
  property_code: n,
411
- value: i
411
+ value: r
412
412
  }] }
413
413
  })).result?.rows?.[0]?.$properties ?? [];
414
414
  return a.find((e) => e.property_code === n) ?? a[0];
415
415
  }
416
416
  async function q(e, t, n) {
417
- await r(`${e}.__update`, {
417
+ await i(`${e}.__update`, {
418
418
  object_ids: [t],
419
419
  entity: e,
420
420
  fields: { $properties: [{
@@ -433,7 +433,7 @@ function J(e, t) {
433
433
  n.invalidateQueries({ queryKey: ["entity-item", e] });
434
434
  },
435
435
  onError: (e) => {
436
- o.error(e.message);
436
+ s.error(e.message);
437
437
  }
438
438
  });
439
439
  }
@@ -445,7 +445,7 @@ function Y(e, t) {
445
445
  n.invalidateQueries({ queryKey: ["entity-item", e] });
446
446
  },
447
447
  onError: (e) => {
448
- o.error(e.message);
448
+ s.error(e.message);
449
449
  }
450
450
  });
451
451
  }
@@ -1,4 +1,4 @@
1
- import { $t as e, en as t, rn as n } from "./useCurrentScreen-CpQjVmrT.js";
1
+ import { $t as e, en as t, rn as n } from "./useCurrentScreen-A3xZDs7U.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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@declarion/react",
3
- "version": "0.43.0",
3
+ "version": "0.45.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "React SDK for Declarion, the schema-driven business apps platform.",