@zeedhi/teknisa-components-common 3.0.4 → 3.2.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/dist/teknisa-components-common.es.js +3536 -0
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/tek-breadcrumb-header/breadcrumb-header.d.ts +2 -2
- package/dist/types/components/tek-breadcrumb-header/interfaces.d.ts +1 -1
- package/dist/types/components/tek-datasource/tek-memory-datasource.d.ts +1 -21
- package/dist/types/components/tek-datasource/tek-rest-datasource.d.ts +6 -30
- package/dist/types/components/tek-grid/filter-helper.d.ts +2 -2
- package/dist/types/components/tek-grid/grid-filter-button.d.ts +1 -0
- package/dist/types/components/tek-grid/grouped-data-manager.d.ts +8 -1
- package/dist/types/components/tek-grid/grouped-data-navigator.d.ts +12 -0
- package/dist/types/components/tek-grid/index.d.ts +1 -1
- package/dist/types/components/tek-grid/interfaces.d.ts +8 -1
- package/dist/types/components/tek-grid/tek-grid-controller.d.ts +19 -17
- package/dist/types/components/tek-grid/tek-grid-data-editor.d.ts +11 -0
- package/dist/types/components/tek-grid/tek-grid-toolbar-provider/export-options/multi-option.d.ts +1 -1
- package/dist/types/components/tek-grid/tek-grid-toolbar-provider/tek-grid-toolbar-provider.d.ts +8 -1
- package/dist/types/components/tek-grid/tek-grid.d.ts +24 -6
- package/dist/types/components/tek-loading/interfaces.d.ts +6 -0
- package/dist/types/components/tek-loading/loading.d.ts +16 -0
- package/dist/types/components/tek-user-info/TekUserInfoController.d.ts +4 -4
- package/dist/types/utils/extract-properties/extract-properties.d.ts +1 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/report-filter/report-filter.d.ts +12 -0
- package/package.json +32 -12
- package/coverage/clover.xml +0 -6
- package/coverage/coverage-final.json +0 -1
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -101
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov.info +0 -0
- package/dist/teknisa-components-common.js +0 -3802
- package/dist/teknisa-components-common.min.js +0 -3802
- package/dist/types/components/tek-grid/grouped-view-navigator.d.ts +0 -14
- package/dist/types/error/delete-rows-error.d.ts +0 -6
- package/environments.json +0 -14
- package/jest.config.js +0 -1
- package/src/components/index.ts +0 -101
- package/src/components/tek-breadcrumb-header/breadcrumb-header.ts +0 -29
- package/src/components/tek-breadcrumb-header/interfaces.ts +0 -7
- package/src/components/tek-datasource/index.ts +0 -3
- package/src/components/tek-datasource/interfaces.ts +0 -36
- package/src/components/tek-datasource/tek-memory-datasource.ts +0 -314
- package/src/components/tek-datasource/tek-rest-datasource.ts +0 -224
- package/src/components/tek-grid/columns-searcher.ts +0 -22
- package/src/components/tek-grid/dynamic-filter-datasource-factory.ts +0 -20
- package/src/components/tek-grid/filter-helper.ts +0 -20
- package/src/components/tek-grid/grid-filter-button.ts +0 -419
- package/src/components/tek-grid/grouped-data-manager.ts +0 -448
- package/src/components/tek-grid/grouped-data-selector.ts +0 -40
- package/src/components/tek-grid/grouped-view-navigator.ts +0 -84
- package/src/components/tek-grid/index.ts +0 -18
- package/src/components/tek-grid/interfaces.ts +0 -329
- package/src/components/tek-grid/keymap-grouped.ts +0 -20
- package/src/components/tek-grid/layout-options.ts +0 -248
- package/src/components/tek-grid/tek-grid-column.ts +0 -193
- package/src/components/tek-grid/tek-grid-columns-button/tek-grid-columns-button-controller.ts +0 -28
- package/src/components/tek-grid/tek-grid-columns-button/tek-grid-columns-button.ts +0 -38
- package/src/components/tek-grid/tek-grid-controller.ts +0 -140
- package/src/components/tek-grid/tek-grid-events.ts +0 -105
- package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/button-option.ts +0 -26
- package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/index.ts +0 -3
- package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/interfaces.ts +0 -6
- package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/multi-option.ts +0 -85
- package/src/components/tek-grid/tek-grid-toolbar-provider/index.ts +0 -2
- package/src/components/tek-grid/tek-grid-toolbar-provider/tek-grid-toolbar-provider.ts +0 -365
- package/src/components/tek-grid/tek-grid.ts +0 -1118
- package/src/components/tek-user-info/TekUserInfoController.ts +0 -87
- package/src/components/tek-user-info/interfaces.ts +0 -21
- package/src/components/tek-user-info/tek-user-info-list.ts +0 -64
- package/src/components/tek-user-info/tek-user-info.ts +0 -337
- package/src/error/tek-grid-delete-rows-error.ts +0 -15
- package/src/error/teknisa-common-error.ts +0 -8
- package/src/utils/config/config.ts +0 -8
- package/src/utils/index.ts +0 -3
- package/src/utils/is-filled-object/is-filled-object.ts +0 -5
- package/src/utils/is-nil.ts +0 -3
- package/tests/__helpers__/component-event-helper.ts +0 -5
- package/tests/__helpers__/flush-promises-helper.ts +0 -3
- package/tests/__helpers__/get-child-helper.ts +0 -27
- package/tests/__helpers__/index.ts +0 -3
- package/tests/__helpers__/mock-created-helper.ts +0 -12
- package/tests/__mocks__/@zeedhi/core/i18n.js +0 -75
- package/tests/__mocks__/@zeedhi/core.js +0 -5
- package/tests/unit/components/crud/crud-add-button.spec.ts +0 -56
- package/tests/unit/components/crud/crud-button.spec.ts +0 -94
- package/tests/unit/components/crud/crud-cancel-button.spec.ts +0 -91
- package/tests/unit/components/crud/crud-delete-button.spec.ts +0 -122
- package/tests/unit/components/crud/crud-form.spec.ts +0 -165
- package/tests/unit/components/crud/crud-save-button.spec.ts +0 -118
- package/tests/unit/components/tek-breadcrumb-header/tek-breadcrumb-header.spec.ts +0 -42
- package/tests/unit/components/tek-card-title/CardTitle.spec.ts +0 -34
- package/tests/unit/components/tek-datasource/memory-datasource.spec.ts +0 -460
- package/tests/unit/components/tek-datasource/rest-datasource.spec.ts +0 -362
- package/tests/unit/components/tek-drag-grid/tek-drag-grid.spec.ts +0 -112
- package/tests/unit/components/tek-grid/button-option.spec.ts +0 -49
- package/tests/unit/components/tek-grid/columns-searcher.spec.ts +0 -112
- package/tests/unit/components/tek-grid/dynamic-filter-datasource-factory.spec.ts +0 -90
- package/tests/unit/components/tek-grid/filter-helper.spec.ts +0 -52
- package/tests/unit/components/tek-grid/grid-filter-button.spec.ts +0 -842
- package/tests/unit/components/tek-grid/grouped-data-manager.spec.ts +0 -593
- package/tests/unit/components/tek-grid/grouped-data-selector.spec.ts +0 -136
- package/tests/unit/components/tek-grid/grouped-view-navigator.spec.ts +0 -244
- package/tests/unit/components/tek-grid/keymap-grouped.spec.ts +0 -20
- package/tests/unit/components/tek-grid/layout-options.spec.ts +0 -1020
- package/tests/unit/components/tek-grid/multi-option.spec.ts +0 -139
- package/tests/unit/components/tek-grid/tek-grid-column.spec.ts +0 -312
- package/tests/unit/components/tek-grid/tek-grid-columns-button.spec.ts +0 -228
- package/tests/unit/components/tek-grid/tek-grid-controller.spec.ts +0 -253
- package/tests/unit/components/tek-grid/tek-grid-events.spec.ts +0 -186
- package/tests/unit/components/tek-grid/tek-grid-toolbar-provider.spec.ts +0 -34
- package/tests/unit/components/tek-grid/tek-grid.spec.ts +0 -895
- package/tests/unit/components/tek-grid/tek-memory-datasource.spec.ts +0 -482
- package/tests/unit/components/tek-grid/tek-rest-datasource.spec.ts +0 -422
- package/tests/unit/components/tek-image/Image.spec.ts +0 -67
- package/tests/unit/components/tek-iterable-carousel/iterable-carousel.spec.ts +0 -37
- package/tests/unit/components/tek-iterable-component-render/iterable-component-render.spec.ts +0 -200
- package/tests/unit/components/tek-loading/Loading.spec.ts +0 -30
- package/tests/unit/components/tek-notifications/notifications.spec.ts +0 -201
- package/tests/unit/components/tek-product-card/product-card.spec.ts +0 -61
- package/tests/unit/components/tek-user-info/TekUserInfoContoller.spec.ts +0 -220
- package/tests/unit/components/tek-user-info/tek-user-info-list.spec.ts +0 -86
- package/tests/unit/components/tek-user-info/tek-user-info.spec.ts +0 -430
- package/tests/unit/components/tree-grid/tree-grid.spec.ts +0 -776
- package/tests/unit/utils/grid-base/export-options/button-option.spec.ts +0 -44
- package/tests/unit/utils/grid-base/export-options/multi-option.spec.ts +0 -135
- package/tests/unit/utils/grid-base/grid-controller.spec.ts +0 -174
- package/tests/unit/utils/report-filter/report-filter.spec.ts +0 -66
- package/tsconfig.build.json +0 -7
- package/tsconfig.eslint.json +0 -9
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Button } from '@zeedhi/common';
|
|
2
|
-
import { TekGrid } from '../../../../../src/components';
|
|
3
|
-
import { ButtonOption } from '../../../../../src/utils';
|
|
4
|
-
|
|
5
|
-
describe('ButtonOption', () => {
|
|
6
|
-
describe('buildComponent()', () => {
|
|
7
|
-
it('when called, should build a simple button component', () => {
|
|
8
|
-
const grid = new TekGrid({ name: 'Grid', component: 'TekGrid' });
|
|
9
|
-
const config = {
|
|
10
|
-
type: 'pdf',
|
|
11
|
-
label: 'Exportar PDF',
|
|
12
|
-
};
|
|
13
|
-
const option = new ButtonOption(config);
|
|
14
|
-
|
|
15
|
-
const component = option.buildComponent(grid);
|
|
16
|
-
|
|
17
|
-
expect(component).toEqual(expect.objectContaining({
|
|
18
|
-
label: config.label,
|
|
19
|
-
name: 'Grid_export_pdf_portrait',
|
|
20
|
-
component: 'ZdButton',
|
|
21
|
-
iconName: undefined,
|
|
22
|
-
flat: true,
|
|
23
|
-
}));
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('the generated button component should call grid.getReport on click', () => {
|
|
27
|
-
const grid = new TekGrid({ name: 'Grid', component: 'TekGrid' });
|
|
28
|
-
const spy = jest.fn();
|
|
29
|
-
grid.getReport = spy;
|
|
30
|
-
const config = {
|
|
31
|
-
type: 'pdf',
|
|
32
|
-
label: 'Exportar PDF',
|
|
33
|
-
};
|
|
34
|
-
const option = new ButtonOption(config);
|
|
35
|
-
|
|
36
|
-
const component = option.buildComponent(grid);
|
|
37
|
-
|
|
38
|
-
const instance = new Button(component);
|
|
39
|
-
instance.click();
|
|
40
|
-
|
|
41
|
-
expect(spy).toHaveBeenCalledTimes(1);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
});
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { Button, type IText, Text } from '@zeedhi/common';
|
|
2
|
-
import { type ITekGridExportConfig, TekGrid } from '../../../../../src/components';
|
|
3
|
-
import { MultiOption } from '../../../../../src/utils';
|
|
4
|
-
|
|
5
|
-
describe('MultiOption', () => {
|
|
6
|
-
describe('buildComponent()', () => {
|
|
7
|
-
it('when called, should build a row with multiple buttons', () => {
|
|
8
|
-
const grid = new TekGrid({ name: 'Grid', component: 'TekGrid' });
|
|
9
|
-
const config: ITekGridExportConfig = {
|
|
10
|
-
type: 'pdf',
|
|
11
|
-
label: 'Exportar PDF',
|
|
12
|
-
multiOption: [
|
|
13
|
-
{ label: 'portrait', iconName: 'icon-portrait' },
|
|
14
|
-
{ label: 'landscape', iconName: 'icon-landscape' },
|
|
15
|
-
],
|
|
16
|
-
};
|
|
17
|
-
const option = new MultiOption(config);
|
|
18
|
-
|
|
19
|
-
const component = option.buildComponent(grid);
|
|
20
|
-
|
|
21
|
-
expect(component).toEqual({
|
|
22
|
-
name: 'Grid_export_pdf_row',
|
|
23
|
-
component: 'ZdRow',
|
|
24
|
-
cssClass: 'zd-display-flex zd-ma-0 zd-py-0 zd-gap-x-1 tek-grid-export-multioption-row',
|
|
25
|
-
children: [
|
|
26
|
-
expect.objectContaining({
|
|
27
|
-
name: 'Grid_export_pdf_text',
|
|
28
|
-
component: 'ZdText',
|
|
29
|
-
text: 'Exportar PDF',
|
|
30
|
-
cssClass: 'zd-display-flex zd-align-center zd-flex-grow-1 tek-grid-export-multioption-text',
|
|
31
|
-
}),
|
|
32
|
-
{
|
|
33
|
-
name: 'Grid_export_pdf_tooltip_portrait',
|
|
34
|
-
component: 'ZdTooltip',
|
|
35
|
-
bottom: true,
|
|
36
|
-
label: 'portrait',
|
|
37
|
-
children: [
|
|
38
|
-
expect.objectContaining({
|
|
39
|
-
name: 'Grid_export_pdf_button_portrait',
|
|
40
|
-
component: 'ZdButton',
|
|
41
|
-
icon: true,
|
|
42
|
-
iconName: 'icon-portrait',
|
|
43
|
-
}),
|
|
44
|
-
],
|
|
45
|
-
},
|
|
46
|
-
expect.objectContaining({
|
|
47
|
-
name: 'Grid_export_pdf_divider_portrait',
|
|
48
|
-
component: 'ZdDivider',
|
|
49
|
-
cssClass: 'zd-my-1',
|
|
50
|
-
vertical: true,
|
|
51
|
-
}),
|
|
52
|
-
{
|
|
53
|
-
name: 'Grid_export_pdf_tooltip_landscape',
|
|
54
|
-
component: 'ZdTooltip',
|
|
55
|
-
bottom: true,
|
|
56
|
-
label: 'landscape',
|
|
57
|
-
children: [
|
|
58
|
-
expect.objectContaining({
|
|
59
|
-
name: 'Grid_export_pdf_button_landscape',
|
|
60
|
-
component: 'ZdButton',
|
|
61
|
-
icon: true,
|
|
62
|
-
iconName: 'icon-landscape',
|
|
63
|
-
}),
|
|
64
|
-
],
|
|
65
|
-
},
|
|
66
|
-
],
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('the generated text component should call stopPropagation on click', () => {
|
|
71
|
-
const grid = new TekGrid({ name: 'Grid', component: 'TekGrid' });
|
|
72
|
-
const config: ITekGridExportConfig = {
|
|
73
|
-
type: 'pdf',
|
|
74
|
-
label: 'Exportar PDF',
|
|
75
|
-
multiOption: [
|
|
76
|
-
{ label: 'portrait', iconName: 'icon-portrait' },
|
|
77
|
-
{ label: 'landscape', iconName: 'icon-landscape' },
|
|
78
|
-
],
|
|
79
|
-
};
|
|
80
|
-
const option = new MultiOption(config);
|
|
81
|
-
|
|
82
|
-
const component = option.buildComponent(grid);
|
|
83
|
-
|
|
84
|
-
const instance = new Text(component.children![0] as IText);
|
|
85
|
-
const spy = jest.fn();
|
|
86
|
-
const event = { stopPropagation: spy } as unknown as Event;
|
|
87
|
-
instance.click(event);
|
|
88
|
-
|
|
89
|
-
expect(spy).toHaveBeenCalled();
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('the generated text component should not throw if event is undefined', () => {
|
|
93
|
-
const grid = new TekGrid({ name: 'Grid', component: 'TekGrid' });
|
|
94
|
-
const config: ITekGridExportConfig = {
|
|
95
|
-
type: 'pdf',
|
|
96
|
-
label: 'Exportar PDF',
|
|
97
|
-
multiOption: [
|
|
98
|
-
{ label: 'portrait', iconName: 'icon-portrait' },
|
|
99
|
-
{ label: 'landscape', iconName: 'icon-landscape' },
|
|
100
|
-
],
|
|
101
|
-
};
|
|
102
|
-
const option = new MultiOption(config);
|
|
103
|
-
|
|
104
|
-
const component = option.buildComponent(grid);
|
|
105
|
-
|
|
106
|
-
const instance = new Text(component.children![0] as IText);
|
|
107
|
-
|
|
108
|
-
expect(() => instance.callEvent('click', { event: undefined })).not.toThrow();
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it('the generated button components should call grid.getReport on click', () => {
|
|
112
|
-
const grid = new TekGrid({ name: 'Grid', component: 'TekGrid' });
|
|
113
|
-
const spy = jest.fn();
|
|
114
|
-
grid.getReport = spy;
|
|
115
|
-
const config: ITekGridExportConfig = {
|
|
116
|
-
type: 'pdf',
|
|
117
|
-
multiOption: [
|
|
118
|
-
{ label: 'portrait', iconName: 'icon-portrait' },
|
|
119
|
-
{ label: 'landscape', iconName: 'icon-landscape' },
|
|
120
|
-
],
|
|
121
|
-
};
|
|
122
|
-
const option = new MultiOption(config);
|
|
123
|
-
|
|
124
|
-
const component = option.buildComponent(grid);
|
|
125
|
-
|
|
126
|
-
const instance = new Button(component.children![1].children![0]);
|
|
127
|
-
instance.click();
|
|
128
|
-
|
|
129
|
-
const instance2 = new Button(component.children![3].children![0]);
|
|
130
|
-
instance2.click();
|
|
131
|
-
|
|
132
|
-
expect(spy).toHaveBeenCalledTimes(2);
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
});
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TekGrid,
|
|
3
|
-
} from '../../../../src';
|
|
4
|
-
import { GridController } from '../../../../src/utils/grid-base/grid-controller';
|
|
5
|
-
|
|
6
|
-
describe('GridController', () => {
|
|
7
|
-
describe('constructor()', () => {
|
|
8
|
-
it('should create controller and get info from grid', () => {
|
|
9
|
-
const grid = new TekGrid({
|
|
10
|
-
name: 'Grid',
|
|
11
|
-
component: 'TekGrid',
|
|
12
|
-
title: 'title',
|
|
13
|
-
addButton: false,
|
|
14
|
-
deleteButton: 'currentRow',
|
|
15
|
-
filterButton: true,
|
|
16
|
-
columnsButton: true,
|
|
17
|
-
editing: true,
|
|
18
|
-
showEditButtons: false,
|
|
19
|
-
modalFilterProps: {
|
|
20
|
-
name: 'name',
|
|
21
|
-
height: 'auto',
|
|
22
|
-
persistent: true,
|
|
23
|
-
},
|
|
24
|
-
showExport: true,
|
|
25
|
-
showLayoutOptionsButton: true,
|
|
26
|
-
showReloadButton: true,
|
|
27
|
-
actions: [{ name: 'button', component: 'ZdButton' }],
|
|
28
|
-
});
|
|
29
|
-
grid.editing = true;
|
|
30
|
-
const instance = new GridController(grid);
|
|
31
|
-
expect(instance.gridTitle).toBe('title');
|
|
32
|
-
expect(instance.showAddButton).toBeFalsy();
|
|
33
|
-
expect(instance.showDeleteButton).toBeTruthy();
|
|
34
|
-
expect(instance.showFilterButton).toBeTruthy();
|
|
35
|
-
expect(instance.showActionsButton).toBeTruthy();
|
|
36
|
-
expect(instance.showExportButton).toBeTruthy();
|
|
37
|
-
expect(instance.showActionAndExportButton).toBeTruthy();
|
|
38
|
-
expect(instance.showSearchInput).toBeTruthy();
|
|
39
|
-
expect(instance.showToolbar).toBeTruthy();
|
|
40
|
-
expect(instance.toolbarStyle).toBe('');
|
|
41
|
-
expect(instance.tooltipName).toBe('TEKGRID_HIDE');
|
|
42
|
-
expect(instance.showDivider2).toBeTruthy();
|
|
43
|
-
expect(instance.showDivider3).toBeTruthy();
|
|
44
|
-
expect(instance.showColumnsButton).toBeTruthy();
|
|
45
|
-
expect(instance.columnsButtonIgnore).toEqual([]);
|
|
46
|
-
expect(instance.showLayoutOptionsButton).toBeTruthy();
|
|
47
|
-
expect(instance.showReloadButton).toBeTruthy();
|
|
48
|
-
expect(instance.showDivider1).toBeTruthy();
|
|
49
|
-
expect(instance.isEditing).toBeTruthy();
|
|
50
|
-
expect(instance.isNotEditing).toBeFalsy();
|
|
51
|
-
expect(instance.showEditButtons).toBeFalsy();
|
|
52
|
-
expect(instance.disableDeleteButton).toBeTruthy();
|
|
53
|
-
expect(instance.showModalFilterProps).toEqual(
|
|
54
|
-
expect.objectContaining({
|
|
55
|
-
height: 'auto',
|
|
56
|
-
persistent: true,
|
|
57
|
-
}),
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
grid.datasource.currentRow = { id: '1' };
|
|
61
|
-
expect(instance.disableDeleteButton).toBeFalsy();
|
|
62
|
-
grid.showExport = false;
|
|
63
|
-
grid.showLayoutOptions = false;
|
|
64
|
-
grid.showReload = false;
|
|
65
|
-
grid.columnsButton = false;
|
|
66
|
-
grid.actions = [];
|
|
67
|
-
grid.deleteButton = 'selection';
|
|
68
|
-
grid.selectedRows = [{ id: '1' }];
|
|
69
|
-
expect(instance.disableDeleteButton).toBeFalsy();
|
|
70
|
-
expect(instance.showExportButton).toBeFalsy();
|
|
71
|
-
expect(instance.showActionAndExportButton).toBeFalsy();
|
|
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();
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('should verify if showDivider3 is visibility', () => {
|
|
81
|
-
const grid = new TekGrid({
|
|
82
|
-
name: 'Grid',
|
|
83
|
-
component: 'TekGrid',
|
|
84
|
-
addButton: false,
|
|
85
|
-
deleteButton: 'none',
|
|
86
|
-
filterButton: false,
|
|
87
|
-
columnsButton: false,
|
|
88
|
-
showReload: false,
|
|
89
|
-
showLayoutOptions: false,
|
|
90
|
-
showReloadButton: true,
|
|
91
|
-
showSearch: false,
|
|
92
|
-
showExport: false,
|
|
93
|
-
actions: [],
|
|
94
|
-
});
|
|
95
|
-
const instance = new GridController(grid);
|
|
96
|
-
|
|
97
|
-
expect(instance.showDivider3).toBeFalsy();
|
|
98
|
-
expect(instance.showActionsButton).toBeFalsy();
|
|
99
|
-
expect(instance.showExportButton).toBeFalsy();
|
|
100
|
-
expect(instance.showSearchInput).toBeFalsy();
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it('should verify if showActionAndExportButton is visibility', () => {
|
|
104
|
-
const grid = new TekGrid({
|
|
105
|
-
name: 'Grid',
|
|
106
|
-
component: 'TekGrid',
|
|
107
|
-
addButton: false,
|
|
108
|
-
deleteButton: 'none',
|
|
109
|
-
filterButton: false,
|
|
110
|
-
columnsButton: true,
|
|
111
|
-
showReload: false,
|
|
112
|
-
showLayoutOptions: true,
|
|
113
|
-
showReloadButton: true,
|
|
114
|
-
showSearch: false,
|
|
115
|
-
showExport: false,
|
|
116
|
-
actions: [],
|
|
117
|
-
});
|
|
118
|
-
const instance = new GridController(grid);
|
|
119
|
-
|
|
120
|
-
expect(instance.showActionAndExportButton).toBeFalsy();
|
|
121
|
-
expect(instance.showActionsButton).toBeFalsy();
|
|
122
|
-
expect(instance.showSearchInput).toBeFalsy();
|
|
123
|
-
expect(instance.showExportButton).toBeFalsy();
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
it('should verify if showDivider2 is visibility', () => {
|
|
127
|
-
const grid = new TekGrid({
|
|
128
|
-
name: 'Grid',
|
|
129
|
-
component: 'TekGrid',
|
|
130
|
-
addButton: false,
|
|
131
|
-
deleteButton: 'none',
|
|
132
|
-
filterButton: false,
|
|
133
|
-
columnsButton: false,
|
|
134
|
-
showReload: true,
|
|
135
|
-
showLayoutOptions: false,
|
|
136
|
-
showSearch: false,
|
|
137
|
-
showExport: false,
|
|
138
|
-
actions: [],
|
|
139
|
-
});
|
|
140
|
-
const instance = new GridController(grid);
|
|
141
|
-
|
|
142
|
-
expect(instance.showDivider2).toBeFalsy();
|
|
143
|
-
expect(instance.showActionsButton).toBeFalsy();
|
|
144
|
-
expect(instance.showSearchInput).toBeFalsy();
|
|
145
|
-
expect(instance.showColumnsButton).toBeFalsy();
|
|
146
|
-
expect(instance.showExportButton).toBeFalsy();
|
|
147
|
-
expect(instance.showReloadButton).toBeTruthy();
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
it('should verify if showDivider1 is visibility', () => {
|
|
151
|
-
const grid = new TekGrid({
|
|
152
|
-
name: 'Grid',
|
|
153
|
-
component: 'TekGrid',
|
|
154
|
-
addButton: true,
|
|
155
|
-
deleteButton: 'selection',
|
|
156
|
-
filterButton: false,
|
|
157
|
-
columnsButton: false,
|
|
158
|
-
showReload: false,
|
|
159
|
-
showLayoutOptions: false,
|
|
160
|
-
showSearch: false,
|
|
161
|
-
showExport: false,
|
|
162
|
-
actions: [],
|
|
163
|
-
});
|
|
164
|
-
const instance = new GridController(grid);
|
|
165
|
-
|
|
166
|
-
expect(instance.showDivider1).toBeFalsy();
|
|
167
|
-
expect(instance.showActionsButton).toBeFalsy();
|
|
168
|
-
expect(instance.showSearchInput).toBeFalsy();
|
|
169
|
-
expect(instance.showColumnsButton).toBeFalsy();
|
|
170
|
-
expect(instance.showExportButton).toBeFalsy();
|
|
171
|
-
expect(instance.showReloadButton).toBeFalsy();
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
});
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { ReportFilter } from '../../../../src/utils';
|
|
2
|
-
|
|
3
|
-
describe('ReportFilter', () => {
|
|
4
|
-
describe('constructor()', () => {
|
|
5
|
-
it('should create a ReportFilter with defined values', () => {
|
|
6
|
-
const filter = {
|
|
7
|
-
name: [
|
|
8
|
-
{
|
|
9
|
-
value: 'Luiz',
|
|
10
|
-
relation: 'AND',
|
|
11
|
-
operation: 'CONTAINS',
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const instance = new ReportFilter(filter);
|
|
17
|
-
|
|
18
|
-
expect(instance.filter).toEqual(filter);
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
describe('build', () => {
|
|
23
|
-
it('should build the filter in ZhReports format', () => {
|
|
24
|
-
const filter = {
|
|
25
|
-
name: [
|
|
26
|
-
{
|
|
27
|
-
value: 'Luiz',
|
|
28
|
-
relation: 'AND',
|
|
29
|
-
operation: 'CONTAINS',
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
salary: [
|
|
33
|
-
{
|
|
34
|
-
value: '100',
|
|
35
|
-
relation: 'AND',
|
|
36
|
-
operation: 'GREATER_THAN',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
value: '200',
|
|
40
|
-
relation: 'AND',
|
|
41
|
-
operation: 'LESS_THAN',
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
value: '500',
|
|
45
|
-
relation: 'OR',
|
|
46
|
-
operation: 'EQUALS',
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
};
|
|
50
|
-
const instance = new ReportFilter(filter);
|
|
51
|
-
|
|
52
|
-
const newFilter = instance.build();
|
|
53
|
-
|
|
54
|
-
expect(newFilter).toEqual([
|
|
55
|
-
{
|
|
56
|
-
label: 'name',
|
|
57
|
-
value: 'contains Luiz',
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
label: 'salary',
|
|
61
|
-
value: 'is greater than 100 and is less than 200 or is equal to 500',
|
|
62
|
-
},
|
|
63
|
-
]);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
});
|
package/tsconfig.build.json
DELETED