@zeedhi/teknisa-components-common 1.101.1 → 1.103.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/coverage/clover.xml +683 -746
- package/coverage/coverage-final.json +45 -45
- package/coverage/lcov-report/components/crud/crud-add-button.ts.html +250 -0
- package/coverage/lcov-report/components/crud/crud-button.ts.html +292 -0
- package/coverage/lcov-report/components/crud/crud-cancel-button.ts.html +259 -0
- package/coverage/lcov-report/components/crud/crud-delete-button.ts.html +322 -0
- package/coverage/lcov-report/components/crud/crud-form.ts.html +382 -0
- package/coverage/lcov-report/components/crud/crud-save-button.ts.html +253 -0
- package/coverage/lcov-report/components/crud/index.html +191 -0
- package/coverage/lcov-report/components/index.html +116 -0
- package/coverage/lcov-report/components/index.ts.html +394 -0
- package/coverage/lcov-report/components/tek-breadcrumb-header/breadcrumb-header.ts.html +172 -0
- package/coverage/lcov-report/components/tek-breadcrumb-header/index.html +116 -0
- package/coverage/lcov-report/components/tek-card-title/card-title.ts.html +175 -0
- package/coverage/lcov-report/components/tek-card-title/index.html +116 -0
- package/coverage/lcov-report/components/tek-datasource/index.html +146 -0
- package/coverage/lcov-report/components/tek-datasource/interfaces.ts.html +193 -0
- package/coverage/lcov-report/components/tek-datasource/memory-datasource.ts.html +1015 -0
- package/coverage/lcov-report/components/tek-datasource/rest-datasource.ts.html +751 -0
- package/coverage/lcov-report/components/tek-drag-grid/index.html +116 -0
- package/coverage/lcov-report/components/tek-drag-grid/tek-drag-grid.ts.html +409 -0
- package/coverage/lcov-report/components/tek-grid/filter-helper.ts.html +145 -0
- package/coverage/lcov-report/components/tek-grid/grid-column.ts.html +775 -0
- package/coverage/lcov-report/components/tek-grid/grid-columns-button-controller.ts.html +169 -0
- package/coverage/lcov-report/components/tek-grid/grid-columns-button.ts.html +190 -0
- package/coverage/lcov-report/components/tek-grid/grid-filter-button.ts.html +1282 -0
- package/coverage/lcov-report/components/tek-grid/grid.ts.html +3157 -0
- package/coverage/lcov-report/components/tek-grid/index.html +221 -0
- package/coverage/lcov-report/components/tek-grid/interfaces.ts.html +733 -0
- package/coverage/lcov-report/components/tek-grid/layout-options.ts.html +826 -0
- package/coverage/lcov-report/components/tek-image/image.ts.html +313 -0
- package/coverage/lcov-report/components/tek-image/index.html +116 -0
- package/coverage/lcov-report/components/tek-iterable-carousel/index.html +116 -0
- package/coverage/lcov-report/components/tek-iterable-carousel/iterable-carousel.ts.html +175 -0
- package/coverage/lcov-report/components/tek-iterable-component-render/index.html +116 -0
- package/coverage/lcov-report/components/tek-iterable-component-render/iterable-component-render.ts.html +118 -0
- package/coverage/lcov-report/components/tek-loading/index.html +116 -0
- package/coverage/lcov-report/components/tek-loading/loading.ts.html +196 -0
- package/coverage/lcov-report/components/tek-notifications/index.html +116 -0
- package/coverage/lcov-report/components/tek-notifications/notifications.ts.html +271 -0
- package/coverage/lcov-report/components/tek-product-card/index.html +116 -0
- package/coverage/lcov-report/components/tek-product-card/product-card.ts.html +391 -0
- package/coverage/lcov-report/components/tek-tree-grid/index.html +116 -0
- package/coverage/lcov-report/components/tek-tree-grid/tree-grid.ts.html +1255 -0
- package/coverage/lcov-report/components/tek-user-info/TekUserInfoController.ts.html +367 -0
- package/coverage/lcov-report/components/tek-user-info/index.html +146 -0
- package/coverage/lcov-report/components/tek-user-info/tek-user-info-list.ts.html +268 -0
- package/coverage/lcov-report/components/tek-user-info/tek-user-info.ts.html +1096 -0
- package/coverage/lcov-report/error/delete-rows-error.ts.html +118 -0
- package/coverage/lcov-report/error/index.html +116 -0
- package/coverage/lcov-report/index.html +17 -17
- package/coverage/lcov-report/tests/__helpers__/component-event-helper.ts.html +2 -2
- package/coverage/lcov-report/tests/__helpers__/flush-promises-helper.ts.html +2 -2
- package/coverage/lcov-report/tests/__helpers__/get-child-helper.ts.html +9 -9
- package/coverage/lcov-report/tests/__helpers__/index.html +1 -1
- package/coverage/lcov-report/tests/__helpers__/index.ts.html +1 -1
- package/coverage/lcov-report/tests/__helpers__/mock-created-helper.ts.html +1 -1
- package/coverage/lcov-report/utils/grid-base/export-options/button-option.ts.html +166 -0
- package/coverage/lcov-report/utils/grid-base/export-options/index.html +146 -0
- package/coverage/lcov-report/utils/grid-base/export-options/index.ts.html +94 -0
- package/coverage/lcov-report/utils/grid-base/export-options/multi-option.ts.html +355 -0
- package/coverage/lcov-report/utils/grid-base/grid-base.ts.html +1960 -0
- package/coverage/lcov-report/utils/grid-base/grid-controller.ts.html +457 -0
- package/coverage/lcov-report/utils/grid-base/index.html +131 -0
- package/coverage/lcov-report/utils/index.html +116 -0
- package/coverage/lcov-report/utils/index.ts.html +100 -0
- package/coverage/lcov-report/utils/report-filter/index.html +116 -0
- package/coverage/lcov-report/utils/report-filter/report-filter.ts.html +256 -0
- package/coverage/lcov.info +1173 -1286
- package/dist/tek-components-common.esm.js +249 -171
- package/dist/tek-components-common.umd.js +248 -169
- package/package.json +3 -3
- package/tests/unit/components/tek-grid/grid.spec.ts +224 -104
- package/tests/unit/components/tek-grid/layout_options.spec.ts +70 -0
- package/tests/unit/components/tree-grid/tree-grid.spec.ts +1 -1
- package/tests/unit/utils/grid-base/grid-controller.spec.ts +8 -0
- package/types/components/index.d.ts +1 -0
- package/types/components/tek-grid/grid.d.ts +2 -0
- package/types/components/tek-grid/interfaces.d.ts +2 -0
- package/types/components/tek-grid/layout-options.d.ts +2 -0
- package/types/components/tek-tree-grid/interfaces.d.ts +2 -0
- package/types/components/tek-tree-grid/tree-grid.d.ts +2 -0
- package/types/utils/grid-base/grid-base.d.ts +166 -154
- package/types/utils/grid-base/grid-controller.d.ts +5 -0
- package/types/components/tek-ag-grid/default-icons.d.ts +0 -53
- package/types/components/tek-ag-grid/interfaces.d.ts +0 -9
- package/types/components/tek-ag-grid/tek-ag-grid.d.ts +0 -35
- package/types/components/tek-datasource/datasource.d.ts +0 -94
- package/types/components/tek-grid/default-icons.d.ts +0 -53
- package/types/components/tek-grid/filter-dynamic-values.d.ts +0 -9
- package/types/components/tek-grid/grid-controller.d.ts +0 -19
- package/types/components/tek-grid/grid_column.d.ts +0 -14
- package/types/components/tek-grid/grid_controller.d.ts +0 -15
- package/types/components/tek-grid/tek-grid.d.ts +0 -35
- package/types/components/tek-login/interfaces.d.ts +0 -3
- package/types/components/tek-login/login-children.d.ts +0 -3
- package/types/components/tek-login/login.d.ts +0 -58
- 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(
|
|
148
|
+
expect(instance.toolbarSlot.length).toBe(3);
|
|
149
149
|
});
|
|
150
150
|
|
|
151
151
|
it('should overwrite toolbar', () => {
|
|
@@ -387,6 +387,33 @@ describe('TekGrid', () => {
|
|
|
387
387
|
spy.mockReset();
|
|
388
388
|
getColumnSpy.mockReset();
|
|
389
389
|
});
|
|
390
|
+
|
|
391
|
+
it('should call getReport always with "xls" when there is no group', async () => {
|
|
392
|
+
(window as any).open = jest.fn();
|
|
393
|
+
|
|
394
|
+
const instance = new TekGrid({
|
|
395
|
+
name: 'grid',
|
|
396
|
+
component: 'TekGrid',
|
|
397
|
+
columns: [
|
|
398
|
+
{
|
|
399
|
+
name: 'id',
|
|
400
|
+
label: 'ID',
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
name: 'department_id',
|
|
404
|
+
label: 'Department ID',
|
|
405
|
+
},
|
|
406
|
+
],
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
await instance.getReport('xls2');
|
|
410
|
+
|
|
411
|
+
expect(reportSpy).toHaveBeenCalledWith('xls', undefined, {
|
|
412
|
+
metaData: {
|
|
413
|
+
columns: {}, filter: undefined, groups: [], xlsDefaultType: undefined,
|
|
414
|
+
},
|
|
415
|
+
}, undefined);
|
|
416
|
+
});
|
|
390
417
|
});
|
|
391
418
|
|
|
392
419
|
describe('saveChanges()', () => {
|
|
@@ -398,12 +425,15 @@ describe('TekGrid', () => {
|
|
|
398
425
|
|
|
399
426
|
const spy = jest.spyOn(instance, 'saveEditedRows');
|
|
400
427
|
instance.onCreated();
|
|
401
|
-
const
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
428
|
+
const toolbarDiv = instance.toolbarSlot[2];
|
|
429
|
+
if (toolbarDiv.children) {
|
|
430
|
+
const button = new Button(toolbarDiv.children[1]);
|
|
431
|
+
const event = new Event('click');
|
|
432
|
+
button.click(event, {} as HTMLElement);
|
|
433
|
+
expect(spy).toBeCalled();
|
|
434
|
+
expect(button.isVisible).toBeFalsy();
|
|
435
|
+
spy.mockReset();
|
|
436
|
+
}
|
|
407
437
|
});
|
|
408
438
|
|
|
409
439
|
it('should call events', () => {
|
|
@@ -419,11 +449,14 @@ describe('TekGrid', () => {
|
|
|
419
449
|
});
|
|
420
450
|
|
|
421
451
|
instance.onCreated();
|
|
422
|
-
const
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
452
|
+
const toolbarDiv = instance.toolbarSlot[2];
|
|
453
|
+
if (toolbarDiv.children) {
|
|
454
|
+
const button = new Button(toolbarDiv.children[1]);
|
|
455
|
+
const event = new Event('click');
|
|
456
|
+
button.click(event, {} as HTMLElement);
|
|
457
|
+
expect(beforeSaveCalled).toBeTruthy();
|
|
458
|
+
expect(afterSaveCalled).toBeTruthy();
|
|
459
|
+
}
|
|
427
460
|
});
|
|
428
461
|
|
|
429
462
|
it('should not call saveEditedRows if beforeSave call preventDefault', () => {
|
|
@@ -440,12 +473,15 @@ describe('TekGrid', () => {
|
|
|
440
473
|
|
|
441
474
|
const spy = jest.spyOn(instance, 'saveEditedRows');
|
|
442
475
|
instance.onCreated();
|
|
443
|
-
const
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
476
|
+
const toolbarDiv = instance.toolbarSlot[2];
|
|
477
|
+
if (toolbarDiv.children) {
|
|
478
|
+
const button = new Button(toolbarDiv.children[1]);
|
|
479
|
+
button.click({ defaultPrevented: true } as Event, {} as HTMLElement);
|
|
480
|
+
expect(beforeSaveCalled).toBeTruthy();
|
|
481
|
+
expect(afterSaveCalled).toBeFalsy();
|
|
482
|
+
expect(spy).not.toBeCalled();
|
|
483
|
+
spy.mockReset();
|
|
484
|
+
}
|
|
449
485
|
});
|
|
450
486
|
});
|
|
451
487
|
|
|
@@ -458,12 +494,15 @@ describe('TekGrid', () => {
|
|
|
458
494
|
|
|
459
495
|
const spy = jest.spyOn(instance, 'cancelEditedRows');
|
|
460
496
|
instance.onCreated();
|
|
461
|
-
const
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
497
|
+
const toolbarDiv = instance.toolbarSlot[2];
|
|
498
|
+
if (toolbarDiv.children) {
|
|
499
|
+
const button = new Button(toolbarDiv.children[2]);
|
|
500
|
+
const event = new Event('click');
|
|
501
|
+
button.click(event, {} as HTMLElement);
|
|
502
|
+
expect(spy).toBeCalled();
|
|
503
|
+
expect(button.isVisible).toBeFalsy();
|
|
504
|
+
spy.mockReset();
|
|
505
|
+
}
|
|
467
506
|
});
|
|
468
507
|
|
|
469
508
|
it('should call events', () => {
|
|
@@ -479,11 +518,14 @@ describe('TekGrid', () => {
|
|
|
479
518
|
});
|
|
480
519
|
|
|
481
520
|
instance.onCreated();
|
|
482
|
-
const
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
521
|
+
const toolbarDiv = instance.toolbarSlot[2];
|
|
522
|
+
if (toolbarDiv.children) {
|
|
523
|
+
const button = new Button(toolbarDiv.children[2]);
|
|
524
|
+
const event = new Event('click');
|
|
525
|
+
button.click(event, {} as HTMLElement);
|
|
526
|
+
expect(beforeCancelCalled).toBeTruthy();
|
|
527
|
+
expect(afterCancelCalled).toBeTruthy();
|
|
528
|
+
}
|
|
487
529
|
});
|
|
488
530
|
|
|
489
531
|
it('should not call cancelEditedRows if beforeSave call preventDefault', () => {
|
|
@@ -500,12 +542,15 @@ describe('TekGrid', () => {
|
|
|
500
542
|
|
|
501
543
|
const spy = jest.spyOn(instance, 'cancelEditedRows');
|
|
502
544
|
instance.onCreated();
|
|
503
|
-
const
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
545
|
+
const toolbarDiv = instance.toolbarSlot[2];
|
|
546
|
+
if (toolbarDiv.children) {
|
|
547
|
+
const button = new Button(toolbarDiv.children[2]);
|
|
548
|
+
button.click({ defaultPrevented: true } as Event, {} as HTMLElement);
|
|
549
|
+
expect(beforeCancelCalled).toBeTruthy();
|
|
550
|
+
expect(afterCancelCalled).toBeFalsy();
|
|
551
|
+
expect(spy).not.toBeCalled();
|
|
552
|
+
spy.mockReset();
|
|
553
|
+
}
|
|
509
554
|
});
|
|
510
555
|
});
|
|
511
556
|
|
|
@@ -520,27 +565,84 @@ describe('TekGrid', () => {
|
|
|
520
565
|
});
|
|
521
566
|
|
|
522
567
|
instance.onCreated();
|
|
523
|
-
const
|
|
524
|
-
if (
|
|
525
|
-
const
|
|
526
|
-
if (
|
|
527
|
-
const
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
568
|
+
const toolbarDiv = instance.toolbarSlot[2];
|
|
569
|
+
if (toolbarDiv.children) {
|
|
570
|
+
const notEditingSpan = toolbarDiv.children[0];
|
|
571
|
+
if (notEditingSpan && notEditingSpan.children && notEditingSpan.children.length > 0) {
|
|
572
|
+
const addTooltip = notEditingSpan.children[0];
|
|
573
|
+
if (addTooltip && addTooltip.children && addTooltip.children.length > 0) {
|
|
574
|
+
const addButton = addTooltip.children[0];
|
|
575
|
+
const button = new Button(addButton);
|
|
576
|
+
const event = new Event('click');
|
|
577
|
+
button.click(event, {} as HTMLElement);
|
|
578
|
+
expect(addClickCalled).toBeFalsy();
|
|
579
|
+
instance.events = {
|
|
580
|
+
addClick: () => { addClickCalled = true; },
|
|
581
|
+
};
|
|
582
|
+
expect(instance.editingNewRows).toBeTruthy();
|
|
583
|
+
button.click(event, {} as HTMLElement);
|
|
584
|
+
expect(addClickCalled).toBeTruthy();
|
|
585
|
+
expect(button.isVisible).toBeTruthy();
|
|
586
|
+
}
|
|
539
587
|
}
|
|
540
588
|
}
|
|
541
589
|
});
|
|
542
590
|
});
|
|
543
591
|
|
|
592
|
+
describe('hideButtonClick()', () => {
|
|
593
|
+
it('should hide toolbar', () => {
|
|
594
|
+
const instance = new TekGrid({
|
|
595
|
+
name: 'grid_deleteClick2',
|
|
596
|
+
component: 'TekGrid',
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
instance.onCreated();
|
|
600
|
+
|
|
601
|
+
const toolbarMock = { isVisible: true };
|
|
602
|
+
jest.spyOn(Metadata, 'getInstance').mockImplementation(() => toolbarMock);
|
|
603
|
+
|
|
604
|
+
const hideTooltip = instance.toolbarSlot[1];
|
|
605
|
+
expect(toolbarMock.isVisible).toBeTruthy();
|
|
606
|
+
|
|
607
|
+
if (hideTooltip.children) {
|
|
608
|
+
const hideButton = hideTooltip.children[0];
|
|
609
|
+
const button = new Button(hideButton);
|
|
610
|
+
const event = new Event('click');
|
|
611
|
+
button.click(event, {} as HTMLElement);
|
|
612
|
+
|
|
613
|
+
expect(toolbarMock.isVisible).toBeFalsy();
|
|
614
|
+
}
|
|
615
|
+
});
|
|
616
|
+
|
|
617
|
+
it('should show toolbar', () => {
|
|
618
|
+
const instance = new TekGrid({
|
|
619
|
+
name: 'grid_deleteClick2',
|
|
620
|
+
component: 'TekGrid',
|
|
621
|
+
toolbarOpened: false,
|
|
622
|
+
});
|
|
623
|
+
|
|
624
|
+
instance.onCreated();
|
|
625
|
+
|
|
626
|
+
const toolbarMock = { isVisible: true };
|
|
627
|
+
jest.spyOn(Metadata, 'getInstance').mockImplementation(() => toolbarMock);
|
|
628
|
+
|
|
629
|
+
const hideTooltip = instance.toolbarSlot[1];
|
|
630
|
+
|
|
631
|
+
if (hideTooltip.children) {
|
|
632
|
+
const hideButton = hideTooltip.children[0];
|
|
633
|
+
const button = new Button(hideButton);
|
|
634
|
+
const event = new Event('click');
|
|
635
|
+
button.click(event, {} as HTMLElement);
|
|
636
|
+
|
|
637
|
+
expect(toolbarMock.isVisible).toBeFalsy();
|
|
638
|
+
|
|
639
|
+
button.click(event, {} as HTMLElement);
|
|
640
|
+
|
|
641
|
+
expect(toolbarMock.isVisible).toBeTruthy();
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
});
|
|
645
|
+
|
|
544
646
|
describe('deleteButtonClick()', () => {
|
|
545
647
|
it('should call deleteRows', () => {
|
|
546
648
|
const instance = new TekGrid({
|
|
@@ -551,17 +653,20 @@ describe('TekGrid', () => {
|
|
|
551
653
|
|
|
552
654
|
const spy = jest.spyOn(instance, 'deleteRows');
|
|
553
655
|
instance.onCreated();
|
|
554
|
-
const
|
|
555
|
-
if (
|
|
556
|
-
const
|
|
557
|
-
if (
|
|
558
|
-
const
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
656
|
+
const notEditingTag = instance.toolbarSlot[2];
|
|
657
|
+
if (notEditingTag.children) {
|
|
658
|
+
const notEditingSpan = notEditingTag.children[0];
|
|
659
|
+
if (notEditingSpan && notEditingSpan.children && notEditingSpan.children.length > 1) {
|
|
660
|
+
const deleteTooltip = notEditingSpan.children[1];
|
|
661
|
+
if (deleteTooltip && deleteTooltip.children && deleteTooltip.children.length > 0) {
|
|
662
|
+
const deleteButton = deleteTooltip.children[0];
|
|
663
|
+
const button = new Button(deleteButton);
|
|
664
|
+
const event = new Event('click');
|
|
665
|
+
button.click(event, {} as HTMLElement);
|
|
666
|
+
expect(spy).toBeCalled();
|
|
667
|
+
expect(button.isVisible).toBeTruthy();
|
|
668
|
+
expect(button.disabled).toBeTruthy();
|
|
669
|
+
}
|
|
565
670
|
}
|
|
566
671
|
}
|
|
567
672
|
spy.mockReset();
|
|
@@ -610,14 +715,17 @@ describe('TekGrid', () => {
|
|
|
610
715
|
instance.onCreated();
|
|
611
716
|
const notEditingSpan = instance.toolbarSlot[2];
|
|
612
717
|
if (notEditingSpan && notEditingSpan.children && notEditingSpan.children.length > 1) {
|
|
613
|
-
const deleteTooltip = notEditingSpan.children[
|
|
614
|
-
if (deleteTooltip
|
|
615
|
-
const
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
718
|
+
const deleteTooltip = notEditingSpan.children[0];
|
|
719
|
+
if (deleteTooltip.children) {
|
|
720
|
+
const teste = deleteTooltip.children[1];
|
|
721
|
+
if (teste && teste.children && teste.children.length > 0) {
|
|
722
|
+
const deleteButton = teste.children[0];
|
|
723
|
+
const button = new Button(deleteButton);
|
|
724
|
+
button.click({ defaultPrevented: true } as Event, {} as HTMLElement);
|
|
725
|
+
expect(beforeDeleteCalled).toBeTruthy();
|
|
726
|
+
expect(afterDeleteCalled).toBeFalsy();
|
|
727
|
+
expect(spy).not.toBeCalled();
|
|
728
|
+
}
|
|
621
729
|
}
|
|
622
730
|
}
|
|
623
731
|
spy.mockReset();
|
|
@@ -637,16 +745,19 @@ describe('TekGrid', () => {
|
|
|
637
745
|
instance.onCreated();
|
|
638
746
|
const notEditingSpan = instance.toolbarSlot[2];
|
|
639
747
|
if (notEditingSpan && notEditingSpan.children && notEditingSpan.children.length > 1) {
|
|
640
|
-
const deleteTooltip = notEditingSpan.children[
|
|
641
|
-
if (deleteTooltip
|
|
642
|
-
const
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
748
|
+
const deleteTooltip = notEditingSpan.children[0];
|
|
749
|
+
if (deleteTooltip.children) {
|
|
750
|
+
const teste = deleteTooltip.children[1];
|
|
751
|
+
if (teste && teste.children && teste.children.length > 0) {
|
|
752
|
+
const deleteButton = teste.children[0];
|
|
753
|
+
const button = new Button(deleteButton);
|
|
754
|
+
const event = new Event('click');
|
|
755
|
+
expect(button.isVisible).toBeTruthy();
|
|
756
|
+
expect(button.disabled).toBeTruthy();
|
|
757
|
+
instance.selectAll(true);
|
|
758
|
+
expect(button.disabled).toBeFalsy();
|
|
759
|
+
expect(() => button.click(event, {} as HTMLElement)).toThrow();
|
|
760
|
+
}
|
|
650
761
|
}
|
|
651
762
|
}
|
|
652
763
|
});
|
|
@@ -663,12 +774,15 @@ describe('TekGrid', () => {
|
|
|
663
774
|
instance.onCreated();
|
|
664
775
|
const notEditingSpan = instance.toolbarSlot[2];
|
|
665
776
|
if (notEditingSpan && notEditingSpan.children && notEditingSpan.children.length > 1) {
|
|
666
|
-
const deleteTooltip = notEditingSpan.children[
|
|
667
|
-
if (deleteTooltip
|
|
668
|
-
const
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
777
|
+
const deleteTooltip = notEditingSpan.children[0];
|
|
778
|
+
if (deleteTooltip.children) {
|
|
779
|
+
const test = deleteTooltip.children[1];
|
|
780
|
+
if (test && test.children && test.children.length > 0) {
|
|
781
|
+
const deleteButton = test.children[0];
|
|
782
|
+
const button = new Button(deleteButton);
|
|
783
|
+
expect(button.isVisible).toBeFalsy();
|
|
784
|
+
expect(button.disabled).toBeFalsy();
|
|
785
|
+
}
|
|
672
786
|
}
|
|
673
787
|
}
|
|
674
788
|
});
|
|
@@ -1005,15 +1119,18 @@ describe('TekGrid', () => {
|
|
|
1005
1119
|
|
|
1006
1120
|
const spy = jest.spyOn(instance, 'reload');
|
|
1007
1121
|
instance.onCreated();
|
|
1008
|
-
const
|
|
1009
|
-
if (
|
|
1010
|
-
const
|
|
1011
|
-
if (
|
|
1012
|
-
const
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1122
|
+
const notEditingTag = instance.toolbarSlot[2];
|
|
1123
|
+
if (notEditingTag.children) {
|
|
1124
|
+
const notEditingSpan = notEditingTag.children[0];
|
|
1125
|
+
if (notEditingSpan && notEditingSpan.children && notEditingSpan.children.length > 3) {
|
|
1126
|
+
const reloadTooltip = notEditingSpan.children[3];
|
|
1127
|
+
if (reloadTooltip && reloadTooltip.children && reloadTooltip.children.length > 0) {
|
|
1128
|
+
const reloadButton = reloadTooltip.children[0];
|
|
1129
|
+
const button = new Button(reloadButton);
|
|
1130
|
+
const event = new Event('click');
|
|
1131
|
+
button.click(event, {} as HTMLElement);
|
|
1132
|
+
expect(spy).toBeCalled();
|
|
1133
|
+
}
|
|
1017
1134
|
}
|
|
1018
1135
|
}
|
|
1019
1136
|
spy.mockReset();
|
|
@@ -1031,15 +1148,18 @@ describe('TekGrid', () => {
|
|
|
1031
1148
|
|
|
1032
1149
|
const spy = jest.spyOn(instance, 'reload');
|
|
1033
1150
|
instance.onCreated();
|
|
1034
|
-
const
|
|
1035
|
-
if (
|
|
1036
|
-
const
|
|
1037
|
-
if (
|
|
1038
|
-
const
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1151
|
+
const notEditingTag = instance.toolbarSlot[2];
|
|
1152
|
+
if (notEditingTag.children) {
|
|
1153
|
+
const notEditingSpan = notEditingTag.children[0];
|
|
1154
|
+
if (notEditingSpan && notEditingSpan.children && notEditingSpan.children.length > 3) {
|
|
1155
|
+
const reloadTooltip = notEditingSpan.children[3];
|
|
1156
|
+
if (reloadTooltip && reloadTooltip.children && reloadTooltip.children.length > 0) {
|
|
1157
|
+
const reloadButton = reloadTooltip.children[0];
|
|
1158
|
+
const button = new Button(reloadButton);
|
|
1159
|
+
setClick(button, { defaultPrevented: true });
|
|
1160
|
+
expect(beforeSpy).toBeCalled();
|
|
1161
|
+
expect(spy).not.toBeCalled();
|
|
1162
|
+
}
|
|
1043
1163
|
}
|
|
1044
1164
|
}
|
|
1045
1165
|
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';
|
|
@@ -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,8 @@ export declare class TekGrid extends GridEditable implements ITekGrid {
|
|
|
75
75
|
protected keyShortcutKeyMapping: any;
|
|
76
76
|
showCheckboxAllFilter: boolean;
|
|
77
77
|
defaultFilter: IDictionary;
|
|
78
|
+
toolbarOpened: boolean;
|
|
79
|
+
reportTitle: string;
|
|
78
80
|
/**
|
|
79
81
|
* TekGrid class constructor
|
|
80
82
|
* @param props TekGrid properties
|
|
@@ -62,6 +62,8 @@ export interface ITekGrid extends IGridEditable {
|
|
|
62
62
|
showCheckboxAllFilter?: boolean;
|
|
63
63
|
defaultFilter?: IDictionary;
|
|
64
64
|
xlsDefaultType?: string;
|
|
65
|
+
toolbarOpened?: boolean;
|
|
66
|
+
reportTitle?: string;
|
|
65
67
|
}
|
|
66
68
|
export declare type MultiOptionParams = {
|
|
67
69
|
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;
|
|
@@ -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
|
|
@@ -64,6 +65,7 @@ export declare class TekTreeGrid extends TreeGridEditable implements ITekTreeGri
|
|
|
64
65
|
filterOperationsDatasource: Datasource;
|
|
65
66
|
showCheckboxAllFilter: boolean;
|
|
66
67
|
defaultFilter: IDictionary;
|
|
68
|
+
reportTitle: string;
|
|
67
69
|
/**
|
|
68
70
|
* TekTreeGrid class constructor
|
|
69
71
|
* @param props TekTreeGrid properties
|