ng-hub-ui-forms 22.33.2 β 22.34.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/README.md +55 -3
- package/fesm2022/ng-hub-ui-forms.mjs +365 -62
- package/fesm2022/ng-hub-ui-forms.mjs.map +1 -1
- package/package.json +7 -1
- package/types/ng-hub-ui-forms.d.ts +265 -35
package/README.md
CHANGED
|
@@ -51,10 +51,12 @@ npm install ng-hub-ui-forms
|
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
`ng-hub-ui-utils` is a peer dependency (the datepicker opens its panel through its overlay
|
|
54
|
-
service, and every field renders its tooltip helper text with `hubTooltip`)
|
|
54
|
+
service, and every field renders its tooltip helper text with `hubTooltip`). `ng-hub-ui-ds`
|
|
55
|
+
carries the design tokens the fields read; it is optional, because every token is read with a
|
|
56
|
+
fallback, but without it the fields fall back to their own defaults instead of your palette:
|
|
55
57
|
|
|
56
58
|
```bash
|
|
57
|
-
npm install ng-hub-ui-utils
|
|
59
|
+
npm install ng-hub-ui-utils ng-hub-ui-ds
|
|
58
60
|
```
|
|
59
61
|
|
|
60
62
|
### 2. Import
|
|
@@ -131,7 +133,7 @@ section.
|
|
|
131
133
|
## π¦ Installation
|
|
132
134
|
|
|
133
135
|
```bash
|
|
134
|
-
npm install ng-hub-ui-forms ng-hub-ui-utils
|
|
136
|
+
npm install ng-hub-ui-forms ng-hub-ui-utils ng-hub-ui-ds
|
|
135
137
|
```
|
|
136
138
|
|
|
137
139
|
### Peer Dependencies
|
|
@@ -142,6 +144,7 @@ npm install ng-hub-ui-forms ng-hub-ui-utils
|
|
|
142
144
|
"@angular/core": ">=21.0.0",
|
|
143
145
|
"@angular/forms": ">=21.0.0",
|
|
144
146
|
"@angular/platform-browser": ">=21.0.0",
|
|
147
|
+
"ng-hub-ui-ds": ">=22.0.0",
|
|
145
148
|
"ng-hub-ui-utils": ">=22.12.0"
|
|
146
149
|
}
|
|
147
150
|
```
|
|
@@ -315,6 +318,38 @@ much room is left to type and so promises typing.
|
|
|
315
318
|
<hub-select formControlName="city" label="City" [items]="cities" bindLabel="name" bindValue="id" groupBy="country" />
|
|
316
319
|
```
|
|
317
320
|
|
|
321
|
+
#### Customization slots
|
|
322
|
+
|
|
323
|
+
Every part of the panel can be re-drawn from a template. The slots carry this library's own name;
|
|
324
|
+
the `ng-*-tmp` attributes of the vendored engine underneath are deprecated and disappear in 23.0.0.
|
|
325
|
+
|
|
326
|
+
```html
|
|
327
|
+
<hub-select formControlName="assignee" label="Assignee" [items]="people" bindLabel="name">
|
|
328
|
+
<ng-template hubSelectLabel let-item="item">{{ item.emoji }} {{ item.name }}</ng-template>
|
|
329
|
+
<ng-template hubSelectOption let-item="item">
|
|
330
|
+
<strong>{{ item.name }}</strong>
|
|
331
|
+
<small>{{ item.role }}</small>
|
|
332
|
+
</ng-template>
|
|
333
|
+
</hub-select>
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
| Slot | Draws | Context |
|
|
337
|
+
| --- | --- | --- |
|
|
338
|
+
| `hubSelectOption` | one option in the list | `item`, `item$`, `index`, `searchTerm` |
|
|
339
|
+
| `hubSelectOptgroup` | a group header, with `groupBy` | `item`, `item$`, `index`, `searchTerm` |
|
|
340
|
+
| `hubSelectLabel` | the selected value, single mode | `item`, `label`, `clear` |
|
|
341
|
+
| `hubSelectMultiLabel` | all selected values at once, multiple mode | `items`, `clear` |
|
|
342
|
+
| `hubSelectHeader` | a fixed block above the list | `searchTerm` |
|
|
343
|
+
| `hubSelectFooter` | a fixed block below the list | `searchTerm` |
|
|
344
|
+
| `hubSelectNotFound` | the "no items found" message | `searchTerm` |
|
|
345
|
+
| `hubSelectTypeToSearch` | the "type to search" hint | β |
|
|
346
|
+
| `hubSelectLoadingText` | the "loadingβ¦" message | `searchTerm` |
|
|
347
|
+
| `hubSelectLoadingSpinner` | the spinner in the control | β |
|
|
348
|
+
| `hubSelectTag` | the "add \<term\>" row, with `addTag` | `searchTerm` |
|
|
349
|
+
| `hubSelectClearButton` | the clear (Γ) control | β |
|
|
350
|
+
|
|
351
|
+
Import the directive you use β `HubSelectOptionDirective`, `HubSelectLabelDirective` and so on.
|
|
352
|
+
|
|
318
353
|
#### Floating label
|
|
319
354
|
|
|
320
355
|
```html
|
|
@@ -630,6 +665,23 @@ form would have written anyway.
|
|
|
630
665
|
The attribute is restricted to `<fieldset>` on purpose: on a `<div>` it would draw a legend over
|
|
631
666
|
a group with none of the semantics assistive technology reads from a real fieldset.
|
|
632
667
|
|
|
668
|
+
#### One way to write the legend
|
|
669
|
+
|
|
670
|
+
`legend="β¦"` is shorthand: it builds a `<hub-legend>` for you. When the legend needs more than a
|
|
671
|
+
string β a required marker, an icon, a badge β project the element yourself and it is lifted into
|
|
672
|
+
the same native `<legend>`, with the same classes.
|
|
673
|
+
|
|
674
|
+
```html
|
|
675
|
+
<fieldset hubFieldset [group]="form.controls.address">
|
|
676
|
+
<hub-legend [required]="true" [invalid]="form.controls.address.invalid">Shipping address</hub-legend>
|
|
677
|
+
β¦
|
|
678
|
+
</fieldset>
|
|
679
|
+
```
|
|
680
|
+
|
|
681
|
+
The older `<ng-template hubLegend>` slot still works and is deprecated: it existed only so a legend
|
|
682
|
+
could carry markup, and `<hub-legend>` carries markup without an `ng-template` and without a second
|
|
683
|
+
directive to import. It is removed in 23.0.0.
|
|
684
|
+
|
|
633
685
|
### Validation states (invalid is automatic, valid is opt-in)
|
|
634
686
|
|
|
635
687
|
The **invalid** state is always automatic: a touched, invalid field shows its
|