assui 3.2.90 → 3.2.91

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.
@@ -16,7 +16,7 @@ interface LabelNumberInputEllipsisProps extends NumberInputProps {
16
16
  label?: string;
17
17
  /** label 是否省略 */
18
18
  labelEllipsis: true;
19
- /** 输入框除去label之后的最小末尾宽度 */
19
+ /** 输入框最小宽度 */
20
20
  baseMinWidth?: number;
21
21
  /** 组件dom id */
22
22
  id?: string;
@@ -32,7 +32,6 @@ var __read = this && this.__read || function (o, n) {
32
32
  };
33
33
  import React from 'react';
34
34
  import useControllableValue from "ahooks/es/useControllableValue";
35
- import useSize from "ahooks/es/useSize";
36
35
  import isUndefined from 'lodash/isUndefined';
37
36
  import classNames from 'classnames';
38
37
  import omit from 'lodash/omit';
@@ -48,8 +47,6 @@ var LabelNumberInput = function LabelNumberInput(props) {
48
47
  _a = props.baseMinWidth,
49
48
  baseMinWidth = _a === void 0 ? 50 : _a;
50
49
  var numberInputRef = React.useRef(null);
51
- var labelDomRef = React.useRef(null);
52
- var labelSize = useSize(labelDomRef);
53
50
  var _b = __read(useControllableValue(props), 2),
54
51
  value = _b[0],
55
52
  setValue = _b[1];
@@ -68,12 +65,11 @@ var LabelNumberInput = function LabelNumberInput(props) {
68
65
  setFocused(false);
69
66
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(value);
70
67
  };
71
- var controlMinWidth = (labelSize === null || labelSize === void 0 ? void 0 : labelSize.width) ? labelSize.width + baseMinWidth : undefined;
72
68
  return /*#__PURE__*/React.createElement("div", {
73
69
  className: classNames('label-number-input-warper', className),
74
70
  id: id,
75
71
  style: {
76
- minWidth: controlMinWidth
72
+ minWidth: baseMinWidth
77
73
  }
78
74
  }, /*#__PURE__*/React.createElement("div", {
79
75
  className: classNames('label-number-input-field', {
@@ -1269,7 +1269,8 @@ html {
1269
1269
  .label-number-input-warper .label-number-input-focused {
1270
1270
  border-color: #000;
1271
1271
  }
1272
- .label-number-input-warper .label-number-input-text {
1272
+ .label-number-input-warper .label-number-input-text,
1273
+ .label-number-input-warper .label-number-input-ellipsis {
1273
1274
  position: absolute;
1274
1275
  top: 12px;
1275
1276
  left: 16px;
@@ -1283,19 +1284,6 @@ html {
1283
1284
  transition: all 0.2s ease-out;
1284
1285
  }
1285
1286
  .label-number-input-warper .label-number-input-ellipsis {
1286
- position: absolute;
1287
- top: 12px;
1288
- left: 16px;
1289
- z-index: 2;
1290
1287
  max-width: calc(100% - 32px);
1291
- height: 20px;
1292
- overflow: hidden;
1293
- color: #9e9e9e;
1294
- font-size: 14px;
1295
- line-height: 20px;
1296
- white-space: nowrap;
1297
- text-overflow: ellipsis;
1298
- transform-origin: top left;
1299
- cursor: text;
1300
- transition: all 0.2s ease-out;
1288
+ cursor: unset;
1301
1289
  }
@@ -41,7 +41,8 @@
41
41
  border-color: @labelFocusBorderColor;
42
42
  }
43
43
 
44
- &-text {
44
+ &-text,
45
+ &-ellipsis {
45
46
  position: absolute;
46
47
  top: 12px;
47
48
  left: 16px;
@@ -56,21 +57,8 @@
56
57
  }
57
58
 
58
59
  &-ellipsis {
59
- position: absolute;
60
- top: 12px;
61
- left: 16px;
62
- z-index: 2;
63
60
  max-width: calc( 100% - 32px);
64
- height: 20px;
65
- overflow: hidden;
66
- color: @color_9aa5b5;
67
- font-size: @font-size-base;
68
- line-height: 20px;
69
- white-space: nowrap;
70
- text-overflow: ellipsis;
71
- transform-origin: top left;
72
- cursor: text;
73
- transition: all 0.2s ease-out;
61
+ cursor: unset;
74
62
  }
75
63
  }
76
64
 
@@ -34,6 +34,7 @@ import React from 'react';
34
34
  import Tooltip from "antd/es/tooltip";
35
35
  import classNames from 'classnames';
36
36
  import omit from 'lodash/omit';
37
+ import useSize from "ahooks/es/useSize";
37
38
  import ButtonModal from '../button-modal';
38
39
  var MultiLineEllipsisText = function MultiLineEllipsisText(_a) {
39
40
  var _b = _a.text,
@@ -48,6 +49,8 @@ var MultiLineEllipsisText = function MultiLineEllipsisText(_a) {
48
49
  onEllipsisChange = _a.onEllipsisChange,
49
50
  onClick = _a.onClick;
50
51
  var ref = React.useRef(null);
52
+ // 监听容器宽度变化,重新计算是否需要省略
53
+ var containerSize = useSize(ref);
51
54
  var _e = __read(React.useState(false), 2),
52
55
  isEllipsis = _e[0],
53
56
  setIsEllipsis = _e[1];
@@ -65,7 +68,7 @@ var MultiLineEllipsisText = function MultiLineEllipsisText(_a) {
65
68
  setIsEllipsis(overflow);
66
69
  onEllipsisChange === null || onEllipsisChange === void 0 ? void 0 : onEllipsisChange(overflow);
67
70
  });
68
- }, [text, lines, onEllipsisChange]);
71
+ }, [text, lines, onEllipsisChange, containerSize === null || containerSize === void 0 ? void 0 : containerSize.width]);
69
72
  var ellipsisNode = /*#__PURE__*/React.createElement("div", {
70
73
  ref: ref,
71
74
  className: classNames('ellipsis', className, {
@@ -16,7 +16,7 @@ interface LabelNumberInputEllipsisProps extends NumberInputProps {
16
16
  label?: string;
17
17
  /** label 是否省略 */
18
18
  labelEllipsis: true;
19
- /** 输入框除去label之后的最小末尾宽度 */
19
+ /** 输入框最小宽度 */
20
20
  baseMinWidth?: number;
21
21
  /** 组件dom id */
22
22
  id?: string;
@@ -42,7 +42,6 @@ Object.defineProperty(exports, "__esModule", {
42
42
  });
43
43
  var react_1 = __importDefault(require("react"));
44
44
  var useControllableValue_1 = __importDefault(require("ahooks/lib/useControllableValue"));
45
- var useSize_1 = __importDefault(require("ahooks/lib/useSize"));
46
45
  var isUndefined_1 = __importDefault(require("lodash/isUndefined"));
47
46
  var classnames_1 = __importDefault(require("classnames"));
48
47
  var omit_1 = __importDefault(require("lodash/omit"));
@@ -58,8 +57,6 @@ var LabelNumberInput = function LabelNumberInput(props) {
58
57
  _a = props.baseMinWidth,
59
58
  baseMinWidth = _a === void 0 ? 50 : _a;
60
59
  var numberInputRef = react_1["default"].useRef(null);
61
- var labelDomRef = react_1["default"].useRef(null);
62
- var labelSize = (0, useSize_1["default"])(labelDomRef);
63
60
  var _b = __read((0, useControllableValue_1["default"])(props), 2),
64
61
  value = _b[0],
65
62
  setValue = _b[1];
@@ -78,12 +75,11 @@ var LabelNumberInput = function LabelNumberInput(props) {
78
75
  setFocused(false);
79
76
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(value);
80
77
  };
81
- var controlMinWidth = (labelSize === null || labelSize === void 0 ? void 0 : labelSize.width) ? labelSize.width + baseMinWidth : undefined;
82
78
  return react_1["default"].createElement("div", {
83
79
  className: (0, classnames_1["default"])('label-number-input-warper', className),
84
80
  id: id,
85
81
  style: {
86
- minWidth: controlMinWidth
82
+ minWidth: baseMinWidth
87
83
  }
88
84
  }, react_1["default"].createElement("div", {
89
85
  className: (0, classnames_1["default"])('label-number-input-field', {
@@ -1269,7 +1269,8 @@ html {
1269
1269
  .label-number-input-warper .label-number-input-focused {
1270
1270
  border-color: #000;
1271
1271
  }
1272
- .label-number-input-warper .label-number-input-text {
1272
+ .label-number-input-warper .label-number-input-text,
1273
+ .label-number-input-warper .label-number-input-ellipsis {
1273
1274
  position: absolute;
1274
1275
  top: 12px;
1275
1276
  left: 16px;
@@ -1283,19 +1284,6 @@ html {
1283
1284
  transition: all 0.2s ease-out;
1284
1285
  }
1285
1286
  .label-number-input-warper .label-number-input-ellipsis {
1286
- position: absolute;
1287
- top: 12px;
1288
- left: 16px;
1289
- z-index: 2;
1290
1287
  max-width: calc(100% - 32px);
1291
- height: 20px;
1292
- overflow: hidden;
1293
- color: #9e9e9e;
1294
- font-size: 14px;
1295
- line-height: 20px;
1296
- white-space: nowrap;
1297
- text-overflow: ellipsis;
1298
- transform-origin: top left;
1299
- cursor: text;
1300
- transition: all 0.2s ease-out;
1288
+ cursor: unset;
1301
1289
  }
@@ -41,7 +41,8 @@
41
41
  border-color: @labelFocusBorderColor;
42
42
  }
43
43
 
44
- &-text {
44
+ &-text,
45
+ &-ellipsis {
45
46
  position: absolute;
46
47
  top: 12px;
47
48
  left: 16px;
@@ -56,21 +57,8 @@
56
57
  }
57
58
 
58
59
  &-ellipsis {
59
- position: absolute;
60
- top: 12px;
61
- left: 16px;
62
- z-index: 2;
63
60
  max-width: calc( 100% - 32px);
64
- height: 20px;
65
- overflow: hidden;
66
- color: @color_9aa5b5;
67
- font-size: @font-size-base;
68
- line-height: 20px;
69
- white-space: nowrap;
70
- text-overflow: ellipsis;
71
- transform-origin: top left;
72
- cursor: text;
73
- transition: all 0.2s ease-out;
61
+ cursor: unset;
74
62
  }
75
63
  }
76
64
 
@@ -44,6 +44,7 @@ var react_1 = __importDefault(require("react"));
44
44
  var tooltip_1 = __importDefault(require("antd/lib/tooltip"));
45
45
  var classnames_1 = __importDefault(require("classnames"));
46
46
  var omit_1 = __importDefault(require("lodash/omit"));
47
+ var useSize_1 = __importDefault(require("ahooks/lib/useSize"));
47
48
  var button_modal_1 = __importDefault(require("../button-modal"));
48
49
  var MultiLineEllipsisText = function MultiLineEllipsisText(_a) {
49
50
  var _b = _a.text,
@@ -58,6 +59,8 @@ var MultiLineEllipsisText = function MultiLineEllipsisText(_a) {
58
59
  onEllipsisChange = _a.onEllipsisChange,
59
60
  onClick = _a.onClick;
60
61
  var ref = react_1["default"].useRef(null);
62
+ // 监听容器宽度变化,重新计算是否需要省略
63
+ var containerSize = (0, useSize_1["default"])(ref);
61
64
  var _e = __read(react_1["default"].useState(false), 2),
62
65
  isEllipsis = _e[0],
63
66
  setIsEllipsis = _e[1];
@@ -75,7 +78,7 @@ var MultiLineEllipsisText = function MultiLineEllipsisText(_a) {
75
78
  setIsEllipsis(overflow);
76
79
  onEllipsisChange === null || onEllipsisChange === void 0 ? void 0 : onEllipsisChange(overflow);
77
80
  });
78
- }, [text, lines, onEllipsisChange]);
81
+ }, [text, lines, onEllipsisChange, containerSize === null || containerSize === void 0 ? void 0 : containerSize.width]);
79
82
  var ellipsisNode = react_1["default"].createElement("div", {
80
83
  ref: ref,
81
84
  className: (0, classnames_1["default"])('ellipsis', className, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assui",
3
- "version": "3.2.90",
3
+ "version": "3.2.91",
4
4
  "description": "react ui library",
5
5
  "author": "jason <usochen@gmail.com>",
6
6
  "main": "./lib/index.js",