cats-data-grid 1.0.1 → 2.0.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.
package/index.d.ts CHANGED
@@ -1,5 +1,421 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- /// <amd-module name="cats-data-grid" />
5
- export * from './public-api';
1
+ import * as i0 from '@angular/core';
2
+ import { OnChanges, OnInit, EventEmitter, ChangeDetectorRef, SimpleChanges } from '@angular/core';
3
+
4
+ declare class CatsDataGridService {
5
+ constructor();
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<CatsDataGridService, never>;
7
+ static ɵprov: i0.ɵɵInjectableDeclaration<CatsDataGridService>;
8
+ }
9
+
10
+ interface DateConfig {
11
+ selectionMode: 'single' | 'range';
12
+ enableTime?: boolean;
13
+ }
14
+
15
+ declare class CatsDataGridComponent implements OnChanges, OnInit {
16
+ private cd;
17
+ tableOptions: any;
18
+ totalRecords: number;
19
+ sortingRequired: boolean;
20
+ checkBoxSelection: boolean;
21
+ checkboxSelectionType: string;
22
+ rowData: any[];
23
+ colDefs: any[];
24
+ paginationRequired: boolean;
25
+ selectedRowEmpty: boolean;
26
+ filterRequired: boolean;
27
+ threeDotsMenuRequired: boolean;
28
+ showDropdown: boolean;
29
+ height: number;
30
+ groupByRequired: boolean;
31
+ onPaginationChange: EventEmitter<any>;
32
+ onCheckboxSelection: EventEmitter<any>;
33
+ onScrollEmitter: EventEmitter<any>;
34
+ filter: EventEmitter<any>;
35
+ activeFilterIndex: number | null;
36
+ originalRowData: any[];
37
+ pageDetails: any;
38
+ recordsToShow: any;
39
+ sortingColumnIndex: number;
40
+ sortingType: any;
41
+ selectedRow: any[];
42
+ pageSizeList: number[];
43
+ showPageSizeList: boolean;
44
+ dragOverIndex: null | number;
45
+ draggedIndex: null | number;
46
+ originalColDefs: any[];
47
+ filteredRowData: any[];
48
+ filteredData: any[];
49
+ currentColumn: any;
50
+ currentIndex: number;
51
+ menuVisible: boolean[];
52
+ menuPosition: any[];
53
+ activeFilters: Set<any>;
54
+ resizingColumnIndex: number | null;
55
+ startX: number;
56
+ startWidth: number;
57
+ isResizing: boolean;
58
+ groupedResult: any[];
59
+ showMoveIcon: any;
60
+ columnDraggable: any[];
61
+ activeGroups: any[];
62
+ groupBy: string[];
63
+ dragGroupIndex: number | null;
64
+ dateConfig: DateConfig;
65
+ filterOptions: {
66
+ label: string;
67
+ value: string;
68
+ }[];
69
+ numberFilterOptions: {
70
+ label: string;
71
+ value: string;
72
+ }[];
73
+ showPin: boolean;
74
+ pinActionClicked: any;
75
+ constructor(cd: ChangeDetectorRef);
76
+ ngOnInit(): void;
77
+ ngOnChanges(changes: SimpleChanges): void;
78
+ /**
79
+ * @description Prepares and normalizes column definitions for filtering and menu behavior
80
+ * @author Anand Pandey
81
+ * @param {any[]} colDefs - Raw column definitions received from the parent.
82
+ * @returns {any[]} - Updated column definitions with filter/menu
83
+ */
84
+ getUpdatedColDefs(colDefs: any[]): any[];
85
+ normalizeSetFilterType(value: any, key: string): any[] | undefined;
86
+ /**
87
+ * @description - Evaluates a text-based filter condition on a given field value.
88
+ * @author Anand Pandey
89
+ * @param {string} type - The type of text filter to apply ('contains' | 'doesNotContain' | 'equals' etc).
90
+ * @param {string} fieldValue - The actual value from the data row being evaluated.
91
+ * @param {string} value - The user-entered filter value to compare against.
92
+ * @returns {boolean} `true` if the fieldValue satisfies the specified filter condition,
93
+ * otherwise `false`.
94
+ */
95
+ evaluateTextFilterCondition(type: string, fieldValue: string, value: string): boolean;
96
+ /**
97
+ * @description - Evaluates number/date filter conditions.
98
+ * @author Anand
99
+ * @param {string} type - Comparison operator ('=' | '>' | '<' | '>=' | '<=').
100
+ * @param {number|string} fieldValue - Actual value from the row (number or timestamp).
101
+ * @param {number|string} value - User-entered value for comparison.
102
+ * @returns {boolean} True if the condition matches, otherwise false.
103
+ */
104
+ evaluateNumDateFilterCondition(type: string, fieldValue: number | string, value: number | string): boolean;
105
+ /**
106
+ * @description Method to filter data according to filterType and comparator selection
107
+ * @author Anand Pandey
108
+ * @param {}
109
+ * @returns void
110
+ */
111
+ applyAllFilters(): void;
112
+ resetFilter(col: any): void;
113
+ /**
114
+ * @description Method to change the data format to utc
115
+ * @author Anand Pandey
116
+ * @param {date} - date value to be changed
117
+ * @returns date in milliseconds
118
+ */
119
+ normalizeDate(dateStr: string): number | null;
120
+ /**
121
+ * @description
122
+ * Filters the available set options inside a Set Filter (checkbox filter)
123
+ * based on the user's search text. This updates only the list shown in
124
+ * the dropdown
125
+ * @author Anand Pandey
126
+ * @param col - Column definition object containing filter config
127
+ * @param event - Input event from the search textbox
128
+ * @returns void
129
+ */
130
+ filterSetOptions(col: any, event: any): void;
131
+ /**
132
+ * @description
133
+ * Toggles an individual checkbox option inside a Set Filter. *
134
+ * @author Anand Pandey
135
+ * @param col - Column definition object
136
+ * @param opt - Selected option value
137
+ * @param event - Checkbox change event
138
+ * @returns void
139
+ */
140
+ toggleSetOption(col: any, opt: any, event: any): void;
141
+ /**
142
+ * @description * Selects or deselects all checkbox options in the Set Filter.
143
+ * @author Anand Pandey
144
+ * @param col - Column definition object
145
+ * @param event - Checkbox change event
146
+ * @returns void
147
+ */
148
+ toggleSelectAll(col: any, event: any): void;
149
+ /**
150
+ * @description
151
+ * Checks whether all options inside a Set Filter are currently selected.
152
+ * @author Anand Pandey
153
+ * @param col - Column definition object
154
+ * @returns boolean - TRUE if all options are selected, otherwise FALSE.
155
+ */
156
+ isAllSelected(col: any): boolean;
157
+ /**
158
+ * @description
159
+ * Opens the three-dots column menu for the selected column.
160
+ * Opens only the menu belonging to the clicked column index
161
+ * @author Anand Pandey
162
+ * @param {MouseEvent} event - The click event triggered on the three-dots icon.
163
+ * @param {any} col - The column definition object for which menu is opened.
164
+ * @param {number} index - Index of the column whose menu has been requested.
165
+ * @returns {void}
166
+ */
167
+ openMenu(event: MouseEvent, col: any, index: number): void;
168
+ /**
169
+ * @description Sort from three dots menu pop up.
170
+ * @author Anand Pandey
171
+ * @param {fieldName} string - fieldname.
172
+ * @param {string} type - Type defines the sorting type whether this is ascending, descending.
173
+ * @returns {void}
174
+ */
175
+ onSort(col: any, type: string, sortingColumIndex: number): void;
176
+ /**
177
+ * @description Generates grouped data based on the selected `groupBy` columns..
178
+ * @author Anand Pandey
179
+ * @returns void
180
+ */
181
+ getGroupedData(): void;
182
+ /**
183
+ * @description Initializes column resize operation when the user presses the mouse on the resize handle.
184
+ * @author Anand Pandey
185
+ * @param {MouseEvent} event - The mousedown event triggered on the resize handle.
186
+ * @param {number} index - Index of the column being resized.
187
+ * @returns {void}
188
+ */
189
+ startResize(event: MouseEvent, index: number): void;
190
+ /**
191
+ * @description Handles column resizing as the mouse moves.
192
+ * @author Anand Pandey
193
+ * @param {MouseEvent} event - Mouse movement event during resizing.
194
+ * @returns {void}
195
+ */
196
+ onMouseMove: (event: MouseEvent) => void;
197
+ /**
198
+ * @description Stops the column resizing operation.
199
+ * Clears resizing state and removes mouse event listeners.
200
+ * @author Anand Pandey
201
+ * @param {MouseEvent} event - Mouse up event ending the resize action.
202
+ * @returns {void}
203
+ */
204
+ stopResize: (event: MouseEvent) => void;
205
+ /**
206
+ * @description Recursively groups row data into a hierarchical structure based on the provided group keys.
207
+ * @author Anand Pandey
208
+ * @param {any[]} data - The row data to be grouped.
209
+ * @param {string[]} groupKeys - Ordered list of column keys to group by.
210
+ * @returns {any[]} A hierarchical grouped structure containing nested group nodes.
211
+ */
212
+ groupData(data: any[], groupKeys: string[]): any;
213
+ /**
214
+ * @description Toggles the expand/collapse state of a group node.
215
+ * @author Anand Pandey
216
+ * @param {any} node - The group node whose expanded state needs to be toggled.
217
+ * @returns {void}
218
+ */
219
+ toggleGroup(node: any): void;
220
+ /**
221
+ * @description Pin column on the left side.
222
+ * @author Anand Pandey
223
+ * @param {any} col - The selected column details from table on clicking pin or unpin from three dots menu.
224
+ * @param {number} index - The index of column from table on clicking pin or unpin from three dots menu.
225
+ * @returns {void}
226
+ */
227
+ pinColumn(col: any, index: number, direction: string): void;
228
+ showPinActions(): void;
229
+ hidePinActions(): void;
230
+ /**
231
+ * @description Updates the horizontal left and right offsets of pinned columns by assigning cumulative widths to each pinned column and resetting non-pinned columns.
232
+ * @author Anand Pandey
233
+ * @returns void
234
+ */
235
+ updatePinnedOffsets(): void;
236
+ /**
237
+ * @description Method to parse column value from rowdata object
238
+ * according to given field value in column Defination
239
+ * @author Tarun Kumar
240
+ * @param row - current row object
241
+ * @param toParse - field value
242
+ * @returns string
243
+ */
244
+ parseColValue(row: any, col: any): any;
245
+ /**
246
+ * @description method to reset table configuration
247
+ * @author Tarun Kumar
248
+ * @param none
249
+ * @returns void
250
+ */
251
+ resetTableConfig(): void;
252
+ /**
253
+ * @description method to set total pages count
254
+ * @author Tarun Kumar
255
+ * @param none
256
+ * @returns void
257
+ */
258
+ setPageCount(): void;
259
+ /**
260
+ * @description method to update table on page size change
261
+ * @author Tarun Kumar
262
+ * @param event
263
+ * @returns void
264
+ */
265
+ onPageSizeChanged(event: any): void;
266
+ /**
267
+ * @description method to update table on previous button click
268
+ * @author Tarun Kumar
269
+ */
270
+ onBtPrevClick(): void;
271
+ /**
272
+ * @description method to update table on next button click
273
+ * @author Tarun Kumar
274
+ */
275
+ onBtNextClick(): void;
276
+ /**
277
+ * @description method to update table on selecting any page randomly
278
+ * @author Tarun Kumar
279
+ * @param event
280
+ */
281
+ goToSelectedPage(event: any): void;
282
+ /**
283
+ * @description method to sort data according to type and column
284
+ * @author Tarun Kumar
285
+ * @param sortingColumIndex
286
+ * @param col
287
+ * @param sortingType
288
+ */
289
+ onSortingRowData(sortingColumIndex: number, col: any): void;
290
+ /**
291
+ * @description method to sort table in ascending order according to given field
292
+ * @param fieldName
293
+ */
294
+ ascendingOrder(col: any): void;
295
+ /**
296
+ * @description method to sort table in descending order according to given field
297
+ * @param fieldName
298
+ */
299
+ descendingOrder(col: any): void;
300
+ /**
301
+ * @description method to check/uncheck all rows on header checkbox selection/deselection
302
+ * @author Tarun Kumar
303
+ * @param event
304
+ */
305
+ onHeaderCheckboxChange(event: any): void;
306
+ /**
307
+ * @description method to check/uncheck row on row checkbox selection/deselection
308
+ * @author Tarun Kumar
309
+ * @param event
310
+ */
311
+ onRowCheckboxSelection(event: any): void;
312
+ /**
313
+ * @description method to check/uncheck all rows on header checkbox selection/deselection
314
+ * @author Tarun Kumar
315
+ * @param col
316
+ * @returns {object}
317
+ */
318
+ getStyle(col: any, type?: string): object;
319
+ onClickOutside(): void;
320
+ checkCondition(data: any): boolean;
321
+ infinityScroll(event: any): void;
322
+ checkAllSelected(): boolean;
323
+ checkInterminate(): boolean;
324
+ /**
325
+ * @author Tarun Kumar
326
+ * @description function triggered when the drag starts
327
+ * @param {event object, index}
328
+ * @returns {void}
329
+ */
330
+ onDragStart(event: DragEvent, index: number): void;
331
+ onGroupDragStart(event: DragEvent, index: number): void;
332
+ /**
333
+ * @author Anand Pandey
334
+ * @description Copies computed CSS styles from the source element to the target element, including all child elements recursively.
335
+ * @param {HTMLElement} source - Original element.
336
+ * @param {HTMLElement} target - Cloned element.
337
+ * @returns {void}
338
+ */
339
+ copyComputedStyles(source: HTMLElement, target: HTMLElement): void;
340
+ /**
341
+ * @author Tarun Kumar
342
+ * @description function to track the index of the element being dragged over and allow dropping
343
+ * @param {event object, index}
344
+ * @returns {void}
345
+ */
346
+ onDragOver(event: DragEvent, index: number): void;
347
+ /**
348
+ * @author Tarun Kumar
349
+ * @description function to Reorder the items on drop
350
+ * @param {event object, index}
351
+ * @returns {void}
352
+ */
353
+ onDrop(event: DragEvent, index: number): void;
354
+ /**
355
+ * @author Tarun Kumar
356
+ * @description function to reset dragOverIndex when the drag ends
357
+ * @param {none}
358
+ * @returns {void}
359
+ */
360
+ onDragEnd(): void;
361
+ /**
362
+ * @description Handles drag over on group panel to allow dropping.
363
+ * @author Anand Pandey
364
+ * @param {DragEvent} event
365
+ * @returns {void}
366
+ */
367
+ onGroupDragOver(event: DragEvent): void;
368
+ /**
369
+ * @description Handles drag over on a group tag and updates the target index for reordering.
370
+ * @author Anand Pandey
371
+ * @param {DragEvent} event
372
+ * @param {number} index
373
+ * @returns {void}
374
+ */
375
+ onActiveDragOver(event: DragEvent, index: number): void;
376
+ /**
377
+ * @description Handles drop on group panel and routes the drop to group reordering or column grouping logic.
378
+ * @author Anand Pandey
379
+ * @param {DragEvent} event
380
+ * @returns {void}
381
+ */
382
+ onGroupDrop(event: DragEvent): void;
383
+ /**
384
+ * @description Handles column grouping triggered from the column action menu by adding the column to the active group list,
385
+ * removing it from visible columns, and recalculating grouped row data.
386
+ *
387
+ * @param {any} col - The column definition selected for grouping.
388
+ * @param {number} index - Index of the column in the current column definitions array.
389
+ * @returns {void}
390
+ */
391
+ groupByColumnAction(col: any, index: number): void;
392
+ /**
393
+ * @description Handles drop on a group tag and reorders the active groups accordingly.
394
+ * @author Anand Pandey
395
+ * @param {DragEvent} event
396
+ * @param {number} index
397
+ * @returns {void}
398
+ */
399
+ onActiveGroupDrop(event: DragEvent, index: number): void;
400
+ /**
401
+ * @description Removes a group tag and restores the column to available columns list.
402
+ * @author Anand Pandey
403
+ * @param {any} col
404
+ * @param {number} id
405
+ * @returns {void}
406
+ */
407
+ removeGroup(col: any, id: number): void;
408
+ toggleDropdown(): void;
409
+ selectFilter(option: any, col: any): void;
410
+ getSelectedFilterLabel(value: string): string;
411
+ toggleFilter(col: any, index: number, event: MouseEvent): void;
412
+ onMouseEnterHeader(index: number): void;
413
+ onMouseLeaveHeader(index: number): void;
414
+ enableColumnDrag(event: MouseEvent, index: number): void;
415
+ disableColumnDrag(event: MouseEvent, index: number): void;
416
+ dateTimeSelected(date: any): void;
417
+ static ɵfac: i0.ɵɵFactoryDeclaration<CatsDataGridComponent, never>;
418
+ static ɵcmp: i0.ɵɵComponentDeclaration<CatsDataGridComponent, "cats-data-grid", never, { "tableOptions": { "alias": "tableOptions"; "required": false; }; "totalRecords": { "alias": "totalRecords"; "required": false; }; "sortingRequired": { "alias": "sortingRequired"; "required": false; }; "checkBoxSelection": { "alias": "checkBoxSelection"; "required": false; }; "checkboxSelectionType": { "alias": "checkboxSelectionType"; "required": false; }; "rowData": { "alias": "rowData"; "required": false; }; "colDefs": { "alias": "colDefs"; "required": false; }; "paginationRequired": { "alias": "paginationRequired"; "required": false; }; "selectedRowEmpty": { "alias": "selectedRowEmpty"; "required": false; }; "filterRequired": { "alias": "filterRequired"; "required": false; }; "threeDotsMenuRequired": { "alias": "threeDotsMenuRequired"; "required": false; }; "height": { "alias": "height"; "required": false; }; "groupByRequired": { "alias": "groupByRequired"; "required": false; }; "pageSizeList": { "alias": "pageSizeList"; "required": false; }; }, { "onPaginationChange": "onPaginationChange"; "onCheckboxSelection": "onCheckboxSelection"; "onScrollEmitter": "onScrollEmitter"; "filter": "filter"; }, never, never, true, never>;
419
+ }
420
+
421
+ export { CatsDataGridComponent, CatsDataGridService };
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "cats-data-grid",
3
- "version": "1.0.1",
3
+ "version": "2.0.0",
4
4
  "peerDependencies": {
5
- "@angular/common": "^19.2.0",
6
- "@angular/core": "^19.2.0"
5
+ "@angular/common": "^20.3.15",
6
+ "@angular/core": "^20.3.15"
7
7
  },
8
8
  "dependencies": {
9
9
  "tslib": "^2.3.0"
@@ -5,7 +5,7 @@
5
5
  box-sizing: border-box;
6
6
  margin: 0;
7
7
  padding: 0;
8
- font-family: "Rethink";
8
+ // font-family: "Open Sans", sans-serif;
9
9
  }
10
10
 
11
11
  body {