ngx-aur-mat-table 17.2.2-2 → 17.2.2-21
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/esm2022/lib/drag-drop/aur-drag-drop-component.mjs +1 -1
- package/esm2022/lib/drag-drop/aur-drag-drop.manager.mjs +85 -54
- package/esm2022/lib/drag-drop/can-drop-manager.mjs +29 -0
- package/esm2022/lib/drag-drop/drag-drop-mapping-manager.mjs +29 -0
- package/esm2022/lib/drag-drop/drag-preview-manager.mjs +39 -0
- package/esm2022/lib/drag-drop/model/aur-drag-drop-mapping.mjs +2 -0
- package/esm2022/lib/drag-drop/model/aur-drag-preview-component.mjs +2 -0
- package/esm2022/lib/model/ColumnConfig.mjs +1 -1
- package/esm2022/lib/ngx-aur-mat-table.component.mjs +21 -14
- package/esm2022/lib/providers/DragDropProvider.mjs +11 -7
- package/esm2022/lib/providers/SelectionProvider.mjs +4 -1
- package/esm2022/lib/providers/TotalRowProvider.mjs +4 -3
- package/esm2022/public-api.mjs +4 -2
- package/fesm2022/ngx-aur-mat-table.mjs +203 -63
- package/fesm2022/ngx-aur-mat-table.mjs.map +1 -1
- package/lib/drag-drop/aur-drag-drop-component.d.ts +1 -1
- package/lib/drag-drop/aur-drag-drop.manager.d.ts +55 -56
- package/lib/drag-drop/can-drop-manager.d.ts +8 -0
- package/lib/drag-drop/drag-drop-mapping-manager.d.ts +9 -0
- package/lib/drag-drop/drag-preview-manager.d.ts +11 -0
- package/lib/drag-drop/model/aur-drag-drop-mapping.d.ts +44 -0
- package/lib/drag-drop/model/aur-drag-preview-component.d.ts +13 -0
- package/lib/model/ColumnConfig.d.ts +6 -1
- package/lib/ngx-aur-mat-table.component.d.ts +5 -3
- package/lib/providers/DragDropProvider.d.ts +9 -7
- package/lib/providers/SelectionProvider.d.ts +1 -0
- package/package.json +1 -1
- package/public-api.d.ts +3 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export interface AurDragDropComponent<T> {
|
|
2
2
|
onDragStart($event: DragEvent, data: T): void;
|
|
3
|
-
onDragOver($event: DragEvent): void;
|
|
3
|
+
onDragOver($event: DragEvent, data: T): void;
|
|
4
4
|
onDrop($event: DragEvent, data: T): void;
|
|
5
5
|
onDragEnd($event: DragEvent, data: T): void;
|
|
6
6
|
}
|
|
@@ -1,68 +1,67 @@
|
|
|
1
|
+
import { ViewContainerRef } from "@angular/core";
|
|
2
|
+
import { AurDragDropMapping, AurDragPreviewMappings } from "./model/aur-drag-drop-mapping";
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* and the target component (where data is dropped), as well as the functions that handle
|
|
5
|
-
* the grabbing and dropping of data.
|
|
6
|
-
*
|
|
7
|
-
* @template SOURCE - The type of data used by the source component.
|
|
8
|
-
* @template TARGET - The type of data used by the target component.
|
|
4
|
+
* Manages the drag-and-drop process, including start, drop, and end events.
|
|
5
|
+
* Handles drag previews, drop validation, and dataset updates after a successful drop.
|
|
9
6
|
*/
|
|
10
|
-
export
|
|
7
|
+
export declare class AurDragDropManager {
|
|
8
|
+
private mappings;
|
|
9
|
+
private previewMappings;
|
|
11
10
|
/**
|
|
12
|
-
*
|
|
13
|
-
* This represents the component that allows a user to initiate a grab action.
|
|
11
|
+
* Manages drop validation logic
|
|
14
12
|
*/
|
|
15
|
-
readonly
|
|
13
|
+
private readonly canDropManager;
|
|
16
14
|
/**
|
|
17
|
-
*
|
|
18
|
-
* This represents the component that accepts the drop action.
|
|
15
|
+
* Manages drag preview rendering
|
|
19
16
|
*/
|
|
20
|
-
readonly
|
|
17
|
+
private readonly previewManager;
|
|
21
18
|
/**
|
|
22
|
-
*
|
|
23
|
-
* It is invoked after a drop has occurred, and it describes what should
|
|
24
|
-
* happen to the data in the source table.
|
|
25
|
-
*
|
|
26
|
-
* @param ctx - The grab context containing information about the source and target.
|
|
27
|
-
* @returns An array of data elements of type SOURCE.
|
|
19
|
+
* Manages source-target mappings
|
|
28
20
|
*/
|
|
29
|
-
readonly
|
|
21
|
+
private readonly mappingManager;
|
|
30
22
|
/**
|
|
31
|
-
*
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*
|
|
36
|
-
|
|
23
|
+
* Holds info about the current drag operation
|
|
24
|
+
*/
|
|
25
|
+
private startDragEvent?;
|
|
26
|
+
/**
|
|
27
|
+
* Holds info about the current drop operation
|
|
28
|
+
*/
|
|
29
|
+
private dropEvent?;
|
|
30
|
+
/**
|
|
31
|
+
* Creates an empty instance of AurDragDropManager.
|
|
32
|
+
* @returns {AurDragDropManager} - An empty manager with no initialized references.
|
|
37
33
|
*/
|
|
38
|
-
readonly dropFn: (ctx: DropContext<SOURCE, TARGET>) => TARGET[];
|
|
39
|
-
}
|
|
40
|
-
export interface grabContext<SOURCE, TARGET> {
|
|
41
|
-
readonly sourceName: string;
|
|
42
|
-
readonly sourceData: SOURCE;
|
|
43
|
-
readonly sourceDataset: SOURCE[];
|
|
44
|
-
readonly targetName: string;
|
|
45
|
-
readonly targetData: TARGET;
|
|
46
|
-
}
|
|
47
|
-
export interface DropContext<SOURCE, TARGET> {
|
|
48
|
-
readonly sourceName: string;
|
|
49
|
-
readonly sourceData: SOURCE;
|
|
50
|
-
readonly targetDataset: TARGET[];
|
|
51
|
-
readonly targetName: string;
|
|
52
|
-
readonly targetData: TARGET;
|
|
53
|
-
}
|
|
54
|
-
export declare class AurDragDropManager {
|
|
55
|
-
private mappings;
|
|
56
|
-
private dragStartCtx;
|
|
57
|
-
private dragEndCtx;
|
|
58
|
-
private canDropStorage;
|
|
59
|
-
constructor(mappings: AurDragDropMapping<any, any>[]);
|
|
60
|
-
startDrag(targetName: string, data: any): void;
|
|
61
|
-
endDrag(sourceDataset: any[]): any[];
|
|
62
|
-
endDragInternal(grabCtx: grabContext<any, any>): any[];
|
|
63
|
-
canDrop(tableName: string, $event: DragEvent): void;
|
|
64
|
-
onDrop(targetDataset: any[], targetName: string, targetData: any): any[];
|
|
65
|
-
onDropInternal(dropCtx: DropContext<any, any>): any[];
|
|
66
|
-
get draggableTableNames(): string[];
|
|
67
34
|
static empty(): AurDragDropManager;
|
|
35
|
+
constructor(viewContainerRef: ViewContainerRef, mappings: AurDragDropMapping<any, any>[], previewMappings: AurDragPreviewMappings<any>[]);
|
|
36
|
+
/**
|
|
37
|
+
* Returns the list of all available draggable source names.
|
|
38
|
+
* @returns {string[]} - Array of source names.
|
|
39
|
+
*/
|
|
40
|
+
get draggableSourceNames(): string[];
|
|
41
|
+
/**
|
|
42
|
+
* Initiates a drag operation, saving the context and showing a drag preview.
|
|
43
|
+
* @param {string} sourceName - The name of the drag source.
|
|
44
|
+
* @param {unknown[]} draggedData - The data being dragged.
|
|
45
|
+
* @param {DragEvent} event - The drag event.
|
|
46
|
+
* @throws Error if a drag is already in progress.
|
|
47
|
+
*/
|
|
48
|
+
startDrag(sourceName: string, draggedData: unknown[], event: DragEvent): void;
|
|
49
|
+
/**
|
|
50
|
+
* Validates whether a drop is allowed on the target element by calling preventDefault.
|
|
51
|
+
* @param {string} targetName - The name of the target element.
|
|
52
|
+
* @param {DragEvent} event - The drag event.
|
|
53
|
+
*/
|
|
54
|
+
canDropPreventDefault(targetName: string, event: DragEvent): void;
|
|
55
|
+
/**
|
|
56
|
+
* Executes the drop operation on the specified target.
|
|
57
|
+
* @param {string} targetName - The name of the target element.
|
|
58
|
+
* @param {any} targetData - The data for the target element.
|
|
59
|
+
*/
|
|
60
|
+
drop(targetName: string, targetData: any): void;
|
|
61
|
+
/**
|
|
62
|
+
* Ends the drag operation and updates the dataset if the drop was successful.
|
|
63
|
+
*/
|
|
64
|
+
endDrag(): void;
|
|
65
|
+
private buildDropContext;
|
|
66
|
+
private getMapping;
|
|
68
67
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AurDragDropMapping } from "./model/aur-drag-drop-mapping";
|
|
2
|
+
export declare class CanDropManager {
|
|
3
|
+
private canDropStorage;
|
|
4
|
+
constructor(mappings: AurDragDropMapping<any, any>[]);
|
|
5
|
+
private fillStorage;
|
|
6
|
+
canDrop(sourceName: string | undefined, targetName: string | undefined): boolean;
|
|
7
|
+
dropPreventDefault(sourceName: string | undefined, targetName: string, $event: DragEvent): boolean;
|
|
8
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AurDragDropMapping } from "./model/aur-drag-drop-mapping";
|
|
2
|
+
export declare class DragDropMappingManager {
|
|
3
|
+
private readonly mappingsStorage;
|
|
4
|
+
constructor(mappings: AurDragDropMapping<any, any>[]);
|
|
5
|
+
get(sourceName: string, targetName: string): AurDragDropMapping<any, any>;
|
|
6
|
+
private fillStorage;
|
|
7
|
+
private buildKeyForMapping;
|
|
8
|
+
private buildKey;
|
|
9
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ViewContainerRef } from "@angular/core";
|
|
2
|
+
import { AurDragPreviewMappings } from "./model/aur-drag-drop-mapping";
|
|
3
|
+
export declare class DragPreviewManager {
|
|
4
|
+
private viewContainerRef;
|
|
5
|
+
private readonly previewStorage;
|
|
6
|
+
private currentPreviewComponentRef;
|
|
7
|
+
constructor(viewContainerRef: ViewContainerRef, mappings: AurDragPreviewMappings<any>[]);
|
|
8
|
+
private fillStorage;
|
|
9
|
+
showPreview(sourceName: string, event: DragEvent, draggedData: unknown[]): void;
|
|
10
|
+
removePreview(): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
import { AurDragPreviewComponent } from "./aur-drag-preview-component";
|
|
3
|
+
export interface AurDragPreviewMappings<SOURCE> {
|
|
4
|
+
sourceName: string;
|
|
5
|
+
readonly preview?: new () => AurDragPreviewComponent<SOURCE>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Interface representing the mapping configuration for drag-and-drop functionality
|
|
9
|
+
* between components. It defines the source component (from where data is grabbed)
|
|
10
|
+
* and the target component (where data is dropped), as well as the functions that handle
|
|
11
|
+
* the grabbing and dropping of data.
|
|
12
|
+
*
|
|
13
|
+
* @template SOURCE - The type of data used by the source component.
|
|
14
|
+
* @template TARGET - The type of data used by the target component.
|
|
15
|
+
*/
|
|
16
|
+
export interface AurDragDropMapping<SOURCE, TARGET> {
|
|
17
|
+
/**
|
|
18
|
+
* The name of the source component from which data can be grabbed.
|
|
19
|
+
* This represents the component that allows a user to initiate a grab action.
|
|
20
|
+
*/
|
|
21
|
+
readonly sourceName: string;
|
|
22
|
+
/**
|
|
23
|
+
* The name of the target component where the data can be dropped.
|
|
24
|
+
* This represents the component that accepts the drop action.
|
|
25
|
+
*/
|
|
26
|
+
readonly targetName: string;
|
|
27
|
+
/**
|
|
28
|
+
* Function called to handle the drop action in the target component.
|
|
29
|
+
* It is invoked when the drop event occurs, and it describes how to process
|
|
30
|
+
* the data into the target component.
|
|
31
|
+
*
|
|
32
|
+
* @param ctx - The drop context containing information about the source and target.
|
|
33
|
+
* @returns An array of data elements of type TARGET.
|
|
34
|
+
*/
|
|
35
|
+
readonly afterDropFn: (ctx: DropContext<SOURCE, TARGET>) => Observable<AurDropResult>;
|
|
36
|
+
}
|
|
37
|
+
export interface AurDropResult {
|
|
38
|
+
}
|
|
39
|
+
export interface DropContext<SOURCE, TARGET> {
|
|
40
|
+
readonly sourceName: string;
|
|
41
|
+
readonly sourceData: SOURCE[];
|
|
42
|
+
readonly targetName: string;
|
|
43
|
+
readonly targetData: TARGET;
|
|
44
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Общий интерфейс для компонентов, которые используются в качестве превью
|
|
3
|
+
* для перетаскивания данных. Это обеспечивает стандартный способ передачи
|
|
4
|
+
* данных в такие компоненты.
|
|
5
|
+
*
|
|
6
|
+
* @template DATA - Тип данных, которые будут переданы в компонент для превью.
|
|
7
|
+
*/
|
|
8
|
+
export interface AurDragPreviewComponent<DATA> {
|
|
9
|
+
/**
|
|
10
|
+
* Данные, которые будут отображаться в компоненте превью.
|
|
11
|
+
*/
|
|
12
|
+
data: DATA[];
|
|
13
|
+
}
|
|
@@ -34,6 +34,7 @@ export interface TableConfig<T> {
|
|
|
34
34
|
tableView?: TableView;
|
|
35
35
|
tableHeaderButtonCfg?: TableHeaderButtonConfig;
|
|
36
36
|
dragCfg?: DragDropConfig;
|
|
37
|
+
totalRowCfg?: TotalRowConfig;
|
|
37
38
|
}
|
|
38
39
|
export interface ClickConfig {
|
|
39
40
|
/**
|
|
@@ -158,7 +159,6 @@ export interface TableView {
|
|
|
158
159
|
height?: string;
|
|
159
160
|
minHeight?: string;
|
|
160
161
|
maxHeight?: string;
|
|
161
|
-
totalRowView?: TotalRowView;
|
|
162
162
|
}
|
|
163
163
|
export interface TableHeaderButtonConfig {
|
|
164
164
|
enable: boolean;
|
|
@@ -169,5 +169,10 @@ export interface TableHeaderButtonConfig {
|
|
|
169
169
|
export interface DragDropConfig {
|
|
170
170
|
enable: boolean;
|
|
171
171
|
manager: AurDragDropManager;
|
|
172
|
+
multiple?: boolean;
|
|
172
173
|
dragIcon?: IconView<string>;
|
|
173
174
|
}
|
|
175
|
+
export interface TotalRowConfig {
|
|
176
|
+
enable: boolean;
|
|
177
|
+
totalRowView?: TotalRowView;
|
|
178
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AfterViewChecked, AfterViewInit, ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, QueryList, SimpleChanges, TemplateRef } from '@angular/core';
|
|
1
|
+
import { AfterViewChecked, AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, QueryList, SimpleChanges, TemplateRef, ViewContainerRef } from '@angular/core';
|
|
2
2
|
import { ColumnView, TableConfig } from './model/ColumnConfig';
|
|
3
3
|
import { MatSort, Sort } from '@angular/material/sort';
|
|
4
4
|
import { MatTableDataSource } from '@angular/material/table';
|
|
@@ -37,6 +37,8 @@ declare enum ExpandState {
|
|
|
37
37
|
EXPANDED = "expanded"
|
|
38
38
|
}
|
|
39
39
|
export declare class NgxAurMatTableComponent<T> implements OnInit, OnChanges, AfterViewInit, AfterViewChecked, OnDestroy, NgxAurMatTablePublic<T>, AurDragDropComponent<TableRow<T>> {
|
|
40
|
+
private viewContainerRef;
|
|
41
|
+
private cdr;
|
|
40
42
|
expandedStateEnum: typeof ExpandState;
|
|
41
43
|
readonly EXTRA_HEADER_CELL_TOP_SUFFIX = "_extra_header_cell_top";
|
|
42
44
|
readonly EXTRA_HEADER_CELL_BOTTOM_SUFFIX = "_extra_header_cell_bottom";
|
|
@@ -79,7 +81,7 @@ export declare class NgxAurMatTableComponent<T> implements OnInit, OnChanges, Af
|
|
|
79
81
|
headerButtonProvider: HeaderButtonProviderDummy;
|
|
80
82
|
onHeaderButton: EventEmitter<MouseEvent>;
|
|
81
83
|
private resizeColumnOffsetsObserver;
|
|
82
|
-
dragDropProvider: DragDropProvider
|
|
84
|
+
dragDropProvider: DragDropProvider<T>;
|
|
83
85
|
selectionProvider: SelectionProvider<T>;
|
|
84
86
|
rowActionsProvider: RowActionProvider<T>;
|
|
85
87
|
indexProvider: IndexProvider;
|
|
@@ -89,7 +91,7 @@ export declare class NgxAurMatTableComponent<T> implements OnInit, OnChanges, Af
|
|
|
89
91
|
private customSortFunctions;
|
|
90
92
|
private filterStorage;
|
|
91
93
|
highlight: HighlightContainer<T> | undefined;
|
|
92
|
-
constructor();
|
|
94
|
+
constructor(viewContainerRef: ViewContainerRef, cdr: ChangeDetectorRef);
|
|
93
95
|
ngOnChanges(changes: SimpleChanges): void;
|
|
94
96
|
resetPaginatorPageIndex(): void;
|
|
95
97
|
refreshTable(): void;
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import { AbstractProvider } from "./AbstractProvider";
|
|
2
|
-
import { AurDragDropManager } from "../drag-drop/aur-drag-drop.manager";
|
|
3
2
|
import { DragDropConfig, IconView, TableConfig } from "../model/ColumnConfig";
|
|
4
|
-
|
|
3
|
+
import { ViewContainerRef } from "@angular/core";
|
|
4
|
+
import { AurDragDropManager } from "../drag-drop/aur-drag-drop.manager";
|
|
5
|
+
export declare class DragDropProvider<T> extends AbstractProvider {
|
|
6
|
+
private readonly viewContainerRef;
|
|
5
7
|
private tableName;
|
|
6
|
-
private dragCfg?;
|
|
7
8
|
protected static readonly DEFAULT_ICON_VIEW: IconView<string>;
|
|
8
9
|
readonly isEnabled: boolean;
|
|
9
10
|
readonly COLUMN_NAME = "tbl_drag_col";
|
|
10
11
|
readonly manager: AurDragDropManager;
|
|
11
12
|
readonly draggable: boolean;
|
|
12
13
|
readonly dragIconView: IconView<string>;
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
readonly multiple: boolean;
|
|
15
|
+
constructor(viewContainerRef: ViewContainerRef, tableName: string, dragCfg?: DragDropConfig);
|
|
16
|
+
addColumn(columns: string[]): DragDropProvider<T>;
|
|
15
17
|
/**
|
|
16
18
|
* Factory method to create an instance of IndexProvider based on table configuration.
|
|
17
19
|
* Returns a dummy provider if the index is not enabled in the configuration.
|
|
18
20
|
* @param tableConfig The configuration of the table.
|
|
19
21
|
* @returns An instance of IndexProvider or IndexProviderDummy.
|
|
20
22
|
*/
|
|
21
|
-
static create<T>(tableConfig: TableConfig<T>): DragDropProvider
|
|
23
|
+
static create<T>(viewContainerRef: ViewContainerRef, tableConfig: TableConfig<T>): DragDropProvider<T>;
|
|
22
24
|
private static canCreate;
|
|
23
25
|
}
|
|
24
|
-
export declare class DragProviderDummy extends DragDropProvider {
|
|
26
|
+
export declare class DragProviderDummy extends DragDropProvider<any> {
|
|
25
27
|
readonly isEnabled = false;
|
|
26
28
|
constructor();
|
|
27
29
|
addColumn(columns: string[]): DragProviderDummy;
|
|
@@ -16,6 +16,7 @@ export declare class SelectionProvider<T> extends AbstractProvider {
|
|
|
16
16
|
bindEventEmitters(selected: EventEmitter<T[]>, onSelect: EventEmitter<T[]>, onDeselect: EventEmitter<T[]>, selectionModel: EventEmitter<SelectionModel<T>>): SelectionProvider<T>;
|
|
17
17
|
masterToggle(): void;
|
|
18
18
|
isAllSelected(): boolean;
|
|
19
|
+
getSelectedRows(): TableRow<T>[];
|
|
19
20
|
private static canEnable;
|
|
20
21
|
static create<T>(tableConfig: TableConfig<T>, tableDataSource: MatTableDataSource<TableRow<T>>, initSelection: T[]): SelectionProvider<T>;
|
|
21
22
|
}
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -15,5 +15,7 @@ export * from './lib/filters/NgxAurFilters';
|
|
|
15
15
|
export * from './lib/directive/ngx-table-sub-footer-row.directive';
|
|
16
16
|
export * from './lib/directive/ngx-aur-table-search-prefix.directive';
|
|
17
17
|
export * from './lib/directive/ngx-aur-table-search-suffix.directive';
|
|
18
|
-
export * from './lib/drag-drop/aur-drag-drop.manager';
|
|
19
18
|
export * from './lib/drag-drop/aur-drag-drop-component';
|
|
19
|
+
export * from './lib/drag-drop/aur-drag-drop.manager';
|
|
20
|
+
export * from './lib/drag-drop/model/aur-drag-drop-mapping';
|
|
21
|
+
export * from './lib/drag-drop/model/aur-drag-preview-component';
|