bhd-components 0.2.7 → 0.2.9
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.
|
@@ -6,13 +6,14 @@ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
|
6
6
|
import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import { useRef } from "react";
|
|
9
|
+
import { CaretDownOutlined } from "../icons/index";
|
|
9
10
|
import { Select } from "antd";
|
|
10
11
|
//import type { SelectProps } from 'antd';
|
|
11
12
|
import styles from "./index.module.less";
|
|
12
13
|
const BhdTableSelect = (props)=>{
|
|
13
14
|
const { // initOption=[],
|
|
14
15
|
// initOptionType='default',
|
|
15
|
-
className ='' , popupClassName ='' , dropdownStyle ={} , children } = props;
|
|
16
|
+
className ='' , popupClassName ='' , dropdownStyle ={} , suffixIcon =null , children } = props;
|
|
16
17
|
const tableSelectRef = useRef(null);
|
|
17
18
|
// const handleTypeSwitchOption=()=>{
|
|
18
19
|
// switch(initOptionType){
|
|
@@ -58,6 +59,7 @@ const BhdTableSelect = (props)=>{
|
|
|
58
59
|
borderRadius: 4,
|
|
59
60
|
border: '1px solid rgba(0,0,0,0.15)'
|
|
60
61
|
}),
|
|
62
|
+
suffixIcon: suffixIcon ? suffixIcon : /*#__PURE__*/ _jsx(CaretDownOutlined, {}),
|
|
61
63
|
popupClassName: popupClassName ? `${popupClassName} ${styles.BhdTableSelect_popup}` : styles.BhdTableSelect_popup
|
|
62
64
|
});
|
|
63
65
|
return /*#__PURE__*/ _jsx("div", {
|
|
@@ -3,7 +3,7 @@ interface TitleBarProps {
|
|
|
3
3
|
title?: React.ReactElement;
|
|
4
4
|
leftIcon?: React.ReactElement;
|
|
5
5
|
subTitle?: React.ReactElement;
|
|
6
|
-
rightContent
|
|
6
|
+
rightContent?: (kind?: string) => React.ReactElement;
|
|
7
7
|
rightMaxWidth?: number;
|
|
8
8
|
wrapClassName?: string;
|
|
9
9
|
leftIconClassName?: string;
|
package/es2017/titleBar/index.js
CHANGED
|
@@ -14,27 +14,31 @@ const TitleBar = (props)=>{
|
|
|
14
14
|
};
|
|
15
15
|
// const onResize = useCallback(, [screenWidth]);
|
|
16
16
|
const onResize = ()=>{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
if (rightContent) {
|
|
18
|
+
const { width } = titleBarRef.current.getBoundingClientRect();
|
|
19
|
+
const maxWidth = width * rightMaxWidth / 100;
|
|
20
|
+
console.log("resize", maxWidth, screenWidth);
|
|
21
|
+
if (screenWidth > maxWidth) {
|
|
22
|
+
// kind minScreen
|
|
23
|
+
setKind("minScreen");
|
|
24
|
+
} else {
|
|
25
|
+
setKind("screen");
|
|
26
|
+
}
|
|
25
27
|
}
|
|
26
28
|
};
|
|
27
29
|
useLayoutEffect(()=>{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
if (rightContent) {
|
|
31
|
+
const { width } = titleBarRef.current.getBoundingClientRect();
|
|
32
|
+
const maxWidth = width * rightMaxWidth / 100;
|
|
33
|
+
const rightWidth = rightContentRef.current.getBoundingClientRect().width;
|
|
34
|
+
setScreenWidth(rightWidth);
|
|
35
|
+
console.log("rightWidthrightWidth", rightWidth, maxWidth);
|
|
36
|
+
if (rightWidth > maxWidth) {
|
|
37
|
+
// kind minScreen
|
|
38
|
+
setKind("minScreen");
|
|
39
|
+
} else {
|
|
40
|
+
setKind("screen");
|
|
41
|
+
}
|
|
38
42
|
}
|
|
39
43
|
}, []);
|
|
40
44
|
useEffect(()=>{
|
package/esm/tableSelect/index.js
CHANGED
|
@@ -6,13 +6,14 @@ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
|
6
6
|
import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import { useRef } from "react";
|
|
9
|
+
import { CaretDownOutlined } from "../icons/index";
|
|
9
10
|
import { Select } from "antd";
|
|
10
11
|
//import type { SelectProps } from 'antd';
|
|
11
12
|
import styles from "./index.module.less";
|
|
12
13
|
var BhdTableSelect = function(props) {
|
|
13
14
|
var _props_className = props.// initOption=[],
|
|
14
15
|
// initOptionType='default',
|
|
15
|
-
className, className = _props_className === void 0 ? "" : _props_className, _props_popupClassName = props.popupClassName, popupClassName = _props_popupClassName === void 0 ? "" : _props_popupClassName, _props_dropdownStyle = props.dropdownStyle, dropdownStyle = _props_dropdownStyle === void 0 ? {} : _props_dropdownStyle, children = props.children;
|
|
16
|
+
className, className = _props_className === void 0 ? "" : _props_className, _props_popupClassName = props.popupClassName, popupClassName = _props_popupClassName === void 0 ? "" : _props_popupClassName, _props_dropdownStyle = props.dropdownStyle, dropdownStyle = _props_dropdownStyle === void 0 ? {} : _props_dropdownStyle, _props_suffixIcon = props.suffixIcon, suffixIcon = _props_suffixIcon === void 0 ? null : _props_suffixIcon, children = props.children;
|
|
16
17
|
var tableSelectRef = useRef(null);
|
|
17
18
|
// const handleTypeSwitchOption=()=>{
|
|
18
19
|
// switch(initOptionType){
|
|
@@ -58,6 +59,7 @@ var BhdTableSelect = function(props) {
|
|
|
58
59
|
borderRadius: 4,
|
|
59
60
|
border: "1px solid rgba(0,0,0,0.15)"
|
|
60
61
|
}),
|
|
62
|
+
suffixIcon: suffixIcon ? suffixIcon : /*#__PURE__*/ _jsx(CaretDownOutlined, {}),
|
|
61
63
|
popupClassName: popupClassName ? "".concat(popupClassName, " ").concat(styles.BhdTableSelect_popup) : styles.BhdTableSelect_popup
|
|
62
64
|
});
|
|
63
65
|
return /*#__PURE__*/ _jsx("div", {
|
package/esm/titleBar/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ interface TitleBarProps {
|
|
|
3
3
|
title?: React.ReactElement;
|
|
4
4
|
leftIcon?: React.ReactElement;
|
|
5
5
|
subTitle?: React.ReactElement;
|
|
6
|
-
rightContent
|
|
6
|
+
rightContent?: (kind?: string) => React.ReactElement;
|
|
7
7
|
rightMaxWidth?: number;
|
|
8
8
|
wrapClassName?: string;
|
|
9
9
|
leftIconClassName?: string;
|
package/esm/titleBar/index.js
CHANGED
|
@@ -15,27 +15,31 @@ var TitleBar = function(props) {
|
|
|
15
15
|
};
|
|
16
16
|
// const onResize = useCallback(, [screenWidth]);
|
|
17
17
|
var onResize = function() {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
if (rightContent) {
|
|
19
|
+
var width = titleBarRef.current.getBoundingClientRect().width;
|
|
20
|
+
var maxWidth = width * rightMaxWidth / 100;
|
|
21
|
+
console.log("resize", maxWidth, screenWidth);
|
|
22
|
+
if (screenWidth > maxWidth) {
|
|
23
|
+
// kind minScreen
|
|
24
|
+
setKind("minScreen");
|
|
25
|
+
} else {
|
|
26
|
+
setKind("screen");
|
|
27
|
+
}
|
|
26
28
|
}
|
|
27
29
|
};
|
|
28
30
|
useLayoutEffect(function() {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
if (rightContent) {
|
|
32
|
+
var width = titleBarRef.current.getBoundingClientRect().width;
|
|
33
|
+
var maxWidth = width * rightMaxWidth / 100;
|
|
34
|
+
var rightWidth = rightContentRef.current.getBoundingClientRect().width;
|
|
35
|
+
setScreenWidth(rightWidth);
|
|
36
|
+
console.log("rightWidthrightWidth", rightWidth, maxWidth);
|
|
37
|
+
if (rightWidth > maxWidth) {
|
|
38
|
+
// kind minScreen
|
|
39
|
+
setKind("minScreen");
|
|
40
|
+
} else {
|
|
41
|
+
setKind("screen");
|
|
42
|
+
}
|
|
39
43
|
}
|
|
40
44
|
}, []);
|
|
41
45
|
useEffect(function() {
|