nexus-shared 3.1.0 → 4.0.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/CHANGELOG.md +2268 -446
- package/LICENSE +21 -21
- package/README.md +1705 -1084
- package/dist/Client.Index.d.ts +17 -0
- package/dist/Client.Index.js +17 -0
- package/dist/Components/Documents/DocumentFrame.d.ts +50 -0
- package/dist/Components/Documents/DocumentFrame.js +83 -0
- package/dist/Components/Documents/Menu.d.ts +4 -0
- package/dist/Components/Documents/Menu.js +40 -24
- package/dist/Components/Documents/PrintDocument.d.ts +95 -0
- package/dist/Components/Documents/PrintDocument.js +62 -0
- package/dist/Components/Documents/Tabs.d.ts +59 -0
- package/dist/Components/Documents/Tabs.js +70 -0
- package/dist/Components/Forms/ApiForm.js +19 -2
- package/dist/Components/Forms/Crud.d.ts +2 -2
- package/dist/Components/Forms/Crud.js +871 -377
- package/dist/Components/Forms/CrudActions.d.ts +136 -0
- package/dist/Components/Forms/CrudActions.js +184 -0
- package/dist/Components/Forms/CrudHistory.d.ts +66 -0
- package/dist/Components/Forms/CrudHistory.js +140 -0
- package/dist/Components/Forms/CrudNarrowPicker.d.ts +31 -0
- package/dist/Components/Forms/CrudNarrowPicker.js +180 -0
- package/dist/Components/Forms/CrudParts.d.ts +30 -2
- package/dist/Components/Forms/CrudParts.js +56 -5
- package/dist/Components/Forms/CrudRowForms.d.ts +26 -0
- package/dist/Components/Forms/CrudRowForms.js +114 -0
- package/dist/Components/Forms/CrudScopes.d.ts +28 -0
- package/dist/Components/Forms/CrudScopes.js +76 -0
- package/dist/Components/Forms/CrudTree.d.ts +90 -0
- package/dist/Components/Forms/CrudTree.js +363 -0
- package/dist/Components/Forms/CrudWorkspace.d.ts +63 -0
- package/dist/Components/Forms/CrudWorkspace.js +169 -0
- package/dist/Components/Forms/ExcelImport.js +3 -3
- package/dist/Components/Forms/Form.d.ts +4 -4
- package/dist/Components/Forms/Form.js +125 -16
- package/dist/Components/Forms/FormLeaveGuard.d.ts +44 -0
- package/dist/Components/Forms/FormLeaveGuard.js +65 -0
- package/dist/Components/Forms/RecordFlows.d.ts +50 -0
- package/dist/Components/Forms/RecordFlows.js +282 -0
- package/dist/Components/Forms/SubmitForm.d.ts +37 -2
- package/dist/Components/Forms/SubmitForm.js +195 -10
- package/dist/Components/Inputs/CheckBox.js +1 -1
- package/dist/Components/Inputs/ChoiceField.d.ts +21 -1
- package/dist/Components/Inputs/ChoiceField.js +28 -2
- package/dist/Components/Inputs/CodeBox.d.ts +69 -0
- package/dist/Components/Inputs/CodeBox.js +316 -0
- package/dist/Components/Inputs/DatePicker.js +4 -1
- package/dist/Components/Inputs/DateRangePicker.js +4 -1
- package/dist/Components/Inputs/DateTimePicker.js +4 -1
- package/dist/Components/Inputs/Dropdown.d.ts +13 -0
- package/dist/Components/Inputs/Dropdown.js +8 -5
- package/dist/Components/Inputs/DropdownParts.d.ts +3 -1
- package/dist/Components/Inputs/DropdownParts.js +16 -4
- package/dist/Components/Inputs/Field.d.ts +7 -1
- package/dist/Components/Inputs/Field.js +2 -2
- package/dist/Components/Inputs/GroupForm.d.ts +6 -6
- package/dist/Components/Inputs/GroupForm.js +10 -11
- package/dist/Components/Inputs/InputRenderer.d.ts +9 -6
- package/dist/Components/Inputs/InputRenderer.js +39 -31
- package/dist/Components/Inputs/NumberBox.js +4 -2
- package/dist/Components/Inputs/PictureInput.d.ts +41 -0
- package/dist/Components/Inputs/PictureInput.js +70 -0
- package/dist/Components/Inputs/RadioGroup.d.ts +16 -3
- package/dist/Components/Inputs/RadioGroup.js +8 -3
- package/dist/Components/Inputs/RowsInput.d.ts +1 -1
- package/dist/Components/Inputs/RowsInput.js +18 -3
- package/dist/Components/Inputs/TabularForm.d.ts +5 -5
- package/dist/Components/Inputs/TabularForm.js +29 -29
- package/dist/Components/Inputs/TextArea.d.ts +6 -0
- package/dist/Components/Inputs/TextArea.js +14 -2
- package/dist/Components/Inputs/TextBox.js +4 -1
- package/dist/Components/Inputs/TextBoxTypes.d.ts +6 -0
- package/dist/Components/Inputs/TextBoxTypes.js +17 -0
- package/dist/Components/Inputs/TimePicker.js +4 -1
- package/dist/Components/Inputs/TreeView.d.ts +107 -6
- package/dist/Components/Inputs/TreeView.js +513 -30
- package/dist/Components/Layouts/MessageBox.d.ts +15 -2
- package/dist/Components/Layouts/MessageBox.js +56 -7
- package/dist/Components/Layouts/Popup.d.ts +13 -6
- package/dist/Components/Layouts/Popup.js +37 -9
- package/dist/Components/Layouts/PopupDock.d.ts +3 -1
- package/dist/Components/Layouts/PopupDock.js +2 -1
- package/dist/Components/Layouts/PopupHost.js +5 -4
- package/dist/Components/Layouts/ThemePicker.d.ts +3 -2
- package/dist/Components/Layouts/ThemePicker.js +16 -4
- package/dist/Components/Viewers/DataTable.js +205 -61
- package/dist/Components/Viewers/DataTableFilters.d.ts +1 -1
- package/dist/Components/Viewers/DataTableFilters.js +17 -2
- package/dist/Components/Viewers/DataTableParts.d.ts +46 -12
- package/dist/Components/Viewers/DataTableParts.js +62 -21
- package/dist/Components/Viewers/OwnerFiles.d.ts +175 -0
- package/dist/Components/Viewers/OwnerFiles.js +589 -0
- package/dist/Components/Viewers/QrCodeImage.d.ts +22 -0
- package/dist/Components/Viewers/QrCodeImage.js +15 -0
- package/dist/Components/Viewers/RecordCards.d.ts +16 -0
- package/dist/Components/Viewers/RecordCards.js +509 -0
- package/dist/Helpers/ApiModules.d.ts +3 -34
- package/dist/Helpers/ApiModules.js +3 -3
- package/dist/Helpers/ApiRoutes.d.ts +68 -26
- package/dist/Helpers/ApiRoutes.js +31 -27
- package/dist/Helpers/ArrayHelpers.d.ts +0 -0
- package/dist/Helpers/ArrayHelpers.js +2 -0
- package/dist/Helpers/BusyHooks.d.ts +6 -0
- package/dist/Helpers/BusyHooks.js +39 -0
- package/dist/Helpers/CodeHelpers.d.ts +97 -0
- package/dist/Helpers/CodeHelpers.js +332 -0
- package/dist/Helpers/CrudBackend.d.ts +114 -6
- package/dist/Helpers/CrudBackend.js +214 -11
- package/dist/Helpers/CrudColumns.d.ts +98 -0
- package/dist/Helpers/CrudColumns.js +160 -0
- package/dist/Helpers/CrudDetailsTabs.d.ts +58 -0
- package/dist/Helpers/CrudDetailsTabs.js +126 -0
- package/dist/Helpers/CrudHelpers.d.ts +130 -6
- package/dist/Helpers/CrudHelpers.js +304 -12
- package/dist/Helpers/CrudNarrowPick.d.ts +83 -0
- package/dist/Helpers/CrudNarrowPick.js +157 -0
- package/dist/Helpers/CrudRowForms.d.ts +15 -0
- package/dist/Helpers/CrudRowForms.js +43 -0
- package/dist/Helpers/CrudScopes.d.ts +32 -0
- package/dist/Helpers/CrudScopes.js +79 -0
- package/dist/Helpers/DropdownHelpers.d.ts +3 -1
- package/dist/Helpers/DropdownHelpers.js +6 -2
- package/dist/Helpers/ExcelHelpers.d.ts +1 -1
- package/dist/Helpers/ExcelHelpers.js +12 -11
- package/dist/Helpers/FileAdapter.d.ts +78 -0
- package/dist/Helpers/FileAdapter.js +102 -0
- package/dist/Helpers/FilePrimaries.d.ts +48 -0
- package/dist/Helpers/FilePrimaries.js +138 -0
- package/dist/Helpers/FormConfirm.d.ts +32 -0
- package/dist/Helpers/FormConfirm.js +40 -0
- package/dist/Helpers/FormStore.d.ts +90 -5
- package/dist/Helpers/FormStore.js +318 -22
- package/dist/Helpers/InputConditions.d.ts +50 -0
- package/dist/Helpers/InputConditions.js +168 -0
- package/dist/Helpers/InputMemory.d.ts +106 -0
- package/dist/Helpers/InputMemory.js +385 -0
- package/dist/Helpers/InputNarrowing.d.ts +18 -0
- package/dist/Helpers/InputNarrowing.js +67 -0
- package/dist/Helpers/InputParamsHelpers.d.ts +44 -1
- package/dist/Helpers/InputParamsHelpers.js +162 -71
- package/dist/Helpers/MessageBuilder.js +2 -0
- package/dist/Helpers/NexusDriveAdapter.d.ts +55 -0
- package/dist/Helpers/NexusDriveAdapter.js +207 -0
- package/dist/Helpers/NexusHelpers.d.ts +0 -0
- package/dist/Helpers/NexusHelpers.js +1 -0
- package/dist/Helpers/NumberHelpers.d.ts +95 -0
- package/dist/Helpers/NumberHelpers.js +126 -0
- package/dist/Helpers/Permissions.js +2 -1
- package/dist/Helpers/QrCode.d.ts +26 -0
- package/dist/Helpers/QrCode.js +463 -0
- package/dist/Helpers/RecordCards.d.ts +205 -0
- package/dist/Helpers/RecordCards.js +378 -0
- package/dist/Helpers/RequestCache.d.ts +47 -0
- package/dist/Helpers/RequestCache.js +132 -0
- package/dist/Helpers/RowsStore.d.ts +37 -2
- package/dist/Helpers/RowsStore.js +128 -10
- package/dist/Helpers/ServerPreview.d.ts +69 -0
- package/dist/Helpers/ServerPreview.js +99 -0
- package/dist/Helpers/TableColumns.js +4 -3
- package/dist/Helpers/TableExport.d.ts +7 -1
- package/dist/Helpers/TableExport.js +21 -15
- package/dist/Helpers/TableFilters.d.ts +1 -1
- package/dist/Helpers/TableFilters.js +24 -23
- package/dist/Helpers/TableHelpers.d.ts +24 -3
- package/dist/Helpers/TableHelpers.js +58 -12
- package/dist/Helpers/TableJoins.d.ts +83 -0
- package/dist/Helpers/TableJoins.js +284 -0
- package/dist/Helpers/TableStore.d.ts +26 -1
- package/dist/Helpers/TableStore.js +73 -7
- package/dist/Helpers/TreeStore.d.ts +306 -11
- package/dist/Helpers/TreeStore.js +1048 -90
- package/dist/Helpers/UserPreferences.d.ts +8 -0
- package/dist/Helpers/UserPreferences.js +17 -0
- package/dist/Interfaces/CrudInterfaces.d.ts +512 -14
- package/dist/Interfaces/FileInterfaces.d.ts +162 -0
- package/dist/Interfaces/FileInterfaces.js +4 -0
- package/dist/Interfaces/FormInterfaces.d.ts +393 -29
- package/dist/Interfaces/FormInterfaces.js +79 -1
- package/dist/Interfaces/InputInterfaces.d.ts +39 -3
- package/dist/Interfaces/MessageInterfaces.d.ts +1 -1
- package/dist/Interfaces/PreferenceInterfaces.d.ts +8 -0
- package/dist/Interfaces/PreferenceInterfaces.js +2 -5
- package/dist/Interfaces/RecordInterfaces.d.ts +367 -0
- package/dist/Interfaces/RecordInterfaces.js +1 -0
- package/dist/Interfaces/TableInterfaces.d.ts +160 -5
- package/dist/Services/ApiProxy.d.ts +36 -1
- package/dist/Services/ApiProxy.js +182 -52
- package/dist/Services/ApiProxyRules.d.ts +203 -0
- package/dist/Services/ApiProxyRules.js +426 -0
- package/dist/Services/ExcelApi.js +5 -0
- package/dist/Services/FileApi.d.ts +13 -0
- package/dist/Services/FileApi.js +29 -0
- package/dist/Services/ImageEditorLoader.d.ts +14 -0
- package/dist/Services/ImageEditorLoader.js +51 -0
- package/dist/Services/JoinSources.d.ts +80 -0
- package/dist/Services/JoinSources.js +150 -0
- package/dist/Services/ModuleImport.d.ts +7 -0
- package/dist/Services/ModuleImport.js +22 -0
- package/dist/Services/ServerApi.d.ts +13 -2
- package/dist/Services/ServerApi.js +8 -3
- package/dist/Shared.Index.d.ts +20 -0
- package/dist/Shared.Index.js +20 -0
- package/package.json +92 -85
- package/src/Styles/Nexus.Avatar.css +80 -79
- package/src/Styles/Nexus.Base.css +117 -117
- package/src/Styles/Nexus.Button.css +186 -180
- package/src/Styles/Nexus.Calendar.css +273 -273
- package/src/Styles/Nexus.Chat.css +1443 -1443
- package/src/Styles/Nexus.Choice.css +359 -343
- package/src/Styles/Nexus.Crud.css +542 -168
- package/src/Styles/Nexus.DateTime.css +81 -81
- package/src/Styles/Nexus.Dropdown.css +733 -725
- package/src/Styles/Nexus.Editor.css +295 -295
- package/src/Styles/Nexus.Excel.css +389 -389
- package/src/Styles/Nexus.Files.css +410 -0
- package/src/Styles/Nexus.Form.css +282 -279
- package/src/Styles/Nexus.Index.css +41 -37
- package/src/Styles/Nexus.Input.css +238 -4
- package/src/Styles/Nexus.Markdown.css +237 -237
- package/src/Styles/Nexus.Menu.css +246 -237
- package/src/Styles/Nexus.Popup.css +800 -724
- package/src/Styles/Nexus.Print.css +288 -0
- package/src/Styles/Nexus.QrCode.css +12 -0
- package/src/Styles/Nexus.Record.css +430 -0
- package/src/Styles/Nexus.Rows.css +637 -637
- package/src/Styles/Nexus.Slider.css +276 -276
- package/src/Styles/Nexus.Tab.Buttons.css +497 -432
- package/src/Styles/Nexus.Table.css +98 -35
- package/src/Styles/Nexus.Theme.Picker.css +59 -3
- package/src/Styles/Nexus.Themes.css +200 -194
- package/src/Styles/Nexus.Time.css +144 -144
- package/src/Styles/Nexus.Toast.css +263 -263
- package/src/Styles/Nexus.Tokens.css +94 -89
- package/src/Styles/Nexus.Tree.css +530 -431
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A record's fields in sections: each run of neighbouring columns that name the same `group` is one section under that
|
|
3
|
+
* heading, and a run of columns with no group is a section with none. A group named again further on starts a new run,
|
|
4
|
+
* as a table's band does. An empty group name counts as none.
|
|
5
|
+
*/
|
|
6
|
+
export function crudDetailsRuns(columns) {
|
|
7
|
+
const runs = [];
|
|
8
|
+
for (const column of columns) {
|
|
9
|
+
const group = column.group || null;
|
|
10
|
+
const last = runs[runs.length - 1];
|
|
11
|
+
if (last && last.group === group)
|
|
12
|
+
last.columns.push(column);
|
|
13
|
+
else
|
|
14
|
+
runs.push({ group, columns: [column] });
|
|
15
|
+
}
|
|
16
|
+
return runs;
|
|
17
|
+
}
|
|
18
|
+
/** Whether the form asks before this save: a `confirm` is given, and its `when` holds for the values (or it has none). */
|
|
19
|
+
export function formConfirmAsks(confirm, values) {
|
|
20
|
+
if (!confirm)
|
|
21
|
+
return false;
|
|
22
|
+
return confirm.when ? Boolean(confirm.when(values)) : true;
|
|
23
|
+
}
|
|
24
|
+
const settle = (text, values, body) => typeof text === "function" ? text(values, body) : text;
|
|
25
|
+
/**
|
|
26
|
+
* The question for these values and this body: each text worked out from them, the details drawn when given (a null
|
|
27
|
+
* answer draws none), "Confirm and save" and "Back to the form" unless given, and the width `lg` with details (two
|
|
28
|
+
* fields to a line) or `sm` without, unless given. A rule that throws throws here, before anything is shown.
|
|
29
|
+
*/
|
|
30
|
+
export function formConfirmQuestion(confirm, values, body) {
|
|
31
|
+
const details = confirm.details?.(values, body) ?? null;
|
|
32
|
+
return {
|
|
33
|
+
title: settle(confirm.title, values, body),
|
|
34
|
+
message: confirm.message === undefined ? null : settle(confirm.message, values, body),
|
|
35
|
+
details,
|
|
36
|
+
confirmLabel: confirm.confirmLabel === undefined ? "Confirm and save" : settle(confirm.confirmLabel, values, body),
|
|
37
|
+
cancelLabel: confirm.cancelLabel ?? "Back to the form",
|
|
38
|
+
size: confirm.size ?? (details ? "lg" : "sm"),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FormErrors, FormRuleResult, FormValues, InputParams, InputValidationContext } from "../Interfaces/FormInterfaces.ts";
|
|
2
|
+
import { type InputMemoryStorage } from "./InputMemory.ts";
|
|
2
3
|
export interface FormStoreOptions<TValues extends FormValues = FormValues> {
|
|
3
4
|
inputs: readonly InputParams[];
|
|
4
5
|
validate?(values: TValues): FormRuleResult;
|
|
@@ -58,6 +59,21 @@ export declare class FormStore<TValues extends FormValues = FormValues> {
|
|
|
58
59
|
private inputByName;
|
|
59
60
|
private values;
|
|
60
61
|
private initial;
|
|
62
|
+
/** The values the last load was given, as given: an input they name with a value is the form's own, never remembered. */
|
|
63
|
+
private given;
|
|
64
|
+
/** Where remembered inputs (`remember`) are read and kept; set by the form that draws this store, in the browser. */
|
|
65
|
+
private memory;
|
|
66
|
+
/** Pickers asked whether they still offer a remembered value; the next opening (a load, a reset) or a submit stops it. */
|
|
67
|
+
private memoryRound;
|
|
68
|
+
/** The inputs whose picker is being asked: drawn loading, and a change to one (the person's pick, code) ends its ask. */
|
|
69
|
+
private asking;
|
|
70
|
+
/** The values memory opened inputs on: an opening that finds nothing (a reset after the choice went) takes its own back. */
|
|
71
|
+
private fromMemory;
|
|
72
|
+
/**
|
|
73
|
+
* The values a load (or a reset, a draft) is working out, while it works them out: what `get` answers then, so an
|
|
74
|
+
* input's live `hidden` (`showWhen`) is judged on the values the form opens with, never on the ones it had before.
|
|
75
|
+
*/
|
|
76
|
+
private reading;
|
|
61
77
|
private isStarted;
|
|
62
78
|
private ruleErrors;
|
|
63
79
|
/** Rows inputs are checked when asked: 10,000 rows on every keystroke would be slow, and the rows check themselves. */
|
|
@@ -87,6 +103,8 @@ export declare class FormStore<TValues extends FormValues = FormValues> {
|
|
|
87
103
|
private draftDropped;
|
|
88
104
|
/** An input reported a value while the values loaded and was refused: it is drawn again from the store when loading ends. */
|
|
89
105
|
private refusedWhileLoading;
|
|
106
|
+
/** What a choice input reported beside the value the user picked last (`pickedItem`): its item, kept with that value. */
|
|
107
|
+
private picked;
|
|
90
108
|
/** A load during a render tells nobody; `announce` does, once the form has mounted. */
|
|
91
109
|
private quiet;
|
|
92
110
|
private unannounced;
|
|
@@ -100,6 +118,8 @@ export declare class FormStore<TValues extends FormValues = FormValues> {
|
|
|
100
118
|
/** Every value, plus the fields the record came with. The same object until something changes; do not change it. */
|
|
101
119
|
getValue(): TValues;
|
|
102
120
|
get(name: string): unknown;
|
|
121
|
+
/** The params of the input of this name, as the form was given them; undefined for a name no input has. */
|
|
122
|
+
inputParams(name: string): InputParams | undefined;
|
|
103
123
|
/** The values the form opened with, or saved last. */
|
|
104
124
|
getInitial(): TValues;
|
|
105
125
|
/** Only the values that differ from the ones the form opened with or saved last. */
|
|
@@ -107,11 +127,23 @@ export declare class FormStore<TValues extends FormValues = FormValues> {
|
|
|
107
127
|
/** The inputs whose values changed, in form order. */
|
|
108
128
|
changedInputs(): string[];
|
|
109
129
|
isChanged(): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Whether the changes are worth asking about before they are dropped (Cancel, closing a popup, leaving the page): a
|
|
132
|
+
* changed value of any input but a password or a one-time code (`keepsTyping`). A form where only those were typed is
|
|
133
|
+
* changed, and Save and its line say so, but nothing asks before it goes.
|
|
134
|
+
*/
|
|
135
|
+
isWorthKeeping(): boolean;
|
|
110
136
|
getStatus: () => FormStatus;
|
|
111
137
|
/** The message an input shows for the form: a server's, the form's rule once the input was left or a submit ran, or its own rule after a submit its input missed. */
|
|
112
138
|
shownError(name: string): string | undefined;
|
|
113
139
|
/** The shown message, with the form's rule messages given, such as the ones before a change. */
|
|
114
140
|
private shownWith;
|
|
141
|
+
/**
|
|
142
|
+
* The item a choice input reported with the value it holds now, when the user picked that value: a dropdown's option
|
|
143
|
+
* (its options, with `multiple`). `undefined` for a value loaded, set from code, or changed since - so what it answers
|
|
144
|
+
* always goes with the value. A CRUD names what a save joined from it (`crudJoinedNames`).
|
|
145
|
+
*/
|
|
146
|
+
pickedItem(name: string): unknown;
|
|
115
147
|
/** The input's own rule message for its value, whether it shows or not. */
|
|
116
148
|
ruleError(name: string): string | null;
|
|
117
149
|
/** The form's own rule message for an input, whether it shows or not. */
|
|
@@ -152,17 +184,21 @@ export declare class FormStore<TValues extends FormValues = FormValues> {
|
|
|
152
184
|
/** Tells listeners about a quiet load. */
|
|
153
185
|
announce(): void;
|
|
154
186
|
private loadValues;
|
|
155
|
-
/**
|
|
187
|
+
/**
|
|
188
|
+
* Brings back the values the form opened with or saved last, and clears every message. The draft goes too. A
|
|
189
|
+
* remembered input opens on the choice kept now, so a form reset after a save starts on what was just saved.
|
|
190
|
+
*/
|
|
156
191
|
reset(): void;
|
|
157
192
|
/** Sets a value from code. Its input shows it at once, and it counts as a change. */
|
|
158
193
|
set(name: string, value: unknown): void;
|
|
159
194
|
/** Sets several values from code, as one change. */
|
|
160
195
|
setValues(values: Partial<TValues>): void;
|
|
161
196
|
/**
|
|
162
|
-
* A value the user typed or picked, from the input rendered with `stamp
|
|
163
|
-
*
|
|
197
|
+
* A value the user typed or picked, from the input rendered with `stamp`, with what a choice input reported beside it
|
|
198
|
+
* (`item`: a dropdown's option, kept for `pickedItem`). An input that was replaced since (by a value from code, a load,
|
|
199
|
+
* or a reset) can still report its last value as it leaves; that value is ignored.
|
|
164
200
|
*/
|
|
165
|
-
input(name: string, value: unknown, stamp: string): void;
|
|
201
|
+
input(name: string, value: unknown, stamp: string, item?: unknown): void;
|
|
166
202
|
/** Marks an input as left by the user: the form's rule messages on it show from now on. */
|
|
167
203
|
touch(name: string): void;
|
|
168
204
|
/**
|
|
@@ -199,6 +235,28 @@ export declare class FormStore<TValues extends FormValues = FormValues> {
|
|
|
199
235
|
* `extra` (from the server, such as a new id) is set on top.
|
|
200
236
|
*/
|
|
201
237
|
commit(saved: TValues, extra?: Partial<TValues>): void;
|
|
238
|
+
/**
|
|
239
|
+
* @internal Whether the input's picker is being asked whether it still offers a remembered value: the input draws
|
|
240
|
+
* loading until it answers, the person picks, or the form opens again.
|
|
241
|
+
*/
|
|
242
|
+
isRemembering(name: string): boolean;
|
|
243
|
+
/**
|
|
244
|
+
* @internal The browser storage remembered inputs read and keep (`InputLayoutParams.remember`), set by the form that
|
|
245
|
+
* draws this store once it is in the browser. Inputs the values left without one open on it at once (as the values
|
|
246
|
+
* the form opened with), a picker once it answers that it still offers the value; a form drawn on a server opened
|
|
247
|
+
* without it, so nothing differs while it hydrates.
|
|
248
|
+
*/
|
|
249
|
+
attachMemory(storage: InputMemoryStorage | null): void;
|
|
250
|
+
/**
|
|
251
|
+
* Inputs that follow ones memory opened (`dependsOn`: a `compute.from`, `showWhen`, `spanWhen`, `labelWhen`, or a
|
|
252
|
+
* `narrowedBy`) draw again with their params read afresh, as after a change: a cell redraws only on its own bump.
|
|
253
|
+
*/
|
|
254
|
+
private bumpFollowers;
|
|
255
|
+
/**
|
|
256
|
+
* @internal A save: each remembered input keeps the value saved (an empty one forgets), for the next form that asks -
|
|
257
|
+
* under the saved values' `per` value, and only where its `when` holds on them.
|
|
258
|
+
*/
|
|
259
|
+
rememberSaved(values: TValues): void;
|
|
202
260
|
/** @internal A save after which the form went back to its opening values (`resetOnSuccess`). */
|
|
203
261
|
markSaved(): void;
|
|
204
262
|
/** @internal While the values load, nothing typed is taken (`input`), and a submit waits (`SubmitForm`). */
|
|
@@ -210,10 +268,37 @@ export declare class FormStore<TValues extends FormValues = FormValues> {
|
|
|
210
268
|
private indexInputs;
|
|
211
269
|
/** Each input's value in the type the input reports; a missing one is the input's default. Other fields stay as they came. */
|
|
212
270
|
private normalize;
|
|
271
|
+
/** Runs `work` with `get` answering from these values (a load's, a reset's, a draft's), and gives back its answer. */
|
|
272
|
+
private readingFrom;
|
|
273
|
+
/**
|
|
274
|
+
* The values with each remembered input the given values leave without one opened on the company's preferred value
|
|
275
|
+
* or the person's last choice (`rememberedOpeningNow`), its `when` and `per` read among these values; without storage
|
|
276
|
+
* (on a server, before the form is drawn) only a preferred value applies. A kept choice no longer offered is forgotten.
|
|
277
|
+
* A picker that must be asked first opens nothing now: it is asked, and its answer opens the input later
|
|
278
|
+
* (`askPickers`) - the round any earlier opening started stops here. An input memory opened before (a reset after a
|
|
279
|
+
* save, the storage arriving) that now opens on nothing takes the value the given values give it back.
|
|
280
|
+
*/
|
|
281
|
+
private openRemembered;
|
|
282
|
+
/** Stops asking pickers about remembered values: their answers no longer open anything, and their inputs stop loading. */
|
|
283
|
+
private stopAskingPickers;
|
|
284
|
+
/**
|
|
285
|
+
* Asks each picker whether it still offers the remembered value (`findRememberedOpening`), the input drawn loading
|
|
286
|
+
* meanwhile. An answer forgets a choice no longer offered, and opens an offered one (`openAsked`) only while the input
|
|
287
|
+
* is still asked about - no pick, no value from code since - and the values it was judged on (`rememberDependencies`:
|
|
288
|
+
* the group that narrows it, the one it is kept per, its `when`) are still the form's: a group changed meanwhile opens
|
|
289
|
+
* nothing.
|
|
290
|
+
*/
|
|
291
|
+
private askPickers;
|
|
292
|
+
/**
|
|
293
|
+
* A picker answered for a remembered value: the input opens on it, as the value the form opened with (not a change) -
|
|
294
|
+
* only while it is as the form opened it and still on the form. One the person typed in, or a draft gave back, keeps
|
|
295
|
+
* what it has.
|
|
296
|
+
*/
|
|
297
|
+
private openAsked;
|
|
213
298
|
/** Inputs that were not there, or were hidden, get their value in the input's type, as a load gives it. */
|
|
214
299
|
private adoptNewInputs;
|
|
215
300
|
private change;
|
|
216
|
-
/** The inputs whose `dependsOn` names any of `names`. */
|
|
301
|
+
/** The inputs whose `dependsOn` (or `narrowedBy`) names any of `names`. */
|
|
217
302
|
private followersOf;
|
|
218
303
|
private checkRule;
|
|
219
304
|
private checkAllRules;
|