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.
@@ -2687,6 +2687,7 @@ class CommonService {
2687
2687
  }
2688
2688
  }
2689
2689
  loadProducts(pageNumber, pazeSize, search = '', onlyActive = true, description = false, levelOneId, levelTwoId, levelThreeId, levelFourId) {
2690
+ this.paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
2690
2691
  const baseApiUrl = this.getBaseApiUrl();
2691
2692
  const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2692
2693
  const programId = this.getValueByKey(this.paramsData, 'programId');
@@ -2697,6 +2698,7 @@ class CommonService {
2697
2698
  return this.http.get(apiUrl);
2698
2699
  }
2699
2700
  listSubCategory(category) {
2701
+ this.paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
2700
2702
  const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2701
2703
  const baseApiUrl = this.getBaseApiUrl();
2702
2704
  return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductsSubCategory?vendorId=${vendorId}&categoryName=${category}`);
@@ -2718,26 +2720,31 @@ class CommonService {
2718
2720
  return queryString;
2719
2721
  }
2720
2722
  listProductCategory() {
2723
+ this.paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
2721
2724
  const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2722
2725
  const baseApiUrl = this.getBaseApiUrl();
2723
2726
  return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductsCategory?vendorId=${vendorId}`);
2724
2727
  }
2725
2728
  productLevelOne() {
2729
+ this.paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
2726
2730
  const baseApiUrl = this.getBaseApiUrl();
2727
2731
  const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2728
2732
  return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductLevelOne?vendorId=${vendorId}`);
2729
2733
  }
2730
2734
  productLevelTwo(levelOneId) {
2735
+ this.paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
2731
2736
  const baseApiUrl = this.getBaseApiUrl();
2732
2737
  const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2733
2738
  return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductLevelTwo?levelOneId=${levelOneId}&vendorId=${vendorId}`);
2734
2739
  }
2735
2740
  productLevelThree(levelOneId, levelTwoId) {
2741
+ this.paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
2736
2742
  const baseApiUrl = this.getBaseApiUrl();
2737
2743
  const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2738
2744
  return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductLevelThree?levelOneId=${levelOneId}&levelTwoId=${levelTwoId}&vendorId=${vendorId}`);
2739
2745
  }
2740
2746
  productLevelFour(levelOneId, levelTwoId, levelThreeId) {
2747
+ this.paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
2741
2748
  const baseApiUrl = this.getBaseApiUrl();
2742
2749
  const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2743
2750
  return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductLevelFour?levelOneId=${levelOneId}&levelTwoId=${levelTwoId}&levelThreeId=${levelThreeId}&vendorId=${vendorId}`);
@@ -2771,12 +2778,8 @@ class CommonService {
2771
2778
  }
2772
2779
  /*Funtion to check if property is matched with given attributes in formBuilder or not */
2773
2780
  checkIsAttributeTrue(newProductPickerFlag, attributeName) {
2774
- // return newProductPickerFlag && Object.keys(newProductPickerFlag).some(key =>
2775
- // key.toLocaleLowerCase() === attributeName.toLowerCase() &&
2776
- // newProductPickerFlag[key].toLowerCase() === "true"
2777
- // );
2778
- return newProductPickerFlag && Object.keys(newProductPickerFlag).some(key => key.trim().toLowerCase() === attributeName.trim().toLowerCase() &&
2779
- String(newProductPickerFlag[key]).trim().toLowerCase() === "true");
2781
+ return newProductPickerFlag && Object.keys(newProductPickerFlag).some(key => key.toLocaleLowerCase() === attributeName.toLowerCase() &&
2782
+ newProductPickerFlag[key].toLowerCase() === "true");
2780
2783
  }
