assui 2.0.100 → 2.0.103

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/es/index.d.ts CHANGED
@@ -44,6 +44,8 @@ export type { LabelRangePickerProps } from './label-range-picker';
44
44
  export { default as LabelRangePicker } from './label-range-picker';
45
45
  export type { LabelDatePickerProps } from './label-date-picker';
46
46
  export { default as LabelDatePicker } from './label-date-picker';
47
+ export type { LabelCustomizeRangePickerProps } from './label-customize-range-picker';
48
+ export { default as LabelCustomizeRangePicker } from './label-customize-range-picker';
47
49
  export type { LabelDescItemProps } from './label-desc-item';
48
50
  export { default as LabelDescItem } from './label-desc-item';
49
51
  export type { RichTextEditorProps } from './rich-text-editor';
package/es/index.js CHANGED
@@ -22,6 +22,7 @@ export { default as LabelSelect } from './label-select';
22
22
  export { default as LabelTextArea } from './label-text-area';
23
23
  export { default as LabelRangePicker } from './label-range-picker';
24
24
  export { default as LabelDatePicker } from './label-date-picker';
25
+ export { default as LabelCustomizeRangePicker } from './label-customize-range-picker';
25
26
  export { default as LabelDescItem } from './label-desc-item';
26
27
  export { default as RichTextEditor } from './rich-text-editor';
27
28
  export { default as beautifulDnd } from './beautiful-dnd';
@@ -20,6 +20,8 @@ export interface LabelInputProps extends Omit<React.InputHTMLAttributes<HTMLInpu
20
20
  maxLength?: number;
21
21
  /** 输入框获取焦点的回调 */
22
22
  onFocus?: (value: string) => void;
23
+ /** 输入框除去label之后的最小末尾宽度 */
24
+ baseMinWidth?: number;
23
25
  /** 组件dom id */
24
26
  id?: string;
25
27
  }
