shineout 3.1.14 → 3.1.16
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/cjs/form/form-field.d.ts +1 -1
- package/cjs/form/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/upload/use-upload-common.d.ts +1 -1
- package/dist/shineout.js +263 -142
- package/dist/shineout.js.map +1 -1
- package/dist/shineout.min.js +1 -1
- package/dist/shineout.min.js.map +1 -1
- package/esm/form/form-field.d.ts +1 -1
- package/esm/form/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/upload/use-upload-common.d.ts +1 -1
- package/package.json +5 -5
package/dist/shineout.js
CHANGED
|
@@ -11949,7 +11949,7 @@ var handleStyle = function handleStyle(style) {
|
|
|
11949
11949
|
};
|
|
11950
11950
|
/* harmony default export */ var jss_style_handleStyle = (handleStyle);
|
|
11951
11951
|
;// CONCATENATED MODULE: ../shineout-style/src/version.ts
|
|
11952
|
-
/* harmony default export */ var version = ('3.1.
|
|
11952
|
+
/* harmony default export */ var version = ('3.1.16');
|
|
11953
11953
|
;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
|
|
11954
11954
|
|
|
11955
11955
|
|
|
@@ -15504,7 +15504,9 @@ var cardStyle = {
|
|
|
15504
15504
|
headerContent: objectSpread2_default()(objectSpread2_default()({}, headerCommon), {}, {
|
|
15505
15505
|
flex: 1
|
|
15506
15506
|
}),
|
|
15507
|
-
simpleHeader: objectSpread2_default()({}, headerCommon),
|
|
15507
|
+
simpleHeader: objectSpread2_default()(objectSpread2_default()({}, headerCommon), {}, {
|
|
15508
|
+
display: 'block'
|
|
15509
|
+
}),
|
|
15508
15510
|
center: {
|
|
15509
15511
|
textAlign: 'center'
|
|
15510
15512
|
},
|
|
@@ -23454,10 +23456,10 @@ var tableStyle = objectSpread2_default()(objectSpread2_default()({}, globalStyle
|
|
|
23454
23456
|
background: src.tableCellBorderColor,
|
|
23455
23457
|
borderLeft: "1px solid ".concat(src.tableCellBorderColor)
|
|
23456
23458
|
},
|
|
23457
|
-
'
|
|
23459
|
+
'[dir=ltr]&::after': {
|
|
23458
23460
|
right: 0
|
|
23459
23461
|
},
|
|
23460
|
-
'
|
|
23462
|
+
'[dir=rtl]&::after': {
|
|
23461
23463
|
left: 0
|
|
23462
23464
|
}
|
|
23463
23465
|
}
|
|
@@ -30164,6 +30166,7 @@ var card_jssStyle = {
|
|
|
30164
30166
|
|
|
30165
30167
|
|
|
30166
30168
|
|
|
30169
|
+
|
|
30167
30170
|
var CardHeader = function CardHeader(props) {
|
|
30168
30171
|
var _props$jssStyle, _props$jssStyle$card;
|
|
30169
30172
|
var align = props.align;
|
|
@@ -30184,19 +30187,24 @@ var CardHeader = function CardHeader(props) {
|
|
|
30184
30187
|
})
|
|
30185
30188
|
});
|
|
30186
30189
|
};
|
|
30187
|
-
var
|
|
30190
|
+
var alignClass = classnames_default()(align === 'center' && (cardClasses === null || cardClasses === void 0 ? void 0 : cardClasses.center), align === 'right' && (cardClasses === null || cardClasses === void 0 ? void 0 : cardClasses.right));
|
|
30191
|
+
var headerContentClassName = classnames_default()(cardClasses === null || cardClasses === void 0 ? void 0 : cardClasses.headerContent, alignClass);
|
|
30192
|
+
var commonHeaderProps = {
|
|
30193
|
+
onMouseDown: handleDragMouseDown,
|
|
30194
|
+
onClick: onCollapse,
|
|
30195
|
+
style: props.style
|
|
30196
|
+
};
|
|
30188
30197
|
if (!props.extra && !collapsible) {
|
|
30189
|
-
|
|
30190
|
-
|
|
30191
|
-
|
|
30198
|
+
var simpleHeaderClassName = classnames_default()(cardClasses === null || cardClasses === void 0 ? void 0 : cardClasses.header, cardClasses === null || cardClasses === void 0 ? void 0 : cardClasses.simpleHeader, alignClass, props.className);
|
|
30199
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", objectSpread2_default()(objectSpread2_default()({
|
|
30200
|
+
className: simpleHeaderClassName
|
|
30201
|
+
}, commonHeaderProps), {}, {
|
|
30192
30202
|
children: props.children
|
|
30193
|
-
});
|
|
30203
|
+
}));
|
|
30194
30204
|
}
|
|
30195
|
-
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
30196
|
-
|
|
30197
|
-
|
|
30198
|
-
className: classnames_default()(props.className, cardClasses === null || cardClasses === void 0 ? void 0 : cardClasses.header),
|
|
30199
|
-
style: props.style,
|
|
30205
|
+
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", objectSpread2_default()(objectSpread2_default()({
|
|
30206
|
+
className: classnames_default()(props.className, cardClasses === null || cardClasses === void 0 ? void 0 : cardClasses.header)
|
|
30207
|
+
}, commonHeaderProps), {}, {
|
|
30200
30208
|
children: [renderIndicator(), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
30201
30209
|
className: headerContentClassName,
|
|
30202
30210
|
children: props.children
|
|
@@ -30204,7 +30212,7 @@ var CardHeader = function CardHeader(props) {
|
|
|
30204
30212
|
className: cardClasses === null || cardClasses === void 0 ? void 0 : cardClasses.headerExtra,
|
|
30205
30213
|
children: props.extra
|
|
30206
30214
|
})]
|
|
30207
|
-
});
|
|
30215
|
+
}));
|
|
30208
30216
|
};
|
|
30209
30217
|
/* harmony default export */ var card_header = (CardHeader);
|
|
30210
30218
|
;// CONCATENATED MODULE: ./src/card/header.tsx
|
|
@@ -35997,8 +36005,8 @@ var result_Result = function Result(props) {
|
|
|
35997
36005
|
var handleResetMore = function handleResetMore() {
|
|
35998
36006
|
if (!compressed) return;
|
|
35999
36007
|
if (isCompressedBound()) return;
|
|
36000
|
-
setMore(-1);
|
|
36001
36008
|
setShouldResetMore(true);
|
|
36009
|
+
setMore(-1);
|
|
36002
36010
|
};
|
|
36003
36011
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
36004
36012
|
if (!focus && mounted.current) {
|
|
@@ -36009,11 +36017,11 @@ var result_Result = function Result(props) {
|
|
|
36009
36017
|
}
|
|
36010
36018
|
mounted.current = true;
|
|
36011
36019
|
}, [focus]);
|
|
36012
|
-
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.
|
|
36020
|
+
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
|
|
36013
36021
|
setTimeout(handleResetMore);
|
|
36014
36022
|
}, [valueProp, data]);
|
|
36015
|
-
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.
|
|
36016
|
-
if (shouldResetMore && more === -1 && compressed && resultRef.current && (props.value || [].length)
|
|
36023
|
+
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
|
|
36024
|
+
if (shouldResetMore && more === -1 && compressed && resultRef.current && (props.value || []).length) {
|
|
36017
36025
|
var tagClassName = ".".concat(styles.tag.split(' ')[0]);
|
|
36018
36026
|
if (shouldResetMore && result_isArray(value) && (value || []).length) {
|
|
36019
36027
|
var newMore = getResetMore(showInput, resultRef.current, resultRef.current.querySelectorAll(tagClassName));
|
|
@@ -46207,7 +46215,9 @@ var input_input_Input = function Input(props) {
|
|
|
46207
46215
|
});
|
|
46208
46216
|
var _useWithFormConfig = use_with_form_config(props),
|
|
46209
46217
|
size = _useWithFormConfig.size,
|
|
46210
|
-
disabled = _useWithFormConfig.disabled
|
|
46218
|
+
disabled = _useWithFormConfig.disabled,
|
|
46219
|
+
status = _useWithFormConfig.status,
|
|
46220
|
+
error = _useWithFormConfig.error;
|
|
46211
46221
|
var getProps = function getProps(child) {
|
|
46212
46222
|
ref.current.propsMap.set(child, {
|
|
46213
46223
|
onFocus: child.props.onFocus,
|
|
@@ -46239,7 +46249,7 @@ var input_input_Input = function Input(props) {
|
|
|
46239
46249
|
className = props.className,
|
|
46240
46250
|
width = props.width,
|
|
46241
46251
|
style = props.style;
|
|
46242
|
-
var rootClass = classnames_default()(className, inputStyle === null || inputStyle === void 0 ? void 0 : inputStyle.group, size === 'small' && (inputStyle === null || inputStyle === void 0 ? void 0 : inputStyle.groupSmall), size === 'large' && (inputStyle === null || inputStyle === void 0 ? void 0 : inputStyle.groupLarge), !!disabled && (inputStyle === null || inputStyle === void 0 ? void 0 : inputStyle.groupDisabled), !!focus && (inputStyle === null || inputStyle === void 0 ? void 0 : inputStyle.groupFocus));
|
|
46252
|
+
var rootClass = classnames_default()(className, inputStyle === null || inputStyle === void 0 ? void 0 : inputStyle.group, size === 'small' && (inputStyle === null || inputStyle === void 0 ? void 0 : inputStyle.groupSmall), size === 'large' && (inputStyle === null || inputStyle === void 0 ? void 0 : inputStyle.groupLarge), !!disabled && (inputStyle === null || inputStyle === void 0 ? void 0 : inputStyle.groupDisabled), !!focus && (inputStyle === null || inputStyle === void 0 ? void 0 : inputStyle.groupFocus), (status === 'error' || error) && (inputStyle === null || inputStyle === void 0 ? void 0 : inputStyle.groupError));
|
|
46243
46253
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", objectSpread2_default()(objectSpread2_default()({}, getDataAttribute({
|
|
46244
46254
|
role: 'input-group'
|
|
46245
46255
|
})), {}, {
|
|
@@ -46722,7 +46732,7 @@ var Scroll = function Scroll(props) {
|
|
|
46722
46732
|
position: 'sticky'
|
|
46723
46733
|
}, isRtl ? 'right' : 'left', 0), "top", 0);
|
|
46724
46734
|
var placeStyle = defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()({
|
|
46725
|
-
marginTop: Math.max(0, Math.floor(scrollHeight - height))
|
|
46735
|
+
marginTop: height > 0 && scrollHeight > 0 ? Math.max(0, Math.floor(scrollHeight - height)) : 0
|
|
46726
46736
|
}, "margin".concat(isRtl ? 'Left' : 'Right'), scrollWidth), "height", 0), "width", 0), "overflow", 'hidden');
|
|
46727
46737
|
var handleScroll = usePersistFn(function (e) {
|
|
46728
46738
|
var target = e.currentTarget;
|
|
@@ -48931,16 +48941,6 @@ function Select(props0) {
|
|
|
48931
48941
|
}),
|
|
48932
48942
|
groupData = _useGroup.data,
|
|
48933
48943
|
groupKey = _useGroup.groupKey;
|
|
48934
|
-
|
|
48935
|
-
// const triggerOpen = usePersistFn(() => {
|
|
48936
|
-
// if (disabled === true) return;
|
|
48937
|
-
// if (open) {
|
|
48938
|
-
// closePop();
|
|
48939
|
-
// } else {
|
|
48940
|
-
// openPop();
|
|
48941
|
-
// }
|
|
48942
|
-
// });
|
|
48943
|
-
|
|
48944
48944
|
var focusAndOpen = function focusAndOpen() {
|
|
48945
48945
|
if (!focused) {
|
|
48946
48946
|
var _inputRef$current2;
|
|
@@ -49347,7 +49347,7 @@ function Select(props0) {
|
|
|
49347
49347
|
children: [tipNode, renderResult(), /*#__PURE__*/(0,jsx_runtime.jsx)(absolute_list, {
|
|
49348
49348
|
adjust: true,
|
|
49349
49349
|
focus: open,
|
|
49350
|
-
fixedWidth: autoAdapt ? 'min' : true,
|
|
49350
|
+
fixedWidth: !props.columns && (autoAdapt ? 'min' : true),
|
|
49351
49351
|
absolute: props.absolute,
|
|
49352
49352
|
zIndex: props.zIndex,
|
|
49353
49353
|
position: position,
|
|
@@ -53266,9 +53266,11 @@ StepsComp.Step = StepsStep;
|
|
|
53266
53266
|
|
|
53267
53267
|
|
|
53268
53268
|
|
|
53269
|
+
|
|
53269
53270
|
var sticky_cssSupport = cssSupport;
|
|
53270
53271
|
var supportSticky = sticky_cssSupport('position', 'sticky');
|
|
53271
53272
|
var defaultZIndex = 900;
|
|
53273
|
+
var events = ['scroll', 'pageshow', 'load', 'resize'];
|
|
53272
53274
|
|
|
53273
53275
|
// const getFirstScrollParent = (el: HTMLElement) => {
|
|
53274
53276
|
// let parent = el.parentNode as HTMLElement;
|
|
@@ -53287,17 +53289,19 @@ var defaultZIndex = 900;
|
|
|
53287
53289
|
// };
|
|
53288
53290
|
|
|
53289
53291
|
var Sticky = function Sticky(props) {
|
|
53290
|
-
var _props$style;
|
|
53291
53292
|
var children = props.children,
|
|
53292
53293
|
top = props.top,
|
|
53293
53294
|
bottom = props.bottom;
|
|
53294
|
-
|
|
53295
|
+
// 是否使用css sticky
|
|
53296
|
+
var css = (props.css || props.target) && supportSticky;
|
|
53297
|
+
var forceUpdate = useRender();
|
|
53295
53298
|
var _useRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
|
|
53296
53299
|
target: null,
|
|
53297
53300
|
div: null,
|
|
53298
|
-
|
|
53301
|
+
position: '',
|
|
53302
|
+
targetObserver: null,
|
|
53299
53303
|
parentObserver: null,
|
|
53300
|
-
|
|
53304
|
+
fixedObserver: null
|
|
53301
53305
|
}),
|
|
53302
53306
|
context = _useRef.current;
|
|
53303
53307
|
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({}),
|
|
@@ -53312,12 +53316,7 @@ var Sticky = function Sticky(props) {
|
|
|
53312
53316
|
_useState6 = slicedToArray_default()(_useState5, 2),
|
|
53313
53317
|
parentVisible = _useState6[0],
|
|
53314
53318
|
setParentVisible = _useState6[1];
|
|
53315
|
-
var forceRender = useRender();
|
|
53316
53319
|
var elementRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
53317
|
-
var elementSize = useResize({
|
|
53318
|
-
targetRef: elementRef,
|
|
53319
|
-
timer: 0
|
|
53320
|
-
});
|
|
53321
53320
|
var getTarget = function getTarget() {
|
|
53322
53321
|
var scrollContainer = props.scrollContainer;
|
|
53323
53322
|
if (typeof scrollContainer === 'string') {
|
|
@@ -53327,22 +53326,19 @@ var Sticky = function Sticky(props) {
|
|
|
53327
53326
|
if (scrollContainer && scrollContainer.nodeType === 1) {
|
|
53328
53327
|
return scrollContainer;
|
|
53329
53328
|
}
|
|
53330
|
-
return
|
|
53329
|
+
return null;
|
|
53331
53330
|
};
|
|
53331
|
+
|
|
53332
|
+
// window resize 时需要重新计算底部附着的位置
|
|
53332
53333
|
var updateStyle = usePersistFn(function () {
|
|
53333
|
-
if (context.div &&
|
|
53334
|
-
var shouldFixed = context.target === document.body;
|
|
53334
|
+
if (context.div && context.position === 'bottom' && show) {
|
|
53335
53335
|
var scrollRect = context.target.getBoundingClientRect();
|
|
53336
53336
|
var targetRect = elementRef.current.getBoundingClientRect();
|
|
53337
53337
|
var targetLeft = targetRect.left;
|
|
53338
|
-
var width = targetRect.width,
|
|
53339
|
-
height = targetRect.height;
|
|
53340
53338
|
if (typeof bottom === 'number') {
|
|
53341
53339
|
var outRootRect = context.target.getBoundingClientRect();
|
|
53342
53340
|
var _style = {
|
|
53343
|
-
position:
|
|
53344
|
-
width: "".concat(width, "px"),
|
|
53345
|
-
height: "".concat(height, "px"),
|
|
53341
|
+
position: 'absolute',
|
|
53346
53342
|
top: "".concat(scrollRect.bottom - (props.bottom || 0) - outRootRect.top, "px"),
|
|
53347
53343
|
left: "".concat(targetLeft - outRootRect.left, "px"),
|
|
53348
53344
|
transform: 'translateY(-100%)'
|
|
@@ -53351,30 +53347,22 @@ var Sticky = function Sticky(props) {
|
|
|
53351
53347
|
}
|
|
53352
53348
|
}
|
|
53353
53349
|
});
|
|
53354
|
-
|
|
53350
|
+
|
|
53351
|
+
// 有滚动容器时的定位
|
|
53352
|
+
var handleTargetPosition = usePersistFn(function (entries) {
|
|
53355
53353
|
var entry = entries[0];
|
|
53356
53354
|
var scrollRect = entry.rootBounds;
|
|
53357
53355
|
var targetRect = entry.boundingClientRect;
|
|
53358
|
-
var shouldFixed = context.target === document.body;
|
|
53359
53356
|
if (!entry.isIntersecting) {
|
|
53360
53357
|
var targetLeft = targetRect.left;
|
|
53361
|
-
var outRootRect =
|
|
53362
|
-
top: 0,
|
|
53363
|
-
bottom: 0,
|
|
53364
|
-
left: 0,
|
|
53365
|
-
right: 0
|
|
53366
|
-
} : context.div.getBoundingClientRect();
|
|
53367
|
-
var width = targetRect.width,
|
|
53368
|
-
height = targetRect.height;
|
|
53358
|
+
var outRootRect = context.div.getBoundingClientRect();
|
|
53369
53359
|
if (scrollRect && targetRect.bottom < scrollRect.bottom) {
|
|
53370
53360
|
// top in
|
|
53371
|
-
context.
|
|
53361
|
+
context.position = 'top';
|
|
53372
53362
|
if (typeof top === 'number') {
|
|
53373
53363
|
setShow(true);
|
|
53374
53364
|
var _style2 = {
|
|
53375
|
-
position:
|
|
53376
|
-
width: "".concat(width, "px"),
|
|
53377
|
-
height: "".concat(height, "px"),
|
|
53365
|
+
position: 'absolute',
|
|
53378
53366
|
top: "".concat(scrollRect.top - outRootRect.top, "px"),
|
|
53379
53367
|
left: "".concat(targetLeft - outRootRect.left, "px")
|
|
53380
53368
|
};
|
|
@@ -53382,16 +53370,13 @@ var Sticky = function Sticky(props) {
|
|
|
53382
53370
|
}
|
|
53383
53371
|
} else if (scrollRect) {
|
|
53384
53372
|
// bottom in
|
|
53385
|
-
context.
|
|
53373
|
+
context.position = 'bottom';
|
|
53386
53374
|
if (typeof bottom === 'number') {
|
|
53387
53375
|
setShow(true);
|
|
53388
|
-
var _outRootRect = context.target.getBoundingClientRect();
|
|
53389
53376
|
var _style3 = {
|
|
53390
|
-
position:
|
|
53391
|
-
|
|
53392
|
-
|
|
53393
|
-
top: "".concat(scrollRect.bottom - _outRootRect.top, "px"),
|
|
53394
|
-
left: "".concat(targetLeft - _outRootRect.left, "px"),
|
|
53377
|
+
position: 'absolute',
|
|
53378
|
+
top: "".concat(scrollRect.bottom - outRootRect.top, "px"),
|
|
53379
|
+
left: "".concat(targetLeft - outRootRect.left, "px"),
|
|
53395
53380
|
transform: 'translateY(-100%)'
|
|
53396
53381
|
};
|
|
53397
53382
|
setStyle(_style3);
|
|
@@ -53400,8 +53385,11 @@ var Sticky = function Sticky(props) {
|
|
|
53400
53385
|
}
|
|
53401
53386
|
if (entry.isIntersecting) {
|
|
53402
53387
|
setShow(false);
|
|
53388
|
+
context.position = '';
|
|
53403
53389
|
}
|
|
53404
53390
|
});
|
|
53391
|
+
|
|
53392
|
+
// 父元素是否可见
|
|
53405
53393
|
var handleParentVisible = usePersistFn(function (entries) {
|
|
53406
53394
|
var entry = entries[0];
|
|
53407
53395
|
if (entry.isIntersecting) {
|
|
@@ -53410,35 +53398,118 @@ var Sticky = function Sticky(props) {
|
|
|
53410
53398
|
setParentVisible(false);
|
|
53411
53399
|
}
|
|
53412
53400
|
});
|
|
53413
|
-
var
|
|
53414
|
-
|
|
53415
|
-
|
|
53416
|
-
|
|
53401
|
+
var setFixedStyle = usePersistFn(function (s, m) {
|
|
53402
|
+
var l = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
53403
|
+
if (s !== show) {
|
|
53404
|
+
setShow(s);
|
|
53417
53405
|
}
|
|
53418
|
-
if (
|
|
53419
|
-
|
|
53420
|
-
|
|
53406
|
+
if (s && m) {
|
|
53407
|
+
var newStyle = defineProperty_default()(defineProperty_default()({
|
|
53408
|
+
position: 'fixed'
|
|
53409
|
+
}, m, m === 'top' ? top : bottom), "left", l);
|
|
53410
|
+
if (!shallowEqual(style, newStyle)) {
|
|
53411
|
+
setStyle(newStyle);
|
|
53412
|
+
}
|
|
53413
|
+
}
|
|
53414
|
+
});
|
|
53415
|
+
|
|
53416
|
+
// 无滚动容器的时候,body 滚动 resize 计算
|
|
53417
|
+
var handleFixedPosition = usePersistFn(function () {
|
|
53418
|
+
if (css || context.target) return;
|
|
53419
|
+
var element = elementRef.current;
|
|
53420
|
+
if (!parentVisible) {
|
|
53421
|
+
setFixedStyle(false);
|
|
53422
|
+
return;
|
|
53423
|
+
}
|
|
53424
|
+
if (!element) return;
|
|
53425
|
+
var selfRect = element.getBoundingClientRect();
|
|
53426
|
+
if (selfRect === null) return;
|
|
53427
|
+
// If the element is hidden, the width and height will be 0
|
|
53428
|
+
if (selfRect && selfRect.width === 0 && selfRect.height === 0) return;
|
|
53429
|
+
var scrollRect = document.body.getBoundingClientRect();
|
|
53430
|
+
var top = props.top,
|
|
53431
|
+
bottom = props.bottom;
|
|
53432
|
+
if (top !== undefined && Math.ceil(selfRect.top) <= top) {
|
|
53433
|
+
setFixedStyle(true, 'top', selfRect.left);
|
|
53434
|
+
return;
|
|
53435
|
+
} else if (bottom !== undefined && Math.ceil(selfRect.bottom) + bottom > scrollRect.bottom) {
|
|
53436
|
+
setFixedStyle(true, 'bottom', selfRect.left);
|
|
53437
|
+
return;
|
|
53438
|
+
} else {
|
|
53439
|
+
setFixedStyle(false);
|
|
53440
|
+
}
|
|
53441
|
+
});
|
|
53442
|
+
|
|
53443
|
+
// 无滚动容器时内滚场景触发
|
|
53444
|
+
var handleFixedInter = usePersistFn(function (entries) {
|
|
53445
|
+
if (!parentVisible) {
|
|
53446
|
+
setFixedStyle(false);
|
|
53447
|
+
return;
|
|
53448
|
+
}
|
|
53449
|
+
var entry = entries[0];
|
|
53450
|
+
var scrollRect = entry.rootBounds;
|
|
53451
|
+
var targetRect = entry.boundingClientRect;
|
|
53452
|
+
if (scrollRect && scrollRect.top === 0 && scrollRect.bottom === 0) {
|
|
53453
|
+
return;
|
|
53454
|
+
}
|
|
53455
|
+
if (!entry.isIntersecting) {
|
|
53456
|
+
var targetLeft = targetRect.left;
|
|
53457
|
+
var outRootRect = document.body.getBoundingClientRect();
|
|
53458
|
+
if (scrollRect && targetRect.bottom < scrollRect.bottom) {
|
|
53459
|
+
// top in
|
|
53460
|
+
if (typeof top === 'number') {
|
|
53461
|
+
setFixedStyle(true, 'top', targetLeft - outRootRect.left);
|
|
53462
|
+
}
|
|
53463
|
+
} else if (scrollRect) {
|
|
53464
|
+
// bottom in
|
|
53465
|
+
if (typeof bottom === 'number') {
|
|
53466
|
+
setFixedStyle(true, 'bottom', targetLeft - outRootRect.left);
|
|
53467
|
+
}
|
|
53468
|
+
}
|
|
53469
|
+
}
|
|
53470
|
+
if (entry.isIntersecting) {
|
|
53471
|
+
setFixedStyle(false);
|
|
53472
|
+
}
|
|
53473
|
+
});
|
|
53474
|
+
var elementSize = useResize({
|
|
53475
|
+
targetRef: elementRef,
|
|
53476
|
+
timer: 10,
|
|
53477
|
+
cb: handleFixedPosition
|
|
53478
|
+
});
|
|
53479
|
+
var cancelFixedObserver = function cancelFixedObserver() {
|
|
53480
|
+
if (context.fixedObserver) {
|
|
53481
|
+
context.fixedObserver.disconnect();
|
|
53482
|
+
context.fixedObserver = null;
|
|
53483
|
+
}
|
|
53484
|
+
};
|
|
53485
|
+
var createFixedObserver = function createFixedObserver() {
|
|
53486
|
+
cancelFixedObserver();
|
|
53487
|
+
context.fixedObserver = new IntersectionObserver(handleFixedInter, {
|
|
53488
|
+
root: null,
|
|
53489
|
+
rootMargin: "-".concat(top || 0, "px 0px -").concat(bottom || 0, "px 0px"),
|
|
53490
|
+
threshold: 1.0
|
|
53491
|
+
});
|
|
53492
|
+
};
|
|
53493
|
+
var cancelObserver = function cancelObserver() {
|
|
53494
|
+
if (context.targetObserver) {
|
|
53495
|
+
context.targetObserver.disconnect();
|
|
53496
|
+
context.targetObserver = null;
|
|
53421
53497
|
}
|
|
53422
|
-
window.removeEventListener('resize', updateStyle);
|
|
53423
53498
|
};
|
|
53424
53499
|
var createObserver = function createObserver() {
|
|
53425
|
-
|
|
53426
|
-
if (!context.div && target !== document.body) {
|
|
53500
|
+
if (!context.div) {
|
|
53427
53501
|
context.div = document.createElement('div');
|
|
53428
53502
|
context.div.style.position = 'relative';
|
|
53429
53503
|
}
|
|
53430
|
-
if (
|
|
53431
|
-
forceRender();
|
|
53432
|
-
context.target = target;
|
|
53433
|
-
cleanEvents();
|
|
53504
|
+
if (context.target) {
|
|
53434
53505
|
if (context.div) {
|
|
53435
53506
|
// append div
|
|
53436
|
-
if (target === document.body) {
|
|
53437
|
-
document.body.
|
|
53507
|
+
if (context.target === document.body) {
|
|
53508
|
+
document.body.insertBefore(context.div, document.body.firstChild);
|
|
53438
53509
|
} else {
|
|
53439
|
-
target.parentNode.insertBefore(context.div, target);
|
|
53510
|
+
context.target.parentNode.insertBefore(context.div, context.target);
|
|
53440
53511
|
}
|
|
53441
|
-
var _style4 = window.getComputedStyle(target);
|
|
53512
|
+
var _style4 = window.getComputedStyle(context.target);
|
|
53442
53513
|
if (_style4.position === 'absolute' || _style4.position === 'fixed') {
|
|
53443
53514
|
context.div.style.position = _style4.position;
|
|
53444
53515
|
context.div.style.top = _style4.top;
|
|
@@ -53447,59 +53518,109 @@ var Sticky = function Sticky(props) {
|
|
|
53447
53518
|
context.div.style.bottom = _style4.bottom;
|
|
53448
53519
|
}
|
|
53449
53520
|
}
|
|
53521
|
+
cancelFixedObserver();
|
|
53450
53522
|
if (window.IntersectionObserver) {
|
|
53451
|
-
var observer = new IntersectionObserver(
|
|
53452
|
-
root: target,
|
|
53523
|
+
var observer = new IntersectionObserver(handleTargetPosition, {
|
|
53524
|
+
root: context.target,
|
|
53453
53525
|
rootMargin: "-".concat(top || 0, "px 0px -").concat(bottom || 0, "px 0px"),
|
|
53454
53526
|
threshold: 1.0
|
|
53455
53527
|
});
|
|
53456
|
-
context.
|
|
53457
|
-
context.parentObserver = new IntersectionObserver(handleParentVisible, {
|
|
53458
|
-
root: target,
|
|
53459
|
-
rootMargin: "-".concat(top || 0, "px 0px -").concat(bottom || 0, "px 0px"),
|
|
53460
|
-
threshold: 0
|
|
53461
|
-
});
|
|
53528
|
+
context.targetObserver = observer;
|
|
53462
53529
|
}
|
|
53463
53530
|
}
|
|
53464
53531
|
};
|
|
53532
|
+
var cancelParentObserver = function cancelParentObserver() {
|
|
53533
|
+
if (context.parentObserver) {
|
|
53534
|
+
context.parentObserver.disconnect();
|
|
53535
|
+
context.parentObserver = null;
|
|
53536
|
+
}
|
|
53537
|
+
};
|
|
53538
|
+
var createParentObserver = function createParentObserver() {
|
|
53539
|
+
if (!props.parent) return;
|
|
53540
|
+
cancelParentObserver();
|
|
53541
|
+
context.parentObserver = new IntersectionObserver(handleParentVisible, {
|
|
53542
|
+
root: context.target,
|
|
53543
|
+
rootMargin: "-".concat(top || 0, "px 0px -").concat(bottom || 0, "px 0px"),
|
|
53544
|
+
threshold: 0
|
|
53545
|
+
});
|
|
53546
|
+
context.parentObserver.observe(props.parent);
|
|
53547
|
+
};
|
|
53548
|
+
|
|
53549
|
+
// 存在滚动容器时的定位
|
|
53550
|
+
var createTargetEvents = function createTargetEvents() {
|
|
53551
|
+
createObserver();
|
|
53552
|
+
window.addEventListener('resize', updateStyle);
|
|
53553
|
+
};
|
|
53554
|
+
var cancelTargetEvents = function cancelTargetEvents() {
|
|
53555
|
+
cancelObserver();
|
|
53556
|
+
window.removeEventListener('resize', updateStyle);
|
|
53557
|
+
if (context.div) {
|
|
53558
|
+
context.div.remove();
|
|
53559
|
+
context.div = null;
|
|
53560
|
+
}
|
|
53561
|
+
};
|
|
53562
|
+
var createFixedEvents = function createFixedEvents() {
|
|
53563
|
+
createFixedObserver();
|
|
53564
|
+
events.forEach(function (event) {
|
|
53565
|
+
window.addEventListener(event, handleFixedPosition);
|
|
53566
|
+
});
|
|
53567
|
+
};
|
|
53568
|
+
var cancelFixedEvents = function cancelFixedEvents() {
|
|
53569
|
+
cancelFixedObserver();
|
|
53570
|
+
events.forEach(function (event) {
|
|
53571
|
+
window.removeEventListener(event, handleFixedPosition);
|
|
53572
|
+
});
|
|
53573
|
+
};
|
|
53465
53574
|
var handleElementRef = function handleElementRef(el) {
|
|
53466
53575
|
if (el) {
|
|
53467
53576
|
elementRef.current = el;
|
|
53468
|
-
if (
|
|
53469
|
-
|
|
53577
|
+
if (context.targetObserver) {
|
|
53578
|
+
if (!el) {
|
|
53579
|
+
context.targetObserver.disconnect();
|
|
53580
|
+
} else {
|
|
53581
|
+
context.targetObserver.observe(el);
|
|
53582
|
+
}
|
|
53583
|
+
}
|
|
53584
|
+
if (context.fixedObserver) {
|
|
53585
|
+
if (!el) {
|
|
53586
|
+
context.fixedObserver.disconnect();
|
|
53587
|
+
} else {
|
|
53588
|
+
context.fixedObserver.observe(el);
|
|
53589
|
+
}
|
|
53470
53590
|
}
|
|
53471
53591
|
}
|
|
53472
53592
|
};
|
|
53473
|
-
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.
|
|
53474
|
-
if (
|
|
53475
|
-
|
|
53476
|
-
|
|
53593
|
+
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
|
|
53594
|
+
if (css) return;
|
|
53595
|
+
var target = getTarget();
|
|
53596
|
+
if (context.target !== target) {
|
|
53597
|
+
context.target = target;
|
|
53598
|
+
forceUpdate();
|
|
53477
53599
|
}
|
|
53478
|
-
|
|
53479
|
-
|
|
53480
|
-
|
|
53481
|
-
|
|
53482
|
-
|
|
53483
|
-
|
|
53484
|
-
|
|
53485
|
-
|
|
53486
|
-
|
|
53487
|
-
|
|
53600
|
+
if (context.target) {
|
|
53601
|
+
createTargetEvents();
|
|
53602
|
+
return cancelTargetEvents;
|
|
53603
|
+
} else {
|
|
53604
|
+
// fixed 布局
|
|
53605
|
+
createFixedEvents();
|
|
53606
|
+
return cancelFixedEvents;
|
|
53607
|
+
}
|
|
53608
|
+
}, [css, top, bottom]);
|
|
53609
|
+
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
|
|
53610
|
+
if (props.parent && !css) {
|
|
53611
|
+
// createParentObserver 用到context.target
|
|
53612
|
+
createParentObserver();
|
|
53488
53613
|
context.parentObserver.observe(props.parent);
|
|
53489
53614
|
}
|
|
53490
|
-
return
|
|
53491
|
-
|
|
53492
|
-
context.parentObserver.disconnect();
|
|
53493
|
-
}
|
|
53494
|
-
};
|
|
53495
|
-
}, [props.parent]);
|
|
53615
|
+
return cancelParentObserver;
|
|
53616
|
+
}, [props.parent, css, context.target, top, bottom]);
|
|
53496
53617
|
|
|
53497
53618
|
// 纯css方法 直接使用css
|
|
53498
53619
|
// js方法
|
|
53499
53620
|
// 1. 不指定滚动容器 基于document.body 使用fixed + js计算
|
|
53500
53621
|
// 2. 指定滚动容器 在滚动容器上方插入一个dom占位 基于该dom渲染和定位
|
|
53501
53622
|
// 3. 使用 intersectionObserver 来判断是否需要sticky
|
|
53502
|
-
if (css
|
|
53623
|
+
if (css) {
|
|
53503
53624
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
53504
53625
|
className: props.className,
|
|
53505
53626
|
style: objectSpread2_default()(objectSpread2_default()({
|
|
@@ -53523,12 +53644,14 @@ var Sticky = function Sticky(props) {
|
|
|
53523
53644
|
})
|
|
53524
53645
|
}) : null;
|
|
53525
53646
|
var isFixed = style.position === 'fixed';
|
|
53647
|
+
var hideStyle = {
|
|
53648
|
+
opacity: 0,
|
|
53649
|
+
pointerEvents: 'none'
|
|
53650
|
+
};
|
|
53526
53651
|
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
53527
53652
|
children: [isFixed ? StickyEl : context.target && context.div && /*#__PURE__*/(0,external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_.createPortal)(StickyEl, context.div), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
53528
53653
|
className: props.className,
|
|
53529
|
-
style: objectSpread2_default()(objectSpread2_default()({}, props.style), {},
|
|
53530
|
-
opacity: show && parentVisible ? 0 : (_props$style = props.style) === null || _props$style === void 0 ? void 0 : _props$style.opacity
|
|
53531
|
-
}),
|
|
53654
|
+
style: objectSpread2_default()(objectSpread2_default()({}, props.style), show && parentVisible ? hideStyle : {}),
|
|
53532
53655
|
ref: handleElementRef,
|
|
53533
53656
|
children: children
|
|
53534
53657
|
})]
|
|
@@ -58904,10 +59027,9 @@ var useUpload = function useUpload(props) {
|
|
|
58904
59027
|
});
|
|
58905
59028
|
});
|
|
58906
59029
|
};
|
|
58907
|
-
var
|
|
58908
|
-
|
|
58909
|
-
|
|
58910
|
-
};
|
|
59030
|
+
var latestState = use_latest_obj({
|
|
59031
|
+
filesState: filesState,
|
|
59032
|
+
value: value
|
|
58911
59033
|
});
|
|
58912
59034
|
var uploadFile = function uploadFile(id, file, data) {
|
|
58913
59035
|
var request = props.request || xhr;
|
|
@@ -58928,8 +59050,7 @@ var useUpload = function useUpload(props) {
|
|
|
58928
59050
|
throttle = false;
|
|
58929
59051
|
}, 16);
|
|
58930
59052
|
var percent = typeof e.percent === 'number' ? e.percent : e.loaded / e.total * 100;
|
|
58931
|
-
var
|
|
58932
|
-
filesState = _getCurrent.filesState;
|
|
59053
|
+
var filesState = latestState.filesState;
|
|
58933
59054
|
var newFiles = objectSpread2_default()({}, filesState);
|
|
58934
59055
|
if (!newFiles[id]) return;
|
|
58935
59056
|
newFiles[id].process = percent;
|
|
@@ -58966,7 +59087,7 @@ var useUpload = function useUpload(props) {
|
|
|
58966
59087
|
});
|
|
58967
59088
|
});
|
|
58968
59089
|
// add value
|
|
58969
|
-
var values = utils_immer_produce(value, function (draft) {
|
|
59090
|
+
var values = utils_immer_produce(latestState.value, function (draft) {
|
|
58970
59091
|
draft.push(result);
|
|
58971
59092
|
});
|
|
58972
59093
|
props.onChange(values);
|
|
@@ -59019,7 +59140,7 @@ var useUpload = function useUpload(props) {
|
|
|
59019
59140
|
reader.readAsDataURL(blob);
|
|
59020
59141
|
});
|
|
59021
59142
|
};
|
|
59022
|
-
var addFiles = /*#__PURE__*/function () {
|
|
59143
|
+
var addFiles = use_persist_fn( /*#__PURE__*/function () {
|
|
59023
59144
|
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2(files) {
|
|
59024
59145
|
var fileList, newFiles, resetLength, list, _loop, _ret, i;
|
|
59025
59146
|
return regeneratorRuntime_default()().wrap(function _callee2$(_context3) {
|
|
@@ -59158,11 +59279,11 @@ var useUpload = function useUpload(props) {
|
|
|
59158
59279
|
}
|
|
59159
59280
|
}, _callee2);
|
|
59160
59281
|
}));
|
|
59161
|
-
return function
|
|
59282
|
+
return function (_x3) {
|
|
59162
59283
|
return _ref2.apply(this, arguments);
|
|
59163
59284
|
};
|
|
59164
|
-
}();
|
|
59165
|
-
var removeFile = function
|
|
59285
|
+
}());
|
|
59286
|
+
var removeFile = use_persist_fn(function (id) {
|
|
59166
59287
|
var beforeCancel = props.beforeCancel,
|
|
59167
59288
|
onErrorRemove = props.onErrorRemove;
|
|
59168
59289
|
var file = filesState[id];
|
|
@@ -59180,8 +59301,8 @@ var useUpload = function useUpload(props) {
|
|
|
59180
59301
|
onErrorRemove(file.xhr, file.blob, file);
|
|
59181
59302
|
}
|
|
59182
59303
|
}
|
|
59183
|
-
};
|
|
59184
|
-
var removeValue = function
|
|
59304
|
+
});
|
|
59305
|
+
var removeValue = use_persist_fn(function (index) {
|
|
59185
59306
|
if (props.disabled) return;
|
|
59186
59307
|
var recoverAble = props.recoverAble,
|
|
59187
59308
|
beforeRemove = props.beforeRemove;
|
|
@@ -59193,15 +59314,15 @@ var useUpload = function useUpload(props) {
|
|
|
59193
59314
|
newRecycle.push(value[index]);
|
|
59194
59315
|
}
|
|
59195
59316
|
setRecycleValues(newRecycle);
|
|
59196
|
-
var newValue = utils_immer_produce(
|
|
59317
|
+
var newValue = utils_immer_produce(latestState.value, function (draft) {
|
|
59197
59318
|
draft.splice(index, 1);
|
|
59198
59319
|
});
|
|
59199
59320
|
props.onChange(newValue);
|
|
59200
59321
|
}).catch(function () {});
|
|
59201
|
-
};
|
|
59202
|
-
var recoverValue = function
|
|
59322
|
+
});
|
|
59323
|
+
var recoverValue = use_persist_fn(function (index) {
|
|
59203
59324
|
if (props.disabled) return;
|
|
59204
|
-
props.onChange(utils_immer_produce(
|
|
59325
|
+
props.onChange(utils_immer_produce(latestState.value, function (draft) {
|
|
59205
59326
|
draft.push(recycleValues[index]);
|
|
59206
59327
|
}));
|
|
59207
59328
|
setRecycleValues(function (pre) {
|
|
@@ -59209,7 +59330,7 @@ var useUpload = function useUpload(props) {
|
|
|
59209
59330
|
newRecycle.splice(index, 1);
|
|
59210
59331
|
return newRecycle;
|
|
59211
59332
|
});
|
|
59212
|
-
};
|
|
59333
|
+
});
|
|
59213
59334
|
var func = use_latest_obj({
|
|
59214
59335
|
addFiles: addFiles,
|
|
59215
59336
|
removeFile: removeFile,
|
|
@@ -62214,7 +62335,7 @@ var upload_interface = __webpack_require__(4412);
|
|
|
62214
62335
|
|
|
62215
62336
|
|
|
62216
62337
|
/* harmony default export */ var src_0 = ({
|
|
62217
|
-
version: '3.1.
|
|
62338
|
+
version: '3.1.16'
|
|
62218
62339
|
});
|
|
62219
62340
|
}();
|
|
62220
62341
|
/******/ return __webpack_exports__;
|