@dev-tcloud/tcloud-ui 6.21.8 → 6.22.1

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.
@@ -711,7 +711,7 @@ class TCloudUiDataListComponent {
711
711
  this.toChange();
712
712
  }
713
713
  }
714
- get disabled() { return this._disabled; }
714
+ get disabled() { return this._disabled || this._disabledByForm; }
715
715
  set loading(v) {
716
716
  if (typeof v === 'boolean' && v !== this._loading) {
717
717
  this._loading = v;
@@ -751,6 +751,7 @@ class TCloudUiDataListComponent {
751
751
  this.menu_on_top = '';
752
752
  this.placeholder = '';
753
753
  this._disabled = false;
754
+ this._disabledByForm = false;
754
755
  this._loading = false;
755
756
  this.showInput = true;
756
757
  this.search = true;
@@ -772,7 +773,7 @@ class TCloudUiDataListComponent {
772
773
  this.onChangeCallback = noop$8;
773
774
  this.subscription_value = this.dataListService.stateValue$.subscribe(v => {
774
775
  this.selected_item = v;
775
- this.selectDescription();
776
+ this.selectDescription(true);
776
777
  this.ngModelChange.emit(this.selected_item);
777
778
  });
778
779
  this.subscription_description = this.dataListService.stateDescription$.subscribe(v => {
@@ -846,27 +847,27 @@ class TCloudUiDataListComponent {
846
847
  }
847
848
  }
848
849
  }
849
- selectDescription() {
850
+ selectDescription(propagateForm = false) {
850
851
  if (this.list_selected_options && (this.list_selected_options).length > 0) {
851
852
  for (let i = 0; i < (this.list_selected_options).length; i++) {
852
853
  const item = this.list_selected_options[i];
853
854
  if (item.value === this.selected_item) {
854
855
  this.selected_description = item.description;
855
- this.toChange();
856
+ this.toChange(propagateForm);
856
857
  return;
857
858
  }
858
859
  }
859
860
  }
860
861
  if (this.selected_item === undefined || this.selected_item === null || this.selected_item === '') {
861
862
  this.selected_description = '';
862
- this.toChange();
863
+ this.toChange(propagateForm);
863
864
  }
864
865
  }
865
866
  toInput(e) {
866
867
  this.onInputChange.emit(this.selected_description);
867
868
  this.onChange.emit(e);
868
869
  }
869
- toChange() {
870
+ toChange(propagateForm = false) {
870
871
  setTimeout(() => {
871
872
  if (this.selected_item === undefined || this.selected_item === null) {
872
873
  this.selected_item = '';
@@ -880,6 +881,9 @@ class TCloudUiDataListComponent {
880
881
  // const input_hidden = document.getElementById(`${this.id}-hidden`);
881
882
  this.toInput(this.formulario.get('selected_item'));
882
883
  }
884
+ if (propagateForm) {
885
+ this.onChangeCallback(this.selected_item);
886
+ }
883
887
  });
884
888
  }
885
889
  clearTextSearch() {
@@ -913,6 +917,7 @@ class TCloudUiDataListComponent {
913
917
  }
914
918
  toClose() {
915
919
  this.menu_show = false;
920
+ this.onTouchedCallback();
916
921
  this.onClosed.emit();
917
922
  }
918
923
  toResize() {
@@ -962,6 +967,9 @@ class TCloudUiDataListComponent {
962
967
  registerOnTouched(fn) {
963
968
  this.onTouchedCallback = fn;
964
969
  }
970
+ setDisabledState(isDisabled) {
971
+ this._disabledByForm = isDisabled;
972
+ }
965
973
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: TCloudUiDataListComponent, deps: [{ token: DataListService }, { token: i2.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
966
974
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: TCloudUiDataListComponent, isStandalone: true, selector: "tcloud-ui-data-list", inputs: { placeholder: "placeholder", disabled: "disabled", loading: "loading", showInput: "showInput", search: "search", listItems: "listItems", open: "open", border: "border", ngModel: "ngModel" }, outputs: { onInputChange: "onInputChange", onChange: "onChange", onOpened: "onOpened", onClosed: "onClosed", ngModelChange: "ngModelChange" }, providers: [
967
975
  DataListService,