@rangertechnologies/ngnxt 2.1.67 → 2.1.69

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.
@@ -1821,94 +1821,110 @@ class CustomDropdownComponent {
1821
1821
  valueField;
1822
1822
  subscription;
1823
1823
  apiObj;
1824
+ uniqueKey;
1824
1825
  ngOnInit() {
1826
+ }
1827
+ getOptions() {
1828
+ console.log('test click');
1825
1829
  // console.log('inside oninit of custom-dropdown of ' + this.id);
1826
1830
  // console.log(this.apiMeta);
1827
1831
  //VD 07Aug24 - isDependentField change
1832
+ // VD 25Oct24 - changes
1828
1833
  this.placeholder = this.placeholder ? this.placeholder : '---Select option---';
1829
- if (this.apiMeta !== undefined) {
1830
- this.apiObj = JSON.parse(this.apiMeta);
1831
- if (!this.apiObj.isDependentField) {
1832
- this.options = [];
1833
- this.labelField = this.apiObj.field;
1834
- // VD 09Sep24- setup the query param for api call
1835
- let fullEndPoint;
1836
- if (this.apiObj.endpoint) {
1837
- if (this.apiObj.queryValueReference && this.apiObj.queryField) {
1838
- // process the end point with query param
1839
- let queryReferences = this.apiObj.queryValueReference.split(',');
1840
- let queryParams = [];
1841
- // Iterate over queryReferences and find the corresponding element in referenceData
1842
- queryReferences.forEach(reference => {
1843
- // Find the element in referenceData that matches the current reference
1844
- let matchingElement = this.question?.referenceQueryData.find(element => element.Reference_Field__c === reference);
1845
- // If a matching element is found, get its input value and create a query parameter
1846
- if (matchingElement) {
1847
- queryParams.push(`${reference}=${matchingElement.input}`);
1848
- }
1849
- });
1850
- fullEndPoint = this.apiObj.endpoint + '?' + queryParams.join('&');
1851
- console.log(fullEndPoint);
1852
- }
1853
- else {
1854
- // if no query param get the actual endPoint
1855
- fullEndPoint = this.apiObj.endpoint;
1856
- }
1857
- // VD 19JAN24 - added one more param for authentication
1858
- this.dataService.apiResponse(fullEndPoint)?.subscribe((apiResponse) => {
1859
- // HA 18-JAN-24 Assigned apiresponse directly if we have the response in array also
1860
- // VD 19JAN24 - if response has key with value(which is array)
1861
- let responses;
1862
- if (this.apiObj.variable) {
1863
- // VD 21May24 - handling multiple child objects
1864
- // VD 22May24 - used common service file
1865
- responses = this.dataService.getValue(apiResponse, this.apiObj.variable);
1866
- let results = [];
1867
- // HA 19JAN24 To avoid undefined error in console
1868
- for (let i = 0; i < responses?.length; i++) {
1869
- var resp = responses[i];
1870
- results.push(resp);
1871
- }
1872
- this.options = results;
1834
+ const cachedOptions = localStorage.getItem(this.uniqueKey);
1835
+ if (cachedOptions) {
1836
+ this.options = JSON.parse(cachedOptions);
1837
+ }
1838
+ else {
1839
+ if (this.apiMeta !== undefined) {
1840
+ this.apiObj = JSON.parse(this.apiMeta);
1841
+ if (!this.apiObj.isDependentField) {
1842
+ this.options = [];
1843
+ this.labelField = this.apiObj.field;
1844
+ // VD 09Sep24- setup the query param for api call
1845
+ let fullEndPoint;
1846
+ if (this.apiObj.endpoint) {
1847
+ if (this.apiObj.queryValueReference && this.apiObj.queryField) {
1848
+ // process the end point with query param
1849
+ let queryReferences = this.apiObj.queryValueReference.split(',');
1850
+ let queryParams = [];
1851
+ // Iterate over queryReferences and find the corresponding element in referenceData
1852
+ queryReferences.forEach(reference => {
1853
+ // Find the element in referenceData that matches the current reference
1854
+ let matchingElement = this.question?.referenceQueryData.find(element => element.Reference_Field__c === reference);
1855
+ // If a matching element is found, get its input value and create a query parameter
1856
+ if (matchingElement) {
1857
+ queryParams.push(`${reference}=${matchingElement.input}`);
1858
+ }
1859
+ });
1860
+ fullEndPoint = this.apiObj.endpoint + '?' + queryParams.join('&');
1861
+ console.log(fullEndPoint);
1873
1862
  }
1874
- else { // VD 19JAN24 - if response has value(which is array) only
1875
- responses = apiResponse;
1876
- this.options = responses;
1863
+ else {
1864
+ // if no query param get the actual endPoint
1865
+ fullEndPoint = this.apiObj.endpoint;
1877
1866
  }
1878
- // Reference https://www.npmjs.com/package/@ng-select/ng-select
1879
- });
1880
- }
1881
- }
1882
- // VD NOV23 - handle the dependent update for dropdown
1883
- // // VD 09Sep24- push the dependent field values for dropdown
1884
- let sourceId = this.apiObj.sourceQuestionId;
1885
- if (sourceId && this.apiObj.variable || this.apiObj.valueField) {
1886
- // Subscribe for the changes
1887
- this.subscription = this.changeService.changeAnnounced$.subscribe((changeValue) => {
1888
- if (changeValue != undefined) {
1889
- // console.log('inside subscription for the change');
1890
- if (changeValue.valueObj != undefined && changeValue.fromQuestionId == this.apiObj.sourceQuestionId) {
1891
- // this.selectedValue = changeValue.valueObj[this.apiObj.valueField];
1892
- // let value ={};
1893
- // value['name'] = this.selectedValue;
1867
+ // VD 19JAN24 - added one more param for authentication
1868
+ this.dataService.apiResponse(fullEndPoint)?.subscribe((apiResponse) => {
1869
+ // HA 18-JAN-24 Assigned apiresponse directly if we have the response in array also
1870
+ // VD 19JAN24 - if response has key with value(which is array)
1871
+ this.uniqueKey = apiResponse[this.apiObj.uniqueKey];
1894
1872
  let responses;
1895
1873
  if (this.apiObj.variable) {
1896
- responses = this.dataService.getValue(changeValue.valueObj, this.apiObj.variable);
1874
+ // VD 21May24 - handling multiple child objects
1875
+ // VD 22May24 - used common service file
1876
+ responses = this.dataService.getValue(apiResponse, this.apiObj.variable);
1897
1877
  let results = [];
1878
+ // HA 19JAN24 To avoid undefined error in console
1898
1879
  for (let i = 0; i < responses?.length; i++) {
1899
1880
  var resp = responses[i];
1900
1881
  results.push(resp);
1901
1882
  }
1902
1883
  this.options = results;
1903
1884
  }
1904
- else {
1905
- responses = changeValue.valueObj;
1885
+ else { // VD 19JAN24 - if response has value(which is array) only
1886
+ responses = apiResponse;
1906
1887
  this.options = responses;
1907
1888
  }
1908
- }
1909
- this.changeService.confirmChange(this.apiObj.sourceQuestionId);
1889
+ // VD 25Oct24 - Store fetched options in local storage
1890
+ if (this.uniqueKey) {
1891
+ localStorage.setItem(this.uniqueKey, JSON.stringify(this.options));
1892
+ }
1893
+ // Reference https://www.npmjs.com/package/@ng-select/ng-select
1894
+ });
1910
1895
  }
1911
- });
1896
+ }
1897
+ // VD NOV23 - handle the dependent update for dropdown
1898
+ // // VD 09Sep24- push the dependent field values for dropdown
1899
+ let sourceId = this.apiObj.sourceQuestionId;
1900
+ if (sourceId && this.apiObj.variable || this.apiObj.valueField) {
1901
+ // Subscribe for the changes
1902
+ this.subscription = this.changeService.changeAnnounced$.subscribe((changeValue) => {
1903
+ if (changeValue != undefined) {
1904
+ // console.log('inside subscription for the change');
1905
+ if (changeValue.valueObj != undefined && changeValue.fromQuestionId == this.apiObj.sourceQuestionId) {
1906
+ // this.selectedValue = changeValue.valueObj[this.apiObj.valueField];
1907
+ // let value ={};
1908
+ // value['name'] = this.selectedValue;
1909
+ let responses;
1910
+ if (this.apiObj.variable) {
1911
+ responses = this.dataService.getValue(changeValue.valueObj, this.apiObj.variable);
1912
+ let results = [];
1913
+ for (let i = 0; i < responses?.length; i++) {
1914
+ var resp = responses[i];
1915
+ results.push(resp);
1916
+ }
1917
+ this.options = results;
1918
+ }
1919
+ else {
1920
+ responses = changeValue.valueObj;
1921
+ this.options = responses;
1922
+ }
1923
+ }
1924
+ this.changeService.confirmChange(this.apiObj.sourceQuestionId);
1925
+ }
1926
+ });
1927
+ }
1912
1928
  }
1913
1929
  }
1914
1930
  }
@@ -1928,11 +1944,11 @@ class CustomDropdownComponent {
1928
1944
  }
1929
1945
  }
1930
1946
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: CustomDropdownComponent, deps: [{ token: ChangeService }, { token: DataService }, { token: I18nService }], target: i0.ɵɵFactoryTarget.Component });
1931
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: CustomDropdownComponent, selector: "app-custom-dropdown", inputs: { options: "options", placeholder: "placeholder", apiMeta: "apiMeta", selectedValue: "selectedValue", progressBar: "progressBar", id: "id", readOnly: "readOnly", errorMessage: "errorMessage", error: "error", fromShengel: "fromShengel", question: "question", referenceField: "referenceField", token: "token" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: "<!-- HA 18-JAN-24 Commenting these lines as we don't have to use shengel here -->\n<!-- <select\n [ngClass]=\"{\n 'dt-line dpDown down myt-dropbox myt-border-r myt-font1': progressBar,\n 'custom-select': !progressBar\n }\" class=\"custom-select mr-sm-2 dd-height\" \n [id]=\"id\" \n [(ngModel)]=\"selectedValue\"\n (change)=\"selectChange($event.target.value);\" \n [style.borderColor]=\"error ? 'red' : '#858585'\"\n [style.color]=\"error ? 'red' : ''\">\n <option *ngFor=\"let option of options\" [value]=\"this.apiMeta !== undefined ? option.title : option.Value__c\" class=\"option\">{{ this.apiMeta !== undefined ? option.title : option.Value__c }}</option>\n <option *ngIf=\"errorMessage\" value=\"\" disabled hidden>{{ errorMessage }}</option>\n</select> -->\n<!-- // VD 12Jun24 - readonly change-->\n<!-- VD 01Aug24 - validation change-->\n<!-- VD 07Aug24 - isDependentField change-->\n<ng-select\n [class]=\"invalidFieldIds.includes(id) || error ? 'shengel-custom-select invalid' : 'shengel-custom-select'\"\n [(ngModel)]=\"selectedValue\" \n [placeholder]=\"placeholder\"\n [disabled]=\"readOnly\"\n (change)=\"selectChange($event)\"\n [id]=\"id\">\n <ng-option *ngFor=\"let option of options\" [value]=\"apiObj !== undefined && !apiObj.isDependentField ? option : option.Value__c\">{{ apiObj !== undefined && !apiObj.isDependentField ? option[labelField] : option.Value__c }}</ng-option> \n</ng-select>\n<span *ngIf=\"error || invalidFieldIds.includes(id)\" class=\"error-msg\">{{errorMessage}}</span>\n", styles: [".ng-select{width:100%}.invalid{border:1px solid red!important}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i6.NgSelectComponent, selector: "ng-select", inputs: ["markFirst", "dropdownPosition", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "bufferAmount", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "readonly", "searchWhileComposing", "minTermLength", "keyDownFn", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd", "bindLabel", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "virtualScroll", "openOnEnter", "appendTo", "bindValue", "appearance", "maxSelectedItems", "groupBy", "groupValue", "tabIndex", "typeahead"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }, { kind: "component", type: i6.ɵr, selector: "ng-option", inputs: ["disabled", "value"] }] });
1947
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: CustomDropdownComponent, selector: "app-custom-dropdown", inputs: { options: "options", placeholder: "placeholder", apiMeta: "apiMeta", selectedValue: "selectedValue", progressBar: "progressBar", id: "id", readOnly: "readOnly", errorMessage: "errorMessage", error: "error", fromShengel: "fromShengel", question: "question", referenceField: "referenceField", token: "token" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: "<!-- HA 18-JAN-24 Commenting these lines as we don't have to use shengel here -->\n<!-- <select\n [ngClass]=\"{\n 'dt-line dpDown down myt-dropbox myt-border-r myt-font1': progressBar,\n 'custom-select': !progressBar\n }\" class=\"custom-select mr-sm-2 dd-height\" \n [id]=\"id\" \n [(ngModel)]=\"selectedValue\"\n (change)=\"selectChange($event.target.value);\" \n [style.borderColor]=\"error ? 'red' : '#858585'\"\n [style.color]=\"error ? 'red' : ''\">\n <option *ngFor=\"let option of options\" [value]=\"this.apiMeta !== undefined ? option.title : option.Value__c\" class=\"option\">{{ this.apiMeta !== undefined ? option.title : option.Value__c }}</option>\n <option *ngIf=\"errorMessage\" value=\"\" disabled hidden>{{ errorMessage }}</option>\n</select> -->\n<!-- // VD 12Jun24 - readonly change-->\n<!-- VD 01Aug24 - validation change-->\n<!-- VD 07Aug24 - isDependentField change-->\n<!-- VD 25Oct24 - changes-->\n<ng-select\n [class]=\"invalidFieldIds.includes(id) || error ? 'shengel-custom-select invalid' : 'shengel-custom-select'\"\n [(ngModel)]=\"selectedValue\" \n [placeholder]=\"placeholder\"\n [disabled]=\"readOnly\"\n (click) = \"getOptions()\"\n (change)=\"selectChange($event)\"\n [id]=\"id\">\n <ng-option *ngFor=\"let option of options\" [value]=\"apiObj !== undefined && !apiObj.isDependentField ? option : option.Value__c\">{{ apiObj !== undefined && !apiObj.isDependentField ? option[labelField] : option.Value__c }}</ng-option> \n</ng-select>\n<span *ngIf=\"error || invalidFieldIds.includes(id)\" class=\"error-msg\">{{errorMessage}}</span>\n", styles: [".ng-select{width:100%}.invalid{border:1px solid red!important}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i6.NgSelectComponent, selector: "ng-select", inputs: ["markFirst", "dropdownPosition", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "bufferAmount", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "readonly", "searchWhileComposing", "minTermLength", "keyDownFn", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd", "bindLabel", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "virtualScroll", "openOnEnter", "appendTo", "bindValue", "appearance", "maxSelectedItems", "groupBy", "groupValue", "tabIndex", "typeahead"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }, { kind: "component", type: i6.ɵr, selector: "ng-option", inputs: ["disabled", "value"] }] });
1932
1948
  }
