@zeedhi/teknisa-components-common 3.0.0 → 3.0.2
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 +5 -2
- package/dist/teknisa-components-common.js +3722 -32
- package/dist/teknisa-components-common.min.js +3722 -32
- package/dist/types/components/index.d.ts +5 -0
- package/dist/types/components/tek-datasource/index.d.ts +3 -0
- package/dist/types/components/tek-datasource/interfaces.d.ts +16 -0
- package/dist/types/components/tek-datasource/tek-memory-datasource.d.ts +93 -0
- package/dist/types/components/tek-datasource/tek-rest-datasource.d.ts +95 -0
- package/dist/types/components/tek-grid/columns-searcher.d.ts +5 -0
- package/dist/types/components/tek-grid/dynamic-filter-datasource-factory.d.ts +6 -0
- package/dist/types/components/tek-grid/filter-helper.d.ts +7 -0
- package/dist/types/components/tek-grid/grid-filter-button.d.ts +29 -0
- package/dist/types/components/tek-grid/grouped-data-manager.d.ts +82 -0
- package/dist/types/components/tek-grid/grouped-data-selector.d.ts +7 -0
- package/dist/types/components/tek-grid/grouped-view-navigator.d.ts +14 -0
- package/dist/types/components/tek-grid/index.d.ts +18 -0
- package/dist/types/components/tek-grid/interfaces.d.ts +259 -0
- package/dist/types/components/tek-grid/keymap-grouped.d.ts +6 -0
- package/dist/types/components/tek-grid/layout-options.d.ts +39 -0
- package/dist/types/components/tek-grid/tek-grid-column.d.ts +42 -0
- package/dist/types/components/tek-grid/tek-grid-columns-button/tek-grid-columns-button-controller.d.ts +8 -0
- package/dist/types/components/tek-grid/tek-grid-columns-button/tek-grid-columns-button.d.ts +13 -0
- package/dist/types/components/tek-grid/tek-grid-controller.d.ts +31 -0
- package/dist/types/components/tek-grid/tek-grid-events.d.ts +31 -0
- package/dist/types/components/tek-grid/tek-grid-toolbar-provider/export-options/button-option.d.ts +17 -0
- package/dist/types/components/tek-grid/tek-grid-toolbar-provider/export-options/index.d.ts +3 -0
- package/dist/types/components/tek-grid/tek-grid-toolbar-provider/export-options/interfaces.d.ts +5 -0
- package/dist/types/components/tek-grid/tek-grid-toolbar-provider/export-options/multi-option.d.ts +12 -0
- package/dist/types/components/tek-grid/tek-grid-toolbar-provider/index.d.ts +2 -0
- package/dist/types/components/tek-grid/tek-grid-toolbar-provider/tek-grid-toolbar-provider.d.ts +22 -0
- package/dist/types/components/tek-grid/tek-grid.d.ts +216 -0
- package/dist/types/components/tek-user-info/TekUserInfoController.d.ts +22 -0
- package/dist/types/components/tek-user-info/interfaces.d.ts +27 -0
- package/dist/types/components/tek-user-info/tek-user-info-list.d.ts +32 -0
- package/dist/types/components/tek-user-info/tek-user-info.d.ts +37 -0
- package/dist/types/error/tek-grid-delete-rows-error.d.ts +7 -0
- package/dist/types/error/teknisa-common-error.d.ts +6 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/utils/config/config.d.ts +7 -0
- package/dist/types/utils/index.d.ts +3 -0
- package/dist/types/utils/is-filled-object/is-filled-object.d.ts +2 -0
- package/dist/types/utils/is-nil.d.ts +1 -0
- package/package.json +2 -2
- package/src/components/index.ts +5 -12
- package/src/components/tek-datasource/index.ts +3 -0
- package/src/components/tek-datasource/interfaces.ts +36 -0
- package/src/components/tek-datasource/tek-memory-datasource.ts +314 -0
- package/src/components/tek-datasource/tek-rest-datasource.ts +224 -0
- package/src/components/tek-grid/columns-searcher.ts +22 -0
- package/src/components/tek-grid/dynamic-filter-datasource-factory.ts +20 -0
- package/src/components/tek-grid/filter-helper.ts +20 -0
- package/src/components/tek-grid/grid-filter-button.ts +419 -0
- package/src/components/tek-grid/grouped-data-manager.ts +448 -0
- package/src/components/tek-grid/grouped-data-selector.ts +40 -0
- package/src/components/tek-grid/grouped-view-navigator.ts +84 -0
- package/src/components/tek-grid/index.ts +18 -0
- package/src/components/tek-grid/interfaces.ts +329 -0
- package/src/components/tek-grid/keymap-grouped.ts +20 -0
- package/src/components/tek-grid/layout-options.ts +248 -0
- package/src/components/tek-grid/tek-grid-column.ts +193 -0
- package/src/components/tek-grid/tek-grid-columns-button/tek-grid-columns-button-controller.ts +28 -0
- package/src/components/tek-grid/tek-grid-columns-button/tek-grid-columns-button.ts +38 -0
- package/src/components/tek-grid/tek-grid-controller.ts +140 -0
- package/src/components/tek-grid/tek-grid-events.ts +105 -0
- package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/button-option.ts +26 -0
- package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/index.ts +3 -0
- package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/interfaces.ts +6 -0
- package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/multi-option.ts +85 -0
- package/src/components/tek-grid/tek-grid-toolbar-provider/index.ts +2 -0
- package/src/components/tek-grid/tek-grid-toolbar-provider/tek-grid-toolbar-provider.ts +365 -0
- package/src/components/tek-grid/tek-grid.ts +1118 -0
- package/src/components/tek-user-info/TekUserInfoController.ts +87 -0
- package/src/components/tek-user-info/interfaces.ts +21 -0
- package/src/components/tek-user-info/tek-user-info-list.ts +64 -0
- package/src/components/tek-user-info/tek-user-info.ts +337 -0
- package/src/error/tek-grid-delete-rows-error.ts +15 -0
- package/src/error/teknisa-common-error.ts +8 -0
- package/src/index.ts +1 -0
- package/src/utils/config/config.ts +8 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/is-filled-object/is-filled-object.ts +5 -0
- package/src/utils/is-nil.ts +3 -0
- package/tests/unit/components/tek-grid/button-option.spec.ts +49 -0
- package/tests/unit/components/tek-grid/columns-searcher.spec.ts +112 -0
- package/tests/unit/components/tek-grid/dynamic-filter-datasource-factory.spec.ts +90 -0
- package/tests/unit/components/tek-grid/filter-helper.spec.ts +34 -130
- package/tests/unit/components/tek-grid/grid-filter-button.spec.ts +110 -241
- package/tests/unit/components/tek-grid/grouped-data-manager.spec.ts +593 -0
- package/tests/unit/components/tek-grid/grouped-data-selector.spec.ts +136 -0
- package/tests/unit/components/tek-grid/grouped-view-navigator.spec.ts +244 -0
- package/tests/unit/components/tek-grid/keymap-grouped.spec.ts +20 -0
- package/tests/unit/components/tek-grid/{layout_options.spec.ts → layout-options.spec.ts} +77 -35
- package/tests/unit/components/tek-grid/multi-option.spec.ts +139 -0
- package/tests/unit/components/tek-grid/{grid-column.spec.ts → tek-grid-column.spec.ts} +48 -6
- package/tests/unit/components/tek-grid/{grid-columns-button.spec.ts → tek-grid-columns-button.spec.ts} +42 -9
- package/tests/unit/components/tek-grid/tek-grid-controller.spec.ts +253 -0
- package/tests/unit/components/tek-grid/tek-grid-events.spec.ts +186 -0
- package/tests/unit/components/tek-grid/tek-grid-toolbar-provider.spec.ts +34 -0
- package/tests/unit/components/tek-grid/tek-grid.spec.ts +895 -0
- package/tests/unit/components/tek-grid/tek-memory-datasource.spec.ts +482 -0
- package/tests/unit/components/tek-grid/tek-rest-datasource.spec.ts +422 -0
- package/dist/types/error/delete-rows-error.d.ts +0 -6
- package/src/error/delete-rows-error.ts +0 -11
- package/tests/unit/components/tek-grid/grid.spec.ts +0 -2701
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
export * from './tek-breadcrumb-header/breadcrumb-header';
|
|
2
2
|
export * from './tek-breadcrumb-header/interfaces';
|
|
3
|
+
export * from './tek-grid';
|
|
4
|
+
export * from './tek-datasource';
|
|
5
|
+
export * from './tek-user-info/interfaces';
|
|
6
|
+
export * from './tek-user-info/tek-user-info';
|
|
7
|
+
export * from './tek-user-info/tek-user-info-list';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IDictionary, IMemoryDatasource, IRestDatasource } from '@zeedhi/core';
|
|
2
|
+
export interface ITekMemoryDatasource extends IMemoryDatasource {
|
|
3
|
+
dynamicFilter?: IDictionary<any>;
|
|
4
|
+
searchJoin?: IDictionary<Array<string | number>>;
|
|
5
|
+
}
|
|
6
|
+
export interface ITekRestDatasource extends IRestDatasource {
|
|
7
|
+
dynamicFilter?: IDictionary<any>;
|
|
8
|
+
searchJoin?: IDictionary<Array<string | number>>;
|
|
9
|
+
}
|
|
10
|
+
export interface IDynamicFilterItem {
|
|
11
|
+
relation: string;
|
|
12
|
+
operation: string;
|
|
13
|
+
value: any;
|
|
14
|
+
}
|
|
15
|
+
export declare const DynamicFilterOperations: IDictionary<boolean>;
|
|
16
|
+
export declare const DynamicFilterRelations: IDictionary<boolean>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { IDatasource, IDictionary, MemoryDatasource } from '@zeedhi/core';
|
|
2
|
+
import { IDynamicFilterItem, ITekMemoryDatasource } from './interfaces';
|
|
3
|
+
export declare class TekMemoryDatasource extends MemoryDatasource implements ITekMemoryDatasource {
|
|
4
|
+
/** Dynamic filter data */
|
|
5
|
+
dynamicFilter: IDictionary<IDynamicFilterItem[]>;
|
|
6
|
+
/** Search Join data */
|
|
7
|
+
searchJoin: IDictionary<Array<string | number>>;
|
|
8
|
+
/**
|
|
9
|
+
* Dynamic Filter Operations
|
|
10
|
+
*/
|
|
11
|
+
dynamicFilterOperations: IDictionary<boolean>;
|
|
12
|
+
/**
|
|
13
|
+
* Dynamic Filter Relations
|
|
14
|
+
*/
|
|
15
|
+
dynamicFilterRelations: IDictionary<boolean>;
|
|
16
|
+
/**
|
|
17
|
+
* Dynamic Filter applied flag
|
|
18
|
+
*/
|
|
19
|
+
protected dynamicFilterApplied: string;
|
|
20
|
+
/**
|
|
21
|
+
* Create new datasource
|
|
22
|
+
* @param props Datasource properties
|
|
23
|
+
*/
|
|
24
|
+
constructor(props: ITekMemoryDatasource);
|
|
25
|
+
protected updateReservedKeys(): void;
|
|
26
|
+
protected updateInternalProperties(datasource?: IDatasource): void;
|
|
27
|
+
protected getEncodedParam(urlParam: string, datasourceParam?: IDictionary<any>): IDictionary<any>;
|
|
28
|
+
protected getQueryStringValues(): IDictionary<any>;
|
|
29
|
+
protected getUrlQueryString(): string;
|
|
30
|
+
/**
|
|
31
|
+
* Adds a new dynamic filter position or replace if exists
|
|
32
|
+
* @param column Dynamic Filter column name
|
|
33
|
+
* @param value Dynamic Filter value
|
|
34
|
+
* @returns Promise with data collection
|
|
35
|
+
*/
|
|
36
|
+
addDynamicFilter(column: string, value: any): Promise<any>;
|
|
37
|
+
/**
|
|
38
|
+
* Removes a dynamic filter position
|
|
39
|
+
* @param column Dynamic Filter column name
|
|
40
|
+
* @returns Promise with data collection
|
|
41
|
+
*/
|
|
42
|
+
removeDynamicFilter(column: string): Promise<any>;
|
|
43
|
+
/**
|
|
44
|
+
* Sets new dynamic filter value
|
|
45
|
+
* @param filter Dynamic Filter value
|
|
46
|
+
* @returns Promise with data collection
|
|
47
|
+
*/
|
|
48
|
+
setDynamicFilter(filter: IDictionary<any>): Promise<any>;
|
|
49
|
+
/**
|
|
50
|
+
* Clears Dynamic filter value
|
|
51
|
+
* @returns Promise with data collection
|
|
52
|
+
*/
|
|
53
|
+
clearDynamicFilter(): Promise<any>;
|
|
54
|
+
/**
|
|
55
|
+
* Resets page and selected rows and tries to update the url
|
|
56
|
+
* @returns Promise with data collection
|
|
57
|
+
*/
|
|
58
|
+
updateDynamicFilter(): Promise<any>;
|
|
59
|
+
/**
|
|
60
|
+
* Checks if a filter value is valid
|
|
61
|
+
* @param value Filter value
|
|
62
|
+
* @returns Is valid filter value
|
|
63
|
+
*/
|
|
64
|
+
protected isValidDynamicFilterValue(column: string, value?: IDictionary<any>[]): boolean | undefined;
|
|
65
|
+
clone(): {
|
|
66
|
+
dynamicFilter: IDictionary<IDynamicFilterItem[]>;
|
|
67
|
+
searchJoin: IDictionary<(string | number)[]>;
|
|
68
|
+
type: string;
|
|
69
|
+
translate?: boolean | string[] | undefined;
|
|
70
|
+
sortFunction?: ((value1: any, value2: any, columnName: string) => boolean) | undefined;
|
|
71
|
+
sortParams?: IDictionary<any> | undefined;
|
|
72
|
+
currentRow?: IDictionary<any> | undefined;
|
|
73
|
+
data?: IDictionary<any>[] | undefined;
|
|
74
|
+
filter?: IDictionary<any> | undefined;
|
|
75
|
+
limit?: string | number | undefined;
|
|
76
|
+
loadAll?: boolean | undefined;
|
|
77
|
+
loading?: boolean | undefined;
|
|
78
|
+
order?: string[] | undefined;
|
|
79
|
+
page?: string | number | undefined;
|
|
80
|
+
search?: string | undefined;
|
|
81
|
+
searchIn?: string[] | undefined;
|
|
82
|
+
uniqueKey?: string | undefined;
|
|
83
|
+
watchUrl?: boolean | undefined;
|
|
84
|
+
events?: import("@zeedhi/core").IDatasourceEvents<import("@zeedhi/core").IEventParam<any>> | undefined;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Updates filtered data
|
|
88
|
+
*/
|
|
89
|
+
protected updateFilteredData(): void;
|
|
90
|
+
protected getRowByDynamicFilter(row: IDictionary<any>): any;
|
|
91
|
+
protected getRowBySearchJoin(row: IDictionary<any>): boolean;
|
|
92
|
+
hasFilter(columnName: string): boolean;
|
|
93
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { IDatasource, IDictionary, RestDatasource } from '@zeedhi/core';
|
|
2
|
+
import { IDynamicFilterItem, ITekRestDatasource } from './interfaces';
|
|
3
|
+
export declare class TekRestDatasource extends RestDatasource implements ITekRestDatasource {
|
|
4
|
+
/** Dynamic filter data */
|
|
5
|
+
dynamicFilter: IDictionary<IDynamicFilterItem[]>;
|
|
6
|
+
/** Search Join data */
|
|
7
|
+
searchJoin: IDictionary<Array<string | number>>;
|
|
8
|
+
/**
|
|
9
|
+
* Dynamic Filter Operations
|
|
10
|
+
*/
|
|
11
|
+
dynamicFilterOperations: IDictionary<boolean>;
|
|
12
|
+
/**
|
|
13
|
+
* Dynamic Filter Relations
|
|
14
|
+
*/
|
|
15
|
+
dynamicFilterRelations: IDictionary<boolean>;
|
|
16
|
+
/**
|
|
17
|
+
* Dynamic Filter applied flag
|
|
18
|
+
*/
|
|
19
|
+
protected dynamicFilterApplied: string;
|
|
20
|
+
/**
|
|
21
|
+
* Create new datasource
|
|
22
|
+
* @param props Datasource properties
|
|
23
|
+
*/
|
|
24
|
+
constructor(props: ITekRestDatasource);
|
|
25
|
+
protected updateReservedKeys(): void;
|
|
26
|
+
protected updateInternalProperties(datasource?: IDatasource): void;
|
|
27
|
+
protected getEncodedParam(urlParam: string, datasourceParam?: IDictionary<any>): IDictionary<any>;
|
|
28
|
+
protected getQueryStringValues(): IDictionary<any>;
|
|
29
|
+
protected getUrlQueryString(): string;
|
|
30
|
+
/**
|
|
31
|
+
* Adds a new dynamic filter position or replace if exists
|
|
32
|
+
* @param column Dynamic Filter column name
|
|
33
|
+
* @param value Dynamic Filter value
|
|
34
|
+
* @returns Promise with data collection
|
|
35
|
+
*/
|
|
36
|
+
addDynamicFilter(column: string, value: any): Promise<IDictionary<any> | IDictionary<any>[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Removes a dynamic filter position
|
|
39
|
+
* @param column Dynamic Filter column name
|
|
40
|
+
* @returns Promise with data collection
|
|
41
|
+
*/
|
|
42
|
+
removeDynamicFilter(column: string): Promise<IDictionary<any> | IDictionary<any>[]>;
|
|
43
|
+
/**
|
|
44
|
+
* Sets new dynamic filter value
|
|
45
|
+
* @param filter Dynamic Filter value
|
|
46
|
+
* @returns Promise with data collection
|
|
47
|
+
*/
|
|
48
|
+
setDynamicFilter(filter: IDictionary<any>): Promise<IDictionary<any> | IDictionary<any>[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Clears Dynamic filter value
|
|
51
|
+
* @returns Promise with data collection
|
|
52
|
+
*/
|
|
53
|
+
clearDynamicFilter(): Promise<IDictionary<any> | IDictionary<any>[]>;
|
|
54
|
+
/**
|
|
55
|
+
* Resets page and selected rows and tries to update the url
|
|
56
|
+
* @returns Promise with data collection
|
|
57
|
+
*/
|
|
58
|
+
updateDynamicFilter(): Promise<IDictionary<any> | IDictionary<any>[]>;
|
|
59
|
+
/**
|
|
60
|
+
* Checks if a filter value is valid
|
|
61
|
+
* @param value Filter value
|
|
62
|
+
* @returns Is valid filter value
|
|
63
|
+
*/
|
|
64
|
+
protected isValidDynamicFilterValue(column: string, value?: IDictionary<any>[]): boolean | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Retrieves request params
|
|
67
|
+
*/
|
|
68
|
+
protected getRequestParams(): any;
|
|
69
|
+
hasFilter(columnName: string): boolean;
|
|
70
|
+
clone(): {
|
|
71
|
+
dynamicFilter: IDictionary<IDynamicFilterItem[]>;
|
|
72
|
+
searchJoin: IDictionary<(string | number)[]>;
|
|
73
|
+
type: string;
|
|
74
|
+
route?: string | undefined;
|
|
75
|
+
lazyLoad?: boolean | undefined;
|
|
76
|
+
arrayFormat?: import("@zeedhi/core").ArrayFormatType | undefined;
|
|
77
|
+
find?: IDictionary<any> | undefined;
|
|
78
|
+
localSearch?: boolean | undefined;
|
|
79
|
+
currentRow?: IDictionary<any> | undefined; /** Search Join data */
|
|
80
|
+
data?: IDictionary<any>[] | undefined;
|
|
81
|
+
filter?: IDictionary<any> | undefined;
|
|
82
|
+
limit?: string | number | undefined;
|
|
83
|
+
loadAll?: boolean | undefined;
|
|
84
|
+
loading?: boolean | undefined;
|
|
85
|
+
order?: string[] | undefined;
|
|
86
|
+
page?: string | number | undefined;
|
|
87
|
+
search?: string | undefined;
|
|
88
|
+
searchIn?: string[] | undefined;
|
|
89
|
+
uniqueKey?: string | undefined;
|
|
90
|
+
watchUrl?: boolean | undefined; /**
|
|
91
|
+
* Dynamic Filter applied flag
|
|
92
|
+
*/
|
|
93
|
+
events?: import("@zeedhi/core").IDatasourceEvents<import("@zeedhi/core").IEventParam<any>> | undefined;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IDictionary } from '@zeedhi/core';
|
|
2
|
+
import { IColumnsSearcher, ITekGridColumn } from './interfaces';
|
|
3
|
+
export declare class ColumnsSearcher implements IColumnsSearcher {
|
|
4
|
+
searchColumn(columns: ITekGridColumn[], search: string): Promise<IDictionary<(string | number)[]>>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Datasource, IDictionary } from '@zeedhi/core';
|
|
2
|
+
import { IDynamicFilterDatasourceFactory } from './interfaces';
|
|
3
|
+
export declare class DynamicFilterDatasourceFactory implements IDynamicFilterDatasourceFactory {
|
|
4
|
+
factory(options: IDictionary<boolean>): Datasource;
|
|
5
|
+
private getFilterOptionsData;
|
|
6
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TekGridColumn } from './tek-grid-column';
|
|
2
|
+
export declare class TekFilterHelper {
|
|
3
|
+
static getLabel(name: string): string;
|
|
4
|
+
static getValue(name: string, column: TekGridColumn): string | string[];
|
|
5
|
+
static register(name: string, label: string, fn: () => Date | [Date, Date]): void;
|
|
6
|
+
static unregister(name: string): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IDictionary } from '@zeedhi/core';
|
|
2
|
+
import { Button, Iterable } from '@zeedhi/common';
|
|
3
|
+
import { ISupportsToolbar, ITekGridFilterButton } from './interfaces';
|
|
4
|
+
import { TekGridColumn } from './tek-grid-column';
|
|
5
|
+
/**
|
|
6
|
+
* Base class for TekGrid Filter Button component
|
|
7
|
+
*/
|
|
8
|
+
export declare class TekGridFilterButton extends Button implements ITekGridFilterButton {
|
|
9
|
+
gridName?: string;
|
|
10
|
+
grid: Iterable<TekGridColumn> & ISupportsToolbar;
|
|
11
|
+
showCheckboxAll: boolean;
|
|
12
|
+
private filterModal?;
|
|
13
|
+
protected filterFormInputs: IDictionary<string[]>;
|
|
14
|
+
constructor(props: ITekGridFilterButton);
|
|
15
|
+
loadGrid(gridName?: string): void;
|
|
16
|
+
click(event?: Event): void;
|
|
17
|
+
private loadFilterValues;
|
|
18
|
+
hideFilterModal(): void;
|
|
19
|
+
destroyFilterModal(): void;
|
|
20
|
+
private createFilterFromColumns;
|
|
21
|
+
onBeforeDestroy(): void;
|
|
22
|
+
private formatFormValue;
|
|
23
|
+
private applyFilter;
|
|
24
|
+
private setFilter;
|
|
25
|
+
private clearFilter;
|
|
26
|
+
private sortFilterIndex;
|
|
27
|
+
private getFilterModalComponents;
|
|
28
|
+
private changeHelperEvent;
|
|
29
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { IDictionary } from '@zeedhi/core';
|
|
2
|
+
import { IGroupedDataManager, ITekGrid, ITekGridSummary } from './interfaces';
|
|
3
|
+
import { TekGridColumn } from './tek-grid-column';
|
|
4
|
+
export declare class GroupedDataManager implements IGroupedDataManager {
|
|
5
|
+
protected grid: ITekGrid;
|
|
6
|
+
summaryColumns: TekGridColumn[];
|
|
7
|
+
private groups;
|
|
8
|
+
private summary;
|
|
9
|
+
private groupedData;
|
|
10
|
+
private groupColumnNames;
|
|
11
|
+
private groupColumns;
|
|
12
|
+
private originalDatasourceLoadAll?;
|
|
13
|
+
private originalDatasourceLimit?;
|
|
14
|
+
private viewUpdateScrollData?;
|
|
15
|
+
private viewUpdateFixedColumns?;
|
|
16
|
+
constructor(grid: ITekGrid);
|
|
17
|
+
setViewUpdateFixedColumns(fn: () => void): void;
|
|
18
|
+
setViewUpdateScrollData(fn: () => void): void;
|
|
19
|
+
/**
|
|
20
|
+
* Tasks that should be finished before loading the grid data
|
|
21
|
+
*/
|
|
22
|
+
private tasksBeforeLoad;
|
|
23
|
+
registerTask(task: Promise<any>): void;
|
|
24
|
+
private request;
|
|
25
|
+
private debounceUpdateGrouping;
|
|
26
|
+
/**
|
|
27
|
+
* Loads grid data after resolving all tasks
|
|
28
|
+
*/
|
|
29
|
+
loadAfterTasks(): Promise<void>;
|
|
30
|
+
private initializeDebounceFunctions;
|
|
31
|
+
/**
|
|
32
|
+
* Initializes grid groups, summary columns and registers the grid datasource callback
|
|
33
|
+
* @param lazyLoad defines if the grid should automatically load data after updating the datasource
|
|
34
|
+
*/
|
|
35
|
+
initializeGrouping(lazyLoad: boolean): void;
|
|
36
|
+
private onGet;
|
|
37
|
+
private resetFooterVariables;
|
|
38
|
+
private initGroups;
|
|
39
|
+
getGroupedData(): IDictionary<any>[];
|
|
40
|
+
private initSummaryColumns;
|
|
41
|
+
/**
|
|
42
|
+
* Calls updateGroupedData with debounce
|
|
43
|
+
*/
|
|
44
|
+
updateGrouping(lazyLoad?: boolean): void;
|
|
45
|
+
/**
|
|
46
|
+
* Inits summary columns, updates the grid datasource and, if needed, reloads the grid data
|
|
47
|
+
*/
|
|
48
|
+
updateGroupedData(lazyLoad: boolean): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* When using groups, should update the grid datasource order to reflect the group order
|
|
51
|
+
* If the grid is not grouped, should not update the datasource order
|
|
52
|
+
*/
|
|
53
|
+
private updateGridDatasource;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the order to be used in the grid datasource based on the group column names and the grid order
|
|
56
|
+
*/
|
|
57
|
+
private getOrder;
|
|
58
|
+
/**
|
|
59
|
+
* Returns the summary data for the group
|
|
60
|
+
*/
|
|
61
|
+
getSummaryData(group: IDictionary<ITekGridSummary>): IDictionary<any>;
|
|
62
|
+
/**
|
|
63
|
+
* Adds group footers to the grouped data
|
|
64
|
+
*/
|
|
65
|
+
private addGroupFooters;
|
|
66
|
+
private getGroupValue;
|
|
67
|
+
private addGroupHeader;
|
|
68
|
+
private calcSummaryValues;
|
|
69
|
+
private calcSummary;
|
|
70
|
+
private addSummary;
|
|
71
|
+
/**
|
|
72
|
+
* It takes a flat array of data and groups it by the group columns specified in
|
|
73
|
+
* the grid.
|
|
74
|
+
*/
|
|
75
|
+
buildGroupedData(): void;
|
|
76
|
+
openGroup(group: IDictionary<any>): void;
|
|
77
|
+
isItemVisible(row: IDictionary<any>): any;
|
|
78
|
+
isGrouped(): boolean;
|
|
79
|
+
isColumnSearchable(column: TekGridColumn): boolean;
|
|
80
|
+
directionalLeft(): void;
|
|
81
|
+
directionalRight(): void;
|
|
82
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DataSelector, IDataSelector, IGrid } from '@zeedhi/common';
|
|
2
|
+
import { IGroupedDataManager } from './interfaces';
|
|
3
|
+
export declare class GroupedDataSelector extends DataSelector implements IDataSelector {
|
|
4
|
+
protected iterable: IGrid & IGroupedDataManager;
|
|
5
|
+
selectAll(isSelected: boolean): void;
|
|
6
|
+
private getData;
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IEventParam } from '@zeedhi/core';
|
|
2
|
+
import { Direction, IViewNavigator } from '@zeedhi/common';
|
|
3
|
+
import { ITekGrid } from './interfaces';
|
|
4
|
+
export declare class GroupedViewNavigator implements IViewNavigator {
|
|
5
|
+
private viewNavigator;
|
|
6
|
+
protected grid: ITekGrid;
|
|
7
|
+
constructor(iterable: ITekGrid);
|
|
8
|
+
navigateLeft(param: IEventParam<any>): void;
|
|
9
|
+
navigateRight(param: IEventParam<any>): void;
|
|
10
|
+
setViewNavigate(viewNavigate: (direction: Direction, event?: Event) => void): void;
|
|
11
|
+
private getRowIndex;
|
|
12
|
+
navigateUp(index?: number): void;
|
|
13
|
+
navigateDown(index?: number): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from '../tek-datasource';
|
|
2
|
+
export * from './tek-grid-toolbar-provider';
|
|
3
|
+
export * from './columns-searcher';
|
|
4
|
+
export * from './dynamic-filter-datasource-factory';
|
|
5
|
+
export * from './filter-helper';
|
|
6
|
+
export * from './grid-filter-button';
|
|
7
|
+
export * from './grouped-data-manager';
|
|
8
|
+
export * from './grouped-view-navigator';
|
|
9
|
+
export * from './interfaces';
|
|
10
|
+
export * from './keymap-grouped';
|
|
11
|
+
export * from './layout-options';
|
|
12
|
+
export * from './tek-grid-column';
|
|
13
|
+
export * from './tek-grid-controller';
|
|
14
|
+
export * from './tek-grid-events';
|
|
15
|
+
export * from './tek-grid';
|
|
16
|
+
export * from './tek-grid-columns-button/tek-grid-columns-button';
|
|
17
|
+
export * from './tek-grid-columns-button/tek-grid-columns-button-controller';
|
|
18
|
+
export * from './grouped-data-selector';
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { Datasource, IDictionary, IEvent, IEventParam } from '@zeedhi/core';
|
|
2
|
+
import { EventDef, GridEventsProp, IButton, IComponent, IComponentEvents, IComponentRender, IGridColumnEditable, IGridEditable, IGridEditableEvents, IGridEditableProps, IGridEvent, IIterableColumnsButton, IModal, Iterable } from '@zeedhi/common';
|
|
3
|
+
import { IDynamicFilterItem } from '../tek-datasource/interfaces';
|
|
4
|
+
import { TekGridColumn } from './tek-grid-column';
|
|
5
|
+
export interface IModalFilterProps extends IModal {
|
|
6
|
+
height?: string;
|
|
7
|
+
maxHeight?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ITekGridLayoutColumn {
|
|
10
|
+
name: string;
|
|
11
|
+
width?: string;
|
|
12
|
+
minWidth?: string;
|
|
13
|
+
maxWidth?: string;
|
|
14
|
+
isVisible?: boolean;
|
|
15
|
+
fixed?: boolean;
|
|
16
|
+
grouped?: boolean;
|
|
17
|
+
aggregation?: ITekGridColumnAggregation;
|
|
18
|
+
label?: string;
|
|
19
|
+
align?: 'left' | 'right' | 'center';
|
|
20
|
+
groupOpened?: boolean;
|
|
21
|
+
filterHelperValue?: string | IDictionary<any>;
|
|
22
|
+
}
|
|
23
|
+
export interface ITekGridLayout {
|
|
24
|
+
name: string;
|
|
25
|
+
gridWidth?: string;
|
|
26
|
+
columns?: ITekGridLayoutColumn[];
|
|
27
|
+
order?: string[];
|
|
28
|
+
dynamicFilter?: IDictionary<IDynamicFilterItem[]>;
|
|
29
|
+
filter?: IDictionary<any>;
|
|
30
|
+
}
|
|
31
|
+
export interface ITekGridLayoutInfo {
|
|
32
|
+
currentLayoutName?: string;
|
|
33
|
+
layouts?: IDictionary<ITekGridLayout>;
|
|
34
|
+
}
|
|
35
|
+
export interface ITekGridLayoutEventParams extends IEventParam<ITekGrid> {
|
|
36
|
+
layouts: ITekGridLayoutInfo;
|
|
37
|
+
}
|
|
38
|
+
export interface ITekGridSummary {
|
|
39
|
+
sum: any;
|
|
40
|
+
avg: any;
|
|
41
|
+
count: number;
|
|
42
|
+
min: any;
|
|
43
|
+
max: any;
|
|
44
|
+
}
|
|
45
|
+
export interface ITekGridCalcSummaryEventParams extends IEventParam<ITekGrid> {
|
|
46
|
+
summary: ITekGridSummary;
|
|
47
|
+
columnName: string;
|
|
48
|
+
rowValue: IDictionary<any>;
|
|
49
|
+
}
|
|
50
|
+
export interface ITekGridProps extends IGridEditableProps, Partial<ISupportsToolbar>, Partial<IExportable> {
|
|
51
|
+
events?: TekGridEventsProp;
|
|
52
|
+
groupsOpened?: boolean;
|
|
53
|
+
showSummaryTotal?: boolean;
|
|
54
|
+
mainGrid?: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface ITekGrid extends IGridEditable<TekGridColumn>, ITekGridEvents, ISupportsToolbar, IExportable, IGroupedDataManager {
|
|
57
|
+
events: TekGridEventsProp;
|
|
58
|
+
groupsOpened: boolean;
|
|
59
|
+
showSummaryTotal: boolean;
|
|
60
|
+
mainGrid: boolean;
|
|
61
|
+
columnHasFilter: (columnName: string) => boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface ISupportsToolbar {
|
|
64
|
+
actions: IComponentRender[];
|
|
65
|
+
addButton: boolean;
|
|
66
|
+
columnsButton: boolean;
|
|
67
|
+
columnsButtonIgnore: string[];
|
|
68
|
+
deleteButton: 'none' | 'currentRow' | 'selection';
|
|
69
|
+
showEditButtons: boolean;
|
|
70
|
+
filterButton: boolean;
|
|
71
|
+
showSearch: boolean;
|
|
72
|
+
showLayoutOptions: boolean;
|
|
73
|
+
title: string;
|
|
74
|
+
showExport: boolean;
|
|
75
|
+
showReload: boolean;
|
|
76
|
+
exportConfig: ITekGridExportConfig[];
|
|
77
|
+
exportActions?: IComponentRender[];
|
|
78
|
+
toolbarOpened: boolean;
|
|
79
|
+
columnFilterButton: boolean;
|
|
80
|
+
modalFilterProps: IModalFilterProps;
|
|
81
|
+
showCheckboxAllFilter: boolean;
|
|
82
|
+
defaultFilter: IDictionary;
|
|
83
|
+
editNewRowsOnly: boolean;
|
|
84
|
+
}
|
|
85
|
+
export interface IExportable {
|
|
86
|
+
reportTitle: string;
|
|
87
|
+
xlsDefaultType?: string;
|
|
88
|
+
getReport(type: string, portrait?: boolean, rowObj?: any): Promise<Window | null>;
|
|
89
|
+
}
|
|
90
|
+
export type IAsyncEvent<T> = (event: T) => Promise<any>;
|
|
91
|
+
export interface TekGridEventsProp<T = IGridEvent | IEventParam<any> | ITekGridLayoutEventParams | ITekGridCalcSummaryEventParams> extends GridEventsProp<T> {
|
|
92
|
+
addClick?: EventDef<T>;
|
|
93
|
+
afterCancel?: EventDef<T>;
|
|
94
|
+
afterDelete?: EventDef<T>;
|
|
95
|
+
afterSave?: EventDef<T>;
|
|
96
|
+
beforeApplyFilter?: EventDef<T>;
|
|
97
|
+
beforeCancel?: EventDef<T>;
|
|
98
|
+
beforeDelete?: EventDef<T>;
|
|
99
|
+
beforeSave?: EventDef<T>;
|
|
100
|
+
calcSummary?: EventDef<T>;
|
|
101
|
+
filterClick?: EventDef<T>;
|
|
102
|
+
loadLayouts?: EventDef<T, IAsyncEvent<T>>;
|
|
103
|
+
saveLayouts?: EventDef<T>;
|
|
104
|
+
groupRowClick?: EventDef<T>;
|
|
105
|
+
groupSelect?: EventDef<T>;
|
|
106
|
+
groupUnselect?: EventDef<T>;
|
|
107
|
+
beforeReload?: EventDef<T>;
|
|
108
|
+
}
|
|
109
|
+
export type MultiOptionParams = {
|
|
110
|
+
iconName: string;
|
|
111
|
+
label: string;
|
|
112
|
+
cssClass?: string;
|
|
113
|
+
reportParams?: {
|
|
114
|
+
portrait?: boolean;
|
|
115
|
+
rowObj?: any;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
export interface ITekGridExportConfig {
|
|
119
|
+
type: string;
|
|
120
|
+
portrait?: boolean;
|
|
121
|
+
label?: string;
|
|
122
|
+
iconName?: string;
|
|
123
|
+
multiOption?: MultiOptionParams[];
|
|
124
|
+
}
|
|
125
|
+
export interface ITekGridEvents extends IGridEditableEvents {
|
|
126
|
+
rowDoubleClick(row: IDictionary<any>, event: Event, element?: HTMLElement): void;
|
|
127
|
+
groupRowClick(row: IDictionary<any>, event: Event, element?: HTMLElement): void;
|
|
128
|
+
groupRowDoubleClick(row: IDictionary<any>, event: Event, element?: HTMLElement): void;
|
|
129
|
+
selectGroupClick(row: IDictionary<any>, isSelected: boolean, event: Event, element?: HTMLElement): void;
|
|
130
|
+
calcSummary(column: TekGridColumn, summary: ITekGridSummary, row: IDictionary): void;
|
|
131
|
+
}
|
|
132
|
+
export type IFilterRelation = 'AND' | 'OR';
|
|
133
|
+
export type IFilterOperation = 'CONTAINS' | 'NOT_CONTAINS' | 'EQUALS' | 'NOT_EQUALS' | 'GREATER_THAN' | 'LESS_THAN' | 'GREATER_THAN_EQUALS' | 'LESS_THAN_EQUALS' | 'IN' | 'NOT_IN' | 'BETWEEN';
|
|
134
|
+
export interface IFilterPropsComponent extends IComponent {
|
|
135
|
+
relation?: IFilterRelation;
|
|
136
|
+
operation?: IFilterOperation;
|
|
137
|
+
helperOptions?: string[];
|
|
138
|
+
helperValue?: string;
|
|
139
|
+
}
|
|
140
|
+
export declare const columnAggregationValues: ["SUM", "MIN", "MAX", "AVG", "COUNT", undefined];
|
|
141
|
+
export type ITekGridColumnAggregation = (typeof columnAggregationValues)[number];
|
|
142
|
+
export interface ITekGridColumn extends IGridColumnEditable {
|
|
143
|
+
filterProps?: IFilterPropsComponent | IFilterPropsComponent[];
|
|
144
|
+
filterable?: boolean;
|
|
145
|
+
filterIndex?: number;
|
|
146
|
+
skipLookupSearch?: boolean;
|
|
147
|
+
grouped?: boolean;
|
|
148
|
+
aggregation?: ITekGridColumnAggregation;
|
|
149
|
+
groupOpened?: boolean;
|
|
150
|
+
groupLabelForEmptyValue?: string;
|
|
151
|
+
}
|
|
152
|
+
export interface IColumnsSearcher {
|
|
153
|
+
searchColumn(columns: ITekGridColumn[], search: string): Promise<IDictionary<(string | number)[]>>;
|
|
154
|
+
}
|
|
155
|
+
export interface IGroupedDataManager {
|
|
156
|
+
initializeGrouping(lazyLoad: boolean): void;
|
|
157
|
+
updateGrouping: (lazyLoad?: boolean) => void;
|
|
158
|
+
updateGroupedData(lazyLoad: boolean): Promise<void>;
|
|
159
|
+
buildGroupedData(): void;
|
|
160
|
+
openGroup(group: IDictionary<any>): void;
|
|
161
|
+
isItemVisible(row: IDictionary<any>): any;
|
|
162
|
+
isGrouped(): boolean;
|
|
163
|
+
isColumnSearchable(column: TekGridColumn): boolean;
|
|
164
|
+
getGroupedData(): IDictionary<any>[];
|
|
165
|
+
directionalLeft(param: IEventParam<any>): void;
|
|
166
|
+
directionalRight(param: IEventParam<any>): void;
|
|
167
|
+
loadAfterTasks(): Promise<void>;
|
|
168
|
+
registerTask(task: Promise<any>): void;
|
|
169
|
+
setViewUpdateFixedColumns(fn: () => void): void;
|
|
170
|
+
setViewUpdateScrollData(fn: () => void): void;
|
|
171
|
+
}
|
|
172
|
+
export interface ITekGridGroupHeader {
|
|
173
|
+
group: boolean;
|
|
174
|
+
groupRow: IDictionary;
|
|
175
|
+
groupColumnName: string;
|
|
176
|
+
groupHeader: boolean;
|
|
177
|
+
groupIndex: number;
|
|
178
|
+
groupLabel: string;
|
|
179
|
+
groupValue: any;
|
|
180
|
+
groupOpened: boolean;
|
|
181
|
+
groupHeaders: ITekGridGroupHeader[];
|
|
182
|
+
children: IDictionary<any>[];
|
|
183
|
+
}
|
|
184
|
+
export interface ITekGridGroupFooter {
|
|
185
|
+
groupFooter: boolean;
|
|
186
|
+
groupIndex: number;
|
|
187
|
+
groupHeaders: ITekGridGroupHeader[];
|
|
188
|
+
groupLabel: string;
|
|
189
|
+
groupValue: any;
|
|
190
|
+
[key: string]: any;
|
|
191
|
+
}
|
|
192
|
+
export interface ITekGridFooter {
|
|
193
|
+
[key: string]: ITekGridSummary;
|
|
194
|
+
}
|
|
195
|
+
export interface ITekGridGroup {
|
|
196
|
+
column: ITekGridColumn;
|
|
197
|
+
name: string;
|
|
198
|
+
label: string;
|
|
199
|
+
lastValue: any;
|
|
200
|
+
footer: ITekGridFooter;
|
|
201
|
+
initialized: boolean;
|
|
202
|
+
lastGroupHeaderRow?: ITekGridGroupHeader;
|
|
203
|
+
}
|
|
204
|
+
export interface ITekGridAtoms {
|
|
205
|
+
TITLE: string;
|
|
206
|
+
HIDE_BUTTON: string;
|
|
207
|
+
ADD_BUTTON: string;
|
|
208
|
+
DELETE_BUTTON: string;
|
|
209
|
+
REFRESH_BUTTON: string;
|
|
210
|
+
COLUMNS_BUTTON: string;
|
|
211
|
+
LAYOUT_BUTTON: string;
|
|
212
|
+
EXPORT_BUTTON: string;
|
|
213
|
+
ACTIONS_BUTTON: string;
|
|
214
|
+
SAVE_BUTTON: string;
|
|
215
|
+
CANCEL_BUTTON: string;
|
|
216
|
+
SEARCH: string;
|
|
217
|
+
FILTER_BUTTON: string;
|
|
218
|
+
FILTER_MODAL: string;
|
|
219
|
+
FILTER_FORM: string;
|
|
220
|
+
EXPORT_DROPDOWN: string;
|
|
221
|
+
ACTIONS_DROPDOWN: string;
|
|
222
|
+
HIDE_TOOLTIP: string;
|
|
223
|
+
TOOLBAR_DIV: string;
|
|
224
|
+
NOT_EDITING_SPAN: string;
|
|
225
|
+
ADD_TOOLTIP: string;
|
|
226
|
+
DELETE_TOOLTIP: string;
|
|
227
|
+
DIVIDER1: string;
|
|
228
|
+
REFRESH_TOOLTIP: string;
|
|
229
|
+
DIVIDER2: string;
|
|
230
|
+
COLUMNS_TOOLTIP: string;
|
|
231
|
+
DIVIDER_ACTIONS: string;
|
|
232
|
+
DIVIDER3: string;
|
|
233
|
+
FILTER_TOOLTIP: string;
|
|
234
|
+
}
|
|
235
|
+
export interface ITekGridToolbarProvider {
|
|
236
|
+
getProperties(): IComponentRender[];
|
|
237
|
+
getAtomInstance<T>(key: keyof ITekGridAtoms): T;
|
|
238
|
+
getAtomName(key: keyof ITekGridAtoms): string;
|
|
239
|
+
}
|
|
240
|
+
export interface IDynamicFilterDatasourceFactory {
|
|
241
|
+
factory(options: IDictionary<boolean>): Datasource;
|
|
242
|
+
}
|
|
243
|
+
export type ITekGridLayoutOptionsEvent<T> = (event: T) => Promise<any>;
|
|
244
|
+
export interface ITekGridLayoutOptionsEvents<T = IEventParam<any> | ITekGridLayoutEventParams> extends IComponentEvents<T> {
|
|
245
|
+
loadLayouts?: IAsyncEvent<T>;
|
|
246
|
+
saveLayouts?: IEvent<T>;
|
|
247
|
+
[key: string]: any;
|
|
248
|
+
}
|
|
249
|
+
export interface ITekGridLayoutOptions extends IComponentRender {
|
|
250
|
+
events?: ITekGridLayoutOptionsEvents;
|
|
251
|
+
}
|
|
252
|
+
export interface ITekGridFilterButton extends IButton {
|
|
253
|
+
gridName?: string;
|
|
254
|
+
grid?: Iterable & ISupportsToolbar;
|
|
255
|
+
showCheckboxAll?: boolean;
|
|
256
|
+
}
|
|
257
|
+
export interface ITekGridColumnsButton extends IIterableColumnsButton {
|
|
258
|
+
hideGroups?: boolean;
|
|
259
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IKeyMap } from '@zeedhi/core';
|
|
2
|
+
import { Component, IKeyMapConfig } from '@zeedhi/common';
|
|
3
|
+
import { IGroupedDataManager } from './interfaces';
|
|
4
|
+
export declare class KeyMapGrouped implements IKeyMapConfig<IGroupedDataManager> {
|
|
5
|
+
getMap(instance: Component & IGroupedDataManager): IKeyMap;
|
|
6
|
+
}
|