@onemrvapublic/design-system 20.6.3-develop.4 → 20.7.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/fesm2022/onemrvapublic-design-system-flag-icon.mjs +3 -3
- package/fesm2022/onemrvapublic-design-system-flag-icon.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-jsonform-renderers.mjs +614 -0
- package/fesm2022/onemrvapublic-design-system-jsonform-renderers.mjs.map +1 -0
- package/fesm2022/onemrvapublic-design-system-layout.mjs +58 -58
- package/fesm2022/onemrvapublic-design-system-layout.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-address.mjs +3 -3
- package/fesm2022/onemrvapublic-design-system-mat-address.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-avatar.mjs +7 -7
- package/fesm2022/onemrvapublic-design-system-mat-avatar.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-breadcrumb.mjs +10 -10
- package/fesm2022/onemrvapublic-design-system-mat-breadcrumb.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-carousel.mjs +6 -6
- package/fesm2022/onemrvapublic-design-system-mat-carousel.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-choice-chip.mjs +3 -3
- package/fesm2022/onemrvapublic-design-system-mat-choice-chip.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-copy-to-clipboard.mjs +3 -3
- package/fesm2022/onemrvapublic-design-system-mat-copy-to-clipboard.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-country-item.mjs +3 -3
- package/fesm2022/onemrvapublic-design-system-mat-country-item.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-datepicker-header.mjs +3 -3
- package/fesm2022/onemrvapublic-design-system-mat-datepicker-header.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-empty-row.mjs +3 -3
- package/fesm2022/onemrvapublic-design-system-mat-empty-row.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-file-upload.mjs +19 -19
- package/fesm2022/onemrvapublic-design-system-mat-file-upload.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-input-address.mjs +6 -6
- package/fesm2022/onemrvapublic-design-system-mat-input-address.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-input-birthplace.mjs +4 -4
- package/fesm2022/onemrvapublic-design-system-mat-input-birthplace.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-input-country.mjs +3 -3
- package/fesm2022/onemrvapublic-design-system-mat-input-country.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-input-enterprise-number.mjs +4 -4
- package/fesm2022/onemrvapublic-design-system-mat-input-enterprise-number.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-input-iban.mjs +54 -13
- package/fesm2022/onemrvapublic-design-system-mat-input-iban.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-input-phone.mjs +288 -156
- package/fesm2022/onemrvapublic-design-system-mat-input-phone.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-message-box.mjs +7 -7
- package/fesm2022/onemrvapublic-design-system-mat-message-box.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-multi-select.mjs +7 -7
- package/fesm2022/onemrvapublic-design-system-mat-multi-select.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-navigation.mjs +9 -9
- package/fesm2022/onemrvapublic-design-system-mat-navigation.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-notification.mjs +3 -3
- package/fesm2022/onemrvapublic-design-system-mat-notification.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-paginator.mjs +7 -7
- package/fesm2022/onemrvapublic-design-system-mat-paginator.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-panel.mjs +23 -23
- package/fesm2022/onemrvapublic-design-system-mat-panel.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-pop-over.mjs +13 -13
- package/fesm2022/onemrvapublic-design-system-mat-pop-over.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-progress-bar.mjs +3 -3
- package/fesm2022/onemrvapublic-design-system-mat-progress-bar.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-select-search.mjs +13 -13
- package/fesm2022/onemrvapublic-design-system-mat-select-search.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-selectable-box.mjs +7 -7
- package/fesm2022/onemrvapublic-design-system-mat-selectable-box.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-side-menu.mjs +7 -7
- package/fesm2022/onemrvapublic-design-system-mat-side-menu.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-skeleton.mjs +7 -7
- package/fesm2022/onemrvapublic-design-system-mat-skeleton.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-spinner.mjs +10 -10
- package/fesm2022/onemrvapublic-design-system-mat-spinner.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-stepper.mjs +7 -7
- package/fesm2022/onemrvapublic-design-system-mat-stepper.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-sticker.mjs +8 -8
- package/fesm2022/onemrvapublic-design-system-mat-sticker.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-table-of-content.mjs +9 -9
- package/fesm2022/onemrvapublic-design-system-mat-table-of-content.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-task-list.mjs +16 -16
- package/fesm2022/onemrvapublic-design-system-mat-task-list.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-timepicker.mjs +22 -22
- package/fesm2022/onemrvapublic-design-system-mat-timepicker.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-toast.mjs +7 -7
- package/fesm2022/onemrvapublic-design-system-mat-toast.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-mat-tooltip.mjs +10 -10
- package/fesm2022/onemrvapublic-design-system-mat-tooltip.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-page-error.mjs +6 -6
- package/fesm2022/onemrvapublic-design-system-page-error.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-page-not-found.mjs +16 -16
- package/fesm2022/onemrvapublic-design-system-page-not-found.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system-shared.mjs +102 -91
- package/fesm2022/onemrvapublic-design-system-shared.mjs.map +1 -1
- package/fesm2022/onemrvapublic-design-system.mjs +1376 -606
- package/fesm2022/onemrvapublic-design-system.mjs.map +1 -1
- package/index.d.ts +175 -21
- package/jsonform-renderers/datepicker-renderer/datepicker-renderer.component.scss +22 -0
- package/jsonform-renderers/index.d.ts +123 -0
- 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 +5 -0
- package/jsonform-renderers/readonly-control-renderer/readonly-control-renderer.component.scss +4 -0
- package/jsonform-renderers/select-renderer/select-renderer.component.scss +0 -0
- package/mat-input-phone/index.d.ts +58 -20
- package/mat-input-phone/src/onemrva-mat-input-phone.component.scss +8 -26
- package/mat-panel/src/onemrva-mat-panel.component.scss +8 -17
- package/mat-sticker/src/onemrva-mat-sticker.component.scss +4 -5
- package/package.json +9 -5
- package/shared/index.d.ts +5 -3
|
@@ -0,0 +1,614 @@
|
|
|
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
|
+
return event?.target?.value;
|
|
217
|
+
};
|
|
218
|
+
this.validator = (control) => {
|
|
219
|
+
if (this.isUpdating()) {
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
const value = control.value;
|
|
223
|
+
// Verify if error is undefined, null or empty
|
|
224
|
+
if (!value || typeof value !== 'string') {
|
|
225
|
+
//console.debug('Invalid IBAN value: ' + value);
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
//console.debug('Valid IBAN value: ' + value);
|
|
230
|
+
}
|
|
231
|
+
if (value.length !== 2) {
|
|
232
|
+
const tempControl = new FormControl(value);
|
|
233
|
+
const ibanValidator = bankAccountValidator();
|
|
234
|
+
const result = ibanValidator(tempControl);
|
|
235
|
+
if (result) {
|
|
236
|
+
this.setErrorValue();
|
|
237
|
+
return result;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return null;
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
ngOnInit() {
|
|
244
|
+
super.ngOnInit();
|
|
245
|
+
this.form.setValue(this.data);
|
|
246
|
+
this.form.setValidators([Validators.required, this.validator]);
|
|
247
|
+
}
|
|
248
|
+
onChange(event) {
|
|
249
|
+
const ibanValue = this.buildIbanValue(event);
|
|
250
|
+
const modifiedEvent = {
|
|
251
|
+
...event,
|
|
252
|
+
target: { ...event.target, value: ibanValue },
|
|
253
|
+
};
|
|
254
|
+
super.onChange(modifiedEvent);
|
|
255
|
+
}
|
|
256
|
+
buildIbanValue(event) {
|
|
257
|
+
let builtValue = event?.currentTarget?.innerText;
|
|
258
|
+
if (event?.data === null) {
|
|
259
|
+
builtValue = builtValue + event?.target?.value?.slice(0, -1);
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
builtValue =
|
|
263
|
+
builtValue + event?.target?.value.toString().replace(/\s/g, '');
|
|
264
|
+
if (event?.target?.value?.toString().length < 14) {
|
|
265
|
+
builtValue = builtValue + event?.data;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return builtValue;
|
|
269
|
+
}
|
|
270
|
+
setErrorValue() {
|
|
271
|
+
this.isUpdating.set(true);
|
|
272
|
+
try {
|
|
273
|
+
// Get existing errors
|
|
274
|
+
const currentState = this.jsonFormsService.getState();
|
|
275
|
+
console.debug('setErrorValue->Current state:', currentState);
|
|
276
|
+
const currentErrors = currentState?.jsonforms?.core?.['errors'] ?? [];
|
|
277
|
+
console.debug('setErrorValue->Existing JSONForms errors:', currentErrors);
|
|
278
|
+
const instancePath = JsonFormsSchemaPathUtil.extractStepKey(this.uischema?.scope);
|
|
279
|
+
// Add the IBAN error
|
|
280
|
+
const ibanError = {
|
|
281
|
+
instancePath: instancePath,
|
|
282
|
+
message: 'Numéro IBAN invalide',
|
|
283
|
+
keyword: 'custom-renderer',
|
|
284
|
+
schemaPath: this.uischema?.scope ?? '',
|
|
285
|
+
params: {},
|
|
286
|
+
};
|
|
287
|
+
// Combine IBAN errors with existing errors of jsonforms
|
|
288
|
+
const updatedErrors = [...currentErrors, ibanError];
|
|
289
|
+
console.debug('setErrorValue->All errors:', updatedErrors);
|
|
290
|
+
const updateAction = Actions.updateErrors(updatedErrors);
|
|
291
|
+
this.jsonFormsService.updateCore(updateAction);
|
|
292
|
+
}
|
|
293
|
+
finally {
|
|
294
|
+
this.isUpdating.set(false);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: IbanRendererComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
298
|
+
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" }] }); }
|
|
299
|
+
}
|
|
300
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: IbanRendererComponent, decorators: [{
|
|
301
|
+
type: Component,
|
|
302
|
+
args: [{ selector: 'app-iban-renderer', imports: [
|
|
303
|
+
CommonModule,
|
|
304
|
+
MatFormFieldModule,
|
|
305
|
+
ReactiveFormsModule,
|
|
306
|
+
MatInputModule,
|
|
307
|
+
OnemrvaMatInputIbanComponent,
|
|
308
|
+
TranslatePipe,
|
|
309
|
+
], 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" }]
|
|
310
|
+
}] });
|
|
311
|
+
const ibanControlTester = rankWith(10, scopeEndsWith('iban'));
|
|
312
|
+
|
|
313
|
+
class LabelRendererComponent extends JsonFormsBaseRenderer {
|
|
314
|
+
constructor() {
|
|
315
|
+
super(...arguments);
|
|
316
|
+
this.jsonFormsService = inject(JsonFormsAngularService);
|
|
317
|
+
}
|
|
318
|
+
ngOnInit() {
|
|
319
|
+
this.addSubscription(this.jsonFormsService.$state.subscribe({
|
|
320
|
+
next: (state) => {
|
|
321
|
+
const props = mapStateToLabelProps(state, this.getOwnProps());
|
|
322
|
+
this.label = props.text;
|
|
323
|
+
this.visible = props.visible;
|
|
324
|
+
},
|
|
325
|
+
}));
|
|
326
|
+
}
|
|
327
|
+
get labelStyle() {
|
|
328
|
+
return {
|
|
329
|
+
fontSize: `${this.fontSize}px`,
|
|
330
|
+
fontWeight: `${this.fontWeight}`,
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
get fontWeight() {
|
|
334
|
+
return this.uischema.options?.['fontWeight'] ?? 'normal';
|
|
335
|
+
}
|
|
336
|
+
get fontSize() {
|
|
337
|
+
return this.uischema.options?.['textSize'] ?? 20;
|
|
338
|
+
}
|
|
339
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: LabelRendererComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
340
|
+
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" }] }); }
|
|
341
|
+
}
|
|
342
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: LabelRendererComponent, decorators: [{
|
|
343
|
+
type: Component,
|
|
344
|
+
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" }]
|
|
345
|
+
}] });
|
|
346
|
+
const customLabelTester = rankWith(5, uiTypeIs('Label'));
|
|
347
|
+
|
|
348
|
+
class NissRendererComponent extends JsonFormsControl {
|
|
349
|
+
constructor() {
|
|
350
|
+
super(...arguments);
|
|
351
|
+
this.nissMask = NISS_MASK;
|
|
352
|
+
this.isUpdating = signal(false, ...(ngDevMode ? [{ debugName: "isUpdating" }] : []));
|
|
353
|
+
this.jsonFormsService = inject(JsonFormsAngularService);
|
|
354
|
+
this.getEventValue = (event) => {
|
|
355
|
+
return event?.target?.value;
|
|
356
|
+
};
|
|
357
|
+
this.validator = (control) => {
|
|
358
|
+
if (this.isUpdating()) {
|
|
359
|
+
return null;
|
|
360
|
+
}
|
|
361
|
+
const value = control.value;
|
|
362
|
+
// Verify if error is undefined, null or empty
|
|
363
|
+
if (!value || typeof value !== 'string') {
|
|
364
|
+
console.debug('Invalid NISS value: ' + value);
|
|
365
|
+
return null;
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
console.debug('Valid NISS value: ' + value);
|
|
369
|
+
}
|
|
370
|
+
const cleanValue = value.toString().trim();
|
|
371
|
+
if (!cleanValue) {
|
|
372
|
+
return null;
|
|
373
|
+
}
|
|
374
|
+
const tempControl = new FormControl(cleanValue);
|
|
375
|
+
const nissValidator = OnemrvaValidators.niss();
|
|
376
|
+
const result = nissValidator(tempControl);
|
|
377
|
+
if (result) {
|
|
378
|
+
this.setErrorValue(result);
|
|
379
|
+
return result;
|
|
380
|
+
}
|
|
381
|
+
return null;
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
ngOnInit() {
|
|
385
|
+
super.ngOnInit();
|
|
386
|
+
this.form.setValue(this.data);
|
|
387
|
+
this.form.setValidators(this.validator);
|
|
388
|
+
}
|
|
389
|
+
onChange(event) {
|
|
390
|
+
const formattedValue = this.getEventValue(event);
|
|
391
|
+
const rawValue = formattedValue.replace(/[^0-9]/g, '');
|
|
392
|
+
// Display formatted value
|
|
393
|
+
this.form.setValue(formattedValue);
|
|
394
|
+
// Store raw value
|
|
395
|
+
const modifiedEvent = {
|
|
396
|
+
...event,
|
|
397
|
+
target: { ...event.target, value: rawValue },
|
|
398
|
+
};
|
|
399
|
+
super.onChange(modifiedEvent);
|
|
400
|
+
}
|
|
401
|
+
setErrorValue(error) {
|
|
402
|
+
this.isUpdating.set(true);
|
|
403
|
+
try {
|
|
404
|
+
// Get existing errors
|
|
405
|
+
const currentState = this.jsonFormsService.getState();
|
|
406
|
+
console.debug('setErrorValue->Current state:', currentState);
|
|
407
|
+
const currentErrors = currentState?.jsonforms?.core?.['errors'] ?? [];
|
|
408
|
+
console.debug('setErrorValue->Existing JSONForms errors:', currentErrors);
|
|
409
|
+
const instancePath = JsonFormsSchemaPathUtil.extractStepKey(this.uischema?.scope);
|
|
410
|
+
// Add the SSIN errors
|
|
411
|
+
const ssinError = {
|
|
412
|
+
instancePath: instancePath,
|
|
413
|
+
message: 'Numéro XXXX invalide',
|
|
414
|
+
keyword: 'custom-renderer',
|
|
415
|
+
schemaPath: this.uischema?.scope ?? '',
|
|
416
|
+
params: {},
|
|
417
|
+
};
|
|
418
|
+
// Combine SSIN errors with existing errors of jsonforms
|
|
419
|
+
const updatedErrors = [...currentErrors, ssinError];
|
|
420
|
+
console.debug('setErrorValue->All errors:', updatedErrors);
|
|
421
|
+
const updateAction = Actions.updateErrors(updatedErrors);
|
|
422
|
+
this.jsonFormsService.updateCore(updateAction);
|
|
423
|
+
}
|
|
424
|
+
finally {
|
|
425
|
+
this.isUpdating.set(false);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
isSsinError() {
|
|
429
|
+
const errors = this.form.errors;
|
|
430
|
+
return (errors !== null &&
|
|
431
|
+
Object.keys(errors).length > 0 &&
|
|
432
|
+
Object.keys(errors)[0].startsWith('niss'));
|
|
433
|
+
}
|
|
434
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: NissRendererComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
435
|
+
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" }] }); }
|
|
436
|
+
}
|
|
437
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: NissRendererComponent, decorators: [{
|
|
438
|
+
type: Component,
|
|
439
|
+
args: [{ selector: 'app-niss-renderer', standalone: true, imports: [
|
|
440
|
+
CommonModule,
|
|
441
|
+
MatFormField,
|
|
442
|
+
MatLabel,
|
|
443
|
+
MatError,
|
|
444
|
+
JsonFormsAngularMaterialModule,
|
|
445
|
+
NgxMaskDirective,
|
|
446
|
+
TranslatePipe,
|
|
447
|
+
], 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" }]
|
|
448
|
+
}] });
|
|
449
|
+
const nissControlTester = rankWith(10,
|
|
450
|
+
// TODO : Why format ="ssin" is not reconized !!!!
|
|
451
|
+
scopeEndsWith('ssin'));
|
|
452
|
+
|
|
453
|
+
class PhoneRendererComponent extends JsonFormsControl {
|
|
454
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: PhoneRendererComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
455
|
+
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", "label", "defaultPrefix", "value", "readonly", "disabled", "placeholder", "required"], outputs: ["getCountry"] }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: MatInputModule }, { kind: "pipe", type: TranslatePipe, name: "translate" }] }); }
|
|
456
|
+
}
|
|
457
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: PhoneRendererComponent, decorators: [{
|
|
458
|
+
type: Component,
|
|
459
|
+
args: [{ selector: 'app-phone-renderer', standalone: true, imports: [
|
|
460
|
+
TranslatePipe,
|
|
461
|
+
CommonModule,
|
|
462
|
+
MatFormFieldModule,
|
|
463
|
+
ReactiveFormsModule,
|
|
464
|
+
OnemrvaMatInputPhoneComponent,
|
|
465
|
+
FormsModule,
|
|
466
|
+
MatInputModule,
|
|
467
|
+
TranslatePipe,
|
|
468
|
+
], 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" }]
|
|
469
|
+
}] });
|
|
470
|
+
const phoneControllerTester = rankWith(8, scopeEndsWith('phone'));
|
|
471
|
+
|
|
472
|
+
class RadioButtonRendererComponent extends JsonFormsControl {
|
|
473
|
+
constructor() {
|
|
474
|
+
super(...arguments);
|
|
475
|
+
this.options = [];
|
|
476
|
+
}
|
|
477
|
+
mapAdditionalProps() {
|
|
478
|
+
if (this.scopedSchema && this.scopedSchema.enum) {
|
|
479
|
+
this.options = this.scopedSchema.enum;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
get isControlDisable() {
|
|
483
|
+
try {
|
|
484
|
+
const state = this.jsonFormsService.getState();
|
|
485
|
+
const ajv = state?.jsonforms?.core?.ajv;
|
|
486
|
+
// May not call isEnabled if ajv is undefined
|
|
487
|
+
if (!ajv) {
|
|
488
|
+
return true;
|
|
489
|
+
}
|
|
490
|
+
return !isEnabled(this.uischema, state?.jsonforms?.core?.data ?? {}, '', ajv);
|
|
491
|
+
}
|
|
492
|
+
catch {
|
|
493
|
+
return true;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: RadioButtonRendererComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
497
|
+
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" }] }); }
|
|
498
|
+
}
|
|
499
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: RadioButtonRendererComponent, decorators: [{
|
|
500
|
+
type: Component,
|
|
501
|
+
args: [{ selector: 'app-radio-button-renderer', standalone: true, imports: [
|
|
502
|
+
CommonModule,
|
|
503
|
+
TranslateModule,
|
|
504
|
+
MatError,
|
|
505
|
+
JsonFormsAngularMaterialModule,
|
|
506
|
+
MatRadioGroup,
|
|
507
|
+
FormsModule,
|
|
508
|
+
MatRadioButton,
|
|
509
|
+
], 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"] }]
|
|
510
|
+
}] });
|
|
511
|
+
const radioButtonTester = (uischema) => {
|
|
512
|
+
if (uischema.type === 'Control' && uischema.options?.['format'] === 'radio') {
|
|
513
|
+
return 11;
|
|
514
|
+
}
|
|
515
|
+
return -1;
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
class ReadonlyControlRendererComponent extends JsonFormsControl {
|
|
519
|
+
constructor() {
|
|
520
|
+
super(...arguments);
|
|
521
|
+
this.translate = inject(TranslateService);
|
|
522
|
+
this.onemrvaNissPipe = inject(OnemrvaNissPipe);
|
|
523
|
+
}
|
|
524
|
+
mapAdditionalProps() {
|
|
525
|
+
if (this.needsTranslation()) {
|
|
526
|
+
const translationKey = this.uischema.i18n + '.' + this.form.value;
|
|
527
|
+
const translatedValue = this.translate.instant(translationKey);
|
|
528
|
+
this.form.patchValue(translatedValue);
|
|
529
|
+
}
|
|
530
|
+
if (this.isNiss()) {
|
|
531
|
+
const formattedNiss = this.onemrvaNissPipe.transform(this.form.value);
|
|
532
|
+
this.form.patchValue(formattedNiss);
|
|
533
|
+
}
|
|
534
|
+
if (this.isIban()) {
|
|
535
|
+
const formattedIban = this.formatIban(this.form.value);
|
|
536
|
+
this.form.patchValue(formattedIban);
|
|
537
|
+
}
|
|
538
|
+
// if (this.isDate()) {
|
|
539
|
+
// const formattedDate = moment(this.form.value).format('DD/MM/YYYY');
|
|
540
|
+
// this.form.patchValue(formattedDate);
|
|
541
|
+
// }
|
|
542
|
+
}
|
|
543
|
+
formatIban(iban) {
|
|
544
|
+
const cleanIban = iban.replace(/\s+/g, '');
|
|
545
|
+
return cleanIban.replace(/(.{4})/g, '$1 ').trim();
|
|
546
|
+
}
|
|
547
|
+
hasValueAndSchema() {
|
|
548
|
+
return !!this.form.value && !!this.scopedSchema;
|
|
549
|
+
}
|
|
550
|
+
isIban() {
|
|
551
|
+
return (this.hasValueAndSchema() &&
|
|
552
|
+
!!this.uischema.scope &&
|
|
553
|
+
this.uischema.scope.endsWith('/iban'));
|
|
554
|
+
}
|
|
555
|
+
isDate() {
|
|
556
|
+
return this.hasValueAndSchema() && this.scopedSchema.format === 'date';
|
|
557
|
+
}
|
|
558
|
+
isNiss() {
|
|
559
|
+
return (this.hasValueAndSchema() &&
|
|
560
|
+
!!this.uischema.scope &&
|
|
561
|
+
this.uischema.scope.endsWith('/ssin'));
|
|
562
|
+
}
|
|
563
|
+
needsTranslation() {
|
|
564
|
+
const isEnum = this.hasValueAndSchema() && !!this.scopedSchema.enum;
|
|
565
|
+
const isBooleanType = this.scopedSchema !== undefined &&
|
|
566
|
+
this.scopedSchema.type?.[0] === 'boolean';
|
|
567
|
+
return isEnum || isBooleanType;
|
|
568
|
+
}
|
|
569
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: ReadonlyControlRendererComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
570
|
+
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 }); }
|
|
571
|
+
}
|
|
572
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: ReadonlyControlRendererComponent, decorators: [{
|
|
573
|
+
type: Component,
|
|
574
|
+
args: [{ selector: 'app-readonly-control-renderer', standalone: true, imports: [
|
|
575
|
+
CommonModule,
|
|
576
|
+
FormsModule,
|
|
577
|
+
MatLabel,
|
|
578
|
+
JsonFormsAngularMaterialModule,
|
|
579
|
+
], 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"] }]
|
|
580
|
+
}] });
|
|
581
|
+
const readonlyControlTester = rankWith(11, and(isControl, optionIs('readonly', true)));
|
|
582
|
+
|
|
583
|
+
class EnumRendererComponent extends JsonFormsControl {
|
|
584
|
+
constructor() {
|
|
585
|
+
super(...arguments);
|
|
586
|
+
this.options = signal([], ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
587
|
+
}
|
|
588
|
+
mapAdditionalProps(props) {
|
|
589
|
+
this.options.set(this.scopedSchema?.enum || []);
|
|
590
|
+
super.mapAdditionalProps(props);
|
|
591
|
+
}
|
|
592
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: EnumRendererComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
593
|
+
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" }] }); }
|
|
594
|
+
}
|
|
595
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: EnumRendererComponent, decorators: [{
|
|
596
|
+
type: Component,
|
|
597
|
+
args: [{ selector: 'app-enum-renderer', standalone: true, imports: [
|
|
598
|
+
CommonModule,
|
|
599
|
+
TranslateModule,
|
|
600
|
+
MatFormField,
|
|
601
|
+
MatLabel,
|
|
602
|
+
MatOption,
|
|
603
|
+
MatSelect,
|
|
604
|
+
JsonFormsAngularMaterialModule,
|
|
605
|
+
], 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" }]
|
|
606
|
+
}] });
|
|
607
|
+
const enumControlTester = rankWith(10, isEnumControl);
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* Generated bundle index. Do not edit.
|
|
611
|
+
*/
|
|
612
|
+
|
|
613
|
+
export { CheckboxRendererComponent, DatePickerRendererTester, DatepickerRendererComponent, EnumRendererComponent, IbanRendererComponent, LabelRendererComponent, NissRendererComponent, PhoneRendererComponent, RadioButtonRendererComponent, ReadonlyControlRendererComponent, checkboxTester, customLabelTester, enumControlTester, ibanControlTester, nissControlTester, phoneControllerTester, radioButtonTester, readonlyControlTester };
|
|
614
|
+
//# sourceMappingURL=onemrvapublic-design-system-jsonform-renderers.mjs.map
|