@acorex/components 1.3.81 → 1.3.85

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
@@ -8244,6 +8245,7 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8244
8245
  _this.onBlur = new EventEmitter();
8245
8246
  _this.onFocus = new EventEmitter();
8246
8247
  _this._items = [];
8248
+ _this.hasSelectedValue = false;
8247
8249
  _this.itemsFiltered = [];
8248
8250
  // #endregion
8249
8251
  _this.dropDownDisabled = false;
@@ -8284,6 +8286,7 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8284
8286
  if (this.itemsChange) {
8285
8287
  this.itemsChange.emit(v);
8286
8288
  }
8289
+ debugger;
8287
8290
  if (this.itemsStatusObserver) {
8288
8291
  this.itemsStatusObserver.next(this.items.length);
8289
8292
  }
@@ -8296,27 +8299,46 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8296
8299
  return this._selectedItems || [];
8297
8300
  },
8298
8301
  set: function (v) {
8299
- var _this = this;
8300
- if (!v) {
8301
- v = [];
8302
- }
8303
- var old = this.selectedItems;
8304
- if (JSON.stringify(old) !== JSON.stringify(v)) {
8305
- this._selectedItems = this.mode == 'single' ? v.slice(0, 1) : __spread(new Set(v)); //[...new Set(v[0])] : [...new Set(v)];
8306
- this._selectedItems.forEach(function (c) { return (c.selected = true); });
8307
- this.selectedItemsChange.emit(this._selectedItems);
8308
- this.selectedValuesChange.emit(this.selectedValues);
8309
- this.clearValidationStyle(this.ref.nativeElement);
8310
- this.waitForData(function () {
8311
- if (_this._selectedItems) {
8312
- _this.items.forEach(function (c) { return (c.selected = _this._selectedItems.some(function (i) { return i[_this.valueField] == c[_this.valueField]; })); });
8313
- }
8314
- });
8315
- }
8302
+ this.setSelectedItemsChange(v);
8303
+ // if (!v) {
8304
+ // v = [];
8305
+ // }
8306
+ // const old = this.selectedItems;
8307
+ // if (JSON.stringify(old) !== JSON.stringify(v)) {
8308
+ // this._selectedItems = this.mode == 'single' ? v.slice(0, 1) : [...new Set(v)]; //[...new Set(v[0])] : [...new Set(v)];
8309
+ // this._selectedItems.forEach((c) => (c.selected = true));
8310
+ // this.selectedItemsChange.emit(this._selectedItems);
8311
+ // this.selectedValuesChange.emit(this.selectedValues);
8312
+ // this.clearValidationStyle(this.ref.nativeElement);
8313
+ // this.waitForData(() => {
8314
+ // if (this._selectedItems) {
8315
+ // this.items.forEach((c) => (c.selected = this._selectedItems.some((i) => i[this.valueField] == c[this.valueField])));
8316
+ // }
8317
+ // });
8318
+ // }
8316
8319
  },
8317
8320
  enumerable: true,
8318
8321
  configurable: true
8319
8322
  });
8323
+ AXSelectBoxComponent.prototype.setSelectedItemsChange = function (v) {
8324
+ var _this = this;
8325
+ if (!v) {
8326
+ v = [];
8327
+ }
8328
+ var old = this.selectedItems;
8329
+ if (JSON.stringify(old) !== JSON.stringify(v)) {
8330
+ this._selectedItems = this.mode == 'single' ? v.slice(0, 1) : __spread(new Set(v)); //[...new Set(v[0])] : [...new Set(v)];
8331
+ this._selectedItems.forEach(function (c) { return (c.selected = true); });
8332
+ this.selectedItemsChange.emit(this._selectedItems);
8333
+ this.selectedValuesChange.emit(this.selectedValues);
8334
+ this.clearValidationStyle(this.ref.nativeElement);
8335
+ this.waitForData(function () {
8336
+ if (_this._selectedItems) {
8337
+ _this.items.forEach(function (c) { return (c.selected = _this._selectedItems.some(function (i) { return i[_this.valueField] == c[_this.valueField]; })); });
8338
+ }
8339
+ });
8340
+ }
8341
+ };
8320
8342
  AXSelectBoxComponent.prototype.ngOnInit = function () {
8321
8343
  if (this.rowTemplate === undefined && this.rowInputTemplate != undefined) {
8322
8344
  this.rowTemplate = this.rowInputTemplate;
@@ -8358,20 +8380,29 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8358
8380
  }
8359
8381
  };
