ngx-render-material-forms 1.5.0 → 1.5.2

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.
@@ -1,11 +1,11 @@
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
- import * as i1$2 from '@angular/common/http';
3
+ import * as i1$1 from '@angular/common/http';
4
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';
8
- import { FormControl, NG_VALUE_ACCESSOR, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
8
+ import { FormControl, NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
9
9
  import * as i4$2 from '@angular/material/input';
10
10
  import { MAT_INPUT_VALUE_ACCESSOR, MatInputModule } from '@angular/material/input';
11
11
  import * as i3$2 from '@angular/material/button';
@@ -27,20 +27,18 @@ import * as i4 from '@angular/material/card';
27
27
  import { MatCardModule } from '@angular/material/card';
28
28
  import * as i2$2 from '@angular/material/tabs';
29
29
  import { MatTabsModule } from '@angular/material/tabs';
30
- import * as i10 from '@angular/material/table';
30
+ import * as i4$7 from '@angular/material/table';
31
31
  import { MatTableDataSource, MatTableModule } from '@angular/material/table';
32
32
  import * as i5$2 from '@angular/material/datepicker';
33
33
  import { MatDatepickerModule } from '@angular/material/datepicker';
34
- import * as i11 from '@angular/material/progress-spinner';
34
+ import * as i3$4 from '@angular/material/progress-spinner';
35
35
  import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
36
36
  import * as i4$1 from '@angular/material/icon';
37
37
  import { MatIconModule } from '@angular/material/icon';
38
38
  import * as i5$1 from '@angular/material/core';
39
39
  import { MatNativeDateModule } from '@angular/material/core';
40
- import * as i1$1 from '@angular/material/dialog';
40
+ import * as i1$2 from '@angular/material/dialog';
41
41
  import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
42
- import * as i14 from '@angular/material/autocomplete';
43
- import { MatAutocompleteModule } from '@angular/material/autocomplete';
44
42
  import Webform from 'formiojs/Webform.js';
45
43
  import FormioComponent$2 from 'formiojs/components/_classes/component/Component.js';
46
44
  import TextFieldComponent from 'formiojs/components/textfield/TextField.js';
@@ -83,24 +81,23 @@ import RadioComponent from 'formiojs/components/radio/Radio.js';
83
81
  import SelectBoxesComponent from 'formiojs/components/selectboxes/SelectBoxes.js';
84
82
  import SelectComponent from 'formiojs/components/select/Select.js';
85
83
  import { Subject } from 'rxjs';
86
- import { debounceTime, distinctUntilChanged, takeUntil, startWith, map } from 'rxjs/operators';
84
+ import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators';
87
85
  import * as CryptoJS from 'crypto-js';
88
86
  import { isNullOrUndefined } from 'util';
89
87
  import * as i9 from 'ngx-mat-select-search';
90
88
  import { NgxMatSelectSearchModule } from 'ngx-mat-select-search';
91
89
  import WellComponent from 'formiojs/components/well/Well.js';
92
90
  import DataGridComponent from 'formiojs/components/datagrid/DataGrid.js';
93
- import * as i9$1 from '@angular/cdk/drag-drop';
91
+ import * as i8 from '@angular/cdk/drag-drop';
94
92
  import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
95
- import { SelectionModel } from '@angular/cdk/collections';
96
- import * as i13 from '@angular/material/stepper';
97
- import { MatStepperModule } from '@angular/material/stepper';
98
93
  import EditGridComponent from 'formiojs/components/editgrid/EditGrid.js';
99
94
  import Components$2 from 'formiojs/components/Components';
100
95
  import isString from 'lodash/isString';
101
96
  import TableComponent from 'formiojs/components/table/Table.js';
102
97
  import Wizard from 'formiojs/Wizard';
103
98
  import Displays from 'formiojs/displays/Displays';
99
+ import * as i3$3 from '@angular/material/stepper';
100
+ import { MatStepperModule } from '@angular/material/stepper';
104
101
  import * as i1$3 from '@formio/angular';
105
102
  import { FormioBaseComponent } from '@formio/angular';
106
103
  import { FlexLayoutModule } from '@angular/flex-layout';
@@ -979,11 +976,8 @@ var AngularButtonsThemes;
979
976
  })(AngularButtonsThemes || (AngularButtonsThemes = {}));
980
977
 
981
978
  class MaterialButtonComponent extends MaterialComponent {
982
- constructor(element, ref, dialog) {
983
- super(element, ref);
984
- this.element = element;
985
- this.ref = ref;
986
- this.dialog = dialog;
979
+ constructor() {
980
+ super(...arguments);
987
981
  this.loading = false;
988
982
  this.done = false;
989
983
  this.error = false;
@@ -1054,12 +1048,12 @@ class MaterialButtonComponent extends MaterialComponent {
1054
1048
  return retVal;
1055
1049
  }
1056
1050
  }
1057
- MaterialButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialButtonComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
1058
- MaterialButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: MaterialButtonComponent, selector: "mat-formio-button", usesInheritance: true, ngImport: i0, template: "<button *ngIf=\"instance && instance.component.label != 'Click to add Products'\"\r\n [ngClass]=\"buttonClass\"\r\n type=\"{{ instance.component.action }}\"\r\n mat-raised-button [color]=\"color\"\r\n [disabled]=\"disabled\"\r\n (click)=\"instance.onClick($event)\"\r\n>\r\n\r\n\r\n <mat-icon *ngIf=\"instance.component.leftIcon\">{{instance.component.leftIcon}}</mat-icon>\r\n <mat-icon *ngIf=\"done\">done</mat-icon>\r\n <mat-icon *ngIf=\"error\">close</mat-icon>\r\n <mat-icon class=\"mat-icon-spin\" *ngIf=\"loading\">autorenew</mat-icon>\r\n {{ instance.component.label }}\r\n <mat-icon *ngIf=\"instance.component.rightIcon\">{{instance.component.rightIcon}}</mat-icon>\r\n</button>\r\n", styles: ["@-webkit-keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}:host .mat-icon-spin{-webkit-animation-name:spin;animation-name:spin;-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-timing-function:linear;animation-timing-function:linear}.mat-formio-theme-success{background-color:#63d644!important}.mat-formio-theme-info{background-color:#49d9f4!important}.mat-formio-button-sm{font-size:14px;padding:8px 12px}.mat-formio-button-xs{font-size:14px;padding:4px 6px}.mat-formio-button-md{font-size:15px;padding:8px 12px}.mat-formio-button-lg{font-size:19px;padding:16px 20px}.mat-formio-button-block{display:block;width:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i6.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }] });
1051
+ MaterialButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1052
+ MaterialButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: MaterialButtonComponent, selector: "mat-formio-button", usesInheritance: true, ngImport: i0, template: "<button *ngIf=\"instance\"\r\n [ngClass]=\"buttonClass\"\r\n type=\"{{ instance.component.action }}\"\r\n mat-raised-button [color]=\"color\"\r\n [disabled]=\"disabled\"\r\n (click)=\"instance.onClick($event)\"\r\n>\r\n <mat-icon *ngIf=\"instance.component.leftIcon\">{{instance.component.leftIcon}}</mat-icon>\r\n <mat-icon *ngIf=\"done\">done</mat-icon>\r\n <mat-icon *ngIf=\"error\">close</mat-icon>\r\n <mat-icon class=\"mat-icon-spin\" *ngIf=\"loading\">autorenew</mat-icon>\r\n {{ instance.component.label }}\r\n <mat-icon *ngIf=\"instance.component.rightIcon\">{{instance.component.rightIcon}}</mat-icon>\r\n</button>\r\n", styles: ["@-webkit-keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}:host .mat-icon-spin{-webkit-animation-name:spin;animation-name:spin;-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-timing-function:linear;animation-timing-function:linear}.mat-formio-theme-success{background-color:#63d644!important}.mat-formio-theme-info{background-color:#49d9f4!important}.mat-formio-button-sm{font-size:14px;padding:8px 12px}.mat-formio-button-xs{font-size:14px;padding:4px 6px}.mat-formio-button-md{font-size:15px;padding:8px 12px}.mat-formio-button-lg{font-size:19px;padding:16px 20px}.mat-formio-button-block{display:block;width:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i6.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }] });
1059
1053
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialButtonComponent, decorators: [{
1060
1054
  type: Component,
1061
- args: [{ selector: 'mat-formio-button', template: "<button *ngIf=\"instance && instance.component.label != 'Click to add Products'\"\r\n [ngClass]=\"buttonClass\"\r\n type=\"{{ instance.component.action }}\"\r\n mat-raised-button [color]=\"color\"\r\n [disabled]=\"disabled\"\r\n (click)=\"instance.onClick($event)\"\r\n>\r\n\r\n\r\n <mat-icon *ngIf=\"instance.component.leftIcon\">{{instance.component.leftIcon}}</mat-icon>\r\n <mat-icon *ngIf=\"done\">done</mat-icon>\r\n <mat-icon *ngIf=\"error\">close</mat-icon>\r\n <mat-icon class=\"mat-icon-spin\" *ngIf=\"loading\">autorenew</mat-icon>\r\n {{ instance.component.label }}\r\n <mat-icon *ngIf=\"instance.component.rightIcon\">{{instance.component.rightIcon}}</mat-icon>\r\n</button>\r\n", styles: ["@-webkit-keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}:host .mat-icon-spin{-webkit-animation-name:spin;animation-name:spin;-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-timing-function:linear;animation-timing-function:linear}.mat-formio-theme-success{background-color:#63d644!important}.mat-formio-theme-info{background-color:#49d9f4!important}.mat-formio-button-sm{font-size:14px;padding:8px 12px}.mat-formio-button-xs{font-size:14px;padding:4px 6px}.mat-formio-button-md{font-size:15px;padding:8px 12px}.mat-formio-button-lg{font-size:19px;padding:16px 20px}.mat-formio-button-block{display:block;width:100%}\n"] }]
1062
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$1.MatDialog }]; } });
1055
+ args: [{ selector: 'mat-formio-button', template: "<button *ngIf=\"instance\"\r\n [ngClass]=\"buttonClass\"\r\n type=\"{{ instance.component.action }}\"\r\n mat-raised-button [color]=\"color\"\r\n [disabled]=\"disabled\"\r\n (click)=\"instance.onClick($event)\"\r\n>\r\n <mat-icon *ngIf=\"instance.component.leftIcon\">{{instance.component.leftIcon}}</mat-icon>\r\n <mat-icon *ngIf=\"done\">done</mat-icon>\r\n <mat-icon *ngIf=\"error\">close</mat-icon>\r\n <mat-icon class=\"mat-icon-spin\" *ngIf=\"loading\">autorenew</mat-icon>\r\n {{ instance.component.label }}\r\n <mat-icon *ngIf=\"instance.component.rightIcon\">{{instance.component.rightIcon}}</mat-icon>\r\n</button>\r\n", styles: ["@-webkit-keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}:host .mat-icon-spin{-webkit-animation-name:spin;animation-name:spin;-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-timing-function:linear;animation-timing-function:linear}.mat-formio-theme-success{background-color:#63d644!important}.mat-formio-theme-info{background-color:#49d9f4!important}.mat-formio-button-sm{font-size:14px;padding:8px 12px}.mat-formio-button-xs{font-size:14px;padding:4px 6px}.mat-formio-button-md{font-size:15px;padding:8px 12px}.mat-formio-button-lg{font-size:19px;padding:16px 20px}.mat-formio-button-block{display:block;width:100%}\n"] }]
1056
+ }] });
1063
1057
  ButtonComponent.MaterialComponent = MaterialButtonComponent;
