@declarion/react 0.432.0 → 0.443.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.
- package/dist-lib/api/data.js +45 -43
- package/dist-lib/api/entities.js +39 -32
- package/dist-lib/components/detail-layout/widgets/monacoBootstrap.js +6 -5
- package/dist-lib/components/fields/RefField.js +30 -37
- package/dist-lib/components/fields/cells/factories/refLink.js +23 -27
- package/dist-lib/components/list/PeekFieldCell.js +53 -51
- package/dist-lib/components/list/QuickPeek.js +99 -96
- package/dist-lib/components/pages/SmartListPage.impl.js +3 -0
- package/dist-lib/components/pages/list/useListQuery.js +101 -100
- package/dist-lib/hooks/useCursorEntityData.js +49 -48
- package/dist-lib/hooks/useRefRecords.js +2 -0
- package/dist-lib/index.d.ts +4 -2
- package/dist-lib/lib/reference.js +53 -0
- package/dist-lib/testing.d.ts +1 -1
- package/dist-lib/types/schema.js +1 -1
- package/dist-lib/{useResponsiveMode-Yo2rIWFA.d.ts → useResponsiveMode-3hOLBkey.d.ts} +13 -1
- package/package.json +1 -1
package/dist-lib/api/data.js
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import { apiFetch as e, apiFetchBlob as t } from "./client.js";
|
|
2
|
-
import {
|
|
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
|
|
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
|
|
10
|
-
if (
|
|
11
|
-
let e =
|
|
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
|
-
|
|
15
|
+
let o = await e(i(t, r), { signal: a.signal });
|
|
16
|
+
return n(o.data, o.$refs), o;
|
|
15
17
|
}
|
|
16
|
-
async function
|
|
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
|
|
21
|
-
if (
|
|
22
|
-
let e =
|
|
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
|
|
31
|
-
return { data: ((await
|
|
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
|
|
37
|
-
let r = typeof t == "string" ? t :
|
|
38
|
-
return { data: ((await
|
|
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
|
|
45
|
-
let n = typeof t == "string" ? t :
|
|
46
|
-
await
|
|
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
|
|
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
|
|
56
|
-
let n = typeof t == "string" ? t :
|
|
57
|
-
await
|
|
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
|
|
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
|
|
74
|
+
function m(e) {
|
|
73
75
|
return !!e && ((e.failed_count ?? 0) > 0 || (e.timed_out_count ?? 0) > 0);
|
|
74
76
|
}
|
|
75
|
-
var
|
|
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
|
|
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
|
|
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
|
|
93
|
-
function
|
|
94
|
-
let t =
|
|
95
|
-
return
|
|
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
|
-
|
|
107
|
-
|
|
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(
|
|
113
|
+
body: JSON.stringify(n)
|
|
112
114
|
});
|
|
113
115
|
} catch (e) {
|
|
114
|
-
throw e instanceof
|
|
116
|
+
throw e instanceof r && g(e.raw) ? new h(e.status, e.raw) : e;
|
|
115
117
|
}
|
|
116
118
|
}
|
|
117
|
-
async function
|
|
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 {
|
|
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 };
|
package/dist-lib/api/entities.js
CHANGED
|
@@ -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 {
|
|
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
|
|
6
|
+
function s(e, t) {
|
|
6
7
|
return e.$statuses?.find((e) => e.group_code === t);
|
|
7
8
|
}
|
|
8
|
-
function
|
|
9
|
+
function c(e, t) {
|
|
9
10
|
return e.$properties?.find((e) => e.property_code === t);
|
|
10
11
|
}
|
|
11
|
-
function
|
|
12
|
+
function l(e) {
|
|
12
13
|
let t = { ...e };
|
|
13
|
-
return t.$status = (e) =>
|
|
14
|
+
return t.$status = (e) => s(t, e), t.$property = (e) => c(t, e), t;
|
|
14
15
|
}
|
|
15
|
-
var
|
|
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
|
|
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
|
|
43
|
+
var f = class {
|
|
42
44
|
entity;
|
|
43
45
|
refs;
|
|
44
46
|
constructor(e, t) {
|
|
45
|
-
this.entity = e, this.refs = t ?? new
|
|
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
|
|
51
|
+
return l((await e(`/api/data/${this.entity}?${n.toString()}`)).data);
|
|
50
52
|
}
|
|
51
53
|
async list(t = {}) {
|
|
52
|
-
let n,
|
|
54
|
+
let n, a = !1;
|
|
53
55
|
try {
|
|
54
|
-
n = await e(
|
|
55
|
-
} catch (
|
|
56
|
-
if (t.after &&
|
|
57
|
-
let { after:
|
|
58
|
-
n = await e(
|
|
59
|
-
} else throw
|
|
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
|
-
|
|
62
|
-
|
|
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:
|
|
65
|
-
|
|
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
|
|
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
|
|
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
|
|
147
|
+
return p(i, `${this.entity}.__upsert`), i.results.map((e) => l(h(e)));
|
|
141
148
|
}
|
|
142
149
|
};
|
|
143
|
-
function
|
|
150
|
+
function p(e, t) {
|
|
144
151
|
if (e.committed) return;
|
|
145
|
-
let n = e.results.find((e) => !e.ok),
|
|
146
|
-
throw Error(`${t} batch failed: ${
|
|
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
|
|
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
|
|
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
|
|
157
|
-
return new
|
|
163
|
+
function g(e, t) {
|
|
164
|
+
return new f(e, t);
|
|
158
165
|
}
|
|
159
|
-
export {
|
|
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
|
|
6
|
-
function
|
|
7
|
-
|
|
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 {
|
|
16
|
+
export { a as ensureMonacoBundled };
|
|
@@ -1,44 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { RefCombobox as
|
|
4
|
-
import { useText as
|
|
5
|
-
import {
|
|
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
|
|
9
|
-
let h =
|
|
10
|
-
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
return
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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:
|
|
38
|
-
specialValues:
|
|
30
|
+
displayFieldOverride: o.display?.ref_display_field,
|
|
31
|
+
specialValues: o.special_values,
|
|
39
32
|
id: p,
|
|
40
33
|
labelId: m,
|
|
41
|
-
required:
|
|
34
|
+
required: o.required
|
|
42
35
|
});
|
|
43
36
|
}
|
|
44
|
-
export {
|
|
37
|
+
export { o as RefField };
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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
|
|
7
|
-
let { field:
|
|
8
|
-
return (
|
|
9
|
-
if (
|
|
10
|
-
let
|
|
11
|
-
if (
|
|
12
|
-
|
|
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__ */
|
|
19
|
-
name:
|
|
18
|
+
children: /* @__PURE__ */ r(e, {
|
|
19
|
+
name: f,
|
|
20
20
|
size: 13
|
|
21
21
|
})
|
|
22
|
-
}), /* @__PURE__ */
|
|
22
|
+
}), /* @__PURE__ */ r("span", {
|
|
23
23
|
style: {
|
|
24
24
|
overflow: "hidden",
|
|
25
25
|
textOverflow: "ellipsis",
|
|
26
26
|
whiteSpace: "nowrap"
|
|
27
27
|
},
|
|
28
|
-
children:
|
|
28
|
+
children: s
|
|
29
29
|
})] });
|
|
30
|
-
return p ? /* @__PURE__ */
|
|
30
|
+
return p ? /* @__PURE__ */ r("a", {
|
|
31
31
|
href: p,
|
|
32
32
|
rel: "noopener noreferrer",
|
|
33
33
|
className: "detail-ref-chip",
|
|
34
|
-
children:
|
|
35
|
-
}) : /* @__PURE__ */
|
|
34
|
+
children: t
|
|
35
|
+
}) : /* @__PURE__ */ r("span", {
|
|
36
36
|
className: "detail-ref-chip",
|
|
37
|
-
children:
|
|
37
|
+
children: t
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
return p ? /* @__PURE__ */
|
|
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:
|
|
49
|
-
}) :
|
|
48
|
+
children: s
|
|
49
|
+
}) : s;
|
|
50
50
|
};
|
|
51
51
|
};
|
|
52
|
-
|
|
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,
|
|
18
|
-
let
|
|
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
|
-
|
|
21
|
-
}, [m,
|
|
22
|
-
let
|
|
23
|
-
|
|
24
|
-
}, [
|
|
25
|
-
|
|
26
|
-
}, [
|
|
27
|
-
|
|
28
|
-
}, [m]),
|
|
29
|
-
if (
|
|
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\"]") ||
|
|
31
|
+
t.closest("a") || t.closest("[data-peek-pencil=\"true\"]") || O();
|
|
32
32
|
}, [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
]),
|
|
37
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
]),
|
|
46
|
-
|
|
47
|
-
}, [
|
|
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
|
-
|
|
55
|
-
|
|
54
|
+
entities: _,
|
|
55
|
+
screens: v,
|
|
56
|
+
t: x
|
|
57
|
+
}), F = C ? n({
|
|
56
58
|
field: u,
|
|
57
59
|
fieldName: f,
|
|
58
|
-
value:
|
|
60
|
+
value: T,
|
|
59
61
|
mode: "edit",
|
|
60
|
-
onChange:
|
|
62
|
+
onChange: N,
|
|
61
63
|
record: h,
|
|
62
64
|
refs: g,
|
|
63
|
-
t:
|
|
65
|
+
t: x
|
|
64
66
|
}) : null;
|
|
65
67
|
return /* @__PURE__ */ c("div", {
|
|
66
68
|
className: "peek-field-cell",
|
|
67
|
-
"data-editing":
|
|
68
|
-
onClick:
|
|
69
|
-
onKeyDown:
|
|
69
|
+
"data-editing": C ? "true" : "false",
|
|
70
|
+
onClick: j,
|
|
71
|
+
onKeyDown: M,
|
|
70
72
|
onMouseEnter: (e) => {
|
|
71
|
-
|
|
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:
|
|
87
|
+
cursor: S || C ? "default" : "text",
|
|
86
88
|
border: "1px dashed transparent"
|
|
87
89
|
},
|
|
88
|
-
tabIndex:
|
|
89
|
-
role:
|
|
90
|
-
"aria-label":
|
|
91
|
-
children:
|
|
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:
|
|
105
|
-
}), !
|
|
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: () =>
|
|
109
|
-
title:
|
|
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:
|
|
114
|
-
title:
|
|
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:
|
|
122
|
-
}), !
|
|
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(),
|
|
137
|
+
e.stopPropagation(), O();
|
|
136
138
|
},
|
|
137
|
-
title:
|
|
139
|
+
title: x("list.record.edit", "Edit")
|
|
138
140
|
})
|
|
139
141
|
})] })
|
|
140
142
|
});
|