@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.
Files changed (134) hide show
  1. package/dist/teknisa-components-common.es.js +3536 -0
  2. package/dist/types/components/index.d.ts +2 -0
  3. package/dist/types/components/tek-breadcrumb-header/breadcrumb-header.d.ts +2 -2
  4. package/dist/types/components/tek-breadcrumb-header/interfaces.d.ts +1 -1
  5. package/dist/types/components/tek-datasource/tek-memory-datasource.d.ts +1 -21
  6. package/dist/types/components/tek-datasource/tek-rest-datasource.d.ts +6 -30
  7. package/dist/types/components/tek-grid/filter-helper.d.ts +2 -2
  8. package/dist/types/components/tek-grid/grid-filter-button.d.ts +1 -0
  9. package/dist/types/components/tek-grid/grouped-data-manager.d.ts +8 -1
  10. package/dist/types/components/tek-grid/grouped-data-navigator.d.ts +12 -0
  11. package/dist/types/components/tek-grid/index.d.ts +1 -1
  12. package/dist/types/components/tek-grid/interfaces.d.ts +8 -1
  13. package/dist/types/components/tek-grid/tek-grid-controller.d.ts +19 -17
  14. package/dist/types/components/tek-grid/tek-grid-data-editor.d.ts +11 -0
  15. package/dist/types/components/tek-grid/tek-grid-toolbar-provider/export-options/multi-option.d.ts +1 -1
  16. package/dist/types/components/tek-grid/tek-grid-toolbar-provider/tek-grid-toolbar-provider.d.ts +8 -1
  17. package/dist/types/components/tek-grid/tek-grid.d.ts +24 -6
  18. package/dist/types/components/tek-loading/interfaces.d.ts +6 -0
  19. package/dist/types/components/tek-loading/loading.d.ts +16 -0
  20. package/dist/types/components/tek-user-info/TekUserInfoController.d.ts +4 -4
  21. package/dist/types/utils/extract-properties/extract-properties.d.ts +1 -0
  22. package/dist/types/utils/index.d.ts +2 -0
  23. package/dist/types/utils/report-filter/report-filter.d.ts +12 -0
  24. package/package.json +32 -12
  25. package/coverage/clover.xml +0 -6
  26. package/coverage/coverage-final.json +0 -1
  27. package/coverage/lcov-report/base.css +0 -224
  28. package/coverage/lcov-report/block-navigation.js +0 -87
  29. package/coverage/lcov-report/favicon.png +0 -0
  30. package/coverage/lcov-report/index.html +0 -101
  31. package/coverage/lcov-report/prettify.css +0 -1
  32. package/coverage/lcov-report/prettify.js +0 -2
  33. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  34. package/coverage/lcov-report/sorter.js +0 -210
  35. package/coverage/lcov.info +0 -0
  36. package/dist/teknisa-components-common.js +0 -3802
  37. package/dist/teknisa-components-common.min.js +0 -3802
  38. package/dist/types/components/tek-grid/grouped-view-navigator.d.ts +0 -14
  39. package/dist/types/error/delete-rows-error.d.ts +0 -6
  40. package/environments.json +0 -14
  41. package/jest.config.js +0 -1
  42. package/src/components/index.ts +0 -101
  43. package/src/components/tek-breadcrumb-header/breadcrumb-header.ts +0 -29
  44. package/src/components/tek-breadcrumb-header/interfaces.ts +0 -7
  45. package/src/components/tek-datasource/index.ts +0 -3
  46. package/src/components/tek-datasource/interfaces.ts +0 -36
  47. package/src/components/tek-datasource/tek-memory-datasource.ts +0 -314
  48. package/src/components/tek-datasource/tek-rest-datasource.ts +0 -224
  49. package/src/components/tek-grid/columns-searcher.ts +0 -22
  50. package/src/components/tek-grid/dynamic-filter-datasource-factory.ts +0 -20
  51. package/src/components/tek-grid/filter-helper.ts +0 -20
  52. package/src/components/tek-grid/grid-filter-button.ts +0 -419
  53. package/src/components/tek-grid/grouped-data-manager.ts +0 -448
  54. package/src/components/tek-grid/grouped-data-selector.ts +0 -40
  55. package/src/components/tek-grid/grouped-view-navigator.ts +0 -84
  56. package/src/components/tek-grid/index.ts +0 -18
  57. package/src/components/tek-grid/interfaces.ts +0 -329
  58. package/src/components/tek-grid/keymap-grouped.ts +0 -20
  59. package/src/components/tek-grid/layout-options.ts +0 -248
  60. package/src/components/tek-grid/tek-grid-column.ts +0 -193
  61. package/src/components/tek-grid/tek-grid-columns-button/tek-grid-columns-button-controller.ts +0 -28
  62. package/src/components/tek-grid/tek-grid-columns-button/tek-grid-columns-button.ts +0 -38
  63. package/src/components/tek-grid/tek-grid-controller.ts +0 -140
  64. package/src/components/tek-grid/tek-grid-events.ts +0 -105
  65. package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/button-option.ts +0 -26
  66. package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/index.ts +0 -3
  67. package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/interfaces.ts +0 -6
  68. package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/multi-option.ts +0 -85
  69. package/src/components/tek-grid/tek-grid-toolbar-provider/index.ts +0 -2
  70. package/src/components/tek-grid/tek-grid-toolbar-provider/tek-grid-toolbar-provider.ts +0 -365
  71. package/src/components/tek-grid/tek-grid.ts +0 -1118
  72. package/src/components/tek-user-info/TekUserInfoController.ts +0 -87
  73. package/src/components/tek-user-info/interfaces.ts +0 -21
  74. package/src/components/tek-user-info/tek-user-info-list.ts +0 -64
  75. package/src/components/tek-user-info/tek-user-info.ts +0 -337
  76. package/src/error/tek-grid-delete-rows-error.ts +0 -15
  77. package/src/error/teknisa-common-error.ts +0 -8
  78. package/src/utils/config/config.ts +0 -8
  79. package/src/utils/index.ts +0 -3
  80. package/src/utils/is-filled-object/is-filled-object.ts +0 -5
  81. package/src/utils/is-nil.ts +0 -3
  82. package/tests/__helpers__/component-event-helper.ts +0 -5
  83. package/tests/__helpers__/flush-promises-helper.ts +0 -3
  84. package/tests/__helpers__/get-child-helper.ts +0 -27
  85. package/tests/__helpers__/index.ts +0 -3
  86. package/tests/__helpers__/mock-created-helper.ts +0 -12
  87. package/tests/__mocks__/@zeedhi/core/i18n.js +0 -75
  88. package/tests/__mocks__/@zeedhi/core.js +0 -5
  89. package/tests/unit/components/crud/crud-add-button.spec.ts +0 -56
  90. package/tests/unit/components/crud/crud-button.spec.ts +0 -94
  91. package/tests/unit/components/crud/crud-cancel-button.spec.ts +0 -91
  92. package/tests/unit/components/crud/crud-delete-button.spec.ts +0 -122
  93. package/tests/unit/components/crud/crud-form.spec.ts +0 -165
  94. package/tests/unit/components/crud/crud-save-button.spec.ts +0 -118
  95. package/tests/unit/components/tek-breadcrumb-header/tek-breadcrumb-header.spec.ts +0 -42
  96. package/tests/unit/components/tek-card-title/CardTitle.spec.ts +0 -34
  97. package/tests/unit/components/tek-datasource/memory-datasource.spec.ts +0 -460
  98. package/tests/unit/components/tek-datasource/rest-datasource.spec.ts +0 -362
  99. package/tests/unit/components/tek-drag-grid/tek-drag-grid.spec.ts +0 -112
  100. package/tests/unit/components/tek-grid/button-option.spec.ts +0 -49
  101. package/tests/unit/components/tek-grid/columns-searcher.spec.ts +0 -112
  102. package/tests/unit/components/tek-grid/dynamic-filter-datasource-factory.spec.ts +0 -90
  103. package/tests/unit/components/tek-grid/filter-helper.spec.ts +0 -52
  104. package/tests/unit/components/tek-grid/grid-filter-button.spec.ts +0 -842
  105. package/tests/unit/components/tek-grid/grouped-data-manager.spec.ts +0 -593
  106. package/tests/unit/components/tek-grid/grouped-data-selector.spec.ts +0 -136
  107. package/tests/unit/components/tek-grid/grouped-view-navigator.spec.ts +0 -244
  108. package/tests/unit/components/tek-grid/keymap-grouped.spec.ts +0 -20
  109. package/tests/unit/components/tek-grid/layout-options.spec.ts +0 -1020
  110. package/tests/unit/components/tek-grid/multi-option.spec.ts +0 -139
  111. package/tests/unit/components/tek-grid/tek-grid-column.spec.ts +0 -312
  112. package/tests/unit/components/tek-grid/tek-grid-columns-button.spec.ts +0 -228
  113. package/tests/unit/components/tek-grid/tek-grid-controller.spec.ts +0 -253
  114. package/tests/unit/components/tek-grid/tek-grid-events.spec.ts +0 -186
  115. package/tests/unit/components/tek-grid/tek-grid-toolbar-provider.spec.ts +0 -34
  116. package/tests/unit/components/tek-grid/tek-grid.spec.ts +0 -895
  117. package/tests/unit/components/tek-grid/tek-memory-datasource.spec.ts +0 -482
  118. package/tests/unit/components/tek-grid/tek-rest-datasource.spec.ts +0 -422
  119. package/tests/unit/components/tek-image/Image.spec.ts +0 -67
  120. package/tests/unit/components/tek-iterable-carousel/iterable-carousel.spec.ts +0 -37
  121. package/tests/unit/components/tek-iterable-component-render/iterable-component-render.spec.ts +0 -200
  122. package/tests/unit/components/tek-loading/Loading.spec.ts +0 -30
  123. package/tests/unit/components/tek-notifications/notifications.spec.ts +0 -201
  124. package/tests/unit/components/tek-product-card/product-card.spec.ts +0 -61
  125. package/tests/unit/components/tek-user-info/TekUserInfoContoller.spec.ts +0 -220
  126. package/tests/unit/components/tek-user-info/tek-user-info-list.spec.ts +0 -86
  127. package/tests/unit/components/tek-user-info/tek-user-info.spec.ts +0 -430
  128. package/tests/unit/components/tree-grid/tree-grid.spec.ts +0 -776
  129. package/tests/unit/utils/grid-base/export-options/button-option.spec.ts +0 -44
  130. package/tests/unit/utils/grid-base/export-options/multi-option.spec.ts +0 -135
  131. package/tests/unit/utils/grid-base/grid-controller.spec.ts +0 -174
  132. package/tests/unit/utils/report-filter/report-filter.spec.ts +0 -66
  133. package/tsconfig.build.json +0 -7
  134. 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
- });
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.build.json",
3
- "compilerOptions": {
4
- "outDir": "./dist"
5
- },
6
- "include": ["src/**/*"]
7
- }
@@ -1,9 +0,0 @@
1
- {
2
- // extend your base config so you don't have to redefine your compilerOptions
3
- "extends": "./tsconfig.json",
4
- "include": [
5
- "./src/**/*.ts",
6
- "./tests/**/*.ts",
7
- ],
8
- "exclude": ["node_modules"]
9
- }