@douyinfe/semi-ui 2.51.1 → 2.51.3
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 +97 -112
- 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/table/Body/BaseRow.d.ts +44 -0
- package/lib/cjs/table/Body/BaseRow.js +47 -42
- package/lib/cjs/table/Body/SectionRow.d.ts +24 -0
- package/lib/cjs/table/Body/SectionRow.js +27 -22
- package/lib/cjs/table/Body/index.js +6 -4
- 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/table/Body/BaseRow.d.ts +44 -0
- package/lib/es/table/Body/BaseRow.js +45 -41
- package/lib/es/table/Body/SectionRow.d.ts +24 -0
- package/lib/es/table/Body/SectionRow.js +25 -21
- package/lib/es/table/Body/index.js +4 -4
- 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
|
}
|
|
@@ -46,6 +46,50 @@ export interface BaseRowProps {
|
|
|
46
46
|
/** whether display none */
|
|
47
47
|
displayNone?: boolean;
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* avoid affected by https://www.npmjs.com/package/babel-plugin-transform-react-remove-prop-types
|
|
51
|
+
*/
|
|
52
|
+
export declare const baseRowPropTypes: {
|
|
53
|
+
anyColumnFixed: PropTypes.Requireable<boolean>;
|
|
54
|
+
cellWidths: PropTypes.Validator<any[]>;
|
|
55
|
+
className: PropTypes.Requireable<string>;
|
|
56
|
+
columns: PropTypes.Validator<any[]>;
|
|
57
|
+
components: PropTypes.Validator<object>;
|
|
58
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
59
|
+
expandIcon: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>>;
|
|
60
|
+
expandableRow: PropTypes.Requireable<boolean>;
|
|
61
|
+
expanded: PropTypes.Requireable<boolean>;
|
|
62
|
+
displayNone: PropTypes.Requireable<boolean>;
|
|
63
|
+
expandedRow: PropTypes.Requireable<boolean>;
|
|
64
|
+
fixed: PropTypes.Requireable<NonNullable<string | boolean>>;
|
|
65
|
+
height: PropTypes.Requireable<NonNullable<string | number>>;
|
|
66
|
+
hideExpandedColumn: PropTypes.Requireable<boolean>;
|
|
67
|
+
hovered: PropTypes.Validator<boolean>;
|
|
68
|
+
indent: PropTypes.Requireable<number>;
|
|
69
|
+
indentSize: PropTypes.Requireable<number>;
|
|
70
|
+
index: PropTypes.Requireable<number>;
|
|
71
|
+
isSection: PropTypes.Requireable<boolean>;
|
|
72
|
+
level: PropTypes.Requireable<number>;
|
|
73
|
+
onDidUpdate: PropTypes.Requireable<(...args: any[]) => any>;
|
|
74
|
+
onHover: PropTypes.Requireable<(...args: any[]) => any>;
|
|
75
|
+
onRow: PropTypes.Requireable<(...args: any[]) => any>;
|
|
76
|
+
onRowClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
77
|
+
onRowContextMenu: PropTypes.Requireable<(...args: any[]) => any>;
|
|
78
|
+
onRowDoubleClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
79
|
+
onRowMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
80
|
+
onRowMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
|
81
|
+
prefixCls: PropTypes.Requireable<string>;
|
|
82
|
+
record: PropTypes.Requireable<object>;
|
|
83
|
+
renderExpandIcon: PropTypes.Requireable<(...args: any[]) => any>;
|
|
84
|
+
replaceClassName: PropTypes.Requireable<string>;
|
|
85
|
+
rowExpandable: PropTypes.Requireable<(...args: any[]) => any>;
|
|
86
|
+
rowKey: PropTypes.Validator<NonNullable<NonNullable<string | number>>>;
|
|
87
|
+
selected: PropTypes.Requireable<boolean>;
|
|
88
|
+
store: PropTypes.Requireable<object>;
|
|
89
|
+
style: PropTypes.Requireable<object>;
|
|
90
|
+
virtualized: PropTypes.Requireable<NonNullable<boolean | object>>;
|
|
91
|
+
visible: PropTypes.Validator<boolean>;
|
|
92
|
+
};
|
|
49
93
|
export default class TableRow extends BaseComponent<BaseRowProps, Record<string, any>> {
|
|
50
94
|
static propTypes: {
|
|
51
95
|
anyColumnFixed: PropTypes.Requireable<boolean>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.baseRowPropTypes = void 0;
|
|
7
7
|
var _pick2 = _interopRequireDefault(require("lodash/pick"));
|
|
8
8
|
var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
|
|
9
9
|
var _omit2 = _interopRequireDefault(require("lodash/omit"));
|
|
@@ -31,6 +31,51 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
31
31
|
}
|
|
32
32
|
return t;
|
|
33
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* avoid affected by https://www.npmjs.com/package/babel-plugin-transform-react-remove-prop-types
|
|
36
|
+
*/
|
|
37
|
+
const baseRowPropTypes = {
|
|
38
|
+
anyColumnFixed: _propTypes.default.bool,
|
|
39
|
+
cellWidths: _propTypes.default.array.isRequired,
|
|
40
|
+
className: _propTypes.default.string,
|
|
41
|
+
columns: _propTypes.default.array.isRequired,
|
|
42
|
+
components: _propTypes.default.object.isRequired,
|
|
43
|
+
disabled: _propTypes.default.bool,
|
|
44
|
+
expandIcon: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.func, _propTypes.default.node]),
|
|
45
|
+
expandableRow: _propTypes.default.bool,
|
|
46
|
+
expanded: _propTypes.default.bool,
|
|
47
|
+
displayNone: _propTypes.default.bool,
|
|
48
|
+
expandedRow: _propTypes.default.bool,
|
|
49
|
+
fixed: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
50
|
+
height: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
51
|
+
hideExpandedColumn: _propTypes.default.bool,
|
|
52
|
+
hovered: _propTypes.default.bool.isRequired,
|
|
53
|
+
indent: _propTypes.default.number,
|
|
54
|
+
indentSize: _propTypes.default.number,
|
|
55
|
+
index: _propTypes.default.number,
|
|
56
|
+
isSection: _propTypes.default.bool,
|
|
57
|
+
level: _propTypes.default.number,
|
|
58
|
+
onDidUpdate: _propTypes.default.func,
|
|
59
|
+
onHover: _propTypes.default.func,
|
|
60
|
+
onRow: _propTypes.default.func,
|
|
61
|
+
onRowClick: _propTypes.default.func,
|
|
62
|
+
onRowContextMenu: _propTypes.default.func,
|
|
63
|
+
onRowDoubleClick: _propTypes.default.func,
|
|
64
|
+
onRowMouseEnter: _propTypes.default.func,
|
|
65
|
+
onRowMouseLeave: _propTypes.default.func,
|
|
66
|
+
prefixCls: _propTypes.default.string,
|
|
67
|
+
record: _propTypes.default.object,
|
|
68
|
+
renderExpandIcon: _propTypes.default.func,
|
|
69
|
+
replaceClassName: _propTypes.default.string,
|
|
70
|
+
rowExpandable: _propTypes.default.func,
|
|
71
|
+
rowKey: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired,
|
|
72
|
+
selected: _propTypes.default.bool,
|
|
73
|
+
store: _propTypes.default.object,
|
|
74
|
+
style: _propTypes.default.object,
|
|
75
|
+
virtualized: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.bool]),
|
|
76
|
+
visible: _propTypes.default.bool.isRequired
|
|
77
|
+
};
|
|
78
|
+
exports.baseRowPropTypes = baseRowPropTypes;
|
|
34
79
|
class TableRow extends _baseComponent.default {
|
|
35
80
|
get adapter() {
|
|
36
81
|
var _this = this;
|
|
@@ -272,47 +317,7 @@ class TableRow extends _baseComponent.default {
|
|
|
272
317
|
}
|
|
273
318
|
}
|
|
274
319
|
exports.default = TableRow;
|
|
275
|
-
TableRow.propTypes =
|
|
276
|
-
anyColumnFixed: _propTypes.default.bool,
|
|
277
|
-
cellWidths: _propTypes.default.array.isRequired,
|
|
278
|
-
className: _propTypes.default.string,
|
|
279
|
-
columns: _propTypes.default.array.isRequired,
|
|
280
|
-
components: _propTypes.default.object.isRequired,
|
|
281
|
-
disabled: _propTypes.default.bool,
|
|
282
|
-
expandIcon: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.func, _propTypes.default.node]),
|
|
283
|
-
expandableRow: _propTypes.default.bool,
|
|
284
|
-
expanded: _propTypes.default.bool,
|
|
285
|
-
displayNone: _propTypes.default.bool,
|
|
286
|
-
expandedRow: _propTypes.default.bool,
|
|
287
|
-
fixed: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
288
|
-
height: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
289
|
-
hideExpandedColumn: _propTypes.default.bool,
|
|
290
|
-
hovered: _propTypes.default.bool.isRequired,
|
|
291
|
-
indent: _propTypes.default.number,
|
|
292
|
-
indentSize: _propTypes.default.number,
|
|
293
|
-
index: _propTypes.default.number,
|
|
294
|
-
isSection: _propTypes.default.bool,
|
|
295
|
-
level: _propTypes.default.number,
|
|
296
|
-
onDidUpdate: _propTypes.default.func,
|
|
297
|
-
onHover: _propTypes.default.func,
|
|
298
|
-
onRow: _propTypes.default.func,
|
|
299
|
-
onRowClick: _propTypes.default.func,
|
|
300
|
-
onRowContextMenu: _propTypes.default.func,
|
|
301
|
-
onRowDoubleClick: _propTypes.default.func,
|
|
302
|
-
onRowMouseEnter: _propTypes.default.func,
|
|
303
|
-
onRowMouseLeave: _propTypes.default.func,
|
|
304
|
-
prefixCls: _propTypes.default.string,
|
|
305
|
-
record: _propTypes.default.object,
|
|
306
|
-
renderExpandIcon: _propTypes.default.func,
|
|
307
|
-
replaceClassName: _propTypes.default.string,
|
|
308
|
-
rowExpandable: _propTypes.default.func,
|
|
309
|
-
rowKey: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired,
|
|
310
|
-
selected: _propTypes.default.bool,
|
|
311
|
-
store: _propTypes.default.object,
|
|
312
|
-
style: _propTypes.default.object,
|
|
313
|
-
virtualized: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.bool]),
|
|
314
|
-
visible: _propTypes.default.bool.isRequired
|
|
315
|
-
};
|
|
320
|
+
TableRow.propTypes = baseRowPropTypes;
|
|
316
321
|
TableRow.defaultProps = {
|
|
317
322
|
columns: [],
|
|
318
323
|
rowExpandable: _stubTrue2.default,
|
|
@@ -24,6 +24,30 @@ export interface SectionRowProps {
|
|
|
24
24
|
store?: Store;
|
|
25
25
|
rowKey?: RowKey<any>;
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* avoid affected by https://www.npmjs.com/package/babel-plugin-transform-react-remove-prop-types
|
|
29
|
+
*/
|
|
30
|
+
export declare const sectionRowPropTypes: {
|
|
31
|
+
record: PropTypes.Requireable<object>;
|
|
32
|
+
index: PropTypes.Requireable<number>;
|
|
33
|
+
columns: PropTypes.Requireable<any[]>;
|
|
34
|
+
group: PropTypes.Validator<object>;
|
|
35
|
+
groupKey: PropTypes.Validator<NonNullable<NonNullable<string | number>>>;
|
|
36
|
+
data: PropTypes.Requireable<any[]>;
|
|
37
|
+
renderGroupSection: PropTypes.Requireable<(...args: any[]) => any>;
|
|
38
|
+
onGroupedRow: PropTypes.Requireable<(...args: any[]) => any>;
|
|
39
|
+
clickGroupedRowToExpand: PropTypes.Requireable<boolean>;
|
|
40
|
+
components: PropTypes.Requireable<object>;
|
|
41
|
+
expanded: PropTypes.Requireable<boolean>;
|
|
42
|
+
prefixCls: PropTypes.Requireable<string>;
|
|
43
|
+
onExpand: PropTypes.Requireable<(...args: any[]) => any>;
|
|
44
|
+
virtualized: PropTypes.Requireable<NonNullable<boolean | object>>;
|
|
45
|
+
style: PropTypes.Requireable<object>;
|
|
46
|
+
renderExpandIcon: PropTypes.Requireable<(...args: any[]) => any>;
|
|
47
|
+
className: PropTypes.Requireable<string>;
|
|
48
|
+
store: PropTypes.Requireable<object>;
|
|
49
|
+
rowKey: PropTypes.Requireable<NonNullable<string | number | ((...args: any[]) => any)>>;
|
|
50
|
+
};
|
|
27
51
|
/**
|
|
28
52
|
* Grouping component title row
|
|
29
53
|
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.sectionRowPropTypes = exports.default = void 0;
|
|
7
7
|
var _isSet2 = _interopRequireDefault(require("lodash/isSet"));
|
|
8
8
|
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -24,9 +24,34 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
24
24
|
}
|
|
25
25
|
return t;
|
|
26
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* avoid affected by https://www.npmjs.com/package/babel-plugin-transform-react-remove-prop-types
|
|
29
|
+
*/
|
|
30
|
+
const sectionRowPropTypes = {
|
|
31
|
+
record: _propTypes.default.object,
|
|
32
|
+
index: _propTypes.default.number,
|
|
33
|
+
columns: _propTypes.default.array,
|
|
34
|
+
group: _propTypes.default.object.isRequired,
|
|
35
|
+
groupKey: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired,
|
|
36
|
+
data: _propTypes.default.array,
|
|
37
|
+
renderGroupSection: _propTypes.default.func,
|
|
38
|
+
onGroupedRow: _propTypes.default.func,
|
|
39
|
+
clickGroupedRowToExpand: _propTypes.default.bool,
|
|
40
|
+
components: _propTypes.default.object,
|
|
41
|
+
expanded: _propTypes.default.bool,
|
|
42
|
+
prefixCls: _propTypes.default.string,
|
|
43
|
+
onExpand: _propTypes.default.func,
|
|
44
|
+
virtualized: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.object]),
|
|
45
|
+
style: _propTypes.default.object,
|
|
46
|
+
renderExpandIcon: _propTypes.default.func,
|
|
47
|
+
className: _propTypes.default.string,
|
|
48
|
+
store: _propTypes.default.object,
|
|
49
|
+
rowKey: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.func])
|
|
50
|
+
};
|
|
27
51
|
/**
|
|
28
52
|
* Grouping component title row
|
|
29
53
|
*/
|
|
54
|
+
exports.sectionRowPropTypes = sectionRowPropTypes;
|
|
30
55
|
class SectionRow extends _react.PureComponent {
|
|
31
56
|
constructor() {
|
|
32
57
|
var _this;
|
|
@@ -154,27 +179,7 @@ class SectionRow extends _react.PureComponent {
|
|
|
154
179
|
}
|
|
155
180
|
}
|
|
156
181
|
SectionRow.contextType = _tableContext.default;
|
|
157
|
-
SectionRow.propTypes =
|
|
158
|
-
record: _propTypes.default.object,
|
|
159
|
-
index: _propTypes.default.number,
|
|
160
|
-
columns: _propTypes.default.array,
|
|
161
|
-
group: _propTypes.default.object.isRequired,
|
|
162
|
-
groupKey: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired,
|
|
163
|
-
data: _propTypes.default.array,
|
|
164
|
-
renderGroupSection: _propTypes.default.func,
|
|
165
|
-
onGroupedRow: _propTypes.default.func,
|
|
166
|
-
clickGroupedRowToExpand: _propTypes.default.bool,
|
|
167
|
-
components: _propTypes.default.object,
|
|
168
|
-
expanded: _propTypes.default.bool,
|
|
169
|
-
prefixCls: _propTypes.default.string,
|
|
170
|
-
onExpand: _propTypes.default.func,
|
|
171
|
-
virtualized: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.object]),
|
|
172
|
-
style: _propTypes.default.object,
|
|
173
|
-
renderExpandIcon: _propTypes.default.func,
|
|
174
|
-
className: _propTypes.default.string,
|
|
175
|
-
store: _propTypes.default.object,
|
|
176
|
-
rowKey: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.func])
|
|
177
|
-
};
|
|
182
|
+
SectionRow.propTypes = sectionRowPropTypes;
|
|
178
183
|
SectionRow.defaultProps = {
|
|
179
184
|
prefixCls: _constants.cssClasses.PREFIX,
|
|
180
185
|
components: {
|
|
@@ -22,11 +22,13 @@ var _constants = require("@douyinfe/semi-foundation/lib/cjs/table/constants");
|
|
|
22
22
|
var _baseComponent = _interopRequireDefault(require("../../_base/baseComponent"));
|
|
23
23
|
var _utils2 = require("../utils");
|
|
24
24
|
var _ColGroup = _interopRequireDefault(require("../ColGroup"));
|
|
25
|
-
var _BaseRow =
|
|
25
|
+
var _BaseRow = _interopRequireWildcard(require("./BaseRow"));
|
|
26
26
|
var _ExpandedRow = _interopRequireDefault(require("./ExpandedRow"));
|
|
27
|
-
var _SectionRow =
|
|
27
|
+
var _SectionRow = _interopRequireWildcard(require("./SectionRow"));
|
|
28
28
|
var _TableHeader = _interopRequireDefault(require("../TableHeader"));
|
|
29
29
|
var _tableContext = _interopRequireDefault(require("../table-context"));
|
|
30
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
30
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
33
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
32
34
|
var t = {};
|
|
@@ -278,7 +280,7 @@ class Body extends _baseComponent.default {
|
|
|
278
280
|
groupKey,
|
|
279
281
|
index
|
|
280
282
|
} = props;
|
|
281
|
-
const sectionRowPickKeys = Object.keys(_SectionRow.
|
|
283
|
+
const sectionRowPickKeys = Object.keys(_SectionRow.sectionRowPropTypes);
|
|
282
284
|
const sectionRowProps = (0, _pick2.default)(props, sectionRowPickKeys);
|
|
283
285
|
const {
|
|
284
286
|
handleRowExpanded
|
|
@@ -602,7 +604,7 @@ class Body extends _baseComponent.default {
|
|
|
602
604
|
disabledRowKeysSet,
|
|
603
605
|
expandRowByClick
|
|
604
606
|
} = props;
|
|
605
|
-
const baseRowPickKeys = Object.keys(_BaseRow.
|
|
607
|
+
const baseRowPickKeys = Object.keys(_BaseRow.baseRowPropTypes);
|
|
606
608
|
const baseRowProps = (0, _pick2.default)(props, baseRowPickKeys);
|
|
607
609
|
let key = (0, _utils.getRecordKey)(record, rowKey);
|
|
608
610
|
if (key == null) {
|
|
@@ -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
|
}
|
|
@@ -46,6 +46,50 @@ export interface BaseRowProps {
|
|
|
46
46
|
/** whether display none */
|
|
47
47
|
displayNone?: boolean;
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* avoid affected by https://www.npmjs.com/package/babel-plugin-transform-react-remove-prop-types
|
|
51
|
+
*/
|
|
52
|
+
export declare const baseRowPropTypes: {
|
|
53
|
+
anyColumnFixed: PropTypes.Requireable<boolean>;
|
|
54
|
+
cellWidths: PropTypes.Validator<any[]>;
|
|
55
|
+
className: PropTypes.Requireable<string>;
|
|
56
|
+
columns: PropTypes.Validator<any[]>;
|
|
57
|
+
components: PropTypes.Validator<object>;
|
|
58
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
59
|
+
expandIcon: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>>;
|
|
60
|
+
expandableRow: PropTypes.Requireable<boolean>;
|
|
61
|
+
expanded: PropTypes.Requireable<boolean>;
|
|
62
|
+
displayNone: PropTypes.Requireable<boolean>;
|
|
63
|
+
expandedRow: PropTypes.Requireable<boolean>;
|
|
64
|
+
fixed: PropTypes.Requireable<NonNullable<string | boolean>>;
|
|
65
|
+
height: PropTypes.Requireable<NonNullable<string | number>>;
|
|
66
|
+
hideExpandedColumn: PropTypes.Requireable<boolean>;
|
|
67
|
+
hovered: PropTypes.Validator<boolean>;
|
|
68
|
+
indent: PropTypes.Requireable<number>;
|
|
69
|
+
indentSize: PropTypes.Requireable<number>;
|
|
70
|
+
index: PropTypes.Requireable<number>;
|
|
71
|
+
isSection: PropTypes.Requireable<boolean>;
|
|
72
|
+
level: PropTypes.Requireable<number>;
|
|
73
|
+
onDidUpdate: PropTypes.Requireable<(...args: any[]) => any>;
|
|
74
|
+
onHover: PropTypes.Requireable<(...args: any[]) => any>;
|
|
75
|
+
onRow: PropTypes.Requireable<(...args: any[]) => any>;
|
|
76
|
+
onRowClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
77
|
+
onRowContextMenu: PropTypes.Requireable<(...args: any[]) => any>;
|
|
78
|
+
onRowDoubleClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
79
|
+
onRowMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
80
|
+
onRowMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
|
81
|
+
prefixCls: PropTypes.Requireable<string>;
|
|
82
|
+
record: PropTypes.Requireable<object>;
|
|
83
|
+
renderExpandIcon: PropTypes.Requireable<(...args: any[]) => any>;
|
|
84
|
+
replaceClassName: PropTypes.Requireable<string>;
|
|
85
|
+
rowExpandable: PropTypes.Requireable<(...args: any[]) => any>;
|
|
86
|
+
rowKey: PropTypes.Validator<NonNullable<NonNullable<string | number>>>;
|
|
87
|
+
selected: PropTypes.Requireable<boolean>;
|
|
88
|
+
store: PropTypes.Requireable<object>;
|
|
89
|
+
style: PropTypes.Requireable<object>;
|
|
90
|
+
virtualized: PropTypes.Requireable<NonNullable<boolean | object>>;
|
|
91
|
+
visible: PropTypes.Validator<boolean>;
|
|
92
|
+
};
|
|
49
93
|
export default class TableRow extends BaseComponent<BaseRowProps, Record<string, any>> {
|
|
50
94
|
static propTypes: {
|
|
51
95
|
anyColumnFixed: PropTypes.Requireable<boolean>;
|
|
@@ -22,6 +22,50 @@ import TableRowFoundation from '@douyinfe/semi-foundation/lib/es/table/tableRowF
|
|
|
22
22
|
import { isLastLeftFixed, arrayAdd, isFixedLeft, isFixedRight, isScrollbarColumn, isFirstFixedRight, isInnerColumnKey, isExpandedColumn } from '@douyinfe/semi-foundation/lib/es/table/utils';
|
|
23
23
|
import BaseComponent from '../../_base/baseComponent';
|
|
24
24
|
import TableCell from '../TableCell';
|
|
25
|
+
/**
|
|
26
|
+
* avoid affected by https://www.npmjs.com/package/babel-plugin-transform-react-remove-prop-types
|
|
27
|
+
*/
|
|
28
|
+
export const baseRowPropTypes = {
|
|
29
|
+
anyColumnFixed: PropTypes.bool,
|
|
30
|
+
cellWidths: PropTypes.array.isRequired,
|
|
31
|
+
className: PropTypes.string,
|
|
32
|
+
columns: PropTypes.array.isRequired,
|
|
33
|
+
components: PropTypes.object.isRequired,
|
|
34
|
+
disabled: PropTypes.bool,
|
|
35
|
+
expandIcon: PropTypes.oneOfType([PropTypes.bool, PropTypes.func, PropTypes.node]),
|
|
36
|
+
expandableRow: PropTypes.bool,
|
|
37
|
+
expanded: PropTypes.bool,
|
|
38
|
+
displayNone: PropTypes.bool,
|
|
39
|
+
expandedRow: PropTypes.bool,
|
|
40
|
+
fixed: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
41
|
+
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
42
|
+
hideExpandedColumn: PropTypes.bool,
|
|
43
|
+
hovered: PropTypes.bool.isRequired,
|
|
44
|
+
indent: PropTypes.number,
|
|
45
|
+
indentSize: PropTypes.number,
|
|
46
|
+
index: PropTypes.number,
|
|
47
|
+
isSection: PropTypes.bool,
|
|
48
|
+
level: PropTypes.number,
|
|
49
|
+
onDidUpdate: PropTypes.func,
|
|
50
|
+
onHover: PropTypes.func,
|
|
51
|
+
onRow: PropTypes.func,
|
|
52
|
+
onRowClick: PropTypes.func,
|
|
53
|
+
onRowContextMenu: PropTypes.func,
|
|
54
|
+
onRowDoubleClick: PropTypes.func,
|
|
55
|
+
onRowMouseEnter: PropTypes.func,
|
|
56
|
+
onRowMouseLeave: PropTypes.func,
|
|
57
|
+
prefixCls: PropTypes.string,
|
|
58
|
+
record: PropTypes.object,
|
|
59
|
+
renderExpandIcon: PropTypes.func,
|
|
60
|
+
replaceClassName: PropTypes.string,
|
|
61
|
+
rowExpandable: PropTypes.func,
|
|
62
|
+
rowKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
|
63
|
+
selected: PropTypes.bool,
|
|
64
|
+
store: PropTypes.object,
|
|
65
|
+
style: PropTypes.object,
|
|
66
|
+
virtualized: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]),
|
|
67
|
+
visible: PropTypes.bool.isRequired
|
|
68
|
+
};
|
|
25
69
|
export default class TableRow extends BaseComponent {
|
|
26
70
|
get adapter() {
|
|
27
71
|
var _this = this;
|
|
@@ -262,47 +306,7 @@ export default class TableRow extends BaseComponent {
|
|
|
262
306
|
}), this.renderCells());
|
|
263
307
|
}
|
|
264
308
|
}
|
|
265
|
-
TableRow.propTypes =
|
|
266
|
-
anyColumnFixed: PropTypes.bool,
|
|
267
|
-
cellWidths: PropTypes.array.isRequired,
|
|
268
|
-
className: PropTypes.string,
|
|
269
|
-
columns: PropTypes.array.isRequired,
|
|
270
|
-
components: PropTypes.object.isRequired,
|
|
271
|
-
disabled: PropTypes.bool,
|
|
272
|
-
expandIcon: PropTypes.oneOfType([PropTypes.bool, PropTypes.func, PropTypes.node]),
|
|
273
|
-
expandableRow: PropTypes.bool,
|
|
274
|
-
expanded: PropTypes.bool,
|
|
275
|
-
displayNone: PropTypes.bool,
|
|
276
|
-
expandedRow: PropTypes.bool,
|
|
277
|
-
fixed: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
278
|
-
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
279
|
-
hideExpandedColumn: PropTypes.bool,
|
|
280
|
-
hovered: PropTypes.bool.isRequired,
|
|
281
|
-
indent: PropTypes.number,
|
|
282
|
-
indentSize: PropTypes.number,
|
|
283
|
-
index: PropTypes.number,
|
|
284
|
-
isSection: PropTypes.bool,
|
|
285
|
-
level: PropTypes.number,
|
|
286
|
-
onDidUpdate: PropTypes.func,
|
|
287
|
-
onHover: PropTypes.func,
|
|
288
|
-
onRow: PropTypes.func,
|
|
289
|
-
onRowClick: PropTypes.func,
|
|
290
|
-
onRowContextMenu: PropTypes.func,
|
|
291
|
-
onRowDoubleClick: PropTypes.func,
|
|
292
|
-
onRowMouseEnter: PropTypes.func,
|
|
293
|
-
onRowMouseLeave: PropTypes.func,
|
|
294
|
-
prefixCls: PropTypes.string,
|
|
295
|
-
record: PropTypes.object,
|
|
296
|
-
renderExpandIcon: PropTypes.func,
|
|
297
|
-
replaceClassName: PropTypes.string,
|
|
298
|
-
rowExpandable: PropTypes.func,
|
|
299
|
-
rowKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
|
300
|
-
selected: PropTypes.bool,
|
|
301
|
-
store: PropTypes.object,
|
|
302
|
-
style: PropTypes.object,
|
|
303
|
-
virtualized: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]),
|
|
304
|
-
visible: PropTypes.bool.isRequired
|
|
305
|
-
};
|
|
309
|
+
TableRow.propTypes = baseRowPropTypes;
|
|
306
310
|
TableRow.defaultProps = {
|
|
307
311
|
columns: [],
|
|
308
312
|
rowExpandable: _stubTrue,
|