@vsn-ux/ngx-gaia 0.9.7 → 0.9.9

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/DOCS.md CHANGED
@@ -221,6 +221,11 @@ Input directive for datepicker integration.
221
221
  - `min: any` - Minimum date constraint
222
222
  - `max: any` - Maximum date constraint
223
223
 
224
+ #### Outputs:
225
+
226
+ - `dateChange(value: any)` - Emitted when the input loses focus (blur) and the date has changed
227
+ - `dateInput(value: any)` - Emitted immediately when the user types in the text input and the parsed value changes
228
+
224
229
  ### `<ga-datepicker-toggle>`
225
230
 
226
231
  Toggle button component for opening datepicker.
@@ -1067,7 +1067,7 @@ class GaDatepickerComponent {
1067
1067
  return Array.from({ length: 25 }, (_, i) => startYear + i - 1);
1068
1068
  });
1069
1069
  selectDate(dateStruct) {
1070
- if (this.isDateDisabled(dateStruct)) {
1070
+ if (this.isDateDisabled(dateStruct) || this.isSelected(dateStruct)) {
1071
1071
  return;
1072
1072
  }
1073
1073
  const externalValue = this.valueAdapter.fromStruct(dateStruct);
@@ -1680,15 +1680,18 @@ class GaDatepickerInputDirective {
1680
1680
  value = linkedSignal(() => this.valueInput());
1681
1681
  dateStruct = computed(() => this.valueAdapter.toStruct(this.value()));
1682
1682
  disabled = linkedSignal(() => !!this.disabledInput());
1683
- lastEmittedStruct = signal(null);
1684
1683
  lastValueValid = signal(false);
1684
+ lastDateChangeEmittedValue = signal(null);
1685
1685
  onNgChangeFn;
1686
1686
  onNgTouchedFn;
1687
1687
  constructor() {
1688
1688
  effect(() => {
1689
1689
  this.valueInput(); // explicit call to track value input changes
1690
1690
  this.lastValueValid.set(true);
1691
- untracked(() => this.formatValue());
1691
+ untracked(() => {
1692
+ this.lastDateChangeEmittedValue.set(this.dateStruct());
1693
+ this.formatValue();
1694
+ });
1692
1695
  });
1693
1696
  }
1694
1697
  onInput(event) {
@@ -1708,9 +1711,9 @@ class GaDatepickerInputDirective {
1708
1711
  if (this.dateStruct()) {
1709
1712
  this.formatValue();
1710
1713
  }
1711
- if (compareStructs(this.dateStruct(), this.lastEmittedStruct()) !== 0) {
1714
+ if (compareStructs(this.dateStruct(), this.lastDateChangeEmittedValue()) !== 0) {
1712
1715
  this.dateChange.emit(this.value());
1713
- this.lastEmittedStruct.set(this.dateStruct());
1716
+ this.lastDateChangeEmittedValue.set(this.dateStruct());
1714
1717
  }
1715
1718
  this.onNgTouchedFn?.();
1716
1719
  }
@@ -1735,6 +1738,7 @@ class GaDatepickerInputDirective {
1735
1738
  // ControlValueAccessor implementation
1736
1739
  writeValue(value) {
1737
1740
  this.updateValue(value, { updateView: true });
1741
+ this.lastDateChangeEmittedValue.set(this.dateStruct());
1738
1742
  }
1739
1743
  registerOnChange(fn) {
1740
1744
  this.onNgChangeFn = fn;
@@ -4128,9 +4132,12 @@ class GaSelectComponent {
4128
4132
  scrollActiveOptionIntoView() {
4129
4133
  afterNextRender({
4130
4134
  mixedReadWrite: () => {
4131
- const activeOption = this.gaOptions().find((option) => option.active());
4135
+ const activeOption = this.gaOptions().find((option) => option.cdkOption.isActive());
4132
4136
  if (activeOption) {
4133
- activeOption.cdkOption.setActiveStyles();
4137
+ activeOption.cdkOption.element.scrollIntoView({
4138
+ block: 'nearest',
4139
+ inline: 'nearest',
4140
+ });
4134
4141
  }
4135
4142
  },
4136
4143
  }, { injector: this.injector });