@gravity-ui/dynamic-forms 4.7.0 → 4.7.2
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/build/cjs/lib/kit/components/CopyButton/CopyButton.css +8 -1
- package/build/cjs/lib/kit/components/CopyButton/CopyButton.js +2 -1
- package/build/cjs/lib/kit/components/LongValue/LongValue.css +6 -3
- package/build/cjs/lib/kit/components/LongValue/LongValue.js +3 -11
- package/build/esm/lib/kit/components/CopyButton/CopyButton.css +8 -1
- package/build/esm/lib/kit/components/CopyButton/CopyButton.js +2 -1
- package/build/esm/lib/kit/components/LongValue/LongValue.css +6 -3
- package/build/esm/lib/kit/components/LongValue/LongValue.js +3 -11
- package/package.json +3 -3
|
@@ -13,7 +13,8 @@ const b = (0, utils_1.block)('copy-button');
|
|
|
13
13
|
*/
|
|
14
14
|
const CopyButton = ({ spec, value }) => {
|
|
15
15
|
if (((0, core_1.isStringSpec)(spec) || (0, core_1.isNumberSpec)(spec)) && spec.viewSpec.copy) {
|
|
16
|
-
return react_1.default.createElement(
|
|
16
|
+
return (react_1.default.createElement("div", { className: b() },
|
|
17
|
+
react_1.default.createElement(uikit_1.ClipboardButton, { className: b('button'), text: `${value}`, size: "xs" })));
|
|
17
18
|
}
|
|
18
19
|
return null;
|
|
19
20
|
};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
.df-long-value {
|
|
2
2
|
max-width: 100%;
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
text-overflow: ellipsis;
|
|
5
|
+
}
|
|
6
|
+
.df-long-value_open {
|
|
7
|
+
white-space: pre-wrap;
|
|
8
|
+
word-wrap: break-word;
|
|
3
9
|
}
|
|
4
10
|
.df-long-value_long {
|
|
5
11
|
cursor: pointer;
|
|
6
12
|
}
|
|
7
13
|
.df-long-value_long:hover {
|
|
8
14
|
color: var(--g-color-text-secondary);
|
|
9
|
-
}
|
|
10
|
-
.df-long-value__container {
|
|
11
|
-
display: flex;
|
|
12
15
|
}
|
|
@@ -12,15 +12,6 @@ const LongValue = ({ value, className }) => {
|
|
|
12
12
|
const [open, setOpen] = react_1.default.useState(false);
|
|
13
13
|
const [long, setLong] = react_1.default.useState(false);
|
|
14
14
|
const handleClick = react_1.default.useCallback(() => setOpen((f) => !f), [setOpen]);
|
|
15
|
-
const currentTextProperies = react_1.default.useMemo(() => {
|
|
16
|
-
let wordBreak;
|
|
17
|
-
let whiteSpace;
|
|
18
|
-
if (open) {
|
|
19
|
-
wordBreak = 'break-all';
|
|
20
|
-
whiteSpace = 'break-spaces';
|
|
21
|
-
}
|
|
22
|
-
return { wordBreak, whiteSpace };
|
|
23
|
-
}, [open]);
|
|
24
15
|
react_1.default.useEffect(() => {
|
|
25
16
|
if (ref.current) {
|
|
26
17
|
if (value !== prevValue.current) {
|
|
@@ -42,7 +33,8 @@ const LongValue = ({ value, className }) => {
|
|
|
42
33
|
}
|
|
43
34
|
}
|
|
44
35
|
});
|
|
45
|
-
return (react_1.default.createElement(
|
|
46
|
-
|
|
36
|
+
return (react_1.default.createElement(uikit_1.Text, { as: "div", ref: ref, className: b({ open, long }, className),
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
onClick: long ? handleClick : undefined }, value));
|
|
47
39
|
};
|
|
48
40
|
exports.LongValue = LongValue;
|
|
@@ -10,7 +10,8 @@ const b = block('copy-button');
|
|
|
10
10
|
*/
|
|
11
11
|
export const CopyButton = ({ spec, value }) => {
|
|
12
12
|
if ((isStringSpec(spec) || isNumberSpec(spec)) && spec.viewSpec.copy) {
|
|
13
|
-
return React.createElement(
|
|
13
|
+
return (React.createElement("div", { className: b() },
|
|
14
|
+
React.createElement(ClipboardButton, { className: b('button'), text: `${value}`, size: "xs" })));
|
|
14
15
|
}
|
|
15
16
|
return null;
|
|
16
17
|
};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
.df-long-value {
|
|
2
2
|
max-width: 100%;
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
text-overflow: ellipsis;
|
|
5
|
+
}
|
|
6
|
+
.df-long-value_open {
|
|
7
|
+
white-space: pre-wrap;
|
|
8
|
+
word-wrap: break-word;
|
|
3
9
|
}
|
|
4
10
|
.df-long-value_long {
|
|
5
11
|
cursor: pointer;
|
|
6
12
|
}
|
|
7
13
|
.df-long-value_long:hover {
|
|
8
14
|
color: var(--g-color-text-secondary);
|
|
9
|
-
}
|
|
10
|
-
.df-long-value__container {
|
|
11
|
-
display: flex;
|
|
12
15
|
}
|
|
@@ -9,15 +9,6 @@ export const LongValue = ({ value, className }) => {
|
|
|
9
9
|
const [open, setOpen] = React.useState(false);
|
|
10
10
|
const [long, setLong] = React.useState(false);
|
|
11
11
|
const handleClick = React.useCallback(() => setOpen((f) => !f), [setOpen]);
|
|
12
|
-
const currentTextProperies = React.useMemo(() => {
|
|
13
|
-
let wordBreak;
|
|
14
|
-
let whiteSpace;
|
|
15
|
-
if (open) {
|
|
16
|
-
wordBreak = 'break-all';
|
|
17
|
-
whiteSpace = 'break-spaces';
|
|
18
|
-
}
|
|
19
|
-
return { wordBreak, whiteSpace };
|
|
20
|
-
}, [open]);
|
|
21
12
|
React.useEffect(() => {
|
|
22
13
|
if (ref.current) {
|
|
23
14
|
if (value !== prevValue.current) {
|
|
@@ -39,6 +30,7 @@ export const LongValue = ({ value, className }) => {
|
|
|
39
30
|
}
|
|
40
31
|
}
|
|
41
32
|
});
|
|
42
|
-
return (React.createElement(
|
|
43
|
-
|
|
33
|
+
return (React.createElement(Text, { as: "div", ref: ref, className: b({ open, long }, className),
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
onClick: long ? handleClick : undefined }, value));
|
|
44
36
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/dynamic-forms",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "build/cjs/index.js",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@bem-react/classname": "^1.6.0",
|
|
47
47
|
"@gravity-ui/components": "^3.0.0",
|
|
48
|
-
"@gravity-ui/date-components": "^2.
|
|
49
|
-
"@gravity-ui/date-utils": "^2.
|
|
48
|
+
"@gravity-ui/date-components": "^2.4.0",
|
|
49
|
+
"@gravity-ui/date-utils": "^2.4.0",
|
|
50
50
|
"@gravity-ui/i18n": "^1.2.0",
|
|
51
51
|
"@gravity-ui/icons": "^2.8.1",
|
|
52
52
|
"lodash": "^4.17.20"
|