@@ -27,10 +27,11 @@ var __read = this && this.__read || function (o, n) {
27
27
 
28
28
  import React from 'react';
29
29
  import classNames from 'classnames';
30
- import { useControllableValue } from 'ahooks';
31
30
  import { trimStart } from 'lodash';
32
31
  import EyeFilled from 'a-icons/lib/EyeFilled';
33
32
  import EyeOutlined from 'a-icons/lib/EyeOutlined';
33
+ import useControllableValue from 'ahooks/lib/useControllableValue';
34
+ import useSize from 'ahooks/lib/useSize';
34
35
  var PasswordSuffix = /*#__PURE__*/React.memo(function (_a) {
35
36
  var inputType = _a.inputType,
36
37
  onChangeInputType = _a.onChangeInputType;
@@ -57,21 +58,25 @@ var LabelInput = function LabelInput(props) {
57
58
  onBlur = props.onBlur,
58
59
  _a = props.type,
59
60
  type = _a === void 0 ? 'text' : _a,
60
- maxLength = props.maxLength;
61
+ maxLength = props.maxLength,
62
+ _b = props.baseMinWidth,
63
+ baseMinWidth = _b === void 0 ? 50 : _b;
64
+ var labelDomRef = React.useRef(null);
65
+ var labelSize = useSize(labelDomRef);
61
66
 
62
- var _b = __read(React.useState(false), 2),
63
- focused = _b[0],
64
- setFocused = _b[1];
67
+ var _c = __read(React.useState(false), 2),
68
+ focused = _c[0],
69
+ setFocused = _c[1];
65
70
 
66
- var _c = __read(useControllableValue(props, {
71
+ var _d = __read(useControllableValue(props, {
67
72
  defaultValue: ''
68
73
  }), 2),
69
- value = _c[0],
70
- setValue = _c[1];
74
+ value = _d[0],
75
+ setValue = _d[1];
71
76
 
72
- var _d = __read(React.useState(type), 2),
73
- inputType = _d[0],
74
- setInputType = _d[1];
77
+ var _e = __read(React.useState(type), 2),
78
+ inputType = _e[0],
79
+ setInputType = _e[1];
75
80
 
76
81
  var InputDomRef = React.useRef(null);
77
82
  var isPasswordInput = type === 'password';
@@ -100,9 +105,13 @@ var LabelInput = function LabelInput(props) {
100
105
  var onChangeInputType = React.useCallback(function (nextInputType) {
101
106
  setInputType(nextInputType);
102
107
  }, []);
108
+ var controlMinWidth = (labelSize === null || labelSize === void 0 ? void 0 : labelSize.width) ? labelSize.width + baseMinWidth : undefined;
103
109
  return /*#__PURE__*/React.createElement("div", {
104
110
  className: classNames('label-input-control', className),
105
- id: id
111
+ id: id,
112
+ style: {
113
+ minWidth: controlMinWidth
114
+ }
106
115
  }, /*#__PURE__*/React.createElement("div", {
107
116
  className: classNames('label-input-field', {
108
117
  'label-input-affix': prefix || suffix || isPasswordInput,
@@ -126,7 +135,8 @@ var LabelInput = function LabelInput(props) {
126
135
  maxLength: maxLength
127
136
  }), /*#__PURE__*/React.createElement("label", {
128
137
  className: "label-input-text",
129
- onClick: handleLabelClick
138
+ onClick: handleLabelClick,
139
+ ref: labelDomRef
130
140
  }, label)), (suffix || isPasswordInput) && /*#__PURE__*/React.createElement("div", {
131
141
  className: "label-input-suffix"
132
142
  }, suffix || /*#__PURE__*/React.createElement(PasswordSuffix, {
package/lib/index.d.ts CHANGED
@@ -44,6 +44,8 @@ export type { LabelRangePickerProps } from './label-range-picker';
44
44
  export { default as LabelRangePicker } from './label-range-picker';
45
45
  export type { LabelDatePickerProps } from './label-date-picker';
46
46
  export { default as LabelDatePicker } from './label-date-picker';
47
+ export type { LabelCustomizeRangePickerProps } from './label-customize-range-picker';
48
+ export { default as LabelCustomizeRangePicker } from './label-customize-range-picker';
47
49
  export type { LabelDescItemProps } from './label-desc-item';
48
50
  export { default as LabelDescItem } from './label-desc-item';
49
51
  export type { RichTextEditorProps } from './rich-text-editor';
package/lib/index.js CHANGED
@@ -220,6 +220,15 @@ Object.defineProperty(exports, "LabelDatePicker", {
220
220
  }
221
221
  });
222
222
 
223
+ var label_customize_range_picker_1 = require("./label-customize-range-picker");
224
+
225
+ Object.defineProperty(exports, "LabelCustomizeRangePicker", {
226
+ enumerable: true,
227
+ get: function get() {
228
+ return label_customize_range_picker_1["default"];
229
+ }
230
+ });
231
+
223
232
  var label_desc_item_1 = require("./label-desc-item");
224
233
 
225
234
  Object.defineProperty(exports, "LabelDescItem", {
@@ -20,6 +20,8 @@ export interface LabelInputProps extends Omit<React.InputHTMLAttributes<HTMLInpu
20
20
  maxLength?: number;
21
21
  /** 输入框获取焦点的回调 */
22
22
  onFocus?: (value: string) => void;
23
+ /** 输入框除去label之后的最小末尾宽度 */
24
+ baseMinWidth?: number;
23
25
  /** 组件dom id */
24
26
  id?: string;
25
27
  }
@@ -41,14 +41,16 @@ var react_1 = __importDefault(require("react"));
41
41
 
42
42
  var classnames_1 = __importDefault(require("classnames"));
43
43
 
44
- var ahooks_1 = require("ahooks");
45
-
46
44
  var lodash_1 = require("lodash");
47
45
 
48
46
  var EyeFilled_1 = __importDefault(require("a-icons/lib/EyeFilled"));
49
47
 
50
48
  var EyeOutlined_1 = __importDefault(require("a-icons/lib/EyeOutlined"));
51
49
 
50
+ var useControllableValue_1 = __importDefault(require("ahooks/lib/useControllableValue"));
51
+
52
+ var useSize_1 = __importDefault(require("ahooks/lib/useSize"));
53
+
52
54
  var PasswordSuffix = react_1["default"].memo(function (_a) {
53
55
  var inputType = _a.inputType,
54
56
  onChangeInputType = _a.onChangeInputType;
@@ -75,21 +77,25 @@ var LabelInput = function LabelInput(props) {
75
77
  onBlur = props.onBlur,
76
78
  _a = props.type,
77
79
  type = _a === void 0 ? 'text' : _a,
78
- maxLength = props.maxLength;
80
+ maxLength = props.maxLength,
81
+ _b = props.baseMinWidth,
82
+ baseMinWidth = _b === void 0 ? 50 : _b;
83
+ var labelDomRef = react_1["default"].useRef(null);
84
+ var labelSize = useSize_1["default"](labelDomRef);
79
85
 
80
- var _b = __read(react_1["default"].useState(false), 2),
81
- focused = _b[0],
82
- setFocused = _b[1];
86
+ var _c = __read(react_1["default"].useState(false), 2),
87
+ focused = _c[0],
88
+ setFocused = _c[1];
83
89
 
84
- var _c = __read(ahooks_1.useControllableValue(props, {
90
+ var _d = __read(useControllableValue_1["default"](props, {
85
91
  defaultValue: ''
86
92
  }), 2),
87
- value = _c[0],
88
- setValue = _c[1];
93
+ value = _d[0],
94
+ setValue = _d[1];
89
95
 
90
- var _d = __read(react_1["default"].useState(type), 2),
91
- inputType = _d[0],
92
- setInputType = _d[1];
96
+ var _e = __read(react_1["default"].useState(type), 2),
97
+ inputType = _e[0],
98
+ setInputType = _e[1];
93
99
 
94
100
  var InputDomRef = react_1["default"].useRef(null);
95
101
  var isPasswordInput = type === 'password';
@@ -118,9 +124,13 @@ var LabelInput = function LabelInput(props) {
118
124
  var onChangeInputType = react_1["default"].useCallback(function (nextInputType) {
119
125
  setInputType(nextInputType);
120
126
  }, []);
127
+ var controlMinWidth = (labelSize === null || labelSize === void 0 ? void 0 : labelSize.width) ? labelSize.width + baseMinWidth : undefined;
121
128
  return react_1["default"].createElement("div", {
122
129
  className: classnames_1["default"]('label-input-control', className),
123
- id: id
130
+ id: id,
131
+ style: {
132
+ minWidth: controlMinWidth
133
+ }
124
134
  }, react_1["default"].createElement("div", {
125
135
  className: classnames_1["default"]('label-input-field', {
126
136
  'label-input-affix': prefix || suffix || isPasswordInput,
@@ -144,7 +154,8 @@ var LabelInput = function LabelInput(props) {
144
154
  maxLength: maxLength
145
155
  }), react_1["default"].createElement("label", {
146
156
  className: "label-input-text",
147
- onClick: handleLabelClick
157
+ onClick: handleLabelClick,
158
+ ref: labelDomRef
148
159
  }, label)), (suffix || isPasswordInput) && react_1["default"].createElement("div", {
149
160
  className: "label-input-suffix"
150
161
  }, suffix || react_1["default"].createElement(PasswordSuffix, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assui",
3
- "version": "2.0.100",
3
+ "version": "2.0.103",
4
4
  "description": "react ui library",
5
5
  "author": "jason <usochen@gmail.com>",
6
6
  "main": "./lib/index.js",
@@ -33,7 +33,7 @@
33
33
  "@ahooksjs/use-url-state": "^2.5.8",
34
34
  "@tinymce/tinymce-react": "^3.13.0",
35
35
  "@types/react-beautiful-dnd": "^13.1.2",
36
- "a-icons": "^1.0.52",
36
+ "a-icons": "^1.0.53",
37
37
  "ahooks": "^3.0.8",
38
38
  "bignumber.js": "^9.0.1",
39
39
  "copy-to-clipboard": "^3.3.1",
@@ -69,5 +69,5 @@
69
69
  "node": ">=10.0.0"
70
70
  },
71
71
  "license": "MIT",
72
- "gitHead": "a2ae036f7fb6b185af19bb40629502d4f58b5de9"
72
+ "gitHead": "ab500961aaa3150c3f63455bf44e5e1e877dd407"
73
73
  }