taro-react-uilib 1.3.0-1 → 1.3.0-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/CHANGELOG.md +9 -0
- package/dist/components/Collapse/index.js +1 -1
- package/dist/components/Collapse/index.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/lib/components/Collapse/index.js +7 -12
- package/lib/components/Collapse/index.js.map +1 -1
- package/package.json +1 -1
- package/types/components/Collapse/index.d.ts +1 -2
|
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import React, {
|
|
12
|
+
import React, { useMemo, useRef, useState } from "react";
|
|
13
13
|
import List from "@/components/List";
|
|
14
14
|
import { View } from "@tarojs/components";
|
|
15
15
|
import classNames from "classnames";
|
|
@@ -21,29 +21,24 @@ const Collapse = props => {
|
|
|
21
21
|
const handleOnchange = () => {
|
|
22
22
|
setInneropen(old => !old);
|
|
23
23
|
};
|
|
24
|
-
const [originHeight, setoriginHeight] = useState(0); // 原始高度
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
var _a;
|
|
27
|
-
if (detailRef.current && process.env.TARO_ENV === "h5") {
|
|
28
|
-
setoriginHeight((_a = detailRef.current) === null || _a === void 0 ? void 0 : _a.scrollHeight);
|
|
29
|
-
}
|
|
30
|
-
}, [detailRef.current]);
|
|
31
24
|
const detailStyle = useMemo(() => {
|
|
32
|
-
var _a;
|
|
25
|
+
var _a, _b;
|
|
33
26
|
const style = { height: 0 };
|
|
34
27
|
if (innerOpen)
|
|
35
28
|
style.height =
|
|
36
|
-
process.env.TARO_ENV === "h5"
|
|
29
|
+
process.env.TARO_ENV === "h5"
|
|
30
|
+
? `${(_a = detailRef.current) === null || _a === void 0 ? void 0 : _a.scrollHeight}px`
|
|
31
|
+
: "auto";
|
|
37
32
|
process.env.TARO_ENV === "h5" &&
|
|
38
33
|
innerOpen &&
|
|
39
|
-
((
|
|
34
|
+
((_b = detailRef.current) === null || _b === void 0 ? void 0 : _b.scrollIntoView({
|
|
40
35
|
behavior: "smooth",
|
|
41
36
|
block: "end",
|
|
42
37
|
inline: "nearest",
|
|
43
38
|
}));
|
|
44
39
|
onToggle === null || onToggle === void 0 ? void 0 : onToggle(innerOpen);
|
|
45
40
|
return style;
|
|
46
|
-
}, [innerOpen
|
|
41
|
+
}, [innerOpen]);
|
|
47
42
|
return (React.createElement(View, { className: classNames("xh-collapse", className), style: style },
|
|
48
43
|
React.createElement(View, { className: classNames("xh-collapse-summary", { open: innerOpen }), onClick: handleOnchange }, summary || React.createElement(List, Object.assign({}, rest, { arrow: true }))),
|
|
49
44
|
React.createElement(View, { className: classNames("xh-collapse-detail"), ref: detailRef, style: detailStyle }, children)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Collapse/index.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAa,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Collapse/index.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAa,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,IAAqB,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,cAAc,CAAC;AAStB,MAAM,QAAQ,GAA4B,KAAK,CAAC,EAAE;IAChD,MAAM,EACJ,OAAO,GAAG,EAAE,EACZ,QAAQ,EACR,IAAI,GAAG,KAAK,EACZ,KAAK,EACL,SAAS,EACT,KAAK,EACL,QAAQ,KAEN,KAAK,EADJ,IAAI,UACL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G,CAC/B;QACP,oBAAC,IAAI,IACH,SAAS,EAAE,UAAU,CAAC,oBAAoB,CAAC,EAC3C,GAAG,EAAE,SAAS,EACd,KAAK,EAAE,WAAW,IAEjB,QAAQ,CACJ,CACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
-
import { XHComponentCommonProps } from "@/types";
|
|
3
2
|
import { XHListProps } from "@/components/List";
|
|
4
3
|
import "./index.scss";
|
|
5
4
|
export declare type CollapseProps = {
|
|
@@ -7,6 +6,6 @@ export declare type CollapseProps = {
|
|
|
7
6
|
open?: boolean;
|
|
8
7
|
style?: React.CSSProperties;
|
|
9
8
|
onToggle?: (open: boolean) => void;
|
|
10
|
-
} &
|
|
9
|
+
} & XHListProps;
|
|
11
10
|
declare const Collapse: React.FC<CollapseProps>;
|
|
12
11
|
export default Collapse;
|