@slotted/angular 0.1.0-beta.24 → 0.1.0-beta.25
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/docs/field.json +16 -1
- package/docs/field.md +3 -1
- package/docs/form.json +14 -3
- package/docs/form.md +3 -1
- package/docs/guidelines/forms.md +89 -1
- package/docs/guidelines/index.md +7 -0
- package/fesm2022/slotted-angular-field.mjs +7 -4
- package/fesm2022/slotted-angular-field.mjs.map +1 -1
- package/fesm2022/slotted-angular-form.mjs +26 -3
- package/fesm2022/slotted-angular-form.mjs.map +1 -1
- package/fesm2022/slotted-angular-menu.mjs +9 -3
- package/fesm2022/slotted-angular-menu.mjs.map +1 -1
- package/fesm2022/slotted-angular-saved-views.mjs +1 -1
- package/fesm2022/slotted-angular-saved-views.mjs.map +1 -1
- package/fesm2022/slotted-angular-wizard.mjs +2 -2
- package/fesm2022/slotted-angular-wizard.mjs.map +1 -1
- package/package.json +3 -3
- package/types/slotted-angular-field.d.ts +10 -2
- package/types/slotted-angular-field.d.ts.map +1 -1
- package/types/slotted-angular-form.d.ts +10 -1
- package/types/slotted-angular-form.d.ts.map +1 -1
- package/types/slotted-angular-menu.d.ts +5 -0
- package/types/slotted-angular-menu.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slotted-angular-form.mjs","sources":["../../form/src/form-defaults.ts","../../form/src/form-actions.ts","../../form/src/form.ts","../../form/src/slotted-angular-form.ts"],"sourcesContent":["import { inject, InjectionToken } from '@angular/core';\nimport type { Signal } from '@angular/core';\nimport type { FormErrorEntry, FormErrors } from '@slotted/core/form';\n\n/**\n * When the form checks its own controls. `submit` is the default and\n * re-validates on every change afterwards: telling a reader an answer is wrong\n * before they have finished writing it is noise, and telling them nothing after\n * they have fixed it is worse.\n */\nexport type FormValidate = 'submit' | 'blur' | 'change' | 'none';\n\n/** Where focus goes after a submit that found something wrong. */\nexport type FormErrorFocus = 'summary' | 'control' | 'none';\n\n/** Whether the family renders the summary itself. */\nexport type FormSummaryMode = 'auto' | 'none';\n\n/** How the action row is arranged along the inline axis. */\nexport type FormActionsAlign = 'end' | 'start' | 'between' | 'stretch';\n\nexport interface FormDefaults {\n align: FormActionsAlign;\n errorFocus: FormErrorFocus;\n nativeValidation: boolean;\n summary: FormSummaryMode;\n summaryDescription: string | undefined;\n validate: FormValidate;\n}\n\nconst FALLBACK: FormDefaults = {\n align: 'end',\n errorFocus: 'summary',\n nativeValidation: false,\n summary: 'auto',\n summaryDescription: undefined,\n validate: 'submit',\n};\n\nexport const FORM_DEFAULTS = new InjectionToken<FormDefaults>('slotted form defaults', {\n providedIn: 'root',\n factory: () => FALLBACK,\n});\n\n/**\n * An application decides once how its forms behave: when they validate, where\n * focus goes after a failed submit, and how its action row is arranged. A form\n * that states any of them itself still wins. The summary's heading comes from\n * the language in force (`provideSlotted`).\n */\nexport function provideFormDefaults(defaults: Partial<FormDefaults>) {\n return {\n provide: FORM_DEFAULTS,\n useFactory: (): FormDefaults => ({ ...FALLBACK, ...defaults }),\n };\n}\n\nexport function injectFormDefaults(): FormDefaults {\n return inject(FORM_DEFAULTS);\n}\n\n/** One validation failure Angular reported, as the registry receives it. */\nexport interface FormErrorMessageContext {\n /** The `name` the control is submitted under, which is the key in the group. */\n name: string;\n /** The key `AbstractControl.errors` used — `required`, `minlength`, and so on. */\n key: string;\n /** Whatever the validator put beside the key. */\n detail: unknown;\n}\n\n/**\n * How a Reactive Forms validation failure the application's own validator\n * reports becomes a sentence.\n *\n * Angular's validators report a key and a shape — `{ required: true }`,\n * `{ minlength: { requiredLength: 8, actualLength: 3 } }` — and never a\n * message. The built-in keys (`required`, `email`, `min`, `max`, `minlength`,\n * `maxlength`, `pattern`) are written by the `form` catalog's `errors.*`\n * messages in the language in force; a validator the application adds names\n * its own message here, and an entry for a built-in key replaces the catalog's.\n */\nexport type FormErrorMessages = Record<string, (context: FormErrorMessageContext) => string>;\n\nexport const SL_FORM_ERROR_MESSAGES = new InjectionToken<FormErrorMessages>(\n 'slotted form error messages',\n { providedIn: 'root', factory: () => ({}) },\n);\n\n/** Names the sentences the application's own validators are written as. */\nexport function provideFormErrorMessages(messages: FormErrorMessages) {\n return { provide: SL_FORM_ERROR_MESSAGES, useValue: messages };\n}\n\nexport function injectFormErrorMessages(): FormErrorMessages {\n return inject(SL_FORM_ERROR_MESSAGES);\n}\n\n/**\n * What the summary needs from the form around it.\n *\n * It is an abstract class rather than an import so the two classes can depend\n * on each other without a cycle — the shape `field` and `text-field` already\n * have.\n */\nexport abstract class SlFormOwner {\n abstract readonly entries: Signal<readonly FormErrorEntry[]>;\n abstract readonly errors: Signal<FormErrors>;\n abstract readonly summaryId: Signal<string>;\n abstract readonly resolvedSummaryTitle: Signal<string>;\n abstract readonly resolvedSummaryDescription: Signal<string | undefined>;\n abstract readonly resolvedAlign: Signal<FormActionsAlign>;\n /** Called by whichever summary is on the page, so focus can reach the region. */\n abstract registerSummary(element: HTMLElement | null): void;\n}\n","import { computed, Directive, inject, input } from '@angular/core';\n\nimport { SlFormOwner } from './form-defaults';\nimport type { FormActionsAlign } from './form-defaults';\n\n/**\n * The row a form's actions stand in.\n *\n * `inline` can end-align a row of buttons. What it cannot do without a query\n * the consumer writes for every form is the reflow: below the form's own\n * container width every action takes the whole width, in a column, with the\n * primary one first — a reader's thumb is at the bottom of a phone and their\n * eye at the end of a row.\n */\n@Directive({\n selector: '[slFormActions]',\n standalone: true,\n exportAs: 'slFormActions',\n host: {\n // The family's identifier on the part: its rules reach it by name, never as any descendant.\n 'data-ui': 'form',\n 'data-ui-form': '',\n 'data-part': 'actions',\n 'data-part-actions': '',\n '[attr.data-align]': 'resolvedAlign()',\n },\n})\nexport class SlFormActions {\n /** Defaults to the form's own `align`, then to the token, then to `end`. */\n readonly align = input<FormActionsAlign | undefined>(undefined);\n\n private readonly form = inject(SlFormOwner, { optional: true });\n\n protected readonly resolvedAlign = computed(\n () => this.align() ?? this.form?.resolvedAlign() ?? 'end',\n );\n}\n","import {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n ElementRef,\n forwardRef,\n HostAttributeToken,\n inject,\n input,\n output,\n signal,\n ViewEncapsulation,\n} from '@angular/core';\nimport type { AfterViewInit, OnInit } from '@angular/core';\nimport { ControlContainer } from '@angular/forms';\nimport type { AbstractControl, FormArray, FormGroup } from '@angular/forms';\nimport { injectMessages } from '@slotted/angular/i18n';\nimport {\n collectValidity,\n hasErrors,\n isDirty,\n mergeErrors,\n namedControls,\n normaliseErrors,\n orderErrors,\n withoutError,\n} from '@slotted/core/form';\nimport type { FormErrorInput, FormErrors } from '@slotted/core/form';\nimport { formMessages, type FormMessages, type PartialMessages } from '@slotted/core/i18n';\nimport { createControllable } from '@slotted/core/state';\nimport type { ChangeReason, ChangeRequest } from '@slotted/core/state';\n\nimport { injectFormDefaults, injectFormErrorMessages, SlFormOwner } from './form-defaults';\nimport type {\n FormActionsAlign,\n FormErrorFocus,\n FormSummaryMode,\n FormValidate,\n} from './form-defaults';\n\nexport type {\n FormActionsAlign,\n FormDefaults,\n FormErrorFocus,\n FormErrorMessageContext,\n FormErrorMessages,\n FormSummaryMode,\n FormValidate,\n} from './form-defaults';\n\nlet summaryCounter = 0;\n\n/**\n * The summary of everything wrong with the form: a focusable region with a\n * heading, and a link per error pointing at the control it is about.\n *\n * It is the GOV.UK error summary, item for item — \"move keyboard focus to the\n * error summary\", \"include the heading\", \"link to each of the answers that have\n * validation errors\", \"make sure the error messages in the error summary are\n * worded the same as those which appear next to the inputs\". The last one is\n * free here: one map feeds the summary and the field.\n *\n * The form renders this itself under `summary=\"auto\"`. A consumer who wants it\n * somewhere else writes `summary=\"none\"` and puts `slFormSummary` on their own\n * element.\n */\n@Component({\n selector: '[slFormSummary]',\n standalone: true,\n exportAs: 'slFormSummary',\n template: `<h2 data-part=\"summary-title\" data-part-summary-title=\"\" [attr.id]=\"form.summaryId()\">\n {{ form.resolvedSummaryTitle() }}\n </h2>\n @if (form.resolvedSummaryDescription(); as description) {\n <p>{{ description }}</p>\n }\n <ul data-part=\"summary-list\" data-part-summary-list=\"\">\n @for (entry of form.entries(); track entry.name) {\n @for (message of entry.messages; track message) {\n <li>\n @if (entry.id) {\n <a\n data-part=\"summary-item\"\n data-part-summary-item=\"\"\n [attr.href]=\"'#' + entry.id\"\n (click)=\"focus($event, entry.id)\"\n >\n {{ message }}\n </a>\n } @else {\n <span data-part=\"summary-item\" data-part-summary-item=\"\">{{ message }}</span>\n }\n </li>\n }\n }\n </ul>`,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n // The family's identifier on the part: its rules reach it by name, never as any descendant.\n 'data-ui': 'form',\n 'data-ui-form': '',\n 'data-part': 'summary',\n 'data-part-summary': '',\n role: 'alert',\n tabindex: '-1',\n '[attr.aria-labelledby]': 'form.summaryId()',\n },\n})\nexport class SlFormSummary implements AfterViewInit {\n protected readonly form = inject(SlFormOwner);\n private readonly element = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n\n ngAfterViewInit() {\n this.form.registerSummary(this.element);\n }\n\n /**\n * The fragment is not followed. A link that navigated would write the\n * control's identifier into the address bar and add an entry to the history\n * of a page that never left; focusing the control is the whole of what the\n * link is for, and the browser scrolls it into view with the focus.\n */\n protected focus(event: Event, id: string) {\n const target = this.element.ownerDocument.getElementById(id);\n if (target === null) return;\n event.preventDefault();\n target.focus();\n }\n}\n\n/**\n * A form, its errors and its row of actions.\n *\n * **It owns the errors and nothing else.** `docs/component-features.md` § 6 puts\n * the boundary there: the family coordinates submission, validation, global\n * messages and focus \"sem possuir o estado de cada framework\". Values come from\n * `FormData`, validity from `checkValidity()` and from Reactive Forms, and the\n * values themselves stay with whichever of the two owns them.\n *\n * **`novalidate` is written, and constraint validation still runs.** The\n * attribute stops the browser drawing its own bubble beside a control whose\n * error the `field` is already showing; `checkValidity()` is called explicitly\n * and each control's `validationMessage` is the platform's localized string.\n *\n * **Reactive Forms is the second source.** When there is a `ControlContainer`,\n * every control is marked touched at submit and each failing one becomes a\n * sentence: a built-in validator's through the catalog's `errors.*` messages,\n * an application's own through `SL_FORM_ERROR_MESSAGES`.\n *\n * **Signal Forms needs nothing here.** Angular 22's `[field]` binds a control\n * through its `ControlValueAccessor`, which every Slotted control provides, so\n * they work under it today and this family adds no second integration.\n */\n@Component({\n selector: 'form[slForm]',\n standalone: true,\n exportAs: 'slForm',\n imports: [SlFormSummary],\n template: `@if (showsOwnSummary()) {\n <div slFormSummary></div>\n }\n <ng-content />`,\n styleUrl: '../../../styles/src/form/form.css',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n providers: [{ provide: SlFormOwner, useExisting: forwardRef(() => SlForm) }],\n host: {\n 'data-ui': 'form',\n 'data-ui-form': '',\n 'data-part': 'root',\n 'data-part-root': '',\n '[attr.novalidate]': \"resolvedNativeValidation() ? null : ''\",\n '[attr.aria-busy]': \"submitting() ? 'true' : null\",\n '[attr.data-invalid]': \"hasAnyError() ? '' : null\",\n '[attr.data-loading]': \"submitting() ? '' : null\",\n '[attr.data-disabled]': \"disabled() ? '' : null\",\n '(submit)': 'onSubmit($event)',\n '(reset)': 'onReset()',\n '(input)': 'onInput($event)',\n '(focusout)': 'onFocusOut($event)',\n },\n})\nexport class SlForm implements SlFormOwner, OnInit {\n /**\n * Present means the consumer owns the error map, for the life of the\n * component. Keyed by the `name` attribute of the control each error is about.\n */\n readonly errorsInput = input<FormErrorInput | undefined>(undefined, { alias: 'errors' });\n /** The errors an uncontrolled form starts from, read once. */\n readonly defaultErrors = input<FormErrorInput | undefined>(undefined);\n\n readonly validate = input<FormValidate | undefined>(undefined);\n readonly errorFocus = input<FormErrorFocus | undefined>(undefined);\n readonly summary = input<FormSummaryMode | undefined>(undefined);\n readonly summaryDescription = input<string | undefined>(undefined);\n readonly align = input<FormActionsAlign | undefined>(undefined);\n /**\n * Words laid over the catalog of the language in force, key by key: the\n * summary's heading (`summaryTitle`) and the built-in validators' sentences\n * (`errors.*`).\n */\n readonly messages = input<PartialMessages<FormMessages> | undefined>(undefined);\n /** Lets the browser draw its own validation bubble. Off by default. */\n readonly nativeValidation = input<boolean | undefined, boolean | string | undefined>(undefined, {\n transform: (raw) => (raw === undefined ? undefined : booleanAttribute(raw)),\n });\n /** Marks the form and every control in it as unavailable. */\n readonly disabled = input(false, { transform: booleanAttribute });\n /**\n * Marks the form busy for work the family did not start — a mutation a\n * consumer's own client is running. It is merged with the family's own\n * submission, so either one puts the root in its busy state.\n */\n readonly loading = input(false, { transform: booleanAttribute });\n /**\n * Registers a `beforeunload` guard while anything in the form has been\n * edited. Off by default: a guard nobody asked for is a trap.\n */\n readonly guardUnsaved = input(false, { transform: booleanAttribute });\n\n /** One output for one transition, carrying the reason and `cancel()`. */\n readonly errorsChange = output<ChangeRequest<FormErrors>>();\n /**\n * Emitted when the form submits and nothing is wrong with it. The values are\n * read from `FormData`, and `errors` is how a handler publishes what a server\n * answered.\n */\n readonly formSubmit = output<{\n values: Record<string, FormDataEntryValue | FormDataEntryValue[]>;\n event: SubmitEvent;\n /** Publishes a server's answer, and moves focus the way a failed submit does. */\n errors: (errors: FormErrorInput) => void;\n /** Holds the form in its busy state until the promise settles. */\n pending: (work: Promise<FormErrorInput | void>) => void;\n }>();\n\n private readonly element = inject<ElementRef<HTMLFormElement>>(ElementRef).nativeElement;\n private readonly defaults = injectFormDefaults();\n private readonly errorMessages = injectFormErrorMessages();\n /** The family's words in the language in force, with this form's `messages` laid over them. */\n readonly t = injectMessages(formMessages, this.messages);\n /** The Reactive Forms group around this element, when a consumer wrote one. */\n private readonly container = inject(ControlContainer, { optional: true, self: true });\n private readonly writtenNoValidate = inject(new HostAttributeToken('novalidate'), {\n optional: true,\n });\n\n private readonly own = signal<FormErrors>({});\n private readonly controls = signal<{ name: string; id: string | undefined }[]>([]);\n private summaryElement: HTMLElement | null = null;\n /** Set when a publish should be followed by the focus a failed submit moves. */\n private pendingFocus = false;\n private readonly ownSubmitting = signal(false);\n /** Either the family's own submission or a consumer's own work. */\n protected readonly submitting = computed(() => this.ownSubmitting() || this.loading());\n private readonly submitted = signal(false);\n\n private readonly external = computed(() => normaliseErrors(this.errorsInput()));\n private readonly controlled = computed(() => this.errorsInput() !== undefined);\n\n readonly errors = computed(() => (this.controlled() ? this.external() : this.own()));\n readonly entries = computed(() => orderErrors(this.errors(), this.controls()));\n protected readonly hasAnyError = computed(() => hasErrors(this.errors()));\n\n readonly summaryId = signal(`slotted-form-summary-${(summaryCounter += 1)}`);\n readonly resolvedSummaryTitle = computed(() => this.t('summaryTitle'));\n readonly resolvedSummaryDescription = computed(\n () => this.summaryDescription() ?? this.defaults.summaryDescription,\n );\n readonly resolvedAlign = computed(() => this.align() ?? this.defaults.align);\n protected readonly resolvedValidate = computed(() => this.validate() ?? this.defaults.validate);\n protected readonly resolvedErrorFocus = computed(\n () => this.errorFocus() ?? this.defaults.errorFocus,\n );\n protected readonly resolvedSummary = computed(() => this.summary() ?? this.defaults.summary);\n protected readonly resolvedNativeValidation = computed(\n () =>\n this.nativeValidation() ??\n (this.writtenNoValidate === null ? this.defaults.nativeValidation : false),\n );\n protected readonly showsOwnSummary = computed(\n () => this.resolvedSummary() === 'auto' && this.entries().length > 0,\n );\n\n constructor() {\n this.attachUnloadGuard();\n }\n\n ngOnInit() {\n this.own.set(normaliseErrors(this.defaultErrors()));\n this.readControls();\n }\n\n /**\n * The summary says when it exists, and takes the focus a failed submit asked\n * for. The move waits for the region rather than racing it: the errors and\n * the element that shows them are published in the same change, and a\n * `focus()` called before the region rendered would land on nothing.\n */\n registerSummary(element: HTMLElement | null) {\n this.summaryElement = element;\n if (element === null || !this.pendingFocus) return;\n this.pendingFocus = false;\n element.focus();\n }\n\n /** Runs validation now and publishes what it found. */\n validateNow(): FormErrors {\n const found = this.collect();\n this.publish(found, 'programmatic', undefined);\n return found;\n }\n\n /** Submits as though the submit button had been pressed. */\n submit() {\n this.element.requestSubmit();\n }\n\n /** Resets the controls and clears the errors. */\n reset() {\n this.element.reset();\n }\n\n /** Moves focus where a failed submit would have moved it. */\n focusFirstError() {\n const focus = this.resolvedErrorFocus();\n if (focus === 'none') return;\n if (focus === 'summary' && this.summaryElement !== null) {\n this.summaryElement.focus();\n return;\n }\n const first = this.entries()[0];\n if (first === undefined) return;\n const control = this.element.elements.namedItem(first.name);\n const element = control instanceof RadioNodeList ? control[0] : control;\n if (element instanceof HTMLElement) element.focus();\n }\n\n protected onSubmit(event: SubmitEvent) {\n this.submitted.set(true);\n this.readControls();\n\n if (this.submitting()) {\n /* A second submit while one is pending is refused. */\n event.preventDefault();\n return;\n }\n\n const found = this.resolvedValidate() === 'none' ? this.external() : this.collect();\n\n if (hasErrors(found)) {\n event.preventDefault();\n this.publish(found, 'submit', event);\n return;\n }\n\n this.publish({}, 'submit', event);\n event.preventDefault();\n\n const data = new FormData(this.element);\n const values: Record<string, FormDataEntryValue | FormDataEntryValue[]> = {};\n for (const key of new Set(data.keys())) {\n const all = data.getAll(key);\n values[key] = all.length > 1 ? all : (all[0] as FormDataEntryValue);\n }\n\n this.formSubmit.emit({\n values,\n event,\n errors: (errors) => this.publish(normaliseErrors(errors), 'submit', event),\n pending: (work) => {\n this.ownSubmitting.set(true);\n void work\n .then((settled) => {\n if (settled !== undefined && settled !== null) {\n this.publish(normaliseErrors(settled), 'submit', event);\n }\n })\n .finally(() => this.ownSubmitting.set(false));\n },\n });\n }\n\n protected onReset() {\n this.submitted.set(false);\n this.publish({}, 'clear', undefined);\n }\n\n /**\n * A server error is dropped when the control it names is edited. After a\n * failed submit under `validate=\"change\"`, the whole form is checked again\n * instead, because a reader who has seen the list is fixing it.\n */\n protected onInput(event: Event) {\n const name = nameOf(event.target);\n if (name === null) return;\n\n if (this.resolvedValidate() === 'change' && this.submitted()) {\n this.publish(this.collect(), 'keyboard', event, false);\n return;\n }\n const next = withoutError(this.errors(), name);\n if (next !== this.errors()) this.publish(next, 'keyboard', event, false);\n }\n\n /**\n * On blur only the control that lost focus is checked. Running the whole form\n * would tell a reader that six fields they have not reached yet are wrong,\n * which is the noise `validate=\"submit\"` exists to avoid.\n */\n protected onFocusOut(event: Event) {\n if (this.resolvedValidate() !== 'blur') return;\n const name = nameOf(event.target);\n if (name === null) return;\n\n const found = this.collect();\n const messages = found[name];\n const next =\n messages === undefined\n ? withoutError(this.errors(), name)\n : mergeErrors(this.errors(), { [name]: messages });\n if (next !== this.errors()) this.publish(next, 'keyboard', event, false);\n }\n\n /**\n * Three sources, latest last: whatever a server sent, the platform's own\n * constraint validation, and Reactive Forms.\n */\n private collect(): FormErrors {\n return mergeErrors(this.external(), collectValidity(this.element), this.angularErrors());\n }\n\n /**\n * Every failing control in the group around this form, as a sentence. Angular\n * reports a key and a shape and never a message, because a message is the\n * application's and so is its language; the registry is where it is written.\n */\n private angularErrors(): FormErrors {\n const group = this.container?.control as FormGroup | FormArray | null | undefined;\n if (group === null || group === undefined) return {};\n group.markAllAsTouched();\n\n const found: Record<string, string[]> = {};\n for (const [name, control] of Object.entries(\n group.controls as Record<string, AbstractControl>,\n )) {\n const errors = control.errors;\n if (errors === null || control.disabled) continue;\n const messages = Object.entries(errors)\n .map(\n ([key, detail]) =>\n this.errorMessages[key]?.({ name, key, detail }) ?? this.builtInMessage(key, detail),\n )\n .filter((message): message is string => typeof message === 'string');\n if (messages.length > 0) found[name] = messages;\n }\n return found;\n }\n\n /**\n * The sentence for one of Angular's own validators, from the catalog; for a\n * key the catalog does not know, nothing — the application's validator names\n * its own message through `SL_FORM_ERROR_MESSAGES`.\n */\n private builtInMessage(key: string, detail: unknown): string | undefined {\n const shape = (detail ?? {}) as { min?: unknown; max?: unknown; requiredLength?: unknown };\n switch (key) {\n case 'required':\n return this.t('errors.required');\n case 'email':\n return this.t('errors.email');\n case 'min':\n return this.t('errors.min', { min: Number(shape.min) });\n case 'max':\n return this.t('errors.max', { max: Number(shape.max) });\n case 'minlength':\n return this.t('errors.minlength', { length: Number(shape.requiredLength) });\n case 'maxlength':\n return this.t('errors.maxlength', { length: Number(shape.requiredLength) });\n case 'pattern':\n return this.t('errors.pattern');\n default:\n return undefined;\n }\n }\n\n private readControls() {\n this.controls.set(namedControls(this.element));\n }\n\n private publish(\n next: FormErrors,\n reason: ChangeReason,\n source: Event | undefined,\n moveFocus = true,\n ) {\n this.readControls();\n\n let cancelled = false;\n const state = createControllable<FormErrors>({\n controlled: undefined,\n initial: this.errors(),\n equals: sameErrors,\n onRequest: (pending) => {\n this.errorsChange.emit(pending);\n cancelled = pending.cancelled;\n },\n });\n state.request(next, reason, source);\n if (cancelled) return;\n\n if (!this.controlled()) this.own.set(next);\n\n if (!moveFocus || !hasErrors(next) || this.resolvedErrorFocus() === 'none') return;\n /* A summary that has not been rendered yet takes the focus when it is, and\n one that is already on the page takes it now. */\n if (this.resolvedErrorFocus() === 'summary' && this.summaryElement === null) {\n this.pendingFocus = true;\n return;\n }\n this.focusFirstError();\n }\n\n /**\n * The guard nobody else ships. It is off by default, because a page that\n * refuses to close after a reader typed one character is a trap.\n */\n private attachUnloadGuard() {\n const onBeforeUnload = (event: BeforeUnloadEvent) => {\n if (!this.guardUnsaved() || this.submitting()) return;\n if (!isDirty(this.element)) return;\n event.preventDefault();\n };\n\n window.addEventListener('beforeunload', onBeforeUnload);\n inject(DestroyRef).onDestroy(() => window.removeEventListener('beforeunload', onBeforeUnload));\n }\n}\n\nfunction nameOf(target: EventTarget | null): string | null {\n if (!(target instanceof HTMLElement)) return null;\n const name = (target as { name?: string }).name;\n return typeof name === 'string' && name !== '' ? name : null;\n}\n\nfunction sameErrors(a: FormErrors, b: FormErrors) {\n const names = Object.keys(a);\n if (names.length !== Object.keys(b).length) return false;\n return names.every(\n (name) =>\n b[name] !== undefined &&\n a[name]!.length === b[name]!.length &&\n a[name]!.every((message, index) => message === b[name]![index]),\n );\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AA8BA,MAAM,QAAQ,GAAiB;AAC7B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Y,EAAE,oBAAoB;AACnC,qBAAA,EAAA,MAAA,EAAA,CAAA,+6GAAA,CAAA,EAAA;;AAuWH,SAAS,MAAM,CAAC,MAA0B,EAAA;AACxC,IAAA,IAAI,EAAE,MAAM,YAAY,WAAW,CAAC;AAAE,QAAA,OAAO,IAAI;AACjD,IAAA,MAAM,IAAI,GAAI,MAA4B,CAAC,IAAI;AAC/C,IAAA,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,EAAE,GAAG,IAAI,GAAG,IAAI;AAC9D;AAEA,SAAS,UAAU,CAAC,CAAa,EAAE,CAAa,EAAA;IAC9C,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5B,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM;AAAE,QAAA,OAAO,KAAK;AACxD,IAAA,OAAO,KAAK,CAAC,KAAK,CAChB,CAAC,IAAI,KACH,CAAC,CAAC,IAAI,CAAC,KAAK,SAAS;QACrB,CAAC,CAAC,IAAI,CAAE,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,CAAE,CAAC,MAAM;QACnC,CAAC,CAAC,IAAI,CAAE,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,KAAK,KAAK,OAAO,KAAK,CAAC,CAAC,IAAI,CAAE,CAAC,KAAK,CAAC,CAAC,CAClE;AACH;;AC7iBA;;AAEG;;"}
|
|
1
|
+
{"version":3,"file":"slotted-angular-form.mjs","sources":["../../form/src/form-defaults.ts","../../form/src/form-actions.ts","../../form/src/form.ts","../../form/src/slotted-angular-form.ts"],"sourcesContent":["import { inject, InjectionToken } from '@angular/core';\nimport type { Signal } from '@angular/core';\nimport type { FormErrorEntry, FormErrors } from '@slotted/core/form';\n\n/**\n * When the form checks its own controls. `submit` is the default and\n * re-validates on every change afterwards: telling a reader an answer is wrong\n * before they have finished writing it is noise, and telling them nothing after\n * they have fixed it is worse.\n */\nexport type FormValidate = 'submit' | 'blur' | 'change' | 'none';\n\n/** Where focus goes after a submit that found something wrong. */\nexport type FormErrorFocus = 'summary' | 'control' | 'none';\n\n/** Whether the family renders the summary itself. */\nexport type FormSummaryMode = 'auto' | 'none';\n\n/** How the action row is arranged along the inline axis. */\nexport type FormActionsAlign = 'end' | 'start' | 'between' | 'stretch';\n\nexport interface FormDefaults {\n align: FormActionsAlign;\n errorFocus: FormErrorFocus;\n nativeValidation: boolean;\n summary: FormSummaryMode;\n summaryDescription: string | undefined;\n validate: FormValidate;\n}\n\nconst FALLBACK: FormDefaults = {\n align: 'end',\n errorFocus: 'summary',\n nativeValidation: false,\n summary: 'auto',\n summaryDescription: undefined,\n validate: 'submit',\n};\n\nexport const FORM_DEFAULTS = new InjectionToken<FormDefaults>('slotted form defaults', {\n providedIn: 'root',\n factory: () => FALLBACK,\n});\n\n/**\n * An application decides once how its forms behave: when they validate, where\n * focus goes after a failed submit, and how its action row is arranged. A form\n * that states any of them itself still wins. The summary's heading comes from\n * the language in force (`provideSlotted`).\n */\nexport function provideFormDefaults(defaults: Partial<FormDefaults>) {\n return {\n provide: FORM_DEFAULTS,\n useFactory: (): FormDefaults => ({ ...FALLBACK, ...defaults }),\n };\n}\n\nexport function injectFormDefaults(): FormDefaults {\n return inject(FORM_DEFAULTS);\n}\n\n/** One validation failure Angular reported, as the registry receives it. */\nexport interface FormErrorMessageContext {\n /** The `name` the control is submitted under, which is the key in the group. */\n name: string;\n /** The key `AbstractControl.errors` used — `required`, `minlength`, and so on. */\n key: string;\n /** Whatever the validator put beside the key. */\n detail: unknown;\n}\n\n/**\n * How a Reactive Forms validation failure the application's own validator\n * reports becomes a sentence.\n *\n * Angular's validators report a key and a shape — `{ required: true }`,\n * `{ minlength: { requiredLength: 8, actualLength: 3 } }` — and never a\n * message. The built-in keys (`required`, `email`, `min`, `max`, `minlength`,\n * `maxlength`, `pattern`) are written by the `form` catalog's `errors.*`\n * messages in the language in force; a validator the application adds names\n * its own message here, and an entry for a built-in key replaces the catalog's.\n */\nexport type FormErrorMessages = Record<string, (context: FormErrorMessageContext) => string>;\n\nexport const SL_FORM_ERROR_MESSAGES = new InjectionToken<FormErrorMessages>(\n 'slotted form error messages',\n { providedIn: 'root', factory: () => ({}) },\n);\n\n/** Names the sentences the application's own validators are written as. */\nexport function provideFormErrorMessages(messages: FormErrorMessages) {\n return { provide: SL_FORM_ERROR_MESSAGES, useValue: messages };\n}\n\nexport function injectFormErrorMessages(): FormErrorMessages {\n return inject(SL_FORM_ERROR_MESSAGES);\n}\n\n/**\n * What the summary needs from the form around it.\n *\n * It is an abstract class rather than an import so the two classes can depend\n * on each other without a cycle — the shape `field` and `text-field` already\n * have.\n */\nexport abstract class SlFormOwner {\n abstract readonly entries: Signal<readonly FormErrorEntry[]>;\n abstract readonly errors: Signal<FormErrors>;\n abstract readonly summaryId: Signal<string>;\n abstract readonly resolvedSummaryTitle: Signal<string>;\n abstract readonly resolvedSummaryDescription: Signal<string | undefined>;\n abstract readonly resolvedAlign: Signal<FormActionsAlign>;\n /** Called by whichever summary is on the page, so focus can reach the region. */\n abstract registerSummary(element: HTMLElement | null): void;\n}\n","import { computed, Directive, inject, input } from '@angular/core';\n\nimport { SlFormOwner } from './form-defaults';\nimport type { FormActionsAlign } from './form-defaults';\n\n/**\n * The row a form's actions stand in.\n *\n * `inline` can end-align a row of buttons. What it cannot do without a query\n * the consumer writes for every form is the reflow: below the form's own\n * container width every action takes the whole width, in a column, with the\n * primary one first — a reader's thumb is at the bottom of a phone and their\n * eye at the end of a row.\n */\n@Directive({\n selector: '[slFormActions]',\n standalone: true,\n exportAs: 'slFormActions',\n host: {\n // The family's identifier on the part: its rules reach it by name, never as any descendant.\n 'data-ui': 'form',\n 'data-ui-form': '',\n 'data-part': 'actions',\n 'data-part-actions': '',\n '[attr.data-align]': 'resolvedAlign()',\n },\n})\nexport class SlFormActions {\n /** Defaults to the form's own `align`, then to the token, then to `end`. */\n readonly align = input<FormActionsAlign | undefined>(undefined);\n\n private readonly form = inject(SlFormOwner, { optional: true });\n\n protected readonly resolvedAlign = computed(\n () => this.align() ?? this.form?.resolvedAlign() ?? 'end',\n );\n}\n\n/**\n * What the form says about the whole record — a live preview, a summary in\n * words, a help panel — beside the column of fields on a wide form, and after\n * the last field on a narrow one.\n */\n@Directive({\n selector: '[slFormAside]',\n standalone: true,\n exportAs: 'slFormAside',\n host: {\n 'data-ui': 'form',\n 'data-ui-form': '',\n 'data-part': 'aside',\n 'data-part-aside': '',\n },\n})\nexport class SlFormAside {}\n","import {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n ElementRef,\n forwardRef,\n HostAttributeToken,\n inject,\n input,\n output,\n signal,\n ViewEncapsulation,\n} from '@angular/core';\nimport type { AfterViewInit, OnInit } from '@angular/core';\nimport { ControlContainer } from '@angular/forms';\nimport type { AbstractControl, FormArray, FormGroup } from '@angular/forms';\nimport { injectMessages } from '@slotted/angular/i18n';\nimport {\n collectValidity,\n hasErrors,\n isDirty,\n mergeErrors,\n namedControls,\n normaliseErrors,\n orderErrors,\n withoutError,\n} from '@slotted/core/form';\nimport type { FormErrorInput, FormErrors } from '@slotted/core/form';\nimport { formMessages, type FormMessages, type PartialMessages } from '@slotted/core/i18n';\nimport { createControllable } from '@slotted/core/state';\nimport type { ChangeReason, ChangeRequest } from '@slotted/core/state';\n\nimport { injectFormDefaults, injectFormErrorMessages, SlFormOwner } from './form-defaults';\nimport type {\n FormActionsAlign,\n FormErrorFocus,\n FormSummaryMode,\n FormValidate,\n} from './form-defaults';\n\nexport type {\n FormActionsAlign,\n FormDefaults,\n FormErrorFocus,\n FormErrorMessageContext,\n FormErrorMessages,\n FormSummaryMode,\n FormValidate,\n} from './form-defaults';\n\nlet summaryCounter = 0;\n\n/**\n * The summary of everything wrong with the form: a focusable region with a\n * heading, and a link per error pointing at the control it is about.\n *\n * It is the GOV.UK error summary, item for item — \"move keyboard focus to the\n * error summary\", \"include the heading\", \"link to each of the answers that have\n * validation errors\", \"make sure the error messages in the error summary are\n * worded the same as those which appear next to the inputs\". The last one is\n * free here: one map feeds the summary and the field.\n *\n * The form renders this itself under `summary=\"auto\"`. A consumer who wants it\n * somewhere else writes `summary=\"none\"` and puts `slFormSummary` on their own\n * element.\n */\n@Component({\n selector: '[slFormSummary]',\n standalone: true,\n exportAs: 'slFormSummary',\n template: `<h2 data-part=\"summary-title\" data-part-summary-title=\"\" [attr.id]=\"form.summaryId()\">\n {{ form.resolvedSummaryTitle() }}\n </h2>\n @if (form.resolvedSummaryDescription(); as description) {\n <p>{{ description }}</p>\n }\n <ul data-part=\"summary-list\" data-part-summary-list=\"\">\n @for (entry of form.entries(); track entry.name) {\n @for (message of entry.messages; track message) {\n <li>\n @if (entry.id) {\n <a\n data-part=\"summary-item\"\n data-part-summary-item=\"\"\n [attr.href]=\"'#' + entry.id\"\n (click)=\"focus($event, entry.id)\"\n >\n {{ message }}\n </a>\n } @else {\n <span data-part=\"summary-item\" data-part-summary-item=\"\">{{ message }}</span>\n }\n </li>\n }\n }\n </ul>`,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n // The family's identifier on the part: its rules reach it by name, never as any descendant.\n 'data-ui': 'form',\n 'data-ui-form': '',\n 'data-part': 'summary',\n 'data-part-summary': '',\n role: 'alert',\n tabindex: '-1',\n '[attr.aria-labelledby]': 'form.summaryId()',\n },\n})\nexport class SlFormSummary implements AfterViewInit {\n protected readonly form = inject(SlFormOwner);\n private readonly element = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n\n ngAfterViewInit() {\n this.form.registerSummary(this.element);\n }\n\n /**\n * The fragment is not followed. A link that navigated would write the\n * control's identifier into the address bar and add an entry to the history\n * of a page that never left; focusing the control is the whole of what the\n * link is for, and the browser scrolls it into view with the focus.\n */\n protected focus(event: Event, id: string) {\n const target = this.element.ownerDocument.getElementById(id);\n if (target === null) return;\n event.preventDefault();\n target.focus();\n }\n}\n\n/**\n * A form, its errors and its row of actions.\n *\n * **It owns the errors and nothing else.** `docs/component-features.md` § 6 puts\n * the boundary there: the family coordinates submission, validation, global\n * messages and focus \"sem possuir o estado de cada framework\". Values come from\n * `FormData`, validity from `checkValidity()` and from Reactive Forms, and the\n * values themselves stay with whichever of the two owns them.\n *\n * **`novalidate` is written, and constraint validation still runs.** The\n * attribute stops the browser drawing its own bubble beside a control whose\n * error the `field` is already showing; `checkValidity()` is called explicitly\n * and each control's `validationMessage` is the platform's localized string.\n *\n * **Reactive Forms is the second source.** When there is a `ControlContainer`,\n * every control is marked touched at submit and each failing one becomes a\n * sentence: a built-in validator's through the catalog's `errors.*` messages,\n * an application's own through `SL_FORM_ERROR_MESSAGES`.\n *\n * **Signal Forms needs nothing here.** Angular 22's `[field]` binds a control\n * through its `ControlValueAccessor`, which every Slotted control provides, so\n * they work under it today and this family adds no second integration.\n */\n@Component({\n selector: 'form[slForm]',\n standalone: true,\n exportAs: 'slForm',\n imports: [SlFormSummary],\n template: `@if (showsOwnSummary()) {\n <div slFormSummary></div>\n }\n <ng-content />`,\n styleUrl: '../../../styles/src/form/form.css',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n providers: [{ provide: SlFormOwner, useExisting: forwardRef(() => SlForm) }],\n host: {\n 'data-ui': 'form',\n 'data-ui-form': '',\n 'data-part': 'root',\n 'data-part-root': '',\n '[attr.novalidate]': \"resolvedNativeValidation() ? null : ''\",\n '[attr.aria-busy]': \"submitting() ? 'true' : null\",\n '[attr.data-invalid]': \"hasAnyError() ? '' : null\",\n '[attr.data-loading]': \"submitting() ? '' : null\",\n '[attr.data-disabled]': \"disabled() ? '' : null\",\n '(submit)': 'onSubmit($event)',\n '(reset)': 'onReset()',\n '(input)': 'onInput($event)',\n '(focusout)': 'onFocusOut($event)',\n },\n})\nexport class SlForm implements SlFormOwner, OnInit {\n /**\n * Present means the consumer owns the error map, for the life of the\n * component. Keyed by the `name` attribute of the control each error is about.\n */\n readonly errorsInput = input<FormErrorInput | undefined>(undefined, { alias: 'errors' });\n /** The errors an uncontrolled form starts from, read once. */\n readonly defaultErrors = input<FormErrorInput | undefined>(undefined);\n\n readonly validate = input<FormValidate | undefined>(undefined);\n readonly errorFocus = input<FormErrorFocus | undefined>(undefined);\n readonly summary = input<FormSummaryMode | undefined>(undefined);\n readonly summaryDescription = input<string | undefined>(undefined);\n readonly align = input<FormActionsAlign | undefined>(undefined);\n /**\n * Words laid over the catalog of the language in force, key by key: the\n * summary's heading (`summaryTitle`) and the built-in validators' sentences\n * (`errors.*`).\n */\n readonly messages = input<PartialMessages<FormMessages> | undefined>(undefined);\n /** Lets the browser draw its own validation bubble. Off by default. */\n readonly nativeValidation = input<boolean | undefined, boolean | string | undefined>(undefined, {\n transform: (raw) => (raw === undefined ? undefined : booleanAttribute(raw)),\n });\n /** Marks the form and every control in it as unavailable. */\n readonly disabled = input(false, { transform: booleanAttribute });\n /**\n * Marks the form busy for work the family did not start — a mutation a\n * consumer's own client is running. It is merged with the family's own\n * submission, so either one puts the root in its busy state.\n */\n readonly loading = input(false, { transform: booleanAttribute });\n /**\n * Registers a `beforeunload` guard while anything in the form has been\n * edited. Off by default: a guard nobody asked for is a trap.\n */\n readonly guardUnsaved = input(false, { transform: booleanAttribute });\n\n /** One output for one transition, carrying the reason and `cancel()`. */\n readonly errorsChange = output<ChangeRequest<FormErrors>>();\n /**\n * Emitted when the form submits and nothing is wrong with it. The values are\n * read from `FormData`, and `errors` is how a handler publishes what a server\n * answered.\n */\n readonly formSubmit = output<{\n values: Record<string, FormDataEntryValue | FormDataEntryValue[]>;\n event: SubmitEvent;\n /** Publishes a server's answer, and moves focus the way a failed submit does. */\n errors: (errors: FormErrorInput) => void;\n /** Holds the form in its busy state until the promise settles. */\n pending: (work: Promise<FormErrorInput | void>) => void;\n }>();\n\n private readonly element = inject<ElementRef<HTMLFormElement>>(ElementRef).nativeElement;\n private readonly defaults = injectFormDefaults();\n private readonly errorMessages = injectFormErrorMessages();\n /** The family's words in the language in force, with this form's `messages` laid over them. */\n readonly t = injectMessages(formMessages, this.messages);\n /** The Reactive Forms group around this element, when a consumer wrote one. */\n private readonly container = inject(ControlContainer, { optional: true, self: true });\n private readonly writtenNoValidate = inject(new HostAttributeToken('novalidate'), {\n optional: true,\n });\n\n private readonly own = signal<FormErrors>({});\n private readonly controls = signal<{ name: string; id: string | undefined }[]>([]);\n private summaryElement: HTMLElement | null = null;\n /** Set when a publish should be followed by the focus a failed submit moves. */\n private pendingFocus = false;\n private readonly ownSubmitting = signal(false);\n /** Either the family's own submission or a consumer's own work. */\n protected readonly submitting = computed(() => this.ownSubmitting() || this.loading());\n private readonly submitted = signal(false);\n\n private readonly external = computed(() => normaliseErrors(this.errorsInput()));\n private readonly controlled = computed(() => this.errorsInput() !== undefined);\n\n readonly errors = computed(() => (this.controlled() ? this.external() : this.own()));\n readonly entries = computed(() => orderErrors(this.errors(), this.controls()));\n protected readonly hasAnyError = computed(() => hasErrors(this.errors()));\n\n readonly summaryId = signal(`slotted-form-summary-${(summaryCounter += 1)}`);\n readonly resolvedSummaryTitle = computed(() => this.t('summaryTitle'));\n readonly resolvedSummaryDescription = computed(\n () => this.summaryDescription() ?? this.defaults.summaryDescription,\n );\n readonly resolvedAlign = computed(() => this.align() ?? this.defaults.align);\n protected readonly resolvedValidate = computed(() => this.validate() ?? this.defaults.validate);\n protected readonly resolvedErrorFocus = computed(\n () => this.errorFocus() ?? this.defaults.errorFocus,\n );\n protected readonly resolvedSummary = computed(() => this.summary() ?? this.defaults.summary);\n protected readonly resolvedNativeValidation = computed(\n () =>\n this.nativeValidation() ??\n (this.writtenNoValidate === null ? this.defaults.nativeValidation : false),\n );\n protected readonly showsOwnSummary = computed(\n () => this.resolvedSummary() === 'auto' && this.entries().length > 0,\n );\n\n constructor() {\n this.attachUnloadGuard();\n }\n\n ngOnInit() {\n this.own.set(normaliseErrors(this.defaultErrors()));\n this.readControls();\n }\n\n /**\n * The summary says when it exists, and takes the focus a failed submit asked\n * for. The move waits for the region rather than racing it: the errors and\n * the element that shows them are published in the same change, and a\n * `focus()` called before the region rendered would land on nothing.\n */\n registerSummary(element: HTMLElement | null) {\n this.summaryElement = element;\n if (element === null || !this.pendingFocus) return;\n this.pendingFocus = false;\n element.focus();\n }\n\n /** Runs validation now and publishes what it found. */\n validateNow(): FormErrors {\n const found = this.collect();\n this.publish(found, 'programmatic', undefined);\n return found;\n }\n\n /** Submits as though the submit button had been pressed. */\n submit() {\n this.element.requestSubmit();\n }\n\n /** Resets the controls and clears the errors. */\n reset() {\n this.element.reset();\n }\n\n /** Moves focus where a failed submit would have moved it. */\n focusFirstError() {\n const focus = this.resolvedErrorFocus();\n if (focus === 'none') return;\n if (focus === 'summary' && this.summaryElement !== null) {\n this.summaryElement.focus();\n return;\n }\n const first = this.entries()[0];\n if (first === undefined) return;\n const control = this.element.elements.namedItem(first.name);\n const element = control instanceof RadioNodeList ? control[0] : control;\n if (element instanceof HTMLElement) element.focus();\n }\n\n protected onSubmit(event: SubmitEvent) {\n this.submitted.set(true);\n this.readControls();\n\n if (this.submitting()) {\n /* A second submit while one is pending is refused. */\n event.preventDefault();\n return;\n }\n\n const found = this.resolvedValidate() === 'none' ? this.external() : this.collect();\n\n if (hasErrors(found)) {\n event.preventDefault();\n this.publish(found, 'submit', event);\n return;\n }\n\n this.publish({}, 'submit', event);\n event.preventDefault();\n\n const data = new FormData(this.element);\n const values: Record<string, FormDataEntryValue | FormDataEntryValue[]> = {};\n for (const key of new Set(data.keys())) {\n const all = data.getAll(key);\n values[key] = all.length > 1 ? all : (all[0] as FormDataEntryValue);\n }\n\n this.formSubmit.emit({\n values,\n event,\n errors: (errors) => this.publish(normaliseErrors(errors), 'submit', event),\n pending: (work) => {\n this.ownSubmitting.set(true);\n void work\n .then((settled) => {\n if (settled !== undefined && settled !== null) {\n this.publish(normaliseErrors(settled), 'submit', event);\n }\n })\n .finally(() => this.ownSubmitting.set(false));\n },\n });\n }\n\n protected onReset() {\n this.submitted.set(false);\n this.publish({}, 'clear', undefined);\n }\n\n /**\n * A server error is dropped when the control it names is edited. After a\n * failed submit under `validate=\"change\"`, the whole form is checked again\n * instead, because a reader who has seen the list is fixing it.\n */\n protected onInput(event: Event) {\n const name = nameOf(event.target);\n if (name === null) return;\n\n if (this.resolvedValidate() === 'change' && this.submitted()) {\n this.publish(this.collect(), 'keyboard', event, false);\n return;\n }\n const next = withoutError(this.errors(), name);\n if (next !== this.errors()) this.publish(next, 'keyboard', event, false);\n }\n\n /**\n * On blur only the control that lost focus is checked. Running the whole form\n * would tell a reader that six fields they have not reached yet are wrong,\n * which is the noise `validate=\"submit\"` exists to avoid.\n */\n protected onFocusOut(event: Event) {\n if (this.resolvedValidate() !== 'blur') return;\n const name = nameOf(event.target);\n if (name === null) return;\n\n const found = this.collect();\n const messages = found[name];\n const next =\n messages === undefined\n ? withoutError(this.errors(), name)\n : mergeErrors(this.errors(), { [name]: messages });\n if (next !== this.errors()) this.publish(next, 'keyboard', event, false);\n }\n\n /**\n * Three sources, latest last: whatever a server sent, the platform's own\n * constraint validation, and Reactive Forms.\n */\n private collect(): FormErrors {\n return mergeErrors(this.external(), collectValidity(this.element), this.angularErrors());\n }\n\n /**\n * Every failing control in the group around this form, as a sentence. Angular\n * reports a key and a shape and never a message, because a message is the\n * application's and so is its language; the registry is where it is written.\n */\n private angularErrors(): FormErrors {\n const group = this.container?.control as FormGroup | FormArray | null | undefined;\n if (group === null || group === undefined) return {};\n group.markAllAsTouched();\n\n const found: Record<string, string[]> = {};\n for (const [name, control] of Object.entries(\n group.controls as Record<string, AbstractControl>,\n )) {\n const errors = control.errors;\n if (errors === null || control.disabled) continue;\n const messages = Object.entries(errors)\n .map(\n ([key, detail]) =>\n this.errorMessages[key]?.({ name, key, detail }) ?? this.builtInMessage(key, detail),\n )\n .filter((message): message is string => typeof message === 'string');\n if (messages.length > 0) found[name] = messages;\n }\n return found;\n }\n\n /**\n * The sentence for one of Angular's own validators, from the catalog; for a\n * key the catalog does not know, nothing — the application's validator names\n * its own message through `SL_FORM_ERROR_MESSAGES`.\n */\n private builtInMessage(key: string, detail: unknown): string | undefined {\n const shape = (detail ?? {}) as { min?: unknown; max?: unknown; requiredLength?: unknown };\n switch (key) {\n case 'required':\n return this.t('errors.required');\n case 'email':\n return this.t('errors.email');\n case 'min':\n return this.t('errors.min', { min: Number(shape.min) });\n case 'max':\n return this.t('errors.max', { max: Number(shape.max) });\n case 'minlength':\n return this.t('errors.minlength', { length: Number(shape.requiredLength) });\n case 'maxlength':\n return this.t('errors.maxlength', { length: Number(shape.requiredLength) });\n case 'pattern':\n return this.t('errors.pattern');\n default:\n return undefined;\n }\n }\n\n private readControls() {\n this.controls.set(namedControls(this.element));\n }\n\n private publish(\n next: FormErrors,\n reason: ChangeReason,\n source: Event | undefined,\n moveFocus = true,\n ) {\n this.readControls();\n\n let cancelled = false;\n const state = createControllable<FormErrors>({\n controlled: undefined,\n initial: this.errors(),\n equals: sameErrors,\n onRequest: (pending) => {\n this.errorsChange.emit(pending);\n cancelled = pending.cancelled;\n },\n });\n state.request(next, reason, source);\n if (cancelled) return;\n\n if (!this.controlled()) this.own.set(next);\n\n if (!moveFocus || !hasErrors(next) || this.resolvedErrorFocus() === 'none') return;\n /* A summary that has not been rendered yet takes the focus when it is, and\n one that is already on the page takes it now. */\n if (this.resolvedErrorFocus() === 'summary' && this.summaryElement === null) {\n this.pendingFocus = true;\n return;\n }\n this.focusFirstError();\n }\n\n /**\n * The guard nobody else ships. It is off by default, because a page that\n * refuses to close after a reader typed one character is a trap.\n */\n private attachUnloadGuard() {\n const onBeforeUnload = (event: BeforeUnloadEvent) => {\n if (!this.guardUnsaved() || this.submitting()) return;\n if (!isDirty(this.element)) return;\n event.preventDefault();\n };\n\n window.addEventListener('beforeunload', onBeforeUnload);\n inject(DestroyRef).onDestroy(() => window.removeEventListener('beforeunload', onBeforeUnload));\n }\n}\n\nfunction nameOf(target: EventTarget | null): string | null {\n if (!(target instanceof HTMLElement)) return null;\n const name = (target as { name?: string }).name;\n return typeof name === 'string' && name !== '' ? name : null;\n}\n\nfunction sameErrors(a: FormErrors, b: FormErrors) {\n const names = Object.keys(a);\n if (names.length !== Object.keys(b).length) return false;\n return names.every(\n (name) =>\n b[name] !== undefined &&\n a[name]!.length === b[name]!.length &&\n a[name]!.every((message, index) => message === b[name]![index]),\n );\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AA8BA,MAAM,QAAQ,GAAiB;AAC7B,IAAA,KAAK,EAAE,KAAK;AACZ,IAAA,UAAU,EAAE,SAAS;AACrB,IAAA,gBAAgB,EAAE,KAAK;AACvB,IAAA,OAAO,EAAE,MAAM;AACf,IAAA,kBAAkB,EAAE,SAAS;AAC7B,IAAA,QAAQ,EAAE,QAAQ;CACnB;MAEY,aAAa,GAAG,IAAI,cAAc,CAAe,uBAAuB,EAAE;AACrF,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,MAAM,QAAQ;AACxB,CAAA;AAED;;;;;AAKG;AACG,SAAU,mBAAmB,CAAC,QAA+B,EAAA;IACjE,OAAO;AACL,QAAA,OAAO,EAAE,aAAa;AACtB,QAAA,UAAU,EAAE,OAAqB,EAAE,GAAG,QAAQ,EAAE,GAAG,QAAQ,EAAE,CAAC;KAC/D;AACH;SAEgB,kBAAkB,GAAA;AAChC,IAAA,OAAO,MAAM,CAAC,aAAa,CAAC;AAC9B;AAyBO,MAAM,sBAAsB,GAAG,IAAI,cAAc,CACtD,6BAA6B,EAC7B,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE;AAG7C;AACM,SAAU,wBAAwB,CAAC,QAA2B,EAAA;IAClE,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,QAAQ,EAAE;AAChE;SAEgB,uBAAuB,GAAA;AACrC,IAAA,OAAO,MAAM,CAAC,sBAAsB,CAAC;AACvC;AAEA;;;;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YAAY,WAAW,CAAC;AAAE,QAAA,OAAO,IAAI;AACjD,IAAA,MAAM,IAAI,GAAI,MAA4B,CAAC,IAAI;AAC/C,IAAA,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,EAAE,GAAG,IAAI,GAAG,IAAI;AAC9D;AAEA,SAAS,UAAU,CAAC,CAAa,EAAE,CAAa,EAAA;IAC9C,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5B,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM;AAAE,QAAA,OAAO,KAAK;AACxD,IAAA,OAAO,KAAK,CAAC,KAAK,CAChB,CAAC,IAAI,KACH,CAAC,CAAC,IAAI,CAAC,KAAK,SAAS;QACrB,CAAC,CAAC,IAAI,CAAE,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,CAAE,CAAC,MAAM;QACnC,CAAC,CAAC,IAAI,CAAE,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,KAAK,KAAK,OAAO,KAAK,CAAC,CAAC,IAAI,CAAE,CAAC,KAAK,CAAC,CAAC,CAClE;AACH;;AC7iBA;;AAEG;;"}
|
|
@@ -687,6 +687,11 @@ class SlMenuItem {
|
|
|
687
687
|
/** The line under the label, which describes the item rather than naming it. */
|
|
688
688
|
describedBy = signal(null, /* @ts-ignore */
|
|
689
689
|
...(ngDevMode ? [{ debugName: "describedBy" }] : /* istanbul ignore next */ []));
|
|
690
|
+
/**
|
|
691
|
+
* What names the item while a line describes it: the label alone, or the
|
|
692
|
+
* description would be read twice, once in the name and once after it.
|
|
693
|
+
*/
|
|
694
|
+
labelId = `sl-menu-label-${Math.random().toString(36).slice(2, 8)}`;
|
|
690
695
|
menu = inject(SlMenu);
|
|
691
696
|
group = inject(SlMenuRadioGroup, { optional: true });
|
|
692
697
|
element = inject(ElementRef).nativeElement;
|
|
@@ -793,14 +798,14 @@ class SlMenuItem {
|
|
|
793
798
|
this.menu.closeAll('select', source);
|
|
794
799
|
}
|
|
795
800
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: SlMenuItem, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
796
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: SlMenuItem, isStandalone: true, selector: "button[slMenuItem], a[slMenuItem], button[slMenuCheckboxItem], button[slMenuRadioItem]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, textValue: { classPropertyName: "textValue", publicName: "textValue", isSignal: true, isRequired: false, transformFunction: null }, tone: { classPropertyName: "tone", publicName: "tone", isSignal: true, isRequired: false, transformFunction: null }, shortcut: { classPropertyName: "shortcut", publicName: "shortcut", isSignal: true, isRequired: false, transformFunction: null }, closeOnSelect: { classPropertyName: "closeOnSelect", publicName: "closeOnSelect", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange", checkedChangeRequest: "checkedChangeRequest", select: "select" }, host: { attributes: { "data-part": "item", "data-part-item": "", "tabindex": "-1" }, listeners: { "click": "onClick($event)", "keydown": "onKeyDown($event)", "pointermove": "onPointerMove()" }, properties: { "attr.role": "role", "attr.type": "isLink ? null : \"button\"", "attr.aria-checked": "role === \"menuitem\" ? null : isChecked()", "attr.aria-disabled": "disabled() ? true : null", "attr.aria-describedby": "describedBy() ?? null", "attr.aria-keyshortcuts": "announced()", "attr.data-disabled": "disabled() ? \"\" : null", "attr.data-checked": "isChecked() ? \"\" : null", "attr.data-text-value": "textValue() ?? null", "attr.data-tone": "tone() ?? null" } }, exportAs: ["slMenuItem"], ngImport: i0, template: `
|
|
801
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: SlMenuItem, isStandalone: true, selector: "button[slMenuItem], a[slMenuItem], button[slMenuCheckboxItem], button[slMenuRadioItem]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, textValue: { classPropertyName: "textValue", publicName: "textValue", isSignal: true, isRequired: false, transformFunction: null }, tone: { classPropertyName: "tone", publicName: "tone", isSignal: true, isRequired: false, transformFunction: null }, shortcut: { classPropertyName: "shortcut", publicName: "shortcut", isSignal: true, isRequired: false, transformFunction: null }, closeOnSelect: { classPropertyName: "closeOnSelect", publicName: "closeOnSelect", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange", checkedChangeRequest: "checkedChangeRequest", select: "select" }, host: { attributes: { "data-part": "item", "data-part-item": "", "tabindex": "-1" }, listeners: { "click": "onClick($event)", "keydown": "onKeyDown($event)", "pointermove": "onPointerMove()" }, properties: { "attr.role": "role", "attr.type": "isLink ? null : \"button\"", "attr.aria-checked": "role === \"menuitem\" ? null : isChecked()", "attr.aria-disabled": "disabled() ? true : null", "attr.aria-describedby": "describedBy() ?? null", "attr.aria-labelledby": "describedBy() === null ? null : labelId", "attr.aria-keyshortcuts": "announced()", "attr.data-disabled": "disabled() ? \"\" : null", "attr.data-checked": "isChecked() ? \"\" : null", "attr.data-text-value": "textValue() ?? null", "attr.data-tone": "tone() ?? null" } }, exportAs: ["slMenuItem"], ngImport: i0, template: `
|
|
797
802
|
@if (role !== 'menuitem') {
|
|
798
803
|
<span data-part="indicator" data-part-indicator=""
|
|
799
804
|
><span slIcon><svg slGlyph [name]="role === 'menuitemradio' ? 'dot' : 'check'"></svg></span
|
|
800
805
|
></span>
|
|
801
806
|
}
|
|
802
807
|
<ng-content select="[slMenuItemIcon]" />
|
|
803
|
-
<span data-part="label" data-part-label=""><ng-content /></span>
|
|
808
|
+
<span data-part="label" data-part-label="" [id]="labelId"><ng-content /></span>
|
|
804
809
|
<ng-content select="[slMenuItemDescription]" />
|
|
805
810
|
<ng-content select="[slMenuItemMeta]" />
|
|
806
811
|
@if (legend(); as printed) {
|
|
@@ -829,6 +834,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
829
834
|
'[attr.aria-checked]': 'role === "menuitem" ? null : isChecked()',
|
|
830
835
|
'[attr.aria-disabled]': 'disabled() ? true : null',
|
|
831
836
|
'[attr.aria-describedby]': 'describedBy() ?? null',
|
|
837
|
+
'[attr.aria-labelledby]': 'describedBy() === null ? null : labelId',
|
|
832
838
|
'[attr.aria-keyshortcuts]': 'announced()',
|
|
833
839
|
'[attr.data-disabled]': 'disabled() ? "" : null',
|
|
834
840
|
'[attr.data-checked]': 'isChecked() ? "" : null',
|
|
@@ -845,7 +851,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
845
851
|
></span>
|
|
846
852
|
}
|
|
847
853
|
<ng-content select="[slMenuItemIcon]" />
|
|
848
|
-
<span data-part="label" data-part-label=""><ng-content /></span>
|
|
854
|
+
<span data-part="label" data-part-label="" [id]="labelId"><ng-content /></span>
|
|
849
855
|
<ng-content select="[slMenuItemDescription]" />
|
|
850
856
|
<ng-content select="[slMenuItemMeta]" />
|
|
851
857
|
@if (legend(); as printed) {
|