@nettyapps/ntyui 21.1.12 → 21.1.13

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, NgModule, input, booleanAttribute, model, viewChild, effect, signal, inject, computed, output, HostListener, numberAttribute, ChangeDetectionStrategy, Injectable } from '@angular/core';
2
+ import { Component, NgModule, input, booleanAttribute, inject, model, viewChild, effect, signal, computed, output, HostListener, numberAttribute, ChangeDetectionStrategy, Injectable } from '@angular/core';
3
3
  import * as i1 from '@angular/forms';
4
4
  import { Validators, FormsModule, ReactiveFormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
5
5
  import * as i2 from '@angular/material/form-field';
@@ -8,9 +8,10 @@ import * as i3 from '@angular/material/input';
8
8
  import { MatInputModule } from '@angular/material/input';
9
9
  import * as i4 from '@angular/material/icon';
10
10
  import { MatIconModule } from '@angular/material/icon';
11
+ import { AlertService } from '@nettyapps/ntybase';
11
12
  import * as i4$1 from '@angular/material/datepicker';
12
13
  import { MatDatepickerModule } from '@angular/material/datepicker';
13
- import { DateAdapter, MatNativeDateModule, provideNativeDateAdapter } from '@angular/material/core';
14
+ import { NativeDateAdapter, DateAdapter, MatNativeDateModule, provideNativeDateAdapter } from '@angular/material/core';
14
15
  import * as i6 from '@angular/material/timepicker';
15
16
  import { MatTimepickerModule } from '@angular/material/timepicker';
16
17
  import * as i1$1 from '@angular/common';
@@ -78,6 +79,8 @@ class UiBase {
78
79
  validateRegex = input(null, ...(ngDevMode ? [{ debugName: "validateRegex" }] : []));
79
80
  validateRegexErrorMessage = input('@invalidFormat', ...(ngDevMode ? [{ debugName: "validateRegexErrorMessage" }] : []));
80
81
  forFilter = input(false, { ...(ngDevMode ? { debugName: "forFilter" } : {}), transform: booleanAttribute });
82
+ // Services
83
+ alertService = inject(AlertService);
81
84
  // Debounce properties
82
85
  debounce = input(200, ...(ngDevMode ? [{ debugName: "debounce" }] : []));
83
86
  debounceTimer;
@@ -269,13 +272,62 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImpor
269
272
  ], host: { 'ntyui-id': 'NettyUIEmailInput' }, template: "<mat-form-field\n class=\"example-full-width\"\n [appearance]=\"appearance()\"\n [class.required-field]=\"required()\"\n [class.required-with-value]=\"required() && value()\"\n>\n @if (label()) {\n <mat-label>{{ label() }}</mat-label>\n }\n\n <input\n #inputModel=\"ngModel\"\n type=\"email\"\n matInput\n [placeholder]=\"placeholder()\"\n [(ngModel)]=\"value\"\n (input)=\"onInputChange($event)\"\n />\n @if (value() && !disabled()) {\n <button\n mat-icon-button\n matSuffix\n (click)=\"clearInput()\"\n aria-label=\"Clear\"\n class=\"clear-btn number-clear-btn\"\n >\n <mat-icon>cancel</mat-icon>\n </button>\n } @if (inputModel?.invalid && (inputModel?.dirty || inputModel?.touched)) {\n <mat-error> {{ getErrorMessage() }} </mat-error>\n }\n</mat-form-field>\n", styles: [".example-full-width{width:100%;max-width:500px}.mat-mdc-form-field-subscript-wrapper{width:auto;height:0}.clear-btn{background:none;border:none;box-shadow:none;cursor:pointer}.search-icon{background:none;border:none;box-shadow:none;opacity:1;cursor:pointer}.search-icon:hover,.clear-btn:hover{color:var(--mat-sys-primary)}.required-field{background-color:var(--mat-sys-required)}.required-with-value{background-color:transparent!important}::ng-deep .circle .mdc-checkbox__background{border-radius:50%!important}::ng-deep .circle .mdc-checkbox__background:before{border-radius:50%!important}\n"] }]
270
273
  }] });
271
274
 
