@zeedhi/teknisa-components-common 1.97.3 → 1.97.6

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.
@@ -42,6 +42,43 @@ const createAndMount = (props: ITekGrid) => {
42
42
  return instance;
43
43
  };
44
44
 
45
+ const createGroupedGrid = async (props: Partial<ITekGrid> = {}) => {
46
+ const grid = createAndMount({
47
+ name: 'grid',
48
+ component: 'TekGrid',
49
+ columns: [
50
+ { name: 'id' },
51
+ { name: 'name' },
52
+ { name: 'month' },
53
+ { name: 'department', grouped: true },
54
+ ],
55
+ datasource: {
56
+ uniqueKey: 'id',
57
+ data: [
58
+ {
59
+ id: '1', name: 'First', month: 11, department: 1,
60
+ },
61
+ {
62
+ id: '2', name: 'Second', month: 11, department: 1,
63
+ },
64
+ {
65
+ id: '3', name: 'Third', month: 11, department: 2,
66
+ },
67
+ {
68
+ id: '4', name: 'Fourth', month: 12, department: 1,
69
+ },
70
+ {
71
+ id: '5', name: 'Fifth', month: 12, department: 2,
72
+ },
73
+ ],
74
+ },
75
+ ...props,
76
+ });
77
+
78
+ await flushPromises();
79
+ return grid;
80
+ };
81
+
45
82
  describe('TekGrid', () => {
46
83
  beforeEach(() => {
47
84
  // clear all metadata instances before testing
@@ -2030,7 +2067,6 @@ describe('TekGrid', () => {
2030
2067
  grid.rowClick(data[0], event, element);
2031
2068
 
2032
2069
  expect(rowClick).not.toHaveBeenCalled();
2033
- expect(grid.datasource.currentRow).toEqual({});
2034
2070
  });
2035
2071
  });
2036
2072
 
@@ -2071,7 +2107,6 @@ describe('TekGrid', () => {
2071
2107
  row: grid.groupedData[0],
2072
2108
  component: grid,
2073
2109
  });
2074
- expect(grid.datasource.currentRow).toEqual({});
2075
2110
  });
2076
2111
 
2077
2112
  it('should not call events.groupRowClick if cellClick prevents it', async () => {
@@ -2322,4 +2357,371 @@ describe('TekGrid', () => {
2322
2357
  expect(spy).toHaveBeenCalledTimes(1);
2323
2358
  });
2324
2359
  });
