ng-hub-ui-forms 22.42.1 → 22.44.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 CHANGED
@@ -148,7 +148,7 @@ npm install ng-hub-ui-forms ng-hub-ui-utils ng-hub-ui-ds
148
148
  "@angular/forms": ">=21.0.0",
149
149
  "@angular/platform-browser": ">=21.0.0",
150
150
  "ng-hub-ui-ds": ">=22.14.1",
151
- "ng-hub-ui-utils": ">=22.12.0"
151
+ "ng-hub-ui-utils": ">=22.21.0"
152
152
  }
153
153
  ```
154
154
 
@@ -566,6 +566,38 @@ Three independent axes control the formats:
566
566
  ISO strings of any width, `Date` instances and epoch milliseconds are detected automatically, so
567
567
  `parse` is only needed for dialects outside that set.
568
568
 
569
+ #### Typing and validation
570
+
571
+ The input is editable by default (`typeable`, default `true`; set `[typeable]="false"` or
572
+ `datepicker: { typeable: false }` in `provideHubForms` for the read-only input of earlier versions;
573
+ `readonly` and `disabled` still win). Clicking opens the calendar as before and typing does not
574
+ close it. The text is committed on blur and on Enter, never on every keystroke:
575
+
576
+ - It is read the way the field writes it, for every `granularity` and `displayFormat` (an Angular
577
+ pattern, `Intl` options, or month names of the `locale`). Any non-digit separator works, 2-digit
578
+ years mean 20yy, and impossible dates such as 31/02 are rejected.
579
+ - Empty text commits `null`. Text that is not a date makes the value `null`, stays visible so it
580
+ can be fixed, and adds the `hubDatepickerParse` error; it is never turned into another date.
581
+ - `single`, `range` and `day-time-range` support typing. A range is split on `rangeSeparator`
582
+ (a hyphen or dash also works) and needs both ends, the end not before the start.
583
+ - A `displayFormat` function cannot be inverted, so typed text is read in the locale's own order.
584
+
585
+ ```html
586
+ <hub-datepicker formControlName="due" label="Due date" [min]="today" [max]="deadline" />
587
+ ```
588
+
589
+ | Error key | Payload | When |
590
+ | :---------------------- | :------------------------- | :-------------------------------------------- |
591
+ | `hubDatepickerParse` | `{ text, format }` | The typed text is not a date (`format`: hint) |
592
+ | `hubDatepickerMin` | `{ min, actual, minText }` | A date is before `min` |
593
+ | `hubDatepickerMax` | `{ max, actual, maxText }` | A date is after `max` |
594
+ | `hubDatepickerDisabled` | `{ actual }` | `disabledDates` rejects a date |
595
+
596
+ `minText` and `maxText` are the bound written the way the field displays dates, ready for a message.
597
+
598
+ `min`, `max` and `disabledDates` validate any value, typed or programmatic. Their messages
599
+ come from `invalidFeedbackTemplateFn` like the other keys.
600
+
569
601
  ### Timepicker
570
602
 
571
603
  A time of day, as `HH:MM`. Built on the platform's `<input type="time">`, so it brings the
@@ -811,6 +843,13 @@ form = new FormGroup(
811
843
  On submit, each invalid field shows its error and the cross-field `hubAreEqual`
812
844
  error is surfaced by the fieldset/form — no manual error markup anywhere.
813
845
 
846
+ Inside a container that lays fields out as cells, a message under the control would make the
847
+ row taller. Such a container provides `HUB_FIELD_FEEDBACK` (from `ng-hub-ui-utils`) with
848
+ `'tooltip'`, and the fields inside it ring themselves in the danger colour and keep the message
849
+ for a tooltip on hover, in the danger colour with white or black text by contrast. The message
850
+ stays in the page, visually hidden, so screen readers still announce it. The paginable table does
851
+ this under `flushFields`, and the spreadsheet for the fields it opens in a cell.
852
+
814
853
  #### Taking the reader to the errors
815
854
 
816
855
  `hubScrollToError` on the submit button scrolls to the first error left on screen and focuses its
@@ -895,7 +934,7 @@ bootstrapApplication(AppComponent, {
895
934
  providers: [
896
935
  provideHubForms({
897
936
  showValid: true,
898
- datepicker: { firstDayOfWeek: 1, displayFormat: 'dd/MM/yyyy' }
937
+ datepicker: { firstDayOfWeek: 1, displayFormat: 'dd/MM/yyyy', typeable: true }
899
938
  })
900
939
  ]
901
940
  });