@bnsights/bbsf-controls 1.0.167 → 1.0.168

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.
@@ -31,7 +31,7 @@ import { CommonModule, DatePipe } from '@angular/common';
31
31
  import * as i1 from '@angular/common/http';
32
32
  import { HttpHeaders, HttpParams, HttpEventType, HttpClientModule } from '@angular/common/http';
33
33
  import * as i0 from '@angular/core';
34
- import { forwardRef, EventEmitter, Output, Input, Component, Directive, Pipe, Optional, Injectable, ViewChild, ViewEncapsulation, ViewContainerRef, ViewChildren, CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, NgModule } from '@angular/core';
34
+ import { forwardRef, EventEmitter, Output, Input, Component, Directive, Pipe, Optional, Injectable, ViewChild, ViewEncapsulation, HostListener, ViewContainerRef, ViewChildren, CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, NgModule } from '@angular/core';
35
35
  import * as i2 from '@angular/forms';
36
36
  import { NG_VALUE_ACCESSOR, Validators, FormControl, FormGroup, ReactiveFormsModule, FormsModule, FormGroupDirective } from '@angular/forms';
37
37
  import * as i6$2 from '@angular/material/slide-toggle';
@@ -5944,14 +5944,16 @@ var FilterType;
5944
5944
  FilterType[FilterType["Other"] = 7] = "Other";
5945
5945
  })(FilterType || (FilterType = {}));
5946
5946
 
