ngx-render-material-forms 1.3.9 → 1.4.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/datagrid/datagrid.component.mjs +2 -2
- package/esm2020/lib/components/select/select.component.mjs +96 -100
- package/fesm2015/ngx-render-material-forms.js +97 -101
- package/fesm2015/ngx-render-material-forms.mjs.map +1 -1
- package/fesm2020/ngx-render-material-forms.js +96 -101
- 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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Injectable, Component, Input, ViewChild, ViewContainerRef, ViewChildren, EventEmitter, Output, forwardRef, Directive, Inject, Optional, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1$1 from '@angular/common/http';
|
|
4
|
-
import { HttpClientModule } from '@angular/common/http';
|
|
4
|
+
import { HttpHeaders, HttpClientModule } from '@angular/common/http';
|
|
5
5
|
import * as i1 from '@angular/common';
|
|
6
6
|
import { CommonModule } from '@angular/common';
|
|
7
7
|
import * as i2 from '@angular/forms';
|
|
@@ -82,6 +82,8 @@ 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
84
|
import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators';
|
|
85
|
+
import * as CryptoJS from 'crypto-js';
|
|
86
|
+
import { isNullOrUndefined } from 'util';
|
|
85
87
|
import * as i9 from 'ngx-mat-select-search';
|
|
86
88
|
import { NgxMatSelectSearchModule } from 'ngx-mat-select-search';
|
|
87
89
|
import WellComponent from 'formiojs/components/well/Well.js';
|
|
@@ -2534,8 +2536,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
2534
2536
|
}] });
|
|
2535
2537
|
SelectBoxesComponent.MaterialComponent = MaterialSelectBoxesComponent;
|
|
2536
2538
|
|
|
2537
|
-
// import * as CryptoJS from 'crypto-js';
|
|
2538
|
-
// import { isNullOrUndefined } from 'util';
|
|
2539
2539
|
class MaterialSelectComponent extends MaterialComponent {
|
|
2540
2540
|
constructor(element, ref, http) {
|
|
2541
2541
|
super(element, ref);
|
|
@@ -2558,8 +2558,8 @@ class MaterialSelectComponent extends MaterialComponent {
|
|
|
2558
2558
|
// Variable to hold the reference to the current panel element
|
|
2559
2559
|
this.currentPanelElement = null;
|
|
2560
2560
|
this.openCounter = 1;
|
|
2561
|
-
|
|
2562
|
-
|
|
2561
|
+
this.holy = CryptoJS.enc.Base64.parse('8F/2+T2NXqUBQERR12R4sw==');
|
|
2562
|
+
this.grail = CryptoJS.enc.Base64.parse('yE0CgQbYzK5wqeoKTVzhOQ==');
|
|
2563
2563
|
}
|
|
2564
2564
|
onInputChange(event) {
|
|
2565
2565
|
if (this.instance.component.key.toLowerCase() === 'vendorproductid' && event.target.value === '') {
|
|
@@ -2571,29 +2571,28 @@ class MaterialSelectComponent extends MaterialComponent {
|
|
|
2571
2571
|
this.onClearAll();
|
|
2572
2572
|
}
|
|
2573
2573
|
}
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
// }
|
|
2574
|
+
scrumble(msg) {
|
|
2575
|
+
if (!isNullOrUndefined(msg)) {
|
|
2576
|
+
var conceal = this.getcampaign(msg, this.holy, this.grail);
|
|
2577
|
+
var sha256 = CryptoJS.HmacSHA256(CryptoJS.enc.Base64.stringify(this.grail) + conceal.toString(), CryptoJS.enc.Base64.stringify(this.holy));
|
|
2578
|
+
var hashInBase64 = CryptoJS.enc.Base64.stringify(sha256);
|
|
2579
|
+
let keyValue = {
|
|
2580
|
+
"value": conceal.toString(),
|
|
2581
|
+
"mac": hashInBase64
|
|
2582
|
+
};
|
|
2583
|
+
var result = JSON.stringify(keyValue);
|
|
2584
|
+
var jumbled = CryptoJS.enc.Utf8.parse(result);
|
|
2585
|
+
return CryptoJS.enc.Base64.stringify(jumbled);
|
|
2586
|
+
}
|
|
2587
|
+
}
|
|
2588
|
+
getcampaign(data, holy, grail) {
|
|
2589
|
+
return CryptoJS.AES.encrypt(data.toString(), holy, {
|
|
2590
|
+
blockSize: 128,
|
|
2591
|
+
iv: grail,
|
|
2592
|
+
mode: CryptoJS.mode.CBC,
|
|
2593
|
+
padding: CryptoJS.pad.Pkcs7
|
|
2594
|
+
});
|
|
2595
|
+
}
|
|
2597
2596
|
registerPanelScrollEvent(selectElem) {
|
|
2598
2597
|
const panelElement = selectElem.panel.nativeElement;
|
|
2599
2598
|
panelElement.addEventListener('scroll', this.onScroll.bind(this));
|
|
@@ -2632,78 +2631,74 @@ class MaterialSelectComponent extends MaterialComponent {
|
|
|
2632
2631
|
return item ? item.value : null;
|
|
2633
2632
|
}
|
|
2634
2633
|
loadData(pageNumber, pageSize, searchQuery) {
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
// if
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
//
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
//
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
// }, 250);
|
|
2704
|
-
// }
|
|
2705
|
-
// }
|
|
2706
|
-
// });
|
|
2634
|
+
const paramsData = JSON.parse(localStorage.getItem('productPicker'));
|
|
2635
|
+
const includeDescription = this.getValueByKey(paramsData, 'includeDescription');
|
|
2636
|
+
const vendorId = this.getValueByKey(paramsData, 'vendorId');
|
|
2637
|
+
const onlyActive = this.getValueByKey(paramsData, 'onlyActive');
|
|
2638
|
+
var currentUser = JSON.parse(localStorage.getItem('currentUser'));
|
|
2639
|
+
let headers;
|
|
2640
|
+
if (currentUser && currentUser.Tokens && currentUser.Tokens.AccessToken) {
|
|
2641
|
+
var accessToken = currentUser.Tokens.AccessToken;
|
|
2642
|
+
headers = new HttpHeaders({
|
|
2643
|
+
'Content-Type': 'application/json',
|
|
2644
|
+
'Authorization': 'Bearer ' + accessToken
|
|
2645
|
+
});
|
|
2646
|
+
}
|
|
2647
|
+
else {
|
|
2648
|
+
console.error('User not authenticated or tokens missing.');
|
|
2649
|
+
}
|
|
2650
|
+
const envendorId = this.scrumble(vendorId);
|
|
2651
|
+
const enpageNumber = this.scrumble(pageNumber);
|
|
2652
|
+
const enpageSize = this.scrumble(pageSize);
|
|
2653
|
+
const ensearchQuery = this.scrumble(searchQuery);
|
|
2654
|
+
let enactive = this.scrumble(onlyActive);
|
|
2655
|
+
//Check if enactive is undefined, null, or blank
|
|
2656
|
+
if (enactive === undefined || enactive === null || enactive === '') {
|
|
2657
|
+
enactive = this.scrumble(true); // Set default value to true
|
|
2658
|
+
}
|
|
2659
|
+
// Scrumble and handle the includeDescription parameter
|
|
2660
|
+
let endescription = this.scrumble(includeDescription);
|
|
2661
|
+
if (!endescription) {
|
|
2662
|
+
endescription = this.scrumble(false); // Set to 'false' if undefined, null, or blank
|
|
2663
|
+
}
|
|
2664
|
+
const baseUrlMapping = {
|
|
2665
|
+
'localhost': 'http://localhost:58504',
|
|
2666
|
+
'lincoln.vartopia.com': 'https://lincoln-api.vartopia.com',
|
|
2667
|
+
'stage.vartopia.com': 'https://stage-api.vartopia.com',
|
|
2668
|
+
'my.vartopia.com': 'https://reagan-api.vartopia.com',
|
|
2669
|
+
'jackson.vartopia.com': 'https://jackson-api.vartopia.com'
|
|
2670
|
+
};
|
|
2671
|
+
// Get the current hostname
|
|
2672
|
+
const hostname = window.location.hostname;
|
|
2673
|
+
const baseApiUrl = baseUrlMapping[hostname] || null;
|
|
2674
|
+
this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetVendorProducts?vendorId=${envendorId}&pageNumber=${enpageNumber}&pageSize=${enpageSize}&search=${ensearchQuery}&onlyActive=${enactive}&includeDescription=${endescription}`, { headers }).subscribe(response => {
|
|
2675
|
+
if (response && response.code === 200) {
|
|
2676
|
+
if (this.instance.component.key.toLowerCase() === 'vendorproductid') {
|
|
2677
|
+
this.totalPages = response?.data?.totalPages;
|
|
2678
|
+
const data = response.data.dataSource;
|
|
2679
|
+
this.filteredOptionsLength = data.length;
|
|
2680
|
+
if (this.productList.length > 0) {
|
|
2681
|
+
data.map(item => {
|
|
2682
|
+
return item;
|
|
2683
|
+
}).forEach(i => this.productList.push(i));
|
|
2684
|
+
}
|
|
2685
|
+
else {
|
|
2686
|
+
this.productList = data;
|
|
2687
|
+
}
|
|
2688
|
+
// Update filteredOptions with transformedData
|
|
2689
|
+
var allProductList = this.transformResponseData(this.productList);
|
|
2690
|
+
this.filteredOptions = Promise.resolve(allProductList);
|
|
2691
|
+
this.searching = false;
|
|
2692
|
+
this.productsloadingFlag = true;
|
|
2693
|
+
setTimeout(() => {
|
|
2694
|
+
const ele = this.selectElem.panel.nativeElement;
|
|
2695
|
+
const trackHeight = ele.scrollHeight - ele.offsetHeight;
|
|
2696
|
+
const middlePosition = trackHeight / 2 - 50;
|
|
2697
|
+
ele.scrollTo({ top: middlePosition, behavior: 'auto' });
|
|
2698
|
+
}, 250);
|
|
2699
|
+
}
|
|
2700
|
+
}
|
|
2701
|
+
});
|
|
2707
2702
|
}
|
|
2708
2703
|
// Utility function to transform response data
|
|
2709
2704
|
transformResponseData(data) {
|
|
@@ -3022,7 +3017,7 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
|
|
|
3022
3017
|
}
|
|
3023
3018
|
}
|
|
3024
3019
|
removeRow(index) {
|
|
3025
|
-
let message = 'Are you sure you want to delete
|
|
3020
|
+
let message = 'Are you sure you want to delete this product?';
|
|
3026
3021
|
let showButton = true;
|
|
3027
3022
|
if (this.dataSource?.data?.length === 1) {
|
|
3028
3023
|
message = 'Please select atleast one product.';
|