UNPKG

@synergy-design-system/angular

Version:
145 lines (141 loc) 8.43 kB
import * as i0 from '@angular/core'; import { forwardRef, Directive, NgModule } from '@angular/core'; import { NG_VALIDATORS, MinValidator, MaxValidator, CheckboxRequiredValidator } from '@angular/forms'; // --------------------------------------------------------------------- // 🔒 AUTOGENERATED @synergy-design-system/angular wrappers for @synergy-design-system/components // Please do not edit this file directly! // It will get recreated when running pnpm build. // --------------------------------------------------------------------- /** * @description * Provider which adds `SYN_MIN_VALIDATOR` to the `NG_VALIDATORS` multi-provider list. */ const SYN_MIN_VALIDATOR = { provide: NG_VALIDATORS, useExisting: forwardRef(() => SynMinValidator), multi: true, }; /** * A directive which installs the {@link SynMinValidator} for a syn-input with `formControlName`, * `formControl`, or control with `ngModel` that also has a `min` attribute. * * @usageNotes * * ### Adding a min validator * * The following example shows how to add a min validator to a syn-input attached to an * ngModel binding. * * ```html * <syn-input type="number" ngModel min="1"></syn-input> * ``` */ class SynMinValidator extends MinValidator { static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SynMinValidator, deps: null, target: i0.ɵɵFactoryTarget.Directive }); static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.1", type: SynMinValidator, isStandalone: false, selector: "syn-input[type=number][min][formControlName],syn-input[type=number][min][formControl],syn-input[type=number][min][ngModel]", host: { properties: { "attr.min": "_enabled ? min : null" } }, providers: [SYN_MIN_VALIDATOR], usesInheritance: true, ngImport: i0 }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SynMinValidator, decorators: [{ type: Directive, args: [{ // This validator is needed, because angular specifies the min validator especially only for `<input />` elements. See https://github.com/angular/angular/blob/e603e5616d2c3830a641d4cf76c891af0059798c/packages/forms/src/directives/validators.ts#L276 selector: 'syn-input[type=number][min][formControlName],syn-input[type=number][min][formControl],syn-input[type=number][min][ngModel]', standalone: false, providers: [SYN_MIN_VALIDATOR], host: { '[attr.min]': '_enabled ? min : null' }, }] }] }); /** * @description * Provider which adds `SynMaxValidator` to the `NG_VALIDATORS` multi-provider list. */ const SYN_MAX_VALIDATOR = { provide: NG_VALIDATORS, useExisting: forwardRef(() => SynMaxValidator), multi: true, }; /** * A directive which installs the {@link SynMaxValidator} for a syn-input with `formControlName`, * `formControl`, or control with `ngModel` that also has a `max` attribute. * * @usageNotes * * ### Adding a max validator * * The following example shows how to add a max validator to a syn-input attached to an * ngModel binding. * * ```html * <syn-input type="number" ngModel max="4"></syn-input> * ``` */ class SynMaxValidator extends MaxValidator { static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SynMaxValidator, deps: null, target: i0.ɵɵFactoryTarget.Directive }); static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.1", type: SynMaxValidator, isStandalone: false, selector: "syn-input[type=number][max][formControlName],syn-input[type=number][max][formControl],syn-input[type=number][max][ngModel]", host: { properties: { "attr.max": "_enabled ? max : null" } }, providers: [SYN_MAX_VALIDATOR], usesInheritance: true, ngImport: i0 }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SynMaxValidator, decorators: [{ type: Directive, args: [{ // This validator is needed, because angular specifies the max validator especially only for `<input />` elements. See https://github.com/angular/angular/blob/e603e5616d2c3830a641d4cf76c891af0059798c/packages/forms/src/directives/validators.ts#L224 selector: 'syn-input[type=number][max][formControlName],syn-input[type=number][max][formControl],syn-input[type=number][max][ngModel]', standalone: false, providers: [SYN_MAX_VALIDATOR], host: { '[attr.max]': '_enabled ? max : null' }, }] }] }); /** * @description * Provider which adds `SynCheckboxRequiredValidator` to the `NG_VALIDATORS` multi-provider list. */ const SYN_CHECKBOX_REQUIRED_VALIDATOR = { provide: NG_VALIDATORS, useExisting: forwardRef(() => SynCheckboxRequiredValidator), multi: true, }; /** * A Directive that adds the `required` validator to syn-checkbox controls marked with the * `required` attribute. The directive is provided with the `NG_VALIDATORS` multi-provider list. * * ### Adding a required syn-checkbox validator using template-driven forms * * The following example shows how to add a checkbox required validator to an input attached to an * ngModel binding. * * ``` * <syn-checkbox ngModel required></syn-checkbox> * ``` */ class SynCheckboxRequiredValidator extends CheckboxRequiredValidator { static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SynCheckboxRequiredValidator, deps: null, target: i0.ɵɵFactoryTarget.Directive }); static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.1", type: SynCheckboxRequiredValidator, isStandalone: false, selector: "syn-checkbox[required][formControlName],syn-checkbox[required][formControl],syn-checkbox[required][ngModel]", host: { properties: { "attr.required": "_enabled ? \"\" : null" } }, providers: [SYN_CHECKBOX_REQUIRED_VALIDATOR], usesInheritance: true, ngImport: i0 }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SynCheckboxRequiredValidator, decorators: [{ type: Directive, args: [{ // This validator is needed, because angular specifies the required checkbox validator especially only for `<input type="checkbox"/>` elements. See https://github.com/angular/angular/blob/e603e5616d2c3830a641d4cf76c891af0059798c/packages/forms/src/directives/validators.ts#L429 selector: 'syn-checkbox[required][formControlName],syn-checkbox[required][formControl],syn-checkbox[required][ngModel]', standalone: false, providers: [SYN_CHECKBOX_REQUIRED_VALIDATOR], host: { '[attr.required]': '_enabled ? "" : null' }, }] }] }); class SynergyValidatorsModule { static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SynergyValidatorsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.1", ngImport: i0, type: SynergyValidatorsModule, declarations: [SynMinValidator, SynMaxValidator, SynCheckboxRequiredValidator], exports: [SynMinValidator, SynMaxValidator, SynCheckboxRequiredValidator] }); static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SynergyValidatorsModule }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SynergyValidatorsModule, decorators: [{ type: NgModule, args: [{ declarations: [ SynMinValidator, SynMaxValidator, SynCheckboxRequiredValidator, ], exports: [SynMinValidator, SynMaxValidator, SynCheckboxRequiredValidator], }] }] }); /** * Generated bundle index. Do not edit. */ export { SYN_CHECKBOX_REQUIRED_VALIDATOR, SYN_MAX_VALIDATOR, SYN_MIN_VALIDATOR, SynCheckboxRequiredValidator, SynMaxValidator, SynMinValidator, SynergyValidatorsModule }; //# sourceMappingURL=synergy-design-system-angular-directives-validators.mjs.map