@acorex/components 1.3.80 → 1.3.84

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.
@@ -14,6 +14,7 @@ import { trigger, state, style, transition, animate } from '@angular/animations'
14
14
  import { TextMaskModule } from 'angular2-text-mask';
15
15
  import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
16
16
  import { A11yModule } from '@angular/cdk/a11y';
17
+ import { differenceBy } from 'lodash';
17
18
  import { RouterModule } from '@angular/router';
18
19
 
19
20
  // @dynamic
@@ -7753,6 +7754,7 @@ let AXSelectBoxComponent = AXSelectBoxComponent_1 = class AXSelectBoxComponent e
7753
7754
  this.onBlur = new EventEmitter();
7754
7755
  this.onFocus = new EventEmitter();
7755
7756
  this._items = [];
7757
+ this.hasSelectedValue = false;
7756
7758
  this.itemsFiltered = [];
7757
7759
  // #endregion
7758
7760
  this.dropDownDisabled = false;
@@ -7782,6 +7784,7 @@ let AXSelectBoxComponent = AXSelectBoxComponent_1 = class AXSelectBoxComponent e
7782
7784
  if (this.itemsChange) {
7783
7785
  this.itemsChange.emit(v);
7784
7786
  }
7787
+ debugger;
7785
7788
  if (this.itemsStatusObserver) {
7786
7789
  this.itemsStatusObserver.next(this.items.length);
7787
7790
  }
@@ -7790,6 +7793,25 @@ let AXSelectBoxComponent = AXSelectBoxComponent_1 = class AXSelectBoxComponent e
7790
7793
  return this._selectedItems || [];
7791
7794
  }
7792
7795
  set selectedItems(v) {
7796
+ this.setSelectedItemsChange(v);
7797
+ // if (!v) {
7798
+ // v = [];
7799
+ // }
7800
+ // const old = this.selectedItems;
7801
+ // if (JSON.stringify(old) !== JSON.stringify(v)) {
7802
+ // this._selectedItems = this.mode == 'single' ? v.slice(0, 1) : [...new Set(v)]; //[...new Set(v[0])] : [...new Set(v)];
7803
+ // this._selectedItems.forEach((c) => (c.selected = true));
7804
+ // this.selectedItemsChange.emit(this._selectedItems);
7805
+ // this.selectedValuesChange.emit(this.selectedValues);
7806
+ // this.clearValidationStyle(this.ref.nativeElement);
7807
+ // this.waitForData(() => {
7808
+ // if (this._selectedItems) {
7809
+ // this.items.forEach((c) => (c.selected = this._selectedItems.some((i) => i[this.valueField] == c[this.valueField])));
7810
+ // }
7811
+ // });
7812
+ // }
7813
+ }
7814
+ setSelectedItemsChange(v) {
7793
7815
  if (!v) {
7794
7816
  v = [];
7795
7817
  }
@@ -7848,20 +7870,29 @@ let AXSelectBoxComponent = AXSelectBoxComponent_1 = class AXSelectBoxComponent e
7848
7870
  }
7849
7871
  }
