@douyinfe/semi-ui 2.51.0 → 2.51.2
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/umd/semi-ui.js +30 -48
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/image/interface.d.ts +1 -1
- package/lib/cjs/image/previewInner.d.ts +1 -1
- package/lib/cjs/image/previewInner.js +2 -2
- package/lib/cjs/input/textarea.js +12 -23
- package/lib/cjs/modal/Modal.js +2 -0
- package/lib/es/image/interface.d.ts +1 -1
- package/lib/es/image/previewInner.d.ts +1 -1
- package/lib/es/image/previewInner.js +2 -2
- package/lib/es/input/textarea.js +12 -23
- package/lib/es/modal/Modal.js +2 -0
- package/package.json +8 -8
|
@@ -118,7 +118,7 @@ export interface HeaderProps {
|
|
|
118
118
|
title?: string;
|
|
119
119
|
titleStyle?: React.CSSProperties;
|
|
120
120
|
className?: string;
|
|
121
|
-
onClose?: () => void;
|
|
121
|
+
onClose?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
122
122
|
}
|
|
123
123
|
export interface FooterProps extends SliderProps {
|
|
124
124
|
curPage?: number;
|
|
@@ -83,7 +83,7 @@ export default class PreviewInner extends BaseComponent<PreviewInnerProps, Previ
|
|
|
83
83
|
viewVisibleChange: () => void;
|
|
84
84
|
handleSwitchImage: (direction: string) => void;
|
|
85
85
|
handleDownload: () => void;
|
|
86
|
-
handlePreviewClose: () => void;
|
|
86
|
+
handlePreviewClose: (e: React.MouseEvent<HTMLElement>) => void;
|
|
87
87
|
handleAdjustRatio: (type: RatioType) => void;
|
|
88
88
|
handleRotateImage: (direction: any) => void;
|
|
89
89
|
handleZoomImage: (newZoom: number, notify?: boolean) => void;
|
|
@@ -136,8 +136,8 @@ class PreviewInner extends _baseComponent.default {
|
|
|
136
136
|
this.handleDownload = () => {
|
|
137
137
|
this.foundation.handleDownload();
|
|
138
138
|
};
|
|
139
|
-
this.handlePreviewClose =
|
|
140
|
-
this.foundation.handlePreviewClose();
|
|
139
|
+
this.handlePreviewClose = e => {
|
|
140
|
+
this.foundation.handlePreviewClose(e);
|
|
141
141
|
};
|
|
142
142
|
this.handleAdjustRatio = type => {
|
|
143
143
|
this.foundation.handleAdjustRatio(type);
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
var _throttle2 = _interopRequireDefault(require("lodash/throttle"));
|
|
7
8
|
var _isObject2 = _interopRequireDefault(require("lodash/isObject"));
|
|
8
9
|
var _isUndefined2 = _interopRequireDefault(require("lodash/isUndefined"));
|
|
9
10
|
var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
|
|
@@ -17,6 +18,7 @@ var _constants = require("@douyinfe/semi-foundation/lib/cjs/input/constants");
|
|
|
17
18
|
var _baseComponent = _interopRequireDefault(require("../_base/baseComponent"));
|
|
18
19
|
require("@douyinfe/semi-foundation/lib/cjs/input/textarea.css");
|
|
19
20
|
var _semiIcons = require("@douyinfe/semi-icons");
|
|
21
|
+
var _resizeObserver = _interopRequireDefault(require("../resizeObserver"));
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
23
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
22
24
|
var t = {};
|
|
@@ -54,7 +56,7 @@ class TextArea extends _baseComponent.default {
|
|
|
54
56
|
this.focusing = false;
|
|
55
57
|
this.foundation = new _textareaFoundation.default(this.adapter);
|
|
56
58
|
this.libRef = /*#__PURE__*/_react.default.createRef();
|
|
57
|
-
this.
|
|
59
|
+
this.throttledResizeTextarea = (0, _throttle2.default)(this.foundation.resizeTextarea, 10);
|
|
58
60
|
}
|
|
59
61
|
get adapter() {
|
|
60
62
|
return Object.assign(Object.assign({}, super.adapter), {
|
|
@@ -105,29 +107,12 @@ class TextArea extends _baseComponent.default {
|
|
|
105
107
|
}
|
|
106
108
|
return willUpdateStates;
|
|
107
109
|
}
|
|
108
|
-
componentDidMount() {
|
|
109
|
-
this.foundation.init();
|
|
110
|
-
this._resizeListener = null;
|
|
111
|
-
if (this.props.autosize) {
|
|
112
|
-
// Working around Firefox bug which runs resize listeners even when other JS is running at the same moment
|
|
113
|
-
// causing competing rerenders (due to setState in the listener) in React.
|
|
114
|
-
// More can be found here - facebook/react#6324
|
|
115
|
-
// // Reference to https://github.com/andreypopp/react-textarea-autosize/
|
|
116
|
-
this._resizeListener = () => {
|
|
117
|
-
if (this._resizeLock) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
this._resizeLock = true;
|
|
121
|
-
this.foundation.resizeTextarea(() => {
|
|
122
|
-
this._resizeLock = false;
|
|
123
|
-
});
|
|
124
|
-
};
|
|
125
|
-
window.addEventListener('resize', this._resizeListener);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
110
|
componentWillUnmount() {
|
|
129
|
-
|
|
130
|
-
|
|
111
|
+
var _a, _b;
|
|
112
|
+
if (this.throttledResizeTextarea) {
|
|
113
|
+
(_b = (_a = this.throttledResizeTextarea) === null || _a === void 0 ? void 0 : _a.cancel) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
114
|
+
this.throttledResizeTextarea = null;
|
|
115
|
+
}
|
|
131
116
|
}
|
|
132
117
|
componentDidUpdate(prevProps, prevState) {
|
|
133
118
|
if ((this.props.value !== prevProps.value || this.props.placeholder !== prevProps.placeholder) && this.props.autosize) {
|
|
@@ -247,8 +232,12 @@ class TextArea extends _baseComponent.default {
|
|
|
247
232
|
style: style,
|
|
248
233
|
onMouseEnter: e => this.foundation.handleMouseEnter(e),
|
|
249
234
|
onMouseLeave: e => this.foundation.handleMouseLeave(e)
|
|
235
|
+
}, autosize ? /*#__PURE__*/_react.default.createElement(_resizeObserver.default, {
|
|
236
|
+
onResize: this.throttledResizeTextarea
|
|
250
237
|
}, /*#__PURE__*/_react.default.createElement("textarea", Object.assign({}, itemProps, {
|
|
251
238
|
ref: this.setRef
|
|
239
|
+
}))) : /*#__PURE__*/_react.default.createElement("textarea", Object.assign({}, itemProps, {
|
|
240
|
+
ref: this.setRef
|
|
252
241
|
})), this.renderClearBtn(), this.renderCounter());
|
|
253
242
|
}
|
|
254
243
|
}
|
package/lib/cjs/modal/Modal.js
CHANGED
|
@@ -118,7 +118,7 @@ export interface HeaderProps {
|
|
|
118
118
|
title?: string;
|
|
119
119
|
titleStyle?: React.CSSProperties;
|
|
120
120
|
className?: string;
|
|
121
|
-
onClose?: () => void;
|
|
121
|
+
onClose?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
122
122
|
}
|
|
123
123
|
export interface FooterProps extends SliderProps {
|
|
124
124
|
curPage?: number;
|
|
@@ -83,7 +83,7 @@ export default class PreviewInner extends BaseComponent<PreviewInnerProps, Previ
|
|
|
83
83
|
viewVisibleChange: () => void;
|
|
84
84
|
handleSwitchImage: (direction: string) => void;
|
|
85
85
|
handleDownload: () => void;
|
|
86
|
-
handlePreviewClose: () => void;
|
|
86
|
+
handlePreviewClose: (e: React.MouseEvent<HTMLElement>) => void;
|
|
87
87
|
handleAdjustRatio: (type: RatioType) => void;
|
|
88
88
|
handleRotateImage: (direction: any) => void;
|
|
89
89
|
handleZoomImage: (newZoom: number, notify?: boolean) => void;
|
|
@@ -129,8 +129,8 @@ export default class PreviewInner extends BaseComponent {
|
|
|
129
129
|
this.handleDownload = () => {
|
|
130
130
|
this.foundation.handleDownload();
|
|
131
131
|
};
|
|
132
|
-
this.handlePreviewClose =
|
|
133
|
-
this.foundation.handlePreviewClose();
|
|
132
|
+
this.handlePreviewClose = e => {
|
|
133
|
+
this.foundation.handlePreviewClose(e);
|
|
134
134
|
};
|
|
135
135
|
this.handleAdjustRatio = type => {
|
|
136
136
|
this.foundation.handleAdjustRatio(type);
|
package/lib/es/input/textarea.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _throttle from "lodash/throttle";
|
|
1
2
|
import _isObject from "lodash/isObject";
|
|
2
3
|
import _isUndefined from "lodash/isUndefined";
|
|
3
4
|
import _isFunction from "lodash/isFunction";
|
|
@@ -19,6 +20,7 @@ import { cssClasses } from '@douyinfe/semi-foundation/lib/es/input/constants';
|
|
|
19
20
|
import BaseComponent from '../_base/baseComponent';
|
|
20
21
|
import '@douyinfe/semi-foundation/lib/es/input/textarea.css';
|
|
21
22
|
import { IconClear } from '@douyinfe/semi-icons';
|
|
23
|
+
import ResizeObserver from '../resizeObserver';
|
|
22
24
|
const prefixCls = cssClasses.PREFIX;
|
|
23
25
|
class TextArea extends BaseComponent {
|
|
24
26
|
constructor(props) {
|
|
@@ -47,7 +49,7 @@ class TextArea extends BaseComponent {
|
|
|
47
49
|
this.focusing = false;
|
|
48
50
|
this.foundation = new TextAreaFoundation(this.adapter);
|
|
49
51
|
this.libRef = /*#__PURE__*/React.createRef();
|
|
50
|
-
this.
|
|
52
|
+
this.throttledResizeTextarea = _throttle(this.foundation.resizeTextarea, 10);
|
|
51
53
|
}
|
|
52
54
|
get adapter() {
|
|
53
55
|
return Object.assign(Object.assign({}, super.adapter), {
|
|
@@ -98,29 +100,12 @@ class TextArea extends BaseComponent {
|
|
|
98
100
|
}
|
|
99
101
|
return willUpdateStates;
|
|
100
102
|
}
|
|
101
|
-
componentDidMount() {
|
|
102
|
-
this.foundation.init();
|
|
103
|
-
this._resizeListener = null;
|
|
104
|
-
if (this.props.autosize) {
|
|
105
|
-
// Working around Firefox bug which runs resize listeners even when other JS is running at the same moment
|
|
106
|
-
// causing competing rerenders (due to setState in the listener) in React.
|
|
107
|
-
// More can be found here - facebook/react#6324
|
|
108
|
-
// // Reference to https://github.com/andreypopp/react-textarea-autosize/
|
|
109
|
-
this._resizeListener = () => {
|
|
110
|
-
if (this._resizeLock) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
this._resizeLock = true;
|
|
114
|
-
this.foundation.resizeTextarea(() => {
|
|
115
|
-
this._resizeLock = false;
|
|
116
|
-
});
|
|
117
|
-
};
|
|
118
|
-
window.addEventListener('resize', this._resizeListener);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
103
|
componentWillUnmount() {
|
|
122
|
-
|
|
123
|
-
|
|
104
|
+
var _a, _b;
|
|
105
|
+
if (this.throttledResizeTextarea) {
|
|
106
|
+
(_b = (_a = this.throttledResizeTextarea) === null || _a === void 0 ? void 0 : _a.cancel) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
107
|
+
this.throttledResizeTextarea = null;
|
|
108
|
+
}
|
|
124
109
|
}
|
|
125
110
|
componentDidUpdate(prevProps, prevState) {
|
|
126
111
|
if ((this.props.value !== prevProps.value || this.props.placeholder !== prevProps.placeholder) && this.props.autosize) {
|
|
@@ -240,8 +225,12 @@ class TextArea extends BaseComponent {
|
|
|
240
225
|
style: style,
|
|
241
226
|
onMouseEnter: e => this.foundation.handleMouseEnter(e),
|
|
242
227
|
onMouseLeave: e => this.foundation.handleMouseLeave(e)
|
|
228
|
+
}, autosize ? /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
229
|
+
onResize: this.throttledResizeTextarea
|
|
243
230
|
}, /*#__PURE__*/React.createElement("textarea", Object.assign({}, itemProps, {
|
|
244
231
|
ref: this.setRef
|
|
232
|
+
}))) : /*#__PURE__*/React.createElement("textarea", Object.assign({}, itemProps, {
|
|
233
|
+
ref: this.setRef
|
|
245
234
|
})), this.renderClearBtn(), this.renderCounter());
|
|
246
235
|
}
|
|
247
236
|
}
|
package/lib/es/modal/Modal.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.51.
|
|
3
|
+
"version": "2.51.2",
|
|
4
4
|
"description": "A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"@dnd-kit/core": "^6.0.8",
|
|
21
21
|
"@dnd-kit/sortable": "^7.0.2",
|
|
22
22
|
"@dnd-kit/utilities": "^3.2.1",
|
|
23
|
-
"@douyinfe/semi-animation": "2.51.
|
|
24
|
-
"@douyinfe/semi-animation-react": "2.51.
|
|
25
|
-
"@douyinfe/semi-foundation": "2.51.
|
|
26
|
-
"@douyinfe/semi-icons": "2.51.
|
|
27
|
-
"@douyinfe/semi-illustrations": "2.51.
|
|
28
|
-
"@douyinfe/semi-theme-default": "2.51.
|
|
23
|
+
"@douyinfe/semi-animation": "2.51.2",
|
|
24
|
+
"@douyinfe/semi-animation-react": "2.51.2",
|
|
25
|
+
"@douyinfe/semi-foundation": "2.51.2",
|
|
26
|
+
"@douyinfe/semi-icons": "2.51.2",
|
|
27
|
+
"@douyinfe/semi-illustrations": "2.51.2",
|
|
28
|
+
"@douyinfe/semi-theme-default": "2.51.2",
|
|
29
29
|
"async-validator": "^3.5.0",
|
|
30
30
|
"classnames": "^2.2.6",
|
|
31
31
|
"copy-text-to-clipboard": "^2.1.1",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
],
|
|
76
76
|
"author": "",
|
|
77
77
|
"license": "MIT",
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "424e683a18b7d3c2a55e21b625f292e31df13ac2",
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
81
81
|
"@babel/plugin-transform-runtime": "^7.15.8",
|