ngx-render-material-forms 2.5.4 → 2.5.6

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.
@@ -2685,6 +2685,7 @@ class CommonService {
2685
2685
  }
2686
2686
  }
2687
2687
  loadProducts(pageNumber, pazeSize, search = '', onlyActive = true, description = false, levelOneId, levelTwoId, levelThreeId, levelFourId) {
2688
+ this.paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
2688
2689
  const baseApiUrl = this.getBaseApiUrl();
2689
2690
  const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2690
2691
  const programId = this.getValueByKey(this.paramsData, 'programId');
@@ -2695,6 +2696,7 @@ class CommonService {
2695
2696
  return this.http.get(apiUrl);
2696
2697
  }
2697
2698
  listSubCategory(category) {
2699
+ this.paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
2698
2700
  const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2699
2701
  const baseApiUrl = this.getBaseApiUrl();
2700
2702
  return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductsSubCategory?vendorId=${vendorId}&categoryName=${category}`);
@@ -2716,26 +2718,31 @@ class CommonService {
2716
2718
  return queryString;
2717
2719
  }
2718
2720
  listProductCategory() {
2721
+ this.paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
2719
2722
  const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2720
2723
  const baseApiUrl = this.getBaseApiUrl();
2721
2724
  return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductsCategory?vendorId=${vendorId}`);
2722
2725
  }
2723
2726
  productLevelOne() {
2727
+ this.paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
2724
2728
  const baseApiUrl = this.getBaseApiUrl();
2725
2729
  const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2726
2730
  return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductLevelOne?vendorId=${vendorId}`);
2727
2731
  }
2728
2732
  productLevelTwo(levelOneId) {
2733
+ this.paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
2729
2734
  const baseApiUrl = this.getBaseApiUrl();
2730
2735
  const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2731
2736
  return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductLevelTwo?levelOneId=${levelOneId}&vendorId=${vendorId}`);
2732
2737
  }
2733
2738
  productLevelThree(levelOneId, levelTwoId) {
2739
+ this.paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
2734
2740
  const baseApiUrl = this.getBaseApiUrl();
2735
2741
  const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2736
2742
  return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductLevelThree?levelOneId=${levelOneId}&levelTwoId=${levelTwoId}&vendorId=${vendorId}`);
2737
2743
  }
2738
2744
  productLevelFour(levelOneId, levelTwoId, levelThreeId) {
2745
+ this.paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
2739
2746
  const baseApiUrl = this.getBaseApiUrl();
2740
2747
  const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2741
2748
  return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductLevelFour?levelOneId=${levelOneId}&levelTwoId=${levelTwoId}&levelThreeId=${levelThreeId}&vendorId=${vendorId}`);
@@ -2769,12 +2776,8 @@ class CommonService {
2769
2776
  }
2770
2777
  /*Funtion to check if property is matched with given attributes in formBuilder or not */
2771
2778
  checkIsAttributeTrue(newProductPickerFlag, attributeName) {
2772
- // return newProductPickerFlag && Object.keys(newProductPickerFlag).some(key =>
2773
- // key.toLocaleLowerCase() === attributeName.toLowerCase() &&
2774
- // newProductPickerFlag[key].toLowerCase() === "true"
2775
- // );
2776
- return newProductPickerFlag && Object.keys(newProductPickerFlag).some(key => key.trim().toLowerCase() === attributeName.trim().toLowerCase() &&
2777
- String(newProductPickerFlag[key]).trim().toLowerCase() === "true");
2779
+ return newProductPickerFlag && Object.keys(newProductPickerFlag).some(key => key.toLocaleLowerCase() === attributeName.toLowerCase() &&
2780
+ newProductPickerFlag[key].toLowerCase() === "true");
2778
2781
  }