1933
1949
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: CustomDropdownComponent, decorators: [{
1934
1950
  type: Component,
1935
- args: [{ selector: 'app-custom-dropdown', template: "<!-- HA 18-JAN-24 Commenting these lines as we don't have to use shengel here -->\n<!-- <select\n [ngClass]=\"{\n 'dt-line dpDown down myt-dropbox myt-border-r myt-font1': progressBar,\n 'custom-select': !progressBar\n }\" class=\"custom-select mr-sm-2 dd-height\" \n [id]=\"id\" \n [(ngModel)]=\"selectedValue\"\n (change)=\"selectChange($event.target.value);\" \n [style.borderColor]=\"error ? 'red' : '#858585'\"\n [style.color]=\"error ? 'red' : ''\">\n <option *ngFor=\"let option of options\" [value]=\"this.apiMeta !== undefined ? option.title : option.Value__c\" class=\"option\">{{ this.apiMeta !== undefined ? option.title : option.Value__c }}</option>\n <option *ngIf=\"errorMessage\" value=\"\" disabled hidden>{{ errorMessage }}</option>\n</select> -->\n<!-- // VD 12Jun24 - readonly change-->\n<!-- VD 01Aug24 - validation change-->\n<!-- VD 07Aug24 - isDependentField change-->\n<ng-select\n [class]=\"invalidFieldIds.includes(id) || error ? 'shengel-custom-select invalid' : 'shengel-custom-select'\"\n [(ngModel)]=\"selectedValue\" \n [placeholder]=\"placeholder\"\n [disabled]=\"readOnly\"\n (change)=\"selectChange($event)\"\n [id]=\"id\">\n <ng-option *ngFor=\"let option of options\" [value]=\"apiObj !== undefined && !apiObj.isDependentField ? option : option.Value__c\">{{ apiObj !== undefined && !apiObj.isDependentField ? option[labelField] : option.Value__c }}</ng-option> \n</ng-select>\n<span *ngIf=\"error || invalidFieldIds.includes(id)\" class=\"error-msg\">{{errorMessage}}</span>\n", styles: [".ng-select{width:100%}.invalid{border:1px solid red!important}\n"] }]
1951
+ args: [{ selector: 'app-custom-dropdown', template: "<!-- HA 18-JAN-24 Commenting these lines as we don't have to use shengel here -->\n<!-- <select\n [ngClass]=\"{\n 'dt-line dpDown down myt-dropbox myt-border-r myt-font1': progressBar,\n 'custom-select': !progressBar\n }\" class=\"custom-select mr-sm-2 dd-height\" \n [id]=\"id\" \n [(ngModel)]=\"selectedValue\"\n (change)=\"selectChange($event.target.value);\" \n [style.borderColor]=\"error ? 'red' : '#858585'\"\n [style.color]=\"error ? 'red' : ''\">\n <option *ngFor=\"let option of options\" [value]=\"this.apiMeta !== undefined ? option.title : option.Value__c\" class=\"option\">{{ this.apiMeta !== undefined ? option.title : option.Value__c }}</option>\n <option *ngIf=\"errorMessage\" value=\"\" disabled hidden>{{ errorMessage }}</option>\n</select> -->\n<!-- // VD 12Jun24 - readonly change-->\n<!-- VD 01Aug24 - validation change-->\n<!-- VD 07Aug24 - isDependentField change-->\n<!-- VD 25Oct24 - changes-->\n<ng-select\n [class]=\"invalidFieldIds.includes(id) || error ? 'shengel-custom-select invalid' : 'shengel-custom-select'\"\n [(ngModel)]=\"selectedValue\" \n [placeholder]=\"placeholder\"\n [disabled]=\"readOnly\"\n (click) = \"getOptions()\"\n (change)=\"selectChange($event)\"\n [id]=\"id\">\n <ng-option *ngFor=\"let option of options\" [value]=\"apiObj !== undefined && !apiObj.isDependentField ? option : option.Value__c\">{{ apiObj !== undefined && !apiObj.isDependentField ? option[labelField] : option.Value__c }}</ng-option> \n</ng-select>\n<span *ngIf=\"error || invalidFieldIds.includes(id)\" class=\"error-msg\">{{errorMessage}}</span>\n", styles: [".ng-select{width:100%}.invalid{border:1px solid red!important}\n"] }]
1936
1952
  }], ctorParameters: function () { return [{ type: ChangeService }, { type: DataService }, { type: I18nService }]; }, propDecorators: { options: [{
1937
1953
  type: Input
1938
1954
  }], placeholder: [{
@@ -6148,7 +6164,8 @@ class BookletComponent {
6148
6164
  }
6149
6165
  });
6150
6166
  // VD 13Sep24 - databind changes
6151
- if (this.dataBind) {
6167
+ // VD 23 Oct24 - file type changes
6168
+ if (this.dataBind && Object.keys(this.dataBind).length > 0) {
6152
6169
  this.changeService.dataChanges('dataBind');
6153
6170
  }
6154
6171
  }