1064
1058
 
1065
1059
  class MaterialTextareaComponent extends MaterialComponent {
@@ -2600,20 +2594,27 @@ class MaterialSelectComponent extends MaterialComponent {
2600
2594
  });
2601
2595
  }
2602
2596
  registerPanelScrollEvent(selectElem) {
2603
- const panelElement = selectElem.panel.nativeElement;
2604
- panelElement.addEventListener('scroll', this.onScroll.bind(this));
2597
+ if (selectElem && selectElem?.panel) {
2598
+ // const panelElement = selectElem.panel.nativeElement;
2599
+ this.currentPanelElement = selectElem.panel.nativeElement;
2600
+ this.currentPanelElement.addEventListener('scroll', this.onScroll.bind(this));
2601
+ }
2605
2602
  }
2606
2603
  onScroll(event) {
2607
2604
  if (this.instance.component.key.toLowerCase() === 'vendorproductid') {
2608
2605
  const scrollElement = event.target;
2606
+ if (!scrollElement)
2607
+ return; // Ensure scrollElement is not undefined
2609
2608
  const trackHeight = scrollElement.scrollHeight - scrollElement.offsetHeight;
2609
+ if (isNaN(trackHeight) || trackHeight <= 0)
2610
+ return; // Check if trackHeight is valid
2610
2611
  if (this.openCounter < 2) {
2611
2612
  const retrievedObject = JSON.parse(localStorage.getItem('storageObject'));
2612
2613
  this.totalPages = Number(retrievedObject?.totalPages);
2613
2614
  this.productsloadingFlag = true;
2614
2615
  this.productList = retrievedObject?.dataSource;
2615
2616
  }
2616
- if (this.productsloadingFlag && Math.floor(scrollElement.scrollTop / trackHeight * 100) > 50) {
2617
+ if (this.productsloadingFlag && Math.floor(scrollElement?.scrollTop / trackHeight * 100) > 50) {
2617
2618
  this.productsloadingFlag = false;
2618
2619
  this.openCounter = this.openCounter + 1;
2619
2620
  if (this.pageNumber < this.totalPages) {
@@ -2697,10 +2698,15 @@ class MaterialSelectComponent extends MaterialComponent {
2697
2698
  this.searching = false;
2698
2699
  this.productsloadingFlag = true;
2699
2700
  setTimeout(() => {
2700
- const ele = this.selectElem.panel.nativeElement;
2701
- const trackHeight = ele.scrollHeight - ele.offsetHeight;
2702
- const middlePosition = trackHeight / 2 - 50;
2703
- ele.scrollTo({ top: middlePosition, behavior: 'auto' });
2701
+ const ele = this.selectElem?.panel?.nativeElement;
2702
+ if (ele) {
2703
+ const trackHeight = ele.scrollHeight - ele.offsetHeight;
2704
+ const middlePosition = trackHeight / 2 - 50;
2705
+ ele.scrollTo({ top: middlePosition, behavior: 'auto' });
2706
+ }
2707
+ else {
2708
+ console.log('Panel element is not available yet.');
2709
+ }
2704
2710
  }, 250);
2705
2711
  }
2706
2712
  }
@@ -2736,6 +2742,9 @@ class MaterialSelectComponent extends MaterialComponent {
2736
2742
  ngOnDestroy() {
2737
2743
  this._onDestroy.next('');
2738
2744
  this._onDestroy.complete();
2745
+ if (this.currentPanelElement) {
2746
+ this.currentPanelElement.removeEventListener('scroll', this.onScroll.bind(this));
2747
+ }
2739
2748
  }
2740
2749
  /*End*/
2741
2750
  setInstance(instance) {
@@ -2756,7 +2765,7 @@ class MaterialSelectComponent extends MaterialComponent {
2756
2765
  if (this.instance.component.key.toLowerCase() === 'vendorproductid') {
2757
2766
  this.selectElem.openedChange.subscribe((isOpen) => {
2758
2767
  if (isOpen) {
2759
- this.pageNumber = 2;
2768
+ this.pageNumber = 1;
2760
2769
  this.pageSize = 20;
2761
2770
  this.searchQuery = '';
2762
2771
  this.searching = false;
@@ -2767,8 +2776,11 @@ class MaterialSelectComponent extends MaterialComponent {
2767
2776
  this.removePanelScrollEvent();
2768
2777
  this.searching = false;
2769
2778
  let selectedValue = this.getValue();
2770
- if (selectedValue.toString().length == 0 && this.searchQuery == '') {
2779
+ if ((selectedValue.toString().length == 0 && this.searchQuery == '') || this.productList?.length === 0) {
2771
2780
  this.productList = [];
2781
+ this.pageNumber = 1;
2782
+ this.pageSize = 20;
2783
+ this.searchQuery = '';
2772
2784
  this.loadData(this.pageNumber, this.pageSize, this.searchQuery);
2773
2785
  }
2774
2786
  }
@@ -2795,6 +2807,7 @@ class MaterialSelectComponent extends MaterialComponent {
2795
2807
  this.pageSize = 20;
2796
2808
  this.productList = [];
2797
2809
  this.searching = true;
2810
+ this.searchQuery = searchQuery;
2798
2811
  this.loadData(this.pageNumber, this.pageSize, searchQuery);
2799
2812
  }
2800
2813
  });
@@ -2815,11 +2828,37 @@ class MaterialSelectComponent extends MaterialComponent {
2815
2828
  });
2816
2829
  this.filteredOptions = this.selectOptions;
2817
2830
  }
2831
+ isError() {
2832
+ if (this.instance.error) {
2833
+ this.control.setErrors(this.instance.component.validate);
2834
+ return true;
2835
+ }
2836
+ else {
2837
+ return false;
2838
+ }
2839
+ }
2840
+ getErrorMessage() {
2841
+ if (this.instance.error && this.instance.error.messages) {
2842
+ const { messages } = this.instance.error;
2843
+ if (messages.length) {
2844
+ for (const msg of messages) {
2845
+ if (msg.context) {
2846
+ if (this.instance && this.instance.parent && this.instance.parent._data) {
2847
+ if (this.instance.parent._data.submit) {
2848
+ this.control.markAllAsTouched();
2849
+ }
2850
+ }
2851
+ return this.instance.error ? this.instance.error.message : '';
2852
+ }
2853
+ }
2854
+ }
2855
+ }
2856
+ }
2818
2857
  compareObjects(o1, o2) {
2819
2858
  return _.isEqual(o1, o2);
2820
2859
  }
2821
2860
  }
2822
- MaterialSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialSelectComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Component });
2861
+ MaterialSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialSelectComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Component });
2823
2862
  MaterialSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: MaterialSelectComponent, selector: "mat-formio-select", viewQueries: [{ propertyName: "multiSelect", first: true, predicate: ["multiSelect"], descendants: true, static: true }, { propertyName: "selectElem", first: true, predicate: ["productSelect"], descendants: true }], usesInheritance: true, ngImport: i0, template: `
2824
2863
  <mat-formio-form-field [instance]="instance" [componentTemplate]="componentTemplate"></mat-formio-form-field>
2825
2864
  <ng-template #componentTemplate let-hasLabel>
@@ -2857,7 +2896,7 @@ MaterialSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0"
2857
2896
  <span *ngIf="instance.component.suffix" matSuffix>
2858
2897
  {{ instance.component.suffix }}
2859
2898
  </span>
2860
- <mat-error *ngIf="instance.error">{{ instance.error.message }}</mat-error>
2899
+ <mat-error *ngIf="isError()" >{{ getErrorMessage() }}</mat-error>
2861
2900
  </mat-form-field>
2862
2901
  </ng-template>
2863
2902
  `, 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" }] });
@@ -2900,11 +2939,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
2900
2939
  <span *ngIf="instance.component.suffix" matSuffix>
2901
2940
  {{ instance.component.suffix }}
2902
2941
  </span>
2903
- <mat-error *ngIf="instance.error">{{ instance.error.message }}</mat-error>
2942
+ <mat-error *ngIf="isError()" >{{ getErrorMessage() }}</mat-error>
2904
2943
  </mat-form-field>
2905
2944
  </ng-template>
2906
2945
  `, 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"] }]
2907
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$2.HttpClient }]; }, propDecorators: { multiSelect: [{
2946
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$1.HttpClient }]; }, propDecorators: { multiSelect: [{
2908
2947
  type: ViewChild,
2909
2948
  args: ['multiSelect', { static: true }]
2910
2949
  }], selectElem: [{
@@ -2963,468 +3002,30 @@ class ConfirmationDialogComponent {
2963
3002
  ngOnInit() {
2964
3003
  }
2965
3004
  }
2966
- ConfirmationDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ConfirmationDialogComponent, deps: [{ token: i1$1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
2967
- ConfirmationDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: ConfirmationDialogComponent, selector: "NgxMat-confirmation-dialog", ngImport: i0, template: "<div class=\"dialog-container\">\r\n<h2 mat-dialog-title class=\"data-grid-alert\">Alert</h2>\r\n<mat-dialog-content class=\"data-grid-popup-body\">\r\n {{data.message}}\r\n</mat-dialog-content>\r\n<mat-dialog-actions class=\"data-grid-popup-footer\">\r\n <button mat-button [mat-dialog-close]=\"true\" color=\"warn\" *ngIf=\"data.buttonStatus\">Delete</button>\r\n <button mat-button [mat-dialog-close]=\"false\" [ngClass]=\"{'data-grid-closed-btn': !data.buttonStatus}\">{{data.buttonStatus ? 'Cancel': 'Close'}}</button>\r\n</mat-dialog-actions>\r\n</div>", styles: ["::ng-deep .data-grid-closed-btn .mat-button-focus-overlay{background-color:transparent}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i6.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: i1$1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }] });
3005
+ ConfirmationDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ConfirmationDialogComponent, deps: [{ token: i1$2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
3006
+ ConfirmationDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: ConfirmationDialogComponent, selector: "NgxMat-confirmation-dialog", ngImport: i0, template: "<div class=\"dialog-container\">\r\n<h2 mat-dialog-title class=\"data-grid-alert\">Alert</h2>\r\n<mat-dialog-content class=\"data-grid-popup-body\">\r\n {{data.message}}\r\n</mat-dialog-content>\r\n<mat-dialog-actions class=\"data-grid-popup-footer\">\r\n <button mat-button [mat-dialog-close]=\"true\" color=\"warn\" *ngIf=\"data.buttonStatus\">Delete</button>\r\n <button mat-button [mat-dialog-close]=\"false\" [ngClass]=\"{'data-grid-closed-btn': !data.buttonStatus}\">{{data.buttonStatus ? 'Cancel': 'Close'}}</button>\r\n</mat-dialog-actions>\r\n</div>", styles: ["::ng-deep .data-grid-closed-btn .mat-button-focus-overlay{background-color:transparent}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i6.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: i1$2.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }] });
2968
3007
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ConfirmationDialogComponent, decorators: [{
2969
3008
  type: Component,
2970
3009
  args: [{ selector: 'NgxMat-confirmation-dialog', template: "<div class=\"dialog-container\">\r\n<h2 mat-dialog-title class=\"data-grid-alert\">Alert</h2>\r\n<mat-dialog-content class=\"data-grid-popup-body\">\r\n {{data.message}}\r\n</mat-dialog-content>\r\n<mat-dialog-actions class=\"data-grid-popup-footer\">\r\n <button mat-button [mat-dialog-close]=\"true\" color=\"warn\" *ngIf=\"data.buttonStatus\">Delete</button>\r\n <button mat-button [mat-dialog-close]=\"false\" [ngClass]=\"{'data-grid-closed-btn': !data.buttonStatus}\">{{data.buttonStatus ? 'Cancel': 'Close'}}</button>\r\n</mat-dialog-actions>\r\n</div>", styles: ["::ng-deep .data-grid-closed-btn .mat-button-focus-overlay{background-color:transparent}\n"] }]
2971
- }], ctorParameters: function () { return [{ type: i1$1.MatDialogRef }, { type: undefined, decorators: [{
3010
+ }], ctorParameters: function () { return [{ type: i1$2.MatDialogRef }, { type: undefined, decorators: [{
2972
3011
  type: Inject,
2973
3012
  args: [MAT_DIALOG_DATA]
2974
3013
  }] }]; } });
2975
3014
 
2976
- class CommonService {
2977
- constructor(http) {
2978
- this.http = http;
2979
- this.holy = '';
2980
- this.grail = '';
2981
- this.holy = CryptoJS.enc.Base64.parse('8F/2+T2NXqUBQERR12R4sw==');
2982
- this.grail = CryptoJS.enc.Base64.parse('yE0CgQbYzK5wqeoKTVzhOQ==');
2983
- this.paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
2984
- this.currentUser = JSON.parse(localStorage.getItem('currentUser'));
2985
- }
2986
- scrumble(msg) {
2987
- if (!isNullOrUndefined(msg)) {
2988
- var conceal = this.getcampaign(msg, this.holy, this.grail);
2989
- var sha256 = CryptoJS.HmacSHA256(CryptoJS.enc.Base64.stringify(this.grail) + conceal.toString(), CryptoJS.enc.Base64.stringify(this.holy));
2990
- var hashInBase64 = CryptoJS.enc.Base64.stringify(sha256);
2991
- let keyValue = {
2992
- "value": conceal.toString(),
2993
- "mac": hashInBase64
2994
- };
2995
- var result = JSON.stringify(keyValue);
2996
- var jumbled = CryptoJS.enc.Utf8.parse(result);
2997
- return CryptoJS.enc.Base64.stringify(jumbled);
2998
- }
2999
- }
3000
- getcampaign(data, holy, grail) {
3001
- return CryptoJS.AES.encrypt(data.toString(), holy, {
3002
- blockSize: 128,
3003
- iv: grail,
3004
- mode: CryptoJS.mode.CBC,
3005
- padding: CryptoJS.pad.Pkcs7
3006
- });
3007
- }
3008
- getBaseApiUrl() {
3009
- const baseUrlMapping = {
3010
- 'localhost': 'http://localhost:58504',
3011
- 'lincoln.vartopia.com': 'https://lincoln-api.vartopia.com',
3012
- 'stage.vartopia.com': 'https://stage-api.vartopia.com',
3013
- 'my.vartopia.com': 'https://reagan-api.vartopia.com',
3014
- 'jackson.vartopia.com': 'https://jackson-api.vartopia.com'
3015
- };
3016
- // Get the current hostname
3017
- const hostname = window.location.hostname;
3018
- return baseUrlMapping[hostname] || null;
3019
- }
3020
- listProductCategory() {
3021
- const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
3022
- const baseApiUrl = this.getBaseApiUrl();
3023
- return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductsCategory?vendorId=${vendorId}`);
3024
- }
3025
- listSubCategory(category) {
3026
- const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
3027
- const baseApiUrl = this.getBaseApiUrl();
3028
- return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductsSubCategory?vendorId=${vendorId}&categoryName=${category}`);
3029
- }
3030
- // Function to get value by key from the array
3031
- getValueByKey(data, key) {
3032
- if (!data || data.length === 0) {
3033
- return null; // Return null if data is empty or undefined
3034
- }
3035
- const item = data.find(kv => kv.key.toLowerCase() === key.toLowerCase());
3036
- return item ? item.value : null;
3037
- }
3038
- // this.http.get<VendorProductsResponse>(`${baseApiUrl}/api/VendorFormBuilder/GetVendorProducts?vendorId=${envendorId}&pageNumber=${enpageNumber}&pageSize=${enpageSize}&search=${ensearchQuery}&onlyActive=${enactive}&includeDescription=${endescription}`, { headers }).subscribe(response => {
3039
- loadProducts(pageNumber, pazeSize, search = '', onlyActive = true, description = false, category, subCategory) {
3040
- const baseApiUrl = this.getBaseApiUrl();
3041
- const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
3042
- const encodeCat = encodeURIComponent(category);
3043
- const encodeSubCat = encodeURIComponent(subCategory);
3044
- return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetVendorProducts?vendorId=${vendorId}&pageNumber=${pageNumber}&pageSize=${pazeSize}&search=${search}&onlyActive=${onlyActive}&includeDescription=${description}&category=${encodeCat}&subCategory=${encodeSubCat}`);
3045
- }
3046
- }
3047
- CommonService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CommonService, deps: [{ token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
3048
- CommonService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CommonService, providedIn: 'root' });
3049
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CommonService, decorators: [{
3050
- type: Injectable,
3051
- args: [{
3052
- providedIn: 'root'
3053
- }]
3054
- }], ctorParameters: function () { return [{ type: i1$2.HttpClient }]; } });
3055
-
3056
- class AddOnProductsComponent {
3057
- constructor(matDialogRef, data, fb, dialog, commonSevice) {
3058
- this.matDialogRef = matDialogRef;
3059
- this.fb = fb;
3060
- this.dialog = dialog;
3061
- this.commonSevice = commonSevice;
3062
- this.category = [];
3063
- this.subCategory = [];
3064
- this.filteredCategories = [];
3065
- this.filteredSubCategories = [];
3066
- this.addProductsColumns = ['select', 'productName', 'price'];
3067
- this.showAllproductsColumns = ['delete', 'productName', 'categoryName', 'subCategory', 'Quantity', 'price'];
3068
- this.quantityList = [5, 10, 15, 20, 25];
3069
- this.ELEMENT_DATA = [];
3070
- this.dataSource = new MatTableDataSource();
3071
- this.selection = new SelectionModel(true, []);
3072
- this.selectedDataSource = new MatTableDataSource([]);
3073
- this.selectedCategory = null;
3074
- this.selectedSubCategory = null;
3075
- this.showCategory = false;
3076
- this.showSubcategory = false;
3077
- this.showPrice = true;
3078
- this.showQuantity = true;
3079
- this.showNewProductPicker = true;
3080
- this.setCategory = '';
3081
- this.setSubCategory = '';
3082
- this.loadingFlag = false;
3083
- this.pageNumber = 1;
3084
- this.pageSize = 20;
3085
- this.totalPages = 0;
3086
- this.searchQuery = '';
3087
- this.itemList = [];
3088
- this.prevScrollPosition = 0; // Track the previous scroll position
3089
- this.spinnerFlag = false;
3090
- this.showCategory = data.attributesFlag.showCategory;
3091
- this.showSubcategory = data.attributesFlag.showSubcategory;
3092
- this.showPrice = data.attributesFlag.showPrice;
3093
- this.showQuantity = data.attributesFlag.showQuantity;
3094
- this.showNewProductPicker = data.showNewProductPicker;
3095
- this.setCategory = data.category || '';
3096
- this.setSubCategory = data.subCategory || '';
3097
- this.selection = new SelectionModel(true, data.selectedProducts || []);
3098
- this.form = this.fb.group({
3099
- productCategory: [''],
3100
- productSubcategory: [''],
3101
- selectedProducts: this.fb.array([])
3102
- });
3103
- this.initializeFormArray();
3104
- if (!this.showCategory) {
3105
- this.removeColumn('categoryName');
3106
- }
3107
- if (!this.showPrice) {
3108
- this.removeColumn('price');
3109
- }
3110
- if (!this.showSubcategory) {
3111
- this.removeColumn('subCategory');
3112
- }
3113
- if (!this.showQuantity) {
3114
- this.removeColumn('Quantity');
3115
- }
3116
- }
3117
- removeColumn(columnName) {
3118
- this.showAllproductsColumns = this.showAllproductsColumns.filter(column => column !== columnName);
3119
- this.addProductsColumns = this.addProductsColumns.filter(column => column !== columnName);
3120
- }
3121
- initializeFormArray() {
3122
- const selectedProductsArray = this.form.get('selectedProducts');
3123
- this.selection.selected.forEach(product => {
3124
- selectedProductsArray.push(this.fb.group({
3125
- price: [product.price || '', Validators.required],
3126
- text: [product.text || ''],
3127
- quantity: [product.quantity || '', Validators.required],
3128
- category: [product?.category || ''],
3129
- subCategory: [product?.subCategory || ''],
3130
- value: [product?.value || '']
3131
- }));
3132
- });
3133
- this.selectedDataSource.data = [...this.selection.selected];
3134
- }
3135
- initializeDataSources() {
3136
- // Ensure selected items are marked in the main data source
3137
- if (this.selection?.selected?.length) {
3138
- this.selection?.selected?.forEach(selectedProduct => {
3139
- const index = this.dataSource.data.findIndex(product => product.value === selectedProduct.value);
3140
- if (index >= 0) {
3141
- this.dataSource.data[index] = selectedProduct;
3142
- }
3143
- });
3144
- this.selectedDataSource.data = [...this.selection.selected];
3145
- }
3146
- else {
3147
- console.warn('No selected products found.');
3148
- }
3149
- }
3150
- ngAfterViewInit() {
3151
- }
3152
- ngOnInit() {
3153
- this.loadProductCategory();
3154
- this.form.get('productCategory').valueChanges
3155
- .pipe(startWith(''), map(value => this.filterProducts(value, 'category1'))).subscribe(filterCat => {
3156
- this.filteredCategories = filterCat;
3157
- });
3158
- this.form.get('productSubcategory').valueChanges
3159
- .pipe(startWith(''), map(value => this.filterProducts(value, 'subCategory'))).subscribe(subCat => {
3160
- this.filteredSubCategories = subCat;
3161
- });
3162
- }
3163
- loadProductCategory() {
3164
- this.spinnerFlag = true;
3165
- this.commonSevice.listProductCategory().subscribe(response => {
3166
- this.spinnerFlag = false;
3167
- if (response && response.code === 200) {
3168
- this.category = response.data;
3169
- this.filteredCategories = this.filterProducts(this.setCategory, 'category1');
3170
- this.form.get('productCategory').setValue(this.setCategory);
3171
- if (this.setCategory !== '') {
3172
- this.onOptionSelected(this.setCategory, 'category1');
3173
- this.form.get('productSubcategory').setValue(this.setSubCategory);
3174
- }
3175
- }
3176
- });
3177
- }
3178
- filterProducts(value, cat) {
3179
- const filterValue = value.toLowerCase();
3180
- const data = cat === 'category1' ? this.category : this.subCategory;
3181
- if (!filterValue) {
3182
- return data;
3183
- }
3184
- else {
3185
- return data.filter(option => option.toLowerCase().includes(filterValue));
3186
- }
3187
- }
3188
- onSubmit() {
3189
- if (this.form.valid) {
3190
- this.matDialogRef.close({
3191
- data: {
3192
- status: true,
3193
- items: this.form.value
3194
- }
3195
- });
3196
- }
3197
- }
3198
- isAllSelected() {
3199
- const numSelected = this.selection.selected.length;
3200
- const numRows = this.dataSource.data.length;
3201
- return numSelected === numRows;
3202
- }
3203
- isIndeterminate() {
3204
- const numSelected = this.selection.selected.length;
3205
- const numRows = this.dataSource.data.length;
3206
- return numSelected > 0 && numSelected < numRows;
3207
- }
3208
- masterToggle() {
3209
- this.isAllSelected()
3210
- ? this.selection.clear()
3211
- : this.dataSource.data.forEach(row => this.selection.select(row));
3212
- this.updateSelectedProducts();
3213
- }
3214
- toggleSelection(row) {
3215
- this.selection.toggle(row);
3216
- this.updateSelectedProducts();
3217
- }
3218
- // Getter for the FormArray
3219
- get selectedProducts() {
3220
- return this.form.get('selectedProducts');
3221
- }
3222
- updateSelectedProducts() {
3223
- if (Array.isArray(this.selection.selected)) {
3224
- this.selectedDataSource.data = [...this.selection.selected];
3225
- const selectedProductsArray = this.selectedProducts;
3226
- selectedProductsArray.clear();
3227
- this.selection?.selected?.forEach(product => {
3228
- selectedProductsArray?.push(this.fb.group({
3229
- price: [product?.price ?? '', this.showPrice ? Validators.required : []],
3230
- text: [product?.text || ''],
3231
- quantity: [product?.quantity ?? '', this.showQuantity ? Validators.required : []],
3232
- category: [product?.category || ''],
3233
- subCategory: [product?.subCategory || ''],
3234
- value: [product?.value || '']
3235
- }));
3236
- });
3237
- }
3238
- else {
3239
- console.error('Selection.selected is not an array:', this.selection.selected);
3240
- }
3241
- }
3242
- getTotalRows() {
3243
- return this.dataSource.data.length;
3244
- }
3245
- getSelectedRowsCount() {
3246
- return this.selection.selected.length;
3247
- }
3248
- onOptionSelected(event, category) {
3249
- let selectedValue;
3250
- if (event && event.option && event.option.value !== undefined) {
3251
- selectedValue = event.option.value;
3252
- }
3253
- else {
3254
- selectedValue = event;
3255
- }
3256
- if (category === 'category1') {
3257
- this.selectedCategory = selectedValue;
3258
- this.spinnerFlag = true;
3259
- this.commonSevice.listSubCategory(selectedValue).subscribe(response => {
3260
- this.spinnerFlag = false;
3261
- if (response && response.code === 200) {
3262
- this.subCategory = response.data;
3263
- this.filteredSubCategories = this.filterProducts(this.setCategory, 'subCategory');
3264
- if (this.setSubCategory !== '') {
3265
- this.selectedSubCategory = this.setSubCategory;
3266
- this.getProducts();
3267
- }
3268
- }
3269
- });
3270
- }
3271
- else {
3272
- if (category === 'subCategory') {
3273
- this.selectedSubCategory = event.option.value;
3274
- this.getProducts();
3275
- }
3276
- }
3277
- }
3278
- getProducts() {
3279
- this.spinnerFlag = true;
3280
- this.commonSevice.loadProducts(this.pageNumber, this.pageSize, '', true, false, this.selectedCategory, this.selectedSubCategory).subscribe(response => {
3281
- this.spinnerFlag = false;
3282
- if (response && response.code === 200) {
3283
- //this.dataSource.data = response.data.dataSource;
3284
- this.totalPages = response?.data?.totalPages;
3285
- const data = response.data.dataSource;
3286
- if (this.dataSource.data.length > 0) {
3287
- data.forEach(item => this.dataSource.data.push(item));
3288
- this.dataSource.data = [...this.dataSource.data];
3289
- }
3290
- else {
3291
- this.dataSource.data = data;
3292
- }
3293
- this.loadingFlag = true;
3294
- setTimeout(() => {
3295
- const middlePosition = this.trackHeight / 2 - 50;
3296
- if (this.firstscrollableDiv && this.firstscrollableDiv.nativeElement) {
3297
- this.firstscrollableDiv.nativeElement.scrollTo({ top: middlePosition, behavior: 'auto' });
3298
- }
3299
- }, 250);
3300
- this.initializeDataSources();
3301
- }
3302
- });
3303
- }
3304
- removeRow(event, element) {
3305
- event.stopPropagation();
3306
- event.preventDefault();
3307
- let message = 'Are you sure you want to delete this product?';
3308
- let showButton = true;
3309
- const index = this.selectedDataSource.data.indexOf(element);
3310
- if (index >= 0) {
3311
- if (this.selectedDataSource.data.length === 1) {
3312
- message = 'Please select at least one product.';
3313
- showButton = false;
3314
- }
3315
- const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
3316
- disableClose: true,
3317
- width: '90%',
3318
- maxWidth: '400px',
3319
- data: { message: message, buttonStatus: showButton }
3320
- });
3321
- dialogRef.afterClosed().subscribe(result => {
3322
- if (result) {
3323
- this.selectedDataSource.data.splice(index, 1);
3324
- this.selectedDataSource._updateChangeSubscription();
3325
- this.selection.deselect(element);
3326
- const selectedProductsArray = this.form.get('selectedProducts');
3327
- const productIndex = selectedProductsArray.controls.findIndex(control => control.value.productName === element.productName);
3328
- if (productIndex >= 0) {
3329
- selectedProductsArray.removeAt(productIndex);
3330
- }
3331
- }
3332
- });
3333
- }
3334
- }
3335
- onScroll(event) {
3336
- this.trackHeight = event.target.scrollHeight - event.target.offsetHeight;
3337
- if (this.loadingFlag && (Math.floor(event.target.scrollTop / this.trackHeight * 100) > 50)) {
3338
- this.loadingFlag = false;
3339
- if (this.pageNumber < this.totalPages) {
3340
- this.pageNumber = this.pageNumber + 1;
3341
- this.getProducts();
3342
- }
3343
- else {
3344
- this.loadingFlag = true;
3345
- }
3346
- }
3347
- this.prevScrollPosition = event.target.scrollTop;
3348
- }
3349
- }
3350
- AddOnProductsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: AddOnProductsComponent, deps: [{ token: i1$1.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: i2.FormBuilder }, { token: i1$1.MatDialog }, { token: CommonService }], target: i0.ɵɵFactoryTarget.Component });
3351
- AddOnProductsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: AddOnProductsComponent, selector: "ngx-mat-add-on-products", viewQueries: [{ propertyName: "firstscrollableDiv", first: true, predicate: ["firstscrollableDiv"], descendants: true }], ngImport: i0, template: "<div *ngIf=\"spinnerFlag\" class=\"OverlayDiv\">\r\n <div class=\"OverlayDivContent\">\r\n <mat-spinner></mat-spinner>\r\n </div>\r\n</div>\r\n<div class=\"product-selector\">\r\n <mat-stepper labelPosition=\"bottom\" #stepper>\r\n <mat-step [stepControl]=\"form\">\r\n <form [formGroup]=\"form\">\r\n <ng-template matStepLabel>Select Products</ng-template>\r\n <div class=\"dropdown-selection\">\r\n <div class=\"row-one\">\r\n <mat-form-field>\r\n <mat-label>Product Category</mat-label>\r\n <input type=\"text\" matInput formControlName=\"productCategory\" [matAutocomplete]=\"auto3\">\r\n <mat-autocomplete #auto3=\"matAutocomplete\"\r\n (optionSelected)=\"onOptionSelected($event, 'category1')\">\r\n <mat-option *ngFor=\"let option of filteredCategories\"\r\n [value]=\"option\">{{option}}</mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>&nbsp;&nbsp;\r\n\r\n <mat-form-field>\r\n <mat-label>Subcategory</mat-label>\r\n <input type=\"text\" matInput formControlName=\"productSubcategory\" [matAutocomplete]=\"auto4\">\r\n <mat-autocomplete #auto4=\"matAutocomplete\"\r\n (optionSelected)=\"onOptionSelected($event, 'subCategory')\">\r\n <mat-option *ngFor=\"let option of filteredSubCategories\"\r\n [value]=\"option\">{{option}}</mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n <div #firstscrollableDiv id=\"firstscrollableDiv\" class=\"new-class mat-elevation-z8 first-div\" (scroll)=\"onScroll($event)\">\r\n <table mat-table [dataSource]=\"dataSource\" class=\"mat-table abc\"\r\n *ngIf=\"dataSource && dataSource.data.length > 0; else noData\">\r\n <ng-container matColumnDef=\"select\">\r\n <th mat-header-cell *matHeaderCellDef>\r\n <!-- <mat-checkbox (change)=\"$event ? masterToggle() : null\" [checked]=\"isAllSelected()\"\r\n [indeterminate]=\"isIndeterminate()\"></mat-checkbox> -->\r\n </th>\r\n <td mat-cell *matCellDef=\"let row\">\r\n <mat-checkbox color=\"primary\" (click)=\"$event.stopPropagation()\"\r\n (change)=\"$event ? toggleSelection(row) : null\"\r\n [checked]=\"selection.isSelected(row)\"></mat-checkbox>\r\n </td> \r\n </ng-container> \r\n\r\n <ng-container matColumnDef=\"productName\">\r\n <th mat-header-cell *matHeaderCellDef> Product Name </th>\r\n <td mat-cell *matCellDef=\"let element\"> {{element.text}} </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"price\" *ngIf=\"showPrice\">\r\n <th mat-header-cell *matHeaderCellDef> Price </th>\r\n <td mat-cell *matCellDef=\"let element\"> {{element.price}} </td>\r\n </ng-container>\r\n\r\n <tr mat-header-row *matHeaderRowDef=\"addProductsColumns\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: addProductsColumns;\"></tr>\r\n </table>\r\n <ng-template #noData>\r\n <div class=\"no-data-message\">\r\n No data found.\r\n </div>\r\n </ng-template>\r\n </div>\r\n <div class=\"row-summary\">\r\n <p>Rows: {{ getTotalRows() }} Selected: {{ getSelectedRowsCount() }}</p>\r\n </div>\r\n <div>\r\n <button mat-button [mat-dialog-close]=\"false\">Close</button>\r\n <button mat-button matStepperNext [disabled]=\"selection.selected.length ? false : true\">Next</button>\r\n </div>\r\n </form>\r\n </mat-step>\r\n <mat-step [stepControl]=\"form\">\r\n <form [formGroup]=\"form\" (ngSubmit)=\"onSubmit()\">\r\n <ng-template matStepLabel>Edit/Save</ng-template>\r\n <div class=\"new-class mat-elevation-z8\">\r\n <table mat-table [dataSource]=\"selectedDataSource\"\r\n *ngIf=\"selectedDataSource && selectedDataSource.data.length > 0; else showBlank\">\r\n <ng-container matColumnDef=\"delete\">\r\n <th mat-header-cell *matHeaderCellDef></th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n <button mat-button (click)=\"$event.stopPropagation();removeRow($event, element)\">\r\n <mat-icon aria-hidden=\"false\" aria-label=\"Remove row\">delete</mat-icon>\r\n </button>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"productName\">\r\n <th mat-header-cell *matHeaderCellDef> Product Name </th>\r\n <td mat-cell *matCellDef=\"let element\"> {{element.text}} </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"categoryName\" *ngIf=\"showCategory\">\r\n <th mat-header-cell *matHeaderCellDef> Category Name </th>\r\n <td mat-cell *matCellDef=\"let element\"> {{element.category}} </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"subCategory\" *ngIf=\"subCategory\">\r\n <th mat-header-cell *matHeaderCellDef>Sub Category </th>\r\n <td mat-cell *matCellDef=\"let element\"> {{element.subCategory}} </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"price\" *ngIf=\"showPrice\">\r\n <th mat-header-cell *matHeaderCellDef>Price</th>\r\n <td mat-cell *matCellDef=\"let element; let i = index\">\r\n <mat-form-field class=\"example-full-width select-price\">\r\n <mat-label>Price</mat-label>\r\n <input matInput [formControl]=\"selectedProducts.at(i).get('price')\"\r\n placeholder=\"Please enter price\">\r\n <mat-error *ngIf=\"selectedProducts.at(i).get('price').hasError('required')\">\r\n Price is required\r\n </mat-error>\r\n </mat-form-field>\r\n </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"Quantity\" *ngIf=\"showQuantity\">\r\n <th mat-header-cell *matHeaderCellDef> Quantity </th>\r\n <td mat-cell *matCellDef=\"let element; let i = index\">\r\n <mat-form-field class=\"example-full-width select-qunatity\">\r\n <mat-label>Select quantity</mat-label>\r\n <input matInput [formControl]=\"selectedProducts.at(i).get('quantity')\"\r\n placeholder=\"Please enter quantity\">\r\n <mat-error *ngIf=\"selectedProducts.at(i).get('quantity').hasError('required')\">\r\n Quantity is required\r\n </mat-error>\r\n </mat-form-field>\r\n </td>\r\n </ng-container>\r\n\r\n <tr mat-header-row *matHeaderRowDef=\"showAllproductsColumns\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: showAllproductsColumns;\"></tr>\r\n </table>\r\n <ng-template #showBlank>\r\n <div class=\"no-data-message\">\r\n No data found.\r\n </div>\r\n </ng-template>\r\n </div>\r\n <div>\r\n <button mat-button matStepperPrevious>Back</button>\r\n <button mat-button matStepperNext type=\"submit\">Add products</button>\r\n </div>\r\n </form>\r\n </mat-step>\r\n</mat-stepper>\r\n</div>", styles: [".dropdown-section{display:flex;flex-direction:column;gap:16px}.form-row{display:flex;gap:16px}mat-form-field{flex:1}.new-class.mat-elevation-z8{margin-top:20px;max-height:350px;overflow-y:auto;margin-bottom:20px}.mat-column-select{width:50px;text-align:center}.mat-header-cell,.mat-cell{text-align:center}button{align-self:flex-end;margin-top:20px}.row-summary{margin-top:20px;font-weight:700}.new-class td{border:1px solid #ddd;padding:10px}.new-class th{background-color:#f2f2f2;position:-webkit-sticky;position:sticky;top:0;transform:none;z-index:99;padding:10px}table{width:100%;border-collapse:collapse}.select-qunatity,.select-price{width:110px}.no-data-message{text-align:center;margin:20px 0;font-size:18px;color:#888}.mat-step-header.cdk-keyboard-focused,mat-step-header.cdk-program-focused,.mat-step-header:hover:not([aria-disabled]),.mat-step-header:hover[aria-disabled=false]{background-color:transparent}.OverlayDiv{position:fixed;display:block;width:100%;height:100%;top:0;left:0;right:0;bottom:0;background-color:#00000080;z-index:500;cursor:pointer}.OverlayDivContent{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%)}\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.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { 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: i4$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i4$5.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "component", type: i5$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i10.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i10.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i10.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i10.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i10.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i10.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i10.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i10.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i10.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i10.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i11.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "diameter", "strokeWidth", "mode", "value"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i13.MatStep, selector: "mat-step", inputs: ["color"], exportAs: ["matStep"] }, { kind: "directive", type: i13.MatStepLabel, selector: "[matStepLabel]" }, { kind: "component", type: i13.MatStepper, selector: "mat-stepper, mat-vertical-stepper, mat-horizontal-stepper, [matStepper]", inputs: ["selectedIndex", "disableRipple", "color", "labelPosition", "headerPosition", "animationDuration"], outputs: ["animationDone"], exportAs: ["matStepper", "matVerticalStepper", "matHorizontalStepper"] }, { kind: "directive", type: i13.MatStepperNext, selector: "button[matStepperNext]", inputs: ["type"] }, { kind: "directive", type: i13.MatStepperPrevious, selector: "button[matStepperPrevious]", inputs: ["type"] }, { kind: "directive", type: i1$1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "component", type: i14.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i14.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }] });
3352
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: AddOnProductsComponent, decorators: [{
3353
- type: Component,
3354
- args: [{ selector: 'ngx-mat-add-on-products', template: "<div *ngIf=\"spinnerFlag\" class=\"OverlayDiv\">\r\n <div class=\"OverlayDivContent\">\r\n <mat-spinner></mat-spinner>\r\n </div>\r\n</div>\r\n<div class=\"product-selector\">\r\n <mat-stepper labelPosition=\"bottom\" #stepper>\r\n <mat-step [stepControl]=\"form\">\r\n <form [formGroup]=\"form\">\r\n <ng-template matStepLabel>Select Products</ng-template>\r\n <div class=\"dropdown-selection\">\r\n <div class=\"row-one\">\r\n <mat-form-field>\r\n <mat-label>Product Category</mat-label>\r\n <input type=\"text\" matInput formControlName=\"productCategory\" [matAutocomplete]=\"auto3\">\r\n <mat-autocomplete #auto3=\"matAutocomplete\"\r\n (optionSelected)=\"onOptionSelected($event, 'category1')\">\r\n <mat-option *ngFor=\"let option of filteredCategories\"\r\n [value]=\"option\">{{option}}</mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>&nbsp;&nbsp;\r\n\r\n <mat-form-field>\r\n <mat-label>Subcategory</mat-label>\r\n <input type=\"text\" matInput formControlName=\"productSubcategory\" [matAutocomplete]=\"auto4\">\r\n <mat-autocomplete #auto4=\"matAutocomplete\"\r\n (optionSelected)=\"onOptionSelected($event, 'subCategory')\">\r\n <mat-option *ngFor=\"let option of filteredSubCategories\"\r\n [value]=\"option\">{{option}}</mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n <div #firstscrollableDiv id=\"firstscrollableDiv\" class=\"new-class mat-elevation-z8 first-div\" (scroll)=\"onScroll($event)\">\r\n <table mat-table [dataSource]=\"dataSource\" class=\"mat-table abc\"\r\n *ngIf=\"dataSource && dataSource.data.length > 0; else noData\">\r\n <ng-container matColumnDef=\"select\">\r\n <th mat-header-cell *matHeaderCellDef>\r\n <!-- <mat-checkbox (change)=\"$event ? masterToggle() : null\" [checked]=\"isAllSelected()\"\r\n [indeterminate]=\"isIndeterminate()\"></mat-checkbox> -->\r\n </th>\r\n <td mat-cell *matCellDef=\"let row\">\r\n <mat-checkbox color=\"primary\" (click)=\"$event.stopPropagation()\"\r\n (change)=\"$event ? toggleSelection(row) : null\"\r\n [checked]=\"selection.isSelected(row)\"></mat-checkbox>\r\n </td> \r\n </ng-container> \r\n\r\n <ng-container matColumnDef=\"productName\">\r\n <th mat-header-cell *matHeaderCellDef> Product Name </th>\r\n <td mat-cell *matCellDef=\"let element\"> {{element.text}} </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"price\" *ngIf=\"showPrice\">\r\n <th mat-header-cell *matHeaderCellDef> Price </th>\r\n <td mat-cell *matCellDef=\"let element\"> {{element.price}} </td>\r\n </ng-container>\r\n\r\n <tr mat-header-row *matHeaderRowDef=\"addProductsColumns\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: addProductsColumns;\"></tr>\r\n </table>\r\n <ng-template #noData>\r\n <div class=\"no-data-message\">\r\n No data found.\r\n </div>\r\n </ng-template>\r\n </div>\r\n <div class=\"row-summary\">\r\n <p>Rows: {{ getTotalRows() }} Selected: {{ getSelectedRowsCount() }}</p>\r\n </div>\r\n <div>\r\n <button mat-button [mat-dialog-close]=\"false\">Close</button>\r\n <button mat-button matStepperNext [disabled]=\"selection.selected.length ? false : true\">Next</button>\r\n </div>\r\n </form>\r\n </mat-step>\r\n <mat-step [stepControl]=\"form\">\r\n <form [formGroup]=\"form\" (ngSubmit)=\"onSubmit()\">\r\n <ng-template matStepLabel>Edit/Save</ng-template>\r\n <div class=\"new-class mat-elevation-z8\">\r\n <table mat-table [dataSource]=\"selectedDataSource\"\r\n *ngIf=\"selectedDataSource && selectedDataSource.data.length > 0; else showBlank\">\r\n <ng-container matColumnDef=\"delete\">\r\n <th mat-header-cell *matHeaderCellDef></th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n <button mat-button (click)=\"$event.stopPropagation();removeRow($event, element)\">\r\n <mat-icon aria-hidden=\"false\" aria-label=\"Remove row\">delete</mat-icon>\r\n </button>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"productName\">\r\n <th mat-header-cell *matHeaderCellDef> Product Name </th>\r\n <td mat-cell *matCellDef=\"let element\"> {{element.text}} </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"categoryName\" *ngIf=\"showCategory\">\r\n <th mat-header-cell *matHeaderCellDef> Category Name </th>\r\n <td mat-cell *matCellDef=\"let element\"> {{element.category}} </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"subCategory\" *ngIf=\"subCategory\">\r\n <th mat-header-cell *matHeaderCellDef>Sub Category </th>\r\n <td mat-cell *matCellDef=\"let element\"> {{element.subCategory}} </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"price\" *ngIf=\"showPrice\">\r\n <th mat-header-cell *matHeaderCellDef>Price</th>\r\n <td mat-cell *matCellDef=\"let element; let i = index\">\r\n <mat-form-field class=\"example-full-width select-price\">\r\n <mat-label>Price</mat-label>\r\n <input matInput [formControl]=\"selectedProducts.at(i).get('price')\"\r\n placeholder=\"Please enter price\">\r\n <mat-error *ngIf=\"selectedProducts.at(i).get('price').hasError('required')\">\r\n Price is required\r\n </mat-error>\r\n </mat-form-field>\r\n </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"Quantity\" *ngIf=\"showQuantity\">\r\n <th mat-header-cell *matHeaderCellDef> Quantity </th>\r\n <td mat-cell *matCellDef=\"let element; let i = index\">\r\n <mat-form-field class=\"example-full-width select-qunatity\">\r\n <mat-label>Select quantity</mat-label>\r\n <input matInput [formControl]=\"selectedProducts.at(i).get('quantity')\"\r\n placeholder=\"Please enter quantity\">\r\n <mat-error *ngIf=\"selectedProducts.at(i).get('quantity').hasError('required')\">\r\n Quantity is required\r\n </mat-error>\r\n </mat-form-field>\r\n </td>\r\n </ng-container>\r\n\r\n <tr mat-header-row *matHeaderRowDef=\"showAllproductsColumns\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: showAllproductsColumns;\"></tr>\r\n </table>\r\n <ng-template #showBlank>\r\n <div class=\"no-data-message\">\r\n No data found.\r\n </div>\r\n </ng-template>\r\n </div>\r\n <div>\r\n <button mat-button matStepperPrevious>Back</button>\r\n <button mat-button matStepperNext type=\"submit\">Add products</button>\r\n </div>\r\n </form>\r\n </mat-step>\r\n</mat-stepper>\r\n</div>", styles: [".dropdown-section{display:flex;flex-direction:column;gap:16px}.form-row{display:flex;gap:16px}mat-form-field{flex:1}.new-class.mat-elevation-z8{margin-top:20px;max-height:350px;overflow-y:auto;margin-bottom:20px}.mat-column-select{width:50px;text-align:center}.mat-header-cell,.mat-cell{text-align:center}button{align-self:flex-end;margin-top:20px}.row-summary{margin-top:20px;font-weight:700}.new-class td{border:1px solid #ddd;padding:10px}.new-class th{background-color:#f2f2f2;position:-webkit-sticky;position:sticky;top:0;transform:none;z-index:99;padding:10px}table{width:100%;border-collapse:collapse}.select-qunatity,.select-price{width:110px}.no-data-message{text-align:center;margin:20px 0;font-size:18px;color:#888}.mat-step-header.cdk-keyboard-focused,mat-step-header.cdk-program-focused,.mat-step-header:hover:not([aria-disabled]),.mat-step-header:hover[aria-disabled=false]{background-color:transparent}.OverlayDiv{position:fixed;display:block;width:100%;height:100%;top:0;left:0;right:0;bottom:0;background-color:#00000080;z-index:500;cursor:pointer}.OverlayDivContent{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%)}\n"] }]
3355
- }], ctorParameters: function () { return [{ type: i1$1.MatDialogRef }, { type: undefined, decorators: [{
3356
- type: Inject,
3357
- args: [MAT_DIALOG_DATA]
3358
- }] }, { type: i2.FormBuilder }, { type: i1$1.MatDialog }, { type: CommonService }]; }, propDecorators: { firstscrollableDiv: [{
3359
- type: ViewChild,
3360
- args: ['firstscrollableDiv']
3361
- }] } });
3362
-
3363
- const ELEMENT_DATA = [];
3364
3015
  class MaterialDataGridComponent extends MaterialNestedComponent {
3365
- constructor(element, ref, dialog, commonService) {
3016
+ constructor(element, ref, dialog) {
3366
3017
  super(element, ref);
3367
3018
  this.element = element;
3368
3019
  this.ref = ref;
3369
3020
  this.dialog = dialog;
3370
- this.commonService = commonService;
3371
3021
  this.dataSource = new MatTableDataSource();
3372
- this.dataSourceNew = ELEMENT_DATA;
3373
- this.displayedColumnsNew = ['productName', 'category', 'subCategory', 'quantity', 'price'];
3374
- this.showNewProductPicker = false;
3375
- this.showCategory = false;
3376
- this.showSubcategory = false;
3377
- this.showPrice = true;
3378
- this.showQuantity = true;
3379
- this.category = '';
3380
- this.subCategory = '';
3381
- this.hasInitialized = false;
3382
3022
  }
3383
3023
  getColumnLabel(column) {
3384
3024
  return column.label || column.key;
3385
3025
  }
3386
- checkIsAttributeTrue(newProductPickerFlag, attributeName) {
3387
- return newProductPickerFlag && Object.keys(newProductPickerFlag).some(key => key.toLocaleLowerCase() === attributeName.toLowerCase() &&
3388
- newProductPickerFlag[key].toLowerCase() === "true");
3389
- }
3390
- // ngOnInit(): void {
3391
- // }
3392
3026
  setInstance(instance) {
3393
- const newProductPickerFlag = instance?.component?.attributes;
3394
- this.showNewProductPicker = this.checkIsAttributeTrue(newProductPickerFlag, "newproductpicker");
3395
- this.showCategory = this.checkIsAttributeTrue(newProductPickerFlag, "showCategory");
3396
- this.showSubcategory = this.checkIsAttributeTrue(newProductPickerFlag, "showSubcategory");
3397
- this.showPrice = this.checkIsAttributeTrue(newProductPickerFlag, "showPrice");
3398
- this.showQuantity = this.checkIsAttributeTrue(newProductPickerFlag, "showQuantity");
3399
3027
  super.setInstance(instance);
3400
- if (this.showNewProductPicker && !this.hasInitialized) {
3401
- if (!this.showCategory) {
3402
- this.removeColumn('category');
3403
- }
3404
- if (!this.showQuantity) {
3405
- this.removeColumn('quantity');
3406
- }
3407
- if (!this.showPrice) {
3408
- this.removeColumn('price');
3409
- }
3410
- if (!this.showSubcategory) {
3411
- this.removeColumn('subCategory');
3412
- }
3413
- const checkProducts = JSON.parse(localStorage.getItem('dealData')) || [];
3414
- const dealId = checkProducts?.dealId;
3415
- const storedData = localStorage.getItem(`selectedProducts-${dealId}`);
3416
- if (storedData?.length) {
3417
- this.dataSourceNew = JSON.parse(storedData);
3418
- }
3419
- else {
3420
- this.dataSourceNew = [];
3421
- }
3422
- // Set flag to true to prevent further execution
3423
- this.hasInitialized = true;
3424
- }
3425
- else {
3426
- this.dataSource.data = instance.dataValue;
3427
- }
3028
+ this.dataSource.data = instance.dataValue;
3428
3029
  this.columns = {};
3429
3030
  this.displayedColumns = [];
3430
3031
  this.formColumns = [];
@@ -3452,10 +3053,7 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
3452
3053
  return viewContainer ? viewContainer : null;
3453
3054
  };
3454
3055
  }
3455
- removeColumn(columnName) {
3456
- this.displayedColumnsNew = this.displayedColumnsNew.filter(column => column !== columnName);
3457
- }
3458
- addAnotherOld() {
3056
+ addAnother() {
3459
3057
  this.checkRowsNumber();
3460
3058
  this.instance.addRow();
3461
3059
  if (this.dataSource.data.length < this.instance.rows.length) {
@@ -3463,58 +3061,6 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
3463
3061
  }
3464
3062
  this.dataSource.data = [...this.dataSource.data];
3465
3063
  }
3466
- addAnother() {
3467
- if (this.showNewProductPicker) {
3468
- const savedData = JSON.parse(localStorage.getItem('saveCat'));
3469
- const checkProducts = JSON.parse(localStorage.getItem('dealData')) || [];
3470
- // Use optional chaining and nullish coalescing to set the values
3471
- this.category = savedData?.category ?? this.category;
3472
- this.subCategory = savedData?.subCategory ?? this.subCategory;
3473
- const diologeRef = this.dialog.open(AddOnProductsComponent, {
3474
- disableClose: true,
3475
- width: '90%',
3476
- maxWidth: '900px',
3477
- autoFocus: false,
3478
- data: { attributesFlag: { showNewProductPicker: this.showNewProductPicker, showCategory: this.showCategory, showSubcategory: this.showSubcategory, showPrice: this.showPrice, showQuantity: this.showQuantity }, selectedProducts: this.dataSourceNew, category: this.category, subCategory: this.subCategory }
3479
- })
3480
- .afterClosed().subscribe(response => {
3481
- if (response?.data?.status) {
3482
- if (!this.showCategory) {
3483
- this.removeColumn('category');
3484
- }
3485
- if (!this.showQuantity) {
3486
- this.removeColumn('quantity');
3487
- }
3488
- if (!this.showPrice) {
3489
- this.removeColumn('price');
3490
- }
3491
- if (!this.showSubcategory) {
3492
- this.removeColumn('subCategory');
3493
- }
3494
- //localStorage.setItem('selectedProducts', JSON.stringify(response.data.items.selectedProducts))
3495
- const dealId = checkProducts?.dealId;
3496
- localStorage.setItem(`selectedProducts-${dealId}`, JSON.stringify(response.data.items.selectedProducts));
3497
- this.dataSourceNew = response.data.items.selectedProducts;
3498
- this.category = response.data.items.productCategory;
3499
- this.subCategory = response.data.items.productSubcategory;
3500
- const catObject = {
3501
- category: this.category,
3502
- subCategory: this.subCategory
3503
- };
3504
- localStorage.setItem('saveCat', JSON.stringify(catObject));
3505
- this.instance.component.defaultValue = response.data.items.selectedProducts;
3506
- }
3507
- });
3508
- }
3509
- else {
3510
- this.checkRowsNumber();
3511
- this.instance.addRow();
3512
- if (this.dataSource.data.length < this.instance.rows.length) {
3513
- this.dataSource.data.push({});
3514
- }
3515
- this.dataSource.data = [...this.dataSource.data];
3516
- }
3517
- }
3518
3064
  checkRowsNumber() {
3519
3065
  while (this.instance.rows.length < this.dataSource.data.length) {
3520
3066
  this.instance.addRow();
@@ -3564,7 +3110,7 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
3564
3110
  super.setValue(value);
3565
3111
  }
3566
3112
  }
3567
- MaterialDataGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialDataGridComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$1.MatDialog }, { token: CommonService }], target: i0.ɵɵFactoryTarget.Component });
3113
+ MaterialDataGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialDataGridComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$2.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
3568
3114
  MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: MaterialDataGridComponent, selector: "mat-formio-datagrid", usesInheritance: true, ngImport: i0, template: `
3569
3115
  <mat-formio-form-field [instance]="instance"
3570
3116
  [componentTemplate]="componentTemplate"
@@ -3583,8 +3129,6 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
3583
3129
  {{instance.component.addAnother || 'Add Another'}}
3584
3130
  </button>
3585
3131
  </mat-card-actions>
3586
- <ng-container *ngIf="!showNewProductPicker">
3587
- <div class="mat-elevation-z8">
3588
3132
  <table
3589
3133
  mat-table
3590
3134
  [dataSource]="dataSource"
@@ -3593,8 +3137,7 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
3593
3137
  cdkDropList
3594
3138
  [cdkDropListData]="dataSource"
3595
3139
  (cdkDropListDropped)="dropTable($event)">
3596
-
3597
-
3140
+ >
3598
3141
  <ng-container *ngFor="let column of formColumns" [matColumnDef]="column">
3599
3142
  <th mat-header-cell *matHeaderCellDef>{{ getColumnLabel(columns[column]) }}</th>
3600
3143
  <td mat-cell *matCellDef="let i = index;" [attr.rowIndex]="i" [attr.component]="column">
@@ -3624,51 +3167,6 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
3624
3167
  <tr class="datagrid-row" mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
3625
3168
  </div>
3626
3169
  </table>
3627
- </div>
3628
- </ng-container>
3629
-
3630
- <table mat-table [dataSource]="dataSourceNew" class="mat-table" *ngIf="dataSourceNew.length > 0 && showNewProductPicker; else noData" >
3631
- <!-- Product Name Column -->
3632
- <ng-container matColumnDef="productName">
3633
- <th mat-header-cell *matHeaderCellDef> Product Name </th>
3634
- <td mat-cell *matCellDef="let element"> {{element.text}} </td>
3635
- </ng-container>
3636
-
3637
- <!-- Quantity Column -->
3638
- <ng-container matColumnDef="quantity" *ngIf="showQuantity">
3639
- <th mat-header-cell *matHeaderCellDef> Quantity </th>
3640
- <td mat-cell *matCellDef="let element"> {{element.quantity}} </td>
3641
- </ng-container>
3642
-
3643
- <!-- Price Column -->
3644
- <ng-container matColumnDef="price" *ngIf="showPrice">
3645
- <th mat-header-cell *matHeaderCellDef> Price </th>
3646
- <td mat-cell *matCellDef="let element"> {{element.price}} </td>
3647
- </ng-container>
3648
-
3649
- <!-- Category Column -->
3650
- <ng-container matColumnDef="category" *ngIf="showCategory">
3651
- <th mat-header-cell *matHeaderCellDef> Category </th>
3652
- <td mat-cell *matCellDef="let element"> {{element.category}} </td>
3653
- </ng-container>
3654
-
3655
- <!-- Category Column -->
3656
- <ng-container matColumnDef="subCategory" *ngIf="showSubcategory">
3657
- <th mat-header-cell *matHeaderCellDef> Sub Category </th>
3658
- <td mat-cell *matCellDef="let element"> {{element.subCategory}} </td>
3659
- </ng-container>
3660
-
3661
- <tr mat-header-row *matHeaderRowDef="displayedColumnsNew"></tr>
3662
- <tr mat-row *matRowDef="let row; columns: displayedColumnsNew;"></tr>
3663
- </table>
3664
- <ng-template #noData>
3665
- <div class="no-data-message" *ngIf="showNewProductPicker">
3666
- No product found please add some products.
3667
- </div>
3668
- </ng-template>
3669
-
3670
-
3671
-
3672
3170
  </mat-card-content>
3673
3171
  <mat-card-actions *ngIf="instance.hasAddButton() && instance.component.addAnotherPosition !== 'top'">
3674
3172
  <button mat-raised-button color="primary" (click)="addAnother()">
@@ -3684,7 +3182,7 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
3684
3182
  <span [instance]="instance" matFormioLabel></span>
3685
3183
  </mat-card-title>
3686
3184
  </ng-template>
3687
- `, isInline: true, styles: [".datagrid-row{height:auto}.mat-table{width:100%}.mat-header-cell,.mat-cell{padding:8px}.no-data-message{text-align:center;margin:20px 0;font-size:18px;color:#888}\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: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i10.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i10.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i10.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i10.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i10.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i10.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i10.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i10.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i10.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i10.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { 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: i4.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { kind: "directive", type: i4.MatCardContent, selector: "mat-card-content, [mat-card-content], [matCardContent]" }, { kind: "directive", type: i4.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "directive", type: i4.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "directive", type: i9$1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i9$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i9$1.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { 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"] }] });
3185
+ `, isInline: true, styles: [".datagrid-row{height:auto}\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: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i4$7.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i4$7.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i4$7.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i4$7.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i4$7.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i4$7.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i4$7.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i4$7.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i4$7.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i4$7.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { 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: i4.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { kind: "directive", type: i4.MatCardContent, selector: "mat-card-content, [mat-card-content], [matCardContent]" }, { kind: "directive", type: i4.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "directive", type: i4.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "directive", type: i8.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i8.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i8.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { 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"] }] });
3688
3186
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialDataGridComponent, decorators: [{
3689
3187
  type: Component,
3690
3188
  args: [{ selector: 'mat-formio-datagrid', template: `
