ngx-render-material-forms 1.2.8 → 1.3.0
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 +60 -34
- package/fesm2015/ngx-render-material-forms.js +59 -33
- package/fesm2015/ngx-render-material-forms.mjs.map +1 -1
- package/fesm2020/ngx-render-material-forms.js +59 -33
- package/fesm2020/ngx-render-material-forms.mjs.map +1 -1
- package/lib/components/select/select.component.d.ts +4 -2
- 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, distinctUntilChanged, takeUntil } from 'rxjs/operators';
|
|
84
|
+
import { debounceTime, tap, 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';
|
|
@@ -2538,6 +2538,9 @@ class MaterialSelectComponent extends MaterialComponent {
|
|
|
2538
2538
|
this.holy = '';
|
|
2539
2539
|
this.grail = '';
|
|
2540
2540
|
this.productsloadingFlag = false;
|
|
2541
|
+
this.searching = false;
|
|
2542
|
+
// Variable to hold the reference to the current panel element
|
|
2543
|
+
this.currentPanelElement = null;
|
|
2541
2544
|
this.holy = CryptoJS.enc.Base64.parse('8F/2+T2NXqUBQERR12R4sw==');
|
|
2542
2545
|
this.grail = CryptoJS.enc.Base64.parse('yE0CgQbYzK5wqeoKTVzhOQ==');
|
|
2543
2546
|
}
|
|
@@ -2573,15 +2576,9 @@ class MaterialSelectComponent extends MaterialComponent {
|
|
|
2573
2576
|
padding: CryptoJS.pad.Pkcs7
|
|
2574
2577
|
});
|
|
2575
2578
|
}
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
this.
|
|
2579
|
-
this.registerPanelScrollEvent();
|
|
2580
|
-
}
|
|
2581
|
-
registerPanelScrollEvent() {
|
|
2582
|
-
if (this.selectElem) {
|
|
2583
|
-
this.selectElem.panel.nativeElement.addEventListener('scroll', this.onScroll.bind(this));
|
|
2584
|
-
}
|
|
2579
|
+
registerPanelScrollEvent(selectElem) {
|
|
2580
|
+
const panelElement = selectElem.panel.nativeElement;
|
|
2581
|
+
panelElement.addEventListener('scroll', this.onScroll.bind(this));
|
|
2585
2582
|
}
|
|
2586
2583
|
onScroll(event) {
|
|
2587
2584
|
if (this.instance.component.key.toLowerCase() === 'vendorproductid') {
|
|
@@ -2623,7 +2620,7 @@ class MaterialSelectComponent extends MaterialComponent {
|
|
|
2623
2620
|
const enpageSize = this.scrumble(pageSize);
|
|
2624
2621
|
const ensearchQuery = this.scrumble(searchQuery);
|
|
2625
2622
|
let enactive = this.scrumble(onlyActive);
|
|
2626
|
-
//
|
|
2623
|
+
//Check if enactive is undefined, null, or blank
|
|
2627
2624
|
if (enactive === undefined || enactive === null || enactive === '') {
|
|
2628
2625
|
enactive = this.scrumble(true); // Set default value to true
|
|
2629
2626
|
}
|
|
@@ -2644,19 +2641,29 @@ class MaterialSelectComponent extends MaterialComponent {
|
|
|
2644
2641
|
const baseApiUrl = baseUrlMapping[hostname] || null;
|
|
2645
2642
|
this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetVendorProducts?vendorId=${envendorId}&pageNumber=${enpageNumber}&pageSize=${enpageSize}&search=${ensearchQuery}&onlyActive=${enactive}&includeDescription=${endescription}`, { headers }).subscribe(response => {
|
|
2646
2643
|
if (response && response.code === 200) {
|
|
2647
|
-
this.totalPages = response?.data?.totalPages;
|
|
2648
2644
|
if (this.instance.component.key.toLowerCase() === 'vendorproductid') {
|
|
2649
|
-
|
|
2645
|
+
this.totalPages = response?.data?.totalPages;
|
|
2646
|
+
const data = response.data.dataSource;
|
|
2647
|
+
const transformedData = this.transformResponseData(data);
|
|
2648
|
+
this.filteredOptionsLength = transformedData.length;
|
|
2650
2649
|
// Update filteredOptions with transformedData
|
|
2651
2650
|
this.filteredOptions = Promise.resolve(transformedData.map(item => ({
|
|
2652
2651
|
label: item.label,
|
|
2653
2652
|
value: item.value,
|
|
2654
2653
|
date: item.date
|
|
2655
2654
|
})));
|
|
2656
|
-
|
|
2657
|
-
|
|
2655
|
+
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
|
+
// });
|
|
2658
2665
|
this.productsloadingFlag = true;
|
|
2659
|
-
}
|
|
2666
|
+
}
|
|
2660
2667
|
}
|
|
2661
2668
|
});
|
|
2662
2669
|
}
|
|
@@ -2698,27 +2705,48 @@ class MaterialSelectComponent extends MaterialComponent {
|
|
|
2698
2705
|
}
|
|
2699
2706
|
onClearAll() {
|
|
2700
2707
|
if (this.instance.component.key.toLowerCase() === 'vendorproductid') {
|
|
2701
|
-
this.
|
|
2708
|
+
this.pageNumber = 1;
|
|
2709
|
+
this.pageSize = 20;
|
|
2710
|
+
this.searchQuery = '';
|
|
2711
|
+
this.loadData(this.pageNumber, this.pageSize, this.searchQuery);
|
|
2702
2712
|
}
|
|
2703
2713
|
}
|
|
2704
2714
|
ngAfterViewInit() {
|
|
2705
|
-
this.
|
|
2706
|
-
|
|
2707
|
-
if (
|
|
2708
|
-
this.
|
|
2715
|
+
if (this.instance.component.key.toLowerCase() === 'vendorproductid') {
|
|
2716
|
+
this.selectElem.openedChange.subscribe((isOpen) => {
|
|
2717
|
+
if (isOpen) {
|
|
2718
|
+
this.pageNumber = 1;
|
|
2719
|
+
this.pageSize = 20;
|
|
2720
|
+
this.searchQuery = '';
|
|
2721
|
+
this.searching = true;
|
|
2722
|
+
this.loadData(this.pageNumber, this.pageSize, this.searchQuery);
|
|
2723
|
+
this.registerPanelScrollEvent(this.selectElem);
|
|
2709
2724
|
}
|
|
2710
|
-
|
|
2711
|
-
|
|
2725
|
+
else {
|
|
2726
|
+
this.removePanelScrollEvent();
|
|
2727
|
+
console.log('closed');
|
|
2728
|
+
}
|
|
2729
|
+
});
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
removePanelScrollEvent() {
|
|
2733
|
+
// Remove the scroll event listener
|
|
2734
|
+
if (this.currentPanelElement) {
|
|
2735
|
+
this.currentPanelElement.removeEventListener('scroll', this.onScroll.bind(this));
|
|
2736
|
+
this.currentPanelElement = null;
|
|
2737
|
+
}
|
|
2712
2738
|
}
|
|
2713
2739
|
ngOnInit() {
|
|
2714
2740
|
/*new logic */
|
|
2715
2741
|
if (this.instance.component.key.toLowerCase() === 'vendorproductid') {
|
|
2716
2742
|
this.websiteMultiFilterCtrl.valueChanges
|
|
2717
2743
|
.pipe(debounceTime(1000), // Time in milliseconds between key events
|
|
2718
|
-
distinctUntilChanged(), takeUntil(this._onDestroy))
|
|
2744
|
+
tap(() => this.searching = true), distinctUntilChanged(), takeUntil(this._onDestroy))
|
|
2719
2745
|
.subscribe((searchQuery) => {
|
|
2720
2746
|
if (searchQuery != '') {
|
|
2721
|
-
this.
|
|
2747
|
+
this.pageNumber = 1;
|
|
2748
|
+
this.pageSize = 20;
|
|
2749
|
+
this.loadData(this.pageNumber, this.pageSize, searchQuery);
|
|
2722
2750
|
}
|
|
2723
2751
|
});
|
|
2724
2752
|
}
|
|
@@ -2762,17 +2790,16 @@ MaterialSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0"
|
|
|
2762
2790
|
(selectionChange)="onChange()"
|
|
2763
2791
|
[compareWith]="compareObjects"
|
|
2764
2792
|
#productSelect
|
|
2765
|
-
(openedChange)="onMatSelectOpen($event ? selectElem : null)"
|
|
2766
2793
|
>
|
|
2767
|
-
|
|
2768
2794
|
<mat-option>
|
|
2769
|
-
<ngx-mat-select-search (input)="onInputChange($event)" placeholderLabel="Type to search" [formControl]="websiteMultiFilterCtrl">
|
|
2795
|
+
<ngx-mat-select-search [searching]="instance.component.key.toLowerCase() === 'vendorproductid' ? searching : false" (input)="onInputChange($event)" placeholderLabel="Type to search" [formControl]="websiteMultiFilterCtrl">
|
|
2796
|
+
<mat-icon ngxMatSelectSearchClear (click)="clearProducts()">close</mat-icon>
|
|
2797
|
+
</ngx-mat-select-search>
|
|
2770
2798
|
</mat-option>
|
|
2771
2799
|
|
|
2772
2800
|
<mat-option *ngFor="let option of filteredOptions | async" [value]="option.value" class="virtual-full-view">
|
|
2773
2801
|
<span [innerHTML]="option.label"></span>
|
|
2774
2802
|
</mat-option>
|
|
2775
|
-
|
|
2776
2803
|
<mat-option *ngIf="!filteredOptionsLength" disabled>
|
|
2777
2804
|
<span>Nothing was found</span>
|
|
2778
2805
|
</mat-option>
|
|
@@ -2806,17 +2833,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
2806
2833
|
(selectionChange)="onChange()"
|
|
2807
2834
|
[compareWith]="compareObjects"
|
|
2808
2835
|
#productSelect
|
|
2809
|
-
(openedChange)="onMatSelectOpen($event ? selectElem : null)"
|
|
2810
2836
|
>
|
|
2811
|
-
|
|
2812
2837
|
<mat-option>
|
|
2813
|
-
<ngx-mat-select-search (input)="onInputChange($event)" placeholderLabel="Type to search" [formControl]="websiteMultiFilterCtrl">
|
|
2838
|
+
<ngx-mat-select-search [searching]="instance.component.key.toLowerCase() === 'vendorproductid' ? searching : false" (input)="onInputChange($event)" placeholderLabel="Type to search" [formControl]="websiteMultiFilterCtrl">
|
|
2839
|
+
<mat-icon ngxMatSelectSearchClear (click)="clearProducts()">close</mat-icon>
|
|
2840
|
+
</ngx-mat-select-search>
|
|
2814
2841
|
</mat-option>
|
|
2815
2842
|
|
|
2816
2843
|
<mat-option *ngFor="let option of filteredOptions | async" [value]="option.value" class="virtual-full-view">
|
|
2817
2844
|
<span [innerHTML]="option.label"></span>
|
|
2818
2845
|
</mat-option>
|
|
2819
|
-
|
|
2820
2846
|
<mat-option *ngIf="!filteredOptionsLength" disabled>
|
|
2821
2847
|
<span>Nothing was found</span>
|
|
2822
2848
|
</mat-option>
|