@zeedhi/teknisa-components-common 1.100.1 → 1.101.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.
@@ -2345,6 +2345,9 @@ class TekGrid extends GridEditable {
2345
2345
  return undefined;
2346
2346
  return Metadata.getInstance(`${this.name}_layout_options`);
2347
2347
  }
2348
+ instantiateCancelColumn() {
2349
+ return new TekGridColumn(this.getCancelColumnProps(), this);
2350
+ }
2348
2351
  /**
2349
2352
  * Get Grid columns objects
2350
2353
  * @param columns Grid columns parameter
@@ -2349,6 +2349,9 @@
2349
2349
  return undefined;
2350
2350
  return core.Metadata.getInstance(`${this.name}_layout_options`);
2351
2351
  }
2352
+ instantiateCancelColumn() {
2353
+ return new TekGridColumn(this.getCancelColumnProps(), this);
2354
+ }
2352
2355
  /**
2353
2356
  * Get Grid columns objects
2354
2357
  * @param columns Grid columns parameter
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/teknisa-components-common",
3
- "version": "1.100.1",
3
+ "version": "1.101.1",
4
4
  "description": "Teknisa Components Common",
5
5
  "author": "Zeedhi <zeedhi@teknisa.com>",
6
6
  "license": "ISC",
@@ -32,5 +32,5 @@
32
32
  "peerDependencies": {
33
33
  "@zeedhi/core": "~1.97.0"
34
34
  },
35
- "gitHead": "ab5303595a8ea77628401599164a96f9fd24dc77"
35
+ "gitHead": "a8d0f3b98cda9cb8821f09e49bdef77d3ba67014"
36
36
  }
@@ -2516,4 +2516,33 @@ describe('TekGrid', () => {
2516
2516
  expect(instance.isColumnSearchable(column)).toBeTruthy();
2517
2517
  });
2518
2518
  });
2519
+
2520
+ describe('cancel column', () => {
2521
+ it('should instantiate grid with a cancel column', () => {
2522
+ const grid = new TekGrid({
2523
+ name: 'grid',
2524
+ component: 'TekGrid',
2525
+ showCancelColumn: true,
2526
+ columns: [
2527
+ { name: 'name' },
2528
+ ],
2529
+ datasource: { data: [{ id: '1' }], uniqueKey: 'id' },
2530
+ });
2531
+ const spy = jest.fn();
2532
+ grid.cancelAddedRow = spy;
2533
+
2534
+ expect(grid.columns.length).toBe(2);
2535
+ expect(grid.columns[1].name).toBe('cancel_action_grid');
2536
+
2537
+ const comp: any = grid.getActionComponent(
2538
+ grid.columns[1].children[0],
2539
+ grid.columns[1],
2540
+ grid.datasource.data[0],
2541
+ );
2542
+ const btn = new Button(comp);
2543
+ btn.click();
2544
+
2545
+ expect(spy).toHaveBeenCalledTimes(1);
2546
+ });
2547
+ });
2519
2548
  });
@@ -90,6 +90,7 @@ export declare class TekGrid extends GridEditable implements ITekGrid {
90
90
  onBeforeDestroy(): void;
91
91
  protected focusSearchInput(): void;
92
92
  get layoutOptions(): TekGridLayoutOptions | undefined;
93
+ protected instantiateCancelColumn(): TekGridColumn;
93
94
  /**
94
95
  * Get Grid columns objects
95
96
  * @param columns Grid columns parameter