@fluxhub/fluxhub-lib 10.0.519 → 10.0.520

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