@elasticias/ui 1.0.40 → 1.0.41

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,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Pipe, input, Component, output, booleanAttribute, Input, Directive, signal, computed, inject, EventEmitter, Injector, forwardRef, Output, ContentChild, HostBinding, ChangeDetectionStrategy, ElementRef, LOCALE_ID, ViewContainerRef, DestroyRef, ChangeDetectorRef, effect, HostListener, ViewChild, model, InjectionToken, TemplateRef, ContentChildren, viewChild, contentChild, ViewEncapsulation, afterNextRender, ViewChildren, untracked, PLATFORM_ID } from '@angular/core';
3
- import { NumberUtils, UuidUtils, StorageUtils } from '@elasticias/utils';
3
+ import { NumberUtils, UuidUtils } from '@elasticias/utils';
4
4
  import * as i1 from 'primeng/button';
5
5
  import { ButtonModule } from 'primeng/button';
6
6
  import * as i1$3 from '@angular/common';
@@ -22,7 +22,7 @@ import * as i1$6 from 'primeng/dialog';
22
22
  import { DialogModule } from 'primeng/dialog';
23
23
  import { SCREEN_REF_DATA_SERVICE, ScreenStateEnum } from '@elasticias/screens';
24
24
  import { Permissions } from '@elasticias/types';
25
- import { EfShortcutService, EfViewportService, formatShortcut, EfThemeConfigService, EF_BUILD_INFO, EfPermissionService, EfActiveModuleService, EF_SESSION, EfToastService } from '@elasticias/core';
25
+ import { EfShortcutService, EfViewportService, EF_PREFERENCE_STORE, formatShortcut, efTablePrefsKey, EfThemeConfigService, EF_BUILD_INFO, EfPermissionService, EfActiveModuleService, EF_SESSION, EF_SIDE_COLLAPSED_KEY, EfToastService } from '@elasticias/core';
26
26
  import * as i1$7 from 'primeng/fieldset';
27
27
  import { FieldsetModule } from 'primeng/fieldset';
28
28
  import * as i2$2 from 'primeng/accordion';
@@ -4571,6 +4571,7 @@ class EfDataCardComponent {
4571
4571
  become a list instead, driven by the same column config —
4572
4572
  each column declares (or is given) a role. */
4573
4573
  viewport = inject(EfViewportService);
4574
+ prefs = inject(EF_PREFERENCE_STORE);
4574
4575
  configuredMobileLayout = inject(EF_DATA_CARD_MOBILE_LAYOUT, { optional: true });
4575
4576
  isMobile = this.viewport.isMobile;
4576
4577
  /** Per-screen override of the app-wide default. */
@@ -5191,14 +5192,17 @@ class EfDataCardComponent {
5191
5192
  }
5192
5193
  storageKey() {
5193
5194
  const key = this.tableKey();
5194
- return key ? `TABLE_PREFS_${key}` : null;
5195
+ return key ? efTablePrefsKey(key) : null;
5195
5196
  }
5196
5197
  loadPreferences() {
5197
5198
  const key = this.storageKey();
5198
5199
  if (!key)
5199
5200
  return;
5200
5201
  try {
5201
- const saved = StorageUtils.getLocal(key);
5202
+ const raw = this.prefs.get(key);
5203
+ if (!raw)
5204
+ return;
5205
+ const saved = JSON.parse(raw);
5202
5206
  if (!saved)
5203
5207
  return;
5204
5208
  if (saved.density)
@@ -5216,10 +5220,10 @@ class EfDataCardComponent {
5216
5220
  if (!key)
5217
5221
  return;
5218
5222
  try {
5219
- StorageUtils.setLocal(key, {
5223
+ this.prefs.set(key, JSON.stringify({
5220
5224
  density: this.density(),
5221
5225
  hiddenColumnIds: this.hiddenColumnIds(),
5222
- });
5226
+ }));
5223
5227
  }
5224
5228
  catch {
5225
5229
  // Preferences are a convenience; losing them must never break
@@ -7472,15 +7476,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
7472
7476
  args: ['document:keydown.escape']
7473
7477
  }] } });
7474
7478
 
7475
- const SIDE_COLLAPSED_KEY = 'ef.shell.side-collapsed';
7476
- function readSideCollapsed() {
7477
- try {
7478
- return localStorage.getItem(SIDE_COLLAPSED_KEY) === '1';
7479
- }
7480
- catch {
7481
- return false;
7482
- }
7483
- }
7484
7479
  /**
7485
7480
  * Top-level Comptoir shell.
7486
7481
  *
@@ -7528,20 +7523,22 @@ class EfAppShellComponent {
7528
7523
  inside the side, so it is still there to bring the side back
7529
7524
  once it is gone, and in the same spot. Remembered per browser:
7530
7525
  it is a reading preference, not something worth a round trip. */
7531
- sideCollapsed = signal(readSideCollapsed(), ...(ngDevMode ? [{ debugName: "sideCollapsed" }] : /* istanbul ignore next */ []));
7526
+ prefs = inject(EF_PREFERENCE_STORE);
7527
+ sideCollapsed = signal(this.prefs.get(EF_SIDE_COLLAPSED_KEY) === '1', ...(ngDevMode ? [{ debugName: "sideCollapsed" }] : /* istanbul ignore next */ []));
7532
7528
  /** Shown in the toggle's tooltip: the button is far from the content, the shortcut is not. */
7533
7529
  shortcutHint = formatShortcut('mod+b');
7534
7530
  toggleSide() {
7535
7531
  const collapsed = !this.sideCollapsed();
7536
7532
  this.sideCollapsed.set(collapsed);
7537
- try {
7538
- localStorage.setItem(SIDE_COLLAPSED_KEY, collapsed ? '1' : '0');
7539
- }
7540
- catch {
7541
- /* private window or blocked storage: the toggle still works for this visit */
7542
- }
7533
+ this.prefs.set(EF_SIDE_COLLAPSED_KEY, collapsed ? '1' : '0');
7543
7534
  }
