@zeedhi/teknisa-components-common 1.43.0 → 1.44.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.
@@ -840,7 +840,7 @@ class GridBase {
840
840
  component: 'ZdDivider',
841
841
  cssClass: 'toolbar-divider',
842
842
  vertical: true,
843
- isVisible: `{{GridController_${this.grid.componentId}.showFirstDivider}}`,
843
+ isVisible: `{{GridController_${this.grid.componentId}.showDivider1}}`,
844
844
  },
845
845
  {
846
846
  name: `${this.grid.name}_refresh_tooltip`,
@@ -853,7 +853,7 @@ class GridBase {
853
853
  component: 'ZdButton',
854
854
  icon: true,
855
855
  iconName: 'refresh',
856
- isVisible: this.grid.showReload,
856
+ isVisible: `{{GridController_${this.grid.componentId}.showReloadButton}}`,
857
857
  events: {
858
858
  click: this.reloadGrid.bind(this),
859
859
  },
@@ -865,7 +865,7 @@ class GridBase {
865
865
  component: 'ZdDivider',
866
866
  cssClass: 'toolbar-divider',
867
867
  vertical: true,
868
- isVisible: `{{GridController_${this.grid.componentId}.showLayoutOptions}`,
868
+ isVisible: `{{GridController_${this.grid.componentId}.showDivider2}}`,
869
869
  },
870
870
  {
871
871
  name: `${this.grid.name}_columns_button_tooltip`,
@@ -886,7 +886,7 @@ class GridBase {
886
886
  {
887
887
  name: `${this.grid.name}_layout_options`,
888
888
  component: 'TekGridLayoutOptions',
889
- isVisible: `{{GridController_${this.grid.componentId}.showLayoutOptions}}`,
889
+ isVisible: `{{GridController_${this.grid.componentId}.showLayoutOptionsButton}}`,
890
890
  },
891
891
  {
892
892
  name: `${this.grid.name}_dividerActions`,
@@ -928,6 +928,7 @@ class GridBase {
928
928
  component: 'ZdDivider',
929
929
  cssClass: 'toolbar-divider',
930
930
  vertical: true,
931
+ isVisible: `{{GridController_${this.grid.componentId}.showDivider3}}`,
931
932
  },
932
933
  ],
933
934
  },
@@ -956,6 +957,7 @@ class GridBase {
956
957
  {
957
958
  name: `${this.grid.name}_gridSearch`,
958
959
  component: 'ZdSearch',
960
+ isVisible: `{{GridController_${this.grid.componentId}.showSearchInput}}`,
959
961
  },
960
962
  {
961
963
  name: `${this.grid.name}_filter_tooltip`,
@@ -1109,10 +1111,15 @@ class GridBase {
1109
1111
  hideFilterModal() {
1110
1112
  this.filterModal.hide();
1111
1113
  }
1114
+ sortFilterIndex(col1, col2) {
1115
+ const index1 = col1.filterIndex !== undefined ? col1.filterIndex : Number.MAX_SAFE_INTEGER;
1116
+ const index2 = col2.filterIndex !== undefined ? col2.filterIndex : Number.MAX_SAFE_INTEGER;
1117
+ return index1 - index2;
1118
+ }
1112
1119
  getFilterModalComponents() {
1113
1120
  const filterColumns = [];
1114
1121
  let columnComponentName;
1115
- this.grid.columns.forEach((column) => {
1122
+ [...this.grid.columns].sort(this.sortFilterIndex).forEach((column) => {
1116
1123
  const filterProps = Array.isArray(column.filterProps) ? column.filterProps : [column.filterProps];
1117
1124
  if (column.filterable && filterProps && filterProps.length > 0) {
1118
1125
  this.filterFormInputs[column.name] = [];
@@ -1590,17 +1597,28 @@ class GridController {
1590
1597
  get showFilterButton() {
1591
1598
  return this.grid.filterButton;
1592
1599
  }
1600
+ get showSearchInput() {
1601
+ return this.grid.showSearch;
1602
+ }
1603
+ get showReloadButton() {
1604
+ return this.grid.showReload;
1605
+ }
1606
+ get showDivider2() {
1607
+ return this.showReloadButton && (this.showLayoutOptionsButton || this.showColumnsButton
1608
+ || this.showActionsButton || this.showExportButton || this.showSearchInput);
1609
+ }
1593
1610
  get showColumnsButton() {
1594
1611
  return this.grid.columnsButton;
1595
1612
  }
1596
1613
  get columnsButtonIgnore() {
1597
1614
  return this.grid.columnsButtonIgnore;
1598
1615
  }
1599
- get showLayoutOptions() {
1616
+ get showLayoutOptionsButton() {
1600
1617
  return this.grid.showLayoutOptions;
1601
1618
  }
1602
- get showFirstDivider() {
1603
- return this.showAddButton || this.showDeleteButton;
1619
+ get showDivider1() {
1620
+ return (this.showAddButton || this.showDeleteButton) && (this.showReloadButton || this.showLayoutOptionsButton || this.showColumnsButton
1621
+ || this.showActionsButton || this.showExportButton || this.showSearchInput);
1604
1622
  }
1605
1623
  get showActionsButton() {
1606
1624
  return this.grid.actions.length > 0;
@@ -1609,7 +1627,10 @@ class GridController {
1609
1627
  return this.grid.showExport;
1610
1628
  }
1611
1629
  get showActionAndExportButton() {
1612
- return this.showActionsButton || this.showExportButton;
1630
+ return (this.showLayoutOptionsButton || this.showColumnsButton) && (this.showActionsButton || this.showExportButton || this.showSearchInput);
1631
+ }
1632
+ get showDivider3() {
1633
+ return (this.showActionsButton || this.showExportButton) && this.showSearchInput;
1613
1634
  }
1614
1635
  get isEditing() {
1615
1636
  return this.grid.editing;
@@ -2101,6 +2122,7 @@ class TekGridColumn extends GridColumnEditable {
2101
2122
  this.isVisible = this.getInitValue('isVisible', props.isVisible, this.isVisible);
2102
2123
  this.filterProps = this.getInitValue('filterProps', props.filterProps, this.filterProps);
2103
2124
  this.filterable = this.getInitValue('filterable', props.filterable, this.filterable);
2125
+ this.filterIndex = this.getInitValue('filterIndex', props.filterIndex, this.filterIndex);
2104
2126
  this.fixed = this.getInitValue('fixed', props.fixed, this.fixed);
2105
2127
  this.grouped = this.getInitValue('grouped', props.grouped, this.grouped);
2106
2128
  this.groupOpened = this.getInitValue('groupOpened', props.groupOpened, this.groupOpened);
@@ -2176,6 +2198,16 @@ class TekGridColumn extends GridColumnEditable {
2176
2198
  this.changeGrouping();
2177
2199
  }
2178
2200
  }
2201
+ get groupOpened() {
2202
+ return this.groupOpenedValue;
2203
+ }
2204
+ set groupOpened(value) {
2205
+ const changed = value !== this.groupOpenedValue;
2206
+ this.groupOpenedValue = value;
2207
+ if (changed) {
2208
+ this.changeGrouping();
2209
+ }
2210
+ }
2179
2211
  get isVisible() {
2180
2212
  return this.isVisibleValue && !this.grouped;
2181
2213
  }
@@ -2209,6 +2241,8 @@ class TekGrid extends GridEditable {
2209
2241
  this.actions = [];
2210
2242
  /* Show Filter button */
2211
2243
  this.filterButton = false;
2244
+ /* Show SearchInput */
2245
+ this.showSearch = true;
2212
2246
  /* Show Column Filter button */
2213
2247
  this.columnFilterButton = false;
2214
2248
  /* Show Columns button */
@@ -2311,6 +2345,7 @@ class TekGrid extends GridEditable {
2311
2345
  this.addButton = this.getInitValue('addButton', props.addButton, this.addButton);
2312
2346
  this.deleteButton = this.getInitValue('deleteButton', props.deleteButton, this.deleteButton);
2313
2347
  this.filterButton = this.getInitValue('filterButton', props.filterButton, this.filterButton);
2348
+ this.showSearch = this.getInitValue('showSearch', props.showSearch, this.showSearch);
2314
2349
  this.columnFilterButton = this.getInitValue('columnFilterButton', props.columnFilterButton, this.columnFilterButton);
2315
2350
  this.columnsButton = this.getInitValue('columnsButton', props.columnsButton, this.columnsButton);
2316
2351
  this.columnsButtonIgnore = this.getInitValue('columnsButtonIgnore', props.columnsButtonIgnore, this.columnsButtonIgnore);
@@ -3091,6 +3126,8 @@ class TekTreeGrid extends TreeGridEditable {
3091
3126
  this.actions = [];
3092
3127
  /* Show Filter button */
3093
3128
  this.filterButton = false;
3129
+ /* Show search Input */
3130
+ this.showSearch = true;
3094
3131
  /* Show Column Filter button */
3095
3132
  this.columnFilterButton = false;
3096
3133
  /* Show Columns button */
@@ -3142,6 +3179,7 @@ class TekTreeGrid extends TreeGridEditable {
3142
3179
  this.addButton = this.getInitValue('addButton', props.addButton, this.addButton);
3143
3180
  this.deleteButton = this.getInitValue('deleteButton', props.deleteButton, this.deleteButton);
3144
3181
  this.filterButton = this.getInitValue('filterButton', props.filterButton, this.filterButton);
3182
+ this.showSearch = this.getInitValue('showSearch', props.showSearch, this.showSearch);
3145
3183
  this.columnFilterButton = this.getInitValue('columnFilterButton', props.columnFilterButton, this.columnFilterButton);
3146
3184
  this.columnsButton = this.getInitValue('columnsButton', props.columnsButton, this.columnsButton);
3147
3185
  this.columnsButtonIgnore = this.getInitValue('columnsButtonIgnore', props.columnsButtonIgnore, this.columnsButtonIgnore);
@@ -846,7 +846,7 @@
846
846
  component: 'ZdDivider',
847
847
  cssClass: 'toolbar-divider',
848
848
  vertical: true,
849
- isVisible: `{{GridController_${this.grid.componentId}.showFirstDivider}}`,
849
+ isVisible: `{{GridController_${this.grid.componentId}.showDivider1}}`,
850
850
  },
851
851
  {
852
852
  name: `${this.grid.name}_refresh_tooltip`,
@@ -859,7 +859,7 @@
859
859
  component: 'ZdButton',
860
860
  icon: true,
861
861
  iconName: 'refresh',
862
- isVisible: this.grid.showReload,
862
+ isVisible: `{{GridController_${this.grid.componentId}.showReloadButton}}`,
863
863
  events: {
864
864
  click: this.reloadGrid.bind(this),
865
865
  },
@@ -871,7 +871,7 @@
871
871
  component: 'ZdDivider',
872
872
  cssClass: 'toolbar-divider',
873
873
  vertical: true,
874
- isVisible: `{{GridController_${this.grid.componentId}.showLayoutOptions}`,
874
+ isVisible: `{{GridController_${this.grid.componentId}.showDivider2}}`,
875
875
  },
876
876
  {
877
877
  name: `${this.grid.name}_columns_button_tooltip`,
@@ -892,7 +892,7 @@
892
892
  {
893
893
  name: `${this.grid.name}_layout_options`,
894
894
  component: 'TekGridLayoutOptions',
895
- isVisible: `{{GridController_${this.grid.componentId}.showLayoutOptions}}`,
895
+ isVisible: `{{GridController_${this.grid.componentId}.showLayoutOptionsButton}}`,
896
896
  },
897
897
  {
898
898
  name: `${this.grid.name}_dividerActions`,
@@ -934,6 +934,7 @@
934
934
  component: 'ZdDivider',
935
935
  cssClass: 'toolbar-divider',
936
936
  vertical: true,
937
+ isVisible: `{{GridController_${this.grid.componentId}.showDivider3}}`,
937
938
  },
938
939
  ],
939
940
  },
@@ -962,6 +963,7 @@
962
963
  {
963
964
  name: `${this.grid.name}_gridSearch`,
964
965
  component: 'ZdSearch',
966
+ isVisible: `{{GridController_${this.grid.componentId}.showSearchInput}}`,
965
967
  },
966
968
  {
967
969
  name: `${this.grid.name}_filter_tooltip`,
@@ -1115,10 +1117,15 @@
1115
1117
  hideFilterModal() {
1116
1118
  this.filterModal.hide();
1117
1119
  }
1120
+ sortFilterIndex(col1, col2) {
1121
+ const index1 = col1.filterIndex !== undefined ? col1.filterIndex : Number.MAX_SAFE_INTEGER;
1122
+ const index2 = col2.filterIndex !== undefined ? col2.filterIndex : Number.MAX_SAFE_INTEGER;
1123
+ return index1 - index2;
1124
+ }
1118
1125
  getFilterModalComponents() {
1119
1126
  const filterColumns = [];
1120
1127
  let columnComponentName;
1121
- this.grid.columns.forEach((column) => {
1128
+ [...this.grid.columns].sort(this.sortFilterIndex).forEach((column) => {
1122
1129
  const filterProps = Array.isArray(column.filterProps) ? column.filterProps : [column.filterProps];
1123
1130
  if (column.filterable && filterProps && filterProps.length > 0) {
1124
1131
  this.filterFormInputs[column.name] = [];
@@ -1596,17 +1603,28 @@
1596
1603
  get showFilterButton() {
1597
1604
  return this.grid.filterButton;
1598
1605
  }
1606
+ get showSearchInput() {
1607
+ return this.grid.showSearch;
1608
+ }
1609
+ get showReloadButton() {
1610
+ return this.grid.showReload;
1611
+ }
1612
+ get showDivider2() {
1613
+ return this.showReloadButton && (this.showLayoutOptionsButton || this.showColumnsButton
1614
+ || this.showActionsButton || this.showExportButton || this.showSearchInput);
1615
+ }
1599
1616
  get showColumnsButton() {
1600
1617
  return this.grid.columnsButton;
1601
1618
  }
1602
1619
  get columnsButtonIgnore() {
1603
1620
  return this.grid.columnsButtonIgnore;
1604
1621
  }
1605
- get showLayoutOptions() {
1622
+ get showLayoutOptionsButton() {
1606
1623
  return this.grid.showLayoutOptions;
1607
1624
  }
1608
- get showFirstDivider() {
1609
- return this.showAddButton || this.showDeleteButton;
1625
+ get showDivider1() {
1626
+ return (this.showAddButton || this.showDeleteButton) && (this.showReloadButton || this.showLayoutOptionsButton || this.showColumnsButton
1627
+ || this.showActionsButton || this.showExportButton || this.showSearchInput);
1610
1628
  }
1611
1629
  get showActionsButton() {
1612
1630
  return this.grid.actions.length > 0;
@@ -1615,7 +1633,10 @@
1615
1633
  return this.grid.showExport;
1616
1634
  }
1617
1635
  get showActionAndExportButton() {
1618
- return this.showActionsButton || this.showExportButton;
1636
+ return (this.showLayoutOptionsButton || this.showColumnsButton) && (this.showActionsButton || this.showExportButton || this.showSearchInput);
1637
+ }
1638
+ get showDivider3() {
1639
+ return (this.showActionsButton || this.showExportButton) && this.showSearchInput;
1619
1640
  }
1620
1641
  get isEditing() {
1621
1642
  return this.grid.editing;
@@ -2107,6 +2128,7 @@
2107
2128
  this.isVisible = this.getInitValue('isVisible', props.isVisible, this.isVisible);
2108
2129
  this.filterProps = this.getInitValue('filterProps', props.filterProps, this.filterProps);
2109
2130
  this.filterable = this.getInitValue('filterable', props.filterable, this.filterable);
2131
+ this.filterIndex = this.getInitValue('filterIndex', props.filterIndex, this.filterIndex);
2110
2132
  this.fixed = this.getInitValue('fixed', props.fixed, this.fixed);
2111
2133
  this.grouped = this.getInitValue('grouped', props.grouped, this.grouped);
2112
2134
  this.groupOpened = this.getInitValue('groupOpened', props.groupOpened, this.groupOpened);
@@ -2182,6 +2204,16 @@
2182
2204
  this.changeGrouping();
2183
2205
  }
2184
2206
  }
2207
+ get groupOpened() {
2208
+ return this.groupOpenedValue;
2209
+ }
2210
+ set groupOpened(value) {
2211
+ const changed = value !== this.groupOpenedValue;
2212
+ this.groupOpenedValue = value;
2213
+ if (changed) {
2214
+ this.changeGrouping();
2215
+ }
2216
+ }
2185
2217
  get isVisible() {
2186
2218
  return this.isVisibleValue && !this.grouped;
2187
2219
  }
@@ -2215,6 +2247,8 @@
2215
2247
  this.actions = [];
2216
2248
  /* Show Filter button */
2217
2249
  this.filterButton = false;
2250
+ /* Show SearchInput */
2251
+ this.showSearch = true;
2218
2252
  /* Show Column Filter button */
2219
2253
  this.columnFilterButton = false;
2220
2254
  /* Show Columns button */
@@ -2317,6 +2351,7 @@
2317
2351
  this.addButton = this.getInitValue('addButton', props.addButton, this.addButton);
2318
2352
  this.deleteButton = this.getInitValue('deleteButton', props.deleteButton, this.deleteButton);
2319
2353
  this.filterButton = this.getInitValue('filterButton', props.filterButton, this.filterButton);
2354
+ this.showSearch = this.getInitValue('showSearch', props.showSearch, this.showSearch);
2320
2355
  this.columnFilterButton = this.getInitValue('columnFilterButton', props.columnFilterButton, this.columnFilterButton);
2321
2356
  this.columnsButton = this.getInitValue('columnsButton', props.columnsButton, this.columnsButton);
2322
2357
  this.columnsButtonIgnore = this.getInitValue('columnsButtonIgnore', props.columnsButtonIgnore, this.columnsButtonIgnore);
@@ -3097,6 +3132,8 @@
3097
3132
  this.actions = [];
3098
3133
  /* Show Filter button */
3099
3134
  this.filterButton = false;
3135
+ /* Show search Input */
3136
+ this.showSearch = true;
3100
3137
  /* Show Column Filter button */
3101
3138
  this.columnFilterButton = false;
3102
3139
  /* Show Columns button */
@@ -3148,6 +3185,7 @@
3148
3185
  this.addButton = this.getInitValue('addButton', props.addButton, this.addButton);
3149
3186
  this.deleteButton = this.getInitValue('deleteButton', props.deleteButton, this.deleteButton);
3150
3187
  this.filterButton = this.getInitValue('filterButton', props.filterButton, this.filterButton);
3188
+ this.showSearch = this.getInitValue('showSearch', props.showSearch, this.showSearch);
3151
3189
  this.columnFilterButton = this.getInitValue('columnFilterButton', props.columnFilterButton, this.columnFilterButton);
3152
3190
  this.columnsButton = this.getInitValue('columnsButton', props.columnsButton, this.columnsButton);
3153
3191
  this.columnsButtonIgnore = this.getInitValue('columnsButtonIgnore', props.columnsButtonIgnore, this.columnsButtonIgnore);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/teknisa-components-common",
3
- "version": "1.43.0",
3
+ "version": "1.44.0",
4
4
  "description": "Teknisa Components Common",
5
5
  "author": "Zeedhi <zeedhi@teknisa.com>",
6
6
  "license": "ISC",
@@ -28,5 +28,5 @@
28
28
  "peerDependencies": {
29
29
  "@zeedhi/core": "*"
30
30
  },
31
- "gitHead": "dff21e134017e20c4de440406daf73031653df60"
31
+ "gitHead": "f58aaa0da52de553088e6eb5bb4567293553e44a"
32
32
  }
@@ -31,6 +31,7 @@ describe('TekGrid', () => {
31
31
  expect(instance.dragColumns).toBeTruthy();
32
32
  expect(instance.resizeColumns).toBeTruthy();
33
33
  expect(instance.showLayoutOptions).toBeTruthy();
34
+ expect(instance.showSearch).toBeTruthy();
34
35
  expect(instance.showSummaryTotal).toBeTruthy();
35
36
  expect(instance.showReload).toBeTruthy();
36
37
  expect(instance.columnsButton).toBeFalsy();
@@ -49,6 +50,7 @@ describe('TekGrid', () => {
49
50
  dragColumns: false,
50
51
  resizeColumns: false,
51
52
  showLayoutOptions: false,
53
+ showSearch: false,
52
54
  showSummaryTotal: false,
53
55
  showReload: false,
54
56
  columns: [
@@ -65,6 +67,7 @@ describe('TekGrid', () => {
65
67
  expect(instance.dragColumns).toBeFalsy();
66
68
  expect(instance.resizeColumns).toBeFalsy();
67
69
  expect(instance.showLayoutOptions).toBeFalsy();
70
+ expect(instance.showSearch).toBeFalsy();
68
71
  expect(instance.showSummaryTotal).toBeFalsy();
69
72
  expect(instance.showReload).toBeFalsy();
70
73
  expect(instance.columns[0]).toBeInstanceOf(TekGridColumn);
@@ -1436,6 +1439,50 @@ describe('TekGrid', () => {
1436
1439
  done();
1437
1440
  }, 1000);
1438
1441
  });
1442
+
1443
+ it('should call debounced updateGroupData', async (done) => {
1444
+ const flushPromises = () => new Promise(setImmediate);
1445
+ const instance = new TekGrid({
1446
+ name: 'grid_grouping_1',
1447
+ component: 'TekGrid',
1448
+ columns: [
1449
+ {
1450
+ name: 'id',
1451
+ label: 'id',
1452
+ },
1453
+ {
1454
+ name: 'name',
1455
+ label: 'name',
1456
+ },
1457
+ {
1458
+ name: 'department',
1459
+ label: 'department',
1460
+ grouped: true,
1461
+ },
1462
+ ],
1463
+ datasource: {
1464
+ uniqueKey: 'id',
1465
+ order: ['name.asc'],
1466
+ data: [
1467
+ { id: 2, name: 'employee 2', department: 1 },
1468
+ { id: 5, name: 'employee 5', department: 2 },
1469
+ { id: 4, name: 'employee 4', department: 2 },
1470
+ { id: 3, name: 'employee 3', department: 1 },
1471
+ { id: 1, name: 'employee 1', department: 1 },
1472
+ ],
1473
+ },
1474
+ });
1475
+
1476
+ await flushPromises();
1477
+
1478
+ instance.updateGroupedData = jest.fn();
1479
+ instance.columns[2].groupOpened = true;
1480
+
1481
+ setTimeout(() => {
1482
+ expect(instance.updateGroupedData).toBeCalled();
1483
+ done();
1484
+ }, 1000);
1485
+ });
1439
1486
  });
1440
1487
 
1441
1488
  describe('filterClick()', () => {
@@ -1564,6 +1611,54 @@ describe('TekGrid', () => {
1564
1611
  spy.mockClear();
1565
1612
  });
1566
1613
 
1614
+ it('should create modal with filterable and ordered form elements', () => {
1615
+ const instance = new TekGrid({
1616
+ name: 'grid-filter-order',
1617
+ component: 'TekGrid',
1618
+ columns: [
1619
+ { name: 'id' },
1620
+ {
1621
+ name: 'first_name',
1622
+ filterable: true,
1623
+ filterProps: [{ name: 'first_name_edit', label: 'first_name' }],
1624
+ },
1625
+ {
1626
+ name: 'last_name',
1627
+ filterable: true,
1628
+ filterIndex: 1,
1629
+ filterProps: [{ name: 'last_name_edit', label: 'last_name' }],
1630
+ },
1631
+ {
1632
+ name: 'dob',
1633
+ filterable: true,
1634
+ filterIndex: 0,
1635
+ filterProps: [{ name: 'dob_edit', label: 'dob' }],
1636
+ },
1637
+ ],
1638
+ });
1639
+
1640
+ let formElements: any = [];
1641
+ const spy = jest.spyOn(ModalService, 'create').mockImplementation((modal: IModal) => {
1642
+ if (modal.children && modal.children.length > 1) {
1643
+ const form = modal.children[1];
1644
+ formElements = form.children;
1645
+ }
1646
+
1647
+ return new Modal(modal);
1648
+ });
1649
+ instance.onCreated();
1650
+ const filterTooltip = instance.toolbarSlot[6];
1651
+ if (filterTooltip && filterTooltip.children && filterTooltip.children.length > 0) {
1652
+ const button = new Button(filterTooltip.children[0]);
1653
+ const event = new Event('click');
1654
+ button.click(event, {} as HTMLElement);
1655
+ expect(formElements[0].name).toBe('grid-filter-order-filter-AND-CONTAINS-dob-0');
1656
+ expect(formElements[1].name).toBe('grid-filter-order-filter-AND-CONTAINS-last_name-0');
1657
+ expect(formElements[2].name).toBe('grid-filter-order-filter-AND-CONTAINS-first_name-0');
1658
+ }
1659
+ spy.mockClear();
1660
+ });
1661
+
1567
1662
  it('should create modal with filterable form elements and TekRestDatasource', () => {
1568
1663
  const instance = new TekGrid({
1569
1664
  name: 'grid_filterClick6',
@@ -15,7 +15,8 @@ describe('GridController', () => {
15
15
  filterButton: true,
16
16
  columnsButton: true,
17
17
  showExport: true,
18
- showLayoutOptions: true,
18
+ showLayoutOptionsButton: true,
19
+ showReloadButton: true,
19
20
  actions: [{ name: 'button', component: 'ZdButton' }],
20
21
  });
21
22
  const instance = new GridController(grid);
@@ -27,10 +28,14 @@ describe('GridController', () => {
27
28
  expect(instance.showActionsButton).toBeTruthy();
28
29
  expect(instance.showExportButton).toBeTruthy();
29
30
  expect(instance.showActionAndExportButton).toBeTruthy();
31
+ expect(instance.showSearchInput).toBeTruthy();
32
+ expect(instance.showDivider2).toBeTruthy();
33
+ expect(instance.showDivider3).toBeTruthy();
30
34
  expect(instance.showColumnsButton).toBeTruthy();
31
35
  expect(instance.columnsButtonIgnore).toEqual([]);
32
- expect(instance.showLayoutOptions).toBeTruthy();
33
- expect(instance.showFirstDivider).toBeTruthy();
36
+ expect(instance.showLayoutOptionsButton).toBeTruthy();
37
+ expect(instance.showReloadButton).toBeTruthy();
38
+ expect(instance.showDivider1).toBeTruthy();
34
39
  expect(instance.isEditing).toBeFalsy();
35
40
  expect(instance.isNotEditing).toBeTruthy();
36
41
  expect(instance.disableDeleteButton).toBeTruthy();
@@ -38,12 +43,110 @@ describe('GridController', () => {
38
43
  grid.datasource.currentRow = { id: '1' };
39
44
  expect(instance.disableDeleteButton).toBeFalsy();
40
45
  grid.showExport = false;
46
+ grid.showLayoutOptions = false;
47
+ grid.showReload = false;
48
+ grid.columnsButton = false;
41
49
  grid.actions = [];
42
50
  grid.deleteButton = 'selection';
43
51
  grid.selectedRows = [{ id: '1' }];
44
52
  expect(instance.disableDeleteButton).toBeFalsy();
45
53
  expect(instance.showExportButton).toBeFalsy();
46
54
  expect(instance.showActionAndExportButton).toBeFalsy();
55
+ expect(instance.showLayoutOptionsButton).toBeFalsy();
56
+ });
57
+
58
+ it('should verify if showDivider3 is visibility', () => {
59
+ const grid = new TekGrid({
60
+ name: 'Grid',
61
+ component: 'TekGrid',
62
+ addButton: false,
63
+ deleteButton: 'none',
64
+ filterButton: false,
65
+ columnsButton: false,
66
+ showReload: false,
67
+ showLayoutOptions: false,
68
+ showReloadButton: true,
69
+ showSearch: false,
70
+ showExport: false,
71
+ actions: [],
72
+ });
73
+ const instance = new GridController(grid);
74
+
75
+ expect(instance.showDivider3).toBeFalsy();
76
+ expect(instance.showActionsButton).toBeFalsy();
77
+ expect(instance.showExportButton).toBeFalsy();
78
+ expect(instance.showSearchInput).toBeFalsy();
79
+ });
80
+
81
+ it('should verify if showActionAndExportButton is visibility', () => {
82
+ const grid = new TekGrid({
83
+ name: 'Grid',
84
+ component: 'TekGrid',
85
+ addButton: false,
86
+ deleteButton: 'none',
87
+ filterButton: false,
88
+ columnsButton: true,
89
+ showReload: false,
90
+ showLayoutOptions: true,
91
+ showReloadButton: true,
92
+ showSearch: false,
93
+ showExport: false,
94
+ actions: [],
95
+ });
96
+ const instance = new GridController(grid);
97
+
98
+ expect(instance.showActionAndExportButton).toBeFalsy();
99
+ expect(instance.showActionsButton).toBeFalsy();
100
+ expect(instance.showSearchInput).toBeFalsy();
101
+ expect(instance.showExportButton).toBeFalsy();
102
+ });
103
+
104
+ it('should verify if showDivider2 is visibility', () => {
105
+ const grid = new TekGrid({
106
+ name: 'Grid',
107
+ component: 'TekGrid',
108
+ addButton: false,
109
+ deleteButton: 'none',
110
+ filterButton: false,
111
+ columnsButton: false,
112
+ showReload: true,
113
+ showLayoutOptions: false,
114
+ showSearch: false,
115
+ showExport: false,
116
+ actions: [],
117
+ });
118
+ const instance = new GridController(grid);
119
+
120
+ expect(instance.showDivider2).toBeFalsy();
121
+ expect(instance.showActionsButton).toBeFalsy();
122
+ expect(instance.showSearchInput).toBeFalsy();
123
+ expect(instance.showColumnsButton).toBeFalsy();
124
+ expect(instance.showExportButton).toBeFalsy();
125
+ expect(instance.showReloadButton).toBeTruthy();
126
+ });
127
+
128
+ it('should verify if showDivider1 is visibility', () => {
129
+ const grid = new TekGrid({
130
+ name: 'Grid',
131
+ component: 'TekGrid',
132
+ addButton: true,
133
+ deleteButton: 'selection',
134
+ filterButton: false,
135
+ columnsButton: false,
136
+ showReload: false,
137
+ showLayoutOptions: false,
138
+ showSearch: false,
139
+ showExport: false,
140
+ actions: [],
141
+ });
142
+ const instance = new GridController(grid);
143
+
144
+ expect(instance.showDivider1).toBeFalsy();
145
+ expect(instance.showActionsButton).toBeFalsy();
146
+ expect(instance.showSearchInput).toBeFalsy();
147
+ expect(instance.showColumnsButton).toBeFalsy();
148
+ expect(instance.showExportButton).toBeFalsy();
149
+ expect(instance.showReloadButton).toBeFalsy();
47
150
  });
48
151
  });
49
152
  });
@@ -7,9 +7,10 @@ import { IFilterPropsComponent, ITekGridColumn, ITekGridColumnAggregation } from
7
7
  export declare class TekGridColumn extends GridColumnEditable implements ITekGridColumn {
8
8
  filterProps: IFilterPropsComponent | IFilterPropsComponent[];
9
9
  filterable: boolean;
10
+ filterIndex?: number;
10
11
  fixed: boolean;
11
12
  private groupedValue;
12
- groupOpened?: boolean;
13
+ private groupOpenedValue?;
13
14
  groupLabelForEmptyValue: string;
14
15
  private aggregationValue?;
15
16
  private isVisibleValue;
@@ -33,6 +34,8 @@ export declare class TekGridColumn extends GridColumnEditable implements ITekGri
33
34
  set grouped(value: boolean);
34
35
  get aggregation(): ITekGridColumnAggregation;
35
36
  set aggregation(value: ITekGridColumnAggregation);
37
+ get groupOpened(): boolean | undefined;
38
+ set groupOpened(value: boolean | undefined);
36
39
  get isVisible(): boolean;
37
40
  set isVisible(value: boolean);
38
41
  private changeGrouping;
@@ -10,6 +10,7 @@ export declare class TekGrid extends GridEditable implements ITekGrid {
10
10
  deleteButton: 'none' | 'currentRow' | 'selection';
11
11
  actions: IComponentRender[];
12
12
  filterButton: boolean;
13
+ showSearch: boolean;
13
14
  columnFilterButton: boolean;
14
15
  columnsButton: boolean;
15
16
  columnsButtonIgnore: string[];
@@ -38,6 +38,7 @@ export interface ITekGrid extends IGridEditable {
38
38
  deleteButton?: 'none' | 'currentRow' | 'selection';
39
39
  events?: ITekGridEvents;
40
40
  filterButton?: boolean;
41
+ showSearch?: boolean;
41
42
  showLayoutOptions?: boolean;
42
43
  title?: string;
43
44
  showExport?: boolean;
@@ -96,6 +97,7 @@ export interface IFilterPropsComponent extends IComponent {
96
97
  export interface ITekGridColumn extends IGridColumnEditable {
97
98
  filterProps?: IFilterPropsComponent | IFilterPropsComponent[];
98
99
  filterable?: boolean;
100
+ filterIndex?: number;
99
101
  fixed?: boolean;
100
102
  grouped?: boolean;
101
103
  aggregation?: ITekGridColumnAggregation;
@@ -10,6 +10,7 @@ export interface ITekTreeGrid extends ITreeGridEditable {
10
10
  deleteButton?: 'none' | 'currentRow' | 'selection';
11
11
  events?: ITekGridEvents;
12
12
  filterButton?: boolean;
13
+ showSearch?: boolean;
13
14
  showLayoutOptions?: boolean;
14
15
  title?: string;
15
16
  showExport?: boolean;