@douyinfe/semi-ui 2.51.4 → 2.52.0-beta.0
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/css/semi.css +285 -0
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +488 -214
- 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/_utils/index.d.ts +2 -1
- package/lib/cjs/_utils/index.js +0 -5
- package/lib/cjs/avatar/TopSlotSvg.d.ts +5 -0
- package/lib/cjs/avatar/TopSlotSvg.js +74 -0
- package/lib/cjs/avatar/index.d.ts +25 -0
- package/lib/cjs/avatar/index.js +126 -8
- package/lib/cjs/avatar/interface.d.ts +24 -1
- package/lib/cjs/cascader/index.d.ts +2 -3
- package/lib/cjs/cascader/index.js +19 -28
- package/lib/cjs/datePicker/datePicker.js +1 -1
- package/lib/cjs/datePicker/yearAndMonth.js +16 -20
- package/lib/cjs/dropdown/dropdownItem.js +2 -1
- package/lib/cjs/form/hoc/withField.d.ts +3 -3
- package/lib/cjs/input/index.d.ts +1 -0
- package/lib/cjs/input/index.js +12 -4
- package/lib/cjs/modal/Modal.d.ts +1 -0
- package/lib/cjs/modal/Modal.js +13 -5
- package/lib/cjs/modal/confirm.d.ts +5 -0
- package/lib/cjs/select/option.js +1 -2
- package/lib/cjs/slider/index.js +33 -1
- package/lib/cjs/table/ColumnFilter.d.ts +34 -18
- package/lib/cjs/table/ColumnFilter.js +134 -73
- package/lib/cjs/table/ResizableTable.js +1 -1
- package/lib/cjs/table/Table.d.ts +5 -5
- package/lib/cjs/table/Table.js +38 -13
- package/lib/cjs/table/index.d.ts +1 -1
- package/lib/cjs/table/interface.d.ts +30 -10
- package/lib/cjs/treeSelect/index.d.ts +2 -0
- package/lib/cjs/treeSelect/index.js +4 -0
- package/lib/es/_utils/index.d.ts +2 -1
- package/lib/es/_utils/index.js +0 -5
- package/lib/es/avatar/TopSlotSvg.d.ts +5 -0
- package/lib/es/avatar/TopSlotSvg.js +66 -0
- package/lib/es/avatar/index.d.ts +25 -0
- package/lib/es/avatar/index.js +126 -8
- package/lib/es/avatar/interface.d.ts +24 -1
- package/lib/es/cascader/index.d.ts +2 -3
- package/lib/es/cascader/index.js +19 -28
- package/lib/es/datePicker/datePicker.js +1 -1
- package/lib/es/datePicker/yearAndMonth.js +16 -20
- package/lib/es/dropdown/dropdownItem.js +2 -1
- package/lib/es/form/hoc/withField.d.ts +3 -3
- package/lib/es/input/index.d.ts +1 -0
- package/lib/es/input/index.js +12 -4
- package/lib/es/modal/Modal.d.ts +1 -0
- package/lib/es/modal/Modal.js +13 -5
- package/lib/es/modal/confirm.d.ts +5 -0
- package/lib/es/select/option.js +1 -2
- package/lib/es/slider/index.js +33 -1
- package/lib/es/table/ColumnFilter.d.ts +34 -18
- package/lib/es/table/ColumnFilter.js +135 -74
- package/lib/es/table/ResizableTable.js +1 -1
- package/lib/es/table/Table.d.ts +5 -5
- package/lib/es/table/Table.js +38 -13
- package/lib/es/table/index.d.ts +1 -1
- package/lib/es/table/interface.d.ts +30 -10
- package/lib/es/treeSelect/index.d.ts +2 -0
- package/lib/es/treeSelect/index.js +4 -0
- package/package.json +8 -8
|
@@ -11,7 +11,8 @@ export declare function stopPropagation(e: React.MouseEvent | React.FocusEvent<H
|
|
|
11
11
|
*
|
|
12
12
|
* skip clone function and react element
|
|
13
13
|
*/
|
|
14
|
-
export declare function cloneDeep(value:
|
|
14
|
+
export declare function cloneDeep<T>(value: T): T;
|
|
15
|
+
export declare function cloneDeep<T>(value: T, customizer: (value: any) => any): any;
|
|
15
16
|
/**
|
|
16
17
|
* [getHighLightTextHTML description]
|
|
17
18
|
*
|
package/lib/cjs/_utils/index.js
CHANGED
|
@@ -33,11 +33,6 @@ function stopPropagation(e, noImmediate) {
|
|
|
33
33
|
e.nativeEvent.stopImmediatePropagation();
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
/**
|
|
37
|
-
* use in Table, Form, Navigation
|
|
38
|
-
*
|
|
39
|
-
* skip clone function and react element
|
|
40
|
-
*/
|
|
41
36
|
function cloneDeep(value, customizer) {
|
|
42
37
|
return (0, _cloneDeepWith2.default)(value, v => {
|
|
43
38
|
if (typeof customizer === 'function') {
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _uuid = require("@douyinfe/semi-foundation/lib/cjs/utils/uuid");
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
const TopSlotSvg = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
gradientStart,
|
|
13
|
+
gradientEnd
|
|
14
|
+
} = _ref;
|
|
15
|
+
const id = (0, _uuid.getUuidShort)();
|
|
16
|
+
return /*#__PURE__*/_react.default.createElement("svg", {
|
|
17
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18
|
+
width: "51",
|
|
19
|
+
height: "52",
|
|
20
|
+
viewBox: "0 0 51 52",
|
|
21
|
+
fill: "none"
|
|
22
|
+
}, /*#__PURE__*/_react.default.createElement("g", {
|
|
23
|
+
filter: "url(#filter0_d_6_2)"
|
|
24
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
25
|
+
d: "M40.4918 46.5592C44.6795 43.176 46.261 34.1333 47.5301 25.6141C49.5854 11.8168 39.6662 1 25.8097 1C11.2857 1 3 11.4279 3 25.3518C3 33.7866 6.29361 43.8947 10.4602 46.5592C12.5868 47.9192 12.5868 47.9051 25.8097 47.9192C38.3651 47.9282 38.5352 48.14 40.4918 46.5592Z",
|
|
26
|
+
fill: `url(#${id})`
|
|
27
|
+
})), /*#__PURE__*/_react.default.createElement("defs", null, /*#__PURE__*/_react.default.createElement("filter", {
|
|
28
|
+
id: "filter0_d_6_2",
|
|
29
|
+
x: "0.789215",
|
|
30
|
+
y: "0.447304",
|
|
31
|
+
width: "49.2216",
|
|
32
|
+
height: "51.3549",
|
|
33
|
+
filterUnits: "userSpaceOnUse",
|
|
34
|
+
colorInterpolationFilters: "sRGB"
|
|
35
|
+
}, /*#__PURE__*/_react.default.createElement("feFlood", {
|
|
36
|
+
floodOpacity: "0",
|
|
37
|
+
result: "BackgroundImageFix"
|
|
38
|
+
}), /*#__PURE__*/_react.default.createElement("feColorMatrix", {
|
|
39
|
+
in: "SourceAlpha",
|
|
40
|
+
type: "matrix",
|
|
41
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",
|
|
42
|
+
result: "hardAlpha"
|
|
43
|
+
}), /*#__PURE__*/_react.default.createElement("feOffset", {
|
|
44
|
+
dy: "1.65809"
|
|
45
|
+
}), /*#__PURE__*/_react.default.createElement("feGaussianBlur", {
|
|
46
|
+
stdDeviation: "1.10539"
|
|
47
|
+
}), /*#__PURE__*/_react.default.createElement("feColorMatrix", {
|
|
48
|
+
type: "matrix",
|
|
49
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0"
|
|
50
|
+
}), /*#__PURE__*/_react.default.createElement("feBlend", {
|
|
51
|
+
mode: "normal",
|
|
52
|
+
in2: "BackgroundImageFix",
|
|
53
|
+
result: "effect1_dropShadow_6_2"
|
|
54
|
+
}), /*#__PURE__*/_react.default.createElement("feBlend", {
|
|
55
|
+
mode: "normal",
|
|
56
|
+
in: "SourceGraphic",
|
|
57
|
+
in2: "effect1_dropShadow_6_2",
|
|
58
|
+
result: "shape"
|
|
59
|
+
})), /*#__PURE__*/_react.default.createElement("linearGradient", {
|
|
60
|
+
id: id,
|
|
61
|
+
x1: "17.671",
|
|
62
|
+
y1: "31.7392",
|
|
63
|
+
x2: "17.671",
|
|
64
|
+
y2: "47.9333",
|
|
65
|
+
gradientUnits: "userSpaceOnUse"
|
|
66
|
+
}, /*#__PURE__*/_react.default.createElement("stop", {
|
|
67
|
+
stopColor: gradientStart
|
|
68
|
+
}), /*#__PURE__*/_react.default.createElement("stop", {
|
|
69
|
+
offset: "1",
|
|
70
|
+
stopColor: gradientEnd
|
|
71
|
+
}))));
|
|
72
|
+
};
|
|
73
|
+
var _default = TopSlotSvg;
|
|
74
|
+
exports.default = _default;
|
|
@@ -40,6 +40,29 @@ export default class Avatar extends BaseComponent<AvatarProps, AvatarState> {
|
|
|
40
40
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
41
41
|
onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
42
42
|
onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
|
43
|
+
bottomSlot: PropTypes.Requireable<PropTypes.InferProps<{
|
|
44
|
+
render: PropTypes.Requireable<(...args: any[]) => any>;
|
|
45
|
+
shape: PropTypes.Requireable<string>;
|
|
46
|
+
text: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
47
|
+
bgColor: PropTypes.Requireable<string>;
|
|
48
|
+
textColor: PropTypes.Requireable<string>;
|
|
49
|
+
className: PropTypes.Requireable<string>;
|
|
50
|
+
style: PropTypes.Requireable<object>;
|
|
51
|
+
}>>;
|
|
52
|
+
topSlot: PropTypes.Requireable<PropTypes.InferProps<{
|
|
53
|
+
render: PropTypes.Requireable<(...args: any[]) => any>;
|
|
54
|
+
gradientStart: PropTypes.Requireable<string>;
|
|
55
|
+
gradientEnd: PropTypes.Requireable<string>;
|
|
56
|
+
text: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
57
|
+
textColor: PropTypes.Requireable<string>;
|
|
58
|
+
className: PropTypes.Requireable<string>;
|
|
59
|
+
style: PropTypes.Requireable<object>;
|
|
60
|
+
}>>;
|
|
61
|
+
border: PropTypes.Requireable<NonNullable<boolean | PropTypes.InferProps<{
|
|
62
|
+
color: PropTypes.Requireable<string>;
|
|
63
|
+
motion: PropTypes.Requireable<boolean>;
|
|
64
|
+
}>>>;
|
|
65
|
+
contentMotion: PropTypes.Requireable<boolean>;
|
|
43
66
|
};
|
|
44
67
|
foundation: AvatarFoundation;
|
|
45
68
|
avatarRef: React.RefObject<HTMLElement | null>;
|
|
@@ -55,5 +78,7 @@ export default class Avatar extends BaseComponent<AvatarProps, AvatarState> {
|
|
|
55
78
|
handleFocusVisible: (event: React.FocusEvent) => void;
|
|
56
79
|
handleBlur: (event: React.FocusEvent) => void;
|
|
57
80
|
getContent: () => React.ReactNode;
|
|
81
|
+
renderBottomSlot: () => string | number | boolean | React.ReactFragment | JSX.Element;
|
|
82
|
+
renderTopSlot: () => string | number | boolean | React.ReactFragment | JSX.Element;
|
|
58
83
|
render(): JSX.Element;
|
|
59
84
|
}
|
package/lib/cjs/avatar/index.js
CHANGED
|
@@ -14,6 +14,7 @@ require("@douyinfe/semi-foundation/lib/cjs/avatar/avatar.css");
|
|
|
14
14
|
var _function = require("@douyinfe/semi-foundation/lib/cjs/utils/function");
|
|
15
15
|
var _baseComponent = _interopRequireDefault(require("../_base/baseComponent"));
|
|
16
16
|
var _a11y = require("@douyinfe/semi-foundation/lib/cjs/utils/a11y");
|
|
17
|
+
var _TopSlotSvg = _interopRequireDefault(require("./TopSlotSvg"));
|
|
17
18
|
var _interface = require("./interface");
|
|
18
19
|
Object.keys(_interface).forEach(function (key) {
|
|
19
20
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -107,6 +108,64 @@ class Avatar extends _baseComponent.default {
|
|
|
107
108
|
}
|
|
108
109
|
return content;
|
|
109
110
|
};
|
|
111
|
+
this.renderBottomSlot = () => {
|
|
112
|
+
var _a, _b;
|
|
113
|
+
if (!this.props.bottomSlot) {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
if (this.props.bottomSlot.render) {
|
|
117
|
+
return this.props.bottomSlot.render();
|
|
118
|
+
}
|
|
119
|
+
const renderContent = (_a = this.props.bottomSlot.render) !== null && _a !== void 0 ? _a : () => {
|
|
120
|
+
var _a;
|
|
121
|
+
const style = {};
|
|
122
|
+
if (this.props.bottomSlot.bgColor) {
|
|
123
|
+
style['backgroundColor'] = this.props.bottomSlot.bgColor;
|
|
124
|
+
}
|
|
125
|
+
if (this.props.bottomSlot.textColor) {
|
|
126
|
+
style['color'] = this.props.bottomSlot.textColor;
|
|
127
|
+
}
|
|
128
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
129
|
+
style: style,
|
|
130
|
+
className: (0, _classnames.default)(`${prefixCls}-bottom_slot-shape_${this.props.bottomSlot.shape}`, `${prefixCls}-bottom_slot-shape_${this.props.bottomSlot.shape}-${this.props.size}`, (_a = this.props.bottomSlot.className) !== null && _a !== void 0 ? _a : "")
|
|
131
|
+
}, this.props.bottomSlot.text);
|
|
132
|
+
};
|
|
133
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
134
|
+
className: (0, _classnames.default)([`${prefixCls}-bottom_slot`]),
|
|
135
|
+
style: (_b = this.props.bottomSlot.style) !== null && _b !== void 0 ? _b : {}
|
|
136
|
+
}, renderContent());
|
|
137
|
+
};
|
|
138
|
+
this.renderTopSlot = () => {
|
|
139
|
+
var _a, _b, _c, _d;
|
|
140
|
+
if (!this.props.topSlot) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
if (this.props.topSlot.render) {
|
|
144
|
+
return this.props.topSlot.render();
|
|
145
|
+
}
|
|
146
|
+
const textStyle = {};
|
|
147
|
+
if (this.props.topSlot.textColor) {
|
|
148
|
+
textStyle['color'] = this.props.topSlot.textColor;
|
|
149
|
+
}
|
|
150
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
151
|
+
style: (_a = this.props.topSlot.style) !== null && _a !== void 0 ? _a : {},
|
|
152
|
+
className: (0, _classnames.default)([`${prefixCls}-top_slot-wrapper`, (_b = this.props.topSlot.className) !== null && _b !== void 0 ? _b : "", {
|
|
153
|
+
[`${prefixCls}-animated`]: this.props.contentMotion
|
|
154
|
+
}])
|
|
155
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
156
|
+
className: (0, _classnames.default)([`${prefixCls}-top_slot-bg`, `${prefixCls}-top_slot-bg-${this.props.size}`])
|
|
157
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
158
|
+
className: (0, _classnames.default)([`${prefixCls}-top_slot-bg-svg`, `${prefixCls}-top_slot-bg-svg-${this.props.size}`])
|
|
159
|
+
}, /*#__PURE__*/_react.default.createElement(_TopSlotSvg.default, {
|
|
160
|
+
gradientStart: (_c = this.props.topSlot.gradientStart) !== null && _c !== void 0 ? _c : "var(--semi-color-primary)",
|
|
161
|
+
gradientEnd: (_d = this.props.topSlot.gradientEnd) !== null && _d !== void 0 ? _d : "var(--semi-color-primary)"
|
|
162
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
163
|
+
className: (0, _classnames.default)([`${prefixCls}-top_slot`])
|
|
164
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
165
|
+
style: textStyle,
|
|
166
|
+
className: (0, _classnames.default)([`${prefixCls}-top_slot-content`, `${prefixCls}-top_slot-content-${this.props.size}`])
|
|
167
|
+
}, this.props.topSlot.text)));
|
|
168
|
+
};
|
|
110
169
|
this.state = {
|
|
111
170
|
isImgExist: true,
|
|
112
171
|
hoverContent: '',
|
|
@@ -224,7 +283,8 @@ class Avatar extends _baseComponent.default {
|
|
|
224
283
|
}
|
|
225
284
|
}
|
|
226
285
|
render() {
|
|
227
|
-
|
|
286
|
+
var _a, _b;
|
|
287
|
+
const _c = this.props,
|
|
228
288
|
{
|
|
229
289
|
shape,
|
|
230
290
|
children,
|
|
@@ -238,9 +298,13 @@ class Avatar extends _baseComponent.default {
|
|
|
238
298
|
srcSet,
|
|
239
299
|
style,
|
|
240
300
|
alt,
|
|
241
|
-
gap
|
|
242
|
-
|
|
243
|
-
|
|
301
|
+
gap,
|
|
302
|
+
bottomSlot,
|
|
303
|
+
topSlot,
|
|
304
|
+
border,
|
|
305
|
+
contentMotion
|
|
306
|
+
} = _c,
|
|
307
|
+
others = __rest(_c, ["shape", "children", "size", "color", "className", "hoverMask", "onClick", "imgAttr", "src", "srcSet", "style", "alt", "gap", "bottomSlot", "topSlot", "border", "contentMotion"]);
|
|
244
308
|
const {
|
|
245
309
|
isImgExist,
|
|
246
310
|
hoverContent,
|
|
@@ -252,14 +316,15 @@ class Avatar extends _baseComponent.default {
|
|
|
252
316
|
[`${prefixCls}-${size}`]: size,
|
|
253
317
|
[`${prefixCls}-${color}`]: color && !isImg,
|
|
254
318
|
[`${prefixCls}-img`]: isImg,
|
|
255
|
-
[`${prefixCls}-focus`]: focusVisible
|
|
319
|
+
[`${prefixCls}-focus`]: focusVisible,
|
|
320
|
+
[`${prefixCls}-animated`]: contentMotion
|
|
256
321
|
}, className);
|
|
257
322
|
const hoverRender = hoverContent ? /*#__PURE__*/_react.default.createElement("div", {
|
|
258
323
|
className: `${prefixCls}-hover`,
|
|
259
324
|
"x-semi-prop": "hoverContent"
|
|
260
325
|
}, hoverContent) : null;
|
|
261
|
-
|
|
262
|
-
style: style,
|
|
326
|
+
let avatar = /*#__PURE__*/_react.default.createElement("span", Object.assign({}, others, {
|
|
327
|
+
style: border || bottomSlot || topSlot || border ? {} : style,
|
|
263
328
|
className: avatarCls,
|
|
264
329
|
onClick: onClick,
|
|
265
330
|
onMouseEnter: this.onEnter,
|
|
@@ -267,6 +332,36 @@ class Avatar extends _baseComponent.default {
|
|
|
267
332
|
role: 'listitem',
|
|
268
333
|
ref: this.avatarRef
|
|
269
334
|
}), this.getContent(), hoverRender);
|
|
335
|
+
if (border) {
|
|
336
|
+
const borderStyle = {};
|
|
337
|
+
if (border === null || border === void 0 ? void 0 : border.color) {
|
|
338
|
+
borderStyle['borderColor'] = border.color;
|
|
339
|
+
}
|
|
340
|
+
avatar = /*#__PURE__*/_react.default.createElement("div", {
|
|
341
|
+
style: Object.assign({
|
|
342
|
+
position: "relative"
|
|
343
|
+
}, style)
|
|
344
|
+
}, avatar, /*#__PURE__*/_react.default.createElement("span", {
|
|
345
|
+
style: borderStyle,
|
|
346
|
+
className: (0, _classnames.default)([`${prefixCls}-additionalBorder`, `${prefixCls}-additionalBorder-${size}`, {
|
|
347
|
+
[`${prefixCls}-${shape}`]: shape
|
|
348
|
+
}])
|
|
349
|
+
}), ((_a = this.props.border) === null || _a === void 0 ? void 0 : _a.motion) && /*#__PURE__*/_react.default.createElement("span", {
|
|
350
|
+
style: borderStyle,
|
|
351
|
+
className: (0, _classnames.default)([`${prefixCls}-additionalBorder`, `${prefixCls}-additionalBorder-${size}`, {
|
|
352
|
+
[`${prefixCls}-${shape}`]: shape,
|
|
353
|
+
[`${prefixCls}-additionalBorder-animated`]: (_b = this.props.border) === null || _b === void 0 ? void 0 : _b.motion
|
|
354
|
+
}])
|
|
355
|
+
}));
|
|
356
|
+
}
|
|
357
|
+
if (bottomSlot || topSlot || border) {
|
|
358
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
359
|
+
className: (0, _classnames.default)([`${prefixCls}-wrapper`]),
|
|
360
|
+
style: style
|
|
361
|
+
}, avatar, topSlot && ["small", "default", "medium", "large", "extra-large"].includes(size) && shape === "circle" && this.renderTopSlot(), bottomSlot && ["small", "default", "medium", "large", "extra-large"].includes(size) && this.renderBottomSlot());
|
|
362
|
+
} else {
|
|
363
|
+
return avatar;
|
|
364
|
+
}
|
|
270
365
|
}
|
|
271
366
|
}
|
|
272
367
|
exports.default = Avatar;
|
|
@@ -295,6 +390,29 @@ Avatar.propTypes = {
|
|
|
295
390
|
onError: _propTypes.default.func,
|
|
296
391
|
onClick: _propTypes.default.func,
|
|
297
392
|
onMouseEnter: _propTypes.default.func,
|
|
298
|
-
onMouseLeave: _propTypes.default.func
|
|
393
|
+
onMouseLeave: _propTypes.default.func,
|
|
394
|
+
bottomSlot: _propTypes.default.shape({
|
|
395
|
+
render: _propTypes.default.func,
|
|
396
|
+
shape: _propTypes.default.oneOf(['circle', 'square']),
|
|
397
|
+
text: _propTypes.default.node,
|
|
398
|
+
bgColor: _propTypes.default.string,
|
|
399
|
+
textColor: _propTypes.default.string,
|
|
400
|
+
className: _propTypes.default.string,
|
|
401
|
+
style: _propTypes.default.object
|
|
402
|
+
}),
|
|
403
|
+
topSlot: _propTypes.default.shape({
|
|
404
|
+
render: _propTypes.default.func,
|
|
405
|
+
gradientStart: _propTypes.default.string,
|
|
406
|
+
gradientEnd: _propTypes.default.string,
|
|
407
|
+
text: _propTypes.default.node,
|
|
408
|
+
textColor: _propTypes.default.string,
|
|
409
|
+
className: _propTypes.default.string,
|
|
410
|
+
style: _propTypes.default.object
|
|
411
|
+
}),
|
|
412
|
+
border: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
413
|
+
color: _propTypes.default.string,
|
|
414
|
+
motion: _propTypes.default.bool
|
|
415
|
+
}), _propTypes.default.bool]),
|
|
416
|
+
contentMotion: _propTypes.default.bool
|
|
299
417
|
};
|
|
300
418
|
Avatar.elementType = 'Avatar';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
2
|
import { BaseProps } from '../_base/baseComponent';
|
|
3
3
|
export type AvatarShape = 'circle' | 'square';
|
|
4
4
|
export type AvatarSize = 'extra-extra-small' | 'extra-small' | 'small' | 'default' | 'medium' | 'large' | 'extra-large';
|
|
@@ -18,6 +18,29 @@ export interface AvatarProps extends BaseProps {
|
|
|
18
18
|
onMouseEnter?: React.MouseEventHandler;
|
|
19
19
|
onMouseLeave?: React.MouseEventHandler;
|
|
20
20
|
imgAttr?: React.ImgHTMLAttributes<HTMLImageElement>;
|
|
21
|
+
bottomSlot?: {
|
|
22
|
+
render?: () => React.ReactNode;
|
|
23
|
+
shape?: "circle" | "square";
|
|
24
|
+
text: React.ReactNode;
|
|
25
|
+
bgColor: string;
|
|
26
|
+
textColor: string;
|
|
27
|
+
className: string;
|
|
28
|
+
style?: CSSProperties;
|
|
29
|
+
};
|
|
30
|
+
topSlot?: {
|
|
31
|
+
render?: () => React.ReactNode;
|
|
32
|
+
gradientStart?: string;
|
|
33
|
+
gradientEnd?: string;
|
|
34
|
+
text: React.ReactNode;
|
|
35
|
+
textColor: string;
|
|
36
|
+
className: string;
|
|
37
|
+
style?: CSSProperties;
|
|
38
|
+
};
|
|
39
|
+
border?: {
|
|
40
|
+
color?: string;
|
|
41
|
+
motion?: boolean;
|
|
42
|
+
} & boolean;
|
|
43
|
+
contentMotion?: boolean;
|
|
21
44
|
}
|
|
22
45
|
export type AvatarGroupShape = 'circle' | 'square';
|
|
23
46
|
export type AvatarGroupSize = 'extra-extra-small' | 'extra-small' | 'small' | 'default' | 'medium' | 'large' | 'extra-large';
|
|
@@ -191,10 +191,9 @@ declare class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
191
191
|
componentWillUnmount(): void;
|
|
192
192
|
componentDidUpdate(prevProps: CascaderProps): void;
|
|
193
193
|
handleInputChange: (value: string) => void;
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
handleTagRemove: (e: any, tagValuePath: Array<string | number>) => void;
|
|
195
|
+
handleRemoveByKey: (key: any) => void;
|
|
196
196
|
renderTagItem: (nodeKey: string, idx: number) => string | number | boolean | React.ReactFragment | JSX.Element;
|
|
197
|
-
onRemoveInTagInput: (v: string) => void;
|
|
198
197
|
renderTagInput(): JSX.Element;
|
|
199
198
|
renderInput(): JSX.Element;
|
|
200
199
|
handleItemClick: (e: MouseEvent | KeyboardEvent, item: Entity | Data) => void;
|
|
@@ -43,13 +43,14 @@ class Cascader extends _baseComponent.default {
|
|
|
43
43
|
this.handleInputChange = value => {
|
|
44
44
|
this.foundation.handleInputChange(value);
|
|
45
45
|
};
|
|
46
|
-
this.
|
|
47
|
-
this.foundation.
|
|
46
|
+
this.handleTagRemove = (e, tagValuePath) => {
|
|
47
|
+
this.foundation.handleTagRemove(e, tagValuePath);
|
|
48
48
|
};
|
|
49
|
-
this.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
this.
|
|
49
|
+
this.handleRemoveByKey = key => {
|
|
50
|
+
const {
|
|
51
|
+
keyEntities
|
|
52
|
+
} = this.state;
|
|
53
|
+
this.handleTagRemove(null, keyEntities[key].valuePath);
|
|
53
54
|
};
|
|
54
55
|
this.renderTagItem = (nodeKey, idx) => {
|
|
55
56
|
const {
|
|
@@ -77,18 +78,18 @@ class Cascader extends _baseComponent.default {
|
|
|
77
78
|
size: size === 'default' ? 'large' : size,
|
|
78
79
|
key: `tag-${nodeKey}-${idx}`,
|
|
79
80
|
color: "white",
|
|
80
|
-
tagKey: nodeKey,
|
|
81
81
|
className: tagCls,
|
|
82
82
|
closable: true,
|
|
83
|
-
onClose:
|
|
83
|
+
onClose: (tagChildren, e) => {
|
|
84
|
+
// When value has not changed, prevent clicking tag closeBtn to close tag
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
this.handleTagRemove(e, keyEntities[nodeKey].valuePath);
|
|
87
|
+
}
|
|
84
88
|
}, keyEntities[nodeKey].data[displayProp]);
|
|
85
89
|
}
|
|
86
90
|
}
|
|
87
91
|
return null;
|
|
88
92
|
};
|
|
89
|
-
this.onRemoveInTagInput = v => {
|
|
90
|
-
this.foundation.handleTagRemoveByKey(v);
|
|
91
|
-
};
|
|
92
93
|
this.handleItemClick = (e, item) => {
|
|
93
94
|
this.foundation.handleItemClick(e, item);
|
|
94
95
|
};
|
|
@@ -288,7 +289,6 @@ class Cascader extends _baseComponent.default {
|
|
|
288
289
|
}, labelNode);
|
|
289
290
|
};
|
|
290
291
|
this.renderCustomTrigger = () => {
|
|
291
|
-
var _a;
|
|
292
292
|
const {
|
|
293
293
|
disabled,
|
|
294
294
|
triggerRender,
|
|
@@ -299,26 +299,17 @@ class Cascader extends _baseComponent.default {
|
|
|
299
299
|
inputValue,
|
|
300
300
|
inputPlaceHolder,
|
|
301
301
|
resolvedCheckedKeys,
|
|
302
|
-
checkedKeys
|
|
303
|
-
keyEntities
|
|
302
|
+
checkedKeys
|
|
304
303
|
} = this.state;
|
|
305
304
|
let realValue;
|
|
306
305
|
if (multiple) {
|
|
307
306
|
if (this.mergeType === _constants.strings.NONE_MERGE_TYPE) {
|
|
308
|
-
realValue =
|
|
309
|
-
checkedKeys.forEach(key => {
|
|
310
|
-
var _a;
|
|
311
|
-
realValue.add((_a = keyEntities[key]) === null || _a === void 0 ? void 0 : _a.pos);
|
|
312
|
-
});
|
|
307
|
+
realValue = checkedKeys;
|
|
313
308
|
} else {
|
|
314
|
-
realValue =
|
|
315
|
-
resolvedCheckedKeys.forEach(key => {
|
|
316
|
-
var _a;
|
|
317
|
-
realValue.add((_a = keyEntities[key]) === null || _a === void 0 ? void 0 : _a.pos);
|
|
318
|
-
});
|
|
309
|
+
realValue = resolvedCheckedKeys;
|
|
319
310
|
}
|
|
320
311
|
} else {
|
|
321
|
-
realValue =
|
|
312
|
+
realValue = [...selectedKeys][0];
|
|
322
313
|
}
|
|
323
314
|
return /*#__PURE__*/_react.default.createElement(_trigger.default, {
|
|
324
315
|
value: realValue,
|
|
@@ -331,7 +322,7 @@ class Cascader extends _baseComponent.default {
|
|
|
331
322
|
componentName: 'Cascader',
|
|
332
323
|
componentProps: Object.assign({}, this.props),
|
|
333
324
|
onSearch: this.handleInputChange,
|
|
334
|
-
onRemove: this.
|
|
325
|
+
onRemove: this.handleRemoveByKey
|
|
335
326
|
});
|
|
336
327
|
};
|
|
337
328
|
this.handleMouseOver = () => {
|
|
@@ -815,11 +806,11 @@ class Cascader extends _baseComponent.default {
|
|
|
815
806
|
showRestTagsPopover: showRestTagsPopover,
|
|
816
807
|
restTagsPopoverProps: restTagsPopoverProps,
|
|
817
808
|
maxTagCount: maxTagCount,
|
|
818
|
-
renderTagItem: this.renderTagItem,
|
|
809
|
+
renderTagItem: (value, index) => this.renderTagItem(value, index),
|
|
819
810
|
inputValue: inputValue,
|
|
820
811
|
onInputChange: this.handleInputChange,
|
|
821
812
|
// TODO Modify logic, not modify type
|
|
822
|
-
onRemove: this.
|
|
813
|
+
onRemove: v => this.handleTagRemove(null, v),
|
|
823
814
|
placeholder: placeholder,
|
|
824
815
|
expandRestTagsOnClick: false
|
|
825
816
|
});
|
|
@@ -471,7 +471,7 @@ class DatePicker extends _baseComponent.default {
|
|
|
471
471
|
return /range/i.test(type) && !(0, _isFunction2.default)(triggerRender);
|
|
472
472
|
}
|
|
473
473
|
componentDidUpdate(prevProps) {
|
|
474
|
-
if (
|
|
474
|
+
if (prevProps.value !== this.props.value) {
|
|
475
475
|
this.foundation.initFromProps(Object.assign({}, this.props));
|
|
476
476
|
} else if (this.props.timeZone !== prevProps.timeZone) {
|
|
477
477
|
this.foundation.initFromProps({
|
|
@@ -48,6 +48,16 @@ class YearAndMonth extends _baseComponent.default {
|
|
|
48
48
|
currentYear,
|
|
49
49
|
currentMonth
|
|
50
50
|
} = props;
|
|
51
|
+
const currentLeftYear = currentYear.left || now.getFullYear();
|
|
52
|
+
const currentLeftMonth = currentMonth.left || now.getMonth() + 1;
|
|
53
|
+
currentYear = {
|
|
54
|
+
left: currentLeftYear,
|
|
55
|
+
right: currentLeftYear
|
|
56
|
+
};
|
|
57
|
+
currentMonth = {
|
|
58
|
+
left: currentLeftMonth,
|
|
59
|
+
right: currentMonth.right || currentLeftMonth + 1
|
|
60
|
+
};
|
|
51
61
|
this.state = {
|
|
52
62
|
years: (0, _index2.getYears)(props.startYear, props.endYear).map(year => ({
|
|
53
63
|
value: year,
|
|
@@ -57,14 +67,8 @@ class YearAndMonth extends _baseComponent.default {
|
|
|
57
67
|
value: idx + 1,
|
|
58
68
|
month: idx + 1
|
|
59
69
|
})),
|
|
60
|
-
currentYear
|
|
61
|
-
|
|
62
|
-
right: currentYear.right || now.getFullYear()
|
|
63
|
-
},
|
|
64
|
-
currentMonth: {
|
|
65
|
-
left: currentMonth.left || now.getMonth() + 1,
|
|
66
|
-
right: currentMonth.right || now.getMonth() + 2
|
|
67
|
-
}
|
|
70
|
+
currentYear,
|
|
71
|
+
currentMonth
|
|
68
72
|
};
|
|
69
73
|
this.yearRef = /*#__PURE__*/_react.default.createRef();
|
|
70
74
|
this.monthRef = /*#__PURE__*/_react.default.createRef();
|
|
@@ -101,19 +105,11 @@ class YearAndMonth extends _baseComponent.default {
|
|
|
101
105
|
}
|
|
102
106
|
static getDerivedStateFromProps(props, state) {
|
|
103
107
|
const willUpdateStates = {};
|
|
104
|
-
if (!(0, _isEqual2.default)(props.currentYear, state.currentYear)) {
|
|
105
|
-
|
|
106
|
-
willUpdateStates.currentYear = {
|
|
107
|
-
left: props.currentYear.left || nowYear,
|
|
108
|
-
right: props.currentYear.right || nowYear
|
|
109
|
-
};
|
|
108
|
+
if (!(0, _isEqual2.default)(props.currentYear, state.currentYear) && props.currentYear.left !== 0) {
|
|
109
|
+
willUpdateStates.currentYear = props.currentYear;
|
|
110
110
|
}
|
|
111
|
-
if (!(0, _isEqual2.default)(props.currentMonth, state.currentMonth)) {
|
|
112
|
-
|
|
113
|
-
willUpdateStates.currentMonth = {
|
|
114
|
-
left: props.currentMonth.left || nowMonth + 1,
|
|
115
|
-
right: props.currentMonth.right || nowMonth + 2
|
|
116
|
-
};
|
|
111
|
+
if (!(0, _isEqual2.default)(props.currentMonth, state.currentMonth) && props.currentMonth.left !== 0) {
|
|
112
|
+
willUpdateStates.currentMonth = props.currentMonth;
|
|
117
113
|
}
|
|
118
114
|
return willUpdateStates;
|
|
119
115
|
}
|
|
@@ -44,7 +44,8 @@ class DropdownItem extends _baseComponent.default {
|
|
|
44
44
|
const events = {};
|
|
45
45
|
if (!disabled) {
|
|
46
46
|
['onClick', 'onMouseEnter', 'onMouseLeave', 'onContextMenu'].forEach(eventName => {
|
|
47
|
-
|
|
47
|
+
const isInAnotherDropdown = this.context.level !== 1;
|
|
48
|
+
if (isInAnotherDropdown && eventName === "onClick") {
|
|
48
49
|
events["onMouseDown"] = e => {
|
|
49
50
|
var _a, _b;
|
|
50
51
|
if (e.button === 0) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import { WithFieldOption } from '@douyinfe/semi-foundation/lib/cjs/form/interface';
|
|
3
|
+
import { CommonFieldProps, CommonexcludeType } from '../interface';
|
|
4
|
+
import { Subtract } from 'utility-types';
|
|
5
5
|
/**
|
|
6
6
|
* withFiled is used to inject components
|
|
7
7
|
* 1. Takes over the value and onChange of the component and synchronizes them to Form Foundation
|
package/lib/cjs/input/index.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
|
|
|
51
51
|
preventScroll?: boolean;
|
|
52
52
|
/** internal prop, DatePicker use it */
|
|
53
53
|
showClearIgnoreDisabled?: boolean;
|
|
54
|
+
onlyBorder?: number;
|
|
54
55
|
}
|
|
55
56
|
export interface InputState {
|
|
56
57
|
value: React.ReactText;
|
package/lib/cjs/input/index.js
CHANGED
|
@@ -340,9 +340,10 @@ class Input extends _baseComponent.default {
|
|
|
340
340
|
getValueLength,
|
|
341
341
|
preventScroll,
|
|
342
342
|
borderless,
|
|
343
|
-
showClearIgnoreDisabled
|
|
343
|
+
showClearIgnoreDisabled,
|
|
344
|
+
onlyBorder
|
|
344
345
|
} = _a,
|
|
345
|
-
rest = __rest(_a, ["addonAfter", "addonBefore", "autoFocus", "clearIcon", "className", "disabled", "defaultValue", "placeholder", "prefix", "mode", "insetLabel", "insetLabelId", "validateStatus", "type", "readonly", "size", "suffix", "style", "showClear", "onEnterPress", "onClear", "hideSuffix", "inputStyle", "forwardRef", "maxLength", "getValueLength", "preventScroll", "borderless", "showClearIgnoreDisabled"]);
|
|
346
|
+
rest = __rest(_a, ["addonAfter", "addonBefore", "autoFocus", "clearIcon", "className", "disabled", "defaultValue", "placeholder", "prefix", "mode", "insetLabel", "insetLabelId", "validateStatus", "type", "readonly", "size", "suffix", "style", "showClear", "onEnterPress", "onClear", "hideSuffix", "inputStyle", "forwardRef", "maxLength", "getValueLength", "preventScroll", "borderless", "showClearIgnoreDisabled", "onlyBorder"]);
|
|
346
347
|
const {
|
|
347
348
|
value,
|
|
348
349
|
isFocus,
|
|
@@ -370,7 +371,8 @@ class Input extends _baseComponent.default {
|
|
|
370
371
|
[`${wrapperPrefix}-modebtn`]: mode === 'password',
|
|
371
372
|
[`${wrapperPrefix}-hidden`]: type === 'hidden',
|
|
372
373
|
[`${wrapperPrefix}-${size}`]: size,
|
|
373
|
-
[`${prefixCls}-borderless`]: borderless
|
|
374
|
+
[`${prefixCls}-borderless`]: borderless,
|
|
375
|
+
[`${prefixCls}-only_border`]: onlyBorder !== undefined && onlyBorder !== null
|
|
374
376
|
});
|
|
375
377
|
const inputCls = (0, _classnames.default)(prefixCls, {
|
|
376
378
|
[`${prefixCls}-${size}`]: size,
|
|
@@ -404,12 +406,18 @@ class Input extends _baseComponent.default {
|
|
|
404
406
|
if (validateStatus === 'error') {
|
|
405
407
|
inputProps['aria-invalid'] = 'true';
|
|
406
408
|
}
|
|
409
|
+
let wrapperStyle = Object.assign({}, style);
|
|
410
|
+
if (onlyBorder !== undefined) {
|
|
411
|
+
wrapperStyle = Object.assign({
|
|
412
|
+
borderWidth: onlyBorder
|
|
413
|
+
}, style);
|
|
414
|
+
}
|
|
407
415
|
return (
|
|
408
416
|
/*#__PURE__*/
|
|
409
417
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
410
418
|
_react.default.createElement("div", {
|
|
411
419
|
className: wrapperCls,
|
|
412
|
-
style:
|
|
420
|
+
style: wrapperStyle,
|
|
413
421
|
onMouseEnter: e => this.handleMouseOver(e),
|
|
414
422
|
onMouseLeave: e => this.handleMouseLeave(e),
|
|
415
423
|
onClick: e => this.handleClick(e)
|
package/lib/cjs/modal/Modal.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ declare class Modal extends BaseComponent<ModalReactProps, ModalState> {
|
|
|
66
66
|
lazyRender: PropTypes.Requireable<boolean>;
|
|
67
67
|
direction: PropTypes.Requireable<string>;
|
|
68
68
|
fullScreen: PropTypes.Requireable<boolean>;
|
|
69
|
+
footerFill: PropTypes.Requireable<boolean>;
|
|
69
70
|
};
|
|
70
71
|
static defaultProps: {
|
|
71
72
|
zIndex: number;
|