@fieldia/viewer 0.11.0 → 0.13.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/bundle/fieldia.ar.js +2 -2
- package/bundle/fieldia.ar.js.map +2 -2
- package/bundle/fieldia.de.js +2 -2
- package/bundle/fieldia.de.js.map +2 -2
- package/bundle/fieldia.fr.js +2 -2
- package/bundle/fieldia.fr.js.map +2 -2
- package/bundle/fieldia.js +62 -4
- package/bundle/fieldia.js.map +4 -4
- package/package.json +3 -3
- package/src/index.d.mts +1 -1
- package/src/index.d.ts +1 -1
- package/src/index.js +5 -1
- package/src/index.js.map +1 -1
- package/src/index.mjs +1 -1
- package/src/index.mjs.map +1 -1
- package/src/lib/attachment-preview.d.mts +27 -0
- package/src/lib/attachment-preview.d.ts +27 -0
- package/src/lib/attachment-preview.js +89 -0
- package/src/lib/attachment-preview.js.map +1 -0
- package/src/lib/attachment-preview.mjs +86 -0
- package/src/lib/attachment-preview.mjs.map +1 -0
- package/src/lib/dialog.d.mts +8 -1
- package/src/lib/dialog.d.ts +8 -1
- package/src/lib/dialog.js +75 -10
- package/src/lib/dialog.js.map +1 -1
- package/src/lib/dialog.mjs +75 -11
- package/src/lib/dialog.mjs.map +1 -1
- package/src/lib/hotkeys.d.mts +11 -0
- package/src/lib/hotkeys.d.ts +11 -0
- package/src/lib/hotkeys.js +34 -0
- package/src/lib/hotkeys.js.map +1 -0
- package/src/lib/hotkeys.mjs +30 -0
- package/src/lib/hotkeys.mjs.map +1 -0
- package/src/lib/labels.d.mts +25 -0
- package/src/lib/labels.d.ts +25 -0
- package/src/lib/labels.js +17 -0
- package/src/lib/labels.js.map +1 -1
- package/src/lib/labels.mjs +17 -0
- package/src/lib/labels.mjs.map +1 -1
- package/src/lib/list.d.mts +3 -1
- package/src/lib/list.d.ts +3 -1
- package/src/lib/list.js +1 -1
- package/src/lib/list.js.map +1 -1
- package/src/lib/list.mjs +1 -1
- package/src/lib/list.mjs.map +1 -1
- package/src/lib/locales/ar.js +17 -0
- package/src/lib/locales/ar.js.map +1 -1
- package/src/lib/locales/ar.mjs +17 -0
- package/src/lib/locales/ar.mjs.map +1 -1
- package/src/lib/locales/de.js +17 -0
- package/src/lib/locales/de.js.map +1 -1
- package/src/lib/locales/de.mjs +17 -0
- package/src/lib/locales/de.mjs.map +1 -1
- package/src/lib/locales/fr.js +17 -0
- package/src/lib/locales/fr.js.map +1 -1
- package/src/lib/locales/fr.mjs +17 -0
- package/src/lib/locales/fr.mjs.map +1 -1
- package/src/lib/look.d.mts +16 -1
- package/src/lib/look.d.ts +16 -1
- package/src/lib/look.js +34 -0
- package/src/lib/look.js.map +1 -1
- package/src/lib/look.mjs +31 -0
- package/src/lib/look.mjs.map +1 -1
- package/src/lib/open.d.mts +7 -1
- package/src/lib/open.d.ts +7 -1
- package/src/lib/open.js +19 -8
- package/src/lib/open.js.map +1 -1
- package/src/lib/open.mjs +20 -9
- package/src/lib/open.mjs.map +1 -1
- package/src/lib/place.d.mts +2 -0
- package/src/lib/place.d.ts +2 -0
- package/src/lib/place.js.map +1 -1
- package/src/lib/place.mjs.map +1 -1
- package/src/lib/record-bar.d.mts +56 -0
- package/src/lib/record-bar.d.ts +56 -0
- package/src/lib/record-bar.js +237 -0
- package/src/lib/record-bar.js.map +1 -0
- package/src/lib/record-bar.mjs +234 -0
- package/src/lib/record-bar.mjs.map +1 -0
- package/src/lib/record-styles.d.mts +9 -0
- package/src/lib/record-styles.d.ts +9 -0
- package/src/lib/record-styles.js +83 -0
- package/src/lib/record-styles.js.map +1 -0
- package/src/lib/record-styles.mjs +79 -0
- package/src/lib/record-styles.mjs.map +1 -0
- package/src/lib/related.d.mts +7 -3
- package/src/lib/related.d.ts +7 -3
- package/src/lib/related.js +28 -9
- package/src/lib/related.js.map +1 -1
- package/src/lib/related.mjs +28 -9
- package/src/lib/related.mjs.map +1 -1
- package/src/lib/say.d.mts +3 -1
- package/src/lib/say.d.ts +3 -1
- package/src/lib/say.js +17 -1
- package/src/lib/say.js.map +1 -1
- package/src/lib/say.mjs +17 -1
- package/src/lib/say.mjs.map +1 -1
- package/src/lib/tab-strip.d.mts +17 -0
- package/src/lib/tab-strip.d.ts +17 -0
- package/src/lib/tab-strip.js +51 -0
- package/src/lib/tab-strip.js.map +1 -0
- package/src/lib/tab-strip.mjs +48 -0
- package/src/lib/tab-strip.mjs.map +1 -0
- package/src/lib/value-words.d.mts +10 -0
- package/src/lib/value-words.d.ts +10 -0
- package/src/lib/value-words.js +38 -0
- package/src/lib/value-words.js.map +1 -0
- package/src/lib/value-words.mjs +35 -0
- package/src/lib/value-words.mjs.map +1 -0
- package/src/lib/viewer.d.mts +45 -2
- package/src/lib/viewer.d.ts +45 -2
- package/src/lib/viewer.js +575 -51
- package/src/lib/viewer.js.map +1 -1
- package/src/lib/viewer.mjs +576 -53
- package/src/lib/viewer.mjs.map +1 -1
package/src/lib/viewer.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { type ActionHost, type ActionStep, type FormEvents, type Form, type FormOptions, type Page, type RecordId, type Locale, type OpenRequest, type OpenResult, type RunContext, type RunResult, type Values } from '@fieldia/core';
|
|
1
|
+
import { type ActionHost, type ActionStep, type FormEvents, type Form, type FormOptions, type LayoutNode, type Page, type Theme, type RecordId, type ResolvedFilter, type Locale, type OpenRequest, type OpenResult, type RunContext, type RunResult, type Values } from '@fieldia/core';
|
|
2
2
|
import { type IconSet, type PreferenceStore, type WidgetFactory } from '@fieldia/widgets';
|
|
3
3
|
import { type PageFinder } from './related';
|
|
4
|
+
import { type Tokens } from './look';
|
|
5
|
+
import { type Breadcrumb, type RecordPager } from './record-bar';
|
|
6
|
+
export type { Breadcrumb, RecordPager } from './record-bar';
|
|
4
7
|
export type Skin = 'underline' | 'outlined';
|
|
5
8
|
import { type ViewerLabels } from './labels';
|
|
6
9
|
export { VIEWER_LABELS, DEFAULT_LABELS, type ViewerLabels } from './labels';
|
|
@@ -14,7 +17,17 @@ export interface ViewerOptions extends Omit<FormOptions, 'page' | 'host'> {
|
|
|
14
17
|
page: Page;
|
|
15
18
|
/** A form made elsewhere, to share one record between two views. */
|
|
16
19
|
form?: Form;
|
|
20
|
+
/** The skin: a theme's own when it is left out (see `THEME_SKINS`), else `underline`. */
|
|
17
21
|
skin?: Skin;
|
|
22
|
+
/** A theme in the style of a known design system, over the page's own (`look.theme`). */
|
|
23
|
+
theme?: Theme;
|
|
24
|
+
/**
|
|
25
|
+
* The host's own colours, corners and font, over the skin's, the theme's, the
|
|
26
|
+
* scheme's and the page's: `{ text, surface, accent, … }` (`TOKEN_NAMES`). The
|
|
27
|
+
* supported way to dress a form in an app's theme; a host's own stylesheet
|
|
28
|
+
* rule on the form does the same.
|
|
29
|
+
*/
|
|
30
|
+
tokens?: Tokens;
|
|
18
31
|
/** Widgets that replace or add to the built-in ones, by `type` or `type.widget`. */
|
|
19
32
|
widgets?: Record<string, WidgetFactory>;
|
|
20
33
|
slots?: Record<string, SlotRenderer>;
|
|
@@ -79,6 +92,8 @@ export interface ViewerOptions extends Omit<FormOptions, 'page' | 'host'> {
|
|
|
79
92
|
translate?: (text: string) => string;
|
|
80
93
|
/** A list page: a row was opened, by a click or by Enter. The app shows the record. */
|
|
81
94
|
onOpenRecord?: (id: RecordId) => void;
|
|
95
|
+
/** A list page: only the records these conditions let through, whatever is searched — the invoices of one order, opened from it. */
|
|
96
|
+
listFilter?: ResolvedFilter[];
|
|
82
97
|
/**
|
|
83
98
|
* What the page's steps ask of the screen, the viewer does itself: a page
|
|
84
99
|
* opened (in a dialog, a side panel, or this form's place, with Back), words
|
|
@@ -91,11 +106,32 @@ export interface ViewerOptions extends Omit<FormOptions, 'page' | 'host'> {
|
|
|
91
106
|
* your router, your own dialog — or with undefined to let the viewer open it.
|
|
92
107
|
*/
|
|
93
108
|
onOpen?: (request: OpenRequest) => Promise<OpenResult> | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* The records round this one, for the pager over a record — "3 / 42",
|
|
111
|
+
* Previous and Next — as the list it was opened from has them: their ids in
|
|
112
|
+
* order, or how many there are, where this one is, and the id at a place.
|
|
113
|
+
* Moving saves what changed first, as Flectra does; the form then shows
|
|
114
|
+
* the other record (its `open` event says which). A copy joins them after
|
|
115
|
+
* its record; a record deleted leaves them, the pager moving to the next.
|
|
116
|
+
* Never in a dialog.
|
|
117
|
+
*/
|
|
118
|
+
records?: readonly RecordId[] | RecordPager;
|
|
119
|
+
/**
|
|
120
|
+
* The trail to this record, for the breadcrumbs over it: each page before
|
|
121
|
+
* it with its words and what a press does (back to it); the record itself
|
|
122
|
+
* comes last, by its name. A page a step opens in this one's place adds
|
|
123
|
+
* this one to the trail, as the way back. Never in a dialog.
|
|
124
|
+
*/
|
|
125
|
+
breadcrumbs?: readonly Breadcrumb[];
|
|
94
126
|
}
|
|
95
127
|
export interface ViewerHandle {
|
|
96
128
|
readonly form: Form;
|
|
97
129
|
readonly element: HTMLElement;
|
|
98
130
|
setSkin(skin: Skin): void;
|
|
131
|
+
/** Wear another theme; the skin follows it unless the viewer was given one. */
|
|
132
|
+
setTheme(theme: Theme | null): void;
|
|
133
|
+
/** Wear the host's tokens in place of those given before, as when its app turns dark; null takes them off. Dialogs opened after wear them too. */
|
|
134
|
+
setTokens(tokens: Tokens | null): void;
|
|
99
135
|
/** Save the record, or take the focus to the first problem when the form refuses. */
|
|
100
136
|
save(): Promise<boolean>;
|
|
101
137
|
/** Check the form without saving, taking the focus to the first problem. */
|
|
@@ -116,4 +152,11 @@ export interface ViewerHandle {
|
|
|
116
152
|
* React, Angular and Vue bindings are thin shells around this function.
|
|
117
153
|
* Throws when the page does not validate, listing every problem.
|
|
118
154
|
*/
|
|
119
|
-
export declare function mountViewer(host: HTMLElement,
|
|
155
|
+
export declare function mountViewer(host: HTMLElement, given: ViewerOptions): ViewerHandle;
|
|
156
|
+
/**
|
|
157
|
+
* A one-line row's parts in runs that wrap as one: words before a field
|
|
158
|
+
* ("Expected:", "to") go with it, and words after it that no field follows
|
|
159
|
+
* ("attempts") too, as Flectra keeps them in one span; any other part runs
|
|
160
|
+
* alone.
|
|
161
|
+
*/
|
|
162
|
+
export declare function onelineRuns(children: readonly LayoutNode[]): LayoutNode[][];
|