ngx-render-material-forms 1.4.6 → 1.4.8
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 +126 -98
- package/fesm2015/ngx-render-material-forms.js +126 -98
- package/fesm2015/ngx-render-material-forms.mjs.map +1 -1
- package/fesm2020/ngx-render-material-forms.js +126 -97
- package/fesm2020/ngx-render-material-forms.mjs.map +1 -1
- package/lib/components/select/select.component.d.ts +2 -2
- 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 {
|
|
4
|
+
import { 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,8 +82,6 @@ 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';
|
|
87
85
|
import * as i9 from 'ngx-mat-select-search';
|
|
88
86
|
import { NgxMatSelectSearchModule } from 'ngx-mat-select-search';
|
|
89
87
|
import WellComponent from 'formiojs/components/well/Well.js';
|
|
@@ -2558,8 +2556,8 @@ class MaterialSelectComponent extends MaterialComponent {
|
|
|
2558
2556
|
// Variable to hold the reference to the current panel element
|
|
2559
2557
|
this.currentPanelElement = null;
|
|
2560
2558
|
this.openCounter = 1;
|
|
2561
|
-
this.holy = CryptoJS.enc.Base64.parse('8F/2+T2NXqUBQERR12R4sw==');
|
|
2562
|
-
this.grail = CryptoJS.enc.Base64.parse('yE0CgQbYzK5wqeoKTVzhOQ==');
|
|
2559
|
+
// this.holy = CryptoJS.enc.Base64.parse('8F/2+T2NXqUBQERR12R4sw==');
|
|
2560
|
+
// this.grail = CryptoJS.enc.Base64.parse('yE0CgQbYzK5wqeoKTVzhOQ==');
|
|
2563
2561
|
}
|
|
2564
2562
|
onInputChange(event) {
|
|
2565
2563
|
if (this.instance.component.key.toLowerCase() === 'vendorproductid' && event.target.value === '') {
|
|
@@ -2571,28 +2569,29 @@ class MaterialSelectComponent extends MaterialComponent {
|
|
|
2571
2569
|
this.onClearAll();
|
|
2572
2570
|
}
|
|
2573
2571
|
}
|
|
2574
|
-
scrumble(msg) {
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
}
|
|
2588
|
-
getcampaign(data, holy, grail) {
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
}
|
|
2572
|
+
// scrumble(msg) {
|
|
2573
|
+
// if (!isNullOrUndefined(msg)) {
|
|
2574
|
+
// var conceal = this.getcampaign(msg, this.holy, this.grail);
|
|
2575
|
+
// var sha256 = CryptoJS.HmacSHA256(CryptoJS.enc.Base64.stringify(this.grail) + conceal.toString(), CryptoJS.enc.Base64.stringify(this.holy));
|
|
2576
|
+
// var hashInBase64 = CryptoJS.enc.Base64.stringify(sha256);
|
|
2577
|
+
// let keyValue = {
|
|
2578
|
+
// "value": conceal.toString(),
|
|
2579
|
+
// "mac": hashInBase64
|
|
2580
|
+
// };
|
|
2581
|
+
// var result = JSON.stringify(keyValue);
|
|
2582
|
+
// var jumbled = CryptoJS.enc.Utf8.parse(result);
|
|
2583
|
+
// return CryptoJS.enc.Base64.stringify(jumbled);
|
|
2584
|
+
// }
|
|
2585
|
+
// }
|
|
2586
|
+
// getcampaign(data: any, holy: any, grail: any) {
|
|
2587
|
+
// return CryptoJS.AES.encrypt(data.toString(), holy,
|
|
2588
|
+
// {
|
|
2589
|
+
// blockSize: 128,
|
|
2590
|
+
// iv: grail,
|
|
2591
|
+
// mode: CryptoJS.mode.CBC,
|
|
2592
|
+
// padding: CryptoJS.pad.Pkcs7
|
|
2593
|
+
// });
|
|
2594
|
+
// }
|
|
2596
2595
|
registerPanelScrollEvent(selectElem) {
|
|
2597
2596
|
const panelElement = selectElem.panel.nativeElement;
|
|
2598
2597
|
panelElement.addEventListener('scroll', this.onScroll.bind(this));
|
|
@@ -2631,74 +2630,78 @@ class MaterialSelectComponent extends MaterialComponent {
|
|
|
2631
2630
|
return item ? item.value : null;
|
|
2632
2631
|
}
|
|
2633
2632
|
loadData(pageNumber, pageSize, searchQuery) {
|
|
2634
|
-
const paramsData = JSON.parse(localStorage.getItem('
|
|
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
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
}
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
const
|
|
2651
|
-
const
|
|
2652
|
-
const
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
//
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
//
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
//
|
|
2672
|
-
const
|
|
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
|
-
});
|
|
2633
|
+
// const paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
|
|
2634
|
+
// const includeDescription = this.getValueByKey(paramsData, 'includeDescription');
|
|
2635
|
+
// const vendorId = this.getValueByKey(paramsData, 'vendorId');
|
|
2636
|
+
// const onlyActive = this.getValueByKey(paramsData, 'onlyActive');
|
|
2637
|
+
// var currentUser = JSON.parse(localStorage.getItem('currentUser'));
|
|
2638
|
+
// let headers;
|
|
2639
|
+
// if (currentUser && currentUser.Tokens && currentUser.Tokens.AccessToken) {
|
|
2640
|
+
// var accessToken = currentUser.Tokens.AccessToken;
|
|
2641
|
+
// headers = new HttpHeaders({
|
|
2642
|
+
// 'Content-Type': 'application/json',
|
|
2643
|
+
// 'Authorization': 'Bearer ' + accessToken
|
|
2644
|
+
// });
|
|
2645
|
+
// } else {
|
|
2646
|
+
// console.error('User not authenticated or tokens missing.');
|
|
2647
|
+
// }
|
|
2648
|
+
// const envendorId = this.scrumble(vendorId)
|
|
2649
|
+
// const enpageNumber = this.scrumble(pageNumber)
|
|
2650
|
+
// const enpageSize = this.scrumble(pageSize);
|
|
2651
|
+
// const ensearchQuery = this.scrumble(searchQuery);
|
|
2652
|
+
// let enactive = this.scrumble(onlyActive);
|
|
2653
|
+
// //Check if enactive is undefined, null, or blank
|
|
2654
|
+
// if (enactive === undefined || enactive === null || enactive === '') {
|
|
2655
|
+
// enactive = this.scrumble(true); // Set default value to true
|
|
2656
|
+
// }
|
|
2657
|
+
// // Scrumble and handle the includeDescription parameter
|
|
2658
|
+
// let endescription = this.scrumble(includeDescription);
|
|
2659
|
+
// if (!endescription) {
|
|
2660
|
+
// endescription = this.scrumble(false); // Set to 'false' if undefined, null, or blank
|
|
2661
|
+
// }
|
|
2662
|
+
// const baseUrlMapping = {
|
|
2663
|
+
// 'localhost': 'http://localhost:58504',
|
|
2664
|
+
// 'lincoln.vartopia.com': 'https://lincoln-api.vartopia.com',
|
|
2665
|
+
// 'stage.vartopia.com': 'https://stage-api.vartopia.com',
|
|
2666
|
+
// 'my.vartopia.com': 'https://reagan-api.vartopia.com',
|
|
2667
|
+
// 'jackson.vartopia.com': 'https://jackson-api.vartopia.com'
|
|
2668
|
+
// };
|
|
2669
|
+
// // Get the current hostname
|
|
2670
|
+
// const hostname = window.location.hostname;
|
|
2671
|
+
// const baseApiUrl = baseUrlMapping[hostname] || null;
|
|
2672
|
+
// interface VendorProductsResponse {
|
|
2673
|
+
// code: number;
|
|
2674
|
+
// data: any;
|
|
2675
|
+
// message: string;
|
|
2676
|
+
// statusCode: number;
|
|
2677
|
+
// }
|
|
2678
|
+
// this.http.get<VendorProductsResponse>(`${baseApiUrl}/api/VendorFormBuilder/GetVendorProducts?vendorId=${envendorId}&pageNumber=${enpageNumber}&pageSize=${enpageSize}&search=${ensearchQuery}&onlyActive=${enactive}&includeDescription=${endescription}`, { headers }).subscribe(response => {
|
|
2679
|
+
// if (response && response.code === 200) {
|
|
2680
|
+
// if (this.instance.component.key.toLowerCase() === 'vendorproductid') {
|
|
2681
|
+
// this.totalPages = response?.data?.totalPages;
|
|
2682
|
+
// const data = response.data.dataSource;
|
|
2683
|
+
// this.filteredOptionsLength = data.length;
|
|
2684
|
+
// if (this.productList.length > 0) {
|
|
2685
|
+
// data.map(item => {
|
|
2686
|
+
// return item
|
|
2687
|
+
// }).forEach(i => this.productList.push(i))
|
|
2688
|
+
// } else {
|
|
2689
|
+
// this.productList = data;
|
|
2690
|
+
// }
|
|
2691
|
+
// // Update filteredOptions with transformedData
|
|
2692
|
+
// var allProductList = this.transformResponseData(this.productList);
|
|
2693
|
+
// this.filteredOptions = Promise.resolve(allProductList);
|
|
2694
|
+
// this.searching = false;
|
|
2695
|
+
// this.productsloadingFlag = true;
|
|
2696
|
+
// setTimeout(() => {
|
|
2697
|
+
// const ele = this.selectElem.panel.nativeElement;
|
|
2698
|
+
// const trackHeight = ele.scrollHeight - ele.offsetHeight
|
|
2699
|
+
// const middlePosition = trackHeight / 2 - 50;
|
|
2700
|
+
// ele.scrollTo({ top: middlePosition, behavior: 'auto' });
|
|
2701
|
+
// }, 250);
|
|
2702
|
+
// }
|
|
2703
|
+
// }
|
|
2704
|
+
// });
|
|
2702
2705
|
}
|
|
2703
2706
|
// Utility function to transform response data
|
|
2704
2707
|
transformResponseData(data) {
|
|
@@ -2809,6 +2812,32 @@ class MaterialSelectComponent extends MaterialComponent {
|
|
|
2809
2812
|
});
|
|
2810
2813
|
this.filteredOptions = this.selectOptions;
|
|
2811
2814
|
}
|
|
2815
|
+
isError() {
|
|
2816
|
+
if (this.instance.error) {
|
|
2817
|
+
this.control.setErrors(this.instance.component.validate);
|
|
2818
|
+
return true;
|
|
2819
|
+
}
|
|
2820
|
+
else {
|
|
2821
|
+
return false;
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
getErrorMessage() {
|
|
2825
|
+
if (this.instance.error && this.instance.error.messages) {
|
|
2826
|
+
const { messages } = this.instance.error;
|
|
2827
|
+
if (messages.length) {
|
|
2828
|
+
for (const msg of messages) {
|
|
2829
|
+
if (msg.context) {
|
|
2830
|
+
if (this.instance && this.instance.parent && this.instance.parent._data) {
|
|
2831
|
+
if (this.instance.parent._data.submit) {
|
|
2832
|
+
this.control.markAllAsTouched();
|
|
2833
|
+
}
|
|
2834
|
+
}
|
|
2835
|
+
return this.instance.error ? this.instance.error.message : '';
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
}
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
2812
2841
|
compareObjects(o1, o2) {
|
|
2813
2842
|
return _.isEqual(o1, o2);
|
|
2814
2843
|
}
|
|
@@ -2851,7 +2880,7 @@ MaterialSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0"
|
|
|
2851
2880
|
<span *ngIf="instance.component.suffix" matSuffix>
|
|
2852
2881
|
{{ instance.component.suffix }}
|
|
2853
2882
|
</span>
|
|
2854
|
-
|
|
2883
|
+
<mat-error *ngIf="isError()" >{{ getErrorMessage() }}</mat-error>
|
|
2855
2884
|
</mat-form-field>
|
|
2856
2885
|
</ng-template>
|
|
2857
2886
|
`, isInline: true, styles: [".example-viewport{height:200px}.product-picker{overflow-x:hidden}.virtual-full-view{height:auto!important;white-space:normal!important;line-height:1.4!important;text-overflow:initial!important;min-height:48px!important;overflow:visible!important;overflow:initial!important;padding-top:10px!important;padding-bottom:10px!important}::ng-deep .product-picker .cdk-virtual-scroll-content-wrapper{width:100%!important}.virtual-full-view .mat-pseudo-checkbox{align-self:top!important}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatPrefix, selector: "[matPrefix]" }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix]" }, { kind: "component", type: i4$3.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i5$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i5.FlexFillDirective, selector: "[fxFill], [fxFlexFill]" }, { kind: "component", type: i9.MatSelectSearchComponent, selector: "ngx-mat-select-search", inputs: ["placeholderLabel", "type", "closeIcon", "closeSvgIcon", "noEntriesFoundLabel", "indexAndLengthScreenReaderText", "clearSearchInput", "searching", "disableInitialFocus", "enableClearOnEscapePressed", "preventHomeEndKeyPropagation", "disableScrollToActiveOnOptionsChanged", "ariaLabel", "showToggleAllCheckbox", "toggleAllCheckboxChecked", "toggleAllCheckboxIndeterminate", "toggleAllCheckboxTooltipMessage", "toogleAllCheckboxTooltipPosition", "hideClearSearchButton", "alwaysRestoreSelectedOptionsMulti"], outputs: ["toggleAll"] }, { kind: "directive", type: i9.MatSelectSearchClearDirective, selector: "[ngxMatSelectSearchClear]" }, { kind: "component", type: FormioFormFieldComponent, selector: "mat-formio-form-field", inputs: ["labelTemplate", "renderTopLabel", "showDescription", "renderElementOnly", "instance", "componentTemplate"] }, { kind: "component", type: LabelComponent, selector: "span[matFormioLabel]", inputs: ["instance"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }] });
|
|
@@ -2894,7 +2923,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
2894
2923
|
<span *ngIf="instance.component.suffix" matSuffix>
|
|
2895
2924
|
{{ instance.component.suffix }}
|
|
2896
2925
|
</span>
|
|
2897
|
-
|
|
2926
|
+
<mat-error *ngIf="isError()" >{{ getErrorMessage() }}</mat-error>
|
|
2898
2927
|
</mat-form-field>
|
|
2899
2928
|
</ng-template>
|
|
2900
2929
|
`, styles: [".example-viewport{height:200px}.product-picker{overflow-x:hidden}.virtual-full-view{height:auto!important;white-space:normal!important;line-height:1.4!important;text-overflow:initial!important;min-height:48px!important;overflow:visible!important;overflow:initial!important;padding-top:10px!important;padding-bottom:10px!important}::ng-deep .product-picker .cdk-virtual-scroll-content-wrapper{width:100%!important}.virtual-full-view .mat-pseudo-checkbox{align-self:top!important}\n"] }]
|