@20baht/ui 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +512 -2
- package/dist/components/baht-form.d.ts +206 -0
- package/dist/components/baht-form.js +630 -0
- package/dist/components/baht-workflow.d.ts +187 -0
- package/dist/components/baht-workflow.js +455 -0
- package/dist/components/base.d.ts +92 -0
- package/dist/components/base.js +138 -0
- package/dist/components/combobox-controller.d.ts +65 -0
- package/dist/components/combobox-controller.js +82 -0
- package/dist/components/define.d.ts +7 -0
- package/dist/components/define.js +16 -0
- package/dist/components/field-base.d.ts +84 -0
- package/dist/components/field-base.js +152 -0
- package/dist/components/floating.d.ts +84 -0
- package/dist/components/floating.js +182 -0
- package/dist/components/form-layout.d.ts +39 -0
- package/dist/components/form-layout.js +67 -0
- package/dist/components/form-options.d.ts +39 -0
- package/dist/components/form-options.js +65 -0
- package/dist/components/form-readonly.d.ts +20 -0
- package/dist/components/form-readonly.js +70 -0
- package/dist/components/layers.d.ts +4 -0
- package/dist/components/layers.js +15 -0
- package/dist/components/menu-controller.d.ts +65 -0
- package/dist/components/menu-controller.js +134 -0
- package/dist/components/motion.d.ts +9 -0
- package/dist/components/motion.js +16 -0
- package/dist/components/primitives/baht-accordion.d.ts +29 -0
- package/dist/components/primitives/baht-accordion.js +66 -0
- package/dist/components/primitives/baht-alert.d.ts +20 -0
- package/dist/components/primitives/baht-alert.js +62 -0
- package/dist/components/primitives/baht-app-shell.d.ts +81 -0
- package/dist/components/primitives/baht-app-shell.js +161 -0
- package/dist/components/primitives/baht-approval-chain.d.ts +59 -0
- package/dist/components/primitives/baht-approval-chain.js +80 -0
- package/dist/components/primitives/baht-avatar.d.ts +19 -0
- package/dist/components/primitives/baht-avatar.js +43 -0
- package/dist/components/primitives/baht-badge.d.ts +24 -0
- package/dist/components/primitives/baht-badge.js +41 -0
- package/dist/components/primitives/baht-bar-chart.d.ts +78 -0
- package/dist/components/primitives/baht-bar-chart.js +361 -0
- package/dist/components/primitives/baht-breadcrumbs.d.ts +23 -0
- package/dist/components/primitives/baht-breadcrumbs.js +45 -0
- package/dist/components/primitives/baht-button.d.ts +89 -0
- package/dist/components/primitives/baht-button.js +146 -0
- package/dist/components/primitives/baht-calendar.d.ts +96 -0
- package/dist/components/primitives/baht-calendar.js +398 -0
- package/dist/components/primitives/baht-card.d.ts +34 -0
- package/dist/components/primitives/baht-card.js +70 -0
- package/dist/components/primitives/baht-catalog-card.d.ts +52 -0
- package/dist/components/primitives/baht-catalog-card.js +90 -0
- package/dist/components/primitives/baht-checkbox.d.ts +7 -0
- package/dist/components/primitives/baht-checkbox.js +40 -0
- package/dist/components/primitives/baht-choice-group.d.ts +52 -0
- package/dist/components/primitives/baht-choice-group.js +71 -0
- package/dist/components/primitives/baht-code.d.ts +18 -0
- package/dist/components/primitives/baht-code.js +33 -0
- package/dist/components/primitives/baht-column-picker.d.ts +69 -0
- package/dist/components/primitives/baht-column-picker.js +234 -0
- package/dist/components/primitives/baht-comments.d.ts +38 -0
- package/dist/components/primitives/baht-comments.js +102 -0
- package/dist/components/primitives/baht-currency.d.ts +13 -0
- package/dist/components/primitives/baht-currency.js +69 -0
- package/dist/components/primitives/baht-datepicker.d.ts +77 -0
- package/dist/components/primitives/baht-datepicker.js +235 -0
- package/dist/components/primitives/baht-donut-chart.d.ts +24 -0
- package/dist/components/primitives/baht-donut-chart.js +88 -0
- package/dist/components/primitives/baht-edit-table.d.ts +45 -0
- package/dist/components/primitives/baht-edit-table.js +176 -0
- package/dist/components/primitives/baht-empty-state.d.ts +26 -0
- package/dist/components/primitives/baht-empty-state.js +51 -0
- package/dist/components/primitives/baht-error-state.d.ts +21 -0
- package/dist/components/primitives/baht-error-state.js +44 -0
- package/dist/components/primitives/baht-facts.d.ts +42 -0
- package/dist/components/primitives/baht-facts.js +49 -0
- package/dist/components/primitives/baht-fieldset.d.ts +19 -0
- package/dist/components/primitives/baht-fieldset.js +42 -0
- package/dist/components/primitives/baht-file.d.ts +27 -0
- package/dist/components/primitives/baht-file.js +158 -0
- package/dist/components/primitives/baht-filter-builder.d.ts +39 -0
- package/dist/components/primitives/baht-filter-builder.js +201 -0
- package/dist/components/primitives/baht-filter.d.ts +36 -0
- package/dist/components/primitives/baht-filter.js +64 -0
- package/dist/components/primitives/baht-heatmap.d.ts +49 -0
- package/dist/components/primitives/baht-heatmap.js +168 -0
- package/dist/components/primitives/baht-input.d.ts +10 -0
- package/dist/components/primitives/baht-input.js +44 -0
- package/dist/components/primitives/baht-keyvalue-editor.d.ts +28 -0
- package/dist/components/primitives/baht-keyvalue-editor.js +106 -0
- package/dist/components/primitives/baht-line-chart.d.ts +45 -0
- package/dist/components/primitives/baht-line-chart.js +183 -0
- package/dist/components/primitives/baht-link.d.ts +26 -0
- package/dist/components/primitives/baht-link.js +48 -0
- package/dist/components/primitives/baht-list.d.ts +29 -0
- package/dist/components/primitives/baht-list.js +79 -0
- package/dist/components/primitives/baht-loading-overlay.d.ts +15 -0
- package/dist/components/primitives/baht-loading-overlay.js +33 -0
- package/dist/components/primitives/baht-markdown-view.d.ts +17 -0
- package/dist/components/primitives/baht-markdown-view.js +39 -0
- package/dist/components/primitives/baht-markdown.d.ts +34 -0
- package/dist/components/primitives/baht-markdown.js +177 -0
- package/dist/components/primitives/baht-menu.d.ts +53 -0
- package/dist/components/primitives/baht-menu.js +100 -0
- package/dist/components/primitives/baht-meter.d.ts +67 -0
- package/dist/components/primitives/baht-meter.js +107 -0
- package/dist/components/primitives/baht-modal.d.ts +71 -0
- package/dist/components/primitives/baht-modal.js +164 -0
- package/dist/components/primitives/baht-multiselect.d.ts +8 -0
- package/dist/components/primitives/baht-multiselect.js +47 -0
- package/dist/components/primitives/baht-notification-bell.d.ts +54 -0
- package/dist/components/primitives/baht-notification-bell.js +143 -0
- package/dist/components/primitives/baht-number.d.ts +5 -0
- package/dist/components/primitives/baht-number.js +39 -0
- package/dist/components/primitives/baht-order-box.d.ts +24 -0
- package/dist/components/primitives/baht-order-box.js +50 -0
- package/dist/components/primitives/baht-otp.d.ts +49 -0
- package/dist/components/primitives/baht-otp.js +109 -0
- package/dist/components/primitives/baht-page-header.d.ts +43 -0
- package/dist/components/primitives/baht-page-header.js +78 -0
- package/dist/components/primitives/baht-pagination.d.ts +33 -0
- package/dist/components/primitives/baht-pagination.js +86 -0
- package/dist/components/primitives/baht-popover.d.ts +45 -0
- package/dist/components/primitives/baht-popover.js +112 -0
- package/dist/components/primitives/baht-progress-ring.d.ts +22 -0
- package/dist/components/primitives/baht-progress-ring.js +62 -0
- package/dist/components/primitives/baht-progress.d.ts +17 -0
- package/dist/components/primitives/baht-progress.js +48 -0
- package/dist/components/primitives/baht-radio.d.ts +7 -0
- package/dist/components/primitives/baht-radio.js +74 -0
- package/dist/components/primitives/baht-range.d.ts +38 -0
- package/dist/components/primitives/baht-range.js +88 -0
- package/dist/components/primitives/baht-rating.d.ts +40 -0
- package/dist/components/primitives/baht-rating.js +107 -0
- package/dist/components/primitives/baht-record-bar.d.ts +30 -0
- package/dist/components/primitives/baht-record-bar.js +60 -0
- package/dist/components/primitives/baht-reference-dialog.d.ts +87 -0
- package/dist/components/primitives/baht-reference-dialog.js +418 -0
- package/dist/components/primitives/baht-reference-picker.d.ts +110 -0
- package/dist/components/primitives/baht-reference-picker.js +321 -0
- package/dist/components/primitives/baht-repeater.d.ts +59 -0
- package/dist/components/primitives/baht-repeater.js +315 -0
- package/dist/components/primitives/baht-rule-builder.d.ts +24 -0
- package/dist/components/primitives/baht-rule-builder.js +177 -0
- package/dist/components/primitives/baht-saved-filters.d.ts +41 -0
- package/dist/components/primitives/baht-saved-filters.js +126 -0
- package/dist/components/primitives/baht-search.d.ts +34 -0
- package/dist/components/primitives/baht-search.js +71 -0
- package/dist/components/primitives/baht-section-header.d.ts +28 -0
- package/dist/components/primitives/baht-section-header.js +48 -0
- package/dist/components/primitives/baht-section.d.ts +23 -0
- package/dist/components/primitives/baht-section.js +49 -0
- package/dist/components/primitives/baht-select.d.ts +49 -0
- package/dist/components/primitives/baht-select.js +197 -0
- package/dist/components/primitives/baht-skeleton.d.ts +16 -0
- package/dist/components/primitives/baht-skeleton.js +37 -0
- package/dist/components/primitives/baht-sparkline.d.ts +23 -0
- package/dist/components/primitives/baht-sparkline.js +56 -0
- package/dist/components/primitives/baht-spinner.d.ts +13 -0
- package/dist/components/primitives/baht-spinner.js +30 -0
- package/dist/components/primitives/baht-split-button.d.ts +43 -0
- package/dist/components/primitives/baht-split-button.js +87 -0
- package/dist/components/primitives/baht-stat-chart.d.ts +14 -0
- package/dist/components/primitives/baht-stat-chart.js +38 -0
- package/dist/components/primitives/baht-stat.d.ts +56 -0
- package/dist/components/primitives/baht-stat.js +117 -0
- package/dist/components/primitives/baht-steps.d.ts +33 -0
- package/dist/components/primitives/baht-steps.js +60 -0
- package/dist/components/primitives/baht-swipe-row.d.ts +64 -0
- package/dist/components/primitives/baht-swipe-row.js +178 -0
- package/dist/components/primitives/baht-table.d.ts +315 -0
- package/dist/components/primitives/baht-table.js +640 -0
- package/dist/components/primitives/baht-tabs.d.ts +54 -0
- package/dist/components/primitives/baht-tabs.js +128 -0
- package/dist/components/primitives/baht-tags.d.ts +96 -0
- package/dist/components/primitives/baht-tags.js +323 -0
- package/dist/components/primitives/baht-text.d.ts +10 -0
- package/dist/components/primitives/baht-text.js +29 -0
- package/dist/components/primitives/baht-textarea.d.ts +5 -0
- package/dist/components/primitives/baht-textarea.js +40 -0
- package/dist/components/primitives/baht-theme-toggle.d.ts +44 -0
- package/dist/components/primitives/baht-theme-toggle.js +101 -0
- package/dist/components/primitives/baht-timeline.d.ts +21 -0
- package/dist/components/primitives/baht-timeline.js +42 -0
- package/dist/components/primitives/baht-toast.d.ts +29 -0
- package/dist/components/primitives/baht-toast.js +83 -0
- package/dist/components/primitives/baht-toggle.d.ts +6 -0
- package/dist/components/primitives/baht-toggle.js +42 -0
- package/dist/components/primitives/baht-tooltip.d.ts +34 -0
- package/dist/components/primitives/baht-tooltip.js +85 -0
- package/dist/components/primitives/baht-tree.d.ts +58 -0
- package/dist/components/primitives/baht-tree.js +159 -0
- package/dist/components/primitives/baht-typeahead.d.ts +92 -0
- package/dist/components/primitives/baht-typeahead.js +258 -0
- package/dist/components/primitives/baht-upload.d.ts +108 -0
- package/dist/components/primitives/baht-upload.js +325 -0
- package/dist/components/primitives/baht-wizard.d.ts +57 -0
- package/dist/components/primitives/baht-wizard.js +147 -0
- package/dist/components/primitives/charts.d.ts +134 -0
- package/dist/components/primitives/charts.js +184 -0
- package/dist/components/primitives/column-map.d.ts +56 -0
- package/dist/components/primitives/column-map.js +70 -0
- package/dist/components/primitives/control-icons.d.ts +2 -0
- package/dist/components/primitives/control-icons.js +40 -0
- package/dist/components/primitives/icons.d.ts +24 -0
- package/dist/components/primitives/icons.js +86 -0
- package/dist/components/primitives/illustrations.d.ts +21 -0
- package/dist/components/primitives/illustrations.js +78 -0
- package/dist/components/primitives/index.d.ts +89 -0
- package/dist/components/primitives/kbd.d.ts +6 -0
- package/dist/components/primitives/kbd.js +9 -0
- package/dist/components/primitives/listbox.d.ts +2 -0
- package/dist/components/primitives/listbox.js +7 -0
- package/dist/components/primitives/markdown-render.d.ts +9 -0
- package/dist/components/primitives/markdown-render.js +77 -0
- package/dist/components/primitives/rule-rows.d.ts +55 -0
- package/dist/components/primitives/rule-rows.js +75 -0
- package/dist/components/primitives/tag-map.d.ts +6 -0
- package/dist/components/primitives/tag-map.js +39 -0
- package/dist/components/reference-labels.d.ts +22 -0
- package/dist/components/reference-labels.js +29 -0
- package/dist/components/shortcuts.d.ts +7 -0
- package/dist/components/shortcuts.js +43 -0
- package/dist/css/components.css +7517 -0
- package/dist/css/datepicker.css +346 -0
- package/dist/css/tokens.css +679 -0
- package/dist/custom-elements.json +45172 -0
- package/dist/engine.d.ts +1 -0
- package/dist/engine.js +1 -0
- package/dist/hydrate.d.ts +9 -0
- package/dist/hydrate.js +46 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +210 -0
- package/dist/overlay.d.ts +50 -0
- package/dist/overlay.js +140 -0
- package/dist/react.d.ts +557 -0
- package/dist/react.js +1 -0
- package/dist/register.d.ts +106 -0
- package/dist/register.js +99 -0
- package/dist/ssr.d.ts +16 -0
- package/dist/ssr.js +125 -0
- package/dist/tokens.css +8197 -0
- package/dist/vscode.css-custom-data.json +6 -0
- package/dist/vscode.html-custom-data.json +2261 -0
- package/dist/web-types.json +6523 -0
- package/package.json +157 -4
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { TemplateResult } from 'lit';
|
|
2
|
+
import { BahtElement } from './base.js';
|
|
3
|
+
import { DerivedFieldState, FeatureFlags, FormDefinition, Registry, ValidationError } from '@20baht/engine';
|
|
4
|
+
export interface BahtFormOptions {
|
|
5
|
+
validateOn?: 'change' | 'blur' | 'submit';
|
|
6
|
+
/** Debounce (ms) for typed fields; unset = BahtFieldBase.defaultDebounce (150). 0 = none. */
|
|
7
|
+
inputDebounce?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* <baht-form> — dumb controlled form renderer (spec 01).
|
|
11
|
+
* JSON in (form + value + registry) -> UI out; emits `baht-change` / `baht-validity`.
|
|
12
|
+
* No buttons, no cross-field logic — that's <baht-workflow> or the host.
|
|
13
|
+
* @fires {CustomEvent<{ form_name: string; key: string; value: unknown; data: Record<string, unknown> }>} baht-change - A field changed (an edit or a script); `data` is the whole form.
|
|
14
|
+
* @fires {CustomEvent<{ valid: boolean; errors: ValidationError[] }>} baht-validity - `validate()` ran.
|
|
15
|
+
* @fires {CustomEvent<{ value: string }>} baht-tab-change - A tab of a tabbed layout was picked.
|
|
16
|
+
* @fires {CustomEvent<{ data: Record<string, unknown> }>} baht-submit - `submit()` (or Enter with `submit-on-enter`) passed `validate()`.
|
|
17
|
+
*/
|
|
18
|
+
export declare class BahtForm extends BahtElement {
|
|
19
|
+
form: FormDefinition;
|
|
20
|
+
/**
|
|
21
|
+
* The starting data, not a live binding: the user's edits sit over it. Setting a new `value`
|
|
22
|
+
* drops the edits to the keys it changes (compared by content) and keeps the rest, so a host
|
|
23
|
+
* that re-feeds a copy of the same data loses nothing. Read the current data with `getData()`
|
|
24
|
+
* or `baht-change`.
|
|
25
|
+
*/
|
|
26
|
+
value: Record<string, unknown>;
|
|
27
|
+
registry: Registry;
|
|
28
|
+
/** Label every non-required field "(optional)" (localized) instead of relying on asterisks alone. */
|
|
29
|
+
showOptional: boolean;
|
|
30
|
+
options: BahtFormOptions;
|
|
31
|
+
/** L2 (workflow) derived per-field UI state, keyed by field key. Optional. */
|
|
32
|
+
fieldStates: Record<string, DerivedFieldState>;
|
|
33
|
+
/**
|
|
34
|
+
* Name of a view from `form.views`. Display-only: when set, only that view's
|
|
35
|
+
* fields are rendered and validated (the user can only fix what they see),
|
|
36
|
+
* but getData() still returns the FULL form — the server always validates
|
|
37
|
+
* the complete schema, views never change the submit payload.
|
|
38
|
+
*/
|
|
39
|
+
view?: string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Feature-flag values (spec 01 §12) — fields whose `flag` is off behave as
|
|
42
|
+
* if they were never in the schema: no render, no validation, no payload.
|
|
43
|
+
*/
|
|
44
|
+
flags: FeatureFlags;
|
|
45
|
+
/** Key of the open tab section; the first one showing when unset or gone. */
|
|
46
|
+
tab: string;
|
|
47
|
+
/** Force every field readonly — a display-only render of this form's own layout/widths. */
|
|
48
|
+
readonly: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Enter in a single-line field (text, email, password, number, currency; never a textarea,
|
|
51
|
+
* and not while an input method is composing) calls `submit()`. Off by default, so a host
|
|
52
|
+
* that binds its own Enter handler does not submit twice.
|
|
53
|
+
*/
|
|
54
|
+
submitOnEnter: boolean;
|
|
55
|
+
/** A save is in flight: every field is disabled, `aria-busy` is set and `submit()` does nothing. */
|
|
56
|
+
busy: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* The session: the edits over `value`, the errors, what scripts set (spec 01 §14). Moved only
|
|
59
|
+
* by `send()` (core/engine/form-session.ts).
|
|
60
|
+
*/
|
|
61
|
+
private session;
|
|
62
|
+
/** Sections folded right now. */
|
|
63
|
+
private folded;
|
|
64
|
+
private get edits();
|
|
65
|
+
private get errors();
|
|
66
|
+
private get fieldMessages();
|
|
67
|
+
private get formMessages();
|
|
68
|
+
/** What the session is told of this element on every step. */
|
|
69
|
+
private sessionInput;
|
|
70
|
+
/**
|
|
71
|
+
* One step of the session: it works out the next state and the events, this element keeps
|
|
72
|
+
* the state and dispatches them in order. `settled` runs between the two.
|
|
73
|
+
*/
|
|
74
|
+
private send;
|
|
75
|
+
private stepping;
|
|
76
|
+
private readonly queued;
|
|
77
|
+
/** The sink of the step now running its scripts; `null` between steps. */
|
|
78
|
+
private stepSink;
|
|
79
|
+
/** The `g` handed to scripts, one per `form`: a handler may keep it and call it later. */
|
|
80
|
+
private scriptContext;
|
|
81
|
+
private g;
|
|
82
|
+
/** Read-only view: labels of reference ids, keyed `lookup\u0000id` (resolved async). */
|
|
83
|
+
private readonly referenceLabels;
|
|
84
|
+
private warnedLookups;
|
|
85
|
+
/** The `form` identity `load` scripts last ran for. */
|
|
86
|
+
private loadedForm;
|
|
87
|
+
/** `options_from` / `options_deps`: what each field has loaded (see form-options.ts). */
|
|
88
|
+
private readonly dynamicOptions;
|
|
89
|
+
/** Unknown `view` values already warned about — avoid re-warning on every render. */
|
|
90
|
+
private warnedViews;
|
|
91
|
+
/** applyFlags result, memoized on (form, flags) identity. */
|
|
92
|
+
private flagCache;
|
|
93
|
+
/**
|
|
94
|
+
* `form` as the host may actually have left it: a framework can connect the element
|
|
95
|
+
* before it binds the property, so internally it is optional until then.
|
|
96
|
+
*/
|
|
97
|
+
private get assignedForm();
|
|
98
|
+
private get effectiveForm();
|
|
99
|
+
protected willUpdate(changed: Map<PropertyKey, unknown>): void;
|
|
100
|
+
/** A step that tells nothing and needs no options refetch: `willUpdate` syncs them itself. */
|
|
101
|
+
private step;
|
|
102
|
+
/** `sortedFields`, memoized on the (flag-resolved form, view) pair it was computed for. */
|
|
103
|
+
private sortedCache;
|
|
104
|
+
private get sortedFields();
|
|
105
|
+
private resolveSortedFields;
|
|
106
|
+
/**
|
|
107
|
+
* Visibility as of the last completed render, by key. A field that was
|
|
108
|
+
* hidden there and is visible now gets `baht-field--revealed` for one
|
|
109
|
+
* render so the stylesheet can fade it in; fields visible from the first
|
|
110
|
+
* render never animate (a form should not shimmer on mount).
|
|
111
|
+
*/
|
|
112
|
+
private lastVisible;
|
|
113
|
+
private nextVisible;
|
|
114
|
+
private tabLayout;
|
|
115
|
+
private selectTab;
|
|
116
|
+
private toggleFold;
|
|
117
|
+
/** After a validate(): when no error can be seen, open the first tab that has one. */
|
|
118
|
+
private openTabWithError;
|
|
119
|
+
private renderTabStrip;
|
|
120
|
+
private revealClass;
|
|
121
|
+
private stateFor;
|
|
122
|
+
/** The row sub-field states of one repeater: `fieldStates` keys starting `key[`. */
|
|
123
|
+
private rowStatesFor;
|
|
124
|
+
/** What each repeater was last handed, so an unchanged render passes the same objects. */
|
|
125
|
+
private readonly rowStatesSeen;
|
|
126
|
+
private readonly rowErrorsSeen;
|
|
127
|
+
private rowErrorsFor;
|
|
128
|
+
/** Defaults that are fresh arrays, kept per descriptor so a re-render hands controls the same one. */
|
|
129
|
+
private readonly defaultsSeen;
|
|
130
|
+
/** `valueFor` for the render path: an unset collection field keeps one default array. */
|
|
131
|
+
private renderValueFor;
|
|
132
|
+
private valueFor;
|
|
133
|
+
/**
|
|
134
|
+
* Keystrokes still in a control's debounce land now: each emits its `baht-change`, as when the
|
|
135
|
+
* field loses focus. `getData()`, `validate()` and `setValue()` do this first, so a read never
|
|
136
|
+
* misses what was typed; `<baht-workflow>` calls it before reading its own data.
|
|
137
|
+
*/
|
|
138
|
+
flushTyped(): void;
|
|
139
|
+
/**
|
|
140
|
+
* Forget keystrokes still in a control's debounce (all, or those of `keys`): the control shows
|
|
141
|
+
* `value` again and nothing is emitted. For a host replacing what the form shows (`restore()`).
|
|
142
|
+
*/
|
|
143
|
+
discardTyped(keys?: readonly string[]): void;
|
|
144
|
+
/** The rendered controls: the direct children of each .baht-field wrapper. */
|
|
145
|
+
private controls;
|
|
146
|
+
/**
|
|
147
|
+
* The whole form's data (not only the view's fields). Pending keystrokes land first, so a read
|
|
148
|
+
* can dispatch their `baht-change` before it returns.
|
|
149
|
+
*/
|
|
150
|
+
getData(): Record<string, unknown>;
|
|
151
|
+
/**
|
|
152
|
+
* Merge values programmatically. Runs each key's `change` scripts (like
|
|
153
|
+
* ServiceNow's g_form.setValue) but emits no `baht-change` — the host
|
|
154
|
+
* already knows, and a store adapter would otherwise loop.
|
|
155
|
+
*/
|
|
156
|
+
setValue(patch: Record<string, unknown>): void;
|
|
157
|
+
/**
|
|
158
|
+
* Drop the user's edits to these keys, so each shows `value` again. For a host that refused an
|
|
159
|
+
* edit and has no new `value` to say so with: `<baht-workflow>` calls it when a rule wrote the
|
|
160
|
+
* field back (spec 02 §4). Emits nothing and runs no scripts.
|
|
161
|
+
*/
|
|
162
|
+
revert(keys: readonly string[]): void;
|
|
163
|
+
/**
|
|
164
|
+
* Full validation pass: validators, then `submit` scripts (spec 01 §14). A
|
|
165
|
+
* script returning `false` blocks; its `addErrorMessage()` calls become
|
|
166
|
+
* `{ key: '$' }` errors so hosts see why.
|
|
167
|
+
*/
|
|
168
|
+
validate(): {
|
|
169
|
+
valid: boolean;
|
|
170
|
+
errors: ValidationError[];
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* The host's Save: `validate()`, then `baht-submit { data }` when it passes. Returns
|
|
174
|
+
* whether it submitted (never while `busy`).
|
|
175
|
+
*/
|
|
176
|
+
submit(): boolean;
|
|
177
|
+
/** `submit-on-enter`: Enter in a single-line control submits (spec 01 §6). */
|
|
178
|
+
private onKeydown;
|
|
179
|
+
reset(): void;
|
|
180
|
+
protected updated(changed: Map<PropertyKey, unknown>): void;
|
|
181
|
+
private onFieldInput;
|
|
182
|
+
/** `validateOn: 'blur'`: validate just the field the user left. */
|
|
183
|
+
private onFieldBlur;
|
|
184
|
+
private renderField;
|
|
185
|
+
/** `registry.references[field.reference]`, with `search` bound to the form's current data. */
|
|
186
|
+
/** A repeater column's lookup: it sees the form's data with its own row on top. */
|
|
187
|
+
private readonly rowLookup;
|
|
188
|
+
private lookupFor;
|
|
189
|
+
/** Read-only view of a reference: its resolved label once known, the raw id until then. */
|
|
190
|
+
private referenceText;
|
|
191
|
+
private uploaderFor;
|
|
192
|
+
private renderFieldMsg;
|
|
193
|
+
/**
|
|
194
|
+
* Resolve the descriptor at event time — it may have changed since the control
|
|
195
|
+
* was first rendered (the same node is reused across renders, see render()).
|
|
196
|
+
*/
|
|
197
|
+
private onControlInput;
|
|
198
|
+
private renderReadonlyField;
|
|
199
|
+
private readonlyContext;
|
|
200
|
+
protected render(): TemplateResult;
|
|
201
|
+
}
|
|
202
|
+
declare global {
|
|
203
|
+
interface HTMLElementTagNameMap {
|
|
204
|
+
'baht-form': BahtForm;
|
|
205
|
+
}
|
|
206
|
+
}
|