@azrico/reactgrid 1.3.49 → 1.3.50

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.
@@ -5,24 +5,24 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.fix_parent_child_relations = fix_parent_child_relations;
7
7
  exports.func_selection = void 0;
8
- function get_parentId(obj) {
8
+ function getParentId(obj) {
9
9
  var _ref, _obj$__parent__table_;
10
- return (_ref = (_obj$__parent__table_ = obj.__parent__table_id) !== null && _obj$__parent__table_ !== void 0 ? _obj$__parent__table_ : obj.parent) !== null && _ref !== void 0 ? _ref : obj.parentid;
10
+ return (_ref = (_obj$__parent__table_ = obj.__parent__table_id) !== null && _obj$__parent__table_ !== void 0 ? _obj$__parent__table_ : obj.parentid) !== null && _ref !== void 0 ? _ref : obj.parent;
11
11
  }
12
- function get_selfId(obj) {
12
+ function getSelfId(obj) {
13
13
  var _obj$__table_id;
14
14
  return (_obj$__table_id = obj.__table_id) !== null && _obj$__table_id !== void 0 ? _obj$__table_id : obj._id;
15
15
  }
16
16
  //given an array of rows, fixes parent,child relations
17
17
  function fix_parent_child_relations(rows) {
18
18
  if (!Array.isArray(rows)) rows = [];
19
- const anyparentid = rows.find(r => get_parentId(r));
20
- const anyselfid = rows.find(r => get_selfId(r));
19
+ const anyparentid = rows.find(r => getParentId(r));
20
+ const anyselfid = rows.find(r => getSelfId(r));
21
21
  if (!anyparentid || !anyselfid) return rows;
22
22
  const converted_rows = rows.filter(r => r != null).map(r => {
23
23
  return {
24
- parent: get_parentId(r),
25
- self: get_selfId(r),
24
+ parent: getParentId(r),
25
+ self: getSelfId(r),
26
26
  data: r
27
27
  };
28
28
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/reactgrid",
3
- "version": "1.3.49",
3
+ "version": "1.3.50",
4
4
  "main": "dist/index.js",
5
5
  "description": "React Datagrid",
6
6
  "author": "Azrideus <MehrdadTavangar@gmail.com>",
@@ -1,23 +1,23 @@
1
1
  type mrow = { __parent__table_id: any; __table_id: any; __children?: any[] };
2
2
  type converted_row = { parent: any; self: any; data: mrow };
3
3
 
4
- function get_parentId(obj) {
5
- return obj.__parent__table_id ?? obj.parent ?? obj.parentid;
4
+ function getParentId(obj) {
5
+ return obj.__parent__table_id ?? obj.parentid ?? obj.parent;
6
6
  }
7
- function get_selfId(obj) {
7
+ function getSelfId(obj) {
8
8
  return obj.__table_id ?? obj._id;
9
9
  }
10
10
  //given an array of rows, fixes parent,child relations
11
11
  export function fix_parent_child_relations<T extends mrow>(rows: T[]): T[] {
12
12
  if (!Array.isArray(rows)) rows = [];
13
- const anyparentid = rows.find((r) => get_parentId(r));
14
- const anyselfid = rows.find((r) => get_selfId(r));
13
+ const anyparentid = rows.find((r) => getParentId(r));
14
+ const anyselfid = rows.find((r) => getSelfId(r));
15
15
  if (!anyparentid || !anyselfid) return rows;
16
16
 
17
17
  const converted_rows: converted_row[] = rows
18
18
  .filter((r) => r != null)
19
19
  .map((r) => {
20
- return { parent: get_parentId(r), self: get_selfId(r), data: r };
20
+ return { parent: getParentId(r), self: getSelfId(r), data: r };
21
21
  });
22
22
 
23
23
  const top_level_rows: converted_row[] = converted_rows.filter((r) => !r.parent);