@douyinfe/semi-ui 2.50.0-beta.0 → 2.50.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/umd/semi-ui.js +28 -18
- 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/previewInner.d.ts +1 -1
- package/lib/cjs/image/previewInner.js +5 -2
- package/lib/es/image/previewInner.d.ts +1 -1
- package/lib/es/image/previewInner.js +5 -2
- package/package.json +8 -8
package/dist/umd/semi-ui.js
CHANGED
|
@@ -99642,7 +99642,9 @@ const DefaultDOMRect = {
|
|
|
99642
99642
|
};
|
|
99643
99643
|
class PreviewImageFoundation extends foundation {
|
|
99644
99644
|
constructor(adapter) {
|
|
99645
|
+
var _this;
|
|
99645
99646
|
super(Object.assign({}, adapter));
|
|
99647
|
+
_this = this;
|
|
99646
99648
|
this.startMouseOffset = {
|
|
99647
99649
|
x: 0,
|
|
99648
99650
|
y: 0
|
|
@@ -99693,7 +99695,9 @@ class PreviewImageFoundation extends foundation {
|
|
|
99693
99695
|
this.setState({
|
|
99694
99696
|
loading: false
|
|
99695
99697
|
});
|
|
99696
|
-
|
|
99698
|
+
// 图片初次加载,计算 zoom,zoom 改变不需要通过回调透出
|
|
99699
|
+
// When the image is loaded for the first time, zoom is calculated, and zoom changes do not need to be exposed through callbacks.
|
|
99700
|
+
this.handleResizeImage(false);
|
|
99697
99701
|
}
|
|
99698
99702
|
const {
|
|
99699
99703
|
src,
|
|
@@ -99711,24 +99715,25 @@ class PreviewImageFoundation extends foundation {
|
|
|
99711
99715
|
});
|
|
99712
99716
|
onError && onError(src);
|
|
99713
99717
|
};
|
|
99714
|
-
this.handleResizeImage = ()
|
|
99715
|
-
|
|
99718
|
+
this.handleResizeImage = function () {
|
|
99719
|
+
let notify = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
99720
|
+
const horizontal = !_this._isImageVertical();
|
|
99716
99721
|
const {
|
|
99717
99722
|
currZoom
|
|
99718
|
-
} =
|
|
99719
|
-
const imgWidth = horizontal ?
|
|
99720
|
-
const imgHeight = horizontal ?
|
|
99723
|
+
} = _this.getStates();
|
|
99724
|
+
const imgWidth = horizontal ? _this.originImageWidth : _this.originImageHeight;
|
|
99725
|
+
const imgHeight = horizontal ? _this.originImageHeight : _this.originImageWidth;
|
|
99721
99726
|
const {
|
|
99722
99727
|
onZoom,
|
|
99723
99728
|
setRatio,
|
|
99724
99729
|
ratio
|
|
99725
|
-
} =
|
|
99726
|
-
const containerDOM =
|
|
99730
|
+
} = _this.getProps();
|
|
99731
|
+
const containerDOM = _this._adapter.getContainer();
|
|
99727
99732
|
if (containerDOM) {
|
|
99728
99733
|
const {
|
|
99729
99734
|
width: containerWidth,
|
|
99730
99735
|
height: containerHeight
|
|
99731
|
-
} =
|
|
99736
|
+
} = _this._getContainerBounds();
|
|
99732
99737
|
const reservedWidth = containerWidth - 80;
|
|
99733
99738
|
const reservedHeight = containerHeight - 80;
|
|
99734
99739
|
let _zoom = 1;
|
|
@@ -99736,9 +99741,9 @@ class PreviewImageFoundation extends foundation {
|
|
|
99736
99741
|
_zoom = Number(Math.min(reservedWidth / imgWidth, reservedHeight / imgHeight).toFixed(2));
|
|
99737
99742
|
}
|
|
99738
99743
|
if (currZoom === _zoom) {
|
|
99739
|
-
|
|
99744
|
+
_this.calculatePreviewImage(_zoom, null);
|
|
99740
99745
|
} else {
|
|
99741
|
-
onZoom(_zoom);
|
|
99746
|
+
onZoom(_zoom, notify);
|
|
99742
99747
|
}
|
|
99743
99748
|
}
|
|
99744
99749
|
};
|
|
@@ -100177,7 +100182,9 @@ const NOT_CLOSE_TARGETS = ["icon", "footer"];
|
|
|
100177
100182
|
const STOP_CLOSE_TARGET = (/* unused pure expression or super */ null && (["icon", "footer", "header"]));
|
|
100178
100183
|
class PreviewInnerFoundation extends foundation {
|
|
100179
100184
|
constructor(adapter) {
|
|
100185
|
+
var _this;
|
|
100180
100186
|
super(Object.assign({}, adapter));
|
|
100187
|
+
_this = this;
|
|
100181
100188
|
this._timer = null;
|
|
100182
100189
|
this._startMouseDown = {
|
|
100183
100190
|
x: 0,
|
|
@@ -100324,7 +100331,6 @@ class PreviewInnerFoundation extends foundation {
|
|
|
100324
100331
|
direction,
|
|
100325
100332
|
rotation: 0
|
|
100326
100333
|
});
|
|
100327
|
-
this._adapter.notifyRotateChange(0);
|
|
100328
100334
|
};
|
|
100329
100335
|
this.handleDownload = () => {
|
|
100330
100336
|
const {
|
|
@@ -100357,13 +100363,14 @@ class PreviewInnerFoundation extends foundation {
|
|
|
100357
100363
|
});
|
|
100358
100364
|
this._adapter.notifyRotateChange(newRotation);
|
|
100359
100365
|
};
|
|
100360
|
-
this.handleZoomImage = newZoom
|
|
100366
|
+
this.handleZoomImage = function (newZoom) {
|
|
100367
|
+
let notify = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
100361
100368
|
const {
|
|
100362
100369
|
zoom
|
|
100363
|
-
} =
|
|
100370
|
+
} = _this.getStates();
|
|
100364
100371
|
if (zoom !== newZoom) {
|
|
100365
|
-
|
|
100366
|
-
|
|
100372
|
+
notify && _this._adapter.notifyZoom(newZoom, newZoom > zoom);
|
|
100373
|
+
_this.setState({
|
|
100367
100374
|
zoom: newZoom
|
|
100368
100375
|
});
|
|
100369
100376
|
}
|
|
@@ -100612,7 +100619,9 @@ class PreviewInner extends BaseComponent {
|
|
|
100612
100619
|
});
|
|
100613
100620
|
}
|
|
100614
100621
|
constructor(props) {
|
|
100622
|
+
var _this;
|
|
100615
100623
|
super(props);
|
|
100624
|
+
_this = this;
|
|
100616
100625
|
this.viewVisibleChange = () => {
|
|
100617
100626
|
this.foundation.handleViewVisibleChange();
|
|
100618
100627
|
};
|
|
@@ -100631,8 +100640,9 @@ class PreviewInner extends BaseComponent {
|
|
|
100631
100640
|
this.handleRotateImage = direction => {
|
|
100632
100641
|
this.foundation.handleRotateImage(direction);
|
|
100633
100642
|
};
|
|
100634
|
-
this.handleZoomImage = newZoom
|
|
100635
|
-
|
|
100643
|
+
this.handleZoomImage = function (newZoom) {
|
|
100644
|
+
let notify = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
100645
|
+
_this.foundation.handleZoomImage(newZoom, notify);
|
|
100636
100646
|
};
|
|
100637
100647
|
this.handleMouseUp = e => {
|
|
100638
100648
|
this.foundation.handleMouseUp(e.nativeEvent);
|