275
+ class PartialDateAdapter extends NativeDateAdapter {
276
+ parse(value) {
277
+ if (typeof value === 'string') {
278
+ const trimmed = value.trim();
279
+ if (!trimmed)
280
+ return null;
281
+ // Ayraçları normalize et
282
+ const normalized = trimmed.replace(/[.\-]/g, '/');
283
+ const parts = normalized.split('/');
284
+ // Sadece Gün (10) veya Gün/Ay (10/3) girilmişse
285
+ if (parts.length === 1 || parts.length === 2) {
286
+ const today = new Date();
287
+ let day = today.getDate();
288
+ let month = today.getMonth();
289
+ const year = today.getFullYear(); // Yıl her zaman içinde bulunduğumuz yıl
290
+ if (parts.length === 1) {
291
+ const d = parseInt(parts[0], 10);
292
+ if (!isNaN(d) && d >= 1 && d <= 31) {
293
+ day = d;
294
+ }
295
+ else {
296
+ return super.parse(value);
297
+ }
298
+ }
299
+ else if (parts.length === 2) {
300
+ const d = parseInt(parts[0], 10);
301
+ const m = parseInt(parts[1], 10);
302
+ if (!isNaN(d) && !isNaN(m) && d >= 1 && d <= 31 && m >= 1 && m <= 12) {
303
+ day = d;
304
+ month = m - 1;
305
+ }
306
+ else {
307
+ return super.parse(value);
308
+ }
309
+ }
310
+ // Geçersiz tarihleri (örn. 30 Şubat) engellemek için kontrol
311
+ const parsedDate = new Date(year, month, day);
312
+ if (!isNaN(parsedDate.getTime()) &&
313
+ parsedDate.getDate() === day &&
314
+ parsedDate.getMonth() === month) {
315
+ return parsedDate; // MatDatepicker'a doğru tarihi ver
316
+ }
317
+ }
318
+ }
319
+ // Tam tarih formatıysa varsayılan parser işini yapsın
320
+ return super.parse(value);
321
+ }
322
+ }
323
+
272
324
  class NettyUIDateTime extends UiBase {
273
- // Combined value output
274
- dateTimeValue = model(null, ...(ngDevMode ? [{ debugName: "dateTimeValue" }] : []));
275
- // Input properties
325
+ // State Management
276
326
  timeLabel = input('', ...(ngDevMode ? [{ debugName: "timeLabel" }] : []));
277
327
  dateRestriction = input('any', ...(ngDevMode ? [{ debugName: "dateRestriction" }] : []));
278
328
  timeFormat = input('tr-TR', ...(ngDevMode ? [{ debugName: "timeFormat" }] : []));
329
+ // Combined value output
330
+ dateTimeValue = model(null, ...(ngDevMode ? [{ debugName: "dateTimeValue" }] : []));
279
331
  // Date properties
280
332
  dateValue = signal(null, ...(ngDevMode ? [{ debugName: "dateValue" }] : []));
281
333
  // Time properties
@@ -284,7 +336,7 @@ class NettyUIDateTime extends UiBase {
284
336
  dateModel = viewChild('dateModel', ...(ngDevMode ? [{ debugName: "dateModel" }] : []));
285
337
  timeModel = viewChild('timeModel', ...(ngDevMode ? [{ debugName: "timeModel" }] : []));
286
338
  inputModel = viewChild('dateInputModel', ...(ngDevMode ? [{ debugName: "inputModel" }] : []));
287
- dateAdapter = inject(DateAdapter);
339
+ _dateAdapter = inject(DateAdapter);
288
340
  displayValue = computed(() => {
289
341
  const date = this.dateValue();
290
342
  if (!date)
@@ -336,7 +388,8 @@ class NettyUIDateTime extends UiBase {
336
388
  });
337
389
  // Locale changes
338
390
  effect(() => {
339
- this.dateAdapter.setLocale(this.timeFormat());
391
+ const locale = this.timeFormat();
392
+ this._dateAdapter.setLocale(locale);
340
393
  });
341
394
  }
342
395
  updateCombinedValue() {
@@ -405,39 +458,54 @@ class NettyUIDateTime extends UiBase {
405
458
  this.dateTimeValue.set(shouldBeNull ? null : new Date('1900-01-01T00:00:00'));
406
459
  }
407
460
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyUIDateTime, deps: [], target: i0.ɵɵFactoryTarget.Component });
408
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.2", type: NettyUIDateTime, isStandalone: true, selector: "ntyui-date-time", inputs: { dateTimeValue: { classPropertyName: "dateTimeValue", publicName: "dateTimeValue", isSignal: true, isRequired: false, transformFunction: null }, timeLabel: { classPropertyName: "timeLabel", publicName: "timeLabel", isSignal: true, isRequired: false, transformFunction: null }, dateRestriction: { classPropertyName: "dateRestriction", publicName: "dateRestriction", isSignal: true, isRequired: false, transformFunction: null }, timeFormat: { classPropertyName: "timeFormat", publicName: "timeFormat", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateTimeValue: "dateTimeValueChange" }, host: { attributes: { "ntyui-id": "NettyUIDateTime" } }, providers: [
461
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.2", type: NettyUIDateTime, isStandalone: true, selector: "ntyui-date-time", inputs: { timeLabel: { classPropertyName: "timeLabel", publicName: "timeLabel", isSignal: true, isRequired: false, transformFunction: null }, dateRestriction: { classPropertyName: "dateRestriction", publicName: "dateRestriction", isSignal: true, isRequired: false, transformFunction: null }, timeFormat: { classPropertyName: "timeFormat", publicName: "timeFormat", isSignal: true, isRequired: false, transformFunction: null }, dateTimeValue: { classPropertyName: "dateTimeValue", publicName: "dateTimeValue", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateTimeValue: "dateTimeValueChange" }, host: { attributes: { "ntyui-id": "NettyUIDateTime" } }, providers: [
462
+ provideNativeDateAdapter(),
409
463
  {
410
464
  provide: NG_VALUE_ACCESSOR,
411
465
  useExisting: NettyUIDateTime,
412
466
  multi: true,
413
467
  },
468
+ {
469
+ provide: DateAdapter,
470
+ useClass: PartialDateAdapter
471
+ }
414
472
  ], viewQueries: [{ propertyName: "dateModel", first: true, predicate: ["dateModel"], descendants: true, isSignal: true }, { propertyName: "timeModel", first: true, predicate: ["timeModel"], descendants: true, isSignal: true }, { propertyName: "inputModel", first: true, predicate: ["dateInputModel"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"datetime-container\">\n <!-- Datetime -->\n <mat-form-field\n [appearance]=\"appearance()\"\n class=\"datepicker\"\n [class.required-field]=\"required()\"\n [class.required-with-value]=\"required() && dateValue()\"\n >\n @if (label()) {\n <mat-label>{{ label() }}</mat-label>\n }\n\n <input\n #dateInputModel=\"ngModel\"\n matInput\n [matDatepicker]=\"picker\"\n [placeholder]=\"placeholder()\"\n [ngModel]=\"dateValue()\"\n (dateChange)=\"onDateChange($event)\"\n [min]=\"minDate() ?? undefined\"\n [max]=\"maxDate() ?? undefined\"\n />\n\n @if (dateValue() && !disabled()) {\n <button\n mat-icon-button\n matSuffix\n (click)=\"clearInput()\"\n aria-label=\"Clear\"\n class=\"clear-btn date-clear\"\n >\n <mat-icon>cancel</mat-icon>\n </button>\n } @if (dateInputModel.invalid && (dateInputModel.dirty ||\n dateInputModel.touched)) {\n <mat-error> {{ getErrorMessage() }} </mat-error>\n }\n\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n\n <!-- Timepicker -->\n <mat-form-field\n class=\"time-field\"\n [appearance]=\"appearance()\"\n [class.required-field]=\"required()\"\n [class.required-with-value]=\"required() && timeValue()\"\n >\n @if (timeLabel()) {\n <mat-label>{{ timeLabel() }}</mat-label>\n }\n <input\n #timeInputModel=\"ngModel\"\n matInput\n [matTimepicker]=\"timepicker\"\n [ngModel]=\"timeValue()\"\n (ngModelChange)=\"onTimeChange($event)\"\n [ngModelOptions]=\"{updateOn: 'blur'}\"\n [disabled]=\"disabled()\"\n />\n\n @if ( timeInputModel.invalid && ( timeInputModel.dirty ||\n timeInputModel.touched)) {\n <mat-error> {{ getErrorMessage() }} </mat-error>\n }\n\n <mat-timepicker #timepicker />\n <mat-timepicker-toggle [for]=\"timepicker\" matSuffix />\n </mat-form-field>\n</div>\n", styles: [".example-full-width{width:100%;max-width:500px}.mat-mdc-form-field-subscript-wrapper{width:auto;height:0}.clear-btn{background:none;border:none;box-shadow:none;cursor:pointer}.search-icon{background:none;border:none;box-shadow:none;opacity:1;cursor:pointer}.search-icon:hover,.clear-btn:hover{color:var(--mat-sys-primary)}.required-field{background-color:var(--mat-sys-required)}.required-with-value{background-color:transparent!important}::ng-deep .circle .mdc-checkbox__background{border-radius:50%!important}::ng-deep .circle .mdc-checkbox__background:before{border-radius:50%!important}.datetime-container{display:flex;align-items:flex-start}@media(max-width:600px){.datetime-container{flex-wrap:nowrap;overflow-x:auto;align-items:flex-start}}.datepicker,.time-field{width:50%}::ng-deep .mat-mdc-form-field-icon-prefix,::ng-deep .mat-mdc-form-field-icon-suffix{display:flex!important;flex-direction:row!important;align-items:center!important}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i4$1.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i4$1.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i4$1.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "ngmodule", type: MatNativeDateModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTimepickerModule }, { kind: "component", type: i6.MatTimepicker, selector: "mat-timepicker", inputs: ["interval", "options", "disableRipple", "aria-label", "aria-labelledby", "panelClass"], outputs: ["selected", "opened", "closed"], exportAs: ["matTimepicker"] }, { kind: "directive", type: i6.MatTimepickerInput, selector: "input[matTimepicker]", inputs: ["value", "matTimepicker", "matTimepickerMin", "matTimepickerMax", "matTimepickerOpenOnClick", "disabled"], outputs: ["valueChange"], exportAs: ["matTimepickerInput"] }, { kind: "component", type: i6.MatTimepickerToggle, selector: "mat-timepicker-toggle", inputs: ["for", "aria-label", "aria-labelledby", "disabled", "tabIndex", "disableRipple"], exportAs: ["matTimepickerToggle"] }] });
415
473
  }
416
474
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyUIDateTime, decorators: [{
417
475
  type: Component,
418
476
  args: [{ selector: 'ntyui-date-time', imports: [FormsModule, MatFormFieldModule, MatInputModule, ReactiveFormsModule, MatDatepickerModule, MatNativeDateModule, MatIconModule, MatTimepickerModule], providers: [
477
+ provideNativeDateAdapter(),
419
478
  {
420
479
  provide: NG_VALUE_ACCESSOR,
421
480
  useExisting: NettyUIDateTime,
422
481
  multi: true,
423
482
  },
483
+ {
484
+ provide: DateAdapter,
485
+ useClass: PartialDateAdapter
486
+ }
424
487
  ], host: { 'ntyui-id': 'NettyUIDateTime' }, template: "<div class=\"datetime-container\">\n <!-- Datetime -->\n <mat-form-field\n [appearance]=\"appearance()\"\n class=\"datepicker\"\n [class.required-field]=\"required()\"\n [class.required-with-value]=\"required() && dateValue()\"\n >\n @if (label()) {\n <mat-label>{{ label() }}</mat-label>\n }\n\n <input\n #dateInputModel=\"ngModel\"\n matInput\n [matDatepicker]=\"picker\"\n [placeholder]=\"placeholder()\"\n [ngModel]=\"dateValue()\"\n (dateChange)=\"onDateChange($event)\"\n [min]=\"minDate() ?? undefined\"\n [max]=\"maxDate() ?? undefined\"\n />\n\n @if (dateValue() && !disabled()) {\n <button\n mat-icon-button\n matSuffix\n (click)=\"clearInput()\"\n aria-label=\"Clear\"\n class=\"clear-btn date-clear\"\n >\n <mat-icon>cancel</mat-icon>\n </button>\n } @if (dateInputModel.invalid && (dateInputModel.dirty ||\n dateInputModel.touched)) {\n <mat-error> {{ getErrorMessage() }} </mat-error>\n }\n\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n\n <!-- Timepicker -->\n <mat-form-field\n class=\"time-field\"\n [appearance]=\"appearance()\"\n [class.required-field]=\"required()\"\n [class.required-with-value]=\"required() && timeValue()\"\n >\n @if (timeLabel()) {\n <mat-label>{{ timeLabel() }}</mat-label>\n }\n <input\n #timeInputModel=\"ngModel\"\n matInput\n [matTimepicker]=\"timepicker\"\n [ngModel]=\"timeValue()\"\n (ngModelChange)=\"onTimeChange($event)\"\n [ngModelOptions]=\"{updateOn: 'blur'}\"\n [disabled]=\"disabled()\"\n />\n\n @if ( timeInputModel.invalid && ( timeInputModel.dirty ||\n timeInputModel.touched)) {\n <mat-error> {{ getErrorMessage() }} </mat-error>\n }\n\n <mat-timepicker #timepicker />\n <mat-timepicker-toggle [for]=\"timepicker\" matSuffix />\n </mat-form-field>\n</div>\n", styles: [".example-full-width{width:100%;max-width:500px}.mat-mdc-form-field-subscript-wrapper{width:auto;height:0}.clear-btn{background:none;border:none;box-shadow:none;cursor:pointer}.search-icon{background:none;border:none;box-shadow:none;opacity:1;cursor:pointer}.search-icon:hover,.clear-btn:hover{color:var(--mat-sys-primary)}.required-field{background-color:var(--mat-sys-required)}.required-with-value{background-color:transparent!important}::ng-deep .circle .mdc-checkbox__background{border-radius:50%!important}::ng-deep .circle .mdc-checkbox__background:before{border-radius:50%!important}.datetime-container{display:flex;align-items:flex-start}@media(max-width:600px){.datetime-container{flex-wrap:nowrap;overflow-x:auto;align-items:flex-start}}.datepicker,.time-field{width:50%}::ng-deep .mat-mdc-form-field-icon-prefix,::ng-deep .mat-mdc-form-field-icon-suffix{display:flex!important;flex-direction:row!important;align-items:center!important}\n"] }]
425
- }], ctorParameters: () => [], propDecorators: { dateTimeValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateTimeValue", required: false }] }, { type: i0.Output, args: ["dateTimeValueChange"] }], timeLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeLabel", required: false }] }], dateRestriction: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateRestriction", required: false }] }], timeFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeFormat", required: false }] }], dateModel: [{ type: i0.ViewChild, args: ['dateModel', { isSignal: true }] }], timeModel: [{ type: i0.ViewChild, args: ['timeModel', { isSignal: true }] }], inputModel: [{ type: i0.ViewChild, args: ['dateInputModel', { isSignal: true }] }] } });
488
+ }], ctorParameters: () => [], propDecorators: { timeLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeLabel", required: false }] }], dateRestriction: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateRestriction", required: false }] }], timeFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeFormat", required: false }] }], dateTimeValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateTimeValue", required: false }] }, { type: i0.Output, args: ["dateTimeValueChange"] }], dateModel: [{ type: i0.ViewChild, args: ['dateModel', { isSignal: true }] }], timeModel: [{ type: i0.ViewChild, args: ['timeModel', { isSignal: true }] }], inputModel: [{ type: i0.ViewChild, args: ['dateInputModel', { isSignal: true }] }] } });
426
489
 
