@zeedhi/teknisa-components-common 1.101.0 → 1.102.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 (39) hide show
  1. package/coverage/clover.xml +706 -687
  2. package/coverage/coverage-final.json +45 -45
  3. package/coverage/lcov-report/index.html +17 -17
  4. package/coverage/lcov-report/tests/__helpers__/component-event-helper.ts.html +1 -1
  5. package/coverage/lcov-report/tests/__helpers__/flush-promises-helper.ts.html +1 -1
  6. package/coverage/lcov-report/tests/__helpers__/get-child-helper.ts.html +7 -7
  7. package/coverage/lcov-report/tests/__helpers__/index.html +1 -1
  8. package/coverage/lcov-report/tests/__helpers__/index.ts.html +1 -1
  9. package/coverage/lcov-report/tests/__helpers__/mock-created-helper.ts.html +1 -1
  10. package/coverage/lcov.info +1213 -1175
  11. package/dist/tek-components-common.esm.js +236 -163
  12. package/dist/tek-components-common.umd.js +235 -161
  13. package/package.json +2 -2
  14. package/tests/unit/components/tek-grid/grid.spec.ts +197 -104
  15. package/tests/unit/components/tek-grid/layout_options.spec.ts +70 -0
  16. package/tests/unit/components/tree-grid/tree-grid.spec.ts +1 -1
  17. package/tests/unit/utils/grid-base/grid-controller.spec.ts +8 -0
  18. package/types/components/index.d.ts +1 -0
  19. package/types/components/tek-grid/grid.d.ts +1 -0
  20. package/types/components/tek-grid/interfaces.d.ts +1 -0
  21. package/types/components/tek-grid/layout-options.d.ts +2 -0
  22. package/types/components/tek-tree-grid/interfaces.d.ts +1 -0
  23. package/types/components/tek-tree-grid/tree-grid.d.ts +1 -0
  24. package/types/utils/grid-base/grid-base.d.ts +166 -154
  25. package/types/utils/grid-base/grid-controller.d.ts +5 -0
  26. package/types/components/tek-ag-grid/default-icons.d.ts +0 -53
  27. package/types/components/tek-ag-grid/interfaces.d.ts +0 -9
  28. package/types/components/tek-ag-grid/tek-ag-grid.d.ts +0 -35
  29. package/types/components/tek-datasource/datasource.d.ts +0 -94
  30. package/types/components/tek-grid/default-icons.d.ts +0 -53
  31. package/types/components/tek-grid/filter-dynamic-values.d.ts +0 -9
  32. package/types/components/tek-grid/grid-controller.d.ts +0 -19
  33. package/types/components/tek-grid/grid_column.d.ts +0 -14
  34. package/types/components/tek-grid/grid_controller.d.ts +0 -15
  35. package/types/components/tek-grid/tek-grid.d.ts +0 -35
  36. package/types/components/tek-login/interfaces.d.ts +0 -3
  37. package/types/components/tek-login/login-children.d.ts +0 -3
  38. package/types/components/tek-login/login.d.ts +0 -58
  39. package/types/components/tek-login/login_children.d.ts +0 -3
@@ -145,7 +145,7 @@ describe('TekGrid', () => {
145
145
  showLayoutOptions: false,
146
146
  });
147
147
  instance.onCreated();
148
- expect(instance.toolbarSlot.length).toBe(7);
148
+ expect(instance.toolbarSlot.length).toBe(3);
149
149
  });
150
150
 
