@declarion/react 0.6.6 → 0.6.7
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/DraggableChildrenTable-CdzxxoTe.js +259 -0
- package/dist-lib/Grid-Cwxca9aO.js +0 -2
- package/dist-lib/JsonEditor-KelPV-OQ.js +0 -2
- package/dist-lib/MarkdownRenderer-Dbl3AFDQ.js +0 -2
- package/dist-lib/api/data.d.ts +1 -1
- package/dist-lib/components/detail-layout/DetailAuditStrip.d.ts +2 -2
- package/dist-lib/components/detail-layout/DetailHighlights.d.ts +2 -2
- package/dist-lib/components/detail-layout/DraggableChildrenTable.d.ts +2 -2
- package/dist-lib/components/detail-layout/EditableChildrenTable.d.ts +2 -2
- package/dist-lib/components/detail-layout/LayoutRenderer.d.ts +2 -2
- package/dist-lib/components/fields/cells/registry.d.ts +4 -4
- package/dist-lib/components/fields/index.d.ts +3 -3
- package/dist-lib/components/file-widgets/host.d.ts +2 -2
- package/dist-lib/components/filters/FilterDrawer.d.ts +1 -1
- package/dist-lib/components/list/PeekFieldCell.d.ts +2 -2
- package/dist-lib/components/list/QuickPeek.d.ts +2 -2
- package/dist-lib/components/mass-edit/PropertyGridEditor.d.ts +1 -1
- package/dist-lib/components/pages/SmartListPage.d.ts +1 -25
- package/dist-lib/components/pages/list/DataCell.d.ts +1 -2
- package/dist-lib/components/pages/list/columns.d.ts +3 -3
- package/dist-lib/components/primitives/index.d.ts +0 -1
- package/dist-lib/components/shared/ActionRunner.d.ts +3 -2
- package/dist-lib/components/shared/Breadcrumbs.d.ts +1 -1
- package/dist-lib/{dataTableStyles-BwnbXviH.js → dataTableStyles-zH3M7xdm.js} +765 -793
- package/dist-lib/index.d.ts +1 -6
- package/dist-lib/index.js +2844 -3271
- package/dist-lib/lib/display-value.d.ts +1 -0
- package/dist-lib/lib/filters.d.ts +0 -4
- package/dist-lib/lib/timestamp.d.ts +16 -3
- package/dist-lib/rich-text-CJpzFOG5.js +0 -2
- package/dist-lib/types/api.d.ts +10 -3
- package/dist-lib/value-CrpaObP_.js +0 -2
- package/dist-lib/vite/index.js +0 -2
- package/package.json +4 -2
- package/dist-lib/DraggableChildrenTable-DhcSXQfV.js +0 -261
- package/dist-lib/DraggableChildrenTable-DhcSXQfV.js.map +0 -1
- package/dist-lib/Grid-Cwxca9aO.js.map +0 -1
- package/dist-lib/JsonEditor-KelPV-OQ.js.map +0 -1
- package/dist-lib/MarkdownRenderer-Dbl3AFDQ.js.map +0 -1
- package/dist-lib/components/list/BulkBar.d.ts +0 -18
- package/dist-lib/components/list/ListPage.d.ts +0 -34
- package/dist-lib/components/list/resolveActions.d.ts +0 -53
- package/dist-lib/components/primitives/cx.d.ts +0 -1
- package/dist-lib/dataTableStyles-BwnbXviH.js.map +0 -1
- package/dist-lib/index.js.map +0 -1
- package/dist-lib/rich-text-CJpzFOG5.js.map +0 -1
- package/dist-lib/value-CrpaObP_.js.map +0 -1
- package/dist-lib/vite/index.js.map +0 -1
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { Qt as e, St as t, Xt as n, Zt as r, a as i, i as a, n as o, r as s, t as c, ut as l } from "./dataTableStyles-zH3M7xdm.js";
|
|
2
|
+
import { useCallback as u, useMemo as d, useRef as f } from "react";
|
|
3
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
4
|
+
import { DndContext as h, PointerSensor as g, closestCenter as _, useSensor as v, useSensors as y } from "@dnd-kit/core";
|
|
5
|
+
import { SortableContext as b, useSortable as x, verticalListSortingStrategy as S } from "@dnd-kit/sortable";
|
|
6
|
+
import { CSS as C } from "@dnd-kit/utilities";
|
|
7
|
+
//#region src/components/detail-layout/DraggableChildrenTable.tsx
|
|
8
|
+
function w({ config: t, childEntity: n, schema: i, rows: a, onChange: c, validationErrors: x, refs: C }) {
|
|
9
|
+
let w = f(null), E = t.position_field, D = t.columns, O = y(v(g, { activationConstraint: { distance: 5 } })), k = new Set(Array.isArray(t.foreign_key) ? t.foreign_key : [t.foreign_key]), A = D.filter((e) => {
|
|
10
|
+
if (k.has(e) || e === E) return !1;
|
|
11
|
+
let t = n.fields.get(e);
|
|
12
|
+
return !(!t || t.auto || t.primary);
|
|
13
|
+
}), j = new Set(D.filter((e) => {
|
|
14
|
+
if (e === E) return !0;
|
|
15
|
+
let t = n.fields.get(e);
|
|
16
|
+
return t && (t.auto || t.primary);
|
|
17
|
+
})), M = D.filter((e) => e !== E), N = d(() => a.filter((e) => !e._deleted).map((e) => e._key), [a]), P = u((e, t, n) => {
|
|
18
|
+
c(a.map((r) => r._key === e ? {
|
|
19
|
+
...r,
|
|
20
|
+
[t]: n,
|
|
21
|
+
_dirty: !0
|
|
22
|
+
} : r));
|
|
23
|
+
}, [a, c]), F = u(() => {
|
|
24
|
+
let e = a.filter((e) => !e._deleted).reduce((e, t) => {
|
|
25
|
+
let n = typeof t[E] == "number" ? t[E] : -1;
|
|
26
|
+
return Math.max(e, n);
|
|
27
|
+
}, -1), r = {
|
|
28
|
+
_key: crypto.randomUUID(),
|
|
29
|
+
_dirty: !0,
|
|
30
|
+
[E]: e + 1
|
|
31
|
+
}, i = t.quick_add?.defaults ?? {};
|
|
32
|
+
for (let e of A) {
|
|
33
|
+
let t = n.fields.get(e);
|
|
34
|
+
t && (i[e] === void 0 ? t.default === void 0 ? t.type === "bool" && (r[e] = !1) : r[e] = t.default : r[e] = i[e]);
|
|
35
|
+
}
|
|
36
|
+
c([...a, r]);
|
|
37
|
+
}, [
|
|
38
|
+
a,
|
|
39
|
+
c,
|
|
40
|
+
A,
|
|
41
|
+
n,
|
|
42
|
+
t.quick_add?.defaults,
|
|
43
|
+
E
|
|
44
|
+
]), I = u((e) => {
|
|
45
|
+
c(a.map((t) => t._key === e ? {
|
|
46
|
+
...t,
|
|
47
|
+
_deleted: !0
|
|
48
|
+
} : t));
|
|
49
|
+
}, [a, c]), L = u((e) => {
|
|
50
|
+
c(a.map((t) => t._key === e ? {
|
|
51
|
+
...t,
|
|
52
|
+
_deleted: !1
|
|
53
|
+
} : t));
|
|
54
|
+
}, [a, c]), R = u((e) => {
|
|
55
|
+
let { active: t, over: n } = e;
|
|
56
|
+
if (!n || t.id === n.id) return;
|
|
57
|
+
let r = a.filter((e) => !e._deleted), i = a.filter((e) => e._deleted), o = r.findIndex((e) => e._key === String(t.id)), s = r.findIndex((e) => e._key === String(n.id));
|
|
58
|
+
if (o === -1 || s === -1) return;
|
|
59
|
+
let l = [...r], [u] = l.splice(o, 1);
|
|
60
|
+
l.splice(s, 0, u), c([...l.map((e, t) => ({
|
|
61
|
+
...e,
|
|
62
|
+
[E]: t,
|
|
63
|
+
_dirty: e[E] === t ? e._dirty : !0
|
|
64
|
+
})), ...i]);
|
|
65
|
+
}, [
|
|
66
|
+
a,
|
|
67
|
+
c,
|
|
68
|
+
E
|
|
69
|
+
]), z = u((e) => {
|
|
70
|
+
let t = e.target, n = t.closest("td");
|
|
71
|
+
if (!n) return;
|
|
72
|
+
let r = n.closest("tr");
|
|
73
|
+
if (!r) return;
|
|
74
|
+
let i = r.closest("tbody");
|
|
75
|
+
if (!i) return;
|
|
76
|
+
let a = Array.from(r.cells).indexOf(n), o = Array.from(i.rows).indexOf(r);
|
|
77
|
+
if (e.key === "Tab") {
|
|
78
|
+
let t = e.shiftKey ? -1 : 1, n = Array.from(i.rows), r = o, s = a + t;
|
|
79
|
+
for (; r >= 0 && r < n.length;) if (s >= 0 && s < n[r].cells.length) {
|
|
80
|
+
let i = n[r].cells[s].querySelector("input, select, textarea, [tabindex]");
|
|
81
|
+
if (i) {
|
|
82
|
+
e.preventDefault(), i.focus();
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
s += t;
|
|
86
|
+
} else r += t, s = t > 0 ? 0 : (n[r]?.cells.length ?? 1) - 1;
|
|
87
|
+
} else if (e.key === "Enter") {
|
|
88
|
+
e.preventDefault();
|
|
89
|
+
let t = Array.from(i.rows);
|
|
90
|
+
if (o < t.length - 1) {
|
|
91
|
+
let e = t[o + 1].cells[a]?.querySelector("input, select, textarea, [tabindex]");
|
|
92
|
+
e && e.focus();
|
|
93
|
+
} else F(), requestAnimationFrame(() => {
|
|
94
|
+
let e = i.querySelectorAll("tr"), t = e[e.length - 1];
|
|
95
|
+
if (t) {
|
|
96
|
+
let e = t.querySelector("input, select, textarea, [tabindex]");
|
|
97
|
+
e && e.focus();
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
} else e.key === "Escape" && t.blur?.();
|
|
101
|
+
}, [F]), B = o;
|
|
102
|
+
return /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("div", {
|
|
103
|
+
style: { overflowX: "auto" },
|
|
104
|
+
children: /* @__PURE__ */ p(h, {
|
|
105
|
+
sensors: O,
|
|
106
|
+
collisionDetection: _,
|
|
107
|
+
onDragEnd: R,
|
|
108
|
+
children: /* @__PURE__ */ m("table", {
|
|
109
|
+
ref: w,
|
|
110
|
+
style: s,
|
|
111
|
+
onKeyDown: z,
|
|
112
|
+
children: [/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [
|
|
113
|
+
/* @__PURE__ */ p("th", { style: {
|
|
114
|
+
...B,
|
|
115
|
+
width: 32,
|
|
116
|
+
padding: "0 4px"
|
|
117
|
+
} }),
|
|
118
|
+
M.map((e) => {
|
|
119
|
+
let t = n.fields.get(e);
|
|
120
|
+
return /* @__PURE__ */ p("th", {
|
|
121
|
+
style: B,
|
|
122
|
+
children: t ? l(t, e, i.entities) : e
|
|
123
|
+
}, e);
|
|
124
|
+
}),
|
|
125
|
+
/* @__PURE__ */ p("th", { style: {
|
|
126
|
+
...B,
|
|
127
|
+
width: 40
|
|
128
|
+
} })
|
|
129
|
+
] }) }), /* @__PURE__ */ p(b, {
|
|
130
|
+
items: N,
|
|
131
|
+
strategy: S,
|
|
132
|
+
children: /* @__PURE__ */ p("tbody", { children: a.map((e) => /* @__PURE__ */ p(T, {
|
|
133
|
+
row: e,
|
|
134
|
+
columns: M,
|
|
135
|
+
editableColumns: A,
|
|
136
|
+
displayOnlyColumns: j,
|
|
137
|
+
childEntity: n,
|
|
138
|
+
validationErrors: x,
|
|
139
|
+
refs: C,
|
|
140
|
+
onCellChange: P,
|
|
141
|
+
onDelete: I,
|
|
142
|
+
onUndoDelete: L
|
|
143
|
+
}, e._key)) })
|
|
144
|
+
})]
|
|
145
|
+
})
|
|
146
|
+
})
|
|
147
|
+
}), /* @__PURE__ */ p("div", {
|
|
148
|
+
style: { marginTop: 8 },
|
|
149
|
+
children: /* @__PURE__ */ p(r, {
|
|
150
|
+
kind: "ghost",
|
|
151
|
+
size: "xs",
|
|
152
|
+
icon: /* @__PURE__ */ p(e.plus, { size: 12 }),
|
|
153
|
+
onClick: F,
|
|
154
|
+
children: "Add row"
|
|
155
|
+
})
|
|
156
|
+
})] });
|
|
157
|
+
}
|
|
158
|
+
function T({ row: r, columns: o, editableColumns: s, displayOnlyColumns: l, childEntity: u, validationErrors: d, refs: f, onCellChange: h, onDelete: g, onUndoDelete: _ }) {
|
|
159
|
+
let v = a(), y = !!r._deleted, b = d?.[r._key], { attributes: S, listeners: w, setNodeRef: T, transform: E, transition: D, isDragging: O } = x({
|
|
160
|
+
id: r._key,
|
|
161
|
+
disabled: y
|
|
162
|
+
}), k = {
|
|
163
|
+
transform: C.Translate.toString(E),
|
|
164
|
+
transition: D,
|
|
165
|
+
zIndex: O ? 10 : void 0,
|
|
166
|
+
opacity: O ? .5 : void 0
|
|
167
|
+
}, A = c, j = {
|
|
168
|
+
padding: "4px 4px",
|
|
169
|
+
borderBottom: "1px solid var(--divider)",
|
|
170
|
+
verticalAlign: "middle"
|
|
171
|
+
};
|
|
172
|
+
return /* @__PURE__ */ m("tr", {
|
|
173
|
+
ref: T,
|
|
174
|
+
style: {
|
|
175
|
+
...k,
|
|
176
|
+
opacity: y ? .5 : k?.opacity ?? 1
|
|
177
|
+
},
|
|
178
|
+
children: [
|
|
179
|
+
/* @__PURE__ */ p("td", {
|
|
180
|
+
style: {
|
|
181
|
+
padding: "4px 4px",
|
|
182
|
+
borderBottom: "1px solid var(--divider)",
|
|
183
|
+
width: 32,
|
|
184
|
+
verticalAlign: "middle"
|
|
185
|
+
},
|
|
186
|
+
children: !y && /* @__PURE__ */ p("button", {
|
|
187
|
+
type: "button",
|
|
188
|
+
style: {
|
|
189
|
+
cursor: "grab",
|
|
190
|
+
padding: 4,
|
|
191
|
+
color: "var(--text-3)",
|
|
192
|
+
background: "transparent",
|
|
193
|
+
border: 0,
|
|
194
|
+
display: "inline-flex"
|
|
195
|
+
},
|
|
196
|
+
...S,
|
|
197
|
+
...w,
|
|
198
|
+
children: /* @__PURE__ */ p(e.grid, { size: 14 })
|
|
199
|
+
})
|
|
200
|
+
}),
|
|
201
|
+
o.map((e) => {
|
|
202
|
+
let n = u.fields.get(e), a = b?.includes(e), o = l.has(e), c = s.includes(e);
|
|
203
|
+
return y || o || !c ? /* @__PURE__ */ p("td", {
|
|
204
|
+
style: {
|
|
205
|
+
...A,
|
|
206
|
+
textDecoration: y ? "line-through" : "none"
|
|
207
|
+
},
|
|
208
|
+
children: n ? i({
|
|
209
|
+
field: n,
|
|
210
|
+
fieldName: e,
|
|
211
|
+
value: r[e],
|
|
212
|
+
mode: "display",
|
|
213
|
+
record: r,
|
|
214
|
+
refs: f,
|
|
215
|
+
locale: v
|
|
216
|
+
}) : t(r[e])
|
|
217
|
+
}, e) : /* @__PURE__ */ p("td", {
|
|
218
|
+
style: {
|
|
219
|
+
...j,
|
|
220
|
+
outline: a ? "1px solid var(--danger)" : "none",
|
|
221
|
+
outlineOffset: -1,
|
|
222
|
+
borderRadius: a ? 4 : 0
|
|
223
|
+
},
|
|
224
|
+
title: a ? `${e} is required` : void 0,
|
|
225
|
+
children: n ? i({
|
|
226
|
+
field: n,
|
|
227
|
+
fieldName: e,
|
|
228
|
+
value: r[e],
|
|
229
|
+
mode: "edit",
|
|
230
|
+
onChange: (t) => h(r._key, e, t),
|
|
231
|
+
record: r,
|
|
232
|
+
refs: f,
|
|
233
|
+
locale: v
|
|
234
|
+
}) : t(r[e])
|
|
235
|
+
}, e);
|
|
236
|
+
}),
|
|
237
|
+
/* @__PURE__ */ p("td", {
|
|
238
|
+
style: {
|
|
239
|
+
padding: "4px 8px",
|
|
240
|
+
borderBottom: "1px solid var(--divider)",
|
|
241
|
+
verticalAlign: "middle"
|
|
242
|
+
},
|
|
243
|
+
children: y ? /* @__PURE__ */ p(n, {
|
|
244
|
+
size: 24,
|
|
245
|
+
icon: /* @__PURE__ */ p(e.refresh, { size: 12 }),
|
|
246
|
+
onClick: () => _(r._key),
|
|
247
|
+
title: "Undo delete"
|
|
248
|
+
}) : /* @__PURE__ */ p(n, {
|
|
249
|
+
size: 24,
|
|
250
|
+
icon: /* @__PURE__ */ p(e.trash, { size: 12 }),
|
|
251
|
+
onClick: () => g(r._key),
|
|
252
|
+
title: "Delete row"
|
|
253
|
+
})
|
|
254
|
+
})
|
|
255
|
+
]
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
//#endregion
|
|
259
|
+
export { w as DraggableChildrenTable };
|
package/dist-lib/api/data.d.ts
CHANGED
|
@@ -77,7 +77,7 @@ export declare class ActionBatchError extends Error {
|
|
|
77
77
|
* ctx.ObjectIDs). The legacy `_ids` envelope was removed in Task 5;
|
|
78
78
|
* passing it triggers a 400 from the server.
|
|
79
79
|
*/
|
|
80
|
-
export declare function buildActionBody(params: Record<string, unknown> | undefined, ids?: string[]
|
|
80
|
+
export declare function buildActionBody(params: Record<string, unknown> | undefined, ids?: string[]): ActionExecuteRequest;
|
|
81
81
|
/**
|
|
82
82
|
* Invoke an action. The URL `code` must be fully qualified for
|
|
83
83
|
* entity-scoped actions (e.g. `lead.archive`). For global actions it's the
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Entity, Schema, Screen } from "../../types/schema";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Refs } from "../../components/fields";
|
|
3
3
|
interface DetailAuditStripProps {
|
|
4
4
|
screen: Screen;
|
|
5
5
|
entity: Entity;
|
|
6
6
|
entityCode: string;
|
|
7
7
|
record: Record<string, unknown>;
|
|
8
|
-
refs?:
|
|
8
|
+
refs?: Refs;
|
|
9
9
|
schema: Schema;
|
|
10
10
|
locale: string;
|
|
11
11
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Entity, Schema, Screen } from "../../types/schema";
|
|
2
2
|
import type { StatusInfo } from "../../types/api";
|
|
3
|
-
import type {
|
|
3
|
+
import type { Refs } from "../../components/fields";
|
|
4
4
|
interface DetailHighlightsProps {
|
|
5
5
|
screen: Screen;
|
|
6
6
|
entity: Entity;
|
|
7
7
|
entityCode: string;
|
|
8
8
|
record: Record<string, unknown>;
|
|
9
|
-
refs?:
|
|
9
|
+
refs?: Refs;
|
|
10
10
|
objectStatuses?: StatusInfo[];
|
|
11
11
|
schema: Schema;
|
|
12
12
|
locale: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Entity, Schema } from "../../types/schema";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Refs } from "../../components/fields";
|
|
3
3
|
import type { PendingChildRow } from "./LayoutRenderer";
|
|
4
4
|
import type { ResolvedChildConfig } from "../../lib/child-config";
|
|
5
5
|
interface DraggableChildrenTableProps {
|
|
@@ -9,7 +9,7 @@ interface DraggableChildrenTableProps {
|
|
|
9
9
|
rows: PendingChildRow[];
|
|
10
10
|
onChange: (rows: PendingChildRow[]) => void;
|
|
11
11
|
validationErrors?: Record<string, string[]>;
|
|
12
|
-
refs?:
|
|
12
|
+
refs?: Refs;
|
|
13
13
|
}
|
|
14
14
|
export declare function DraggableChildrenTable({ config, childEntity, schema, rows, onChange, validationErrors, refs, }: DraggableChildrenTableProps): import("react").JSX.Element;
|
|
15
15
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Entity, Schema } from "../../types/schema";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Refs } from "../../components/fields";
|
|
3
3
|
import type { PendingChildRow } from "./LayoutRenderer";
|
|
4
4
|
import type { ResolvedChildConfig } from "../../lib/child-config";
|
|
5
5
|
interface EditableChildrenTableProps {
|
|
@@ -9,7 +9,7 @@ interface EditableChildrenTableProps {
|
|
|
9
9
|
rows: PendingChildRow[];
|
|
10
10
|
onChange: (rows: PendingChildRow[]) => void;
|
|
11
11
|
validationErrors?: Record<string, string[]>;
|
|
12
|
-
refs?:
|
|
12
|
+
refs?: Refs;
|
|
13
13
|
}
|
|
14
14
|
export declare function EditableChildrenTable({ config, childEntity, schema, rows, onChange, validationErrors, refs, }: EditableChildrenTableProps): import("react").JSX.Element;
|
|
15
15
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Entity, LayoutNode, Schema } from "../../types/schema";
|
|
2
2
|
import type { StatusInfo, PropertyValue } from "../../types/api";
|
|
3
|
-
import type {
|
|
3
|
+
import type { Refs } from "../../components/fields";
|
|
4
4
|
export interface PendingChildRow {
|
|
5
5
|
_key: string;
|
|
6
6
|
_deleted?: boolean;
|
|
@@ -16,7 +16,7 @@ export interface LayoutContext {
|
|
|
16
16
|
isNew: boolean;
|
|
17
17
|
mode: "display" | "edit";
|
|
18
18
|
onFieldChange?: (field: string, value: unknown) => void;
|
|
19
|
-
refs?:
|
|
19
|
+
refs?: Refs;
|
|
20
20
|
columns?: number;
|
|
21
21
|
objectProperties?: PropertyValue[];
|
|
22
22
|
onSetProperty?: (propertyCode: string, value: unknown) => void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
2
|
import type { EntityField, Entity, Screen } from "../../../types/schema";
|
|
3
|
-
|
|
3
|
+
import type { RowData, Refs } from "../../../types/api";
|
|
4
|
+
export type { RowData, Refs };
|
|
4
5
|
export type CellOutput = string | number | ReactElement;
|
|
5
|
-
export type CellRenderer = (value: unknown, record:
|
|
6
|
-
export type RefsMap = Record<string, Record<string, Record<string, unknown>>>;
|
|
6
|
+
export type CellRenderer = (value: unknown, record: RowData) => CellOutput;
|
|
7
7
|
export interface CellResolveCtx {
|
|
8
8
|
field: EntityField;
|
|
9
9
|
fieldName: string;
|
|
@@ -11,7 +11,7 @@ export interface CellResolveCtx {
|
|
|
11
11
|
entity?: Entity;
|
|
12
12
|
entities?: Record<string, Entity>;
|
|
13
13
|
screens?: Record<string, Screen>;
|
|
14
|
-
refs?:
|
|
14
|
+
refs?: Refs | (() => Refs | undefined);
|
|
15
15
|
locale: string;
|
|
16
16
|
}
|
|
17
17
|
export type CellFactory = (ctx: CellResolveCtx) => CellRenderer;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { EntityField, Entity, Screen } from "../../types/schema";
|
|
2
2
|
import { type FieldType } from "../../types/fieldType";
|
|
3
|
-
|
|
3
|
+
import type { Refs } from "../../types/api";
|
|
4
|
+
export type { Refs };
|
|
4
5
|
export interface FieldRendererProps {
|
|
5
6
|
field: EntityField;
|
|
6
7
|
entityCode?: string;
|
|
@@ -11,7 +12,7 @@ export interface FieldRendererProps {
|
|
|
11
12
|
fieldId?: string;
|
|
12
13
|
labelId?: string;
|
|
13
14
|
record?: Record<string, unknown>;
|
|
14
|
-
refs?:
|
|
15
|
+
refs?: Refs;
|
|
15
16
|
fill?: boolean;
|
|
16
17
|
compact?: boolean;
|
|
17
18
|
surface?: "list" | "detail";
|
|
@@ -23,4 +24,3 @@ export interface FieldRendererProps {
|
|
|
23
24
|
type FieldRenderer = React.ComponentType<FieldRendererProps>;
|
|
24
25
|
export declare const editRegistry: Record<FieldType, FieldRenderer>;
|
|
25
26
|
export declare function renderField(props: FieldRendererProps): React.ReactNode;
|
|
26
|
-
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { Entity, Screen } from "../../types/schema";
|
|
3
3
|
import type { FileFieldDef, FileFieldValue } from "../../types/files";
|
|
4
|
-
import type {
|
|
4
|
+
import type { Refs } from "../../components/fields";
|
|
5
5
|
export declare function getEntityFileField(entity: Pick<Entity, "files">, fieldName: string): FileFieldDef | undefined;
|
|
6
6
|
export declare function getFileFieldValue(record: Record<string, unknown>, fieldName: string): FileFieldValue;
|
|
7
7
|
export declare function getSchemaFieldValue(entity: Pick<Entity, "fields" | "files">, record: Record<string, unknown>, fieldName: string): unknown;
|
|
@@ -14,7 +14,7 @@ export declare function renderSchemaField(props: {
|
|
|
14
14
|
record: Record<string, unknown>;
|
|
15
15
|
mode: "display" | "edit";
|
|
16
16
|
onChange?: (value: unknown) => void;
|
|
17
|
-
refs?:
|
|
17
|
+
refs?: Refs;
|
|
18
18
|
disabled?: boolean;
|
|
19
19
|
surface?: "list" | "detail";
|
|
20
20
|
entities?: Record<string, Entity>;
|
|
@@ -2,7 +2,7 @@ import { type FilterNode, type FilterOp } from "../../lib/filters";
|
|
|
2
2
|
export interface FilterFieldMeta {
|
|
3
3
|
code: string;
|
|
4
4
|
label: string;
|
|
5
|
-
type: "string" | "enum" | "int" | "float" | "date" | "timestamp" | "bool" | "ref" | "status" | "property" | string;
|
|
5
|
+
type: "string" | "enum" | "int" | "float" | "date" | "timestamp" | "bool" | "ref" | "status" | "property" | (string & {});
|
|
6
6
|
operators: FilterOp[];
|
|
7
7
|
options?: {
|
|
8
8
|
value: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Refs } from "../../components/fields";
|
|
2
2
|
import type { EntityField } from "../../types/schema";
|
|
3
3
|
export interface PeekFieldCellProps {
|
|
4
4
|
field: EntityField;
|
|
@@ -8,7 +8,7 @@ export interface PeekFieldCellProps {
|
|
|
8
8
|
label: string;
|
|
9
9
|
value: unknown;
|
|
10
10
|
record?: Record<string, unknown>;
|
|
11
|
-
refs?:
|
|
11
|
+
refs?: Refs;
|
|
12
12
|
readOnly?: boolean;
|
|
13
13
|
/** Fired exactly once per explicit user commit. */
|
|
14
14
|
onCommit: (next: unknown) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import { type Action, type Entity, type EntityField, type Screen } from "../../types/schema";
|
|
3
|
-
import type {
|
|
3
|
+
import type { Refs } from "../../components/fields";
|
|
4
4
|
export interface QuickPeekRegularFieldSpec {
|
|
5
5
|
key: string;
|
|
6
6
|
label: string;
|
|
@@ -24,7 +24,7 @@ export interface QuickPeekProps<R extends Record<string, unknown> = Record<strin
|
|
|
24
24
|
avatarName?: string;
|
|
25
25
|
fields: QuickPeekFieldSpec[];
|
|
26
26
|
/** $refs payload from the list/detail API; used by RefField-style renderers. */
|
|
27
|
-
refs?:
|
|
27
|
+
refs?: Refs;
|
|
28
28
|
/** Full screen YAML — honors `screen.quick_peek.width` and `quick_peek.primary_action`. */
|
|
29
29
|
screen?: Screen;
|
|
30
30
|
/** All actions available on this record. */
|
|
@@ -16,5 +16,5 @@ interface PropertyGridEditorProps {
|
|
|
16
16
|
/** UI-only marker for cells whose selected rows disagree on the current value. */
|
|
17
17
|
declare const MULTIPLE_VALUES: unique symbol;
|
|
18
18
|
export declare function PropertyGridEditor({ entity, filterTargets, selectedRows, value, onChange, }: PropertyGridEditorProps): import("react").JSX.Element;
|
|
19
|
-
export declare function detectCommonValue(target: MassEditTarget, selectedRows: ReadonlyArray<Record<string, unknown>> | undefined): unknown
|
|
19
|
+
export declare function detectCommonValue(target: MassEditTarget, selectedRows: ReadonlyArray<Record<string, unknown>> | undefined): unknown;
|
|
20
20
|
export { MULTIPLE_VALUES };
|
|
@@ -1,36 +1,12 @@
|
|
|
1
|
+
import { type RowData } from "../../types/api";
|
|
1
2
|
import type { Entity, PkValues } from "../../types/schema";
|
|
2
3
|
interface SmartListPageProps {
|
|
3
4
|
screenCode: string;
|
|
4
5
|
}
|
|
5
|
-
type RowData = Record<string, unknown>;
|
|
6
6
|
export declare const PER_PAGE_MAX = 1000;
|
|
7
7
|
export declare const PER_PAGE_DEFAULT = 200;
|
|
8
8
|
export declare const PER_PAGE_OPTIONS: readonly [25, 50, 100, 200, 500, 1000];
|
|
9
9
|
export declare function rowSelectionKey(entity: Entity, row: RowData): string;
|
|
10
10
|
export declare function selectedRowPkValues(entity: Entity | undefined, rows: RowData[], selectedKeys: string[]): PkValues[];
|
|
11
|
-
/**
|
|
12
|
-
* Resolve the target href for a row click on a list screen per the
|
|
13
|
-
* entity-canonical DSL. `list.detail_screen` is tri-valued:
|
|
14
|
-
*
|
|
15
|
-
* absent -> inherit entity.detail_screen
|
|
16
|
-
* DETAIL_SCREEN_NONE ("none") -> explicit opt-out (disabled)
|
|
17
|
-
* any other code -> override with that detail screen
|
|
18
|
-
*
|
|
19
|
-
* Resolution:
|
|
20
|
-
* if list.detail_screen === "none" -> null (disabled)
|
|
21
|
-
* elif list.detail_screen is set -> use screens[list.detail_screen]
|
|
22
|
-
* elif entity.detail_screen is set -> use screens[entity.detail_screen]
|
|
23
|
-
* else -> null (disabled)
|
|
24
|
-
*
|
|
25
|
-
* Returns null when no navigation target exists; callers MUST render
|
|
26
|
-
* non-interactive rows in that case (no cursor, no click handler).
|
|
27
|
-
*/
|
|
28
|
-
export declare function resolveDetailHref(list: {
|
|
29
|
-
detail_screen?: string;
|
|
30
|
-
}, id: string, entity: {
|
|
31
|
-
detail_screen?: string;
|
|
32
|
-
} | undefined, allScreens: Record<string, {
|
|
33
|
-
route?: string;
|
|
34
|
-
}> | undefined): string | null;
|
|
35
11
|
export declare function SmartListPage({ screenCode }: SmartListPageProps): import("react").JSX.Element;
|
|
36
12
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Cell } from "@tanstack/react-table";
|
|
2
|
-
type RowData
|
|
2
|
+
import type { RowData } from "../../../types/api";
|
|
3
3
|
export declare function DataCell({ cell, isRowSelected, }: {
|
|
4
4
|
cell: Cell<RowData, unknown>;
|
|
5
5
|
isRowSelected: boolean;
|
|
6
6
|
}): import("react").JSX.Element;
|
|
7
|
-
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type RefObject } from "react";
|
|
2
2
|
import type { ColumnDef } from "@tanstack/react-table";
|
|
3
|
-
import { type
|
|
3
|
+
import { type Refs } from "../../../components/fields/cells/registry";
|
|
4
4
|
import type { Action, Entity, Screen } from "../../../types/schema";
|
|
5
|
-
type RowData
|
|
5
|
+
import type { RowData } from "../../../types/api";
|
|
6
6
|
type SchemaMaps = {
|
|
7
7
|
entities?: Record<string, Entity>;
|
|
8
8
|
screens?: Record<string, Screen>;
|
|
@@ -33,7 +33,7 @@ export interface BuildListColumnsArgs {
|
|
|
33
33
|
}) => void;
|
|
34
34
|
/** Latest $refs payload, read through a ref so column identity is stable
|
|
35
35
|
* across data fetches (see SmartListPageInner refsRef comment). */
|
|
36
|
-
refsRef: RefObject<
|
|
36
|
+
refsRef: RefObject<Refs | undefined>;
|
|
37
37
|
/** Row-selection key, used as the stable rowId for per-row action dispatch. */
|
|
38
38
|
rowSelectionKey: (entity: Entity, row: RowData) => string;
|
|
39
39
|
setPeekRow: (row: RowData) => void;
|
|
@@ -8,8 +8,9 @@ export interface RunActionOptions {
|
|
|
8
8
|
/** When `action` is absent, individual flags still steer dispatch. */
|
|
9
9
|
destructive?: boolean;
|
|
10
10
|
longRunning?: boolean;
|
|
11
|
-
/** Invoked after the user confirms / fills params.
|
|
12
|
-
|
|
11
|
+
/** Invoked after the user confirms / fills params. May return a promise
|
|
12
|
+
* (awaited by the runner) or a sync value; `unknown` covers both. */
|
|
13
|
+
execute: (params: Record<string, unknown>) => unknown;
|
|
13
14
|
/**
|
|
14
15
|
* Caller-side hook fired after `execute` resolves with a `success`
|
|
15
16
|
* outcome. Reason: navigation and cache-invalidation decisions that
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type IconName } from "../../components/primitives";
|
|
2
2
|
export interface Crumb {
|
|
3
3
|
label: string;
|
|
4
|
-
icon?: IconName | string;
|
|
4
|
+
icon?: IconName | (string & {});
|
|
5
5
|
onClick?: () => void;
|
|
6
6
|
target?: unknown;
|
|
7
7
|
/** True for the final segment (rendered bold per design spec). */
|