2360
+
2361
+ describe('addNewRow', () => {
2362
+ it('when not using groups, should add a new row to the datasource', async () => {
2363
+ const instance = new TekGrid({
2364
+ name: 'Grid',
2365
+ component: 'TekGrid',
2366
+ datasource: {
2367
+ page: 1,
2368
+ data: [
2369
+ { id: 1 },
2370
+ ],
2371
+ },
2372
+ });
2373
+ const newRow1 = { id: 2 };
2374
+ await instance.addNewRow(newRow1, 'start');
2375
+ expect(instance.datasource.data[0]).toEqual({ id: 2, __added_row: true });
2376
+ expect(instance.datasource.data[1]).toEqual({ id: 1 });
2377
+ });
2378
+
2379
+ it('should add a new row to the groupedData array', async () => {
2380
+ const grid = await createGroupedGrid();
2381
+
2382
+ expect(grid.groupedData).toMatchObject([
2383
+ { groupValue: 1 },
2384
+ { id: '1', groupHeaders: [{ groupValue: 1 }] },
2385
+ { id: '2', groupHeaders: [{ groupValue: 1 }] },
2386
+ { id: '4', groupHeaders: [{ groupValue: 1 }] },
2387
+ { groupValue: 2 },
2388
+ { id: '3', groupHeaders: [{ groupValue: 2 }] },
2389
+ { id: '5', groupHeaders: [{ groupValue: 2 }] },
2390
+ ]);
2391
+ expect(grid.groupedData[0].children).toMatchObject([
2392
+ { id: '1' },
2393
+ { id: '2' },
2394
+ { id: '4' },
2395
+ ]);
2396
+
2397
+ await grid.addNewRow({ id: '999', name: 'new', department: 1 });
2398
+
2399
+ expect(grid.groupedData).toMatchObject([
2400
+ { groupValue: 1 },
2401
+ { id: '1', groupHeaders: [{ groupValue: 1 }] },
2402
+ { id: '2', groupHeaders: [{ groupValue: 1 }] },
2403
+ { id: '4', groupHeaders: [{ groupValue: 1 }] },
2404
+ { id: '999', groupHeaders: [{ groupValue: 1 }] },
2405
+ { groupValue: 2 },
2406
+ { id: '3', groupHeaders: [{ groupValue: 2 }] },
2407
+ { id: '5', groupHeaders: [{ groupValue: 2 }] },
2408
+ ]);
2409
+ expect(grid.groupedData[0].children).toMatchObject([
2410
+ { id: '1' },
2411
+ { id: '2' },
2412
+ { id: '4' },
2413
+ { id: '999' },
2414
+ ]);
2415
+ });
2416
+
2417
+ it('should add a new row to the groupedData array using nested groups', async () => {
2418
+ const grid = await createGroupedGrid({
2419
+ columns: [
2420
+ { name: 'id' },
2421
+ { name: 'name' },
2422
+ { name: 'month', grouped: true },
2423
+ { name: 'department', grouped: true },
2424
+ ],
2425
+ });
2426
+
2427
+ expect(grid.groupedData).toMatchObject([
2428
+ { groupValue: 11 },
2429
+ { groupValue: 1, groupHeaders: [{ groupValue: 11 }] },
2430
+ { id: '1', groupHeaders: [{ groupValue: 11 }, { groupValue: 1 }] },
2431
+ { id: '2', groupHeaders: [{ groupValue: 11 }, { groupValue: 1 }] },
2432
+ { groupValue: 2, groupHeaders: [{ groupValue: 11 }] },
2433
+ { id: '3', groupHeaders: [{ groupValue: 11 }, { groupValue: 2 }] },
2434
+ { groupValue: 12 },
2435
+ { groupValue: 1, groupHeaders: [{ groupValue: 12 }] },
2436
+ { id: '4', groupHeaders: [{ groupValue: 12 }, { groupValue: 1 }] },
2437
+ { groupValue: 2, groupHeaders: [{ groupValue: 12 }] },
2438
+ { id: '5', groupHeaders: [{ groupValue: 12 }, { groupValue: 2 }] },
2439
+ ]);
2440
+
2441
+ await grid.addNewRow({
2442
+ id: '999', name: 'new', month: 12, department: 1,
2443
+ }, 'start');
2444
+
2445
+ expect(grid.groupedData).toMatchObject([
2446
+ { groupValue: 11 },
2447
+ { groupValue: 1, groupHeaders: [{ groupValue: 11 }] },
2448
+ { id: '1', groupHeaders: [{ groupValue: 11 }, { groupValue: 1 }] },
2449
+ { id: '2', groupHeaders: [{ groupValue: 11 }, { groupValue: 1 }] },
2450
+ { groupValue: 2, groupHeaders: [{ groupValue: 11 }] },
2451
+ { id: '3', groupHeaders: [{ groupValue: 11 }, { groupValue: 2 }] },
2452
+ { groupValue: 12 },
2453
+ { groupValue: 1, groupHeaders: [{ groupValue: 12 }] },
2454
+ { id: '999', groupHeaders: [{ groupValue: 12 }, { groupValue: 1 }] },
2455
+ { id: '4', groupHeaders: [{ groupValue: 12 }, { groupValue: 1 }] },
2456
+ { groupValue: 2, groupHeaders: [{ groupValue: 12 }] },
2457
+ { id: '5', groupHeaders: [{ groupValue: 12 }, { groupValue: 2 }] },
2458
+ ]);
2459
+
2460
+ expect(grid.groupedData[6].children).toMatchObject([
2461
+ { id: '999' },
2462
+ { id: '4' },
2463
+ { id: '5' },
2464
+ ]);
2465
+ expect(grid.groupedData[7].children).toMatchObject([
2466
+ { id: '999' },
2467
+ { id: '4' },
2468
+ ]);
2469
+ });
2470
+
2471
+ it('should add a new row to a group that doesnt exist', async () => {
2472
+ const grid = await createGroupedGrid();
2473
+
2474
+ await grid.addNewRow({ id: '999', name: 'new', department: 999 }, 'end');
2475
+
2476
+ expect(grid.groupedData).toMatchObject([
2477
+ { groupValue: 1 },
2478
+ { id: '1', groupHeaders: [{ groupValue: 1 }] },
2479
+ { id: '2', groupHeaders: [{ groupValue: 1 }] },
2480
+ { id: '4', groupHeaders: [{ groupValue: 1 }] },
2481
+ { groupValue: 2 },
2482
+ { id: '3', groupHeaders: [{ groupValue: 2 }] },
2483
+ { id: '5', groupHeaders: [{ groupValue: 2 }] },
2484
+ { groupValue: 999 },
2485
+ { id: '999', groupHeaders: [{ groupValue: 999 }] },
2486
+ ]);
2487
+ });
2488
+
2489
+ it('should add a new row to a group that doesnt exist using nested groups', async () => {
2490
+ const grid = await createGroupedGrid({
2491
+ columns: [
2492
+ { name: 'id' },
2493
+ { name: 'name' },
2494
+ { name: 'month', grouped: true },
2495
+ { name: 'department', grouped: true },
2496
+ ],
2497
+ });
2498
+
2499
+ await grid.addNewRow({
2500
+ id: '999', name: 'new', month: 999, department: 1,
2501
+ }, 'end');
2502
+
2503
+ expect(grid.groupedData).toMatchObject([
2504
+ { groupValue: 11 },
2505
+ { groupValue: 1, groupHeaders: [{ groupValue: 11 }] },
2506
+ { id: '1', groupHeaders: [{ groupValue: 11 }, { groupValue: 1 }] },
2507
+ { id: '2', groupHeaders: [{ groupValue: 11 }, { groupValue: 1 }] },
2508
+ { groupValue: 2, groupHeaders: [{ groupValue: 11 }] },
2509
+ { id: '3', groupHeaders: [{ groupValue: 11 }, { groupValue: 2 }] },
2510
+ { groupValue: 12 },
2511
+ { groupValue: 1, groupHeaders: [{ groupValue: 12 }] },
2512
+ { id: '4', groupHeaders: [{ groupValue: 12 }, { groupValue: 1 }] },
2513
+ { groupValue: 2, groupHeaders: [{ groupValue: 12 }] },
2514
+ { id: '5', groupHeaders: [{ groupValue: 12 }, { groupValue: 2 }] },
2515
+ // new group
2516
+ { groupValue: 999 },
2517
+ { groupValue: 1, groupHeaders: [{ groupValue: 999 }] },
2518
+ { id: '999', groupHeaders: [{ groupValue: 999 }, { groupValue: 1 }] },
2519
+ ]);
2520
+ });
2521
+
2522
+ it('should add a new row to a group that doesnt inside a group that exists', async () => {
2523
+ const grid = await createGroupedGrid({
2524
+ columns: [
2525
+ { name: 'id' },
2526
+ { name: 'name' },
2527
+ { name: 'month', grouped: true },
2528
+ { name: 'department', grouped: true },
2529
+ ],
2530
+ });
2531
+
2532
+ await grid.addNewRow({
2533
+ id: '999', name: 'new', month: 11, department: 999,
2534
+ }, 'end');
2535
+
2536
+ expect(grid.groupedData).toMatchObject([
2537
+ { groupValue: 11 },
2538
+ { groupValue: 999, groupHeaders: [{ groupValue: 11 }] },
2539
+ { id: '999', groupHeaders: [{ groupValue: 11 }, { groupValue: 999 }] },
2540
+ { groupValue: 1, groupHeaders: [{ groupValue: 11 }] },
2541
+ { id: '1', groupHeaders: [{ groupValue: 11 }, { groupValue: 1 }] },
2542
+ { id: '2', groupHeaders: [{ groupValue: 11 }, { groupValue: 1 }] },
2543
+ { groupValue: 2, groupHeaders: [{ groupValue: 11 }] },
2544
+ { id: '3', groupHeaders: [{ groupValue: 11 }, { groupValue: 2 }] },
2545
+ { groupValue: 12 },
2546
+ { groupValue: 1, groupHeaders: [{ groupValue: 12 }] },
2547
+ { id: '4', groupHeaders: [{ groupValue: 12 }, { groupValue: 1 }] },
2548
+ { groupValue: 2, groupHeaders: [{ groupValue: 12 }] },
2549
+ { id: '5', groupHeaders: [{ groupValue: 12 }, { groupValue: 2 }] },
2550
+ ]);
2551
+ });
2552
+
2553
+ it('should add a new row inside nested groups that doesnt exist', async () => {
2554
+ const grid = await createGroupedGrid({
2555
+ columns: [
2556
+ { name: 'id' },
2557
+ { name: 'name' },
2558
+ { name: 'year', grouped: true },
2559
+ { name: 'month', grouped: true },
2560
+ { name: 'department', grouped: true },
2561
+ ],
2562
+ datasource: {
2563
+ uniqueKey: 'id',
2564
+ data: [
2565
+ {
2566
+ id: '1', name: 'First', year: 2000, month: 11, department: 1,
2567
+ },
2568
+ {
2569
+ id: '2', name: 'Second', year: 2000, month: 11, department: 1,
2570
+ },
2571
+ {
2572
+ id: '3', name: 'Third', year: 2000, month: 11, department: 2,
2573
+ },
2574
+ {
2575
+ id: '4', name: 'Fourth', year: 2010, month: 11, department: 1,
2576
+ },
2577
+ {
2578
+ id: '5', name: 'Fifth', year: 2010, month: 12, department: 2,
2579
+ },
2580
+ ],
2581
+ },
2582
+ });
2583
+
2584
+ await grid.addNewRow({
2585
+ id: '999', name: 'new', year: 2010, month: 999, department: 999,
2586
+ }, 'end');
2587
+ await grid.addNewRow({
2588
+ id: '998', name: 'new', year: 2010, month: 999, department: 999,
2589
+ }, 'end');
2590
+
2591
+ expect(grid.groupedData).toMatchObject([
2592
+ { groupValue: 2000 },
2593
+ { groupValue: 11, groupHeaders: [{ groupValue: 2000 }] },
2594
+ { groupValue: 1, groupHeaders: [{ groupValue: 2000 }, { groupValue: 11 }] },
2595
+ { id: '1', groupHeaders: [{ groupValue: 2000 }, { groupValue: 11 }, { groupValue: 1 }] },
2596
+ { id: '2', groupHeaders: [{ groupValue: 2000 }, { groupValue: 11 }, { groupValue: 1 }] },
2597
+ { groupValue: 2, groupHeaders: [{ groupValue: 2000 }, { groupValue: 11 }] },
2598
+ { id: '3', groupHeaders: [{ groupValue: 2000 }, { groupValue: 11 }, { groupValue: 2 }] },
2599
+ { groupValue: 2010 },
2600
+ { groupValue: 999, groupHeaders: [{ groupValue: 2010 }] },
2601
+ { groupValue: 999, groupHeaders: [{ groupValue: 2010 }, { groupValue: 999 }] },
2602
+ { id: '999', groupHeaders: [{ groupValue: 2010 }, { groupValue: 999 }, { groupValue: 999 }] },
2603
+ { id: '998', groupHeaders: [{ groupValue: 2010 }, { groupValue: 999 }, { groupValue: 999 }] },
2604
+ { groupValue: 11, groupHeaders: [{ groupValue: 2010 }] },
2605
+ { groupValue: 1, groupHeaders: [{ groupValue: 2010 }, { groupValue: 11 }] },
2606
+ { id: '4', groupHeaders: [{ groupValue: 2010 }, { groupValue: 11 }, { groupValue: 1 }] },
2607
+ { groupValue: 12, groupHeaders: [{ groupValue: 2010 }] },
2608
+ { groupValue: 2, groupHeaders: [{ groupValue: 2010 }, { groupValue: 12 }] },
2609
+ { id: '5', groupHeaders: [{ groupValue: 2010 }, { groupValue: 12 }, { groupValue: 2 }] },
2610
+ ]);
2611
+ });
2612
+
2613
+ it('should throw an error when row groups are not defined or incomplete', async () => {
2614
+ const grid = await createGroupedGrid({
2615
+ columns: [
2616
+ { name: 'id' },
2617
+ { name: 'name' },
2618
+ { name: 'month', grouped: true },
2619
+ { name: 'department', grouped: true },
2620
+ ],
2621
+ });
2622
+
2623
+ // month group is undefined, should throw
2624
+ expect(async () => grid.addNewRow({ id: '999', name: 'new', department: 1 }, 'end')).rejects.toThrow();
2625
+ });
2626
+ });
2627
+
2628
+ describe('addToSelection', () => {
2629
+ it('should add a row to the selected group', async () => {
2630
+ const grid = await createGroupedGrid();
2631
+
2632
+ [grid.datasource.currentRow] = grid.groupedData;
2633
+
2634
+ grid.addToSelection({ id: '999', name: 'new', month: 12 });
2635
+
2636
+ expect(grid.groupedData).toMatchObject([
2637
+ { groupValue: 1 },
2638
+ { id: '1', groupHeaders: [{ groupValue: 1 }] },
2639
+ { id: '2', groupHeaders: [{ groupValue: 1 }] },
2640
+ { id: '4', groupHeaders: [{ groupValue: 1 }] },
2641
+ { id: '999', groupHeaders: [{ groupValue: 1 }] },
2642
+ { groupValue: 2 },
2643
+ { id: '3', groupHeaders: [{ groupValue: 2 }] },
2644
+ { id: '5', groupHeaders: [{ groupValue: 2 }] },
2645
+ ]);
2646
+ });
2647
+
2648
+ it('should add a row to the selected group when using nested groups', async () => {
2649
+ const grid = await createGroupedGrid();
2650
+
2651
+ [grid.datasource.currentRow] = grid.groupedData;
2652
+
2653
+ grid.addToSelection({ id: '999', name: 'new', month: 12 });
2654
+
2655
+ expect(grid.groupedData).toMatchObject([
2656
+ { groupValue: 1 },
2657
+ { id: '1', groupHeaders: [{ groupValue: 1 }] },
2658
+ { id: '2', groupHeaders: [{ groupValue: 1 }] },
2659
+ { id: '4', groupHeaders: [{ groupValue: 1 }] },
2660
+ { id: '999', groupHeaders: [{ groupValue: 1 }] },
2661
+ { groupValue: 2 },
2662
+ { id: '3', groupHeaders: [{ groupValue: 2 }] },
2663
+ { id: '5', groupHeaders: [{ groupValue: 2 }] },
2664
+ ]);
2665
+ });
2666
+
2667
+ it('when selected row is not a group, should add a row to the same group as the selected row', async () => {
2668
+ const grid = await createGroupedGrid({
2669
+ columns: [
2670
+ { name: 'id' },
2671
+ { name: 'name' },
2672
+ { name: 'month', grouped: true },
2673
+ { name: 'department', grouped: true },
2674
+ ],
2675
+ });
2676
+
2677
+ grid.datasource.currentRow = grid.groupedData.find((row) => row.id === '3')!;
2678
+
2679
+ grid.addToSelection({ id: '999', name: 'new', month: 12 });
2680
+
2681
+ expect(grid.groupedData).toMatchObject([
2682
+ { groupValue: 11 },
2683
+ { groupValue: 1, groupHeaders: [{ groupValue: 11 }] },
2684
+ { id: '1', groupHeaders: [{ groupValue: 11 }, { groupValue: 1 }] },
2685
+ { id: '2', groupHeaders: [{ groupValue: 11 }, { groupValue: 1 }] },
2686
+ { groupValue: 2, groupHeaders: [{ groupValue: 11 }] },
2687
+ { id: '3', groupHeaders: [{ groupValue: 11 }, { groupValue: 2 }] },
2688
+ { id: '999', groupHeaders: [{ groupValue: 11 }, { groupValue: 2 }] },
2689
+ { groupValue: 12 },
2690
+ { groupValue: 1, groupHeaders: [{ groupValue: 12 }] },
2691
+ { id: '4', groupHeaders: [{ groupValue: 12 }, { groupValue: 1 }] },
2692
+ { groupValue: 2, groupHeaders: [{ groupValue: 12 }] },
2693
+ { id: '5', groupHeaders: [{ groupValue: 12 }, { groupValue: 2 }] },
2694
+ ]);
2695
+ });
2696
+
2697
+ it('when selected row is not the most internal group, should add a row to the first most internal group', async () => {
2698
+ const grid = await createGroupedGrid({
2699
+ columns: [
2700
+ { name: 'id' },
2701
+ { name: 'name' },
2702
+ { name: 'month', grouped: true },
2703
+ { name: 'department', grouped: true },
2704
+ ],
2705
+ });
2706
+
2707
+ [grid.datasource.currentRow] = grid.groupedData;
2708
+
2709
+ grid.addToSelection({ id: '999', name: 'new', month: 12 });
2710
+
2711
+ expect(grid.groupedData).toMatchObject([
2712
+ { groupValue: 11 },
2713
+ { groupValue: 1, groupHeaders: [{ groupValue: 11 }] },
2714
+ { id: '1', groupHeaders: [{ groupValue: 11 }, { groupValue: 1 }] },
2715
+ { id: '2', groupHeaders: [{ groupValue: 11 }, { groupValue: 1 }] },
2716
+ { id: '999', groupHeaders: [{ groupValue: 11 }, { groupValue: 1 }] },
2717
+ { groupValue: 2, groupHeaders: [{ groupValue: 11 }] },
2718
+ { id: '3', groupHeaders: [{ groupValue: 11 }, { groupValue: 2 }] },
2719
+ { groupValue: 12 },
2720
+ { groupValue: 1, groupHeaders: [{ groupValue: 12 }] },
2721
+ { id: '4', groupHeaders: [{ groupValue: 12 }, { groupValue: 1 }] },
2722
+ { groupValue: 2, groupHeaders: [{ groupValue: 12 }] },
2723
+ { id: '5', groupHeaders: [{ groupValue: 12 }, { groupValue: 2 }] },
2724
+ ]);
2725
+ });
2726
+ });
2325
2727
  });
