@gravity-ui/dynamic-forms 4.8.0 → 4.9.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.
|
@@ -8,11 +8,14 @@ const uikit_1 = require("@gravity-ui/uikit");
|
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const b = (0, utils_1.block)('long-value');
|
|
10
10
|
const LongValue = (_a) => {
|
|
11
|
-
var { value, className } = _a, restProps = tslib_1.__rest(_a, ["value", "className"]);
|
|
11
|
+
var { value, onClick, className } = _a, restProps = tslib_1.__rest(_a, ["value", "onClick", "className"]);
|
|
12
12
|
const ref = react_1.default.useRef(null);
|
|
13
13
|
const [open, setOpen] = react_1.default.useState(false);
|
|
14
14
|
const [long, setLong] = react_1.default.useState(false);
|
|
15
|
-
const handleClick = react_1.default.useCallback(() =>
|
|
15
|
+
const handleClick = react_1.default.useCallback((e) => {
|
|
16
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
17
|
+
setOpen((f) => !f);
|
|
18
|
+
}, [setOpen, onClick]);
|
|
16
19
|
react_1.default.useEffect(() => {
|
|
17
20
|
if (ref.current) {
|
|
18
21
|
const { offsetWidth, scrollWidth } = ref.current;
|
|
@@ -3,5 +3,6 @@ import { type TextProps } from '@gravity-ui/uikit';
|
|
|
3
3
|
import './LongValue.css';
|
|
4
4
|
export interface LongValueProps extends TextProps {
|
|
5
5
|
value?: string | number | boolean;
|
|
6
|
+
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
6
7
|
}
|
|
7
8
|
export declare const LongValue: React.FC<LongValueProps>;
|
|
@@ -6,11 +6,14 @@ import { block } from '../../utils';
|
|
|
6
6
|
import './LongValue.css';
|
|
7
7
|
const b = block('long-value');
|
|
8
8
|
export const LongValue = (_a) => {
|
|
9
|
-
var { value, className } = _a, restProps = __rest(_a, ["value", "className"]);
|
|
9
|
+
var { value, onClick, className } = _a, restProps = __rest(_a, ["value", "onClick", "className"]);
|
|
10
10
|
const ref = React.useRef(null);
|
|
11
11
|
const [open, setOpen] = React.useState(false);
|
|
12
12
|
const [long, setLong] = React.useState(false);
|
|
13
|
-
const handleClick = React.useCallback(() =>
|
|
13
|
+
const handleClick = React.useCallback((e) => {
|
|
14
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
15
|
+
setOpen((f) => !f);
|
|
16
|
+
}, [setOpen, onClick]);
|
|
14
17
|
React.useEffect(() => {
|
|
15
18
|
if (ref.current) {
|
|
16
19
|
const { offsetWidth, scrollWidth } = ref.current;
|