ag-common 0.0.718 → 0.0.720

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.
@@ -31,8 +31,12 @@ exports.arrayToObject = arrayToObject;
31
31
  const flat = (arr) => [].concat(...arr);
32
32
  exports.flat = flat;
33
33
  const take = (array, num) => {
34
- const ret = JSON.parse(JSON.stringify(array));
35
- return { part: ret.slice(0, num), rest: ret.slice(num) };
34
+ // Ensure num is within the bounds of the array
35
+ const safeNum = Math.max(0, Math.min(num, array.length));
36
+ // Use array.slice() to create shallow copies of the parts we need
37
+ const part = array.slice(0, safeNum);
38
+ const rest = array.slice(safeNum);
39
+ return { part, rest };
36
40
  };
37
41
  exports.take = take;
38
42
  const chunk = (array, max) => {
@@ -24,6 +24,7 @@ function isJson(str) {
24
24
  }
25
25
  exports.isJson = isJson;
26
26
  const objectKeysToLowerCase = (origObj) => {
27
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
27
28
  if (!origObj || Object.keys(origObj).length === 0) {
28
29
  return {};
29
30
  }
@@ -42,6 +43,7 @@ exports.objectKeysToLowerCase = objectKeysToLowerCase;
42
43
  const getObjectKeysAsNumber = (o) => Object.keys(o).map((o2) => parseInt(o2, 10));
43
44
  exports.getObjectKeysAsNumber = getObjectKeysAsNumber;
44
45
  function objectToArray(obj) {
46
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
45
47
  if (!obj) {
46
48
  return [];
47
49
  }
@@ -108,6 +110,7 @@ function objectToString(obj,
108
110
  joinKeyValue,
109
111
  /** eg '&' */
110
112
  joinKeys) {
113
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
111
114
  if (!obj || Object.keys(obj).length === 0) {
112
115
  return '';
113
116
  }
@@ -36,6 +36,12 @@ function fetchFile(p) {
36
36
  yield write();
37
37
  });
38
38
  yield write();
39
+ try {
40
+ fileStream.close();
41
+ }
42
+ catch (e) {
43
+ //
44
+ }
39
45
  });
40
46
  }
41
47
  exports.fetchFile = fetchFile;
@@ -32,7 +32,7 @@ const react_1 = __importStar(require("react"));
32
32
  const react_dom_1 = require("react-dom");
33
33
  const Base = styled_1.default.div `
34
34
  position: absolute;
35
- z-index: 2;
35
+ z-index: 10;
36
36
  `;
37
37
  const Comp = ({ pos, children, }) => {
38
38
  const ref = (0, react_1.createRef)();
@@ -72,6 +72,9 @@ const Comp = ({ pos, children, }) => {
72
72
  if (pos.hasParent) {
73
73
  top = undefined;
74
74
  }
75
+ else {
76
+ top = pos.parentHeight - size.tooltipHeight;
77
+ }
75
78
  bottom = pos.parentHeight - pos.y;
76
79
  }
77
80
  if (right && right + size.tooltipWidth > pos.parentWidth) {
@@ -90,7 +93,7 @@ const Comp = ({ pos, children, }) => {
90
93
  const Content = (react_1.default.createElement(Base, { "data-type": "tooltip-content", ref: ref, style: Object.assign(Object.assign({ left,
91
94
  right,
92
95
  top,
93
- bottom, zIndex: 10, overflow: 'hidden' }, (!pos.hasParent && { position: 'fixed' })), (!size && { zIndex: -1 })) }, children(pos, size)));
96
+ bottom }, (!pos.hasParent && { position: 'fixed' })), (!size && { zIndex: -1 })) }, children(pos, size)));
94
97
  const e = document.querySelector(`#${pos.portalId}`);
95
98
  if (!pos.hasParent && e) {
96
99
  return (0, react_dom_1.createPortal)(Content, e);
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.718",
2
+ "version": "0.0.720",
3
3
  "name": "ag-common",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",