7544
7535
  constructor() {
7536
+ // A store that hydrates after sign in announces the key it filled.
7537
+ this.prefs.changes?.pipe(takeUntilDestroyed()).subscribe((key) => {
7538
+ if (key === EF_SIDE_COLLAPSED_KEY) {
7539
+ this.sideCollapsed.set(this.prefs.get(EF_SIDE_COLLAPSED_KEY) === '1');
7540
+ }
7541
+ });
7545
7542
  inject(EfShortcutService).register({
7546
7543
  id: 'shell.toggle-side',
7547
7544
  keys: 'mod+b',
@@ -10888,14 +10885,22 @@ class EfSmartBarComponent {
10888
10885
  only text inside this label is the shortcut hint, so
10889
10886
  without it a screen reader announced the primary
10890
10887
  search field of every list screen as "Cmd K". -->
10888
+ <!-- type="search" fires a native, bubbling 'search' Event
10889
+ on Enter and on the browser's clear button (Chromium,
10890
+ WebKit). A host (search) binding hears that DOM event
10891
+ as well as the output below, so it would receive the
10892
+ Event as the search text. Stopped here; the output is
10893
+ the only 'search' that leaves this component. -->
10891
10894
  <input
10892
10895
  #searchInput
10893
10896
  type="search"
10897
+ enterkeyhint="search"
10894
10898
  [attr.aria-label]="accessibleLabel()"
10895
10899
  [placeholder]="(placeholderKey() ? (placeholderKey() | translate) : placeholder())"
10896
10900
  [ngModel]="searchText()"
10897
10901
  (ngModelChange)="searchText.set($event)"
10898
10902
  (keydown.enter)="onSubmit()"
10903
+ (search)="$event.stopPropagation()"
10899
10904
  />
10900
10905
  @if (showKbdHint() && kbdLabel()) {
10901
10906
  <!-- Decorative, and hidden from the accessibility tree:
@@ -10935,15 +10940,11 @@ class EfSmartBarComponent {
10935
10940
 
10936
10941
  <ng-content select="[drawer]"></ng-content>
10937
10942
  </div>
10938
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$1.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$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
10943
+ `, isInline: true, styles: ["input[type=search]::-webkit-search-cancel-button{-webkit-appearance:none;appearance:none;display:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$1.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$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
10939
10944
  }
10940
10945
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: EfSmartBarComponent, decorators: [{
10941
10946
  type: Component,
10942
- args: [{
10943
- selector: 'ef-smart-bar',
10944
- standalone: true,
10945
- imports: [CommonModule, FormsModule, TranslateModule],
10946
- template: `
10947
+ args: [{ selector: 'ef-smart-bar', standalone: true, imports: [CommonModule, FormsModule, TranslateModule], template: `
10947
10948
  <div class="screen-search">
10948
10949
  <div class="smart-bar">
10949
10950
  <label class="search">
@@ -10951,14 +10952,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
10951
10952
  only text inside this label is the shortcut hint, so
10952
10953
  without it a screen reader announced the primary
10953
10954
  search field of every list screen as "Cmd K". -->
10955
+ <!-- type="search" fires a native, bubbling 'search' Event
10956
+ on Enter and on the browser's clear button (Chromium,
10957
+ WebKit). A host (search) binding hears that DOM event
10958
+ as well as the output below, so it would receive the
10959
+ Event as the search text. Stopped here; the output is
10960
+ the only 'search' that leaves this component. -->
10954
10961
  <input
10955
10962
  #searchInput
10956
10963
  type="search"
10964
+ enterkeyhint="search"
10957
10965
  [attr.aria-label]="accessibleLabel()"
10958
10966
  [placeholder]="(placeholderKey() ? (placeholderKey() | translate) : placeholder())"
10959
10967
  [ngModel]="searchText()"
10960
10968
  (ngModelChange)="searchText.set($event)"
10961
10969
  (keydown.enter)="onSubmit()"
10970
+ (search)="$event.stopPropagation()"
10962
10971
  />
10963
10972
  @if (showKbdHint() && kbdLabel()) {
10964
10973
  <!-- Decorative, and hidden from the accessibility tree:
@@ -10998,9 +11007,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
10998
11007
 
10999
11008
  <ng-content select="[drawer]"></ng-content>
11000
11009
  </div>
11001
- `,
11002
- changeDetection: ChangeDetectionStrategy.OnPush,
11003
- }]
11010
+ `, changeDetection: ChangeDetectionStrategy.OnPush, styles: ["input[type=search]::-webkit-search-cancel-button{-webkit-appearance:none;appearance:none;display:none}\n"] }]
11004
11011
  }], ctorParameters: () => [], propDecorators: { searchInput: [{ type: i0.ViewChild, args: ['searchInput', { isSignal: true }] }], searchText: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchText", required: false }] }, { type: i0.Output, args: ["searchTextChange"] }], placeholderKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholderKey", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], clearLabelKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearLabelKey", required: false }] }], clearTitleKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearTitleKey", required: false }] }], searchLabelKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchLabelKey", required: false }] }], showKbdHint: [{ type: i0.Input, args: [{ isSignal: true, alias: "showKbdHint", required: false }] }], hideClear: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideClear", required: false }] }], hideSearch: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideSearch", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], shortcut: [{ type: i0.Input, args: [{ isSignal: true, alias: "shortcut", required: false }] }], search: [{ type: i0.Output, args: ["search"] }], clear: [{ type: i0.Output, args: ["clear"] }] } });
11005
11012
 
11006
11013
  /**