@zeedhi/teknisa-components-common 1.130.0 → 1.131.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 (44) hide show
  1. package/.package.json +39 -0
  2. package/coverage/clover.xml +1204 -1142
  3. package/coverage/coverage-final.json +48 -47
  4. package/coverage/lcov-report/index.html +18 -18
  5. package/coverage/lcov-report/tests/__helpers__/component-event-helper.ts.html +3 -3
  6. package/coverage/lcov-report/tests/__helpers__/flush-promises-helper.ts.html +1 -1
  7. package/coverage/lcov-report/tests/__helpers__/get-child-helper.ts.html +11 -11
  8. package/coverage/lcov-report/tests/__helpers__/index.html +1 -1
  9. package/coverage/lcov-report/tests/__helpers__/index.ts.html +4 -4
  10. package/coverage/lcov-report/tests/__helpers__/mock-created-helper.ts.html +3 -3
  11. package/coverage/lcov.info +2082 -1961
  12. package/dist/tek-components-common.esm.js +278 -163
  13. package/dist/tek-components-common.umd.js +278 -162
  14. package/package.json +2 -2
  15. package/tests/unit/components/tek-grid/grid-columns-button.spec.ts +123 -2
  16. package/tests/unit/components/tek-grid/grid-export-button.spec.ts +403 -0
  17. package/tests/unit/components/tek-grid/grid-filter-button.spec.ts +147 -4
  18. package/tests/unit/components/tek-grid/grid.spec.ts +142 -9
  19. package/tests/unit/components/tek-grid/layout_options.spec.ts +166 -0
  20. package/types/components/index.d.ts +1 -0
  21. package/types/components/tek-ag-grid/default-icons.d.ts +53 -0
  22. package/types/components/tek-ag-grid/interfaces.d.ts +9 -0
  23. package/types/components/tek-ag-grid/tek-ag-grid.d.ts +35 -0
  24. package/types/components/tek-datasource/datasource.d.ts +94 -0
  25. package/types/components/tek-grid/default-icons.d.ts +53 -0
  26. package/types/components/tek-grid/filter-dynamic-values.d.ts +9 -0
  27. package/types/components/tek-grid/grid-columns-button.d.ts +2 -1
  28. package/types/components/tek-grid/grid-controller.d.ts +19 -0
  29. package/types/components/tek-grid/grid-export-button.d.ts +19 -0
  30. package/types/components/tek-grid/grid-filter-button.d.ts +1 -0
  31. package/types/components/tek-grid/grid.d.ts +4 -0
  32. package/types/components/tek-grid/grid_column.d.ts +14 -0
  33. package/types/components/tek-grid/grid_controller.d.ts +15 -0
  34. package/types/components/tek-grid/interfaces.d.ts +8 -0
  35. package/types/components/tek-grid/layout-options.d.ts +6 -0
  36. package/types/components/tek-grid/tek-grid.d.ts +35 -0
  37. package/types/components/tek-login/interfaces.d.ts +3 -0
  38. package/types/components/tek-login/login-children.d.ts +3 -0
  39. package/types/components/tek-login/login.d.ts +58 -0
  40. package/types/components/tek-login/login_children.d.ts +3 -0
  41. package/types/components/tek-tree-grid/tree-grid.d.ts +2 -0
  42. package/types/utils/grid-base/export-options/button-option.d.ts +3 -1
  43. package/types/utils/grid-base/export-options/multi-option.d.ts +3 -1
  44. package/types/utils/grid-base/grid-base.d.ts +1 -3
@@ -84,6 +84,27 @@ describe('TekGridFilterButton', () => {
84
84
 
85
85
  expect(filterButton.grid).toEqual(instance);
86
86
  });
