@shival99/z-ui 2.5.9 → 2.5.10

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.
Files changed (27) hide show
  1. package/fesm2022/shival99-z-ui-components-z-autocomplete.mjs +24 -0
  2. package/fesm2022/shival99-z-ui-components-z-autocomplete.mjs.map +1 -1
  3. package/fesm2022/shival99-z-ui-components-z-calendar.mjs +1 -1
  4. package/fesm2022/shival99-z-ui-components-z-calendar.mjs.map +1 -1
  5. package/fesm2022/shival99-z-ui-components-z-input.mjs +1 -1
  6. package/fesm2022/shival99-z-ui-components-z-input.mjs.map +1 -1
  7. package/fesm2022/shival99-z-ui-components-z-kanban.mjs +1 -1
  8. package/fesm2022/shival99-z-ui-components-z-kanban.mjs.map +1 -1
  9. package/fesm2022/shival99-z-ui-components-z-pagination.mjs +1 -1
  10. package/fesm2022/shival99-z-ui-components-z-pagination.mjs.map +1 -1
  11. package/fesm2022/shival99-z-ui-components-z-select.mjs +234 -11
  12. package/fesm2022/shival99-z-ui-components-z-select.mjs.map +1 -1
  13. package/fesm2022/shival99-z-ui-components-z-table.mjs +3 -3
  14. package/fesm2022/shival99-z-ui-components-z-table.mjs.map +1 -1
  15. package/fesm2022/shival99-z-ui-components-z-tabs.mjs +7 -3
  16. package/fesm2022/shival99-z-ui-components-z-tabs.mjs.map +1 -1
  17. package/fesm2022/shival99-z-ui-components-z-tags.mjs +10 -21
  18. package/fesm2022/shival99-z-ui-components-z-tags.mjs.map +1 -1
  19. package/package.json +1 -1
  20. package/types/shival99-z-ui-components-z-autocomplete.d.ts +2 -0
  21. package/types/shival99-z-ui-components-z-editor.d.ts +1 -1
  22. package/types/shival99-z-ui-components-z-modal.d.ts +1 -1
  23. package/types/shival99-z-ui-components-z-select.d.ts +25 -4
  24. package/types/shival99-z-ui-components-z-table.d.ts +1 -1
  25. package/types/shival99-z-ui-components-z-tabs.d.ts +2 -1
  26. package/types/shival99-z-ui-components-z-tags.d.ts +3 -4
  27. package/types/shival99-z-ui-components-z-upload.d.ts +3 -3
@@ -426,6 +426,7 @@ class ZAutocompleteComponent {
426
426
  _onTouched = () => void 0;
427
427
  _ngControl = null;
428
428
  _isNavigationFilling = false;
429
+ _hasPendingInput = false;
429
430
  constructor() {
430
431
  effect(onCleanup => {
431
432
  const triggerEl = this.triggerRef()?.nativeElement;
@@ -534,6 +535,7 @@ class ZAutocompleteComponent {
534
535
  this._value.set(value ?? '');
535
536
  this.inputValue.set(value ?? '');
536
537
  this.debouncedQuery.set(value ?? '');
538
+ this._hasPendingInput = false;
537
539
  if (this.zType() === 'address_bar') {
538
540
  this.searchQuery.set(value ?? '');
539
541
  }
@@ -553,6 +555,7 @@ class ZAutocompleteComponent {
553
555
  this._pendingSearch.set(false);
554
556
  this.inputValue.set(value);
555
557
  this._value.set(value);
558
+ this._hasPendingInput = true;
556
559
  this.uiState.update(s => ({ ...s, dirty: true }));
557
560
  this._onChange(value);
558
561
  if (!this._isNavigationFilling) {
@@ -649,6 +652,10 @@ class ZAutocompleteComponent {
649
652
  event.preventDefault();
650
653
  if (isAddressBarMode && this._valueBeforeNavigation !== null) {
651
654
  this._revertToValueBeforeNavigation();
655
+ this._hasPendingInput = false;
656
+ }
657
+ else {
658
+ this._cancelPendingInput();
652
659
  }
653
660
  this._valueBeforeNavigation = null;
654
661
  this._closePanel();
@@ -721,6 +728,7 @@ class ZAutocompleteComponent {
721
728
  }, 0);
722
729
  }
723
730
  _resetInput() {
731
+ this._hasPendingInput = false;
724
732
  if (!this.zResetOnSelect()) {
725
733
  this._closePanel();
726
734
  this.activeIndex.set(-1);
@@ -755,6 +763,7 @@ class ZAutocompleteComponent {
755
763
  }, 50);
756
764
  }
757
765
  onPopoverHideStart() {
766
+ this._cancelPendingInput();
758
767
  this._openRequested = false;
759
768
  this.uiState.update(s => ({ ...s, isOpen: false }));
760
769
  this.activeIndex.set(-1);
@@ -779,6 +788,7 @@ class ZAutocompleteComponent {
779
788
  this.zOnSelect.emit(option);
780
789
  this._selectedOption.set(option);
781
790
  const newValue = this.zResetOnSelect() ? '' : option.label;
791
+ this._hasPendingInput = false;
782
792
  this.inputValue.set(newValue);
783
793
  this._value.set(newValue);
784
794
  this.debouncedQuery.set(newValue);
@@ -793,6 +803,7 @@ class ZAutocompleteComponent {
793
803
  clearInput(event) {
794
804
  event.stopPropagation();
795
805
  event.preventDefault();
806
+ this._hasPendingInput = false;
796
807
  this.inputValue.set('');
797
808
  this._value.set('');
798
809
  this.uiState.update(s => ({ ...s, dirty: true }));
@@ -833,9 +844,14 @@ class ZAutocompleteComponent {
833
844
  this.inputRef()?.nativeElement.blur();
834
845
  }
835
846
  clear() {
847
+ this._hasPendingInput = false;
836
848
  this.inputValue.set('');
837
849
  this._value.set('');
838
850
  this.debouncedQuery.set('');
851
+ const inputEl = this.inputRef()?.nativeElement;
852
+ if (inputEl) {
853
+ inputEl.value = '';
854
+ }
839
855
  this._onChange('');
840
856
  this.zValueChange.emit('');
841
857
  this._selectedOption.set(null);
@@ -858,6 +874,7 @@ class ZAutocompleteComponent {
858
874
  this._closePanel();
859
875
  }
860
876
  setValue(value) {
877
+ this._hasPendingInput = false;
861
878
  this._value.set(value);
862
879
  this.inputValue.set(value);
863
880
  this.debouncedQuery.set(value);
@@ -877,6 +894,13 @@ class ZAutocompleteComponent {
877
894
  _closePanel() {
878
895
  this._popoverControl()?.close();
879
896
  }
897
+ _cancelPendingInput() {
898
+ if (!this._hasPendingInput) {
899
+ return;
900
+ }
901
+ this._hasPendingInput = false;
902
+ this.clear();
903
+ }
880
904
  _setupDebounce() {
881
905
  this._query$
882
906
  .pipe(debounceTime(this.effectiveDebounceTime()), distinctUntilChanged(), takeUntilDestroyed(this._destroyRef))