@elasticias/screens 1.0.47 → 1.0.49

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elasticias/screens",
3
- "version": "1.0.47",
3
+ "version": "1.0.49",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.0.0",
6
6
  "@angular/core": "^21.0.0",
@@ -5,7 +5,7 @@ import { Subject, Observable } from 'rxjs';
5
5
  import { Permissions } from '@elasticias/types';
6
6
  import { Router, ActivatedRoute } from '@angular/router';
7
7
  import { NgForm } from '@angular/forms';
8
- import { CacheService, ToastService, ConfirmDialogService } from '@elasticias/core';
8
+ import { CacheService, ToastService, ConfirmDialogService, EfConfirmOptions } from '@elasticias/core';
9
9
  import { Table, TableLazyLoadEvent } from 'primeng/table';
10
10
  import { Location } from '@angular/common';
11
11
 
@@ -538,12 +538,34 @@ interface EfDataCardColumn {
538
538
  * always excluded regardless.
539
539
  */
540
540
  hideable?: boolean;
541
+ /**
542
+ * Start the column hidden. The viewer can still show it from the
543
+ * Columns picker, and that choice is saved per `tableKey` through
544
+ * `EF_PREFERENCE_STORE` like any other hidden column, so it wins on
545
+ * the next visit. Use it for a column a wide table can do without at
546
+ * first sight (a sort position, an internal code).
547
+ *
548
+ * Ignored with `hideable: false` and on `select` / `actions`: a column
549
+ * the picker does not list could never be shown again.
550
+ *
551
+ * A table whose preferences were saved before the column became
552
+ * `defaultHidden` keeps the saved list, which shows it.
553
+ */
554
+ defaultHidden?: boolean;
541
555
  /**
542
556
  * Set `false` to keep this column out of a CSV export. Use it for
543
557
  * columns that only make sense on screen — a thumbnail, a rendered
544
558
  * badge with no underlying value. Defaults to exported.
545
559
  */
546
560
  exportable?: boolean;
561
+ /**
562
+ * The value this column writes to a CSV export, given the row. Use it
563
+ * where the screen shows a label composed from codes (a kind plus its
564
+ * rule), so the file says what the screen said. It wins over the
565
+ * built-in reference lookup and raw value; `null`/`undefined` become an
566
+ * empty cell.
567
+ */
568
+ exportValue?: (row: any) => unknown;
547
569
  /** Inline CSS width (e.g. `'40px'`, `'15%'`). */
548
570
  width?: string;
549
571
  /** Extra CSS classes to apply on the `<td>` (e.g. `'num'`). */
@@ -608,6 +630,13 @@ interface EfDataCardExportRequest {
608
630
  resolveCell: (row: unknown, col: EfDataCardColumn) => unknown;
609
631
  }
610
632
 
633
+ /**
634
+ * What a search screen may add to its delete confirmation: the copy, the
635
+ * name, the params. `accept` and `reject` stay with the base, so the
636
+ * delete call, the `errors` handling, the new search and the toast are
637
+ * the same on every screen.
638
+ */
639
+ type EfDeleteConfirmOptions = Partial<Omit<EfConfirmOptions, 'accept' | 'reject' | 'intent'>>;
611
640
  /**
612
641
  * Declarative definition of an advanced-search select filter rendered in
613
642
  * the filter drawer. One `<ef-select>` is rendered per entry; the screen
@@ -662,6 +691,15 @@ interface AdvancedSelectFilter {
662
691
  declare abstract class AbstractSearchScreenV2<TItem = any> extends AbstractScreenComponent implements OnInit {
663
692
  protected readonly screenState = ScreenStateEnum.SEARCH;
664
693
  protected readonly injector: Injector;
694
+ private readonly destroyRef;
695
+ /**
696
+ * A delete confirm is loading or open. A second click (or the row
697
+ * shortcut) meanwhile is ignored, so one gesture cannot start two impact
698
+ * reads or stack two confirms. Cleared when the confirm is answered
699
+ * (PrimeNG calls reject on close and Escape too) or when the read
700
+ * yields no confirm.
701
+ */
702
+ private deleteConfirmBusy;
665
703
  private serviceInstance;
666
704
  /**
667
705
  * Translate lazily, through the injector.
@@ -929,7 +967,33 @@ declare abstract class AbstractSearchScreenV2<TItem = any> extends AbstractScree
929
967
  * ```
930
968
  */
931
969
  protected getDeleteConfirmName(_id: any): string | undefined;
970
+ /**
971
+ * Async details for the delete confirmation, read before it opens. Use
972
+ * it when the confirm has to say what the delete will take with it, such
973
+ * as how many products lose a collection:
974
+ *
975
+ * ```ts
976
+ * protected override getDeleteConfirmOptions(id: any) {
977
+ * return this.collectionsClient.deleteImpact(id).pipe(
978
+ * map(impact => ({
979
+ * messageKey: impact.onHome ? 'x_delete_message_home' : 'x_delete_message',
980
+ * messageParams: { count: impact.productCount ?? 0 },
981
+ * })),
982
+ * );
983
+ * }
984
+ * ```
985
+ *
986
+ * The returned options are merged over `{ intent: 'delete', name:
987
+ * getDeleteConfirmName(id) }`. Only the first value of an Observable is
988
+ * used. If the read fails (the HTTP interceptor toasts it) or completes
989
+ * without a value, no confirm opens and nothing is deleted. Return
990
+ * `undefined`, the default, to open the confirm at once. While the read
991
+ * is in flight or the confirm is open, another delete is ignored, and a
992
+ * screen destroyed during the read opens nothing.
993
+ */
994
+ protected getDeleteConfirmOptions(_id: any): Observable<EfDeleteConfirmOptions> | Promise<EfDeleteConfirmOptions> | undefined;
932
995
  delete(id: any): void;
996
+ private openDeleteConfirm;
933
997
  duplicate(id: any): void;
934
998
  ngOnDestroy(): void;
935
999
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AbstractSearchScreenV2<any>, never>;
@@ -977,6 +1041,9 @@ interface EfDetailToolbarAction {
977
1041
  visible?: boolean;
978
1042
  /** Disable without removing. */
979
1043
  disabled?: boolean;
1044
+ /** Translation key saying why the action is disabled; shown in the
1045
+ * phone overflow menu under the label and as its description. */
1046
+ disabledReasonKey?: string;
980
1047
  /**
981
1048
  * If set, the action is hidden unless the bound `ScreenContext`
982
1049
  * grants this permission. Actions with no `permission` always
@@ -1427,4 +1494,4 @@ declare class ViewModelEntity extends AbstractEntity {
1427
1494
  type EfSearchToolbarAction = EfDetailToolbarAction;
1428
1495
 
1429
1496
  export { AUDIT_HISTORY_SERVICE, AbstractComponent, AbstractDetailScreenComponent, AbstractDetailScreenV2, AbstractEntity, AbstractReportScreenV2, AbstractScreenComponent, AbstractSearchScreenComponent, AbstractSearchScreenV2, AbstractSubScreenComponent, AbstractSubScreenV2, PaginationEnum, SCREEN_REF_DATA_SERVICE, ScreenConfig, ScreenContext, ScreenStateEnum, SearchEntity, SortDirectionEnum, StateUtilsEnum, ViewModelEntity };
1430
- export type { ActiveFilter, AdvancedSelectFilter, AuditHistoryService, DefaultSort, EfBoundedDateRange, EfDataCardColumn, EfDataCardColumnAlign, EfDataCardColumnMobileRole, EfDataCardColumnType, EfDataCardExportRequest, EfDataCardSort, EfDataCardSortDirection, EfDatePresetKey, EfDateRange, EfDetailToolbarAction, EfReferenceColumnOpts, EfSearchToolbarAction, LoadOptions, ReferenceDataProvider, ReportWidget, ReportWidgetStatus, ScreenDatatableColumn, ScreenReferenceDataService };
1497
+ export type { ActiveFilter, AdvancedSelectFilter, AuditHistoryService, DefaultSort, EfBoundedDateRange, EfDataCardColumn, EfDataCardColumnAlign, EfDataCardColumnMobileRole, EfDataCardColumnType, EfDataCardExportRequest, EfDataCardSort, EfDataCardSortDirection, EfDatePresetKey, EfDateRange, EfDeleteConfirmOptions, EfDetailToolbarAction, EfReferenceColumnOpts, EfSearchToolbarAction, LoadOptions, ReferenceDataProvider, ReportWidget, ReportWidgetStatus, ScreenDatatableColumn, ScreenReferenceDataService };