@zeedhi/teknisa-components-common 1.80.0 → 1.81.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.
@@ -908,7 +908,7 @@ class GridBase {
908
908
  name: `${this.grid.name}_saveButton`,
909
909
  component: 'ZdButton',
910
910
  label: 'TEKGRID_SAVE',
911
- isVisible: `{{GridController_${this.grid.componentId}.isEditing}}`,
911
+ isVisible: `{{GridController_${this.grid.componentId}.showEditButtons}}`,
912
912
  small: true,
913
913
  events: {
914
914
  click: this.saveChanges.bind(this),
@@ -920,7 +920,7 @@ class GridBase {
920
920
  label: 'TEKGRID_CANCEL',
921
921
  outline: true,
922
922
  cssClass: 'zd-mx-2',
923
- isVisible: `{{GridController_${this.grid.componentId}.isEditing}}`,
923
+ isVisible: `{{GridController_${this.grid.componentId}.showEditButtons}}`,
924
924
  small: true,
925
925
  events: {
926
926
  click: this.cancelChanges.bind(this),
@@ -1631,6 +1631,9 @@ class GridController {
1631
1631
  get isEditing() {
1632
1632
  return this.grid.editing;
1633
1633
  }
1634
+ get showEditButtons() {
1635
+ return this.isEditing && this.grid.showEditButtons;
1636
+ }
1634
1637
  get isNotEditing() {
1635
1638
  return !this.isEditing;
1636
1639
  }
@@ -2316,6 +2319,8 @@ class TekGrid extends GridEditable {
2316
2319
  this.deleteButton = 'none';
2317
2320
  /* Show Delete button */
2318
2321
  this.actions = [];
2322
+ /* Show edit button */
2323
+ this.showEditButtons = true;
2319
2324
  /* Show Filter button */
2320
2325
  this.filterButton = false;
2321
2326
  /* Show SearchInput */
@@ -2420,6 +2425,7 @@ class TekGrid extends GridEditable {
2420
2425
  this.columnFilterButton = this.getInitValue('columnFilterButton', props.columnFilterButton, this.columnFilterButton);
2421
2426
  this.columnsButton = this.getInitValue('columnsButton', props.columnsButton, this.columnsButton);
2422
2427
  this.columnsButtonIgnore = this.getInitValue('columnsButtonIgnore', props.columnsButtonIgnore, this.columnsButtonIgnore);
2428
+ this.showEditButtons = this.getInitValue('showEditButtons', props.showEditButtons, this.showEditButtons);
2423
2429
  this.dragColumns = this.getInitValue('dragColumns', props.dragColumns, this.dragColumns);
2424
2430
  this.resizeColumns = this.getInitValue('resizeColumns', props.resizeColumns, this.resizeColumns);
2425
2431
  this.showLayoutOptions = this.getInitValue('showLayoutOptions', props.showLayoutOptions, this.showLayoutOptions);
@@ -3251,6 +3257,8 @@ class TekTreeGrid extends TreeGridEditable {
3251
3257
  this.title = '';
3252
3258
  /* Show Add button */
3253
3259
  this.addButton = false;
3260
+ /* Show edit buttons */
3261
+ this.showEditButtons = true;
3254
3262
  /* Show Delete button */
3255
3263
  this.deleteButton = 'none';
3256
3264
  /* Show Delete button */
@@ -3326,6 +3334,7 @@ class TekTreeGrid extends TreeGridEditable {
3326
3334
  this.title = this.getInitValue('title', props.title, this.title);
3327
3335
  this.addButton = this.getInitValue('addButton', props.addButton, this.addButton);
3328
3336
  this.deleteButton = this.getInitValue('deleteButton', props.deleteButton, this.deleteButton);
3337
+ this.showEditButtons = this.getInitValue('showEditButtons', props.showEditButtons, this.showEditButtons);
3329
3338
  this.filterButton = this.getInitValue('filterButton', props.filterButton, this.filterButton);
3330
3339
  this.showSearch = this.getInitValue('showSearch', props.showSearch, this.showSearch);
3331
3340
  this.columnFilterButton = this.getInitValue('columnFilterButton', props.columnFilterButton, this.columnFilterButton);
@@ -913,7 +913,7 @@
913
913
  name: `${this.grid.name}_saveButton`,
914
914
  component: 'ZdButton',
915
915
  label: 'TEKGRID_SAVE',
916
- isVisible: `{{GridController_${this.grid.componentId}.isEditing}}`,
916
+ isVisible: `{{GridController_${this.grid.componentId}.showEditButtons}}`,
917
917
  small: true,
918
918
  events: {
919
919
  click: this.saveChanges.bind(this),
@@ -925,7 +925,7 @@
925
925
  label: 'TEKGRID_CANCEL',
926
926
  outline: true,
927
927
  cssClass: 'zd-mx-2',
928
- isVisible: `{{GridController_${this.grid.componentId}.isEditing}}`,
928
+ isVisible: `{{GridController_${this.grid.componentId}.showEditButtons}}`,
929
929
  small: true,
930
930
  events: {
931
931
  click: this.cancelChanges.bind(this),
@@ -1636,6 +1636,9 @@
1636
1636
  get isEditing() {
1637
1637
  return this.grid.editing;
1638
1638
  }
1639
+ get showEditButtons() {
1640
+ return this.isEditing && this.grid.showEditButtons;
1641
+ }
1639
1642
  get isNotEditing() {
1640
1643
  return !this.isEditing;
1641
1644
  }
@@ -2321,6 +2324,8 @@
2321
2324
  this.deleteButton = 'none';
2322
2325
  /* Show Delete button */
2323
2326
  this.actions = [];
2327
+ /* Show edit button */
2328
+ this.showEditButtons = true;
2324
2329
  /* Show Filter button */
2325
2330
  this.filterButton = false;
2326
2331
  /* Show SearchInput */
@@ -2425,6 +2430,7 @@
2425
2430
  this.columnFilterButton = this.getInitValue('columnFilterButton', props.columnFilterButton, this.columnFilterButton);
2426
2431
  this.columnsButton = this.getInitValue('columnsButton', props.columnsButton, this.columnsButton);
2427
2432
  this.columnsButtonIgnore = this.getInitValue('columnsButtonIgnore', props.columnsButtonIgnore, this.columnsButtonIgnore);
2433
+ this.showEditButtons = this.getInitValue('showEditButtons', props.showEditButtons, this.showEditButtons);
2428
2434
  this.dragColumns = this.getInitValue('dragColumns', props.dragColumns, this.dragColumns);
2429
2435
  this.resizeColumns = this.getInitValue('resizeColumns', props.resizeColumns, this.resizeColumns);
2430
2436
  this.showLayoutOptions = this.getInitValue('showLayoutOptions', props.showLayoutOptions, this.showLayoutOptions);
@@ -3256,6 +3262,8 @@
3256
3262
  this.title = '';
3257
3263
  /* Show Add button */
3258
3264
  this.addButton = false;
3265
+ /* Show edit buttons */
3266
+ this.showEditButtons = true;
3259
3267
  /* Show Delete button */
3260
3268
  this.deleteButton = 'none';
3261
3269
  /* Show Delete button */
@@ -3331,6 +3339,7 @@
3331
3339
  this.title = this.getInitValue('title', props.title, this.title);
3332
3340
  this.addButton = this.getInitValue('addButton', props.addButton, this.addButton);
3333
3341
  this.deleteButton = this.getInitValue('deleteButton', props.deleteButton, this.deleteButton);
3342
+ this.showEditButtons = this.getInitValue('showEditButtons', props.showEditButtons, this.showEditButtons);
3334
3343
  this.filterButton = this.getInitValue('filterButton', props.filterButton, this.filterButton);
3335
3344
  this.showSearch = this.getInitValue('showSearch', props.showSearch, this.showSearch);
3336
3345
  this.columnFilterButton = this.getInitValue('columnFilterButton', props.columnFilterButton, this.columnFilterButton);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/teknisa-components-common",
3
- "version": "1.80.0",
3
+ "version": "1.81.0",
4
4
  "description": "Teknisa Components Common",
5
5
  "author": "Zeedhi <zeedhi@teknisa.com>",
6
6
  "license": "ISC",
@@ -31,5 +31,5 @@
31
31
  "peerDependencies": {
32
32
  "@zeedhi/core": "*"
33
33
  },
34
- "gitHead": "34e08ad2e8bf0d91e064f456fca003b73afba2dd"
34
+ "gitHead": "98bdfb4f56d94f0477a1611b6db70895f7176c9d"
35
35
  }
@@ -14,6 +14,8 @@ describe('GridController', () => {
14
14
  deleteButton: 'currentRow',
15
15
  filterButton: true,
16
16
  columnsButton: true,
17
+ editing: true,
18
+ showEditButtons: false,
17
19
  modalFilterProps: {
18
20
  name: 'name',
19
21
  height: 'auto',
@@ -24,8 +26,8 @@ describe('GridController', () => {
24
26
  showReloadButton: true,
25
27
  actions: [{ name: 'button', component: 'ZdButton' }],
26
28
  });
29
+ grid.editing = true;
27
30
  const instance = new GridController(grid);
28
-
29
31
  expect(instance.gridTitle).toBe('title');
30
32
  expect(instance.showAddButton).toBeFalsy();
31
33
  expect(instance.showDeleteButton).toBeTruthy();
@@ -41,8 +43,9 @@ describe('GridController', () => {
41
43
  expect(instance.showLayoutOptionsButton).toBeTruthy();
42
44
  expect(instance.showReloadButton).toBeTruthy();
43
45
  expect(instance.showDivider1).toBeTruthy();
44
- expect(instance.isEditing).toBeFalsy();
45
- expect(instance.isNotEditing).toBeTruthy();
46
+ expect(instance.isEditing).toBeTruthy();
47
+ expect(instance.isNotEditing).toBeFalsy();
48
+ expect(instance.showEditButtons).toBeFalsy();
46
49
  expect(instance.disableDeleteButton).toBeTruthy();
47
50
  expect(instance.showModalFilterProps).toEqual(
48
51
  expect.objectContaining({
@@ -9,6 +9,7 @@ export declare class TekGrid extends GridEditable implements ITekGrid {
9
9
  addButton: boolean;
10
10
  deleteButton: 'none' | 'currentRow' | 'selection';
11
11
  actions: IComponentRender[];
12
+ showEditButtons: boolean;
12
13
  filterButton: boolean;
13
14
  showSearch: boolean;
14
15
  columnFilterButton: boolean;
@@ -39,6 +39,7 @@ export interface ITekGrid extends IGridEditable {
39
39
  columnsButtonIgnore?: string[];
40
40
  deleteButton?: 'none' | 'currentRow' | 'selection';
41
41
  events?: ITekGridEvents;
42
+ showEditButtons?: boolean;
42
43
  filterButton?: boolean;
43
44
  modalFilterProps?: IModalFilterProps;
44
45
  showSearch?: boolean;
@@ -16,6 +16,7 @@ export interface ITekTreeGrid extends ITreeGridEditable {
16
16
  showLayoutOptions?: boolean;
17
17
  title?: string;
18
18
  showExport?: boolean;
19
+ showEditButtons?: boolean;
19
20
  showReload?: boolean;
20
21
  exportConfig?: ITekGridExportConfig[];
21
22
  exportActions?: IComponentRender[];
@@ -8,6 +8,7 @@ import { TekGridLayoutOptions } from '..';
8
8
  export declare class TekTreeGrid extends TreeGridEditable implements ITekTreeGrid {
9
9
  title: string;
10
10
  addButton: boolean;
11
+ showEditButtons: boolean;
11
12
  deleteButton: 'none' | 'currentRow' | 'selection';
12
13
  actions: IComponentRender[];
13
14
  filterButton: boolean;
@@ -20,6 +20,7 @@ export declare class GridController {
20
20
  get showActionAndExportButton(): boolean | undefined;
21
21
  get showDivider3(): boolean | undefined;
22
22
  get isEditing(): boolean;
23
+ get showEditButtons(): boolean;
23
24
  get isNotEditing(): boolean;
24
25
  get disableDeleteButton(): boolean;
25
26
  }