@onemrvapublic/design-system 20.7.0-develop.14 → 20.7.0-develop.16
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/fesm2022/onemrvapublic-design-system-mat-input-birthplace.mjs +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-input-birthplace.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-input-country.mjs +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-input-country.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-input-enterprise-number.mjs +2 -2
- package/fesm2022/onemrvapublic-design-system-mat-input-enterprise-number.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-input-iban.mjs +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-input-iban.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-input-phone.mjs +3 -2
- package/fesm2022/onemrvapublic-design-system-mat-input-phone.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-shared.mjs +5 -3
- package/fesm2022/onemrvapublic-design-system-shared.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system.mjs +79 -605
- package/fesm2022/onemrvapublic-design-system.mjs.map +1 -1
- package/index.d.ts +32 -121
- package/package.json +19 -26
- package/shared/index.d.ts +1 -1
- package/fesm2022/onemrvapublic-design-system-jsonform-renderers.mjs +0 -621
- package/fesm2022/onemrvapublic-design-system-jsonform-renderers.mjs.map +0 -1
- package/jsonform-renderers/datepicker-renderer/datepicker-renderer.component.scss +0 -22
- package/jsonform-renderers/index.d.ts +0 -124
- package/jsonform-renderers/label-renderer/label-renderer.component.scss +0 -0
- package/jsonform-renderers/niss-renderer/niss-renderer.component.scss +0 -0
- package/jsonform-renderers/radio-button-renderer/radio-button.renderer.component.scss +0 -5
- package/jsonform-renderers/readonly-control-renderer/readonly-control-renderer.component.scss +0 -4
- package/jsonform-renderers/select-renderer/select-renderer.component.scss +0 -0
|
@@ -1,621 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Input, Component, inject, ChangeDetectionStrategy, ViewEncapsulation, input, signal } from '@angular/core';
|
|
3
|
-
import * as i1$2 from '@angular/common';
|
|
4
|
-
import { CommonModule } from '@angular/common';
|
|
5
|
-
import * as i1 from '@angular/material/checkbox';
|
|
6
|
-
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
7
|
-
import { rankWith, isBooleanControl, isDateControl, Actions, scopeEndsWith, mapStateToLabelProps, uiTypeIs, isEnabled, and, isControl, optionIs, isEnumControl } from '@jsonforms/core';
|
|
8
|
-
import { JsonFormsControl, JsonFormsBaseRenderer, JsonFormsAngularService } from '@jsonforms/angular';
|
|
9
|
-
import * as i3$1 from '@ngx-translate/core';
|
|
10
|
-
import { TranslatePipe, TranslateModule, TranslateService } from '@ngx-translate/core';
|
|
11
|
-
import { JsonFormsAngularMaterialModule } from '@jsonforms/angular-material';
|
|
12
|
-
import * as i1$1 from '@angular/material/form-field';
|
|
13
|
-
import { MatFormField, MatFormFieldModule, MatLabel, MatError } from '@angular/material/form-field';
|
|
14
|
-
import * as i4 from '@angular/material/datepicker';
|
|
15
|
-
import { MatDatepickerInput } from '@angular/material/datepicker';
|
|
16
|
-
import { OnemrvaMatDatepickerHeaderComponent } from '@onemrvapublic/design-system/mat-datepicker-header';
|
|
17
|
-
import { provideLuxonDateAdapter } from '@angular/material-luxon-adapter';
|
|
18
|
-
import { DateAdapter, MatOption } from '@angular/material/core';
|
|
19
|
-
import * as i3 from '@angular/material/input';
|
|
20
|
-
import { MatInputModule } from '@angular/material/input';
|
|
21
|
-
import * as i2 from '@angular/forms';
|
|
22
|
-
import { FormControl, Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
23
|
-
import { bankAccountValidator, NISS_MASK, OnemrvaValidators, OnemrvaNissPipe } from '@onemrvapublic/design-system/shared';
|
|
24
|
-
import { OnemrvaMatInputIbanComponent } from '@onemrvapublic/design-system/mat-input-iban';
|
|
25
|
-
import { NgxMaskDirective, provideNgxMask } from 'ngx-mask';
|
|
26
|
-
import { OnemrvaMatInputPhoneComponent } from '@onemrvapublic/design-system/mat-input-phone';
|
|
27
|
-
import { MatRadioGroup, MatRadioButton } from '@angular/material/radio';
|
|
28
|
-
import { MatSelect } from '@angular/material/select';
|
|
29
|
-
|
|
30
|
-
class CheckboxRendererComponent extends JsonFormsControl {
|
|
31
|
-
constructor() {
|
|
32
|
-
super(...arguments);
|
|
33
|
-
this.color = '';
|
|
34
|
-
this.indeterminate = false;
|
|
35
|
-
this.getEventValue = (event) => {
|
|
36
|
-
return event;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
onCheckboxChange(value) {
|
|
40
|
-
this.onChange(value);
|
|
41
|
-
}
|
|
42
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: CheckboxRendererComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
43
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: CheckboxRendererComponent, isStandalone: true, selector: "app-demo-checkbox", inputs: { color: "color", indeterminate: "indeterminate" }, usesInheritance: true, ngImport: i0, template: "@if (!hidden) {\n <mat-checkbox\n [color]=\"color\"\n [checked]=\"!!data\"\n [indeterminate]=\"indeterminate\"\n [disabled]=\"!enabled\"\n (change)=\"onCheckboxChange($event.checked)\"\n >{{ uischema.i18n + '' | translate }}</mat-checkbox\n >\n @if (error) {\n <mat-error> {{ error }}</mat-error>\n }\n}\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i1.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: JsonFormsAngularMaterialModule }, { kind: "directive", type: i1$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] }); }
|
|
44
|
-
}
|
|
45
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: CheckboxRendererComponent, decorators: [{
|
|
46
|
-
type: Component,
|
|
47
|
-
args: [{ selector: 'app-demo-checkbox', standalone: true, imports: [
|
|
48
|
-
CommonModule,
|
|
49
|
-
MatCheckboxModule,
|
|
50
|
-
TranslatePipe,
|
|
51
|
-
JsonFormsAngularMaterialModule,
|
|
52
|
-
], template: "@if (!hidden) {\n <mat-checkbox\n [color]=\"color\"\n [checked]=\"!!data\"\n [indeterminate]=\"indeterminate\"\n [disabled]=\"!enabled\"\n (change)=\"onCheckboxChange($event.checked)\"\n >{{ uischema.i18n + '' | translate }}</mat-checkbox\n >\n @if (error) {\n <mat-error> {{ error }}</mat-error>\n }\n}\n" }]
|
|
53
|
-
}], propDecorators: { color: [{
|
|
54
|
-
type: Input
|
|
55
|
-
}], indeterminate: [{
|
|
56
|
-
type: Input
|
|
57
|
-
}] } });
|
|
58
|
-
const checkboxTester = rankWith(3, isBooleanControl);
|
|
59
|
-
|
|
60
|
-
const defaultDateFormat = 'yyyy-MM-dd';
|
|
61
|
-
class DatepickerRendererComponent extends JsonFormsControl {
|
|
62
|
-
constructor() {
|
|
63
|
-
super(...arguments);
|
|
64
|
-
this.focused = false;
|
|
65
|
-
this.startView = 'month';
|
|
66
|
-
this.panelClass = '';
|
|
67
|
-
this.views = ['year', 'month', 'day'];
|
|
68
|
-
this.OnemrvaMatDatepickerHeaderComponent = OnemrvaMatDatepickerHeaderComponent;
|
|
69
|
-
// Make maxDate dynamic instead of readonly
|
|
70
|
-
this.maxDate = null;
|
|
71
|
-
this.minDate = null;
|
|
72
|
-
this.dateAdapter = inject((DateAdapter));
|
|
73
|
-
this.getEventValue = (event) => {
|
|
74
|
-
const value = event.value ? event.value : event;
|
|
75
|
-
return this.dateAdapter.format(value, this.getSaveFormat());
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
mapToProps(state) {
|
|
79
|
-
const props = super.mapToProps(state);
|
|
80
|
-
// Get save format from UI schema options or use default
|
|
81
|
-
const saveFormat = this.uischema?.options?.['dateSaveFormat']
|
|
82
|
-
? this.uischema.options['dateSaveFormat']
|
|
83
|
-
: defaultDateFormat;
|
|
84
|
-
// Get views from UI schema options
|
|
85
|
-
this.views = this.uischema?.options?.['views']
|
|
86
|
-
? this.uischema.options['views']
|
|
87
|
-
: ['year', 'month', 'day'];
|
|
88
|
-
// Set min and max dates from UI schema options
|
|
89
|
-
this.setDateLimits();
|
|
90
|
-
this.setViewProperties();
|
|
91
|
-
// Get display format from UI schema options
|
|
92
|
-
const dateFormat = this.uischema?.options?.['dateFormat'];
|
|
93
|
-
if (dateFormat) {
|
|
94
|
-
this.dateAdapter.setLocale(this.jsonFormsService.getLocale() || 'en');
|
|
95
|
-
}
|
|
96
|
-
// Parse the data using the save format
|
|
97
|
-
let parsedDate = null;
|
|
98
|
-
if (props.data) {
|
|
99
|
-
try {
|
|
100
|
-
parsedDate = this.dateAdapter.parse(props.data, saveFormat);
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
console.warn('Failed to parse date:', props.data, error);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return { ...props, data: parsedDate };
|
|
107
|
-
}
|
|
108
|
-
setDateLimits() {
|
|
109
|
-
const options = this.uischema?.options;
|
|
110
|
-
if (options?.['maxDate']) {
|
|
111
|
-
this.maxDate = this.parseDate(options['maxDate']);
|
|
112
|
-
}
|
|
113
|
-
if (options?.['minDate']) {
|
|
114
|
-
this.minDate = this.parseDate(options['minDate']);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
parseDate(dateValue) {
|
|
118
|
-
if (dateValue === 'today') {
|
|
119
|
-
return new Date();
|
|
120
|
-
}
|
|
121
|
-
else if (dateValue === 'tomorrow') {
|
|
122
|
-
const tomorrow = new Date();
|
|
123
|
-
tomorrow.setDate(tomorrow.getDate() + 1);
|
|
124
|
-
return tomorrow;
|
|
125
|
-
}
|
|
126
|
-
else if (dateValue === 'yesterday') {
|
|
127
|
-
const yesterday = new Date();
|
|
128
|
-
yesterday.setDate(yesterday.getDate() - 1);
|
|
129
|
-
return yesterday;
|
|
130
|
-
}
|
|
131
|
-
else if (typeof dateValue === 'string') {
|
|
132
|
-
try {
|
|
133
|
-
const luxonDate = this.dateAdapter.parse(dateValue, this.getSaveFormat());
|
|
134
|
-
// Convert Luxon DateTime to JavaScript Date
|
|
135
|
-
return luxonDate ? this.luxonToDate(luxonDate) : null;
|
|
136
|
-
}
|
|
137
|
-
catch (error) {
|
|
138
|
-
console.warn('Failed to parse date:', dateValue, error);
|
|
139
|
-
return null;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
else if (dateValue instanceof Date) {
|
|
143
|
-
return dateValue;
|
|
144
|
-
}
|
|
145
|
-
return null;
|
|
146
|
-
}
|
|
147
|
-
luxonToDate(luxonDateTime) {
|
|
148
|
-
return luxonDateTime.toJSDate();
|
|
149
|
-
}
|
|
150
|
-
yearSelected($event, datepicker) {
|
|
151
|
-
if (!this.views.includes('day') && !this.views.includes('month')) {
|
|
152
|
-
this.onChange($event);
|
|
153
|
-
datepicker.close();
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
monthSelected($event, datepicker) {
|
|
157
|
-
if (!this.views.includes('day')) {
|
|
158
|
-
this.onChange($event);
|
|
159
|
-
datepicker.close();
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
setViewProperties() {
|
|
163
|
-
if (!this.views.includes('day')) {
|
|
164
|
-
this.startView = 'multi-year';
|
|
165
|
-
this.panelClass = 'no-panel-navigation';
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
this.startView = 'month';
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
getSaveFormat() {
|
|
172
|
-
return this.uischema?.options?.['dateSaveFormat'] || defaultDateFormat;
|
|
173
|
-
}
|
|
174
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: DatepickerRendererComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
175
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: DatepickerRendererComponent, isStandalone: true, selector: "app-date-picker-renderer", providers: [provideLuxonDateAdapter()], usesInheritance: true, ngImport: i0, template: "<mat-form-field\n class=\"date-control-renderer\"\n [ngStyle]=\"{ display: hidden ? 'none' : '' }\"\n>\n <mat-label>{{ label }}</mat-label>\n <input\n matInput\n (dateChange)=\"onChange($event)\"\n [id]=\"id\"\n [formControl]=\"form\"\n [matDatepicker]=\"datepicker\"\n (focus)=\"focused = true\"\n (focusout)=\"focused = false\"\n [max]=\"maxDate\"\n [min]=\"minDate\"\n />\n <mat-datepicker-toggle matSuffix [for]=\"datepicker\"></mat-datepicker-toggle>\n <mat-datepicker\n #picker\n [calendarHeaderComponent]=\"OnemrvaMatDatepickerHeaderComponent\"\n #datepicker\n [startView]=\"startView\"\n [panelClass]=\"panelClass\"\n (yearSelected)=\"yearSelected($event, picker)\"\n (monthSelected)=\"monthSelected($event, picker)\"\n ></mat-datepicker>\n @if (shouldShowUnfocusedDescription() || focused) {\n <mat-hint>{{ description }}</mat-hint>\n }\n @if (error) {\n <mat-error>{{ error }}</mat-error>\n }\n</mat-form-field>\n", styles: ["DateControlRenderer{display:flex;flex-direction:row}.date-control-renderer{flex:1 1 auto}.no-panel-navigation .mat-calendar-period-button{pointer-events:none}.no-panel-navigation .mat-calendar-arrow{display:none}.mat-headline-6{font-size:5px;line-height:.6;color:#000}\n"], dependencies: [{ kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "ngmodule", type: JsonFormsAngularMaterialModule }, { kind: "directive", type: i1$2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i1$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i1$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i1$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i4.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "component", type: i4.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
176
|
-
}
|
|
177
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: DatepickerRendererComponent, decorators: [{
|
|
178
|
-
type: Component,
|
|
179
|
-
args: [{ selector: 'app-date-picker-renderer', standalone: true, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [provideLuxonDateAdapter()], imports: [MatFormField, MatDatepickerInput, JsonFormsAngularMaterialModule], template: "<mat-form-field\n class=\"date-control-renderer\"\n [ngStyle]=\"{ display: hidden ? 'none' : '' }\"\n>\n <mat-label>{{ label }}</mat-label>\n <input\n matInput\n (dateChange)=\"onChange($event)\"\n [id]=\"id\"\n [formControl]=\"form\"\n [matDatepicker]=\"datepicker\"\n (focus)=\"focused = true\"\n (focusout)=\"focused = false\"\n [max]=\"maxDate\"\n [min]=\"minDate\"\n />\n <mat-datepicker-toggle matSuffix [for]=\"datepicker\"></mat-datepicker-toggle>\n <mat-datepicker\n #picker\n [calendarHeaderComponent]=\"OnemrvaMatDatepickerHeaderComponent\"\n #datepicker\n [startView]=\"startView\"\n [panelClass]=\"panelClass\"\n (yearSelected)=\"yearSelected($event, picker)\"\n (monthSelected)=\"monthSelected($event, picker)\"\n ></mat-datepicker>\n @if (shouldShowUnfocusedDescription() || focused) {\n <mat-hint>{{ description }}</mat-hint>\n }\n @if (error) {\n <mat-error>{{ error }}</mat-error>\n }\n</mat-form-field>\n", styles: ["DateControlRenderer{display:flex;flex-direction:row}.date-control-renderer{flex:1 1 auto}.no-panel-navigation .mat-calendar-period-button{pointer-events:none}.no-panel-navigation .mat-calendar-arrow{display:none}.mat-headline-6{font-size:5px;line-height:.6;color:#000}\n"] }]
|
|
180
|
-
}] });
|
|
181
|
-
const DatePickerRendererTester = rankWith(3, isDateControl);
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Utility for manipulating and extracting information
|
|
185
|
-
* from schema and scope paths in JsonForms
|
|
186
|
-
*/
|
|
187
|
-
class JsonFormsSchemaPathUtil {
|
|
188
|
-
static { this.PROPERTY_PATH_REGEX = /\/properties\/([^/]+)(?:\/properties\/([^/]+))?/; }
|
|
189
|
-
/**
|
|
190
|
-
* Extracts the step key from a UI Schema scope path
|
|
191
|
-
* @param scope The scope path (e.g. "/properties/childInfo/properties/ssin")
|
|
192
|
-
* @returns The extracted step key (e.g. "/childInfo/ssin")
|
|
193
|
-
*/
|
|
194
|
-
static extractStepKey(scope) {
|
|
195
|
-
// Get the "childInfo" and the "ssin"
|
|
196
|
-
const regex = new RegExp(JsonFormsSchemaPathUtil.PROPERTY_PATH_REGEX);
|
|
197
|
-
const matches = regex.exec(scope ?? '');
|
|
198
|
-
if (!matches) {
|
|
199
|
-
return '';
|
|
200
|
-
}
|
|
201
|
-
// If we have both parts (childInfo + ssin)
|
|
202
|
-
if (matches[2]) {
|
|
203
|
-
return `/${matches[1]}/${matches[2]}`;
|
|
204
|
-
}
|
|
205
|
-
// If we have only the first part (childInfo)
|
|
206
|
-
return `/${matches[1]}`;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
class IbanRendererComponent extends JsonFormsControl {
|
|
211
|
-
constructor() {
|
|
212
|
-
super(...arguments);
|
|
213
|
-
this.readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : []));
|
|
214
|
-
this.isUpdating = signal(false, ...(ngDevMode ? [{ debugName: "isUpdating" }] : []));
|
|
215
|
-
this.getEventValue = (event) => {
|
|
216
|
-
if (typeof event === 'string') {
|
|
217
|
-
return event.replace(/\s/g, '');
|
|
218
|
-
}
|
|
219
|
-
if (event && typeof event.value === 'string') {
|
|
220
|
-
return event.value.replace(/\s/g, '');
|
|
221
|
-
}
|
|
222
|
-
const raw = event?.target?.value;
|
|
223
|
-
return typeof raw === 'string' ? raw.replace(/\s/g, '') : raw;
|
|
224
|
-
};
|
|
225
|
-
this.validator = (control) => {
|
|
226
|
-
if (this.isUpdating()) {
|
|
227
|
-
return null;
|
|
228
|
-
}
|
|
229
|
-
const value = control.value;
|
|
230
|
-
// Verify if error is undefined, null or empty
|
|
231
|
-
if (!value || typeof value !== 'string') {
|
|
232
|
-
//console.debug('Invalid IBAN value: ' + value);
|
|
233
|
-
return null;
|
|
234
|
-
}
|
|
235
|
-
else {
|
|
236
|
-
//console.debug('Valid IBAN value: ' + value);
|
|
237
|
-
}
|
|
238
|
-
if (value.length !== 2) {
|
|
239
|
-
const tempControl = new FormControl(value);
|
|
240
|
-
const ibanValidator = bankAccountValidator();
|
|
241
|
-
const result = ibanValidator(tempControl);
|
|
242
|
-
if (result) {
|
|
243
|
-
this.setErrorValue();
|
|
244
|
-
return result;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
return null;
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
ngOnInit() {
|
|
251
|
-
super.ngOnInit();
|
|
252
|
-
this.form.setValue(this.data);
|
|
253
|
-
this.form.setValidators([Validators.required, this.validator]);
|
|
254
|
-
}
|
|
255
|
-
setErrorValue() {
|
|
256
|
-
this.isUpdating.set(true);
|
|
257
|
-
try {
|
|
258
|
-
// Get existing errors
|
|
259
|
-
const currentState = this.jsonFormsService.getState();
|
|
260
|
-
//console.debug('setErrorValue->Current state:', currentState);
|
|
261
|
-
const currentErrors = currentState?.jsonforms?.core?.['errors'] ?? [];
|
|
262
|
-
//console.debug('setErrorValue->Existing JSONForms errors:', currentErrors);
|
|
263
|
-
const instancePath = JsonFormsSchemaPathUtil.extractStepKey(this.uischema?.scope);
|
|
264
|
-
// Add the IBAN error
|
|
265
|
-
const ibanError = {
|
|
266
|
-
instancePath: instancePath,
|
|
267
|
-
message: 'Numéro IBAN invalide',
|
|
268
|
-
keyword: 'custom-renderer',
|
|
269
|
-
schemaPath: this.uischema?.scope ?? '',
|
|
270
|
-
params: {},
|
|
271
|
-
};
|
|
272
|
-
// Combine IBAN errors with existing errors of jsonforms
|
|
273
|
-
const updatedErrors = [...currentErrors, ibanError];
|
|
274
|
-
//console.debug('setErrorValue->All errors:', updatedErrors);
|
|
275
|
-
const updateAction = Actions.updateErrors(updatedErrors);
|
|
276
|
-
this.jsonFormsService.updateCore(updateAction);
|
|
277
|
-
}
|
|
278
|
-
finally {
|
|
279
|
-
this.isUpdating.set(false);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: IbanRendererComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
283
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: IbanRendererComponent, isStandalone: true, selector: "app-iban-renderer", inputs: { readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: "@if (!hidden) {\n <mat-form-field>\n <mat-label>IBAN</mat-label>\n\n <onemrva-mat-input-iban [formControl]=\"form\" (input)=\"onChange($event)\">\n </onemrva-mat-input-iban>\n\n @if (form.hasError('required')) {\n <mat-error>\n {{ 'error.required' | translate }}\n </mat-error>\n } @else if (form.hasError('WrongBBANLength')) {\n <mat-error>\n {{ 'error.iban.length' | translate }}\n </mat-error>\n } @else if (form.hasError('NoIBANCountry')) {\n <mat-error> NoIBANCountry </mat-error>\n } @else if (\n !form.hasError('WrongBBANLength') &&\n (form.hasError('WrongBBANFormat') ||\n form.hasError('WrongAccountBankBranchChecksum') ||\n form.hasError('WrongIBANChecksum'))\n ) {\n <mat-error>\n {{ 'error.iban.invalid' | translate }}\n </mat-error>\n }\n </mat-form-field>\n}\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i1$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "component", type: OnemrvaMatInputIbanComponent, selector: "onemrva-mat-input-iban", inputs: ["noEntriesFoundLabel", "placeholderLabel", "searchAriaLabel", "label", "prioritizedCountries", "onlySEPA", "value", "readonly", "disabled", "placeholder", "required"], outputs: ["getCountry"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] }); }
|
|
284
|
-
}
|
|
285
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: IbanRendererComponent, decorators: [{
|
|
286
|
-
type: Component,
|
|
287
|
-
args: [{ selector: 'app-iban-renderer', imports: [
|
|
288
|
-
CommonModule,
|
|
289
|
-
MatFormFieldModule,
|
|
290
|
-
ReactiveFormsModule,
|
|
291
|
-
MatInputModule,
|
|
292
|
-
OnemrvaMatInputIbanComponent,
|
|
293
|
-
TranslatePipe,
|
|
294
|
-
], standalone: true, template: "@if (!hidden) {\n <mat-form-field>\n <mat-label>IBAN</mat-label>\n\n <onemrva-mat-input-iban [formControl]=\"form\" (input)=\"onChange($event)\">\n </onemrva-mat-input-iban>\n\n @if (form.hasError('required')) {\n <mat-error>\n {{ 'error.required' | translate }}\n </mat-error>\n } @else if (form.hasError('WrongBBANLength')) {\n <mat-error>\n {{ 'error.iban.length' | translate }}\n </mat-error>\n } @else if (form.hasError('NoIBANCountry')) {\n <mat-error> NoIBANCountry </mat-error>\n } @else if (\n !form.hasError('WrongBBANLength') &&\n (form.hasError('WrongBBANFormat') ||\n form.hasError('WrongAccountBankBranchChecksum') ||\n form.hasError('WrongIBANChecksum'))\n ) {\n <mat-error>\n {{ 'error.iban.invalid' | translate }}\n </mat-error>\n }\n </mat-form-field>\n}\n" }]
|
|
295
|
-
}] });
|
|
296
|
-
const ibanControlTester = rankWith(10, scopeEndsWith('iban'));
|
|
297
|
-
|
|
298
|
-
class LabelRendererComponent extends JsonFormsBaseRenderer {
|
|
299
|
-
constructor() {
|
|
300
|
-
super(...arguments);
|
|
301
|
-
this.jsonFormsService = inject(JsonFormsAngularService);
|
|
302
|
-
}
|
|
303
|
-
ngOnInit() {
|
|
304
|
-
this.addSubscription(this.jsonFormsService.$state.subscribe({
|
|
305
|
-
next: (state) => {
|
|
306
|
-
const props = mapStateToLabelProps(state, this.getOwnProps());
|
|
307
|
-
this.label = props.text;
|
|
308
|
-
this.visible = props.visible;
|
|
309
|
-
},
|
|
310
|
-
}));
|
|
311
|
-
}
|
|
312
|
-
get labelStyle() {
|
|
313
|
-
return {
|
|
314
|
-
fontSize: `${this.fontSize}px`,
|
|
315
|
-
fontWeight: `${this.fontWeight}`,
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
get fontWeight() {
|
|
319
|
-
return this.uischema.options?.['fontWeight'] ?? 'normal';
|
|
320
|
-
}
|
|
321
|
-
get fontSize() {
|
|
322
|
-
return this.uischema.options?.['textSize'] ?? 20;
|
|
323
|
-
}
|
|
324
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: LabelRendererComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
325
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: LabelRendererComponent, isStandalone: true, selector: "app-label-renderer", usesInheritance: true, ngImport: i0, template: "@if (visible) {\n <mat-label [ngStyle]=\"labelStyle\">\n {{ label }}\n </mat-label>\n}\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }] }); }
|
|
326
|
-
}
|
|
327
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: LabelRendererComponent, decorators: [{
|
|
328
|
-
type: Component,
|
|
329
|
-
args: [{ selector: 'app-label-renderer', standalone: true, imports: [CommonModule, MatLabel], template: "@if (visible) {\n <mat-label [ngStyle]=\"labelStyle\">\n {{ label }}\n </mat-label>\n}\n" }]
|
|
330
|
-
}] });
|
|
331
|
-
const customLabelTester = rankWith(5, uiTypeIs('Label'));
|
|
332
|
-
|
|
333
|
-
class NissRendererComponent extends JsonFormsControl {
|
|
334
|
-
constructor() {
|
|
335
|
-
super(...arguments);
|
|
336
|
-
this.nissMask = NISS_MASK;
|
|
337
|
-
this.isUpdating = signal(false, ...(ngDevMode ? [{ debugName: "isUpdating" }] : []));
|
|
338
|
-
this.jsonFormsService = inject(JsonFormsAngularService);
|
|
339
|
-
this.getEventValue = (event) => {
|
|
340
|
-
return event?.target?.value;
|
|
341
|
-
};
|
|
342
|
-
this.validator = (control) => {
|
|
343
|
-
if (this.isUpdating()) {
|
|
344
|
-
return null;
|
|
345
|
-
}
|
|
346
|
-
const value = control.value;
|
|
347
|
-
// Verify if error is undefined, null or empty
|
|
348
|
-
if (!value || typeof value !== 'string') {
|
|
349
|
-
console.debug('Invalid NISS value: ' + value);
|
|
350
|
-
return null;
|
|
351
|
-
}
|
|
352
|
-
else {
|
|
353
|
-
console.debug('Valid NISS value: ' + value);
|
|
354
|
-
}
|
|
355
|
-
const cleanValue = value.toString().trim();
|
|
356
|
-
if (!cleanValue) {
|
|
357
|
-
return null;
|
|
358
|
-
}
|
|
359
|
-
const tempControl = new FormControl(cleanValue);
|
|
360
|
-
const nissValidator = OnemrvaValidators.niss();
|
|
361
|
-
const result = nissValidator(tempControl);
|
|
362
|
-
if (result) {
|
|
363
|
-
this.setErrorValue(result);
|
|
364
|
-
return result;
|
|
365
|
-
}
|
|
366
|
-
return null;
|
|
367
|
-
};
|
|
368
|
-
}
|
|
369
|
-
ngOnInit() {
|
|
370
|
-
super.ngOnInit();
|
|
371
|
-
this.form.setValue(this.data);
|
|
372
|
-
this.form.setValidators(this.validator);
|
|
373
|
-
}
|
|
374
|
-
onChange(event) {
|
|
375
|
-
const formattedValue = this.getEventValue(event);
|
|
376
|
-
const rawValue = formattedValue.replace(/[^0-9]/g, '');
|
|
377
|
-
// Display formatted value
|
|
378
|
-
this.form.setValue(formattedValue);
|
|
379
|
-
// Store raw value
|
|
380
|
-
const modifiedEvent = {
|
|
381
|
-
...event,
|
|
382
|
-
target: { ...event.target, value: rawValue },
|
|
383
|
-
};
|
|
384
|
-
super.onChange(modifiedEvent);
|
|
385
|
-
}
|
|
386
|
-
setErrorValue(error) {
|
|
387
|
-
this.isUpdating.set(true);
|
|
388
|
-
try {
|
|
389
|
-
// Get existing errors
|
|
390
|
-
const currentState = this.jsonFormsService.getState();
|
|
391
|
-
//console.debug('setErrorValue->Current state:', currentState);
|
|
392
|
-
const currentErrors = currentState?.jsonforms?.core?.['errors'] ?? [];
|
|
393
|
-
//console.debug('setErrorValue->Existing JSONForms errors:', currentErrors);
|
|
394
|
-
const instancePath = JsonFormsSchemaPathUtil.extractStepKey(this.uischema?.scope);
|
|
395
|
-
// Add the SSIN errors
|
|
396
|
-
const ssinError = {
|
|
397
|
-
instancePath: instancePath,
|
|
398
|
-
message: 'Numéro XXXX invalide',
|
|
399
|
-
keyword: 'custom-renderer',
|
|
400
|
-
schemaPath: this.uischema?.scope ?? '',
|
|
401
|
-
params: {},
|
|
402
|
-
};
|
|
403
|
-
// Combine SSIN errors with existing errors of jsonforms
|
|
404
|
-
const updatedErrors = [...currentErrors, ssinError];
|
|
405
|
-
//console.debug('setErrorValue->All errors:', updatedErrors);
|
|
406
|
-
const updateAction = Actions.updateErrors(updatedErrors);
|
|
407
|
-
this.jsonFormsService.updateCore(updateAction);
|
|
408
|
-
}
|
|
409
|
-
finally {
|
|
410
|
-
this.isUpdating.set(false);
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
isSsinError() {
|
|
414
|
-
const errors = this.form.errors;
|
|
415
|
-
return (errors !== null &&
|
|
416
|
-
Object.keys(errors).length > 0 &&
|
|
417
|
-
Object.keys(errors)[0].startsWith('niss'));
|
|
418
|
-
}
|
|
419
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: NissRendererComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
420
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: NissRendererComponent, isStandalone: true, selector: "app-niss-renderer", providers: [provideNgxMask()], usesInheritance: true, ngImport: i0, template: "<mat-form-field>\n <mat-label>{{ label }}</mat-label>\n <input\n id=\"{{ id }}\"\n matInput\n [formControl]=\"form\"\n (input)=\"onChange($event)\"\n [mask]=\"nissMask\"\n />\n</mat-form-field>\n\n@if (isSsinError()) {\n <mat-error>{{ 'error.ssin' | translate }}</mat-error>\n}\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: JsonFormsAngularMaterialModule }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: NgxMaskDirective, selector: "input[mask], textarea[mask]", inputs: ["mask", "specialCharacters", "patterns", "prefix", "suffix", "thousandSeparator", "decimalMarker", "dropSpecialCharacters", "hiddenInput", "showMaskTyped", "placeHolderCharacter", "shownMaskExpression", "clearIfNotMatch", "validation", "separatorLimit", "allowNegativeNumbers", "leadZeroDateTime", "leadZero", "triggerOnMaskChange", "apm", "inputTransformFn", "outputTransformFn", "keepCharacterPositions", "instantPrefix"], outputs: ["maskFilled"], exportAs: ["mask", "ngxMask"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] }); }
|
|
421
|
-
}
|
|
422
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: NissRendererComponent, decorators: [{
|
|
423
|
-
type: Component,
|
|
424
|
-
args: [{ selector: 'app-niss-renderer', standalone: true, imports: [
|
|
425
|
-
CommonModule,
|
|
426
|
-
MatFormField,
|
|
427
|
-
MatLabel,
|
|
428
|
-
MatError,
|
|
429
|
-
JsonFormsAngularMaterialModule,
|
|
430
|
-
NgxMaskDirective,
|
|
431
|
-
TranslatePipe,
|
|
432
|
-
], providers: [provideNgxMask()], template: "<mat-form-field>\n <mat-label>{{ label }}</mat-label>\n <input\n id=\"{{ id }}\"\n matInput\n [formControl]=\"form\"\n (input)=\"onChange($event)\"\n [mask]=\"nissMask\"\n />\n</mat-form-field>\n\n@if (isSsinError()) {\n <mat-error>{{ 'error.ssin' | translate }}</mat-error>\n}\n" }]
|
|
433
|
-
}] });
|
|
434
|
-
const nissControlTester = rankWith(10,
|
|
435
|
-
// TODO : Why format ="ssin" is not reconized !!!!
|
|
436
|
-
scopeEndsWith('ssin'));
|
|
437
|
-
|
|
438
|
-
class PhoneRendererComponent extends JsonFormsControl {
|
|
439
|
-
constructor() {
|
|
440
|
-
super(...arguments);
|
|
441
|
-
this.getEventValue = (event) => {
|
|
442
|
-
return event?.target?.value;
|
|
443
|
-
};
|
|
444
|
-
this.validator = (control) => {
|
|
445
|
-
const value = control.value;
|
|
446
|
-
if (value === null || value === undefined || value === '')
|
|
447
|
-
return null;
|
|
448
|
-
if (typeof value !== 'string')
|
|
449
|
-
return { phone: true };
|
|
450
|
-
// Basic international phone validation: starts with '+' or digit, min 6 digits when spaces removed
|
|
451
|
-
const normalized = value.replace(/\s+/g, '');
|
|
452
|
-
const isValid = /^\+?\d{6,}$/.test(normalized);
|
|
453
|
-
return isValid ? null : { phone: true };
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
ngOnInit() {
|
|
457
|
-
super.ngOnInit();
|
|
458
|
-
this.form.setValue(this.data);
|
|
459
|
-
this.form.setValidators([Validators.required, this.validator]);
|
|
460
|
-
}
|
|
461
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: PhoneRendererComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
462
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: PhoneRendererComponent, isStandalone: true, selector: "app-phone-renderer", usesInheritance: true, ngImport: i0, template: "@if (!hidden) {\n <mat-form-field>\n <mat-label>Phone number</mat-label>\n\n <onemrva-mat-input-phone\n [formControl]=\"form\"\n placeholder=\"+32 475 12 23 34\"\n ></onemrva-mat-input-phone>\n\n <mat-hint>hint</mat-hint>\n @if (form.invalid) {\n <mat-error>\n {{ 'input.phone.invalid' | translate }}\n </mat-error>\n }\n </mat-form-field>\n}\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i1$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i1$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: OnemrvaMatInputPhoneComponent, selector: "onemrva-mat-input-phone", inputs: ["noEntriesFoundLabel", "placeholderLabel", "searchAriaLabel", "defaultPrefix", "value", "readonly", "disabled", "placeholder", "required"], outputs: ["getCountry"] }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: MatInputModule }, { kind: "pipe", type: TranslatePipe, name: "translate" }] }); }
|
|
463
|
-
}
|
|
464
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: PhoneRendererComponent, decorators: [{
|
|
465
|
-
type: Component,
|
|
466
|
-
args: [{ selector: 'app-phone-renderer', standalone: true, imports: [
|
|
467
|
-
TranslatePipe,
|
|
468
|
-
CommonModule,
|
|
469
|
-
MatFormFieldModule,
|
|
470
|
-
ReactiveFormsModule,
|
|
471
|
-
OnemrvaMatInputPhoneComponent,
|
|
472
|
-
FormsModule,
|
|
473
|
-
MatInputModule,
|
|
474
|
-
TranslatePipe,
|
|
475
|
-
], template: "@if (!hidden) {\n <mat-form-field>\n <mat-label>Phone number</mat-label>\n\n <onemrva-mat-input-phone\n [formControl]=\"form\"\n placeholder=\"+32 475 12 23 34\"\n ></onemrva-mat-input-phone>\n\n <mat-hint>hint</mat-hint>\n @if (form.invalid) {\n <mat-error>\n {{ 'input.phone.invalid' | translate }}\n </mat-error>\n }\n </mat-form-field>\n}\n" }]
|
|
476
|
-
}] });
|
|
477
|
-
const phoneControllerTester = rankWith(8, scopeEndsWith('phone'));
|
|
478
|
-
|
|
479
|
-
class RadioButtonRendererComponent extends JsonFormsControl {
|
|
480
|
-
constructor() {
|
|
481
|
-
super(...arguments);
|
|
482
|
-
this.options = [];
|
|
483
|
-
}
|
|
484
|
-
mapAdditionalProps() {
|
|
485
|
-
if (this.scopedSchema && this.scopedSchema.enum) {
|
|
486
|
-
this.options = this.scopedSchema.enum;
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
get isControlDisable() {
|
|
490
|
-
try {
|
|
491
|
-
const state = this.jsonFormsService.getState();
|
|
492
|
-
const ajv = state?.jsonforms?.core?.ajv;
|
|
493
|
-
// May not call isEnabled if ajv is undefined
|
|
494
|
-
if (!ajv) {
|
|
495
|
-
return true;
|
|
496
|
-
}
|
|
497
|
-
return !isEnabled(this.uischema, state?.jsonforms?.core?.data ?? {}, '', ajv);
|
|
498
|
-
}
|
|
499
|
-
catch {
|
|
500
|
-
return true;
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: RadioButtonRendererComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
504
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: RadioButtonRendererComponent, isStandalone: true, selector: "app-radio-button-renderer", usesInheritance: true, ngImport: i0, template: "@if (!hidden) {\n <mat-radio-group\n [(ngModel)]=\"data\"\n (change)=\"onChange($event)\"\n disabled=\"{{ isControlDisable }}\"\n class=\"vertical-radio-group\"\n >\n <mat-radio-button *ngFor=\"let option of options\" [value]=\"option\">\n {{ uischema.i18n + '.' + option | translate }}\n </mat-radio-button>\n @if (error) {\n <mat-error> {{ error }}</mat-error>\n }\n </mat-radio-group>\n}\n", styles: [".vertical-radio-group{display:flex;flex-direction:column;margin-bottom:1px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: JsonFormsAngularMaterialModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: MatRadioGroup, selector: "mat-radio-group", inputs: ["color", "name", "labelPosition", "value", "selected", "disabled", "required", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioGroup"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { kind: "pipe", type: i3$1.TranslatePipe, name: "translate" }] }); }
|
|
505
|
-
}
|
|
506
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: RadioButtonRendererComponent, decorators: [{
|
|
507
|
-
type: Component,
|
|
508
|
-
args: [{ selector: 'app-radio-button-renderer', standalone: true, imports: [
|
|
509
|
-
CommonModule,
|
|
510
|
-
TranslateModule,
|
|
511
|
-
MatError,
|
|
512
|
-
JsonFormsAngularMaterialModule,
|
|
513
|
-
MatRadioGroup,
|
|
514
|
-
FormsModule,
|
|
515
|
-
MatRadioButton,
|
|
516
|
-
], template: "@if (!hidden) {\n <mat-radio-group\n [(ngModel)]=\"data\"\n (change)=\"onChange($event)\"\n disabled=\"{{ isControlDisable }}\"\n class=\"vertical-radio-group\"\n >\n <mat-radio-button *ngFor=\"let option of options\" [value]=\"option\">\n {{ uischema.i18n + '.' + option | translate }}\n </mat-radio-button>\n @if (error) {\n <mat-error> {{ error }}</mat-error>\n }\n </mat-radio-group>\n}\n", styles: [".vertical-radio-group{display:flex;flex-direction:column;margin-bottom:1px}\n"] }]
|
|
517
|
-
}] });
|
|
518
|
-
const radioButtonTester = (uischema) => {
|
|
519
|
-
if (uischema.type === 'Control' && uischema.options?.['format'] === 'radio') {
|
|
520
|
-
return 11;
|
|
521
|
-
}
|
|
522
|
-
return -1;
|
|
523
|
-
};
|
|
524
|
-
|
|
525
|
-
class ReadonlyControlRendererComponent extends JsonFormsControl {
|
|
526
|
-
constructor() {
|
|
527
|
-
super(...arguments);
|
|
528
|
-
this.translate = inject(TranslateService);
|
|
529
|
-
this.onemrvaNissPipe = inject(OnemrvaNissPipe);
|
|
530
|
-
}
|
|
531
|
-
mapAdditionalProps() {
|
|
532
|
-
if (this.needsTranslation()) {
|
|
533
|
-
const translationKey = this.uischema.i18n + '.' + this.form.value;
|
|
534
|
-
const translatedValue = this.translate.instant(translationKey);
|
|
535
|
-
this.form.patchValue(translatedValue);
|
|
536
|
-
}
|
|
537
|
-
if (this.isNiss()) {
|
|
538
|
-
const formattedNiss = this.onemrvaNissPipe.transform(this.form.value);
|
|
539
|
-
this.form.patchValue(formattedNiss);
|
|
540
|
-
}
|
|
541
|
-
if (this.isIban()) {
|
|
542
|
-
const formattedIban = this.formatIban(this.form.value);
|
|
543
|
-
this.form.patchValue(formattedIban);
|
|
544
|
-
}
|
|
545
|
-
// if (this.isDate()) {
|
|
546
|
-
// const formattedDate = moment(this.form.value).format('DD/MM/YYYY');
|
|
547
|
-
// this.form.patchValue(formattedDate);
|
|
548
|
-
// }
|
|
549
|
-
}
|
|
550
|
-
formatIban(iban) {
|
|
551
|
-
const cleanIban = iban.replace(/\s+/g, '');
|
|
552
|
-
return cleanIban.replace(/(.{4})/g, '$1 ').trim();
|
|
553
|
-
}
|
|
554
|
-
hasValueAndSchema() {
|
|
555
|
-
return !!this.form.value && !!this.scopedSchema;
|
|
556
|
-
}
|
|
557
|
-
isIban() {
|
|
558
|
-
return (this.hasValueAndSchema() &&
|
|
559
|
-
!!this.uischema.scope &&
|
|
560
|
-
this.uischema.scope.endsWith('/iban'));
|
|
561
|
-
}
|
|
562
|
-
isDate() {
|
|
563
|
-
return this.hasValueAndSchema() && this.scopedSchema.format === 'date';
|
|
564
|
-
}
|
|
565
|
-
isNiss() {
|
|
566
|
-
return (this.hasValueAndSchema() &&
|
|
567
|
-
!!this.uischema.scope &&
|
|
568
|
-
this.uischema.scope.endsWith('/ssin'));
|
|
569
|
-
}
|
|
570
|
-
needsTranslation() {
|
|
571
|
-
const isEnum = this.hasValueAndSchema() && !!this.scopedSchema.enum;
|
|
572
|
-
const isBooleanType = this.scopedSchema !== undefined &&
|
|
573
|
-
this.scopedSchema.type?.[0] === 'boolean';
|
|
574
|
-
return isEnum || isBooleanType;
|
|
575
|
-
}
|
|
576
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: ReadonlyControlRendererComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
577
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.4", type: ReadonlyControlRendererComponent, isStandalone: true, selector: "app-readonly-control-renderer", providers: [], usesInheritance: true, ngImport: i0, template: "<div class=\"summary-grid\">\n <mat-label class=\"column1\">{{ label }}</mat-label>\n <input class=\"column2 mat-typography\" [id]=\"id\" [formControl]=\"form\" />\n</div>\n", styles: [".column2{border:none;background:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: JsonFormsAngularMaterialModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
578
|
-
}
|
|
579
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: ReadonlyControlRendererComponent, decorators: [{
|
|
580
|
-
type: Component,
|
|
581
|
-
args: [{ selector: 'app-readonly-control-renderer', standalone: true, imports: [
|
|
582
|
-
CommonModule,
|
|
583
|
-
FormsModule,
|
|
584
|
-
MatLabel,
|
|
585
|
-
JsonFormsAngularMaterialModule,
|
|
586
|
-
], providers: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"summary-grid\">\n <mat-label class=\"column1\">{{ label }}</mat-label>\n <input class=\"column2 mat-typography\" [id]=\"id\" [formControl]=\"form\" />\n</div>\n", styles: [".column2{border:none;background:none}\n"] }]
|
|
587
|
-
}] });
|
|
588
|
-
const readonlyControlTester = rankWith(11, and(isControl, optionIs('readonly', true)));
|
|
589
|
-
|
|
590
|
-
class EnumRendererComponent extends JsonFormsControl {
|
|
591
|
-
constructor() {
|
|
592
|
-
super(...arguments);
|
|
593
|
-
this.options = signal([], ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
594
|
-
}
|
|
595
|
-
mapAdditionalProps(props) {
|
|
596
|
-
this.options.set(this.scopedSchema?.enum || []);
|
|
597
|
-
super.mapAdditionalProps(props);
|
|
598
|
-
}
|
|
599
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: EnumRendererComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
600
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: EnumRendererComponent, isStandalone: true, selector: "app-enum-renderer", usesInheritance: true, ngImport: i0, template: "<mat-form-field appearance=\"outline\">\n <mat-label>{{ label }}</mat-label>\n <mat-select\n [(value)]=\"data\"\n (selectionChange)=\"onChange($event)\"\n [formControl]=\"form\"\n >\n @for (value of options(); track value) {\n <mat-option [value]=\"value\">\n {{ uischema.i18n + '.' + value | translate }}\n </mat-option>\n }\n </mat-select>\n</mat-form-field>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "component", type: MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "ngmodule", type: JsonFormsAngularMaterialModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "pipe", type: i3$1.TranslatePipe, name: "translate" }] }); }
|
|
601
|
-
}
|
|
602
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: EnumRendererComponent, decorators: [{
|
|
603
|
-
type: Component,
|
|
604
|
-
args: [{ selector: 'app-enum-renderer', standalone: true, imports: [
|
|
605
|
-
CommonModule,
|
|
606
|
-
TranslateModule,
|
|
607
|
-
MatFormField,
|
|
608
|
-
MatLabel,
|
|
609
|
-
MatOption,
|
|
610
|
-
MatSelect,
|
|
611
|
-
JsonFormsAngularMaterialModule,
|
|
612
|
-
], template: "<mat-form-field appearance=\"outline\">\n <mat-label>{{ label }}</mat-label>\n <mat-select\n [(value)]=\"data\"\n (selectionChange)=\"onChange($event)\"\n [formControl]=\"form\"\n >\n @for (value of options(); track value) {\n <mat-option [value]=\"value\">\n {{ uischema.i18n + '.' + value | translate }}\n </mat-option>\n }\n </mat-select>\n</mat-form-field>\n" }]
|
|
613
|
-
}] });
|
|
614
|
-
const enumControlTester = rankWith(10, isEnumControl);
|
|
615
|
-
|
|
616
|
-
/**
|
|
617
|
-
* Generated bundle index. Do not edit.
|
|
618
|
-
*/
|
|
619
|
-
|
|
620
|
-
export { CheckboxRendererComponent, DatePickerRendererTester, DatepickerRendererComponent, EnumRendererComponent, IbanRendererComponent, LabelRendererComponent, NissRendererComponent, PhoneRendererComponent, RadioButtonRendererComponent, ReadonlyControlRendererComponent, checkboxTester, customLabelTester, enumControlTester, ibanControlTester, nissControlTester, phoneControllerTester, radioButtonTester, readonlyControlTester };
|
|
621
|
-
//# sourceMappingURL=onemrvapublic-design-system-jsonform-renderers.mjs.map
|