@fluxhub/fluxhub-lib 11.0.146 → 11.0.148

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.
@@ -1771,20 +1771,31 @@ class FHListComponent {
1771
1771
  constructor(_dataService) {
1772
1772
  this._dataService = _dataService;
1773
1773
  this.init_fill = true;
1774
- this.sql = "";
1774
+ this.sql = '';
1775
1775
  this.types = [];
1776
1776
  this.values = [];
1777
- this.label = "";
1777
+ this.label = '';
1778
1778
  this.enabled = true;
1779
1779
  this.single_sel = false;
1780
- this.separator = ",";
1780
+ this.enableSearch = false;
1781
+ this.separator = ',';
1781
1782
  this.fillend = new EventEmitter();
1782
1783
  this.selchange = new EventEmitter();
1783
1784
  this.initend = new EventEmitter();
1784
1785
  this.myData = new Array();
1785
- this.selval = "-1";
1786
- this.errorMsg = "";
1787
- this.valDef = "-1";
1786
+ this.filter = '';
1787
+ this.myDataFilter = [];
1788
+ this.selval = '-1';
1789
+ this.errorMsg = '';
1790
+ this.valDef = '-1';
1791
+ }
1792
+ applyFilter() {
1793
+ if ((this.filter || '') == '')
1794
+ this.myDataFilter = JSON.parse(JSON.stringify(this.myData));
1795
+ else
1796
+ this.myDataFilter = this.myData.filter((el) => {
1797
+ return el.descrizione_valore.toLowerCase().indexOf(this.filter.toLowerCase()) > -1;
1798
+ });
1788
1799
  }
1789
1800
  change_v(u, o) {
1790
1801
  u.checked = !u.checked;
@@ -1811,14 +1822,15 @@ class FHListComponent {
1811
1822
  }
1812
1823
  reset() {
1813
1824
  this.myData = new Array();
1825
+ this.applyFilter();
1814
1826
  this.resetValue();
1815
1827
  }
1816
- fillCombo() {
1828
+ fillCombo(force = false) {
1817
1829
  //(this.init_fill);
1818
- if (!this.init_fill) {
1830
+ if (!this.init_fill && !force) {
1819
1831
  return;
1820
1832
  }
1821
- console.log("fillcombolist");
1833
+ // console.log('fillcombolist');
1822
1834
  let p = new QParam();
1823
1835
  p.sql = this.sql;
1824
1836
  p.types = this.types;
@@ -1826,12 +1838,13 @@ class FHListComponent {
1826
1838
  console.log('p ', p);
1827
1839
  this._dataService.doQuery(p).subscribe((data) => {
1828
1840
  if (data != null)
1829
- if (data.result_msg == "OK") {
1841
+ if (data.result_msg == 'OK') {
1830
1842
  this.myData = data.result_data;
1843
+ this.applyFilter();
1831
1844
  this.resetValue();
1832
1845
  // console.log(this.smtr); console.log(this.smtr.nativeElement);
1833
1846
  this.setByValue(this.valDef);
1834
- if (this.getValue() == "" && this.valDef != "-1")
1847
+ if (this.getValue() == '' && this.valDef != '-1')
1835
1848
  this.setByDescri(this.valDef);
1836
1849
  this.fillend.emit();
1837
1850
  }
@@ -1839,15 +1852,15 @@ class FHListComponent {
1839
1852
  this.errorMsg =
1840
1853
  "ERRORE DI CONNESSIONE CON IL SERVER.RITENTARE PIU' TARDI [" +
1841
1854
  this.sql +
1842
- "]";
1855
+ ']';
1843
1856
  });
1844
1857
  }
1845
1858
  setByDescri(desc_val) {
1846
- console.log("setByDescri " + desc_val);
1859
+ console.log('setByDescri ' + desc_val);
1847
1860
  this.valDef = desc_val;
1848
1861
  if (desc_val == null)
1849
1862
  return;
1850
- if (desc_val == "")
1863
+ if (desc_val == '')
1851
1864
  return;
1852
1865
  if (this.myData == null)
1853
1866
  return;
@@ -1857,15 +1870,15 @@ class FHListComponent {
1857
1870
  console.log('arr_val ', arr_val);
1858
1871
  for (let j = 0; j < this.myData.length; j++)
1859
1872
  for (let j1 = 0; j1 < arr_val.length; j1++) {
1860
- console.log('v1 - v2', this.myData[j].descrizione_valore, arr_val[j1]);
1873
+ // console.log('v1 - v2', this.myData[j].descrizione_valore, arr_val[j1]);
1861
1874
  if (this.myData[j].descrizione_valore == arr_val[j1]) {
1862
1875
  this.myData[j].checked = true;
1863
1876
  }
1864
1877
  }
1865
1878
  }
1866
1879
  setByIndex(ind) {
1867
- this.valDef = "";
1868
- this.selval = "-1";
1880
+ this.valDef = '';
1881
+ this.selval = '-1';
1869
1882
  if (this.myData == null)
1870
1883
  return;
1871
1884
  if (this.myData.length == 0 || this.myData[0] == null)
@@ -1880,7 +1893,7 @@ class FHListComponent {
1880
1893
  if (desc_val == null)
1881
1894
  return;
1882
1895
  // console.log(this.myData);
1883
- if ("" + desc_val == "") {
1896
+ if ('' + desc_val == '') {
1884
1897
  // console.log('qqq1111');
1885
1898
  return;
1886
1899
  }
@@ -1901,10 +1914,10 @@ class FHListComponent {
1901
1914
  }
1902
1915
  }
1903
1916
  getDescri() {
1904
- let sx = "";
1917
+ let sx = '';
1905
1918
  for (let j = 0; j < this.myData.length; j++)
1906
1919
  if (this.myData[j].checked) {
1907
- if (sx != "")
1920
+ if (sx != '')
1908
1921
  sx = sx + this.separator;
1909
1922
  sx = sx + this.myData[j].descrizione_valore;
1910
1923
  }
@@ -1919,10 +1932,10 @@ class FHListComponent {
1919
1932
  return sx;
1920
1933
  }
1921
1934
  getValue() {
1922
- let sx = "";
1935
+ let sx = '';
1923
1936
  for (let j = 0; j < this.myData.length; j++)
1924
1937
  if (this.myData[j].checked) {
1925
- if (sx != "")
1938
+ if (sx != '')
1926
1939
  sx = sx + this.separator;
1927
1940
  sx = sx + this.myData[j].valore;
1928
1941
  }
@@ -1930,7 +1943,7 @@ class FHListComponent {
1930
1943
  }
1931
1944
  getData(campo) {
1932
1945
  for (var x in this.myData) {
1933
- if (this.myData[x]["valore"] == this.selval) {
1946
+ if (this.myData[x]['valore'] == this.selval) {
1934
1947
  return this.myData[x][campo];
1935
1948
  }
1936
1949
  else {
@@ -1944,32 +1957,34 @@ class FHListComponent {
1944
1957
  }
1945
1958
  set_options(s) {
1946
1959
  this.myData = new Array();
1947
- var a = s.split("$");
1960
+ var a = s.split('$');
1948
1961
  for (let i = 0; i < a.length; i++) {
1949
1962
  var o = new Object();
1950
- var av = a[i].split("|");
1963
+ var av = a[i].split('|');
1951
1964
  o.valore = av[1];
1952
1965
  o.descrizione_valore = av[0];
1953
1966
  o.checked = false;
1954
1967
  this.myData.push(o);
1955
1968
  }
1969
+ this.applyFilter();
1956
1970
  this.setByValue(this.valDef);
1957
- if (this.getValue() == "-1")
1971
+ if (this.getValue() == '-1')
1958
1972
  this.setByDescri(this.valDef);
1959
1973
  }
1960
1974
  ngAfterViewInit() {
1975
+ // console.log(
1976
+ // '🚀 ~ file: fhlist.ts ~ line 259 ~ FHListComponent ~ ngAfterViewInit ~ ngAfterViewInit init_fill sql ',
1977
+ // this.init_fill,
1978
+ // this.sql
1979
+ // );
1961
1980
  setTimeout(() => {
1962
1981
  // console.log("ngAfterViewInit"); console.log(this.init_fill);
1963
1982
  if (this.init_fill == true) {
1964
- if (this.sql == "") {
1965
- //this.errorMsg="QUERY NON CONFIGURATA";
1983
+ if (this.sql == '') {
1966
1984
  return;
1967
1985
  }
1968
1986
  this.fillCombo();
1969
1987
  }
1970
- else {
1971
- this.errorMsg = "";
1972
- }
1973
1988
  this.initend.emit();
1974
1989
  });
1975
1990
  }
@@ -1979,43 +1994,45 @@ class FHListComponent {
1979
1994
  }
1980
1995
  FHListComponent.decorators = [
1981
1996
  { type: Component, args: [{
1982
- selector: "FHList",
1997
+ selector: 'FHList',
1983
1998
  template: `
1999
+ <div fxLayout="column">
2000
+ <div [hidden]="!enableSearch">
2001
+ <FHTextInput [label]="'Trova' | translate" [(ngModel)]="filter" (change)="applyFilter()"></FHTextInput>
2002
+ </div>
2003
+
1984
2004
  <table class="fh_table" style="width:100%;">
1985
2005
  <thead>
1986
2006
  <tr>
1987
2007
  <th *ngIf="!single_sel"></th>
1988
2008
  <th>
1989
- {{ label }}
2009
+ {{ label | translate }}
1990
2010
  </th>
1991
2011
  <th *ngIf="single_sel"></th>
1992
2012
  </tr>
1993
2013
  </thead>
1994
2014
  <tbody>
1995
2015
  <tr
1996
- *ngFor="let u of myData; let odd = odd; let even = even"
2016
+ *ngFor="let u of myDataFilter; let odd = odd; let even = even"
1997
2017
  [ngClass]="{ odd: odd, even: even }"
1998
2018
  >
1999
- <td style="width:20px;" valign="middle" *ngIf="!single_sel">
2019
+ <td style="width:20px;" *ngIf="!single_sel">
2000
2020
  <mat-slide-toggle
2001
2021
  (change)="upd_f(u, $event)"
2002
2022
  [disabled]="!enabled"
2003
2023
  [(ngModel)]="u.checked"
2004
2024
  ></mat-slide-toggle>
2005
2025
  </td>
2006
- <td (click)="change_v(u, $event)" valign="middle">
2026
+ <td (click)="change_v(u, $event)">
2007
2027
  {{ u.descrizione_valore }}
2008
2028
  </td>
2009
- <td
2010
- valign="middle"
2011
- style="width:20px;text-align: center"
2012
- *ngIf="single_sel"
2013
- >
2029
+ <td style="width:20px;text-align: center" *ngIf="single_sel">
2014
2030
  <button
2015
2031
  mat-flat-button
2016
2032
  color="primary"
2017
2033
  (click)="upd_f(u, $event)"
2018
2034
  [disabled]="!enabled"
2035
+ class="fh_icon_button"
2019
2036
  >
2020
2037
  <mat-icon>send</mat-icon></button
2021
2038
  >&nbsp;&nbsp;&nbsp;
@@ -2023,6 +2040,7 @@ FHListComponent.decorators = [
2023
2040
  </tr>
2024
2041
  </tbody>
2025
2042
  </table>
2043
+ </div>
2026
2044
  `,
2027
2045
  styles: [``]
2028
2046
  },] }
@@ -2038,8 +2056,9 @@ FHListComponent.propDecorators = {
2038
2056
  label: [{ type: Input }],
2039
2057
  enabled: [{ type: Input }],
2040
2058
  single_sel: [{ type: Input }],
2059
+ enableSearch: [{ type: Input }],
2041
2060
  separator: [{ type: Input }],
2042
- smtr: [{ type: ViewChild, args: ["cmb",] }],
2061
+ smtr: [{ type: ViewChild, args: ['cmb',] }],
2043
2062
  fillend: [{ type: Output }],
2044
2063
  selchange: [{ type: Output }],
2045
2064
  initend: [{ type: Output }]
@@ -14299,6 +14318,7 @@ class fh_win_list {
14299
14318
  this.single_sel = false;
14300
14319
  this.sel_values = "";
14301
14320
  this.required = true;
14321
+ this.enableSearch = true;
14302
14322
  this.options = null;
14303
14323
  this.cmb_sel = null;
14304
14324
  if (data != null) {
@@ -14324,6 +14344,8 @@ class fh_win_list {
14324
14344
  this.doFill();
14325
14345
  if (data.options != null)
14326
14346
  this.options = data.options;
14347
+ if (data.enableSearch != null)
14348
+ this.enableSearch = data.enableSearch;
14327
14349
  }
14328
14350
  }
14329
14351
  close() {
@@ -14390,6 +14412,7 @@ fh_win_list.decorators = [
14390
14412
  [label]="label"
14391
14413
  [single_sel]="single_sel"
14392
14414
  [separator]="separator"
14415
+ [enableSearch]="enableSearch"
14393
14416
  style="width:100%;height:100%"
14394
14417
  [init_fill]="false"
14395
14418
  (selchange)="ok_single()"