@zeedhi/teknisa-components-common 1.86.1 → 1.87.1

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.
@@ -955,6 +955,9 @@ class GridBase {
955
955
  ];
956
956
  }
957
957
  addButtonClick({ event }) {
958
+ if (this.grid.editNewRowsOnly) {
959
+ this.grid.editingNewRows = true;
960
+ }
958
961
  this.grid.callEvent('addClick', { component: this.grid, event });
959
962
  }
960
963
  deleteButtonClick({ event }) {
@@ -976,14 +979,22 @@ class GridBase {
976
979
  saveChanges({ event }) {
977
980
  this.grid.callEvent('beforeSave', { component: this.grid, event });
978
981
  if (!event.defaultPrevented) {
979
- this.grid.saveEditedRows();
982
+ const save = (() => __awaiter(this, void 0, void 0, function* () {
983
+ yield this.grid.saveEditedRows();
984
+ this.grid.editingNewRows = false;
985
+ }));
986
+ save();
980
987
  this.grid.callEvent('afterSave', { component: this.grid });
981
988
  }
982
989
  }
983
990
  cancelChanges({ event }) {
984
991
  this.grid.callEvent('beforeCancel', { component: this.grid, event });
985
992
  if (!event.defaultPrevented) {
986
- this.grid.cancelEditedRows();
993
+ const cancel = (() => __awaiter(this, void 0, void 0, function* () {
994
+ yield this.grid.cancelEditedRows();
995
+ this.grid.editingNewRows = false;
996
+ }));
997
+ cancel();
987
998
  this.grid.callEvent('afterCancel', { component: this.grid });
988
999
  }
989
1000
  }
@@ -2415,6 +2426,7 @@ class TekGrid extends GridEditable {
2415
2426
  this.groupColumns = [];
2416
2427
  this.groupedData = [];
2417
2428
  this.toolbarSlotProps = false;
2429
+ this.editNewRowsOnly = false;
2418
2430
  this.defaultLazy = false;
2419
2431
  this.groups = [];
2420
2432
  this.summary = {};
@@ -2445,6 +2457,7 @@ class TekGrid extends GridEditable {
2445
2457
  this.exportActions = props.exportActions || this.exportActions;
2446
2458
  this.groupsOpened = this.getInitValue('groupsOpened', props.groupsOpened, this.groupsOpened);
2447
2459
  this.showSummaryTotal = this.getInitValue('showSummaryTotal', props.showSummaryTotal, this.showSummaryTotal);
2460
+ this.editNewRowsOnly = this.getInitValue('editNewRowsOnly', props.editNewRowsOnly, this.editNewRowsOnly);
2448
2461
  this.mainGrid = this.getInitValue('mainGrid', props.mainGrid, this.mainGrid);
2449
2462
  this.actions = props.actions || this.actions;
2450
2463
  this.toolbarSlotProps = props.toolbarSlot !== undefined;
@@ -960,6 +960,9 @@
960
960
  ];
961
961
  }
962
962
  addButtonClick({ event }) {
963
+ if (this.grid.editNewRowsOnly) {
964
+ this.grid.editingNewRows = true;
965
+ }
963
966
  this.grid.callEvent('addClick', { component: this.grid, event });
964
967
  }
965
968
  deleteButtonClick({ event }) {
@@ -981,14 +984,22 @@
981
984
  saveChanges({ event }) {
982
985
  this.grid.callEvent('beforeSave', { component: this.grid, event });
983
986
  if (!event.defaultPrevented) {
984
- this.grid.saveEditedRows();
987
+ const save = (() => __awaiter(this, void 0, void 0, function* () {
988
+ yield this.grid.saveEditedRows();
989
+ this.grid.editingNewRows = false;
990
+ }));
991
+ save();
985
992
  this.grid.callEvent('afterSave', { component: this.grid });
986
993
  }
987
994
  }
988
995
  cancelChanges({ event }) {
989
996
  this.grid.callEvent('beforeCancel', { component: this.grid, event });
990
997
  if (!event.defaultPrevented) {
991
- this.grid.cancelEditedRows();
998
+ const cancel = (() => __awaiter(this, void 0, void 0, function* () {
999
+ yield this.grid.cancelEditedRows();
1000
+ this.grid.editingNewRows = false;
1001
+ }));
1002
+ cancel();
992
1003
  this.grid.callEvent('afterCancel', { component: this.grid });
993
1004
  }
994
1005
  }
@@ -2420,6 +2431,7 @@
2420
2431
  this.groupColumns = [];
2421
2432
  this.groupedData = [];
2422
2433
  this.toolbarSlotProps = false;
2434
+ this.editNewRowsOnly = false;
2423
2435
  this.defaultLazy = false;
2424
2436
  this.groups = [];
2425
2437
  this.summary = {};
@@ -2450,6 +2462,7 @@
2450
2462
  this.exportActions = props.exportActions || this.exportActions;
2451
2463
  this.groupsOpened = this.getInitValue('groupsOpened', props.groupsOpened, this.groupsOpened);
2452
2464
  this.showSummaryTotal = this.getInitValue('showSummaryTotal', props.showSummaryTotal, this.showSummaryTotal);
2465
+ this.editNewRowsOnly = this.getInitValue('editNewRowsOnly', props.editNewRowsOnly, this.editNewRowsOnly);
2453
2466
  this.mainGrid = this.getInitValue('mainGrid', props.mainGrid, this.mainGrid);
2454
2467
  this.actions = props.actions || this.actions;
2455
2468
  this.toolbarSlotProps = props.toolbarSlot !== undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/teknisa-components-common",
3
- "version": "1.86.1",
3
+ "version": "1.87.1",
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": "b54e5e96828000e083117c116900a0467a72aeae"
34
+ "gitHead": "c2f902e06ac4f4a54e5ba6e00910af289ae218ec"
35
35
  }
@@ -563,6 +563,7 @@ describe('TekGrid', () => {
563
563
  name: 'grid_addClick1',
564
564
  component: 'TekGrid',
565
565
  addButton: true,
566
+ editNewRowsOnly: true,
566
567
  });
567
568
 
568
569
  instance.onCreated();
@@ -578,6 +579,7 @@ describe('TekGrid', () => {
578
579
  instance.events = {
579
580
  addClick: () => { addClickCalled = true; },
580
581
  };
582
+ expect(instance.editingNewRows).toBeTruthy();
581
583
  button.click(event, {} as HTMLElement);
582
584
  expect(addClickCalled).toBeTruthy();
583
585
  expect(button.isVisible).toBeTruthy();
@@ -70,6 +70,7 @@ export declare class TekGrid extends GridEditable implements ITekGrid {
70
70
  private gridBase;
71
71
  filterRelationsDatasource: Datasource;
72
72
  filterOperationsDatasource: Datasource;
73
+ editNewRowsOnly: boolean;
73
74
  protected keyShortcutKeyMapping: any;
74
75
  /**
75
76
  * TekGrid class constructor