@fluxhub/fluxhub-lib 10.0.519 → 10.0.521

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.
@@ -7780,6 +7780,12 @@
7780
7780
  var _this = this;
7781
7781
  this.myData = new Array();
7782
7782
  this.searchItemsFiltered = new Array();
7783
+ if (this.sql == null)
7784
+ this.sql = "";
7785
+ if (this.sql.indexOf("|") != -1 && this.sql.indexOf("$") != -1) {
7786
+ this.set_options(this.sql);
7787
+ return;
7788
+ }
7783
7789
  var p = new QParam();
7784
7790
  p.sql = this.sql;
7785
7791
  p.types = this.types;
@@ -16331,6 +16337,1845 @@
16331
16337
  { type: undefined, decorators: [{ type: i0.Inject, args: [dialog.MAT_DIALOG_DATA,] }] }
16332
16338
  ]; };
16333
16339
 
16340
+ var FHGridComponentN = /** @class */ (function () {
16341
+ function FHGridComponentN(_gridservice, _toast, _dataService, m_appService, slimLoadingBarService, m_dialog, uti_s, _fileService, clipboard) {
16342
+ var _this = this;
16343
+ this._gridservice = _gridservice;
16344
+ this._toast = _toast;
16345
+ this._dataService = _dataService;
16346
+ this.m_appService = m_appService;
16347
+ this.slimLoadingBarService = slimLoadingBarService;
16348
+ this.m_dialog = m_dialog;
16349
+ this.uti_s = uti_s;
16350
+ this._fileService = _fileService;
16351
+ this.clipboard = clipboard;
16352
+ this.width_max = '100%';
16353
+ this.browser = 'nd';
16354
+ this.tooltipShowDelay = 2000;
16355
+ this.elimina_label = 'ELIMINA';
16356
+ this.export_field_aggiuntivi = '';
16357
+ this.end_point = null;
16358
+ this.tbl_name = "";
16359
+ this.num_per_pag = 35;
16360
+ this.grid_key = "PRO_H";
16361
+ this.enabled = true;
16362
+ this.show_link = false;
16363
+ this.show_help_bar = false;
16364
+ this.help_label_bar = 'HELP';
16365
+ this.auto_load = true;
16366
+ this.auto_height = false;
16367
+ this.enable_export = true;
16368
+ this.enabled_pag = true;
16369
+ this.show_help = true;
16370
+ this.show_num_elem = true;
16371
+ this.system_dest = 1;
16372
+ this.header_h = 35;
16373
+ this.selection_mode = 'multiple';
16374
+ this.init_fill = true;
16375
+ this.no_pref = false;
16376
+ this.pref_hidden = true;
16377
+ this.enable_export_pdf = true;
16378
+ this.enable_export_xls = true;
16379
+ this.enable_copy = true;
16380
+ this.autosize_at_ini = true;
16381
+ this.label_elementi = " Elementi";
16382
+ this.trova_label = "TROVA";
16383
+ this.mantieni_impostazioni = "Mantieni Imp.";
16384
+ this.curr_filter = "";
16385
+ this.show_buttons = true;
16386
+ this.fill_end = new i0.EventEmitter();
16387
+ this.cell_edited = new i0.EventEmitter();
16388
+ this.clicked = new i0.EventEmitter();
16389
+ this.dclicked = new i0.EventEmitter();
16390
+ this.columndclicked = new i0.EventEmitter();
16391
+ this.cell_clicked = new i0.EventEmitter();
16392
+ this.custom_export = false;
16393
+ this.toolbar_type = "NONE";
16394
+ this.toolbar_wkfapp = null;
16395
+ this.toolbar_custom_commands = [];
16396
+ this.command = new i0.EventEmitter();
16397
+ this.b_ensure = false;
16398
+ this.curr_config = "-1";
16399
+ /* calcola_filtro(obj_filtro, filter_v, key, add_end = true) {
16400
+ console.log('calcola_filtro ',key,add_end);
16401
+ let b_filter: boolean = false;
16402
+ if (obj_filtro.type != null) {
16403
+ if (obj_filtro.filter != null) {
16404
+
16405
+ if (add_end) filter_v = filter_v + " and ";
16406
+ b_filter = true;
16407
+ if (obj_filtro.filterType == "number") {
16408
+ if (obj_filtro.type == "greaterThan")
16409
+ filter_v = filter_v + " " + key + " > " + obj_filtro.filter;
16410
+ if (obj_filtro.type == "equals")
16411
+ filter_v = filter_v + " " + key + " = " + obj_filtro.filter;
16412
+ if (obj_filtro.type == "notEqual")
16413
+ filter_v = filter_v + " " + key + " <> " + obj_filtro.filter;
16414
+ if (obj_filtro.type == "lessThan")
16415
+ filter_v = filter_v + " " + key + " < " + obj_filtro.filter;
16416
+ if (obj_filtro.type == "lessThanOrEqual")
16417
+ filter_v = filter_v + " " + key + " <= " + obj_filtro.filter;
16418
+ if (obj_filtro.type == "greaterThanOrEqual")
16419
+ filter_v = filter_v + " " + key + " >= " + obj_filtro.filter;
16420
+ if (obj_filtro.type == "inRange")
16421
+ filter_v =
16422
+ filter_v +
16423
+ " (" +
16424
+ key +
16425
+ " >= " +
16426
+ obj_filtro.filter +
16427
+ " and " +
16428
+ key +
16429
+ " <= " +
16430
+ obj_filtro.filterTo +
16431
+ ")";
16432
+ } else {
16433
+ if (obj_filtro.type == "contains")
16434
+ filter_v =
16435
+ filter_v +
16436
+ " upper(" +
16437
+ key +
16438
+ ") like '%" +
16439
+ obj_filtro.filter.replace("'", "$'").replace("*", "$*").replace("?", "$?").replace("[", "$[").replace("]", "$]").replace("!", "'$").toUpperCase() +
16440
+ "%' ESCAPE '$'";
16441
+ if (obj_filtro.type == "startsWith")
16442
+ filter_v =
16443
+ filter_v +
16444
+ " upper(" +
16445
+ key +
16446
+ ") like '" +
16447
+ obj_filtro.filter.replace("'", "$'").replace("*", "$*").replace("?", "$?").replace("[", "$[").replace("]", "$]").replace("!", "'$").toUpperCase() +
16448
+ "%' ESCAPE '$'";
16449
+ if (obj_filtro.type == "equals")
16450
+ filter_v =
16451
+ filter_v +
16452
+ " upper(" +
16453
+ key +
16454
+ ") = '" +
16455
+ obj_filtro.filter.replace("'", "''").toUpperCase() +
16456
+ "%'";
16457
+ if (obj_filtro.type == "notContains")
16458
+ filter_v =
16459
+ filter_v +
16460
+ "not upper(" +
16461
+ key +
16462
+ ") like '%" +
16463
+ obj_filtro.filter.replace("'", "$'").replace("*", "$*").replace("?", "$?").replace("[", "$[").replace("]", "$]").replace("!", "'$").toUpperCase() +
16464
+ "%' ESCAPE '$'";
16465
+
16466
+ if (obj_filtro.type == "notEqual")
16467
+ filter_v =
16468
+ filter_v +
16469
+ " upper(" +
16470
+ key +
16471
+ ") <> '" +
16472
+ obj_filtro.filter.replace("'", "''").toUpperCase() +
16473
+ "'";
16474
+ if (obj_filtro.type == "endsWith")
16475
+ filter_v =
16476
+ filter_v +
16477
+ " upper(" +
16478
+ key +
16479
+ ") like '%" +
16480
+ obj_filtro.replace("'", "$'").replace("*", "$*").replace("?", "$?").replace("[", "$[").replace("]", "$]").replace("!", "'$").toUpperCase() +
16481
+ "' ESCAPE '$'";
16482
+ // if(obj_filtro.type=="startsWith") filter_v = filter_v +' upper('+ key + ') like \'' + obj_filtro.filter.replace('\'', '\'\'').toUpperCase() + '%\'';
16483
+ }
16484
+ }
16485
+ if (obj_filtro.type == 'inRange'){
16486
+ if (obj_filtro.dateTo != null && obj_filtro.dateFrom != null) {
16487
+ if(obj_filtro.dateFrom>=obj_filtro.dateTo){
16488
+ this._toast.error('Data inizio range deve essere maggiore di data fine range');
16489
+ return;
16490
+ }
16491
+ b_filter = true;
16492
+ if (add_end) filter_v = filter_v + " and ";
16493
+ filter_v = filter_v + ' ('+key+'>='+ this.uti_s.sql_date_grid(
16494
+ this.uti_s.string2date(obj_filtro.dateFrom, 5)
16495
+ )+' and '+key+'<='+ this.uti_s.sql_date_grid(
16496
+ this.uti_s.string2date(obj_filtro.dateTo, 5)
16497
+ )+') ';
16498
+ }
16499
+ }else
16500
+ if (obj_filtro.dateTo != null || obj_filtro.dateFrom != null) {
16501
+ b_filter = true;
16502
+ if (add_end) filter_v = filter_v + " and ";
16503
+ filter_v = filter_v + " (";
16504
+ // if (obj_filtro.dateFrom != null && obj_filtro.dateTo != null && this.uti_s.sql_date_grid(this.uti_s.string2date(obj_filtro.dateFrom, 5))!='dbnull') filter_v = filter_v + key + ">=" + this.uti_s.sql_date_grid(this.uti_s.string2date(obj_filtro.dateFrom, 5));
16505
+
16506
+ if (
16507
+ obj_filtro.dateFrom != null &&
16508
+ this.uti_s.sql_date_grid(
16509
+ this.uti_s.string2date(obj_filtro.dateFrom, 5)
16510
+ ) != "dbnull"
16511
+ ) {
16512
+ let q: string = "";
16513
+ if (obj_filtro.type == "greaterThan")
16514
+ q =
16515
+ " " +
16516
+ key +
16517
+ " >= " +
16518
+ this.uti_s.sql_date_grid(
16519
+ this.uti_s.string2date(obj_filtro.dateFrom, 5)
16520
+ ) +
16521
+ "";
16522
+ if (obj_filtro.type == "equals")
16523
+ q =
16524
+ " (" +
16525
+ key +
16526
+ " >=" +
16527
+ this.uti_s.sql_date_grid(
16528
+ this.uti_s.string2date(obj_filtro.dateFrom, 5)
16529
+ ) +
16530
+ " and " +
16531
+ key +
16532
+ " <=" +
16533
+ this.uti_s.sql_date_grid(
16534
+ this.uti_s.string2date(obj_filtro.dateFrom, 5),
16535
+ "T23:59:00"
16536
+ ) +
16537
+ ")";
16538
+ if (obj_filtro.type == "notEqual")
16539
+ q =
16540
+ " " +
16541
+ key +
16542
+ " <> " +
16543
+ this.uti_s.sql_date_grid(
16544
+ this.uti_s.string2date(obj_filtro.dateFrom, 5)
16545
+ ) +
16546
+ "";
16547
+ if (obj_filtro.type == "lessThan")
16548
+ q =
16549
+ " " +
16550
+ key +
16551
+ " <= " +
16552
+ this.uti_s.sql_date_grid(
16553
+ this.uti_s.string2date(obj_filtro.dateFrom, 5)
16554
+ ) +
16555
+ "";
16556
+ let dtx:Date= this.uti_s.string2date(obj_filtro.dateFrom, 5)
16557
+ dtx.setHours(23);
16558
+ dtx.setMinutes(59);
16559
+
16560
+ if (obj_filtro.type == "lessThanOrEqual")
16561
+ q =
16562
+ " " +
16563
+ key +
16564
+ " <= " +
16565
+ this.uti_s.sql_date_grid(
16566
+ dtx
16567
+ ) +
16568
+ "";
16569
+ if (obj_filtro.type == "greaterThanOrEqual")
16570
+ q =
16571
+ " " +
16572
+ key +
16573
+ " >= " +
16574
+ this.uti_s.sql_date_grid(
16575
+ this.uti_s.string2date(obj_filtro.dateFrom, 5)
16576
+ ) +
16577
+ "";
16578
+ filter_v = filter_v + q;
16579
+ } else filter_v = filter_v + "1=1";
16580
+ filter_v = filter_v + " )";
16581
+ }
16582
+ } else {
16583
+ // if(obj_filtro.length>0)filter_v= filter_v+' and ';
16584
+ let like_f:string='';
16585
+ let sq: string = "";
16586
+ let include_null_value: boolean = false;
16587
+ if (obj_filtro.values != null)
16588
+ for (let i: number = 0; i < obj_filtro.values.length; i++)
16589
+ if (obj_filtro.values[i] != null) {
16590
+ if (sq != "") sq = sq + ",";
16591
+
16592
+ sq = sq + "'" + obj_filtro.values[i].replace("'", "''") + "'";
16593
+ if (like_f != "") like_f = like_f + " or ";
16594
+ like_f = like_f + " upper(" +
16595
+ key +
16596
+ ") like '%" +
16597
+ obj_filtro.values[i].replace("'", "$'").replace("*", "$*").replace("?", "$?").replace("[", "$[").replace("]", "$]").replace("!", "'$").toUpperCase() +
16598
+ "%' ESCAPE '$'";
16599
+
16600
+ } else {
16601
+ include_null_value = true;
16602
+ }
16603
+ let num_all=-1;
16604
+
16605
+ let countryFilterComponent:ColDef = this.gridOptions.api.getColumnDef(key);
16606
+
16607
+ if(countryFilterComponent!=null)
16608
+ if(countryFilterComponent.filterParams!=null)
16609
+ if(countryFilterComponent.filterParams.values!=null)
16610
+ {
16611
+ let model = countryFilterComponent.filterParams.values;
16612
+ model=model.filter((n, i) => model.indexOf(n) === i);
16613
+
16614
+ if(model!=null)num_all=model.length;
16615
+ }
16616
+ console.log('KEY!!!! ',key);
16617
+ if(key!='pers_int'){
16618
+ if (sq != "" ) {
16619
+ if(obj_filtro.values.length!=num_all){
16620
+ b_filter = true;
16621
+ if (add_end) filter_v = filter_v + " and ";
16622
+ if (!include_null_value) filter_v = filter_v + key + " in (" + sq + ")";
16623
+ else
16624
+ filter_v =
16625
+ filter_v + "(" + key + " in (" + sq + ") or " + key + " is null)";
16626
+ }
16627
+ } else {
16628
+ b_filter = true;
16629
+ if (add_end) filter_v = filter_v + " and ";
16630
+ if (!include_null_value) filter_v = filter_v + " (1=0)";
16631
+ else filter_v = filter_v + " " + key + " is null";
16632
+ }
16633
+ }else
16634
+ {
16635
+ if(like_f!=''){
16636
+ console.log('like_f ',like_f);
16637
+ b_filter = true;
16638
+ if (add_end)filter_v = filter_v + " and ";
16639
+ filter_v = filter_v +"(" + like_f + ")";
16640
+ }
16641
+ }
16642
+ }
16643
+
16644
+ console.log('return filter_v ',filter_v);
16645
+ return filter_v;
16646
+ }*/
16647
+ this.init_end = new i0.EventEmitter();
16648
+ this.off_set = 0;
16649
+ this.first_ref = true;
16650
+ this.b_restored = false;
16651
+ this.str_curr_q_p = "";
16652
+ this.p_fi = {};
16653
+ this.dataSource = {
16654
+ //rowCount: ???, - not setting the row count, infinite paging will be used
16655
+ getRows: function (params) {
16656
+ // this code should contact the server for rows. however for the purposes of the demo,
16657
+ // the data is generated locally, a timer is used to give the experience of
16658
+ // an asynchronous call
16659
+ // console.log('asking for ' + params.startRow + ' to ' + params.endRow);
16660
+ //console.log( params.filterModel);// + ' params.filterModel ' +params.filterModel);
16661
+ _this.slimLoadingBarService.start(function () { });
16662
+ var p = { kd: _this.tbl_name };
16663
+ // p.table = this.tbl_name;
16664
+ // p.table_count = this.tbl_name;
16665
+ //if (this.count_tbl_name != "") p.table_count = this.count_tbl_name;
16666
+ // console.log(params);
16667
+ p.num_per_pag = params.endRow - params.startRow;
16668
+ // this.gridOptions.paginationPageSize = this.num_per_pag;
16669
+ // this.gridOptions.cacheBlockSize = this.num_per_pag;
16670
+ // console.log(this.gridOptions.cacheBlockSize );
16671
+ // console.log(this.gridOptions.paginationPageSize );
16672
+ p.curr_page = Math.round(params.startRow / p.num_per_pag);
16673
+ if (p.curr_page == null)
16674
+ p.curr_page = 0;
16675
+ if (p.num_per_pag == null)
16676
+ p.num_per_pag = 100;
16677
+ p.system_dest = _this.system_dest;
16678
+ p.p = JSON.stringify({ sort_model: params.sortModel, filter_model: params.filterModel, free_search: _this.ric_libera });
16679
+ //p.sort_field = this.sort_field;
16680
+ /*
16681
+ if (params.sortModel != null)
16682
+ if (params.sortModel.length > 0) {
16683
+ p.sort_field = "";
16684
+ for (var i: number = 0; i < params.sortModel.length; i++) {
16685
+ if (p.sort_field != "") p.sort_field = p.sort_field + ",";
16686
+ if (params.sortModel[i].colId == "autori")
16687
+ p.sort_field =
16688
+ p.sort_field +
16689
+ "case when CHARINDEX('" +
16690
+ this.m_appService.user +
16691
+ "',autori)>0 then 1 else 0 end" +
16692
+ " " +
16693
+ params.sortModel[i].sort;
16694
+ else
16695
+ p.sort_field =
16696
+ p.sort_field +
16697
+ params.sortModel[i].colId +
16698
+ " " +
16699
+ params.sortModel[i].sort;
16700
+ }
16701
+ }
16702
+
16703
+
16704
+
16705
+
16706
+ if (this.filters != null) p.filter = this.filters;
16707
+
16708
+ if (this.fix_flt != "") {
16709
+ if (p.filter != "") p.filter = p.filter + " and ";
16710
+ p.filter = p.filter + " (" + this.fix_flt + " )";
16711
+ }
16712
+
16713
+ if (this.fix_flt_temp != "") {
16714
+ if (p.filter != "") p.filter = p.filter + " and ";
16715
+ p.filter = p.filter + " (" + this.fix_flt_temp + " )";
16716
+ }
16717
+
16718
+ // console.log('Filter model');
16719
+ //console.log(params.filterModel);
16720
+
16721
+ if (params.filterModel != null) {
16722
+ // console.log('Filtri');
16723
+
16724
+ for (let key in params.filterModel) {
16725
+ // console.log(key);
16726
+ // if (p.hasOwnProperty(key)) {
16727
+ // console.log( params.filterModel[key]);
16728
+ let obj_filtro_test = params.filterModel[key];
16729
+ console.log(params.filterModel[key], key);
16730
+ if (obj_filtro_test.operator == null) {
16731
+ if (p.filter == "")
16732
+ p.filter += this.calcola_filtro(
16733
+ params.filterModel[key],
16734
+ "",
16735
+ key,
16736
+ false
16737
+ );
16738
+ else
16739
+ p.filter += this.calcola_filtro(
16740
+ params.filterModel[key],
16741
+ "",
16742
+ key,
16743
+ true
16744
+ );
16745
+ } else {
16746
+ if (p.filter != "") p.filter += " and ";
16747
+ p.filter += " (";
16748
+ p.filter += this.calcola_filtro(
16749
+ params.filterModel[key].condition1,
16750
+ "",
16751
+ key,
16752
+ false
16753
+ );
16754
+
16755
+ p.filter += " " + obj_filtro_test.operator + " ";
16756
+ p.filter += this.calcola_filtro(
16757
+ params.filterModel[key].condition2,
16758
+ "",
16759
+ key,
16760
+ false
16761
+ );
16762
+
16763
+ p.filter += ")";
16764
+ }
16765
+ // }
16766
+ }
16767
+ }
16768
+
16769
+ (data) => {
16770
+ //p.num_per_pag=5000;
16771
+ // console.log(this._gridservice);
16772
+ this.str_curr_q_p = "";
16773
+ if (p.filter != "") this.str_curr_q_p = "where " + p.filter;
16774
+ if (p.sort_field != "")
16775
+ this.str_curr_q_p = this.str_curr_q_p + " order by " + p.sort_field;
16776
+ this.curr_filter = p.filter;*/
16777
+ //console.log('params.filterModel ',params.filterModel, JSON.stringify(params.filterModel));
16778
+ if ((params.filterModel == null || JSON.stringify(params.filterModel) == '{}') && (_this.ric_libera == null || _this.ric_libera == ''))
16779
+ _this.show_pulisci_filtri = false;
16780
+ else
16781
+ _this.show_pulisci_filtri = true;
16782
+ // this._gridservice.url='https://web.raytecvision.com/test/api/dogridn';
16783
+ _this.p_fi = { kd: p.kd, system_dest: p.system_dest, p: p.p };
16784
+ _this._gridservice.doQuery(p, true, _this.m_appService.API_ENDPOINT + 'dogridn').subscribe(function (data) {
16785
+ var ok_op = false;
16786
+ if (data != null)
16787
+ if (data.result_msg == "OK") {
16788
+ ok_op = true;
16789
+ // console.log(data.result_data);
16790
+ params.successCallback(data.result_data, data.count);
16791
+ _this.b_init = true;
16792
+ _this.myData = data.result_data.slice();
16793
+ _this.num_r = data.count;
16794
+ _this.slimLoadingBarService.complete();
16795
+ _this.fill_end.emit();
16796
+ // console.log("end");
16797
+ // console.log(localStorage.getItem(this.grid_key+'_POS'));
16798
+ localStorage.setItem(_this.grid_key + "_POS1", JSON.stringify(p));
16799
+ if (localStorage.getItem(_this.grid_key + "_POS2") != null)
16800
+ if (_this.gridOptions != null)
16801
+ if (_this.gridOptions.api != null)
16802
+ _this.gridOptions.api.forEachNode(function (node) {
16803
+ // console.log(node)
16804
+ if (_this.getRowNodeId(node) ===
16805
+ localStorage.getItem(_this.grid_key + "_POS2")) {
16806
+ node.setSelected(true);
16807
+ localStorage.removeItem(_this.grid_key + "_POS2");
16808
+ if (localStorage.getItem(_this.grid_key + "_LAST_ROW") != null)
16809
+ _this.sRow = JSON.parse(localStorage.getItem(_this.grid_key + "_LAST_ROW"));
16810
+ localStorage.removeItem(_this.grid_key + "_LAST_ROW");
16811
+ }
16812
+ });
16813
+ var b_mantieni_ck = false;
16814
+ if (_this.toggle_mantieni != null)
16815
+ b_mantieni_ck = _this.toggle_mantieni.checked;
16816
+ if (_this.no_pref && !_this.b_init1) {
16817
+ _this.autoSizeAll();
16818
+ }
16819
+ _this.b_init1 = true;
16820
+ _this.ensure_visible();
16821
+ /*if (localStorage.getItem(this.grid_key + '_COLS')==null && this.first_ref) {
16822
+ setTimeout(() => {
16823
+ this.autoSizeAll();
16824
+ }, 300);
16825
+ this.first_ref = false;
16826
+
16827
+
16828
+ } else*/ if (localStorage.getItem(_this.grid_key + "_COLS") == null &&
16829
+ _this.autosize_at_ini)
16830
+ setTimeout(function () {
16831
+ _this.autoSizeAll();
16832
+ }, 300);
16833
+ //console.log('xxxxxxxxxxxxxxxxxxx');
16834
+ // console.log(this.m_appService.getState().grid_obj[this.grid_key+'_NODE'].id);
16835
+ //if(this.m_appService.getState().grid_obj[this.grid_key+'_NODE']!=null)
16836
+ /*
16837
+
16838
+ this.gridOptions.api.forEachNode( (node) =>{
16839
+ // select the node
16840
+ // console.log(node.id+' '+this.m_appService.getState().grid_obj[this.grid_key+'_NODE'].id);
16841
+ if(node.rowIndex==parseInt(localStorage.getItem(this.grid_key+'_POS'))){
16842
+ // console.log(node.id+' '+this.m_appService.getState().grid_obj[this.grid_key+'_NODE'].id);
16843
+ node.setSelected(true);
16844
+
16845
+ }}*/
16846
+ // if(this.m_appService.getState().grid_obj[this.grid_key+'_NODE']!=null)
16847
+ //this.gridOptions.api.get(parseInt(localStorage.getItem(this.grid_key+'_POS'))).setSelected(true);
16848
+ // console.log(this.myData);
16849
+ }
16850
+ if (!ok_op) {
16851
+ _this.errorMsg = data.msg + " [" + data.result_msg + "]";
16852
+ }
16853
+ }, function (err) {
16854
+ _this.errorMsg =
16855
+ "ERRORE DI CONNESSIONE CON IL SERVER. RITENTARE PIU' TARDI";
16856
+ });
16857
+ // this.gridOptions.api.setDatasource(this.dataSource);
16858
+ },
16859
+ };
16860
+ this.getContextMenuItems_n_e = function () { return [
16861
+ "autoSizeAll",
16862
+ "expandAll",
16863
+ "contractAll",
16864
+ "copy",
16865
+ "copyWithHeaders",
16866
+ "paste",
16867
+ ]; };
16868
+ this.getContextMenuItems_e = function () { return [
16869
+ "autoSizeAll",
16870
+ "expandAll",
16871
+ "contractAll",
16872
+ "copy",
16873
+ "copyWithHeaders",
16874
+ "paste",
16875
+ // 'resetColumns',
16876
+ {
16877
+ name: "Esporta",
16878
+ action: function () {
16879
+ _this.export_excel();
16880
+ },
16881
+ icon: '<img src="assets/icons/square-o/xlsx.svg"/>',
16882
+ },
16883
+ ]; };
16884
+ this.gridOptions = {
16885
+ debug: false,
16886
+ headerHeight: this.header_h,
16887
+ enableRangeSelection: true,
16888
+ defaultColDef: { resizable: true, sortable: true, floatingFilter: true },
16889
+ allowContextMenuWithControlKey: true,
16890
+ rowModelType: "infinite",
16891
+ localeText: {
16892
+ // for filter panel
16893
+ page: "pagina",
16894
+ more: "altre",
16895
+ to: "a",
16896
+ of: "di",
16897
+ next: "prossima",
16898
+ last: "ultima",
16899
+ first: "prima",
16900
+ previous: "precedente",
16901
+ loadingOoo: "Caricamento...",
16902
+ // for set filter
16903
+ selectAll: "Seleziona Tutto",
16904
+ searchOoo: "Trova...",
16905
+ blanks: "Vuoto",
16906
+ // for number filter and text filter
16907
+ filterOoo: "Filtro...",
16908
+ applyFilter: "Applica Filtro...",
16909
+ // for number filter
16910
+ equals: "Uguale",
16911
+ notEqual: "Diverso",
16912
+ lessThan: "Minore o Uguale",
16913
+ greaterThan: "Maggiore o Uguale",
16914
+ // for text filter
16915
+ notContains: "Non Contiene",
16916
+ contains: "Contiene",
16917
+ startsWith: "Inizia Con",
16918
+ endsWith: "Finisce Con",
16919
+ // the header of the default group column
16920
+ group: "Gruppo",
16921
+ // tool panel
16922
+ columns: "Colonne",
16923
+ rowGroupColumns: "Colonne Pivot",
16924
+ rowGroupColumnsEmptyMessage: "trascina le colonne per raggrupparle",
16925
+ valueColumns: "Colonne Valore",
16926
+ pivotMode: "Modalità Pivot",
16927
+ groups: "Gruppi",
16928
+ values: "Valori",
16929
+ pivots: "Pivots",
16930
+ valueColumnsEmptyMessage: "trascina le colonne per aggreare",
16931
+ pivotColumnsEmptyMessage: "trascina le colonne per pivot",
16932
+ // other
16933
+ noRowsToShow: "nessun dato",
16934
+ // enterprise menu
16935
+ pinColumn: "Sposta Colonna",
16936
+ valueAggregation: "Aggregazione",
16937
+ autosizeThiscolumn: "Autosize colonna",
16938
+ autosizeAllColumns: "Autosize tutte le colonne",
16939
+ groupBy: "Raggruppa per",
16940
+ ungroupBy: "Spacca per",
16941
+ resetColumns: "Resetta queste colonna",
16942
+ expandAll: "Espandi",
16943
+ collapseAll: "Chiudi",
16944
+ toolPanel: "Impostazioni",
16945
+ // enterprise menu pinning
16946
+ pinLeft: "Sposta <<",
16947
+ pinRight: "Sposta >>",
16948
+ noPin: "Sposta <>",
16949
+ // enterprise menu aggregation and status panel
16950
+ sum: "Somma",
16951
+ min: "Minimo",
16952
+ max: "Massimo",
16953
+ none: "Nessuno",
16954
+ count: "Numero",
16955
+ average: "Media",
16956
+ // standard menu
16957
+ copy: "Copia",
16958
+ ctrlC: "ctrl n C",
16959
+ paste: "Incolla",
16960
+ ctrlV: "ctrl n C",
16961
+ },
16962
+ getRowNodeId: function (item) {
16963
+ // console.log(item);
16964
+ if (item.ID != null)
16965
+ return String(item.ID);
16966
+ if (item.id != null)
16967
+ return String(item.id);
16968
+ if (item.uiid != null)
16969
+ return item.uiid;
16970
+ if (item.codice != null)
16971
+ return item.codice;
16972
+ if (item.id_doc != null)
16973
+ return item.id_doc;
16974
+ if (item.notesid != null)
16975
+ return item.notesid;
16976
+ if (item.ord != null)
16977
+ return item.ord;
16978
+ },
16979
+ };
16980
+ this.last_copy = '';
16981
+ this.b_init = false;
16982
+ this.b_init1 = false;
16983
+ this.errorMsg = "";
16984
+ this.innerWidth = 750;
16985
+ this.show_pulisci_filtri = false;
16986
+ this.uiid_stampa = "";
16987
+ this.xxopx = 0;
16988
+ this.num_r = 0;
16989
+ this.ready = false;
16990
+ this.ckk_ed = false;
16991
+ this.myData = new Array();
16992
+ this.b_iniended = false;
16993
+ this.ric_libera = "";
16994
+ this.fix_flt = "";
16995
+ this.fix_flt_temp = "";
16996
+ if (this.m_appService.getState().grid_obj == null)
16997
+ this.m_appService.getState().grid_obj = {};
16998
+ this.browser = this.getBrowserName();
16999
+ if (this.browser == 'ie')
17000
+ this.width_max = '';
17001
+ }
17002
+ FHGridComponentN.prototype.getBrowserName = function () {
17003
+ var agent = window.navigator.userAgent.toLowerCase();
17004
+ switch (true) {
17005
+ case agent.indexOf('edge') > -1:
17006
+ return 'edge';
17007
+ case agent.indexOf('opr') > -1 && !!window.opr:
17008
+ return 'opera';
17009
+ case agent.indexOf('chrome') > -1 && !!window.chrome:
17010
+ return 'chrome';
17011
+ case agent.indexOf('trident') > -1:
17012
+ return 'ie';
17013
+ case agent.indexOf('firefox') > -1:
17014
+ return 'firefox';
17015
+ case agent.indexOf('safari') > -1:
17016
+ return 'safari';
17017
+ default:
17018
+ return 'other';
17019
+ }
17020
+ };
17021
+ FHGridComponentN.prototype.docmd = function (o) {
17022
+ this.command.emit(o);
17023
+ };
17024
+ FHGridComponentN.prototype.ensure_visible = function () {
17025
+ if (this.b_ensure)
17026
+ return;
17027
+ this.b_ensure = true;
17028
+ try {
17029
+ if (localStorage.getItem(this.grid_key + "_POS") != null) {
17030
+ this.gridOptions.api.ensureIndexVisible(parseInt(localStorage.getItem(this.grid_key + "_POS")));
17031
+ localStorage.removeItem(this.grid_key + "_POS");
17032
+ }
17033
+ }
17034
+ catch (e) {
17035
+ console.log(e);
17036
+ }
17037
+ };
17038
+ FHGridComponentN.prototype.ck_flag = function () {
17039
+ if (!this.toggle_mantieni.checked) {
17040
+ localStorage.setItem(this.grid_key + "_MANTIENI", "SI");
17041
+ }
17042
+ else {
17043
+ localStorage.setItem(this.grid_key + "_MANTIENI", "NO");
17044
+ }
17045
+ };
17046
+ FHGridComponentN.prototype.refresh_all_rows = function () {
17047
+ var _this = this;
17048
+ setTimeout(function () {
17049
+ _this.gridOptions.api.refreshCells({
17050
+ force: true,
17051
+ });
17052
+ }, 0);
17053
+ };
17054
+ FHGridComponentN.prototype.ch_config = function () {
17055
+ if (this.no_pref)
17056
+ return;
17057
+ this.curr_config = this.gf.getValue();
17058
+ if (this.curr_config == "-1")
17059
+ return;
17060
+ localStorage.removeItem(this.grid_key + "_COLS");
17061
+ // localStorage.removeItem(this.grid_key + "_SORT");
17062
+ localStorage.removeItem(this.grid_key + "_FILTER");
17063
+ localStorage.removeItem(this.grid_key + "_CFG_DEFAULT");
17064
+ localStorage.removeItem(this.grid_key + "_FILTER_UP");
17065
+ if (this.gf.getObj().COL != null)
17066
+ if (this.gf.getObj().COL != "")
17067
+ localStorage.setItem(this.grid_key + "_COLS", this.gf.getObj().COL);
17068
+ // if (this.gf.getObj().SORT != null)
17069
+ // if (this.gf.getObj().SORT != "")
17070
+ // localStorage.setItem(this.grid_key + "_SORT", this.gf.getObj().SORT);
17071
+ if (this.gf.getObj().FILTER != null)
17072
+ if (this.gf.getObj().FILTER != "")
17073
+ localStorage.setItem(this.grid_key + "_FILTER", this.gf.getObj().FILTER);
17074
+ if (this.gf.getDescri() != null)
17075
+ if (this.gf.getDescri() != "-1")
17076
+ localStorage.setItem(this.grid_key + "_CFG_DEFAULT", this.gf.getDescri());
17077
+ this.curr_config = this.gf.getValue();
17078
+ this.res_columns(true);
17079
+ };
17080
+ FHGridComponentN.prototype.elimina_config = function () {
17081
+ var _this = this;
17082
+ if (this.gf.getObj().username != null)
17083
+ if (this.m_appService.user != this.gf.getObj().username) {
17084
+ this._toast.error("Configurazione gestibile da: " + this.gf.getObj().username);
17085
+ return;
17086
+ }
17087
+ localStorage.setItem(this.m_appService.COMPANY_KEY + "title_dialog", "Conferma Operazione");
17088
+ localStorage.setItem(this.m_appService.COMPANY_KEY + "msg_dialog", "Confermi di voler cancellare la configurazione " +
17089
+ this.gf.getDescri() +
17090
+ "?");
17091
+ var dialogRef = this.m_dialog.open(fh_win_confirm, {
17092
+ disableClose: true,
17093
+ });
17094
+ dialogRef.afterClosed().subscribe(function (result) {
17095
+ if (result) {
17096
+ var p = new QParam();
17097
+ p.sql = "DELETE_CFG_GRID";
17098
+ p.types = ["string", "string"];
17099
+ p.values = [_this.gf.getDescri(), _this.grid_key];
17100
+ var ok_op = false;
17101
+ _this._dataService.doQuery(p).subscribe(function (data) {
17102
+ var ok_op = false;
17103
+ if (data != null)
17104
+ if (data.result_msg == "OK") {
17105
+ _this._toast.info("Configurazione eliminata");
17106
+ _this.gf.types = ["string"];
17107
+ _this.gf.values = [_this.grid_key];
17108
+ _this.gf.fillCombo();
17109
+ _this.curr_config = "-1";
17110
+ }
17111
+ });
17112
+ }
17113
+ });
17114
+ };
17115
+ FHGridComponentN.prototype.edit_config = function () {
17116
+ var _this = this;
17117
+ if (this.gf.getObj().username != null)
17118
+ if (this.m_appService.user != this.gf.getObj().username) {
17119
+ this._toast.error("Configurazione gestibile da: " + this.gf.getObj().username);
17120
+ return;
17121
+ }
17122
+ localStorage.setItem(this.m_appService.COMPANY_KEY + "title_dialog", "Conferma Operazione");
17123
+ localStorage.setItem(this.m_appService.COMPANY_KEY + "msg_dialog", "Confermi di voler sovrascrivere la configurazione " +
17124
+ this.gf.getDescri() +
17125
+ "?");
17126
+ var dialogRef = this.m_dialog.open(fh_win_confirm, {
17127
+ disableClose: true,
17128
+ });
17129
+ dialogRef.afterClosed().subscribe(function (result) {
17130
+ if (result) {
17131
+ var p = new QParam();
17132
+ p.sql = "INSERT_UPDATE_CFG_GRID";
17133
+ var p_col = "";
17134
+ // let p_sort: string = "";
17135
+ var p_filter = "";
17136
+ if (localStorage.getItem(_this.grid_key + "_COLS") != null)
17137
+ p_col = localStorage.getItem(_this.grid_key + "_COLS");
17138
+ // if (localStorage.getItem(this.grid_key + "_SORT") != null)
17139
+ // p_sort = localStorage.getItem(this.grid_key + "_SORT");
17140
+ if (localStorage.getItem(_this.grid_key + "_FILTER") != null)
17141
+ p_filter = localStorage.getItem(_this.grid_key + "_FILTER");
17142
+ p.types = ["string", "string", "string", "string", "string", "string"];
17143
+ p.values = [
17144
+ _this.gf.getDescri(),
17145
+ _this.grid_key,
17146
+ p_col,
17147
+ '',
17148
+ p_filter,
17149
+ _this.m_appService.user,
17150
+ ];
17151
+ var ok_op = false;
17152
+ _this._dataService.doQuery(p).subscribe(function (data) {
17153
+ var ok_op = false;
17154
+ if (data != null)
17155
+ if (data.result_msg == "OK") {
17156
+ _this._toast.info("Configurazione salvata");
17157
+ _this.gf.types = ["string"];
17158
+ _this.gf.values = [_this.grid_key];
17159
+ _this.gf.fillCombo();
17160
+ _this.curr_config = "-1";
17161
+ }
17162
+ if (!ok_op) {
17163
+ }
17164
+ }, function (err) { });
17165
+ }
17166
+ });
17167
+ };
17168
+ FHGridComponentN.prototype.refresh_access = function (wkfx) {
17169
+ this.toolbar_wkfapp = wkfx;
17170
+ };
17171
+ FHGridComponentN.prototype.getGridApi = function () {
17172
+ return this.gridOptions.api;
17173
+ };
17174
+ FHGridComponentN.prototype.getGridOptions = function () {
17175
+ return this.gridOptions;
17176
+ };
17177
+ FHGridComponentN.prototype.insert_config = function () {
17178
+ var _this = this;
17179
+ this.win_opt = this.m_dialog.open(fh_win_ask_text, {
17180
+ disableClose: true,
17181
+ });
17182
+ setTimeout(function () {
17183
+ _this.win_opt.componentInstance.title = "Salva Configurazione";
17184
+ _this.win_opt.componentInstance.label = "Nome";
17185
+ });
17186
+ this.win_opt.afterClosed().subscribe(function (result) {
17187
+ if (result)
17188
+ if (result != null) {
17189
+ var p = new QParam();
17190
+ p.sql = "INSERT_UPDATE_CFG_GRID";
17191
+ var p_col = "";
17192
+ // let p_sort: string = "";
17193
+ var p_filter = "";
17194
+ if (localStorage.getItem(_this.grid_key + "_COLS") != null)
17195
+ p_col = localStorage.getItem(_this.grid_key + "_COLS");
17196
+ // if (localStorage.getItem(this.grid_key + "_SORT") != null)
17197
+ // p_sort = localStorage.getItem(this.grid_key + "_SORT");
17198
+ if (localStorage.getItem(_this.grid_key + "_FILTER") != null)
17199
+ p_filter = localStorage.getItem(_this.grid_key + "_FILTER");
17200
+ p.types = [
17201
+ "string",
17202
+ "string",
17203
+ "string",
17204
+ "string",
17205
+ "string",
17206
+ "string",
17207
+ ];
17208
+ p.values = [
17209
+ result,
17210
+ _this.grid_key,
17211
+ p_col,
17212
+ '',
17213
+ p_filter,
17214
+ _this.m_appService.user,
17215
+ ];
17216
+ var ok_op = false;
17217
+ _this._dataService.doQuery(p).subscribe(function (data) {
17218
+ var ok_op = false;
17219
+ if (data != null)
17220
+ if (data.result_msg == "OK") {
17221
+ _this._toast.info("Configurazione salvata");
17222
+ ok_op = true;
17223
+ _this.gf.types = ["string"];
17224
+ _this.gf.values = [_this.grid_key];
17225
+ _this.gf.fillCombo();
17226
+ }
17227
+ if (!ok_op) {
17228
+ }
17229
+ }, function (err) { });
17230
+ }
17231
+ });
17232
+ };
17233
+ FHGridComponentN.prototype.onBtExport = function () {
17234
+ this.export_excel();
17235
+ /*
17236
+ var params = {
17237
+ skipHeader: false,
17238
+ columnGroups: false,
17239
+ skipFooters: true,
17240
+ skipGroups: true,
17241
+ skipPinnedTop: true,
17242
+ skipPinnedBottom: true,
17243
+ allColumns: true,
17244
+ onlySelected: false,
17245
+ suppressQuotes: false,
17246
+ processCellCallback: (params) => {
17247
+ if (params.value) {
17248
+ // console.log(params.value);
17249
+ if (params.value == null) return '';
17250
+ if (typeof params.value.getMonth === 'function') {
17251
+
17252
+ return this.uti_s.pad(params.value.getDate(), 2) + '/' + this.uti_s.pad(params.value.getMonth() + 1, 2) + '/' + params.value.getFullYear();
17253
+ } else if (params.value.length == 24 && params.value.indexOf(':00.000Z') > -1) {
17254
+ // console.log( new Date(params.value));
17255
+ let arrdt: Date = new Date(params.value);
17256
+
17257
+ // let arrdt2=arrdt[1].split(':');
17258
+ return this.uti_s.pad(arrdt.getDate(), 2) + '/' + this.uti_s.pad(arrdt.getMonth() + 1, 2) + '/' + arrdt.getFullYear() + ' ' + this.uti_s.pad(arrdt.getHours(), 2) + ':' + this.uti_s.pad(arrdt.getMinutes(), 2);
17259
+
17260
+
17261
+ }
17262
+ else
17263
+ return params.value;
17264
+ }
17265
+
17266
+ }
17267
+ }
17268
+
17269
+ this.gridOptions.api.exportDataAsExcel(params);*/
17270
+ };
17271
+ FHGridComponentN.prototype.export_excel = function (type) {
17272
+ var _this = this;
17273
+ if (type === void 0) { type = 'excel'; }
17274
+ this.dialogRef_W = this.m_dialog.open(fh_win_wait, {
17275
+ disableClose: true,
17276
+ });
17277
+ setTimeout(function () {
17278
+ _this.dialogRef_W.componentInstance.label = "EXPORT IN CORSO";
17279
+ });
17280
+ // this._toast.info('da implementare lato server');
17281
+ this.p_fi.type = type;
17282
+ this.p_fi.uiid_stampa = this.uti_s.newGuid();
17283
+ this.uiid_stampa = this.p_fi.uiid_stampa;
17284
+ this._gridservice.doQuery(this.p_fi, true, this.m_appService.API_ENDPOINT + 'doexportn').subscribe(function (data) {
17285
+ _this.check_end(type == 'pdf' ? '.pdf' : '.xlsx');
17286
+ });
17287
+ };
17288
+ FHGridComponentN.prototype.check_end = function (format) {
17289
+ var _this = this;
17290
+ var p = new FSInput();
17291
+ p.p1 =
17292
+ this.m_appService.LOCAL_PATH +
17293
+ "grid_reports\\" +
17294
+ this.uiid_stampa +
17295
+ "_" +
17296
+ this.m_appService.user +
17297
+ format;
17298
+ p.command = "check_file";
17299
+ this._fileService.doQuery(p).subscribe(function (data) {
17300
+ if (data != null)
17301
+ if (data.msg == "N") {
17302
+ setTimeout(function () {
17303
+ _this.check_end(format);
17304
+ }, 1000);
17305
+ }
17306
+ else {
17307
+ setTimeout(function () {
17308
+ _this.dialogRef_W.componentInstance.update_progess(100);
17309
+ });
17310
+ window.open(_this.m_appService.COMPANY_SITE_ROOT +
17311
+ "/grid_reports/" +
17312
+ _this.uiid_stampa +
17313
+ "_" +
17314
+ _this.m_appService.user +
17315
+ format);
17316
+ }
17317
+ });
17318
+ };
17319
+ FHGridComponentN.prototype.setHeaderHeight = function (n) {
17320
+ var _this = this;
17321
+ this.header_h = n;
17322
+ this.gridOptions.api.setHeaderHeight(this.header_h);
17323
+ this.gridOptions.suppressCopyRowsToClipboard = true;
17324
+ this.gridOptions.sendToClipboard = function (v) {
17325
+ console.log('v ', v);
17326
+ if (_this.enable_copy)
17327
+ _this.gridApi.copySelectedRangeToClipboard();
17328
+ {
17329
+ _this.clipboard.copy(v.data.split('\n')[0]);
17330
+ }
17331
+ };
17332
+ };
17333
+ FHGridComponentN.prototype.getRowNodeId = function (item) {
17334
+ // console.log(item);
17335
+ if (item == null)
17336
+ return this.uti_s.newGuid();
17337
+ if (item.data == null)
17338
+ return this.uti_s.newGuid();
17339
+ if (item.data.id != null)
17340
+ return String(item.data.id);
17341
+ if (item.data.uiid != null)
17342
+ return item.data.uiid;
17343
+ if (item.data.codice != null)
17344
+ return item.data.codice;
17345
+ return "NA";
17346
+ };
17347
+ FHGridComponentN.prototype.ngAfterViewInit = function () {
17348
+ var _this = this;
17349
+ if (this.grid_key == "PRO_H")
17350
+ this.no_pref = true;
17351
+ setTimeout(function () {
17352
+ if (_this.end_point == null)
17353
+ _this.end_point =
17354
+ _this.m_appService.API_ENDPOINT + _this.m_appService.GRID_ENDPOINT;
17355
+ if (localStorage.getItem(_this.grid_key + "_FILTER_UP") != null)
17356
+ _this.ric_libera = localStorage.getItem(_this.grid_key + "_FILTER_UP");
17357
+ _this.onResize();
17358
+ });
17359
+ };
17360
+ FHGridComponentN.prototype.okr = function (event) {
17361
+ //console.log(event.column.colDef.field);
17362
+ event.data.nome_colonna = event.column.colDef.field;
17363
+ this.cell_edited.emit(event.data);
17364
+ };
17365
+ FHGridComponentN.prototype.help_window = function () {
17366
+ var dialogRef = this.m_dialog.open(win_grid_help, { disableClose: true });
17367
+ dialogRef.afterClosed().subscribe(function (result) {
17368
+ return;
17369
+ });
17370
+ };
17371
+ FHGridComponentN.prototype.onResize = function (event) {
17372
+ return;
17373
+ // console.log("auto height "+this.auto_height+ "("+bodyWidth+")");
17374
+ //if(bodyWidth>1400){
17375
+ // this.g_height= Number(this.m_appService.getState().body_height.split('px').join(''))-40-this.off_set+'px';
17376
+ //console.log('this.g_height '+this.g_height);
17377
+ //if(this.m_appService.getState( ).mobile)this.g_height=Number(this.m_appService.getState().body_height.split('px').join(''))-40+'px';
17378
+ // this.num_per_pag=Math.round((700-50-this.off_set)/50);
17379
+ //}
17380
+ //else
17381
+ //if(bodyWidth>800){
17382
+ //this.g_height=520-this.off_set+'px';
17383
+ // this.num_per_pag=Math.round((520-50-this.off_set)/50);
17384
+ //}
17385
+ //else{
17386
+ //this.g_height=400-this.off_set+'px';
17387
+ // this.num_per_pag=Math.round((400-50-this.off_set)/50);
17388
+ //}
17389
+ // console.log( this.g_height);
17390
+ };
17391
+ FHGridComponentN.prototype.autoSizeAll = function () {
17392
+ var _this = this;
17393
+ if (this.gridOptions == null)
17394
+ return;
17395
+ if (this.gridOptions.columnApi == null)
17396
+ return;
17397
+ var allColumnIds = [];
17398
+ this.gridOptions.columnApi.getAllGridColumns().map(function (v) {
17399
+ allColumnIds.push(v.getColId());
17400
+ });
17401
+ this.gridOptions.columnApi.autoSizeColumns(allColumnIds);
17402
+ if (this.gridOptions.columnApi.getColumnState().length > 0)
17403
+ if (this.gridOptions.columnApi.getColumnState()[0].width == 24) {
17404
+ setTimeout(function () {
17405
+ _this.autoSizeAll();
17406
+ }, 300);
17407
+ return;
17408
+ }
17409
+ this.save_cfg();
17410
+ };
17411
+ FHGridComponentN.prototype.fitSizeAll = function () {
17412
+ // console.log("fitSizeAll");
17413
+ this.gridOptions.api.sizeColumnsToFit();
17414
+ this.save_cfg();
17415
+ };
17416
+ FHGridComponentN.prototype.selectCount = function () {
17417
+ var i = 0;
17418
+ this.gridOptions.api.forEachNode(function (node) {
17419
+ if (node.isSelected())
17420
+ i++;
17421
+ });
17422
+ return i;
17423
+ };
17424
+ FHGridComponentN.prototype.getquerySelected = function (f, t) {
17425
+ var s = "";
17426
+ if (t == "String") {
17427
+ this.gridOptions.api.forEachNode(function (node) {
17428
+ if (node.isSelected())
17429
+ if (node.data[f] != null) {
17430
+ if (s != "")
17431
+ s = s + ",";
17432
+ s = s + "'" + node.data[f] + "'";
17433
+ }
17434
+ });
17435
+ }
17436
+ // console.log('ENTRO '+f+" "+t);
17437
+ if (t == "Number") {
17438
+ // console.log('CERCO SEL');
17439
+ this.gridOptions.api.forEachNode(function (node) {
17440
+ if (node.isSelected())
17441
+ if (node.data[f] != null) {
17442
+ // console.log('selected');
17443
+ if (s != "")
17444
+ s = s + ",";
17445
+ s = s + node.data[f];
17446
+ }
17447
+ });
17448
+ }
17449
+ return s;
17450
+ };
17451
+ FHGridComponentN.prototype.selectAllFiltered = function () {
17452
+ var _this = this;
17453
+ this.gridOptions.api.forEachNode(function (node) {
17454
+ _this.gridOptions.api.selectNode(node, true);
17455
+ });
17456
+ };
17457
+ FHGridComponentN.prototype.deselectAllFiltered = function () {
17458
+ var _this = this;
17459
+ this.gridOptions.api.forEachNode(function (node) {
17460
+ _this.gridOptions.api.selectNode(node, false);
17461
+ });
17462
+ };
17463
+ FHGridComponentN.prototype.pulisci_filtri = function (resetr) {
17464
+ if (resetr === void 0) { resetr = true; }
17465
+ localStorage.removeItem(this.grid_key + "_FILTER");
17466
+ if (resetr) {
17467
+ if (this.ric_libera != "")
17468
+ this.doFill("", true, false);
17469
+ this.ric_libera = "";
17470
+ localStorage.removeItem(this.grid_key + "_FILTER_UP");
17471
+ }
17472
+ this.fix_flt_temp = "";
17473
+ this.gridOptions.api.setFilterModel(null);
17474
+ var filtrtm = {}; /*
17475
+ this.columnDefs.map((v)=>{
17476
+ if(v.filter=='agSetColumnFilter'){
17477
+ filtrtm[v.field]={type:'set',values:[]}
17478
+ }
17479
+ });*/
17480
+ this.gridOptions.api.setFilterModel(filtrtm);
17481
+ };
17482
+ /*
17483
+ public export_excel(format: string = "xlsx") {
17484
+ if(this.custom_export){
17485
+ this.command.emit({ cmd: "export_excel",v:format });
17486
+ return;}
17487
+ if (this.num_r > 15000) {
17488
+ this._toast.error("Massimo 15000 elementi esportabili");
17489
+ return;
17490
+ }
17491
+ format = "." + format;
17492
+
17493
+ this.uiid_stampa = this.uti_s.newGuid();
17494
+ this.xxopx = 0;
17495
+ let q: string = "";
17496
+ this.dialogRef_W = this.m_dialog.open(fh_win_wait, {
17497
+ disableClose: true,
17498
+ });
17499
+ setTimeout(() => {
17500
+ this.dialogRef_W.componentInstance.label = "EXPORT IN CORSO";
17501
+ });
17502
+ let cmds: Array<any> = [];
17503
+
17504
+ let str_fields = "";
17505
+ let p_col = this.gridOptions.columnApi.getAllDisplayedColumns();
17506
+
17507
+ for (let j = 0; j < p_col.length; j++) {
17508
+ if (str_fields != "") str_fields += ",";
17509
+ if (p_col[j].getColDef().headerName == null)
17510
+ str_fields += "[" + p_col[j].getColDef().field + "]";
17511
+ else if (p_col[j].getColDef().headerName == "")
17512
+ str_fields += "[" + p_col[j].getColDef().field + "]";
17513
+ else
17514
+ str_fields +=
17515
+ "[" +
17516
+ p_col[j].getColDef().field +
17517
+ "] [" +
17518
+ p_col[j].getColDef().headerName.split('[').join('').split(']').join('') +
17519
+ "]";
17520
+ }
17521
+ if (this.fields.indexOf("DISTINCT") != -1)
17522
+ str_fields = "DISTINCT " + str_fields;
17523
+ cmds.push(
17524
+ this.officeService.operation(
17525
+ "GB_XLS_APRI",
17526
+ "tpl_report.xlsx",
17527
+ "" + this.uiid_stampa + ".xlsx",
17528
+ this.xxopx++
17529
+ )
17530
+ );
17531
+ let opx:string='GB_CREA_TABELLA_FROM_DB';
17532
+ if(this.system_dest==2)opx='GB_CREA_TABELLA_FROM_DB1';
17533
+ if(this.export_field_aggiuntivi=='')
17534
+ cmds.push(
17535
+ this.officeService.operation(
17536
+ opx,
17537
+ "select " +
17538
+ str_fields+
17539
+ " from " +
17540
+ this.tbl_name +
17541
+ " " +
17542
+ this.str_curr_q_p,
17543
+ "3",
17544
+ this.xxopx++
17545
+ )
17546
+ );
17547
+ else
17548
+ cmds.push(
17549
+ this.officeService.operation(
17550
+ opx,
17551
+ "select " +
17552
+ str_fields +','+this.export_field_aggiuntivi+
17553
+ " from " +
17554
+ this.tbl_name +
17555
+ " " +
17556
+ this.str_curr_q_p,
17557
+ "3",
17558
+ this.xxopx++
17559
+ )
17560
+ );
17561
+ cmds.push(
17562
+ this.officeService.operation(
17563
+ "GB_XLS_SAVE",
17564
+ this.m_appService.LOCAL_PATH +
17565
+ "grid_reports\\" +
17566
+ this.uiid_stampa +
17567
+ "_" +
17568
+ this.m_appService.user +
17569
+ format,
17570
+ "",
17571
+ this.xxopx++
17572
+ )
17573
+ );
17574
+
17575
+ this.officeService
17576
+ .runCommands(this.uiid_stampa, cmds, this.dialogRef_W,false)
17577
+ .subscribe((data) => {
17578
+ this.check_end(format);
17579
+ });
17580
+ }
17581
+ check_end(format){
17582
+
17583
+
17584
+ let p: FSInput = new FSInput();
17585
+ p.p1 =
17586
+ this.m_appService.LOCAL_PATH +
17587
+ "grid_reports\\" +
17588
+ this.uiid_stampa +
17589
+ "_" +
17590
+ this.m_appService.user +
17591
+ format;
17592
+ p.command = "check_file";
17593
+ this._fileService.doQuery(p).subscribe((data) => {
17594
+ if (data != null)
17595
+ if (data.msg == "N") {
17596
+ setTimeout(() => {
17597
+ this.check_end(format);
17598
+ },5000);
17599
+ } else {
17600
+ setTimeout(() => {
17601
+ this.dialogRef_W.componentInstance.update_progess(100);
17602
+ });
17603
+ window.open(
17604
+ this.m_appService.COMPANY_SITE_ROOT +
17605
+ "/grid_reports/" +
17606
+ this.uiid_stampa +
17607
+ "_" +
17608
+ this.m_appService.user +
17609
+ format
17610
+ );
17611
+ }
17612
+ });
17613
+
17614
+ }
17615
+
17616
+ */
17617
+ FHGridComponentN.prototype.print = function () {
17618
+ if (this.custom_export)
17619
+ this.command.emit({ cmd: "print_pdf" });
17620
+ else
17621
+ this.export_excel('pdf');
17622
+ };
17623
+ FHGridComponentN.prototype.init_conf = function () {
17624
+ // console.log(" init_conf()");
17625
+ //this.ckk();
17626
+ };
17627
+ FHGridComponentN.prototype.createColumnDefs = function (em) { };
17628
+ FHGridComponentN.prototype.ckk = function () {
17629
+ var _this = this;
17630
+ if (!this.auto_load)
17631
+ return;
17632
+ if (this.columnDefs == null) {
17633
+ setTimeout(function () {
17634
+ _this.ckk();
17635
+ }, 500);
17636
+ return;
17637
+ }
17638
+ if (this.columnDefs.length == 0) {
17639
+ setTimeout(function () {
17640
+ _this.ckk();
17641
+ }, 500);
17642
+ return;
17643
+ }
17644
+ if (this.ckk_ed)
17645
+ return;
17646
+ this.ckk_ed = true;
17647
+ if (this.toggle_mantieni != null) {
17648
+ this.toggle_mantieni.checked = true;
17649
+ if (localStorage.getItem(this.grid_key + "_MANTIENI") != null)
17650
+ if (localStorage.getItem(this.grid_key + "_MANTIENI") == "NO") {
17651
+ this.toggle_mantieni.checked = false;
17652
+ }
17653
+ }
17654
+ this.res_columns();
17655
+ if (localStorage.getItem(this.grid_key + "_POS") != null)
17656
+ this.b_restored = true;
17657
+ if (localStorage.getItem(this.grid_key + "_FILTER_UP") != null)
17658
+ if (localStorage.getItem(this.grid_key + "_FILTER_UP") != "") {
17659
+ this.ric_libera = localStorage.getItem(this.grid_key + "_FILTER_UP");
17660
+ var arr = this.ric_libera.split(" ");
17661
+ var arr_F_1 = new Array();
17662
+ for (var i = 0; i < arr.length; i++)
17663
+ arr_F_1.push(arr[i]);
17664
+ //if (arr[i].length > 2)
17665
+ //else
17666
+ // this._toast.error("ignorato termine: " + arr[i] + " troppo corto");
17667
+ if (arr_F_1.length == 0)
17668
+ return;
17669
+ var ss = "";
17670
+ var _loop_1 = function (i) {
17671
+ var ss_r = "";
17672
+ for (var y = 0; y < this_1.columnDefs.length; y++) {
17673
+ if (this_1.columnDefs[y] != null)
17674
+ if (this_1.columnDefs[y].no_filter == null)
17675
+ if (this_1.columnDefs[y].field != null)
17676
+ if (this_1.columnDefs[y].field != "")
17677
+ if (this_1.columnDefs[y].filter != "agDateColumnFilter") {
17678
+ if (ss_r != "")
17679
+ ss_r += " or ";
17680
+ ss_r +=
17681
+ this_1.columnDefs[y].field +
17682
+ " LIKE '%" +
17683
+ this_1.uti_s.string_sqlvalue(arr_F_1[i]).replace("'", "$'").replace("*", "$*").replace("?", "$?").replace("[", "$[").replace("]", "$]").replace("!", "'$").toUpperCase() +
17684
+ "%' ESCAPE '$'";
17685
+ }
17686
+ }
17687
+ if (this_1.full_text_added_columns != null)
17688
+ this_1.full_text_added_columns.map(function (v) {
17689
+ if (v != null)
17690
+ if (v != '') {
17691
+ if (ss_r != "")
17692
+ ss_r += " or ";
17693
+ ss_r +=
17694
+ v +
17695
+ " LIKE '%" +
17696
+ _this.uti_s.string_sqlvalue(arr_F_1[i]).replace("'", "$'").replace("*", "$*").replace("?", "$?").replace("[", "$[").replace("]", "$]").replace("!", "'$").toUpperCase() +
17697
+ "%' ESCAPE '$'";
17698
+ }
17699
+ });
17700
+ if (ss_r != '') {
17701
+ if (ss != "")
17702
+ ss += " and ";
17703
+ ss += '(' + ss_r + ')';
17704
+ }
17705
+ };
17706
+ var this_1 = this;
17707
+ for (var i = 0; i < arr_F_1.length; i++) {
17708
+ _loop_1(i);
17709
+ }
17710
+ this.fix_flt_temp = ss;
17711
+ }
17712
+ if (this.init_fill) {
17713
+ setTimeout(function () {
17714
+ _this.ref_dt();
17715
+ }, 100);
17716
+ }
17717
+ // this.createNewDatasource();
17718
+ /*
17719
+ if(this.m_appService.getState().grid_obj[this.grid_key+'_startPage']!=null)
17720
+ {
17721
+ //console.log('setto pag: '+this.m_appService.getState().grid_obj[this.grid_key+'_startPage']);
17722
+ this.gridOptions.api.paginationGoToPage(this.m_appService.getState().grid_obj[this.grid_key+'_startPage']);
17723
+ } */
17724
+ };
17725
+ FHGridComponentN.prototype.set_init_size = function () {
17726
+ var _this = this;
17727
+ if (this.myData.length == 0) {
17728
+ setTimeout(function () { _this.set_init_size(); }, 500);
17729
+ return;
17730
+ }
17731
+ if (this.columnDefs.length <= 6)
17732
+ this.fitSizeAll();
17733
+ else
17734
+ this.autoSizeAll();
17735
+ };
17736
+ FHGridComponentN.prototype.res_columns = function (forza) {
17737
+ var _this = this;
17738
+ if (forza === void 0) { forza = false; }
17739
+ if (this.columnDefs == null) {
17740
+ setTimeout(function () {
17741
+ _this.res_columns(forza);
17742
+ }, 200);
17743
+ return;
17744
+ }
17745
+ if (this.columnDefs.length == 0) {
17746
+ setTimeout(function () {
17747
+ _this.res_columns(forza);
17748
+ }, 200);
17749
+ return;
17750
+ }
17751
+ var b_mantieni_ck = false;
17752
+ var b_rip = false;
17753
+ if (this.toggle_mantieni != null)
17754
+ b_mantieni_ck = this.toggle_mantieni.checked;
17755
+ if (localStorage.getItem(this.grid_key + "_COLS") == null ||
17756
+ localStorage.getItem(this.grid_key + "_COLS") == "") {
17757
+ this.set_init_size();
17758
+ return;
17759
+ }
17760
+ if (localStorage.getItem(this.grid_key + "_COLS") != null &&
17761
+ (b_mantieni_ck || forza))
17762
+ if (localStorage.getItem(this.grid_key + "_COLS") != "") {
17763
+ b_rip = true;
17764
+ try {
17765
+ var a = JSON.parse(localStorage.getItem(this.grid_key + "_COLS"));
17766
+ var annulla = true;
17767
+ for (var i = 0; i < a.length; i++) {
17768
+ if (!a[i].hide)
17769
+ annulla = false;
17770
+ }
17771
+ if (annulla)
17772
+ localStorage.getItem(this.grid_key + "_COLS");
17773
+ else
17774
+ this.gridOptions.columnApi.setColumnState(JSON.parse(localStorage.getItem(this.grid_key + "_COLS")));
17775
+ }
17776
+ catch (eer) {
17777
+ console.log(eer);
17778
+ }
17779
+ }
17780
+ /* try {
17781
+ this.gridOptions.api.setSortModel(null);
17782
+ } catch (eer) {
17783
+ console.log(eer);
17784
+ }
17785
+ if (
17786
+ localStorage.getItem(this.grid_key + "_SORT") != null &&
17787
+ (b_mantieni_ck || forza)
17788
+ )
17789
+ if (localStorage.getItem(this.grid_key + "_SORT") != "") {
17790
+ // console.log('setto sort: '+localStorage.getItem(this.grid_key+'_SORT'));
17791
+ // console.log(localStorage.getItem(this.grid_key+'_SORT'));
17792
+ try {
17793
+ this.gridOptions.api.setSortModel(
17794
+ JSON.parse(localStorage.getItem(this.grid_key + "_SORT"))
17795
+ );
17796
+ } catch (eer) {
17797
+ console.log(eer);
17798
+ }
17799
+ }
17800
+ try {
17801
+ this.gridOptions.api.setFilterModel(null);
17802
+ } catch (eer) {
17803
+ console.log(eer);
17804
+ }*/
17805
+ if (localStorage.getItem(this.grid_key + "_FILTER") != null &&
17806
+ (b_mantieni_ck || forza))
17807
+ if (localStorage.getItem(this.grid_key + "_FILTER") != "") {
17808
+ try {
17809
+ this.gridOptions.api.setFilterModel(JSON.parse(localStorage.getItem(this.grid_key + "_FILTER")));
17810
+ }
17811
+ catch (eer) {
17812
+ console.log(eer);
17813
+ }
17814
+ }
17815
+ };
17816
+ FHGridComponentN.prototype.getRows = function () {
17817
+ return this.gridOptions.rowData;
17818
+ };
17819
+ FHGridComponentN.prototype.sortAndFilter = function (sortModel, filterModel) {
17820
+ // return sortData(sortModel, filterData(filterModel, allOfTheData))
17821
+ };
17822
+ FHGridComponentN.prototype.ref_dt = function () {
17823
+ var _this = this;
17824
+ if (this.gridOptions == null)
17825
+ setTimeout(function () {
17826
+ _this.ref_dt();
17827
+ }, 500);
17828
+ else {
17829
+ if (this.gridOptions.api == null)
17830
+ setTimeout(function () {
17831
+ _this.ref_dt();
17832
+ }, 500);
17833
+ else
17834
+ this.gridOptions.api.setDatasource(this.dataSource);
17835
+ }
17836
+ };
17837
+ FHGridComponentN.prototype.updateRow = function () {
17838
+ this.refresh_all_rows();
17839
+ };
17840
+ FHGridComponentN.prototype.onModelUpdated = function () {
17841
+ // console.log('onModelUpdated');
17842
+ // this.calculateRowCount();
17843
+ };
17844
+ FHGridComponentN.prototype.onReady = function (event) {
17845
+ // console.log(this.header_h);
17846
+ this.gridApi = event.api;
17847
+ this.setHeaderHeight(this.header_h);
17848
+ if (this.gf != null && this.show_buttons && !this.pref_hidden) {
17849
+ this.gf.sql = "SELECT_CFG_GRID";
17850
+ this.gf.types = ["string"];
17851
+ this.gf.values = [this.grid_key];
17852
+ this.gf.fillCombo();
17853
+ if (localStorage.getItem(this.grid_key + "_MANTIENI") != "NO")
17854
+ if (localStorage.getItem(this.grid_key + "_CFG_DEFAULT") != null) {
17855
+ return;
17856
+ }
17857
+ }
17858
+ // let iOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
17859
+ // if(!iOS)this.setAutoHeight();
17860
+ if (this.auto_load)
17861
+ this.onready_go();
17862
+ };
17863
+ FHGridComponentN.prototype.init_grid = function () {
17864
+ this.auto_load = true;
17865
+ this.onready_go();
17866
+ };
17867
+ FHGridComponentN.prototype.save_cfg = function () {
17868
+ localStorage.setItem(this.grid_key + "_COLS", JSON.stringify(this.gridOptions.columnApi.getColumnState()));
17869
+ };
17870
+ FHGridComponentN.prototype.fe_cfg = function () {
17871
+ if (this.gf != null)
17872
+ if (this.gf.getObj() != null)
17873
+ if (localStorage.getItem(this.grid_key + "_MANTIENI") != "NO") {
17874
+ this.gf.setByDescri(localStorage.getItem(this.grid_key + "_CFG_DEFAULT"));
17875
+ localStorage.setItem(this.grid_key + "_COLS", this.gf.getObj().COLS);
17876
+ // localStorage.setItem(this.grid_key + "_SORT", this.gf.getObj().SORT);
17877
+ localStorage.setItem(this.grid_key + "_FILTER", this.gf.getObj().FILTER);
17878
+ this.curr_config = this.gf.getValue();
17879
+ }
17880
+ this.onready_go();
17881
+ };
17882
+ FHGridComponentN.prototype.onready_go = function () {
17883
+ var _this = this;
17884
+ this.ready = true;
17885
+ //console.log('onready_go');
17886
+ setTimeout(function () {
17887
+ _this.ckk();
17888
+ }, 10);
17889
+ if (!this.b_iniended) {
17890
+ this.b_iniended = true;
17891
+ this.init_end.emit();
17892
+ }
17893
+ };
17894
+ FHGridComponentN.prototype.init_filters = function () {
17895
+ //this.createNewDatasource();
17896
+ };
17897
+ FHGridComponentN.prototype.keyDownFunctioncl = function (event) {
17898
+ if (event.keyCode == 13) {
17899
+ this.free_search();
17900
+ }
17901
+ };
17902
+ FHGridComponentN.prototype.free_search = function () {
17903
+ var _this = this;
17904
+ if (this.ric_libera == "") {
17905
+ this.pulisci_filtri();
17906
+ this.fix_flt_temp = "";
17907
+ this.doFill("", true, false);
17908
+ localStorage.removeItem(this.grid_key + "_FILTER_UP");
17909
+ return;
17910
+ }
17911
+ localStorage.setItem(this.grid_key + "_FILTER_UP", this.ric_libera);
17912
+ var arr = this.ric_libera.split(" ");
17913
+ var arr_F = new Array();
17914
+ for (var i = 0; i < arr.length; i++)
17915
+ arr_F.push(arr[i]);
17916
+ // if (arr[i].length > 2)
17917
+ // else this._toast.error("ignorato termine: " + arr[i] + " troppo corto");
17918
+ if (arr_F.length == 0)
17919
+ return;
17920
+ var ss = "";
17921
+ var _loop_2 = function (i) {
17922
+ var ss_r = "";
17923
+ for (var y = 0; y < this_2.columnDefs.length; y++) {
17924
+ if (this_2.columnDefs[y] != null)
17925
+ if (this_2.columnDefs[y].no_filter == null)
17926
+ if (this_2.columnDefs[y].field != null)
17927
+ if (this_2.columnDefs[y].field != "")
17928
+ if (this_2.columnDefs[y].filter != "agDateColumnFilter") {
17929
+ if (ss_r != "")
17930
+ ss_r += " or ";
17931
+ ss_r +=
17932
+ this_2.columnDefs[y].field +
17933
+ " LIKE '%" +
17934
+ this_2.uti_s.string_sqlvalue(arr_F[i]).replace("'", "$'").replace("*", "$*").replace("?", "$?").replace("[", "$[").replace("]", "$]").replace("!", "'$").toUpperCase() +
17935
+ "%' ESCAPE '$'";
17936
+ }
17937
+ }
17938
+ if (this_2.full_text_added_columns != null)
17939
+ this_2.full_text_added_columns.map(function (v) {
17940
+ if (v != null)
17941
+ if (v != '') {
17942
+ if (ss_r != "")
17943
+ ss_r += " or ";
17944
+ ss_r +=
17945
+ v +
17946
+ " LIKE '%" +
17947
+ _this.uti_s.string_sqlvalue(arr_F[i]).replace("'", "$'").replace("*", "$*").replace("?", "$?").replace("[", "$[").replace("]", "$]").replace("!", "'$").toUpperCase() +
17948
+ "%' ESCAPE '$'";
17949
+ }
17950
+ });
17951
+ if (ss_r != '') {
17952
+ console.log('ADDO '), ss_r;
17953
+ if (ss != "")
17954
+ ss += " and ";
17955
+ ss += '(' + ss_r + ')';
17956
+ }
17957
+ };
17958
+ var this_2 = this;
17959
+ for (var i = 0; i < arr_F.length; i++) {
17960
+ _loop_2(i);
17961
+ }
17962
+ this.pulisci_filtri(false);
17963
+ this.doFill_Temp(ss, true);
17964
+ };
17965
+ FHGridComponentN.prototype.onCellClicked = function (event) {
17966
+ // console.log(event.rowIndex + ' ' + event.colDef.field);
17967
+ this.cell_clicked.emit(event);
17968
+ // console.log(this.myModalNormal);
17969
+ // this.testom.element.nativeElement.value=event.data.descrizione;
17970
+ // this.testom.element.nativeElement.scrollTop =0;
17971
+ //this.testom.element.nativeElement.focus();
17972
+ //this.testom.element.nativeElement.setSelectionRange(0, 0);
17973
+ // this.myModalNormal.element.nativeElement.show();
17974
+ };
17975
+ FHGridComponentN.prototype.onCellValueChanged = function (event) {
17976
+ // console.log('onCellValueChanged: ' + event.oldValue + ' to ' + event.newValue);
17977
+ };
17978
+ FHGridComponentN.prototype.onCellDoubleClicked = function (event) {
17979
+ // console.log('onCellDoubleClicked: ' + event.rowIndex + ' ' + event.colDef.field);
17980
+ };
17981
+ FHGridComponentN.prototype.onCellFocused = function (event) {
17982
+ //console.log('onCellFocused: (' + event.rowIndex + ',' + event.colIndex + ')');
17983
+ };
17984
+ FHGridComponentN.prototype.onSelectionChanged = function () {
17985
+ // console.log('selectionChanged');
17986
+ };
17987
+ FHGridComponentN.prototype.onBeforeFilterChanged = function () {
17988
+ // console.log('beforeFilterChanged');
17989
+ };
17990
+ FHGridComponentN.prototype.oncolumnEverythingChanged = function (event) {
17991
+ // console.log('oncolumnEverythingChanged');
17992
+ if (this.b_init) {
17993
+ // console.log('salvo f: '+JSON.stringify(this.gridOptions.columnApi.getColumnState()));
17994
+ localStorage.setItem(this.grid_key + "_COLS", JSON.stringify(this.gridOptions.columnApi.getColumnState()));
17995
+ }
17996
+ };
17997
+ FHGridComponentN.prototype.onFilterModified = function () {
17998
+ var _this = this;
17999
+ if (this.no_pref)
18000
+ return;
18001
+ setTimeout(function () {
18002
+ if (_this.b_init) {
18003
+ localStorage.setItem(_this.grid_key + "_FILTER", JSON.stringify(_this.gridOptions.api.getFilterModel()));
18004
+ }
18005
+ }, 200);
18006
+ };
18007
+ FHGridComponentN.prototype.onBeforeSortChanged = function () {
18008
+ // console.log('onBeforeSortChanged');
18009
+ };
18010
+ FHGridComponentN.prototype.onAfterSortChanged = function () {
18011
+ // console.log('onAfterSortChanged');
18012
+ if (this.no_pref)
18013
+ return;
18014
+ if (this.b_init) {
18015
+ localStorage.setItem(this.grid_key + "_COLS", JSON.stringify(this.gridOptions.columnApi.getColumnState()));
18016
+ // console.log('salvo s: '+this.gridOptions.api.getSortModel());
18017
+ /*
18018
+
18019
+ localStorage.setItem(
18020
+ this.grid_key + "_SORT",
18021
+ JSON.stringify(this.gridOptions.api.getSortModel())
18022
+ );*/
18023
+ }
18024
+ };
18025
+ FHGridComponentN.prototype.onVirtualRowRemoved = function ($event) {
18026
+ // because this event gets fired LOTS of times, we don't print it to the
18027
+ // console. if you want to see it, just uncomment out this line
18028
+ // console.log('onVirtualRowRemoved: ' + event.rowIndex);
18029
+ };
18030
+ FHGridComponentN.prototype.onRowClicked = function ($event) {
18031
+ //console.log('onRowClicked: ' );
18032
+ var selectedInGrid = this.gridOptions.api.getSelectedNodes();
18033
+ if (selectedInGrid != null)
18034
+ if (selectedInGrid[0] != null) {
18035
+ // console.log((this.gridOptions.api.getVerticalPixelRange()));
18036
+ localStorage.setItem(this.grid_key + "_POS", String(selectedInGrid[0].rowIndex));
18037
+ localStorage.setItem(this.grid_key + "_POS_BAR", JSON.stringify(this.gridOptions.api.getVerticalPixelRange()));
18038
+ localStorage.setItem(this.grid_key + "_POS2", this.getRowNodeId(selectedInGrid[0]));
18039
+ // this.m_appService.getState().grid_obj=new Object();
18040
+ // this.m_appService.getState().grid_obj[this.grid_key+'_NODE']=this.gridOptions.api.getSelectedRows[0];
18041
+ }
18042
+ this.sRow = $event.data;
18043
+ localStorage.setItem(this.grid_key + "_LAST_ROW", JSON.stringify(this.sRow));
18044
+ this.clicked.emit($event.data);
18045
+ var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
18046
+ if (iOS) {
18047
+ this.columndclicked.emit($event);
18048
+ this.dclicked.emit($event.data);
18049
+ }
18050
+ };
18051
+ FHGridComponentN.prototype.onRowDClicked = function ($event) {
18052
+ //console.log('onRowClicked: ' );
18053
+ //console.log(event);
18054
+ this.dclicked.emit($event.data);
18055
+ var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
18056
+ if (iOS) {
18057
+ this.columndclicked.emit($event);
18058
+ //this.dclicked.emit($event.data);
18059
+ }
18060
+ };
18061
+ FHGridComponentN.prototype.onQuickFilterChanged = function ($event) {
18062
+ this.gridOptions.api.setQuickFilter($event.target.value);
18063
+ };
18064
+ // here we use one generic event to handle all the column type events.
18065
+ // the method just prints the event name
18066
+ FHGridComponentN.prototype.onColumnEvent = function ($event) {
18067
+ this.columndclicked.emit($event);
18068
+ // console.log('onColumnEvent: ' + $event);
18069
+ // localStorage.setItem(this.grid_key+'_COLUMN',JSON.stringify(this.gridOptions.api.getColumnDef()));
18070
+ };
18071
+ FHGridComponentN.prototype.doFill = function (flt, reset_prec, over_fixed) {
18072
+ var _this = this;
18073
+ if (reset_prec === void 0) { reset_prec = true; }
18074
+ if (over_fixed === void 0) { over_fixed = true; }
18075
+ // if (reset_prec) this.filters = "";
18076
+ if (over_fixed)
18077
+ this.fix_flt = flt;
18078
+ this.ckk_ed = false;
18079
+ // this.createNewDatasource();
18080
+ this.b_init = true;
18081
+ this.init_fill = true;
18082
+ //this.createNewDatasource();
18083
+ setTimeout(function () {
18084
+ _this.ckk();
18085
+ }, 10);
18086
+ };
18087
+ FHGridComponentN.prototype.doFill_Temp = function (flt, reset_prec) {
18088
+ var _this = this;
18089
+ if (reset_prec === void 0) { reset_prec = true; }
18090
+ //if (reset_prec) this.filters = "";
18091
+ this.fix_flt_temp = flt;
18092
+ this.ckk_ed = false;
18093
+ // this.createNewDatasource();
18094
+ this.b_init = true;
18095
+ this.init_fill = true;
18096
+ //this.createNewDatasource();
18097
+ setTimeout(function () {
18098
+ _this.Refresh();
18099
+ }, 10);
18100
+ };
18101
+ FHGridComponentN.prototype.Refresh = function () {
18102
+ this.ref_dt();
18103
+ };
18104
+ FHGridComponentN.prototype.RefreshOnlyMemory = function () {
18105
+ this.updateRow();
18106
+ };
18107
+ return FHGridComponentN;
18108
+ }());
18109
+ FHGridComponentN.decorators = [
18110
+ { type: i0.Component, args: [{
18111
+ selector: "FHGridN",
18112
+ template: "<div fxLayout=\"column\" fxFlexFill>\n <div\n fxLayout=\"row\"\n fxLayout.xs=\"column\"\n fxLayoutAlign=\"center start\"\n fxLayoutGap=\"3px\"\n style=\"min-height: 55px;\"\n [hidden]=\"!show_buttons\"\n >\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n <div fxLayout=\"row\" fxLayoutGap=\"3px\" fxLayoutAlign=\"start center\">\n <div>\n <h5>{{num_r}}&nbsp;{{label_elementi}}</h5>\n </div>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n\n <div fxLayout=\"row\" fxLayoutAlign=\"start center\">\n <input\n matInput\n [placeholder]=\"trova_label\"\n (keydown)=\"keyDownFunctioncl($event)\"\n [(ngModel)]=\"ric_libera\"\n style=\"\n width: 200px;\n border: 1px solid;\n min-height: 30px;\n \"\n />\n </div>\n\n <div\n matTooltip=\"REMOVE FILTER\"\n matTooltipPosition=\"above\"\n *ngIf=\"show_pulisci_filtri\"\n >\n <button mat-flat-button (click)=\"pulisci_filtri()\" color=\"warn\">\n <mat-icon>filter_none</mat-icon>&nbsp;\n </button>\n </div>\n <div matTooltip=\"AUTO SIZE\" matTooltipPosition=\"above\">\n <button\n mat-flat-button\n (click)=\"autoSizeAll()\"\n color=\"accent\"\n *ngIf=\"show_buttons\"\n >\n <mat-icon>swap_horiz</mat-icon>\n </button>\n </div>\n <div fxHide fxShow.gt-sm matTooltip=\"FIT SIZE\" matTooltipPosition=\"above\">\n <button\n mat-flat-button\n (click)=\"fitSizeAll()\"\n color=\"accent\"\n *ngIf=\"show_buttons\"\n >\n <mat-icon>keyboard_tab</mat-icon>\n </button>\n </div>\n <div fxHide fxShow.gt-sm matTooltip=\"Refresh\" matTooltipPosition=\"above\">\n <button\n mat-flat-button\n (click)=\"Refresh()\"\n color=\"accent\"\n *ngIf=\"show_buttons\"\n >\n <mat-icon>autorenew</mat-icon>\n </button>\n </div>\n <FHFilterComboBox\n fxHide\n fxShow.gt-sm\n [hidden]=\"!show_buttons || pref_hidden\"\n (selchange)=\"ch_config()\"\n (fillend)=\"fe_cfg()\"\n #gf\n init_fill=\"false\"\n ></FHFilterComboBox>\n <div\n matTooltip=\"Modifica Preferenza\"\n matTooltipPosition=\"above\"\n *ngIf=\"curr_config!='-1'\"\n >\n <button\n mat-icon-button\n *ngIf=\"show_buttons && !pref_hidden\"\n style=\"color: rgb(248, 105, 10);\"\n >\n <mat-icon (click)=\"edit_config()\">save</mat-icon>\n </button>\n </div>\n <div\n matTooltip=\"Elimina Preferenza\"\n matTooltipPosition=\"above\"\n *ngIf=\"curr_config!='-1'\"\n >\n <button\n mat-icon-button\n *ngIf=\"show_buttons && !pref_hidden\"\n style=\"color: rgb(248, 105, 10);\"\n >\n <mat-icon (click)=\"elimina_config()\">delete</mat-icon>\n </button>\n </div>\n <div\n fxHide\n fxShow.gt-sm\n matTooltip=\"Crea Nuova Preferenza\"\n matTooltipPosition=\"above\"\n >\n <button\n mat-icon-button\n style=\"color: rgb(16, 98, 16);\"\n *ngIf=\"show_buttons && !pref_hidden\"\n >\n <mat-icon (click)=\"insert_config()\">library_add</mat-icon>\n </button>\n </div>\n\n <mat-slide-toggle\n fxHide\n fxShow.gt-sm\n [hidden]=\"!show_buttons || pref_hidden\"\n (click)=\"ck_flag()\"\n #toggle_mantieni\n >\n {{mantieni_impostazioni}}\n </mat-slide-toggle>\n\n &nbsp;\n <div fxHide fxShow.gt-sm matTooltip=\"HELP\" matTooltipPosition=\"above\">\n <button\n mat-flat-button\n (click)=\"help_window()\"\n color=\"primary\"\n *ngIf=\"show_buttons && show_help\"\n >\n <mat-icon>help</mat-icon>\n </button>\n </div>\n &nbsp;&nbsp;&nbsp;&nbsp;\n\n <img\n *ngIf=\"enable_export && enable_export_pdf\"\n matTooltip=\"EXPORT PDF\"\n matTooltipPosition=\"above\"\n src=\"assets/icons/square-o/pdf.svg\"\n style=\"width: 24px; height: 24px; cursor: pointer\"\n (click)=\"print()\"\n alt=\"Export PDF\"\n width=\"24\" height=\"24\"\n />\n\n\n <img *ngIf=\"enable_export && enable_export_xls\"\n matTooltip=\"EXPORT EXCEL\"\n matTooltipPosition=\"above\"\n src=\"assets/icons/square-o/xlsx.svg\"\n style=\"width: 24px; height: 24px; cursor: pointer\"\n (click)=\"export_excel()\"\n alt=\"Export Excel\"\n width=\"24\" height=\"24\"\n />\n\n </div>\n <div\n fxLayout=\"row\"\n fxLayoutAlign=\"end center\"\n\n [style.width]=\"width_max\"\n *ngIf=\"enabled\"\n >\n\n <FHGridToolBar\n (command)=\"docmd($event)\"\n [type]=\"toolbar_type\"\n [show_link]=\"show_link\"\n [show_help]=\"show_help_bar\"\n [help_label]=\"help_label_bar\"\n [custom_commands]=\"toolbar_custom_commands\"\n [toolbar_wkfapp]=\"toolbar_wkfapp\"\n [elimina_label]=\"elimina_label\"\n [sRow]=\"sRow\"\n ></FHGridToolBar>\n </div>\n </div>\n\n\n <div fxLayout=\"row\" style=\"width: 100%;\" [fxFlex]=\"show_buttons ? 100:95\">\n <ag-grid-angular\n ref-agGrid\n style=\"width: 100%; height: 100%;\"\n id=\"myGrid\"\n (cellDoubleClicked)=\"onColumnEvent($event)\"\n (cellClicked)=\"onCellClicked($event)\"\n [headerHeight]=\"header_h\"\n [groupHeaderHeight]=\"header_h\"\n class=\"ag-theme-balham\"\n [singleClickEdit]=\"true\"\n [gridOptions]=\"gridOptions\"\n [columnDefs]=\"columnDefs\"\n [rowData]=\"rowData\"\n [rowSelection]=\"selection_mode\"\n [tooltipShowDelay]=\"tooltipShowDelay\"\n [getContextMenuItems]=\"enable_export ? getContextMenuItems_e:getContextMenuItems_n_e\"\n (filterModified)=\"onFilterModified()\"\n (rowDoubleClicked)=\"onRowDClicked($event)\"\n (rowClicked)=\"onRowClicked($event)\"\n (columnVisible)=\"oncolumnEverythingChanged($event)\"\n (columnResized)=\"oncolumnEverythingChanged($event)\"\n (columnMoved)=\"oncolumnEverythingChanged($event)\"\n (cellValueChanged)=\"okr($event)\"\n (sortChanged)=\"onAfterSortChanged()\"\n [paginationPageSize]=\"num_per_pag\"\n (gridReady)=\"onReady($event)\"\n >\n </ag-grid-angular>\n </div>\n</div>\n",
18113
+ styles: [""]
18114
+ },] }
18115
+ ];
18116
+ FHGridComponentN.ctorParameters = function () { return [
18117
+ { type: GridService },
18118
+ { type: i3.ToastrService },
18119
+ { type: QueryService },
18120
+ { type: AppService },
18121
+ { type: ng2SlimLoadingBar.SlimLoadingBarService },
18122
+ { type: dialog.MatDialog },
18123
+ { type: UtilityService },
18124
+ { type: FileService },
18125
+ { type: clipboard.Clipboard }
18126
+ ]; };
18127
+ FHGridComponentN.propDecorators = {
18128
+ tooltipShowDelay: [{ type: i0.Input }],
18129
+ elimina_label: [{ type: i0.Input }],
18130
+ export_field_aggiuntivi: [{ type: i0.Input }],
18131
+ end_point: [{ type: i0.Input }],
18132
+ tbl_name: [{ type: i0.Input }],
18133
+ columnDefs: [{ type: i0.Input }],
18134
+ num_per_pag: [{ type: i0.Input }],
18135
+ grid_key: [{ type: i0.Input }],
18136
+ enabled: [{ type: i0.Input }],
18137
+ show_link: [{ type: i0.Input }],
18138
+ show_help_bar: [{ type: i0.Input }],
18139
+ help_label_bar: [{ type: i0.Input }],
18140
+ auto_load: [{ type: i0.Input }],
18141
+ auto_height: [{ type: i0.Input }],
18142
+ enable_export: [{ type: i0.Input }],
18143
+ enabled_pag: [{ type: i0.Input }],
18144
+ show_help: [{ type: i0.Input }],
18145
+ show_num_elem: [{ type: i0.Input }],
18146
+ system_dest: [{ type: i0.Input }],
18147
+ header_h: [{ type: i0.Input }],
18148
+ selection_mode: [{ type: i0.Input }],
18149
+ init_fill: [{ type: i0.Input }],
18150
+ no_pref: [{ type: i0.Input }],
18151
+ pref_hidden: [{ type: i0.Input }],
18152
+ enable_export_pdf: [{ type: i0.Input }],
18153
+ enable_export_xls: [{ type: i0.Input }],
18154
+ enable_copy: [{ type: i0.Input }],
18155
+ full_text_added_columns: [{ type: i0.Input }],
18156
+ autosize_at_ini: [{ type: i0.Input }],
18157
+ label_elementi: [{ type: i0.Input }],
18158
+ trova_label: [{ type: i0.Input }],
18159
+ mantieni_impostazioni: [{ type: i0.Input }],
18160
+ show_buttons: [{ type: i0.Input }],
18161
+ fill_end: [{ type: i0.Output }],
18162
+ cell_edited: [{ type: i0.Output }],
18163
+ clicked: [{ type: i0.Output }],
18164
+ dclicked: [{ type: i0.Output }],
18165
+ columndclicked: [{ type: i0.Output }],
18166
+ cell_clicked: [{ type: i0.Output }],
18167
+ custom_export: [{ type: i0.Input }],
18168
+ toolbar_type: [{ type: i0.Input }],
18169
+ toolbar_wkfapp: [{ type: i0.Input }],
18170
+ toolbar_custom_commands: [{ type: i0.Input }],
18171
+ command: [{ type: i0.Output }],
18172
+ gf: [{ type: i0.ViewChild, args: ["gf",] }],
18173
+ toggle_mantieni: [{ type: i0.ViewChild, args: ["toggle_mantieni",] }],
18174
+ init_end: [{ type: i0.Output }],
18175
+ off_set: [{ type: i0.Input }],
18176
+ onResize: [{ type: i0.HostListener, args: ["window:resize", ["event"],] }]
18177
+ };
18178
+
16334
18179
  var FluxhubLibModule = /** @class */ (function () {
16335
18180
  function FluxhubLibModule() {
16336
18181
  }
@@ -16433,6 +18278,7 @@
16433
18278
  FHUploadPanelComponent,
16434
18279
  FHUploadComponent,
16435
18280
  FHGridComponent,
18281
+ FHGridComponentN,
16436
18282
  FHComboboxComponent,
16437
18283
  fh_win_confirm,
16438
18284
  FHAutoCompleteComponent,
@@ -16501,6 +18347,7 @@
16501
18347
  FHUploadComponent,
16502
18348
  wkf_header_bar,
16503
18349
  FHGridComponent,
18350
+ FHGridComponentN,
16504
18351
  FHComboboxComponent,
16505
18352
  fh_win_confirm,
16506
18353
  FHAutoCompleteComponent,
@@ -22088,6 +23935,7 @@
22088
23935
  exports.FHFieldPickListComponent = FHFieldPickListComponent;
22089
23936
  exports.FHFormToolBarComponent = FHFormToolBarComponent;
22090
23937
  exports.FHGridComponent = FHGridComponent;
23938
+ exports.FHGridComponentN = FHGridComponentN;
22091
23939
  exports.FHGridJSONComponent = FHGridJSONComponent;
22092
23940
  exports.FHGuard = FHGuard;
22093
23941
  exports.FHListComponent = FHListComponent;