@ng-modular-forms/core 0.7.4 → 0.7.7
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/README.md +3 -1
- package/fesm2022/ng-modular-forms-core.mjs +228 -365
- package/fesm2022/ng-modular-forms-core.mjs.map +1 -1
- package/lib/base/form-control-base.d.ts +1 -1
- package/lib/base/form-handler-base.d.ts +2 -2
- package/lib/form-hydrator.d.ts +2 -2
- package/lib/form-orchestrator.d.ts +3 -3
- package/lib/form-serializer.d.ts +2 -2
- package/lib/{form-util.d.ts → form-utils.d.ts} +1 -3
- package/lib/input/form-field.component.d.ts +9 -0
- package/lib/input/input-currency.component.d.ts +1 -1
- package/lib/input/input-datepicker.component.d.ts +1 -1
- package/lib/input/input-number.component.d.ts +2 -2
- package/lib/input/input-select.component.d.ts +1 -1
- package/lib/input/input-text.component.d.ts +1 -1
- package/lib/input/input-timepicker.component.d.ts +1 -1
- package/lib/number-utils.d.ts +2 -0
- package/lib/type-guards.d.ts +1 -0
- package/lib/types.d.ts +4 -4
- package/package.json +30 -11
- package/public-api.d.ts +2 -1
|
@@ -18,6 +18,7 @@ class FormControlBase {
|
|
|
18
18
|
placeholder = input('');
|
|
19
19
|
_disabledByInput = input(false, {
|
|
20
20
|
transform: booleanAttribute,
|
|
21
|
+
alias: 'disabledOverride',
|
|
21
22
|
});
|
|
22
23
|
_disabledByCva = signal(false);
|
|
23
24
|
ngControl = inject(NgControl, {
|
|
@@ -105,39 +106,12 @@ class FormControlBase {
|
|
|
105
106
|
}
|
|
106
107
|
}
|
|
107
108
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: FormControlBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
108
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.21", type: FormControlBase, isStandalone: true, inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, classList: { classPropertyName: "classList", publicName: "classList", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, _disabledByInput: { classPropertyName: "_disabledByInput", publicName: "
|
|
109
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.21", type: FormControlBase, isStandalone: true, inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, classList: { classPropertyName: "classList", publicName: "classList", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, _disabledByInput: { classPropertyName: "_disabledByInput", publicName: "disabledOverride", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
109
110
|
}
|
|
110
111
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: FormControlBase, decorators: [{
|
|
111
112
|
type: Directive
|
|
112
113
|
}], ctorParameters: () => [] });
|
|
113
114
|
|
|
114
|
-
function getControl(controlName, form) {
|
|
115
|
-
if (!form) {
|
|
116
|
-
throw new Error(`Missing form instance while getting the control of "${controlName}"`);
|
|
117
|
-
}
|
|
118
|
-
const control = form.get(controlName);
|
|
119
|
-
if (!control) {
|
|
120
|
-
throw new Error(`Missing control "${controlName}" in form "${form}"`);
|
|
121
|
-
}
|
|
122
|
-
return control;
|
|
123
|
-
}
|
|
124
|
-
function getControlValue(controlName, form) {
|
|
125
|
-
const control = getControl(controlName, form);
|
|
126
|
-
if (!control) {
|
|
127
|
-
throw new Error(`Missing control "${controlName}" in form "${form}"`);
|
|
128
|
-
}
|
|
129
|
-
const value = control.getRawValue();
|
|
130
|
-
if (value === '') {
|
|
131
|
-
return null;
|
|
132
|
-
}
|
|
133
|
-
if (typeof value === 'string') {
|
|
134
|
-
const cleaned = value.replace(/,/g, '');
|
|
135
|
-
if (!Number.isNaN(Number(cleaned))) {
|
|
136
|
-
return parseNumber(value);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return value;
|
|
140
|
-
}
|
|
141
115
|
function parseNumber(input) {
|
|
142
116
|
if (input == null || input === '')
|
|
143
117
|
return null;
|
|
@@ -171,6 +145,34 @@ function formatNumber(value, locale = 'en-US', options = { maximumFractionDigits
|
|
|
171
145
|
return isNegative ? `-${formatted}` : formatted;
|
|
172
146
|
}
|
|
173
147
|
|
|
148
|
+
function getControl(controlName, form) {
|
|
149
|
+
if (!form) {
|
|
150
|
+
throw new Error(`Missing form instance while getting the control of "${controlName}"`);
|
|
151
|
+
}
|
|
152
|
+
const control = form.get(controlName);
|
|
153
|
+
if (!control) {
|
|
154
|
+
throw new Error(`Missing control "${controlName}" in form "${form}"`);
|
|
155
|
+
}
|
|
156
|
+
return control;
|
|
157
|
+
}
|
|
158
|
+
function getControlValue(controlName, form) {
|
|
159
|
+
const control = getControl(controlName, form);
|
|
160
|
+
if (!control) {
|
|
161
|
+
throw new Error(`Missing control "${controlName}" in form "${form}"`);
|
|
162
|
+
}
|
|
163
|
+
const value = control.getRawValue();
|
|
164
|
+
if (value === '') {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
if (typeof value === 'string') {
|
|
168
|
+
const cleaned = value.replace(/,/g, '');
|
|
169
|
+
if (!Number.isNaN(Number(cleaned))) {
|
|
170
|
+
return parseNumber(value);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return value;
|
|
174
|
+
}
|
|
175
|
+
|
|
174
176
|
class FormHandlerBase {
|
|
175
177
|
registeredControls = {};
|
|
176
178
|
/**
|
|
@@ -259,6 +261,71 @@ class TextBehavior {
|
|
|
259
261
|
}
|
|
260
262
|
}
|
|
261
263
|
|
|
264
|
+
class FormFieldComponent {
|
|
265
|
+
label = input();
|
|
266
|
+
isRequired = input();
|
|
267
|
+
loading = input();
|
|
268
|
+
errorMessage = input();
|
|
269
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: FormFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
270
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: FormFieldComponent, isStandalone: true, selector: "nmf-form-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, isRequired: { classPropertyName: "isRequired", publicName: "isRequired", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
271
|
+
<div class="nmf-field" [class.loading]="loading()">
|
|
272
|
+
@if (label()) {
|
|
273
|
+
<label class="nmf-label">
|
|
274
|
+
{{ label() }}
|
|
275
|
+
@if (isRequired()) {
|
|
276
|
+
<span class="nmf-required">*</span>
|
|
277
|
+
}
|
|
278
|
+
</label>
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
<ng-content></ng-content>
|
|
282
|
+
|
|
283
|
+
@if (loading()) {
|
|
284
|
+
<div class="nmf-loading">
|
|
285
|
+
<span class="nmf-spinner"></span>
|
|
286
|
+
</div>
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
<p class="nmf-error">
|
|
290
|
+
{{ errorMessage() }}
|
|
291
|
+
</p>
|
|
292
|
+
</div>
|
|
293
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
294
|
+
}
|
|
295
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: FormFieldComponent, decorators: [{
|
|
296
|
+
type: Component,
|
|
297
|
+
args: [{
|
|
298
|
+
selector: 'nmf-form-field',
|
|
299
|
+
standalone: true,
|
|
300
|
+
imports: [CommonModule, ReactiveFormsModule],
|
|
301
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
302
|
+
template: `
|
|
303
|
+
<div class="nmf-field" [class.loading]="loading()">
|
|
304
|
+
@if (label()) {
|
|
305
|
+
<label class="nmf-label">
|
|
306
|
+
{{ label() }}
|
|
307
|
+
@if (isRequired()) {
|
|
308
|
+
<span class="nmf-required">*</span>
|
|
309
|
+
}
|
|
310
|
+
</label>
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
<ng-content></ng-content>
|
|
314
|
+
|
|
315
|
+
@if (loading()) {
|
|
316
|
+
<div class="nmf-loading">
|
|
317
|
+
<span class="nmf-spinner"></span>
|
|
318
|
+
</div>
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
<p class="nmf-error">
|
|
322
|
+
{{ errorMessage() }}
|
|
323
|
+
</p>
|
|
324
|
+
</div>
|
|
325
|
+
`,
|
|
326
|
+
}]
|
|
327
|
+
}] });
|
|
328
|
+
|
|
262
329
|
class InputCurrencyComponent extends FormControlBase {
|
|
263
330
|
displayValue = signal(null);
|
|
264
331
|
behavior = new CurrencyBehavior();
|
|
@@ -288,16 +355,12 @@ class InputCurrencyComponent extends FormControlBase {
|
|
|
288
355
|
});
|
|
289
356
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputCurrencyComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
290
357
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: InputCurrencyComponent, isStandalone: true, selector: "nmf-currency", usesInheritance: true, ngImport: i0, template: `
|
|
291
|
-
<
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
}
|
|
298
|
-
</label>
|
|
299
|
-
}
|
|
300
|
-
|
|
358
|
+
<nmf-form-field
|
|
359
|
+
[label]="label()"
|
|
360
|
+
[isRequired]="isRequired()"
|
|
361
|
+
[loading]="loading()"
|
|
362
|
+
[errorMessage]="errorMessage()"
|
|
363
|
+
>
|
|
301
364
|
<div class="nmf-input-wrapper nmf-input-prefix">
|
|
302
365
|
@if (displayValue() != null) {
|
|
303
366
|
<span
|
|
@@ -330,39 +393,23 @@ class InputCurrencyComponent extends FormControlBase {
|
|
|
330
393
|
(keydown)="handleKeyDown($event)"
|
|
331
394
|
/>
|
|
332
395
|
</div>
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
@if (loading()) {
|
|
337
|
-
<div class="nmf-loading">
|
|
338
|
-
<span class="nmf-spinner"></span>
|
|
339
|
-
</div>
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
<p class="nmf-error">
|
|
343
|
-
{{ errorMessage() }}
|
|
344
|
-
</p>
|
|
345
|
-
</div>
|
|
346
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
396
|
+
</nmf-form-field>
|
|
397
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: FormFieldComponent, selector: "nmf-form-field", inputs: ["label", "isRequired", "loading", "errorMessage"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
347
398
|
}
|
|
348
399
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputCurrencyComponent, decorators: [{
|
|
349
400
|
type: Component,
|
|
350
401
|
args: [{
|
|
351
402
|
selector: 'nmf-currency',
|
|
352
403
|
standalone: true,
|
|
353
|
-
imports: [CommonModule, ReactiveFormsModule],
|
|
404
|
+
imports: [CommonModule, ReactiveFormsModule, FormFieldComponent],
|
|
354
405
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
355
406
|
template: `
|
|
356
|
-
<
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
}
|
|
363
|
-
</label>
|
|
364
|
-
}
|
|
365
|
-
|
|
407
|
+
<nmf-form-field
|
|
408
|
+
[label]="label()"
|
|
409
|
+
[isRequired]="isRequired()"
|
|
410
|
+
[loading]="loading()"
|
|
411
|
+
[errorMessage]="errorMessage()"
|
|
412
|
+
>
|
|
366
413
|
<div class="nmf-input-wrapper nmf-input-prefix">
|
|
367
414
|
@if (displayValue() != null) {
|
|
368
415
|
<span
|
|
@@ -395,19 +442,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
395
442
|
(keydown)="handleKeyDown($event)"
|
|
396
443
|
/>
|
|
397
444
|
</div>
|
|
398
|
-
|
|
399
|
-
<ng-content></ng-content>
|
|
400
|
-
|
|
401
|
-
@if (loading()) {
|
|
402
|
-
<div class="nmf-loading">
|
|
403
|
-
<span class="nmf-spinner"></span>
|
|
404
|
-
</div>
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
<p class="nmf-error">
|
|
408
|
-
{{ errorMessage() }}
|
|
409
|
-
</p>
|
|
410
|
-
</div>
|
|
445
|
+
</nmf-form-field>
|
|
411
446
|
`,
|
|
412
447
|
}]
|
|
413
448
|
}] });
|
|
@@ -444,17 +479,13 @@ class InputDatepickerComponent extends FormControlBase {
|
|
|
444
479
|
this.onChange(parsed);
|
|
445
480
|
}
|
|
446
481
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputDatepickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
447
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
448
|
-
<
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
}
|
|
455
|
-
</label>
|
|
456
|
-
}
|
|
457
|
-
|
|
482
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.21", type: InputDatepickerComponent, isStandalone: true, selector: "nmf-datepicker", inputs: { minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: `
|
|
483
|
+
<nmf-form-field
|
|
484
|
+
[label]="label()"
|
|
485
|
+
[isRequired]="isRequired()"
|
|
486
|
+
[loading]="loading()"
|
|
487
|
+
[errorMessage]="errorMessage()"
|
|
488
|
+
>
|
|
458
489
|
<input
|
|
459
490
|
type="date"
|
|
460
491
|
class="nmf-input"
|
|
@@ -472,39 +503,23 @@ class InputDatepickerComponent extends FormControlBase {
|
|
|
472
503
|
(blur)="onTouched()"
|
|
473
504
|
(input)="onInput($event)"
|
|
474
505
|
/>
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
@if (loading()) {
|
|
479
|
-
<div class="nmf-loading">
|
|
480
|
-
<span class="nmf-spinner"></span>
|
|
481
|
-
</div>
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
<p class="nmf-error">
|
|
485
|
-
{{ errorMessage() }}
|
|
486
|
-
</p>
|
|
487
|
-
</div>
|
|
488
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
506
|
+
</nmf-form-field>
|
|
507
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: FormFieldComponent, selector: "nmf-form-field", inputs: ["label", "isRequired", "loading", "errorMessage"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
489
508
|
}
|
|
490
509
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputDatepickerComponent, decorators: [{
|
|
491
510
|
type: Component,
|
|
492
511
|
args: [{
|
|
493
512
|
selector: 'nmf-datepicker',
|
|
494
513
|
standalone: true,
|
|
495
|
-
imports: [CommonModule, ReactiveFormsModule],
|
|
514
|
+
imports: [CommonModule, ReactiveFormsModule, FormFieldComponent],
|
|
496
515
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
497
516
|
template: `
|
|
498
|
-
<
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
}
|
|
505
|
-
</label>
|
|
506
|
-
}
|
|
507
|
-
|
|
517
|
+
<nmf-form-field
|
|
518
|
+
[label]="label()"
|
|
519
|
+
[isRequired]="isRequired()"
|
|
520
|
+
[loading]="loading()"
|
|
521
|
+
[errorMessage]="errorMessage()"
|
|
522
|
+
>
|
|
508
523
|
<input
|
|
509
524
|
type="date"
|
|
510
525
|
class="nmf-input"
|
|
@@ -522,25 +537,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
522
537
|
(blur)="onTouched()"
|
|
523
538
|
(input)="onInput($event)"
|
|
524
539
|
/>
|
|
525
|
-
|
|
526
|
-
<ng-content></ng-content>
|
|
527
|
-
|
|
528
|
-
@if (loading()) {
|
|
529
|
-
<div class="nmf-loading">
|
|
530
|
-
<span class="nmf-spinner"></span>
|
|
531
|
-
</div>
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
<p class="nmf-error">
|
|
535
|
-
{{ errorMessage() }}
|
|
536
|
-
</p>
|
|
537
|
-
</div>
|
|
540
|
+
</nmf-form-field>
|
|
538
541
|
`,
|
|
539
542
|
}]
|
|
540
543
|
}] });
|
|
541
544
|
|
|
542
545
|
class InputNumberComponent extends FormControlBase {
|
|
543
|
-
|
|
546
|
+
formatValue = input(false);
|
|
544
547
|
displayValue = signal('');
|
|
545
548
|
behavior = new TextBehavior();
|
|
546
549
|
currencyBehavior = new CurrencyBehavior();
|
|
@@ -560,7 +563,7 @@ class InputNumberComponent extends FormControlBase {
|
|
|
560
563
|
this.onChange(parsed);
|
|
561
564
|
}
|
|
562
565
|
updateDisplayValue(value) {
|
|
563
|
-
if (this.
|
|
566
|
+
if (this.formatValue() && value != null) {
|
|
564
567
|
this.displayValue.set(formatNumber(value) ?? '');
|
|
565
568
|
}
|
|
566
569
|
else {
|
|
@@ -568,17 +571,13 @@ class InputNumberComponent extends FormControlBase {
|
|
|
568
571
|
}
|
|
569
572
|
}
|
|
570
573
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputNumberComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
571
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
572
|
-
<
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
}
|
|
579
|
-
</label>
|
|
580
|
-
}
|
|
581
|
-
|
|
574
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.21", type: InputNumberComponent, isStandalone: true, selector: "nmf-number", inputs: { formatValue: { classPropertyName: "formatValue", publicName: "formatValue", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: `
|
|
575
|
+
<nmf-form-field
|
|
576
|
+
[label]="label()"
|
|
577
|
+
[isRequired]="isRequired()"
|
|
578
|
+
[loading]="loading()"
|
|
579
|
+
[errorMessage]="errorMessage()"
|
|
580
|
+
>
|
|
582
581
|
<input
|
|
583
582
|
autocomplete="off"
|
|
584
583
|
class="nmf-input"
|
|
@@ -587,7 +586,7 @@ class InputNumberComponent extends FormControlBase {
|
|
|
587
586
|
[class.disabled]="disabled()"
|
|
588
587
|
[id]="id()"
|
|
589
588
|
[name]="name()"
|
|
590
|
-
[type]="
|
|
589
|
+
[type]="formatValue() ? 'text' : 'number'"
|
|
591
590
|
[value]="displayValue()"
|
|
592
591
|
[disabled]="disabled()"
|
|
593
592
|
[required]="isRequired()"
|
|
@@ -596,39 +595,23 @@ class InputNumberComponent extends FormControlBase {
|
|
|
596
595
|
(input)="onInput($event)"
|
|
597
596
|
(keydown)="handleKeyDown($event)"
|
|
598
597
|
/>
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
<p class="nmf-error">
|
|
603
|
-
{{ errorMessage() }}
|
|
604
|
-
</p>
|
|
605
|
-
|
|
606
|
-
@if (loading()) {
|
|
607
|
-
<div class="nmf-loading">
|
|
608
|
-
<span class="nmf-spinner"></span>
|
|
609
|
-
</div>
|
|
610
|
-
}
|
|
611
|
-
</div>
|
|
612
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
598
|
+
</nmf-form-field>
|
|
599
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: FormFieldComponent, selector: "nmf-form-field", inputs: ["label", "isRequired", "loading", "errorMessage"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
613
600
|
}
|
|
614
601
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputNumberComponent, decorators: [{
|
|
615
602
|
type: Component,
|
|
616
603
|
args: [{
|
|
617
604
|
selector: 'nmf-number',
|
|
618
605
|
standalone: true,
|
|
619
|
-
imports: [CommonModule, ReactiveFormsModule],
|
|
606
|
+
imports: [CommonModule, ReactiveFormsModule, FormFieldComponent],
|
|
620
607
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
621
608
|
template: `
|
|
622
|
-
<
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
}
|
|
629
|
-
</label>
|
|
630
|
-
}
|
|
631
|
-
|
|
609
|
+
<nmf-form-field
|
|
610
|
+
[label]="label()"
|
|
611
|
+
[isRequired]="isRequired()"
|
|
612
|
+
[loading]="loading()"
|
|
613
|
+
[errorMessage]="errorMessage()"
|
|
614
|
+
>
|
|
632
615
|
<input
|
|
633
616
|
autocomplete="off"
|
|
634
617
|
class="nmf-input"
|
|
@@ -637,7 +620,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
637
620
|
[class.disabled]="disabled()"
|
|
638
621
|
[id]="id()"
|
|
639
622
|
[name]="name()"
|
|
640
|
-
[type]="
|
|
623
|
+
[type]="formatValue() ? 'text' : 'number'"
|
|
641
624
|
[value]="displayValue()"
|
|
642
625
|
[disabled]="disabled()"
|
|
643
626
|
[required]="isRequired()"
|
|
@@ -646,19 +629,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
646
629
|
(input)="onInput($event)"
|
|
647
630
|
(keydown)="handleKeyDown($event)"
|
|
648
631
|
/>
|
|
649
|
-
|
|
650
|
-
<ng-content></ng-content>
|
|
651
|
-
|
|
652
|
-
<p class="nmf-error">
|
|
653
|
-
{{ errorMessage() }}
|
|
654
|
-
</p>
|
|
655
|
-
|
|
656
|
-
@if (loading()) {
|
|
657
|
-
<div class="nmf-loading">
|
|
658
|
-
<span class="nmf-spinner"></span>
|
|
659
|
-
</div>
|
|
660
|
-
}
|
|
661
|
-
</div>
|
|
632
|
+
</nmf-form-field>
|
|
662
633
|
`,
|
|
663
634
|
}]
|
|
664
635
|
}] });
|
|
@@ -669,15 +640,12 @@ class InputSelectComponent extends FormControlBase {
|
|
|
669
640
|
clearOptionLabel = input('Clear selection');
|
|
670
641
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputSelectComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
671
642
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: InputSelectComponent, isStandalone: true, selector: "nmf-select", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, emptyOptionLabel: { classPropertyName: "emptyOptionLabel", publicName: "emptyOptionLabel", isSignal: true, isRequired: false, transformFunction: null }, clearOptionLabel: { classPropertyName: "clearOptionLabel", publicName: "clearOptionLabel", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: `
|
|
672
|
-
<
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
}
|
|
679
|
-
</label>
|
|
680
|
-
}
|
|
643
|
+
<nmf-form-field
|
|
644
|
+
[label]="label()"
|
|
645
|
+
[isRequired]="isRequired()"
|
|
646
|
+
[loading]="loading()"
|
|
647
|
+
[errorMessage]="errorMessage()"
|
|
648
|
+
>
|
|
681
649
|
<div class="select-wrapper" [class.disabled]="disabled()">
|
|
682
650
|
<select
|
|
683
651
|
class="nmf-input"
|
|
@@ -708,36 +676,23 @@ class InputSelectComponent extends FormControlBase {
|
|
|
708
676
|
}
|
|
709
677
|
</select>
|
|
710
678
|
</div>
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
<div class="nmf-loading">
|
|
714
|
-
<span class="nmf-spinner"></span>
|
|
715
|
-
</div>
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
<p class="nmf-error">
|
|
719
|
-
{{ errorMessage() }}
|
|
720
|
-
</p>
|
|
721
|
-
</div>
|
|
722
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
679
|
+
</nmf-form-field>
|
|
680
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: FormFieldComponent, selector: "nmf-form-field", inputs: ["label", "isRequired", "loading", "errorMessage"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
723
681
|
}
|
|
724
682
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputSelectComponent, decorators: [{
|
|
725
683
|
type: Component,
|
|
726
684
|
args: [{
|
|
727
685
|
selector: 'nmf-select',
|
|
728
686
|
standalone: true,
|
|
729
|
-
imports: [CommonModule, ReactiveFormsModule],
|
|
687
|
+
imports: [CommonModule, ReactiveFormsModule, FormFieldComponent],
|
|
730
688
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
731
689
|
template: `
|
|
732
|
-
<
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
}
|
|
739
|
-
</label>
|
|
740
|
-
}
|
|
690
|
+
<nmf-form-field
|
|
691
|
+
[label]="label()"
|
|
692
|
+
[isRequired]="isRequired()"
|
|
693
|
+
[loading]="loading()"
|
|
694
|
+
[errorMessage]="errorMessage()"
|
|
695
|
+
>
|
|
741
696
|
<div class="select-wrapper" [class.disabled]="disabled()">
|
|
742
697
|
<select
|
|
743
698
|
class="nmf-input"
|
|
@@ -768,17 +723,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
768
723
|
}
|
|
769
724
|
</select>
|
|
770
725
|
</div>
|
|
771
|
-
|
|
772
|
-
@if (loading()) {
|
|
773
|
-
<div class="nmf-loading">
|
|
774
|
-
<span class="nmf-spinner"></span>
|
|
775
|
-
</div>
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
<p class="nmf-error">
|
|
779
|
-
{{ errorMessage() }}
|
|
780
|
-
</p>
|
|
781
|
-
</div>
|
|
726
|
+
</nmf-form-field>
|
|
782
727
|
`,
|
|
783
728
|
}]
|
|
784
729
|
}] });
|
|
@@ -791,16 +736,12 @@ class InputTextComponent extends FormControlBase {
|
|
|
791
736
|
: this.type());
|
|
792
737
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputTextComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
793
738
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: InputTextComponent, isStandalone: true, selector: "nmf-text", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: `
|
|
794
|
-
<
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
}
|
|
801
|
-
</label>
|
|
802
|
-
}
|
|
803
|
-
|
|
739
|
+
<nmf-form-field
|
|
740
|
+
[label]="label()"
|
|
741
|
+
[isRequired]="isRequired()"
|
|
742
|
+
[loading]="loading()"
|
|
743
|
+
[errorMessage]="errorMessage()"
|
|
744
|
+
>
|
|
804
745
|
<div class="nmf-input-wrapper">
|
|
805
746
|
<input
|
|
806
747
|
class="nmf-input"
|
|
@@ -831,19 +772,7 @@ class InputTextComponent extends FormControlBase {
|
|
|
831
772
|
</button>
|
|
832
773
|
}
|
|
833
774
|
</div>
|
|
834
|
-
|
|
835
|
-
<ng-content></ng-content>
|
|
836
|
-
|
|
837
|
-
<p class="nmf-error">
|
|
838
|
-
{{ errorMessage() }}
|
|
839
|
-
</p>
|
|
840
|
-
|
|
841
|
-
@if (loading()) {
|
|
842
|
-
<div class="nmf-loading">
|
|
843
|
-
<span class="nmf-spinner"></span>
|
|
844
|
-
</div>
|
|
845
|
-
}
|
|
846
|
-
</div>
|
|
775
|
+
</nmf-form-field>
|
|
847
776
|
|
|
848
777
|
<ng-template #eyeIcon>
|
|
849
778
|
<svg
|
|
@@ -879,26 +808,22 @@ class InputTextComponent extends FormControlBase {
|
|
|
879
808
|
/>
|
|
880
809
|
</svg>
|
|
881
810
|
</ng-template>
|
|
882
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { 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.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
811
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { 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.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: FormFieldComponent, selector: "nmf-form-field", inputs: ["label", "isRequired", "loading", "errorMessage"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
883
812
|
}
|
|
884
813
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputTextComponent, decorators: [{
|
|
885
814
|
type: Component,
|
|
886
815
|
args: [{
|
|
887
816
|
selector: 'nmf-text',
|
|
888
817
|
standalone: true,
|
|
889
|
-
imports: [CommonModule, ReactiveFormsModule],
|
|
818
|
+
imports: [CommonModule, ReactiveFormsModule, FormFieldComponent],
|
|
890
819
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
891
820
|
template: `
|
|
892
|
-
<
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
}
|
|
899
|
-
</label>
|
|
900
|
-
}
|
|
901
|
-
|
|
821
|
+
<nmf-form-field
|
|
822
|
+
[label]="label()"
|
|
823
|
+
[isRequired]="isRequired()"
|
|
824
|
+
[loading]="loading()"
|
|
825
|
+
[errorMessage]="errorMessage()"
|
|
826
|
+
>
|
|
902
827
|
<div class="nmf-input-wrapper">
|
|
903
828
|
<input
|
|
904
829
|
class="nmf-input"
|
|
@@ -929,19 +854,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
929
854
|
</button>
|
|
930
855
|
}
|
|
931
856
|
</div>
|
|
932
|
-
|
|
933
|
-
<ng-content></ng-content>
|
|
934
|
-
|
|
935
|
-
<p class="nmf-error">
|
|
936
|
-
{{ errorMessage() }}
|
|
937
|
-
</p>
|
|
938
|
-
|
|
939
|
-
@if (loading()) {
|
|
940
|
-
<div class="nmf-loading">
|
|
941
|
-
<span class="nmf-spinner"></span>
|
|
942
|
-
</div>
|
|
943
|
-
}
|
|
944
|
-
</div>
|
|
857
|
+
</nmf-form-field>
|
|
945
858
|
|
|
946
859
|
<ng-template #eyeIcon>
|
|
947
860
|
<svg
|
|
@@ -985,17 +898,13 @@ class InputTextareaComponent extends FormControlBase {
|
|
|
985
898
|
rows = input(5);
|
|
986
899
|
cols = input(5);
|
|
987
900
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputTextareaComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
988
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
989
|
-
<
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
}
|
|
996
|
-
</label>
|
|
997
|
-
}
|
|
998
|
-
|
|
901
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.21", type: InputTextareaComponent, isStandalone: true, selector: "nmf-textarea", inputs: { rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, cols: { classPropertyName: "cols", publicName: "cols", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: `
|
|
902
|
+
<nmf-form-field
|
|
903
|
+
[label]="label()"
|
|
904
|
+
[isRequired]="isRequired()"
|
|
905
|
+
[loading]="loading()"
|
|
906
|
+
[errorMessage]="errorMessage()"
|
|
907
|
+
>
|
|
999
908
|
<textarea
|
|
1000
909
|
class="nmf-input"
|
|
1001
910
|
[ngClass]="classList()"
|
|
@@ -1009,37 +918,23 @@ class InputTextareaComponent extends FormControlBase {
|
|
|
1009
918
|
[formControl]="formControl"
|
|
1010
919
|
(blur)="onTouched()"
|
|
1011
920
|
></textarea>
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
{{ errorMessage() }}
|
|
1015
|
-
</p>
|
|
1016
|
-
|
|
1017
|
-
@if (loading()) {
|
|
1018
|
-
<div class="nmf-loading">
|
|
1019
|
-
<span class="nmf-spinner"></span>
|
|
1020
|
-
</div>
|
|
1021
|
-
}
|
|
1022
|
-
</div>
|
|
1023
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { 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.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
921
|
+
</nmf-form-field>
|
|
922
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { 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.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: FormFieldComponent, selector: "nmf-form-field", inputs: ["label", "isRequired", "loading", "errorMessage"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1024
923
|
}
|
|
1025
924
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputTextareaComponent, decorators: [{
|
|
1026
925
|
type: Component,
|
|
1027
926
|
args: [{
|
|
1028
927
|
selector: 'nmf-textarea',
|
|
1029
928
|
standalone: true,
|
|
1030
|
-
imports: [CommonModule, ReactiveFormsModule],
|
|
929
|
+
imports: [CommonModule, ReactiveFormsModule, FormFieldComponent],
|
|
1031
930
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1032
931
|
template: `
|
|
1033
|
-
<
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
}
|
|
1040
|
-
</label>
|
|
1041
|
-
}
|
|
1042
|
-
|
|
932
|
+
<nmf-form-field
|
|
933
|
+
[label]="label()"
|
|
934
|
+
[isRequired]="isRequired()"
|
|
935
|
+
[loading]="loading()"
|
|
936
|
+
[errorMessage]="errorMessage()"
|
|
937
|
+
>
|
|
1043
938
|
<textarea
|
|
1044
939
|
class="nmf-input"
|
|
1045
940
|
[ngClass]="classList()"
|
|
@@ -1053,17 +948,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
1053
948
|
[formControl]="formControl"
|
|
1054
949
|
(blur)="onTouched()"
|
|
1055
950
|
></textarea>
|
|
1056
|
-
|
|
1057
|
-
<p class="nmf-error">
|
|
1058
|
-
{{ errorMessage() }}
|
|
1059
|
-
</p>
|
|
1060
|
-
|
|
1061
|
-
@if (loading()) {
|
|
1062
|
-
<div class="nmf-loading">
|
|
1063
|
-
<span class="nmf-spinner"></span>
|
|
1064
|
-
</div>
|
|
1065
|
-
}
|
|
1066
|
-
</div>
|
|
951
|
+
</nmf-form-field>
|
|
1067
952
|
`,
|
|
1068
953
|
}]
|
|
1069
954
|
}] });
|
|
@@ -1101,17 +986,13 @@ class InputTimepickerComponent extends FormControlBase {
|
|
|
1101
986
|
this.onChange(parsed);
|
|
1102
987
|
}
|
|
1103
988
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputTimepickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1104
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
1105
|
-
<
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
}
|
|
1112
|
-
</label>
|
|
1113
|
-
}
|
|
1114
|
-
|
|
989
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.21", type: InputTimepickerComponent, isStandalone: true, selector: "nmf-timepicker", inputs: { step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: `
|
|
990
|
+
<nmf-form-field
|
|
991
|
+
[label]="label()"
|
|
992
|
+
[isRequired]="isRequired()"
|
|
993
|
+
[loading]="loading()"
|
|
994
|
+
[errorMessage]="errorMessage()"
|
|
995
|
+
>
|
|
1115
996
|
<input
|
|
1116
997
|
type="time"
|
|
1117
998
|
autocomplete="off"
|
|
@@ -1129,39 +1010,23 @@ class InputTimepickerComponent extends FormControlBase {
|
|
|
1129
1010
|
(blur)="onTouched()"
|
|
1130
1011
|
(input)="onInput($event)"
|
|
1131
1012
|
/>
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
@if (loading()) {
|
|
1136
|
-
<div class="nmf-loading">
|
|
1137
|
-
<span class="nmf-spinner"></span>
|
|
1138
|
-
</div>
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
<p class="nmf-error">
|
|
1142
|
-
{{ errorMessage() }}
|
|
1143
|
-
</p>
|
|
1144
|
-
</div>
|
|
1145
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1013
|
+
</nmf-form-field>
|
|
1014
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: FormFieldComponent, selector: "nmf-form-field", inputs: ["label", "isRequired", "loading", "errorMessage"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1146
1015
|
}
|
|
1147
1016
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputTimepickerComponent, decorators: [{
|
|
1148
1017
|
type: Component,
|
|
1149
1018
|
args: [{
|
|
1150
1019
|
selector: 'nmf-timepicker',
|
|
1151
1020
|
standalone: true,
|
|
1152
|
-
imports: [CommonModule, ReactiveFormsModule],
|
|
1021
|
+
imports: [CommonModule, ReactiveFormsModule, FormFieldComponent],
|
|
1153
1022
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1154
1023
|
template: `
|
|
1155
|
-
<
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
}
|
|
1162
|
-
</label>
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1024
|
+
<nmf-form-field
|
|
1025
|
+
[label]="label()"
|
|
1026
|
+
[isRequired]="isRequired()"
|
|
1027
|
+
[loading]="loading()"
|
|
1028
|
+
[errorMessage]="errorMessage()"
|
|
1029
|
+
>
|
|
1165
1030
|
<input
|
|
1166
1031
|
type="time"
|
|
1167
1032
|
autocomplete="off"
|
|
@@ -1179,23 +1044,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
1179
1044
|
(blur)="onTouched()"
|
|
1180
1045
|
(input)="onInput($event)"
|
|
1181
1046
|
/>
|
|
1182
|
-
|
|
1183
|
-
<ng-content></ng-content>
|
|
1184
|
-
|
|
1185
|
-
@if (loading()) {
|
|
1186
|
-
<div class="nmf-loading">
|
|
1187
|
-
<span class="nmf-spinner"></span>
|
|
1188
|
-
</div>
|
|
1189
|
-
}
|
|
1190
|
-
|
|
1191
|
-
<p class="nmf-error">
|
|
1192
|
-
{{ errorMessage() }}
|
|
1193
|
-
</p>
|
|
1194
|
-
</div>
|
|
1047
|
+
</nmf-form-field>
|
|
1195
1048
|
`,
|
|
1196
1049
|
}]
|
|
1197
1050
|
}] });
|
|
1198
1051
|
|
|
1052
|
+
function isRecord(value) {
|
|
1053
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1199
1056
|
class FormHydrator {
|
|
1200
1057
|
hydrate(form, model, registry = {}) {
|
|
1201
1058
|
Object.entries(form.controls).forEach(([key, control]) => {
|
|
@@ -1205,10 +1062,13 @@ class FormHydrator {
|
|
|
1205
1062
|
const value = model?.[key];
|
|
1206
1063
|
if (control instanceof FormGroup) {
|
|
1207
1064
|
if (mapFn) {
|
|
1208
|
-
|
|
1065
|
+
const mapped = mapFn(value);
|
|
1066
|
+
if (isRecord(mapped)) {
|
|
1067
|
+
control.patchValue(mapped, { emitEvent: false });
|
|
1068
|
+
}
|
|
1209
1069
|
}
|
|
1210
1070
|
else {
|
|
1211
|
-
this.hydrate(control, value, registry);
|
|
1071
|
+
this.hydrate(control, (value ?? {}), registry);
|
|
1212
1072
|
}
|
|
1213
1073
|
return;
|
|
1214
1074
|
}
|
|
@@ -1305,7 +1165,10 @@ class FormOrchestrator extends FormMapperBase {
|
|
|
1305
1165
|
const mapper = registry[key];
|
|
1306
1166
|
const value = model?.[key];
|
|
1307
1167
|
if (control instanceof FormGroup) {
|
|
1308
|
-
|
|
1168
|
+
const mapped = mapper ? mapper.fromModel(value) : value;
|
|
1169
|
+
if (isRecord(mapped)) {
|
|
1170
|
+
this.hydrator.hydrate(control, mapped);
|
|
1171
|
+
}
|
|
1309
1172
|
}
|
|
1310
1173
|
});
|
|
1311
1174
|
}
|