@declarion/react 0.32.0 → 0.35.1
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/README.md +1 -1
- package/dist-lib/{ActionRunner-CaSrGpBi.js → ActionRunner-Bkkb_YMa.js} +1332 -1310
- package/dist-lib/{DraggableChildrenTable-CAHg7paQ.js → DraggableChildrenTable-TNni9y0Q.js} +55 -55
- package/dist-lib/DynamicIcon-BWO6QtNF.js +261 -0
- package/dist-lib/{Grid-DDbBhqcl.js → Grid-DOtBLx3n.js} +2 -2
- package/dist-lib/{JsonEditor-KelPV-OQ.js → JsonEditor-DoNmyrYd.js} +2 -2
- package/dist-lib/{LayoutRenderer-CelsqsZ6.js → LayoutRenderer-CMuVgKev.js} +748 -746
- package/dist-lib/{MarkdownRenderer-DThy2ixe.js → MarkdownRenderer-DWOlvx8k.js} +1 -1
- package/dist-lib/{MonacoJson-DVjwsaBK.js → MonacoJson-BfpzZ1iT.js} +1 -1
- package/dist-lib/RefreshControl-CgU8mNEp.js +835 -0
- package/dist-lib/SmartDetailPage.impl-Bjl7EFzU.js +1774 -0
- package/dist-lib/{SmartRecordListPage.impl-BKIpTNK7.js → SmartRecordListPage.impl-D2eE-g5J.js} +91 -91
- package/dist-lib/assets/OFL-Inter.txt +93 -0
- package/dist-lib/assets/OFL-JetBrainsMono.txt +93 -0
- package/dist-lib/assets/inter-latin-ext-wght-normal.woff2 +0 -0
- package/dist-lib/assets/inter-latin-wght-normal.woff2 +0 -0
- package/dist-lib/assets/jetbrains-mono-latin-ext-wght-normal.woff2 +0 -0
- package/dist-lib/assets/jetbrains-mono-latin-wght-normal.woff2 +0 -0
- package/dist-lib/components/fields/cells/factories/host-icons.d.ts +9 -1
- package/dist-lib/components/layout/TopBar.d.ts +2 -1
- package/dist-lib/components/pages/DocumentsMenu.d.ts +22 -0
- package/dist-lib/components/pages/RecordDocumentsPanel.d.ts +42 -0
- package/dist-lib/components/pages/list/DataCell.d.ts +1 -2
- package/dist-lib/components/pages/list/ListHeader.d.ts +1 -11
- package/dist-lib/components/primitives/Btn.d.ts +1 -1
- package/dist-lib/components/primitives/Icons.d.ts +1 -0
- package/dist-lib/components/primitives/Tooltip.d.ts +30 -0
- package/dist-lib/components/primitives/index.d.ts +2 -0
- package/dist-lib/components/shared/ActionResultDialog.d.ts +4 -0
- package/dist-lib/components/shared/RecordHeader.d.ts +2 -1
- package/dist-lib/components/shared/ResponsiveActionBar.d.ts +9 -1
- package/dist-lib/declarion-react.css +1 -1
- package/dist-lib/embed/theme.d.ts +8 -8
- package/dist-lib/hooks/useBrandingChrome.d.ts +28 -2
- package/dist-lib/hooks/useResponsiveMode.d.ts +17 -1
- package/dist-lib/icons.js +1 -1
- package/dist-lib/index.js +2430 -2441
- package/dist-lib/lib/brand-tokens.d.ts +43 -0
- package/dist-lib/lib/document-templates.d.ts +12 -0
- package/dist-lib/lib/download.d.ts +20 -0
- package/dist-lib/lib/html-state.d.ts +11 -0
- package/dist-lib/lib/record-documents-key.d.ts +1 -0
- package/dist-lib/lib/versionTracker.d.ts +6 -0
- package/dist-lib/{registry-KQyyL5Gt.js → registry-GTwsJEYp.js} +1469 -1343
- package/dist-lib/stores/page-state.d.ts +1 -1
- package/dist-lib/stores/preferences.d.ts +37 -0
- package/dist-lib/testing.js +5 -5
- package/dist-lib/types/api.d.ts +95 -23
- package/dist-lib/types/schema.d.ts +32 -1
- package/dist-lib/{useProperties-D74hyWIa.js → useProperties-oNGJ7HwM.js} +67 -67
- package/dist-lib/{value-BfXXl5EE.js → value-DNs5L0Ad.js} +82 -82
- package/dist-lib/vite/fingerprint-plugin.d.ts +1 -1
- package/package.json +17 -16
- package/dist-lib/DynamicIcon-DCRdxxZ7.js +0 -260
- package/dist-lib/RefreshControl-CorluL6r.js +0 -582
- package/dist-lib/SmartDetailPage.impl-USIxbl-8.js +0 -1532
- package/dist-lib/stores/appearance.d.ts +0 -37
|
@@ -6,7 +6,7 @@ import type { QueryClient, QueryKey } from "@tanstack/react-query";
|
|
|
6
6
|
export declare const DEFAULT_PAGE_STATE_TTL_MS: number;
|
|
7
7
|
/** Hard upper bound on retained-page entries. Bounds total memory and is the
|
|
8
8
|
* ONLY bound in embed mode, which has no tab-close signal at all. Generous
|
|
9
|
-
* relative to `
|
|
9
|
+
* relative to `preferences.tabs_max_open` (a user rarely revisits more than this many
|
|
10
10
|
* distinct URLs within one TTL window); the least-recently-active entry is
|
|
11
11
|
* evicted first when the cap is exceeded. */
|
|
12
12
|
export declare const PAGE_STATE_MAX_ENTRIES = 64;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { BrandingPreferences } from "../types/api";
|
|
2
|
+
export type ColorScheme = "light" | "dark";
|
|
3
|
+
export type AccentId = "violet" | "blue" | "teal" | "amber" | "rose";
|
|
4
|
+
export type Density = "compact" | "comfortable" | "cozy";
|
|
5
|
+
export type SidebarMode = "wide" | "collapsed";
|
|
6
|
+
export type TabsPosition = "top" | "bottom";
|
|
7
|
+
export type AiSurface = "command" | "panel" | "both" | "off";
|
|
8
|
+
export type ToastPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
9
|
+
export interface Preferences {
|
|
10
|
+
colorScheme: ColorScheme;
|
|
11
|
+
accent: AccentId;
|
|
12
|
+
density: Density;
|
|
13
|
+
sidebar: SidebarMode;
|
|
14
|
+
tabsPosition: TabsPosition;
|
|
15
|
+
tabsMaxOpen: number;
|
|
16
|
+
/** When false, tabs are not persisted across reloads. */
|
|
17
|
+
tabsPersist: boolean;
|
|
18
|
+
radius: number;
|
|
19
|
+
zebra: boolean;
|
|
20
|
+
aiSurface: AiSurface;
|
|
21
|
+
/** Where toasts appear. Read by <Toaster> in app.tsx. */
|
|
22
|
+
toastPosition: ToastPosition;
|
|
23
|
+
}
|
|
24
|
+
export declare function applyPreferences(p: Preferences): void;
|
|
25
|
+
interface PreferencesState extends Preferences {
|
|
26
|
+
set: <K extends keyof Preferences>(key: K, value: Preferences[K]) => void;
|
|
27
|
+
setMany: (patch: Partial<Preferences>) => void;
|
|
28
|
+
/** Apply the deployment's defaults from `branding.preferences`. ONLY fills
|
|
29
|
+
* keys the user has not already changed this session, so a branding
|
|
30
|
+
* refetch never clobbers a toggle the user just clicked. */
|
|
31
|
+
hydrateFromBranding: (preferences: BrandingPreferences | undefined) => void;
|
|
32
|
+
/** Forget every session choice and return to the deployment's defaults —
|
|
33
|
+
* the same state a fresh page load resolves, reproduced on demand. */
|
|
34
|
+
resetToDefaults: (preferences: BrandingPreferences | undefined) => void;
|
|
35
|
+
}
|
|
36
|
+
export declare const usePreferencesStore: import("zustand").UseBoundStore<import("zustand").StoreApi<PreferencesState>>;
|
|
37
|
+
export {};
|
package/dist-lib/testing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fn as e, dt as t, ft as n, ht as r, rt as i, t as a, ut as o } from "./ActionRunner-Bkkb_YMa.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";
|
|
@@ -87,7 +87,7 @@ function S(e) {
|
|
|
87
87
|
}
|
|
88
88
|
function C(e) {
|
|
89
89
|
let r = e.entityData ?? {};
|
|
90
|
-
|
|
90
|
+
n((e, t) => {
|
|
91
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: [],
|
|
@@ -109,7 +109,7 @@ function C(e) {
|
|
|
109
109
|
};
|
|
110
110
|
});
|
|
111
111
|
let a = e.entityItems ?? {}, s = e.entityItemResponses ?? {};
|
|
112
|
-
|
|
112
|
+
t((e, t) => {
|
|
113
113
|
let n = typeof t == "string" ? t : i(t), r = s[e]?.[n];
|
|
114
114
|
if (r instanceof Error) throw r;
|
|
115
115
|
if (r !== void 0) return r;
|
|
@@ -118,14 +118,14 @@ function C(e) {
|
|
|
118
118
|
return { data: o };
|
|
119
119
|
});
|
|
120
120
|
let c = e.actionResults ?? {};
|
|
121
|
-
|
|
121
|
+
o(async (e, t) => {
|
|
122
122
|
if (!(e in c)) throw Error(`renderWithDeclarion: no action result registered for "${e}" (seed it via actionResults)`);
|
|
123
123
|
let n = c[e];
|
|
124
124
|
return b(typeof n == "function" ? await n(t) : n);
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
127
|
function w() {
|
|
128
|
-
|
|
128
|
+
n(null), t(null), o(null), r.setState({
|
|
129
129
|
user: null,
|
|
130
130
|
isAuthenticated: !1,
|
|
131
131
|
activeTenant: null,
|
package/dist-lib/types/api.d.ts
CHANGED
|
@@ -165,7 +165,6 @@ export interface BrandingIdentity {
|
|
|
165
165
|
app_name?: string;
|
|
166
166
|
app_logo?: string;
|
|
167
167
|
app_initial?: string;
|
|
168
|
-
accent_color?: string;
|
|
169
168
|
ai_name?: string;
|
|
170
169
|
wordmark?: string;
|
|
171
170
|
version_label?: string;
|
|
@@ -177,51 +176,122 @@ export interface BrandingIdentity {
|
|
|
177
176
|
workspace_domain?: string;
|
|
178
177
|
legal_links?: PublicLegalLinks;
|
|
179
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Fourteen brand colors, each named EXACTLY after the CSS custom property it
|
|
181
|
+
* writes, with underscores hyphenated: `surface_2` writes `--surface-2`. A
|
|
182
|
+
* developer who set a field in YAML reaches the same token from their own
|
|
183
|
+
* stylesheet without a lookup table. `branding.colorFields.test.ts` enforces
|
|
184
|
+
* the mapping against the YAML structure, across languages.
|
|
185
|
+
*
|
|
186
|
+
* The shades that hang off these (`--accent-soft`, `--accent-ring`,
|
|
187
|
+
* `--row-selected-bg`) are DERIVED from them and are not settable here: a
|
|
188
|
+
* designer picks an accent, and the tints follow. A brand that wants a bespoke
|
|
189
|
+
* tint sets the custom property in `theme.css_url`, with a plain rule and no
|
|
190
|
+
* `!important`.
|
|
191
|
+
*/
|
|
180
192
|
export interface BrandingThemeColors {
|
|
181
|
-
|
|
182
|
-
accent_hover?: string;
|
|
183
|
-
accent_soft?: string;
|
|
184
|
-
primary?: string;
|
|
185
|
-
sidebar?: string;
|
|
186
|
-
rail?: string;
|
|
193
|
+
background?: string;
|
|
187
194
|
surface?: string;
|
|
188
195
|
surface_2?: string;
|
|
189
|
-
|
|
196
|
+
surface_3?: string;
|
|
190
197
|
text?: string;
|
|
191
|
-
|
|
198
|
+
text_2?: string;
|
|
199
|
+
text_3?: string;
|
|
192
200
|
border?: string;
|
|
201
|
+
divider?: string;
|
|
202
|
+
accent?: string;
|
|
203
|
+
accent_hover?: string;
|
|
204
|
+
accent_foreground?: string;
|
|
205
|
+
sidebar?: string;
|
|
206
|
+
rail?: string;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Page-title typography. Scheme-independent: a title is the same size in light
|
|
210
|
+
* and dark. Each field is named after the CSS custom property it writes:
|
|
211
|
+
* `page_title_size` writes `--page-title-size`.
|
|
212
|
+
*
|
|
213
|
+
* Three surfaces render an `<h1>` page title at three sizes the designer chose
|
|
214
|
+
* (list 20px, record 19px, page 18px). Declaring `page_title_size` overrides all
|
|
215
|
+
* three at once; omitting it leaves each on its own designed default.
|
|
216
|
+
*/
|
|
217
|
+
export interface BrandingTypography {
|
|
218
|
+
/** e.g. "15px". Overrides every page title's size. */
|
|
219
|
+
page_title_size?: string;
|
|
220
|
+
/** e.g. "22.5px" or "1.5". Overrides every page title's line height. */
|
|
221
|
+
page_title_line_height?: string;
|
|
193
222
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
223
|
+
/**
|
|
224
|
+
* Brand colors keyed by color scheme. A scheme may be omitted entirely, or any
|
|
225
|
+
* field within it omitted; the platform's own token for that scheme applies. A
|
|
226
|
+
* value is NEVER copied from the other scheme - that is the bug this shape
|
|
227
|
+
* exists to make impossible.
|
|
228
|
+
*/
|
|
229
|
+
export interface BrandingThemeColorSchemes {
|
|
230
|
+
light?: BrandingThemeColors;
|
|
231
|
+
dark?: BrandingThemeColors;
|
|
201
232
|
}
|
|
202
233
|
export interface BrandingTheme {
|
|
203
234
|
css_url?: string;
|
|
204
235
|
font_sans?: string;
|
|
205
236
|
font_mono?: string;
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
237
|
+
typography?: BrandingTypography;
|
|
238
|
+
colors?: BrandingThemeColorSchemes;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* The deployment's DEFAULTS for the controls the Preferences screen renders,
|
|
242
|
+
* and the single durable source of preference state (Decision 33: the browser
|
|
243
|
+
* stores nothing). A user's toggle holds for the SPA session and resets to
|
|
244
|
+
* these on reload.
|
|
245
|
+
*
|
|
246
|
+
* Wire shape is snake_case because it is YAML. `stores/preferences.ts` owns the
|
|
247
|
+
* single translation into the camelCase store; add a field here and there, or
|
|
248
|
+
* it will load, validate, and do nothing.
|
|
249
|
+
*/
|
|
250
|
+
export interface BrandingPreferences {
|
|
251
|
+
color_scheme?: "light" | "dark";
|
|
252
|
+
accent?: "violet" | "blue" | "teal" | "amber" | "rose";
|
|
253
|
+
density?: "compact" | "comfortable" | "cozy";
|
|
254
|
+
sidebar?: "wide" | "collapsed";
|
|
255
|
+
tabs_position?: "top" | "bottom";
|
|
256
|
+
tabs_max_open?: number;
|
|
257
|
+
tabs_persist?: boolean;
|
|
258
|
+
radius?: number;
|
|
259
|
+
zebra_rows?: boolean;
|
|
260
|
+
ai_surface?: "command" | "panel" | "both" | "off";
|
|
261
|
+
toast_position?: "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
210
262
|
}
|
|
263
|
+
/**
|
|
264
|
+
* Per-surface chrome flags - mirrors the YAML `branding_surface_flags`
|
|
265
|
+
* structure exactly. Kept distinct from {@link BrandingShellFlags}: the two
|
|
266
|
+
* are different YAML structures, and conflating them let a caller ask a
|
|
267
|
+
* surface for a shell flag that could never be set there.
|
|
268
|
+
*/
|
|
211
269
|
export interface BrandingSurfaceFlags {
|
|
212
270
|
show_title?: boolean;
|
|
213
|
-
show_breadcrumbs?: boolean;
|
|
214
271
|
show_actions?: boolean;
|
|
215
272
|
show_count?: boolean;
|
|
216
|
-
|
|
273
|
+
}
|
|
274
|
+
/** Shell chrome flags - mirrors the YAML `branding_chrome_shell` structure. */
|
|
275
|
+
export interface BrandingShellFlags {
|
|
217
276
|
show_topbar?: boolean;
|
|
218
277
|
show_rail?: boolean;
|
|
278
|
+
show_sidebar?: boolean;
|
|
219
279
|
show_tabs?: boolean;
|
|
280
|
+
show_breadcrumbs?: boolean;
|
|
220
281
|
show_tenant_switcher?: boolean;
|
|
282
|
+
show_command_palette?: boolean;
|
|
283
|
+
show_theme_toggle?: boolean;
|
|
221
284
|
}
|
|
285
|
+
/**
|
|
286
|
+
* The device class the SDK renders for. `auto` derives it from the measured
|
|
287
|
+
* width, which is what the platform has always done and what a deployment that
|
|
288
|
+
* declares nothing keeps.
|
|
289
|
+
*/
|
|
290
|
+
export type BrandingViewport = "auto" | "phone" | "tablet" | "desktop";
|
|
222
291
|
export interface BrandingChrome {
|
|
223
292
|
full?: {
|
|
224
|
-
|
|
293
|
+
viewport?: BrandingViewport;
|
|
294
|
+
shell?: BrandingShellFlags;
|
|
225
295
|
surfaces?: {
|
|
226
296
|
list?: BrandingSurfaceFlags;
|
|
227
297
|
detail?: BrandingSurfaceFlags;
|
|
@@ -230,6 +300,7 @@ export interface BrandingChrome {
|
|
|
230
300
|
};
|
|
231
301
|
};
|
|
232
302
|
embed?: {
|
|
303
|
+
viewport?: BrandingViewport;
|
|
233
304
|
surfaces?: {
|
|
234
305
|
list?: BrandingSurfaceFlags;
|
|
235
306
|
detail?: BrandingSurfaceFlags;
|
|
@@ -242,6 +313,7 @@ export interface BrandingChrome {
|
|
|
242
313
|
export interface PublicBranding {
|
|
243
314
|
identity?: BrandingIdentity;
|
|
244
315
|
theme?: BrandingTheme;
|
|
316
|
+
preferences?: BrandingPreferences;
|
|
245
317
|
chrome?: BrandingChrome;
|
|
246
318
|
}
|
|
247
319
|
/**
|
|
@@ -4,6 +4,20 @@ import type { IconDef } from "../stores/icon-registry";
|
|
|
4
4
|
export { OrderedMap };
|
|
5
5
|
export type { IconDef };
|
|
6
6
|
export type LocalizedString = Record<string, string>;
|
|
7
|
+
/**
|
|
8
|
+
* Where a `url` cell fetches an unknown host's site icon from.
|
|
9
|
+
*
|
|
10
|
+
* This is an outbound-request policy, not a visual style:
|
|
11
|
+
* google — one request per rendered hostname to www.google.com.
|
|
12
|
+
* direct — /favicon.ico from the site's own origin.
|
|
13
|
+
* none — no request at all; render the globe placeholder.
|
|
14
|
+
*
|
|
15
|
+
* Declared per column by `field.display.favicon_source`, and nowhere else -
|
|
16
|
+
* there is no parameter (plan 2026-07-09 Decision 23). Absent = `google`,
|
|
17
|
+
* today's rendered default. Mirrors `validFaviconSources` in
|
|
18
|
+
* golang/internal/engine/types_field_display.go.
|
|
19
|
+
*/
|
|
20
|
+
export type FaviconSource = "google" | "direct" | "none";
|
|
7
21
|
/**
|
|
8
22
|
* Per-entity empty-state copy declared in the manifest under
|
|
9
23
|
* `display.empty_state`. Title and Body are localized; LearnMoreURL is a
|
|
@@ -29,7 +43,7 @@ export declare function getDisplayValue(row: Record<string, unknown> | null | un
|
|
|
29
43
|
display_field?: string;
|
|
30
44
|
};
|
|
31
45
|
} | null | undefined): string | undefined;
|
|
32
|
-
export declare function resolveRefRecordLabel(record: Record<string, unknown>,
|
|
46
|
+
export declare function resolveRefRecordLabel(record: Record<string, unknown>, displayKey: string | undefined, fallback: string): string;
|
|
33
47
|
export declare function screenTitleForPath(pathname: string, screens: Record<string, Screen> | undefined, entities?: Record<string, Entity>): {
|
|
34
48
|
title: string;
|
|
35
49
|
icon?: string;
|
|
@@ -111,6 +125,7 @@ export interface EntityField {
|
|
|
111
125
|
currency?: string;
|
|
112
126
|
currency_field?: string;
|
|
113
127
|
currency_display?: "symbol" | "narrow_symbol" | "code" | "name";
|
|
128
|
+
favicon_source?: FaviconSource;
|
|
114
129
|
};
|
|
115
130
|
values?: Array<{
|
|
116
131
|
code: string;
|
|
@@ -413,6 +428,22 @@ export interface Entity {
|
|
|
413
428
|
* list UI on this. See docs/plans/2026-06-20-cross-store-list-cursor-pagination.md.
|
|
414
429
|
*/
|
|
415
430
|
list_pagination?: "offset" | "cursor";
|
|
431
|
+
/**
|
|
432
|
+
* Static, per-caller document-generation capability computed from the
|
|
433
|
+
* SYSTEM document template registry at schema projection (registry-only,
|
|
434
|
+
* no DB read, no ETag impact - system templates are boot-static and are
|
|
435
|
+
* covered by the schema fingerprint). Absent (or both flags falsy) means
|
|
436
|
+
* no system template applies for this caller/tenant/entity - the
|
|
437
|
+
* frontend's Generate affordance renders nothing UNLESS a tenant-uploaded
|
|
438
|
+
* template is found via the lazy `document.templates.available` runtime
|
|
439
|
+
* probe (tenant templates are runtime data and are never baked into the
|
|
440
|
+
* schema). `generate_one` gates the detail-scope toolbar; `generate_many`
|
|
441
|
+
* gates the list-scope toolbar. See docs/document-generation.md.
|
|
442
|
+
*/
|
|
443
|
+
documents?: {
|
|
444
|
+
generate_one?: boolean;
|
|
445
|
+
generate_many?: boolean;
|
|
446
|
+
};
|
|
416
447
|
}
|
|
417
448
|
export interface ExportConfig {
|
|
418
449
|
enabled?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { vt as c } from "./registry-
|
|
1
|
+
import { At as e, V as t, Z as n, Zt as r, cn as i, it as a, kt as o, vn as s } from "./ActionRunner-Bkkb_YMa.js";
|
|
2
|
+
import { vt as c } from "./registry-GTwsJEYp.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";
|
|
@@ -47,33 +47,33 @@ var b = class {
|
|
|
47
47
|
this.entity = e, this.refs = t ?? new v();
|
|
48
48
|
}
|
|
49
49
|
async get(e) {
|
|
50
|
-
let
|
|
51
|
-
return _((await
|
|
50
|
+
let t = new URLSearchParams(typeof e == "string" ? { id: e } : e);
|
|
51
|
+
return _((await o(`/api/data/${this.entity}?${t.toString()}`)).data);
|
|
52
52
|
}
|
|
53
53
|
async list(e = {}) {
|
|
54
|
-
let
|
|
54
|
+
let t, n = !1;
|
|
55
55
|
try {
|
|
56
|
-
|
|
57
|
-
} catch (
|
|
58
|
-
if (e.after && r(
|
|
59
|
-
let { after: r, ...
|
|
60
|
-
|
|
61
|
-
} else throw
|
|
56
|
+
t = await o(y(this.entity, e));
|
|
57
|
+
} catch (i) {
|
|
58
|
+
if (e.after && r(i)) {
|
|
59
|
+
let { after: r, ...i } = e;
|
|
60
|
+
t = await o(y(this.entity, i)), n = !0;
|
|
61
|
+
} else throw i;
|
|
62
62
|
}
|
|
63
|
-
return this.refs.merge(
|
|
64
|
-
data:
|
|
65
|
-
meta:
|
|
63
|
+
return this.refs.merge(t.$refs), {
|
|
64
|
+
data: t.data.map((e) => _(e)),
|
|
65
|
+
meta: t.meta,
|
|
66
66
|
$refs: this.refs.all(),
|
|
67
|
-
reset:
|
|
67
|
+
reset: n
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
async create(e) {
|
|
71
71
|
return (await this.createMany([e]))[0];
|
|
72
72
|
}
|
|
73
|
-
async createMany(
|
|
74
|
-
if (
|
|
75
|
-
let
|
|
76
|
-
actions:
|
|
73
|
+
async createMany(t) {
|
|
74
|
+
if (t.length === 0) return [];
|
|
75
|
+
let n = await e("system.batch", {
|
|
76
|
+
actions: t.map((e) => ({
|
|
77
77
|
action: `${this.entity}.__create`,
|
|
78
78
|
params: {
|
|
79
79
|
entity: this.entity,
|
|
@@ -82,7 +82,7 @@ var b = class {
|
|
|
82
82
|
})),
|
|
83
83
|
atomic: !0
|
|
84
84
|
});
|
|
85
|
-
return x(
|
|
85
|
+
return x(n, `${this.entity}.__create`), n.results.map((e) => _(S(e)));
|
|
86
86
|
}
|
|
87
87
|
async update(e, t) {
|
|
88
88
|
return (await this.updateMany([{
|
|
@@ -90,10 +90,10 @@ var b = class {
|
|
|
90
90
|
...t
|
|
91
91
|
}]))[0];
|
|
92
92
|
}
|
|
93
|
-
async updateMany(
|
|
94
|
-
if (
|
|
95
|
-
let
|
|
96
|
-
actions:
|
|
93
|
+
async updateMany(t) {
|
|
94
|
+
if (t.length === 0) return [];
|
|
95
|
+
let n = await e("system.batch", {
|
|
96
|
+
actions: t.map(({ id: e, ...t }) => ({
|
|
97
97
|
action: `${this.entity}.__update`,
|
|
98
98
|
params: {
|
|
99
99
|
object_ids: [e],
|
|
@@ -103,13 +103,13 @@ var b = class {
|
|
|
103
103
|
})),
|
|
104
104
|
atomic: !0
|
|
105
105
|
});
|
|
106
|
-
return x(
|
|
106
|
+
return x(n, `${this.entity}.__update`), n.results.map((e) => _(S(e)));
|
|
107
107
|
}
|
|
108
108
|
async delete(e) {
|
|
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 a(`${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 a(`${this.entity}.__restore`, {
|
|
122
122
|
object_ids: e,
|
|
123
123
|
entity: this.entity
|
|
124
124
|
})).object_count ?? e.length };
|
|
@@ -126,20 +126,20 @@ var b = class {
|
|
|
126
126
|
async upsert(e, t) {
|
|
127
127
|
return (await this.upsertMany([e], t))[0];
|
|
128
128
|
}
|
|
129
|
-
async upsertMany(
|
|
130
|
-
if (
|
|
131
|
-
let
|
|
132
|
-
actions:
|
|
129
|
+
async upsertMany(t, n) {
|
|
130
|
+
if (t.length === 0) return [];
|
|
131
|
+
let r = await e("system.batch", {
|
|
132
|
+
actions: t.map((e) => ({
|
|
133
133
|
action: `${this.entity}.__upsert`,
|
|
134
134
|
params: {
|
|
135
135
|
entity: this.entity,
|
|
136
136
|
fields: e,
|
|
137
|
-
unique_by:
|
|
137
|
+
unique_by: n
|
|
138
138
|
}
|
|
139
139
|
})),
|
|
140
140
|
atomic: !0
|
|
141
141
|
});
|
|
142
|
-
return x(
|
|
142
|
+
return x(r, `${this.entity}.__upsert`), r.results.map((e) => _(C(e)));
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
145
|
function x(e, t) {
|
|
@@ -232,40 +232,40 @@ 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(e) {
|
|
236
|
+
let t = n(), [r] = d();
|
|
237
237
|
l(() => {
|
|
238
|
-
if (!
|
|
239
|
-
let
|
|
240
|
-
i &&
|
|
238
|
+
if (!e || t.enabled) return;
|
|
239
|
+
let n = c.getState(), i = n.findTabByPathname(e);
|
|
240
|
+
i && n.updateTabSearch(i.id, r.toString());
|
|
241
241
|
}, [
|
|
242
242
|
r,
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
e,
|
|
244
|
+
t.enabled
|
|
245
245
|
]);
|
|
246
246
|
}
|
|
247
247
|
//#endregion
|
|
248
248
|
//#region src/hooks/useRegisterScreenTab.ts
|
|
249
|
-
function A(
|
|
250
|
-
let a =
|
|
249
|
+
function A(e, t, r, i) {
|
|
250
|
+
let a = n();
|
|
251
251
|
l(() => {
|
|
252
|
-
!
|
|
253
|
-
pathname:
|
|
252
|
+
!e || a.enabled || c.getState().openTab({
|
|
253
|
+
pathname: e,
|
|
254
254
|
search: i,
|
|
255
|
-
title:
|
|
255
|
+
title: t,
|
|
256
256
|
icon: r,
|
|
257
257
|
closable: !0
|
|
258
258
|
});
|
|
259
259
|
}, [
|
|
260
|
+
e,
|
|
260
261
|
t,
|
|
261
|
-
n,
|
|
262
262
|
r,
|
|
263
263
|
a.enabled
|
|
264
264
|
]);
|
|
265
265
|
}
|
|
266
266
|
function j(e, t, n) {
|
|
267
|
-
let r = e?.route,
|
|
268
|
-
A(t ? r : void 0,
|
|
267
|
+
let r = e?.route, a = t ? i(e?.display?.name) || i(t.display.name_plural) : "", o = e?.display?.icon || t?.display.icon;
|
|
268
|
+
A(t ? r : void 0, a, o, n);
|
|
269
269
|
}
|
|
270
270
|
//#endregion
|
|
271
271
|
//#region src/lib/filters.ts
|
|
@@ -332,14 +332,14 @@ function z(e, t) {
|
|
|
332
332
|
if (!e.field || !e.op) return "";
|
|
333
333
|
let n = N[e.op] || e.op;
|
|
334
334
|
if (M.has(e.op)) return `${n}`;
|
|
335
|
-
let r = e.field,
|
|
335
|
+
let r = e.field, i = (e) => {
|
|
336
336
|
if (t) {
|
|
337
337
|
let n = t(r, e);
|
|
338
338
|
return n.label != null && (n.status === "special" || n.status === "resolved") ? n.label : n.raw;
|
|
339
339
|
}
|
|
340
|
-
return
|
|
340
|
+
return s(e);
|
|
341
341
|
};
|
|
342
|
-
return `${n} ${Array.isArray(e.value) ? e.value.map(
|
|
342
|
+
return `${n} ${Array.isArray(e.value) ? e.value.map(i).join(", ") : i(e.value)}`;
|
|
343
343
|
}
|
|
344
344
|
function B(e, t) {
|
|
345
345
|
return {
|
|
@@ -374,36 +374,36 @@ function V(e, t) {
|
|
|
374
374
|
//#endregion
|
|
375
375
|
//#region src/api/status.ts
|
|
376
376
|
async function H(e, t, n, r, i) {
|
|
377
|
-
let
|
|
377
|
+
let o = {
|
|
378
378
|
status_group_code: n,
|
|
379
379
|
status_code: r
|
|
380
380
|
};
|
|
381
|
-
i != null && (
|
|
382
|
-
let
|
|
381
|
+
i != null && (o.note = i);
|
|
382
|
+
let s = (await a(`${e}.__update`, {
|
|
383
383
|
object_ids: [t],
|
|
384
384
|
entity: e,
|
|
385
|
-
fields: { $statuses: [
|
|
385
|
+
fields: { $statuses: [o] }
|
|
386
386
|
})).result?.rows?.[0]?.$statuses ?? [];
|
|
387
|
-
return
|
|
387
|
+
return s.find((e) => e.group_code === n) ?? s[0];
|
|
388
388
|
}
|
|
389
389
|
//#endregion
|
|
390
390
|
//#region src/hooks/useObjectStatus.ts
|
|
391
|
-
function U(e,
|
|
391
|
+
function U(e, n) {
|
|
392
392
|
let r = m();
|
|
393
393
|
return p({
|
|
394
|
-
mutationFn: ({ groupCode:
|
|
394
|
+
mutationFn: ({ groupCode: t, statusCode: r, note: i }) => H(e, n, t, r, i),
|
|
395
395
|
onSuccess: () => {
|
|
396
396
|
r.invalidateQueries({ queryKey: ["entity-item", e] });
|
|
397
397
|
},
|
|
398
398
|
onError: (e) => {
|
|
399
|
-
|
|
399
|
+
t.error(e.message);
|
|
400
400
|
}
|
|
401
401
|
});
|
|
402
402
|
}
|
|
403
403
|
//#endregion
|
|
404
404
|
//#region src/api/properties.ts
|
|
405
405
|
async function W(e, t, n, r) {
|
|
406
|
-
let i = (await
|
|
406
|
+
let i = (await a(`${e}.__update`, {
|
|
407
407
|
object_ids: [t],
|
|
408
408
|
entity: e,
|
|
409
409
|
fields: { $properties: [{
|
|
@@ -414,7 +414,7 @@ async function W(e, t, n, r) {
|
|
|
414
414
|
return i.find((e) => e.property_code === n) ?? i[0];
|
|
415
415
|
}
|
|
416
416
|
async function G(e, t, n) {
|
|
417
|
-
await
|
|
417
|
+
await a(`${e}.__update`, {
|
|
418
418
|
object_ids: [t],
|
|
419
419
|
entity: e,
|
|
420
420
|
fields: { $properties: [{
|
|
@@ -425,27 +425,27 @@ async function G(e, t, n) {
|
|
|
425
425
|
}
|
|
426
426
|
//#endregion
|
|
427
427
|
//#region src/hooks/useProperties.ts
|
|
428
|
-
function K(e,
|
|
428
|
+
function K(e, n) {
|
|
429
429
|
let r = m();
|
|
430
430
|
return p({
|
|
431
|
-
mutationFn: ({ propertyCode:
|
|
431
|
+
mutationFn: ({ propertyCode: t, value: r }) => W(e, n, t, r),
|
|
432
432
|
onSuccess: () => {
|
|
433
433
|
r.invalidateQueries({ queryKey: ["entity-item", e] });
|
|
434
434
|
},
|
|
435
435
|
onError: (e) => {
|
|
436
|
-
|
|
436
|
+
t.error(e.message);
|
|
437
437
|
}
|
|
438
438
|
});
|
|
439
439
|
}
|
|
440
|
-
function q(e,
|
|
440
|
+
function q(e, n) {
|
|
441
441
|
let r = m();
|
|
442
442
|
return p({
|
|
443
|
-
mutationFn: (
|
|
443
|
+
mutationFn: (t) => G(e, n, t),
|
|
444
444
|
onSuccess: () => {
|
|
445
445
|
r.invalidateQueries({ queryKey: ["entity-item", e] });
|
|
446
446
|
},
|
|
447
447
|
onError: (e) => {
|
|
448
|
-
|
|
448
|
+
t.error(e.message);
|
|
449
449
|
}
|
|
450
450
|
});
|
|
451
451
|
}
|