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: (kind?: string) => React.ReactElement;
6
+ rightContent?: (kind?: string) => React.ReactElement;
7
7
  rightMaxWidth?: number;
8
8
  wrapClassName?: string;
9
9
  leftIconClassName?: string;
@@ -14,27 +14,31 @@ const TitleBar = (props)=>{
14
14
  };
15
15
  // const onResize = useCallback(, [screenWidth]);
16
16
  const onResize = ()=>{
17
- const { width } = titleBarRef.current.getBoundingClientRect();
18
- const maxWidth = width * rightMaxWidth / 100;
19
- console.log("resize", maxWidth, screenWidth);
20
- if (screenWidth > maxWidth) {
21
- // kind minScreen
22
- setKind("minScreen");
23
- } else {
24
- setKind("screen");
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
- const { width } = titleBarRef.current.getBoundingClientRect();
29
- const maxWidth = width * rightMaxWidth / 100;
30
- const rightWidth = rightContentRef.current.getBoundingClientRect().width;
31
- setScreenWidth(rightWidth);
32
- console.log("rightWidthrightWidth", rightWidth, maxWidth);
33
- if (rightWidth > maxWidth) {
34
- // kind minScreen
35
- setKind("minScreen");
36
- } else {
37
- setKind("screen");
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(()=>{
@@ -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", {
@@ -3,7 +3,7 @@ interface TitleBarProps {
3
3
  title?: React.ReactElement;
4
4
  leftIcon?: React.ReactElement;
5
5
  subTitle?: React.ReactElement;
6
- rightContent: (kind?: string) => React.ReactElement;
6
+ rightContent?: (kind?: string) => React.ReactElement;
7
7
  rightMaxWidth?: number;
8
8
  wrapClassName?: string;
9
9
  leftIconClassName?: string;
@@ -15,27 +15,31 @@ var TitleBar = function(props) {
15
15
  };
16
16
  // const onResize = useCallback(, [screenWidth]);
17
17
  var onResize = function() {
18
- var width = titleBarRef.current.getBoundingClientRect().width;
19
- var 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");
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
- var width = titleBarRef.current.getBoundingClientRect().width;
30
- var maxWidth = width * rightMaxWidth / 100;
31
- var rightWidth = rightContentRef.current.getBoundingClientRect().width;
32
- setScreenWidth(rightWidth);
33
- console.log("rightWidthrightWidth", rightWidth, maxWidth);
34
- if (rightWidth > maxWidth) {
35
- // kind minScreen
36
- setKind("minScreen");
37
- } else {
38
- setKind("screen");
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() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bhd-components",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "组件功能描述",
5
5
  "files": [
6
6
  "esm",