@acorex/components 1.3.83 → 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;
@@ -7791,6 +7793,25 @@ let AXSelectBoxComponent = AXSelectBoxComponent_1 = class AXSelectBoxComponent e
7791
7793
  return this._selectedItems || [];
7792
7794
  }
7793
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) {
7794
7815
  if (!v) {
7795
7816
  v = [];
7796
7817
  }
@@ -7849,27 +7870,29 @@ let AXSelectBoxComponent = AXSelectBoxComponent_1 = class AXSelectBoxComponent e
7849
7870
  }
7850
7871
  }
7851
7872
  textChanged(e) {
7852
- // if((e.value === null || e.value=== undefined || e.value === "") && (e.oldValue === null || e.oldValue === undefined || e.oldValue === "")){
7853
- // }else{
7854
- this.currentfocusedIndex = -1;
7855
- if (this.remoteOperation) {
7856
- this.searchText = this.text;
7857
- // this.searchText = e.value;
7858
- // this.text = e.value;
7859
- // this.items = [];
7860
- let t = this.items.length;
7861
- for (let i = 0; i < t; i++) {
7862
- this.items.pop();
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);
7863
7895
  }
7864
- // this.items.forEach((element) => {
7865
- // this.items.pop();
7866
- // });
7867
- const params = {};
7868
- params.searchText = this.text;
7869
- // params.searchText = e.value;
7870
- params.skip = 0;
7871
- params.take = this.bufferSize;
7872
- this.fetch(params);
7873
7896
  }
7874
7897
  }
7875
7898
  onButtonClick(e) {
@@ -7931,6 +7954,9 @@ let AXSelectBoxComponent = AXSelectBoxComponent_1 = class AXSelectBoxComponent e
7931
7954
  }
7932
7955
  else {
7933
7956
  if (v !== undefined) {
7957
+ if (v != [] && v != '' && v != null) {
7958
+ this.hasSelectedValue = true;
7959
+ }
7934
7960
  this.waitForData(() => {
7935
7961
  if (this.mode === 'single') {
7936
7962
  if (this.items.filter((c) => v == c[this.valueField])) {
@@ -7942,7 +7968,26 @@ let AXSelectBoxComponent = AXSelectBoxComponent_1 = class AXSelectBoxComponent e
7942
7968
  }
7943
7969
  else {
7944
7970
  if (Array.isArray(v)) {
7945
- 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]));
7946
7991
  }
7947
7992
  else if (v) {
7948
7993
  this.selectedItems = this.items.filter((c) => v === c[this.valueField]);
@@ -7979,7 +8024,8 @@ let AXSelectBoxComponent = AXSelectBoxComponent_1 = class AXSelectBoxComponent e
7979
8024
  if (this.mode == 'single') {
7980
8025
  this.showCheckBox = false;
7981
8026
  }
7982
- if (!this.remoteOperation) {
8027
+ debugger;
8028
+ if (!this.remoteOperation || (this.remoteOperation && this.hasSelectedValue)) {
7983
8029
  this.refresh();
7984
8030
  }
7985
8031
  }
@@ -8122,7 +8168,7 @@ let AXSelectBoxComponent = AXSelectBoxComponent_1 = class AXSelectBoxComponent e
8122
8168
  // this.selectedItemsChange.emit(this._selectedItems);
8123
8169
  // this.clearValidationStyle(this.ref.nativeElement);
8124
8170
  }
8125
- this.text = '';
8171
+ // this.text = '';
8126
8172
  this.cdr.markForCheck();
8127
8173
  }
8128
8174
  onFocusTextBox(e) { }