@gravitee/ui-particles-angular 7.22.0 → 7.22.1-apim-1416-enable-disable-form-70f7ec2
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/type-component/array-type.component.mjs +46 -11
- package/esm2020/lib/gio-form-json-schema/type-component/multischema-type.component.mjs +21 -3
- package/fesm2015/gravitee-ui-particles-angular.mjs +63 -12
- package/fesm2015/gravitee-ui-particles-angular.mjs.map +1 -1
- package/fesm2020/gravitee-ui-particles-angular.mjs +62 -12
- package/fesm2020/gravitee-ui-particles-angular.mjs.map +1 -1
- package/lib/gio-form-json-schema/type-component/array-type.component.d.ts +17 -1
- package/lib/gio-form-json-schema/type-component/multischema-type.component.d.ts +6 -2
- package/package.json +3 -3
|
@@ -4066,12 +4066,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
4066
4066
|
* limitations under the License.
|
|
4067
4067
|
*/
|
|
4068
4068
|
class GioFjsArrayTypeComponent extends FieldArrayType {
|
|
4069
|
-
constructor() {
|
|
4070
|
-
super(
|
|
4069
|
+
constructor(cdr) {
|
|
4070
|
+
super();
|
|
4071
|
+
this.cdr = cdr;
|
|
4071
4072
|
this.collapse = false;
|
|
4072
4073
|
}
|
|
4074
|
+
/**
|
|
4075
|
+
* This method is here to ensure that all fields of the array are disabled or enabled when the form is disabled or enabled.
|
|
4076
|
+
*/
|
|
4077
|
+
ngAfterViewChecked() {
|
|
4078
|
+
this.field.props.disabled = this.form.disabled;
|
|
4079
|
+
this.field.fieldGroup?.forEach(f => {
|
|
4080
|
+
if (f && f.props)
|
|
4081
|
+
f.props.disabled = this.form.disabled;
|
|
4082
|
+
});
|
|
4083
|
+
this.cdr.detectChanges();
|
|
4084
|
+
}
|
|
4085
|
+
/**
|
|
4086
|
+
* This method fix an issue with the fieldChanges Subject which can be undefined when we enable or disable the form.
|
|
4087
|
+
*/
|
|
4088
|
+
onFocusIn() {
|
|
4089
|
+
if (this.field && this.field.options && this.field.options.fieldChanges === undefined) {
|
|
4090
|
+
this.field.options.fieldChanges = new Subject();
|
|
4091
|
+
}
|
|
4092
|
+
}
|
|
4093
|
+
/**
|
|
4094
|
+
* This method fix an issue with the fieldChanges Subject which can be undefined when we enable or disable the form
|
|
4095
|
+
* and then try to add a new field.
|
|
4096
|
+
*/
|
|
4097
|
+
add() {
|
|
4098
|
+
if (this.field && this.field.options && this.field.options.fieldChanges === undefined) {
|
|
4099
|
+
this.field.options.fieldChanges = new Subject();
|
|
4100
|
+
}
|
|
4101
|
+
super.add();
|
|
4102
|
+
}
|
|
4073
4103
|
}
|
|
4074
|
-
GioFjsArrayTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsArrayTypeComponent, deps:
|
|
4104
|
+
GioFjsArrayTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsArrayTypeComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
4075
4105
|
GioFjsArrayTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFjsArrayTypeComponent, selector: "gio-fjs-array-type", usesInheritance: true, ngImport: i0, template: `
|
|
4076
4106
|
<div class="wrapper" [class.error]="formControl.touched && formControl.invalid">
|
|
4077
4107
|
<div class="wrapper__header">
|
|
@@ -4092,16 +4122,18 @@ GioFjsArrayTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0
|
|
|
4092
4122
|
|
|
4093
4123
|
<div [hidden]="collapse" class="wrapper__rows" [class.collapse-open]="collapse" [class.collapse-close]="!collapse">
|
|
4094
4124
|
<div *ngFor="let field of field.fieldGroup; let i = index" class="wrapper__rows__row">
|
|
4095
|
-
<formly-field class="wrapper__rows__row__field" [field]="field"></formly-field>
|
|
4125
|
+
<formly-field class="wrapper__rows__row__field" [field]="field" (focusin)="onFocusIn()"></formly-field>
|
|
4096
4126
|
<div class="wrapper__rows__row__remove">
|
|
4097
|
-
<button type="button" mat-icon-button aria-label="Remove" (click)="remove(i)">
|
|
4127
|
+
<button type="button" mat-icon-button aria-label="Remove" [disabled]="this.form?.disabled ?? false" (click)="remove(i)">
|
|
4098
4128
|
<mat-icon svgIcon="gio:cancel"></mat-icon>
|
|
4099
4129
|
</button>
|
|
4100
4130
|
</div>
|
|
4101
4131
|
</div>
|
|
4102
4132
|
|
|
4103
4133
|
<div>
|
|
4104
|
-
<button type="button" mat-stroked-button aria-label="Add" (click)="add()"
|
|
4134
|
+
<button type="button" mat-stroked-button aria-label="Add" [disabled]="this.form?.disabled ?? false" (click)="add()">
|
|
4135
|
+
<mat-icon svgIcon="gio:plus"></mat-icon> Add
|
|
4136
|
+
</button>
|
|
4105
4137
|
</div>
|
|
4106
4138
|
</div>
|
|
4107
4139
|
</div>
|
|
@@ -4128,21 +4160,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
4128
4160
|
|
|
4129
4161
|
<div [hidden]="collapse" class="wrapper__rows" [class.collapse-open]="collapse" [class.collapse-close]="!collapse">
|
|
4130
4162
|
<div *ngFor="let field of field.fieldGroup; let i = index" class="wrapper__rows__row">
|
|
4131
|
-
<formly-field class="wrapper__rows__row__field" [field]="field"></formly-field>
|
|
4163
|
+
<formly-field class="wrapper__rows__row__field" [field]="field" (focusin)="onFocusIn()"></formly-field>
|
|
4132
4164
|
<div class="wrapper__rows__row__remove">
|
|
4133
|
-
<button type="button" mat-icon-button aria-label="Remove" (click)="remove(i)">
|
|
4165
|
+
<button type="button" mat-icon-button aria-label="Remove" [disabled]="this.form?.disabled ?? false" (click)="remove(i)">
|
|
4134
4166
|
<mat-icon svgIcon="gio:cancel"></mat-icon>
|
|
4135
4167
|
</button>
|
|
4136
4168
|
</div>
|
|
4137
4169
|
</div>
|
|
4138
4170
|
|
|
4139
4171
|
<div>
|
|
4140
|
-
<button type="button" mat-stroked-button aria-label="Add" (click)="add()"
|
|
4172
|
+
<button type="button" mat-stroked-button aria-label="Add" [disabled]="this.form?.disabled ?? false" (click)="add()">
|
|
4173
|
+
<mat-icon svgIcon="gio:plus"></mat-icon> Add
|
|
4174
|
+
</button>
|
|
4141
4175
|
</div>
|
|
4142
4176
|
</div>
|
|
4143
4177
|
</div>
|
|
4144
4178
|
`, styles: [".wrapper{padding:8px;border:1px solid #d3d5dc;border-radius:8px}.wrapper.error{border-color:#ec4899}.wrapper:empty{display:none}.wrapper__header{display:flex}.wrapper__header__text{flex:1 1 auto}.wrapper__header__text__title{font:600 16px/24px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;margin-bottom:8px}.wrapper__header__collapse{flex:0 0 auto}.wrapper__header__collapse .collapse-open{transform:rotate(180deg);transition:transform 225ms cubic-bezier(.4,0,.2,1)}.wrapper__header__collapse .collapse-close{transform:rotate(0);transition:transform 225ms cubic-bezier(.4,0,.2,1)}.wrapper__error{font:400 12px/16px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:normal;color:#ec4899}.wrapper__rows__row{display:flex;align-items:center;justify-content:space-between;margin-bottom:4px}.wrapper__rows__row+.wrapper__rows__row{padding-top:3px;border-top:1px solid #d3d5dc;margin-top:4px}.wrapper__rows__row__field{flex:1 1 auto}.wrapper__rows__row__remove{flex:0 0 auto}\n"] }]
|
|
4145
|
-
}] });
|
|
4179
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
|
|
4146
4180
|
|
|
4147
4181
|
function minItemsValidationMessage(error, field) {
|
|
4148
4182
|
return `Should NOT have fewer than ${field.props?.minItems} items`;
|
|
@@ -4228,12 +4262,28 @@ function bannerExtension(field) {
|
|
|
4228
4262
|
* limitations under the License.
|
|
4229
4263
|
*/
|
|
4230
4264
|
class GioFjsMultiSchemaTypeComponent extends FieldType {
|
|
4265
|
+
constructor(cdr) {
|
|
4266
|
+
super();
|
|
4267
|
+
this.cdr = cdr;
|
|
4268
|
+
this.unsubscribe$ = new Subject();
|
|
4269
|
+
}
|
|
4270
|
+
ngOnDestroy() {
|
|
4271
|
+
this.unsubscribe$.next();
|
|
4272
|
+
this.unsubscribe$.unsubscribe();
|
|
4273
|
+
}
|
|
4231
4274
|
ngOnInit() {
|
|
4232
4275
|
set(this.field, 'fieldGroup[0].props.appearance', 'fill');
|
|
4233
4276
|
set(this.field, 'fieldGroup[0].props.label', 'Select option');
|
|
4277
|
+
set(this.field, 'fieldGroup[0].props.disabled', this.form.disabled);
|
|
4278
|
+
this.form.valueChanges
|
|
4279
|
+
.pipe(tap(() => {
|
|
4280
|
+
set(this.field, 'fieldGroup[0].props.disabled', this.form.disabled);
|
|
4281
|
+
this.cdr.detectChanges();
|
|
4282
|
+
}), takeUntil(this.unsubscribe$))
|
|
4283
|
+
.subscribe();
|
|
4234
4284
|
}
|
|
4235
4285
|
}
|
|
4236
|
-
GioFjsMultiSchemaTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsMultiSchemaTypeComponent, deps:
|
|
4286
|
+
GioFjsMultiSchemaTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsMultiSchemaTypeComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
4237
4287
|
GioFjsMultiSchemaTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFjsMultiSchemaTypeComponent, selector: "gio-fjs-multi-schema-type", usesInheritance: true, ngImport: i0, template: `
|
|
4238
4288
|
<div class="wrapper">
|
|
4239
4289
|
<div class="wrapper__title" *ngIf="props.label">{{ props.label }}</div>
|
|
@@ -4256,7 +4306,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
4256
4306
|
<formly-field *ngFor="let f of field.fieldGroup" [field]="f"></formly-field>
|
|
4257
4307
|
</div>
|
|
4258
4308
|
`, styles: [".wrapper__title{font-size:16px;font-weight:500;line-height:24px;font:600 14px/20px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;margin-bottom:4px}.wrapper:empty{display:none}.wrapper__error{font:400 12px/16px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:normal;color:#ec4899}\n"] }]
|
|
4259
|
-
}] });
|
|
4309
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
|
|
4260
4310
|
|
|
4261
4311
|
/*
|
|
4262
4312
|
* Copyright (C) 2023 The Gravitee team (http://gravitee.io)
|