@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 +1 -1
- package/utils/adjust-textarea-height.js +4 -5
- package/utils/omit.d.ts +1 -0
- package/utils/omit.js +10 -0
- package/utils/omit.test.d.ts +1 -0
- package/utils/omit.test.js +9 -0
package/package.json
CHANGED
|
@@ -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
|
|
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(
|
|
12
|
-
if (element.clientHeight - lineHeight <=
|
|
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(
|
|
16
|
+
element.style.height = Math.max(minRowsHeight, element.scrollHeight) + "px";
|
|
18
17
|
}
|
|
19
18
|
else {
|
|
20
19
|
element.style.height = "auto";
|
package/utils/omit.d.ts
ADDED
|
@@ -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 @@
|
|
|
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
|
+
});
|