@selfhelp/shared 1.21.3 → 1.21.5
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/CHANGELOG.md +83 -0
- package/README.md +2 -1
- package/dist/index.d.mts +427 -20
- package/dist/index.d.ts +427 -20
- package/dist/index.js +560 -13
- package/dist/index.mjs +518 -13
- package/dist/plugin-sdk/index.d.mts +1 -1
- package/dist/plugin-sdk/index.d.ts +1 -1
- package/dist/plugin-sdk/index.js +2 -1
- package/dist/plugin-sdk/index.mjs +2 -1
- package/dist/registry/index.d.mts +2 -2
- package/dist/registry/index.d.ts +2 -2
- package/dist/registry/index.js +2 -1
- package/dist/registry/index.mjs +2 -1
- package/dist/{styles.registry-DEDEZ8l3.d.ts → styles.registry-DX79oirw.d.ts} +93 -16
- package/dist/{styles.registry-DHM4M77N.d.mts → styles.registry-ffw0MH3r.d.mts} +93 -16
- package/package.json +1 -1
- package/src/content/__tests__/fieldsMapLabels.test.ts +55 -0
- package/src/content/__tests__/optionLabels.test.ts +100 -0
- package/src/content/fieldsMapLabels.ts +103 -0
- package/src/content/index.ts +2 -0
- package/src/content/optionLabels.ts +200 -0
- package/src/navigation/__tests__/navigation.test.ts +296 -6
- package/src/navigation/activeTrail.ts +99 -0
- package/src/navigation/branchNav.ts +155 -6
- package/src/navigation/footerPreset.ts +109 -0
- package/src/navigation/headerLayers.ts +56 -0
- package/src/navigation/headerPreset.ts +9 -2
- package/src/navigation/index.ts +4 -0
- package/src/navigation/menuDepth.ts +73 -37
- package/src/navigation/mobileRoute.ts +25 -0
- package/src/navigation/navLinks.ts +0 -4
- package/src/navigation/navigationBundle.ts +81 -0
- package/src/navigation/navigationPayload.ts +96 -17
- package/src/registry/__tests__/platform.test.ts +11 -10
- package/src/registry/styles.registry.ts +2 -1
- package/src/types/__tests__/preview-bridge.test.ts +7 -0
- package/src/types/auth.ts +4 -0
- package/src/types/cms-app.ts +74 -0
- package/src/types/index.ts +1 -0
- package/src/types/mobile-adapters.ts +1 -0
- package/src/types/pages.ts +6 -0
- package/src/types/preview-bridge.ts +12 -1
- package/src/types/styles/composite.ts +21 -0
- package/src/types/styles/forms.ts +57 -10
- package/src/types/styles/interactive.ts +1 -1
- package/src/types/styles/unknown.ts +2 -2
|
@@ -3,6 +3,7 @@ SPDX-FileCopyrightText: 2026 Humdek, University of Bern
|
|
|
3
3
|
SPDX-License-Identifier: MPL-2.0
|
|
4
4
|
*/
|
|
5
5
|
import type { TWebHeaderPreset } from './headerPreset';
|
|
6
|
+
import type { TWebFooterPreset } from './footerPreset';
|
|
6
7
|
|
|
7
8
|
export type TNavigationMenuKey =
|
|
8
9
|
| 'web_header'
|
|
@@ -12,7 +13,17 @@ export type TNavigationMenuKey =
|
|
|
12
13
|
|
|
13
14
|
export type TNavigationMenuItemType = 'page' | 'external_url' | 'group';
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
/** Header row assignment for `web_header` root items (`null` = main row). */
|
|
17
|
+
export type TNavigationHeaderLayer = 'top';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* How a web page presents its menu branch (children/siblings):
|
|
21
|
+
* `sidebar` = left sidebar + prev/next pager, `pills` = compact pill strip,
|
|
22
|
+
* `none` = only the page content. Menu-level default (NULL resolves to
|
|
23
|
+
* `sidebar`), overridable per parent item. Mobile menus have native
|
|
24
|
+
* presentation and always carry `null`.
|
|
25
|
+
*/
|
|
26
|
+
export type TNavigationChildrenNavMode = 'sidebar' | 'pills' | 'none';
|
|
16
27
|
|
|
17
28
|
export type TNavigationSearchMode = 'off' | 'menu_pages' | 'searchable_pages' | 'content_index';
|
|
18
29
|
|
|
@@ -25,36 +36,49 @@ export interface INavigationResolvedPageRef {
|
|
|
25
36
|
keyword: string;
|
|
26
37
|
url: string | null;
|
|
27
38
|
title: string | null;
|
|
28
|
-
icon?: string | null;
|
|
29
|
-
mobile_icon?: string | null;
|
|
30
39
|
has_content?: boolean;
|
|
31
40
|
section_count?: number;
|
|
32
41
|
}
|
|
33
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Resolved public menu item (`GET /navigation`). Strict contract: every key is
|
|
45
|
+
* always present; absence of a value is expressed as `null`, never a missing key.
|
|
46
|
+
*/
|
|
34
47
|
export interface INavigationMenuItem {
|
|
35
|
-
id: number
|
|
48
|
+
id: number;
|
|
36
49
|
item_type: TNavigationMenuItemType;
|
|
37
50
|
label: string;
|
|
38
|
-
description
|
|
39
|
-
aria_label
|
|
40
|
-
icon
|
|
51
|
+
description: string | null;
|
|
52
|
+
aria_label: string | null;
|
|
53
|
+
icon: string | null;
|
|
54
|
+
mobile_icon: string | null;
|
|
41
55
|
position: number;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
56
|
+
/** Only meaningful on `web_header` root items; `null` everywhere else. */
|
|
57
|
+
layer: TNavigationHeaderLayer | null;
|
|
58
|
+
/** Per-parent-item override of the menu's `children_nav` default (web menus only). */
|
|
59
|
+
children_nav: TNavigationChildrenNavMode | null;
|
|
60
|
+
/** Per-parent-item override of the menu's `show_pager` default; `null` = inherit. */
|
|
61
|
+
show_pager?: boolean | null;
|
|
62
|
+
external_url: string | null;
|
|
63
|
+
page: INavigationResolvedPageRef | null;
|
|
64
|
+
is_active: boolean;
|
|
65
|
+
children: INavigationMenuItem[];
|
|
48
66
|
}
|
|
49
67
|
|
|
50
68
|
export interface INavigationMenu {
|
|
51
69
|
key: TNavigationMenuKey;
|
|
52
70
|
platform: 'web' | 'mobile';
|
|
53
71
|
surface: 'header' | 'footer' | 'drawer' | 'bottom_tabs';
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
72
|
+
/** Header presets for `web_header`, footer presets for `web_footer`, `null` for mobile menus. */
|
|
73
|
+
preset: TWebHeaderPreset | TWebFooterPreset | null;
|
|
74
|
+
max_depth: number | null;
|
|
75
|
+
item_limit: number | null;
|
|
76
|
+
/** Resolved branch presentation default; `sidebar`/`pills`/`none` on web menus, `null` on mobile menus. */
|
|
77
|
+
children_nav: TNavigationChildrenNavMode | null;
|
|
78
|
+
/** Breadcrumb trail above nested web pages; always `false` on mobile menus. */
|
|
79
|
+
show_breadcrumbs: boolean;
|
|
80
|
+
/** Prev/next pager on nested web pages; always `false` on mobile menus. */
|
|
81
|
+
show_pager?: boolean;
|
|
58
82
|
items: INavigationMenuItem[];
|
|
59
83
|
}
|
|
60
84
|
|
|
@@ -78,8 +102,63 @@ export interface INavigationSearchConfig {
|
|
|
78
102
|
field_policy: string;
|
|
79
103
|
}
|
|
80
104
|
|
|
105
|
+
/** Brand block size step; maps to logo heights 24/32/44/56px on web. */
|
|
106
|
+
export type TNavigationBrandingSize = 'sm' | 'md' | 'lg' | 'xl';
|
|
107
|
+
|
|
108
|
+
/** Brand block layout: image + site name, image alone, or text alone. */
|
|
109
|
+
export type TNavigationBrandingVariant = 'logo-and-name' | 'logo-only' | 'name-only';
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Global branding block shared by the web header and the mobile drawer:
|
|
113
|
+
* `logo_url` = public path of the logo asset (null = text fallback),
|
|
114
|
+
* `logo_alt` = accessible alt / brand text, `link_url` = logo click target
|
|
115
|
+
* (null = home), `logo_size` + `logo_variant` = presentation options
|
|
116
|
+
* (default `md` / `logo-and-name` when omitted by older backends).
|
|
117
|
+
*/
|
|
118
|
+
export interface INavigationBranding {
|
|
119
|
+
logo_url: string | null;
|
|
120
|
+
logo_alt: string | null;
|
|
121
|
+
link_url: string | null;
|
|
122
|
+
logo_size?: TNavigationBrandingSize;
|
|
123
|
+
logo_variant?: TNavigationBrandingVariant;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** Logo pixel heights per brand size step (shared by web header + mobile drawer). */
|
|
127
|
+
export const NAVIGATION_BRANDING_LOGO_HEIGHTS: Record<TNavigationBrandingSize, number> = {
|
|
128
|
+
sm: 24,
|
|
129
|
+
md: 32,
|
|
130
|
+
lg: 44,
|
|
131
|
+
xl: 56,
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Resolve the branding presentation with cross-platform defaults: older
|
|
136
|
+
* backends omit `logo_size` / `logo_variant`, and a missing logo image
|
|
137
|
+
* degrades `logo-and-name` / `logo-only` to the text fallback.
|
|
138
|
+
*/
|
|
139
|
+
export function resolveBrandingPresentation(branding?: INavigationBranding | null): {
|
|
140
|
+
size: TNavigationBrandingSize;
|
|
141
|
+
variant: TNavigationBrandingVariant;
|
|
142
|
+
logoHeight: number;
|
|
143
|
+
showLogo: boolean;
|
|
144
|
+
showName: boolean;
|
|
145
|
+
} {
|
|
146
|
+
const size: TNavigationBrandingSize = branding?.logo_size ?? 'md';
|
|
147
|
+
const requestedVariant: TNavigationBrandingVariant = branding?.logo_variant ?? 'logo-and-name';
|
|
148
|
+
const hasLogo = Boolean(branding?.logo_url);
|
|
149
|
+
const variant: TNavigationBrandingVariant = hasLogo ? requestedVariant : 'name-only';
|
|
150
|
+
return {
|
|
151
|
+
size,
|
|
152
|
+
variant,
|
|
153
|
+
logoHeight: NAVIGATION_BRANDING_LOGO_HEIGHTS[size],
|
|
154
|
+
showLogo: variant !== 'name-only',
|
|
155
|
+
showName: variant !== 'logo-only',
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
81
159
|
export interface INavigationPayload {
|
|
82
160
|
menus: Record<TNavigationMenuKey, INavigationMenu>;
|
|
83
161
|
startup: INavigationStartupConfig;
|
|
84
162
|
search: INavigationSearchConfig;
|
|
163
|
+
branding?: INavigationBranding;
|
|
85
164
|
}
|
|
@@ -39,7 +39,7 @@ describe('style render-target targeting', () => {
|
|
|
39
39
|
it('defaults the eight established system/data styles to both', () => {
|
|
40
40
|
for (const name of [
|
|
41
41
|
'no-access', 'missing', 'not-found', 'version',
|
|
42
|
-
'ref-container', 'data-container', '
|
|
42
|
+
'ref-container', 'data-container', 'entry-table', 'timeline-item',
|
|
43
43
|
]) {
|
|
44
44
|
expect(getStylePlatforms(name)).toEqual(['web', 'mobile']);
|
|
45
45
|
}
|
|
@@ -145,18 +145,18 @@ describe('style placement targeting', () => {
|
|
|
145
145
|
});
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
|
-
* Catalog parity (mobile rendering plan, milestone one).
|
|
149
|
-
*
|
|
150
|
-
* system/data/reference styles are present, and
|
|
151
|
-
* speculative styles are absent. Drift here means the
|
|
152
|
-
* backend catalog have diverged.
|
|
148
|
+
* Catalog parity (mobile rendering plan, milestone one + entry-record-form).
|
|
149
|
+
* The core registry must match the established backend catalog (91 styles):
|
|
150
|
+
* the eight previously-missing system/data/reference styles are present, and
|
|
151
|
+
* the sixteen deferred speculative styles are absent. Drift here means the
|
|
152
|
+
* shared contract and the backend catalog have diverged.
|
|
153
153
|
*/
|
|
154
|
-
describe('core catalog parity (
|
|
154
|
+
describe('core catalog parity (91 established styles)', () => {
|
|
155
155
|
const CORE_NAMES = Object.keys(BASE_STYLE_REGISTRY);
|
|
156
156
|
|
|
157
157
|
const PREVIOUSLY_MISSING = [
|
|
158
158
|
'data-container', 'timeline-item', 'version', 'no-access',
|
|
159
|
-
'missing', 'not-found', 'ref-container', '
|
|
159
|
+
'missing', 'not-found', 'ref-container', 'entry-table',
|
|
160
160
|
];
|
|
161
161
|
|
|
162
162
|
const DEFERRED_SPECULATIVE = [
|
|
@@ -165,8 +165,9 @@ describe('core catalog parity (90 established styles)', () => {
|
|
|
165
165
|
'input-otp', 'search-field', 'fab-button', 'biometric-login-button',
|
|
166
166
|
];
|
|
167
167
|
|
|
168
|
-
it('contains exactly the
|
|
169
|
-
expect(CORE_NAMES).toHaveLength(
|
|
168
|
+
it('contains exactly the 91 established core styles', () => {
|
|
169
|
+
expect(CORE_NAMES).toHaveLength(91);
|
|
170
|
+
expect(CORE_NAMES).toContain('entry-record-form');
|
|
170
171
|
});
|
|
171
172
|
|
|
172
173
|
it('includes every previously-missing established style', () => {
|
|
@@ -182,6 +182,7 @@ export const BASE_STYLE_REGISTRY = {
|
|
|
182
182
|
// ===== forms =====
|
|
183
183
|
'form-log': { description: 'Append-only form (one row per submit)', category: 'forms', canHaveChildren: true },
|
|
184
184
|
'form-record': { description: 'Per-user record form', category: 'forms', canHaveChildren: true },
|
|
185
|
+
'entry-record-form': { description: 'Route-aware create/edit form', category: 'forms', canHaveChildren: true },
|
|
185
186
|
input: { description: 'Plain HTML input', category: 'forms', canHaveChildren: false },
|
|
186
187
|
'text-input': { description: 'Mantine TextInput', category: 'forms', canHaveChildren: false },
|
|
187
188
|
textarea: { description: 'Mantine Textarea', category: 'forms', canHaveChildren: false },
|
|
@@ -225,7 +226,7 @@ export const BASE_STYLE_REGISTRY = {
|
|
|
225
226
|
version: { description: 'Build/version diagnostic surface', category: 'auth', canHaveChildren: false },
|
|
226
227
|
'ref-container': { description: 'Renders content referenced from another section', category: 'layout', canHaveChildren: true },
|
|
227
228
|
'data-container': { description: 'Data-scoped container (renders subtree against a data scope)', category: 'layout', canHaveChildren: true },
|
|
228
|
-
'
|
|
229
|
+
'entry-table': { description: 'Built-in admin CRUD grid over a form\'s records (search/sort/paginate/CSV, add / edit / delete actions)', category: 'forms', canHaveChildren: false },
|
|
229
230
|
} as const satisfies Record<string, IStyleRegistryEntry>;
|
|
230
231
|
|
|
231
232
|
/**
|
|
@@ -53,6 +53,13 @@ describe('isPreviewBridgeMessage', () => {
|
|
|
53
53
|
expect(
|
|
54
54
|
isPreviewBridgeMessage({ type: PREVIEW_BRIDGE_MESSAGE.NAVIGATE, keyword: null }),
|
|
55
55
|
).toBe(true);
|
|
56
|
+
expect(
|
|
57
|
+
isPreviewBridgeMessage({
|
|
58
|
+
type: PREVIEW_BRIDGE_MESSAGE.NAVIGATE,
|
|
59
|
+
keyword: 'team-members-record',
|
|
60
|
+
path: '/team-members/5',
|
|
61
|
+
}),
|
|
62
|
+
).toBe(true);
|
|
56
63
|
});
|
|
57
64
|
|
|
58
65
|
it('accepts a shell->frame set-preferences command (theme + locale)', () => {
|
package/src/types/auth.ts
CHANGED
|
@@ -69,6 +69,10 @@ export const PERMISSIONS = {
|
|
|
69
69
|
ADMIN_PAGE_VERSION_PUBLISH: 'admin.page.version.publish',
|
|
70
70
|
ADMIN_PAGE_VERSION_READ: 'admin.page.version.read',
|
|
71
71
|
ADMIN_PAGE_VERSION_COMPARE: 'admin.page.version.compare',
|
|
72
|
+
ADMIN_CMS_APP_READ: 'admin.cms_app.read',
|
|
73
|
+
ADMIN_CMS_APP_CREATE: 'admin.cms_app.create',
|
|
74
|
+
ADMIN_CMS_APP_UPDATE: 'admin.cms_app.update',
|
|
75
|
+
ADMIN_CMS_APP_DELETE: 'admin.cms_app.delete',
|
|
72
76
|
ADMIN_USER_READ: 'admin.user.read',
|
|
73
77
|
ADMIN_USER_CREATE: 'admin.user.create',
|
|
74
78
|
ADMIN_USER_UPDATE: 'admin.user.update',
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SPDX-FileCopyrightText: 2026 Humdek, University of Bern
|
|
3
|
+
* SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* First-class CMS app contract (Host Admin product unit).
|
|
8
|
+
* Mirrors backend CmsAppRole + CmsAppService response shapes.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export type TCmsAppRole =
|
|
12
|
+
| 'form'
|
|
13
|
+
| 'cms_list'
|
|
14
|
+
| 'cms_detail'
|
|
15
|
+
| 'public_list'
|
|
16
|
+
| 'public_detail'
|
|
17
|
+
| 'other';
|
|
18
|
+
|
|
19
|
+
export const CMS_APP_ROLES: readonly TCmsAppRole[] = [
|
|
20
|
+
'form',
|
|
21
|
+
'cms_list',
|
|
22
|
+
'cms_detail',
|
|
23
|
+
'public_list',
|
|
24
|
+
'public_detail',
|
|
25
|
+
'other',
|
|
26
|
+
] as const;
|
|
27
|
+
|
|
28
|
+
export const CMS_APP_PRIMARY_ROLES: readonly TCmsAppRole[] = [
|
|
29
|
+
'form',
|
|
30
|
+
'cms_list',
|
|
31
|
+
'cms_detail',
|
|
32
|
+
'public_list',
|
|
33
|
+
'public_detail',
|
|
34
|
+
] as const;
|
|
35
|
+
|
|
36
|
+
/** Assigned page row inside a CMS app detail payload. */
|
|
37
|
+
export interface ICmsAppPage {
|
|
38
|
+
page_id: number;
|
|
39
|
+
keyword: string;
|
|
40
|
+
url: string | null;
|
|
41
|
+
page_surface: string;
|
|
42
|
+
cms_app_role: TCmsAppRole | null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** @deprecated Prefer {@link ICmsAppPage} — kept for existing imports. */
|
|
46
|
+
export type ICmsAppAssignedPage = ICmsAppPage;
|
|
47
|
+
|
|
48
|
+
/** List/summary row for GET /admin/cms-apps. */
|
|
49
|
+
export interface ICmsAppSummary {
|
|
50
|
+
id: number;
|
|
51
|
+
name: string;
|
|
52
|
+
slug: string;
|
|
53
|
+
description: string | null;
|
|
54
|
+
page_count: number;
|
|
55
|
+
id_form_section: number | null;
|
|
56
|
+
id_cms_list_page: number | null;
|
|
57
|
+
cms_list_keyword: string | null;
|
|
58
|
+
cms_list_url: string | null;
|
|
59
|
+
id_cms_detail_page: number | null;
|
|
60
|
+
id_public_list_page: number | null;
|
|
61
|
+
public_list_keyword: string | null;
|
|
62
|
+
public_list_url: string | null;
|
|
63
|
+
id_public_detail_page: number | null;
|
|
64
|
+
created_at: string;
|
|
65
|
+
updated_at: string | null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Detail payload (summary + assigned pages). Canonical alias: {@link ICmsApp}. */
|
|
69
|
+
export interface ICmsAppDetail extends ICmsAppSummary {
|
|
70
|
+
pages: ICmsAppPage[];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Canonical CMS app detail contract. */
|
|
74
|
+
export type ICmsApp = ICmsAppDetail;
|
package/src/types/index.ts
CHANGED
|
@@ -146,6 +146,7 @@ export interface IMobileCheckboxProps extends IMobileAdapterBaseProps {
|
|
|
146
146
|
export interface IMobileSelectOption {
|
|
147
147
|
value: string;
|
|
148
148
|
label: string;
|
|
149
|
+
disabled?: boolean;
|
|
149
150
|
}
|
|
150
151
|
|
|
151
152
|
export interface IMobileSelectProps extends IMobileAdapterBaseProps {
|
package/src/types/pages.ts
CHANGED
|
@@ -73,6 +73,12 @@ export interface IPageContent {
|
|
|
73
73
|
url: string | null;
|
|
74
74
|
parent_page_id: number | null;
|
|
75
75
|
is_headless: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* CMS-in-CMS surface: `public` website pages vs `cms` admin-only snippets
|
|
78
|
+
* (entry-table / form). `cms` pages must not render on the public slug route;
|
|
79
|
+
* Host Admin hosts them under `/admin/cms-apps/.../content`.
|
|
80
|
+
*/
|
|
81
|
+
page_surface?: 'public' | 'cms';
|
|
76
82
|
/**
|
|
77
83
|
* When true, the web frontend renders this page's content inside a modal
|
|
78
84
|
* overlay (the page title becomes the modal header, with a close button)
|
|
@@ -116,6 +116,12 @@ export interface IPreviewNavigatedMessage {
|
|
|
116
116
|
export interface IPreviewNavigateCommand {
|
|
117
117
|
type: typeof PREVIEW_BRIDGE_MESSAGE.NAVIGATE;
|
|
118
118
|
keyword: string | null;
|
|
119
|
+
/**
|
|
120
|
+
* Full public path when keyword alone is insufficient (parameterized routes
|
|
121
|
+
* such as `/team-members/5`). The mobile frame resolves this via
|
|
122
|
+
* `GET /pages/resolve` instead of routing by keyword only.
|
|
123
|
+
*/
|
|
124
|
+
path?: string | null;
|
|
119
125
|
}
|
|
120
126
|
|
|
121
127
|
/**
|
|
@@ -177,7 +183,12 @@ export function isPreviewBridgeMessage(value: unknown): value is TPreviewBridgeM
|
|
|
177
183
|
typeof record.href === 'string'
|
|
178
184
|
);
|
|
179
185
|
case PREVIEW_BRIDGE_MESSAGE.NAVIGATE:
|
|
180
|
-
return
|
|
186
|
+
return (
|
|
187
|
+
(typeof record.keyword === 'string' || record.keyword === null) &&
|
|
188
|
+
(record.path === undefined ||
|
|
189
|
+
record.path === null ||
|
|
190
|
+
typeof record.path === 'string')
|
|
191
|
+
);
|
|
181
192
|
case PREVIEW_BRIDGE_MESSAGE.SET_PREFERENCES:
|
|
182
193
|
return isPreviewPreferences(record.preferences);
|
|
183
194
|
case PREVIEW_BRIDGE_MESSAGE.PREFERENCES_CHANGED:
|
|
@@ -122,14 +122,35 @@ export interface IListItemStyle extends IStyleWithSpacing {
|
|
|
122
122
|
export interface IEntryListStyle extends IBaseStyle {
|
|
123
123
|
style_name: 'entry-list';
|
|
124
124
|
line_clamp?: IContentField<TMantineLineClamp>;
|
|
125
|
+
data_table?: IContentField<string>;
|
|
126
|
+
own_entries_only?: IContentField<string>;
|
|
127
|
+
filter?: IContentField<string>;
|
|
128
|
+
scope?: IContentField<string>;
|
|
129
|
+
load_as_table?: IContentField<string>;
|
|
130
|
+
selected_columns?: IContentField<string>;
|
|
125
131
|
}
|
|
126
132
|
|
|
127
133
|
export interface IEntryRecordStyle extends IBaseStyle {
|
|
128
134
|
style_name: 'entry-record';
|
|
135
|
+
data_table?: IContentField<string>;
|
|
136
|
+
own_entries_only?: IContentField<string>;
|
|
137
|
+
/**
|
|
138
|
+
* Route parameter carrying the record id (same contract as
|
|
139
|
+
* `entry-record-form.load_record_from`, e.g. `record_id` on
|
|
140
|
+
* `/team-members/{record_id}`). The holder loads that single row.
|
|
141
|
+
*/
|
|
142
|
+
load_record_from?: IContentField<string>;
|
|
143
|
+
scope?: IContentField<string>;
|
|
129
144
|
}
|
|
130
145
|
|
|
131
146
|
export interface IEntryRecordDeleteStyle extends IBaseStyle {
|
|
132
147
|
style_name: 'entry-record-delete';
|
|
148
|
+
/** Delete button text (catalog field; the generic `label` field is not linked to this style). */
|
|
149
|
+
label_delete?: IContentField<string>;
|
|
150
|
+
confirmation_title?: IContentField<string>;
|
|
151
|
+
confirmation_message?: IContentField<string>;
|
|
152
|
+
confirmation_continue?: IContentField<string>;
|
|
153
|
+
confirmation_cancel?: IContentField<string>;
|
|
133
154
|
}
|
|
134
155
|
|
|
135
156
|
export interface ILoopStyle extends IBaseStyle {
|
|
@@ -23,7 +23,7 @@ export type TMobileSelectPresentation = 'bottom-sheet' | 'dialog' | 'popover';
|
|
|
23
23
|
export type TMobileFieldVariant = 'primary' | 'secondary';
|
|
24
24
|
|
|
25
25
|
export interface IFormStyle extends IStyleWithSpacing {
|
|
26
|
-
style_name: 'form-log' | 'form-record';
|
|
26
|
+
style_name: 'form-log' | 'form-record' | 'entry-record-form';
|
|
27
27
|
/** Optional auto-styled heading rendered above the form when set. */
|
|
28
28
|
title?: IContentField<string>;
|
|
29
29
|
/** Optional sub-heading rendered below the title when set. */
|
|
@@ -69,8 +69,30 @@ export interface IFormLogStyle extends IFormStyle {
|
|
|
69
69
|
|
|
70
70
|
export interface IFormRecordStyle extends IFormStyle {
|
|
71
71
|
style_name: 'form-record';
|
|
72
|
+
/** Human-readable table name slug (runtime table is owned by section id). */
|
|
73
|
+
name?: IContentField<string>;
|
|
74
|
+
btn_update_label?: IContentField<string>;
|
|
75
|
+
btn_update_color?: IContentField<string>;
|
|
76
|
+
/**
|
|
77
|
+
* '1' (default): the form only ever loads/updates the user's own records.
|
|
78
|
+
* '0': shared editing — foreign records can be loaded/updated by users
|
|
79
|
+
* holding UPDATE data access on the form's table (admins always pass).
|
|
80
|
+
*/
|
|
81
|
+
own_entries_only?: IContentField<string>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface IEntryRecordFormStyle extends IFormStyle {
|
|
85
|
+
style_name: 'entry-record-form';
|
|
72
86
|
btn_update_label?: IContentField<string>;
|
|
73
87
|
btn_update_color?: IContentField<string>;
|
|
88
|
+
/** Numeric data_tables.id or empty to use this section's owned table. */
|
|
89
|
+
data_table?: IContentField<string>;
|
|
90
|
+
/**
|
|
91
|
+
* Route parameter carrying the record id (e.g. record_id on /cms/team/{record_id}).
|
|
92
|
+
* When present the form loads that record; when absent the form stays empty (create).
|
|
93
|
+
*/
|
|
94
|
+
load_record_from?: IContentField<string>;
|
|
95
|
+
own_entries_only?: IContentField<string>;
|
|
74
96
|
}
|
|
75
97
|
|
|
76
98
|
export interface IInputStyle extends IBaseStyle {
|
|
@@ -164,6 +186,8 @@ export interface ISelectStyle extends IBaseStyle {
|
|
|
164
186
|
value?: IContentField<string>;
|
|
165
187
|
placeholder?: IContentField<string>;
|
|
166
188
|
options?: IContentField<string>;
|
|
189
|
+
/** Translatable map: `code -> label` for active language. */
|
|
190
|
+
option_labels?: IContentField<string>;
|
|
167
191
|
is_multiple?: IContentField<string>;
|
|
168
192
|
max?: IContentField<string>;
|
|
169
193
|
// RF-17: searchable/clearable are portable behaviour (was the stale
|
|
@@ -191,6 +215,8 @@ export interface IRadioStyle extends IStyleWithSpacing {
|
|
|
191
215
|
size?: IContentField<TSharedSize>;
|
|
192
216
|
color?: IContentField<TMantineColor>;
|
|
193
217
|
radio_options?: IContentField<string>;
|
|
218
|
+
/** Translatable map: `code -> label` for active language. */
|
|
219
|
+
option_labels?: IContentField<string>;
|
|
194
220
|
web_radio_label_position?: IContentField<string>;
|
|
195
221
|
web_radio_variant?: IContentField<string>;
|
|
196
222
|
web_radio_card?: IContentField<string>;
|
|
@@ -317,6 +343,8 @@ export interface IComboboxStyle extends IStyleWithSpacing {
|
|
|
317
343
|
style_name: 'combobox';
|
|
318
344
|
placeholder?: IContentField<string>;
|
|
319
345
|
combobox_options?: IContentField<string>;
|
|
346
|
+
/** Translatable map: `code -> label` for active language. */
|
|
347
|
+
option_labels?: IContentField<string>;
|
|
320
348
|
disabled?: IContentField<string>; label?: IContentField<string>;
|
|
321
349
|
description?: IContentField<string>;
|
|
322
350
|
name?: IContentField<string>;
|
|
@@ -415,6 +443,8 @@ export interface INumberInputStyle extends IStyleWithSpacing {
|
|
|
415
443
|
export interface ISegmentedControlStyle extends IStyleWithSpacing {
|
|
416
444
|
style_name: 'segmented-control';
|
|
417
445
|
segmented_control_data?: IContentField<string>;
|
|
446
|
+
/** Translatable map: `code -> label` for active language. */
|
|
447
|
+
option_labels?: IContentField<string>;
|
|
418
448
|
orientation?: IContentField<string>;
|
|
419
449
|
size?: IContentField<TSharedSize>;
|
|
420
450
|
radius?: IContentField<TSharedRadius>;
|
|
@@ -472,15 +502,24 @@ export interface IProgressSectionStyle extends IBaseStyle {
|
|
|
472
502
|
tooltip_label?: IContentField<string>;
|
|
473
503
|
web_tooltip_position?: IContentField<string>;}
|
|
474
504
|
|
|
475
|
-
export interface
|
|
505
|
+
export interface IEntryTableEntry {
|
|
476
506
|
record_id: number;
|
|
477
507
|
id_users: number;
|
|
508
|
+
/** Per-row delete permission (backend rule `canDeleteOwnedRecord`). */
|
|
478
509
|
_can_delete?: boolean;
|
|
510
|
+
/** Per-row edit permission (backend rule `canUpdateOwnedRecord`). */
|
|
511
|
+
_can_edit?: boolean;
|
|
479
512
|
[key: string]: unknown;
|
|
480
513
|
}
|
|
481
514
|
|
|
482
|
-
|
|
483
|
-
|
|
515
|
+
/**
|
|
516
|
+
* The built-in admin CRUD grid (renamed from `show-user-input` in the
|
|
517
|
+
* CMS-in-CMS polish wave): a data table over a form's records with search /
|
|
518
|
+
* sort / pagination / CSV, an "Add new" button, a per-row edit action and a
|
|
519
|
+
* permission-gated per-row delete.
|
|
520
|
+
*/
|
|
521
|
+
export interface IEntryTableStyle extends IBaseStyle {
|
|
522
|
+
style_name: 'entry-table';
|
|
484
523
|
/** Optional auto-styled heading rendered above the entries when set. */
|
|
485
524
|
title?: IContentField<string>;
|
|
486
525
|
/** Message shown when there are no entries to display (default "No entries found."). */
|
|
@@ -498,20 +537,28 @@ export interface IShowUserInputStyle extends IBaseStyle {
|
|
|
498
537
|
csv_export?: IContentField<string>;
|
|
499
538
|
delete_entry?: IContentField<string>;
|
|
500
539
|
fields_map?: IContentField<string>;
|
|
540
|
+
/** Per-language header labels keyed by field_key. */
|
|
541
|
+
fields_map_labels?: IContentField<string>;
|
|
501
542
|
/**
|
|
502
543
|
* Optional URL of a create form. When set, the web table shows an "Add new"
|
|
503
544
|
* button above it (e.g. opens the create form modal). Web-only.
|
|
504
545
|
*/
|
|
505
546
|
add_url?: IContentField<string>;
|
|
506
547
|
/**
|
|
507
|
-
* Optional URL template for opening a row's
|
|
508
|
-
* `/cms/team/{record_id}`). When set, each row gets an
|
|
509
|
-
*
|
|
510
|
-
* the renderer at click time. Web-only.
|
|
548
|
+
* Optional URL template for opening a row's edit form (e.g.
|
|
549
|
+
* `/cms/team/{record_id}`). When set, each row with `_can_edit` gets an
|
|
550
|
+
* edit action with the single-brace `{record_id}` placeholder substituted
|
|
551
|
+
* by the renderer at click time. Web-only.
|
|
511
552
|
*/
|
|
512
553
|
edit_url?: IContentField<string>;
|
|
513
554
|
delete_modal_title?: IContentField<string>;
|
|
514
555
|
delete_modal_body?: IContentField<string>;
|
|
556
|
+
/**
|
|
557
|
+
* When `1`, the web table shows a language selector above the grid and
|
|
558
|
+
* reloads translatable cell values for the chosen locale (CMS app lists).
|
|
559
|
+
* Default off.
|
|
560
|
+
*/
|
|
561
|
+
show_language_preview?: IContentField<string>;
|
|
515
562
|
spacing?: IContentField<string>;
|
|
516
563
|
web_table_striped?: IContentField<string>;
|
|
517
564
|
web_table_highlight_on_hover?: IContentField<string>;
|
|
@@ -521,10 +568,10 @@ export interface IShowUserInputStyle extends IBaseStyle {
|
|
|
521
568
|
web_table_sticky_header?: IContentField<string>;
|
|
522
569
|
web_table_caption_side?: IContentField<string>;
|
|
523
570
|
/**
|
|
524
|
-
*
|
|
571
|
+
* entry-table rows, each keyed by the immutable data-column `field_key`
|
|
525
572
|
* (issue #56 v2). Header labels come from {@link field_labels}, not the keys.
|
|
526
573
|
*/
|
|
527
|
-
entries?:
|
|
574
|
+
entries?: IEntryTableEntry[];
|
|
528
575
|
/**
|
|
529
576
|
* Header map `field_key => display_name` for {@link entries} (issue #56 v2).
|
|
530
577
|
* Lets the table show the human column label while rows stay keyed by the
|
|
@@ -177,6 +177,6 @@ export interface INotificationStyle extends IStyleWithSpacing {
|
|
|
177
177
|
radius?: IContentField<TSharedRadius>;}
|
|
178
178
|
|
|
179
179
|
// NOTE: `fab-button` and `biometric-login-button` are deferred (mobile rendering
|
|
180
|
-
// plan, milestone-one scope). They are NOT part of the established
|
|
180
|
+
// plan, milestone-one scope). They are NOT part of the established 91-style
|
|
181
181
|
// catalog and were removed from the registry, union and interfaces. Reintroduce
|
|
182
182
|
// only with a concrete CMS authoring use case, fields, render target, and tests.
|
|
@@ -87,7 +87,7 @@ import type {
|
|
|
87
87
|
IProgressStyle,
|
|
88
88
|
IProgressRootStyle,
|
|
89
89
|
IProgressSectionStyle,
|
|
90
|
-
|
|
90
|
+
IEntryTableStyle,
|
|
91
91
|
} from './forms';
|
|
92
92
|
import type {
|
|
93
93
|
IAccordionStyle,
|
|
@@ -208,7 +208,7 @@ export type TStyle =
|
|
|
208
208
|
| IVersionStyle
|
|
209
209
|
| IRefContainerStyle
|
|
210
210
|
| IDataContainerStyle
|
|
211
|
-
|
|
|
211
|
+
| IEntryTableStyle;
|
|
212
212
|
|
|
213
213
|
/**
|
|
214
214
|
* Discriminator — name of every supported style. Derived from the
|