@zeedhi/teknisa-components-common 1.37.0 → 1.41.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 (31) hide show
  1. package/coverage/clover.xml +789 -617
  2. package/coverage/coverage-final.json +30 -27
  3. package/coverage/lcov-report/block-navigation.js +8 -0
  4. package/coverage/lcov-report/index.html +55 -19
  5. package/coverage/lcov-report/sorter.js +26 -0
  6. package/coverage/lcov.info +1506 -1181
  7. package/dist/tek-components-common.esm.js +1808 -1347
  8. package/dist/tek-components-common.umd.js +1808 -1344
  9. package/package.json +2 -2
  10. package/tests/unit/components/tek-datasource/memory-datasource.spec.ts +20 -4
  11. package/tests/unit/components/tek-grid/filter-helper.spec.ts +145 -0
  12. package/tests/unit/components/tek-grid/grid.spec.ts +376 -58
  13. package/tests/unit/components/tek-grid/layout_options.spec.ts +58 -0
  14. package/tests/unit/components/tek-loading/Loading.spec.ts +30 -0
  15. package/tests/unit/components/tree-grid/tree-grid.spec.ts +469 -0
  16. package/tests/unit/{components/tek-grid → utils/grid-base}/grid-controller.spec.ts +3 -3
  17. package/types/components/index.d.ts +5 -0
  18. package/types/components/tek-datasource/memory-datasource.d.ts +1 -0
  19. package/types/components/tek-grid/filter-dynamic-values.d.ts +9 -0
  20. package/types/components/tek-grid/filter-helper.d.ts +9 -0
  21. package/types/components/tek-grid/grid-columns-button.d.ts +2 -0
  22. package/types/components/tek-grid/grid.d.ts +12 -19
  23. package/types/components/tek-grid/interfaces.d.ts +15 -1
  24. package/types/components/tek-grid/layout-options.d.ts +3 -2
  25. package/types/components/tek-loading/interfaces.d.ts +6 -0
  26. package/types/components/tek-loading/loading.d.ts +24 -0
  27. package/types/components/tek-tree-grid/interfaces.d.ts +19 -0
  28. package/types/components/tek-tree-grid/tree-grid.d.ts +76 -0
  29. package/types/utils/grid-base/grid-base.d.ts +267 -0
  30. package/types/utils/grid-base/grid-controller.d.ts +20 -0
  31. package/types/utils/index.d.ts +3 -1
@@ -1,5 +1,5 @@
1
1
  import { GridEditable, IComponentRender } from '@zeedhi/common';
2
- import { IDictionary } from '@zeedhi/core';
2
+ import { Datasource, IDictionary } from '@zeedhi/core';
3
3
  import { TekGridColumn } from './grid-column';
4
4
  import { ITekGrid, ITekGridColumn, ITekGridEvents, ITekGridExportConfig } from './interfaces';