5947
- // tslint:disable-next-line: no-conflicting-lifecycle
5948
5947
  class PagingComponent {
5949
- constructor(utilityService, http, router, onChangeService, requestHandlerService) {
5948
+ constructor(utilityService, http, router, route, location, onChangeService, requestHandlerService, cdr) {
5950
5949
  this.utilityService = utilityService;
5951
5950
  this.http = http;
5952
5951
  this.router = router;
5952
+ this.route = route;
5953
+ this.location = location;
5953
5954
  this.onChangeService = onChangeService;
5954
5955
  this.requestHandlerService = requestHandlerService;
5956
+ this.cdr = cdr;
5955
5957
  this.items = [];
5956
5958
  this.result = [];
5957
5959
  this.pagerConfig = null;
@@ -5970,9 +5972,17 @@ class PagingComponent {
5970
5972
  this.isFirstCall = true;
5971
5973
  this.previousFilters = {};
5972
5974
  this.Items = new EventEmitter();
5975
+ this.pageStateRestored = new EventEmitter();
5973
5976
  this.subscriptions = new Subscription();
5977
+ // Browser navigation support
5978
+ this.isNavigatingBack = false;
5979
+ this.isRestoringFilters = false;
5980
+ this.pageHistory = [];
5981
+ this.currentHistoryIndex = -1;
5974
5982
  this.reinitializePaging = () => {
5975
5983
  this.isFirstCall = true;
5984
+ this.currentPage = 1;
5985
+ this.clearHistoryState();
5976
5986
  this.getItemList(1, true);
5977
5987
  };
5978
5988
  this.updatePaging = () => {
@@ -5984,6 +5994,10 @@ class PagingComponent {
5984
5994
  this.subscriptions.unsubscribe();
5985
5995
  }
5986
5996
  ngOnInit() {
5997
+ // Initialize browser navigation support if enabled
5998
+ if (this.options.enableBrowserNavigation) {
5999
+ this.initializeBrowserNavigation();
6000
+ }
5987
6001
  if (this.options.isLoadMoreControl)
5988
6002
  this.sum = this.options.pageSize;
5989
6003
  if (this.options.dropdownFiltersControlNames != null && this.options.dropdownFiltersControlNames.length > 0) {
@@ -5993,6 +6007,7 @@ class PagingComponent {
5993
6007
  if (result.length > 0) {
5994
6008
  this.isFirstCall = true;
5995
6009
  this.currentPage = 1;
6010
+ this.updateHistoryState();
5996
6011
  this.getItemList(this.currentPage, true);
5997
6012
  }
5998
6013
  }));
@@ -6004,6 +6019,7 @@ class PagingComponent {
6004
6019
  if (result.length > 0) {
6005
6020
  this.isFirstCall = true;
6006
6021
  this.currentPage = 1;
6022
+ this.updateHistoryState();
6007
6023
  this.getItemList(this.currentPage, true);
6008
6024
  }
6009
6025
  }));
@@ -6011,6 +6027,181 @@ class PagingComponent {
6011
6027
  this.isFirstCall = true;
6012
6028
  this.getItemList(this.currentPage, true);
6013
6029
  }
6030
+ /**
6031
+ * Initialize browser navigation support
6032
+ */
6033
+ initializeBrowserNavigation() {
6034
+ // Try to restore state from browser history on initial load
6035
+ this.restoreStateFromBrowserHistory();
6036
+ }
6037
+ /**
6038
+ * Restore state from browser history on initial load
6039
+ */
6040
+ restoreStateFromBrowserHistory() {
6041
+ try {
6042
+ // Get the current history state
6043
+ const currentState = history.state;
6044
+ if (currentState && currentState.pagingState) {
6045
+ const savedState = currentState.pagingState;
6046
+ // Check if the saved state has valid data
6047
+ if (savedState.page && savedState.pageSize && savedState.filters) {
6048
+ // Restore filter values to form controls
6049
+ this.restoreFilterValues(savedState.filters);
6050
+ // Get current filters after restoration
6051
+ const currentFilters = this.getFiltersValue();
6052
+ // Only restore if filters match (same search context)
6053
+ if (JSON.stringify(savedState.filters) === JSON.stringify(currentFilters)) {
6054
+ let pageChanged = false;
6055
+ let pageSizeChanged = false;
6056
+ if (savedState.page !== this.currentPage) {
6057
+ this.currentPage = savedState.page;
6058
+ pageChanged = true;
6059
+ }
6060
+ if (savedState.pageSize !== this.options.pageSize) {
6061
+ this.options.pageSize = savedState.pageSize;
6062
+ pageSizeChanged = true;
6063
+ }
6064
+ // If page or page size changed, reload data
6065
+ if (pageChanged || pageSizeChanged) {
6066
+ this.getItemList(this.currentPage, pageSizeChanged);
6067
+ }
6068
+ // Add the restored state to our local history
6069
+ this.pageHistory.push(savedState);
6070
+ this.currentHistoryIndex = this.pageHistory.length - 1;
6071
+ // Emit event to notify that page state was restored
6072
+ this.pageStateRestored.emit({
6073
+ page: this.currentPage,
6074
+ pageSize: this.options.pageSize
6075
+ });
6076
+ // Force change detection to update the UI
6077
+ this.cdr.detectChanges();
6078
+ console.log(`Initial page state restored: Page ${this.currentPage}, PageSize ${this.options.pageSize}, Filters restored`);
6079
+ }
6080
+ }
6081
+ }
6082
+ }
6083
+ catch (error) {
6084
+ console.warn('Failed to restore browser history state:', error);
6085
+ }
6086
+ }
6087
+ /**
6088
+ * Listen to browser back/forward navigation
6089
+ */
6090
+ onPopState(event) {
6091
+ if (!this.options.enableBrowserNavigation) {
6092
+ return;
6093
+ }
6094
+ console.log('Browser back/forward navigation detected');
6095
+ this.isNavigatingBack = true;
6096
+ this.restorePageStateFromHistory();
6097
+ this.isNavigatingBack = false;
6098
+ }
6099
+ /**
6100
+ * Restore page state from browser history
6101
+ */
6102
+ restorePageStateFromHistory() {
6103
+ try {
6104
+ // Get the current history state from browser
6105
+ const currentState = history.state;
6106
+ if (currentState && currentState.pagingState) {
6107
+ const savedState = currentState.pagingState;
6108
+ // Check if the saved state has valid data
6109
+ if (savedState.page && savedState.pageSize && savedState.filters) {
6110
+ // Restore filter values to form controls
6111
+ this.restoreFilterValues(savedState.filters);
6112
+ // Get current filters after restoration
6113
+ const currentFilters = this.getFiltersValue();
6114
+ // Only restore if filters match (same search context)
6115
+ if (JSON.stringify(savedState.filters) === JSON.stringify(currentFilters)) {
6116
+ let pageChanged = false;
6117
+ let pageSizeChanged = false;
6118
+ if (savedState.page !== this.currentPage) {
6119
+ this.currentPage = savedState.page;
6120
+ pageChanged = true;
6121
+ }
6122
+ if (savedState.pageSize !== this.options.pageSize) {
6123
+ this.options.pageSize = savedState.pageSize;
6124
+ pageSizeChanged = true;
6125
+ }
6126
+ // If page or page size changed, reload data
6127
+ if (pageChanged || pageSizeChanged) {
6128
+ this.getItemList(this.currentPage, pageSizeChanged);
6129
+ }
6130
+ // Update our local history index to match the browser state
6131
+ this.updateLocalHistoryIndex(savedState);
6132
+ // Emit event to notify that page state was restored
6133
+ this.pageStateRestored.emit({
6134
+ page: this.currentPage,
6135
+ pageSize: this.options.pageSize
6136
+ });
6137
+ // Force change detection to update the UI
6138
+ this.cdr.detectChanges();
6139
+ console.log(`Page state restored from browser navigation: Page ${this.currentPage}, PageSize ${this.options.pageSize}, Filters restored`);
6140
+ }
6141
+ }
6142
+ }
6143
+ }
6144
+ catch (error) {
6145
+ console.warn('Failed to restore page state from history:', error);
6146
+ }
6147
+ }
6148
+ /**
6149
+ * Update local history index to match browser state
6150
+ */
6151
+ updateLocalHistoryIndex(savedState) {
6152
+ // Find the matching state in our local history
6153
+ const index = this.pageHistory.findIndex(state => state.page === savedState.page &&
6154
+ state.pageSize === savedState.pageSize &&
6155
+ JSON.stringify(state.filters) === JSON.stringify(savedState.filters));
6156
+ if (index !== -1) {
6157
+ this.currentHistoryIndex = index;
6158
+ }
6159
+ else {
6160
+ // If not found, add it to our history
6161
+ this.pageHistory.push(savedState);
6162
+ this.currentHistoryIndex = this.pageHistory.length - 1;
6163
+ }
6164
+ }
6165
+ /**
6166
+ * Update browser history state with current page and page size
6167
+ */
6168
+ updateHistoryState() {
6169
+ if (!this.options.enableBrowserNavigation) {
6170
+ return;
6171
+ }
6172
+ const currentFilters = this.getFiltersValue();
6173
+ const currentState = {
6174
+ page: this.currentPage,
6175
+ pageSize: this.options.pageSize,
6176
+ filters: currentFilters
6177
+ };
6178
+ // Only update history if we're not already navigating back
6179
+ if (!this.isNavigatingBack) {
6180
+ // Add current state to local history
6181
+ this.pageHistory.push(currentState);
6182
+ this.currentHistoryIndex = this.pageHistory.length - 1;
6183
+ // Limit history size to prevent memory issues
6184
+ if (this.pageHistory.length > 50) {
6185
+ this.pageHistory.shift();
6186
+ this.currentHistoryIndex--;
6187
+ }
6188
+ // Update browser history state
6189
+ const historyState = {
6190
+ pagingState: currentState,
6191
+ timestamp: Date.now()
6192
+ };
6193
+ try {
6194
+ // Use history.pushState to add a new history entry
6195
+ // This allows proper back/forward navigation
6196
+ history.pushState(historyState, '', this.location.path());
6197
+ }
6198
+ catch (error) {
6199
+ console.warn('Failed to update browser history state:', error);
6200
+ // Fallback to replaceState if pushState fails
6201
+ this.location.replaceState(this.location.path(), '', JSON.stringify(historyState));
6202
+ }
6203
+ }
6204
+ }
6014
6205
  ngAfterViewInit() {
6015
6206
  if (this.options.onClickFiltersControlNames != null && this.options.onClickFiltersControlNames.length > 0) {
6016
6207
  const OnClickFiltersControlNames = this.options.onClickFiltersControlNames;
@@ -6019,6 +6210,7 @@ class PagingComponent {
6019
6210
  document.getElementById(OnClickFiltersControlName).addEventListener("click", () => {
6020
6211
  this.currentPage = 1;
6021
6212
  this.isFirstCall = true;
6213
+ this.updateHistoryState();
6022
6214
  this.getItemList(this.currentPage, true);
6023
6215
  }, false);
6024
6216
  }
@@ -6032,6 +6224,7 @@ class PagingComponent {
6032
6224
  if (e.key == "Enter") {
6033
6225
  this.currentPage = 1;
6034
6226
  this.isFirstCall = true;
6227
+ this.updateHistoryState();
6035
6228
  this.getItemList(this.currentPage, true);
6036
6229
  }
6037
6230
  }, false);
@@ -6055,6 +6248,7 @@ class PagingComponent {
6055
6248
  if (e.key == "Enter") {
6056
6249
  this.currentPage = 1;
6057
6250
  this.isFirstCall = true;
6251
+ this.updateHistoryState();
6058
6252
  this.getItemList(this.currentPage, true);
6059
6253
  }
6060
6254
  }, false);
@@ -6065,6 +6259,7 @@ class PagingComponent {
6065
6259
  if (result) {
6066
6260
  this.currentPage = 1;
6067
6261
  this.isFirstCall = true;
6262
+ this.updateHistoryState();
6068
6263
  this.getItemList(this.currentPage, true);
6069
6264
  }
6070
6265
  }
@@ -6077,6 +6272,7 @@ class PagingComponent {
6077
6272
  return;
6078
6273
  }
6079
6274
  this.currentPage = Page;
6275
+ this.updateHistoryState();
6080
6276
  this.getItemList(Page);
6081
6277
  }
6082
6278
  }
@@ -6084,6 +6280,7 @@ class PagingComponent {
6084
6280
  this.options.pageSize = e.target.value;
6085
6281
  this.currentPage = 1;
6086
6282
  this.isFirstCall = true;
6283
+ this.updateHistoryState();
6087
6284
  this.getItemList(this.currentPage, true);
6088
6285
  }
6089
6286
  onScrollDown() {
@@ -6098,7 +6295,8 @@ class PagingComponent {
6098
6295
  this.options.startPagingCallback.call(null);
6099
6296
  let filters = {};
6100
6297
  filters = this.getFiltersValue();
6101
- if (!IsFilterUpdated && Object.keys(this.previousFilters).length != 0 && JSON.stringify(this.previousFilters) != JSON.stringify(filters)) {
6298
+ // Skip filter change detection if we're restoring filters from browser history
6299
+ if (!this.isRestoringFilters && !IsFilterUpdated && Object.keys(this.previousFilters).length != 0 && JSON.stringify(this.previousFilters) != JSON.stringify(filters)) {
6102
6300
  //Reinitialize if filters changed
6103
6301
  page = 1;
6104
6302
  IsFilterUpdated = true;
@@ -6138,6 +6336,74 @@ class PagingComponent {
6138
6336
  this.router.navigate(["/Admin/account/login"]);
6139
6337
  });
6140
6338
  }
6339
+ /**
6340
+ * Force update the current page (useful for external components)
6341
+ */
6342
+ setCurrentPage(page) {
6343
+ if (page > 0 && page !== this.currentPage) {
6344
+ this.currentPage = page;
6345
+ this.updateHistoryState();
6346
+ this.getItemList(page);
6347
+ this.cdr.detectChanges();
6348
+ }
6349
+ }
6350
+ /**
6351
+ * Get the current page number
6352
+ */
6353
+ getCurrentPage() {
6354
+ return this.currentPage;
6355
+ }
6356
+ /**
6357
+ * Restore filter values to form controls
6358
+ */
6359
+ restoreFilterValues(savedFilters) {
6360
+ if (!this.options.filters || !this.group) {
6361
+ return;
6362
+ }
6363
+ this.isRestoringFilters = true;
6364
+ try {
6365
+ for (let index = 0; index < this.options.filters.length; index++) {
6366
+ const filter = this.options.filters[index];
6367
+ if (filter.formControlName && filter.formControlName !== "") {
6368
+ const formControlName = filter.formControlName;
6369
+ const actionParameterName = filter.actionParameterName;
6370
+ // Check if we have a saved value for this filter
6371
+ if (savedFilters.hasOwnProperty(actionParameterName)) {
6372
+ const savedValue = savedFilters[actionParameterName];
6373
+ // Only restore if the value is not null/undefined/empty
6374
+ if (savedValue !== null && savedValue !== undefined && savedValue !== "") {
6375
+ // Set the value to the form control
6376
+ this.group.controls[formControlName].setValue(savedValue);
6377
+ console.log(`Restored filter ${formControlName} with value:`, savedValue);
6378
+ }
6379
+ }
6380
+ }
6381
+ else if (filter.jQuerySelector) {
6382
+ // Handle jQuery selector based filters
6383
+ const actionParameterName = filter.actionParameterName;
6384
+ if (savedFilters.hasOwnProperty(actionParameterName)) {
6385
+ const savedValue = savedFilters[actionParameterName];
6386
+ if (savedValue !== null && savedValue !== undefined && savedValue !== "") {
6387
+ const element = document.querySelector(filter.jQuerySelector);
6388
+ if (element) {
6389
+ element.value = savedValue;
6390
+ console.log(`Restored jQuery filter ${filter.jQuerySelector} with value:`, savedValue);
6391
+ }
6392
+ }
6393
+ }
6394
+ }
6395
+ }
6396
+ }
6397
+ catch (error) {
6398
+ console.warn('Failed to restore filter values:', error);
6399
+ }
6400
+ finally {
6401
+ // Reset the flag after a short delay to allow form controls to update
6402
+ setTimeout(() => {
6403
+ this.isRestoringFilters = false;
6404
+ }, 100);
6405
+ }
6406
+ }
6141
6407
  castItems(objectArr) {
6142
6408
  let originalArray = [];
6143
6409
  for (let index = 0; index < objectArr.length; index++) {
@@ -6189,9 +6455,22 @@ class PagingComponent {
6189
6455
  this.group.controls[FormControlName].setValue(null);
6190
6456
  }
6191
6457
  }
6458
+ // Clear history state when filters are reset
6459
+ this.clearHistoryState();
6192
6460
  this.reinitializePaging();
6193
6461
  }
6194
6462
  }
6463
+ /**
6464
+ * Clear page history state
6465
+ */
6466
+ clearHistoryState() {
6467
+ if (!this.options.enableBrowserNavigation) {
6468
+ return;
6469
+ }
6470
+ // Clear the page history
6471
+ this.pageHistory = [];
6472
+ this.currentHistoryIndex = -1;
6473
+ }
6195
6474
  getFiltersValue() {
6196
6475
  let filters = {};
6197
6476
  if (this.options.filters != null) {
@@ -6235,18 +6514,23 @@ class PagingComponent {
6235
6514
  }
6236
6515
  return filters;
6237
6516
  }
6238
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PagingComponent, deps: [{ token: i3.UtilityService }, { token: i1.HttpClient }, { token: i3$2.Router }, { token: OnPagingFiltersChangeService }, { token: i3.RequestHandlerService }], target: i0.ɵɵFactoryTarget.Component }); }
6239
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: PagingComponent, selector: "BBSF-Paging", inputs: { options: "options", group: "group" }, outputs: { Items: "Items" }, ngImport: i0, template: "<div class=\"form-group bbsf-control bbsf-paging\" *ngIf=\"(result.length > 0)\">\r\n <!--paging container-->\r\n <div class=\"bbsf-paging-container\" *ngIf=\"!options.isLoadMoreControl\">\r\n <!--items-->\r\n <div class=\"bbsf-pagination\">\r\n <jw-pagination [items]=\"items\" *ngIf=\"!((Pages==1)&&options.hidePaginationWhenPageSizeEqualOne)\"\r\n (changePage)=\"onChangePage($event)\" [pageSize]=\"options.pageSize\" [ShowFirstAndLast]=\"options.showFirstAndLast\"\r\n [initialPage]=\"1\" [maxPages]=\"10\"></jw-pagination>\r\n </div>\r\n <!--page count-->\r\n <div class=\"bbsf-pages\" *ngIf=\"!((Pages==1)&&options.hidePaginationWhenPageSizeEqualOne)\">\r\n <select (change)=\"changePageSize($event)\" *ngIf=\"options.showPageSizeOption\">\r\n <option>10</option>\r\n <option>20</option>\r\n <option>50</option>\r\n <option>100</option>\r\n <option>200</option>\r\n </select>\r\n <div class=\"bssf-items\">\r\n <strong>{{totalRow}}</strong> {{itemsText}} {{utilityService.getResourceValue(\"In\")}} <strong>\r\n {{Pages}}</strong> {{pagesText}}\r\n </div>\r\n </div>\r\n </div>\r\n <!--load more-->\r\n <div class=\"bbsf-loadmore\" *ngIf=\"options.isLoadMoreControl\">\r\n <div class=\"search-results\" infinite-scroll [infiniteScrollDistance]=\"scrollDistance\"\r\n [infiniteScrollUpDistance]=\"scrollUpDistance\" [infiniteScrollThrottle]=\"throttle\"\r\n (scrolled)=\"options.isInfiniteScroll==true?onScrollDown():null\" [scrollWindow]=\"options.scrollWindow\"\r\n [infiniteScrollContainer]=\"options.infiniteScrollContainer\">\r\n </div>\r\n <button class=\"btn btn-sm btn-primary\" (click)=\"onScrollDown()\"\r\n *ngIf=\"!(result.length==totalRow)\">{{utilityService.getResourceValue(\"LoadMore\")}}</button>\r\n </div>\r\n</div>", dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6$3.InfiniteScrollDirective, selector: "[infiniteScroll], [infinite-scroll], [data-infinite-scroll]", inputs: ["infiniteScrollDistance", "infiniteScrollUpDistance", "infiniteScrollThrottle", "infiniteScrollDisabled", "infiniteScrollContainer", "scrollWindow", "immediateCheck", "horizontal", "alwaysCallback", "fromRoot"], outputs: ["scrolled", "scrolledUp"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "component", type: JwPaginationComponent, selector: "jw-pagination", inputs: ["items", "initialPage", "pageSize", "maxPages", "ShowFirstAndLast"], outputs: ["changePage"] }] }); }
6517
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PagingComponent, deps: [{ token: i3.UtilityService }, { token: i1.HttpClient }, { token: i3$2.Router }, { token: i3$2.ActivatedRoute }, { token: i5.Location }, { token: OnPagingFiltersChangeService }, { token: i3.RequestHandlerService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
6518
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: PagingComponent, selector: "BBSF-Paging", inputs: { options: "options", group: "group" }, outputs: { Items: "Items", pageStateRestored: "pageStateRestored" }, host: { listeners: { "window:popstate": "onPopState($event)" } }, ngImport: i0, template: "<div class=\"form-group bbsf-control bbsf-paging\" *ngIf=\"(result.length > 0)\">\r\n <!--paging container-->\r\n <div class=\"bbsf-paging-container\" *ngIf=\"!options.isLoadMoreControl\">\r\n <!--items-->\r\n <div class=\"bbsf-pagination\">\r\n <jw-pagination [items]=\"items\" *ngIf=\"!((Pages==1)&&options.hidePaginationWhenPageSizeEqualOne)\"\r\n (changePage)=\"onChangePage($event)\" [pageSize]=\"options.pageSize\" [ShowFirstAndLast]=\"options.showFirstAndLast\"\r\n [initialPage]=\"currentPage\" [maxPages]=\"10\"></jw-pagination>\r\n </div>\r\n <!--page count-->\r\n <div class=\"bbsf-pages\" *ngIf=\"!((Pages==1)&&options.hidePaginationWhenPageSizeEqualOne)\">\r\n <select (change)=\"changePageSize($event)\" *ngIf=\"options.showPageSizeOption\">\r\n <option>10</option>\r\n <option>20</option>\r\n <option>50</option>\r\n <option>100</option>\r\n <option>200</option>\r\n </select>\r\n <div class=\"bssf-items\">\r\n <strong>{{totalRow}}</strong> {{itemsText}} {{utilityService.getResourceValue(\"In\")}} <strong>\r\n {{Pages}}</strong> {{pagesText}}\r\n </div>\r\n </div>\r\n </div>\r\n <!--load more-->\r\n <div class=\"bbsf-loadmore\" *ngIf=\"options.isLoadMoreControl\">\r\n <div class=\"search-results\" infinite-scroll [infiniteScrollDistance]=\"scrollDistance\"\r\n [infiniteScrollUpDistance]=\"scrollUpDistance\" [infiniteScrollThrottle]=\"throttle\"\r\n (scrolled)=\"options.isInfiniteScroll==true?onScrollDown():null\" [scrollWindow]=\"options.scrollWindow\"\r\n [infiniteScrollContainer]=\"options.infiniteScrollContainer\">\r\n </div>\r\n <button class=\"btn btn-sm btn-primary\" (click)=\"onScrollDown()\"\r\n *ngIf=\"!(result.length==totalRow)\">{{utilityService.getResourceValue(\"LoadMore\")}}</button>\r\n </div>\r\n</div>", dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6$3.InfiniteScrollDirective, selector: "[infiniteScroll], [infinite-scroll], [data-infinite-scroll]", inputs: ["infiniteScrollDistance", "infiniteScrollUpDistance", "infiniteScrollThrottle", "infiniteScrollDisabled", "infiniteScrollContainer", "scrollWindow", "immediateCheck", "horizontal", "alwaysCallback", "fromRoot"], outputs: ["scrolled", "scrolledUp"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "component", type: JwPaginationComponent, selector: "jw-pagination", inputs: ["items", "initialPage", "pageSize", "maxPages", "ShowFirstAndLast"], outputs: ["changePage"] }] }); }
6240
6519
  }