151
151
  it('should overwrite toolbar', () => {
@@ -398,12 +398,15 @@ describe('TekGrid', () => {
398
398
 
399
399
  const spy = jest.spyOn(instance, 'saveEditedRows');
400
400
  instance.onCreated();
401
- const button = new Button(instance.toolbarSlot[3]);
402
- const event = new Event('click');
403
- button.click(event, {} as HTMLElement);
404
- expect(spy).toBeCalled();
405
- expect(button.isVisible).toBeFalsy();
406
- spy.mockReset();
401
+ const toolbarDiv = instance.toolbarSlot[2];
402
+ if (toolbarDiv.children) {
403
+ const button = new Button(toolbarDiv.children[1]);
404
+ const event = new Event('click');
405
+ button.click(event, {} as HTMLElement);
406
+ expect(spy).toBeCalled();
407
+ expect(button.isVisible).toBeFalsy();
408
+ spy.mockReset();
409
+ }
407
410
  });
408
411
 
409
412
  it('should call events', () => {
@@ -419,11 +422,14 @@ describe('TekGrid', () => {
419
422
  });
420
423
 
421
424
  instance.onCreated();
422
- const button = new Button(instance.toolbarSlot[3]);
423
- const event = new Event('click');
424
- button.click(event, {} as HTMLElement);
425
- expect(beforeSaveCalled).toBeTruthy();
426
- expect(afterSaveCalled).toBeTruthy();
425
+ const toolbarDiv = instance.toolbarSlot[2];
426
+ if (toolbarDiv.children) {
427
+ const button = new Button(toolbarDiv.children[1]);
428
+ const event = new Event('click');
429
+ button.click(event, {} as HTMLElement);
430
+ expect(beforeSaveCalled).toBeTruthy();
431
+ expect(afterSaveCalled).toBeTruthy();
432
+ }
427
433
  });
428
434
 
429
435
  it('should not call saveEditedRows if beforeSave call preventDefault', () => {
@@ -440,12 +446,15 @@ describe('TekGrid', () => {
440
446
 
441
447
  const spy = jest.spyOn(instance, 'saveEditedRows');
442
448
  instance.onCreated();
443
- const button = new Button(instance.toolbarSlot[3]);
444
- button.click({ defaultPrevented: true } as Event, {} as HTMLElement);
445
- expect(beforeSaveCalled).toBeTruthy();
446
- expect(afterSaveCalled).toBeFalsy();
447
- expect(spy).not.toBeCalled();
448
- spy.mockReset();
449
+ const toolbarDiv = instance.toolbarSlot[2];
450
+ if (toolbarDiv.children) {
451
+ const button = new Button(toolbarDiv.children[1]);
452
+ button.click({ defaultPrevented: true } as Event, {} as HTMLElement);
453
+ expect(beforeSaveCalled).toBeTruthy();
454
+ expect(afterSaveCalled).toBeFalsy();
455
+ expect(spy).not.toBeCalled();
456
+ spy.mockReset();
457
+ }
449
458
  });
450
459
  });
451
460
 
@@ -458,12 +467,15 @@ describe('TekGrid', () => {
458
467
 
459
468
  const spy = jest.spyOn(instance, 'cancelEditedRows');
460
469
  instance.onCreated();
461
- const button = new Button(instance.toolbarSlot[4]);
462
- const event = new Event('click');
463
- button.click(event, {} as HTMLElement);
464
- expect(spy).toBeCalled();
465
- expect(button.isVisible).toBeFalsy();
466
- spy.mockReset();
470
+ const toolbarDiv = instance.toolbarSlot[2];
471
+ if (toolbarDiv.children) {
472
+ const button = new Button(toolbarDiv.children[2]);
473
+ const event = new Event('click');
474
+ button.click(event, {} as HTMLElement);
475
+ expect(spy).toBeCalled();
476
+ expect(button.isVisible).toBeFalsy();
477
+ spy.mockReset();
478
+ }
467
479
  });
468
480
 
469
481
  it('should call events', () => {
@@ -479,11 +491,14 @@ describe('TekGrid', () => {
479
491
  });
480
492
 
481
493
  instance.onCreated();
482
- const button = new Button(instance.toolbarSlot[4]);
483
- const event = new Event('click');
484
- button.click(event, {} as HTMLElement);
485
- expect(beforeCancelCalled).toBeTruthy();
486
- expect(afterCancelCalled).toBeTruthy();
494
+ const toolbarDiv = instance.toolbarSlot[2];
495
+ if (toolbarDiv.children) {
496
+ const button = new Button(toolbarDiv.children[2]);
497
+ const event = new Event('click');
498
+ button.click(event, {} as HTMLElement);
499
+ expect(beforeCancelCalled).toBeTruthy();
500
+ expect(afterCancelCalled).toBeTruthy();
501
+ }
487
502
  });
488
503
 
489
504
  it('should not call cancelEditedRows if beforeSave call preventDefault', () => {
@@ -500,12 +515,15 @@ describe('TekGrid', () => {
500
515
 
501
516
  const spy = jest.spyOn(instance, 'cancelEditedRows');
502
517
  instance.onCreated();
503
- const button = new Button(instance.toolbarSlot[4]);
504
- button.click({ defaultPrevented: true } as Event, {} as HTMLElement);
505
- expect(beforeCancelCalled).toBeTruthy();
506
- expect(afterCancelCalled).toBeFalsy();
507
- expect(spy).not.toBeCalled();
508
- spy.mockReset();
518
+ const toolbarDiv = instance.toolbarSlot[2];
519
+ if (toolbarDiv.children) {
520
+ const button = new Button(toolbarDiv.children[2]);
521
+ button.click({ defaultPrevented: true } as Event, {} as HTMLElement);
522
+ expect(beforeCancelCalled).toBeTruthy();
523
+ expect(afterCancelCalled).toBeFalsy();
524
+ expect(spy).not.toBeCalled();
525
+ spy.mockReset();
526
+ }
509
527
  });
510
528
  });
511
529
 
@@ -520,27 +538,84 @@ describe('TekGrid', () => {
520
538
  });
521
539
 
522
540
  instance.onCreated();
523
- const notEditingSpan = instance.toolbarSlot[2];
524
- if (notEditingSpan && notEditingSpan.children && notEditingSpan.children.length > 0) {
525
- const addTooltip = notEditingSpan.children[0];
526
- if (addTooltip && addTooltip.children && addTooltip.children.length > 0) {
527
- const addButton = addTooltip.children[0];
528
- const button = new Button(addButton);
529
- const event = new Event('click');
530
- button.click(event, {} as HTMLElement);
531
- expect(addClickCalled).toBeFalsy();
532
- instance.events = {
533
- addClick: () => { addClickCalled = true; },
534
- };
535
- expect(instance.editingNewRows).toBeTruthy();
536
- button.click(event, {} as HTMLElement);
537
- expect(addClickCalled).toBeTruthy();
538
- expect(button.isVisible).toBeTruthy();
541
+ const toolbarDiv = instance.toolbarSlot[2];
542
+ if (toolbarDiv.children) {
543
+ const notEditingSpan = toolbarDiv.children[0];
544
+ if (notEditingSpan && notEditingSpan.children && notEditingSpan.children.length > 0) {
545
+ const addTooltip = notEditingSpan.children[0];
546
+ if (addTooltip && addTooltip.children && addTooltip.children.length > 0) {
547
+ const addButton = addTooltip.children[0];
548
+ const button = new Button(addButton);
549
+ const event = new Event('click');
550
+ button.click(event, {} as HTMLElement);
551
+ expect(addClickCalled).toBeFalsy();
552
+ instance.events = {
553
+ addClick: () => { addClickCalled = true; },
554
+ };
555
+ expect(instance.editingNewRows).toBeTruthy();
556
+ button.click(event, {} as HTMLElement);
557
+ expect(addClickCalled).toBeTruthy();
558
+ expect(button.isVisible).toBeTruthy();
559
+ }
539
560
  }
540
561
  }
541
562
  });
542
563
  });
