@gravitee/ui-particles-angular 7.58.0 → 7.59.0-apim-5436-pattern-error-message-580f329
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/esm2020/lib/gio-form-json-schema/gio-form-json-schema.component.mjs +12 -10
- package/esm2020/lib/gio-form-json-schema/gio-form-json-schema.module.mjs +4 -2
- package/esm2020/lib/gio-form-json-schema/util/validation-message.util.mjs +5 -1
- package/fesm2015/gravitee-ui-particles-angular.mjs +17 -8
- package/fesm2015/gravitee-ui-particles-angular.mjs.map +1 -1
- package/fesm2020/gravitee-ui-particles-angular.mjs +16 -8
- package/fesm2020/gravitee-ui-particles-angular.mjs.map +1 -1
- package/lib/gio-form-json-schema/util/validation-message.util.d.ts +1 -0
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ import { ComponentHarness, HarnessPredicate, parallel, TestKey } from '@angular/
|
|
|
15
15
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
16
16
|
import * as i3$3 from '@angular/material/form-field';
|
|
17
17
|
import { MatFormFieldControl, MatFormFieldModule, MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
|
|
18
|
-
import { isEmpty, isString, isObject, toLower, dropRight, isNil, isArray, remove, cloneDeep, uniqueId, set, range } from 'lodash';
|
|
18
|
+
import { isEmpty, isString, isObject, toLower, dropRight, isNil, isArray, remove, isEqual, cloneDeep, uniqueId, set, range } from 'lodash';
|
|
19
19
|
import * as i7 from '@angular/forms';
|
|
20
20
|
import { FormsModule, FormArray, FormGroup, FormControl, Validators, NG_VALUE_ACCESSOR, NG_VALIDATORS, ReactiveFormsModule, NgControl } from '@angular/forms';
|
|
21
21
|
import * as i1$2 from '@angular/cdk/a11y';
|
|
@@ -2732,12 +2732,14 @@ class GioFormJsonSchemaComponent {
|
|
|
2732
2732
|
this.ngControl?.control?.addAsyncValidators(() => {
|
|
2733
2733
|
return this.isValid$.pipe(take(1), map(isValid => (isValid ? null : { invalid: true })), takeUntil(this.unsubscribe$));
|
|
2734
2734
|
});
|
|
2735
|
-
//
|
|
2736
|
-
|
|
2735
|
+
// Sync control value with default value (without emit event) as long as the component is not ready
|
|
2736
|
+
// When formly is initialised, it emits several values as it builds up step by step.
|
|
2737
|
+
this.formGroup.valueChanges
|
|
2738
|
+
.pipe(distinctUntilChanged(isEqual), tap(value => {
|
|
2737
2739
|
this.ngControl?.control?.reset(value, { emitEvent: false });
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2740
|
+
}), takeUntil(this.ready), takeUntil(this.unsubscribe$))
|
|
2741
|
+
.subscribe();
|
|
2742
|
+
// Avoid ExpressionChangedAfterItHasBeenCheckedError on project
|
|
2741
2743
|
this.changeDetectorRef.markForCheck();
|
|
2742
2744
|
this.changeDetectorRef.detectChanges();
|
|
2743
2745
|
// Subscribe to state changes to manage touches, status and value
|
|
@@ -2819,10 +2821,10 @@ class GioFormJsonSchemaComponent {
|
|
|
2819
2821
|
}
|
|
2820
2822
|
}
|
|
2821
2823
|
GioFormJsonSchemaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaComponent, deps: [{ token: GioFormlyJsonSchemaService }, { token: i0.ElementRef }, { token: i1$2.FocusMonitor }, { token: i0.ChangeDetectorRef }, { token: i7.NgControl, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
2822
|
-
GioFormJsonSchemaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFormJsonSchemaComponent, selector: "gio-form-json-schema", inputs: { jsonSchema: "jsonSchema", options: "options" }, outputs: { ready: "ready" }, host: { properties: { "attr.gioFormFocusInvalidIgnore": "this.gioFormFocusInvalidIgnore" } }, usesOnChanges: true, ngImport: i0, template: `<formly-form *ngIf="formGroup" [fields]="fields" [options]="options" [form]="formGroup" [model]="model"></formly-form>`, isInline: true, styles: ["::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-outline:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)){padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-outline:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)) .mat-form-field-wrapper{padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-fill:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)){padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-fill:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)) .mat-form-field-wrapper{margin-bottom:-1.34375em}\n"], components: [{ type: i1$5.FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }], directives: [{ type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
2824
|
+
GioFormJsonSchemaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFormJsonSchemaComponent, selector: "gio-form-json-schema", inputs: { jsonSchema: "jsonSchema", options: "options" }, outputs: { ready: "ready" }, host: { properties: { "attr.gioFormFocusInvalidIgnore": "this.gioFormFocusInvalidIgnore" } }, usesOnChanges: true, ngImport: i0, template: `<formly-form *ngIf="formGroup" [fields]="fields" [options]="options" [form]="formGroup" [model]="model"></formly-form>`, isInline: true, styles: ["::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-outline:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)){padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-outline:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)) .mat-form-field-wrapper{padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-fill:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)){padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-fill:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)) .mat-form-field-wrapper{margin-bottom:-1.34375em}\n"], components: [{ type: i1$5.FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }], directives: [{ type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2823
2825
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaComponent, decorators: [{
|
|
2824
2826
|
type: Component,
|
|
2825
|
-
args: [{ selector: 'gio-form-json-schema', template: `<formly-form *ngIf="formGroup" [fields]="fields" [options]="options" [form]="formGroup" [model]="model"></formly-form>`, styles: ["::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-outline:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)){padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-outline:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)) .mat-form-field-wrapper{padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-fill:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)){padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-fill:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)) .mat-form-field-wrapper{margin-bottom:-1.34375em}\n"] }]
|
|
2827
|
+
args: [{ selector: 'gio-form-json-schema', template: `<formly-form *ngIf="formGroup" [fields]="fields" [options]="options" [form]="formGroup" [model]="model"></formly-form>`, changeDetection: ChangeDetectionStrategy.OnPush, styles: ["::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-outline:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)){padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-outline:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)) .mat-form-field-wrapper{padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-fill:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)){padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-fill:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)) .mat-form-field-wrapper{margin-bottom:-1.34375em}\n"] }]
|
|
2826
2828
|
}], ctorParameters: function () { return [{ type: GioFormlyJsonSchemaService }, { type: i0.ElementRef }, { type: i1$2.FocusMonitor }, { type: i0.ChangeDetectorRef }, { type: i7.NgControl, decorators: [{
|
|
2827
2829
|
type: Host
|
|
2828
2830
|
}, {
|
|
@@ -3701,6 +3703,10 @@ function constValidationMessage(error, field) {
|
|
|
3701
3703
|
function typeValidationMessage({ schemaType }) {
|
|
3702
3704
|
return `Should be "${schemaType[0]}".`;
|
|
3703
3705
|
}
|
|
3706
|
+
function patternValidationMessage(error, field) {
|
|
3707
|
+
const key = field?.key?.toString() ?? 'Field';
|
|
3708
|
+
return `${key.charAt(0).toUpperCase() + key.slice(1)} value does not respect the pattern: ${field?.props?.pattern}`;
|
|
3709
|
+
}
|
|
3704
3710
|
|
|
3705
3711
|
/*
|
|
3706
3712
|
* Copyright (C) 2023 The Gravitee team (http://gravitee.io)
|
|
@@ -4111,6 +4117,7 @@ GioFormJsonSchemaModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0",
|
|
|
4111
4117
|
{ name: 'maxItems', message: maxItemsValidationMessage },
|
|
4112
4118
|
{ name: 'uniqueItems', message: 'Should NOT have duplicate items' },
|
|
4113
4119
|
{ name: 'const', message: constValidationMessage },
|
|
4120
|
+
{ name: 'pattern', message: patternValidationMessage },
|
|
4114
4121
|
],
|
|
4115
4122
|
wrappers: [
|
|
4116
4123
|
{ name: 'gio-with-banner', component: GioBannerWrapperComponent },
|
|
@@ -4186,6 +4193,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
4186
4193
|
{ name: 'maxItems', message: maxItemsValidationMessage },
|
|
4187
4194
|
{ name: 'uniqueItems', message: 'Should NOT have duplicate items' },
|
|
4188
4195
|
{ name: 'const', message: constValidationMessage },
|
|
4196
|
+
{ name: 'pattern', message: patternValidationMessage },
|
|
4189
4197
|
],
|
|
4190
4198
|
wrappers: [
|
|
4191
4199
|
{ name: 'gio-with-banner', component: GioBannerWrapperComponent },
|