@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.
@@ -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;
@@ -8504,27 +8505,46 @@
8504
8505
  return this._selectedItems || [];
8505
8506
  },
8506
8507
  set: function (v) {
8507
- var _this = this;
8508
- if (!v) {
8509
- v = [];
8510
- }
8511
- var old = this.selectedItems;
8512
- if (JSON.stringify(old) !== JSON.stringify(v)) {
8513
- this._selectedItems = this.mode == 'single' ? v.slice(0, 1) : __spread(new Set(v)); //[...new Set(v[0])] : [...new Set(v)];
8514
- this._selectedItems.forEach(function (c) { return (c.selected = true); });
8515
- this.selectedItemsChange.emit(this._selectedItems);
8516
- this.selectedValuesChange.emit(this.selectedValues);
8517
- this.clearValidationStyle(this.ref.nativeElement);
8518
- this.waitForData(function () {
8519
- if (_this._selectedItems) {
8520
- _this.items.forEach(function (c) { return (c.selected = _this._selectedItems.some(function (i) { return i[_this.valueField] == c[_this.valueField]; })); });
8521
- }
8522
- });
8523
- }
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
+ // }
8524
8525
  },
8525
8526
  enumerable: true,
8526
8527
  configurable: true
8527
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
+ };
8528
8548
  AXSelectBoxComponent.prototype.ngOnInit = function () {
8529
8549
  if (this.rowTemplate === undefined && this.rowInputTemplate != undefined) {
8530
8550
  this.rowTemplate = this.rowInputTemplate;
@@ -8566,27 +8586,29 @@
8566
8586
  }
8567
8587
  };
8568
8588
  AXSelectBoxComponent.prototype.textChanged = function (e) {
8569
- // if((e.value === null || e.value=== undefined || e.value === "") && (e.oldValue === null || e.oldValue === undefined || e.oldValue === "")){
8570
- // }else{
8571
- this.currentfocusedIndex = -1;
8572
- if (this.remoteOperation) {
8573
- this.searchText = this.text;
8574
- // this.searchText = e.value;
8575
- // this.text = e.value;
8576
- // this.items = [];
8577
- var t = this.items.length;
8578
- for (var i = 0; i < t; i++) {
8579
- this.items.pop();
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);
8580
8611
  }
8581
- // this.items.forEach((element) => {
8582
- // this.items.pop();
8583
- // });
8584
- var params = {};
8585
- params.searchText = this.text;
8586
- // params.searchText = e.value;
8587
- params.skip = 0;
8588
- params.take = this.bufferSize;
8589
- this.fetch(params);
8590
8612
  }
8591
8613
  };
8592
8614
  AXSelectBoxComponent.prototype.onButtonClick = function (e) {
@@ -8653,6 +8675,9 @@
8653
8675
  }
8654
8676
  else {
8655
8677
  if (v !== undefined) {
8678
+ if (v != [] && v != '' && v != null) {
8679
+ this.hasSelectedValue = true;
8680
+ }
8656
8681
  this.waitForData(function () {
8657
8682
  if (_this.mode === 'single') {
8658
8683
  if (_this.items.filter(function (c) { return v == c[_this.valueField]; })) {
@@ -8664,7 +8689,26 @@
8664
8689
  }
8665
8690
  else {
8666
8691
  if (Array.isArray(v)) {
8667
- _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, 'ID');
8704
+ var vv_1 = [];
8705
+ newId.forEach(function (rc) {
8706
+ vv_1.push(rc['ID']);
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]));
8668
8712
  }
8669
8713
  else if (v) {
8670
8714
  _this.selectedItems = _this.items.filter(function (c) { return v === c[_this.valueField]; });
@@ -8704,7 +8748,8 @@
8704
8748
  if (this.mode == 'single') {
8705
8749
  this.showCheckBox = false;
8706
8750
  }
8707
- if (!this.remoteOperation) {
8751
+ debugger;
8752
+ if (!this.remoteOperation || (this.remoteOperation && this.hasSelectedValue)) {
8708
8753
  this.refresh();
8709
8754
  }
8710
8755
  };
@@ -8852,7 +8897,7 @@
8852
8897
  // this.selectedItemsChange.emit(this._selectedItems);
8853
8898
  // this.clearValidationStyle(this.ref.nativeElement);
8854
8899
  }
8855
- this.text = '';
8900
+ // this.text = '';
8856
8901
  this.cdr.markForCheck();
8857
8902
  };
8858
8903
  AXSelectBoxComponent.prototype.onFocusTextBox = function (e) { };