ng-hub-ui-forms 22.40.0 → 22.42.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-hub-ui-forms",
3
- "version": "22.40.0",
3
+ "version": "22.42.0",
4
4
  "license": "MIT",
5
5
  "description": "Accessible, signal-based form fields for Angular (input, textarea, slider, segmented, select, datepicker, file input with drag & drop and upload progress) with automatic error display for controls, FormGroups and FormArrays. Reactive Forms today, Signal Forms ready. Part of the ng-hub-ui family.",
6
6
  "author": "Carlos Morcillo Fernández <carlos.morcillo@me.com> (https://www.carlosmorcillo.com)",
@@ -615,6 +615,8 @@
615
615
  --hub-select-dropdown-border-color: var(--hub-sys-border-color-default, #dee2e6);
616
616
  --hub-select-dropdown-border-radius: var(--hub-ref-radius-md, 0.375rem);
617
617
  --hub-select-dropdown-box-shadow: var(--hub-sys-shadow, 0 0.5rem 1rem rgba(0, 0, 0, 0.15));
618
+ // How far a list may grow past its control to show its options whole.
619
+ --hub-select-dropdown-max-width: 24rem;
618
620
  // Dropdown panel stacking. The vendored ng-select hard-codes `z-index: 1050` on
619
621
  // `.ng-dropdown-panel` — one below HubModal (`--hub-sys-zindex-modal`, 1055) — so a
620
622
  // select opened inside a modal was clipped underneath it. Sit a few layers above
@@ -1805,6 +1805,22 @@ declare class HubSelectComponent extends HubFieldControl {
1805
1805
  * one sync away from disappearing. See {@link placeholder}.
1806
1806
  */
1807
1807
  protected readonly _ngSelectConfig: NgSelectConfig;
1808
+ /**
1809
+ * The engine behind the field, kept only so the list can be worked from outside.
1810
+ *
1811
+ * A select that something else opens — a grid cell that turns into an editor, a row that turns
1812
+ * into a form — is created after the reader's click has already been spent, so there is no
1813
+ * gesture left for it to answer. Without a way in, reaching the field takes one click and
1814
+ * seeing the list takes another.
1815
+ */
1816
+ private readonly _engine;
1817
+ /**
1818
+ * Honours {@link autoOpen} once, after the first render.
1819
+ *
1820
+ * Not an effect: the intent is a one-off at birth, and an effect would re-open the list every
1821
+ * time the flag or the items changed underneath the reader.
1822
+ */
1823
+ private readonly _openOnArrival;
1808
1824
  protected readonly _labelTypes: typeof HubLabelTypes;
1809
1825
  protected readonly _selectFormats: typeof HubSelectFormats;
1810
1826
  protected readonly _value: _angular_core.WritableSignal<any>;
@@ -1951,6 +1967,24 @@ declare class HubSelectComponent extends HubFieldControl {
1951
1967
  readonly loading: _angular_core.InputSignalWithTransform<boolean, unknown>;
1952
1968
  /** Whether the control is read-only. */
1953
1969
  readonly readonly: _angular_core.InputSignalWithTransform<boolean, unknown>;
1970
+ /**
1971
+ * Opens the list as soon as the field appears.
1972
+ *
1973
+ * For a field that something else has already opened for the reader: a spreadsheet cell that
1974
+ * becomes an editor, a row that becomes a form. The click that got them there has been spent by
1975
+ * the time the field exists, so without this reaching the field costs one click and seeing the
1976
+ * list costs another. A field with nothing to offer opens all the same and says so, which is
1977
+ * what it would do had the reader opened it by hand.
1978
+ */
1979
+ readonly autoOpen: _angular_core.InputSignalWithTransform<boolean, unknown>;
1980
+ /**
1981
+ * A search term the field starts with.
1982
+ *
1983
+ * For the same case as {@link autoOpen}, one keystroke earlier: the character that opened the
1984
+ * field belongs in its search box, or the reader has to type it a second time. Applied once,
1985
+ * on arrival, and only when the field is searchable.
1986
+ */
1987
+ readonly initialSearchTerm: _angular_core.InputSignal<string | null>;
1954
1988
  /**
1955
1989
  * Text shown when no items match. Left undefined so the engine falls back to the app's
1956
1990
  * `NgSelectConfig`, which is where a translated build sets it once for every select.
@@ -2105,8 +2139,25 @@ declare class HubSelectComponent extends HubFieldControl {
2105
2139
  * @param item - The item to toggle.
2106
2140
  */
2107
2141
  protected toggleItem(item: any): void;
2142
+ /**
2143
+ * Opens the list.
2144
+ *
2145
+ * Refused while the field is disabled, while it is already open, and while there is nothing to
2146
+ * choose from, so calling it the moment the field appears is safe whatever state it is in.
2147
+ */
2148
+ open(): void;
2149
+ /** Closes the list, keeping whatever was chosen. */
2150
+ close(): void;
2151
+ /** Puts the keyboard in the field without opening the list. */
2152
+ focus(): void;
2153
+ /**
2154
+ * Narrows the list by a term, as typing into the search box would.
2155
+ *
2156
+ * @param term - What to search for; an empty string clears the search.
2157
+ */
2158
+ search(term: string): void;
2108
2159
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<HubSelectComponent, never>;
2109
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<HubSelectComponent, "hub-select", never, { "prepend": { "alias": "prepend"; "required": false; "isSignal": true; }; "append": { "alias": "append"; "required": false; "isSignal": true; }; "format": { "alias": "format"; "required": false; "isSignal": true; }; "vertical": { "alias": "vertical"; "required": false; "isSignal": true; }; "items": { "alias": "items"; "required": false; "isSignal": true; }; "bindLabel": { "alias": "bindLabel"; "required": false; "isSignal": true; }; "bindValue": { "alias": "bindValue"; "required": false; "isSignal": true; }; "groupBy": { "alias": "groupBy"; "required": false; "isSignal": true; }; "searchFn": { "alias": "searchFn"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "labelType": { "alias": "labelType"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "searchable": { "alias": "searchable"; "required": false; "isSignal": true; }; "clearable": { "alias": "clearable"; "required": false; "isSignal": true; }; "closeOnSelect": { "alias": "closeOnSelect"; "required": false; "isSignal": true; }; "clearSearchOnAdd": { "alias": "clearSearchOnAdd"; "required": false; "isSignal": true; }; "fixedPlaceholder": { "alias": "fixedPlaceholder"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "notFoundText": { "alias": "notFoundText"; "required": false; "isSignal": true; }; "appendTo": { "alias": "appendTo"; "required": false; "isSignal": true; }; "addTag": { "alias": "addTag"; "required": false; "isSignal": true; }; "addTagText": { "alias": "addTagText"; "required": false; "isSignal": true; }; "minTermLength": { "alias": "minTermLength"; "required": false; "isSignal": true; }; "typeahead": { "alias": "typeahead"; "required": false; "isSignal": true; }; "compareWith": { "alias": "compareWith"; "required": false; "isSignal": true; }; "classlist": { "alias": "classlist"; "required": false; "isSignal": true; }; }, { "valueChange": "valueChange"; "change": "change"; "onFocus": "onFocus"; "onBlur": "onBlur"; "onOpen": "onOpen"; "onClose": "onClose"; "onClear": "onClear"; "onSearch": "onSearch"; "onAdd": "onAdd"; "onRemove": "onRemove"; "scroll": "scroll"; "scrollToEnd": "scrollToEnd"; }, ["_hubOptionTpl", "_ngOptionTpl", "_hubOptgroupTpl", "_ngOptgroupTpl", "_hubLabelTpl", "_ngLabelTpl", "_hubMultiLabelTpl", "_ngMultiLabelTpl", "_hubHeaderTpl", "_ngHeaderTpl", "_hubFooterTpl", "_ngFooterTpl", "_hubNotFoundTpl", "_ngNotFoundTpl", "_hubTypeToSearchTpl", "_ngTypeToSearchTpl", "_hubLoadingTextTpl", "_ngLoadingTextTpl", "_hubLoadingSpinnerTpl", "_ngLoadingSpinnerTpl", "_hubTagTpl", "_ngTagTpl", "_hubClearButtonTpl", "_ngClearButtonTpl", "_legacySuffixTpl", "_prependTpl", "_genericAppendTpl"], ["*"], true, never>;
2160
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<HubSelectComponent, "hub-select", never, { "prepend": { "alias": "prepend"; "required": false; "isSignal": true; }; "append": { "alias": "append"; "required": false; "isSignal": true; }; "format": { "alias": "format"; "required": false; "isSignal": true; }; "vertical": { "alias": "vertical"; "required": false; "isSignal": true; }; "items": { "alias": "items"; "required": false; "isSignal": true; }; "bindLabel": { "alias": "bindLabel"; "required": false; "isSignal": true; }; "bindValue": { "alias": "bindValue"; "required": false; "isSignal": true; }; "groupBy": { "alias": "groupBy"; "required": false; "isSignal": true; }; "searchFn": { "alias": "searchFn"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "labelType": { "alias": "labelType"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "searchable": { "alias": "searchable"; "required": false; "isSignal": true; }; "clearable": { "alias": "clearable"; "required": false; "isSignal": true; }; "closeOnSelect": { "alias": "closeOnSelect"; "required": false; "isSignal": true; }; "clearSearchOnAdd": { "alias": "clearSearchOnAdd"; "required": false; "isSignal": true; }; "fixedPlaceholder": { "alias": "fixedPlaceholder"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "autoOpen": { "alias": "autoOpen"; "required": false; "isSignal": true; }; "initialSearchTerm": { "alias": "initialSearchTerm"; "required": false; "isSignal": true; }; "notFoundText": { "alias": "notFoundText"; "required": false; "isSignal": true; }; "appendTo": { "alias": "appendTo"; "required": false; "isSignal": true; }; "addTag": { "alias": "addTag"; "required": false; "isSignal": true; }; "addTagText": { "alias": "addTagText"; "required": false; "isSignal": true; }; "minTermLength": { "alias": "minTermLength"; "required": false; "isSignal": true; }; "typeahead": { "alias": "typeahead"; "required": false; "isSignal": true; }; "compareWith": { "alias": "compareWith"; "required": false; "isSignal": true; }; "classlist": { "alias": "classlist"; "required": false; "isSignal": true; }; }, { "valueChange": "valueChange"; "change": "change"; "onFocus": "onFocus"; "onBlur": "onBlur"; "onOpen": "onOpen"; "onClose": "onClose"; "onClear": "onClear"; "onSearch": "onSearch"; "onAdd": "onAdd"; "onRemove": "onRemove"; "scroll": "scroll"; "scrollToEnd": "scrollToEnd"; }, ["_hubOptionTpl", "_ngOptionTpl", "_hubOptgroupTpl", "_ngOptgroupTpl", "_hubLabelTpl", "_ngLabelTpl", "_hubMultiLabelTpl", "_ngMultiLabelTpl", "_hubHeaderTpl", "_ngHeaderTpl", "_hubFooterTpl", "_ngFooterTpl", "_hubNotFoundTpl", "_ngNotFoundTpl", "_hubTypeToSearchTpl", "_ngTypeToSearchTpl", "_hubLoadingTextTpl", "_ngLoadingTextTpl", "_hubLoadingSpinnerTpl", "_ngLoadingSpinnerTpl", "_hubTagTpl", "_ngTagTpl", "_hubClearButtonTpl", "_ngClearButtonTpl", "_legacySuffixTpl", "_prependTpl", "_genericAppendTpl"], ["*"], true, never>;
2110
2161
  }
2111
2162
 
2112
2163
  /** A calendar cell enriched with its selection / range / disabled / focus state. */
@@ -3379,6 +3430,50 @@ declare class HubAutoresizeDirective implements OnInit {
3379
3430
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<HubAutoresizeDirective, "textarea[hubAutoresize]", never, { "hubAutoresize": { "alias": "hubAutoresize"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
3380
3431
  }
3381
3432
 
3433
+ /**
3434
+ * Takes the person to what is wrong, on the button that found it.
3435
+ *
3436
+ * Put it on a submit or «Next» button. It answers for the button's own form (the one it sits in,
3437
+ * or the one its `form` attribute names), or for the element you give it. Each press that leaves errors on screen scrolls to the next one and focuses its
3438
+ * control, so a long form with three mistakes is walked in three presses instead of hunted by
3439
+ * eye; after the last one it starts again from the first.
3440
+ *
3441
+ * It reads the page and not a form model, because errors come from several places: reactive
3442
+ * controls, fields drawn from a schema, the cells of a sheet. What counts as an error is the
3443
+ * hub fields' own invalid state plus whatever `hubScrollToErrorSelector` adds, so a product can
3444
+ * teach it its own error marks without forking it.
3445
+ *
3446
+ * It runs after the button's own handler has had a frame to paint the errors, and does nothing
3447
+ * when there are none, so it never stands in the way of a valid submit. Scrolling is instant
3448
+ * when the reader asks for reduced motion.
3449
+ *
3450
+ * @example
3451
+ * ```html
3452
+ * <form id="customer" hubForm [formGroup]="group" (submit)="save()">…</form>
3453
+ * <button hubButton type="submit" form="customer" hubScrollToError>Save</button>
3454
+ *
3455
+ * <!-- Another block of the page, with a product's own error marks as well -->
3456
+ * <section #sheet>…</section>
3457
+ * <button [hubScrollToError]="sheet" hubScrollToErrorSelector=".my-error, .hub-spreadsheet__cell--invalid">
3458
+ * ```
3459
+ */
3460
+ declare class HubScrollToErrorDirective {
3461
+ #private;
3462
+ /**
3463
+ * The block of the page whose errors this button walks. Left empty, the button's own form:
3464
+ * a template reference on `<form hubForm>` names the component, not the element, so the
3465
+ * form is reached through the button instead.
3466
+ */
3467
+ readonly hubScrollToError: _angular_core.InputSignal<"" | HTMLElement | ElementRef<HTMLElement>>;
3468
+ /** More CSS selectors that read as an error, added to the hub fields' own. */
3469
+ readonly hubScrollToErrorSelector: _angular_core.InputSignal<string>;
3470
+ protected onClick(): void;
3471
+ /** Scrolls to the next error on screen and focuses it; a no-op when there is none. */
3472
+ goToNextError(): void;
3473
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<HubScrollToErrorDirective, never>;
3474
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<HubScrollToErrorDirective, "[hubScrollToError]", never, { "hubScrollToError": { "alias": "hubScrollToError"; "required": false; "isSignal": true; }; "hubScrollToErrorSelector": { "alias": "hubScrollToErrorSelector"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
3475
+ }
3476
+
3382
3477
  /**
3383
3478
  * Marks content attached to the **inline-start edge** of a field (left in LTR, right in RTL) —
3384
3479
  * an icon, a button, another field, anything richer than the text a `prepend` string can carry.
@@ -4004,6 +4099,25 @@ interface HubFormControlConfig {
4004
4099
  ariaLabel?: string;
4005
4100
  cssClass?: string;
4006
4101
  options?: ReadonlyArray<HubFormControlOption>;
4102
+ /**
4103
+ * Whether a select offers a search box. Off unless asked for.
4104
+ *
4105
+ * A control built into somebody else's chrome is usually a short list in a tight space — a
4106
+ * table's rows-per-page, a filter — where a search box is noise. A cell of a spreadsheet is
4107
+ * the other case, and a long list there is the whole reason for wiring an adapter at all.
4108
+ */
4109
+ searchable?: boolean;
4110
+ /** Whether it offers to clear itself. On unless the host says otherwise, as the field does. */
4111
+ clearable?: boolean;
4112
+ /**
4113
+ * Whether a select opens as it appears, and on what term.
4114
+ *
4115
+ * For a control that something else has already opened for the reader: a cell that becomes an
4116
+ * editor, a row that becomes a form. Their gesture has been spent by the time the control
4117
+ * exists, and the character they typed belongs in its search box.
4118
+ */
4119
+ autoOpen?: boolean;
4120
+ searchTerm?: string;
4007
4121
  onValueChange: (value: unknown) => void;
4008
4122
  }
4009
4123
  /** Live handle to a control created by {@link hubFormControlAdapter}. */
@@ -4031,5 +4145,5 @@ interface HubFormControlAdapter {
4031
4145
  */
4032
4146
  declare const hubFormControlAdapter: HubFormControlAdapter;
4033
4147
 
4034
- export { FormTextTypes, HUB_COLOR_PALETTES, HUB_FILE_UPLOADER, HUB_FORMS_CONFIG, HubAppendDirective, HubAutoresizeDirective, HubDatepickerComponent, HubFieldControl, HubFieldsetComponent, HubFileDropDirective, HubFileDropOverlayComponent, HubFileDropzoneNoticeDirective, HubFileIconDirective, HubFileInputComponent, HubFilePreviewDirective, HubFormComponent, HubFormControl, HubFormTextDirective, HubGroupControl, HubInputComponent, HubInputFormats, HubInputPrefixDirective, HubInputSuffixDirective, HubInvertColorPipe, HubJoinButLastPipe, HubLabelTypes, HubLegendComponent, HubLegendDirective, HubMapPipe, HubOtpInputComponent, HubPrependDirective, HubSafeUrlPipe, HubSegmentedComponent, HubSegmentedOptionDirective, HubSelectClearButtonDirective, HubSelectComponent, HubSelectFooterDirective, HubSelectFormats, HubSelectHeaderDirective, HubSelectLabelDirective, HubSelectLoadingSpinnerDirective, HubSelectLoadingTextDirective, HubSelectMultiLabelDirective, HubSelectNotFoundDirective, HubSelectOptgroupDirective, HubSelectOptionDirective, HubSelectSuffixDirective, HubSelectTagDirective, HubSelectTypeToSearchDirective, HubSliderComponent, HubSnakeUpperPipe, HubTextareaComponent, HubTimepickerComponent, HubUcfirstPipe, HubValidationErrorDirective, NgClearButtonTemplateDirective, NgFooterTemplateDirective, NgHeaderTemplateDirective, NgLabelTemplateDirective, NgLoadingSpinnerTemplateDirective, NgLoadingTextTemplateDirective, NgMultiLabelTemplateDirective, NgNotFoundTemplateDirective, NgOptgroupTemplateDirective, NgOptionComponent, NgOptionTemplateDirective, NgSelectConfig, NgTagTemplateDirective, NgTypeToSearchTemplateDirective, applyMask, areEqual, camelToSnakeUpper, controlHasMinOrMaxValidator, defaultHubColorConfig, defaultHubDatepickerConfig, defaultHubDatepickerLabels, defaultHubFileInputLabels, defaultHubFormsConfig, defaultHubPasswordLabels, defaultInvalidFeedback, fileKey, fileKind, formatFileSize, get, getActiveElement, getMinOrMaxValueFromValidator, hubAcceptedFiles, hubAreEqual, hubFormControlAdapter, hubMaxFileSize, hubMaxFiles, hubMaxTotalSize, hubMinFileSize, hubMinFiles, isDefined, isMaskActive, isString, joinButLast, matchesAccept, provideHubFileUploader, provideHubForms, runInZone, scorePasswordStrength, toFileArray, uuid };
4148
+ export { FormTextTypes, HUB_COLOR_PALETTES, HUB_FILE_UPLOADER, HUB_FORMS_CONFIG, HubAppendDirective, HubAutoresizeDirective, HubDatepickerComponent, HubFieldControl, HubFieldsetComponent, HubFileDropDirective, HubFileDropOverlayComponent, HubFileDropzoneNoticeDirective, HubFileIconDirective, HubFileInputComponent, HubFilePreviewDirective, HubFormComponent, HubFormControl, HubFormTextDirective, HubGroupControl, HubInputComponent, HubInputFormats, HubInputPrefixDirective, HubInputSuffixDirective, HubInvertColorPipe, HubJoinButLastPipe, HubLabelTypes, HubLegendComponent, HubLegendDirective, HubMapPipe, HubOtpInputComponent, HubPrependDirective, HubSafeUrlPipe, HubScrollToErrorDirective, HubSegmentedComponent, HubSegmentedOptionDirective, HubSelectClearButtonDirective, HubSelectComponent, HubSelectFooterDirective, HubSelectFormats, HubSelectHeaderDirective, HubSelectLabelDirective, HubSelectLoadingSpinnerDirective, HubSelectLoadingTextDirective, HubSelectMultiLabelDirective, HubSelectNotFoundDirective, HubSelectOptgroupDirective, HubSelectOptionDirective, HubSelectSuffixDirective, HubSelectTagDirective, HubSelectTypeToSearchDirective, HubSliderComponent, HubSnakeUpperPipe, HubTextareaComponent, HubTimepickerComponent, HubUcfirstPipe, HubValidationErrorDirective, NgClearButtonTemplateDirective, NgFooterTemplateDirective, NgHeaderTemplateDirective, NgLabelTemplateDirective, NgLoadingSpinnerTemplateDirective, NgLoadingTextTemplateDirective, NgMultiLabelTemplateDirective, NgNotFoundTemplateDirective, NgOptgroupTemplateDirective, NgOptionComponent, NgOptionTemplateDirective, NgSelectConfig, NgTagTemplateDirective, NgTypeToSearchTemplateDirective, applyMask, areEqual, camelToSnakeUpper, controlHasMinOrMaxValidator, defaultHubColorConfig, defaultHubDatepickerConfig, defaultHubDatepickerLabels, defaultHubFileInputLabels, defaultHubFormsConfig, defaultHubPasswordLabels, defaultInvalidFeedback, fileKey, fileKind, formatFileSize, get, getActiveElement, getMinOrMaxValueFromValidator, hubAcceptedFiles, hubAreEqual, hubFormControlAdapter, hubMaxFileSize, hubMaxFiles, hubMaxTotalSize, hubMinFileSize, hubMinFiles, isDefined, isMaskActive, isString, joinButLast, matchesAccept, provideHubFileUploader, provideHubForms, runInZone, scorePasswordStrength, toFileArray, uuid };
4035
4149
  export type { FormTextType, HubColorConfig, HubColorPaletteName, HubColorSwatch, HubColorSwatchInput, HubCurrentFile, HubDateRange, HubDateValue, HubDatepickerConfig, HubDatepickerGranularity, HubDatepickerLabels, HubDatepickerMode, HubDatepickerValueFormat, HubFileConstraints, HubFileDropScope, HubFileIconContext, HubFileInputAppearance, HubFileInputLabels, HubFileItem, HubFileKind, HubFilePreview, HubFilePreviewContext, HubFileRejection, HubFileRejectionReason, HubFileStatus, HubFileUploadEvent, HubFileUploader, HubFileValue, HubFormControlAdapter, HubFormControlConfig, HubFormControlHandle, HubFormControlOption, HubFormsConfig, HubGroupErrorTrigger, HubInputFormat, HubLabelType, HubMaskResult, HubOtpMode, HubPasswordLabels, HubPasswordStrengthScore, HubSegmentedOption, HubSegmentedOptionContext, HubSegmentedSize, HubSelectFormat, HubSliderValue };