2779
2782
  getglobedata() {
2780
2783
  const hostMappings = {
@@ -2839,8 +2842,6 @@ class MaterialSelectComponent extends MaterialComponent {
2839
2842
  this.storeDependentItems = [];
2840
2843
  this.executionFlag = false;
2841
2844
  this.apiCounter = 0;
2842
- this.optionsInitialized = false;
2843
- this.lastOptionsHash = '';
2844
2845
  }
2845
2846
  onInputChange(event) {
2846
2847
  if (this.instance.component.key.toLowerCase() === 'vendorproductid' && event.target.value === '') {
@@ -3097,8 +3098,6 @@ class MaterialSelectComponent extends MaterialComponent {
3097
3098
  // If the object doesn't exist, add it to the array
3098
3099
  finalParams.push({ key: 'dataValue', value: value });
3099
3100
  }
3100
- this.secondDropdownItems = [];
3101
- this.commonService.setDropdownItems(this.secondDropdownItems);
3102
3101
  this.commonService.initializeApiPath(apiEndPoint, finalParams).subscribe(response => {
3103
3102
  if (response && response.code === 200) {
3104
3103
  this.secondDropdownItems = response.data;
@@ -3133,60 +3132,21 @@ class MaterialSelectComponent extends MaterialComponent {
3133
3132
  });
3134
3133
  }
3135
3134
  if (this.checkVendorRefItems(this.instance) && checkInvokeFromLibrary) {
3136
- // this.storeDependentItems = [];
3137
- // this.secondDropdownItems = this.commonService.getDropdownItems();
3138
- // if (this.secondDropdownItems?.length) {
3139
- // this.secondDropdownItems.forEach((renderElement, index, array) => {
3140
- // this.storeDependentItems.push({ label: renderElement['text'], value: this.commonService.onlyNumbers(renderElement['value']) ? renderElement['value'] + ' ' : renderElement['value'] });
3141
- // });
3142
- // }
3143
- // if (!this.commonService.getDropDownFlag()) {
3144
- // this.storeDependentItems = this.instance.component.data.values;
3145
- // }
3146
- // this.filteredOptions = Promise.resolve(this.storeDependentItems);
3147
- // this.selectOptions = Promise.resolve(this.storeDependentItems);
3148
- // this.selectOptions.then(result => {
3149
- // this.filteredOptionsLength = result.length
3150
- // });
3151
- const incomingItems = this.commonService.getDropdownItems();
3152
- const seen = new Set();
3153
- const newOptions = [];
3154
- if (incomingItems?.length) {
3155
- incomingItems.forEach(item => {
3156
- const rawValue = this.commonService.onlyNumbers(item['value']) ? item['value'] + ' ' : item['value'];
3157
- const label = item['text']?.trim();
3158
- const key = `${label}-${rawValue}`;
3159
- if (!seen.has(key)) {
3160
- seen.add(key);
3161
- newOptions.push({ label, value: rawValue });
3162
- }
3135
+ this.storeDependentItems = [];
3136
+ this.secondDropdownItems = this.commonService.getDropdownItems();
3137
+ if (this.secondDropdownItems?.length) {
3138
+ this.secondDropdownItems.forEach((renderElement, index, array) => {
3139
+ this.storeDependentItems.push({ label: renderElement['text'], value: this.commonService.onlyNumbers(renderElement['value']) ? renderElement['value'] + ' ' : renderElement['value'] });
3163
3140
  });
3164
3141
  }
3165
- // compare hashes to avoid unnecessary reassignments
3166
- const newHash = JSON.stringify(newOptions);
3167
- if (newHash !== this.lastOptionsHash) {
3168
- this.lastOptionsHash = newHash;
3169
- this.storeDependentItems = newOptions;
3170
- if (!this.commonService.getDropDownFlag()) {
3171
- this.storeDependentItems = this.instance.component.data.values;
3172
- }
3173
- this.filteredOptions = Promise.resolve(this.storeDependentItems);
3174
- this.selectOptions = Promise.resolve(this.storeDependentItems);
3175
- this.selectOptions.then(result => {
3176
- this.filteredOptionsLength = result.length;
3177
- });
3178
- // scroll to selected item
3179
- setTimeout(() => {
3180
- const panel = this.selectElem?.panel?.nativeElement;
3181
- if (panel && this.storeDependentItems?.length) {
3182
- const selectedIndex = this.storeDependentItems.findIndex(item => this.compareObjects(item.value, this.control.value));
3183
- if (selectedIndex >= 0) {
3184
- const optionHeight = 48;
3185
- panel.scrollTop = selectedIndex * optionHeight;
3186
- }
3187
- }
3188
- }, 200);
3142
+ if (!this.commonService.getDropDownFlag()) {
3143
+ this.storeDependentItems = this.instance.component.data.values;
3189
3144
  }
3145
+ this.filteredOptions = Promise.resolve(this.storeDependentItems);
3146
+ this.selectOptions = Promise.resolve(this.storeDependentItems);
3147
+ this.selectOptions.then(result => {
3148
+ this.filteredOptionsLength = result.length;
3149
+ });
3190
3150
  }
3191
3151
  }
3192
3152
  });
@@ -3270,7 +3230,6 @@ class MaterialSelectComponent extends MaterialComponent {
3270
3230
  const dataUrl = instance.component['data']?.url;
3271
3231
  const isSelectValuesValid = selectValues != null && selectValues !== '' && selectValues !== undefined;
3272
3232
  const isDataUrlInvalid = dataUrl == null || dataUrl === '' || dataUrl === undefined;
3273
- instance.component.defaultValue = "";
3274
3233
  return isSelectValuesValid && isDataUrlInvalid;
3275
3234
  }
3276
3235
  getVendorRefList(instance) {
@@ -3363,7 +3322,7 @@ MaterialSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0"
3363
3322
  <mat-error *ngIf="isError()" >{{ getErrorMessage() }}</mat-error>
3364
3323
  </mat-form-field>
3365
3324
  </ng-template>
3366
- `, 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}.mat-option.virtual-full-view.mat-active{background:none}.mat-option.virtual-full-view.mat-selected .mat-option-text span{color:#000000de}\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: i10.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: i10.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" }] });
3325
+ `, 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: i10.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: i10.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" }] });
3367
3326
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialSelectComponent, decorators: [{
3368
3327
  type: Component,
3369
3328
  args: [{ selector: 'mat-formio-select', template: `
@@ -3407,7 +3366,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
3407
3366
  <mat-error *ngIf="isError()" >{{ getErrorMessage() }}</mat-error>
3408
3367
  </mat-form-field>
3409
3368
  </ng-template>
3410
- `, 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}.mat-option.virtual-full-view.mat-active{background:none}.mat-option.virtual-full-view.mat-selected .mat-option-text span{color:#000000de}\n"] }]
3369
+ `, 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"] }]
3411
3370
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$2.HttpClient }, { type: CommonService }]; }, propDecorators: { multiSelect: [{
3412
3371
  type: ViewChild,
3413
3372
  args: ['multiSelect', { static: true }]