@indigina/ui-kit 1.1.635 → 1.1.637

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.
@@ -15179,7 +15179,7 @@ class KitGridViewsComponent {
15179
15179
  new FetchGridViewsConfig(this.viewConfigGroup()),
15180
15180
  ]).subscribe(() => {
15181
15181
  const views = this.store.selectSnapshot(KitGridViewsState.getViews());
15182
- const viewName = this.activatedRoute.snapshot.params['view'] ?? this.activatedRoute.snapshot.data['view'];
15182
+ const viewName = this.activatedRoute.snapshot.params['view'] ?? this.activatedRoute.snapshot.data?.['view'] ?? '';
15183
15183
  this.handleViewChange(views, viewName);
15184
15184
  });
15185
15185
  }
@@ -15190,7 +15190,7 @@ class KitGridViewsComponent {
15190
15190
  return;
15191
15191
  }
15192
15192
  const views = this.store.selectSnapshot(KitGridViewsState.getViews());
15193
- const viewName = decodeViewNameFromUrl(this.activatedRoute.snapshot.params['view']);
15193
+ const viewName = this.activatedRoute.snapshot.params['view'] ?? this.activatedRoute.snapshot.data?.['view'] ?? '';
15194
15194
  this.handleViewChange(views, viewName);
15195
15195
  });
15196
15196
  }
@@ -15206,6 +15206,13 @@ class KitGridViewsComponent {
15206
15206
  });
15207
15207
  }
15208
15208
  handleViewChange(views, viewName = '') {
15209
+ if (!viewName) {
15210
+ const firstView = views.find(view => !view.hidden);
15211
+ if (firstView) {
15212
+ void this.navigateToView(firstView.title, firstView.type, this.buildUrlParamsFromView(firstView.viewState));
15213
+ }
15214
+ return;
15215
+ }
15209
15216
  if (viewName !== viewName.toLowerCase()) {
15210
15217
  this.navigateToView(viewName, this.selectedView()?.type);
15211
15218
  return;
@@ -15258,7 +15265,9 @@ class KitGridViewsComponent {
15258
15265
  }
15259
15266
  navigateToView(viewName, type = KitGridViewType.USER, params = {}) {
15260
15267
  const routePath = kitEncodeViewNameToUrl(viewName.toLowerCase());
15261
- return this.router.navigate([`../${routePath}`], {
15268
+ const hasView = !!(this.activatedRoute.snapshot.params['view'] ?? this.activatedRoute.snapshot.data?.['view']);
15269
+ const relativePrefix = hasView ? '../' : './';
15270
+ return this.router.navigate([`${relativePrefix}${routePath}`], {
15262
15271
  relativeTo: this.activatedRoute,
15263
15272
  queryParams: { ...params, type },
15264
15273
  queryParamsHandling: 'merge',
@@ -17057,8 +17066,18 @@ class KitGridColumnManagerComponent {
17057
17066
  }
17058
17067
  applyChanges() {
17059
17068
  const { sort: sortDescriptor } = this.store.selectSnapshot(KIT_GRID_STATE_TOKEN);
17060
- const visibleColumns = new Set(this.updatedColumns().filter(({ hidden }) => !hidden).map(({ field }) => field));
17061
- const sort = sortDescriptor.filter(({ field }) => visibleColumns.has(field));
17069
+ const visibleColumns = new Set(this.updatedColumns()
17070
+ .filter(({ hidden, hiddenInGrid }) => !hidden && !hiddenInGrid)
17071
+ .map(({ field }) => field));
17072
+ const sort = sortDescriptor.filter(({ field, dir }) => visibleColumns.has(field) &&
17073
+ (dir === KitSortDirection.ASC || dir === KitSortDirection.DESC));
17074
+ if (!sort.length) {
17075
+ const fallbackColumn = this.updatedColumns()
17076
+ .find(({ field, sortable = true }) => visibleColumns.has(field) && sortable);
17077
+ if (fallbackColumn) {
17078
+ sort.push({ field: fallbackColumn.field, dir: KitSortDirection.DESC });
17079
+ }
17080
+ }
17062
17081
  this.store.dispatch([
17063
17082
  new SetGridSort(sort),
17064
17083
  new SetGridColumns(this.updatedColumns()),