ng-hub-ui-forms 22.42.0 → 22.43.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
@@ -147,7 +147,7 @@ npm install ng-hub-ui-forms ng-hub-ui-utils ng-hub-ui-ds
147
147
  "@angular/core": ">=21.0.0",
148
148
  "@angular/forms": ">=21.0.0",
149
149
  "@angular/platform-browser": ">=21.0.0",
150
- "ng-hub-ui-ds": ">=22.0.0",
150
+ "ng-hub-ui-ds": ">=22.14.1",
151
151
  "ng-hub-ui-utils": ">=22.12.0"
152
152
  }
153
153
  ```
@@ -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
@@ -895,7 +927,7 @@ bootstrapApplication(AppComponent, {
895
927
  providers: [
896
928
  provideHubForms({
897
929
  showValid: true,
898
- datepicker: { firstDayOfWeek: 1, displayFormat: 'dd/MM/yyyy' }
930
+ datepicker: { firstDayOfWeek: 1, displayFormat: 'dd/MM/yyyy', typeable: true }
899
931
  })
900
932
  ]
901
933
  });