427
490
  class NettyUIDatePicker extends UiBase {
428
491
  // Constants
429
492
  NULL_DATE = '1900-01-01T00:00:00.000Z'; // Null date in UTC format
430
- // Inputs
493
+ // Services
494
+ _dateAdapter = inject(DateAdapter);
495
+ // State Management
431
496
  dateRestriction = input('any', ...(ngDevMode ? [{ debugName: "dateRestriction" }] : []));
432
- // Model and Signals
433
497
  dateValue = model(null, ...(ngDevMode ? [{ debugName: "dateValue" }] : []));
434
498
  selectedDate = model(null, ...(ngDevMode ? [{ debugName: "selectedDate" }] : []));
435
499
  displayValue = signal(null, ...(ngDevMode ? [{ debugName: "displayValue" }] : []));
436
- // Date limits
500
+ timeFormat = input('tr-TR', ...(ngDevMode ? [{ debugName: "timeFormat" }] : []));
437
501
  minDate = signal(null, ...(ngDevMode ? [{ debugName: "minDate" }] : []));
438
502
  maxDate = signal(null, ...(ngDevMode ? [{ debugName: "maxDate" }] : []));
439
503
  constructor() {
440
504
  super();
505
+ effect(() => {
506
+ const locale = this.timeFormat();
507
+ this._dateAdapter.setLocale(locale);
508
+ });
441
509
  // Update displayValue and dateValue when selected date changes
442
510
  effect(() => {
443
511
  const date = this.selectedDate();
@@ -519,80 +587,37 @@ class NettyUIDatePicker extends UiBase {
519
587
  * @param event The blur event from the input element.
520
588
  */
521
589
  onInputBlur(event) {
522
- const input = event.target;
523
- const value = input.value;
524
- if (!value || value.trim() === '') {
525
- return;
526
- }
527
- // If it's just a number or D/M format, try to complete it
528
- const parsedDate = this.parsePartialDate(value);
529
- if (parsedDate) {
530
- this.selectedDate.set(parsedDate);
531
- this.onChange(parsedDate.toISOString());
532
- this.onTouched();
533
- }
534
- }
535
- parsePartialDate(value) {
536
- // Normalize separators
537
- const normalized = value.replace(/[.\-]/g, '/');
538
- const parts = normalized.split('/');
539
- if (parts.length > 2) {
540
- return null; // Let the default parser handle full dates
541
- }
542
- const today = new Date();
543
- let day = today.getDate();
544
- let month = today.getMonth();
545
- let year = today.getFullYear();
546
- if (parts.length === 1) {
547
- // Only "D" provided
548
- const d = parseInt(parts[0], 10);
549
- if (isNaN(d) || d < 1 || d > 31)
550
- return null;
551
- day = d;
552
- }
553
- else if (parts.length === 2) {
554
- // "D/M" provided
555
- const d = parseInt(parts[0], 10);
556
- const m = parseInt(parts[1], 10);
557
- if (isNaN(d) || isNaN(m) || d < 1 || d > 31 || m < 1 || m > 12)
558
- return null;
559
- day = d;
560
- month = m - 1;
561
- }
562
- // Create local date to validate day of month (e.g. Feb 30)
563
- const date = new Date(year, month, day);
564
- if (isNaN(date.getTime()) ||
565
- date.getDate() !== day ||
566
- date.getMonth() !== month) {
567
- return null;
568
- }
569
- // Convert to UTC as the component expects
570
- const utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
571
- // Check restrictions
572
- if (!this.isDateValid(utcDate)) {
573
- return null;
574
- }
575
- return utcDate;
590
+ this.onTouched();
576
591
  }
577
592
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyUIDatePicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
578
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.2", type: NettyUIDatePicker, isStandalone: true, selector: "ntyui-date-picker", inputs: { dateRestriction: { classPropertyName: "dateRestriction", publicName: "dateRestriction", isSignal: true, isRequired: false, transformFunction: null }, dateValue: { classPropertyName: "dateValue", publicName: "dateValue", isSignal: true, isRequired: false, transformFunction: null }, selectedDate: { classPropertyName: "selectedDate", publicName: "selectedDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateValue: "dateValueChange", selectedDate: "selectedDateChange" }, host: { attributes: { "ntyui-id": "NettyUIDatePicker" } }, providers: [
593
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.2", type: NettyUIDatePicker, isStandalone: true, selector: "ntyui-date-picker", inputs: { dateRestriction: { classPropertyName: "dateRestriction", publicName: "dateRestriction", isSignal: true, isRequired: false, transformFunction: null }, dateValue: { classPropertyName: "dateValue", publicName: "dateValue", isSignal: true, isRequired: false, transformFunction: null }, selectedDate: { classPropertyName: "selectedDate", publicName: "selectedDate", isSignal: true, isRequired: false, transformFunction: null }, timeFormat: { classPropertyName: "timeFormat", publicName: "timeFormat", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateValue: "dateValueChange", selectedDate: "selectedDateChange" }, host: { attributes: { "ntyui-id": "NettyUIDatePicker" } }, providers: [
594
+ provideNativeDateAdapter(),
579
595
  {
580
596
  provide: NG_VALUE_ACCESSOR,
581
597
  useExisting: NettyUIDatePicker,
582
598
  multi: true,
583
599
  },
600
+ {
601
+ provide: DateAdapter,
602
+ useClass: PartialDateAdapter
603
+ }
584
604
  ], usesInheritance: true, ngImport: i0, template: "<mat-form-field\n [appearance]=\"appearance()\"\n class=\"example-full-width\"\n [class.required-field]=\"required()\"\n [class.required-with-value]=\"required() && selectedDate()\"\n>\n @if (label()) {\n <mat-label>{{ label() }}</mat-label>\n }\n\n <input\n #inputModel=\"ngModel\"\n matInput\n [matDatepicker]=\"picker\"\n [placeholder]=\"placeholder()\"\n [(ngModel)]=\"selectedDate\"\n (dateChange)=\"onDateChange($event)\"\n (blur)=\"onInputBlur($event)\"\n [min]=\"minDate() ?? undefined\"\n [max]=\"maxDate() ?? undefined\"\n />\n\n <button\n mat-icon-button\n matSuffix\n [class.invisible]=\"!selectedDate() || disabled()\"\n (click)=\"clearInput()\"\n aria-label=\"Clear\"\n class=\"clear-btn date-clear\"\n >\n <mat-icon>cancel</mat-icon>\n </button>\n\n @if (inputModel.invalid && (inputModel.dirty || inputModel.touched)) {\n <mat-error> {{ getErrorMessage() }} </mat-error>\n }\n\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n</mat-form-field>\n", styles: [".example-full-width{width:100%;max-width:500px}.mat-mdc-form-field-subscript-wrapper{width:auto;height:0}.clear-btn{background:none;border:none;box-shadow:none;cursor:pointer}.search-icon{background:none;border:none;box-shadow:none;opacity:1;cursor:pointer}.search-icon:hover,.clear-btn:hover{color:var(--mat-sys-primary)}.required-field{background-color:var(--mat-sys-required)}.required-with-value{background-color:transparent!important}::ng-deep .circle .mdc-checkbox__background{border-radius:50%!important}::ng-deep .circle .mdc-checkbox__background:before{border-radius:50%!important}.mat-datepicker-toggle{margin-right:5px}.clear-btn{opacity:1;transition:opacity .2s}.clear-btn.invisible{opacity:0;pointer-events:none}.mat-form-field-suffix{display:flex;align-items:center;gap:4px}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i4$1.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i4$1.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i4$1.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "ngmodule", type: MatNativeDateModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
585
605
  }
586
606
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyUIDatePicker, decorators: [{
587
607
  type: Component,
588
608
  args: [{ selector: 'ntyui-date-picker', imports: [FormsModule, MatFormFieldModule, MatInputModule, ReactiveFormsModule, MatDatepickerModule, MatNativeDateModule, MatIconModule], providers: [
609
+ provideNativeDateAdapter(),
589
610
  {
590
611
  provide: NG_VALUE_ACCESSOR,
591
612
  useExisting: NettyUIDatePicker,
592
613
  multi: true,
593
614
  },
615
+ {
616
+ provide: DateAdapter,
617
+ useClass: PartialDateAdapter
618
+ }
594
619
  ], host: { 'ntyui-id': 'NettyUIDatePicker' }, template: "<mat-form-field\n [appearance]=\"appearance()\"\n class=\"example-full-width\"\n [class.required-field]=\"required()\"\n [class.required-with-value]=\"required() && selectedDate()\"\n>\n @if (label()) {\n <mat-label>{{ label() }}</mat-label>\n }\n\n <input\n #inputModel=\"ngModel\"\n matInput\n [matDatepicker]=\"picker\"\n [placeholder]=\"placeholder()\"\n [(ngModel)]=\"selectedDate\"\n (dateChange)=\"onDateChange($event)\"\n (blur)=\"onInputBlur($event)\"\n [min]=\"minDate() ?? undefined\"\n [max]=\"maxDate() ?? undefined\"\n />\n\n <button\n mat-icon-button\n matSuffix\n [class.invisible]=\"!selectedDate() || disabled()\"\n (click)=\"clearInput()\"\n aria-label=\"Clear\"\n class=\"clear-btn date-clear\"\n >\n <mat-icon>cancel</mat-icon>\n </button>\n\n @if (inputModel.invalid && (inputModel.dirty || inputModel.touched)) {\n <mat-error> {{ getErrorMessage() }} </mat-error>\n }\n\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n</mat-form-field>\n", styles: [".example-full-width{width:100%;max-width:500px}.mat-mdc-form-field-subscript-wrapper{width:auto;height:0}.clear-btn{background:none;border:none;box-shadow:none;cursor:pointer}.search-icon{background:none;border:none;box-shadow:none;opacity:1;cursor:pointer}.search-icon:hover,.clear-btn:hover{color:var(--mat-sys-primary)}.required-field{background-color:var(--mat-sys-required)}.required-with-value{background-color:transparent!important}::ng-deep .circle .mdc-checkbox__background{border-radius:50%!important}::ng-deep .circle .mdc-checkbox__background:before{border-radius:50%!important}.mat-datepicker-toggle{margin-right:5px}.clear-btn{opacity:1;transition:opacity .2s}.clear-btn.invisible{opacity:0;pointer-events:none}.mat-form-field-suffix{display:flex;align-items:center;gap:4px}\n"] }]
595
- }], ctorParameters: () => [], propDecorators: { dateRestriction: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateRestriction", required: false }] }], dateValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateValue", required: false }] }, { type: i0.Output, args: ["dateValueChange"] }], selectedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedDate", required: false }] }, { type: i0.Output, args: ["selectedDateChange"] }] } });
620
+ }], ctorParameters: () => [], propDecorators: { dateRestriction: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateRestriction", required: false }] }], dateValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateValue", required: false }] }, { type: i0.Output, args: ["dateValueChange"] }], selectedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedDate", required: false }] }, { type: i0.Output, args: ["selectedDateChange"] }], timeFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeFormat", required: false }] }] } });
596
621
 