8360
8382
  AXSelectBoxComponent.prototype.textChanged = function (e) {
8361
- // if((e.value === null || e.value=== undefined || e.value === "") && (e.oldValue === null || e.oldValue === undefined || e.oldValue === "")){
8362
- // }else{
8363
- this.currentfocusedIndex = -1;
8364
- if (this.remoteOperation) {
8365
- this.searchText = this.text;
8366
- // this.searchText = e.value;
8367
- // this.text = e.value;
8368
- this.items = [];
8369
- var params = {};
8370
- params.searchText = this.text;
8371
- // params.searchText = e.value;
8372
- params.skip = 0;
8373
- params.take = this.bufferSize;
8374
- this.fetch(params);
8383
+ if ((e.value === null || e.value === undefined || e.value === '') && (e.oldValue === null || e.oldValue === undefined || e.oldValue === '')) {
8384
+ }
8385
+ else {
8386
+ this.currentfocusedIndex = -1;
8387
+ if (this.remoteOperation) {
8388
+ this.searchText = this.text;
8389
+ // this.searchText = e.value;
8390
+ // this.text = e.value;
8391
+ // this.items = [];
8392
+ var t = this.items.length;
8393
+ for (var i = 0; i < t; i++) {
8394
+ this.items.pop();
8395
+ }
8396
+ // this.items.forEach((element) => {
8397
+ // this.items.pop();
8398
+ // });
8399
+ var params = {};
8400
+ params.searchText = this.text;
8401
+ // params.searchText = e.value;
8402
+ params.skip = 0;
8403
+ params.take = this.bufferSize;
8404
+ this.fetch(params);
8405
+ }
8375
8406
  }
8376
8407
  };
8377
8408
  AXSelectBoxComponent.prototype.onButtonClick = function (e) {
@@ -8438,10 +8469,13 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8438
8469
  }
8439
8470
  else {
8440
8471
  if (v !== undefined) {
8472
+ if (v != [] && v != '' && v != null) {
8473
+ this.hasSelectedValue = true;
8474
+ }
8441
8475
  this.waitForData(function () {
8442
8476
  if (_this.mode === 'single') {
8443
- if (_this.items.filter(function (c) { return v === c[_this.valueField]; })) {
8444
- _this.selectedItems = _this.items.filter(function (c) { return v === c[_this.valueField]; });
8477
+ if (_this.items.filter(function (c) { return v == c[_this.valueField]; })) {
8478
+ _this.selectedItems = _this.items.filter(function (c) { return v == c[_this.valueField]; });
8445
8479
  }
8446
8480
  else {
8447
8481
  _this.selectedItems = [];
@@ -8449,7 +8483,26 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8449
8483
  }
8450
8484
  else {
8451
8485
  if (Array.isArray(v)) {
8452
- _this.selectedItems = _this.items.filter(function (c) { return v.includes(c[_this.valueField]); });
8486
+ debugger;
8487
+ if (_this.selectedItems.length > v.length) {
8488
+ _this.selectedItems = _this.selectedItems.filter(function (c) { return v.includes(c[_this.valueField]); });
8489
+ }
8490
+ else {
8491
+ var addId_1 = [];
8492
+ v.forEach(function (vId) {
8493
+ addId_1.push({
8494
+ ID: vId
8495
+ });
8496
+ });
8497
+ var newId = differenceBy(addId_1, _this.selectedItems, _this.valueField);
8498
+ var vv_1 = [];
8499
+ newId.forEach(function (rc) {
8500
+ vv_1.push(rc[_this.valueField]);
8501
+ });
8502
+ _this.selectedItems.push(_this.items.filter(function (c) { return vv_1.includes(c[_this.valueField]); })[0]);
8503
+ _this.setSelectedItemsChange(_this.selectedItems);
8504
+ }
8505
+ // this.selectedItems = this.items.filter((c) => v.includes(c[this.valueField]));
8453
8506
  }
8454
8507
  else if (v) {
8455
8508
  _this.selectedItems = _this.items.filter(function (c) { return v === c[_this.valueField]; });
@@ -8489,7 +8542,8 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8489
8542
  if (this.mode == 'single') {
8490
8543
  this.showCheckBox = false;
8491
8544
  }
8492
- if (!this.remoteOperation) {
8545
+ debugger;
8546
+ if (!this.remoteOperation || (this.remoteOperation && this.hasSelectedValue)) {
8493
8547
  this.refresh();
8494
8548
  }
8495
8549
  };
@@ -8497,6 +8551,7 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8497
8551
  var _this = this;
8498
8552
  this.text = '';
8499
8553
  if (this.dropdown.isOpen) {
8554
+ this.refresh();
8500
8555
  setTimeout(function () {
8501
8556
  if (_this.serchBox) {
8502
8557
  _this.serchBox.focus();
@@ -8504,7 +8559,7 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8504
8559
  }, 1);
8505
8560
  }
8506
8561
  else {
8507
- this.refresh();
8562
+ // this.refresh();
8508
8563
  }
8509
8564
  };
8510
8565
  AXSelectBoxComponent.prototype.ngAfterContentInit = function () {
@@ -8534,12 +8589,18 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8534
8589
  if (this.searchText && this.searchText != null && this.searchText !== '') {
8535
8590
  if (data.totalCount) {
8536
8591
  if (this.items.length == 0) {
8537
- this.items = data.items;
8592
+ //this.items = data.items;
8593
+ data.items.forEach(function (item) {
8594
+ _this.items.push(item);
8595
+ });
8538
8596
  }
8539
8597
  else {
8540
8598
  data.items.forEach(function (item) {
8541
8599
  _this.items.push(item);
8542
8600
  });
8601
+ // if (this.itemsStatusObserver) {
8602
+ // this.itemsStatusObserver.next(this.items.length);
8603
+ // }
8543
8604
  }
8544
8605
  this.totalCount = data.totalCount;
8545
8606
  }
@@ -8551,6 +8612,9 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8551
8612
  data.items.forEach(function (item) {
8552
8613
  _this.items.push(item);
8553
8614
  });
8615
+ // if (this.itemsStatusObserver) {
8616
+ // this.itemsStatusObserver.next(this.items.length);
8617
+ // }
8554
8618
  }
8555
8619
  this.totalCount = data.items == undefined ? 0 : data.items.length;
8556
8620
  }
@@ -8563,6 +8627,9 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8563
8627
  data.items.forEach(function (elm) {
8564
8628
  _this.items.push(elm);
8565
8629
  });
8630
+ // if (this.itemsStatusObserver) {
8631
+ // this.itemsStatusObserver.next(this.items.length);
8632
+ // }
8566
8633
  this.totalCount = data.totalCount;
8567
8634
  }
8568
8635
  else {
@@ -8598,7 +8665,14 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8598
8665
  params.take = this.bufferSize;
8599
8666
  }
8600
8667
  if (this.dataSource != undefined) {
8601
- this.items = [];
8668
+ // this.items = [];
8669
+ // this.items.forEach((element) => {
8670
+ // this.items.pop();
8671
+ // });
8672
+ var t = this.items.length;
8673
+ for (var i = 0; i < t; i++) {
8674
+ this.items.pop();
8675
+ }
8602
8676
  this.fetch(params);
8603
8677
  }
8604
8678
  };
@@ -8617,7 +8691,7 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8617
8691
  // this.selectedItemsChange.emit(this._selectedItems);
8618
8692
  // this.clearValidationStyle(this.ref.nativeElement);
8619
8693
  }
8620
- this.text = '';
8694
+ // this.text = '';
8621
8695
  this.cdr.markForCheck();
8622
8696
  };
8623
8697
  AXSelectBoxComponent.prototype.onFocusTextBox = function (e) { };
@@ -8978,6 +9052,7 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8978
9052
  .pipe(debounceTime(100))
8979
9053
  .pipe(distinctUntilChanged())
8980
9054
  .subscribe(function (c) {
9055
+ debugger;
8981
9056
  callbackfn();
8982
9057
  });
8983
9058
  }