@ecodev/natural 64.0.2 → 65.0.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/index.d.ts CHANGED
@@ -1678,8 +1678,8 @@ declare function validateAllFormControls(control: AbstractControl<unknown>): voi
1678
1678
  /**
1679
1679
  * Emits exactly 0 or 1 time:
1680
1680
  *
1681
- * - if the form is VALID, emits immediately
1682
- * - if the form is PENDING emits if it changes from PENDING to VALID
1681
+ * - if the form is `VALID`, emits immediately
1682
+ * - if the form is `PENDING` emits if it changes from `PENDING` to `VALID`
1683
1683
  * - any other cases will **never** emit
1684
1684
  */
1685
1685
  declare function ifValid(control: AbstractControl): Observable<'VALID'>;
@@ -1689,23 +1689,21 @@ declare function ifValid(control: AbstractControl): Observable<'VALID'>;
1689
1689
  * This is meant to replace **all** usages of Angular too permissive `Validators.email`
1690
1690
  */
1691
1691
  declare function deliverableEmail(control: AbstractControl): ValidationErrors | null;
1692
+ declare const urlPattern: string;
1692
1693
  /**
1693
1694
  * Naive URL validator for "normal" web links, that is a bit too permissive
1694
1695
  *
1695
- * It enforces:
1696
- *
1696
+ * - It enforces:
1697
1697
  * - http/https protocol
1698
1698
  * - one domain
1699
1699
  * - one tld
1700
- *
1701
- * It allows:
1702
- *
1700
+ * - It allows:
1703
1701
  * - any number of subdomains
1704
1702
  * - any parameters
1705
1703
  * - any fragments
1706
1704
  * - any characters for any parts (does not conform to rfc1738)
1707
1705
  */
1708
- declare const urlValidator: ValidatorFn;
1706
+ declare const url: ValidatorFn;
1709
1707
  /**
1710
1708
  * Validates that the value is an integer (non-float)
1711
1709
  */
@@ -1721,6 +1719,26 @@ declare function decimal(scale: number): ValidatorFn;
1721
1719
  * Validate that the value is an amount of money, meaning a number with at most 2 decimals
1722
1720
  */
1723
1721
  declare function money(control: AbstractControl): ValidationErrors | null;
1722
+ /**
1723
+ * Validate that the number is strictly greater than given one.
1724
+ *
1725
+ * `Validators.min()` is "greater than or equal", but this one is strictly
1726
+ * "greater than".
1727
+ *
1728
+ * **SHOULD NOT USE IT**, instead consider using Angular's native `Validators.min()`.
1729
+ * Because you should also apply `[attr.min]="123"` in the template to have the browser
1730
+ * help the user. And that attribute spec defines that it is "greater or equal", which
1731
+ * contradicts this validator. So we cannot use this validator and have the best UX.
1732
+ */
1733
+ declare function greaterThan(min: number): ValidatorFn;
1734
+ /**
1735
+ * Validate a 32 bits MiFare hexadecimal CSN
1736
+ */
1737
+ declare function nfcCardHex(control: AbstractControl): ValidationErrors | null;
1738
+ /**
1739
+ * Validate a time similar to "14h35", "14:35" or "14h".
1740
+ */
1741
+ declare function time(control: AbstractControl): ValidationErrors | null;
1724
1742
 
