@uxf/core 11.54.0 → 11.58.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/core",
3
- "version": "11.54.0",
3
+ "version": "11.58.0",
4
4
  "description": "UXF Core",
5
5
  "author": "Petr Vejvoda <vejvoda@uxf.cz>",
6
6
  "homepage": "https://gitlab.com/uxf-npm/core#readme",
@@ -4,17 +4,16 @@ exports.adjustTextareaHeight = adjustTextareaHeight;
4
4
  function setHeightByContent(element, shouldShrink, rows = 4) {
5
5
  if (rows >= 1) {
6
6
  const lineHeight = parseFloat(window.getComputedStyle(element).getPropertyValue("line-height"));
7
- const fontSize = parseFloat(window.getComputedStyle(element).getPropertyValue("font-size"));
8
- const targetHeight = parseInt((rows * fontSize * (lineHeight / fontSize)).toFixed(3), 10);
7
+ const minRowsHeight = parseInt((rows * lineHeight).toFixed(3), 10);
9
8
  if (shouldShrink) {
10
9
  while (element.scrollHeight <= element.clientHeight) {
11
- element.style.height = Math.max(targetHeight, element.scrollHeight - lineHeight) + "px";
12
- if (element.clientHeight - lineHeight <= targetHeight) {
10
+ element.style.height = Math.max(minRowsHeight, element.scrollHeight - lineHeight) + "px";
11
+ if (element.clientHeight - lineHeight <= minRowsHeight) {
13
12
  break;
14
13
  }
15
14
  }
16
15
  }
17
- element.style.height = Math.max(targetHeight, element.scrollHeight) + "px";
16
+ element.style.height = Math.max(minRowsHeight, element.scrollHeight) + "px";
18
17
  }
19
18
  else {
20
19
  element.style.height = "auto";
@@ -0,0 +1 @@
1
+ export declare function omit<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
package/utils/omit.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.omit = omit;
4
+ function omit(obj, keys) {
5
+ const result = { ...obj };
6
+ for (const key of keys) {
7
+ delete result[key];
8
+ }
9
+ return result;
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const omit_1 = require("./omit");
4
+ describe("omit function", () => {
5
+ it("basic usage", () => {
6
+ const result = (0, omit_1.omit)({ a: "1", b: "2" }, ["a"]);
7
+ expect(result).toEqual({ b: "2" });
8
+ });
9
+ });