5
5
  export declare class TekGrid extends GridEditable implements ITekGrid {
@@ -43,7 +43,6 @@ export declare class TekGrid extends GridEditable implements ITekGrid {
43
43
  * Export config
44
44
  */
45
45
  exportConfig: ITekGridExportConfig[];
46
- private exportConfigButtons;
47
46
  /**
48
47
  * Actions to overwrite the default export config
49
48
  */
@@ -63,35 +62,21 @@ export declare class TekGrid extends GridEditable implements ITekGrid {
63
62
  private toolbarSlotProps;
64
63
  viewUpdateScrollData?: () => void;
65
64
  viewUpdateFixedColumns?: () => void;
65
+ private gridBase;
66
+ filterRelationsDatasource: Datasource;
67
+ filterOperationsDatasource: Datasource;
66
68
  /**
67
69
  * TekGrid class constructor
68
70
  * @param props TekGrid properties
69
71
  */
70
72
  constructor(props: ITekGrid);
71
- private getExportConfigButtons;
72
73
  onCreated(): void;
73
74
  /**
74
75
  * Get Grid columns objects
75
76
  * @param columns Grid columns parameter
76
77
  */
77
78
  protected getColumns(columns: ITekGridColumn[]): TekGridColumn[];
78
- private createToolbarProps;
79
- private saveChanges;
80
- private cancelChanges;
81
- private addButtonClick;
82
- private deleteButtonClick;
83
- private reloadGrid;
84
- private filterClick;
85
- private filterModal?;
86
- private createFilterFromColumns;
87
- hideFilterModal(): void;
88
- private getFilterModalComponents;
89
- private loadFilterValues;
90
- private applyFilter;
91
79
  columnHasFilterData(column: TekGridColumn): any;
92
- filterRelationsDatasource: any;
93
- filterOperationsDatasource: any;
94
- private getFilterOptionsData;
95
80
  private buildReportGroups;
96
81
  private buildReportAggregations;
97
82
  getReport(type: string, portrait?: boolean, rowObj?: any): Promise<Window | null>;
@@ -140,4 +125,12 @@ export declare class TekGrid extends GridEditable implements ITekGrid {
140
125
  * @param element DOM Element
141
126
  */
142
127
  groupRowClick(row: IDictionary<any>, event: Event, element: HTMLElement): void;
128
+ /**
129
+ * Dispatches group select/unselect event
130
+ * @param row Group row
131
+ * @param isSelected Row is selected
132
+ * @param event DOM event
133
+ * @param element DOM Element
134
+ */
135
+ selectGroupClick(row: IDictionary<any>, isSelected: boolean, event: Event, element: HTMLElement): void;
143
136
  }
@@ -18,6 +18,8 @@ export interface ITekGridEvents<T = IEventParam<any> | ITekGridLayoutEventParams
18
18
  loadLayouts?: ITekGridEvent<T>;
19
19
  saveLayouts?: IEvent<T>;
20
20
  groupRowClick?: IEvent<T>;
21
+ groupSelect?: IEvent<T>;
22
+ groupUnselect?: IEvent<T>;
21
23
  [key: string]: any;
22
24
  }
23
25
  export declare type ITekGridLayoutOptionsEvent<T> = (event: T) => Promise<any>;
@@ -67,7 +69,7 @@ export declare const columnAggregationValues: ["SUM", "MIN", "MAX", "AVG", "COUN
67
69
  export declare type ITekGridColumnAggregation = (typeof columnAggregationValues)[number];
68
70
  export interface ITekGridLayoutColumn {
69
71
  name: string;
70
- width: string;
72
+ width?: string;
71
73
  minWidth?: string;
72
74
  maxWidth?: string;
73
75
  isVisible?: boolean;
@@ -77,6 +79,7 @@ export interface ITekGridLayoutColumn {
77
79
  label?: string;
78
80
  align?: 'left' | 'right' | 'center';
79
81
  groupOpened?: boolean;
82
+ filterHelperValue?: string | IDictionary<any>;
80
83
  }
81
84
  export interface ITekGridLayoutOptions extends IComponentRender {
82
85
  events?: ITekGridLayoutOptionsEvents;
@@ -86,6 +89,8 @@ export declare type IFilterOperation = 'CONTAINS' | 'NOT_CONTAINS' | 'EQUALS' |
86
89
  export interface IFilterPropsComponent extends IComponent {
87
90
  relation?: IFilterRelation;
88
91
  operation?: IFilterOperation;
92
+ helperOptions?: string[];
93
+ helperValue?: string;
89
94
  }
90
95
  export interface ITekGridColumn extends IGridColumnEditable {
91
96
  filterProps?: IFilterPropsComponent | IFilterPropsComponent[];
@@ -98,6 +103,7 @@ export interface ITekGridColumn extends IGridColumnEditable {
98
103
  storeData?: boolean;
99
104
  }
100
105
  export interface ITekGridColumnsButton extends IIterableColumnsButton {
106
+ hideGroups?: boolean;
101
107
  }
102
108
  export interface ITekGridGroup {
103
109
  column: ITekGridColumn;
@@ -118,6 +124,7 @@ export interface ITekGridGroupHeader {
118
124
  groupValue: any;
119
125
  groupOpened: boolean;
120
126
  groupHeaders: ITekGridGroupHeader[];
127
+ children: IDictionary<any>[];
121
128
  }
122
129
  export interface ITekGridFooter {
123
130
  [key: string]: ITekGridSummary;
@@ -128,3 +135,10 @@ export interface ITekGridSummary {
128
135
  min: any;
129
136
  max: any;
130
137
  }
138
+ export interface ITekFilterHelperValue {
139
+ label: string;
140
+ fn: () => Date | [Date, Date];
141
+ }
142
+ export interface ITekFilterHelperValues {
143
+ [key: string]: ITekFilterHelperValue;
144
+ }
@@ -1,6 +1,6 @@
1
1
  import { ComponentRender, Grid } from '@zeedhi/common';
2
2
  import { IDictionary } from '@zeedhi/core';
3
- import { IDynamicFilterItem } from '..';
3
+ import { IDynamicFilterItem, ITekGridLayoutColumn } from '..';
4
4
  import { ITekGridLayoutOptions, ITekGridLayout, ITekGridLayoutOptionsEvents } from './interfaces';
5
5
  export declare class TekGridLayoutOptions extends ComponentRender implements ITekGridLayoutOptions {
6
6
  currentLayoutName: string;
@@ -8,7 +8,7 @@ export declare class TekGridLayoutOptions extends ComponentRender implements ITe
8
8
  layouts: IDictionary<ITekGridLayout>;
9
9
  layoutNames: string[];
10
10
  viewApplyLayout?: Function;
11
- originalColumnProps: IDictionary<any>[];
11
+ originalColumnProps: ITekGridLayoutColumn[];
12
12
  originalDatasourceOrder: string[];
13
13
  originalDatasourceDynamicFilter: IDictionary<IDynamicFilterItem[]>;
14
14
  originalDatasourceFilter: IDictionary<any>;
@@ -16,6 +16,7 @@ export declare class TekGridLayoutOptions extends ComponentRender implements ITe
16
16
  grid: Grid;
17
17
  private getParentGrid;
18
18
  onMounted(element: HTMLElement): Promise<void>;
19
+ getHelperValue(column: any): string | (string | undefined)[] | undefined;
19
20
  newLayout(newLayout: ITekGridLayout): void;
20
21
  applyLayout(name: string, save?: boolean): void;
21
22
  private saveLayouts;
@@ -0,0 +1,6 @@
1
+ import { IComponentRender } from '@zeedhi/common';
2
+ export interface ILoading extends IComponentRender {
3
+ text?: string;
4
+ zIndex?: number | string;
5
+ image?: string;
6
+ }
@@ -0,0 +1,24 @@
1
+ import { ComponentRender } from '@zeedhi/common';
2
+ import { ILoading } from './interfaces';
3
+ /**
4
+ * Teknisa component
5
+ */
6
+ export declare class Loading extends ComponentRender implements ILoading {
7
+ /**
8
+ * text to show in Loader Overlay
9
+ */
10
+ text: string;
11
+ /**
12
+ * zIndex value.
13
+ */
14
+ zIndex: number | string;
15
+ /**
16
+ * loading path.
17
+ */
18
+ image: string;
19
+ /**
20
+ * Creates a new instance of TekLoading
21
+ * @param props Image Link props
22
+ */
23
+ constructor(props: ILoading);
24
+ }
@@ -0,0 +1,19 @@
1
+ import { IComponentRender, ITreeGridEditable } from '@zeedhi/common';
2
+ import { ITekGridColumn, ITekGridEvents, ITekGridExportConfig } from '..';
3
+ export interface ITekTreeGrid extends ITreeGridEditable {
4
+ actions?: IComponentRender[];
5
+ addButton?: boolean;
6
+ columnFilterButton?: boolean;
7
+ columns?: ITekGridColumn[];
8
+ columnsButton?: boolean;
9
+ columnsButtonIgnore?: string[];
10
+ deleteButton?: 'none' | 'currentRow' | 'selection';
11
+ events?: ITekGridEvents;
12
+ filterButton?: boolean;
13
+ showLayoutOptions?: boolean;
14
+ title?: string;
15
+ showExport?: boolean;
16
+ showReload?: boolean;
17
+ exportConfig?: ITekGridExportConfig[];
18
+ exportActions?: IComponentRender[];
19
+ }
@@ -0,0 +1,76 @@
1
+ import { IComponentRender, TreeGridEditable } from '@zeedhi/common';
2
+ import { Datasource, IDictionary } from '@zeedhi/core';
3
+ import { TekGridColumn } from '../tek-grid/grid-column';
4
+ import { ITekGrid, ITekGridColumn, ITekGridEvents, ITekGridExportConfig } from '../tek-grid/interfaces';
5
+ import { ITekTreeGrid } from './interfaces';
6
+ export declare class TekTreeGrid extends TreeGridEditable implements ITekTreeGrid {
7
+ title: string;
8
+ addButton: boolean;
9
+ deleteButton: 'none' | 'currentRow' | 'selection';
10
+ actions: IComponentRender[];
11
+ filterButton: boolean;
12
+ columnFilterButton: boolean;
13
+ columnsButton: boolean;
14
+ columnsButtonIgnore: string[];
15
+ events: ITekGridEvents;
16
+ /**
17
+ * Enables column dragging
18
+ * @public
19
+ */
20
+ dragColumns: boolean;
21
+ /**
22
+ * Enables column resizing
23
+ * @public
24
+ */
25
+ resizeColumns: boolean;
26
+ /**
27
+ * Enables layout saving
28
+ * @public
29
+ */
30
+ showLayoutOptions: boolean;
31
+ /**
32
+ * Editable columns
33
+ */
34
+ columns: TekGridColumn[];
35
+ /**
36
+ * Show export button
37
+ */
38
+ showExport: boolean;
39
+ /**
40
+ * Show refresh button
41
+ */
42
+ showReload: boolean;
43
+ /**
44
+ * Export config
45
+ */
46
+ exportConfig: ITekGridExportConfig[];
47
+ /**
48
+ * Actions to overwrite the default export config
49
+ */
50
+ exportActions?: IComponentRender[];
51
+ private toolbarSlotProps;
52
+ private gridBase;
53
+ filterRelationsDatasource: Datasource;
54
+ filterOperationsDatasource: Datasource;
55
+ /**
56
+ * TekTreeGrid class constructor
57
+ * @param props TekTreeGrid properties
58
+ */
59
+ constructor(props: ITekGrid);
60
+ onCreated(): void;
61
+ /**
62
+ * Get Grid columns objects
63
+ * @param columns Grid columns parameter
64
+ */
65
+ protected getColumns(columns: ITekGridColumn[]): TekGridColumn[];
66
+ columnHasFilterData(column: TekGridColumn): any;
67
+ getReport(type: string, portrait?: boolean, rowObj?: any): Promise<Window | null>;
68
+ setSearch(search: string): Promise<any>;
69
+ /**
70
+ * Dispatches row click event
71
+ * @param row Grid row
72
+ * @param event DOM event
73
+ * @param element DOM Element
74
+ */
75
+ rowClick(row: IDictionary<any>, event: Event, element: HTMLElement): void;
76
+ }
@@ -0,0 +1,267 @@
1
+ import { IButton } from '@zeedhi/common';
2
+ import { IEventParam } from '@zeedhi/core';
3
+ import { TekGrid, TekTreeGrid } from '../../components';
4
+ export declare class GridBase {
5
+ private grid;
6
+ private exportConfigButtons;
7
+ constructor(grid: TekGrid | TekTreeGrid);
8
+ private getExportConfigButtons;
9
+ createToolbarProps(): ({
10
+ name: string;
11
+ component: string;
12
+ cssClass: string;
13
+ tag: string;
14
+ text: string;
15
+ title: string;
16
+ cssStyle?: undefined;
17
+ isVisible?: undefined;
18
+ children?: undefined;
19
+ label?: undefined;
20
+ small?: undefined;
21
+ events?: undefined;
22
+ outline?: undefined;
23
+ bottom?: undefined;
24
+ } | {
25
+ name: string;
26
+ component: string;
27
+ cssClass?: undefined;
28
+ tag?: undefined;
29
+ text?: undefined;
30
+ title?: undefined;
31
+ cssStyle?: undefined;
32
+ isVisible?: undefined;
33
+ children?: undefined;
34
+ label?: undefined;
35
+ small?: undefined;
36
+ events?: undefined;
37
+ outline?: undefined;
38
+ bottom?: undefined;
39
+ } | {
40
+ name: string;
41
+ component: string;
42
+ tag: string;
43
+ cssStyle: string;
44
+ isVisible: string;
45
+ children: ({
46
+ name: string;
47
+ component: string;
48
+ label: string;
49
+ bottom: boolean;
50
+ children: {
51
+ name: string;
52
+ component: string;
53
+ icon: boolean;
54
+ iconName: string;
55
+ isVisible: string;
56
+ events: {
57
+ click: ({ event }: IEventParam<any>) => void;
58
+ };
59
+ }[];
60
+ cssClass?: undefined;
61
+ vertical?: undefined;
62
+ isVisible?: undefined;
63
+ offsetY?: undefined;
64
+ activator?: undefined;
65
+ } | {
66
+ name: string;
67
+ component: string;
68
+ label: string;
69
+ bottom: boolean;
70
+ children: {
71
+ name: string;
72
+ component: string;
73
+ icon: boolean;
74
+ iconName: string;
75
+ isVisible: string;
76
+ disabled: string;
77
+ events: {
78
+ click: ({ event }: IEventParam<any>) => void;
79
+ };
80
+ }[];
81
+ cssClass?: undefined;
82
+ vertical?: undefined;
83
+ isVisible?: undefined;
84
+ offsetY?: undefined;
85
+ activator?: undefined;
86
+ } | {
87
+ name: string;
88
+ component: string;
89
+ cssClass: string;
90
+ vertical: boolean;
91
+ isVisible: string;
92
+ label?: undefined;
93
+ bottom?: undefined;
94
+ children?: undefined;
95
+ offsetY?: undefined;
96
+ activator?: undefined;
97
+ } | {
98
+ name: string;
99
+ component: string;
100
+ label: string;
101
+ bottom: boolean;
102
+ children: {
103
+ name: string;
104
+ component: string;
105
+ icon: boolean;
106
+ iconName: string;
107
+ isVisible: boolean;
108
+ events: {
109
+ click: () => void;
110
+ };
111
+ }[];
112
+ cssClass?: undefined;
113
+ vertical?: undefined;
114
+ isVisible?: undefined;
115
+ offsetY?: undefined;
116
+ activator?: undefined;
117
+ } | {
118
+ name: string;
119
+ component: string;
120
+ label: string;
121
+ bottom: boolean;
122
+ children: {
123
+ name: string;
124
+ component: string;
125
+ isVisible: string;
126
+ iterableComponentName: string;
127
+ hideGroups: boolean;
128
+ ignoreColumns: string;
129
+ }[];
130
+ cssClass?: undefined;
131
+ vertical?: undefined;
132
+ isVisible?: undefined;
133
+ offsetY?: undefined;
134
+ activator?: undefined;
135
+ } | {
136
+ name: string;
137
+ component: string;
138
+ isVisible: string;
139
+ label?: undefined;
140
+ bottom?: undefined;
141
+ children?: undefined;
142
+ cssClass?: undefined;
143
+ vertical?: undefined;
144
+ offsetY?: undefined;
145
+ activator?: undefined;
146
+ } | {
147
+ name: string;
148
+ component: string;
149
+ cssClass: string;
150
+ offsetY: boolean;
151
+ activator: {
152
+ name: string;
153
+ component: string;
154
+ icon: boolean;
155
+ iconName: string;
156
+ isVisible: string;
157
+ };
158
+ children: IButton[] | import("@zeedhi/common").IComponentRender[];
159
+ label?: undefined;
160
+ bottom?: undefined;
161
+ vertical?: undefined;
162
+ isVisible?: undefined;
163
+ } | {
164
+ name: string;
165
+ component: string;
166
+ cssClass: string;
167
+ vertical: boolean;
168
+ label?: undefined;
169
+ bottom?: undefined;
170
+ children?: undefined;
171
+ isVisible?: undefined;
172
+ offsetY?: undefined;
173
+ activator?: undefined;
174
+ })[];
175
+ cssClass?: undefined;
176
+ text?: undefined;
177
+ title?: undefined;
178
+ label?: undefined;
179
+ small?: undefined;
180
+ events?: undefined;
181
+ outline?: undefined;
182
+ bottom?: undefined;
183
+ } | {
184
+ name: string;
185
+ component: string;
186
+ label: string;
187
+ isVisible: string;
188
+ small: boolean;
189
+ events: {
190
+ click: ({ event }: IEventParam<any>) => void;
191
+ };
192
+ cssClass?: undefined;
193
+ tag?: undefined;
194
+ text?: undefined;
195
+ title?: undefined;
196
+ cssStyle?: undefined;
197
+ children?: undefined;
198
+ outline?: undefined;
199
+ bottom?: undefined;
200
+ } | {
201
+ name: string;
202
+ component: string;
203
+ label: string;
204
+ outline: boolean;
205
+ cssClass: string;
206
+ isVisible: string;
207
+ small: boolean;
208
+ events: {
209
+ click: ({ event }: IEventParam<any>) => void;
210
+ };
211
+ tag?: undefined;
212
+ text?: undefined;
213
+ title?: undefined;
214
+ cssStyle?: undefined;
215
+ children?: undefined;
216
+ bottom?: undefined;
217
+ } | {
218
+ name: string;
219
+ component: string;
220
+ label: string;
221
+ bottom: boolean;
222
+ children: {
223
+ name: string;
224
+ component: string;
225
+ icon: boolean;
226
+ iconName: string;
227
+ isVisible: string;
228
+ events: {
229
+ click: ({ event }: any) => void;
230
+ };
231
+ }[];
232
+ cssClass?: undefined;
233
+ tag?: undefined;
234
+ text?: undefined;
235
+ title?: undefined;
236
+ cssStyle?: undefined;
237
+ isVisible?: undefined;
238
+ small?: undefined;
239
+ events?: undefined;
240
+ outline?: undefined;
241
+ })[];
242
+ private addButtonClick;
243
+ private deleteButtonClick;
244
+ private reloadGrid;
245
+ private saveChanges;
246
+ private cancelChanges;
247
+ private filterClick;
248
+ private filterModal?;
249
+ private createFilterFromColumns;
250
+ hideFilterModal(): void;
251
+ private getFilterModalComponents;
252
+ private getHelperValueComponent;
253
+ private createHelperValueOptions;
254
+ private helperValuesOptionClick;
255
+ private setFilterPropsHelperValue;
256
+ private registerFilterComponentToForm;
257
+ private clearFilterHelperValue;
258
+ private loadFilterValues;
259
+ private applyFilter;
260
+ getFilterRelationsDatasource(): any;
261
+ getFilterOperationsDatasource(): any;
262
+ getFilterOptionsData(prop: string): {
263
+ text: string;
264
+ value: string;
265
+ }[];
266
+ setSearch(search: string): Promise<any>;
267
+ }
@@ -0,0 +1,20 @@
1
+ import { TekGrid } from '../../components/tek-grid/grid';
2
+ import { TekTreeGrid } from '../../components/tek-tree-grid/tree-grid';
3
+ export declare class GridController {
4
+ private grid;
5
+ constructor(grid: TekGrid | TekTreeGrid);
6
+ get gridTitle(): string;
7
+ get showAddButton(): boolean;
8
+ get showDeleteButton(): boolean;
9
+ get showFilterButton(): boolean;
10
+ get showColumnsButton(): boolean;
11
+ get columnsButtonIgnore(): string[];
12
+ get showLayoutOptions(): boolean;
13
+ get showFirstDivider(): boolean;
14
+ get showActionsButton(): boolean;
15
+ get showExportButton(): boolean;
16
+ get showActionAndExportButton(): boolean;
17
+ get isEditing(): boolean;
18
+ get isNotEditing(): boolean;
19
+ get disableDeleteButton(): boolean;
20
+ }
@@ -1,2 +1,4 @@
1
1
  import { ReportFilter } from './report-filter/report-filter';
2
- export { ReportFilter };
2
+ import { GridBase } from './grid-base/grid-base';
3
+ import { GridController } from './grid-base/grid-controller';
4
+ export { ReportFilter, GridBase, GridController };