6241
6520
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PagingComponent, decorators: [{
6242
6521
  type: Component,
6243
- args: [{ selector: 'BBSF-Paging', template: "<div class=\"form-group bbsf-control bbsf-paging\" *ngIf=\"(result.length > 0)\">\r\n <!--paging container-->\r\n <div class=\"bbsf-paging-container\" *ngIf=\"!options.isLoadMoreControl\">\r\n <!--items-->\r\n <div class=\"bbsf-pagination\">\r\n <jw-pagination [items]=\"items\" *ngIf=\"!((Pages==1)&&options.hidePaginationWhenPageSizeEqualOne)\"\r\n (changePage)=\"onChangePage($event)\" [pageSize]=\"options.pageSize\" [ShowFirstAndLast]=\"options.showFirstAndLast\"\r\n [initialPage]=\"1\" [maxPages]=\"10\"></jw-pagination>\r\n </div>\r\n <!--page count-->\r\n <div class=\"bbsf-pages\" *ngIf=\"!((Pages==1)&&options.hidePaginationWhenPageSizeEqualOne)\">\r\n <select (change)=\"changePageSize($event)\" *ngIf=\"options.showPageSizeOption\">\r\n <option>10</option>\r\n <option>20</option>\r\n <option>50</option>\r\n <option>100</option>\r\n <option>200</option>\r\n </select>\r\n <div class=\"bssf-items\">\r\n <strong>{{totalRow}}</strong> {{itemsText}} {{utilityService.getResourceValue(\"In\")}} <strong>\r\n {{Pages}}</strong> {{pagesText}}\r\n </div>\r\n </div>\r\n </div>\r\n <!--load more-->\r\n <div class=\"bbsf-loadmore\" *ngIf=\"options.isLoadMoreControl\">\r\n <div class=\"search-results\" infinite-scroll [infiniteScrollDistance]=\"scrollDistance\"\r\n [infiniteScrollUpDistance]=\"scrollUpDistance\" [infiniteScrollThrottle]=\"throttle\"\r\n (scrolled)=\"options.isInfiniteScroll==true?onScrollDown():null\" [scrollWindow]=\"options.scrollWindow\"\r\n [infiniteScrollContainer]=\"options.infiniteScrollContainer\">\r\n </div>\r\n <button class=\"btn btn-sm btn-primary\" (click)=\"onScrollDown()\"\r\n *ngIf=\"!(result.length==totalRow)\">{{utilityService.getResourceValue(\"LoadMore\")}}</button>\r\n </div>\r\n</div>" }]
6244
- }], ctorParameters: () => [{ type: i3.UtilityService }, { type: i1.HttpClient }, { type: i3$2.Router }, { type: OnPagingFiltersChangeService }, { type: i3.RequestHandlerService }], propDecorators: { Items: [{
6522
+ args: [{ selector: 'BBSF-Paging', template: "<div class=\"form-group bbsf-control bbsf-paging\" *ngIf=\"(result.length > 0)\">\r\n <!--paging container-->\r\n <div class=\"bbsf-paging-container\" *ngIf=\"!options.isLoadMoreControl\">\r\n <!--items-->\r\n <div class=\"bbsf-pagination\">\r\n <jw-pagination [items]=\"items\" *ngIf=\"!((Pages==1)&&options.hidePaginationWhenPageSizeEqualOne)\"\r\n (changePage)=\"onChangePage($event)\" [pageSize]=\"options.pageSize\" [ShowFirstAndLast]=\"options.showFirstAndLast\"\r\n [initialPage]=\"currentPage\" [maxPages]=\"10\"></jw-pagination>\r\n </div>\r\n <!--page count-->\r\n <div class=\"bbsf-pages\" *ngIf=\"!((Pages==1)&&options.hidePaginationWhenPageSizeEqualOne)\">\r\n <select (change)=\"changePageSize($event)\" *ngIf=\"options.showPageSizeOption\">\r\n <option>10</option>\r\n <option>20</option>\r\n <option>50</option>\r\n <option>100</option>\r\n <option>200</option>\r\n </select>\r\n <div class=\"bssf-items\">\r\n <strong>{{totalRow}}</strong> {{itemsText}} {{utilityService.getResourceValue(\"In\")}} <strong>\r\n {{Pages}}</strong> {{pagesText}}\r\n </div>\r\n </div>\r\n </div>\r\n <!--load more-->\r\n <div class=\"bbsf-loadmore\" *ngIf=\"options.isLoadMoreControl\">\r\n <div class=\"search-results\" infinite-scroll [infiniteScrollDistance]=\"scrollDistance\"\r\n [infiniteScrollUpDistance]=\"scrollUpDistance\" [infiniteScrollThrottle]=\"throttle\"\r\n (scrolled)=\"options.isInfiniteScroll==true?onScrollDown():null\" [scrollWindow]=\"options.scrollWindow\"\r\n [infiniteScrollContainer]=\"options.infiniteScrollContainer\">\r\n </div>\r\n <button class=\"btn btn-sm btn-primary\" (click)=\"onScrollDown()\"\r\n *ngIf=\"!(result.length==totalRow)\">{{utilityService.getResourceValue(\"LoadMore\")}}</button>\r\n </div>\r\n</div>" }]
6523
+ }], ctorParameters: () => [{ type: i3.UtilityService }, { type: i1.HttpClient }, { type: i3$2.Router }, { type: i3$2.ActivatedRoute }, { type: i5.Location }, { type: OnPagingFiltersChangeService }, { type: i3.RequestHandlerService }, { type: i0.ChangeDetectorRef }], propDecorators: { Items: [{
6524
+ type: Output
6525
+ }], pageStateRestored: [{
6245
6526
  type: Output
6246
6527
  }], options: [{
6247
6528
  type: Input
6248
6529
  }], group: [{
6249
6530
  type: Input
6531
+ }], onPopState: [{
6532
+ type: HostListener,
6533
+ args: ['window:popstate', ['$event']]
6250
6534
  }] } });