1725
1743
  type ProgressBar = {
1726
1744
  start: () => void;
@@ -1926,6 +1944,64 @@ declare class NaturalEnumPipe implements PipeTransform {
1926
1944
  static ɵpipe: i0.ɵɵPipeDeclaration<NaturalEnumPipe, "enum", true>;
1927
1945
  }
1928
1946
 
1947
+ /**
1948
+ * Return a single error message for the first found error, if any.
1949
+ *
1950
+ * Typical usage is without `@if`:
1951
+ *
1952
+ * ```html
1953
+ * <mat-form-field>
1954
+ * <input matInput formControlName="name" />
1955
+ * <mat-label i18n>Nom</mat-label>
1956
+ * <mat-error>{{ form.get('name')?.errors | errorMessage }}</mat-error>
1957
+ * </mat-form-field>
1958
+ * ```
1959
+ *
1960
+ * If you need custom error messages, you can override, or defined new ones like that:
1961
+ *
1962
+ * ```html
1963
+ * <mat-form-field>
1964
+ * <input matInput formControlName="name" />
1965
+ * <mat-label i18n>Nom</mat-label>
1966
+ * @if (form.get('name')?.hasError('required')) {
1967
+ * <mat-error>Ce champ est requis parce qu'il est vraiment très important</mat-error>
1968
+ * } @else {
1969
+ * <mat-error>{{ form.get('name')?.errors | errorMessage }}</mat-error>
1970
+ * }
1971
+ * </mat-form-field>
1972
+ * ```
1973
+ *
1974
+ * Supported validators are:
1975
+ *
1976
+ * - Angular
1977
+ * - `Validators.max`
1978
+ * - `Validators.maxlength`
1979
+ * - `Validators.min`
1980
+ * - `Validators.minlength`
1981
+ * - `Validators.required`
1982
+ * - Natural
1983
+ * - `available`
1984
+ * - `decimal`
1985
+ * - `deliverableEmail`
1986
+ * - `greaterThan`
1987
+ * - `integer`
1988
+ * - `money`
1989
+ * - `nfcCardHex`
1990
+ * - `time`
1991
+ * - `unique`
1992
+ * - `url`
1993
+ * - Others, that live in individual projects, but we exceptionally support here
1994
+ * - `iban`
1995
+ * - `validateCity`
1996
+ *
1997
+ * @param unit is used to build the message for the following validators: `min`, `max`, `greaterThan`
1998
+ */
1999
+ declare class NaturalErrorMessagePipe implements PipeTransform {
2000
+ transform(errors: ValidationErrors | null | undefined, unit?: string): string;
2001
+ static ɵfac: i0.ɵɵFactoryDeclaration<NaturalErrorMessagePipe, never>;
2002
+ static ɵpipe: i0.ɵɵPipeDeclaration<NaturalErrorMessagePipe, "errorMessage", true>;
2003
+ }
2004
+
1929
2005
  /**
1930
2006
  * Returns a string to approximately describe the date.
1931
2007
  *
@@ -4194,5 +4270,5 @@ declare const naturalProviders: ApplicationConfig['providers'];
4194
4270
  */
4195
4271
  declare function graphqlQuerySigner(key: string): HttpInterceptorFn;
4196
4272
 
4197
- export { AvatarService, InvalidWithValueStateMatcher$1 as InvalidWithValueStateMatcher, LOCAL_STORAGE, NATURAL_DROPDOWN_DATA, NATURAL_ICONS_CONFIG, NATURAL_PERSISTENCE_VALIDATOR, NATURAL_SEO_CONFIG, NaturalAbstractDetail, NaturalAbstractEditableList, NaturalAbstractList, NaturalAbstractModelService, NaturalAbstractNavigableList, NaturalAbstractPanel, NaturalAlertService, NaturalAvatarComponent, NaturalBackgroundDensityDirective, NaturalCapitalizePipe, NaturalColumnsPickerComponent, NaturalConfirmComponent, NaturalDataSource, NaturalDebounceService, NaturalDetailHeaderComponent, NaturalDialogTriggerComponent, NaturalDropdownRef, NaturalEllipsisPipe, NaturalEnumPipe, NaturalEnumService, NaturalErrorHandler, NaturalFileComponent, NaturalFileDropDirective, NaturalFileSelectDirective, NaturalFileService, NaturalFixedButtonComponent, NaturalFixedButtonDetailComponent, NaturalHierarchicSelectorComponent, NaturalHierarchicSelectorDialogComponent, NaturalHierarchicSelectorDialogService, NaturalHierarchicSelectorService, NaturalHttpPrefixDirective, NaturalIconDirective, NaturalLinkMutationService, NaturalLinkableTabDirective, NaturalLoggerConfigExtra, NaturalLoggerConfigUrl, NaturalMatomoService, NaturalMemoryStorage, NaturalPanelsComponent, NaturalPanelsService, NaturalPersistenceService, NaturalQueryVariablesManager, NaturalRelationsComponent, NaturalSearchComponent, NaturalSelectComponent, NaturalSelectEnumComponent, NaturalSelectHierarchicComponent, NaturalSeoService, NaturalSidenavComponent, NaturalSidenavContainerComponent, NaturalSidenavContentComponent, NaturalSidenavService, NaturalSidenavStackService, NaturalSrcDensityDirective, NaturalStampComponent, NaturalSwissParsingDateAdapter, NaturalTableButtonComponent, NaturalTimeAgoPipe, NetworkActivityService, PanelsHooksConfig, SESSION_STORAGE, SortingOrder, TypeBooleanComponent, TypeDateComponent, TypeDateRangeComponent, TypeHierarchicSelectorComponent, TypeNaturalSelectComponent, TypeNumberComponent, TypeOptionsComponent, TypeSelectComponent, TypeTextComponent, activityInterceptor, available, cancellableTimeout, cloneDeepButSkipFile, collectErrors, commonImageMimeTypes, copyToClipboard, createHttpLink, debug, decimal, deepFreeze, deliverableEmail, ensureHttpPrefix, fallbackIfNoOpenedPanels, formatIsoDate, formatIsoDateTime, fromUrl, getForegroundColor, graphqlQuerySigner, hasFilesAndProcessDate, ifValid, integer, isFile, localStorageFactory, localStorageProvider, makePlural, memoryLocalStorageProvider, memorySessionStorageProvider, mergeOverrideArray, money, naturalPanelsUrlMatcher, naturalProviders, onHistoryEvent, possibleComparableOperators, provideErrorHandler, provideIcons, providePanels, provideSeo, relationsToIds, replaceObjectKeepingReference, replaceOperatorByField, replaceOperatorByName, rgbToHex, sessionStorageFactory, sessionStorageProvider, toGraphQLDoctrineFilter, toNavigationParameters, toUrl, unique, upperCaseFirstLetter, urlValidator, validTlds, validateAllFormControls, validateColumns, validatePagination, validateSorting, wrapLike, wrapPrefix, wrapSuffix };
4273
+ export { AvatarService, InvalidWithValueStateMatcher$1 as InvalidWithValueStateMatcher, LOCAL_STORAGE, NATURAL_DROPDOWN_DATA, NATURAL_ICONS_CONFIG, NATURAL_PERSISTENCE_VALIDATOR, NATURAL_SEO_CONFIG, NaturalAbstractDetail, NaturalAbstractEditableList, NaturalAbstractList, NaturalAbstractModelService, NaturalAbstractNavigableList, NaturalAbstractPanel, NaturalAlertService, NaturalAvatarComponent, NaturalBackgroundDensityDirective, NaturalCapitalizePipe, NaturalColumnsPickerComponent, NaturalConfirmComponent, NaturalDataSource, NaturalDebounceService, NaturalDetailHeaderComponent, NaturalDialogTriggerComponent, NaturalDropdownRef, NaturalEllipsisPipe, NaturalEnumPipe, NaturalEnumService, NaturalErrorHandler, NaturalErrorMessagePipe, NaturalFileComponent, NaturalFileDropDirective, NaturalFileSelectDirective, NaturalFileService, NaturalFixedButtonComponent, NaturalFixedButtonDetailComponent, NaturalHierarchicSelectorComponent, NaturalHierarchicSelectorDialogComponent, NaturalHierarchicSelectorDialogService, NaturalHierarchicSelectorService, NaturalHttpPrefixDirective, NaturalIconDirective, NaturalLinkMutationService, NaturalLinkableTabDirective, NaturalLoggerConfigExtra, NaturalLoggerConfigUrl, NaturalMatomoService, NaturalMemoryStorage, NaturalPanelsComponent, NaturalPanelsService, NaturalPersistenceService, NaturalQueryVariablesManager, NaturalRelationsComponent, NaturalSearchComponent, NaturalSelectComponent, NaturalSelectEnumComponent, NaturalSelectHierarchicComponent, NaturalSeoService, NaturalSidenavComponent, NaturalSidenavContainerComponent, NaturalSidenavContentComponent, NaturalSidenavService, NaturalSidenavStackService, NaturalSrcDensityDirective, NaturalStampComponent, NaturalSwissParsingDateAdapter, NaturalTableButtonComponent, NaturalTimeAgoPipe, NetworkActivityService, PanelsHooksConfig, SESSION_STORAGE, SortingOrder, TypeBooleanComponent, TypeDateComponent, TypeDateRangeComponent, TypeHierarchicSelectorComponent, TypeNaturalSelectComponent, TypeNumberComponent, TypeOptionsComponent, TypeSelectComponent, TypeTextComponent, activityInterceptor, available, cancellableTimeout, cloneDeepButSkipFile, collectErrors, commonImageMimeTypes, copyToClipboard, createHttpLink, debug, decimal, deepFreeze, deliverableEmail, ensureHttpPrefix, fallbackIfNoOpenedPanels, formatIsoDate, formatIsoDateTime, fromUrl, getForegroundColor, graphqlQuerySigner, greaterThan, hasFilesAndProcessDate, ifValid, integer, isFile, localStorageFactory, localStorageProvider, makePlural, memoryLocalStorageProvider, memorySessionStorageProvider, mergeOverrideArray, money, naturalPanelsUrlMatcher, naturalProviders, nfcCardHex, onHistoryEvent, possibleComparableOperators, provideErrorHandler, provideIcons, providePanels, provideSeo, relationsToIds, replaceObjectKeepingReference, replaceOperatorByField, replaceOperatorByName, rgbToHex, sessionStorageFactory, sessionStorageProvider, time, toGraphQLDoctrineFilter, toNavigationParameters, toUrl, unique, upperCaseFirstLetter, url, urlPattern, validTlds, validateAllFormControls, validateColumns, validatePagination, validateSorting, wrapLike, wrapPrefix, wrapSuffix };
4198
4274
  export type { AvailableColumn, Button, DropdownComponent, DropdownFacet, ExtractResolve, ExtractTall, ExtractTallOne, ExtractTcreate, ExtractTdelete, ExtractTone, ExtractTupdate, ExtractVall, ExtractVcreate, ExtractVdelete, ExtractVone, ExtractVupdate, Facet, FileModel, FileSelection, Filter, FilterGroupConditionField, FlagFacet, FormAsyncValidators, FormControls, FormValidators, HierarchicDialogConfig, HierarchicDialogResult, HierarchicFilterConfiguration$1 as HierarchicFilterConfiguration, HierarchicFiltersConfiguration$1 as HierarchicFiltersConfiguration, IEnum, InvalidFile, LinkableObject, Literal, NameOrFullName, NaturalConfirmData, NaturalDialogTriggerProvidedData, NaturalDialogTriggerRedirectionValues, NaturalDialogTriggerRoutingData, NaturalDropdownData, NaturalHierarchicConfiguration, NaturalIconConfig, NaturalIconsConfig, NaturalLoggerExtra, NaturalLoggerType, NaturalPanelConfig, NaturalPanelData, NaturalPanelResolves, NaturalPanelsBeforeOpenPanel, NaturalPanelsHooksConfig, NaturalPanelsRouteConfig, NaturalPanelsRouterRule, NaturalPanelsRoutesConfig, NaturalSearchFacets, NaturalSearchSelection, NaturalSearchSelections, NaturalSeo, NaturalSeoBasic, NaturalSeoCallback, NaturalSeoConfig, NaturalSeoResolve, NaturalSeoResolveData, NaturalStorage, NavigableItem, OrganizedModelSelection, PaginatedData, PaginationInput, PersistenceValidator, PossibleComparableOpertorKeys, QueryVariables, ResolvedData, Sorting, SubButton, TypeBooleanConfiguration, TypeDateConfiguration, TypeDateRangeConfiguration, TypeHierarchicSelectorConfiguration, TypeNumberConfiguration, TypeOption, TypeOptionsConfiguration, TypeSelectConfiguration, TypeSelectItem, TypeSelectNaturalConfiguration, VariablesWithInput, WithId };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecodev/natural",
3
- "version": "64.0.2",
3
+ "version": "65.0.0",
4
4
  "license": "MIT",
5
5
  "repository": "github:Ecodev/natural",
6
6
  "sideEffects": false,
@@ -12,10 +12,6 @@
12
12
  },
13
13
  "./package.json": {
14
14
  "default": "./package.json"
15
- },
16
- "./vanilla": {
17
- "types": "./vanilla/index.d.ts",
18
- "default": "./fesm2022/ecodev-natural-vanilla.mjs"
19
15
  }
20
16
  },
21
17
  "dependencies": {