linkmore-design 1.0.13 → 1.0.14

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/dist/index.umd.js CHANGED
@@ -28906,31 +28906,105 @@
28906
28906
  }, others), children);
28907
28907
  };
28908
28908
 
28909
- var _excluded$b = ["children", "className", "overlayClassName"];
28909
+ var _excluded$b = ["children", "className", "overlayClassName", "dropdownmatchwidth"];
28910
28910
  var prefixCls$1 = 'lm_dropdown';
28911
28911
 
28912
28912
  var CLMDropdown = function CLMDropdown(props) {
28913
28913
  var children = props.children,
28914
28914
  className = props.className,
28915
28915
  overlayClassName = props.overlayClassName,
28916
+ _props$dropdownmatchw = props.dropdownmatchwidth,
28917
+ dropdownmatchwidth = _props$dropdownmatchw === void 0 ? false : _props$dropdownmatchw,
28916
28918
  others = _objectWithoutProperties(props, _excluded$b);
28917
28919
 
28918
- return /*#__PURE__*/React__default['default'].createElement(_Dropdown__default['default'], _extends({
28920
+ var dropdownRef = React.useRef(null);
28921
+
28922
+ var _useState = React.useState(''),
28923
+ _useState2 = _slicedToArray(_useState, 2),
28924
+ minwidth = _useState2[0],
28925
+ setMinWidth = _useState2[1];
28926
+
28927
+ React.useEffect(function () {
28928
+ if (dropdownmatchwidth) {
28929
+ var _dropdownRef$current$;
28930
+
28931
+ var dropdown_dom = (_dropdownRef$current$ = dropdownRef.current.getElementsByClassName("lm_dropdown")) === null || _dropdownRef$current$ === void 0 ? void 0 : _dropdownRef$current$[0];
28932
+
28933
+ if (dropdown_dom) {
28934
+ var _dropdown_dom$getBoun, _dropdown_dom$getBoun2;
28935
+
28936
+ console.log((_dropdown_dom$getBoun = dropdown_dom.getBoundingClientRect()) === null || _dropdown_dom$getBoun === void 0 ? void 0 : _dropdown_dom$getBoun.width);
28937
+ setMinWidth(((_dropdown_dom$getBoun2 = dropdown_dom.getBoundingClientRect()) === null || _dropdown_dom$getBoun2 === void 0 ? void 0 : _dropdown_dom$getBoun2.width) || '');
28938
+ }
28939
+ }
28940
+ }, []);
28941
+
28942
+ if (!dropdownmatchwidth) {
28943
+ return /*#__PURE__*/React__default['default'].createElement(_Dropdown__default['default'], _extends({
28944
+ className: classnames(className, prefixCls$1)
28945
+ }, others, {
28946
+ overlayClassName: classnames(overlayClassName, 'lm_dropdown_overlay')
28947
+ }), children);
28948
+ }
28949
+
28950
+ return /*#__PURE__*/React__default['default'].createElement("div", {
28951
+ ref: dropdownRef
28952
+ }, /*#__PURE__*/React__default['default'].createElement(_Dropdown__default['default'], _extends({
28919
28953
  className: classnames(className, prefixCls$1)
28920
28954
  }, others, {
28921
- overlayClassName: classnames(overlayClassName, 'lm_dropdown_overlay')
28922
- }), children);
28955
+ overlayClassName: classnames(overlayClassName, 'lm_dropdown_overlay'),
28956
+ overlayStyle: minwidth ? _objectSpread({
28957
+ minWidth: minwidth
28958
+ }, others.overlayStyle) : _objectSpread({}, others.overlayStyle)
28959
+ }), children));
28923
28960
  };
28924
28961
 
28925
28962
  var LMDropdown = CLMDropdown;
28926
28963
 
28927
28964
  LMDropdown.Button = function (props) {
28928
- return /*#__PURE__*/React__default['default'].createElement(_Dropdown__default['default'].Button, _extends({
28965
+ var _props$dropdownmatchw2 = props.dropdownmatchwidth,
28966
+ dropdownmatchwidth = _props$dropdownmatchw2 === void 0 ? false : _props$dropdownmatchw2;
28967
+ var dropdownRef = React.useRef(null);
28968
+
28969
+ var _useState3 = React.useState(''),
28970
+ _useState4 = _slicedToArray(_useState3, 2),
28971
+ minwidth = _useState4[0],
28972
+ setMinWidth = _useState4[1];
28973
+
28974
+ React.useEffect(function () {
28975
+ if (dropdownmatchwidth) {
28976
+ var _dropdownRef$current$2;
28977
+
28978
+ var dropdown_dom = (_dropdownRef$current$2 = dropdownRef.current.getElementsByClassName("lm_dropdown_button")) === null || _dropdownRef$current$2 === void 0 ? void 0 : _dropdownRef$current$2[0];
28979
+
28980
+ if (dropdown_dom) {
28981
+ var _dropdown_dom$getBoun3;
28982
+
28983
+ setMinWidth(((_dropdown_dom$getBoun3 = dropdown_dom.getBoundingClientRect()) === null || _dropdown_dom$getBoun3 === void 0 ? void 0 : _dropdown_dom$getBoun3.width) || '');
28984
+ }
28985
+ }
28986
+ }, []);
28987
+
28988
+ if (!dropdownmatchwidth) {
28989
+ return /*#__PURE__*/React__default['default'].createElement(_Dropdown__default['default'].Button, _extends({
28990
+ size: "small"
28991
+ }, props, {
28992
+ overlayClassName: classnames(props.overlayClassName, 'lm_dropdown_overlay'),
28993
+ className: classnames(props.className, 'lm_dropdown_button')
28994
+ }));
28995
+ }
28996
+
28997
+ return /*#__PURE__*/React__default['default'].createElement("div", {
28998
+ ref: dropdownRef
28999
+ }, /*#__PURE__*/React__default['default'].createElement(_Dropdown__default['default'].Button, _extends({
28929
29000
  size: "small"
28930
29001
  }, props, {
28931
29002
  overlayClassName: classnames(props.overlayClassName, 'lm_dropdown_overlay'),
29003
+ overlayStyle: minwidth ? _objectSpread({
29004
+ minWidth: minwidth
29005
+ }, props.overlayStyle) : _objectSpread({}, props.overlayStyle),
28932
29006
  className: classnames(props.className, 'lm_dropdown_button')
28933
- }));
29007
+ })));
28934
29008
  };
28935
29009
 
28936
29010
  var UploadBox = function UploadBox(props) {