2781
2784
  getglobedata() {
2782
2785
  const hostMappings = {
@@ -2841,8 +2844,6 @@ class MaterialSelectComponent extends MaterialComponent {
2841
2844
  this.storeDependentItems = [];
2842
2845
  this.executionFlag = false;
2843
2846
  this.apiCounter = 0;
2844
- this.optionsInitialized = false;
2845
- this.lastOptionsHash = '';
2846
2847
  }
2847
2848
  onInputChange(event) {
2848
2849
  if (this.instance.component.key.toLowerCase() === 'vendorproductid' && event.target.value === '') {
@@ -3103,8 +3104,6 @@ class MaterialSelectComponent extends MaterialComponent {
3103
3104
  // If the object doesn't exist, add it to the array
3104
3105
  finalParams.push({ key: 'dataValue', value: value });
3105
3106
  }
3106
- this.secondDropdownItems = [];
3107
- this.commonService.setDropdownItems(this.secondDropdownItems);
3108
3107
  this.commonService.initializeApiPath(apiEndPoint, finalParams).subscribe(response => {
3109
3108
  if (response && response.code === 200) {
3110
3109
  this.secondDropdownItems = response.data;
@@ -3124,7 +3123,7 @@ class MaterialSelectComponent extends MaterialComponent {
3124
3123
  }
3125
3124
  }
3126
3125
  this.selectElem.openedChange.subscribe((isOpen) => __awaiter(this, void 0, void 0, function* () {
3127
- var _a, _b;
3126
+ var _a, _b, _c;
3128
3127
  let i = 0;
3129
3128
  if (isOpen) {
3130
3129
  const newProductPickerFlag = (_b = (_a = this.instance) === null || _a === void 0 ? void 0 : _a.component) === null || _b === void 0 ? void 0 : _b.attributes;
@@ -3140,62 +3139,21 @@ class MaterialSelectComponent extends MaterialComponent {
3140
3139
  });
3141
3140
  }
3142
3141
  if (this.checkVendorRefItems(this.instance) && checkInvokeFromLibrary) {
3143
- // this.storeDependentItems = [];
3144
- // this.secondDropdownItems = this.commonService.getDropdownItems();
3145
- // if (this.secondDropdownItems?.length) {
3146
- // this.secondDropdownItems.forEach((renderElement, index, array) => {
3147
- // this.storeDependentItems.push({ label: renderElement['text'], value: this.commonService.onlyNumbers(renderElement['value']) ? renderElement['value'] + ' ' : renderElement['value'] });
3148
- // });
3149
- // }
3150
- // if (!this.commonService.getDropDownFlag()) {
3151
- // this.storeDependentItems = this.instance.component.data.values;
3152
- // }
3153
- // this.filteredOptions = Promise.resolve(this.storeDependentItems);
3154
- // this.selectOptions = Promise.resolve(this.storeDependentItems);
3155
- // this.selectOptions.then(result => {
3156
- // this.filteredOptionsLength = result.length
3157
- // });
3158
- const incomingItems = this.commonService.getDropdownItems();
3159
- const seen = new Set();
3160
- const newOptions = [];
3161
- if (incomingItems === null || incomingItems === void 0 ? void 0 : incomingItems.length) {
3162
- incomingItems.forEach(item => {
3163
- var _a;
3164
- const rawValue = this.commonService.onlyNumbers(item['value']) ? item['value'] + ' ' : item['value'];
3165
- const label = (_a = item['text']) === null || _a === void 0 ? void 0 : _a.trim();
3166
- const key = `${label}-${rawValue}`;
3167
- if (!seen.has(key)) {
3168
- seen.add(key);
3169
- newOptions.push({ label, value: rawValue });
3170
- }
3142
+ this.storeDependentItems = [];
3143
+ this.secondDropdownItems = this.commonService.getDropdownItems();
3144
+ if ((_c = this.secondDropdownItems) === null || _c === void 0 ? void 0 : _c.length) {
3145
+ this.secondDropdownItems.forEach((renderElement, index, array) => {
3146
+ this.storeDependentItems.push({ label: renderElement['text'], value: this.commonService.onlyNumbers(renderElement['value']) ? renderElement['value'] + ' ' : renderElement['value'] });
3171
3147
  });
3172
3148
  }
3173
- // compare hashes to avoid unnecessary reassignments
3174
- const newHash = JSON.stringify(newOptions);
3175
- if (newHash !== this.lastOptionsHash) {
3176
- this.lastOptionsHash = newHash;
3177
- this.storeDependentItems = newOptions;
3178
- if (!this.commonService.getDropDownFlag()) {
3179
- this.storeDependentItems = this.instance.component.data.values;
3180
- }
3181
- this.filteredOptions = Promise.resolve(this.storeDependentItems);
3182
- this.selectOptions = Promise.resolve(this.storeDependentItems);
3183
- this.selectOptions.then(result => {
3184
- this.filteredOptionsLength = result.length;
3185
- });
3186
- // scroll to selected item
3187
- setTimeout(() => {
3188
- var _a, _b, _c;
3189
- const panel = (_b = (_a = this.selectElem) === null || _a === void 0 ? void 0 : _a.panel) === null || _b === void 0 ? void 0 : _b.nativeElement;
3190
- if (panel && ((_c = this.storeDependentItems) === null || _c === void 0 ? void 0 : _c.length)) {
3191
- const selectedIndex = this.storeDependentItems.findIndex(item => this.compareObjects(item.value, this.control.value));
3192
- if (selectedIndex >= 0) {
3193
- const optionHeight = 48;
3194
- panel.scrollTop = selectedIndex * optionHeight;
3195
- }
3196
- }
3197
- }, 200);
3149
+ if (!this.commonService.getDropDownFlag()) {
3150
+ this.storeDependentItems = this.instance.component.data.values;
3198
3151
  }
3152
+ this.filteredOptions = Promise.resolve(this.storeDependentItems);
3153
+ this.selectOptions = Promise.resolve(this.storeDependentItems);
3154
+ this.selectOptions.then(result => {
3155
+ this.filteredOptionsLength = result.length;
3156
+ });
3199
3157
  }
3200
3158
  }
3201
3159
  }));
@@ -3281,7 +3239,6 @@ class MaterialSelectComponent extends MaterialComponent {
3281
3239
  const dataUrl = (_a = instance.component['data']) === null || _a === void 0 ? void 0 : _a.url;
3282
3240
  const isSelectValuesValid = selectValues != null && selectValues !== '' && selectValues !== undefined;
3283
3241
  const isDataUrlInvalid = dataUrl == null || dataUrl === '' || dataUrl === undefined;
3284
- instance.component.defaultValue = "";
3285
3242
  return isSelectValuesValid && isDataUrlInvalid;
3286
3243
  }
3287
3244
  getVendorRefList(instance) {
@@ -3375,7 +3332,7 @@ MaterialSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0"
3375
3332
  <mat-error *ngIf="isError()" >{{ getErrorMessage() }}</mat-error>
3376
3333
  </mat-form-field>
3377
3334
  </ng-template>
3378
- `, 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" }] });
3335
+ `, 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" }] });
3379
3336
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialSelectComponent, decorators: [{
3380
3337
  type: Component,
3381
3338
  args: [{ selector: 'mat-formio-select', template: `
@@ -3419,7 +3376,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
3419
3376
  <mat-error *ngIf="isError()" >{{ getErrorMessage() }}</mat-error>
3420
3377
  </mat-form-field>
3421
3378
  </ng-template>
3422
- `, 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"] }]
3379
+ `, 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"] }]
3423
3380
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$2.HttpClient }, { type: CommonService }]; }, propDecorators: { multiSelect: [{
3424
3381
  type: ViewChild,
3425
3382
  args: ['multiSelect', { static: true }]