@fluxhub/fluxhub-lib 11.0.145 → 11.0.147

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.
@@ -7930,7 +7930,7 @@
7930
7930
  // if(!this.init_fill){this.init_fill=true;return;}
7931
7931
  if (this.sql == null)
7932
7932
  this.sql = "";
7933
- if (this.sql.indexOf("|") != -1 && this.sql.indexOf("$") != -1) {
7933
+ if (this.sql.indexOf("|") != -1) {
7934
7934
  this.set_options(this.sql);
7935
7935
  return;
7936
7936
  }
@@ -9582,21 +9582,33 @@
9582
9582
  function FHListComponent(_dataService) {
9583
9583
  this._dataService = _dataService;
9584
9584
  this.init_fill = true;
9585
- this.sql = "";
9585
+ this.sql = '';
9586
9586
  this.types = [];
9587
9587
  this.values = [];
9588
- this.label = "";
9588
+ this.label = '';
9589
9589
  this.enabled = true;
9590
9590
  this.single_sel = false;
9591
- this.separator = ",";
9591
+ this.enableSearch = false;
9592
+ this.separator = ',';
9592
9593
  this.fillend = new i0.EventEmitter();
9593
9594
  this.selchange = new i0.EventEmitter();
9594
9595
  this.initend = new i0.EventEmitter();
9595
9596
  this.myData = new Array();
9596
- this.selval = "-1";
9597
- this.errorMsg = "";
9598
- this.valDef = "-1";
9597
+ this.filter = '';
9598
+ this.myDataFilter = [];
9599
+ this.selval = '-1';
9600
+ this.errorMsg = '';
9601
+ this.valDef = '-1';
9599
9602
  }
9603
+ FHListComponent.prototype.applyFilter = function () {
9604
+ var _this = this;
9605
+ if ((this.filter || '') == '')
9606
+ this.myDataFilter = JSON.parse(JSON.stringify(this.myData));
9607
+ else
9608
+ this.myDataFilter = this.myData.filter(function (el) {
9609
+ return el.descrizione_valore.toLowerCase().indexOf(_this.filter.toLowerCase()) > -1;
9610
+ });
9611
+ };
9600
9612
  FHListComponent.prototype.change_v = function (u, o) {
9601
9613
  u.checked = !u.checked;
9602
9614
  this.upd_f(u, o);
@@ -9622,15 +9634,17 @@
9622
9634
  };
9623
9635
  FHListComponent.prototype.reset = function () {
9624
9636
  this.myData = new Array();
9637
+ this.applyFilter();
9625
9638
  this.resetValue();
9626
9639
  };
9627
- FHListComponent.prototype.fillCombo = function () {
9640
+ FHListComponent.prototype.fillCombo = function (force) {
9628
9641
  var _this = this;
9642
+ if (force === void 0) { force = false; }
9629
9643
  //(this.init_fill);
9630
- if (!this.init_fill) {
9644
+ if (!this.init_fill && !force) {
9631
9645
  return;
9632
9646
  }
9633
- console.log("fillcombolist");
9647
+ // console.log('fillcombolist');
9634
9648
  var p = new QParam();
9635
9649
  p.sql = this.sql;
9636
9650
  p.types = this.types;
@@ -9638,12 +9652,13 @@
9638
9652
  console.log('p ', p);
9639
9653
  this._dataService.doQuery(p).subscribe(function (data) {
9640
9654
  if (data != null)
9641
- if (data.result_msg == "OK") {
9655
+ if (data.result_msg == 'OK') {
9642
9656
  _this.myData = data.result_data;
9657
+ _this.applyFilter();
9643
9658
  _this.resetValue();
9644
9659
  // console.log(this.smtr); console.log(this.smtr.nativeElement);
9645
9660
  _this.setByValue(_this.valDef);
9646
- if (_this.getValue() == "" && _this.valDef != "-1")
9661
+ if (_this.getValue() == '' && _this.valDef != '-1')
9647
9662
  _this.setByDescri(_this.valDef);
9648
9663
  _this.fillend.emit();
9649
9664
  }
@@ -9651,15 +9666,15 @@
9651
9666
  _this.errorMsg =
9652
9667
  "ERRORE DI CONNESSIONE CON IL SERVER.RITENTARE PIU' TARDI [" +
9653
9668
  _this.sql +
9654
- "]";
9669
+ ']';
9655
9670
  });
9656
9671
  };
9657
9672
  FHListComponent.prototype.setByDescri = function (desc_val) {
9658
- console.log("setByDescri " + desc_val);
9673
+ console.log('setByDescri ' + desc_val);
9659
9674
  this.valDef = desc_val;
9660
9675
  if (desc_val == null)
9661
9676
  return;
9662
- if (desc_val == "")
9677
+ if (desc_val == '')
9663
9678
  return;
9664
9679
  if (this.myData == null)
9665
9680
  return;
@@ -9669,15 +9684,15 @@
9669
9684
  console.log('arr_val ', arr_val);
9670
9685
  for (var j = 0; j < this.myData.length; j++)
9671
9686
  for (var j1 = 0; j1 < arr_val.length; j1++) {
9672
- console.log('v1 - v2', this.myData[j].descrizione_valore, arr_val[j1]);
9687
+ // console.log('v1 - v2', this.myData[j].descrizione_valore, arr_val[j1]);
9673
9688
  if (this.myData[j].descrizione_valore == arr_val[j1]) {
9674
9689
  this.myData[j].checked = true;
9675
9690
  }
9676
9691
  }
9677
9692
  };
9678
9693
  FHListComponent.prototype.setByIndex = function (ind) {
9679
- this.valDef = "";
9680
- this.selval = "-1";
9694
+ this.valDef = '';
9695
+ this.selval = '-1';
9681
9696
  if (this.myData == null)
9682
9697
  return;
9683
9698
  if (this.myData.length == 0 || this.myData[0] == null)
@@ -9692,7 +9707,7 @@
9692
9707
  if (desc_val == null)
9693
9708
  return;
9694
9709
  // console.log(this.myData);
9695
- if ("" + desc_val == "") {
9710
+ if ('' + desc_val == '') {
9696
9711
  // console.log('qqq1111');
9697
9712
  return;
9698
9713
  }
@@ -9713,10 +9728,10 @@
9713
9728
  }
9714
9729
  };
9715
9730
  FHListComponent.prototype.getDescri = function () {
9716
- var sx = "";
9731
+ var sx = '';
9717
9732
  for (var j = 0; j < this.myData.length; j++)
9718
9733
  if (this.myData[j].checked) {
9719
- if (sx != "")
9734
+ if (sx != '')
9720
9735
  sx = sx + this.separator;
9721
9736
  sx = sx + this.myData[j].descrizione_valore;
9722
9737
  }
@@ -9731,10 +9746,10 @@
9731
9746
  return sx;
9732
9747
  };
9733
9748
  FHListComponent.prototype.getValue = function () {
9734
- var sx = "";
9749
+ var sx = '';
9735
9750
  for (var j = 0; j < this.myData.length; j++)
9736
9751
  if (this.myData[j].checked) {
9737
- if (sx != "")
9752
+ if (sx != '')
9738
9753
  sx = sx + this.separator;
9739
9754
  sx = sx + this.myData[j].valore;
9740
9755
  }
@@ -9742,7 +9757,7 @@
9742
9757
  };
9743
9758
  FHListComponent.prototype.getData = function (campo) {
9744
9759
  for (var x in this.myData) {
9745
- if (this.myData[x]["valore"] == this.selval) {
9760
+ if (this.myData[x]['valore'] == this.selval) {
9746
9761
  return this.myData[x][campo];
9747
9762
  }
9748
9763
  else {
@@ -9756,33 +9771,35 @@
9756
9771
  };
9757
9772
  FHListComponent.prototype.set_options = function (s) {
9758
9773
  this.myData = new Array();
9759
- var a = s.split("$");
9774
+ var a = s.split('$');
9760
9775
  for (var i = 0; i < a.length; i++) {
9761
9776
  var o = new Object();
9762
- var av = a[i].split("|");
9777
+ var av = a[i].split('|');
9763
9778
  o.valore = av[1];
9764
9779
  o.descrizione_valore = av[0];
9765
9780
  o.checked = false;
9766
9781
  this.myData.push(o);
9767
9782
  }
9783
+ this.applyFilter();
9768
9784
  this.setByValue(this.valDef);
9769
- if (this.getValue() == "-1")
9785
+ if (this.getValue() == '-1')
9770
9786
  this.setByDescri(this.valDef);
9771
9787
  };
9772
9788
  FHListComponent.prototype.ngAfterViewInit = function () {
9773
9789
  var _this = this;
9790
+ // console.log(
9791
+ // '🚀 ~ file: fhlist.ts ~ line 259 ~ FHListComponent ~ ngAfterViewInit ~ ngAfterViewInit init_fill sql ',
9792
+ // this.init_fill,
9793
+ // this.sql
9794
+ // );
9774
9795
  setTimeout(function () {
9775
9796
  // console.log("ngAfterViewInit"); console.log(this.init_fill);
9776
9797
  if (_this.init_fill == true) {
9777
- if (_this.sql == "") {
9778
- //this.errorMsg="QUERY NON CONFIGURATA";
9798
+ if (_this.sql == '') {
9779
9799
  return;
9780
9800
  }
9781
9801
  _this.fillCombo();
9782
9802
  }
9783
- else {
9784
- _this.errorMsg = "";
9785
- }
9786
9803
  _this.initend.emit();
9787
9804
  });
9788
9805
  };
@@ -9793,8 +9810,8 @@
9793
9810
  }());
9794
9811
  FHListComponent.decorators = [
9795
9812
  { type: i0.Component, args: [{
9796
- selector: "FHList",
9797
- template: "\n <table class=\"fh_table\" style=\"width:100%;\">\n <thead>\n <tr>\n <th *ngIf=\"!single_sel\"></th>\n <th>\n {{ label }}\n </th>\n <th *ngIf=\"single_sel\"></th>\n </tr>\n </thead>\n <tbody>\n <tr\n *ngFor=\"let u of myData; let odd = odd; let even = even\"\n [ngClass]=\"{ odd: odd, even: even }\"\n >\n <td style=\"width:20px;\" valign=\"middle\" *ngIf=\"!single_sel\">\n <mat-slide-toggle\n (change)=\"upd_f(u, $event)\"\n [disabled]=\"!enabled\"\n [(ngModel)]=\"u.checked\"\n ></mat-slide-toggle>\n </td>\n <td (click)=\"change_v(u, $event)\" valign=\"middle\">\n {{ u.descrizione_valore }}\n </td>\n <td\n valign=\"middle\"\n style=\"width:20px;text-align: center\"\n *ngIf=\"single_sel\"\n >\n <button\n mat-flat-button\n color=\"primary\"\n (click)=\"upd_f(u, $event)\"\n [disabled]=\"!enabled\"\n >\n <mat-icon>send</mat-icon></button\n >&nbsp;&nbsp;&nbsp;\n </td>\n </tr>\n </tbody>\n </table>\n ",
9813
+ selector: 'FHList',
9814
+ template: "\n <div fxLayout=\"column\">\n <div [hidden]=\"!enableSearch\">\n <FHTextInput [label]=\"'Trova' | translate\" [(ngModel)]=\"filter\" (change)=\"applyFilter()\"></FHTextInput>\n </div>\n\n <table class=\"fh_table\" style=\"width:100%;\">\n <thead>\n <tr>\n <th *ngIf=\"!single_sel\"></th>\n <th>\n {{ label | translate }}\n </th>\n <th *ngIf=\"single_sel\"></th>\n </tr>\n </thead>\n <tbody>\n <tr\n *ngFor=\"let u of myDataFilter; let odd = odd; let even = even\"\n [ngClass]=\"{ odd: odd, even: even }\"\n >\n <td style=\"width:20px;\" *ngIf=\"!single_sel\">\n <mat-slide-toggle\n (change)=\"upd_f(u, $event)\"\n [disabled]=\"!enabled\"\n [(ngModel)]=\"u.checked\"\n ></mat-slide-toggle>\n </td>\n <td (click)=\"change_v(u, $event)\">\n {{ u.descrizione_valore }}\n </td>\n <td style=\"width:20px;text-align: center\" *ngIf=\"single_sel\">\n <button\n mat-flat-button\n color=\"primary\"\n (click)=\"upd_f(u, $event)\"\n [disabled]=\"!enabled\"\n class=\"fh_icon_button\"\n >\n <mat-icon>send</mat-icon></button\n >&nbsp;&nbsp;&nbsp;\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n ",
9798
9815
  styles: [""]
9799
9816
  },] }
9800
9817
  ];
@@ -9809,8 +9826,9 @@
9809
9826
  label: [{ type: i0.Input }],
9810
9827
  enabled: [{ type: i0.Input }],
9811
9828
  single_sel: [{ type: i0.Input }],
9829
+ enableSearch: [{ type: i0.Input }],
9812
9830
  separator: [{ type: i0.Input }],
9813
- smtr: [{ type: i0.ViewChild, args: ["cmb",] }],
9831
+ smtr: [{ type: i0.ViewChild, args: ['cmb',] }],
9814
9832
  fillend: [{ type: i0.Output }],
9815
9833
  selchange: [{ type: i0.Output }],
9816
9834
  initend: [{ type: i0.Output }]