@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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@acorex/core'), require('@angular/cdk/overlay'), require('@angular/cdk/portal'), require('rxjs'), require('@angular/cdk/bidi'), require('@angular/common'), require('@angular/cdk/platform'), require('rxjs/operators'), require('@angular/cdk/drag-drop'), require('@angular/forms'), require('@angular/animations'), require('angular2-text-mask'), require('@angular/platform-browser/animations'), require('@angular/cdk/a11y'), require('@angular/router')) :
3
- typeof define === 'function' && define.amd ? define('@acorex/components', ['exports', '@angular/core', '@acorex/core', '@angular/cdk/overlay', '@angular/cdk/portal', 'rxjs', '@angular/cdk/bidi', '@angular/common', '@angular/cdk/platform', 'rxjs/operators', '@angular/cdk/drag-drop', '@angular/forms', '@angular/animations', 'angular2-text-mask', '@angular/platform-browser/animations', '@angular/cdk/a11y', '@angular/router'], factory) :
4
- (global = global || self, factory((global.acorex = global.acorex || {}, global.acorex.components = {}), global.ng.core, global['@acorex/core'], global.ng.cdk.overlay, global.ng.cdk.portal, global.rxjs, global.ng.cdk.bidi, global.ng.common, global.ng.cdk.platform, global.rxjs.operators, global.ng.cdk.dragDrop, global.ng.forms, global.ng.animations, global.angular2TextMask, global.ng.platformBrowser.animations, global.ng.cdk.a11y, global.ng.router));
5
- }(this, (function (exports, core, core$1, overlay, portal, rxjs, bidi, common, platform, operators, dragDrop, forms, animations, angular2TextMask, animations$1, a11y, router) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@acorex/core'), require('@angular/cdk/overlay'), require('@angular/cdk/portal'), require('rxjs'), require('@angular/cdk/bidi'), require('@angular/common'), require('@angular/cdk/platform'), require('rxjs/operators'), require('@angular/cdk/drag-drop'), require('@angular/forms'), require('@angular/animations'), require('angular2-text-mask'), require('@angular/platform-browser/animations'), require('@angular/cdk/a11y'), require('lodash'), require('@angular/router')) :
3
+ typeof define === 'function' && define.amd ? define('@acorex/components', ['exports', '@angular/core', '@acorex/core', '@angular/cdk/overlay', '@angular/cdk/portal', 'rxjs', '@angular/cdk/bidi', '@angular/common', '@angular/cdk/platform', 'rxjs/operators', '@angular/cdk/drag-drop', '@angular/forms', '@angular/animations', 'angular2-text-mask', '@angular/platform-browser/animations', '@angular/cdk/a11y', 'lodash', '@angular/router'], factory) :
4
+ (global = global || self, factory((global.acorex = global.acorex || {}, global.acorex.components = {}), global.ng.core, global['@acorex/core'], global.ng.cdk.overlay, global.ng.cdk.portal, global.rxjs, global.ng.cdk.bidi, global.ng.common, global.ng.cdk.platform, global.rxjs.operators, global.ng.cdk.dragDrop, global.ng.forms, global.ng.animations, global.angular2TextMask, global.ng.platformBrowser.animations, global.ng.cdk.a11y, global.lodash, global.ng.router));
5
+ }(this, (function (exports, core, core$1, overlay, portal, rxjs, bidi, common, platform, operators, dragDrop, forms, animations, angular2TextMask, animations$1, a11y, lodash, router) { 'use strict';
6
6
 
7
7
  /*! *****************************************************************************
8
8
  Copyright (c) Microsoft Corporation.
@@ -8451,6 +8451,7 @@
8451
8451
  _this.onBlur = new core.EventEmitter();
8452
8452
  _this.onFocus = new core.EventEmitter();
8453
8453
  _this._items = [];
8454
+ _this.hasSelectedValue = false;
8454
8455
  _this.itemsFiltered = [];
8455
8456
  // #endregion
8456
8457
  _this.dropDownDisabled = false;
@@ -8491,6 +8492,7 @@
8491
8492
  if (this.itemsChange) {
8492
8493
  this.itemsChange.emit(v);
8493
8494
  }
8495
+ debugger;
8494
8496
  if (this.itemsStatusObserver) {
8495
8497
  this.itemsStatusObserver.next(this.items.length);
8496
8498
  }
@@ -8503,27 +8505,46 @@
8503
8505
  return this._selectedItems || [];
8504
8506
  },
8505
8507
  set: function (v) {
8506
- var _this = this;
8507
- if (!v) {
8508
- v = [];
8509
- }
8510
- var old = this.selectedItems;
8511
- if (JSON.stringify(old) !== JSON.stringify(v)) {
8512
- this._selectedItems = this.mode == 'single' ? v.slice(0, 1) : __spread(new Set(v)); //[...new Set(v[0])] : [...new Set(v)];
8513
- this._selectedItems.forEach(function (c) { return (c.selected = true); });
8514
- this.selectedItemsChange.emit(this._selectedItems);
8515
- this.selectedValuesChange.emit(this.selectedValues);
8516
- this.clearValidationStyle(this.ref.nativeElement);
8517
- this.waitForData(function () {
8518
- if (_this._selectedItems) {
8519
- _this.items.forEach(function (c) { return (c.selected = _this._selectedItems.some(function (i) { return i[_this.valueField] == c[_this.valueField]; })); });
8520
- }
8521
- });
8522
- }
8508
+ this.setSelectedItemsChange(v);
8509
+ // if (!v) {
8510
+ // v = [];
8511
+ // }
8512
+ // const old = this.selectedItems;
8513
+ // if (JSON.stringify(old) !== JSON.stringify(v)) {
8514
+ // this._selectedItems = this.mode == 'single' ? v.slice(0, 1) : [...new Set(v)]; //[...new Set(v[0])] : [...new Set(v)];
8515
+ // this._selectedItems.forEach((c) => (c.selected = true));
8516
+ // this.selectedItemsChange.emit(this._selectedItems);
8517
+ // this.selectedValuesChange.emit(this.selectedValues);
8518
+ // this.clearValidationStyle(this.ref.nativeElement);
8519
+ // this.waitForData(() => {
8520
+ // if (this._selectedItems) {
8521
+ // this.items.forEach((c) => (c.selected = this._selectedItems.some((i) => i[this.valueField] == c[this.valueField])));
8522
+ // }
8523
+ // });
8524
+ // }
8523
8525
  },
8524
8526
  enumerable: true,
8525
8527
  configurable: true
8526
8528
  });
8529
+ AXSelectBoxComponent.prototype.setSelectedItemsChange = function (v) {
8530
+ var _this = this;
8531
+ if (!v) {
8532
+ v = [];
8533
+ }
8534
+ var old = this.selectedItems;
8535
+ if (JSON.stringify(old) !== JSON.stringify(v)) {
8536
+ this._selectedItems = this.mode == 'single' ? v.slice(0, 1) : __spread(new Set(v)); //[...new Set(v[0])] : [...new Set(v)];
8537
+ this._selectedItems.forEach(function (c) { return (c.selected = true); });
8538
+ this.selectedItemsChange.emit(this._selectedItems);
8539
+ this.selectedValuesChange.emit(this.selectedValues);
8540
+ this.clearValidationStyle(this.ref.nativeElement);
8541
+ this.waitForData(function () {
8542
+ if (_this._selectedItems) {
8543
+ _this.items.forEach(function (c) { return (c.selected = _this._selectedItems.some(function (i) { return i[_this.valueField] == c[_this.valueField]; })); });
8544
+ }
8545
+ });
8546
+ }
8547
+ };
8527
8548
  AXSelectBoxComponent.prototype.ngOnInit = function () {
8528
8549
  if (this.rowTemplate === undefined && this.rowInputTemplate != undefined) {
8529
8550
  this.rowTemplate = this.rowInputTemplate;
@@ -8565,20 +8586,29 @@
8565
8586
  }
8566
8587
  };
8567
8588
  AXSelectBoxComponent.prototype.textChanged = function (e) {
8568
- // if((e.value === null || e.value=== undefined || e.value === "") && (e.oldValue === null || e.oldValue === undefined || e.oldValue === "")){
8569
- // }else{
8570
- this.currentfocusedIndex = -1;
8571
- if (this.remoteOperation) {
8572
- this.searchText = this.text;
8573
- // this.searchText = e.value;
8574
- // this.text = e.value;
8575
- this.items = [];
8576
- var params = {};
8577
- params.searchText = this.text;
8578
- // params.searchText = e.value;
8579
- params.skip = 0;
8580
- params.take = this.bufferSize;
8581
- this.fetch(params);
8589
+ if ((e.value === null || e.value === undefined || e.value === '') && (e.oldValue === null || e.oldValue === undefined || e.oldValue === '')) {
8590
+ }
8591
+ else {
8592
+ this.currentfocusedIndex = -1;
8593
+ if (this.remoteOperation) {
8594
+ this.searchText = this.text;
8595
+ // this.searchText = e.value;
8596
+ // this.text = e.value;
8597
+ // this.items = [];
8598
+ var t = this.items.length;
8599
+ for (var i = 0; i < t; i++) {
8600
+ this.items.pop();
8601
+ }
8602
+ // this.items.forEach((element) => {
8603
+ // this.items.pop();
8604
+ // });
8605
+ var params = {};
8606
+ params.searchText = this.text;
8607
+ // params.searchText = e.value;
8608
+ params.skip = 0;
8609
+ params.take = this.bufferSize;
8610
+ this.fetch(params);
8611
+ }
8582
8612
  }
8583
8613
  };
8584
8614
  AXSelectBoxComponent.prototype.onButtonClick = function (e) {
@@ -8645,10 +8675,13 @@
8645
8675
  }
8646
8676
  else {
8647
8677
  if (v !== undefined) {
8678
+ if (v != [] && v != '' && v != null) {
8679
+ this.hasSelectedValue = true;
8680
+ }
8648
8681
  this.waitForData(function () {
8649
8682
  if (_this.mode === 'single') {
8650
- if (_this.items.filter(function (c) { return v === c[_this.valueField]; })) {
8651
- _this.selectedItems = _this.items.filter(function (c) { return v === c[_this.valueField]; });
8683
+ if (_this.items.filter(function (c) { return v == c[_this.valueField]; })) {
8684
+ _this.selectedItems = _this.items.filter(function (c) { return v == c[_this.valueField]; });
8652
8685
  }
8653
8686
  else {
8654
8687
  _this.selectedItems = [];
@@ -8656,7 +8689,26 @@
8656
8689
  }
8657
8690
  else {
8658
8691
  if (Array.isArray(v)) {
8659
- _this.selectedItems = _this.items.filter(function (c) { return v.includes(c[_this.valueField]); });
8692
+ debugger;
8693
+ if (_this.selectedItems.length > v.length) {
8694
+ _this.selectedItems = _this.selectedItems.filter(function (c) { return v.includes(c[_this.valueField]); });
8695
+ }
8696
+ else {
8697
+ var addId_1 = [];
8698
+ v.forEach(function (vId) {
8699
+ addId_1.push({
8700
+ ID: vId
8701
+ });
8702
+ });
8703
+ var newId = lodash.differenceBy(addId_1, _this.selectedItems, _this.valueField);
8704
+ var vv_1 = [];
8705
+ newId.forEach(function (rc) {
8706
+ vv_1.push(rc[_this.valueField]);
8707
+ });
8708
+ _this.selectedItems.push(_this.items.filter(function (c) { return vv_1.includes(c[_this.valueField]); })[0]);
8709
+ _this.setSelectedItemsChange(_this.selectedItems);
8710
+ }
8711
+ // this.selectedItems = this.items.filter((c) => v.includes(c[this.valueField]));
8660
8712
  }
8661
8713
  else if (v) {
8662
8714
  _this.selectedItems = _this.items.filter(function (c) { return v === c[_this.valueField]; });
@@ -8696,7 +8748,8 @@
8696
8748
  if (this.mode == 'single') {
8697
8749
  this.showCheckBox = false;
8698
8750
  }
8699
- if (!this.remoteOperation) {
8751
+ debugger;
8752
+ if (!this.remoteOperation || (this.remoteOperation && this.hasSelectedValue)) {
8700
8753
  this.refresh();
8701
8754
  }
8702
8755
  };
@@ -8704,6 +8757,7 @@
8704
8757
  var _this = this;
8705
8758
  this.text = '';
8706
8759
  if (this.dropdown.isOpen) {
8760
+ this.refresh();
8707
8761
  setTimeout(function () {
8708
8762
  if (_this.serchBox) {
8709
8763
  _this.serchBox.focus();
@@ -8711,7 +8765,7 @@
8711
8765
  }, 1);
8712
8766
  }
8713
8767
  else {
8714
- this.refresh();
8768
+ // this.refresh();
8715
8769
  }
8716
8770
  };
8717
8771
  AXSelectBoxComponent.prototype.ngAfterContentInit = function () {
@@ -8741,12 +8795,18 @@
8741
8795
  if (this.searchText && this.searchText != null && this.searchText !== '') {
8742
8796
  if (data.totalCount) {
8743
8797
  if (this.items.length == 0) {
8744
- this.items = data.items;
8798
+ //this.items = data.items;
8799
+ data.items.forEach(function (item) {
8800
+ _this.items.push(item);
8801
+ });
8745
8802
  }
8746
8803
  else {
8747
8804
  data.items.forEach(function (item) {
8748
8805
  _this.items.push(item);
8749
8806
  });
8807
+ // if (this.itemsStatusObserver) {
8808
+ // this.itemsStatusObserver.next(this.items.length);
8809
+ // }
8750
8810
  }
8751
8811
  this.totalCount = data.totalCount;
8752
8812
  }
@@ -8758,6 +8818,9 @@
8758
8818
  data.items.forEach(function (item) {
8759
8819
  _this.items.push(item);
8760
8820
  });
8821
+ // if (this.itemsStatusObserver) {
8822
+ // this.itemsStatusObserver.next(this.items.length);
8823
+ // }
8761
8824
  }
8762
8825
  this.totalCount = data.items == undefined ? 0 : data.items.length;
8763
8826
  }
@@ -8770,6 +8833,9 @@
8770
8833
  data.items.forEach(function (elm) {
8771
8834
  _this.items.push(elm);
8772
8835
  });
8836
+ // if (this.itemsStatusObserver) {
8837
+ // this.itemsStatusObserver.next(this.items.length);
8838
+ // }
8773
8839
  this.totalCount = data.totalCount;
8774
8840
  }
8775
8841
  else {
@@ -8805,7 +8871,14 @@
8805
8871
  params.take = this.bufferSize;
8806
8872
  }
8807
8873
  if (this.dataSource != undefined) {
8808
- this.items = [];
8874
+ // this.items = [];
8875
+ // this.items.forEach((element) => {
8876
+ // this.items.pop();
8877
+ // });
8878
+ var t = this.items.length;
8879
+ for (var i = 0; i < t; i++) {
8880
+ this.items.pop();
8881
+ }
8809
8882
  this.fetch(params);
8810
8883
  }
8811
8884
  };
@@ -8824,7 +8897,7 @@
8824
8897
  // this.selectedItemsChange.emit(this._selectedItems);
8825
8898
  // this.clearValidationStyle(this.ref.nativeElement);
8826
8899
  }
8827
- this.text = '';
8900
+ // this.text = '';
8828
8901
  this.cdr.markForCheck();
8829
8902
  };
8830
8903
  AXSelectBoxComponent.prototype.onFocusTextBox = function (e) { };
@@ -9185,6 +9258,7 @@
9185
9258
  .pipe(operators.debounceTime(100))
9186
9259
  .pipe(operators.distinctUntilChanged())
9187
9260
  .subscribe(function (c) {
9261
+ debugger;
9188
9262
  callbackfn();
9189
9263
  });
9190
9264
  }