ngx-render-material-forms 1.2.9 → 1.3.1

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.
@@ -81,7 +81,7 @@ import RadioComponent from 'formiojs/components/radio/Radio.js';
81
81
  import SelectBoxesComponent from 'formiojs/components/selectboxes/SelectBoxes.js';
82
82
  import SelectComponent from 'formiojs/components/select/Select.js';
83
83
  import { Subject } from 'rxjs';
84
- import { debounceTime, tap, distinctUntilChanged, takeUntil } from 'rxjs/operators';
84
+ import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators';
85
85
  import * as CryptoJS from 'crypto-js';
86
86
  import { isNullOrUndefined } from 'util';
87
87
  import * as i9 from 'ngx-mat-select-search';
@@ -2539,8 +2539,10 @@ class MaterialSelectComponent extends MaterialComponent {
2539
2539
  this.grail = '';
2540
2540
  this.productsloadingFlag = false;
2541
2541
  this.searching = false;
2542
+ this.productList = [];
2542
2543
  // Variable to hold the reference to the current panel element
2543
2544
  this.currentPanelElement = null;
2545
+ this.openCounter = 1;
2544
2546
  this.holy = CryptoJS.enc.Base64.parse('8F/2+T2NXqUBQERR12R4sw==');
2545
2547
  this.grail = CryptoJS.enc.Base64.parse('yE0CgQbYzK5wqeoKTVzhOQ==');
2546
2548
  }
@@ -2584,14 +2586,25 @@ class MaterialSelectComponent extends MaterialComponent {
2584
2586
  if (this.instance.component.key.toLowerCase() === 'vendorproductid') {
2585
2587
  const scrollElement = event.target;
2586
2588
  const trackHeight = scrollElement.scrollHeight - scrollElement.offsetHeight;
2589
+ if (this.openCounter < 2) {
2590
+ const retrievedObject = JSON.parse(localStorage.getItem('storageObject'));
2591
+ console.log('165', Number(retrievedObject?.totalPages));
2592
+ console.log('166', retrievedObject?.dataSource);
2593
+ this.totalPages = Number(retrievedObject?.totalPages);
2594
+ this.productsloadingFlag = true;
2595
+ this.productList = retrievedObject?.dataSource;
2596
+ }
2587
2597
  if (this.productsloadingFlag && Math.floor(scrollElement.scrollTop / trackHeight * 100) > 50) {
2588
2598
  this.productsloadingFlag = false;
2599
+ this.openCounter = this.openCounter + 1;
2589
2600
  if (this.pageNumber < this.totalPages) {
2590
2601
  this.pageNumber = this.pageNumber + 1;
2602
+ this.searching = true;
2591
2603
  this.loadData(this.pageNumber, this.pageSize, this.searchQuery);
2592
2604
  }
2593
2605
  else {
2594
2606
  this.productsloadingFlag = true;
2607
+ this.searching = false;
2595
2608
  }
2596
2609
  }
2597
2610
  }
@@ -2619,7 +2632,7 @@ class MaterialSelectComponent extends MaterialComponent {
2619
2632
  const enpageNumber = this.scrumble(pageNumber);
2620
2633
  const enpageSize = this.scrumble(pageSize);
2621
2634
  const ensearchQuery = this.scrumble(searchQuery);
2622
- let enactive = this.scrumble(false);
2635
+ let enactive = this.scrumble(onlyActive);
2623
2636
  //Check if enactive is undefined, null, or blank
2624
2637
  if (enactive === undefined || enactive === null || enactive === '') {
2625
2638
  enactive = this.scrumble(true); // Set default value to true
@@ -2644,25 +2657,26 @@ class MaterialSelectComponent extends MaterialComponent {
2644
2657
  if (this.instance.component.key.toLowerCase() === 'vendorproductid') {
2645
2658
  this.totalPages = response?.data?.totalPages;
2646
2659
  const data = response.data.dataSource;
2647
- const transformedData = this.transformResponseData(data);
2648
- this.filteredOptionsLength = transformedData.length;
2660
+ this.filteredOptionsLength = data.length;
2661
+ if (this.productList.length > 0) {
2662
+ data.map(item => {
2663
+ return item;
2664
+ }).forEach(i => this.productList.push(i));
2665
+ }
2666
+ else {
2667
+ this.productList = data;
2668
+ }
2649
2669
  // Update filteredOptions with transformedData
2650
- this.filteredOptions = Promise.resolve(transformedData.map(item => ({
2651
- label: item.label,
2652
- value: item.value,
2653
- date: item.date
2654
- })));
2670
+ var allProductList = this.transformResponseData(this.productList);
2671
+ this.filteredOptions = Promise.resolve(allProductList);
2655
2672
  this.searching = false;
2656
- // Update filteredOptions with transformedData
2657
- // this.filteredOptions = this.filteredOptions.then(existingOptions => {
2658
- // const newOptions = transformedData.map(item => ({
2659
- // label: item.label,
2660
- // value: item.value,
2661
- // date: item.date
2662
- // }));
2663
- // return existingOptions.concat(newOptions);
2664
- // });
2665
2673
  this.productsloadingFlag = true;
2674
+ setTimeout(() => {
2675
+ const ele = this.selectElem.panel.nativeElement;
2676
+ const trackHeight = ele.scrollHeight - ele.offsetHeight;
2677
+ const middlePosition = trackHeight / 2 - 50;
2678
+ ele.scrollTo({ top: middlePosition, behavior: 'auto' });
2679
+ }, 250);
2666
2680
  }
2667
2681
  }
2668
2682
  });
@@ -2708,6 +2722,8 @@ class MaterialSelectComponent extends MaterialComponent {
2708
2722
  this.pageNumber = 1;
2709
2723
  this.pageSize = 20;
2710
2724
  this.searchQuery = '';
2725
+ this.searching = false;
2726
+ this.productList = [];
2711
2727
  this.loadData(this.pageNumber, this.pageSize, this.searchQuery);
2712
2728
  }
2713
2729
  }
