ngx-render-material-forms 1.3.0 → 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.
- package/esm2020/lib/components/select/select.component.mjs +42 -23
- package/fesm2015/ngx-render-material-forms.js +41 -22
- package/fesm2015/ngx-render-material-forms.mjs.map +1 -1
- package/fesm2020/ngx-render-material-forms.js +41 -22
- package/fesm2020/ngx-render-material-forms.mjs.map +1 -1
- package/lib/components/select/select.component.d.ts +2 -0
- package/package.json +1 -1
|
@@ -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,
|
|
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
|
}
|
|
@@ -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
|
-
|
|
2648
|
-
this.
|
|
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
|
-
|
|
2651
|
-
|
|
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 =
|
|
2734
|
+
this.pageNumber = 2;
|
|
2719
2735
|
this.pageSize = 20;
|
|
2720
2736
|
this.searchQuery = '';
|
|
2721
|
-
this.searching =
|
|
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
|
-
|
|
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),
|
|
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
|
});
|