@@ -3705,8 +3203,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
3705
3203
  {{instance.component.addAnother || 'Add Another'}}
3706
3204
  </button>
3707
3205
  </mat-card-actions>
3708
- <ng-container *ngIf="!showNewProductPicker">
3709
- <div class="mat-elevation-z8">
3710
3206
  <table
3711
3207
  mat-table
3712
3208
  [dataSource]="dataSource"
@@ -3715,8 +3211,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
3715
3211
  cdkDropList
3716
3212
  [cdkDropListData]="dataSource"
3717
3213
  (cdkDropListDropped)="dropTable($event)">
3718
-
3719
-
3214
+ >
3720
3215
  <ng-container *ngFor="let column of formColumns" [matColumnDef]="column">
3721
3216
  <th mat-header-cell *matHeaderCellDef>{{ getColumnLabel(columns[column]) }}</th>
3722
3217
  <td mat-cell *matCellDef="let i = index;" [attr.rowIndex]="i" [attr.component]="column">
@@ -3746,51 +3241,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
3746
3241
  <tr class="datagrid-row" mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
3747
3242
  </div>
3748
3243
  </table>
3749
- </div>
3750
- </ng-container>
3751
-
3752
- <table mat-table [dataSource]="dataSourceNew" class="mat-table" *ngIf="dataSourceNew.length > 0 && showNewProductPicker; else noData" >
3753
- <!-- Product Name Column -->
3754
- <ng-container matColumnDef="productName">
3755
- <th mat-header-cell *matHeaderCellDef> Product Name </th>
3756
- <td mat-cell *matCellDef="let element"> {{element.text}} </td>
3757
- </ng-container>
3758
-
3759
- <!-- Quantity Column -->
3760
- <ng-container matColumnDef="quantity" *ngIf="showQuantity">
3761
- <th mat-header-cell *matHeaderCellDef> Quantity </th>
3762
- <td mat-cell *matCellDef="let element"> {{element.quantity}} </td>
3763
- </ng-container>
3764
-
3765
- <!-- Price Column -->
3766
- <ng-container matColumnDef="price" *ngIf="showPrice">
3767
- <th mat-header-cell *matHeaderCellDef> Price </th>
3768
- <td mat-cell *matCellDef="let element"> {{element.price}} </td>
3769
- </ng-container>
3770
-
3771
- <!-- Category Column -->
3772
- <ng-container matColumnDef="category" *ngIf="showCategory">
3773
- <th mat-header-cell *matHeaderCellDef> Category </th>
3774
- <td mat-cell *matCellDef="let element"> {{element.category}} </td>
3775
- </ng-container>
3776
-
3777
- <!-- Category Column -->
3778
- <ng-container matColumnDef="subCategory" *ngIf="showSubcategory">
3779
- <th mat-header-cell *matHeaderCellDef> Sub Category </th>
3780
- <td mat-cell *matCellDef="let element"> {{element.subCategory}} </td>
3781
- </ng-container>
3782
-
3783
- <tr mat-header-row *matHeaderRowDef="displayedColumnsNew"></tr>
3784
- <tr mat-row *matRowDef="let row; columns: displayedColumnsNew;"></tr>
3785
- </table>
3786
- <ng-template #noData>
3787
- <div class="no-data-message" *ngIf="showNewProductPicker">
3788
- No product found please add some products.
3789
- </div>
3790
- </ng-template>
3791
-
3792
-
3793
-
3794
3244
  </mat-card-content>
