@zeedhi/teknisa-components-common 1.115.0 → 3.0.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 (105) hide show
  1. package/.package.json +40 -0
  2. package/dist/teknisa-components-common.js +112 -0
  3. package/dist/teknisa-components-common.min.js +112 -0
  4. package/dist/types/components/index.d.ts +2 -0
  5. package/{types → dist/types}/components/tek-breadcrumb-header/breadcrumb-header.d.ts +12 -12
  6. package/{types → dist/types}/components/tek-breadcrumb-header/interfaces.d.ts +6 -6
  7. package/{types → dist/types}/error/delete-rows-error.d.ts +6 -6
  8. package/dist/types/index.d.ts +1 -0
  9. package/environments.json +14 -0
  10. package/package.json +26 -18
  11. package/src/components/index.ts +108 -0
  12. package/src/components/tek-breadcrumb-header/breadcrumb-header.ts +29 -0
  13. package/src/components/tek-breadcrumb-header/interfaces.ts +7 -0
  14. package/src/error/delete-rows-error.ts +11 -0
  15. package/src/index.ts +1 -0
  16. package/tests/__helpers__/component-event-helper.ts +1 -1
  17. package/tests/__helpers__/get-child-helper.ts +1 -1
  18. package/tests/__helpers__/mock-created-helper.ts +1 -1
  19. package/tests/unit/components/crud/crud-button.spec.ts +1 -1
  20. package/tests/unit/components/tek-datasource/memory-datasource.spec.ts +1 -11
  21. package/tests/unit/components/tek-datasource/rest-datasource.spec.ts +5 -7
  22. package/tests/unit/components/tek-drag-grid/tek-drag-grid.spec.ts +1 -1
  23. package/tests/unit/components/tek-grid/grid-column.spec.ts +4 -4
  24. package/tests/unit/components/tek-grid/grid-filter-button.spec.ts +17 -11
  25. package/tests/unit/components/tek-grid/grid.spec.ts +45 -721
  26. package/tests/unit/components/tek-grid/layout_options.spec.ts +5 -7
  27. package/tests/unit/components/tek-user-info/tek-user-info-list.spec.ts +1 -1
  28. package/tests/unit/components/tek-user-info/tek-user-info.spec.ts +10 -14
  29. package/tests/unit/components/tree-grid/tree-grid.spec.ts +4 -28
  30. package/tests/unit/utils/grid-base/export-options/multi-option.spec.ts +2 -2
  31. package/tests/unit/utils/grid-base/grid-controller.spec.ts +17 -152
  32. package/tsconfig.build.json +7 -0
  33. package/coverage/clover.xml +0 -2005
  34. package/coverage/coverage-final.json +0 -48
  35. package/coverage/lcov-report/base.css +0 -224
  36. package/coverage/lcov-report/block-navigation.js +0 -87
  37. package/coverage/lcov-report/favicon.png +0 -0
  38. package/coverage/lcov-report/index.html +0 -431
  39. package/coverage/lcov-report/prettify.css +0 -1
  40. package/coverage/lcov-report/prettify.js +0 -2
  41. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  42. package/coverage/lcov-report/sorter.js +0 -210
  43. package/coverage/lcov-report/tests/__helpers__/component-event-helper.ts.html +0 -100
  44. package/coverage/lcov-report/tests/__helpers__/flush-promises-helper.ts.html +0 -94
  45. package/coverage/lcov-report/tests/__helpers__/get-child-helper.ts.html +0 -166
  46. package/coverage/lcov-report/tests/__helpers__/index.html +0 -176
  47. package/coverage/lcov-report/tests/__helpers__/index.ts.html +0 -94
  48. package/coverage/lcov-report/tests/__helpers__/mock-created-helper.ts.html +0 -121
  49. package/coverage/lcov.info +0 -3883
  50. package/dist/tek-components-common.esm.js +0 -4830
  51. package/dist/tek-components-common.umd.js +0 -4867
  52. package/tests/unit/utils/grid-base/delete-rows-error.spec.ts +0 -24
  53. package/types/components/crud/crud-add-button.d.ts +0 -38
  54. package/types/components/crud/crud-button.d.ts +0 -27
  55. package/types/components/crud/crud-cancel-button.d.ts +0 -28
  56. package/types/components/crud/crud-delete-button.d.ts +0 -42
  57. package/types/components/crud/crud-form.d.ts +0 -46
  58. package/types/components/crud/crud-save-button.d.ts +0 -24
  59. package/types/components/crud/interfaces.d.ts +0 -15
  60. package/types/components/index.d.ts +0 -41
  61. package/types/components/tek-card-title/card-title.d.ts +0 -14
  62. package/types/components/tek-card-title/interfaces.d.ts +0 -9
  63. package/types/components/tek-datasource/interfaces.d.ts +0 -16
  64. package/types/components/tek-datasource/memory-datasource.d.ts +0 -100
  65. package/types/components/tek-datasource/rest-datasource.d.ts +0 -103
  66. package/types/components/tek-drag-grid/interfaces.d.ts +0 -7
  67. package/types/components/tek-drag-grid/tek-drag-grid.d.ts +0 -36
  68. package/types/components/tek-grid/filter-helper.d.ts +0 -7
  69. package/types/components/tek-grid/grid-column.d.ts +0 -45
  70. package/types/components/tek-grid/grid-columns-button-controller.d.ts +0 -8
  71. package/types/components/tek-grid/grid-columns-button.d.ts +0 -12
  72. package/types/components/tek-grid/grid-filter-button.d.ts +0 -31
  73. package/types/components/tek-grid/grid.d.ts +0 -267
  74. package/types/components/tek-grid/interfaces.d.ts +0 -203
  75. package/types/components/tek-grid/layout-options.d.ts +0 -31
  76. package/types/components/tek-image/image.d.ts +0 -55
  77. package/types/components/tek-image/interfaces.d.ts +0 -12
  78. package/types/components/tek-iterable-carousel/interfaces.d.ts +0 -5
  79. package/types/components/tek-iterable-carousel/iterable-carousel.d.ts +0 -13
  80. package/types/components/tek-iterable-component-render/interfaces.d.ts +0 -3
  81. package/types/components/tek-iterable-component-render/iterable-component-render.d.ts +0 -10
  82. package/types/components/tek-loading/interfaces.d.ts +0 -6
  83. package/types/components/tek-loading/loading.d.ts +0 -24
  84. package/types/components/tek-notifications/interfaces.d.ts +0 -22
  85. package/types/components/tek-notifications/notifications.d.ts +0 -35
  86. package/types/components/tek-product-card/interfaces.d.ts +0 -19
  87. package/types/components/tek-product-card/product-card.d.ts +0 -66
  88. package/types/components/tek-tree-grid/interfaces.d.ts +0 -30
  89. package/types/components/tek-tree-grid/tree-grid.d.ts +0 -102
  90. package/types/components/tek-user-info/TekUserInfoController.d.ts +0 -21
  91. package/types/components/tek-user-info/interfaces.d.ts +0 -27
  92. package/types/components/tek-user-info/tek-user-info-list.d.ts +0 -31
  93. package/types/components/tek-user-info/tek-user-info.d.ts +0 -37
  94. package/types/error/incomplete-groups-error.d.ts +0 -8
  95. package/types/index.d.ts +0 -2
  96. package/types/utils/config/config.d.ts +0 -7
  97. package/types/utils/extract-properties.d.ts +0 -7
  98. package/types/utils/grid-base/export-options/button-option.d.ts +0 -16
  99. package/types/utils/grid-base/export-options/index.d.ts +0 -3
  100. package/types/utils/grid-base/export-options/interfaces.d.ts +0 -5
  101. package/types/utils/grid-base/export-options/multi-option.d.ts +0 -12
  102. package/types/utils/grid-base/grid-base.d.ts +0 -59
  103. package/types/utils/grid-base/grid-controller.d.ts +0 -27
  104. package/types/utils/index.d.ts +0 -6
  105. package/types/utils/report-filter/report-filter.d.ts +0 -12
