@ng-modular-forms/core 0.5.0 → 0.6.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/README.md +105 -39
- package/fesm2022/ng-modular-forms-core.mjs +965 -14
- package/fesm2022/ng-modular-forms-core.mjs.map +1 -1
- package/lib/behavior/currency.behavior.d.ts +3 -0
- package/lib/behavior/text.behavior.d.ts +5 -0
- package/lib/input/input-currency.component.d.ts +13 -0
- package/lib/input/input-datepicker.component.d.ts +13 -0
- package/lib/input/input-number.component.d.ts +16 -0
- package/lib/input/input-select.component.d.ts +14 -0
- package/lib/input/input-text.component.d.ts +10 -0
- package/lib/input/input-textarea.component.d.ts +8 -0
- package/lib/input/input-timepicker.component.d.ts +12 -0
- package/lib/types.d.ts +2 -2
- package/package.json +23 -1
- package/public-api.d.ts +9 -0
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as i2 from '@angular/forms';
|
|
2
|
+
import { NgControl, FormControl, Validators, TouchedChangeEvent, ReactiveFormsModule, FormGroup } from '@angular/forms';
|
|
2
3
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, ChangeDetectorRef, DestroyRef, input, booleanAttribute, signal, computed, effect, Directive, Injectable } from '@angular/core';
|
|
4
|
+
import { inject, ChangeDetectorRef, DestroyRef, input, booleanAttribute, signal, computed, effect, Directive, ChangeDetectionStrategy, Component, Injectable } from '@angular/core';
|
|
4
5
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
6
|
import { Subscription, startWith } from 'rxjs';
|
|
7
|
+
import * as i1 from '@angular/common';
|
|
8
|
+
import { CommonModule } from '@angular/common';
|
|
6
9
|
|
|
7
10
|
class FormControlBase {
|
|
8
11
|
cdr = inject(ChangeDetectorRef);
|
|
@@ -224,16 +227,967 @@ class FormMapperBase {
|
|
|
224
227
|
}
|
|
225
228
|
}
|
|
226
229
|
|
|
230
|
+
class CurrencyBehavior {
|
|
231
|
+
blockNonDigitKey(event) {
|
|
232
|
+
const input = event.target;
|
|
233
|
+
const value = input.value;
|
|
234
|
+
if (event.ctrlKey || event.metaKey) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
const allowedKeys = [
|
|
238
|
+
'Backspace',
|
|
239
|
+
'Delete',
|
|
240
|
+
'Tab',
|
|
241
|
+
'Enter',
|
|
242
|
+
'Escape',
|
|
243
|
+
'ArrowLeft',
|
|
244
|
+
'ArrowRight',
|
|
245
|
+
'Home',
|
|
246
|
+
'End',
|
|
247
|
+
];
|
|
248
|
+
if (allowedKeys.includes(event.key)) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
const isDigit = /^[0-9]$/.test(event.key);
|
|
252
|
+
if (isDigit) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if (event.key === '.') {
|
|
256
|
+
if (value.includes('.')) {
|
|
257
|
+
event.preventDefault();
|
|
258
|
+
}
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
if (event.key === ',') {
|
|
262
|
+
event.preventDefault();
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
if (event.key === '-') {
|
|
266
|
+
const hasMinus = value.includes('-');
|
|
267
|
+
const isAtStart = input.selectionStart === 0;
|
|
268
|
+
if (hasMinus || !isAtStart) {
|
|
269
|
+
event.preventDefault();
|
|
270
|
+
}
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
event.preventDefault();
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
class TextBehavior {
|
|
278
|
+
_showPassword = signal(false);
|
|
279
|
+
showPassword = this._showPassword.asReadonly();
|
|
280
|
+
toggleShowPassword(event) {
|
|
281
|
+
event?.stopPropagation();
|
|
282
|
+
this._showPassword.set(!this.showPassword());
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
class InputCurrencyComponent extends FormControlBase {
|
|
287
|
+
displayValue = signal(null);
|
|
288
|
+
behavior = new CurrencyBehavior();
|
|
289
|
+
writeValue(value) {
|
|
290
|
+
super.writeValue(value);
|
|
291
|
+
this.displayValue.set(value != null ? formatNumber(value) : null);
|
|
292
|
+
}
|
|
293
|
+
handleKeyDown(event) {
|
|
294
|
+
this.behavior.blockNonDigitKey(event);
|
|
295
|
+
}
|
|
296
|
+
onInput(event) {
|
|
297
|
+
if (this._disabledByInput())
|
|
298
|
+
return;
|
|
299
|
+
const rawValue = event.target.value ?? null;
|
|
300
|
+
const value = parseNumber(rawValue);
|
|
301
|
+
this.displayValue.set(value != null ? formatNumber(value) : null);
|
|
302
|
+
this.onChange(value);
|
|
303
|
+
}
|
|
304
|
+
textColor = computed(() => {
|
|
305
|
+
const value = this.displayValue();
|
|
306
|
+
if (this._disabledByInput() || !value) {
|
|
307
|
+
return 'inherit';
|
|
308
|
+
}
|
|
309
|
+
const parsedValue = parseNumber(value);
|
|
310
|
+
const valid = parsedValue != null && parsedValue >= 0;
|
|
311
|
+
return valid ? 'inherit' : '#dc6262';
|
|
312
|
+
});
|
|
313
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputCurrencyComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
314
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: InputCurrencyComponent, isStandalone: true, selector: "nmf-currency", usesInheritance: true, ngImport: i0, template: `
|
|
315
|
+
<div class="nmf-field">
|
|
316
|
+
@if (label()) {
|
|
317
|
+
<label class="nmf-label">
|
|
318
|
+
{{ label() }}
|
|
319
|
+
@if (isRequired()) {
|
|
320
|
+
<span class="nmf-required">*</span>
|
|
321
|
+
}
|
|
322
|
+
</label>
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
<div class="nmf-input-wrapper nmf-input-prefix">
|
|
326
|
+
@if (displayValue() != null) {
|
|
327
|
+
<span
|
|
328
|
+
class="nmf-prefix"
|
|
329
|
+
[class.error]="hasErrors()"
|
|
330
|
+
[class.nmf-prefix-disabled]="disabled()"
|
|
331
|
+
[style.color]="textColor()"
|
|
332
|
+
>
|
|
333
|
+
$
|
|
334
|
+
</span>
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
<input
|
|
338
|
+
type="text"
|
|
339
|
+
autocomplete="off"
|
|
340
|
+
class="nmf-input"
|
|
341
|
+
[ngClass]="classList()"
|
|
342
|
+
[class.error]="hasErrors()"
|
|
343
|
+
[class.disabled]="disabled()"
|
|
344
|
+
[class.nmf-input-with-prefix]="displayValue() != null"
|
|
345
|
+
[style.color]="textColor()"
|
|
346
|
+
[id]="id()"
|
|
347
|
+
[name]="name()"
|
|
348
|
+
[value]="displayValue()"
|
|
349
|
+
[disabled]="disabled()"
|
|
350
|
+
[required]="isRequired()"
|
|
351
|
+
[placeholder]="placeholder()"
|
|
352
|
+
(blur)="onTouched()"
|
|
353
|
+
(input)="onInput($event)"
|
|
354
|
+
(keydown)="handleKeyDown($event)"
|
|
355
|
+
/>
|
|
356
|
+
</div>
|
|
357
|
+
|
|
358
|
+
<ng-content></ng-content>
|
|
359
|
+
|
|
360
|
+
@if (loading()) {
|
|
361
|
+
<div class="nmf-loading">
|
|
362
|
+
<span class="nmf-spinner"></span>
|
|
363
|
+
</div>
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
<p class="nmf-error">
|
|
367
|
+
{{ errorMessage() }}
|
|
368
|
+
</p>
|
|
369
|
+
</div>
|
|
370
|
+
`, isInline: true, styles: [".nmf-field{position:relative;display:block;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif}.nmf-label{display:block;font-weight:500;font-size:.875rem;margin-bottom:.25rem}.nmf-required{color:#dc2626;font-size:.8rem}.nmf-input-wrapper{position:relative;display:flex;align-items:center}.nmf-input{width:100%;box-sizing:border-box;padding:.5rem .75rem;font-size:.875rem;line-height:1.25rem;border:1px solid #d1d5db;border-radius:.275rem;background-color:#f4f3f2;color:#111827;outline:none;transition:border-color .15s ease,box-shadow .15s ease}.nmf-field.loading select{background-image:none!important}.nmf-field.loading input[type=date]::-webkit-calendar-picker-indicator,.nmf-field.loading input[type=time]::-webkit-calendar-picker-indicator{opacity:0;pointer-events:none}select.nmf-input{appearance:none!important;-webkit-appearance:none!important;-moz-appearance:none!important;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAUCAMAAACtdX32AAAAdVBMVEUAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhMdQaAAAAJ3RSTlMAAAECAwQGBwsOFBwkJTg5RUZ4eYCHkJefpaytrsXGy8zW3+Do8vNn0bsyAAAAYElEQVR42tXROwJDQAAA0Ymw1p9kiT+L5P5HVEi3qJn2lcPjtIuzUIJ/rhIGy762N3XaThqMN1ZPALsZPEzG1x8LrFL77DHBnEMxBewz0fJ6LyFHTPL7xhwzWYrJ9z22AqmQBV757MHfAAAAAElFTkSuQmCC);background-position:100% center;background-repeat:no-repeat}.nmf-input:focus{border-color:#10b981;box-shadow:0 0 0 2px #10b98133}select.nmf-input:disabled{background-image:none}.nmf-input:disabled{opacity:.6;background-color:#f3f4f6;cursor:not-allowed}.nmf-input.error{border-color:#dc2626}.nmf-input.error:focus{box-shadow:0 0 0 2px #dc262633}.nmf-prefix{position:absolute;left:.75rem;top:50%;transform:translateY(-50%);line-height:1;font-size:.875rem;pointer-events:none}.nmf-prefix.error{color:#dc2626}.nmf-prefix-disabled{opacity:.6}.nmf-input-with-prefix{padding-left:1.25rem}.nmf-icon{width:20px;height:20px;fill:currentColor}.nmf-password-toggle{position:absolute;right:.75rem;background:none;border:none;padding:0;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:.875rem;line-height:1}.nmf-password-toggle:disabled{cursor:not-allowed}.nmf-error{font-size:.75rem;color:#dc2626;height:16px;margin-top:.25rem;margin-bottom:0;min-height:16px}.nmf-loading{position:absolute;width:1rem;height:1rem;top:50%;transform:translateY(-50%);right:.75rem}.nmf-spinner{display:inline-block;width:1rem;height:1rem;border:2px solid #d1d5db;border-top-color:#10b981;border-radius:50%;animation:nmf-spin .8s linear infinite}@keyframes nmf-spin{to{transform:rotate(360deg)}}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{appearance:textfield;-moz-appearance:textfield}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
371
|
+
}
|
|
372
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputCurrencyComponent, decorators: [{
|
|
373
|
+
type: Component,
|
|
374
|
+
args: [{ selector: 'nmf-currency', standalone: true, imports: [CommonModule, ReactiveFormsModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
375
|
+
<div class="nmf-field">
|
|
376
|
+
@if (label()) {
|
|
377
|
+
<label class="nmf-label">
|
|
378
|
+
{{ label() }}
|
|
379
|
+
@if (isRequired()) {
|
|
380
|
+
<span class="nmf-required">*</span>
|
|
381
|
+
}
|
|
382
|
+
</label>
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
<div class="nmf-input-wrapper nmf-input-prefix">
|
|
386
|
+
@if (displayValue() != null) {
|
|
387
|
+
<span
|
|
388
|
+
class="nmf-prefix"
|
|
389
|
+
[class.error]="hasErrors()"
|
|
390
|
+
[class.nmf-prefix-disabled]="disabled()"
|
|
391
|
+
[style.color]="textColor()"
|
|
392
|
+
>
|
|
393
|
+
$
|
|
394
|
+
</span>
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
<input
|
|
398
|
+
type="text"
|
|
399
|
+
autocomplete="off"
|
|
400
|
+
class="nmf-input"
|
|
401
|
+
[ngClass]="classList()"
|
|
402
|
+
[class.error]="hasErrors()"
|
|
403
|
+
[class.disabled]="disabled()"
|
|
404
|
+
[class.nmf-input-with-prefix]="displayValue() != null"
|
|
405
|
+
[style.color]="textColor()"
|
|
406
|
+
[id]="id()"
|
|
407
|
+
[name]="name()"
|
|
408
|
+
[value]="displayValue()"
|
|
409
|
+
[disabled]="disabled()"
|
|
410
|
+
[required]="isRequired()"
|
|
411
|
+
[placeholder]="placeholder()"
|
|
412
|
+
(blur)="onTouched()"
|
|
413
|
+
(input)="onInput($event)"
|
|
414
|
+
(keydown)="handleKeyDown($event)"
|
|
415
|
+
/>
|
|
416
|
+
</div>
|
|
417
|
+
|
|
418
|
+
<ng-content></ng-content>
|
|
419
|
+
|
|
420
|
+
@if (loading()) {
|
|
421
|
+
<div class="nmf-loading">
|
|
422
|
+
<span class="nmf-spinner"></span>
|
|
423
|
+
</div>
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
<p class="nmf-error">
|
|
427
|
+
{{ errorMessage() }}
|
|
428
|
+
</p>
|
|
429
|
+
</div>
|
|
430
|
+
`, styles: [".nmf-field{position:relative;display:block;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif}.nmf-label{display:block;font-weight:500;font-size:.875rem;margin-bottom:.25rem}.nmf-required{color:#dc2626;font-size:.8rem}.nmf-input-wrapper{position:relative;display:flex;align-items:center}.nmf-input{width:100%;box-sizing:border-box;padding:.5rem .75rem;font-size:.875rem;line-height:1.25rem;border:1px solid #d1d5db;border-radius:.275rem;background-color:#f4f3f2;color:#111827;outline:none;transition:border-color .15s ease,box-shadow .15s ease}.nmf-field.loading select{background-image:none!important}.nmf-field.loading input[type=date]::-webkit-calendar-picker-indicator,.nmf-field.loading input[type=time]::-webkit-calendar-picker-indicator{opacity:0;pointer-events:none}select.nmf-input{appearance:none!important;-webkit-appearance:none!important;-moz-appearance:none!important;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAUCAMAAACtdX32AAAAdVBMVEUAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhMdQaAAAAJ3RSTlMAAAECAwQGBwsOFBwkJTg5RUZ4eYCHkJefpaytrsXGy8zW3+Do8vNn0bsyAAAAYElEQVR42tXROwJDQAAA0Ymw1p9kiT+L5P5HVEi3qJn2lcPjtIuzUIJ/rhIGy762N3XaThqMN1ZPALsZPEzG1x8LrFL77DHBnEMxBewz0fJ6LyFHTPL7xhwzWYrJ9z22AqmQBV757MHfAAAAAElFTkSuQmCC);background-position:100% center;background-repeat:no-repeat}.nmf-input:focus{border-color:#10b981;box-shadow:0 0 0 2px #10b98133}select.nmf-input:disabled{background-image:none}.nmf-input:disabled{opacity:.6;background-color:#f3f4f6;cursor:not-allowed}.nmf-input.error{border-color:#dc2626}.nmf-input.error:focus{box-shadow:0 0 0 2px #dc262633}.nmf-prefix{position:absolute;left:.75rem;top:50%;transform:translateY(-50%);line-height:1;font-size:.875rem;pointer-events:none}.nmf-prefix.error{color:#dc2626}.nmf-prefix-disabled{opacity:.6}.nmf-input-with-prefix{padding-left:1.25rem}.nmf-icon{width:20px;height:20px;fill:currentColor}.nmf-password-toggle{position:absolute;right:.75rem;background:none;border:none;padding:0;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:.875rem;line-height:1}.nmf-password-toggle:disabled{cursor:not-allowed}.nmf-error{font-size:.75rem;color:#dc2626;height:16px;margin-top:.25rem;margin-bottom:0;min-height:16px}.nmf-loading{position:absolute;width:1rem;height:1rem;top:50%;transform:translateY(-50%);right:.75rem}.nmf-spinner{display:inline-block;width:1rem;height:1rem;border:2px solid #d1d5db;border-top-color:#10b981;border-radius:50%;animation:nmf-spin .8s linear infinite}@keyframes nmf-spin{to{transform:rotate(360deg)}}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{appearance:textfield;-moz-appearance:textfield}\n"] }]
|
|
431
|
+
}] });
|
|
432
|
+
|
|
433
|
+
class InputDatepickerComponent extends FormControlBase {
|
|
434
|
+
minDate = input(null);
|
|
435
|
+
maxDate = input(null);
|
|
436
|
+
displayValue = signal('');
|
|
437
|
+
formatDate(date) {
|
|
438
|
+
if (!date)
|
|
439
|
+
return null;
|
|
440
|
+
// yyyy-MM-dd (required by input[type="date"])
|
|
441
|
+
const yyyy = date.getFullYear();
|
|
442
|
+
const mm = String(date.getMonth() + 1).padStart(2, '0');
|
|
443
|
+
const dd = String(date.getDate()).padStart(2, '0');
|
|
444
|
+
return `${yyyy}-${mm}-${dd}`;
|
|
445
|
+
}
|
|
446
|
+
parseDate(value) {
|
|
447
|
+
if (!value)
|
|
448
|
+
return null;
|
|
449
|
+
const [y, m, d] = value.split('-').map(Number);
|
|
450
|
+
return new Date(y, m - 1, d);
|
|
451
|
+
}
|
|
452
|
+
writeValue(value) {
|
|
453
|
+
super.writeValue(value);
|
|
454
|
+
this.displayValue.set(this.formatDate(value) ?? '');
|
|
455
|
+
}
|
|
456
|
+
onInput(event) {
|
|
457
|
+
if (this._disabledByInput())
|
|
458
|
+
return;
|
|
459
|
+
const input = event.target;
|
|
460
|
+
const parsed = this.parseDate(input.value);
|
|
461
|
+
this.displayValue.set(this.formatDate(parsed) ?? '');
|
|
462
|
+
this.onChange(parsed);
|
|
463
|
+
}
|
|
464
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputDatepickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
465
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.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: `
|
|
466
|
+
<div class="nmf-field" [class.loading]="loading()">
|
|
467
|
+
@if (label()) {
|
|
468
|
+
<label class="nmf-label">
|
|
469
|
+
{{ label() }}
|
|
470
|
+
@if (isRequired()) {
|
|
471
|
+
<span class="nmf-required">*</span>
|
|
472
|
+
}
|
|
473
|
+
</label>
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
<input
|
|
477
|
+
type="date"
|
|
478
|
+
class="nmf-input"
|
|
479
|
+
[ngClass]="classList()"
|
|
480
|
+
[class.error]="hasErrors()"
|
|
481
|
+
[class.disabled]="disabled()"
|
|
482
|
+
[id]="id()"
|
|
483
|
+
[min]="formatDate(minDate())"
|
|
484
|
+
[max]="formatDate(maxDate())"
|
|
485
|
+
[name]="name()"
|
|
486
|
+
[value]="displayValue()"
|
|
487
|
+
[disabled]="disabled()"
|
|
488
|
+
[required]="isRequired()"
|
|
489
|
+
[placeholder]="placeholder()"
|
|
490
|
+
(blur)="onTouched()"
|
|
491
|
+
(input)="onInput($event)"
|
|
492
|
+
/>
|
|
493
|
+
|
|
494
|
+
<ng-content></ng-content>
|
|
495
|
+
|
|
496
|
+
@if (loading()) {
|
|
497
|
+
<div class="nmf-loading">
|
|
498
|
+
<span class="nmf-spinner"></span>
|
|
499
|
+
</div>
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
<p class="nmf-error">
|
|
503
|
+
{{ errorMessage() }}
|
|
504
|
+
</p>
|
|
505
|
+
</div>
|
|
506
|
+
`, isInline: true, styles: [".nmf-field{position:relative;display:block;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif}.nmf-label{display:block;font-weight:500;font-size:.875rem;margin-bottom:.25rem}.nmf-required{color:#dc2626;font-size:.8rem}.nmf-input-wrapper{position:relative;display:flex;align-items:center}.nmf-input{width:100%;box-sizing:border-box;padding:.5rem .75rem;font-size:.875rem;line-height:1.25rem;border:1px solid #d1d5db;border-radius:.275rem;background-color:#f4f3f2;color:#111827;outline:none;transition:border-color .15s ease,box-shadow .15s ease}.nmf-field.loading select{background-image:none!important}.nmf-field.loading input[type=date]::-webkit-calendar-picker-indicator,.nmf-field.loading input[type=time]::-webkit-calendar-picker-indicator{opacity:0;pointer-events:none}select.nmf-input{appearance:none!important;-webkit-appearance:none!important;-moz-appearance:none!important;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAUCAMAAACtdX32AAAAdVBMVEUAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhMdQaAAAAJ3RSTlMAAAECAwQGBwsOFBwkJTg5RUZ4eYCHkJefpaytrsXGy8zW3+Do8vNn0bsyAAAAYElEQVR42tXROwJDQAAA0Ymw1p9kiT+L5P5HVEi3qJn2lcPjtIuzUIJ/rhIGy762N3XaThqMN1ZPALsZPEzG1x8LrFL77DHBnEMxBewz0fJ6LyFHTPL7xhwzWYrJ9z22AqmQBV757MHfAAAAAElFTkSuQmCC);background-position:100% center;background-repeat:no-repeat}.nmf-input:focus{border-color:#10b981;box-shadow:0 0 0 2px #10b98133}select.nmf-input:disabled{background-image:none}.nmf-input:disabled{opacity:.6;background-color:#f3f4f6;cursor:not-allowed}.nmf-input.error{border-color:#dc2626}.nmf-input.error:focus{box-shadow:0 0 0 2px #dc262633}.nmf-prefix{position:absolute;left:.75rem;top:50%;transform:translateY(-50%);line-height:1;font-size:.875rem;pointer-events:none}.nmf-prefix.error{color:#dc2626}.nmf-prefix-disabled{opacity:.6}.nmf-input-with-prefix{padding-left:1.25rem}.nmf-icon{width:20px;height:20px;fill:currentColor}.nmf-password-toggle{position:absolute;right:.75rem;background:none;border:none;padding:0;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:.875rem;line-height:1}.nmf-password-toggle:disabled{cursor:not-allowed}.nmf-error{font-size:.75rem;color:#dc2626;height:16px;margin-top:.25rem;margin-bottom:0;min-height:16px}.nmf-loading{position:absolute;width:1rem;height:1rem;top:50%;transform:translateY(-50%);right:.75rem}.nmf-spinner{display:inline-block;width:1rem;height:1rem;border:2px solid #d1d5db;border-top-color:#10b981;border-radius:50%;animation:nmf-spin .8s linear infinite}@keyframes nmf-spin{to{transform:rotate(360deg)}}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{appearance:textfield;-moz-appearance:textfield}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
507
|
+
}
|
|
508
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputDatepickerComponent, decorators: [{
|
|
509
|
+
type: Component,
|
|
510
|
+
args: [{ selector: 'nmf-datepicker', standalone: true, imports: [CommonModule, ReactiveFormsModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
511
|
+
<div class="nmf-field" [class.loading]="loading()">
|
|
512
|
+
@if (label()) {
|
|
513
|
+
<label class="nmf-label">
|
|
514
|
+
{{ label() }}
|
|
515
|
+
@if (isRequired()) {
|
|
516
|
+
<span class="nmf-required">*</span>
|
|
517
|
+
}
|
|
518
|
+
</label>
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
<input
|
|
522
|
+
type="date"
|
|
523
|
+
class="nmf-input"
|
|
524
|
+
[ngClass]="classList()"
|
|
525
|
+
[class.error]="hasErrors()"
|
|
526
|
+
[class.disabled]="disabled()"
|
|
527
|
+
[id]="id()"
|
|
528
|
+
[min]="formatDate(minDate())"
|
|
529
|
+
[max]="formatDate(maxDate())"
|
|
530
|
+
[name]="name()"
|
|
531
|
+
[value]="displayValue()"
|
|
532
|
+
[disabled]="disabled()"
|
|
533
|
+
[required]="isRequired()"
|
|
534
|
+
[placeholder]="placeholder()"
|
|
535
|
+
(blur)="onTouched()"
|
|
536
|
+
(input)="onInput($event)"
|
|
537
|
+
/>
|
|
538
|
+
|
|
539
|
+
<ng-content></ng-content>
|
|
540
|
+
|
|
541
|
+
@if (loading()) {
|
|
542
|
+
<div class="nmf-loading">
|
|
543
|
+
<span class="nmf-spinner"></span>
|
|
544
|
+
</div>
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
<p class="nmf-error">
|
|
548
|
+
{{ errorMessage() }}
|
|
549
|
+
</p>
|
|
550
|
+
</div>
|
|
551
|
+
`, styles: [".nmf-field{position:relative;display:block;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif}.nmf-label{display:block;font-weight:500;font-size:.875rem;margin-bottom:.25rem}.nmf-required{color:#dc2626;font-size:.8rem}.nmf-input-wrapper{position:relative;display:flex;align-items:center}.nmf-input{width:100%;box-sizing:border-box;padding:.5rem .75rem;font-size:.875rem;line-height:1.25rem;border:1px solid #d1d5db;border-radius:.275rem;background-color:#f4f3f2;color:#111827;outline:none;transition:border-color .15s ease,box-shadow .15s ease}.nmf-field.loading select{background-image:none!important}.nmf-field.loading input[type=date]::-webkit-calendar-picker-indicator,.nmf-field.loading input[type=time]::-webkit-calendar-picker-indicator{opacity:0;pointer-events:none}select.nmf-input{appearance:none!important;-webkit-appearance:none!important;-moz-appearance:none!important;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAUCAMAAACtdX32AAAAdVBMVEUAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhMdQaAAAAJ3RSTlMAAAECAwQGBwsOFBwkJTg5RUZ4eYCHkJefpaytrsXGy8zW3+Do8vNn0bsyAAAAYElEQVR42tXROwJDQAAA0Ymw1p9kiT+L5P5HVEi3qJn2lcPjtIuzUIJ/rhIGy762N3XaThqMN1ZPALsZPEzG1x8LrFL77DHBnEMxBewz0fJ6LyFHTPL7xhwzWYrJ9z22AqmQBV757MHfAAAAAElFTkSuQmCC);background-position:100% center;background-repeat:no-repeat}.nmf-input:focus{border-color:#10b981;box-shadow:0 0 0 2px #10b98133}select.nmf-input:disabled{background-image:none}.nmf-input:disabled{opacity:.6;background-color:#f3f4f6;cursor:not-allowed}.nmf-input.error{border-color:#dc2626}.nmf-input.error:focus{box-shadow:0 0 0 2px #dc262633}.nmf-prefix{position:absolute;left:.75rem;top:50%;transform:translateY(-50%);line-height:1;font-size:.875rem;pointer-events:none}.nmf-prefix.error{color:#dc2626}.nmf-prefix-disabled{opacity:.6}.nmf-input-with-prefix{padding-left:1.25rem}.nmf-icon{width:20px;height:20px;fill:currentColor}.nmf-password-toggle{position:absolute;right:.75rem;background:none;border:none;padding:0;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:.875rem;line-height:1}.nmf-password-toggle:disabled{cursor:not-allowed}.nmf-error{font-size:.75rem;color:#dc2626;height:16px;margin-top:.25rem;margin-bottom:0;min-height:16px}.nmf-loading{position:absolute;width:1rem;height:1rem;top:50%;transform:translateY(-50%);right:.75rem}.nmf-spinner{display:inline-block;width:1rem;height:1rem;border:2px solid #d1d5db;border-top-color:#10b981;border-radius:50%;animation:nmf-spin .8s linear infinite}@keyframes nmf-spin{to{transform:rotate(360deg)}}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{appearance:textfield;-moz-appearance:textfield}\n"] }]
|
|
552
|
+
}] });
|
|
553
|
+
|
|
554
|
+
class InputNumberComponent extends FormControlBase {
|
|
555
|
+
formatNumberValue = input(false);
|
|
556
|
+
displayValue = signal('');
|
|
557
|
+
behavior = new TextBehavior();
|
|
558
|
+
currencyBehavior = new CurrencyBehavior();
|
|
559
|
+
writeValue(value) {
|
|
560
|
+
super.writeValue(value);
|
|
561
|
+
this.updateDisplayValue(value);
|
|
562
|
+
}
|
|
563
|
+
handleKeyDown(event) {
|
|
564
|
+
this.currencyBehavior.blockNonDigitKey(event);
|
|
565
|
+
}
|
|
566
|
+
onInput(event) {
|
|
567
|
+
if (this._disabledByInput())
|
|
568
|
+
return;
|
|
569
|
+
const raw = event.target.value;
|
|
570
|
+
const parsed = parseNumber(raw);
|
|
571
|
+
this.updateDisplayValue(parsed);
|
|
572
|
+
this.onChange(parsed);
|
|
573
|
+
}
|
|
574
|
+
updateDisplayValue(value) {
|
|
575
|
+
if (this.formatNumberValue() && value != null) {
|
|
576
|
+
this.displayValue.set(formatNumber(value) ?? '');
|
|
577
|
+
}
|
|
578
|
+
else {
|
|
579
|
+
this.displayValue.set(value != null ? String(value) : '');
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputNumberComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
583
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: InputNumberComponent, isStandalone: true, selector: "nmf-number", inputs: { formatNumberValue: { classPropertyName: "formatNumberValue", publicName: "formatNumberValue", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: `
|
|
584
|
+
<div class="nmf-field">
|
|
585
|
+
@if (label()) {
|
|
586
|
+
<label class="nmf-label">
|
|
587
|
+
{{ label() }}
|
|
588
|
+
@if (isRequired()) {
|
|
589
|
+
<span class="nmf-required">*</span>
|
|
590
|
+
}
|
|
591
|
+
</label>
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
<input
|
|
595
|
+
autocomplete="off"
|
|
596
|
+
class="nmf-input"
|
|
597
|
+
[ngClass]="classList()"
|
|
598
|
+
[class.error]="hasErrors()"
|
|
599
|
+
[class.disabled]="disabled()"
|
|
600
|
+
[id]="id()"
|
|
601
|
+
[name]="name()"
|
|
602
|
+
[type]="formatNumberValue() ? 'text' : 'number'"
|
|
603
|
+
[value]="displayValue()"
|
|
604
|
+
[disabled]="disabled()"
|
|
605
|
+
[required]="isRequired()"
|
|
606
|
+
[placeholder]="placeholder()"
|
|
607
|
+
(blur)="onTouched()"
|
|
608
|
+
(input)="onInput($event)"
|
|
609
|
+
(keydown)="handleKeyDown($event)"
|
|
610
|
+
/>
|
|
611
|
+
|
|
612
|
+
<ng-content></ng-content>
|
|
613
|
+
|
|
614
|
+
<p class="nmf-error">
|
|
615
|
+
{{ errorMessage() }}
|
|
616
|
+
</p>
|
|
617
|
+
|
|
618
|
+
@if (loading()) {
|
|
619
|
+
<div class="nmf-loading">
|
|
620
|
+
<span class="nmf-spinner"></span>
|
|
621
|
+
</div>
|
|
622
|
+
}
|
|
623
|
+
</div>
|
|
624
|
+
`, isInline: true, styles: [".nmf-field{position:relative;display:block;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif}.nmf-label{display:block;font-weight:500;font-size:.875rem;margin-bottom:.25rem}.nmf-required{color:#dc2626;font-size:.8rem}.nmf-input-wrapper{position:relative;display:flex;align-items:center}.nmf-input{width:100%;box-sizing:border-box;padding:.5rem .75rem;font-size:.875rem;line-height:1.25rem;border:1px solid #d1d5db;border-radius:.275rem;background-color:#f4f3f2;color:#111827;outline:none;transition:border-color .15s ease,box-shadow .15s ease}.nmf-field.loading select{background-image:none!important}.nmf-field.loading input[type=date]::-webkit-calendar-picker-indicator,.nmf-field.loading input[type=time]::-webkit-calendar-picker-indicator{opacity:0;pointer-events:none}select.nmf-input{appearance:none!important;-webkit-appearance:none!important;-moz-appearance:none!important;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAUCAMAAACtdX32AAAAdVBMVEUAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhMdQaAAAAJ3RSTlMAAAECAwQGBwsOFBwkJTg5RUZ4eYCHkJefpaytrsXGy8zW3+Do8vNn0bsyAAAAYElEQVR42tXROwJDQAAA0Ymw1p9kiT+L5P5HVEi3qJn2lcPjtIuzUIJ/rhIGy762N3XaThqMN1ZPALsZPEzG1x8LrFL77DHBnEMxBewz0fJ6LyFHTPL7xhwzWYrJ9z22AqmQBV757MHfAAAAAElFTkSuQmCC);background-position:100% center;background-repeat:no-repeat}.nmf-input:focus{border-color:#10b981;box-shadow:0 0 0 2px #10b98133}select.nmf-input:disabled{background-image:none}.nmf-input:disabled{opacity:.6;background-color:#f3f4f6;cursor:not-allowed}.nmf-input.error{border-color:#dc2626}.nmf-input.error:focus{box-shadow:0 0 0 2px #dc262633}.nmf-prefix{position:absolute;left:.75rem;top:50%;transform:translateY(-50%);line-height:1;font-size:.875rem;pointer-events:none}.nmf-prefix.error{color:#dc2626}.nmf-prefix-disabled{opacity:.6}.nmf-input-with-prefix{padding-left:1.25rem}.nmf-icon{width:20px;height:20px;fill:currentColor}.nmf-password-toggle{position:absolute;right:.75rem;background:none;border:none;padding:0;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:.875rem;line-height:1}.nmf-password-toggle:disabled{cursor:not-allowed}.nmf-error{font-size:.75rem;color:#dc2626;height:16px;margin-top:.25rem;margin-bottom:0;min-height:16px}.nmf-loading{position:absolute;width:1rem;height:1rem;top:50%;transform:translateY(-50%);right:.75rem}.nmf-spinner{display:inline-block;width:1rem;height:1rem;border:2px solid #d1d5db;border-top-color:#10b981;border-radius:50%;animation:nmf-spin .8s linear infinite}@keyframes nmf-spin{to{transform:rotate(360deg)}}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{appearance:textfield;-moz-appearance:textfield}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
625
|
+
}
|
|
626
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputNumberComponent, decorators: [{
|
|
627
|
+
type: Component,
|
|
628
|
+
args: [{ selector: 'nmf-number', standalone: true, imports: [CommonModule, ReactiveFormsModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
629
|
+
<div class="nmf-field">
|
|
630
|
+
@if (label()) {
|
|
631
|
+
<label class="nmf-label">
|
|
632
|
+
{{ label() }}
|
|
633
|
+
@if (isRequired()) {
|
|
634
|
+
<span class="nmf-required">*</span>
|
|
635
|
+
}
|
|
636
|
+
</label>
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
<input
|
|
640
|
+
autocomplete="off"
|
|
641
|
+
class="nmf-input"
|
|
642
|
+
[ngClass]="classList()"
|
|
643
|
+
[class.error]="hasErrors()"
|
|
644
|
+
[class.disabled]="disabled()"
|
|
645
|
+
[id]="id()"
|
|
646
|
+
[name]="name()"
|
|
647
|
+
[type]="formatNumberValue() ? 'text' : 'number'"
|
|
648
|
+
[value]="displayValue()"
|
|
649
|
+
[disabled]="disabled()"
|
|
650
|
+
[required]="isRequired()"
|
|
651
|
+
[placeholder]="placeholder()"
|
|
652
|
+
(blur)="onTouched()"
|
|
653
|
+
(input)="onInput($event)"
|
|
654
|
+
(keydown)="handleKeyDown($event)"
|
|
655
|
+
/>
|
|
656
|
+
|
|
657
|
+
<ng-content></ng-content>
|
|
658
|
+
|
|
659
|
+
<p class="nmf-error">
|
|
660
|
+
{{ errorMessage() }}
|
|
661
|
+
</p>
|
|
662
|
+
|
|
663
|
+
@if (loading()) {
|
|
664
|
+
<div class="nmf-loading">
|
|
665
|
+
<span class="nmf-spinner"></span>
|
|
666
|
+
</div>
|
|
667
|
+
}
|
|
668
|
+
</div>
|
|
669
|
+
`, styles: [".nmf-field{position:relative;display:block;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif}.nmf-label{display:block;font-weight:500;font-size:.875rem;margin-bottom:.25rem}.nmf-required{color:#dc2626;font-size:.8rem}.nmf-input-wrapper{position:relative;display:flex;align-items:center}.nmf-input{width:100%;box-sizing:border-box;padding:.5rem .75rem;font-size:.875rem;line-height:1.25rem;border:1px solid #d1d5db;border-radius:.275rem;background-color:#f4f3f2;color:#111827;outline:none;transition:border-color .15s ease,box-shadow .15s ease}.nmf-field.loading select{background-image:none!important}.nmf-field.loading input[type=date]::-webkit-calendar-picker-indicator,.nmf-field.loading input[type=time]::-webkit-calendar-picker-indicator{opacity:0;pointer-events:none}select.nmf-input{appearance:none!important;-webkit-appearance:none!important;-moz-appearance:none!important;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAUCAMAAACtdX32AAAAdVBMVEUAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhMdQaAAAAJ3RSTlMAAAECAwQGBwsOFBwkJTg5RUZ4eYCHkJefpaytrsXGy8zW3+Do8vNn0bsyAAAAYElEQVR42tXROwJDQAAA0Ymw1p9kiT+L5P5HVEi3qJn2lcPjtIuzUIJ/rhIGy762N3XaThqMN1ZPALsZPEzG1x8LrFL77DHBnEMxBewz0fJ6LyFHTPL7xhwzWYrJ9z22AqmQBV757MHfAAAAAElFTkSuQmCC);background-position:100% center;background-repeat:no-repeat}.nmf-input:focus{border-color:#10b981;box-shadow:0 0 0 2px #10b98133}select.nmf-input:disabled{background-image:none}.nmf-input:disabled{opacity:.6;background-color:#f3f4f6;cursor:not-allowed}.nmf-input.error{border-color:#dc2626}.nmf-input.error:focus{box-shadow:0 0 0 2px #dc262633}.nmf-prefix{position:absolute;left:.75rem;top:50%;transform:translateY(-50%);line-height:1;font-size:.875rem;pointer-events:none}.nmf-prefix.error{color:#dc2626}.nmf-prefix-disabled{opacity:.6}.nmf-input-with-prefix{padding-left:1.25rem}.nmf-icon{width:20px;height:20px;fill:currentColor}.nmf-password-toggle{position:absolute;right:.75rem;background:none;border:none;padding:0;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:.875rem;line-height:1}.nmf-password-toggle:disabled{cursor:not-allowed}.nmf-error{font-size:.75rem;color:#dc2626;height:16px;margin-top:.25rem;margin-bottom:0;min-height:16px}.nmf-loading{position:absolute;width:1rem;height:1rem;top:50%;transform:translateY(-50%);right:.75rem}.nmf-spinner{display:inline-block;width:1rem;height:1rem;border:2px solid #d1d5db;border-top-color:#10b981;border-radius:50%;animation:nmf-spin .8s linear infinite}@keyframes nmf-spin{to{transform:rotate(360deg)}}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{appearance:textfield;-moz-appearance:textfield}\n"] }]
|
|
670
|
+
}] });
|
|
671
|
+
|
|
672
|
+
class InputSelectComponent extends FormControlBase {
|
|
673
|
+
options = input([]);
|
|
674
|
+
emptyOptionLabel = input('Select an option');
|
|
675
|
+
clearOptionLabel = input('Clear selection');
|
|
676
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputSelectComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
677
|
+
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: `
|
|
678
|
+
<div class="nmf-field" [class.loading]="loading()">
|
|
679
|
+
@if (label()) {
|
|
680
|
+
<label class="nmf-label">
|
|
681
|
+
{{ label() }}
|
|
682
|
+
@if (isRequired()) {
|
|
683
|
+
<span class="nmf-required">*</span>
|
|
684
|
+
}
|
|
685
|
+
</label>
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
<select
|
|
689
|
+
class="nmf-input"
|
|
690
|
+
[ngClass]="classList()"
|
|
691
|
+
[class.error]="hasErrors()"
|
|
692
|
+
[class.disabled]="disabled()"
|
|
693
|
+
[required]="isRequired()"
|
|
694
|
+
[formControl]="control"
|
|
695
|
+
(blur)="onTouched()"
|
|
696
|
+
>
|
|
697
|
+
<!-- Empty option -->
|
|
698
|
+
<option [ngValue]="null" disabled>
|
|
699
|
+
{{ emptyOptionLabel() }}
|
|
700
|
+
</option>
|
|
701
|
+
|
|
702
|
+
<!-- Options -->
|
|
703
|
+
@for (option of options(); track option.key) {
|
|
704
|
+
<option [ngValue]="option.key" [disabled]="option.disabled">
|
|
705
|
+
{{ option.label }}
|
|
706
|
+
</option>
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
<!-- Clear option -->
|
|
710
|
+
@if (clearOptionLabel()) {
|
|
711
|
+
<option [ngValue]="null">
|
|
712
|
+
{{ clearOptionLabel() }}
|
|
713
|
+
</option>
|
|
714
|
+
}
|
|
715
|
+
</select>
|
|
716
|
+
|
|
717
|
+
@if (loading()) {
|
|
718
|
+
<div class="nmf-loading">
|
|
719
|
+
<span class="nmf-spinner"></span>
|
|
720
|
+
</div>
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
<p class="nmf-error">
|
|
724
|
+
{{ errorMessage() }}
|
|
725
|
+
</p>
|
|
726
|
+
</div>
|
|
727
|
+
`, isInline: true, styles: [".nmf-field{position:relative;display:block;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif}.nmf-label{display:block;font-weight:500;font-size:.875rem;margin-bottom:.25rem}.nmf-required{color:#dc2626;font-size:.8rem}.nmf-input-wrapper{position:relative;display:flex;align-items:center}.nmf-input{width:100%;box-sizing:border-box;padding:.5rem .75rem;font-size:.875rem;line-height:1.25rem;border:1px solid #d1d5db;border-radius:.275rem;background-color:#f4f3f2;color:#111827;outline:none;transition:border-color .15s ease,box-shadow .15s ease}.nmf-field.loading select{background-image:none!important}.nmf-field.loading input[type=date]::-webkit-calendar-picker-indicator,.nmf-field.loading input[type=time]::-webkit-calendar-picker-indicator{opacity:0;pointer-events:none}select.nmf-input{appearance:none!important;-webkit-appearance:none!important;-moz-appearance:none!important;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAUCAMAAACtdX32AAAAdVBMVEUAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhMdQaAAAAJ3RSTlMAAAECAwQGBwsOFBwkJTg5RUZ4eYCHkJefpaytrsXGy8zW3+Do8vNn0bsyAAAAYElEQVR42tXROwJDQAAA0Ymw1p9kiT+L5P5HVEi3qJn2lcPjtIuzUIJ/rhIGy762N3XaThqMN1ZPALsZPEzG1x8LrFL77DHBnEMxBewz0fJ6LyFHTPL7xhwzWYrJ9z22AqmQBV757MHfAAAAAElFTkSuQmCC);background-position:100% center;background-repeat:no-repeat}.nmf-input:focus{border-color:#10b981;box-shadow:0 0 0 2px #10b98133}select.nmf-input:disabled{background-image:none}.nmf-input:disabled{opacity:.6;background-color:#f3f4f6;cursor:not-allowed}.nmf-input.error{border-color:#dc2626}.nmf-input.error:focus{box-shadow:0 0 0 2px #dc262633}.nmf-prefix{position:absolute;left:.75rem;top:50%;transform:translateY(-50%);line-height:1;font-size:.875rem;pointer-events:none}.nmf-prefix.error{color:#dc2626}.nmf-prefix-disabled{opacity:.6}.nmf-input-with-prefix{padding-left:1.25rem}.nmf-icon{width:20px;height:20px;fill:currentColor}.nmf-password-toggle{position:absolute;right:.75rem;background:none;border:none;padding:0;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:.875rem;line-height:1}.nmf-password-toggle:disabled{cursor:not-allowed}.nmf-error{font-size:.75rem;color:#dc2626;height:16px;margin-top:.25rem;margin-bottom:0;min-height:16px}.nmf-loading{position:absolute;width:1rem;height:1rem;top:50%;transform:translateY(-50%);right:.75rem}.nmf-spinner{display:inline-block;width:1rem;height:1rem;border:2px solid #d1d5db;border-top-color:#10b981;border-radius:50%;animation:nmf-spin .8s linear infinite}@keyframes nmf-spin{to{transform:rotate(360deg)}}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{appearance:textfield;-moz-appearance:textfield}\n"], 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 });
|
|
728
|
+
}
|
|
729
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputSelectComponent, decorators: [{
|
|
730
|
+
type: Component,
|
|
731
|
+
args: [{ selector: 'nmf-select', imports: [CommonModule, ReactiveFormsModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
732
|
+
<div class="nmf-field" [class.loading]="loading()">
|
|
733
|
+
@if (label()) {
|
|
734
|
+
<label class="nmf-label">
|
|
735
|
+
{{ label() }}
|
|
736
|
+
@if (isRequired()) {
|
|
737
|
+
<span class="nmf-required">*</span>
|
|
738
|
+
}
|
|
739
|
+
</label>
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
<select
|
|
743
|
+
class="nmf-input"
|
|
744
|
+
[ngClass]="classList()"
|
|
745
|
+
[class.error]="hasErrors()"
|
|
746
|
+
[class.disabled]="disabled()"
|
|
747
|
+
[required]="isRequired()"
|
|
748
|
+
[formControl]="control"
|
|
749
|
+
(blur)="onTouched()"
|
|
750
|
+
>
|
|
751
|
+
<!-- Empty option -->
|
|
752
|
+
<option [ngValue]="null" disabled>
|
|
753
|
+
{{ emptyOptionLabel() }}
|
|
754
|
+
</option>
|
|
755
|
+
|
|
756
|
+
<!-- Options -->
|
|
757
|
+
@for (option of options(); track option.key) {
|
|
758
|
+
<option [ngValue]="option.key" [disabled]="option.disabled">
|
|
759
|
+
{{ option.label }}
|
|
760
|
+
</option>
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
<!-- Clear option -->
|
|
764
|
+
@if (clearOptionLabel()) {
|
|
765
|
+
<option [ngValue]="null">
|
|
766
|
+
{{ clearOptionLabel() }}
|
|
767
|
+
</option>
|
|
768
|
+
}
|
|
769
|
+
</select>
|
|
770
|
+
|
|
771
|
+
@if (loading()) {
|
|
772
|
+
<div class="nmf-loading">
|
|
773
|
+
<span class="nmf-spinner"></span>
|
|
774
|
+
</div>
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
<p class="nmf-error">
|
|
778
|
+
{{ errorMessage() }}
|
|
779
|
+
</p>
|
|
780
|
+
</div>
|
|
781
|
+
`, styles: [".nmf-field{position:relative;display:block;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif}.nmf-label{display:block;font-weight:500;font-size:.875rem;margin-bottom:.25rem}.nmf-required{color:#dc2626;font-size:.8rem}.nmf-input-wrapper{position:relative;display:flex;align-items:center}.nmf-input{width:100%;box-sizing:border-box;padding:.5rem .75rem;font-size:.875rem;line-height:1.25rem;border:1px solid #d1d5db;border-radius:.275rem;background-color:#f4f3f2;color:#111827;outline:none;transition:border-color .15s ease,box-shadow .15s ease}.nmf-field.loading select{background-image:none!important}.nmf-field.loading input[type=date]::-webkit-calendar-picker-indicator,.nmf-field.loading input[type=time]::-webkit-calendar-picker-indicator{opacity:0;pointer-events:none}select.nmf-input{appearance:none!important;-webkit-appearance:none!important;-moz-appearance:none!important;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAUCAMAAACtdX32AAAAdVBMVEUAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhMdQaAAAAJ3RSTlMAAAECAwQGBwsOFBwkJTg5RUZ4eYCHkJefpaytrsXGy8zW3+Do8vNn0bsyAAAAYElEQVR42tXROwJDQAAA0Ymw1p9kiT+L5P5HVEi3qJn2lcPjtIuzUIJ/rhIGy762N3XaThqMN1ZPALsZPEzG1x8LrFL77DHBnEMxBewz0fJ6LyFHTPL7xhwzWYrJ9z22AqmQBV757MHfAAAAAElFTkSuQmCC);background-position:100% center;background-repeat:no-repeat}.nmf-input:focus{border-color:#10b981;box-shadow:0 0 0 2px #10b98133}select.nmf-input:disabled{background-image:none}.nmf-input:disabled{opacity:.6;background-color:#f3f4f6;cursor:not-allowed}.nmf-input.error{border-color:#dc2626}.nmf-input.error:focus{box-shadow:0 0 0 2px #dc262633}.nmf-prefix{position:absolute;left:.75rem;top:50%;transform:translateY(-50%);line-height:1;font-size:.875rem;pointer-events:none}.nmf-prefix.error{color:#dc2626}.nmf-prefix-disabled{opacity:.6}.nmf-input-with-prefix{padding-left:1.25rem}.nmf-icon{width:20px;height:20px;fill:currentColor}.nmf-password-toggle{position:absolute;right:.75rem;background:none;border:none;padding:0;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:.875rem;line-height:1}.nmf-password-toggle:disabled{cursor:not-allowed}.nmf-error{font-size:.75rem;color:#dc2626;height:16px;margin-top:.25rem;margin-bottom:0;min-height:16px}.nmf-loading{position:absolute;width:1rem;height:1rem;top:50%;transform:translateY(-50%);right:.75rem}.nmf-spinner{display:inline-block;width:1rem;height:1rem;border:2px solid #d1d5db;border-top-color:#10b981;border-radius:50%;animation:nmf-spin .8s linear infinite}@keyframes nmf-spin{to{transform:rotate(360deg)}}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{appearance:textfield;-moz-appearance:textfield}\n"] }]
|
|
782
|
+
}] });
|
|
783
|
+
|
|
784
|
+
class InputTextComponent extends FormControlBase {
|
|
785
|
+
type = input('text');
|
|
786
|
+
behavior = new TextBehavior();
|
|
787
|
+
computedType = computed(() => this.behavior.showPassword() && this.type() === 'password'
|
|
788
|
+
? 'text'
|
|
789
|
+
: this.type());
|
|
790
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputTextComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
791
|
+
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: `
|
|
792
|
+
<div class="nmf-field">
|
|
793
|
+
@if (label()) {
|
|
794
|
+
<label class="nmf-label">
|
|
795
|
+
{{ label() }}
|
|
796
|
+
@if (isRequired()) {
|
|
797
|
+
<span class="nmf-required">*</span>
|
|
798
|
+
}
|
|
799
|
+
</label>
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
<div class="nmf-input-wrapper">
|
|
803
|
+
<input
|
|
804
|
+
class="nmf-input"
|
|
805
|
+
[ngClass]="classList()"
|
|
806
|
+
[class.error]="hasErrors()"
|
|
807
|
+
[class.disabled]="disabled()"
|
|
808
|
+
[id]="id()"
|
|
809
|
+
[name]="name()"
|
|
810
|
+
[type]="computedType()"
|
|
811
|
+
[required]="isRequired()"
|
|
812
|
+
[placeholder]="placeholder()"
|
|
813
|
+
[formControl]="control"
|
|
814
|
+
(blur)="onTouched()"
|
|
815
|
+
/>
|
|
816
|
+
|
|
817
|
+
@if (type() === 'password' && !loading()) {
|
|
818
|
+
<button
|
|
819
|
+
type="button"
|
|
820
|
+
class="nmf-password-toggle"
|
|
821
|
+
aria-label="Toggle password visibility"
|
|
822
|
+
[disabled]="disabled()"
|
|
823
|
+
(click)="behavior.toggleShowPassword($event)"
|
|
824
|
+
>
|
|
825
|
+
@if (behavior.showPassword()) {
|
|
826
|
+
<ng-container [ngTemplateOutlet]="eyeOffIcon"></ng-container>
|
|
827
|
+
} @else {
|
|
828
|
+
<ng-container [ngTemplateOutlet]="eyeIcon"></ng-container>
|
|
829
|
+
}
|
|
830
|
+
</button>
|
|
831
|
+
}
|
|
832
|
+
</div>
|
|
833
|
+
|
|
834
|
+
<ng-content></ng-content>
|
|
835
|
+
|
|
836
|
+
<p class="nmf-error">
|
|
837
|
+
{{ errorMessage() }}
|
|
838
|
+
</p>
|
|
839
|
+
|
|
840
|
+
@if (loading()) {
|
|
841
|
+
<div class="nmf-loading">
|
|
842
|
+
<span class="nmf-spinner"></span>
|
|
843
|
+
</div>
|
|
844
|
+
}
|
|
845
|
+
</div>
|
|
846
|
+
|
|
847
|
+
<ng-template #eyeIcon>
|
|
848
|
+
<svg
|
|
849
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
850
|
+
height="24px"
|
|
851
|
+
viewBox="0 0 24 24"
|
|
852
|
+
width="24px"
|
|
853
|
+
fill="#e3e3e3"
|
|
854
|
+
class="nmf-icon"
|
|
855
|
+
>
|
|
856
|
+
<path d="M0 0h24v24H0z" fill="none" />
|
|
857
|
+
<path
|
|
858
|
+
d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"
|
|
859
|
+
/>
|
|
860
|
+
</svg>
|
|
861
|
+
</ng-template>
|
|
862
|
+
|
|
863
|
+
<ng-template #eyeOffIcon>
|
|
864
|
+
<svg
|
|
865
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
866
|
+
height="24px"
|
|
867
|
+
viewBox="0 0 24 24"
|
|
868
|
+
width="24px"
|
|
869
|
+
fill="#e3e3e3"
|
|
870
|
+
class="nmf-icon"
|
|
871
|
+
>
|
|
872
|
+
<path
|
|
873
|
+
d="M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z"
|
|
874
|
+
fill="none"
|
|
875
|
+
/>
|
|
876
|
+
<path
|
|
877
|
+
d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"
|
|
878
|
+
/>
|
|
879
|
+
</svg>
|
|
880
|
+
</ng-template>
|
|
881
|
+
`, isInline: true, styles: [".nmf-field{position:relative;display:block;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif}.nmf-label{display:block;font-weight:500;font-size:.875rem;margin-bottom:.25rem}.nmf-required{color:#dc2626;font-size:.8rem}.nmf-input-wrapper{position:relative;display:flex;align-items:center}.nmf-input{width:100%;box-sizing:border-box;padding:.5rem .75rem;font-size:.875rem;line-height:1.25rem;border:1px solid #d1d5db;border-radius:.275rem;background-color:#f4f3f2;color:#111827;outline:none;transition:border-color .15s ease,box-shadow .15s ease}.nmf-field.loading select{background-image:none!important}.nmf-field.loading input[type=date]::-webkit-calendar-picker-indicator,.nmf-field.loading input[type=time]::-webkit-calendar-picker-indicator{opacity:0;pointer-events:none}select.nmf-input{appearance:none!important;-webkit-appearance:none!important;-moz-appearance:none!important;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAUCAMAAACtdX32AAAAdVBMVEUAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhMdQaAAAAJ3RSTlMAAAECAwQGBwsOFBwkJTg5RUZ4eYCHkJefpaytrsXGy8zW3+Do8vNn0bsyAAAAYElEQVR42tXROwJDQAAA0Ymw1p9kiT+L5P5HVEi3qJn2lcPjtIuzUIJ/rhIGy762N3XaThqMN1ZPALsZPEzG1x8LrFL77DHBnEMxBewz0fJ6LyFHTPL7xhwzWYrJ9z22AqmQBV757MHfAAAAAElFTkSuQmCC);background-position:100% center;background-repeat:no-repeat}.nmf-input:focus{border-color:#10b981;box-shadow:0 0 0 2px #10b98133}select.nmf-input:disabled{background-image:none}.nmf-input:disabled{opacity:.6;background-color:#f3f4f6;cursor:not-allowed}.nmf-input.error{border-color:#dc2626}.nmf-input.error:focus{box-shadow:0 0 0 2px #dc262633}.nmf-prefix{position:absolute;left:.75rem;top:50%;transform:translateY(-50%);line-height:1;font-size:.875rem;pointer-events:none}.nmf-prefix.error{color:#dc2626}.nmf-prefix-disabled{opacity:.6}.nmf-input-with-prefix{padding-left:1.25rem}.nmf-icon{width:20px;height:20px;fill:currentColor}.nmf-password-toggle{position:absolute;right:.75rem;background:none;border:none;padding:0;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:.875rem;line-height:1}.nmf-password-toggle:disabled{cursor:not-allowed}.nmf-error{font-size:.75rem;color:#dc2626;height:16px;margin-top:.25rem;margin-bottom:0;min-height:16px}.nmf-loading{position:absolute;width:1rem;height:1rem;top:50%;transform:translateY(-50%);right:.75rem}.nmf-spinner{display:inline-block;width:1rem;height:1rem;border:2px solid #d1d5db;border-top-color:#10b981;border-radius:50%;animation:nmf-spin .8s linear infinite}@keyframes nmf-spin{to{transform:rotate(360deg)}}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{appearance:textfield;-moz-appearance:textfield}\n"], 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 });
|
|
882
|
+
}
|
|
883
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputTextComponent, decorators: [{
|
|
884
|
+
type: Component,
|
|
885
|
+
args: [{ selector: 'nmf-text', standalone: true, imports: [CommonModule, ReactiveFormsModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
886
|
+
<div class="nmf-field">
|
|
887
|
+
@if (label()) {
|
|
888
|
+
<label class="nmf-label">
|
|
889
|
+
{{ label() }}
|
|
890
|
+
@if (isRequired()) {
|
|
891
|
+
<span class="nmf-required">*</span>
|
|
892
|
+
}
|
|
893
|
+
</label>
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
<div class="nmf-input-wrapper">
|
|
897
|
+
<input
|
|
898
|
+
class="nmf-input"
|
|
899
|
+
[ngClass]="classList()"
|
|
900
|
+
[class.error]="hasErrors()"
|
|
901
|
+
[class.disabled]="disabled()"
|
|
902
|
+
[id]="id()"
|
|
903
|
+
[name]="name()"
|
|
904
|
+
[type]="computedType()"
|
|
905
|
+
[required]="isRequired()"
|
|
906
|
+
[placeholder]="placeholder()"
|
|
907
|
+
[formControl]="control"
|
|
908
|
+
(blur)="onTouched()"
|
|
909
|
+
/>
|
|
910
|
+
|
|
911
|
+
@if (type() === 'password' && !loading()) {
|
|
912
|
+
<button
|
|
913
|
+
type="button"
|
|
914
|
+
class="nmf-password-toggle"
|
|
915
|
+
aria-label="Toggle password visibility"
|
|
916
|
+
[disabled]="disabled()"
|
|
917
|
+
(click)="behavior.toggleShowPassword($event)"
|
|
918
|
+
>
|
|
919
|
+
@if (behavior.showPassword()) {
|
|
920
|
+
<ng-container [ngTemplateOutlet]="eyeOffIcon"></ng-container>
|
|
921
|
+
} @else {
|
|
922
|
+
<ng-container [ngTemplateOutlet]="eyeIcon"></ng-container>
|
|
923
|
+
}
|
|
924
|
+
</button>
|
|
925
|
+
}
|
|
926
|
+
</div>
|
|
927
|
+
|
|
928
|
+
<ng-content></ng-content>
|
|
929
|
+
|
|
930
|
+
<p class="nmf-error">
|
|
931
|
+
{{ errorMessage() }}
|
|
932
|
+
</p>
|
|
933
|
+
|
|
934
|
+
@if (loading()) {
|
|
935
|
+
<div class="nmf-loading">
|
|
936
|
+
<span class="nmf-spinner"></span>
|
|
937
|
+
</div>
|
|
938
|
+
}
|
|
939
|
+
</div>
|
|
940
|
+
|
|
941
|
+
<ng-template #eyeIcon>
|
|
942
|
+
<svg
|
|
943
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
944
|
+
height="24px"
|
|
945
|
+
viewBox="0 0 24 24"
|
|
946
|
+
width="24px"
|
|
947
|
+
fill="#e3e3e3"
|
|
948
|
+
class="nmf-icon"
|
|
949
|
+
>
|
|
950
|
+
<path d="M0 0h24v24H0z" fill="none" />
|
|
951
|
+
<path
|
|
952
|
+
d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"
|
|
953
|
+
/>
|
|
954
|
+
</svg>
|
|
955
|
+
</ng-template>
|
|
956
|
+
|
|
957
|
+
<ng-template #eyeOffIcon>
|
|
958
|
+
<svg
|
|
959
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
960
|
+
height="24px"
|
|
961
|
+
viewBox="0 0 24 24"
|
|
962
|
+
width="24px"
|
|
963
|
+
fill="#e3e3e3"
|
|
964
|
+
class="nmf-icon"
|
|
965
|
+
>
|
|
966
|
+
<path
|
|
967
|
+
d="M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z"
|
|
968
|
+
fill="none"
|
|
969
|
+
/>
|
|
970
|
+
<path
|
|
971
|
+
d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"
|
|
972
|
+
/>
|
|
973
|
+
</svg>
|
|
974
|
+
</ng-template>
|
|
975
|
+
`, styles: [".nmf-field{position:relative;display:block;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif}.nmf-label{display:block;font-weight:500;font-size:.875rem;margin-bottom:.25rem}.nmf-required{color:#dc2626;font-size:.8rem}.nmf-input-wrapper{position:relative;display:flex;align-items:center}.nmf-input{width:100%;box-sizing:border-box;padding:.5rem .75rem;font-size:.875rem;line-height:1.25rem;border:1px solid #d1d5db;border-radius:.275rem;background-color:#f4f3f2;color:#111827;outline:none;transition:border-color .15s ease,box-shadow .15s ease}.nmf-field.loading select{background-image:none!important}.nmf-field.loading input[type=date]::-webkit-calendar-picker-indicator,.nmf-field.loading input[type=time]::-webkit-calendar-picker-indicator{opacity:0;pointer-events:none}select.nmf-input{appearance:none!important;-webkit-appearance:none!important;-moz-appearance:none!important;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAUCAMAAACtdX32AAAAdVBMVEUAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhMdQaAAAAJ3RSTlMAAAECAwQGBwsOFBwkJTg5RUZ4eYCHkJefpaytrsXGy8zW3+Do8vNn0bsyAAAAYElEQVR42tXROwJDQAAA0Ymw1p9kiT+L5P5HVEi3qJn2lcPjtIuzUIJ/rhIGy762N3XaThqMN1ZPALsZPEzG1x8LrFL77DHBnEMxBewz0fJ6LyFHTPL7xhwzWYrJ9z22AqmQBV757MHfAAAAAElFTkSuQmCC);background-position:100% center;background-repeat:no-repeat}.nmf-input:focus{border-color:#10b981;box-shadow:0 0 0 2px #10b98133}select.nmf-input:disabled{background-image:none}.nmf-input:disabled{opacity:.6;background-color:#f3f4f6;cursor:not-allowed}.nmf-input.error{border-color:#dc2626}.nmf-input.error:focus{box-shadow:0 0 0 2px #dc262633}.nmf-prefix{position:absolute;left:.75rem;top:50%;transform:translateY(-50%);line-height:1;font-size:.875rem;pointer-events:none}.nmf-prefix.error{color:#dc2626}.nmf-prefix-disabled{opacity:.6}.nmf-input-with-prefix{padding-left:1.25rem}.nmf-icon{width:20px;height:20px;fill:currentColor}.nmf-password-toggle{position:absolute;right:.75rem;background:none;border:none;padding:0;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:.875rem;line-height:1}.nmf-password-toggle:disabled{cursor:not-allowed}.nmf-error{font-size:.75rem;color:#dc2626;height:16px;margin-top:.25rem;margin-bottom:0;min-height:16px}.nmf-loading{position:absolute;width:1rem;height:1rem;top:50%;transform:translateY(-50%);right:.75rem}.nmf-spinner{display:inline-block;width:1rem;height:1rem;border:2px solid #d1d5db;border-top-color:#10b981;border-radius:50%;animation:nmf-spin .8s linear infinite}@keyframes nmf-spin{to{transform:rotate(360deg)}}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{appearance:textfield;-moz-appearance:textfield}\n"] }]
|
|
976
|
+
}] });
|
|
977
|
+
|
|
978
|
+
class InputTextareaComponent extends FormControlBase {
|
|
979
|
+
rows = input(5);
|
|
980
|
+
cols = input(5);
|
|
981
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputTextareaComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
982
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.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: `
|
|
983
|
+
<div class="nmf-field">
|
|
984
|
+
@if (label()) {
|
|
985
|
+
<label class="nmf-label">
|
|
986
|
+
{{ label() }}
|
|
987
|
+
@if (isRequired()) {
|
|
988
|
+
<span class="nmf-required">*</span>
|
|
989
|
+
}
|
|
990
|
+
</label>
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
<textarea
|
|
994
|
+
class="nmf-input"
|
|
995
|
+
[ngClass]="classList()"
|
|
996
|
+
[class.error]="hasErrors()"
|
|
997
|
+
[class.disabled]="disabled()"
|
|
998
|
+
[id]="id()"
|
|
999
|
+
[rows]="rows()"
|
|
1000
|
+
[cols]="cols()"
|
|
1001
|
+
[required]="isRequired()"
|
|
1002
|
+
[placeholder]="placeholder()"
|
|
1003
|
+
[formControl]="control"
|
|
1004
|
+
(blur)="onTouched()"
|
|
1005
|
+
></textarea>
|
|
1006
|
+
|
|
1007
|
+
<p class="nmf-error">
|
|
1008
|
+
{{ errorMessage() }}
|
|
1009
|
+
</p>
|
|
1010
|
+
|
|
1011
|
+
@if (loading()) {
|
|
1012
|
+
<div class="nmf-loading">
|
|
1013
|
+
<span class="nmf-spinner"></span>
|
|
1014
|
+
</div>
|
|
1015
|
+
}
|
|
1016
|
+
</div>
|
|
1017
|
+
`, isInline: true, styles: [".nmf-field{position:relative;display:block;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif}.nmf-label{display:block;font-weight:500;font-size:.875rem;margin-bottom:.25rem}.nmf-required{color:#dc2626;font-size:.8rem}.nmf-input-wrapper{position:relative;display:flex;align-items:center}.nmf-input{width:100%;box-sizing:border-box;padding:.5rem .75rem;font-size:.875rem;line-height:1.25rem;border:1px solid #d1d5db;border-radius:.275rem;background-color:#f4f3f2;color:#111827;outline:none;transition:border-color .15s ease,box-shadow .15s ease}.nmf-field.loading select{background-image:none!important}.nmf-field.loading input[type=date]::-webkit-calendar-picker-indicator,.nmf-field.loading input[type=time]::-webkit-calendar-picker-indicator{opacity:0;pointer-events:none}select.nmf-input{appearance:none!important;-webkit-appearance:none!important;-moz-appearance:none!important;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAUCAMAAACtdX32AAAAdVBMVEUAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhMdQaAAAAJ3RSTlMAAAECAwQGBwsOFBwkJTg5RUZ4eYCHkJefpaytrsXGy8zW3+Do8vNn0bsyAAAAYElEQVR42tXROwJDQAAA0Ymw1p9kiT+L5P5HVEi3qJn2lcPjtIuzUIJ/rhIGy762N3XaThqMN1ZPALsZPEzG1x8LrFL77DHBnEMxBewz0fJ6LyFHTPL7xhwzWYrJ9z22AqmQBV757MHfAAAAAElFTkSuQmCC);background-position:100% center;background-repeat:no-repeat}.nmf-input:focus{border-color:#10b981;box-shadow:0 0 0 2px #10b98133}select.nmf-input:disabled{background-image:none}.nmf-input:disabled{opacity:.6;background-color:#f3f4f6;cursor:not-allowed}.nmf-input.error{border-color:#dc2626}.nmf-input.error:focus{box-shadow:0 0 0 2px #dc262633}.nmf-prefix{position:absolute;left:.75rem;top:50%;transform:translateY(-50%);line-height:1;font-size:.875rem;pointer-events:none}.nmf-prefix.error{color:#dc2626}.nmf-prefix-disabled{opacity:.6}.nmf-input-with-prefix{padding-left:1.25rem}.nmf-icon{width:20px;height:20px;fill:currentColor}.nmf-password-toggle{position:absolute;right:.75rem;background:none;border:none;padding:0;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:.875rem;line-height:1}.nmf-password-toggle:disabled{cursor:not-allowed}.nmf-error{font-size:.75rem;color:#dc2626;height:16px;margin-top:.25rem;margin-bottom:0;min-height:16px}.nmf-loading{position:absolute;width:1rem;height:1rem;top:50%;transform:translateY(-50%);right:.75rem}.nmf-spinner{display:inline-block;width:1rem;height:1rem;border:2px solid #d1d5db;border-top-color:#10b981;border-radius:50%;animation:nmf-spin .8s linear infinite}@keyframes nmf-spin{to{transform:rotate(360deg)}}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{appearance:textfield;-moz-appearance:textfield}\n"], 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 });
|
|
1018
|
+
}
|
|
1019
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputTextareaComponent, decorators: [{
|
|
1020
|
+
type: Component,
|
|
1021
|
+
args: [{ selector: 'nmf-textarea', standalone: true, imports: [CommonModule, ReactiveFormsModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
1022
|
+
<div class="nmf-field">
|
|
1023
|
+
@if (label()) {
|
|
1024
|
+
<label class="nmf-label">
|
|
1025
|
+
{{ label() }}
|
|
1026
|
+
@if (isRequired()) {
|
|
1027
|
+
<span class="nmf-required">*</span>
|
|
1028
|
+
}
|
|
1029
|
+
</label>
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
<textarea
|
|
1033
|
+
class="nmf-input"
|
|
1034
|
+
[ngClass]="classList()"
|
|
1035
|
+
[class.error]="hasErrors()"
|
|
1036
|
+
[class.disabled]="disabled()"
|
|
1037
|
+
[id]="id()"
|
|
1038
|
+
[rows]="rows()"
|
|
1039
|
+
[cols]="cols()"
|
|
1040
|
+
[required]="isRequired()"
|
|
1041
|
+
[placeholder]="placeholder()"
|
|
1042
|
+
[formControl]="control"
|
|
1043
|
+
(blur)="onTouched()"
|
|
1044
|
+
></textarea>
|
|
1045
|
+
|
|
1046
|
+
<p class="nmf-error">
|
|
1047
|
+
{{ errorMessage() }}
|
|
1048
|
+
</p>
|
|
1049
|
+
|
|
1050
|
+
@if (loading()) {
|
|
1051
|
+
<div class="nmf-loading">
|
|
1052
|
+
<span class="nmf-spinner"></span>
|
|
1053
|
+
</div>
|
|
1054
|
+
}
|
|
1055
|
+
</div>
|
|
1056
|
+
`, styles: [".nmf-field{position:relative;display:block;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif}.nmf-label{display:block;font-weight:500;font-size:.875rem;margin-bottom:.25rem}.nmf-required{color:#dc2626;font-size:.8rem}.nmf-input-wrapper{position:relative;display:flex;align-items:center}.nmf-input{width:100%;box-sizing:border-box;padding:.5rem .75rem;font-size:.875rem;line-height:1.25rem;border:1px solid #d1d5db;border-radius:.275rem;background-color:#f4f3f2;color:#111827;outline:none;transition:border-color .15s ease,box-shadow .15s ease}.nmf-field.loading select{background-image:none!important}.nmf-field.loading input[type=date]::-webkit-calendar-picker-indicator,.nmf-field.loading input[type=time]::-webkit-calendar-picker-indicator{opacity:0;pointer-events:none}select.nmf-input{appearance:none!important;-webkit-appearance:none!important;-moz-appearance:none!important;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAUCAMAAACtdX32AAAAdVBMVEUAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhMdQaAAAAJ3RSTlMAAAECAwQGBwsOFBwkJTg5RUZ4eYCHkJefpaytrsXGy8zW3+Do8vNn0bsyAAAAYElEQVR42tXROwJDQAAA0Ymw1p9kiT+L5P5HVEi3qJn2lcPjtIuzUIJ/rhIGy762N3XaThqMN1ZPALsZPEzG1x8LrFL77DHBnEMxBewz0fJ6LyFHTPL7xhwzWYrJ9z22AqmQBV757MHfAAAAAElFTkSuQmCC);background-position:100% center;background-repeat:no-repeat}.nmf-input:focus{border-color:#10b981;box-shadow:0 0 0 2px #10b98133}select.nmf-input:disabled{background-image:none}.nmf-input:disabled{opacity:.6;background-color:#f3f4f6;cursor:not-allowed}.nmf-input.error{border-color:#dc2626}.nmf-input.error:focus{box-shadow:0 0 0 2px #dc262633}.nmf-prefix{position:absolute;left:.75rem;top:50%;transform:translateY(-50%);line-height:1;font-size:.875rem;pointer-events:none}.nmf-prefix.error{color:#dc2626}.nmf-prefix-disabled{opacity:.6}.nmf-input-with-prefix{padding-left:1.25rem}.nmf-icon{width:20px;height:20px;fill:currentColor}.nmf-password-toggle{position:absolute;right:.75rem;background:none;border:none;padding:0;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:.875rem;line-height:1}.nmf-password-toggle:disabled{cursor:not-allowed}.nmf-error{font-size:.75rem;color:#dc2626;height:16px;margin-top:.25rem;margin-bottom:0;min-height:16px}.nmf-loading{position:absolute;width:1rem;height:1rem;top:50%;transform:translateY(-50%);right:.75rem}.nmf-spinner{display:inline-block;width:1rem;height:1rem;border:2px solid #d1d5db;border-top-color:#10b981;border-radius:50%;animation:nmf-spin .8s linear infinite}@keyframes nmf-spin{to{transform:rotate(360deg)}}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{appearance:textfield;-moz-appearance:textfield}\n"] }]
|
|
1057
|
+
}] });
|
|
1058
|
+
|
|
1059
|
+
class InputTimepickerComponent extends FormControlBase {
|
|
1060
|
+
// step in seconds: 60 = minutes only, 1 = show seconds
|
|
1061
|
+
step = input(60);
|
|
1062
|
+
displayValue = signal('');
|
|
1063
|
+
formatTime(date) {
|
|
1064
|
+
if (!date)
|
|
1065
|
+
return null;
|
|
1066
|
+
const hh = String(date.getHours()).padStart(2, '0');
|
|
1067
|
+
const mm = String(date.getMinutes()).padStart(2, '0');
|
|
1068
|
+
const ss = String(date.getSeconds()).padStart(2, '0');
|
|
1069
|
+
return this.step() < 60 ? `${hh}:${mm}:${ss}` : `${hh}:${mm}`;
|
|
1070
|
+
}
|
|
1071
|
+
parseTime(value) {
|
|
1072
|
+
if (!value)
|
|
1073
|
+
return null;
|
|
1074
|
+
const [h, m, s = 0] = value.split(':').map(Number);
|
|
1075
|
+
const date = new Date();
|
|
1076
|
+
date.setHours(h, m, s, 0);
|
|
1077
|
+
return date;
|
|
1078
|
+
}
|
|
1079
|
+
writeValue(value) {
|
|
1080
|
+
super.writeValue(value);
|
|
1081
|
+
this.displayValue.set(this.formatTime(value) ?? '');
|
|
1082
|
+
}
|
|
1083
|
+
onInput(event) {
|
|
1084
|
+
if (this._disabledByInput())
|
|
1085
|
+
return;
|
|
1086
|
+
const input = event.target;
|
|
1087
|
+
const parsed = this.parseTime(input.value);
|
|
1088
|
+
this.displayValue.set(this.formatTime(parsed) ?? '');
|
|
1089
|
+
this.onChange(parsed);
|
|
1090
|
+
}
|
|
1091
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputTimepickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1092
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.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: `
|
|
1093
|
+
<div class="nmf-field" [class.loading]="loading()">
|
|
1094
|
+
@if (label()) {
|
|
1095
|
+
<label class="nmf-label">
|
|
1096
|
+
{{ label() }}
|
|
1097
|
+
@if (isRequired()) {
|
|
1098
|
+
<span class="nmf-required">*</span>
|
|
1099
|
+
}
|
|
1100
|
+
</label>
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
<input
|
|
1104
|
+
type="time"
|
|
1105
|
+
autocomplete="off"
|
|
1106
|
+
class="nmf-input"
|
|
1107
|
+
[ngClass]="classList()"
|
|
1108
|
+
[class.error]="hasErrors()"
|
|
1109
|
+
[class.disabled]="disabled()"
|
|
1110
|
+
[id]="id()"
|
|
1111
|
+
[name]="name()"
|
|
1112
|
+
[step]="step()"
|
|
1113
|
+
[value]="displayValue()"
|
|
1114
|
+
[disabled]="disabled()"
|
|
1115
|
+
[required]="isRequired()"
|
|
1116
|
+
[placeholder]="placeholder()"
|
|
1117
|
+
(blur)="onTouched()"
|
|
1118
|
+
(input)="onInput($event)"
|
|
1119
|
+
/>
|
|
1120
|
+
|
|
1121
|
+
<ng-content></ng-content>
|
|
1122
|
+
|
|
1123
|
+
@if (loading()) {
|
|
1124
|
+
<div class="nmf-loading">
|
|
1125
|
+
<span class="nmf-spinner"></span>
|
|
1126
|
+
</div>
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
<p class="nmf-error">
|
|
1130
|
+
{{ errorMessage() }}
|
|
1131
|
+
</p>
|
|
1132
|
+
</div>
|
|
1133
|
+
`, isInline: true, styles: [".nmf-field{position:relative;display:block;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif}.nmf-label{display:block;font-weight:500;font-size:.875rem;margin-bottom:.25rem}.nmf-required{color:#dc2626;font-size:.8rem}.nmf-input-wrapper{position:relative;display:flex;align-items:center}.nmf-input{width:100%;box-sizing:border-box;padding:.5rem .75rem;font-size:.875rem;line-height:1.25rem;border:1px solid #d1d5db;border-radius:.275rem;background-color:#f4f3f2;color:#111827;outline:none;transition:border-color .15s ease,box-shadow .15s ease}.nmf-field.loading select{background-image:none!important}.nmf-field.loading input[type=date]::-webkit-calendar-picker-indicator,.nmf-field.loading input[type=time]::-webkit-calendar-picker-indicator{opacity:0;pointer-events:none}select.nmf-input{appearance:none!important;-webkit-appearance:none!important;-moz-appearance:none!important;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAUCAMAAACtdX32AAAAdVBMVEUAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhMdQaAAAAJ3RSTlMAAAECAwQGBwsOFBwkJTg5RUZ4eYCHkJefpaytrsXGy8zW3+Do8vNn0bsyAAAAYElEQVR42tXROwJDQAAA0Ymw1p9kiT+L5P5HVEi3qJn2lcPjtIuzUIJ/rhIGy762N3XaThqMN1ZPALsZPEzG1x8LrFL77DHBnEMxBewz0fJ6LyFHTPL7xhwzWYrJ9z22AqmQBV757MHfAAAAAElFTkSuQmCC);background-position:100% center;background-repeat:no-repeat}.nmf-input:focus{border-color:#10b981;box-shadow:0 0 0 2px #10b98133}select.nmf-input:disabled{background-image:none}.nmf-input:disabled{opacity:.6;background-color:#f3f4f6;cursor:not-allowed}.nmf-input.error{border-color:#dc2626}.nmf-input.error:focus{box-shadow:0 0 0 2px #dc262633}.nmf-prefix{position:absolute;left:.75rem;top:50%;transform:translateY(-50%);line-height:1;font-size:.875rem;pointer-events:none}.nmf-prefix.error{color:#dc2626}.nmf-prefix-disabled{opacity:.6}.nmf-input-with-prefix{padding-left:1.25rem}.nmf-icon{width:20px;height:20px;fill:currentColor}.nmf-password-toggle{position:absolute;right:.75rem;background:none;border:none;padding:0;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:.875rem;line-height:1}.nmf-password-toggle:disabled{cursor:not-allowed}.nmf-error{font-size:.75rem;color:#dc2626;height:16px;margin-top:.25rem;margin-bottom:0;min-height:16px}.nmf-loading{position:absolute;width:1rem;height:1rem;top:50%;transform:translateY(-50%);right:.75rem}.nmf-spinner{display:inline-block;width:1rem;height:1rem;border:2px solid #d1d5db;border-top-color:#10b981;border-radius:50%;animation:nmf-spin .8s linear infinite}@keyframes nmf-spin{to{transform:rotate(360deg)}}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{appearance:textfield;-moz-appearance:textfield}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1134
|
+
}
|
|
1135
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: InputTimepickerComponent, decorators: [{
|
|
1136
|
+
type: Component,
|
|
1137
|
+
args: [{ selector: 'nmf-timepicker', standalone: true, imports: [CommonModule, ReactiveFormsModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
1138
|
+
<div class="nmf-field" [class.loading]="loading()">
|
|
1139
|
+
@if (label()) {
|
|
1140
|
+
<label class="nmf-label">
|
|
1141
|
+
{{ label() }}
|
|
1142
|
+
@if (isRequired()) {
|
|
1143
|
+
<span class="nmf-required">*</span>
|
|
1144
|
+
}
|
|
1145
|
+
</label>
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
<input
|
|
1149
|
+
type="time"
|
|
1150
|
+
autocomplete="off"
|
|
1151
|
+
class="nmf-input"
|
|
1152
|
+
[ngClass]="classList()"
|
|
1153
|
+
[class.error]="hasErrors()"
|
|
1154
|
+
[class.disabled]="disabled()"
|
|
1155
|
+
[id]="id()"
|
|
1156
|
+
[name]="name()"
|
|
1157
|
+
[step]="step()"
|
|
1158
|
+
[value]="displayValue()"
|
|
1159
|
+
[disabled]="disabled()"
|
|
1160
|
+
[required]="isRequired()"
|
|
1161
|
+
[placeholder]="placeholder()"
|
|
1162
|
+
(blur)="onTouched()"
|
|
1163
|
+
(input)="onInput($event)"
|
|
1164
|
+
/>
|
|
1165
|
+
|
|
1166
|
+
<ng-content></ng-content>
|
|
1167
|
+
|
|
1168
|
+
@if (loading()) {
|
|
1169
|
+
<div class="nmf-loading">
|
|
1170
|
+
<span class="nmf-spinner"></span>
|
|
1171
|
+
</div>
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
<p class="nmf-error">
|
|
1175
|
+
{{ errorMessage() }}
|
|
1176
|
+
</p>
|
|
1177
|
+
</div>
|
|
1178
|
+
`, styles: [".nmf-field{position:relative;display:block;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif}.nmf-label{display:block;font-weight:500;font-size:.875rem;margin-bottom:.25rem}.nmf-required{color:#dc2626;font-size:.8rem}.nmf-input-wrapper{position:relative;display:flex;align-items:center}.nmf-input{width:100%;box-sizing:border-box;padding:.5rem .75rem;font-size:.875rem;line-height:1.25rem;border:1px solid #d1d5db;border-radius:.275rem;background-color:#f4f3f2;color:#111827;outline:none;transition:border-color .15s ease,box-shadow .15s ease}.nmf-field.loading select{background-image:none!important}.nmf-field.loading input[type=date]::-webkit-calendar-picker-indicator,.nmf-field.loading input[type=time]::-webkit-calendar-picker-indicator{opacity:0;pointer-events:none}select.nmf-input{appearance:none!important;-webkit-appearance:none!important;-moz-appearance:none!important;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAUCAMAAACtdX32AAAAdVBMVEUAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhMdQaAAAAJ3RSTlMAAAECAwQGBwsOFBwkJTg5RUZ4eYCHkJefpaytrsXGy8zW3+Do8vNn0bsyAAAAYElEQVR42tXROwJDQAAA0Ymw1p9kiT+L5P5HVEi3qJn2lcPjtIuzUIJ/rhIGy762N3XaThqMN1ZPALsZPEzG1x8LrFL77DHBnEMxBewz0fJ6LyFHTPL7xhwzWYrJ9z22AqmQBV757MHfAAAAAElFTkSuQmCC);background-position:100% center;background-repeat:no-repeat}.nmf-input:focus{border-color:#10b981;box-shadow:0 0 0 2px #10b98133}select.nmf-input:disabled{background-image:none}.nmf-input:disabled{opacity:.6;background-color:#f3f4f6;cursor:not-allowed}.nmf-input.error{border-color:#dc2626}.nmf-input.error:focus{box-shadow:0 0 0 2px #dc262633}.nmf-prefix{position:absolute;left:.75rem;top:50%;transform:translateY(-50%);line-height:1;font-size:.875rem;pointer-events:none}.nmf-prefix.error{color:#dc2626}.nmf-prefix-disabled{opacity:.6}.nmf-input-with-prefix{padding-left:1.25rem}.nmf-icon{width:20px;height:20px;fill:currentColor}.nmf-password-toggle{position:absolute;right:.75rem;background:none;border:none;padding:0;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:.875rem;line-height:1}.nmf-password-toggle:disabled{cursor:not-allowed}.nmf-error{font-size:.75rem;color:#dc2626;height:16px;margin-top:.25rem;margin-bottom:0;min-height:16px}.nmf-loading{position:absolute;width:1rem;height:1rem;top:50%;transform:translateY(-50%);right:.75rem}.nmf-spinner{display:inline-block;width:1rem;height:1rem;border:2px solid #d1d5db;border-top-color:#10b981;border-radius:50%;animation:nmf-spin .8s linear infinite}@keyframes nmf-spin{to{transform:rotate(360deg)}}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{appearance:textfield;-moz-appearance:textfield}\n"] }]
|
|
1179
|
+
}] });
|
|
1180
|
+
|
|
227
1181
|
class FormHydrator {
|
|
228
1182
|
hydrate(form, model, registry = {}) {
|
|
229
1183
|
Object.entries(form.controls).forEach(([key, control]) => {
|
|
230
1184
|
if (!(key in model))
|
|
231
1185
|
return;
|
|
232
|
-
const
|
|
1186
|
+
const mapFn = registry[key]?.fromModel;
|
|
233
1187
|
const value = model?.[key];
|
|
234
1188
|
if (control instanceof FormGroup) {
|
|
235
|
-
if (
|
|
236
|
-
control.patchValue(
|
|
1189
|
+
if (mapFn) {
|
|
1190
|
+
control.patchValue(mapFn(value), { emitEvent: false });
|
|
237
1191
|
}
|
|
238
1192
|
else {
|
|
239
1193
|
this.hydrate(control, value, registry);
|
|
@@ -255,14 +1209,11 @@ class FormSerializer {
|
|
|
255
1209
|
toRequest(form, registry = {}) {
|
|
256
1210
|
const result = {};
|
|
257
1211
|
Object.entries(form.controls).forEach(([key, control]) => {
|
|
258
|
-
const
|
|
1212
|
+
const mapFn = registry[key]?.toRequest;
|
|
259
1213
|
if (control instanceof FormGroup) {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
else {
|
|
264
|
-
result[key] = this.toRequest(control, registry);
|
|
265
|
-
}
|
|
1214
|
+
result[key] = mapFn
|
|
1215
|
+
? mapFn(control.value)
|
|
1216
|
+
: this.toRequest(control, registry);
|
|
266
1217
|
return;
|
|
267
1218
|
}
|
|
268
1219
|
result[key] = control.value;
|
|
@@ -301,7 +1252,7 @@ class FormOrchestrator extends FormMapperBase {
|
|
|
301
1252
|
* Must be called before any subform registration or handler execution.
|
|
302
1253
|
*/
|
|
303
1254
|
orchestrate(options) {
|
|
304
|
-
const { form, handlers, mapperRegistry } = options;
|
|
1255
|
+
const { form, handlers = [], mapperRegistry = {} } = options;
|
|
305
1256
|
this._form.set(form);
|
|
306
1257
|
this._handlers.set(handlers);
|
|
307
1258
|
this._mapperRegistry.set(mapperRegistry);
|
|
@@ -361,5 +1312,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
361
1312
|
* Generated bundle index. Do not edit.
|
|
362
1313
|
*/
|
|
363
1314
|
|
|
364
|
-
export { FormControlBase, FormHandlerBase, FormHydrator, FormMapperBase, FormOrchestrator, FormSerializer, formatNumber, getControl, getControlValue, parseNumber };
|
|
1315
|
+
export { CurrencyBehavior, FormControlBase, FormHandlerBase, FormHydrator, FormMapperBase, FormOrchestrator, FormSerializer, InputCurrencyComponent, InputDatepickerComponent, InputNumberComponent, InputSelectComponent, InputTextComponent, InputTextareaComponent, InputTimepickerComponent, TextBehavior, formatNumber, getControl, getControlValue, parseNumber };
|
|
365
1316
|
//# sourceMappingURL=ng-modular-forms-core.mjs.map
|