@sumaris-net/ngx-components 18.22.23 → 18.23.0-beta.0

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.
Files changed (25) hide show
  1. package/doc/changelog.md +9 -0
  2. package/esm2022/src/app/core/table/column/actions-column.component.mjs +1 -1
  3. package/esm2022/src/app/core/table/table.pipes.mjs +6 -7
  4. package/esm2022/src/app/core/table/testing/table.testing.module.mjs +25 -4
  5. package/esm2022/src/app/core/table/testing/table2.testing.mjs +63 -15
  6. package/esm2022/src/app/shared/directives/cell-selection/cell-identifier.directive.mjs +41 -0
  7. package/esm2022/src/app/shared/directives/cell-selection/cell-selection.directive.mjs +201 -0
  8. package/esm2022/src/app/shared/directives/cell-selection/cell-selection.service.mjs +180 -0
  9. package/esm2022/src/app/shared/functions.mjs +1 -1
  10. package/esm2022/src/app/shared/material/datetime/material.date.mjs +4 -2
  11. package/esm2022/src/app/shared/material/datetime/material.datetime.mjs +5 -2
  12. package/esm2022/src/app/social/feed/feed.component.mjs +3 -3
  13. package/fesm2022/sumaris-net.ngx-components.mjs +495 -19
  14. package/fesm2022/sumaris-net.ngx-components.mjs.map +1 -1
  15. package/package.json +1 -1
  16. package/src/app/core/table/column/actions-column.component.d.ts +1 -1
  17. package/src/app/core/table/table.pipes.d.ts +2 -1
  18. package/src/app/core/table/testing/table.testing.module.d.ts +3 -1
  19. package/src/app/core/table/testing/table2.testing.d.ts +7 -3
  20. package/src/app/shared/directives/cell-selection/cell-identifier.directive.d.ts +15 -0
  21. package/src/app/shared/directives/cell-selection/cell-selection.directive.d.ts +28 -0
  22. package/src/app/shared/directives/cell-selection/cell-selection.service.d.ts +62 -0
  23. package/src/app/shared/functions.d.ts +1 -1
  24. package/src/app/shared/inputs.d.ts +1 -1
  25. package/src/theme/_ngx-components.table.scss +45 -2
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sumaris-net/ngx-components",
3
3
  "description": "SUMARiS Angular components",
4
- "version": "18.22.23",
4
+ "version": "18.23.0-beta.0",
5
5
  "author": "contact@e-is.pro",
6
6
  "license": "AGPL-3.0",
7
7
  "readmeFilename": "README.md",
@@ -3,7 +3,7 @@ import { AsyncTableElement, TableElement } from '@e-is/ngx-material-table';
3
3
  import { MatColumnDef, MatTable } from '@angular/material/table';
4
4
  import { MatMenuTrigger } from '@angular/material/menu';
5
5
  import * as i0 from "@angular/core";