597
622
  class NettyUIMaskedInput extends UiBase {
598
623
  // Input properties
@@ -1024,8 +1049,8 @@ class NettyUINumberInput extends UiBase {
1024
1049
  this.value.set(result.toString());
1025
1050
  }
1026
1051
  catch (e) {
1027
- console.error('Hesaplama hatası:', e);
1028
- this.value.set('Geçersiz ifade girdiniz.');
1052
+ this.alertService.showError('Hesaplama hatası:', e);
1053
+ this.value.set('Geçersiz ifade girdiniz');
1029
1054
  setTimeout(() => {
1030
1055
  this.value.set('');
1031
1056
  }, 2000);
@@ -1598,21 +1623,31 @@ class NettyuUIDateTimeRange extends UiBase {
1598
1623
  }
1599
1624
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyuUIDateTimeRange, deps: [], target: i0.ɵɵFactoryTarget.Component });
1600
1625
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.2", type: NettyuUIDateTimeRange, isStandalone: true, selector: "ntyui-date-time-range", inputs: { endValue: { classPropertyName: "endValue", publicName: "endValue", isSignal: true, isRequired: false, transformFunction: null }, endLabel: { classPropertyName: "endLabel", publicName: "endLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { endValue: "endValueChange" }, providers: [
1626
+ provideNativeDateAdapter(),
1601
1627
  {
1602
1628
  provide: NG_VALUE_ACCESSOR,
1603
1629
  useExisting: NettyuUIDateTimeRange,
1604
1630
  multi: true,
1605
1631
  },
1606
- ], usesInheritance: true, ngImport: i0, template: "<div class=\"datetime-range-wrapper\">\n <div class=\"range-field\">\n <ntyui-date-time\n [label]=\"label()\"\n [appearance]=\"appearance()\"\n [required]=\"required()\"\n [forFilter]=\"forFilter()\"\n [disabled]=\"disabled()\"\n [(ngModel)]=\"value\"\n ></ntyui-date-time>\n </div>\n\n <div class=\"range-separator\">\n <span class=\"dash\">\u2014</span>\n </div>\n\n <div class=\"range-field\">\n <ntyui-date-time\n [label]=\"endLabel() || label()\"\n [appearance]=\"appearance()\"\n [required]=\"required()\"\n [forFilter]=\"forFilter()\"\n [disabled]=\"disabled()\"\n [(ngModel)]=\"endValue\"\n ></ntyui-date-time>\n </div>\n</div>", styles: [".datetime-range-wrapper{display:flex;flex-direction:row;align-items:flex-start;gap:12px;width:100%}.datetime-range-wrapper .range-field{flex:1;min-width:0}.datetime-range-wrapper .range-separator{display:flex;align-items:center;height:56px;color:#00000061;font-weight:700}@media(max-width:768px){.datetime-range-wrapper{flex-direction:column;gap:0}.datetime-range-wrapper .range-separator{display:none}}\n"], dependencies: [{ kind: "component", type: NettyUIDateTime, selector: "ntyui-date-time", inputs: ["dateTimeValue", "timeLabel", "dateRestriction", "timeFormat"], outputs: ["dateTimeValueChange"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
1632
+ {
1633
+ provide: DateAdapter,
1634
+ useClass: PartialDateAdapter
1635
+ }
1636
+ ], usesInheritance: true, ngImport: i0, template: "<div class=\"datetime-range-wrapper\">\n <div class=\"range-field\">\n <ntyui-date-time\n [label]=\"label()\"\n [appearance]=\"appearance()\"\n [required]=\"required()\"\n [forFilter]=\"forFilter()\"\n [disabled]=\"disabled()\"\n [(ngModel)]=\"value\"\n ></ntyui-date-time>\n </div>\n\n <div class=\"range-separator\">\n <span class=\"dash\">\u2014</span>\n </div>\n\n <div class=\"range-field\">\n <ntyui-date-time\n [label]=\"endLabel() || label()\"\n [appearance]=\"appearance()\"\n [required]=\"required()\"\n [forFilter]=\"forFilter()\"\n [disabled]=\"disabled()\"\n [(ngModel)]=\"endValue\"\n ></ntyui-date-time>\n </div>\n</div>", styles: [".datetime-range-wrapper{display:flex;flex-direction:row;align-items:flex-start;gap:12px;width:100%}.datetime-range-wrapper .range-field{flex:1;min-width:0}.datetime-range-wrapper .range-separator{display:flex;align-items:center;height:56px;color:#00000061;font-weight:700}@media(max-width:768px){.datetime-range-wrapper{flex-direction:column;gap:0}.datetime-range-wrapper .range-separator{display:none}}\n"], dependencies: [{ kind: "component", type: NettyUIDateTime, selector: "ntyui-date-time", inputs: ["timeLabel", "dateRestriction", "timeFormat", "dateTimeValue"], outputs: ["dateTimeValueChange"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
1607
1637
  }
1608
1638
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NettyuUIDateTimeRange, decorators: [{
1609
1639
  type: Component,
1610
1640
  args: [{ selector: 'ntyui-date-time-range', imports: [NettyUIDateTime, FormsModule], providers: [
1641
+ provideNativeDateAdapter(),
1611
1642
  {
1612
1643
  provide: NG_VALUE_ACCESSOR,
1613
1644
  useExisting: NettyuUIDateTimeRange,
1614
1645
  multi: true,
1615
1646
  },
1647
+ {
1648
+ provide: DateAdapter,
1649
+ useClass: PartialDateAdapter
1650
+ }
1616
1651
  ], template: "<div class=\"datetime-range-wrapper\">\n <div class=\"range-field\">\n <ntyui-date-time\n [label]=\"label()\"\n [appearance]=\"appearance()\"\n [required]=\"required()\"\n [forFilter]=\"forFilter()\"\n [disabled]=\"disabled()\"\n [(ngModel)]=\"value\"\n ></ntyui-date-time>\n </div>\n\n <div class=\"range-separator\">\n <span class=\"dash\">\u2014</span>\n </div>\n\n <div class=\"range-field\">\n <ntyui-date-time\n [label]=\"endLabel() || label()\"\n [appearance]=\"appearance()\"\n [required]=\"required()\"\n [forFilter]=\"forFilter()\"\n [disabled]=\"disabled()\"\n [(ngModel)]=\"endValue\"\n ></ntyui-date-time>\n </div>\n</div>", styles: [".datetime-range-wrapper{display:flex;flex-direction:row;align-items:flex-start;gap:12px;width:100%}.datetime-range-wrapper .range-field{flex:1;min-width:0}.datetime-range-wrapper .range-separator{display:flex;align-items:center;height:56px;color:#00000061;font-weight:700}@media(max-width:768px){.datetime-range-wrapper{flex-direction:column;gap:0}.datetime-range-wrapper .range-separator{display:none}}\n"] }]
1617
1652
  }], ctorParameters: () => [], propDecorators: { endValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "endValue", required: false }] }, { type: i0.Output, args: ["endValueChange"] }], endLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "endLabel", required: false }] }] } });
1618
1653