87
+
88
+ it('should load grid by gridName after the filter button is created', () => {
89
+ const filterButton = new TekGridFilterButton({
90
+ name: 'external-filter-button',
91
+ component: 'TekGridFilterButton',
92
+ gridName: 'grid-created-after-filter-button',
93
+ });
94
+
95
+ expect(filterButton.grid).toBeUndefined();
96
+
97
+ const instance = new TekGrid({
98
+ name: 'grid-created-after-filter-button',
99
+ component: 'TekGrid',
100
+ });
101
+ instance.onCreated();
102
+
103
+ filterButton.loadGrid();
104
+
105
+ expect(filterButton.grid).toEqual(instance);
106
+ expect((instance as any).gridBase.filterButton).toBe(filterButton);
107
+ });
87
108
  });
88
109
 
89
110
  describe('filterClick()', () => {
@@ -117,6 +138,85 @@ describe('TekGridFilterButton', () => {
117
138
  spyMetadata.mockReset();
118
139
  });
119
140
 
141
+ it('should open the filter modal from an external button when grid filterButton is false', () => {
142
+ const instance = new TekGrid({
143
+ name: 'grid_external_filter_button',
144
+ component: 'TekGrid',
145
+ filterButton: false,
146
+ columns: [
147
+ { name: 'id' },
148
+ { name: 'name', filterable: true, filterProps: [{ name: 'name_edit', label: 'name' }] },
149
+ ],
150
+ });
151
+
152
+ let formElements: any = [];
153
+ const spy = jest.spyOn(ModalService, 'create').mockImplementation((modal: IModal) => {
154
+ const form = getChild<IForm>(modal.children || [], `${instance.name}-filter-form`);
155
+ formElements = form.children;
156
+
157
+ return new Modal(modal);
158
+ });
159
+ instance.onCreated();
160
+
161
+ const button = new TekGridFilterButton({
162
+ name: 'external-filter-button',
163
+ component: 'TekGridFilterButton',
164
+ gridName: instance.name,
165
+ });
166
+ setClick(button);
167
+
168
+ expect(button.grid).toEqual(instance);
169
+ expect((instance as any).gridBase.filterButton).toBe(button);
170
+ expect(formElements[0].name).toBe(`${instance.name}-filter-AND-CONTAINS-name-0`);
171
+
172
+ spy.mockReset();
173
+ });
174
+
175
+ it('should not open the filter modal when click cannot resolve a grid', () => {
176
+ const spy = jest.spyOn(ModalService, 'create');
177
+ const button = new TekGridFilterButton({
178
+ name: 'external-filter-button-without-grid',
179
+ component: 'TekGridFilterButton',
180
+ gridName: 'missing-grid',
181
+ });
182
+
183
+ setClick(button);
184
+
185
+ expect(button.grid).toBeUndefined();
186
+ expect(spy).not.toBeCalled();
187
+
188
+ spy.mockReset();
189
+ });
190
+
191
+ it('should close the owning filter modal from the header close button', () => {
192
+ const instance = new TekGrid({
193
+ name: 'grid_filter_close_button',
194
+ component: 'TekGrid',
195
+ });
196
+
197
+ let closeButton: IButton = { name: 'close', component: 'ZdButton' };
198
+ const spy = jest.spyOn(ModalService, 'create').mockImplementation((modal: IModal) => {
199
+ const header = getChild(modal.children || [], `${instance.name}-filter-header-container`);
200
+ closeButton = getChild(header.children || [], `${instance.name}-filter-close-button`);
201
+
202
+ return new Modal(modal);
203
+ });
204
+ instance.onCreated();
205
+
206
+ const buttonProps = getChild<ITekGridFilterButton>(instance.toolbarSlot, `${instance.name}_filterButton`);
207
+ const button = new TekGridFilterButton(buttonProps);
208
+ setClick(button);
209
+
210
+ const hideSpy = jest.spyOn((button as any).filterModal, 'hide');
211
+ const closeButtonObject = new Button(closeButton);
212
+ setClick(closeButtonObject);
213
+
214
+ expect(closeButton.component).toBe('ZdButton');
215
+ expect(hideSpy).toBeCalled();
216
+
217
+ spy.mockReset();
218
+ });
219
+
120
220
  it('should call events', () => {
121
221
  let filterClickCalled = false;
122
222
  const instance = new TekGrid({
@@ -207,6 +307,49 @@ describe('TekGridFilterButton', () => {
207
307
  spy.mockReset();
208
308
  });
209
309
 
310
+ it('should create filter form elements without dataValueOut from componentProps', () => {
311
+ const instance = new TekGrid({
312
+ name: 'grid_filterClick_dataValueOut',
313
+ component: 'TekGrid',
314
+ columns: [
315
+ {
316
+ name: 'name',
317
+ filterable: true,
318
+ componentProps: {
319
+ name: 'name_edit',
320
+ component: 'ZdSelect',
321
+ dataText: 'description',
322
+ dataValueOut: 'id',
323
+ },
324
+ filterProps: [{ name: 'name_filter', label: 'name' }],
325
+ },
326
+ {
327
+ name: 'description',
328
+ filterable: true,
329
+ filterProps: [{ name: 'description_filter', label: 'description' }],
330
+ },
331
+ ],
332
+ });
333
+
334
+ let formElements: any = [];
335
+ const spy = jest.spyOn(ModalService, 'create').mockImplementation((modal: IModal) => {
336
+ const form = getChild<IForm>(modal.children || [], `${instance.name}-filter-form`);
337
+ formElements = form.children;
338
+
339
+ return new Modal(modal);
340
+ });
341
+ instance.onCreated();
342
+ (instance.columns[1] as any).componentProps = undefined;
343
+ clickOnFilterButton(instance);
344
+
345
+ expect(formElements[0].component).toBe('ZdSelect');
346
+ expect(formElements[0].dataText).toBe('description');
347
+ expect(formElements[0].dataValueOut).toBeUndefined();
348
+ expect(formElements[1].name).toBe(`${instance.name}-filter-AND-CONTAINS-description-0`);
349
+
350
+ spy.mockReset();
351
+ });
352
+
210
353
  it('when creating a SelectMultiple filter, default should not add showCheckboxAll prop', () => {
211
354
  const instance = new TekGrid({
212
355
  name: 'grid_filterClick5',
@@ -318,7 +461,7 @@ describe('TekGridFilterButton', () => {
318
461
  formObject.value['grid_filterClick5-filter-AND-CONTAINS-id-0'] = ['example'];
319
462
  setClick(applyButtonObject);
320
463
 
321
- expect(instance.datasource.filter).toEqual({});
464
+ expect(instance.datasource.filter).toEqual({ id: ['example'] });
322
465
 
323
466
  selectObject.checkboxAll = true;
324
467
  setClick(applyButtonObject);
@@ -327,7 +470,7 @@ describe('TekGridFilterButton', () => {
327
470
 
328
471
  (Config as any).set({ selectAllCompatibilityMode: true });
329
472
  setClick(applyButtonObject);
330
- expect(instance.datasource.filter).toEqual({});
473
+ expect(instance.datasource.filter).toEqual({ id: 'T' });
331
474
 
332
475
  spy.mockReset();
333
476
  });
@@ -952,10 +1095,10 @@ describe('TekGridFilterButton', () => {
952
1095
  };
953
1096
  const applyButtonObject = new Button(applyButton);
954
1097
  setClick(applyButtonObject);
955
- expect(instance.datasource.filter).toEqual({});
1098
+ expect(instance.datasource.filter).toEqual({ id: '1;2;3', name: 'teste', salary: '1000' });
956
1099
  expect(beforeApplyFilterCalled).toBeTruthy();
957
1100
  expect(changeLayoutCalled).toBeTruthy();
958
- expect(instance.columnHasFilterData({ name: 'name' } as TekGridColumn)).toBe(undefined);
1101
+ expect(instance.columnHasFilterData({ name: 'name' } as TekGridColumn)).toBe(true);
959
1102
 
960
1103
  setClick(applyButtonObject, { defaultPrevented: true });
961
1104
  expect(spyDatasourceGet).toBeCalledTimes(1);
@@ -15,7 +15,7 @@ import {
15
15
  ITekGrid,
16
16
  ITekGridFilterButton,
17
17
  ITekGridGroupFooter,
18
- TekGrid, TekGridColumn, TekGridFilterButton, TekRestDatasource,
18
+ TekGrid, TekGridColumn, TekGridExportButton, TekGridFilterButton, TekRestDatasource,
19
19
  } from '../../../../src';
20
20
  import { ReportFilter } from '../../../../src/utils';
21
21
  import { setClick, getChild } from '../../../__helpers__';
@@ -232,12 +232,19 @@ describe('TekGrid', () => {
232
232
  ],
233
233
  });
234
234
 
235
- expect((instance as any).gridBase.exportConfigButtons[0].label).toBeUndefined();
236
- expect((instance as any).gridBase.exportConfigButtons[0].iconName).toBe('icon');
237
- expect((instance as any).gridBase.exportConfigButtons[0].name).toBe('grid_export_pdf_landscape');
238
- expect((instance as any).gridBase.exportConfigButtons[0].component).toBe('ZdButton');
239
- expect((instance as any).gridBase.exportConfigButtons[0].flat).toBeTruthy();
240
- expect((instance as any).gridBase.exportConfigButtons[0].events).toBeDefined();
235
+ const exportButton = new TekGridExportButton({
236
+ name: 'grid_export_dropdown',
237
+ component: 'TekGridExportButton',
238
+ grid: instance,
239
+ });
240
+ const exportConfigButton = exportButton.children![0];
241
+
242
+ expect(exportConfigButton.label).toBeUndefined();
243
+ expect(exportConfigButton.iconName).toBe('icon');
244
+ expect(exportConfigButton.name).toBe('grid_export_pdf_landscape');
245
+ expect(exportConfigButton.component).toBe('ZdButton');
246
+ expect(exportConfigButton.flat).toBeTruthy();
247
+ expect(exportConfigButton.events).toBeDefined();
241
248
  });
242
249
 
243
250
  it('should create new TekGrid with accessor datasource', () => {
@@ -1032,6 +1039,10 @@ describe('TekGrid', () => {
1032
1039
 
1033
1040
  await flushPromises();
1034
1041
 
1042
+ instance.navigateDatasource(false);
1043
+ expect(instance.datasource.currentRow).toEqual(instance.groupedData[0]);
1044
+ instance.datasource.currentRow = {};
1045
+
1035
1046
  dispatchEvent('arrowdown', {}); // arrow down
1036
1047
  expect(instance.datasource.currentRow).toEqual(instance.groupedData[0]);
1037
1048
 
@@ -1198,11 +1209,10 @@ describe('TekGrid', () => {
1198
1209
  spyMetadata.mockReset();
1199
1210
  });
1200
1211
 
1201
- it('when using cellSelection, should use viewNavigate', async () => {
1212
+ it('when grouped, should use viewNavigate', async () => {
1202
1213
  const instance = new TekGrid({
1203
1214
  name: 'grid_navigation_1',
1204
1215
  component: 'TekGrid',
1205
- cellSelection: true,
1206
1216
  columns: [
1207
1217
  {
1208
1218
  name: 'name',
@@ -2286,6 +2296,126 @@ describe('TekGrid', () => {
2286
2296
 
2287
2297
  expect(grid.columnHasFilterData(column)).toBe(true);
2288
2298
  });
2299
+
2300
+ it('should search only in columns listed in searchIn when searchIn is non-empty', async () => {
2301
+ const instance = new TekGrid({
2302
+ name: 'grid_search',
2303
+ component: 'TekGrid',
2304
+ columns: [
2305
+ { name: 'id' },
2306
+ {
2307
+ name: 'employee_id',
2308
+ componentProps: {
2309
+ name: 'ZdSelect',
2310
+ dataText: ['name'],
2311
+ datasource: {
2312
+ type: 'tek-rest',
2313
+ uniqueKey: 'id',
2314
+ route: '/zeedhi',
2315
+ lazyLoad: false,
2316
+ },
2317
+ },
2318
+ },
2319
+ {
2320
+ name: 'department_id',
2321
+ componentProps: {
2322
+ name: 'ZdSelect',
2323
+ dataText: ['name'],
2324
+ datasource: {
2325
+ type: 'tek-rest',
2326
+ uniqueKey: 'id',
2327
+ route: '/departments',
2328
+ lazyLoad: false,
2329
+ },
2330
+ },
2331
+ },
2332
+ ],
2333
+ datasource: {
2334
+ type: 'tek-rest',
2335
+ lazyLoad: true,
2336
+ route: '/grid',
2337
+ searchIn: ['employee_id'],
2338
+ } as any,
2339
+ });
2340
+
2341
+ await instance.setSearch('1');
2342
+
2343
+ expect(instance.datasource).toBeInstanceOf(TekRestDatasource);
2344
+ expect((instance.datasource as TekRestDatasource).searchJoin).toEqual({ employee_id: [1, 15] });
2345
+ expect(httpSpy).toHaveBeenCalledTimes(2);
2346
+ });
2347
+
2348
+ it('should search all lookup columns when searchIn is empty', async () => {
2349
+ const instance = new TekGrid({
2350
+ name: 'grid_search_empty_searchin',
2351
+ component: 'TekGrid',
2352
+ columns: [
2353
+ { name: 'id' },
2354
+ {
2355
+ name: 'employee_id',
2356
+ componentProps: {
2357
+ name: 'ZdSelect',
2358
+ dataText: ['name'],
2359
+ datasource: {
2360
+ type: 'tek-rest',
2361
+ uniqueKey: 'id',
2362
+ route: '/zeedhi',
2363
+ lazyLoad: false,
2364
+ },
2365
+ },
2366
+ },
2367
+ ],
2368
+ datasource: {
2369
+ type: 'tek-rest',
2370
+ lazyLoad: true,
2371
+ route: '/grid',
2372
+ searchIn: [],
2373
+ } as any,
2374
+ });
2375
+
2376
+ await instance.setSearch('1');
2377
+
2378
+ expect(instance.datasource).toBeInstanceOf(TekRestDatasource);
2379
+ expect((instance.datasource as TekRestDatasource).searchJoin).toEqual({ employee_id: [1, 15] });
2380
+ expect(httpSpy).toHaveBeenCalledTimes(2);
2381
+ });
2382
+
2383
+ it('should fall back to empty array when datasource.searchIn is null', async () => {
2384
+ const instance = new TekGrid({
2385
+ name: 'grid_search_null_searchin',
2386
+ component: 'TekGrid',
2387
+ columns: [
2388
+ { name: 'id' },
2389
+ {
2390
+ name: 'employee_id',
2391
+ componentProps: {
2392
+ name: 'ZdSelect',
2393
+ dataText: ['name'],
2394
+ datasource: {
2395
+ type: 'tek-rest',
2396
+ uniqueKey: 'id',
2397
+ route: '/zeedhi',
2398
+ lazyLoad: false,
2399
+ },
2400
+ },
2401
+ },
2402
+ ],
2403
+ datasource: {
2404
+ type: 'tek-rest',
2405
+ lazyLoad: true,
2406
+ route: '/grid',
2407
+ searchIn: [],
2408
+ } as any,
2409
+ });
2410
+
2411
+ (instance.datasource as any).searchIn = null;
2412
+
2413
+ await instance.setSearch('1');
2414
+
2415
+ expect(instance.datasource).toBeInstanceOf(TekRestDatasource);
2416
+ expect((instance.datasource as TekRestDatasource).searchJoin).toEqual({ employee_id: [1, 15] });
2417
+ expect(httpSpy).toHaveBeenCalledTimes(2);
2418
+ });
2289
2419
  });
2290
2420
 
2291
2421
  describe('rowClick', () => {
@@ -3372,6 +3502,9 @@ describe('TekGrid', () => {
3372
3502
  expect(toolbarSlot.find((c: IComponentRender) => c.name?.includes('_title'))).toBeUndefined();
3373
3503
  expect(toolbarSlot.find((c: IComponentRender) => c.name?.includes('_hideTooltip'))).toBeUndefined();
3374
3504
  expect(toolbarSlot[0].name).toBe('grid_toolbarDiv');
3505
+ expect(getChild<any>(toolbarSlot, 'grid_columnsButton').gridName).toBe('grid');
3506
+ expect(getChild<any>(toolbarSlot, 'grid_columnsButton').iterableComponentName).toBeUndefined();
3507
+ expect(getChild<IComponentRender>(toolbarSlot, 'grid_layout_options').gridName).toBe('grid');
3375
3508
  });
3376
3509
  });
3377
3510
  });
@@ -51,9 +51,175 @@ describe('LayoutOptions', () => {
51
51
  expect(instance.layoutNames).toEqual([]);
52
52
  expect(instance.originalColumnProps).toEqual([]);
53
53
  });
54
+
55
+ it('should create layout options object with gridName', () => {
56
+ const instance = new TekGridLayoutOptions({
57
+ name: 'layout_with_grid_name',
58
+ component: 'TekGridLayoutOptions',
59
+ gridName: 'layout_grid_name',
60
+ });
61
+
62
+ expect(instance.gridName).toBe('layout_grid_name');
63
+ });
64
+ });
65
+
66
+ describe('loadGrid()', () => {
67
+ it('should load grid by gridName', () => {
68
+ const grid = new TekGrid({
69
+ name: 'layout_options_load_grid',
70
+ component: 'TekGrid',
71
+ });
72
+ grid.onCreated();
73
+
74
+ const instance = new TekGridLayoutOptions({
75
+ name: 'layout_load_grid',
76
+ component: 'TekGridLayoutOptions',
77
+ gridName: 'layout_options_load_grid',
78
+ });
79
+
80
+ instance.loadGrid();
81
+
82
+ expect(instance.grid).toBe(grid);
83
+ expect(instance.gridName).toBe(grid.name);
84
+ });
85
+
86
+ it('should load grid by gridName after layout options is created', () => {
87
+ const instance = new TekGridLayoutOptions({
88
+ name: 'layout_load_grid_late',
89
+ component: 'TekGridLayoutOptions',
90
+ gridName: 'layout_options_late_grid',
91
+ });
92
+
93
+ expect(instance.grid).toBeUndefined();
94
+
95
+ const grid = new TekGrid({
96
+ name: 'layout_options_late_grid',
97
+ component: 'TekGrid',
98
+ });
99
+ grid.onCreated();
100
+
101
+ instance.loadGrid();
102
+
103
+ expect(instance.grid).toBe(grid);
104
+ expect(instance.gridName).toBe(grid.name);
105
+ });
106
+
107
+ it('should load grid by gridName argument', () => {
108
+ const grid = new TekGrid({
109
+ name: 'layout_options_argument_grid',
110
+ component: 'TekGrid',
111
+ });
112
+ grid.onCreated();
113
+
114
+ const instance = new TekGridLayoutOptions({
115
+ name: 'layout_load_grid_argument',
116
+ component: 'TekGridLayoutOptions',
117
+ });
118
+
119
+ instance.loadGrid('layout_options_argument_grid');
120
+
121
+ expect(instance.grid).toBe(grid);
122
+ expect(instance.gridName).toBe(grid.name);
123
+ });
54
124
  });
55
125
 
56
126
  describe('mounted()', () => {
127
+ it('should store original props from gridName when mounted outside the grid', async () => {
128
+ const parentGrid = new Grid({
129
+ name: 'layout_options_parent_grid',
130
+ component: 'Grid',
131
+ columns: [{ name: 'parent_id' }],
132
+ });
133
+ const grid = new TekGrid({
134
+ name: 'layout_options_named_grid',
135
+ component: 'TekGrid',
136
+ columns: [
137
+ { name: 'id' },
138
+ { name: 'name' },
139
+ ],
140
+ });
141
+ grid.onCreated();
142
+
143
+ const instance = new TekGridLayoutOptions({
144
+ name: 'layout_named_grid',
145
+ component: 'TekGridLayoutOptions',
146
+ gridName: 'layout_options_named_grid',
147
+ });
148
+ instance.parent = parentGrid;
149
+
150
+ await instance.onMounted({} as HTMLElement);
151
+
152
+ expect(instance.grid).toBe(grid);
153
+ expect(instance.originalColumnProps.map((column) => column.name)).toEqual(['id', 'name']);
154
+ });
155
+
156
+ it('should mark layout as edited when named grid layout changes', async () => {
157
+ const grid = new TekGrid({
158
+ name: 'layout_options_change_layout_grid',
159
+ component: 'TekGrid',
160
+ columns: [{ name: 'id' }],
161
+ });
162
+ grid.onCreated();
163
+
164
+ const instance = new TekGridLayoutOptions({
165
+ name: 'external_layout_options',
166
+ component: 'TekGridLayoutOptions',
167
+ gridName: 'layout_options_change_layout_grid',
168
+ });
169
+
170
+ await instance.onMounted({} as HTMLElement);
171
+ expect(instance.layoutEdited).toBe(false);
172
+
173
+ grid.changeLayout();
174
+
175
+ expect(instance.layoutEdited).toBe(true);
176
+ });
177
+
178
+ it('should preserve existing changeLayout event handlers', async () => {
179
+ let changeLayoutCalled = false;
180
+ const grid = new TekGrid({
181
+ name: 'layout_options_existing_change_layout_grid',
182
+ component: 'TekGrid',
183
+ columns: [{ name: 'id' }],
184
+ events: {
185
+ changeLayout: () => {
186
+ changeLayoutCalled = true;
187
+ },
188
+ },
189
+ });
190
+ grid.onCreated();
191
+
192
+ const instance = new TekGridLayoutOptions({
193
+ name: 'external_existing_layout_options',
194
+ component: 'TekGridLayoutOptions',
195
+ gridName: 'layout_options_existing_change_layout_grid',
196
+ });
197
+
198
+ await instance.onMounted({} as HTMLElement);
199
+ grid.changeLayout();
200
+
201
+ expect(changeLayoutCalled).toBe(true);
202
+ expect(instance.layoutEdited).toBe(true);
203
+ });
204
+
205
+ it('should mark layout as edited when parent grid layout changes', async () => {
206
+ const grid = new Grid({
207
+ name: 'layout_options_parent_change_layout_grid',
208
+ component: 'Grid',
209
+ columns: [{ name: 'id' }],
210
+ });
211
+ const instance = new TekGridLayoutOptions({
212
+ name: 'parent_layout_options',
213
+ component: 'TekGridLayoutOptions',
214
+ });
215
+ instance.parent = grid;
216
+
217
+ await instance.onMounted({} as HTMLElement);
218
+ grid.changeLayout();
219
+
220
+ expect(instance.layoutEdited).toBe(true);
221
+ });
222
+
57
223
  it('should store the original column props of a TekGrid', () => {
58
224
  const tag = new Tag({
59
225
  name: 'toolbar',
@@ -26,6 +26,7 @@ export * from './tek-grid/grid';
26
26
  export * from './tek-grid/grid-column';
27
27
  export * from './tek-grid/grid-columns-button';
28
28
  export * from './tek-grid/grid-columns-button-controller';
29
+ export * from './tek-grid/grid-export-button';
29
30
  export * from './tek-grid/grid-filter-button';
30
31
  export * from './tek-grid/layout-options';
31
32
  export * from './tek-grid/filter-helper';
@@ -0,0 +1,53 @@
1
+ declare const defaultIcons: {
2
+ columnGroupOpened: string;
3
+ columnGroupClosed: string;
4
+ columnSelectClosed: string;
5
+ columnSelectOpen: string;
6
+ columnSelectIndeterminate: string;
7
+ columnMovePin: string;
8
+ columnMoveHide: string;
9
+ columnMoveMove: string;
10
+ columnMoveLeft: string;
11
+ columnMoveRight: string;
12
+ columnMoveGroup: string;
13
+ columnMoveValue: string;
14
+ dropNotAllowed: string;
15
+ groupContracted: string;
16
+ groupExpanded: string;
17
+ chart: string;
18
+ close: string;
19
+ cancel: string;
20
+ check: string;
21
+ first: string;
22
+ previous: string;
23
+ next: string;
24
+ last: string;
25
+ linked: string;
26
+ unlinked: string;
27
+ colorPicker: string;
28
+ groupLoading: string;
29
+ menu: string;
30
+ filter: string;
31
+ columns: string;
32
+ maximize: string;
33
+ minimize: string;
34
+ menuPin: string;
35
+ menuValue: string;
36
+ menuAddRowGroup: string;
37
+ menuRemoveRowGroup: string;
38
+ clipboardCopy: string;
39
+ clipboardPaste: string;
40
+ rowGroupPanel: string;
41
+ valuePanel: string;
42
+ columnDrag: string;
43
+ rowDrag: string;
44
+ save: string;
45
+ smallDown: string;
46
+ smallLeft: string;
47
+ smallRight: string;
48
+ smallUp: string;
49
+ sortAscending: string;
50
+ sortDescending: string;
51
+ sortUnSort: string;
52
+ };
53
+ export default defaultIcons;
@@ -0,0 +1,9 @@
1
+ import { IIterable } from '@zeedhi/common';
2
+ import { IDictionary } from '@zeedhi/core';
3
+ export interface ITekAgGrid extends IIterable {
4
+ dense?: boolean;
5
+ frameworkComponents?: IDictionary;
6
+ gridOptions?: IDictionary;
7
+ height?: string | number;
8
+ icons?: IDictionary<string>;
9
+ }
@@ -0,0 +1,35 @@
1
+ import { Iterable } from '@zeedhi/common';
2
+ import { IDictionary } from '@zeedhi/core';
3
+ import { ITekAgGrid } from './interfaces';
4
+ /** Grid Component */
5
+ export declare class TekAgGrid extends Iterable implements ITekAgGrid {
6
+ cssClass: string;
7
+ dense: boolean;
8
+ frameworkComponents: IDictionary;
9
+ gridOptions: IDictionary;
10
+ height: string | number;
11
+ icons: IDictionary<string>;
12
+ gridComponent: any;
13
+ /**
14
+ * Creates a new AgGrid.
15
+ * @param props AgGrid properties
16
+ */
17
+ constructor(props: ITekAgGrid);
18
+ private createOptionsAccessors;
19
+ private setAccessor;
20
+ /**
21
+ * Reload dataset
22
+ */
23
+ reload(): Promise<any>;
24
+ /**
25
+ * Compares two dates
26
+ * @param date1
27
+ * @param date2
28
+ * @param format
29
+ * @returns -1 if date1 after date2
30
+ * @returns 0 if date1 equal date2
31
+ * @returns 1 if date1 before date2
32
+ */
33
+ dateComparator(date1: string | Date, date2: string | Date, format?: string): 1 | -1 | 0;
34
+ private getDateAsString;
35
+ }