@cauca-911/material 21.0.3 → 21.0.5

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 { Injectable, ChangeDetectionStrategy, Component, input, output, signal, inject, HostListener, computed, Injector, ElementRef, Directive, forwardRef, model, TemplateRef, Input, Optional, Self, ContentChild, ViewChild, resource, effect, NgModule, EventEmitter, Output } from '@angular/core';
2
+ import { Injectable, ChangeDetectionStrategy, Component, input, output, signal, inject, HostListener, model, computed, Injector, ElementRef, Directive, forwardRef, TemplateRef, Input, Optional, Self, ContentChild, ViewChild, resource, effect, NgModule, EventEmitter, Output } from '@angular/core';
3
3
  import * as i1 from '@ngx-translate/core';
4
4
  import { TranslateModule, TranslatePipe, TranslateService } from '@ngx-translate/core';
5
5
  import * as i1$5 from '@angular/material/dialog';
@@ -538,6 +538,7 @@ function CaucaDateTimePickerComponent_Conditional_1_Template(rf, ctx) { if (rf &
538
538
  } }
539
539
  class CaucaDateTimePickerComponent {
540
540
  constructor() {
541
+ this.value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
541
542
  this.subscriptSizing = input('fixed', ...(ngDevMode ? [{ debugName: "subscriptSizing" }] : []));
542
543
  this.showTime = input(true, ...(ngDevMode ? [{ debugName: "showTime" }] : []));
543
544
  this.label = input('', ...(ngDevMode ? [{ debugName: "label" }] : []));
@@ -552,7 +553,7 @@ class CaucaDateTimePickerComponent {
552
553
  this.showClearButton = input(true, ...(ngDevMode ? [{ debugName: "showClearButton" }] : []));
553
554
  this.showButtonIcons = input(true, ...(ngDevMode ? [{ debugName: "showButtonIcons" }] : []));
554
555
  this.selectedChange = output();
555
- this.stringDate = signal('', ...(ngDevMode ? [{ debugName: "stringDate" }] : []));
556
+ this.stringDate = computed(() => this.value() ? this.stringifyDate(this.value()) : '', ...(ngDevMode ? [{ debugName: "stringDate" }] : []));
556
557
  this.isRequired = computed(() => Boolean(this.control?.hasValidator(Validators.required)), ...(ngDevMode ? [{ debugName: "isRequired" }] : []));
557
558
  this.injector = inject(Injector);
558
559
  this.elementRef = inject(ElementRef);
@@ -561,12 +562,6 @@ class CaucaDateTimePickerComponent {
561
562
  this.onChange = (value) => value;
562
563
  this.onTouched = () => { };
563
564
  }
564
- set value(value) {
565
- if (value) {
566
- this.stringDate.set(this.stringifyDate(value));
567
- this.selectedDate = value;
568
- }
569
- }
570
565
  ngOnInit() {
571
566
  const ngControl = this.injector.get(NgControl, null, { self: true, optional: true });
572
567
  if (ngControl instanceof FormControlName) {
@@ -585,15 +580,14 @@ class CaucaDateTimePickerComponent {
585
580
  });
586
581
  dialogRef.afterClosed().subscribe((data) => {
587
582
  if (data) {
588
- this.stringDate.set(this.stringifyDate(data.value));
589
- this.selectedDate = data.value;
583
+ this.value.set(data.value);
590
584
  this.selectedChange.emit(data.value);
591
585
  this.onChange(data.value);
592
586
  }
593
587
  });
594
588
  }
595
589
  writeValue(date) {
596
- this.value = date;
590
+ this.value.set(date);
597
591
  }
598
592
  registerOnChange(fn) {
599
593
  this.onChange = fn;
@@ -603,7 +597,7 @@ class CaucaDateTimePickerComponent {
603
597
  }
604
598
  getDateTimePickerOptions() {
605
599
  return {
606
- selectedDate: this.selectedDate,
600
+ selectedDate: this.value(),
607
601
  minimumDate: this.minimumDate(),
608
602
  maximumDate: this.maximumDate(),
609
603
  showSeconds: this.showSeconds(),
@@ -641,7 +635,7 @@ class CaucaDateTimePickerComponent {
641
635
  };
642
636
  }
643
637
  static { this.ɵfac = function CaucaDateTimePickerComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CaucaDateTimePickerComponent)(); }; }
644
- static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaucaDateTimePickerComponent, selectors: [["cauca-date-time-picker"]], inputs: { subscriptSizing: [1, "subscriptSizing"], showTime: [1, "showTime"], label: [1, "label"], translateLabel: [1, "translateLabel"], stepHours: [1, "stepHours"], stepMinutes: [1, "stepMinutes"], stepSecondes: [1, "stepSecondes"], minimumDate: [1, "minimumDate"], maximumDate: [1, "maximumDate"], showSeconds: [1, "showSeconds"], showFormat: [1, "showFormat"], showClearButton: [1, "showClearButton"], showButtonIcons: [1, "showButtonIcons"] }, outputs: { selectedChange: "selectedChange" }, features: [i0.ɵɵProvidersFeature([
638
+ static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CaucaDateTimePickerComponent, selectors: [["cauca-date-time-picker"]], inputs: { value: [1, "value"], subscriptSizing: [1, "subscriptSizing"], showTime: [1, "showTime"], label: [1, "label"], translateLabel: [1, "translateLabel"], stepHours: [1, "stepHours"], stepMinutes: [1, "stepMinutes"], stepSecondes: [1, "stepSecondes"], minimumDate: [1, "minimumDate"], maximumDate: [1, "maximumDate"], showSeconds: [1, "showSeconds"], showFormat: [1, "showFormat"], showClearButton: [1, "showClearButton"], showButtonIcons: [1, "showButtonIcons"] }, outputs: { value: "valueChange", selectedChange: "selectedChange" }, features: [i0.ɵɵProvidersFeature([
645
639
  DatePipe,
646
640
  {
647
641
  provide: NG_VALUE_ACCESSOR,
@@ -684,7 +678,7 @@ class CaucaDateTimePickerComponent {
684
678
  useExisting: CaucaDateTimePickerComponent,
685
679
  }
686
680
  ], template: "<mat-form-field [subscriptSizing]=\"subscriptSizing()\">\n @if (label()) {\n <mat-label>{{ translateLabel() ? (label() | translate) : label() }}{{isRequired() ? '*' : ''}}</mat-label>\n }\n <input (focusout)=\"onTouched()\" matInput [value]=\"stringDate()\" readonly=\"readonly\">\n <button matSuffix mat-icon-button (click)=\"showDialog()\">\n <mat-icon>calendar_month</mat-icon>\n </button>\n</mat-form-field>", styles: [":host{display:block}mat-form-field{width:100%}\n"] }]
687
- }], null, { subscriptSizing: [{ type: i0.Input, args: [{ isSignal: true, alias: "subscriptSizing", required: false }] }], showTime: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTime", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], translateLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "translateLabel", required: false }] }], stepHours: [{ type: i0.Input, args: [{ isSignal: true, alias: "stepHours", required: false }] }], stepMinutes: [{ type: i0.Input, args: [{ isSignal: true, alias: "stepMinutes", required: false }] }], stepSecondes: [{ type: i0.Input, args: [{ isSignal: true, alias: "stepSecondes", required: false }] }], minimumDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minimumDate", required: false }] }], maximumDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maximumDate", required: false }] }], showSeconds: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSeconds", required: false }] }], showFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "showFormat", required: false }] }], showClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearButton", required: false }] }], showButtonIcons: [{ type: i0.Input, args: [{ isSignal: true, alias: "showButtonIcons", required: false }] }], selectedChange: [{ type: i0.Output, args: ["selectedChange"] }] }); })();
681
+ }], null, { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], subscriptSizing: [{ type: i0.Input, args: [{ isSignal: true, alias: "subscriptSizing", required: false }] }], showTime: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTime", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], translateLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "translateLabel", required: false }] }], stepHours: [{ type: i0.Input, args: [{ isSignal: true, alias: "stepHours", required: false }] }], stepMinutes: [{ type: i0.Input, args: [{ isSignal: true, alias: "stepMinutes", required: false }] }], stepSecondes: [{ type: i0.Input, args: [{ isSignal: true, alias: "stepSecondes", required: false }] }], minimumDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minimumDate", required: false }] }], maximumDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maximumDate", required: false }] }], showSeconds: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSeconds", required: false }] }], showFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "showFormat", required: false }] }], showClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearButton", required: false }] }], showButtonIcons: [{ type: i0.Input, args: [{ isSignal: true, alias: "showButtonIcons", required: false }] }], selectedChange: [{ type: i0.Output, args: ["selectedChange"] }] }); })();
688
682
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CaucaDateTimePickerComponent, { className: "CaucaDateTimePickerComponent", filePath: "lib/components/cauca-date-time-picker/cauca-date-time-picker.component.ts", lineNumber: 34 }); })();
689
683
 
690
684
  class BaseButton {