3795
3245
  <mat-card-actions *ngIf="instance.hasAddButton() && instance.component.addAnotherPosition !== 'top'">
3796
3246
  <button mat-raised-button color="primary" (click)="addAnother()">
@@ -3806,8 +3256,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
3806
3256
  <span [instance]="instance" matFormioLabel></span>
3807
3257
  </mat-card-title>
3808
3258
  </ng-template>
3809
- `, styles: [".datagrid-row{height:auto}.mat-table{width:100%}.mat-header-cell,.mat-cell{padding:8px}.no-data-message{text-align:center;margin:20px 0;font-size:18px;color:#888}\n"] }]
3810
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$1.MatDialog }, { type: CommonService }]; } });
3259
+ `, styles: [".datagrid-row{height:auto}\n"] }]
3260
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$2.MatDialog }]; } });
3811
3261
  DataGridComponent.MaterialComponent = MaterialDataGridComponent;
3812
3262
 
3813
3263
  var EditRowState;
@@ -4193,7 +3643,7 @@ MaterialWizardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0"
4193
3643
  <button *ngIf="instance.hasButton('submit')" mat-raised-button color="primary" (click)="submit()">Submit</button>
4194
3644
  </div>
4195
3645
  </mat-step>
4196
- </mat-horizontal-stepper>`, isInline: true, styles: [":host .navigation-button-row{margin-top:8px}\n", ":host .navigation-button-row button{margin-right:8px}\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: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i13.MatStep, selector: "mat-step", inputs: ["color"], exportAs: ["matStep"] }, { kind: "component", type: i13.MatStepper, selector: "mat-stepper, mat-vertical-stepper, mat-horizontal-stepper, [matStepper]", inputs: ["selectedIndex", "disableRipple", "color", "labelPosition", "headerPosition", "animationDuration"], outputs: ["animationDone"], exportAs: ["matStepper", "matVerticalStepper", "matHorizontalStepper"] }] });
3646
+ </mat-horizontal-stepper>`, isInline: true, styles: [":host .navigation-button-row{margin-top:8px}\n", ":host .navigation-button-row button{margin-right:8px}\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: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i3$3.MatStep, selector: "mat-step", inputs: ["color"], exportAs: ["matStep"] }, { kind: "component", type: i3$3.MatStepper, selector: "mat-stepper, mat-vertical-stepper, mat-horizontal-stepper, [matStepper]", inputs: ["selectedIndex", "disableRipple", "color", "labelPosition", "headerPosition", "animationDuration"], outputs: ["animationDone"], exportAs: ["matStepper", "matVerticalStepper", "matHorizontalStepper"] }] });
4197
3647
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialWizardComponent, decorators: [{
4198
3648
  type: Component,
4199
3649
  args: [{ selector: 'mat-formio-wizard', template: `
@@ -4363,7 +3813,7 @@ FormioComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", versio
4363
3813
  <div fxLayout="column" fxLayoutGap="1em">
4364
3814
  <ng-template #formio></ng-template>
4365
3815
  </div>
4366
- `, isInline: true, styles: [".alert-danger{color:#721c24;background-color:#f8d7da;border-color:#f5c6cb}.alert-success{color:#155724;background-color:#d4edda;border-color:#c3e6cb}.alert{position:relative;padding:.75rem 1.25rem;margin-bottom:.5rem;border:1px solid transparent;border-radius:.25rem}::ng-deep mat-card{box-sizing:border-box;-moz-box-sizing:border-box}\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: "component", type: i11.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "diameter", "strokeWidth", "mode", "value"], exportAs: ["matProgressSpinner"] }, { kind: "directive", type: i5.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i5.DefaultLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }] });
3816
+ `, isInline: true, styles: [".alert-danger{color:#721c24;background-color:#f8d7da;border-color:#f5c6cb}.alert-success{color:#155724;background-color:#d4edda;border-color:#c3e6cb}.alert{position:relative;padding:.75rem 1.25rem;margin-bottom:.5rem;border:1px solid transparent;border-radius:.25rem}::ng-deep mat-card{box-sizing:border-box;-moz-box-sizing:border-box}\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: "component", type: i3$4.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "diameter", "strokeWidth", "mode", "value"], exportAs: ["matProgressSpinner"] }, { kind: "directive", type: i5.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i5.DefaultLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }] });
4367
3817
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: FormioComponent, decorators: [{
4368
3818
  type: Component,
4369
3819
  args: [{ selector: 'mat-formio', template: `
@@ -4433,8 +3883,7 @@ NgxRenderMaterialFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.
4433
3883
  FormioFormFieldComponent,
4434
3884
  LabelComponent,
4435
3885
  MaskDirective,
4436
- ConfirmationDialogComponent,
4437
- AddOnProductsComponent], imports: [CommonModule,
3886
+ ConfirmationDialogComponent], imports: [CommonModule,
4438
3887
  FormsModule,
4439
3888
  ReactiveFormsModule,
4440
3889
  MatInputModule,
@@ -4462,9 +3911,7 @@ NgxRenderMaterialFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.
4462
3911
  ScrollingModule,
4463
3912
  NgxMatSelectSearchModule,
4464
3913
  MatDialogModule,
4465
- HttpClientModule,
4466
- MatAutocompleteModule], exports: [MatAutocompleteModule,
4467
- NgxRenderMaterialFormsComponent,
3914
+ HttpClientModule], exports: [NgxRenderMaterialFormsComponent,
4468
3915
  FormioComponent,
4469
3916
  MatInputModule,
4470
3917
  MatFormFieldModule,
@@ -4518,9 +3965,7 @@ NgxRenderMaterialFormsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.
4518
3965
  ScrollingModule,
4519
3966
  NgxMatSelectSearchModule,
4520
3967
  MatDialogModule,
4521
- HttpClientModule,
4522
- MatAutocompleteModule, MatAutocompleteModule,
4523
- MatInputModule,
3968
+ HttpClientModule, MatInputModule,
4524
3969
  MatFormFieldModule,
4525
3970
  MatCheckboxModule,
4526
3971
  MatRadioModule,
@@ -4588,8 +4033,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
4588
4033
  FormioFormFieldComponent,
4589
4034
  LabelComponent,
4590
4035
  MaskDirective,
4591
- ConfirmationDialogComponent,
4592
- AddOnProductsComponent
4036
+ ConfirmationDialogComponent
4593
4037
  ],
4594
4038
  imports: [
4595
4039
  CommonModule,
@@ -4620,11 +4064,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
4620
4064
  ScrollingModule,
4621
4065
  NgxMatSelectSearchModule,
4622
4066
  MatDialogModule,
4623
- HttpClientModule,
4624
- MatAutocompleteModule
4067
+ HttpClientModule
4625
4068
  ],
4626
4069
  exports: [
4627
- MatAutocompleteModule,
4628
4070
  NgxRenderMaterialFormsComponent,
4629
4071
  FormioComponent,
4630
4072
  MatInputModule,