6
- export declare class ActionsColumnComponent<T extends TableElement<any> | AsyncTableElement<any> = TableElement<any>> implements OnInit, OnDestroy {
6
+ export declare class ActionsColumnComponent<T extends TableElement<any> | AsyncTableElement<any>> implements OnInit, OnDestroy {
7
7
  private table;
8
8
  private cd;
9
9
  columnDef: MatColumnDef;
@@ -6,10 +6,11 @@ import { Subscription } from 'rxjs';
6
6
  import { AppAsyncTable } from './async-table.class';
7
7
  import * as i0 from "@angular/core";
8
8
  export type AppTableRowCountProperty = 'visibleRowCount' | 'totalRowCount';
9
- export declare abstract class AbstractTableSelectionPipe<R, O, T extends AppTable<any> | AppAsyncTable<any> = AppTable<any> | AppAsyncTable<any>> extends AbstractSelectionModelPipe<any, R, O> {
9
+ export declare abstract class AbstractTableSelectionPipe<R, O, T extends AppTable<any> | AppAsyncTable<any> = AppTable<any> | AppAsyncTable<any>> extends AbstractSelectionModelPipe<any, R, O> implements PipeTransform, OnDestroy {
10
10
  private _onRowsChanges;
11
11
  protected constructor(_ref: ChangeDetectorRef);
12
12
  transform(selectionOrTable: SelectionModel<any> | T, tableOrOpts?: T | O, opts?: O): R;
13
+ private isTable;
13
14
  protected _subscribe(selection: SelectionModel<any>, table?: T, opts?: O): Subscription;
14
15
  protected _dispose(): void;
15
16
  static ɵfac: i0.ɵɵFactoryDeclaration<AbstractTableSelectionPipe<any, any, any>, never>;
@@ -7,8 +7,10 @@ import * as i5 from "../../core.module";
7
7
  import * as i6 from "@ngx-translate/core";
8
8
  import * as i7 from "@angular/forms";
9
9
  import * as i8 from "../../../shared/directives/resizable/resizable.module";
10
+ import * as i9 from "../../../shared/directives/cell-selection/cell-identifier.directive";
11
+ import * as i10 from "../../../shared/directives/cell-selection/cell-selection.directive";
10
12
  export declare class TableTestingModule {
11
13
  static ɵfac: i0.ɵɵFactoryDeclaration<TableTestingModule, never>;
12
- static ɵmod: i0.ɵɵNgModuleDeclaration<TableTestingModule, [typeof i1.TableTestPage, typeof i2.Table2TestPage], [typeof i3.CommonModule, typeof i4.SharedModule, typeof i5.CoreModule, typeof i6.TranslateModule, typeof i7.FormsModule, typeof i8.ResizableModule], [typeof i1.TableTestPage, typeof i2.Table2TestPage, typeof i6.TranslateModule]>;
14
+ static ɵmod: i0.ɵɵNgModuleDeclaration<TableTestingModule, [typeof i1.TableTestPage, typeof i2.Table2TestPage], [typeof i3.CommonModule, typeof i4.SharedModule, typeof i5.CoreModule, typeof i6.TranslateModule, typeof i7.FormsModule, typeof i8.ResizableModule, typeof i9.CellIdentifierDirective, typeof i10.CellSelectionDirective], [typeof i1.TableTestPage, typeof i2.Table2TestPage, typeof i6.TranslateModule]>;
13
15
  static ɵinj: i0.ɵɵInjectorDeclaration<TableTestingModule>;
14
16
  }
@@ -1,5 +1,4 @@
1
1
  import { AfterViewInit, Injector, OnDestroy, OnInit } from '@angular/core';
2
- import { AppTable } from '../table.class';
3
2
  import { Referential } from '../../services/model/referential.model';
4
3
  import { IonInfiniteScroll } from '@ionic/angular';
5
4
  import { InMemoryEntitiesService } from '../../../shared/services/memory-entity-service.class';
@@ -7,8 +6,10 @@ import { AppValidatorService } from '../../services/validator/base.validator.cla
7
6
  import { AbstractControl, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
8
7
  import { ReferentialFilter } from '../../services/testing/referential-filter.model';
9
8
  import { MatExpansionPanel } from '@angular/material/expansion';
9
+ import { AppAsyncTable } from '../async-table.class';
10
+ import { CellSelectionEvent, ICellId } from '../../../shared/directives/cell-selection/cell-selection.service';
10
11
  import * as i0 from "@angular/core";
11
- export declare class Table2TestPage extends AppTable<Referential, ReferentialFilter> implements OnInit, OnDestroy, AfterViewInit {
12
+ export declare class Table2TestPage extends AppAsyncTable<Referential, ReferentialFilter> implements OnInit, OnDestroy, AfterViewInit {
12
13
  protected validatorService: AppValidatorService;
13
14
  protected formBuilder: UntypedFormBuilder;
14
15
  static readonly maxRowCount = 100;
@@ -26,6 +27,7 @@ export declare class Table2TestPage extends AppTable<Referential, ReferentialFil
26
27
  get hasMoreData(): boolean;
27
28
  filterExpansionPanel: MatExpansionPanel;
28
29
  infiniteScroll: IonInfiniteScroll;
30
+ protected readonly selectableColumns: string[];
29
31
  get dataService(): InMemoryEntitiesService<Referential>;
30
32
  constructor(injector: Injector, validatorService: AppValidatorService, formBuilder: UntypedFormBuilder);
31
33
  ngOnInit(): void;
@@ -41,8 +43,10 @@ export declare class Table2TestPage extends AppTable<Referential, ReferentialFil
41
43
  toggleFilterPanelFloating(): void;
42
44
  applyFilterAndClosePanel(event?: Event): void;
43
45
  closeFilterPanel(): void;
44
- resetFilter(_?: Event): void;
46
+ resetFilter(event?: Event): Promise<void>;
45
47
  protected generateData(offset?: number, size?: number): Referential[];
48
+ protected onCellSelectionChange(event: CellSelectionEvent<ICellId>): void;
49
+ protected onCellRightClick(event: MouseEvent): void;
46
50
  static ɵfac: i0.ɵɵFactoryDeclaration<Table2TestPage, never>;
47
51
  static ɵcmp: i0.ɵɵComponentDeclaration<Table2TestPage, "app-table2-testing", never, { "filterPanelFloating": { "alias": "filterPanelFloating"; "required": false; }; "sticky": { "alias": "sticky"; "required": false; }; "stickyEnd": { "alias": "stickyEnd"; "required": false; }; }, {}, never, ["[suffix]"], false, never>;
48
52
  }
@@ -0,0 +1,15 @@
1
+ import { OnInit } from '@angular/core';
2
+ import { ICellId } from './cell-selection.service';
3
+ import * as i0 from "@angular/core";
4
+ export declare class CellIdentifierDirective<C extends ICellId = ICellId> implements OnInit {
5
+ cellId: import("@angular/core").InputSignal<C>;
6
+ protected isCellSelected: boolean;
7
+ protected isDragging: boolean;
8
+ private readonly service;
9
+ private readonly destroyRef;
10
+ ngOnInit(): void;
11
+ protected handleMouseDown(event: MouseEvent): Promise<void>;
12
+ protected handleMouseEnter(event: MouseEvent): Promise<void>;
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<CellIdentifierDirective<any>, never>;
14
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CellIdentifierDirective<any>, "[appCellId]", never, { "cellId": { "alias": "appCellId"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
15
+ }
@@ -0,0 +1,28 @@
1
+ import { OnInit } from '@angular/core';
2
+ import { CellSelectionEvent, ICellId } from './cell-selection.service';
3
+ import * as i0 from "@angular/core";
4
+ export declare class CellSelectionDirective<C extends ICellId = ICellId> implements OnInit {
5
+ selectableColumns: import("@angular/core").InputSignal<string[]>;
6
+ selectionChange: import("@angular/core").OutputEmitterRef<CellSelectionEvent<C>>;
7
+ rightClick: import("@angular/core").OutputEmitterRef<MouseEvent>;
8
+ protected service: import("./cell-selection.service").CellSelectionService<ICellId>;
9
+ private readonly elementRef;
10
+ private readonly renderer;
11
+ private readonly destroyRef;
12
+ private overlayElements;
13
+ constructor();
14
+ ngOnInit(): void;
15
+ private setupServiceConfiguration;
16
+ private setupGlobalMouseEvents;
17
+ private setupCopyListener;
18
+ addCellsOverlay(cells: C[]): void;
19
+ removeCellsOverlay(): void;
20
+ private groupContiguousCells;
21
+ private getAdjacentCells;
22
+ private getNextColumnName;
23
+ private getCellKey;
24
+ private calculateSelectionBounds;
25
+ private createOverlayElement;
26
+ static ɵfac: i0.ɵɵFactoryDeclaration<CellSelectionDirective<any>, never>;
27
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CellSelectionDirective<any>, "[appCellSelection]", never, { "selectableColumns": { "alias": "appSelectableColumns"; "required": true; "isSignal": true; }; }, { "selectionChange": "appCellSelectionChange"; "rightClick": "appCellRightClick"; }, never, never, true, never>;
28
+ }
@@ -0,0 +1,62 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { Subject } from 'rxjs';
3
+ import { EqualsFn } from '../../types';
4
+ import * as i0 from "@angular/core";
5
+ export declare const APP_CELL_SELECTION_SERVICE_TOKEN: InjectionToken<CellSelectionService<ICellId>>;
6
+ export declare const APP_CELL_SELECTION_SERVICE_CONFIG_TOKEN: InjectionToken<CellSelectionServiceConfig<any>>;
7
+ export interface ICellId {
8
+ rowId: number;
9
+ columnName: string;
10
+ }
11
+ export interface CellSelectionEvent<C extends ICellId> {
12
+ selectedCells: C[];
13
+ isRangeSelection: boolean;
14
+ isToggleSelection: boolean;
15
+ }
16
+ export interface CellSelectionServiceConfig<C extends ICellId> {
17
+ equals: EqualsFn<C>;
18
+ new: (cellId: ICellId) => C;
19
+ }
20
+ /**
21
+ * Service to manage cell selection state across multiple directive instances.
22
+ * This service should be provided at the component level (not root) to ensure
23
+ * proper isolation between different table instances.
24
+ */
25
+ export declare class CellSelectionService<C extends ICellId = ICellId> {
26
+ config: CellSelectionServiceConfig<any>;
27
+ selectableColumns: string[];
28
+ selectedCells: C[];
29
+ private selectionStartCell;
30
+ private isSelecting;
31
+ draggedCells: C[];
32
+ private dragStartCell;
33
+ private isDragging;
34
+ readonly selectionChangeSubject: Subject<CellSelectionEvent<C>>;
35
+ readonly selectionRightClickSubject: Subject<MouseEvent>;
36
+ private readonly _equals;
37
+ private readonly _new;
38
+ constructor();
39
+ equals(cell1: C, cell2: C): boolean;
40
+ new(cellId: ICellId): C;
41
+ isCellSelected(cellId: C): boolean;
42
+ isCellDragged(cellId: C): boolean;
43
+ handleCellMouseDown(event: MouseEvent, cellId: C): Promise<void>;
44
+ handleCellMouseEnter(event: MouseEvent, cellId: C): Promise<void>;
45
+ endMouseMove(): void;
46
+ private startSelection;
47
+ private startDragSelection;
48
+ private toggleCellSelection;
49
+ private selectRange;
50
+ private updateSelection;
51
+ private updateDraggedCells;
52
+ private emitSelection;
53
+ calculateRangeCells(endCell: C): C[];
54
+ calculateRangeBetweenCells(startCell: C, endCell: C): C[];
55
+ resetSelectionState(): void;
56
+ resetDragState(): void;
57
+ private findFirstSelectedCell;
58
+ private findLastSelectedCell;
59
+ private findSelectedCell;
60
+ static ɵfac: i0.ɵɵFactoryDeclaration<CellSelectionService<any>, never>;
61
+ static ɵprov: i0.ɵɵInjectableDeclaration<CellSelectionService<any>>;
62
+ }
@@ -6,7 +6,7 @@ export declare function isNotNil<T>(obj: T | null | undefined): boolean;
6
6
  export declare function isNotNilOrBlank<T>(obj: T | null | undefined): boolean;
7
7
  export declare function isNotNilOrNaN<T>(obj: T | null | undefined): boolean;
8
8
  export declare function isNilOrNaN<T>(obj: T | null | undefined): boolean;
9
- export declare function isNotEmptyArray<T>(obj: T[] | null | undefined): boolean;
9
+ export declare function isNotEmptyArray<T>(obj: T[] | readonly T[] | null | undefined): boolean;
10
10
  export declare function firstArrayValue<T>(obj: T[] | null | undefined): T | undefined;
11
11
  export declare function lastArrayValue<T>(obj: T[] | null | undefined): T | undefined;
12
12
  export declare function isEmptyArray<T>(obj: T[] | null | undefined): boolean;
@@ -17,7 +17,7 @@ export interface InputElement extends FocusableElement {
17
17
  }
18
18
  export declare function isInputElement(object: any): object is InputElement;
19
19
  export declare function asInputElement<T = any>(object: ElementRef<T>): InputElement | undefined;
20
- export declare function tabindexComparator(a: InputElement, b: InputElement): 1 | 0 | -1;
20
+ export declare function tabindexComparator(a: InputElement, b: InputElement): 0 | 1 | -1;
21
21
  export interface CanGainFocusOptions {
22
22
  minTabindex?: number;
23
23
  maxTabindex?: number;
@@ -249,7 +249,6 @@
249
249
 
250
250
  .mat-mdc-row,
251
251
  .mat-mdc-footer-row {
252
-
253
252
  // Disabled row
254
253
  &.mat-mdc-row-disabled *,
255
254
  &.mat-row-disabled * {
@@ -550,8 +549,52 @@
550
549
  border-bottom-width: var(--mat-table-row-item-outline-width, 1px) !important;
551
550
  border-bottom-style: solid !important;
552
551
  }
553
- }
554
552
 
553
+ // Cell selection
554
+ td.cell-selected {
555
+ background-color: rgba(102, 51, 153, 0.2) !important;
556
+ }
557
+
558
+ td.cell-dragging {
559
+ background-color: rgba(102, 51, 153, 0.3) !important;
560
+ }
561
+
562
+ div.cell-selection-overlay {
563
+ --border-color: var(--ion-color-accent, gray);
564
+ position: absolute;
565
+ z-index: 5;
566
+ animation: linearGradientMove 0.3s infinite linear;
567
+ background:
568
+ linear-gradient(90deg, var(--border-color) 50%, transparent 0) repeat-x,
569
+ linear-gradient(90deg, var(--border-color) 50%, transparent 0) repeat-x,
570
+ linear-gradient(0deg, var(--border-color) 50%, transparent 0) repeat-y,
571
+ linear-gradient(0deg, var(--border-color) 50%, transparent 0) repeat-y;
572
+ background-size:
573
+ 4px 2px,
574
+ 4px 2px,
575
+ 2px 4px,
576
+ 2px 4px;
577
+ background-position:
578
+ 0 0,
579
+ 0 100%,
580
+ 0 0,
581
+ 100% 0;
582
+ background-color: unset;
583
+ box-sizing: border-box;
584
+ pointer-events: none;
585
+ }
586
+
587
+ // Animated dashed border keyframes
588
+ @keyframes linearGradientMove {
589
+ 100% {
590
+ background-position:
591
+ 4px 0,
592
+ -4px 100%,
593
+ 0 -4px,
594
+ 100% 4px;
595
+ }
596
+ }
597
+ }
555
598
 
556
599
  // Paginator
557
600
  .mat-mdc-paginator {