@declarion/react 0.31.2 → 0.32.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/{ActionRunner-BzaZQtiI.js → ActionRunner-CaSrGpBi.js} +264 -260
- package/dist-lib/{DraggableChildrenTable-DILqStHQ.js → DraggableChildrenTable-CAHg7paQ.js} +1 -1
- package/dist-lib/{Grid-BIsiUwPh.js → Grid-DDbBhqcl.js} +2 -2
- package/dist-lib/{LayoutRenderer-3RvIsC9M.js → LayoutRenderer-CelsqsZ6.js} +433 -433
- package/dist-lib/{MarkdownRenderer-CaHhWrfm.js → MarkdownRenderer-DThy2ixe.js} +1 -1
- package/dist-lib/RefreshControl-CorluL6r.js +582 -0
- package/dist-lib/{SmartDetailPage.impl--EO-9fos.js → SmartDetailPage.impl-USIxbl-8.js} +449 -411
- package/dist-lib/{SmartRecordListPage.impl-B1iws8yf.js → SmartRecordListPage.impl-BKIpTNK7.js} +210 -210
- package/dist-lib/api/data.d.ts +4 -4
- package/dist-lib/api/params.d.ts +1 -1
- package/dist-lib/components/layout/Rail.d.ts +5 -5
- package/dist-lib/components/layout/TopBar.d.ts +3 -1
- package/dist-lib/components/pages/auth/AuthShell.d.ts +1 -1
- package/dist-lib/components/pages/list/ListHeader.d.ts +1 -1
- package/dist-lib/components/primitives/BrandLogo.d.ts +1 -1
- package/dist-lib/components/shared/ActionRunner.d.ts +1 -0
- package/dist-lib/components/shared/ObjectActionBar.d.ts +29 -0
- package/dist-lib/components/shared/PageHeader.d.ts +1 -1
- package/dist-lib/components/shared/RecordHeader.d.ts +2 -1
- package/dist-lib/components/shared/RefreshControl.d.ts +6 -0
- package/dist-lib/hooks/useBranding.d.ts +8 -0
- package/dist-lib/hooks/useBrandingChrome.d.ts +6 -0
- package/dist-lib/hooks/useLiveObject.d.ts +9 -0
- package/dist-lib/hooks/useMutations.d.ts +3 -3
- package/dist-lib/hooks/useObject.d.ts +10 -0
- package/dist-lib/hooks/usePageStateRuntime.d.ts +1 -1
- package/dist-lib/hooks/useParams.d.ts +10 -1
- package/dist-lib/index.d.ts +11 -5
- package/dist-lib/index.js +1890 -1722
- package/dist-lib/lib/actions.d.ts +6 -2
- package/dist-lib/lib/branding.d.ts +10 -1
- package/dist-lib/{registry-2KliNTHB.js → registry-KQyyL5Gt.js} +1452 -1401
- package/dist-lib/testing.d.ts +5 -3
- package/dist-lib/testing.js +35 -31
- package/dist-lib/types/api.d.ts +70 -3
- package/dist-lib/types/schema.d.ts +1 -15
- package/dist-lib/{useProperties-Co3RdtuT.js → useProperties-D74hyWIa.js} +53 -53
- package/dist-lib/{value-BooGwUik.js → value-BfXXl5EE.js} +1 -1
- package/package.json +1 -1
- package/dist-lib/hooks/useEntityItem.d.ts +0 -10
- package/dist-lib/peekDraftStore-yyzMbaiI.js +0 -468
package/dist-lib/testing.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { QueryClient } from "@tanstack/react-query";
|
|
|
4
4
|
import { type ResponsiveViewport } from "./hooks/useResponsiveMode";
|
|
5
5
|
import { type ActionExecuteRequest, type ActionExecuteResponse } from "./api/data";
|
|
6
6
|
import type { Schema } from "./types/schema";
|
|
7
|
-
import type { ListMeta, ListResponse, Refs } from "./types/api";
|
|
7
|
+
import type { DataResponse, ListMeta, ListResponse, Refs } from "./types/api";
|
|
8
8
|
/** A single action's stubbed outcome: the action's RESULT payload (what
|
|
9
9
|
* executeDeclarionAction unwraps from response.result), or a function of the
|
|
10
10
|
* dispatched body returning it. The harness always wraps it in a success
|
|
@@ -25,8 +25,10 @@ export interface RenderWithDeclarionOptions {
|
|
|
25
25
|
schema?: Schema;
|
|
26
26
|
/** entity -> rows, { rows, meta }, or an entityDataFixture() ListResponse; resolves useEntityData / useEntityCount. */
|
|
27
27
|
entityData?: Record<string, Record<string, unknown>[] | EntityDataFixture | ListResponse>;
|
|
28
|
-
/** entity -> { [id]: row }; resolves
|
|
29
|
-
entityItems?: Record<string, Record<string, Record<string, unknown
|
|
28
|
+
/** entity -> { [id]: row | Error }; resolves useObject. Error entries let tests model 404/403 without network. */
|
|
29
|
+
entityItems?: Record<string, Record<string, Record<string, unknown> | Error>>;
|
|
30
|
+
/** entity -> { [id]: DataResponse | Error }; resolves useObject when a test needs envelope metadata like `$refs`. */
|
|
31
|
+
entityItemResponses?: Record<string, Record<string, DataResponse | Error>>;
|
|
30
32
|
/** action code -> result | (body) => result; resolves executeAction (and create/update/delete/restore). */
|
|
31
33
|
actionResults?: Record<string, ActionResult>;
|
|
32
34
|
/** Initial path for the memory router (e.g. "/replay/abc/compare"). Default "/". */
|
package/dist-lib/testing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Nn as e, dt as t, lt as n, mt as r, nt as i, t as a, ut as o } from "./ActionRunner-CaSrGpBi.js";
|
|
2
2
|
import { useState as s } from "react";
|
|
3
3
|
import { MemoryRouter as c } from "react-router-dom";
|
|
4
4
|
import { QueryClient as l, QueryClientProvider as u } from "@tanstack/react-query";
|
|
@@ -70,7 +70,7 @@ function x() {
|
|
|
70
70
|
created_at: "2026-01-01T00:00:00Z",
|
|
71
71
|
updated_at: "2026-01-01T00:00:00Z"
|
|
72
72
|
};
|
|
73
|
-
|
|
73
|
+
r.getState().setUser(t, e);
|
|
74
74
|
}
|
|
75
75
|
function S(e) {
|
|
76
76
|
if (e === void 0) return { rows: [] };
|
|
@@ -85,50 +85,54 @@ function S(e) {
|
|
|
85
85
|
}
|
|
86
86
|
return e;
|
|
87
87
|
}
|
|
88
|
-
function C(
|
|
89
|
-
let
|
|
90
|
-
|
|
91
|
-
let n =
|
|
88
|
+
function C(e) {
|
|
89
|
+
let r = e.entityData ?? {};
|
|
90
|
+
t((e, t) => {
|
|
91
|
+
let n = r[e], i = S(n), a = i.meta?.per_page ?? 50, o = i.meta?.total ?? i.rows.length;
|
|
92
92
|
return t.count === "only" ? {
|
|
93
93
|
data: [],
|
|
94
94
|
meta: {
|
|
95
95
|
page: 1,
|
|
96
|
-
per_page:
|
|
96
|
+
per_page: a,
|
|
97
97
|
total: o,
|
|
98
|
-
total_pages:
|
|
99
|
-
count_mode:
|
|
98
|
+
total_pages: i.meta?.total_pages ?? Math.max(1, Math.ceil(o / a)),
|
|
99
|
+
count_mode: i.meta?.count_mode ?? "exact"
|
|
100
100
|
}
|
|
101
101
|
} : {
|
|
102
|
-
data:
|
|
102
|
+
data: i.rows,
|
|
103
103
|
meta: {
|
|
104
|
-
page:
|
|
105
|
-
per_page:
|
|
106
|
-
has_more:
|
|
104
|
+
page: i.meta?.page ?? 1,
|
|
105
|
+
per_page: a,
|
|
106
|
+
has_more: i.meta?.has_more ?? !1
|
|
107
107
|
},
|
|
108
|
-
...
|
|
108
|
+
...i.refs === void 0 ? {} : { $refs: i.refs }
|
|
109
109
|
};
|
|
110
110
|
});
|
|
111
|
-
let
|
|
112
|
-
|
|
113
|
-
let
|
|
114
|
-
|
|
111
|
+
let a = e.entityItems ?? {}, s = e.entityItemResponses ?? {};
|
|
112
|
+
o((e, t) => {
|
|
113
|
+
let n = typeof t == "string" ? t : i(t), r = s[e]?.[n];
|
|
114
|
+
if (r instanceof Error) throw r;
|
|
115
|
+
if (r !== void 0) return r;
|
|
116
|
+
let o = a[e]?.[n];
|
|
117
|
+
if (o instanceof Error) throw o;
|
|
118
|
+
return { data: o };
|
|
115
119
|
});
|
|
116
|
-
let
|
|
117
|
-
|
|
118
|
-
if (!(e in
|
|
119
|
-
let n =
|
|
120
|
+
let c = e.actionResults ?? {};
|
|
121
|
+
n(async (e, t) => {
|
|
122
|
+
if (!(e in c)) throw Error(`renderWithDeclarion: no action result registered for "${e}" (seed it via actionResults)`);
|
|
123
|
+
let n = c[e];
|
|
120
124
|
return b(typeof n == "function" ? await n(t) : n);
|
|
121
125
|
});
|
|
122
126
|
}
|
|
123
127
|
function w() {
|
|
124
|
-
|
|
128
|
+
t(null), o(null), n(null), r.setState({
|
|
125
129
|
user: null,
|
|
126
130
|
isAuthenticated: !1,
|
|
127
131
|
activeTenant: null,
|
|
128
132
|
tenants: []
|
|
129
133
|
});
|
|
130
134
|
}
|
|
131
|
-
function T(
|
|
135
|
+
function T(t, n = {}) {
|
|
132
136
|
let r = new l({ defaultOptions: { queries: {
|
|
133
137
|
retry: !1,
|
|
134
138
|
gcTime: Infinity
|
|
@@ -138,21 +142,21 @@ function T(e, n = {}) {
|
|
|
138
142
|
client: r,
|
|
139
143
|
children: [/* @__PURE__ */ f(c, {
|
|
140
144
|
initialEntries: [n.route ?? "/"],
|
|
141
|
-
children: /* @__PURE__ */ f(
|
|
145
|
+
children: /* @__PURE__ */ f(a, { children: t })
|
|
142
146
|
}), /* @__PURE__ */ f(d, {})]
|
|
143
|
-
}),
|
|
147
|
+
}), o = m(n.viewport ? /* @__PURE__ */ f(e, {
|
|
144
148
|
viewportOverride: n.viewport,
|
|
145
149
|
children: i
|
|
146
150
|
}) : i);
|
|
147
|
-
return Object.assign(
|
|
151
|
+
return Object.assign(o, { queryClient: r });
|
|
148
152
|
}
|
|
149
153
|
function E({ children: e, authenticated: t = !0, ...n }) {
|
|
150
|
-
let [
|
|
154
|
+
let [i] = s(() => {
|
|
151
155
|
let e = new l({ defaultOptions: { queries: {
|
|
152
156
|
retry: !1,
|
|
153
157
|
gcTime: Infinity
|
|
154
158
|
} } });
|
|
155
|
-
return t ? (x(), e.setQueryData(["schema", !0], n.schema ?? h())) :
|
|
159
|
+
return t ? (x(), e.setQueryData(["schema", !0], n.schema ?? h())) : r.setState({
|
|
156
160
|
user: null,
|
|
157
161
|
isAuthenticated: !1,
|
|
158
162
|
activeTenant: null,
|
|
@@ -160,10 +164,10 @@ function E({ children: e, authenticated: t = !0, ...n }) {
|
|
|
160
164
|
}), C(n), e;
|
|
161
165
|
});
|
|
162
166
|
return /* @__PURE__ */ p(u, {
|
|
163
|
-
client:
|
|
167
|
+
client: i,
|
|
164
168
|
children: [/* @__PURE__ */ f(c, {
|
|
165
169
|
initialEntries: [n.route ?? "/"],
|
|
166
|
-
children: /* @__PURE__ */ f(
|
|
170
|
+
children: /* @__PURE__ */ f(a, { children: e })
|
|
167
171
|
}), /* @__PURE__ */ f(d, {})]
|
|
168
172
|
});
|
|
169
173
|
}
|
package/dist-lib/types/api.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export interface ListResponse<T = Record<string, unknown>> {
|
|
|
30
30
|
}
|
|
31
31
|
export interface DataResponse<T = Record<string, unknown>> {
|
|
32
32
|
data: T;
|
|
33
|
+
$refs?: Refs;
|
|
33
34
|
}
|
|
34
35
|
export interface ApiErrorBody {
|
|
35
36
|
error: {
|
|
@@ -148,6 +149,7 @@ export interface PublicParam {
|
|
|
148
149
|
code: string;
|
|
149
150
|
name: LocalizedString;
|
|
150
151
|
type: string;
|
|
152
|
+
structure?: string;
|
|
151
153
|
category: string;
|
|
152
154
|
description?: LocalizedString;
|
|
153
155
|
value: unknown;
|
|
@@ -159,8 +161,7 @@ export interface PublicLegalLinks {
|
|
|
159
161
|
terms_url?: string;
|
|
160
162
|
docs_url?: string;
|
|
161
163
|
}
|
|
162
|
-
|
|
163
|
-
export interface PublicBranding {
|
|
164
|
+
export interface BrandingIdentity {
|
|
164
165
|
app_name?: string;
|
|
165
166
|
app_logo?: string;
|
|
166
167
|
app_initial?: string;
|
|
@@ -176,6 +177,73 @@ export interface PublicBranding {
|
|
|
176
177
|
workspace_domain?: string;
|
|
177
178
|
legal_links?: PublicLegalLinks;
|
|
178
179
|
}
|
|
180
|
+
export interface BrandingThemeColors {
|
|
181
|
+
accent?: string;
|
|
182
|
+
accent_hover?: string;
|
|
183
|
+
accent_soft?: string;
|
|
184
|
+
primary?: string;
|
|
185
|
+
sidebar?: string;
|
|
186
|
+
rail?: string;
|
|
187
|
+
surface?: string;
|
|
188
|
+
surface_2?: string;
|
|
189
|
+
background?: string;
|
|
190
|
+
text?: string;
|
|
191
|
+
text_muted?: string;
|
|
192
|
+
border?: string;
|
|
193
|
+
}
|
|
194
|
+
export interface BrandingThemeTypography {
|
|
195
|
+
font_display?: string;
|
|
196
|
+
body?: number;
|
|
197
|
+
page_title?: number;
|
|
198
|
+
table_cell?: number;
|
|
199
|
+
control?: number;
|
|
200
|
+
caption?: number;
|
|
201
|
+
}
|
|
202
|
+
export interface BrandingTheme {
|
|
203
|
+
css_url?: string;
|
|
204
|
+
font_sans?: string;
|
|
205
|
+
font_mono?: string;
|
|
206
|
+
radius?: string;
|
|
207
|
+
density?: string;
|
|
208
|
+
colors?: BrandingThemeColors;
|
|
209
|
+
typography?: BrandingThemeTypography;
|
|
210
|
+
}
|
|
211
|
+
export interface BrandingSurfaceFlags {
|
|
212
|
+
show_title?: boolean;
|
|
213
|
+
show_breadcrumbs?: boolean;
|
|
214
|
+
show_actions?: boolean;
|
|
215
|
+
show_count?: boolean;
|
|
216
|
+
show_sidebar?: boolean;
|
|
217
|
+
show_topbar?: boolean;
|
|
218
|
+
show_rail?: boolean;
|
|
219
|
+
show_tabs?: boolean;
|
|
220
|
+
show_tenant_switcher?: boolean;
|
|
221
|
+
}
|
|
222
|
+
export interface BrandingChrome {
|
|
223
|
+
full?: {
|
|
224
|
+
shell?: BrandingSurfaceFlags;
|
|
225
|
+
surfaces?: {
|
|
226
|
+
list?: BrandingSurfaceFlags;
|
|
227
|
+
detail?: BrandingSurfaceFlags;
|
|
228
|
+
record_list?: BrandingSurfaceFlags;
|
|
229
|
+
custom?: BrandingSurfaceFlags;
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
embed?: {
|
|
233
|
+
surfaces?: {
|
|
234
|
+
list?: BrandingSurfaceFlags;
|
|
235
|
+
detail?: BrandingSurfaceFlags;
|
|
236
|
+
record_list?: BrandingSurfaceFlags;
|
|
237
|
+
custom?: BrandingSurfaceFlags;
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
/** Structured value of the public `branding` parameter. */
|
|
242
|
+
export interface PublicBranding {
|
|
243
|
+
identity?: BrandingIdentity;
|
|
244
|
+
theme?: BrandingTheme;
|
|
245
|
+
chrome?: BrandingChrome;
|
|
246
|
+
}
|
|
179
247
|
/**
|
|
180
248
|
* Deploy-time identity exposed pre-login by /api/params/public so the
|
|
181
249
|
* auth shell can render real region/build values (no mockup placeholders).
|
|
@@ -193,7 +261,6 @@ export interface PublicParamsResponse {
|
|
|
193
261
|
parameters: PublicParam[];
|
|
194
262
|
accents?: Record<string, AccentDef>;
|
|
195
263
|
messages?: Record<string, LocalizedString>;
|
|
196
|
-
branding?: PublicBranding;
|
|
197
264
|
meta?: PublicMeta;
|
|
198
265
|
}
|
|
199
266
|
/**
|
|
@@ -261,6 +261,7 @@ export interface ParameterDef {
|
|
|
261
261
|
name: LocalizedString;
|
|
262
262
|
description?: LocalizedString;
|
|
263
263
|
type: string;
|
|
264
|
+
structure?: string;
|
|
264
265
|
default?: unknown;
|
|
265
266
|
is_public?: boolean;
|
|
266
267
|
category?: string;
|
|
@@ -925,20 +926,6 @@ export interface HandlerDef {
|
|
|
925
926
|
params?: OrderedMap<HandlerParam>;
|
|
926
927
|
success_event?: string;
|
|
927
928
|
}
|
|
928
|
-
export interface Branding {
|
|
929
|
-
app_name?: string;
|
|
930
|
-
app_logo?: string;
|
|
931
|
-
app_initial?: string;
|
|
932
|
-
accent_color?: string;
|
|
933
|
-
ai_name?: string;
|
|
934
|
-
wordmark?: string;
|
|
935
|
-
version_label?: string;
|
|
936
|
-
status_url?: string;
|
|
937
|
-
auth_tagline?: LocalizedString;
|
|
938
|
-
auth_subtagline?: LocalizedString;
|
|
939
|
-
auth_badges?: LocalizedString[];
|
|
940
|
-
css_url?: string;
|
|
941
|
-
}
|
|
942
929
|
export interface Schema {
|
|
943
930
|
languages: LanguageDef[];
|
|
944
931
|
structures: Record<string, StructureDef>;
|
|
@@ -950,7 +937,6 @@ export interface Schema {
|
|
|
950
937
|
enums: Record<string, EnumDef>;
|
|
951
938
|
parameters: Record<string, ParameterDef>;
|
|
952
939
|
messages?: Record<string, LocalizedString>;
|
|
953
|
-
branding?: Branding;
|
|
954
940
|
areas?: AreaDef[];
|
|
955
941
|
accents?: Record<string, AccentDef>;
|
|
956
942
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { J as e, Ot as t, R as n, Yt as r, gn as i, kt as a, on as o, rt as s } from "./ActionRunner-CaSrGpBi.js";
|
|
2
|
+
import { vt as c } from "./registry-KQyyL5Gt.js";
|
|
3
3
|
import { useEffect as l, useMemo as u } from "react";
|
|
4
4
|
import { useSearchParams as d } from "react-router-dom";
|
|
5
5
|
import { useInfiniteQuery as f, useMutation as p, useQueryClient as m } from "@tanstack/react-query";
|
|
@@ -109,7 +109,7 @@ var b = class {
|
|
|
109
109
|
await this.deleteMany([e]);
|
|
110
110
|
}
|
|
111
111
|
async deleteMany(e) {
|
|
112
|
-
return e.length === 0 ? { count: 0 } : { count: (await
|
|
112
|
+
return e.length === 0 ? { count: 0 } : { count: (await s(`${this.entity}.__delete`, {
|
|
113
113
|
object_ids: e,
|
|
114
114
|
entity: this.entity
|
|
115
115
|
})).object_count ?? e.length };
|
|
@@ -118,7 +118,7 @@ var b = class {
|
|
|
118
118
|
await this.restoreMany([e]);
|
|
119
119
|
}
|
|
120
120
|
async restoreMany(e) {
|
|
121
|
-
return e.length === 0 ? { count: 0 } : { count: (await
|
|
121
|
+
return e.length === 0 ? { count: 0 } : { count: (await s(`${this.entity}.__restore`, {
|
|
122
122
|
object_ids: e,
|
|
123
123
|
entity: this.entity
|
|
124
124
|
})).object_count ?? e.length };
|
|
@@ -232,39 +232,39 @@ function O(e, t, n) {
|
|
|
232
232
|
}
|
|
233
233
|
//#endregion
|
|
234
234
|
//#region src/hooks/useTabSearchMirror.ts
|
|
235
|
-
function k(
|
|
236
|
-
let
|
|
235
|
+
function k(t) {
|
|
236
|
+
let n = e(), [r] = d();
|
|
237
237
|
l(() => {
|
|
238
|
-
if (!
|
|
239
|
-
let
|
|
240
|
-
i &&
|
|
238
|
+
if (!t || n.enabled) return;
|
|
239
|
+
let e = c.getState(), i = e.findTabByPathname(t);
|
|
240
|
+
i && e.updateTabSearch(i.id, r.toString());
|
|
241
241
|
}, [
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
242
|
+
r,
|
|
243
|
+
t,
|
|
244
|
+
n.enabled
|
|
245
245
|
]);
|
|
246
246
|
}
|
|
247
247
|
//#endregion
|
|
248
248
|
//#region src/hooks/useRegisterScreenTab.ts
|
|
249
|
-
function A(
|
|
250
|
-
let
|
|
249
|
+
function A(t, n, r, i) {
|
|
250
|
+
let a = e();
|
|
251
251
|
l(() => {
|
|
252
|
-
!
|
|
253
|
-
pathname:
|
|
254
|
-
search:
|
|
255
|
-
title:
|
|
256
|
-
icon:
|
|
252
|
+
!t || a.enabled || c.getState().openTab({
|
|
253
|
+
pathname: t,
|
|
254
|
+
search: i,
|
|
255
|
+
title: n,
|
|
256
|
+
icon: r,
|
|
257
257
|
closable: !0
|
|
258
258
|
});
|
|
259
259
|
}, [
|
|
260
|
-
e,
|
|
261
260
|
t,
|
|
262
261
|
n,
|
|
263
|
-
|
|
262
|
+
r,
|
|
263
|
+
a.enabled
|
|
264
264
|
]);
|
|
265
265
|
}
|
|
266
266
|
function j(e, t, n) {
|
|
267
|
-
let r = e?.route, i = t ?
|
|
267
|
+
let r = e?.route, i = t ? o(e?.display?.name) || o(t.display.name_plural) : "", a = e?.display?.icon || t?.display.icon;
|
|
268
268
|
A(t ? r : void 0, i, a, n);
|
|
269
269
|
}
|
|
270
270
|
//#endregion
|
|
@@ -373,79 +373,79 @@ function V(e, t) {
|
|
|
373
373
|
}
|
|
374
374
|
//#endregion
|
|
375
375
|
//#region src/api/status.ts
|
|
376
|
-
async function H(e, t, r, i
|
|
377
|
-
let
|
|
378
|
-
status_group_code:
|
|
379
|
-
status_code:
|
|
376
|
+
async function H(e, t, n, r, i) {
|
|
377
|
+
let a = {
|
|
378
|
+
status_group_code: n,
|
|
379
|
+
status_code: r
|
|
380
380
|
};
|
|
381
|
-
|
|
382
|
-
let
|
|
381
|
+
i != null && (a.note = i);
|
|
382
|
+
let o = (await s(`${e}.__update`, {
|
|
383
383
|
object_ids: [t],
|
|
384
384
|
entity: e,
|
|
385
|
-
fields: { $statuses: [
|
|
385
|
+
fields: { $statuses: [a] }
|
|
386
386
|
})).result?.rows?.[0]?.$statuses ?? [];
|
|
387
|
-
return
|
|
387
|
+
return o.find((e) => e.group_code === n) ?? o[0];
|
|
388
388
|
}
|
|
389
389
|
//#endregion
|
|
390
390
|
//#region src/hooks/useObjectStatus.ts
|
|
391
|
-
function U(
|
|
391
|
+
function U(e, t) {
|
|
392
392
|
let r = m();
|
|
393
393
|
return p({
|
|
394
|
-
mutationFn: ({ groupCode:
|
|
394
|
+
mutationFn: ({ groupCode: n, statusCode: r, note: i }) => H(e, t, n, r, i),
|
|
395
395
|
onSuccess: () => {
|
|
396
|
-
r.invalidateQueries({ queryKey: ["entity-item",
|
|
396
|
+
r.invalidateQueries({ queryKey: ["entity-item", e] });
|
|
397
397
|
},
|
|
398
|
-
onError: (
|
|
399
|
-
|
|
398
|
+
onError: (e) => {
|
|
399
|
+
n.error(e.message);
|
|
400
400
|
}
|
|
401
401
|
});
|
|
402
402
|
}
|
|
403
403
|
//#endregion
|
|
404
404
|
//#region src/api/properties.ts
|
|
405
|
-
async function W(e, t,
|
|
406
|
-
let
|
|
405
|
+
async function W(e, t, n, r) {
|
|
406
|
+
let i = (await s(`${e}.__update`, {
|
|
407
407
|
object_ids: [t],
|
|
408
408
|
entity: e,
|
|
409
409
|
fields: { $properties: [{
|
|
410
|
-
property_code:
|
|
411
|
-
value:
|
|
410
|
+
property_code: n,
|
|
411
|
+
value: r
|
|
412
412
|
}] }
|
|
413
413
|
})).result?.rows?.[0]?.$properties ?? [];
|
|
414
|
-
return
|
|
414
|
+
return i.find((e) => e.property_code === n) ?? i[0];
|
|
415
415
|
}
|
|
416
|
-
async function G(e, t,
|
|
417
|
-
await
|
|
416
|
+
async function G(e, t, n) {
|
|
417
|
+
await s(`${e}.__update`, {
|
|
418
418
|
object_ids: [t],
|
|
419
419
|
entity: e,
|
|
420
420
|
fields: { $properties: [{
|
|
421
|
-
property_code:
|
|
421
|
+
property_code: n,
|
|
422
422
|
value: null
|
|
423
423
|
}] }
|
|
424
424
|
});
|
|
425
425
|
}
|
|
426
426
|
//#endregion
|
|
427
427
|
//#region src/hooks/useProperties.ts
|
|
428
|
-
function K(
|
|
428
|
+
function K(e, t) {
|
|
429
429
|
let r = m();
|
|
430
430
|
return p({
|
|
431
|
-
mutationFn: ({ propertyCode:
|
|
431
|
+
mutationFn: ({ propertyCode: n, value: r }) => W(e, t, n, r),
|
|
432
432
|
onSuccess: () => {
|
|
433
|
-
r.invalidateQueries({ queryKey: ["entity-item",
|
|
433
|
+
r.invalidateQueries({ queryKey: ["entity-item", e] });
|
|
434
434
|
},
|
|
435
|
-
onError: (
|
|
436
|
-
|
|
435
|
+
onError: (e) => {
|
|
436
|
+
n.error(e.message);
|
|
437
437
|
}
|
|
438
438
|
});
|
|
439
439
|
}
|
|
440
|
-
function q(
|
|
440
|
+
function q(e, t) {
|
|
441
441
|
let r = m();
|
|
442
442
|
return p({
|
|
443
|
-
mutationFn: (
|
|
443
|
+
mutationFn: (n) => G(e, t, n),
|
|
444
444
|
onSuccess: () => {
|
|
445
|
-
r.invalidateQueries({ queryKey: ["entity-item",
|
|
445
|
+
r.invalidateQueries({ queryKey: ["entity-item", e] });
|
|
446
446
|
},
|
|
447
|
-
onError: (
|
|
448
|
-
|
|
447
|
+
onError: (e) => {
|
|
448
|
+
n.error(e.message);
|
|
449
449
|
}
|
|
450
450
|
});
|
|
451
451
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ft as e, It as t, zt as n } from "./ActionRunner-
|
|
1
|
+
import { Ft as e, It as t, zt as n } from "./ActionRunner-CaSrGpBi.js";
|
|
2
2
|
import { useCallback as r, useEffect as i, useRef as a, useState as o } from "react";
|
|
3
3
|
//#region src/components/file-widgets/helpers.ts
|
|
4
4
|
var s = ["thumb_200", "thumb_300"];
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type QueryKey } from "@tanstack/react-query";
|
|
2
|
-
import type { PkValues } from "../types/schema";
|
|
3
|
-
/**
|
|
4
|
-
* The React Query key for a single-record read. Single source of truth for both
|
|
5
|
-
* `useEntityItem` and a detail screen registering its PRIMARY read with its
|
|
6
|
-
* retained page (`useRegisterRetainedQuery`). For a string PK uses it directly;
|
|
7
|
-
* for a composite PK sorts the parts so key order does not fork the cache.
|
|
8
|
-
*/
|
|
9
|
-
export declare function entityItemQueryKey(entity: string | undefined, pkValues: PkValues | string | undefined): QueryKey;
|
|
10
|
-
export declare function useEntityItem(entity: string | undefined, pkValues: PkValues | string | undefined): import("@tanstack/react-query").UseQueryResult<NoInfer<import("..").DataResponse<Record<string, unknown>>>, Error>;
|