@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
@@ -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;
@@ -8297,27 +8299,46 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8297
8299
  return this._selectedItems || [];
8298
8300
  },
8299
8301
  set: function (v) {
8300
- var _this = this;
8301
- if (!v) {
8302
- v = [];
8303
- }
8304
- var old = this.selectedItems;
8305
- if (JSON.stringify(old) !== JSON.stringify(v)) {
8306
- this._selectedItems = this.mode == 'single' ? v.slice(0, 1) : __spread(new Set(v)); //[...new Set(v[0])] : [...new Set(v)];
8307
- this._selectedItems.forEach(function (c) { return (c.selected = true); });
8308
- this.selectedItemsChange.emit(this._selectedItems);
8309
- this.selectedValuesChange.emit(this.selectedValues);
8310
- this.clearValidationStyle(this.ref.nativeElement);
8311
- this.waitForData(function () {
8312
- if (_this._selectedItems) {
8313
- _this.items.forEach(function (c) { return (c.selected = _this._selectedItems.some(function (i) { return i[_this.valueField] == c[_this.valueField]; })); });
8314
- }
8315
- });
8316
- }
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
+ // }
8317
8319
  },
8318
8320
  enumerable: true,
8319
8321
  configurable: true
8320
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
+ };
8321
8342
  AXSelectBoxComponent.prototype.ngOnInit = function () {
8322
8343
  if (this.rowTemplate === undefined && this.rowInputTemplate != undefined) {
8323
8344
  this.rowTemplate = this.rowInputTemplate;
@@ -8359,27 +8380,29 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8359
8380
  }
8360
8381
  };
8361
8382
  AXSelectBoxComponent.prototype.textChanged = function (e) {
8362
- // if((e.value === null || e.value=== undefined || e.value === "") && (e.oldValue === null || e.oldValue === undefined || e.oldValue === "")){
8363
- // }else{
8364
- this.currentfocusedIndex = -1;
8365
- if (this.remoteOperation) {
8366
- this.searchText = this.text;
8367
- // this.searchText = e.value;
8368
- // this.text = e.value;
8369
- // this.items = [];
8370
- var t = this.items.length;
8371
- for (var i = 0; i < t; i++) {
8372
- this.items.pop();
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);
8373
8405
  }
8374
- // this.items.forEach((element) => {
8375
- // this.items.pop();
8376
- // });
8377
- var params = {};
8378
- params.searchText = this.text;
8379
- // params.searchText = e.value;
8380
- params.skip = 0;
8381
- params.take = this.bufferSize;
8382
- this.fetch(params);
8383
8406
  }
8384
8407
  };
8385
8408
  AXSelectBoxComponent.prototype.onButtonClick = function (e) {
@@ -8446,6 +8469,9 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8446
8469
  }
8447
8470
  else {
8448
8471
  if (v !== undefined) {
8472
+ if (v != [] && v != '' && v != null) {
8473
+ this.hasSelectedValue = true;
8474
+ }
8449
8475
  this.waitForData(function () {
8450
8476
  if (_this.mode === 'single') {
8451
8477
  if (_this.items.filter(function (c) { return v == c[_this.valueField]; })) {
@@ -8457,7 +8483,26 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8457
8483
  }
8458
8484
  else {
8459
8485
  if (Array.isArray(v)) {
8460
- _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, 'ID');
8498
+ var vv_1 = [];
8499
+ newId.forEach(function (rc) {
8500
+ vv_1.push(rc['ID']);
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]));
8461
8506
  }
8462
8507
  else if (v) {
8463
8508
  _this.selectedItems = _this.items.filter(function (c) { return v === c[_this.valueField]; });
@@ -8497,7 +8542,8 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8497
8542
  if (this.mode == 'single') {
8498
8543
  this.showCheckBox = false;
8499
8544
  }
8500
- if (!this.remoteOperation) {
8545
+ debugger;
8546
+ if (!this.remoteOperation || (this.remoteOperation && this.hasSelectedValue)) {
8501
8547
  this.refresh();
8502
8548
  }
8503
8549
  };
@@ -8645,7 +8691,7 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8645
8691
  // this.selectedItemsChange.emit(this._selectedItems);
8646
8692
  // this.clearValidationStyle(this.ref.nativeElement);
8647
8693
  }
8648
- this.text = '';
8694
+ // this.text = '';
8649
8695
  this.cdr.markForCheck();
8650
8696
  };
8651
8697
  AXSelectBoxComponent.prototype.onFocusTextBox = function (e) { };