@@ -2715,16 +2731,16 @@ class MaterialSelectComponent extends MaterialComponent {
2715
2731
  if (this.instance.component.key.toLowerCase() === 'vendorproductid') {
2716
2732
  this.selectElem.openedChange.subscribe((isOpen) => {
2717
2733
  if (isOpen) {
2718
- this.pageNumber = 1;
2734
+ this.pageNumber = 2;
2719
2735
  this.pageSize = 20;
2720
2736
  this.searchQuery = '';
2721
- this.searching = true;
2722
- this.loadData(this.pageNumber, this.pageSize, this.searchQuery);
2737
+ this.searching = false;
2738
+ //this.loadData(this.pageNumber, this.pageSize, this.searchQuery);
2723
2739
  this.registerPanelScrollEvent(this.selectElem);
2724
2740
  }
2725
2741
  else {
2726
2742
  this.removePanelScrollEvent();
2727
- console.log('closed');
2743
+ this.searching = false;
2728
2744
  }
2729
2745
  });
2730
2746
  }
@@ -2741,11 +2757,14 @@ class MaterialSelectComponent extends MaterialComponent {
2741
2757
  if (this.instance.component.key.toLowerCase() === 'vendorproductid') {
2742
2758
  this.websiteMultiFilterCtrl.valueChanges
2743
2759
  .pipe(debounceTime(1000), // Time in milliseconds between key events
2744
- tap(() => this.searching = true), distinctUntilChanged(), takeUntil(this._onDestroy))
2760
+ // tap(() => this.searching = true),
2761
+ distinctUntilChanged(), takeUntil(this._onDestroy))
2745
2762
  .subscribe((searchQuery) => {
2746
2763
  if (searchQuery != '') {
2747
2764
  this.pageNumber = 1;
2748
2765
  this.pageSize = 20;
2766
+ this.productList = [];
2767
+ this.searching = true;
2749
2768
  this.loadData(this.pageNumber, this.pageSize, searchQuery);
2750
2769
  }
2751
2770
  });