@@ -2,7 +2,7 @@ import { GridEditable, IComponentRender } from '@zeedhi/common';
2
2
  import { Datasource, IDictionary, IEventParam } from '@zeedhi/core';
3
3
  import { ITekGridAtoms } from '../../utils';
4
4
  import { TekGridColumn } from './grid-column';
5
- import { IModalFilterProps, ITekGrid, ITekGridColumn, ITekGridEvents, ITekGridExportConfig } from './interfaces';
5
+ import { IGroupedData, IModalFilterProps, ITekGrid, ITekGridColumn, ITekGridEvents, ITekGridExportConfig } from './interfaces';
6
6
  import { TekGridLayoutOptions } from './layout-options';
7
7
  export declare class TekGrid extends GridEditable implements ITekGrid {
8
8
  title: string;
@@ -64,7 +64,7 @@ export declare class TekGrid extends GridEditable implements ITekGrid {
64
64
  groupColumnNames: string[];
65
65
  summaryColumns: TekGridColumn[];
66
66
  groupColumns: TekGridColumn[];
67
- groupedData: IDictionary<any>[];
67
+ groupedData: IGroupedData[];
68
68
  private toolbarSlotProps;
69
69
  viewUpdateScrollData?: () => void;
70
70
  private gridBase;
@@ -167,4 +167,47 @@ export declare class TekGrid extends GridEditable implements ITekGrid {
167
167
  selectGroupClick(row: IDictionary<any>, isSelected: boolean, event: Event, element: HTMLElement): void;
168
168
  getAtomInstance<T>(key: keyof ITekGridAtoms): T;
169
169
  getFilterInputs(columnName?: string): import("@zeedhi/common").Input[];
170
+ /**
171
+ * Adds new row to the datasource data and pushes it to the editedRows
172
+ * @param row Row
173
+ * @param position whether the new Row will be inserted at the beginning or end of the data array
174
+ */
175
+ addNewRow(row: IDictionary, position?: 'end' | 'start'): Promise<void>;
176
+ /**
177
+ * Takes a row and adds it to the selected group (datasource.currentRow)
178
+ * @param row the new row to be added
179
+ * @param position the position, at the beginning of the group or at the end
180
+ */
181
+ addToSelection(row: IDictionary, position?: 'end' | 'start'): Promise<void>;
182
+ /**
183
+ * Adds a new row to the groupedData array
184
+ * @param row the new row to be added
185
+ * @param position the position, at the beginning of the group or at the end
186
+ */
187
+ private addGroupedRow;
188
+ private findMissingGroups;
189
+ /**
190
+ * Finds the last group (most internal group) where a row should be inserted
191
+ * @param row to be inserted
192
+ * @returns the index and the group where the row should be inserted
193
+ */
194
+ private findLastGroupingIndex;
195
+ /**
196
+ * Creates a group hierarchy for a new row, creating intermediate groups if needed
197
+ * @param row to be inserted
198
+ * @returns the index and the group where the row should be inserted
199
+ */
200
+ private createGroupHierarchyForRow;
201
+ /**
202
+ * Adds a row to the children of a group
203
+ */
204
+ private addRowToGroupChildren;
205
+ /**
206
+ * Checks if a row is a group header, adding typescript type-checking
207
+ */
208
+ private isGroupHeader;
209
+ /**
210
+ * Checks if a row is the last grouping of the grid (the most internal grouping)
211
+ */
212
+ private isLastGrouping;
170
213
  }
@@ -174,3 +174,22 @@ export interface IModalFilterProps extends IModal {
174
174
  height?: string;
175
175
  maxHeight?: string;
176
176
  }
177
+ export interface ITekGridGroupFooter {
178
+ groupFooter: boolean;
179
+ groupIndex: number;
180
+ groupHeaders: ITekGridGroupHeader[];
181
+ groupLabel: string;
182
+ groupValue: any;
183
+ }
184
+ export declare type IGroupedData = (ITekGridGroupHeader & {
185
+ [key: string]: any;
186
+ }) | {
187
+ [key: string]: any;
188
+ groupFooter: boolean;
189
+ groupSummary: boolean;
190
+ } | (ITekGridGroupFooter & {
191
+ [key: string]: any;
192
+ }) | {
193
+ [key: string]: any;
194
+ groupHeaders: ITekGridGroupHeader[];
195
+ };
@@ -0,0 +1,8 @@
1
+ import { IDictionary } from '@zeedhi/core';
2
+ /**
3
+ * Thrown when a row has incomplete group information.
4
+ * Provides details about the missing groups and the problematic row.
5
+ */
6
+ export declare class IncompleteGroupsError extends Error {
7
+ constructor(row: IDictionary, missingGroups: string[]);
8
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Extracts properties from an object based on a list of properties
3
+ * @param obj object whose properties will be extracted
4
+ * @param props array of strings with the properties to be extracted
5
+ * @returns object containing the extracted properties
6
+ */
7
+ export declare const extractProperties: (obj: any, props: string[]) => any;
@@ -3,3 +3,4 @@ export * from './grid-base/grid-base';
3
3
  export * from './grid-base/grid-controller';
4
4
  export * from './grid-base/export-options';
5
5
  export * from './config/config';
6
+ export * from './extract-properties';