@douyinfe/semi-ui 2.39.3 → 2.40.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 +3 -0
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +132 -89
- 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/_portal/index.d.ts +3 -2
- package/lib/cjs/_portal/index.js +33 -26
- package/lib/cjs/form/baseForm.js +5 -5
- package/lib/cjs/form/interface.d.ts +2 -2
- package/lib/cjs/image/image.js +5 -3
- package/lib/cjs/image/interface.d.ts +2 -0
- package/lib/cjs/image/preview.js +5 -3
- package/lib/cjs/image/previewContext.d.ts +1 -0
- package/lib/cjs/image/previewFooter.d.ts +5 -1
- package/lib/cjs/image/previewFooter.js +66 -38
- package/lib/cjs/image/previewInner.js +4 -0
- package/lib/cjs/upload/index.js +1 -4
- package/lib/es/_portal/index.d.ts +3 -2
- package/lib/es/_portal/index.js +33 -26
- package/lib/es/form/baseForm.js +5 -5
- package/lib/es/form/interface.d.ts +2 -2
- package/lib/es/image/image.js +5 -3
- package/lib/es/image/interface.d.ts +2 -0
- package/lib/es/image/preview.js +5 -3
- package/lib/es/image/previewContext.d.ts +1 -0
- package/lib/es/image/previewFooter.d.ts +5 -1
- package/lib/es/image/previewFooter.js +66 -38
- package/lib/es/image/previewInner.js +4 -0
- package/lib/es/upload/index.js +1 -4
- package/package.json +8 -8
package/lib/es/image/preview.js
CHANGED
|
@@ -141,9 +141,10 @@ export default class Preview extends BaseComponent {
|
|
|
141
141
|
src,
|
|
142
142
|
className,
|
|
143
143
|
style,
|
|
144
|
-
lazyLoad
|
|
144
|
+
lazyLoad,
|
|
145
|
+
setDownloadName
|
|
145
146
|
} = _a,
|
|
146
|
-
restProps = __rest(_a, ["src", "className", "style", "lazyLoad"]);
|
|
147
|
+
restProps = __rest(_a, ["src", "className", "style", "lazyLoad", "setDownloadName"]);
|
|
147
148
|
const {
|
|
148
149
|
currentIndex,
|
|
149
150
|
visible
|
|
@@ -165,7 +166,8 @@ export default class Preview extends BaseComponent {
|
|
|
165
166
|
lazyLoad,
|
|
166
167
|
previewObserver: this.previewObserver,
|
|
167
168
|
setCurrentIndex: this.handleCurrentIndexChange,
|
|
168
|
-
handleVisibleChange: this.handleVisibleChange
|
|
169
|
+
handleVisibleChange: this.handleVisibleChange,
|
|
170
|
+
setDownloadName: setDownloadName
|
|
169
171
|
}
|
|
170
172
|
}, /*#__PURE__*/React.createElement("div", {
|
|
171
173
|
id: this.previewGroupId,
|
|
@@ -9,5 +9,6 @@ export interface PreviewContextProps {
|
|
|
9
9
|
previewObserver: IntersectionObserver;
|
|
10
10
|
setCurrentIndex: (current: number) => void;
|
|
11
11
|
handleVisibleChange: (visible: boolean, preVisible?: boolean) => void;
|
|
12
|
+
setDownloadName: (src: string) => string;
|
|
12
13
|
}
|
|
13
14
|
export declare const PreviewContext: import("react").Context<PreviewContextProps>;
|
|
@@ -49,7 +49,7 @@ export default class Footer extends BaseComponent<FooterProps> {
|
|
|
49
49
|
handleSlideChange: import("lodash").DebouncedFunc<(value: any) => void>;
|
|
50
50
|
handleRatioClick: () => void;
|
|
51
51
|
customRenderViewMenu: () => ReactNode;
|
|
52
|
-
getFinalIconElement: (element: ReactNode, content: ReactNode) => string | number | boolean | React.ReactFragment | JSX.Element;
|
|
52
|
+
getFinalIconElement: (element: ReactNode, content: ReactNode, key: string) => string | number | boolean | React.ReactFragment | JSX.Element;
|
|
53
53
|
getLocalTextByKey: (key: string) => JSX.Element;
|
|
54
54
|
getIconChevronLeft: () => string | number | boolean | React.ReactFragment | JSX.Element;
|
|
55
55
|
getIconChevronRight: () => string | number | boolean | React.ReactFragment | JSX.Element;
|
|
@@ -58,5 +58,9 @@ export default class Footer extends BaseComponent<FooterProps> {
|
|
|
58
58
|
getIconRatio: () => string | number | boolean | React.ReactFragment | JSX.Element;
|
|
59
59
|
getIconRotate: () => string | number | boolean | React.ReactFragment | JSX.Element;
|
|
60
60
|
getIconDownload: () => string | number | boolean | React.ReactFragment | JSX.Element;
|
|
61
|
+
getNumberInfo: () => JSX.Element;
|
|
62
|
+
getSlider: () => JSX.Element;
|
|
63
|
+
getMenu: () => (string | number | boolean | React.ReactFragment | JSX.Element)[];
|
|
64
|
+
getFooterMenu: () => (string | number | boolean | React.ReactFragment | JSX.Element)[];
|
|
61
65
|
render(): JSX.Element;
|
|
62
66
|
}
|
|
@@ -81,18 +81,20 @@ export default class Footer extends BaseComponent {
|
|
|
81
81
|
disabledZoomOut: zoom === min,
|
|
82
82
|
onRatioClick: this.handleRatioClick,
|
|
83
83
|
onZoomIn: this.handlePlusClick,
|
|
84
|
-
onZoomOut: this.handleMinusClick
|
|
84
|
+
onZoomOut: this.handleMinusClick,
|
|
85
|
+
menuItems: this.getMenu()
|
|
85
86
|
};
|
|
86
87
|
return renderPreviewMenu(props);
|
|
87
88
|
};
|
|
88
89
|
// According to showTooltip in props, decide whether to use Tooltip to pack a layer
|
|
89
90
|
// 根据 props 中的 showTooltip 决定是否使用 Tooltip 包一层
|
|
90
|
-
this.getFinalIconElement = (element, content) => {
|
|
91
|
+
this.getFinalIconElement = (element, content, key) => {
|
|
91
92
|
const {
|
|
92
93
|
showTooltip
|
|
93
94
|
} = this.props;
|
|
94
95
|
return showTooltip ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
95
|
-
content: content
|
|
96
|
+
content: content,
|
|
97
|
+
key: `tooltip-${key}`
|
|
96
98
|
}, element) : element;
|
|
97
99
|
};
|
|
98
100
|
this.getLocalTextByKey = key => /*#__PURE__*/React.createElement(LocaleConsumer, {
|
|
@@ -105,12 +107,13 @@ export default class Footer extends BaseComponent {
|
|
|
105
107
|
prevTip
|
|
106
108
|
} = this.props;
|
|
107
109
|
const icon = /*#__PURE__*/React.createElement(IconChevronLeft, {
|
|
110
|
+
key: "chevron-left",
|
|
108
111
|
size: "large",
|
|
109
112
|
className: disabledPrev ? `${footerPrefixCls}-disabled` : "",
|
|
110
113
|
onClick: !disabledPrev ? onPrev : undefined
|
|
111
114
|
});
|
|
112
115
|
const content = prevTip !== null && prevTip !== void 0 ? prevTip : this.getLocalTextByKey("prevTip");
|
|
113
|
-
return this.getFinalIconElement(icon, content);
|
|
116
|
+
return this.getFinalIconElement(icon, content, 'chevron-left');
|
|
114
117
|
};
|
|
115
118
|
this.getIconChevronRight = () => {
|
|
116
119
|
const {
|
|
@@ -119,12 +122,13 @@ export default class Footer extends BaseComponent {
|
|
|
119
122
|
nextTip
|
|
120
123
|
} = this.props;
|
|
121
124
|
const icon = /*#__PURE__*/React.createElement(IconChevronRight, {
|
|
125
|
+
key: "chevron-right",
|
|
122
126
|
size: "large",
|
|
123
127
|
className: disabledNext ? `${footerPrefixCls}-disabled` : "",
|
|
124
128
|
onClick: !disabledNext ? onNext : undefined
|
|
125
129
|
});
|
|
126
130
|
const content = nextTip !== null && nextTip !== void 0 ? nextTip : this.getLocalTextByKey("nextTip");
|
|
127
|
-
return this.getFinalIconElement(icon, content);
|
|
131
|
+
return this.getFinalIconElement(icon, content, 'chevron-right');
|
|
128
132
|
};
|
|
129
133
|
this.getIconMinus = () => {
|
|
130
134
|
const {
|
|
@@ -134,12 +138,13 @@ export default class Footer extends BaseComponent {
|
|
|
134
138
|
} = this.props;
|
|
135
139
|
const disabledZoomOut = zoom === min;
|
|
136
140
|
const icon = /*#__PURE__*/React.createElement(IconMinus, {
|
|
141
|
+
key: "minus",
|
|
137
142
|
size: "large",
|
|
138
143
|
onClick: !disabledZoomOut ? this.handleMinusClick : undefined,
|
|
139
144
|
className: disabledZoomOut ? `${footerPrefixCls}-disabled` : ""
|
|
140
145
|
});
|
|
141
146
|
const content = zoomOutTip !== null && zoomOutTip !== void 0 ? zoomOutTip : this.getLocalTextByKey("zoomOutTip");
|
|
142
|
-
return this.getFinalIconElement(icon, content);
|
|
147
|
+
return this.getFinalIconElement(icon, content, 'minus');
|
|
143
148
|
};
|
|
144
149
|
this.getIconPlus = () => {
|
|
145
150
|
const {
|
|
@@ -149,12 +154,13 @@ export default class Footer extends BaseComponent {
|
|
|
149
154
|
} = this.props;
|
|
150
155
|
const disabledZoomIn = zoom === max;
|
|
151
156
|
const icon = /*#__PURE__*/React.createElement(IconPlus, {
|
|
157
|
+
key: "plus",
|
|
152
158
|
size: "large",
|
|
153
159
|
onClick: !disabledZoomIn ? this.handlePlusClick : undefined,
|
|
154
160
|
className: disabledZoomIn ? `${footerPrefixCls}-disabled` : ""
|
|
155
161
|
});
|
|
156
162
|
const content = zoomInTip !== null && zoomInTip !== void 0 ? zoomInTip : this.getLocalTextByKey("zoomInTip");
|
|
157
|
-
return this.getFinalIconElement(icon, content);
|
|
163
|
+
return this.getFinalIconElement(icon, content, 'plus');
|
|
158
164
|
};
|
|
159
165
|
this.getIconRatio = () => {
|
|
160
166
|
const {
|
|
@@ -163,6 +169,7 @@ export default class Footer extends BaseComponent {
|
|
|
163
169
|
adaptiveTip
|
|
164
170
|
} = this.props;
|
|
165
171
|
const props = {
|
|
172
|
+
key: "ratio",
|
|
166
173
|
size: "large",
|
|
167
174
|
className: cls(`${footerPrefixCls}-gap`),
|
|
168
175
|
onClick: this.handleRatioClick
|
|
@@ -174,18 +181,19 @@ export default class Footer extends BaseComponent {
|
|
|
174
181
|
} else {
|
|
175
182
|
content = adaptiveTip !== null && adaptiveTip !== void 0 ? adaptiveTip : this.getLocalTextByKey("adaptiveTip");
|
|
176
183
|
}
|
|
177
|
-
return this.getFinalIconElement(icon, content);
|
|
184
|
+
return this.getFinalIconElement(icon, content, 'ratio');
|
|
178
185
|
};
|
|
179
186
|
this.getIconRotate = () => {
|
|
180
187
|
const {
|
|
181
188
|
rotateTip
|
|
182
189
|
} = this.props;
|
|
183
190
|
const icon = /*#__PURE__*/React.createElement(IconRotate, {
|
|
191
|
+
key: "rotate",
|
|
184
192
|
size: "large",
|
|
185
193
|
onClick: this.handleRotateLeft
|
|
186
194
|
});
|
|
187
195
|
const content = rotateTip !== null && rotateTip !== void 0 ? rotateTip : this.getLocalTextByKey("rotateTip");
|
|
188
|
-
return this.getFinalIconElement(icon, content);
|
|
196
|
+
return this.getFinalIconElement(icon, content, 'rotate');
|
|
189
197
|
};
|
|
190
198
|
this.getIconDownload = () => {
|
|
191
199
|
const {
|
|
@@ -194,6 +202,7 @@ export default class Footer extends BaseComponent {
|
|
|
194
202
|
disableDownload
|
|
195
203
|
} = this.props;
|
|
196
204
|
const icon = /*#__PURE__*/React.createElement(IconDownload, {
|
|
205
|
+
key: 'download',
|
|
197
206
|
size: "large",
|
|
198
207
|
onClick: !disableDownload ? onDownload : undefined,
|
|
199
208
|
className: cls(`${footerPrefixCls}-gap`, {
|
|
@@ -201,44 +210,63 @@ export default class Footer extends BaseComponent {
|
|
|
201
210
|
})
|
|
202
211
|
});
|
|
203
212
|
const content = downloadTip !== null && downloadTip !== void 0 ? downloadTip : this.getLocalTextByKey("downloadTip");
|
|
204
|
-
return this.getFinalIconElement(icon, content);
|
|
213
|
+
return this.getFinalIconElement(icon, content, 'download');
|
|
214
|
+
};
|
|
215
|
+
this.getNumberInfo = () => {
|
|
216
|
+
const {
|
|
217
|
+
curPage,
|
|
218
|
+
totalNum
|
|
219
|
+
} = this.props;
|
|
220
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
221
|
+
className: `${footerPrefixCls}-page`,
|
|
222
|
+
key: 'info'
|
|
223
|
+
}, curPage, "/", totalNum);
|
|
224
|
+
};
|
|
225
|
+
this.getSlider = () => {
|
|
226
|
+
const {
|
|
227
|
+
zoom,
|
|
228
|
+
min,
|
|
229
|
+
max,
|
|
230
|
+
step,
|
|
231
|
+
showTooltip
|
|
232
|
+
} = this.props;
|
|
233
|
+
return /*#__PURE__*/React.createElement(Slider, {
|
|
234
|
+
key: 'slider',
|
|
235
|
+
value: zoom,
|
|
236
|
+
min: min,
|
|
237
|
+
max: max,
|
|
238
|
+
step: step,
|
|
239
|
+
tipFormatter: v => `${v}%`,
|
|
240
|
+
tooltipVisible: showTooltip ? undefined : false,
|
|
241
|
+
onChange: this.handleSlideChange
|
|
242
|
+
});
|
|
243
|
+
};
|
|
244
|
+
this.getMenu = () => [this.getIconChevronLeft(), this.getNumberInfo(), this.getIconChevronRight(), this.getIconMinus(), this.getSlider(), this.getIconPlus(), this.getIconRatio(), this.getIconRotate(), this.getIconDownload()];
|
|
245
|
+
this.getFooterMenu = () => {
|
|
246
|
+
const menuItems = this.getMenu();
|
|
247
|
+
menuItems.splice(3, 0, /*#__PURE__*/React.createElement(Divider, {
|
|
248
|
+
layout: "vertical",
|
|
249
|
+
key: "divider-first"
|
|
250
|
+
}));
|
|
251
|
+
menuItems.splice(8, 0, /*#__PURE__*/React.createElement(Divider, {
|
|
252
|
+
layout: "vertical",
|
|
253
|
+
key: "divider-second"
|
|
254
|
+
}));
|
|
255
|
+
return menuItems;
|
|
205
256
|
};
|
|
206
257
|
this.foundation = new PreviewFooterFoundation(this.adapter);
|
|
207
258
|
}
|
|
208
259
|
render() {
|
|
209
260
|
const {
|
|
210
|
-
min,
|
|
211
|
-
max,
|
|
212
|
-
step,
|
|
213
|
-
curPage,
|
|
214
|
-
totalNum,
|
|
215
|
-
zoom,
|
|
216
|
-
showTooltip,
|
|
217
261
|
className,
|
|
218
262
|
renderPreviewMenu
|
|
219
263
|
} = this.props;
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}, this.customRenderViewMenu());
|
|
224
|
-
}
|
|
264
|
+
const menuCls = cls(footerPrefixCls, `${footerPrefixCls}-wrapper`, className, {
|
|
265
|
+
[`${footerPrefixCls}-content`]: !Boolean(renderPreviewMenu)
|
|
266
|
+
});
|
|
225
267
|
return /*#__PURE__*/React.createElement("section", {
|
|
226
|
-
className:
|
|
227
|
-
}, this.
|
|
228
|
-
className: `${footerPrefixCls}-page`
|
|
229
|
-
}, /*#__PURE__*/React.createElement("span", null, curPage), /*#__PURE__*/React.createElement("span", null, "/"), /*#__PURE__*/React.createElement("span", null, totalNum)), this.getIconChevronRight(), /*#__PURE__*/React.createElement(Divider, {
|
|
230
|
-
layout: "vertical"
|
|
231
|
-
}), this.getIconMinus(), /*#__PURE__*/React.createElement(Slider, {
|
|
232
|
-
value: zoom,
|
|
233
|
-
min: min,
|
|
234
|
-
max: max,
|
|
235
|
-
step: step,
|
|
236
|
-
tipFormatter: v => `${v}%`,
|
|
237
|
-
tooltipVisible: showTooltip ? undefined : false,
|
|
238
|
-
onChange: this.handleSlideChange
|
|
239
|
-
}), this.getIconPlus(), this.getIconRatio(), /*#__PURE__*/React.createElement(Divider, {
|
|
240
|
-
layout: "vertical"
|
|
241
|
-
}), this.getIconRotate(), this.getIconDownload());
|
|
268
|
+
className: menuCls
|
|
269
|
+
}, renderPreviewMenu ? this.customRenderViewMenu() : this.getFooterMenu());
|
|
242
270
|
}
|
|
243
271
|
}
|
|
244
272
|
Footer.propTypes = {
|
|
@@ -124,6 +124,10 @@ export default class PreviewInner extends BaseComponent {
|
|
|
124
124
|
},
|
|
125
125
|
setMouseActiveTime: time => {
|
|
126
126
|
mouseActiveTime = time;
|
|
127
|
+
},
|
|
128
|
+
getSetDownloadFunc: () => {
|
|
129
|
+
var _a, _b;
|
|
130
|
+
return (_b = (_a = this.context) === null || _a === void 0 ? void 0 : _a.setDownloadName) !== null && _b !== void 0 ? _b : this.props.setDownloadName;
|
|
127
131
|
}
|
|
128
132
|
});
|
|
129
133
|
}
|
package/lib/es/upload/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.40.0-beta.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"lib/*"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@douyinfe/semi-animation": "2.
|
|
21
|
-
"@douyinfe/semi-animation-react": "2.
|
|
22
|
-
"@douyinfe/semi-foundation": "2.
|
|
23
|
-
"@douyinfe/semi-icons": "2.
|
|
24
|
-
"@douyinfe/semi-illustrations": "2.
|
|
25
|
-
"@douyinfe/semi-theme-default": "2.
|
|
20
|
+
"@douyinfe/semi-animation": "2.40.0-beta.0",
|
|
21
|
+
"@douyinfe/semi-animation-react": "2.40.0-beta.0",
|
|
22
|
+
"@douyinfe/semi-foundation": "2.40.0-beta.0",
|
|
23
|
+
"@douyinfe/semi-icons": "2.40.0-beta.0",
|
|
24
|
+
"@douyinfe/semi-illustrations": "2.40.0-beta.0",
|
|
25
|
+
"@douyinfe/semi-theme-default": "2.40.0-beta.0",
|
|
26
26
|
"async-validator": "^3.5.0",
|
|
27
27
|
"classnames": "^2.2.6",
|
|
28
28
|
"copy-text-to-clipboard": "^2.1.1",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
],
|
|
70
70
|
"author": "",
|
|
71
71
|
"license": "MIT",
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "f42587885c81ecb266aa0d32d2feaa7633e01e67",
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
75
75
|
"@babel/plugin-transform-runtime": "^7.15.8",
|