@@ -1,13 +1,13 @@
1
1
  import { Grid, Tag } from '@zeedhi/common';
2
2
  import { Config, Http } from '@zeedhi/core';
3
3
  import {
4
- ITekConfig,
5
- ITekGridLayoutInfo,
4
+ type ITekConfig,
5
+ type ITekGridLayoutInfo,
6
6
  TekGrid,
7
7
  TekGridLayoutOptions,
8
8
  } from '../../../../src';
9
9
 
10
- let savedLayouts: string = '';
10
+ let savedLayouts = '';
11
11
  const testLayouts: ITekGridLayoutInfo = {
12
12
  layouts: {
13
13
  'Name first': {
@@ -300,16 +300,14 @@ describe('LayoutOptions', () => {
300
300
  instance.parent = tag;
301
301
  tag.parent = grid;
302
302
 
303
- const localStorageMock = (function () { // eslint-disable-line func-names
304
- return {
303
+ const localStorageMock = ((() => ({
305
304
  getItem(): string {
306
305
  return JSON.stringify(testLayouts);
307
306
  },
308
307
  setItem(_name: string, value: string) {
309
308
  savedLayouts = value;
310
309
  },
311
- };
312
- }());
310
+ }))());
313
311
 
314
312
  Object.defineProperty(window, 'localStorage', {
315
313
  value: localStorageMock,
@@ -1,7 +1,7 @@
1
1
  import { ListItem } from '@zeedhi/common';
2
2
  import { Metadata } from '@zeedhi/core';
3
3
  import { UserInfo } from '@zeedhi/zd-user-info-common';
4
- import { TekUserInfo, TekUserInfoList, ITekUserInfo } from '../../../../src';
4
+ import { TekUserInfo, TekUserInfoList, type ITekUserInfo } from '../../../../src';
5
5
  import { mockCreated } from '../../../__helpers__/mock-created-helper';
6
6
 
7
7
  function instantiateAndCreate(props: ITekUserInfo) {
@@ -1,9 +1,9 @@
1
1
  import {
2
- Button, ListItem, Modal, ModalService,
2
+ Button, ListItem, type Modal, ModalService,
3
3
  } from '@zeedhi/common';
4
4
  import { Metadata, Http } from '@zeedhi/core';
5
5
  import { UserInfo } from '@zeedhi/zd-user-info-common';
6
- import { ITekUserInfo, TekUserInfo, TekUserInfoList } from '../../../../src';
6
+ import { type ITekUserInfo, TekUserInfo, TekUserInfoList } from '../../../../src';
7
7
  import { mockCreated } from '../../../__helpers__/mock-created-helper';
8
8
 
9
9
  function instantiateAndCreate(props: ITekUserInfo) {
@@ -84,14 +84,12 @@ describe('TekUserInfo', () => {
84
84
  children: [
85
85
  {
86
86
  component: 'ZdHeader',
87
- leftSlot: [
88
- {
89
- component: 'ZdTag',
90
- children: [{ component: 'ZdImage', src: 'path' }],
91
- },
92
- ],
93
87
  rightSlot: [{ component: 'ZdModalCloseButton' }],
94
88
  },
89
+ {
90
+ component: 'ZdTag',
91
+ children: [{ component: 'ZdImage', src: 'path' }],
92
+ },
95
93
  {
96
94
  component: 'ZdTabs',
97
95
  tabs: [
@@ -152,14 +150,12 @@ describe('TekUserInfo', () => {
152
150
  children: [
153
151
  {
154
152
  component: 'ZdHeader',
155
- leftSlot: [
156
- {
157
- component: 'ZdTag',
158
- children: [{ component: 'ZdImage', src: '' }],
159
- },
160
- ],
161
153
  rightSlot: [{ component: 'ZdModalCloseButton' }],
162
154
  },
155
+ {
156
+ component: 'ZdTag',
157
+ children: [{ component: 'ZdImage', src: '' }],
158
+ },
163
159
  {
164
160
  component: 'ZdTabs',
165
161
  tabs: [
@@ -1,12 +1,12 @@
1
1
  import {
2
- Button, Dropdown, Form, IButton, IForm, IModal, Modal, ModalService, Report, Search, Text, TextInput,
2
+ Button, Dropdown, Form, type IButton, type IForm, type IModal, Modal, ModalService, Report, Search, Text, TextInput,
3
3
  } from '@zeedhi/common';
4
4
  import {
5
- Http, IDictionary, KeyMap, Metadata,
5
+ Http, type IDictionary, KeyMap, Metadata,
6
6
  } from '@zeedhi/core';
7
7
  import {
8
- ITekGridFilterButton,
9
- ITekTreeGrid, TekGridColumn, TekGridFilterButton, TekRestDatasource, TekTreeGrid,
8
+ type ITekGridFilterButton,
9
+ type ITekTreeGrid, TekGridColumn, TekGridFilterButton, TekRestDatasource, TekTreeGrid,
10
10
  } from '../../../../src';
11
11
  import { getChild, setClick } from '../../../__helpers__';
12
12
 
@@ -63,18 +63,6 @@ describe('TekTreeGrid', () => {
63
63
  ],
64
64
  columnsButton: true,
65
65
  columnsButtonIgnore: ['id'],
66
- modalFilterProps: {
67
- name: 'name',
68
- height: 'auto',
69
- persistent: true,
70
- cssClass: '',
71
- cssStyle: '',
72
- dark: false,
73
- draggable: false,
74
- fullscreen: false,
75
- dragHandle: '',
76
- title: 'EXAMPLE',
77
- },
78
66
  });
79
67
  expect(instance.title).toBe('title');
80
68
  expect(instance.addButton).toBeTruthy();
@@ -88,18 +76,6 @@ describe('TekTreeGrid', () => {
88
76
  expect(instance.columns[0]).toBeInstanceOf(TekGridColumn);
89
77
  expect(instance.columnsButton).toBeTruthy();
90
78
  expect(instance.columnsButtonIgnore).toEqual(['id']);
91
- expect(instance.modalFilterProps).toEqual({
92
- name: 'name',
93
- height: 'auto',
94
- persistent: true,
95
- cssClass: '',
96
- cssStyle: '',
97
- dark: false,
98
- draggable: false,
99
- fullscreen: false,
100
- dragHandle: '',
101
- title: 'EXAMPLE',
102
- });
103
79
  });
104
80
 
105
81
  it('should create toolbar and footer', () => {
@@ -1,5 +1,5 @@
1
- import { Button, IText, Text } from '@zeedhi/common';
2
- import { ITekGridExportConfig, TekGrid } from '../../../../../src/components';
1
+ import { Button, type IText, Text } from '@zeedhi/common';
2
+ import { type ITekGridExportConfig, TekGrid } from '../../../../../src/components';
3
3
  import { MultiOption } from '../../../../../src/utils';
4
4
 
5
5
  describe('MultiOption', () => {
@@ -26,7 +26,7 @@ describe('GridController', () => {
26
26
  showReloadButton: true,
27
27
  actions: [{ name: 'button', component: 'ZdButton' }],
28
28
  });
29
- grid.editing = false;
29
+ grid.editing = true;
30
30
  const instance = new GridController(grid);
31
31
  expect(instance.gridTitle).toBe('title');
32
32
  expect(instance.showAddButton).toBeFalsy();
@@ -36,13 +36,18 @@ 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');
42
+ expect(instance.showDivider2).toBeTruthy();
43
+ expect(instance.showDivider3).toBeTruthy();
39
44
  expect(instance.showColumnsButton).toBeTruthy();
40
45
  expect(instance.columnsButtonIgnore).toEqual([]);
41
46
  expect(instance.showLayoutOptionsButton).toBeTruthy();
42
47
  expect(instance.showReloadButton).toBeTruthy();
43
- expect(instance.showDivider).toBeTruthy();
44
- expect(instance.isEditing).toBeFalsy();
45
- expect(instance.isNotEditing).toBeTruthy();
48
+ expect(instance.showDivider1).toBeTruthy();
49
+ expect(instance.isEditing).toBeTruthy();
50
+ expect(instance.isNotEditing).toBeFalsy();
46
51
  expect(instance.showEditButtons).toBeFalsy();
47
52
  expect(instance.disableDeleteButton).toBeTruthy();
48
53
  expect(instance.showModalFilterProps).toEqual(
@@ -65,6 +70,11 @@ describe('GridController', () => {
65
70
  expect(instance.showExportButton).toBeFalsy();
66
71
  expect(instance.showActionAndExportButton).toBeFalsy();
67
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();
68
78
  });
69
79
 
70
80
  it('should verify if showDivider3 is visibility', () => {
@@ -84,6 +94,7 @@ describe('GridController', () => {
84
94
  });
85
95
  const instance = new GridController(grid);
86
96
 
97
+ expect(instance.showDivider3).toBeFalsy();
87
98
  expect(instance.showActionsButton).toBeFalsy();
88
99
  expect(instance.showExportButton).toBeFalsy();
89
100
  expect(instance.showSearchInput).toBeFalsy();
@@ -128,6 +139,7 @@ describe('GridController', () => {
128
139
  });
129
140
  const instance = new GridController(grid);
130
141
 
142
+ expect(instance.showDivider2).toBeFalsy();
131
143
  expect(instance.showActionsButton).toBeFalsy();
132
144
  expect(instance.showSearchInput).toBeFalsy();
133
145
  expect(instance.showColumnsButton).toBeFalsy();
@@ -151,6 +163,7 @@ describe('GridController', () => {
151
163
  });
152
164
  const instance = new GridController(grid);
153
165
 
166
+ expect(instance.showDivider1).toBeFalsy();
154
167
  expect(instance.showActionsButton).toBeFalsy();
155
168
  expect(instance.showSearchInput).toBeFalsy();
156
169
  expect(instance.showColumnsButton).toBeFalsy();
@@ -158,152 +171,4 @@ describe('GridController', () => {
158
171
  expect(instance.showReloadButton).toBeFalsy();
159
172
  });
160
173
  });
161
- describe('showAddButton', () => {
162
- it('should return true when addButton is true, not editing, and toolbar is open', () => {
163
- const grid = new TekGrid({
164
- name: 'Grid', component: 'TekGrid', addButton: true, editing: false,
165
- });
166
- const instance = new GridController(grid);
167
- instance.openToolbar = true;
168
- expect(instance.showAddButton).toBe(true);
169
- });
170
-
171
- it('should return false when grid is in editing mode', () => {
172
- const grid = new TekGrid({
173
- name: 'Grid', component: 'TekGrid', addButton: true, editing: true,
174
- });
175
- const instance = new GridController(grid);
176
- expect(instance.showAddButton).toBe(true);
177
- });
178
-
179
- it('should return false when toolbar is closed', () => {
180
- const grid = new TekGrid({
181
- name: 'Grid', component: 'TekGrid', addButton: true, editing: false,
182
- });
183
- const instance = new GridController(grid);
184
- instance.openToolbar = false;
185
- expect(instance.showAddButton).toBe(true);
186
- });
187
- });
188
-
189
- describe('disableDeleteButton', () => {
190
- it('should be disabled if selectAllPages is true, allSelected is true, and all items are exceptions', () => {
191
- const grid = new TekGrid({
192
- name: 'Grid', component: 'TekGrid', deleteButton: 'selection', selectAllPages: true,
193
- });
194
- grid.datasource.total = 3;
195
- grid.selectionState = { allSelected: true, except: [{ id: 1 }, { id: 2 }, { id: 3 }] };
196
- const instance = new GridController(grid);
197
- expect(instance.disableDeleteButton).toBe(true);
198
- });
199
-
200
- it('should be disabled if selectAllPages is true, allSelected is false, and no items are exceptions', () => {
201
- const grid = new TekGrid({
202
- name: 'Grid', component: 'TekGrid', deleteButton: 'selection', selectAllPages: true,
203
- });
204
- grid.selectionState = { allSelected: false, except: [] };
205
- const instance = new GridController(grid);
206
- expect(instance.disableDeleteButton).toBe(true);
207
- });
208
-
209
- it('should be enabled if selectAllPages is true and there is a valid selection', () => {
210
- const grid = new TekGrid({
211
- name: 'Grid', component: 'TekGrid', deleteButton: 'selection', selectAllPages: true,
212
- });
213
- grid.datasource.total = 5;
214
- grid.selectionState = { allSelected: true, except: [{ id: 1 }] };
215
- const instance = new GridController(grid);
216
- expect(instance.disableDeleteButton).toBe(false);
217
- });
218
-
219
- it('should not be disabled when deleteButton is "none"', () => {
220
- const grid = new TekGrid({ name: 'Grid', component: 'TekGrid', deleteButton: 'none' }); //
221
- const instance = new GridController(grid);
222
- expect(instance.disableDeleteButton).toBe(false);
223
- });
224
- });
225
-
226
- describe('showEditButtons', () => {
227
- it('deve retornar true quando o grid está em modo de edição e a propriedade showEditButtons é true', () => {
228
- const grid = new TekGrid({
229
- name: 'Grid',
230
- component: 'TekGrid',
231
- });
232
- grid.editing = true;
233
- const instance = new GridController(grid);
234
- expect(instance.showEditButtons).toBe(true);
235
- });
236
-
237
- it('deve retornar false quando o grid não está em modo de edição', () => {
238
- const grid = new TekGrid({
239
- name: 'Grid',
240
- component: 'TekGrid',
241
- editing: false,
242
- showEditButtons: true,
243
- });
244
- const instance = new GridController(grid);
245
- expect(instance.showEditButtons).toBe(false);
246
- });
247
-
248
- it('deve retornar false quando a propriedade showEditButtons do grid é false', () => {
249
- const grid = new TekGrid({
250
- name: 'Grid',
251
- component: 'TekGrid',
252
- editing: true,
253
- showEditButtons: false,
254
- });
255
- const instance = new GridController(grid);
256
- expect(instance.showEditButtons).toBe(false);
257
- });
258
- });
259
-
260
- describe('showOptionsDivider', () => {
261
- it('should return true when showExport is true, not editing, and toolbar is open', () => {
262
- const grid = new TekGrid({
263
- name: 'Grid',
264
- component: 'TekGrid',
265
- columnsButton: false,
266
- showLayoutOptions: false,
267
- showExport: true,
268
- editing: false,
269
- });
270
- const instance = new GridController(grid);
271
- instance.openToolbar = true;
272
- expect(instance.showOptionsDivider).toBe(true);
273
- });
274
-
275
- it('should return false when the toolbar is closed', () => {
276
- const grid = new TekGrid({
277
- name: 'Grid',
278
- component: 'TekGrid',
279
- showExport: true,
280
- editing: false,
281
- });
282
- const instance = new GridController(grid);
283
- instance.openToolbar = false;
284
- expect(instance.showOptionsDivider).toBe(true);
285
- });
286
- });
287
-
288
- describe('showHideButton', () => {
289
- it('should return true when grid.showHideButton is true', () => {
290
- const grid = new TekGrid({
291
- name: 'Grid',
292
- component: 'TekGrid',
293
- showHideButton: true,
294
- });
295
- const instance = new GridController(grid);
296
- expect(instance.showHideButton).toBe(true);
297
- });
298
-
299
- it('should return false when grid.showHideButton is false', () => {
300
- const grid = new TekGrid({
301
- name: 'Grid',
302
- component: 'TekGrid',
303
- showHideButton: false,
304
- });
305
- const instance = new GridController(grid);
306
- expect(instance.showHideButton).toBe(false);
307
- });
308
- });
309
174
  });
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../../tsconfig.build.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist"
5
+ },
6
+ "include": ["src/**/*"]
7
+ }