@one-paragon/angular-utilities 0.3.8 → 0.3.10--beta.1
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/table-builder/classes/MatTableObservableDataSource.mjs +32 -3
- package/esm2022/table-builder/classes/TableState.mjs +11 -1
- package/esm2022/table-builder/components/generic-table/generic-table.component.mjs +32 -36
- package/esm2022/table-builder/components/generic-table/paginator.component.mjs +15 -14
- package/esm2022/table-builder/components/scroll-strategy.mjs +63 -0
- package/esm2022/table-builder/components/table-container/table-container-imports.mjs +5 -2
- package/esm2022/table-builder/components/table-container/table-container.mjs +104 -42
- package/esm2022/table-builder/components/table-container/tableProps.mjs +9 -0
- package/esm2022/table-builder/components/table-container/virtual-scroll-container.mjs +101 -0
- package/esm2022/table-builder/components/table-context.mjs +2 -0
- package/esm2022/table-builder/functions/sort-data-function.mjs +3 -3
- package/fesm2022/one-paragon-angular-utilities.mjs +417 -155
- package/fesm2022/one-paragon-angular-utilities.mjs.map +1 -1
- package/package.json +1 -1
- package/table-builder/classes/MatTableObservableDataSource.d.ts +6 -2
- package/table-builder/classes/TableState.d.ts +5 -0
- package/table-builder/components/generic-table/generic-table.component.d.ts +11 -14
- package/table-builder/components/generic-table/paginator.component.d.ts +5 -6
- package/table-builder/components/scroll-strategy.d.ts +23 -0
- package/table-builder/components/table-container/table-container-imports.d.ts +3 -1
- package/table-builder/components/table-container/table-container.d.ts +18 -7
- package/table-builder/components/table-container/tableProps.d.ts +11 -0
- package/table-builder/components/table-container/virtual-scroll-container.d.ts +17 -0
- package/table-builder/components/table-context.d.ts +10 -0
- package/table-builder/functions/sort-data-function.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { MatTableDataSource } from '@angular/material/table';
|
|
2
2
|
import { Observable, Subscription } from 'rxjs';
|
|
3
|
+
import { TableStore } from './table-store';
|
|
4
|
+
import { TableContext } from '../components/table-context';
|
|
3
5
|
export declare class MatTableObservableDataSource<T> extends MatTableDataSource<T> {
|
|
4
|
-
|
|
6
|
+
dataSrc: Observable<T[]>;
|
|
7
|
+
private state;
|
|
8
|
+
private context;
|
|
5
9
|
subscription?: Subscription;
|
|
6
|
-
constructor(dataSrc: Observable<T[]
|
|
10
|
+
constructor(dataSrc: Observable<T[]>, state: TableStore, context: TableContext);
|
|
7
11
|
connect(): import("rxjs").BehaviorSubject<T[]>;
|
|
8
12
|
disconnect(): void;
|
|
9
13
|
}
|
|
@@ -32,6 +32,11 @@ export interface TableState extends Required<PersistedTableState> {
|
|
|
32
32
|
metaData: Dictionary<MetaData>;
|
|
33
33
|
notPersistedTableSettings: NotPersistedTableSettings;
|
|
34
34
|
pageSize: number;
|
|
35
|
+
currentPage: number;
|
|
36
|
+
virtualScrollOffset: number;
|
|
37
|
+
virtualStart: number;
|
|
38
|
+
virtualEnd: number;
|
|
39
|
+
dataLen: number;
|
|
35
40
|
linkMaps: {
|
|
36
41
|
[key: string]: {
|
|
37
42
|
link: (t: any) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SimpleChanges, OnInit, QueryList, ViewContainerRef, ElementRef, Injector
|
|
1
|
+
import { SimpleChanges, OnInit, QueryList, ViewContainerRef, ElementRef, Injector } from '@angular/core';
|
|
2
2
|
import { MatSort } from '@angular/material/sort';
|
|
3
3
|
import { MatRowDef, MatTable } from '@angular/material/table';
|
|
4
4
|
import { Observable } from 'rxjs';
|
|
@@ -8,44 +8,42 @@ import { ColumnBuilderComponent } from '../column-builder/column-builder.compone
|
|
|
8
8
|
import { Dictionary } from '../../interfaces/dictionary';
|
|
9
9
|
import { ColumnInfo } from '../../interfaces/ColumnInfo';
|
|
10
10
|
import { CdkDragDrop, CdkDropList } from '@angular/cdk/drag-drop';
|
|
11
|
-
import { PaginatorComponent } from './paginator.component';
|
|
12
11
|
import { TransformCreator } from '../../services/transform-creator';
|
|
13
|
-
import {
|
|
12
|
+
import { tableProps } from '../table-container/tableProps';
|
|
13
|
+
import { TableContext } from '../table-context';
|
|
14
14
|
import * as i0 from "@angular/core";
|
|
15
15
|
export declare class GenericTableComponent implements OnInit {
|
|
16
16
|
private sort;
|
|
17
17
|
state: TableStore;
|
|
18
18
|
private viewContainer;
|
|
19
19
|
private transformCreator;
|
|
20
|
+
context: TableContext<any>;
|
|
21
|
+
props: tableProps;
|
|
20
22
|
drop(event: CdkDragDrop<string[]>): void;
|
|
21
23
|
set trackBy(trackBy: string);
|
|
22
24
|
displayData$: Observable<any[]>;
|
|
23
25
|
data$: Observable<any[]>;
|
|
24
|
-
indexColumn: boolean;
|
|
25
|
-
selectionColumn: boolean;
|
|
26
26
|
rows: QueryList<MatRowDef<any>>;
|
|
27
|
-
isSticky: boolean;
|
|
28
27
|
columnBuilders: ColumnBuilderComponent[];
|
|
29
28
|
columnInfos: Observable<ColumnInfo[]>;
|
|
30
|
-
groupHeaderTemplate: TemplateRef<any>;
|
|
31
29
|
table: MatTable<any>;
|
|
32
30
|
dropList: CdkDropList;
|
|
33
|
-
tableElRef: ElementRef;
|
|
34
|
-
paginatorComponent: PaginatorComponent;
|
|
31
|
+
set tableElRef(val: ElementRef);
|
|
35
32
|
currentColumns: string[];
|
|
36
|
-
dataSource: MatTableObservableDataSource<any>;
|
|
37
33
|
keys: string[];
|
|
38
34
|
injector: Injector;
|
|
39
35
|
rowDefArr: MatRowDef<any>[];
|
|
40
36
|
columns: string[];
|
|
41
37
|
myColumns: Dictionary<ColumnBuilderComponent>;
|
|
42
38
|
showHeader$: Observable<boolean>;
|
|
43
|
-
|
|
39
|
+
offset$: Observable<number>;
|
|
40
|
+
offsetIndex: number;
|
|
41
|
+
dataView: Observable<any[]>;
|
|
42
|
+
constructor(sort: MatSort, state: TableStore, viewContainer: ViewContainerRef, transformCreator: TransformCreator, injector: Injector, context: TableContext<any>);
|
|
44
43
|
defaultTrackBy: (index: number, item: any) => any;
|
|
45
44
|
trackByFunction: (index: number, item: any) => any;
|
|
46
45
|
ngOnChanges(changes: SimpleChanges): void;
|
|
47
46
|
ngOnInit(): void;
|
|
48
|
-
createDataSource(): void;
|
|
49
47
|
isGroupHeader(_: number, row: {
|
|
50
48
|
isGroupHeader: boolean;
|
|
51
49
|
}): boolean;
|
|
@@ -65,8 +63,7 @@ export declare class GenericTableComponent implements OnInit {
|
|
|
65
63
|
width?: undefined;
|
|
66
64
|
}>;
|
|
67
65
|
showFooterRow$: Observable<'regular-footer' | 'no-footer' | 'small-footer'>;
|
|
68
|
-
collapseFooter$: Observable<boolean>;
|
|
69
66
|
getTransform: (key: string, val: string) => any;
|
|
70
67
|
static ɵfac: i0.ɵɵFactoryDeclaration<GenericTableComponent, never>;
|
|
71
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<GenericTableComponent, "tb-generic-table", never, { "trackBy": { "alias": "trackBy"; "required": false; }; "displayData$": { "alias": "displayData$"; "required": false; }; "data$": { "alias": "data$"; "required": false; }; "
|
|
68
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<GenericTableComponent, "tb-generic-table", never, { "trackBy": { "alias": "trackBy"; "required": false; }; "displayData$": { "alias": "displayData$"; "required": false; }; "data$": { "alias": "data$"; "required": false; }; "rows": { "alias": "rows"; "required": false; }; "columnBuilders": { "alias": "columnBuilders"; "required": false; }; "columnInfos": { "alias": "columnInfos"; "required": false; }; }, { "selection$": "selection$"; }, never, never, true, never>;
|
|
72
69
|
}
|
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AfterViewInit, OnInit } from '@angular/core';
|
|
2
2
|
import { MatPaginator } from '@angular/material/paginator';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
import { TableStore } from '../../classes/table-store';
|
|
5
|
-
import {
|
|
5
|
+
import { TableContext } from '../table-context';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
export declare class PaginatorComponent implements OnInit, AfterViewInit {
|
|
8
8
|
private state;
|
|
9
|
-
|
|
10
|
-
tableElRef: ElementRef;
|
|
9
|
+
private context;
|
|
11
10
|
paginator: MatPaginator;
|
|
12
11
|
currentPageData$: Observable<CurrentPageDetails>;
|
|
13
12
|
collapseFooter$: Observable<boolean>;
|
|
14
13
|
data$: Observable<any[]>;
|
|
15
|
-
constructor(state: TableStore);
|
|
14
|
+
constructor(state: TableStore, context: TableContext);
|
|
16
15
|
ngOnInit(): void;
|
|
17
16
|
ngAfterViewInit(): void;
|
|
18
17
|
paginatorChange(): void;
|
|
19
18
|
ourPageEvent: boolean;
|
|
20
19
|
static ɵfac: i0.ɵɵFactoryDeclaration<PaginatorComponent, never>;
|
|
21
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<PaginatorComponent, "tb-paginator", never, { "
|
|
20
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<PaginatorComponent, "tb-paginator", never, { "data$": { "alias": "data$"; "required": false; }; }, {}, never, never, true, never>;
|
|
22
21
|
}
|
|
23
22
|
interface CurrentPageDetails {
|
|
24
23
|
currentStart: number;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CdkVirtualScrollViewport, VirtualScrollStrategy } from '@angular/cdk/scrolling';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
export declare class TableVirtualScrollStrategy implements VirtualScrollStrategy {
|
|
4
|
+
private itemHeight;
|
|
5
|
+
private headerOffset;
|
|
6
|
+
scrolledIndexChange: Observable<number>;
|
|
7
|
+
private dataLength;
|
|
8
|
+
private readonly indexChange;
|
|
9
|
+
private viewport?;
|
|
10
|
+
constructor(itemHeight: number, headerOffset: number);
|
|
11
|
+
attach(viewport: CdkVirtualScrollViewport): void;
|
|
12
|
+
onContentScrolled(): void;
|
|
13
|
+
onDataLengthChanged(): void;
|
|
14
|
+
setDataLength(length: number): void;
|
|
15
|
+
setScrollHeight(rowHeight: number, headerOffset: number): void;
|
|
16
|
+
setItemHeight(rowHeight: number): void;
|
|
17
|
+
setHeaderOffset(headerOffset: number): void;
|
|
18
|
+
detach(): void;
|
|
19
|
+
onContentRendered(): void;
|
|
20
|
+
onRenderedOffsetChanged(): void;
|
|
21
|
+
scrollToIndex(index: number, behavior: ScrollBehavior): void;
|
|
22
|
+
private updateContent;
|
|
23
|
+
}
|
|
@@ -9,4 +9,6 @@ import { GenFilterDisplayerComponent } from "../table-container-filter/gen-filte
|
|
|
9
9
|
import { GenColDisplayerComponent } from "../gen-col-displayer/gen-col-displayer.component";
|
|
10
10
|
import { SortMenuComponent } from "../sort-menu/sort-menu.component";
|
|
11
11
|
import { ClickEmitterDirective, DialogDirective, StopPropagationDirective } from "../../../utilities";
|
|
12
|
-
|
|
12
|
+
import { PaginatorComponent } from "../generic-table/paginator.component";
|
|
13
|
+
import { VirtualScrollContainer } from "./virtual-scroll-container";
|
|
14
|
+
export declare const containerImports: (typeof MatButtonModule | typeof NgTemplateOutlet | typeof AsyncPipe | typeof MultiSortDirective | typeof StopPropagationDirective | typeof ClickEmitterDirective | typeof DialogDirective | typeof GenColDisplayerComponent | typeof GenFilterDisplayerComponent | typeof LetDirective | typeof FilterChipsComponent | typeof PaginatorComponent | typeof GenericTableComponent | typeof GroupByListComponent | typeof SortMenuComponent | typeof VirtualScrollContainer)[];
|
|
@@ -10,22 +10,32 @@ import { TableState } from '../../classes/TableState';
|
|
|
10
10
|
import { ColumnInfo } from '../../interfaces/ColumnInfo';
|
|
11
11
|
import { TableWrapperDirective } from '../../directives/table-wrapper.directive';
|
|
12
12
|
import { TableBuilderStateStore } from '../../ngrx/tableBuilderStateStore';
|
|
13
|
+
import { tableProps } from './tableProps';
|
|
14
|
+
import { TableContext } from '../table-context';
|
|
15
|
+
import { PaginatorComponent } from '../generic-table/paginator.component';
|
|
13
16
|
import * as i0 from "@angular/core";
|
|
14
17
|
export declare class TableContainerComponent<T = any> {
|
|
15
|
-
|
|
18
|
+
props: tableProps;
|
|
19
|
+
context: TableContext<T>;
|
|
20
|
+
set indexColumn(val: boolean);
|
|
21
|
+
set selectionColumn(val: boolean);
|
|
22
|
+
set isSticky(val: boolean);
|
|
23
|
+
set stickyFooter(val: boolean);
|
|
24
|
+
set pageSize(value: number);
|
|
25
|
+
set groupHeaderTemplate(template: TemplateRef<any>);
|
|
26
|
+
set usePaginator(val: boolean);
|
|
27
|
+
set itemHeight(val: number);
|
|
28
|
+
set headerOffset(val: number);
|
|
29
|
+
set useVirtualScroll(val: boolean);
|
|
30
|
+
paginatorComponent?: PaginatorComponent;
|
|
16
31
|
customFilterDirectives: QueryList<TableCustomFilterDirective>;
|
|
17
32
|
filterDirectives: QueryList<TableFilterDirective>;
|
|
18
33
|
customRows: QueryList<MatRowDef<any>>;
|
|
19
34
|
customCells: QueryList<CustomCellDirective>;
|
|
20
35
|
tableId: string;
|
|
21
36
|
tableBuilder: TableBuilder;
|
|
22
|
-
indexColumn: boolean;
|
|
23
|
-
selectionColumn: boolean;
|
|
24
37
|
trackBy: string;
|
|
25
|
-
isSticky: boolean;
|
|
26
|
-
set pageSize(value: number);
|
|
27
38
|
inputFilters?: Observable<Array<Predicate<T>>>;
|
|
28
|
-
groupHeaderTemplate: TemplateRef<any>;
|
|
29
39
|
selection$: EventEmitter<any>;
|
|
30
40
|
displayDataSubject: ReplaySubject<Observable<T[]>>;
|
|
31
41
|
displayData: Observable<T[]>;
|
|
@@ -35,6 +45,7 @@ export declare class TableContainerComponent<T = any> {
|
|
|
35
45
|
onSaveState: EventEmitter<any>;
|
|
36
46
|
state: TableStore;
|
|
37
47
|
state$: Observable<import("../../classes/TableState").PersistedTableState>;
|
|
48
|
+
collapseFooter$: Observable<boolean>;
|
|
38
49
|
myColumns$: Observable<ColumnInfo[]>;
|
|
39
50
|
stateKeys$?: Observable<string[] | null>;
|
|
40
51
|
currentStateKey$?: Observable<string>;
|
|
@@ -60,5 +71,5 @@ export declare class TableContainerComponent<T = any> {
|
|
|
60
71
|
collapseHeader$: Observable<boolean>;
|
|
61
72
|
addFilterDirectives: (state: TableState) => void;
|
|
62
73
|
static ɵfac: i0.ɵɵFactoryDeclaration<TableContainerComponent<any>, never>;
|
|
63
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<TableContainerComponent<any>, "tb-table-container", never, { "
|
|
74
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TableContainerComponent<any>, "tb-table-container", never, { "indexColumn": { "alias": "indexColumn"; "required": false; }; "selectionColumn": { "alias": "selectionColumn"; "required": false; }; "isSticky": { "alias": "isSticky"; "required": false; }; "stickyFooter": { "alias": "stickyFooter"; "required": false; }; "pageSize": { "alias": "pageSize"; "required": false; }; "groupHeaderTemplate": { "alias": "groupHeaderTemplate"; "required": false; }; "usePaginator": { "alias": "usePaginator"; "required": false; }; "itemHeight": { "alias": "itemHeight"; "required": false; }; "headerOffset": { "alias": "headerOffset"; "required": false; }; "useVirtualScroll": { "alias": "useVirtualScroll"; "required": false; }; "tableId": { "alias": "tableId"; "required": false; }; "tableBuilder": { "alias": "tableBuilder"; "required": false; }; "trackBy": { "alias": "trackBy"; "required": false; }; "inputFilters": { "alias": "inputFilters"; "required": false; }; }, { "selection$": "selection$"; "data": "data"; "onStateReset": "onStateReset"; "onSaveState": "onSaveState"; "state$": "state$"; }, ["customFilterDirectives", "filterDirectives", "customRows", "customCells"], ["[before]", ".tb-header-title"], true, never>;
|
|
64
75
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TemplateRef } from '@angular/core';
|
|
2
|
+
export interface tableProps {
|
|
3
|
+
usePaginator: boolean;
|
|
4
|
+
useVirtualScroll: boolean;
|
|
5
|
+
indexColumn: boolean;
|
|
6
|
+
selectionColumn: boolean;
|
|
7
|
+
isSticky: boolean;
|
|
8
|
+
stickyFooter: boolean;
|
|
9
|
+
groupHeaderTemplate?: TemplateRef<any>;
|
|
10
|
+
}
|
|
11
|
+
export declare const defaultProps: tableProps;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ElementRef, OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import { TableContext } from '../table-context';
|
|
3
|
+
import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
|
|
4
|
+
import { TableStore } from '../../classes/table-store';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export declare class VirtualScrollContainer<T = any> implements OnInit, OnDestroy {
|
|
7
|
+
context: TableContext;
|
|
8
|
+
private state;
|
|
9
|
+
constructor(context: TableContext, state: TableStore);
|
|
10
|
+
viewport: CdkVirtualScrollViewport;
|
|
11
|
+
ngOnInit(): void;
|
|
12
|
+
ngOnDestroy(): void;
|
|
13
|
+
setSize(el: ElementRef<HTMLElement>): void;
|
|
14
|
+
resizeHandler: () => void;
|
|
15
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<VirtualScrollContainer<any>, never>;
|
|
16
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<VirtualScrollContainer<any>, "tb-virtual-scroll-container", never, {}, {}, never, ["*"], true, never>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ElementRef } from "@angular/core";
|
|
2
|
+
import { MatTableObservableDataSource } from "../classes/MatTableObservableDataSource";
|
|
3
|
+
import { tableProps } from "./table-container/tableProps";
|
|
4
|
+
import { TableVirtualScrollStrategy } from "./scroll-strategy";
|
|
5
|
+
export interface TableContext<T = any> {
|
|
6
|
+
dataSource?: MatTableObservableDataSource<T>;
|
|
7
|
+
tableElRef?: ElementRef;
|
|
8
|
+
tableProps: tableProps;
|
|
9
|
+
scrollStrategy: TableVirtualScrollStrategy;
|
|
10
|
+
}
|
|
@@ -2,5 +2,5 @@ import { Sort } from "@angular/material/sort";
|
|
|
2
2
|
import { Predicate } from "@angular/core";
|
|
3
3
|
export type direc = 'asc' | 'desc' | boolean;
|
|
4
4
|
export declare function sortData<T>(data: T[], sorted: Sort[]): T[];
|
|
5
|
-
export declare function filterData<T>(data: T[], filters: Predicate<T>[],
|
|
5
|
+
export declare function filterData<T>(data: T[], filters: Predicate<T>[], resetAll?: boolean): T[];
|
|
6
6
|
export declare const tbNoShowSymbol: unique symbol;
|