@douyinfe/semi-ui 2.48.0 → 2.49.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 +4 -0
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +319 -293
- 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/banner/index.d.ts +2 -2
- package/lib/cjs/banner/index.js +2 -2
- package/lib/cjs/breadcrumb/item.d.ts +1 -1
- package/lib/cjs/breadcrumb/item.js +1 -1
- package/lib/cjs/calendar/dayCalendar.d.ts +1 -0
- package/lib/cjs/calendar/dayCalendar.js +4 -1
- package/lib/cjs/calendar/dayCol.d.ts +2 -0
- package/lib/cjs/calendar/dayCol.js +6 -6
- package/lib/cjs/calendar/index.d.ts +1 -0
- package/lib/cjs/calendar/index.js +1 -0
- package/lib/cjs/calendar/interface.d.ts +2 -1
- package/lib/cjs/calendar/rangeCalendar.js +4 -2
- package/lib/cjs/calendar/weekCalendar.js +4 -2
- package/lib/cjs/image/interface.d.ts +3 -3
- package/lib/cjs/image/previewFooter.js +5 -8
- package/lib/cjs/image/previewHeader.d.ts +2 -2
- package/lib/cjs/image/previewHeader.js +9 -8
- package/lib/cjs/image/previewImage.d.ts +1 -12
- package/lib/cjs/image/previewImage.js +23 -83
- package/lib/cjs/image/previewInner.d.ts +11 -2
- package/lib/cjs/image/previewInner.js +60 -42
- package/lib/cjs/modal/Modal.d.ts +1 -1
- package/lib/cjs/modal/Modal.js +1 -1
- package/lib/cjs/navigation/SubNav.d.ts +1 -1
- package/lib/cjs/navigation/SubNav.js +1 -1
- package/lib/cjs/popconfirm/index.d.ts +1 -1
- package/lib/cjs/popconfirm/index.js +1 -1
- package/lib/cjs/sideSheet/SideSheetContent.d.ts +3 -1
- package/lib/cjs/sideSheet/SideSheetContent.js +6 -3
- package/lib/cjs/table/Body/BaseRow.d.ts +3 -0
- package/lib/cjs/table/Body/BaseRow.js +4 -1
- package/lib/cjs/table/Body/ExpandedRow.d.ts +1 -0
- package/lib/cjs/table/Body/ExpandedRow.js +4 -2
- package/lib/cjs/table/Body/index.d.ts +3 -0
- package/lib/cjs/table/Body/index.js +18 -10
- package/lib/cjs/table/interface.d.ts +1 -0
- package/lib/cjs/timePicker/TimePicker.d.ts +3 -0
- package/lib/cjs/timePicker/TimePicker.js +7 -3
- package/lib/cjs/timePicker/index.d.ts +2 -0
- package/lib/cjs/toast/toast.d.ts +1 -1
- package/lib/cjs/toast/toast.js +1 -1
- package/lib/cjs/typography/util.js +5 -6
- package/lib/es/banner/index.d.ts +2 -2
- package/lib/es/banner/index.js +2 -2
- package/lib/es/breadcrumb/item.d.ts +1 -1
- package/lib/es/breadcrumb/item.js +1 -1
- package/lib/es/calendar/dayCalendar.d.ts +1 -0
- package/lib/es/calendar/dayCalendar.js +4 -1
- package/lib/es/calendar/dayCol.d.ts +2 -0
- package/lib/es/calendar/dayCol.js +6 -6
- package/lib/es/calendar/index.d.ts +1 -0
- package/lib/es/calendar/index.js +1 -0
- package/lib/es/calendar/interface.d.ts +2 -1
- package/lib/es/calendar/rangeCalendar.js +4 -2
- package/lib/es/calendar/weekCalendar.js +4 -2
- package/lib/es/image/interface.d.ts +3 -3
- package/lib/es/image/previewFooter.js +5 -8
- package/lib/es/image/previewHeader.d.ts +2 -2
- package/lib/es/image/previewHeader.js +4 -3
- package/lib/es/image/previewImage.d.ts +1 -12
- package/lib/es/image/previewImage.js +23 -83
- package/lib/es/image/previewInner.d.ts +11 -2
- package/lib/es/image/previewInner.js +60 -42
- package/lib/es/modal/Modal.d.ts +1 -1
- package/lib/es/modal/Modal.js +1 -1
- package/lib/es/navigation/SubNav.d.ts +1 -1
- package/lib/es/navigation/SubNav.js +1 -1
- package/lib/es/popconfirm/index.d.ts +1 -1
- package/lib/es/popconfirm/index.js +1 -1
- package/lib/es/sideSheet/SideSheetContent.d.ts +3 -1
- package/lib/es/sideSheet/SideSheetContent.js +6 -3
- package/lib/es/table/Body/BaseRow.d.ts +3 -0
- package/lib/es/table/Body/BaseRow.js +4 -1
- package/lib/es/table/Body/ExpandedRow.d.ts +1 -0
- package/lib/es/table/Body/ExpandedRow.js +4 -2
- package/lib/es/table/Body/index.d.ts +3 -0
- package/lib/es/table/Body/index.js +18 -10
- package/lib/es/table/interface.d.ts +1 -0
- package/lib/es/timePicker/TimePicker.d.ts +3 -0
- package/lib/es/timePicker/TimePicker.js +7 -3
- package/lib/es/timePicker/index.d.ts +2 -0
- package/lib/es/toast/toast.d.ts +1 -1
- package/lib/es/toast/toast.js +1 -1
- package/lib/es/typography/util.js +5 -6
- package/package.json +8 -8
package/dist/umd/semi-ui.js
CHANGED
|
@@ -22566,7 +22566,6 @@ const getRenderText = function (originEle, rows) {
|
|
|
22566
22566
|
const lineHeight = pxToNumber(originStyle.lineHeight);
|
|
22567
22567
|
const maxHeight = Math.round(lineHeight * (rows + 1) + pxToNumber(originStyle.paddingTop) + pxToNumber(originStyle.paddingBottom));
|
|
22568
22568
|
// Set shadow
|
|
22569
|
-
const maxWidth = parseInt(originStyle.width);
|
|
22570
22569
|
ellipsisContainer.setAttribute('style', originCSS);
|
|
22571
22570
|
ellipsisContainer.style.position = 'fixed';
|
|
22572
22571
|
ellipsisContainer.style.left = '0';
|
|
@@ -22578,12 +22577,12 @@ const getRenderText = function (originEle, rows) {
|
|
|
22578
22577
|
ellipsisContainer.style.webkitLineClamp = 'none';
|
|
22579
22578
|
// Render fake container
|
|
22580
22579
|
external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_default().render( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null), ellipsisContainer);
|
|
22581
|
-
// Check if ellipsis in measure div is
|
|
22580
|
+
// Check if ellipsis in measure div is enough for content
|
|
22582
22581
|
function inRange() {
|
|
22583
|
-
|
|
22584
|
-
|
|
22585
|
-
|
|
22586
|
-
return
|
|
22582
|
+
// If content does not wrap due to line break strategy, width should be judged to determine whether it's in range
|
|
22583
|
+
const widthInRange = ellipsisContainer.scrollWidth <= ellipsisContainer.offsetWidth;
|
|
22584
|
+
const heightInRange = ellipsisContainer.scrollHeight < maxHeight;
|
|
22585
|
+
return rows === 1 ? widthInRange && heightInRange : heightInRange;
|
|
22587
22586
|
}
|
|
22588
22587
|
// ========================= Find match ellipsis content =========================
|
|
22589
22588
|
// Create origin content holder
|
|
@@ -29146,8 +29145,8 @@ Banner.propTypes = {
|
|
|
29146
29145
|
type: prop_types_default().oneOf(types),
|
|
29147
29146
|
title: (prop_types_default()).node,
|
|
29148
29147
|
description: (prop_types_default()).node,
|
|
29149
|
-
icon:
|
|
29150
|
-
closeIcon:
|
|
29148
|
+
icon: (prop_types_default()).node,
|
|
29149
|
+
closeIcon: (prop_types_default()).node,
|
|
29151
29150
|
children: (prop_types_default()).node,
|
|
29152
29151
|
style: (prop_types_default()).object,
|
|
29153
29152
|
className: (prop_types_default()).string,
|
|
@@ -29404,7 +29403,7 @@ BreadcrumbItem.propTypes = {
|
|
|
29404
29403
|
children: (prop_types_default()).node,
|
|
29405
29404
|
active: (prop_types_default()).bool,
|
|
29406
29405
|
shouldRenderSeparator: (prop_types_default()).bool,
|
|
29407
|
-
icon:
|
|
29406
|
+
icon: (prop_types_default()).node,
|
|
29408
29407
|
separator: (prop_types_default()).node,
|
|
29409
29408
|
noLink: (prop_types_default()).bool
|
|
29410
29409
|
};
|
|
@@ -33634,7 +33633,8 @@ class DayCol extends BaseComponent {
|
|
|
33634
33633
|
this.renderEvents = () => {
|
|
33635
33634
|
const {
|
|
33636
33635
|
events,
|
|
33637
|
-
scrollHeight
|
|
33636
|
+
scrollHeight,
|
|
33637
|
+
minEventHeight
|
|
33638
33638
|
} = this.props;
|
|
33639
33639
|
const list = events.map((event, ind) => {
|
|
33640
33640
|
const {
|
|
@@ -33645,12 +33645,9 @@ class DayCol extends BaseComponent {
|
|
|
33645
33645
|
} = event;
|
|
33646
33646
|
const top = startPos * scrollHeight;
|
|
33647
33647
|
const height = (endPos - startPos) * scrollHeight;
|
|
33648
|
-
if (!height) {
|
|
33649
|
-
return undefined;
|
|
33650
|
-
}
|
|
33651
33648
|
const style = {
|
|
33652
33649
|
top: `${top}px`,
|
|
33653
|
-
height: `${height}px`
|
|
33650
|
+
height: `${Math.max(minEventHeight, height)}px`
|
|
33654
33651
|
};
|
|
33655
33652
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
|
|
33656
33653
|
className: `${calendar_constants_cssClasses.PREFIX}-event-item ${calendar_constants_cssClasses.PREFIX}-event-day`,
|
|
@@ -33764,6 +33761,7 @@ DayCol.propTypes = {
|
|
|
33764
33761
|
currPos: (prop_types_default()).number,
|
|
33765
33762
|
handleClick: (prop_types_default()).func,
|
|
33766
33763
|
mode: (prop_types_default()).string,
|
|
33764
|
+
minEventHeight: (prop_types_default()).number,
|
|
33767
33765
|
isWeekend: (prop_types_default()).bool,
|
|
33768
33766
|
dateGridRender: (prop_types_default()).func
|
|
33769
33767
|
};
|
|
@@ -33772,7 +33770,8 @@ DayCol.defaultProps = {
|
|
|
33772
33770
|
showCurrTime: true,
|
|
33773
33771
|
scrollHeight: 0,
|
|
33774
33772
|
currPos: 0,
|
|
33775
|
-
mode: 'dayCol'
|
|
33773
|
+
mode: 'dayCol',
|
|
33774
|
+
minEventHeight: Number.MIN_SAFE_INTEGER
|
|
33776
33775
|
};
|
|
33777
33776
|
DayCol.contextType = locale_context;
|
|
33778
33777
|
;// CONCATENATED MODULE: ./calendar/timeCol.tsx
|
|
@@ -33953,7 +33952,8 @@ class DayCalendar extends BaseComponent {
|
|
|
33953
33952
|
height,
|
|
33954
33953
|
width,
|
|
33955
33954
|
style,
|
|
33956
|
-
header
|
|
33955
|
+
header,
|
|
33956
|
+
minEventHeight
|
|
33957
33957
|
} = this.props;
|
|
33958
33958
|
const dayCls = classnames_default()(dayCalendar_prefixCls, className);
|
|
33959
33959
|
const dayStyle = Object.assign({
|
|
@@ -33986,6 +33986,7 @@ class DayCalendar extends BaseComponent {
|
|
|
33986
33986
|
handleClick: this.handleClick,
|
|
33987
33987
|
showCurrTime: showCurrTime,
|
|
33988
33988
|
isWeekend: this.isWeekend,
|
|
33989
|
+
minEventHeight: minEventHeight,
|
|
33989
33990
|
dateGridRender: dateGridRender
|
|
33990
33991
|
}))));
|
|
33991
33992
|
}
|
|
@@ -33999,6 +34000,7 @@ DayCalendar.propTypes = {
|
|
|
33999
34000
|
mode: (prop_types_default()).string,
|
|
34000
34001
|
renderTimeDisplay: (prop_types_default()).func,
|
|
34001
34002
|
markWeekend: (prop_types_default()).bool,
|
|
34003
|
+
minEventHeight: (prop_types_default()).number,
|
|
34002
34004
|
scrollTop: (prop_types_default()).number,
|
|
34003
34005
|
width: prop_types_default().oneOfType([(prop_types_default()).number, (prop_types_default()).string]),
|
|
34004
34006
|
height: prop_types_default().oneOfType([(prop_types_default()).number, (prop_types_default()).string]),
|
|
@@ -34054,7 +34056,8 @@ class WeekCalendar extends BaseComponent {
|
|
|
34054
34056
|
} = this.weeklyData;
|
|
34055
34057
|
const {
|
|
34056
34058
|
markWeekend,
|
|
34057
|
-
dateGridRender
|
|
34059
|
+
dateGridRender,
|
|
34060
|
+
minEventHeight
|
|
34058
34061
|
} = this.props;
|
|
34059
34062
|
const inner = week.map(day => {
|
|
34060
34063
|
const dateString = day.date.toString();
|
|
@@ -34068,7 +34071,8 @@ class WeekCalendar extends BaseComponent {
|
|
|
34068
34071
|
events: parsed.day,
|
|
34069
34072
|
showCurrTime: this.props.showCurrTime,
|
|
34070
34073
|
isWeekend: markWeekend && day.isWeekend,
|
|
34071
|
-
dateGridRender: dateGridRender
|
|
34074
|
+
dateGridRender: dateGridRender,
|
|
34075
|
+
minEventHeight: minEventHeight
|
|
34072
34076
|
});
|
|
34073
34077
|
});
|
|
34074
34078
|
return inner;
|
|
@@ -34735,7 +34739,8 @@ class RangeCalendar extends BaseComponent {
|
|
|
34735
34739
|
} = this.RangeData;
|
|
34736
34740
|
const {
|
|
34737
34741
|
markWeekend,
|
|
34738
|
-
dateGridRender
|
|
34742
|
+
dateGridRender,
|
|
34743
|
+
minEventHeight
|
|
34739
34744
|
} = this.props;
|
|
34740
34745
|
const inner = week.map(day => {
|
|
34741
34746
|
const dateString = day.date.toString();
|
|
@@ -34749,7 +34754,8 @@ class RangeCalendar extends BaseComponent {
|
|
|
34749
34754
|
events: parsed.day,
|
|
34750
34755
|
showCurrTime: this.props.showCurrTime,
|
|
34751
34756
|
isWeekend: markWeekend && day.isWeekend,
|
|
34752
|
-
dateGridRender: dateGridRender
|
|
34757
|
+
dateGridRender: dateGridRender,
|
|
34758
|
+
minEventHeight: minEventHeight
|
|
34753
34759
|
});
|
|
34754
34760
|
});
|
|
34755
34761
|
return inner;
|
|
@@ -35022,6 +35028,7 @@ Calendar.propTypes = {
|
|
|
35022
35028
|
renderTimeDisplay: (prop_types_default()).func,
|
|
35023
35029
|
renderDateDisplay: (prop_types_default()).func,
|
|
35024
35030
|
markWeekend: (prop_types_default()).bool,
|
|
35031
|
+
minEventHeight: (prop_types_default()).number,
|
|
35025
35032
|
width: prop_types_default().oneOfType([(prop_types_default()).number, (prop_types_default()).string]),
|
|
35026
35033
|
height: prop_types_default().oneOfType([(prop_types_default()).number, (prop_types_default()).string]),
|
|
35027
35034
|
style: (prop_types_default()).object,
|
|
@@ -62413,7 +62420,7 @@ Modal.propTypes = {
|
|
|
62413
62420
|
getPopupContainer: (prop_types_default()).func,
|
|
62414
62421
|
getContainerContext: (prop_types_default()).func,
|
|
62415
62422
|
maskFixed: (prop_types_default()).bool,
|
|
62416
|
-
closeIcon:
|
|
62423
|
+
closeIcon: (prop_types_default()).node,
|
|
62417
62424
|
closeOnEsc: (prop_types_default()).bool,
|
|
62418
62425
|
size: prop_types_default().oneOf(modal_constants_strings.SIZE),
|
|
62419
62426
|
keepDOM: (prop_types_default()).bool,
|
|
@@ -66867,7 +66874,7 @@ SubNav.propTypes = {
|
|
|
66867
66874
|
/**
|
|
66868
66875
|
* Icon name on the left
|
|
66869
66876
|
*/
|
|
66870
|
-
icon:
|
|
66877
|
+
icon: (prop_types_default()).node,
|
|
66871
66878
|
/**
|
|
66872
66879
|
* Maximum height (for animation)
|
|
66873
66880
|
*/
|
|
@@ -69374,6 +69381,7 @@ class SelectFoundation extends foundation {
|
|
|
69374
69381
|
this.close(e);
|
|
69375
69382
|
this._notifyBlur(e);
|
|
69376
69383
|
this._adapter.updateFocusState(false);
|
|
69384
|
+
this._adapter.unregisterClickOutsideHandler();
|
|
69377
69385
|
});
|
|
69378
69386
|
}
|
|
69379
69387
|
toggle2SearchInput(isShow) {
|
|
@@ -69391,7 +69399,6 @@ class SelectFoundation extends foundation {
|
|
|
69391
69399
|
this._adapter.setIsFocusInContainer(false);
|
|
69392
69400
|
// this.unBindKeyBoardEvent();
|
|
69393
69401
|
// this._notifyBlur(e);
|
|
69394
|
-
this._adapter.unregisterClickOutsideHandler();
|
|
69395
69402
|
// this._adapter.updateFocusState(false);
|
|
69396
69403
|
const isFilterable = this._isFilterable();
|
|
69397
69404
|
if (isFilterable) {
|
|
@@ -72784,7 +72791,7 @@ Popconfirm.propTypes = {
|
|
|
72784
72791
|
prefixCls: (prop_types_default()).string,
|
|
72785
72792
|
className: (prop_types_default()).string,
|
|
72786
72793
|
style: (prop_types_default()).object,
|
|
72787
|
-
icon:
|
|
72794
|
+
icon: (prop_types_default()).node,
|
|
72788
72795
|
okText: (prop_types_default()).string,
|
|
72789
72796
|
okType: (prop_types_default()).string,
|
|
72790
72797
|
cancelText: (prop_types_default()).string,
|
|
@@ -75011,7 +75018,8 @@ class SideSheetContent extends (external_root_React_commonjs2_react_commonjs_rea
|
|
|
75011
75018
|
const {
|
|
75012
75019
|
title,
|
|
75013
75020
|
closable,
|
|
75014
|
-
headerStyle
|
|
75021
|
+
headerStyle,
|
|
75022
|
+
closeIcon
|
|
75015
75023
|
} = this.props;
|
|
75016
75024
|
let header, closer;
|
|
75017
75025
|
if (title) {
|
|
@@ -75021,12 +75029,13 @@ class SideSheetContent extends (external_root_React_commonjs2_react_commonjs_rea
|
|
|
75021
75029
|
}, this.props.title);
|
|
75022
75030
|
}
|
|
75023
75031
|
if (closable) {
|
|
75032
|
+
const iconType = closeIcon || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(IconClose, null);
|
|
75024
75033
|
closer = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(iconButton_0, {
|
|
75025
75034
|
className: `${SideSheetContent_prefixCls}-close`,
|
|
75026
75035
|
key: "close-btn",
|
|
75027
75036
|
onClick: this.close,
|
|
75028
75037
|
type: "tertiary",
|
|
75029
|
-
icon:
|
|
75038
|
+
icon: iconType,
|
|
75030
75039
|
theme: "borderless",
|
|
75031
75040
|
size: "small"
|
|
75032
75041
|
});
|
|
@@ -75112,7 +75121,8 @@ class SideSheetContent extends (external_root_React_commonjs2_react_commonjs_rea
|
|
|
75112
75121
|
}
|
|
75113
75122
|
}
|
|
75114
75123
|
SideSheetContent.propTypes = {
|
|
75115
|
-
onClose: (prop_types_default()).func
|
|
75124
|
+
onClose: (prop_types_default()).func,
|
|
75125
|
+
closeIcon: (prop_types_default()).node
|
|
75116
75126
|
};
|
|
75117
75127
|
SideSheetContent.defaultProps = {
|
|
75118
75128
|
onClose: (noop_default())
|
|
@@ -75933,7 +75943,7 @@ class SliderFoundation extends foundation {
|
|
|
75933
75943
|
this.onHandleLeave = () => {
|
|
75934
75944
|
// this._adapter.setEventDefault(e);
|
|
75935
75945
|
const disabled = this._adapter.getState('disabled');
|
|
75936
|
-
if (!disabled) {
|
|
75946
|
+
if (!disabled && this.getStates()['focusPos'] === "") {
|
|
75937
75947
|
this._adapter.onHandleLeave();
|
|
75938
75948
|
}
|
|
75939
75949
|
};
|
|
@@ -81504,6 +81514,7 @@ class TableRow extends BaseComponent {
|
|
|
81504
81514
|
record,
|
|
81505
81515
|
hovered,
|
|
81506
81516
|
expanded,
|
|
81517
|
+
displayNone,
|
|
81507
81518
|
expandableRow,
|
|
81508
81519
|
level,
|
|
81509
81520
|
expandedRow,
|
|
@@ -81521,7 +81532,8 @@ class TableRow extends BaseComponent {
|
|
|
81521
81532
|
const rowCls = typeof replaceClassName === 'string' && replaceClassName.length ? replaceClassName : classnames_default()(className, `${prefixCls}-row`, {
|
|
81522
81533
|
[`${prefixCls}-row-selected`]: selected,
|
|
81523
81534
|
[`${prefixCls}-row-expanded`]: expanded,
|
|
81524
|
-
[`${prefixCls}-row-hovered`]: hovered
|
|
81535
|
+
[`${prefixCls}-row-hovered`]: hovered,
|
|
81536
|
+
[`${prefixCls}-row-hidden`]: displayNone
|
|
81525
81537
|
}, customClassName);
|
|
81526
81538
|
const ariaProps = {};
|
|
81527
81539
|
if (typeof index === 'number') {
|
|
@@ -81562,6 +81574,7 @@ TableRow.propTypes = {
|
|
|
81562
81574
|
expandIcon: prop_types_default().oneOfType([(prop_types_default()).bool, (prop_types_default()).func, (prop_types_default()).node]),
|
|
81563
81575
|
expandableRow: (prop_types_default()).bool,
|
|
81564
81576
|
expanded: (prop_types_default()).bool,
|
|
81577
|
+
displayNone: (prop_types_default()).bool,
|
|
81565
81578
|
expandedRow: (prop_types_default()).bool,
|
|
81566
81579
|
fixed: prop_types_default().oneOfType([(prop_types_default()).string, (prop_types_default()).bool]),
|
|
81567
81580
|
height: prop_types_default().oneOfType([(prop_types_default()).string, (prop_types_default()).number]),
|
|
@@ -81653,7 +81666,8 @@ class TableExpandedRow extends external_root_React_commonjs2_react_commonjs_reac
|
|
|
81653
81666
|
style,
|
|
81654
81667
|
virtualized,
|
|
81655
81668
|
indentSize,
|
|
81656
|
-
cellWidths
|
|
81669
|
+
cellWidths,
|
|
81670
|
+
displayNone
|
|
81657
81671
|
} = this.props;
|
|
81658
81672
|
const {
|
|
81659
81673
|
tableWidth,
|
|
@@ -81712,7 +81726,8 @@ class TableExpandedRow extends external_root_React_commonjs2_react_commonjs_reac
|
|
|
81712
81726
|
store: store,
|
|
81713
81727
|
virtualized: virtualized,
|
|
81714
81728
|
indentSize: indentSize,
|
|
81715
|
-
cellWidths: baseRowCellWidths
|
|
81729
|
+
cellWidths: baseRowCellWidths,
|
|
81730
|
+
displayNone: displayNone
|
|
81716
81731
|
});
|
|
81717
81732
|
}
|
|
81718
81733
|
}
|
|
@@ -82227,7 +82242,8 @@ class Body extends BaseComponent {
|
|
|
82227
82242
|
expanded,
|
|
82228
82243
|
index,
|
|
82229
82244
|
rowKey,
|
|
82230
|
-
virtualized
|
|
82245
|
+
virtualized,
|
|
82246
|
+
displayNone
|
|
82231
82247
|
} = props;
|
|
82232
82248
|
let key = getRecordKey(record, rowKey);
|
|
82233
82249
|
if (key == null) {
|
|
@@ -82253,7 +82269,8 @@ class Body extends BaseComponent {
|
|
|
82253
82269
|
index: index,
|
|
82254
82270
|
virtualized: virtualized,
|
|
82255
82271
|
key: genExpandedRowKey(key),
|
|
82256
|
-
cellWidths: _this.cellWidths
|
|
82272
|
+
cellWidths: _this.cellWidths,
|
|
82273
|
+
displayNone: displayNone
|
|
82257
82274
|
});
|
|
82258
82275
|
};
|
|
82259
82276
|
/**
|
|
@@ -82265,7 +82282,8 @@ class Body extends BaseComponent {
|
|
|
82265
82282
|
groups,
|
|
82266
82283
|
dataSource: data,
|
|
82267
82284
|
rowKey,
|
|
82268
|
-
expandedRowKeys
|
|
82285
|
+
expandedRowKeys,
|
|
82286
|
+
keepDOM
|
|
82269
82287
|
} = this.props;
|
|
82270
82288
|
const {
|
|
82271
82289
|
flattenedColumns
|
|
@@ -82300,7 +82318,7 @@ class Body extends BaseComponent {
|
|
|
82300
82318
|
expanded
|
|
82301
82319
|
})));
|
|
82302
82320
|
// Render the grouped content when the group is expanded
|
|
82303
|
-
if (expanded) {
|
|
82321
|
+
if (expanded || keepDOM) {
|
|
82304
82322
|
const dataInGroup = [];
|
|
82305
82323
|
group.forEach(recordKey => {
|
|
82306
82324
|
const record = getRecord(data, recordKey, rowKey);
|
|
@@ -82311,7 +82329,7 @@ class Body extends BaseComponent {
|
|
|
82311
82329
|
/**
|
|
82312
82330
|
* Render the contents of the group row
|
|
82313
82331
|
*/
|
|
82314
|
-
renderedRows.push(this.renderBodyRows(dataInGroup));
|
|
82332
|
+
renderedRows.push(this.renderBodyRows(dataInGroup, undefined, [], !expanded));
|
|
82315
82333
|
}
|
|
82316
82334
|
});
|
|
82317
82335
|
return renderedRows;
|
|
@@ -82555,12 +82573,14 @@ class Body extends BaseComponent {
|
|
|
82555
82573
|
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
82556
82574
|
let level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
82557
82575
|
let renderedRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
82576
|
+
let displayNone = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
82558
82577
|
const {
|
|
82559
82578
|
rowKey,
|
|
82560
82579
|
expandedRowRender,
|
|
82561
82580
|
expandedRowKeys,
|
|
82562
82581
|
childrenRecordName,
|
|
82563
|
-
rowExpandable
|
|
82582
|
+
rowExpandable,
|
|
82583
|
+
keepDOM
|
|
82564
82584
|
} = this.props;
|
|
82565
82585
|
const hasExpandedRowRender = typeof expandedRowRender === 'function';
|
|
82566
82586
|
const expandBtnShouldInRow = this.state.cachedExpandBtnShouldInRow;
|
|
@@ -82577,6 +82597,7 @@ class Body extends BaseComponent {
|
|
|
82577
82597
|
renderedRows.push(this.renderBaseRow(Object.assign(Object.assign({}, this.props), {
|
|
82578
82598
|
columns: flattenedColumns,
|
|
82579
82599
|
expandBtnShouldInRow,
|
|
82600
|
+
displayNone,
|
|
82580
82601
|
record,
|
|
82581
82602
|
key,
|
|
82582
82603
|
level,
|
|
@@ -82584,13 +82605,15 @@ class Body extends BaseComponent {
|
|
|
82584
82605
|
})));
|
|
82585
82606
|
// render expand row
|
|
82586
82607
|
const expanded = isExpanded(expandedRowKeys, key);
|
|
82587
|
-
|
|
82608
|
+
const shouldRenderExpandedRows = expanded || keepDOM;
|
|
82609
|
+
if (hasExpandedRowRender && rowExpandable && rowExpandable(record) && shouldRenderExpandedRows) {
|
|
82588
82610
|
const currentExpandRow = this.renderExpandedRow(Object.assign(Object.assign({}, this.props), {
|
|
82589
82611
|
columns: flattenedColumns,
|
|
82590
82612
|
level,
|
|
82591
82613
|
index,
|
|
82592
82614
|
record,
|
|
82593
|
-
expanded
|
|
82615
|
+
expanded,
|
|
82616
|
+
displayNone: displayNone || !expanded
|
|
82594
82617
|
}));
|
|
82595
82618
|
/**
|
|
82596
82619
|
* If expandedRowRender returns falsy, this expanded row will not be rendered
|
|
@@ -82601,8 +82624,8 @@ class Body extends BaseComponent {
|
|
|
82601
82624
|
}
|
|
82602
82625
|
}
|
|
82603
82626
|
// render tree data
|
|
82604
|
-
if (recordHasChildren &&
|
|
82605
|
-
const nestedRows = this.renderBodyRows(recordChildren, level + 1);
|
|
82627
|
+
if (recordHasChildren && shouldRenderExpandedRows) {
|
|
82628
|
+
const nestedRows = this.renderBodyRows(recordChildren, level + 1, [], displayNone || !expanded);
|
|
82606
82629
|
renderedRows.push(...nestedRows);
|
|
82607
82630
|
}
|
|
82608
82631
|
});
|
|
@@ -86524,9 +86547,10 @@ class TimePicker extends BaseComponent {
|
|
|
86524
86547
|
scrollItemProps,
|
|
86525
86548
|
triggerRender,
|
|
86526
86549
|
motion,
|
|
86527
|
-
autoAdjustOverflow
|
|
86550
|
+
autoAdjustOverflow,
|
|
86551
|
+
stopPropagation
|
|
86528
86552
|
} = _a,
|
|
86529
|
-
rest = TimePicker_rest(_a, ["prefixCls", "placeholder", "disabled", "defaultValue", "dropdownMargin", "className", "popupStyle", "size", "style", "locale", "localeCode", "zIndex", "getPopupContainer", "insetLabel", "insetLabelId", "inputStyle", "showClear", "panelHeader", "panelFooter", "rangeSeparator", "onOpenChange", "onChangeWithDateFirst", "popupClassName", "hideDisabledOptions", "use12Hours", "minuteStep", "hourStep", "secondStep", "scrollItemProps", "triggerRender", "motion", "autoAdjustOverflow"]);
|
|
86553
|
+
rest = TimePicker_rest(_a, ["prefixCls", "placeholder", "disabled", "defaultValue", "dropdownMargin", "className", "popupStyle", "size", "style", "locale", "localeCode", "zIndex", "getPopupContainer", "insetLabel", "insetLabelId", "inputStyle", "showClear", "panelHeader", "panelFooter", "rangeSeparator", "onOpenChange", "onChangeWithDateFirst", "popupClassName", "hideDisabledOptions", "use12Hours", "minuteStep", "hourStep", "secondStep", "scrollItemProps", "triggerRender", "motion", "autoAdjustOverflow", "stopPropagation"]);
|
|
86530
86554
|
const format = this.foundation.getDefaultFormatIfNeed();
|
|
86531
86555
|
const position = this.foundation.getPosition();
|
|
86532
86556
|
const useCustomTrigger = typeof triggerRender === 'function';
|
|
@@ -86584,7 +86608,8 @@ class TimePicker extends BaseComponent {
|
|
|
86584
86608
|
visible: disabled ? false : Boolean(open),
|
|
86585
86609
|
motion: motion,
|
|
86586
86610
|
margin: dropdownMargin,
|
|
86587
|
-
autoAdjustOverflow: autoAdjustOverflow
|
|
86611
|
+
autoAdjustOverflow: autoAdjustOverflow,
|
|
86612
|
+
stopPropagation: stopPropagation
|
|
86588
86613
|
}, useCustomTrigger ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(trigger, {
|
|
86589
86614
|
triggerRender: triggerRender,
|
|
86590
86615
|
disabled: disabled,
|
|
@@ -86639,6 +86664,7 @@ TimePicker.propTypes = Object.assign(Object.assign({
|
|
|
86639
86664
|
focusOnOpen: (prop_types_default()).bool,
|
|
86640
86665
|
autoFocus: (prop_types_default()).bool,
|
|
86641
86666
|
size: prop_types_default().oneOf(timePicker_constants_strings.SIZE),
|
|
86667
|
+
stopPropagation: (prop_types_default()).bool,
|
|
86642
86668
|
panels: prop_types_default().arrayOf(prop_types_default().shape(PanelShape)),
|
|
86643
86669
|
onFocus: (prop_types_default()).func,
|
|
86644
86670
|
onBlur: (prop_types_default()).func,
|
|
@@ -86672,6 +86698,7 @@ TimePicker.defaultProps = Object.assign({
|
|
|
86672
86698
|
prefixCls: timePicker_constants_cssClasses.PREFIX,
|
|
86673
86699
|
inputReadOnly: false,
|
|
86674
86700
|
style: {},
|
|
86701
|
+
stopPropagation: true,
|
|
86675
86702
|
className: '',
|
|
86676
86703
|
popupClassName: '',
|
|
86677
86704
|
popupStyle: {
|
|
@@ -86995,7 +87022,7 @@ Toast.propTypes = {
|
|
|
86995
87022
|
showClose: (prop_types_default()).bool,
|
|
86996
87023
|
stack: (prop_types_default()).bool,
|
|
86997
87024
|
stackExpanded: (prop_types_default()).bool,
|
|
86998
|
-
icon:
|
|
87025
|
+
icon: (prop_types_default()).node,
|
|
86999
87026
|
direction: prop_types_default().oneOf(toast_constants_strings.directions)
|
|
87000
87027
|
};
|
|
87001
87028
|
Toast.defaultProps = {
|
|
@@ -98923,14 +98950,14 @@ const PreviewContext = /*#__PURE__*/(0,external_root_React_commonjs2_react_commo
|
|
|
98923
98950
|
|
|
98924
98951
|
|
|
98925
98952
|
const previewHeader_prefixCls = `${image_constants_cssClasses.PREFIX}-preview-header`;
|
|
98926
|
-
const previewHeader_Header = _ref => {
|
|
98953
|
+
const previewHeader_Header = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)((_ref, ref) => {
|
|
98927
98954
|
let {
|
|
98928
98955
|
onClose,
|
|
98929
98956
|
titleStyle,
|
|
98930
98957
|
className,
|
|
98931
98958
|
renderHeader
|
|
98932
98959
|
} = _ref;
|
|
98933
|
-
return /*#__PURE__*/
|
|
98960
|
+
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(PreviewContext.Consumer, null, _ref2 => {
|
|
98934
98961
|
let {
|
|
98935
98962
|
currentIndex,
|
|
98936
98963
|
titles
|
|
@@ -98939,17 +98966,18 @@ const previewHeader_Header = _ref => {
|
|
|
98939
98966
|
if (titles && typeof currentIndex === "number") {
|
|
98940
98967
|
title = titles[currentIndex];
|
|
98941
98968
|
}
|
|
98942
|
-
return /*#__PURE__*/
|
|
98969
|
+
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("section", {
|
|
98970
|
+
ref: ref,
|
|
98943
98971
|
className: classnames_default()(previewHeader_prefixCls, className)
|
|
98944
|
-
}, /*#__PURE__*/
|
|
98972
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("section", {
|
|
98945
98973
|
className: `${previewHeader_prefixCls}-title`,
|
|
98946
98974
|
style: titleStyle
|
|
98947
|
-
}, renderHeader ? renderHeader(title) : title), /*#__PURE__*/
|
|
98975
|
+
}, renderHeader ? renderHeader(title) : title), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("section", {
|
|
98948
98976
|
className: `${previewHeader_prefixCls}-close`,
|
|
98949
98977
|
onMouseUp: onClose
|
|
98950
|
-
}, /*#__PURE__*/
|
|
98978
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(IconClose, null)));
|
|
98951
98979
|
});
|
|
98952
|
-
};
|
|
98980
|
+
});
|
|
98953
98981
|
/* harmony default export */ const previewHeader = (previewHeader_Header);
|
|
98954
98982
|
;// CONCATENATED MODULE: ../semi-icons/lib/es/icons/IconMinus.js
|
|
98955
98983
|
|
|
@@ -99105,7 +99133,6 @@ class PreviewFooterFoundation extends foundation {
|
|
|
99105
99133
|
} else {
|
|
99106
99134
|
onZoomOut(Number((value / 100).toFixed(2)));
|
|
99107
99135
|
}
|
|
99108
|
-
this._adapter.setStartMouseOffset(value);
|
|
99109
99136
|
};
|
|
99110
99137
|
this.handleRatioClick = () => {
|
|
99111
99138
|
const {
|
|
@@ -99138,14 +99165,9 @@ class PreviewFooterFoundation extends foundation {
|
|
|
99138
99165
|
|
|
99139
99166
|
const previewFooter_prefixCls = image_constants_cssClasses.PREFIX;
|
|
99140
99167
|
const footerPrefixCls = `${image_constants_cssClasses.PREFIX}-preview-footer`;
|
|
99141
|
-
let mouseActiveTime = 0;
|
|
99142
99168
|
class previewFooter_Footer extends BaseComponent {
|
|
99143
99169
|
get adapter() {
|
|
99144
|
-
return Object.assign(
|
|
99145
|
-
setStartMouseOffset: time => {
|
|
99146
|
-
mouseActiveTime = time;
|
|
99147
|
-
}
|
|
99148
|
-
});
|
|
99170
|
+
return Object.assign({}, super.adapter);
|
|
99149
99171
|
}
|
|
99150
99172
|
constructor(props) {
|
|
99151
99173
|
super(props);
|
|
@@ -99385,13 +99407,15 @@ class previewFooter_Footer extends BaseComponent {
|
|
|
99385
99407
|
render() {
|
|
99386
99408
|
const {
|
|
99387
99409
|
className,
|
|
99388
|
-
renderPreviewMenu
|
|
99410
|
+
renderPreviewMenu,
|
|
99411
|
+
forwardRef
|
|
99389
99412
|
} = this.props;
|
|
99390
99413
|
const menuCls = classnames_default()(footerPrefixCls, `${footerPrefixCls}-wrapper`, className, {
|
|
99391
99414
|
[`${footerPrefixCls}-content`]: !Boolean(renderPreviewMenu)
|
|
99392
99415
|
});
|
|
99393
99416
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("section", {
|
|
99394
|
-
className: menuCls
|
|
99417
|
+
className: menuCls,
|
|
99418
|
+
ref: forwardRef
|
|
99395
99419
|
}, renderPreviewMenu ? this.customRenderViewMenu() : this.getFooterMenu());
|
|
99396
99420
|
}
|
|
99397
99421
|
}
|
|
@@ -99430,9 +99454,6 @@ previewFooter_Footer.defaultProps = {
|
|
|
99430
99454
|
};
|
|
99431
99455
|
;// CONCATENATED MODULE: ../semi-foundation/image/previewImageFoundation.ts
|
|
99432
99456
|
|
|
99433
|
-
|
|
99434
|
-
|
|
99435
|
-
|
|
99436
99457
|
const DefaultDOMRect = {
|
|
99437
99458
|
bottom: 0,
|
|
99438
99459
|
height: 0,
|
|
@@ -99447,6 +99468,12 @@ const DefaultDOMRect = {
|
|
|
99447
99468
|
class PreviewImageFoundation extends foundation {
|
|
99448
99469
|
constructor(adapter) {
|
|
99449
99470
|
super(Object.assign({}, adapter));
|
|
99471
|
+
this.startMouseOffset = {
|
|
99472
|
+
x: 0,
|
|
99473
|
+
y: 0
|
|
99474
|
+
};
|
|
99475
|
+
this.originImageWidth = null;
|
|
99476
|
+
this.originImageHeight = null;
|
|
99450
99477
|
this._isImageVertical = () => this.getProp("rotation") % 180 !== 0;
|
|
99451
99478
|
this._getImageBounds = () => {
|
|
99452
99479
|
const imageDOM = this._adapter.getImage();
|
|
@@ -99476,32 +99503,18 @@ class PreviewImageFoundation extends foundation {
|
|
|
99476
99503
|
this._adapter.setLoading(loading);
|
|
99477
99504
|
};
|
|
99478
99505
|
this.handleWindowResize = () => {
|
|
99479
|
-
|
|
99480
|
-
|
|
99481
|
-
setRatio
|
|
99482
|
-
} = this.getProps();
|
|
99483
|
-
const {
|
|
99484
|
-
originImageWidth,
|
|
99485
|
-
originImageHeight
|
|
99486
|
-
} = this._adapter.getOriginImageSize();
|
|
99487
|
-
if (originImageWidth && originImageHeight) {
|
|
99488
|
-
if (ratio !== "adaptation") {
|
|
99489
|
-
setRatio("adaptation");
|
|
99490
|
-
} else {
|
|
99491
|
-
this.handleResizeImage();
|
|
99492
|
-
}
|
|
99506
|
+
if (this.originImageWidth && this.originImageHeight) {
|
|
99507
|
+
this.handleResizeImage();
|
|
99493
99508
|
}
|
|
99494
99509
|
};
|
|
99495
99510
|
this.handleLoad = e => {
|
|
99496
99511
|
if (e.target) {
|
|
99497
99512
|
const {
|
|
99498
|
-
|
|
99499
|
-
|
|
99513
|
+
naturalWidth: w,
|
|
99514
|
+
naturalHeight: h
|
|
99500
99515
|
} = e.target;
|
|
99501
|
-
this.
|
|
99502
|
-
|
|
99503
|
-
originImageHeight: h
|
|
99504
|
-
});
|
|
99516
|
+
this.originImageHeight = h;
|
|
99517
|
+
this.originImageWidth = w;
|
|
99505
99518
|
this.setState({
|
|
99506
99519
|
loading: false
|
|
99507
99520
|
});
|
|
@@ -99526,13 +99539,14 @@ class PreviewImageFoundation extends foundation {
|
|
|
99526
99539
|
this.handleResizeImage = () => {
|
|
99527
99540
|
const horizontal = !this._isImageVertical();
|
|
99528
99541
|
const {
|
|
99529
|
-
|
|
99530
|
-
|
|
99531
|
-
|
|
99532
|
-
const
|
|
99533
|
-
const imgHeight = horizontal ? originImageHeight : originImageWidth;
|
|
99542
|
+
currZoom
|
|
99543
|
+
} = this.getStates();
|
|
99544
|
+
const imgWidth = horizontal ? this.originImageWidth : this.originImageHeight;
|
|
99545
|
+
const imgHeight = horizontal ? this.originImageHeight : this.originImageWidth;
|
|
99534
99546
|
const {
|
|
99535
|
-
onZoom
|
|
99547
|
+
onZoom,
|
|
99548
|
+
setRatio,
|
|
99549
|
+
ratio
|
|
99536
99550
|
} = this.getProps();
|
|
99537
99551
|
const containerDOM = this._adapter.getContainer();
|
|
99538
99552
|
if (containerDOM) {
|
|
@@ -99542,8 +99556,44 @@ class PreviewImageFoundation extends foundation {
|
|
|
99542
99556
|
} = this._getContainerBounds();
|
|
99543
99557
|
const reservedWidth = containerWidth - 80;
|
|
99544
99558
|
const reservedHeight = containerHeight - 80;
|
|
99545
|
-
|
|
99546
|
-
|
|
99559
|
+
let _zoom = 1;
|
|
99560
|
+
if (imgWidth > reservedWidth || imgHeight > reservedHeight) {
|
|
99561
|
+
_zoom = Number(Math.min(reservedWidth / imgWidth, reservedHeight / imgHeight).toFixed(2));
|
|
99562
|
+
}
|
|
99563
|
+
if (currZoom === _zoom) {
|
|
99564
|
+
this.calculatePreviewImage(_zoom, null);
|
|
99565
|
+
} else {
|
|
99566
|
+
onZoom(_zoom);
|
|
99567
|
+
}
|
|
99568
|
+
}
|
|
99569
|
+
};
|
|
99570
|
+
this.handleRatioChange = () => {
|
|
99571
|
+
if (this.originImageWidth && this.originImageHeight) {
|
|
99572
|
+
const {
|
|
99573
|
+
currZoom
|
|
99574
|
+
} = this.getStates();
|
|
99575
|
+
const {
|
|
99576
|
+
ratio,
|
|
99577
|
+
onZoom
|
|
99578
|
+
} = this.getProps();
|
|
99579
|
+
let _zoom;
|
|
99580
|
+
if (ratio === 'adaptation') {
|
|
99581
|
+
const horizontal = !this._isImageVertical();
|
|
99582
|
+
const imgWidth = horizontal ? this.originImageWidth : this.originImageHeight;
|
|
99583
|
+
const imgHeight = horizontal ? this.originImageHeight : this.originImageWidth;
|
|
99584
|
+
const {
|
|
99585
|
+
width: containerWidth,
|
|
99586
|
+
height: containerHeight
|
|
99587
|
+
} = this._getContainerBounds();
|
|
99588
|
+
const reservedWidth = containerWidth - 80;
|
|
99589
|
+
const reservedHeight = containerHeight - 80;
|
|
99590
|
+
_zoom = Number(Math.min(reservedWidth / imgWidth, reservedHeight / imgHeight).toFixed(2));
|
|
99591
|
+
} else {
|
|
99592
|
+
_zoom = 1;
|
|
99593
|
+
}
|
|
99594
|
+
if (currZoom !== _zoom) {
|
|
99595
|
+
onZoom(_zoom);
|
|
99596
|
+
}
|
|
99547
99597
|
}
|
|
99548
99598
|
};
|
|
99549
99599
|
this.handleRightClickImage = e => {
|
|
@@ -99558,38 +99608,6 @@ class PreviewImageFoundation extends foundation {
|
|
|
99558
99608
|
return true;
|
|
99559
99609
|
}
|
|
99560
99610
|
};
|
|
99561
|
-
// e: WheelEvent<HTMLImageElement>
|
|
99562
|
-
this.handleWheel = e => {
|
|
99563
|
-
this.onWheel(e);
|
|
99564
|
-
handlePrevent(e);
|
|
99565
|
-
};
|
|
99566
|
-
// e: WheelEvent<HTMLImageElement>
|
|
99567
|
-
this.onWheel = throttle_default()(e => {
|
|
99568
|
-
const {
|
|
99569
|
-
onZoom,
|
|
99570
|
-
zoomStep,
|
|
99571
|
-
maxZoom,
|
|
99572
|
-
minZoom
|
|
99573
|
-
} = this.getProps();
|
|
99574
|
-
const {
|
|
99575
|
-
currZoom
|
|
99576
|
-
} = this.getStates();
|
|
99577
|
-
let _zoom;
|
|
99578
|
-
if (e.deltaY < 0) {
|
|
99579
|
-
/* zoom in */
|
|
99580
|
-
if (currZoom + zoomStep <= maxZoom) {
|
|
99581
|
-
_zoom = Number((currZoom + zoomStep).toFixed(2));
|
|
99582
|
-
}
|
|
99583
|
-
} else if (e.deltaY > 0) {
|
|
99584
|
-
/* zoom out */
|
|
99585
|
-
if (currZoom - zoomStep >= minZoom) {
|
|
99586
|
-
_zoom = Number((currZoom - zoomStep).toFixed(2));
|
|
99587
|
-
}
|
|
99588
|
-
}
|
|
99589
|
-
if (!isUndefined_default()(_zoom)) {
|
|
99590
|
-
onZoom(_zoom);
|
|
99591
|
-
}
|
|
99592
|
-
}, 50);
|
|
99593
99611
|
this.calcCanDragDirection = () => {
|
|
99594
99612
|
const {
|
|
99595
99613
|
width,
|
|
@@ -99613,12 +99631,8 @@ class PreviewImageFoundation extends foundation {
|
|
|
99613
99631
|
canDragHorizontal
|
|
99614
99632
|
};
|
|
99615
99633
|
};
|
|
99616
|
-
this.
|
|
99634
|
+
this.calculatePreviewImage = (newZoom, e) => {
|
|
99617
99635
|
const imageDOM = this._adapter.getImage();
|
|
99618
|
-
const {
|
|
99619
|
-
originImageWidth,
|
|
99620
|
-
originImageHeight
|
|
99621
|
-
} = this._adapter.getOriginImageSize();
|
|
99622
99636
|
const {
|
|
99623
99637
|
canDragVertical,
|
|
99624
99638
|
canDragHorizontal
|
|
@@ -99628,8 +99642,8 @@ class PreviewImageFoundation extends foundation {
|
|
|
99628
99642
|
width: containerWidth,
|
|
99629
99643
|
height: containerHeight
|
|
99630
99644
|
} = this._getContainerBounds();
|
|
99631
|
-
const newWidth = Math.floor(originImageWidth * newZoom);
|
|
99632
|
-
const newHeight = Math.floor(originImageHeight * newZoom);
|
|
99645
|
+
const newWidth = Math.floor(this.originImageWidth * newZoom);
|
|
99646
|
+
const newHeight = Math.floor(this.originImageHeight * newZoom);
|
|
99633
99647
|
// debugger;
|
|
99634
99648
|
let _offset;
|
|
99635
99649
|
const horizontal = !this._isImageVertical();
|
|
@@ -99688,13 +99702,13 @@ class PreviewImageFoundation extends foundation {
|
|
|
99688
99702
|
width,
|
|
99689
99703
|
height
|
|
99690
99704
|
} = this.getStates();
|
|
99691
|
-
const startMouseMove = this._adapter.getMouseMove();
|
|
99692
|
-
const startMouseOffset = this._adapter.getMouseOffset();
|
|
99693
99705
|
const {
|
|
99694
99706
|
canDragVertical,
|
|
99695
99707
|
canDragHorizontal
|
|
99696
99708
|
} = this.calcCanDragDirection();
|
|
99697
|
-
|
|
99709
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons
|
|
99710
|
+
const mouseLeftPress = e.buttons === 1;
|
|
99711
|
+
if (mouseLeftPress && (canDragVertical || canDragHorizontal)) {
|
|
99698
99712
|
const {
|
|
99699
99713
|
clientX,
|
|
99700
99714
|
clientY
|
|
@@ -99707,8 +99721,8 @@ class PreviewImageFoundation extends foundation {
|
|
|
99707
99721
|
left: extremeLeft,
|
|
99708
99722
|
top: extremeTop
|
|
99709
99723
|
} = this.calcExtremeBounds();
|
|
99710
|
-
let newX = canDragHorizontal ? clientX - containerLeft - startMouseOffset.x : offset.x;
|
|
99711
|
-
let newY = canDragVertical ? clientY - containerTop - startMouseOffset.y : offset.y;
|
|
99724
|
+
let newX = canDragHorizontal ? clientX - containerLeft - this.startMouseOffset.x : offset.x;
|
|
99725
|
+
let newY = canDragVertical ? clientY - containerTop - this.startMouseOffset.y : offset.y;
|
|
99712
99726
|
if (canDragHorizontal) {
|
|
99713
99727
|
newX = newX > 0 ? 0 : newX < extremeLeft ? extremeLeft : newX;
|
|
99714
99728
|
}
|
|
@@ -99727,11 +99741,7 @@ class PreviewImageFoundation extends foundation {
|
|
|
99727
99741
|
}
|
|
99728
99742
|
};
|
|
99729
99743
|
this.handleImageMouseDown = e => {
|
|
99730
|
-
this.
|
|
99731
|
-
this._adapter.setStartMouseMove(true);
|
|
99732
|
-
};
|
|
99733
|
-
this.handleImageMouseUp = () => {
|
|
99734
|
-
this._adapter.setStartMouseMove(false);
|
|
99744
|
+
this.startMouseOffset = this._getOffset(e);
|
|
99735
99745
|
};
|
|
99736
99746
|
}
|
|
99737
99747
|
}
|
|
@@ -99744,38 +99754,14 @@ class PreviewImageFoundation extends foundation {
|
|
|
99744
99754
|
|
|
99745
99755
|
const previewImage_prefixCls = image_constants_cssClasses.PREFIX;
|
|
99746
99756
|
const preViewImgPrefixCls = `${previewImage_prefixCls}-preview-image`;
|
|
99747
|
-
let originImageWidth = null;
|
|
99748
|
-
let originImageHeight = null;
|
|
99749
|
-
let startMouseMove = false;
|
|
99750
|
-
// startMouseOffset:The offset of the mouse relative to the left and top of the picture
|
|
99751
|
-
let startMouseOffset = {
|
|
99752
|
-
x: 0,
|
|
99753
|
-
y: 0
|
|
99754
|
-
};
|
|
99755
99757
|
class PreviewImage extends BaseComponent {
|
|
99756
99758
|
get adapter() {
|
|
99757
99759
|
return Object.assign(Object.assign({}, super.adapter), {
|
|
99758
|
-
getOriginImageSize: () => ({
|
|
99759
|
-
originImageWidth,
|
|
99760
|
-
originImageHeight
|
|
99761
|
-
}),
|
|
99762
|
-
setOriginImageSize: size => {
|
|
99763
|
-
originImageWidth = size.originImageWidth;
|
|
99764
|
-
originImageHeight = size.originImageHeight;
|
|
99765
|
-
},
|
|
99766
99760
|
getContainer: () => {
|
|
99767
99761
|
return this.containerRef.current;
|
|
99768
99762
|
},
|
|
99769
99763
|
getImage: () => {
|
|
99770
|
-
return this.imageRef;
|
|
99771
|
-
},
|
|
99772
|
-
getMouseMove: () => startMouseMove,
|
|
99773
|
-
setStartMouseMove: move => {
|
|
99774
|
-
startMouseMove = move;
|
|
99775
|
-
},
|
|
99776
|
-
getMouseOffset: () => startMouseOffset,
|
|
99777
|
-
setStartMouseOffset: offset => {
|
|
99778
|
-
startMouseOffset = offset;
|
|
99764
|
+
return this.imageRef.current;
|
|
99779
99765
|
},
|
|
99780
99766
|
setLoading: loading => {
|
|
99781
99767
|
this.setState({
|
|
@@ -99783,7 +99769,7 @@ class PreviewImage extends BaseComponent {
|
|
|
99783
99769
|
});
|
|
99784
99770
|
},
|
|
99785
99771
|
setImageCursor: canDrag => {
|
|
99786
|
-
this.imageRef.style.cursor = canDrag ? "grab" : "default";
|
|
99772
|
+
this.imageRef.current.style.cursor = canDrag ? "grab" : "default";
|
|
99787
99773
|
}
|
|
99788
99774
|
});
|
|
99789
99775
|
}
|
|
@@ -99792,52 +99778,22 @@ class PreviewImage extends BaseComponent {
|
|
|
99792
99778
|
this.onWindowResize = () => {
|
|
99793
99779
|
this.foundation.handleWindowResize();
|
|
99794
99780
|
};
|
|
99795
|
-
this.handleZoomChange = (newZoom, e) => {
|
|
99796
|
-
this.foundation.handleZoomChange(newZoom, e);
|
|
99797
|
-
};
|
|
99798
99781
|
// Determine the response method of right click according to the disableDownload parameter in props
|
|
99799
99782
|
this.handleRightClickImage = e => {
|
|
99800
99783
|
this.foundation.handleRightClickImage(e);
|
|
99801
99784
|
};
|
|
99802
|
-
this.handleWheel = e => {
|
|
99803
|
-
this.foundation.handleWheel(e);
|
|
99804
|
-
};
|
|
99805
99785
|
this.handleLoad = e => {
|
|
99806
99786
|
this.foundation.handleLoad(e);
|
|
99807
99787
|
};
|
|
99808
99788
|
this.handleError = e => {
|
|
99809
99789
|
this.foundation.handleError(e);
|
|
99810
99790
|
};
|
|
99811
|
-
this.resizeImage = () => {
|
|
99812
|
-
this.foundation.handleResizeImage();
|
|
99813
|
-
};
|
|
99814
99791
|
this.handleMoveImage = e => {
|
|
99815
99792
|
this.foundation.handleMoveImage(e);
|
|
99816
99793
|
};
|
|
99817
|
-
// 为什么通过ref注册wheel而不是使用onWheel事件?
|
|
99818
|
-
// 因为对于wheel事件,浏览器将 addEventListener 的 passive 默认值更改为 true。如此,事件监听器便不能取消事件,也不会在用户滚动页面时阻止页面呈现。
|
|
99819
|
-
// 这里我们需要保持页面不动,仅放大图片,因此此处需要将 passive 更改设置为 false。
|
|
99820
|
-
// Why register wheel via ref instead of using onWheel event?
|
|
99821
|
-
// Because for wheel events, the browser changes the passive default of addEventListener to true. This way, the event listener cannot cancel the event, nor prevent the page from rendering when the user scrolls.
|
|
99822
|
-
// Here we need to keep the page still and only zoom in on the image, so here we need to set the passive change to false.
|
|
99823
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners。
|
|
99824
|
-
this.registryImageRef = ref => {
|
|
99825
|
-
if (this.imageRef) {
|
|
99826
|
-
this.imageRef.removeEventListener("wheel", this.handleWheel);
|
|
99827
|
-
}
|
|
99828
|
-
if (ref) {
|
|
99829
|
-
ref.addEventListener("wheel", this.handleWheel, {
|
|
99830
|
-
passive: false
|
|
99831
|
-
});
|
|
99832
|
-
}
|
|
99833
|
-
this.imageRef = ref;
|
|
99834
|
-
};
|
|
99835
99794
|
this.onImageMouseDown = e => {
|
|
99836
99795
|
this.foundation.handleImageMouseDown(e);
|
|
99837
99796
|
};
|
|
99838
|
-
this.onImageMouseUp = () => {
|
|
99839
|
-
this.foundation.handleImageMouseUp();
|
|
99840
|
-
};
|
|
99841
99797
|
this.state = {
|
|
99842
99798
|
width: 0,
|
|
99843
99799
|
height: 0,
|
|
@@ -99851,7 +99807,7 @@ class PreviewImage extends BaseComponent {
|
|
|
99851
99807
|
left: 0
|
|
99852
99808
|
};
|
|
99853
99809
|
this.containerRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
|
|
99854
|
-
this.imageRef =
|
|
99810
|
+
this.imageRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
|
|
99855
99811
|
this.foundation = new PreviewImageFoundation(this.adapter);
|
|
99856
99812
|
}
|
|
99857
99813
|
componentDidMount() {
|
|
@@ -99862,27 +99818,22 @@ class PreviewImage extends BaseComponent {
|
|
|
99862
99818
|
}
|
|
99863
99819
|
componentDidUpdate(prevProps, prevStates) {
|
|
99864
99820
|
// If src changes, start a new loading
|
|
99865
|
-
|
|
99821
|
+
const zoomChange = "zoom" in this.props && this.props.zoom !== this.state.currZoom;
|
|
99822
|
+
const srcChange = this.props.src && this.props.src !== prevProps.src;
|
|
99823
|
+
if (srcChange) {
|
|
99866
99824
|
this.foundation.setLoading(true);
|
|
99867
99825
|
}
|
|
99868
99826
|
// If the incoming zoom changes, other content changes are determined based on the new zoom value
|
|
99869
|
-
if (
|
|
99870
|
-
this.
|
|
99871
|
-
}
|
|
99872
|
-
// When the incoming ratio is changed, if it"s adaptation, then resizeImage is triggered to make the image adapt to the page
|
|
99873
|
-
// else if it"s adaptation is realSize, then onZoom(1) is called to make the image size the original size;
|
|
99874
|
-
if ("ratio" in this.props && this.props.ratio !== prevProps.ratio) {
|
|
99875
|
-
if (originImageWidth && originImageHeight) {
|
|
99876
|
-
if (this.props.ratio === "adaptation") {
|
|
99877
|
-
this.resizeImage();
|
|
99878
|
-
} else {
|
|
99879
|
-
this.props.onZoom(1);
|
|
99880
|
-
}
|
|
99881
|
-
}
|
|
99827
|
+
if (zoomChange) {
|
|
99828
|
+
this.foundation.calculatePreviewImage(this.props.zoom, null);
|
|
99882
99829
|
}
|
|
99883
|
-
|
|
99884
|
-
|
|
99885
|
-
|
|
99830
|
+
if (!zoomChange && !srcChange && prevProps) {
|
|
99831
|
+
if ("ratio" in this.props && this.props.ratio !== prevProps.ratio) {
|
|
99832
|
+
this.foundation.handleRatioChange();
|
|
99833
|
+
}
|
|
99834
|
+
if ("rotation" in this.props && this.props.rotation !== prevProps.rotation) {
|
|
99835
|
+
this.onWindowResize();
|
|
99836
|
+
}
|
|
99886
99837
|
}
|
|
99887
99838
|
}
|
|
99888
99839
|
render() {
|
|
@@ -99904,21 +99855,20 @@ class PreviewImage extends BaseComponent {
|
|
|
99904
99855
|
transform: `rotate(${-rotation}deg)`,
|
|
99905
99856
|
top,
|
|
99906
99857
|
left,
|
|
99907
|
-
width
|
|
99908
|
-
height
|
|
99858
|
+
width,
|
|
99859
|
+
height
|
|
99909
99860
|
};
|
|
99910
99861
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
99911
99862
|
className: `${preViewImgPrefixCls}`,
|
|
99912
99863
|
ref: this.containerRef
|
|
99913
99864
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("img", {
|
|
99914
|
-
ref: this.
|
|
99865
|
+
ref: this.imageRef,
|
|
99915
99866
|
src: src,
|
|
99916
99867
|
alt: "previewImag",
|
|
99917
99868
|
className: `${preViewImgPrefixCls}-img`,
|
|
99918
99869
|
key: src,
|
|
99919
99870
|
onMouseMove: this.handleMoveImage,
|
|
99920
99871
|
onMouseDown: this.onImageMouseDown,
|
|
99921
|
-
onMouseUp: this.onImageMouseUp,
|
|
99922
99872
|
onContextMenu: this.handleRightClickImage,
|
|
99923
99873
|
onDragStart: e => e.preventDefault(),
|
|
99924
99874
|
onLoad: this.handleLoad,
|
|
@@ -99935,9 +99885,9 @@ PreviewImage.propTypes = {
|
|
|
99935
99885
|
src: (prop_types_default()).string,
|
|
99936
99886
|
rotation: (prop_types_default()).number,
|
|
99937
99887
|
style: (prop_types_default()).object,
|
|
99938
|
-
maxZoom:
|
|
99939
|
-
minZoom:
|
|
99940
|
-
zoomStep:
|
|
99888
|
+
// maxZoom: PropTypes.number,
|
|
99889
|
+
// minZoom: PropTypes.number,
|
|
99890
|
+
// zoomStep: PropTypes.number,
|
|
99941
99891
|
zoom: (prop_types_default()).number,
|
|
99942
99892
|
ratio: (prop_types_default()).string,
|
|
99943
99893
|
disableDownload: (prop_types_default()).bool,
|
|
@@ -99948,9 +99898,9 @@ PreviewImage.propTypes = {
|
|
|
99948
99898
|
onError: (prop_types_default()).func
|
|
99949
99899
|
};
|
|
99950
99900
|
PreviewImage.defaultProps = {
|
|
99951
|
-
maxZoom: 5,
|
|
99952
|
-
minZoom: 0.1,
|
|
99953
|
-
zoomStep: 0.1,
|
|
99901
|
+
// maxZoom: 5,
|
|
99902
|
+
// minZoom: 0.1,
|
|
99903
|
+
// zoomStep: 0.1,
|
|
99954
99904
|
zoom: undefined
|
|
99955
99905
|
};
|
|
99956
99906
|
;// CONCATENATED MODULE: ../semi-foundation/image/utils.ts
|
|
@@ -100045,40 +99995,91 @@ const getPreloadImagArr = (imgSrc, currentIndex, preLoadGap, infinite) => {
|
|
|
100045
99995
|
|
|
100046
99996
|
|
|
100047
99997
|
|
|
99998
|
+
|
|
99999
|
+
|
|
100000
|
+
|
|
100048
100001
|
const NOT_CLOSE_TARGETS = ["icon", "footer"];
|
|
100049
|
-
const STOP_CLOSE_TARGET = ["icon", "footer", "header"];
|
|
100002
|
+
const STOP_CLOSE_TARGET = (/* unused pure expression or super */ null && (["icon", "footer", "header"]));
|
|
100050
100003
|
class PreviewInnerFoundation extends foundation {
|
|
100051
100004
|
constructor(adapter) {
|
|
100052
100005
|
super(Object.assign({}, adapter));
|
|
100006
|
+
this._timer = null;
|
|
100007
|
+
this._startMouseDown = {
|
|
100008
|
+
x: 0,
|
|
100009
|
+
y: 0
|
|
100010
|
+
};
|
|
100053
100011
|
this.handleViewVisibleChange = () => {
|
|
100054
|
-
const nowTime = new Date().getTime();
|
|
100055
|
-
const mouseActiveTime = this._adapter.getMouseActiveTime();
|
|
100056
|
-
const stopTiming = this._adapter.getStopTiming();
|
|
100057
|
-
const {
|
|
100058
|
-
viewerVisibleDelay
|
|
100059
|
-
} = this.getProps();
|
|
100060
100012
|
const {
|
|
100061
100013
|
viewerVisible
|
|
100062
100014
|
} = this.getStates();
|
|
100063
|
-
if (
|
|
100064
|
-
|
|
100015
|
+
if (viewerVisible) {
|
|
100016
|
+
this.setState({
|
|
100065
100017
|
viewerVisible: false
|
|
100066
100018
|
});
|
|
100019
|
+
this.clearTimer();
|
|
100020
|
+
}
|
|
100021
|
+
};
|
|
100022
|
+
this.handleMouseMove = e => {
|
|
100023
|
+
this._persistEvent(e);
|
|
100024
|
+
this.mouseMoveHandler(e);
|
|
100025
|
+
};
|
|
100026
|
+
this.mouseMoveHandler = throttle_default()(e => {
|
|
100027
|
+
const {
|
|
100028
|
+
viewerVisible
|
|
100029
|
+
} = this.getStates();
|
|
100030
|
+
const isValidTarget = this._adapter.isValidTarget(e);
|
|
100031
|
+
if (isValidTarget) {
|
|
100032
|
+
if (!viewerVisible) {
|
|
100033
|
+
this.setState({
|
|
100034
|
+
viewerVisible: true
|
|
100035
|
+
});
|
|
100036
|
+
}
|
|
100037
|
+
this.updateTimer();
|
|
100038
|
+
} else {
|
|
100039
|
+
this.clearTimer();
|
|
100067
100040
|
}
|
|
100041
|
+
}, 50);
|
|
100042
|
+
this.updateTimer = () => {
|
|
100043
|
+
const {
|
|
100044
|
+
viewerVisibleDelay
|
|
100045
|
+
} = this.getProps();
|
|
100046
|
+
this.clearTimer();
|
|
100047
|
+
this._timer = setTimeout(this.handleViewVisibleChange, viewerVisibleDelay);
|
|
100068
100048
|
};
|
|
100069
|
-
this.
|
|
100070
|
-
|
|
100071
|
-
|
|
100072
|
-
this.
|
|
100073
|
-
} else if (isTarget && event === "out") {
|
|
100074
|
-
this._adapter.setStopTiming(false);
|
|
100049
|
+
this.clearTimer = () => {
|
|
100050
|
+
if (this._timer) {
|
|
100051
|
+
clearTimeout(this._timer);
|
|
100052
|
+
this._timer = null;
|
|
100075
100053
|
}
|
|
100076
100054
|
};
|
|
100077
|
-
this.
|
|
100078
|
-
this.
|
|
100079
|
-
|
|
100080
|
-
|
|
100081
|
-
|
|
100055
|
+
this.handleWheel = e => {
|
|
100056
|
+
this.onWheel(e);
|
|
100057
|
+
handlePrevent(e);
|
|
100058
|
+
};
|
|
100059
|
+
this.onWheel = e => {
|
|
100060
|
+
const {
|
|
100061
|
+
zoomStep,
|
|
100062
|
+
maxZoom,
|
|
100063
|
+
minZoom
|
|
100064
|
+
} = this.getProps();
|
|
100065
|
+
const {
|
|
100066
|
+
zoom: currZoom
|
|
100067
|
+
} = this.getStates();
|
|
100068
|
+
let _zoom;
|
|
100069
|
+
if (e.deltaY < 0) {
|
|
100070
|
+
/* zoom in */
|
|
100071
|
+
if (currZoom + zoomStep <= maxZoom) {
|
|
100072
|
+
_zoom = Number((currZoom + zoomStep).toFixed(2));
|
|
100073
|
+
}
|
|
100074
|
+
} else if (e.deltaY > 0) {
|
|
100075
|
+
/* zoom out */
|
|
100076
|
+
if (currZoom - zoomStep >= minZoom) {
|
|
100077
|
+
_zoom = Number((currZoom - zoomStep).toFixed(2));
|
|
100078
|
+
}
|
|
100079
|
+
}
|
|
100080
|
+
if (!isUndefined_default()(_zoom)) {
|
|
100081
|
+
this.handleZoomImage(_zoom);
|
|
100082
|
+
}
|
|
100082
100083
|
};
|
|
100083
100084
|
this.handleMouseUp = e => {
|
|
100084
100085
|
const {
|
|
@@ -100092,7 +100093,7 @@ class PreviewInnerFoundation extends foundation {
|
|
|
100092
100093
|
const {
|
|
100093
100094
|
x,
|
|
100094
100095
|
y
|
|
100095
|
-
} = this.
|
|
100096
|
+
} = this._startMouseDown;
|
|
100096
100097
|
// 对鼠标移动做容错处理,当 x 和 y 方向在 mouseUp 的时候移动距离都小于等于 5px 时候就可以关闭预览
|
|
100097
100098
|
// Error-tolerant processing of mouse movement, when the movement distance in the x and y directions is less than or equal to 5px in mouseUp, the preview can be closed
|
|
100098
100099
|
// 不做容错处理的话,直接用 clientX !== x || y !== clientY 做判断,鼠标在用户点击时候无意识的轻微移动无法关闭预览,不符合用户预期
|
|
@@ -100109,7 +100110,10 @@ class PreviewInnerFoundation extends foundation {
|
|
|
100109
100110
|
clientX,
|
|
100110
100111
|
clientY
|
|
100111
100112
|
} = e;
|
|
100112
|
-
this.
|
|
100113
|
+
this._startMouseDown = {
|
|
100114
|
+
x: clientX,
|
|
100115
|
+
y: clientY
|
|
100116
|
+
};
|
|
100113
100117
|
};
|
|
100114
100118
|
this.handleKeyDown = e => {
|
|
100115
100119
|
const {
|
|
@@ -100182,10 +100186,12 @@ class PreviewInnerFoundation extends foundation {
|
|
|
100182
100186
|
const {
|
|
100183
100187
|
zoom
|
|
100184
100188
|
} = this.getStates();
|
|
100185
|
-
|
|
100186
|
-
|
|
100187
|
-
|
|
100188
|
-
|
|
100189
|
+
if (zoom !== newZoom) {
|
|
100190
|
+
this._adapter.notifyZoom(newZoom, newZoom > zoom);
|
|
100191
|
+
this.setState({
|
|
100192
|
+
zoom: newZoom
|
|
100193
|
+
});
|
|
100194
|
+
}
|
|
100189
100195
|
};
|
|
100190
100196
|
// 当 visible 改变之后,预览组件完成首张图片加载后,启动预加载
|
|
100191
100197
|
// 如: 1,2,3,4,5,6,7,8张图片, 点击第 4 张图片,preLoadGap 为 2
|
|
@@ -100303,10 +100309,12 @@ class PreviewInnerFoundation extends foundation {
|
|
|
100303
100309
|
beforeShow() {
|
|
100304
100310
|
this._adapter.registerKeyDownListener();
|
|
100305
100311
|
this._adapter.disabledBodyScroll();
|
|
100312
|
+
this.updateTimer();
|
|
100306
100313
|
}
|
|
100307
100314
|
afterHide() {
|
|
100308
100315
|
this._adapter.unregisterKeyDownListener();
|
|
100309
100316
|
this._adapter.enabledBodyScroll();
|
|
100317
|
+
this.clearTimer();
|
|
100310
100318
|
}
|
|
100311
100319
|
}
|
|
100312
100320
|
;// CONCATENATED MODULE: ./image/previewInner.tsx
|
|
@@ -100326,14 +100334,6 @@ class PreviewInnerFoundation extends foundation {
|
|
|
100326
100334
|
|
|
100327
100335
|
|
|
100328
100336
|
const previewInner_prefixCls = image_constants_cssClasses.PREFIX;
|
|
100329
|
-
let startMouseDown = {
|
|
100330
|
-
x: 0,
|
|
100331
|
-
y: 0
|
|
100332
|
-
};
|
|
100333
|
-
let previewInner_mouseActiveTime = null;
|
|
100334
|
-
let stopTiming = false;
|
|
100335
|
-
let timer = null;
|
|
100336
|
-
// let bodyOverflowValue = document.body.style.overflow;
|
|
100337
100337
|
class PreviewInner extends BaseComponent {
|
|
100338
100338
|
get adapter() {
|
|
100339
100339
|
return Object.assign(Object.assign({}, super.adapter), {
|
|
@@ -100417,30 +100417,22 @@ class PreviewInner extends BaseComponent {
|
|
|
100417
100417
|
unregisterKeyDownListener: () => {
|
|
100418
100418
|
window && window.removeEventListener("keydown", this.handleKeyDown);
|
|
100419
100419
|
},
|
|
100420
|
-
getMouseActiveTime: () => {
|
|
100421
|
-
return previewInner_mouseActiveTime;
|
|
100422
|
-
},
|
|
100423
|
-
getStopTiming: () => {
|
|
100424
|
-
return stopTiming;
|
|
100425
|
-
},
|
|
100426
|
-
setStopTiming: value => {
|
|
100427
|
-
stopTiming = value;
|
|
100428
|
-
},
|
|
100429
|
-
getStartMouseDown: () => {
|
|
100430
|
-
return startMouseDown;
|
|
100431
|
-
},
|
|
100432
|
-
setStartMouseDown: (x, y) => {
|
|
100433
|
-
startMouseDown = {
|
|
100434
|
-
x,
|
|
100435
|
-
y
|
|
100436
|
-
};
|
|
100437
|
-
},
|
|
100438
|
-
setMouseActiveTime: time => {
|
|
100439
|
-
previewInner_mouseActiveTime = time;
|
|
100440
|
-
},
|
|
100441
100420
|
getSetDownloadFunc: () => {
|
|
100442
100421
|
var _a, _b;
|
|
100443
100422
|
return (_b = (_a = this.context) === null || _a === void 0 ? void 0 : _a.setDownloadName) !== null && _b !== void 0 ? _b : this.props.setDownloadName;
|
|
100423
|
+
},
|
|
100424
|
+
isValidTarget: e => {
|
|
100425
|
+
const headerDom = this.headerRef && this.headerRef.current;
|
|
100426
|
+
const footerDom = this.footerRef && this.footerRef.current;
|
|
100427
|
+
const leftIconDom = this.leftIconRef && this.leftIconRef.current;
|
|
100428
|
+
const rightIconDom = this.rightIconRef && this.rightIconRef.current;
|
|
100429
|
+
const target = e.target;
|
|
100430
|
+
if (headerDom && headerDom.contains(target) || footerDom && footerDom.contains(target) || leftIconDom && leftIconDom.contains(target) || rightIconDom && rightIconDom.contains(target)) {
|
|
100431
|
+
// Move in the operation area, return false
|
|
100432
|
+
return false;
|
|
100433
|
+
}
|
|
100434
|
+
// Move in the preview area except the operation area, return true
|
|
100435
|
+
return true;
|
|
100444
100436
|
}
|
|
100445
100437
|
});
|
|
100446
100438
|
}
|
|
@@ -100473,9 +100465,6 @@ class PreviewInner extends BaseComponent {
|
|
|
100473
100465
|
this.handleMouseMove = e => {
|
|
100474
100466
|
this.foundation.handleMouseMove(e);
|
|
100475
100467
|
};
|
|
100476
|
-
this.handleMouseEvent = (e, event) => {
|
|
100477
|
-
this.foundation.handleMouseMoveEvent(e, event);
|
|
100478
|
-
};
|
|
100479
100468
|
this.handleKeyDown = e => {
|
|
100480
100469
|
this.foundation.handleKeyDown(e);
|
|
100481
100470
|
};
|
|
@@ -100488,6 +100477,31 @@ class PreviewInner extends BaseComponent {
|
|
|
100488
100477
|
this.handleMouseDown = e => {
|
|
100489
100478
|
this.foundation.handleMouseDown(e);
|
|
100490
100479
|
};
|
|
100480
|
+
this.handleWheel = e => {
|
|
100481
|
+
this.foundation.handleWheel(e);
|
|
100482
|
+
};
|
|
100483
|
+
// 为什么通过 addEventListener 注册 wheel 事件而不是使用 onWheel 事件?
|
|
100484
|
+
// 因为 Passive Event Listeners(https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners)
|
|
100485
|
+
// Passive Event Listeners 是一种优化技术,用于提高滚动性能。在默认情况下,浏览器会假设事件的监听器不会调用
|
|
100486
|
+
// preventDefault() 方法来阻止事件的默认行为,从而允许进行一些优化操作,例如滚动平滑。
|
|
100487
|
+
// 对于 Image 而言,如果使用触控板,双指朝不同方向分开放大图片,则需要 preventDefault 防止页面整体放大。
|
|
100488
|
+
// Why register wheel event through addEventListener instead of using onWheel event?
|
|
100489
|
+
// Because of Passive Event Listeners(an optimization technique used to improve scrolling performance. By default,
|
|
100490
|
+
// the browser will assume that event listeners will not call preventDefault() method to prevent the default behavior of the event,
|
|
100491
|
+
// allowing some optimization operations such as scroll smoothing.)
|
|
100492
|
+
// For Image, if we use the trackpad and spread your fingers in different directions to enlarge the image, we need to preventDefault
|
|
100493
|
+
// to prevent the page from being enlarged as a whole.
|
|
100494
|
+
this.registryImageWrapRef = ref => {
|
|
100495
|
+
if (this.imageWrapRef) {
|
|
100496
|
+
this.imageWrapRef.removeEventListener("wheel", this.handleWheel);
|
|
100497
|
+
}
|
|
100498
|
+
if (ref) {
|
|
100499
|
+
ref.addEventListener("wheel", this.handleWheel, {
|
|
100500
|
+
passive: false
|
|
100501
|
+
});
|
|
100502
|
+
}
|
|
100503
|
+
this.imageWrapRef = ref;
|
|
100504
|
+
};
|
|
100491
100505
|
this.state = {
|
|
100492
100506
|
imgSrc: [],
|
|
100493
100507
|
imgLoadStatus: new Map(),
|
|
@@ -100504,6 +100518,11 @@ class PreviewInner extends BaseComponent {
|
|
|
100504
100518
|
this.bodyOverflow = '';
|
|
100505
100519
|
this.originBodyWidth = '100%';
|
|
100506
100520
|
this.scrollBarWidth = 0;
|
|
100521
|
+
this.imageWrapRef = null;
|
|
100522
|
+
this.headerRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
|
|
100523
|
+
this.footerRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
|
|
100524
|
+
this.leftIconRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
|
|
100525
|
+
this.rightIconRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
|
|
100507
100526
|
}
|
|
100508
100527
|
static getDerivedStateFromProps(props, state) {
|
|
100509
100528
|
const willUpdateStates = {};
|
|
@@ -100519,6 +100538,9 @@ class PreviewInner extends BaseComponent {
|
|
|
100519
100538
|
willUpdateStates.visible = props.visible;
|
|
100520
100539
|
if (props.visible) {
|
|
100521
100540
|
willUpdateStates.preloadAfterVisibleChange = true;
|
|
100541
|
+
willUpdateStates.viewerVisible = true;
|
|
100542
|
+
willUpdateStates.rotation = 0;
|
|
100543
|
+
willUpdateStates.ratio = 'adaptation';
|
|
100522
100544
|
}
|
|
100523
100545
|
}
|
|
100524
100546
|
if ("currentIndex" in props && props.currentIndex !== state.currentIndex) {
|
|
@@ -100537,10 +100559,8 @@ class PreviewInner extends BaseComponent {
|
|
|
100537
100559
|
}
|
|
100538
100560
|
}
|
|
100539
100561
|
componentDidUpdate(prevProps, prevState) {
|
|
100540
|
-
if (
|
|
100541
|
-
|
|
100542
|
-
timer && clearInterval(timer);
|
|
100543
|
-
timer = setInterval(this.viewVisibleChange, 1000);
|
|
100562
|
+
if (prevProps.src !== this.props.src) {
|
|
100563
|
+
this.foundation.updateTimer();
|
|
100544
100564
|
}
|
|
100545
100565
|
// hide => show
|
|
100546
100566
|
if (!prevProps.visible && this.props.visible) {
|
|
@@ -100552,7 +100572,7 @@ class PreviewInner extends BaseComponent {
|
|
|
100552
100572
|
}
|
|
100553
100573
|
}
|
|
100554
100574
|
componentWillUnmount() {
|
|
100555
|
-
|
|
100575
|
+
this.foundation.clearTimer();
|
|
100556
100576
|
}
|
|
100557
100577
|
isInGroup() {
|
|
100558
100578
|
return Boolean(this.context && this.context.isGroup);
|
|
@@ -100617,10 +100637,10 @@ class PreviewInner extends BaseComponent {
|
|
|
100617
100637
|
style: style,
|
|
100618
100638
|
onMouseDown: this.handleMouseDown,
|
|
100619
100639
|
onMouseUp: this.handleMouseUp,
|
|
100620
|
-
|
|
100621
|
-
|
|
100622
|
-
onMouseOut: e => this.handleMouseEvent(e.nativeEvent, "out")
|
|
100640
|
+
ref: this.registryImageWrapRef,
|
|
100641
|
+
onMouseMove: this.handleMouseMove
|
|
100623
100642
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(previewHeader, {
|
|
100643
|
+
ref: this.headerRef,
|
|
100624
100644
|
className: classnames_default()(hideViewerCls),
|
|
100625
100645
|
onClose: this.handlePreviewClose,
|
|
100626
100646
|
renderHeader: renderHeader
|
|
@@ -100631,7 +100651,6 @@ class PreviewInner extends BaseComponent {
|
|
|
100631
100651
|
setRatio: this.handleAdjustRatio,
|
|
100632
100652
|
zoom: zoom,
|
|
100633
100653
|
ratio: ratio,
|
|
100634
|
-
zoomStep: zoomStep,
|
|
100635
100654
|
rotation: rotation,
|
|
100636
100655
|
crossOrigin: crossOrigin,
|
|
100637
100656
|
onError: this.onImageError,
|
|
@@ -100640,6 +100659,7 @@ class PreviewInner extends BaseComponent {
|
|
|
100640
100659
|
/*#__PURE__*/
|
|
100641
100660
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
100642
100661
|
external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
100662
|
+
ref: this.leftIconRef,
|
|
100643
100663
|
className: classnames_default()(`${previewPrefixCls}-icon`, `${previewPrefixCls}-prev`, hideViewerCls),
|
|
100644
100664
|
onClick: () => this.handleSwitchImage("prev")
|
|
100645
100665
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(IconArrowLeft, {
|
|
@@ -100648,11 +100668,13 @@ class PreviewInner extends BaseComponent {
|
|
|
100648
100668
|
/*#__PURE__*/
|
|
100649
100669
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
100650
100670
|
external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
100671
|
+
ref: this.rightIconRef,
|
|
100651
100672
|
className: classnames_default()(`${previewPrefixCls}-icon`, `${previewPrefixCls}-next`, hideViewerCls),
|
|
100652
100673
|
onClick: () => this.handleSwitchImage("next")
|
|
100653
100674
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(IconArrowRight, {
|
|
100654
100675
|
size: "large"
|
|
100655
100676
|
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(previewFooter_Footer, {
|
|
100677
|
+
forwardRef: this.footerRef,
|
|
100656
100678
|
className: hideViewerCls,
|
|
100657
100679
|
totalNum: total,
|
|
100658
100680
|
curPage: currentIndex + 1,
|
|
@@ -100710,6 +100732,8 @@ PreviewInner.propTypes = {
|
|
|
100710
100732
|
disableDownload: (prop_types_default()).bool,
|
|
100711
100733
|
viewerVisibleDelay: (prop_types_default()).number,
|
|
100712
100734
|
zIndex: (prop_types_default()).number,
|
|
100735
|
+
maxZoom: (prop_types_default()).number,
|
|
100736
|
+
minZoom: (prop_types_default()).number,
|
|
100713
100737
|
renderHeader: (prop_types_default()).func,
|
|
100714
100738
|
renderPreviewMenu: (prop_types_default()).func,
|
|
100715
100739
|
getPopupContainer: (prop_types_default()).func,
|
|
@@ -100734,7 +100758,9 @@ PreviewInner.defaultProps = {
|
|
|
100734
100758
|
preLoadGap: 2,
|
|
100735
100759
|
zIndex: 1000,
|
|
100736
100760
|
maskClosable: true,
|
|
100737
|
-
viewerVisibleDelay: 10000
|
|
100761
|
+
viewerVisibleDelay: 10000,
|
|
100762
|
+
maxZoom: 5,
|
|
100763
|
+
minZoom: 0.1
|
|
100738
100764
|
};
|
|
100739
100765
|
;// CONCATENATED MODULE: ../semi-foundation/image/imageFoundation.ts
|
|
100740
100766
|
|