6251
6535
 
6252
6536
  class PhoneComponent {
@@ -7148,7 +7432,7 @@ class TextAreaComponent {
7148
7432
  this.showCharsLimitMsg = false;
7149
7433
  this.hasCharsLimitValidationError = false;
7150
7434
  this.minCharsLimit = -1; //To disable chars limit feature by default
7151
- this.maxLimitWarningMsg = "";
7435
+ this.maxLimitWarningMsg = '';
7152
7436
  this.isMicOn = false;
7153
7437
  this.resetError = () => {
7154
7438
  this.controlValidationService.removeGlobalError();
@@ -7190,7 +7474,7 @@ class TextAreaComponent {
7190
7474
  this.options.maxLength = this.globalSettings.maxLengthTextArea;
7191
7475
  if (!this.options.viewType)
7192
7476
  this.options.viewType = this.globalSettings.viewType;
7193
- if (this.options.labelKey != null && this.options.labelKey != "")
7477
+ if (this.options.labelKey != null && this.options.labelKey != '')
7194
7478
  this.options.labelValue = this.utilityService.getResourceValue(this.options.labelKey);
7195
7479
  if (this.options.enableSpeechRecognition) {
7196
7480
  // Initialize language form control
@@ -7198,7 +7482,7 @@ class TextAreaComponent {
7198
7482
  this.group.addControl(languageControlName, new FormControl(this.options.selectedSpeechLanguage || ''));
7199
7483
  //Get all languages if not set
7200
7484
  if (!this.options.speechLanguages) {
7201
- this.languageService.getLanguages().subscribe(result => {
7485
+ this.languageService.getLanguages().subscribe((result) => {
7202
7486
  this.options.speechLanguages = result;
7203
7487
  this.setSpeechLanguage();
7204
7488
  });
@@ -7264,16 +7548,18 @@ class TextAreaComponent {
7264
7548
  this.controlUtility.CopyInputMessage(inputElement);
7265
7549
  }
7266
7550
  onTextChange() {
7267
- if (this.textAreaFormControl.value == "") {
7551
+ if (this.textAreaFormControl.value == '') {
7268
7552
  this.wordCountArray = 0;
7269
7553
  this.wordCount = 0;
7270
7554
  }
7271
7555
  else {
7272
- this.wordCountArray = this.textAreaFormControl.value.split(" ").length;
7556
+ this.wordCountArray = this.textAreaFormControl.value.split(' ').length;
7273
7557
  if (this.wordCountArray > 0) {
7274
7558
  if (this.wordCountArray > this.options.maxWordCount) {
7275
7559
  this.wordCount = this.options.maxWordCount;
7276
- this.textAreaFormControl.setErrors({ "errorMassage": ` Word count must be less then or equal ${this.options.maxWordCount}` });
7560
+ this.textAreaFormControl.setErrors({
7561
+ errorMassage: ` Word count must be less then or equal ${this.options.maxWordCount}`
7562
+ });
7277
7563
  this.textAreaFormControl.markAsTouched();
7278
7564
  this.textAreaFormControl.invalid;
7279
7565
  }
@@ -7290,9 +7576,9 @@ class TextAreaComponent {
7290
7576
  this.showCharsLimitMsg = true;
7291
7577
  this.hasCharsLimitValidationError = true;
7292
7578
  if (this.currentCharsCount == this.options.maxLength)
7293
- this.charsLimitMsgClass = "danger";
7579
+ this.charsLimitMsgClass = 'danger';
7294
7580
  else
7295
- this.charsLimitMsgClass = "warning";
7581
+ this.charsLimitMsgClass = 'warning';
7296
7582
  }
7297
7583
  else {
7298
7584
  this.showCharsLimitMsg = false;
@@ -7300,9 +7586,11 @@ class TextAreaComponent {
7300
7586
  }
7301
7587
  let max = this.options.maxLength;
7302
7588
  let current = this.currentCharsCount;
7303
- let msg = this.utilityService.getResourceValue("MaxLengthLimitWarning");
7589
+ let msg = this.utilityService.getResourceValue('MaxLengthLimitWarning');
7304
7590
  // Replace placeholders with actual values
7305
- this.maxLimitWarningMsg = msg.replace("${max}", max.toString()).replace("${current}", current.toString());
7591
+ this.maxLimitWarningMsg = msg
7592
+ .replace('${max}', max.toString())
7593
+ .replace('${current}', current.toString());
7306
7594
  }
7307
7595
  this.onChange.emit(this.textAreaFormControl.value);
7308
7596
  }
@@ -7310,38 +7598,41 @@ class TextAreaComponent {
7310
7598
  this.isShowWordCount = isFocus;
7311
7599
  //onFocus
7312
7600
  if (isFocus) {
7313
- if (this.hasCharsLimitValidationError) //check if there was previous validation error
7601
+ if (this.hasCharsLimitValidationError)
7602
+ //check if there was previous validation error
7314
7603
  this.showCharsLimitMsg = true;
7315
- }
7316
- else //onFocusOut
7604
+ } //onFocusOut
7605
+ else
7317
7606
  this.showCharsLimitMsg = false;
7318
7607
  }
7319
7608
  //region Speech Recognition
7320
7609
  setSpeechLanguage() {
7321
7610
  const languageControlName = 'Language_' + this.options.name;
7322
7611
  if (this.options.autoSaveSpeechLanguagetoLocalStorage) {
7323
- let savedLanguage = localStorage.getItem("speechLanguage");
7612
+ let savedLanguage = localStorage.getItem('speechLanguage');
7324
7613
  if (savedLanguage) {
7325
7614
  this.options.selectedSpeechLanguage = savedLanguage;
7326
7615
  }
7327
7616
  else {
7328
7617
  this.loadSelectedSpeechLanguage();
7329
- localStorage.setItem("speechLanguage", this.options.selectedSpeechLanguage);
7618
+ localStorage.setItem('speechLanguage', this.options.selectedSpeechLanguage);
7330
7619
  }
7331
7620
  }
7332
7621
  else {
7333
7622
  this.loadSelectedSpeechLanguage();
7334
7623
  }
7335
7624
  this.group.get(languageControlName).setValue(this.options.selectedSpeechLanguage);
7336
- this.selectedSpeechLanguageDisplayText = this.options.speechLanguages.find(l => l.dialect == this.options.selectedSpeechLanguage).prefix;
7625
+ this.selectedSpeechLanguageDisplayText = this.options.speechLanguages.find((l) => l.dialect == this.options.selectedSpeechLanguage).prefix;
7337
7626
  }
7338
7627
  loadSelectedSpeechLanguage() {
7339
7628
  if (!this.options.selectedSpeechLanguage) {
7340
- if (this.currentLanguage == "en" && this.options.speechLanguages.some(language => language.englishName === 'English')) {
7341
- this.options.selectedSpeechLanguage = this.options.speechLanguages.find(language => language.englishName === 'English').dialect;
7629
+ if (this.currentLanguage == 'en' &&
7630
+ this.options.speechLanguages.some((language) => language.englishName === 'English')) {
7631
+ this.options.selectedSpeechLanguage = this.options.speechLanguages.find((language) => language.englishName === 'English').dialect;
7342
7632
  }
7343
- else if (this.currentLanguage == "ar" && this.options.speechLanguages.some(language => language.englishName === 'Arabic')) {
7344
- this.options.selectedSpeechLanguage = this.options.speechLanguages.find(language => language.englishName === 'Arabic').dialect;
7633
+ else if (this.currentLanguage == 'ar' &&
7634
+ this.options.speechLanguages.some((language) => language.englishName === 'Arabic')) {
7635
+ this.options.selectedSpeechLanguage = this.options.speechLanguages.find((language) => language.englishName === 'Arabic').dialect;
7345
7636
  }
7346
7637
  else {
7347
7638
  this.options.selectedSpeechLanguage = this.options.speechLanguages[0].dialect;
@@ -7350,21 +7641,25 @@ class TextAreaComponent {
7350
7641
  }
7351
7642
  startSpeechRecognition() {
7352
7643
  if (!this.speechRecognitionService.isSupported) {
7353
- this.utilityService.notifyErrorMessage(this.utilityService.getResourceValue("BrowserNotSupportSpeechRecognition"));
7644
+ this.utilityService.notifyErrorMessage(this.utilityService.getResourceValue('BrowserNotSupportSpeechRecognition'));
7354
7645
  return;
7355
7646
  }
7356
7647
  //Disable Select Language
7357
7648
  this.enableOrDisableLanguageSelect(false);
7358
7649
  this.isMicOn = true;
7359
- this.subscription = this.speechRecognitionService.startListening(this.options.selectedSpeechLanguage).subscribe({
7650
+ this.subscription = this.speechRecognitionService
7651
+ .startListening(this.options.selectedSpeechLanguage)
7652
+ .subscribe({
7360
7653
  next: (transcript) => {
7361
7654
  if (transcript) {
7362
7655
  if (this.options.value) {
7363
7656
  this.options.value += ' ';
7657
+ this.fireOnChange(this.options.value);
7364
7658
  }
7365
7659
  let charIndex = 0;
7366
7660
  const interval = setInterval(() => {
7367
7661
  this.options.value += transcript[charIndex];
7662
+ this.fireOnChange(this.options.value);
7368
7663
  charIndex++;
7369
7664
  if (charIndex === transcript.length) {
7370
7665
  clearInterval(interval);
@@ -7394,6 +7689,11 @@ class TextAreaComponent {
7394
7689
  this.subscription.unsubscribe();
7395
7690
  }
7396
7691
  }
7692
+ fireOnChange(text) {
7693
+ if (this.onChange) {
7694
+ this.onChange.emit(text);
7695
+ }
7696
+ }
7397
7697
  ngOnDestroy() {
7398
7698
  if (this.options.enableSpeechRecognition) {
7399
7699
  this.stopSpeechRecognition();
@@ -7401,13 +7701,13 @@ class TextAreaComponent {
7401
7701
  }
7402
7702
  onSpeechLanguageChange(event) {
7403
7703
  let selectedLang_Dialect = event.target.value;
7404
- this.selectedSpeechLanguageDisplayText = this.options.speechLanguages.find(l => l.dialect == selectedLang_Dialect).prefix;
7704
+ this.selectedSpeechLanguageDisplayText = this.options.speechLanguages.find((l) => l.dialect == selectedLang_Dialect).prefix;
7405
7705
  this.options.selectedSpeechLanguage = selectedLang_Dialect;
7406
7706
  const languageControlName = 'Language_' + this.options.name;
7407
7707
  let select = this.group.get(languageControlName);
7408
7708
  select.setValue(selectedLang_Dialect);
7409
7709
  if (this.options.autoSaveSpeechLanguagetoLocalStorage) {
7410
- localStorage.setItem("speechLanguage", selectedLang_Dialect);
7710
+ localStorage.setItem('speechLanguage', selectedLang_Dialect);
7411
7711
  }
7412
7712
  }
7413
7713
  enableOrDisableLanguageSelect(isEnabled = true) {
@@ -9459,6 +9759,8 @@ class PagingOptions {
9459
9759
  this.resetFilterButtonName = null;
9460
9760
  this.disableBlockUI = false;
9461
9761
  this.startPagingCallback = null;
9762
+ /** Enable browser back/forward navigation support for paging state */
9763
+ this.enableBrowserNavigation = false;
9462
9764
  }
9463
9765
  }
9464
9766