7850
7872
  textChanged(e) {
7851
- // if((e.value === null || e.value=== undefined || e.value === "") && (e.oldValue === null || e.oldValue === undefined || e.oldValue === "")){
7852
- // }else{
7853
- this.currentfocusedIndex = -1;
7854
- if (this.remoteOperation) {
7855
- this.searchText = this.text;
7856
- // this.searchText = e.value;
7857
- // this.text = e.value;
7858
- this.items = [];
7859
- const params = {};
7860
- params.searchText = this.text;
7861
- // params.searchText = e.value;
7862
- params.skip = 0;
7863
- params.take = this.bufferSize;
7864
- this.fetch(params);
7873
+ if ((e.value === null || e.value === undefined || e.value === '') && (e.oldValue === null || e.oldValue === undefined || e.oldValue === '')) {
7874
+ }
7875
+ else {
7876
+ this.currentfocusedIndex = -1;
7877
+ if (this.remoteOperation) {
7878
+ this.searchText = this.text;
7879
+ // this.searchText = e.value;
7880
+ // this.text = e.value;
7881
+ // this.items = [];
7882
+ let t = this.items.length;
7883
+ for (let i = 0; i < t; i++) {
7884
+ this.items.pop();
7885
+ }
7886
+ // this.items.forEach((element) => {
7887
+ // this.items.pop();
7888
+ // });
7889
+ const params = {};
7890
+ params.searchText = this.text;
7891
+ // params.searchText = e.value;
7892
+ params.skip = 0;
7893
+ params.take = this.bufferSize;
7894
+ this.fetch(params);
7895
+ }
7865
7896
  }
7866
7897
  }
7867
7898
  onButtonClick(e) {
@@ -7923,6 +7954,9 @@ let AXSelectBoxComponent = AXSelectBoxComponent_1 = class AXSelectBoxComponent e
7923
7954
  }
7924
7955
  else {
7925
7956
  if (v !== undefined) {
7957
+ if (v != [] && v != '' && v != null) {
7958
+ this.hasSelectedValue = true;
7959
+ }
7926
7960
  this.waitForData(() => {
7927
7961
  if (this.mode === 'single') {
7928
7962
  if (this.items.filter((c) => v == c[this.valueField])) {
@@ -7934,7 +7968,26 @@ let AXSelectBoxComponent = AXSelectBoxComponent_1 = class AXSelectBoxComponent e
7934
7968
  }
7935
7969
  else {
7936
7970
  if (Array.isArray(v)) {
7937
- this.selectedItems = this.items.filter((c) => v.includes(c[this.valueField]));
7971
+ debugger;
7972
+ if (this.selectedItems.length > v.length) {
7973
+ this.selectedItems = this.selectedItems.filter((c) => v.includes(c[this.valueField]));
7974
+ }
7975
+ else {
7976
+ let addId = [];
7977
+ v.forEach((vId) => {
7978
+ addId.push({
7979
+ ID: vId
7980
+ });
7981
+ });
7982
+ let newId = differenceBy(addId, this.selectedItems, 'ID');
7983
+ let vv = [];
7984
+ newId.forEach((rc) => {
7985
+ vv.push(rc['ID']);
7986
+ });
7987
+ this.selectedItems.push(this.items.filter((c) => vv.includes(c[this.valueField]))[0]);
7988
+ this.setSelectedItemsChange(this.selectedItems);
7989
+ }
7990
+ // this.selectedItems = this.items.filter((c) => v.includes(c[this.valueField]));
7938
7991
  }
7939
7992
  else if (v) {
7940
7993
  this.selectedItems = this.items.filter((c) => v === c[this.valueField]);
@@ -7971,13 +8024,15 @@ let AXSelectBoxComponent = AXSelectBoxComponent_1 = class AXSelectBoxComponent e
7971
8024
  if (this.mode == 'single') {
7972
8025
  this.showCheckBox = false;
7973
8026
  }
7974
- if (!this.remoteOperation) {
8027
+ debugger;
8028
+ if (!this.remoteOperation || (this.remoteOperation && this.hasSelectedValue)) {
7975
8029
  this.refresh();
7976
8030
  }
7977
8031
  }
7978
8032
  dropdownToggle(e) {
7979
8033
  this.text = '';
7980
8034
  if (this.dropdown.isOpen) {
8035
+ this.refresh();
7981
8036
  setTimeout(() => {
7982
8037
  if (this.serchBox) {
7983
8038
  this.serchBox.focus();
@@ -7985,7 +8040,7 @@ let AXSelectBoxComponent = AXSelectBoxComponent_1 = class AXSelectBoxComponent e
7985
8040
  }, 1);
7986
8041
  }
7987
8042
  else {
7988
- this.refresh();
8043
+ // this.refresh();
7989
8044
  }
7990
8045
  }
7991
8046
  ngAfterContentInit() {
@@ -8013,12 +8068,18 @@ let AXSelectBoxComponent = AXSelectBoxComponent_1 = class AXSelectBoxComponent e
8013
8068
  if (this.searchText && this.searchText != null && this.searchText !== '') {
8014
8069
  if (data.totalCount) {
8015
8070
  if (this.items.length == 0) {
8016
- this.items = data.items;
8071
+ //this.items = data.items;
8072
+ data.items.forEach((item) => {
8073
+ this.items.push(item);
8074
+ });
8017
8075
  }
8018
8076
  else {
8019
8077
  data.items.forEach((item) => {
8020
8078
  this.items.push(item);
8021
8079
  });
8080
+ // if (this.itemsStatusObserver) {
8081
+ // this.itemsStatusObserver.next(this.items.length);
8082
+ // }
8022
8083
  }
8023
8084
  this.totalCount = data.totalCount;
8024
8085
  }
@@ -8030,6 +8091,9 @@ let AXSelectBoxComponent = AXSelectBoxComponent_1 = class AXSelectBoxComponent e
8030
8091
  data.items.forEach((item) => {
8031
8092
  this.items.push(item);
8032
8093
  });
8094
+ // if (this.itemsStatusObserver) {
8095
+ // this.itemsStatusObserver.next(this.items.length);
8096
+ // }
8033
8097
  }
8034
8098
  this.totalCount = data.items == undefined ? 0 : data.items.length;
8035
8099
  }
@@ -8042,6 +8106,9 @@ let AXSelectBoxComponent = AXSelectBoxComponent_1 = class AXSelectBoxComponent e
8042
8106
  data.items.forEach((elm) => {
8043
8107
  this.items.push(elm);
8044
8108
  });
8109
+ // if (this.itemsStatusObserver) {
8110
+ // this.itemsStatusObserver.next(this.items.length);
8111
+ // }
8045
8112
  this.totalCount = data.totalCount;
8046
8113
  }
8047
8114
  else {
@@ -8076,7 +8143,14 @@ let AXSelectBoxComponent = AXSelectBoxComponent_1 = class AXSelectBoxComponent e
8076
8143
  params.take = this.bufferSize;
8077
8144
  }
8078
8145
  if (this.dataSource != undefined) {
8079
- this.items = [];
8146
+ // this.items = [];
8147
+ // this.items.forEach((element) => {
8148
+ // this.items.pop();
8149
+ // });
8150
+ let t = this.items.length;
8151
+ for (let i = 0; i < t; i++) {
8152
+ this.items.pop();
8153
+ }
8080
8154
  this.fetch(params);
8081
8155
  }
8082
8156
  }
@@ -8094,7 +8168,7 @@ let AXSelectBoxComponent = AXSelectBoxComponent_1 = class AXSelectBoxComponent e
8094
8168
  // this.selectedItemsChange.emit(this._selectedItems);
8095
8169
  // this.clearValidationStyle(this.ref.nativeElement);
8096
8170
  }
8097
- this.text = '';
8171
+ // this.text = '';
8098
8172
  this.cdr.markForCheck();
8099
8173
  }
8100
8174
  onFocusTextBox(e) { }
@@ -8444,6 +8518,7 @@ let AXSelectBoxComponent = AXSelectBoxComponent_1 = class AXSelectBoxComponent e
8444
8518
  .pipe(debounceTime(100))
8445
8519
  .pipe(distinctUntilChanged())
8446
8520
  .subscribe((c) => {
8521
+ debugger;
8447
8522
  callbackfn();
8448
8523
  });
8449
8524
  }