@declarion/react 0.254.0 → 0.302.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/components/actions/ResponsiveActionBar.js +255 -239
- package/dist-lib/components/detail-layout/DetailHighlights.js +40 -40
- package/dist-lib/components/detail-layout/EvidenceBlock.js +10 -9
- package/dist-lib/components/detail-layout/useQuickAdd.js +45 -47
- package/dist-lib/components/fields/EnumField.js +25 -25
- package/dist-lib/components/fields/JsonField.js +8 -5
- package/dist-lib/components/fields/cells/factories/badge.js +14 -27
- package/dist-lib/components/fields/cells/factories/statusPill.js +13 -26
- package/dist-lib/components/fields/cells/factories/tagList.js +13 -26
- package/dist-lib/components/pages/SmartDetailPage.impl.js +416 -415
- package/dist-lib/components/pages/auth/AuthShell.js +57 -76
- package/dist-lib/components/pages/list/ListCardRow.js +66 -66
- package/dist-lib/components/pages/list/columns.js +30 -30
- package/dist-lib/components/pages/profile/Profile.impl.js +130 -126
- package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +107 -109
- package/dist-lib/components/params/ParamsBlock.js +42 -37
- package/dist-lib/components/params/param-editors.js +20 -33
- package/dist-lib/components/primitives/Btn.js +3 -0
- package/dist-lib/components/primitives/IconBtn.js +2 -2
- package/dist-lib/components/primitives/Pill.js +36 -15
- package/dist-lib/components/shared/StatusGroupsDisplay.js +49 -49
- package/dist-lib/declarion-react.css +1 -1
- package/dist-lib/hooks/useDeclaredEnum.js +38 -0
- package/dist-lib/hooks/useResponsiveMode.js +1 -1
- package/dist-lib/index.d.ts +34 -12
- package/dist-lib/index.js +123 -122
- package/dist-lib/lib/evidence-verdict.js +8 -20
- package/dist-lib/lib/fill-from.js +15 -0
- package/dist-lib/testing.d.ts +1 -1
- package/dist-lib/{useResponsiveMode-DjoWkC2n.d.ts → useResponsiveMode-CBSHZBY5.d.ts} +3 -1
- package/package.json +1 -1
|
@@ -1,58 +1,58 @@
|
|
|
1
1
|
import { renderSchemaField as e, resolveSchemaFieldLabel as t } from "../file-widgets/host.js";
|
|
2
|
-
import { Pill as n } from "../primitives/Pill.js";
|
|
3
|
-
import { HighlightsStrip as
|
|
4
|
-
import { CopyButton as
|
|
5
|
-
import { copyableValue as
|
|
6
|
-
import { useText as
|
|
7
|
-
import { Fragment as
|
|
2
|
+
import { Pill as n, pillColor as r } from "../primitives/Pill.js";
|
|
3
|
+
import { HighlightsStrip as i } from "../chrome/HighlightsStrip.js";
|
|
4
|
+
import { CopyButton as a } from "../shared/CopyButton.js";
|
|
5
|
+
import { copyableValue as o } from "./FieldRow.js";
|
|
6
|
+
import { useText as s } from "../../hooks/useText.js";
|
|
7
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
8
|
// src/components/detail-layout/DetailHighlights.tsx
|
|
9
|
-
function
|
|
9
|
+
function d(e, t) {
|
|
10
10
|
return new Set((e.highlights ?? []).filter((e) => t.fields.get(e) || t.files?.get(e)));
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
let
|
|
14
|
-
if (!
|
|
15
|
-
let
|
|
16
|
-
for (let
|
|
17
|
-
let
|
|
18
|
-
if (
|
|
19
|
-
let e =
|
|
20
|
-
|
|
21
|
-
code:
|
|
22
|
-
label:
|
|
23
|
-
value: t ? /* @__PURE__ */
|
|
24
|
-
tone: t.color
|
|
12
|
+
function f({ screen: d, entity: f, entityCode: p, record: m, refs: h, objectStatuses: g, schema: _ }) {
|
|
13
|
+
let v = s(), y = d.highlights;
|
|
14
|
+
if (!y || y.length === 0) return null;
|
|
15
|
+
let b = [];
|
|
16
|
+
for (let i of y) {
|
|
17
|
+
let s = f.status_groups?.[i];
|
|
18
|
+
if (s) {
|
|
19
|
+
let e = g?.find((e) => e.group_code === i), t = e ? s.statuses.find((t) => t.code === e.status_code) : void 0;
|
|
20
|
+
b.push({
|
|
21
|
+
code: i,
|
|
22
|
+
label: v(s.name),
|
|
23
|
+
value: t ? /* @__PURE__ */ l(n, {
|
|
24
|
+
tone: r(t.color),
|
|
25
25
|
size: "xs",
|
|
26
|
-
children:
|
|
27
|
-
}) : /* @__PURE__ */
|
|
26
|
+
children: v(t.name)
|
|
27
|
+
}) : /* @__PURE__ */ l("span", {
|
|
28
28
|
style: { color: "var(--text-4)" },
|
|
29
29
|
children: "—"
|
|
30
30
|
})
|
|
31
31
|
});
|
|
32
|
-
} else if (
|
|
32
|
+
} else if (f.fields.get(i) || f.files?.get(i)) {
|
|
33
33
|
let n = e({
|
|
34
|
-
entity:
|
|
35
|
-
entityCode:
|
|
36
|
-
fieldName:
|
|
37
|
-
record:
|
|
34
|
+
entity: f,
|
|
35
|
+
entityCode: p,
|
|
36
|
+
fieldName: i,
|
|
37
|
+
record: m,
|
|
38
38
|
mode: "display",
|
|
39
|
-
refs:
|
|
40
|
-
entities:
|
|
41
|
-
screens:
|
|
39
|
+
refs: h,
|
|
40
|
+
entities: _.entities,
|
|
41
|
+
screens: _.screens,
|
|
42
42
|
surface: "list",
|
|
43
|
-
t:
|
|
44
|
-
}),
|
|
45
|
-
|
|
46
|
-
code:
|
|
47
|
-
label: t(
|
|
48
|
-
value:
|
|
49
|
-
value:
|
|
43
|
+
t: v
|
|
44
|
+
}), r = o(f.fields.get(i), m[i]);
|
|
45
|
+
b.push({
|
|
46
|
+
code: i,
|
|
47
|
+
label: t(v, f, i, _.entities),
|
|
48
|
+
value: r ? /* @__PURE__ */ u(c, { children: [n, /* @__PURE__ */ l(a, {
|
|
49
|
+
value: r,
|
|
50
50
|
size: "sm",
|
|
51
|
-
title:
|
|
51
|
+
title: v("record.field.copy_value", "Copy value")
|
|
52
52
|
})] }) : n
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
return
|
|
56
|
+
return b.length === 0 ? null : /* @__PURE__ */ l(i, { items: b });
|
|
57
57
|
}
|
|
58
|
-
export {
|
|
58
|
+
export { f as DetailHighlights, d as highlightedFieldCodes };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Pill as e } from "../primitives/Pill.js";
|
|
2
|
-
import {
|
|
2
|
+
import { evidenceVerdictPill as t } from "../../lib/evidence-verdict.js";
|
|
3
|
+
import { useSchema as n } from "../../hooks/useSchema.js";
|
|
3
4
|
import { useText as r } from "../../hooks/useText.js";
|
|
4
5
|
import { formatOffsetTimestamp as i } from "../../lib/timestamp.js";
|
|
5
6
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
@@ -8,8 +9,8 @@ function s(e, t) {
|
|
|
8
9
|
if (e && !Number.isNaN(new Date(e).getTime())) return i(e, { zone: t });
|
|
9
10
|
}
|
|
10
11
|
function c({ evidence: i }) {
|
|
11
|
-
let c = r(), l = i?.verdict ?? "unverified",
|
|
12
|
-
return i?.seq &&
|
|
12
|
+
let c = r(), { data: l } = n(), u = t(c, l?.enums, i?.verdict ?? "unverified"), d = s(i?.verified_at, c.timeZone), f = [];
|
|
13
|
+
return i?.seq && f.push(c("record.evidence.chain", "chain #{seq}", { seq: i.seq })), i?.generation && f.push(c("record.evidence.generation", "generation {number}", { number: i.generation })), /* @__PURE__ */ o("div", {
|
|
13
14
|
style: {
|
|
14
15
|
display: "flex",
|
|
15
16
|
flexDirection: "column",
|
|
@@ -31,25 +32,25 @@ function c({ evidence: i }) {
|
|
|
31
32
|
},
|
|
32
33
|
children: c("record.evidence.title", "Evidence")
|
|
33
34
|
}),
|
|
34
|
-
|
|
35
|
+
f.length > 0 && /* @__PURE__ */ a("span", {
|
|
35
36
|
style: {
|
|
36
37
|
fontSize: 12,
|
|
37
38
|
color: "var(--muted-foreground)"
|
|
38
39
|
},
|
|
39
|
-
children:
|
|
40
|
+
children: f.join(" · ")
|
|
40
41
|
}),
|
|
41
42
|
/* @__PURE__ */ a(e, {
|
|
42
|
-
tone:
|
|
43
|
+
tone: u.tone,
|
|
43
44
|
size: "sm",
|
|
44
45
|
dot: !0,
|
|
45
|
-
children:
|
|
46
|
+
children: u.label
|
|
46
47
|
}),
|
|
47
|
-
|
|
48
|
+
d && /* @__PURE__ */ a("span", {
|
|
48
49
|
style: {
|
|
49
50
|
fontSize: 12,
|
|
50
51
|
color: "var(--muted-foreground)"
|
|
51
52
|
},
|
|
52
|
-
children: c("record.evidence.verified", "Checked {when}", { when:
|
|
53
|
+
children: c("record.evidence.verified", "Checked {when}", { when: d })
|
|
53
54
|
})
|
|
54
55
|
]
|
|
55
56
|
}), i?.reason && /* @__PURE__ */ a("span", {
|
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
import { createEntity as e } from "../../api/data.js";
|
|
2
2
|
import { buildQuickAddPayload as t, isQuickAddReady as n } from "../../lib/quick-add.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { withFillFrom as r } from "../../lib/fill-from.js";
|
|
4
|
+
import { ENTITY_CHILDREN_KEY as i } from "../../hooks/useChildrenData.js";
|
|
5
|
+
import { pkValuePartsToId as a } from "../../types/schema.js";
|
|
6
|
+
import { formatWireDateTime as o } from "../../lib/timestamp.js";
|
|
7
|
+
import { useRef as s, useState as c } from "react";
|
|
8
|
+
import { useMutation as l, useQueryClient as u } from "@tanstack/react-query";
|
|
8
9
|
// src/components/detail-layout/useQuickAdd.ts
|
|
9
|
-
function
|
|
10
|
-
let [
|
|
11
|
-
let e =
|
|
12
|
-
if (e?.fields) for (let r of e.fields) e.defaults?.[r] == null ? t?.fields.get(r)?.type === "timestamp" && (n[r] =
|
|
10
|
+
function d(d, f, p, m) {
|
|
11
|
+
let h = s(/* @__PURE__ */ new Set()), [g, _] = c(() => {
|
|
12
|
+
let e = d.quick_add, t = m.entities[d.entity], n = {};
|
|
13
|
+
if (e?.fields) for (let r of e.fields) e.defaults?.[r] == null ? t?.fields.get(r)?.type === "timestamp" && (n[r] = o()) : n[r] = e.defaults[r];
|
|
13
14
|
return n;
|
|
14
|
-
}),
|
|
15
|
-
mutationFn: (t) => e(
|
|
15
|
+
}), v = u(), { mutate: y, isPending: b, error: x, reset: S } = l({
|
|
16
|
+
mutationFn: (t) => e(d.entity, t),
|
|
16
17
|
onMutate: async (e) => {
|
|
17
|
-
let t = Array.isArray(
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
let t = Array.isArray(p) ? a(p.map(String)) : p, n = [
|
|
19
|
+
i,
|
|
20
|
+
f,
|
|
20
21
|
t,
|
|
21
|
-
|
|
22
|
+
d.entity
|
|
22
23
|
];
|
|
23
|
-
await
|
|
24
|
-
let
|
|
24
|
+
await v.cancelQueries({ queryKey: n });
|
|
25
|
+
let r = v.getQueriesData({ queryKey: n }), o = {
|
|
25
26
|
...e,
|
|
26
27
|
id: `__optimistic_${crypto.randomUUID()}`,
|
|
27
28
|
__optimistic: !0
|
|
28
29
|
};
|
|
29
|
-
return
|
|
30
|
+
return v.setQueriesData({ queryKey: n }, (e) => {
|
|
30
31
|
if (!e || typeof e != "object") return e;
|
|
31
32
|
if ("pages" in e && Array.isArray(e.pages) && e.pages.length > 0) {
|
|
32
33
|
let t = e, [n, ...r] = t.pages;
|
|
@@ -39,46 +40,43 @@ function l(l, u, d, f) {
|
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
42
|
return e;
|
|
42
|
-
}), { snapshots:
|
|
43
|
+
}), { snapshots: r };
|
|
43
44
|
},
|
|
44
45
|
onError: (e, t, n) => {
|
|
45
|
-
if (n?.snapshots) for (let [e, t] of n.snapshots)
|
|
46
|
+
if (n?.snapshots) for (let [e, t] of n.snapshots) v.setQueryData(e, t);
|
|
46
47
|
},
|
|
47
48
|
onSuccess: () => {
|
|
48
|
-
let e =
|
|
49
|
-
if (e?.fields) for (let r of e.fields) n[r] = e?.defaults?.[r] == null ? t?.fields.get(r)?.type === "timestamp" ?
|
|
50
|
-
|
|
49
|
+
let e = d.quick_add, t = m.entities[d.entity], n = {};
|
|
50
|
+
if (e?.fields) for (let r of e.fields) n[r] = e?.defaults?.[r] == null ? t?.fields.get(r)?.type === "timestamp" ? o() : "" : e.defaults[r];
|
|
51
|
+
_(n);
|
|
51
52
|
},
|
|
52
53
|
onSettled: () => {
|
|
53
|
-
let e = Array.isArray(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
let e = Array.isArray(p) ? a(p.map(String)) : p;
|
|
55
|
+
v.invalidateQueries({ queryKey: [
|
|
56
|
+
i,
|
|
57
|
+
f,
|
|
57
58
|
e,
|
|
58
|
-
|
|
59
|
+
d.entity
|
|
59
60
|
] });
|
|
60
61
|
}
|
|
61
|
-
}),
|
|
62
|
-
function
|
|
63
|
-
if (e.preventDefault(), !
|
|
64
|
-
let n = t(
|
|
65
|
-
|
|
62
|
+
}), C = d.quick_add, w = m.entities[d.entity], T = C?.fields.filter((e) => w?.fields.get(e)?.required && !w?.fields.get(e)?.generate) ?? [], E = n(g, T);
|
|
63
|
+
function D(e) {
|
|
64
|
+
if (e.preventDefault(), !C) return;
|
|
65
|
+
let n = t(g, C.defaults, d.foreign_key, p);
|
|
66
|
+
y(n);
|
|
66
67
|
}
|
|
67
|
-
function
|
|
68
|
-
|
|
69
|
-
...n,
|
|
70
|
-
[e]: t
|
|
71
|
-
}));
|
|
68
|
+
function O(e, t) {
|
|
69
|
+
x && S(), _((n) => r(w ?? void 0, n, e, t, h.current));
|
|
72
70
|
}
|
|
73
71
|
return {
|
|
74
|
-
values:
|
|
75
|
-
quickAdd:
|
|
76
|
-
childEntity:
|
|
77
|
-
isPending:
|
|
78
|
-
error:
|
|
79
|
-
isReady:
|
|
80
|
-
handleSubmit:
|
|
81
|
-
handleFieldChange:
|
|
72
|
+
values: g,
|
|
73
|
+
quickAdd: C,
|
|
74
|
+
childEntity: w,
|
|
75
|
+
isPending: b,
|
|
76
|
+
error: x,
|
|
77
|
+
isReady: E,
|
|
78
|
+
handleSubmit: D,
|
|
79
|
+
handleFieldChange: O
|
|
82
80
|
};
|
|
83
81
|
}
|
|
84
|
-
export {
|
|
82
|
+
export { d as useQuickAdd };
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { Pill as e } from "../primitives/Pill.js";
|
|
2
|
-
import { Select as
|
|
3
|
-
import { coerceDisplayString as
|
|
4
|
-
import { jsx as
|
|
1
|
+
import { Pill as e, pillColor as t } from "../primitives/Pill.js";
|
|
2
|
+
import { Select as n } from "../primitives/Fields.js";
|
|
3
|
+
import { coerceDisplayString as r } from "../../lib/display-value.js";
|
|
4
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
5
5
|
// src/components/fields/EnumField.tsx
|
|
6
|
-
var
|
|
7
|
-
function
|
|
8
|
-
let
|
|
9
|
-
if (
|
|
10
|
-
tone:
|
|
6
|
+
var a = "__declarion_enum_null__";
|
|
7
|
+
function o({ field: o, value: s, mode: c, onChange: l, fieldId: u, labelId: d, t: f }) {
|
|
8
|
+
let p = o.values ?? [], m = p.find((e) => e.code === s);
|
|
9
|
+
if (c === "display") return m ? /* @__PURE__ */ i(e, {
|
|
10
|
+
tone: t(m.color),
|
|
11
11
|
size: "xs",
|
|
12
|
-
children:
|
|
13
|
-
}) : /* @__PURE__ */
|
|
12
|
+
children: f(m.name)
|
|
13
|
+
}) : /* @__PURE__ */ i("span", {
|
|
14
14
|
style: {
|
|
15
15
|
fontSize: 12.5,
|
|
16
16
|
color: "var(--text-4)"
|
|
17
17
|
},
|
|
18
18
|
children: "—"
|
|
19
19
|
});
|
|
20
|
-
let
|
|
21
|
-
value:
|
|
22
|
-
label:
|
|
23
|
-
}] : [], ...
|
|
20
|
+
let h = !o.required, g = s != null && s !== "" ? r(s) : a, _ = [...h ? [{
|
|
21
|
+
value: a,
|
|
22
|
+
label: f("field.enum.none", "— None —")
|
|
23
|
+
}] : [], ...p.map((e) => ({
|
|
24
24
|
value: e.code,
|
|
25
|
-
label:
|
|
25
|
+
label: f(e.name) || e.code
|
|
26
26
|
}))];
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
id:
|
|
29
|
-
"aria-labelledby":
|
|
30
|
-
"aria-required":
|
|
31
|
-
value:
|
|
32
|
-
options:
|
|
33
|
-
onChange: (e) =>
|
|
34
|
-
placeholder:
|
|
27
|
+
return /* @__PURE__ */ i(n, {
|
|
28
|
+
id: u,
|
|
29
|
+
"aria-labelledby": d,
|
|
30
|
+
"aria-required": o.required || void 0,
|
|
31
|
+
value: g,
|
|
32
|
+
options: _,
|
|
33
|
+
onChange: (e) => l?.(e === a ? null : e),
|
|
34
|
+
placeholder: f("field.select_placeholder", "Select…")
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
export {
|
|
37
|
+
export { o as EnumField };
|
|
@@ -46,7 +46,9 @@ function m({ value: e, mode: t, onChange: n, fieldId: r }) {
|
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
var h = {
|
|
49
|
-
|
|
49
|
+
display: "flex",
|
|
50
|
+
flexDirection: "column",
|
|
51
|
+
gap: 6,
|
|
50
52
|
border: "1px solid var(--border)",
|
|
51
53
|
borderRadius: "var(--radius-md)",
|
|
52
54
|
padding: 12,
|
|
@@ -77,9 +79,8 @@ var h = {
|
|
|
77
79
|
fontSize: 12.5,
|
|
78
80
|
overflowWrap: "anywhere"
|
|
79
81
|
}, x = {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
right: 6
|
|
82
|
+
display: "flex",
|
|
83
|
+
justifyContent: "flex-end"
|
|
83
84
|
};
|
|
84
85
|
function S({ value: r }) {
|
|
85
86
|
let a = n(), [s, f] = o(!1), p = s ? a("field.json.hide_source", "Hide JSON") : a("field.json.show_source", "Show JSON");
|
|
@@ -90,7 +91,9 @@ function S({ value: r }) {
|
|
|
90
91
|
children: /* @__PURE__ */ c(e, {
|
|
91
92
|
size: 22,
|
|
92
93
|
icon: /* @__PURE__ */ c(t.code, { size: 13 }),
|
|
93
|
-
onClick: (
|
|
94
|
+
onClick: (e) => {
|
|
95
|
+
e.stopPropagation(), f((e) => !e);
|
|
96
|
+
},
|
|
94
97
|
title: p,
|
|
95
98
|
"aria-label": p,
|
|
96
99
|
"aria-pressed": s
|
|
@@ -1,41 +1,28 @@
|
|
|
1
|
-
import { Pill as e } from "../../../primitives/Pill.js";
|
|
2
|
-
import { coerceDisplayString as
|
|
3
|
-
import { jsx as
|
|
1
|
+
import { Pill as e, pillColor as t } from "../../../primitives/Pill.js";
|
|
2
|
+
import { coerceDisplayString as n } from "../../../../lib/display-value.js";
|
|
3
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
4
4
|
// src/components/fields/cells/factories/badge.tsx
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
"emerald",
|
|
8
|
-
"amber",
|
|
9
|
-
"rose",
|
|
10
|
-
"sky",
|
|
11
|
-
"violet",
|
|
12
|
-
"slate",
|
|
13
|
-
"teal"
|
|
14
|
-
]);
|
|
15
|
-
function i(e) {
|
|
16
|
-
return e && r.has(e) ? e : "slate";
|
|
17
|
-
}
|
|
18
|
-
var a = (r) => {
|
|
19
|
-
let { field: a, t: o } = r, s = /* @__PURE__ */ new Map();
|
|
5
|
+
var i = (i) => {
|
|
6
|
+
let { field: a, t: o } = i, s = /* @__PURE__ */ new Map();
|
|
20
7
|
if (a.values) for (let e of a.values) s.set(e.code, {
|
|
21
|
-
tone:
|
|
8
|
+
tone: t(e.color),
|
|
22
9
|
label: o(e.name) || e.code
|
|
23
10
|
});
|
|
24
|
-
if (a.display?.value_map) for (let [e,
|
|
25
|
-
let
|
|
11
|
+
if (a.display?.value_map) for (let [e, n] of Object.entries(a.display.value_map)) {
|
|
12
|
+
let r = s.get(e), i = n.color ? t(n.color) : r?.tone ?? "slate", a = (n.label ? o(n.label) : "") || r?.label || e;
|
|
26
13
|
s.set(e, {
|
|
27
|
-
tone:
|
|
14
|
+
tone: i,
|
|
28
15
|
label: a
|
|
29
16
|
});
|
|
30
17
|
}
|
|
31
|
-
return (
|
|
32
|
-
if (
|
|
33
|
-
let i = t
|
|
34
|
-
return /* @__PURE__ */
|
|
18
|
+
return (t) => {
|
|
19
|
+
if (t == null || t === "") return "—";
|
|
20
|
+
let i = n(t), a = s.get(i);
|
|
21
|
+
return /* @__PURE__ */ r(e, {
|
|
35
22
|
tone: a?.tone ?? "slate",
|
|
36
23
|
size: "xs",
|
|
37
24
|
children: a?.label ?? i
|
|
38
25
|
});
|
|
39
26
|
};
|
|
40
27
|
};
|
|
41
|
-
export {
|
|
28
|
+
export { i as badgeFactory };
|
|
@@ -1,34 +1,21 @@
|
|
|
1
|
-
import { Pill as e } from "../../../primitives/Pill.js";
|
|
2
|
-
import { coerceDisplayString as
|
|
3
|
-
import { jsx as
|
|
1
|
+
import { Pill as e, pillColor as t } from "../../../primitives/Pill.js";
|
|
2
|
+
import { coerceDisplayString as n } from "../../../../lib/display-value.js";
|
|
3
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
4
4
|
// src/components/fields/cells/factories/statusPill.tsx
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"sky",
|
|
11
|
-
"violet",
|
|
12
|
-
"slate",
|
|
13
|
-
"teal"
|
|
14
|
-
]);
|
|
15
|
-
function i(e) {
|
|
16
|
-
return e && r.has(e) ? e : "slate";
|
|
17
|
-
}
|
|
18
|
-
var a = (r) => {
|
|
19
|
-
let { entity: a, t: o } = r, s = /* @__PURE__ */ new Map();
|
|
20
|
-
if (a?.status_groups) for (let e of Object.values(a.status_groups)) for (let t of e.statuses) s.set(t.code, {
|
|
21
|
-
tone: i(t.color),
|
|
22
|
-
label: o(t.name) || t.code
|
|
5
|
+
var i = (i) => {
|
|
6
|
+
let { entity: a, t: o } = i, s = /* @__PURE__ */ new Map();
|
|
7
|
+
if (a?.status_groups) for (let e of Object.values(a.status_groups)) for (let n of e.statuses) s.set(n.code, {
|
|
8
|
+
tone: t(n.color),
|
|
9
|
+
label: o(n.name) || n.code
|
|
23
10
|
});
|
|
24
|
-
return (
|
|
25
|
-
if (
|
|
26
|
-
let i = t
|
|
27
|
-
return /* @__PURE__ */
|
|
11
|
+
return (t) => {
|
|
12
|
+
if (t == null || t === "") return "—";
|
|
13
|
+
let i = n(t), a = s.get(i);
|
|
14
|
+
return /* @__PURE__ */ r(e, {
|
|
28
15
|
tone: a?.tone ?? "slate",
|
|
29
16
|
size: "xs",
|
|
30
17
|
children: a?.label ?? i
|
|
31
18
|
});
|
|
32
19
|
};
|
|
33
20
|
};
|
|
34
|
-
export {
|
|
21
|
+
export { i as statusPillFactory };
|
|
@@ -1,43 +1,30 @@
|
|
|
1
1
|
import { Chip as e } from "../../../primitives/Chip.js";
|
|
2
|
-
import { Pill as t } from "../../../primitives/Pill.js";
|
|
3
|
-
import { parseLangMap as
|
|
4
|
-
import { jsx as
|
|
2
|
+
import { Pill as t, pillColor as n } from "../../../primitives/Pill.js";
|
|
3
|
+
import { parseLangMap as r } from "../../langMap.js";
|
|
4
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
5
5
|
// src/components/fields/cells/factories/tagList.tsx
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
"emerald",
|
|
9
|
-
"amber",
|
|
10
|
-
"rose",
|
|
11
|
-
"sky",
|
|
12
|
-
"violet",
|
|
13
|
-
"slate",
|
|
14
|
-
"teal"
|
|
15
|
-
]);
|
|
16
|
-
function a(e) {
|
|
17
|
-
return e && i.has(e) ? e : null;
|
|
18
|
-
}
|
|
19
|
-
var o = (i) => {
|
|
20
|
-
let { field: o, t: s } = i, c = /* @__PURE__ */ new Map();
|
|
6
|
+
var a = (a) => {
|
|
7
|
+
let { field: o, t: s } = a, c = /* @__PURE__ */ new Map();
|
|
21
8
|
if (o.display?.value_map) for (let [e, t] of Object.entries(o.display.value_map)) c.set(e, {
|
|
22
9
|
label: t.label && s(t.label) || e,
|
|
23
|
-
tone:
|
|
10
|
+
tone: t.color ? n(t.color) : null
|
|
24
11
|
});
|
|
25
12
|
let l = o.type === "multilang_array";
|
|
26
|
-
return (
|
|
13
|
+
return (n) => !Array.isArray(n) || n.length === 0 ? "—" : /* @__PURE__ */ i("span", {
|
|
27
14
|
style: {
|
|
28
15
|
display: "inline-flex",
|
|
29
16
|
gap: 4,
|
|
30
17
|
flexWrap: "wrap"
|
|
31
18
|
},
|
|
32
|
-
children:
|
|
33
|
-
if (l) return /* @__PURE__ */
|
|
34
|
-
let o = String(
|
|
35
|
-
return u?.tone ? /* @__PURE__ */
|
|
19
|
+
children: n.map((n, a) => {
|
|
20
|
+
if (l) return /* @__PURE__ */ i(e, { children: s(r(n)) || "—" }, a);
|
|
21
|
+
let o = String(n), u = c.get(o);
|
|
22
|
+
return u?.tone ? /* @__PURE__ */ i(t, {
|
|
36
23
|
tone: u.tone,
|
|
37
24
|
size: "xs",
|
|
38
25
|
children: u.label
|
|
39
|
-
}, `${o}-${a}`) : /* @__PURE__ */
|
|
26
|
+
}, `${o}-${a}`) : /* @__PURE__ */ i(e, { children: u?.label ?? o }, `${o}-${a}`);
|
|
40
27
|
})
|
|
41
28
|
});
|
|
42
29
|
};
|
|
43
|
-
export {
|
|
30
|
+
export { a as tagListFactory };
|