543
564
 
565
+ describe('hideButtonClick()', () => {
566
+ it('should hide toolbar', () => {
567
+ const instance = new TekGrid({
568
+ name: 'grid_deleteClick2',
569
+ component: 'TekGrid',
570
+ });
571
+
572
+ instance.onCreated();
573
+
574
+ const toolbarMock = { isVisible: true };
575
+ jest.spyOn(Metadata, 'getInstance').mockImplementation(() => toolbarMock);
576
+
577
+ const hideTooltip = instance.toolbarSlot[1];
578
+ expect(toolbarMock.isVisible).toBeTruthy();
579
+
580
+ if (hideTooltip.children) {
581
+ const hideButton = hideTooltip.children[0];
582
+ const button = new Button(hideButton);
583
+ const event = new Event('click');
584
+ button.click(event, {} as HTMLElement);
585
+
586
+ expect(toolbarMock.isVisible).toBeFalsy();
587
+ }
588
+ });
589
+
590
+ it('should show toolbar', () => {
591
+ const instance = new TekGrid({
592
+ name: 'grid_deleteClick2',
593
+ component: 'TekGrid',
594
+ toolbarOpened: false,
595
+ });
596
+
597
+ instance.onCreated();
598
+
599
+ const toolbarMock = { isVisible: true };
600
+ jest.spyOn(Metadata, 'getInstance').mockImplementation(() => toolbarMock);
601
+
602
+ const hideTooltip = instance.toolbarSlot[1];
603
+
604
+ if (hideTooltip.children) {
605
+ const hideButton = hideTooltip.children[0];
606
+ const button = new Button(hideButton);
607
+ const event = new Event('click');
608
+ button.click(event, {} as HTMLElement);
609
+
610
+ expect(toolbarMock.isVisible).toBeFalsy();
611
+
612
+ button.click(event, {} as HTMLElement);
613
+
614
+ expect(toolbarMock.isVisible).toBeTruthy();
615
+ }
616
+ });
617
+ });
618
+
544
619
  describe('deleteButtonClick()', () => {
545
620
  it('should call deleteRows', () => {
546
621
  const instance = new TekGrid({
@@ -551,17 +626,20 @@ describe('TekGrid', () => {
551
626
 
552
627
  const spy = jest.spyOn(instance, 'deleteRows');
553
628
  instance.onCreated();
554
- const notEditingSpan = instance.toolbarSlot[2];
555
- if (notEditingSpan && notEditingSpan.children && notEditingSpan.children.length > 1) {
556
- const deleteTooltip = notEditingSpan.children[1];
557
- if (deleteTooltip && deleteTooltip.children && deleteTooltip.children.length > 0) {
558
- const deleteButton = deleteTooltip.children[0];
559
- const button = new Button(deleteButton);
560
- const event = new Event('click');
561
- button.click(event, {} as HTMLElement);
562
- expect(spy).toBeCalled();
563
- expect(button.isVisible).toBeTruthy();
564
- expect(button.disabled).toBeTruthy();
629
+ const notEditingTag = instance.toolbarSlot[2];
630
+ if (notEditingTag.children) {
631
+ const notEditingSpan = notEditingTag.children[0];
632
+ if (notEditingSpan && notEditingSpan.children && notEditingSpan.children.length > 1) {
633
+ const deleteTooltip = notEditingSpan.children[1];
634
+ if (deleteTooltip && deleteTooltip.children && deleteTooltip.children.length > 0) {
635
+ const deleteButton = deleteTooltip.children[0];
636
+ const button = new Button(deleteButton);
637
+ const event = new Event('click');
638
+ button.click(event, {} as HTMLElement);
639
+ expect(spy).toBeCalled();
640
+ expect(button.isVisible).toBeTruthy();
641
+ expect(button.disabled).toBeTruthy();
642
+ }
565
643
  }
566
644
  }
567
645
  spy.mockReset();
@@ -610,14 +688,17 @@ describe('TekGrid', () => {
610
688
  instance.onCreated();
611
689
  const notEditingSpan = instance.toolbarSlot[2];
612
690
  if (notEditingSpan && notEditingSpan.children && notEditingSpan.children.length > 1) {
613
- const deleteTooltip = notEditingSpan.children[1];
614
- if (deleteTooltip && deleteTooltip.children && deleteTooltip.children.length > 0) {
615
- const deleteButton = deleteTooltip.children[0];
616
- const button = new Button(deleteButton);
617
- button.click({ defaultPrevented: true } as Event, {} as HTMLElement);
618
- expect(beforeDeleteCalled).toBeTruthy();
619
- expect(afterDeleteCalled).toBeFalsy();
620
- expect(spy).not.toBeCalled();
691
+ const deleteTooltip = notEditingSpan.children[0];
692
+ if (deleteTooltip.children) {
693
+ const teste = deleteTooltip.children[1];
694
+ if (teste && teste.children && teste.children.length > 0) {
695
+ const deleteButton = teste.children[0];
696
+ const button = new Button(deleteButton);
697
+ button.click({ defaultPrevented: true } as Event, {} as HTMLElement);
698
+ expect(beforeDeleteCalled).toBeTruthy();
699
+ expect(afterDeleteCalled).toBeFalsy();
700
+ expect(spy).not.toBeCalled();
701
+ }
621
702
  }
622
703
  }
623
704
  spy.mockReset();
@@ -637,16 +718,19 @@ describe('TekGrid', () => {
637
718
  instance.onCreated();
638
719
  const notEditingSpan = instance.toolbarSlot[2];
639
720
  if (notEditingSpan && notEditingSpan.children && notEditingSpan.children.length > 1) {
640
- const deleteTooltip = notEditingSpan.children[1];
641
- if (deleteTooltip && deleteTooltip.children && deleteTooltip.children.length > 0) {
642
- const deleteButton = deleteTooltip.children[0];
643
- const button = new Button(deleteButton);
644
- const event = new Event('click');
645
- expect(button.isVisible).toBeTruthy();
646
- expect(button.disabled).toBeTruthy();
647
- instance.selectAll(true);
648
- expect(button.disabled).toBeFalsy();
649
- expect(() => button.click(event, {} as HTMLElement)).toThrow();
721
+ const deleteTooltip = notEditingSpan.children[0];
722
+ if (deleteTooltip.children) {
723
+ const teste = deleteTooltip.children[1];
724
+ if (teste && teste.children && teste.children.length > 0) {
725
+ const deleteButton = teste.children[0];
726
+ const button = new Button(deleteButton);
727
+ const event = new Event('click');
728
+ expect(button.isVisible).toBeTruthy();
729
+ expect(button.disabled).toBeTruthy();
730
+ instance.selectAll(true);
731
+ expect(button.disabled).toBeFalsy();
732
+ expect(() => button.click(event, {} as HTMLElement)).toThrow();
733
+ }
650
734
  }
651
735
  }
652
736
  });
@@ -663,12 +747,15 @@ describe('TekGrid', () => {
663
747
  instance.onCreated();
664
748
  const notEditingSpan = instance.toolbarSlot[2];
665
749
  if (notEditingSpan && notEditingSpan.children && notEditingSpan.children.length > 1) {
666
- const deleteTooltip = notEditingSpan.children[1];
667
- if (deleteTooltip && deleteTooltip.children && deleteTooltip.children.length > 0) {
668
- const deleteButton = deleteTooltip.children[0];
669
- const button = new Button(deleteButton);
670
- expect(button.isVisible).toBeFalsy();
671
- expect(button.disabled).toBeFalsy();
750
+ const deleteTooltip = notEditingSpan.children[0];
751
+ if (deleteTooltip.children) {
752
+ const test = deleteTooltip.children[1];
753
+ if (test && test.children && test.children.length > 0) {
754
+ const deleteButton = test.children[0];
755
+ const button = new Button(deleteButton);
756
+ expect(button.isVisible).toBeFalsy();
757
+ expect(button.disabled).toBeFalsy();
758
+ }
672
759
  }
673
760
  }
674
761
  });
@@ -1005,15 +1092,18 @@ describe('TekGrid', () => {
1005
1092
 
1006
1093
  const spy = jest.spyOn(instance, 'reload');
1007
1094
  instance.onCreated();
1008
- const notEditingSpan = instance.toolbarSlot[2];
1009
- if (notEditingSpan && notEditingSpan.children && notEditingSpan.children.length > 3) {
1010
- const reloadTooltip = notEditingSpan.children[3];
1011
- if (reloadTooltip && reloadTooltip.children && reloadTooltip.children.length > 0) {
1012
- const reloadButton = reloadTooltip.children[0];
1013
- const button = new Button(reloadButton);
1014
- const event = new Event('click');
1015
- button.click(event, {} as HTMLElement);
1016
- expect(spy).toBeCalled();
1095
+ const notEditingTag = instance.toolbarSlot[2];
1096
+ if (notEditingTag.children) {
1097
+ const notEditingSpan = notEditingTag.children[0];
1098
+ if (notEditingSpan && notEditingSpan.children && notEditingSpan.children.length > 3) {
1099
+ const reloadTooltip = notEditingSpan.children[3];
1100
+ if (reloadTooltip && reloadTooltip.children && reloadTooltip.children.length > 0) {
1101
+ const reloadButton = reloadTooltip.children[0];
1102
+ const button = new Button(reloadButton);
1103
+ const event = new Event('click');
1104
+ button.click(event, {} as HTMLElement);
1105
+ expect(spy).toBeCalled();
1106
+ }
1017
1107
  }
1018
1108
  }
1019
1109
  spy.mockReset();
@@ -1031,15 +1121,18 @@ describe('TekGrid', () => {
1031
1121
 
1032
1122
  const spy = jest.spyOn(instance, 'reload');
1033
1123
  instance.onCreated();
1034
- const notEditingSpan = instance.toolbarSlot[2];
1035
- if (notEditingSpan && notEditingSpan.children && notEditingSpan.children.length > 3) {
1036
- const reloadTooltip = notEditingSpan.children[3];
1037
- if (reloadTooltip && reloadTooltip.children && reloadTooltip.children.length > 0) {
1038
- const reloadButton = reloadTooltip.children[0];
1039
- const button = new Button(reloadButton);
1040
- setClick(button, { defaultPrevented: true });
1041
- expect(beforeSpy).toBeCalled();
1042
- expect(spy).not.toBeCalled();
1124
+ const notEditingTag = instance.toolbarSlot[2];
1125
+ if (notEditingTag.children) {
1126
+ const notEditingSpan = notEditingTag.children[0];
1127
+ if (notEditingSpan && notEditingSpan.children && notEditingSpan.children.length > 3) {
1128
+ const reloadTooltip = notEditingSpan.children[3];
1129
+ if (reloadTooltip && reloadTooltip.children && reloadTooltip.children.length > 0) {
1130
+ const reloadButton = reloadTooltip.children[0];
1131
+ const button = new Button(reloadButton);
1132
+ setClick(button, { defaultPrevented: true });
1133
+ expect(beforeSpy).toBeCalled();
1134
+ expect(spy).not.toBeCalled();
1135
+ }
1043
1136
  }
1044
1137
  }
1045
1138
  spy.mockReset();
@@ -623,6 +623,75 @@ describe('LayoutOptions', () => {
623
623
  });
624
624
  });
625
625
 
626
+ describe('discardChanges()', () => {
627
+ it('should discard changes and restore layout', async () => {
628
+ const layouts: ITekGridLayoutInfo = {
629
+ currentLayoutName: 'Name first',
630
+ layouts: {
631
+ 'Name first': {
632
+ name: 'Name first',
633
+ gridWidth: '544px',
634
+ columns: [
635
+ {
636
+ name: 'id',
637
+ width: '34px',
638
+ isVisible: true,
639
+ grouped: false,
640
+ },
641
+ {
642
+ name: 'name',
643
+ width: '107px',
644
+ isVisible: true,
645
+ grouped: false,
646
+ },
647
+ {
648
+ name: 'salary',
649
+ width: '114px',
650
+ isVisible: true,
651
+ grouped: false,
652
+ },
653
+ ],
654
+ },
655
+ },
656
+ };
657
+
658
+ let viewCalled = false;
659
+
660
+ const tag = new Tag({
661
+ name: 'toolbar',
662
+ component: 'ZdTag',
663
+ tag: 'span',
664
+ });
665
+ const grid = new TekGrid({
666
+ name: 'grid',
667
+ component: 'TekGrid',
668
+ columns: [
669
+ { name: 'id' },
670
+ { name: 'name' },
671
+ { name: 'salary' },
672
+ ],
673
+ events: {
674
+ loadLayouts: async () => layouts,
675
+ },
676
+ });
677
+ const instance = new TekGridLayoutOptions({ name: 'layout', component: 'TekGridLayoutOptions' });
678
+ instance.viewApplyLayout = () => { viewCalled = true; };
679
+ instance.parent = tag;
680
+ tag.parent = grid;
681
+
682
+ await instance.onMounted({} as HTMLElement);
683
+ instance.applyLayout('Name first');
684
+ expect(viewCalled).toBeTruthy();
685
+ expect(instance.layoutEdited).toBeFalsy();
686
+ expect(instance.currentLayoutName).toBe('Name first');
687
+
688
+ instance.layoutEdited = true;
689
+
690
+ instance.discardChanges();
691
+ expect(instance.layoutEdited).toBeFalsy();
692
+ });
693
+ });
694
+
626
695
  describe('updateDefaultLayout()', () => {
627
696
  it('should update default layout', async () => {
628
697
  const tag = new Tag({
@@ -718,6 +787,7 @@ describe('LayoutOptions', () => {
718
787
  expect(applyLayoutSpy).toBeCalled();
719
788
  });
720
789
  });
790
+
721
791
  describe('loadLayouts()/saveLayouts()', () => {
722
792
  it('should load layouts using config endpoint', async () => {
723
793
  (Config as ITekConfig).loadGridLayoutsEndPoint = '/loadLayoutsRoute';
@@ -92,7 +92,7 @@ describe('TekTreeGrid', () => {
92
92
  showLayoutOptions: false,
93
93
  });
94
94
  instance.onCreated();
95
- expect(instance.toolbarSlot.length).toBe(7);
95
+ expect(instance.toolbarSlot.length).toBe(3);
96
96
  });
97
97
 
98
98
  it('should overwrite toolbar', () => {
@@ -36,6 +36,9 @@ describe('GridController', () => {
36
36
  expect(instance.showExportButton).toBeTruthy();
37
37
  expect(instance.showActionAndExportButton).toBeTruthy();
38
38
  expect(instance.showSearchInput).toBeTruthy();
39
+ expect(instance.showToolbar).toBeTruthy();
40
+ expect(instance.toolbarStyle).toBe('');
41
+ expect(instance.tooltipName).toBe('TEKGRID_HIDE');
39
42
  expect(instance.showDivider2).toBeTruthy();
40
43
  expect(instance.showDivider3).toBeTruthy();
41
44
  expect(instance.showColumnsButton).toBeTruthy();
@@ -67,6 +70,11 @@ describe('GridController', () => {
67
70
  expect(instance.showExportButton).toBeFalsy();
68
71
  expect(instance.showActionAndExportButton).toBeFalsy();
69
72
  expect(instance.showLayoutOptionsButton).toBeFalsy();
73
+
74
+ instance.showToolbar = false;
75
+ expect(instance.toolbarStyle).toBe('is-rotated');
76
+ expect(instance.tooltipName).toBe('TEKGRID_SHOW');
77
+ expect(instance.showToolbar).toBeFalsy();
70
78
  });
71
79
 
72
80
  it('should verify if showDivider3 is visibility', () => {
@@ -25,6 +25,7 @@ export * from './tek-grid/interfaces';
25
25
  export * from './tek-grid/grid';
26
26
  export * from './tek-grid/grid-column';
27
27
  export * from './tek-grid/grid-columns-button';
28
+ export * from './tek-grid/grid-columns-button-controller';
28
29
  export * from './tek-grid/grid-filter-button';
29
30
  export * from './tek-grid/layout-options';
30
31
  export * from './tek-grid/filter-helper';
@@ -75,6 +75,7 @@ export declare class TekGrid extends GridEditable implements ITekGrid {
75
75
  protected keyShortcutKeyMapping: any;
76
76
  showCheckboxAllFilter: boolean;
77
77
  defaultFilter: IDictionary;
78
+ toolbarOpened: boolean;
78
79
  /**
79
80
  * TekGrid class constructor
80
81
  * @param props TekGrid properties
@@ -62,6 +62,7 @@ export interface ITekGrid extends IGridEditable {
62
62
  showCheckboxAllFilter?: boolean;
63
63
  defaultFilter?: IDictionary;
64
64
  xlsDefaultType?: string;
65
+ toolbarOpened?: boolean;
65
66
  }
66
67
  export declare type MultiOptionParams = {
67
68
  iconName: string;
@@ -8,6 +8,7 @@ export declare class TekGridLayoutOptions extends ComponentRender implements ITe
8
8
  layouts: IDictionary<ITekGridLayout>;
9
9
  layoutNames: string[];
10
10
  viewApplyLayout?: Function;
11
+ viewGetCurrentLayout?: Function;
11
12
  originalColumnProps: ITekGridLayoutColumn[];
12
13
  originalDatasourceOrder: string[];
13
14
  originalDatasourceDynamicFilter: IDictionary<IDynamicFilterItem[]>;
@@ -20,6 +21,7 @@ export declare class TekGridLayoutOptions extends ComponentRender implements ITe
20
21
  getHelperValue(column: any): string | (string | undefined)[] | undefined;
21
22
  newLayout(layout: ITekGridLayout): void;
22
23
  addLayout(layout: ITekGridLayout): void;
24
+ discardChanges(): void;
23
25
  applyLayout(name: string, save?: boolean): void;
24
26
  private saveLayouts;
25
27
  deleteLayout(name: string): void;
@@ -24,4 +24,5 @@ export interface ITekTreeGrid extends ITreeGridEditable {
24
24
  layoutOptions?: TekGridLayoutOptions;
25
25
  showCheckboxAllFilter?: boolean;
26
26
  defaultFilter?: IDictionary;
27
+ toolbarOpened?: boolean;
27
28
  }
@@ -49,6 +49,7 @@ export declare class TekTreeGrid extends TreeGridEditable implements ITekTreeGri
49
49
  * Show refresh button
50
50
  */
51
51
  showReload: boolean;
52
+ toolbarOpened: boolean;
52
53
  protected keyShortcutKeyMapping: any;
53
54
  /**
54
55
  * Export config