@declarion/react 0.429.0 → 0.442.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,25 +1,27 @@
1
1
  import { apiFetch as e, apiFetchBlob as t } from "./client.js";
2
- import { ApiError as n } from "../types/api.js";
2
+ import { bindRowReferences as n } from "../lib/reference.js";
3
+ import { ApiError as r } from "../types/api.js";
3
4
  // src/api/data.ts
4
- function r(e, t) {
5
+ function i(e, t) {
5
6
  let n = new URL(`/api/data/${e}`, window.location.origin);
6
7
  if (t.page && n.searchParams.set("page", String(t.page)), t.per_page && n.searchParams.set("per_page", String(t.per_page)), t.sort && n.searchParams.set("sort", t.sort), t.search && n.searchParams.set("search", t.search), t.filters && t.filters.length > 0 && n.searchParams.set("filters", JSON.stringify(t.filters)), t.include_deleted && n.searchParams.set("include_deleted", "true"), t.expand) for (let e of t.expand) n.searchParams.append("expand", e);
7
8
  return t.select && t.select.length > 0 && n.searchParams.set("select", t.select.join(",")), t.screen && n.searchParams.set("screen", t.screen), t.preview && n.searchParams.set("preview", "true"), t.count && n.searchParams.set("count", t.count), n.pathname + n.search;
8
9
  }
9
- async function i(t, n = {}, i = {}) {
10
- if (y) {
11
- let e = y(t, n);
12
- if (e !== void 0) return e;
10
+ async function a(t, r = {}, a = {}) {
11
+ if (b) {
12
+ let e = b(t, r);
13
+ if (e !== void 0) return n(e.data, e.$refs), e;
13
14
  }
14
- return e(r(t, n), { signal: i.signal });
15
+ let o = await e(i(t, r), { signal: a.signal });
16
+ return n(o.data, o.$refs), o;
15
17
  }
16
- async function a(t, n, r = {}) {
18
+ async function o(t, n, r = {}) {
17
19
  let i = new URLSearchParams({ aggregate: n.aggregate.join(",") });
18
20
  return n.group_by && i.set("group_by", n.group_by), n.filters && n.filters.length > 0 && i.set("filters", JSON.stringify(n.filters)), n.search && i.set("search", n.search), n.screen && i.set("screen", n.screen), n.include_deleted && i.set("include_deleted", "true"), e(`/api/data/${t}?${i.toString()}`, { signal: r.signal });
19
21
  }
20
- async function o(t, n, r = {}) {
21
- if (b) {
22
- let e = b(t, n);
22
+ async function s(t, n, r = {}) {
23
+ if (x) {
24
+ let e = x(t, n);
23
25
  if (e !== void 0) return e;
24
26
  }
25
27
  let i = new URLSearchParams();
@@ -27,39 +29,39 @@ async function o(t, n, r = {}) {
27
29
  else for (let [e, t] of Object.entries(n)) i.set(e, t);
28
30
  return r.expand?.length && i.set("expand", r.expand.join(",")), e(`/api/data/${t}?${i.toString()}`);
29
31
  }
30
- async function s(e, t) {
31
- return { data: ((await C(`${e}.__create`, {
32
+ async function c(e, t) {
33
+ return { data: ((await w(`${e}.__create`, {
32
34
  entity: e,
33
35
  fields: t
34
36
  })).result?.rows ?? [])[0] };
35
37
  }
36
- async function c(e, t, n) {
37
- let r = typeof t == "string" ? t : u(t);
38
- return { data: ((await C(`${e}.__update`, {
38
+ async function l(e, t, n) {
39
+ let r = typeof t == "string" ? t : d(t);
40
+ return { data: ((await w(`${e}.__update`, {
39
41
  object_ids: [r],
40
42
  entity: e,
41
43
  fields: n
42
44
  })).result?.rows ?? [])[0] };
43
45
  }
44
- async function l(e, t) {
45
- let n = typeof t == "string" ? t : u(t);
46
- await C(`${e}.__delete`, {
46
+ async function u(e, t) {
47
+ let n = typeof t == "string" ? t : d(t);
48
+ await w(`${e}.__delete`, {
47
49
  object_ids: [n],
48
50
  entity: e
49
51
  });
50
52
  }
51
- function u(e) {
53
+ function d(e) {
52
54
  let t = Object.values(e);
53
55
  return t.length === 1 ? t[0] : t.join("");
54
56
  }
55
- async function d(e, t) {
56
- let n = typeof t == "string" ? t : u(t);
57
- await C(`${e}.__restore`, {
57
+ async function f(e, t) {
58
+ let n = typeof t == "string" ? t : d(t);
59
+ await w(`${e}.__restore`, {
58
60
  object_ids: [n],
59
61
  entity: e
60
62
  });
61
63
  }
62
- async function f(e, n) {
64
+ async function p(e, n) {
63
65
  let r = await t(`/api/data/${e}/export`, {
64
66
  method: "POST",
65
67
  body: JSON.stringify(n)
@@ -69,53 +71,53 @@ async function f(e, n) {
69
71
  filename: r.filename
70
72
  };
71
73
  }
72
- function p(e) {
74
+ function m(e) {
73
75
  return !!e && ((e.failed_count ?? 0) > 0 || (e.timed_out_count ?? 0) > 0);
74
76
  }
75
- var m = class extends Error {
77
+ var h = class extends Error {
76
78
  status;
77
79
  response;
78
80
  constructor(e, t) {
79
81
  super(t.errors?.[0]?.error?.title ?? ""), this.name = "ActionBatchError", this.status = e, this.response = t;
80
82
  }
81
83
  };
82
- function h(e) {
84
+ function g(e) {
83
85
  if (!e || typeof e != "object") return !1;
84
86
  let t = e;
85
87
  return typeof t.status == "string" && Array.isArray(t.errors);
86
88
  }
87
- function g(e, t) {
89
+ function _(e, t) {
88
90
  let n = { ...e ?? {} };
89
91
  if ("object_ids" in n) throw Error("handler param \"object_ids\" collides with reserved key");
90
92
  return t !== void 0 && (n.object_ids = t), n;
91
93
  }
92
- var _ = null;
93
- function v(e) {
94
- let t = _;
95
- return _ = e, t;
96
- }
97
- var y = null, b = null;
98
- function x(e) {
99
- let t = y;
100
- return y = e, t;
94
+ var v = null;
95
+ function y(e) {
96
+ let t = v;
97
+ return v = e, t;
101
98
  }
99
+ var b = null, x = null;
102
100
  function S(e) {
103
101
  let t = b;
104
102
  return b = e, t;
105
103
  }
106
- async function C(t, r) {
107
- if (_) return _(t, r);
104
+ function C(e) {
105
+ let t = x;
106
+ return x = e, t;
107
+ }
108
+ async function w(t, n) {
109
+ if (v) return v(t, n);
108
110
  try {
109
111
  return await e(`/api/actions/${t}`, {
110
112
  method: "POST",
111
- body: JSON.stringify(r)
113
+ body: JSON.stringify(n)
112
114
  });
113
115
  } catch (e) {
114
- throw e instanceof n && h(e.raw) ? new m(e.status, e.raw) : e;
116
+ throw e instanceof r && g(e.raw) ? new h(e.status, e.raw) : e;
115
117
  }
116
118
  }
117
- async function w(t, n) {
119
+ async function T(t, n) {
118
120
  let r = new URLSearchParams();
119
121
  return r.set("ids", n.join(",")), e(`/api/associations/${t}?${r.toString()}`);
120
122
  }
121
- export { m as ActionBatchError, a as aggregateEntities, g as buildActionBody, s as createEntity, l as deleteObject, u as encodeObjectId, p as eventsFailed, C as executeAction, f as exportEntities, o as getEntity, i as listEntities, w as resolveAssociation, d as restoreObject, v as setActionExecutor, S as setGetEntityResolver, x as setListEntitiesResolver, c as updateEntity };
123
+ export { h as ActionBatchError, o as aggregateEntities, _ as buildActionBody, c as createEntity, u as deleteObject, d as encodeObjectId, m as eventsFailed, w as executeAction, p as exportEntities, s as getEntity, a as listEntities, T as resolveAssociation, f as restoreObject, y as setActionExecutor, C as setGetEntityResolver, S as setListEntitiesResolver, l as updateEntity };
@@ -1,21 +1,23 @@
1
1
  import { apiFetch as e, callHandler as t } from "./client.js";
2
2
  import { executeAction as n } from "./data.js";
3
- import { errorCodeOf as r, isCursorStaleError as i } from "../types/api.js";
3
+ import { bindRowReferences as r, isPolymorphicReferenceBucket as i } from "../lib/reference.js";
4
+ import { errorCodeOf as a, isCursorStaleError as o } from "../types/api.js";
4
5
  // src/api/entities.ts
5
- function a(e, t) {
6
+ function s(e, t) {
6
7
  return e.$statuses?.find((e) => e.group_code === t);
7
8
  }
8
- function o(e, t) {
9
+ function c(e, t) {
9
10
  return e.$properties?.find((e) => e.property_code === t);
10
11
  }
11
- function s(e) {
12
+ function l(e) {
12
13
  let t = { ...e };
13
- return t.$status = (e) => a(t, e), t.$property = (e) => o(t, e), t;
14
+ return t.$status = (e) => s(t, e), t.$property = (e) => c(t, e), t;
14
15
  }
15
- var c = class {
16
+ var u = class {
16
17
  cache = {};
17
18
  merge(e) {
18
19
  if (e) for (let t of Object.keys(e)) {
20
+ if (i(t)) continue;
19
21
  this.cache[t] || (this.cache[t] = {});
20
22
  let n = e[t];
21
23
  for (let e of Object.keys(n)) this.cache[t][e] = {
@@ -34,35 +36,40 @@ var c = class {
34
36
  this.cache = {};
35
37
  }
36
38
  };
37
- function l(e, t) {
39
+ function d(e, t) {
38
40
  let n = new URL(`/api/data/${e}`, window.location.origin);
39
41
  return t.select && t.select.length > 0 && n.searchParams.set("select", t.select.join(",")), t.expand && t.expand.length > 0 && n.searchParams.set("expand", t.expand.join(",")), t.sort && n.searchParams.set("sort", t.sort), t.search && n.searchParams.set("search", t.search), t.limit && n.searchParams.set("limit", String(t.limit)), t.after && n.searchParams.set("after", t.after), t.count && n.searchParams.set("count", "with"), t.screen && n.searchParams.set("screen", t.screen), t.preview && n.searchParams.set("preview", "true"), t.include_deleted && n.searchParams.set("include_deleted", "true"), t.filters && t.filters.length > 0 && n.searchParams.set("filters", JSON.stringify(t.filters)), n.pathname + n.search;
40
42
  }
41
- var u = class {
43
+ var f = class {
42
44
  entity;
43
45
  refs;
44
46
  constructor(e, t) {
45
- this.entity = e, this.refs = t ?? new c();
47
+ this.entity = e, this.refs = t ?? new u();
46
48
  }
47
49
  async get(t) {
48
50
  let n = new URLSearchParams(typeof t == "string" ? { id: t } : t);
49
- return s((await e(`/api/data/${this.entity}?${n.toString()}`)).data);
51
+ return l((await e(`/api/data/${this.entity}?${n.toString()}`)).data);
50
52
  }
51
53
  async list(t = {}) {
52
- let n, r = !1;
54
+ let n, a = !1;
53
55
  try {
54
- n = await e(l(this.entity, t));
55
- } catch (a) {
56
- if (t.after && i(a)) {
57
- let { after: i, ...a } = t;
58
- n = await e(l(this.entity, a)), r = !0;
59
- } else throw a;
56
+ n = await e(d(this.entity, t));
57
+ } catch (r) {
58
+ if (t.after && o(r)) {
59
+ let { after: r, ...i } = t;
60
+ n = await e(d(this.entity, i)), a = !0;
61
+ } else throw r;
60
62
  }
61
- return this.refs.merge(n.$refs), {
62
- data: n.data.map((e) => s(e)),
63
+ this.refs.merge(n.$refs);
64
+ let s = r(n.data.map((e) => l(e)), n.$refs), c = Object.fromEntries(Object.entries(n.$refs ?? {}).filter(([e]) => i(e)));
65
+ return {
66
+ data: s,
63
67
  meta: n.meta,
64
- $refs: this.refs.all(),
65
- reset: r
68
+ $refs: {
69
+ ...this.refs.all(),
70
+ ...c
71
+ },
72
+ reset: a
66
73
  };
67
74
  }
68
75
  async create(e) {
@@ -80,7 +87,7 @@ var u = class {
80
87
  actions: n,
81
88
  atomic: !0
82
89
  });
83
- return d(r, `${this.entity}.__create`), r.results.map((e) => s(f(e)));
90
+ return p(r, `${this.entity}.__create`), r.results.map((e) => l(m(e)));
84
91
  }
85
92
  async update(e, t) {
86
93
  return (await this.updateMany([{
@@ -101,7 +108,7 @@ var u = class {
101
108
  actions: n,
102
109
  atomic: !0
103
110
  });
104
- return d(r, `${this.entity}.__update`), r.results.map((e) => s(f(e)));
111
+ return p(r, `${this.entity}.__update`), r.results.map((e) => l(m(e)));
105
112
  }
106
113
  async delete(e) {
107
114
  await this.deleteMany([e]);
@@ -137,23 +144,23 @@ var u = class {
137
144
  actions: r,
138
145
  atomic: !0
139
146
  });
140
- return d(i, `${this.entity}.__upsert`), i.results.map((e) => s(p(e)));
147
+ return p(i, `${this.entity}.__upsert`), i.results.map((e) => l(h(e)));
141
148
  }
142
149
  };
143
- function d(e, t) {
150
+ function p(e, t) {
144
151
  if (e.committed) return;
145
- let n = e.results.find((e) => !e.ok), i = n?.error ? `${r(n.error.type)}: ${n.error.title}` : "batch did not commit";
146
- throw Error(`${t} batch failed: ${i}`);
152
+ let n = e.results.find((e) => !e.ok), r = n?.error ? `${a(n.error.type)}: ${n.error.title}` : "batch did not commit";
153
+ throw Error(`${t} batch failed: ${r}`);
147
154
  }
148
- function f(e) {
155
+ function m(e) {
149
156
  let t = e.result ?? {};
150
157
  return (Array.isArray(t.rows) ? t.rows[0] : void 0) ?? {};
151
158
  }
152
- function p(e) {
159
+ function h(e) {
153
160
  let t = e.result ?? {};
154
161
  return (Array.isArray(t.rows) ? t.rows[0] : void 0)?.row ?? {};
155
162
  }
156
- function m(e, t) {
157
- return new u(e, t);
163
+ function g(e, t) {
164
+ return new f(e, t);
158
165
  }
159
- export { u as EntityClient, c as RefCache, m as entityClient };
166
+ export { f as EntityClient, u as RefCache, g as entityClient };
@@ -1,15 +1,16 @@
1
1
  import { loader as e } from "@monaco-editor/react";
2
2
  import * as t from "monaco-editor";
3
3
  import n from "monaco-editor/editor/editor.worker.js?worker";
4
+ import r from "monaco-editor/language/json/json.worker.js?worker";
4
5
  // src/components/detail-layout/widgets/monacoBootstrap.ts
5
- var r = !1;
6
- function i() {
7
- r ||= (typeof self < "u" && (self.MonacoEnvironment = { getWorker(e, t) {
6
+ var i = !1;
7
+ function a() {
8
+ i ||= (typeof self < "u" && (self.MonacoEnvironment = { getWorker(e, t) {
8
9
  try {
9
- return new n();
10
+ return t === "json" ? new r() : new n();
10
11
  } catch {
11
12
  return;
12
13
  }
13
14
  } }), e.config({ monaco: t }), !0);
14
15
  }
15
- export { i as ensureMonacoBundled };
16
+ export { a as ensureMonacoBundled };
@@ -1,44 +1,37 @@
1
- import { resolveRefRecordLabel as e, specialValueMarker as t, specialValueMarkerCode as n } from "../../types/schema.js";
2
- import { coerceDisplayString as r } from "../../lib/display-value.js";
3
- import { RefCombobox as i } from "./RefCombobox.js";
4
- import { useText as a } from "../../hooks/useText.js";
5
- import { useMemo as o } from "react";
6
- import { jsx as s } from "react/jsx-runtime";
1
+ import { specialValueMarker as e, specialValueMarkerCode as t } from "../../types/schema.js";
2
+ import { referenceResolver as n } from "../../lib/reference.js";
3
+ import { RefCombobox as r } from "./RefCombobox.js";
4
+ import { useText as i } from "../../hooks/useText.js";
5
+ import { jsx as a } from "react/jsx-runtime";
7
6
  // src/components/fields/RefField.tsx
8
- function c({ field: c, value: l, mode: u, onChange: d, refs: f, fieldId: p, labelId: m }) {
9
- let h = a(), g = c.ref?.entity, _ = c.display?.ref_display_field || "$display", v = o(() => {
10
- if (l == null) return "—";
11
- let t = r(l);
12
- if (f && g) {
13
- let n = f[g]?.[t];
14
- if (n) return e(h, n, _, t);
15
- }
16
- return t;
17
- }, [
18
- h,
19
- l,
20
- f,
21
- g,
22
- _
23
- ]);
24
- if (u === "display") return /* @__PURE__ */ s("span", {
25
- style: { fontSize: 12.5 },
26
- children: v
27
- });
28
- let y = n(l);
29
- return /* @__PURE__ */ s(i, {
30
- ref: c.ref,
31
- value: y ?? l,
32
- onChange: (e) => {
33
- let n = typeof e == "string" && (c.special_values ?? []).some((t) => t.code === e);
34
- d?.(n ? t(e) : e);
7
+ function o({ field: o, fieldName: s, value: c, mode: l, onChange: u, record: d, refs: f, fieldId: p, labelId: m }) {
8
+ let h = i();
9
+ if (l === "display" || o.ref?.entity_field) {
10
+ let { label: e } = n({
11
+ field: o,
12
+ fieldName: s,
13
+ t: h
14
+ })(c, d ?? {}, f);
15
+ return /* @__PURE__ */ a("span", {
16
+ style: { fontSize: 12.5 },
17
+ id: p,
18
+ children: e
19
+ });
20
+ }
21
+ let g = t(c);
22
+ return /* @__PURE__ */ a(r, {
23
+ ref: o.ref,
24
+ value: g ?? c,
25
+ onChange: (t) => {
26
+ let n = typeof t == "string" && (o.special_values ?? []).some((e) => e.code === t);
27
+ u?.(n ? e(t) : t);
35
28
  },
36
29
  refs: f,
37
- displayFieldOverride: c.display?.ref_display_field,
38
- specialValues: c.special_values,
30
+ displayFieldOverride: o.display?.ref_display_field,
31
+ specialValues: o.special_values,
39
32
  id: p,
40
33
  labelId: m,
41
- required: c.required
34
+ required: o.required
42
35
  });
43
36
  }
44
- export { c as RefField };
37
+ export { o as RefField };
@@ -1,43 +1,43 @@
1
- import { getPrimaryKeyFields as e, resolveRefRecordLabel as t } from "../../../../types/schema.js";
2
- import { DynamicIcon as n } from "../../../shared/DynamicIcon.js";
3
- import { coerceDisplayString as r } from "../../../../lib/display-value.js";
4
- import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
1
+ import { DynamicIcon as e } from "../../../shared/DynamicIcon.js";
2
+ import { referenceResolver as t } from "../../../../lib/reference.js";
3
+ import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
5
4
  // src/components/fields/cells/factories/refLink.tsx
6
- var s = (t) => {
7
- let { field: s, entities: l, screens: u, refs: d, surface: f, detailScreen: p } = t, m = s.ref?.entity, h = m ? l?.[m] : void 0, g = typeof d == "function" ? d : () => d, _ = f === "detail", v = h?.display?.icon, y = s.display?.ref_display_field || "$display", b = p || h?.detail_screen, x = (b ? u?.[b] : void 0)?.route, S = h ? e(h)[0] ?? "id" : "id";
8
- return (e, s) => {
9
- if (e == null || e === "") return "—";
10
- let l = r(e), u = c(t.t, l, m, g(), y), d = m ? g()?.[m]?.[l] : void 0, f = d?.[S] == null ? l : r(d[S]), p = x ? x.replace(":id", encodeURIComponent(f)) : void 0;
11
- if (_) {
12
- let e = /* @__PURE__ */ o(i, { children: [v && /* @__PURE__ */ a("span", {
5
+ var a = (a) => {
6
+ let { field: o, refs: s, surface: c } = a, l = typeof s == "function" ? s : () => s, u = c === "detail", d = t(a);
7
+ return (t, a) => {
8
+ if (t == null || t === "") return "—";
9
+ let { label: s, resolved: c, icon: f, href: p } = d(t, a, l());
10
+ if (o.ref?.entity_field && !c) return s;
11
+ if (u) {
12
+ let t = /* @__PURE__ */ i(n, { children: [f && /* @__PURE__ */ r("span", {
13
13
  style: {
14
14
  color: "var(--text-3)",
15
15
  display: "flex",
16
16
  flexShrink: 0
17
17
  },
18
- children: /* @__PURE__ */ a(n, {
19
- name: v,
18
+ children: /* @__PURE__ */ r(e, {
19
+ name: f,
20
20
  size: 13
21
21
  })
22
- }), /* @__PURE__ */ a("span", {
22
+ }), /* @__PURE__ */ r("span", {
23
23
  style: {
24
24
  overflow: "hidden",
25
25
  textOverflow: "ellipsis",
26
26
  whiteSpace: "nowrap"
27
27
  },
28
- children: u
28
+ children: s
29
29
  })] });
30
- return p ? /* @__PURE__ */ a("a", {
30
+ return p ? /* @__PURE__ */ r("a", {
31
31
  href: p,
32
32
  rel: "noopener noreferrer",
33
33
  className: "detail-ref-chip",
34
- children: e
35
- }) : /* @__PURE__ */ a("span", {
34
+ children: t
35
+ }) : /* @__PURE__ */ r("span", {
36
36
  className: "detail-ref-chip",
37
- children: e
37
+ children: t
38
38
  });
39
39
  }
40
- return p ? /* @__PURE__ */ a("a", {
40
+ return p ? /* @__PURE__ */ r("a", {
41
41
  href: p,
42
42
  rel: "noopener noreferrer",
43
43
  style: {
@@ -45,12 +45,8 @@ var s = (t) => {
45
45
  textDecoration: "underline",
46
46
  textUnderlineOffset: 2
47
47
  },
48
- children: u
49
- }) : u;
48
+ children: s
49
+ }) : s;
50
50
  };
51
51
  };
52
- function c(e, n, r, i, a) {
53
- let o = r && i ? i[r]?.[n] : void 0;
54
- return o ? t(e, o, a, n) : n;
55
- }
56
- export { s as refLinkFactory };
52
+ export { a as refLinkFactory };
@@ -14,61 +14,63 @@ function d(e) {
14
14
  let t = e.display?.widget;
15
15
  return t && u.has(t) ? !0 : u.has(e.type);
16
16
  }
17
- function f({ field: u, fieldName: f, label: p, value: m, record: h, refs: g, readOnly: _, onCommit: v }) {
18
- let y = r(), [b, x] = o(!1), [S, C] = o(m), w = d(u);
17
+ function f({ field: u, fieldName: f, label: p, value: m, record: h, refs: g, entities: _, screens: v, readOnly: y, onCommit: b }) {
18
+ let x = r(), S = y || !!u.ref?.entity_field, [C, w] = o(!1), [T, E] = o(m), D = d(u);
19
19
  a(() => {
20
- b || C(m);
21
- }, [m, b]);
22
- let T = i(() => {
23
- _ || (C(m), x(!0));
24
- }, [_, m]), E = i((e) => {
25
- v(e === void 0 ? S : e), x(!1);
26
- }, [v, S]), D = i(() => {
27
- C(m), x(!1);
28
- }, [m]), O = i((e) => {
29
- if (_ || b) return;
20
+ C || E(m);
21
+ }, [m, C]);
22
+ let O = i(() => {
23
+ S || (E(m), w(!0));
24
+ }, [S, m]), k = i((e) => {
25
+ b(e === void 0 ? T : e), w(!1);
26
+ }, [b, T]), A = i(() => {
27
+ E(m), w(!1);
28
+ }, [m]), j = i((e) => {
29
+ if (S || C) return;
30
30
  let t = e.target;
31
- t.closest("a") || t.closest("[data-peek-pencil=\"true\"]") || T();
31
+ t.closest("a") || t.closest("[data-peek-pencil=\"true\"]") || O();
32
32
  }, [
33
- _,
34
- b,
35
- T
36
- ]), k = i((e) => {
37
- b ? w || (e.key === "Enter" ? (e.preventDefault(), e.stopPropagation(), E()) : e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), D())) : _ || e.key !== "Enter" && e.key !== " " || (e.preventDefault(), T());
33
+ S,
34
+ C,
35
+ O
36
+ ]), M = i((e) => {
37
+ C ? D || (e.key === "Enter" ? (e.preventDefault(), e.stopPropagation(), k()) : e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), A())) : S || e.key !== "Enter" && e.key !== " " || (e.preventDefault(), O());
38
38
  }, [
39
- b,
40
- w,
41
- _,
42
- T,
43
- E,
44
- D
45
- ]), A = i((e) => {
46
- w ? (C(e), E(e)) : C(e);
47
- }, [w, E]), j = n({
39
+ C,
40
+ D,
41
+ S,
42
+ O,
43
+ k,
44
+ A
45
+ ]), N = i((e) => {
46
+ D ? (E(e), k(e)) : E(e);
47
+ }, [D, k]), P = n({
48
48
  field: u,
49
49
  fieldName: f,
50
50
  value: m,
51
51
  mode: "display",
52
52
  record: h,
53
53
  refs: g,
54
- t: y
55
- }), M = b ? n({
54
+ entities: _,
55
+ screens: v,
56
+ t: x
57
+ }), F = C ? n({
56
58
  field: u,
57
59
  fieldName: f,
58
- value: S,
60
+ value: T,
59
61
  mode: "edit",
60
- onChange: A,
62
+ onChange: N,
61
63
  record: h,
62
64
  refs: g,
63
- t: y
65
+ t: x
64
66
  }) : null;
65
67
  return /* @__PURE__ */ c("div", {
66
68
  className: "peek-field-cell",
67
- "data-editing": b ? "true" : "false",
68
- onClick: O,
69
- onKeyDown: k,
69
+ "data-editing": C ? "true" : "false",
70
+ onClick: j,
71
+ onKeyDown: M,
70
72
  onMouseEnter: (e) => {
71
- _ || b || (e.currentTarget.style.borderColor = "var(--border)");
73
+ S || C || (e.currentTarget.style.borderColor = "var(--border)");
72
74
  },
73
75
  onMouseLeave: (e) => {
74
76
  e.currentTarget.style.borderColor = "transparent";
@@ -82,13 +84,13 @@ function f({ field: u, fieldName: f, label: p, value: m, record: h, refs: g, rea
82
84
  margin: "-4px -6px",
83
85
  borderRadius: "var(--radius-sm)",
84
86
  minHeight: 28,
85
- cursor: _ || b ? "default" : "text",
87
+ cursor: S || C ? "default" : "text",
86
88
  border: "1px dashed transparent"
87
89
  },
88
- tabIndex: _ || b ? -1 : 0,
89
- role: _ || b ? void 0 : "button",
90
- "aria-label": _ || b ? void 0 : y("list.peek.edit_field", "Edit {field}", { field: p }),
91
- children: b ? /* @__PURE__ */ l("div", {
90
+ tabIndex: S || C ? -1 : 0,
91
+ role: S || C ? void 0 : "button",
92
+ "aria-label": S || C ? void 0 : x("list.peek.edit_field", "Edit {field}", { field: p }),
93
+ children: C ? /* @__PURE__ */ l("div", {
92
94
  style: {
93
95
  display: "flex",
94
96
  alignItems: "center",
@@ -101,25 +103,25 @@ function f({ field: u, fieldName: f, label: p, value: m, record: h, refs: g, rea
101
103
  flex: 1,
102
104
  minWidth: 0
103
105
  },
104
- children: M
105
- }), !w && /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(t, {
106
+ children: F
107
+ }), !D && /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(t, {
106
108
  size: 24,
107
109
  icon: /* @__PURE__ */ c(e.check, { size: 13 }),
108
- onClick: () => E(),
109
- title: y("dialog.save", "Save")
110
+ onClick: () => k(),
111
+ title: x("dialog.save", "Save")
110
112
  }), /* @__PURE__ */ c(t, {
111
113
  size: 24,
112
114
  icon: /* @__PURE__ */ c(e.x, { size: 13 }),
113
- onClick: D,
114
- title: y("dialog.cancel", "Cancel")
115
+ onClick: A,
116
+ title: x("dialog.cancel", "Cancel")
115
117
  })] })]
116
118
  }) : /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("div", {
117
119
  style: {
118
120
  flex: 1,
119
121
  minWidth: 0
120
122
  },
121
- children: j
122
- }), !_ && /* @__PURE__ */ c("span", {
123
+ children: P
124
+ }), !S && /* @__PURE__ */ c("span", {
123
125
  "data-peek-pencil": "true",
124
126
  style: {
125
127
  position: "absolute",
@@ -132,9 +134,9 @@ function f({ field: u, fieldName: f, label: p, value: m, record: h, refs: g, rea
132
134
  size: 20,
133
135
  icon: /* @__PURE__ */ c(e.edit, { size: 12 }),
134
136
  onClick: (e) => {
135
- e.stopPropagation(), T();
137
+ e.stopPropagation(), O();
136
138
  },
137
- title: y("list.record.edit", "Edit")
139
+ title: x("list.record.edit", "Edit")
138
140
  })
139
141
  })] })
140
142
  });