@zeedhi/teknisa-components-common 1.48.0 → 1.53.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.
@@ -1306,6 +1306,7 @@ class GridBase {
1306
1306
  }
1307
1307
  datasource.searchJoin = searchJoin;
1308
1308
  }
1309
+ datasource.page = 1;
1309
1310
  return datasource.setSearch(search);
1310
1311
  });
1311
1312
  }
@@ -1311,6 +1311,7 @@
1311
1311
  }
1312
1312
  datasource.searchJoin = searchJoin;
1313
1313
  }
1314
+ datasource.page = 1;
1314
1315
  return datasource.setSearch(search);
1315
1316
  });
1316
1317
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/teknisa-components-common",
3
- "version": "1.48.0",
3
+ "version": "1.53.0",
4
4
  "description": "Teknisa Components Common",
5
5
  "author": "Zeedhi <zeedhi@teknisa.com>",
6
6
  "license": "ISC",
@@ -29,5 +29,5 @@
29
29
  "peerDependencies": {
30
30
  "@zeedhi/core": "*"
31
31
  },
32
- "gitHead": "2b74af72b5bfd6159d947cba0beb3c990218f093"
32
+ "gitHead": "302c68b7d95c3b2592a24c199320ae520f44b38b"
33
33
  }
@@ -0,0 +1,5 @@
1
+ import { Component } from '@zeedhi/common';
2
+
3
+ const setClick = (instance: Component, event: any = {}) => instance.click(event, {});
4
+
5
+ export { setClick };
@@ -0,0 +1,27 @@
1
+ import { IComponent } from '@zeedhi/common';
2
+
3
+ /**
4
+ * Search for a component inside an array of children
5
+ *
6
+ * The children array can be either an array of IComponent or an array of Component
7
+ */
8
+ const getChild = <T extends IComponent>(children: any[], name: string): T => {
9
+ let found: any;
10
+
11
+ children.forEach((child) => {
12
+ if (child.name === name) {
13
+ found = child;
14
+ return;
15
+ }
16
+
17
+ if (child.children && child.children.length > 0) {
18
+ const result = getChild<T>(child.children, name) as T;
19
+
20
+ if (result) found = result;
21
+ }
22
+ });
23
+
24
+ return found;
25
+ };
26
+
27
+ export { getChild };
@@ -0,0 +1,3 @@
1
+ export * from './component-event-helper';
2
+ export * from './get-child-helper';
3
+ export * from './mock-created-helper';
@@ -1,8 +1,10 @@
1
1
  import { ComponentRender } from '@zeedhi/common';
2
- import { UserInfo } from '@zeedhi/zd-user-info-common';
3
2
 
4
- const mockCreated = (component: ComponentRender) => {
5
- jest.spyOn(UserInfo.prototype, 'onCreated').mockImplementation(() => {
3
+ /**
4
+ * Function used to spy on a class' onCreated and always assign the componentId as 1
5
+ */
6
+ const mockCreated = <T extends ComponentRender>(component: T, prototype: any) => {
7
+ jest.spyOn(prototype, 'onCreated').mockImplementation(() => {
6
8
  component.componentId = 1;
7
9
  });
8
10
  };