shineout 3.6.5-beta.1 → 3.6.5-beta.10
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/index.js +1 -1
- package/dist/shineout.js +125 -50
- package/dist/shineout.js.map +1 -1
- package/dist/shineout.min.js +1 -1
- package/dist/shineout.min.js.map +1 -1
- package/esm/index.js +1 -1
- package/package.json +5 -5
package/cjs/index.js
CHANGED
|
@@ -514,5 +514,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
514
514
|
// 此文件由脚本自动生成,请勿直接修改。
|
|
515
515
|
// This file was generated automatically by a script. Please do not modify it directly.
|
|
516
516
|
var _default = exports.default = {
|
|
517
|
-
version: '3.6.5-beta.
|
|
517
|
+
version: '3.6.5-beta.10'
|
|
518
518
|
};
|
package/dist/shineout.js
CHANGED
|
@@ -12217,7 +12217,7 @@ var handleStyle = function handleStyle(style) {
|
|
|
12217
12217
|
};
|
|
12218
12218
|
/* harmony default export */ var jss_style_handleStyle = (handleStyle);
|
|
12219
12219
|
;// CONCATENATED MODULE: ../shineout-style/src/version.ts
|
|
12220
|
-
/* harmony default export */ var version = ('3.6.5-beta.
|
|
12220
|
+
/* harmony default export */ var version = ('3.6.5-beta.10');
|
|
12221
12221
|
;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
|
|
12222
12222
|
|
|
12223
12223
|
|
|
@@ -19757,9 +19757,14 @@ var ImageStyle = objectSpread2_default()(objectSpread2_default()({
|
|
|
19757
19757
|
},
|
|
19758
19758
|
fill: {
|
|
19759
19759
|
'& $inner': {
|
|
19760
|
-
|
|
19761
|
-
|
|
19762
|
-
|
|
19760
|
+
'& > img': {
|
|
19761
|
+
position: 'absolute',
|
|
19762
|
+
top: '50%',
|
|
19763
|
+
left: '50%',
|
|
19764
|
+
transform: 'translate(-50%, -50%)',
|
|
19765
|
+
maxWidth: 'none',
|
|
19766
|
+
maxHeight: 'none'
|
|
19767
|
+
}
|
|
19763
19768
|
}
|
|
19764
19769
|
},
|
|
19765
19770
|
previewMask: {
|
|
@@ -49442,7 +49447,8 @@ var useForm = function useForm(props) {
|
|
|
49442
49447
|
size = props.size,
|
|
49443
49448
|
colon = props.colon,
|
|
49444
49449
|
formName = props.name,
|
|
49445
|
-
scrollParent = props.scrollParent
|
|
49450
|
+
scrollParent = props.scrollParent,
|
|
49451
|
+
isControl = props.isControl;
|
|
49446
49452
|
var deepSetOptions = {
|
|
49447
49453
|
removeUndefined: removeUndefined,
|
|
49448
49454
|
forceSet: true
|
|
@@ -49698,13 +49704,16 @@ var useForm = function useForm(props) {
|
|
|
49698
49704
|
var values = Object.keys(vals);
|
|
49699
49705
|
// 针对 name 为数组模式,如 datepicker 的 name={['startTime', 'endTime']} 时,前者校验可能需要依赖后者,因此需要提前将后者数据整合至 draft 用于多字段整合校验
|
|
49700
49706
|
values.forEach(function (key) {
|
|
49701
|
-
|
|
49707
|
+
// upload组件返回的可能是函数: (prev) => [...prev, file]
|
|
49708
|
+
var valueOfKey = typeof vals[key] === 'function' ? vals[key](getValue(key)) : vals[key];
|
|
49709
|
+
deepSet(draft, key, valueOfKey, deepSetOptions);
|
|
49702
49710
|
});
|
|
49703
49711
|
values.forEach(function (key) {
|
|
49704
49712
|
if (option.validate) {
|
|
49705
49713
|
var _context$validateMap$;
|
|
49706
49714
|
(_context$validateMap$ = context.validateMap[key]) === null || _context$validateMap$ === void 0 || _context$validateMap$.forEach(function (validate) {
|
|
49707
|
-
|
|
49715
|
+
var valueOfKey = typeof vals[key] === 'function' ? vals[key](getValue(key)) : vals[key];
|
|
49716
|
+
validate(key, valueOfKey, current(draft));
|
|
49708
49717
|
});
|
|
49709
49718
|
}
|
|
49710
49719
|
});
|
|
@@ -50002,7 +50011,10 @@ var useForm = function useForm(props) {
|
|
|
50002
50011
|
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(function () {
|
|
50003
50012
|
context.removeLock = false;
|
|
50004
50013
|
// 内部 onChange 改的 value, 不需要更新
|
|
50005
|
-
if (props.value === context.value)
|
|
50014
|
+
if (props.value === context.value) {
|
|
50015
|
+
if (!isControl) update();
|
|
50016
|
+
return;
|
|
50017
|
+
}
|
|
50006
50018
|
if (initValidate && !context.resetTime) {
|
|
50007
50019
|
var keys = Object.keys(context.validateMap).filter(function (key) {
|
|
50008
50020
|
var oldValue = deepGet(preValue || emptyObj, key);
|
|
@@ -50072,11 +50084,12 @@ var Form = function Form(props) {
|
|
|
50072
50084
|
rest = objectWithoutProperties_default()(props, form_excluded);
|
|
50073
50085
|
var formClasses = jssStyle === null || jssStyle === void 0 || (_jssStyle$form = jssStyle.form) === null || _jssStyle$form === void 0 ? void 0 : _jssStyle$form.call(jssStyle);
|
|
50074
50086
|
var modalFormContext = useFormFooter();
|
|
50087
|
+
var isControl = ('value' in props);
|
|
50075
50088
|
var inputAbleParams = {
|
|
50076
50089
|
value: props.value,
|
|
50077
50090
|
onChange: props.onChange,
|
|
50078
50091
|
defaultValue: props.defaultValue,
|
|
50079
|
-
control:
|
|
50092
|
+
control: isControl,
|
|
50080
50093
|
beforeChange: undefined,
|
|
50081
50094
|
reserveAble: false
|
|
50082
50095
|
};
|
|
@@ -50087,7 +50100,8 @@ var Form = function Form(props) {
|
|
|
50087
50100
|
var _useForm = use_form(objectSpread2_default()(objectSpread2_default()({}, rest), {}, {
|
|
50088
50101
|
value: value,
|
|
50089
50102
|
onChange: onChange,
|
|
50090
|
-
formElRef: formElRef
|
|
50103
|
+
formElRef: formElRef,
|
|
50104
|
+
isControl: isControl
|
|
50091
50105
|
})),
|
|
50092
50106
|
Provider = _useForm.Provider,
|
|
50093
50107
|
ProviderProps = _useForm.ProviderProps,
|
|
@@ -51220,6 +51234,10 @@ var useImage = function useImage() {
|
|
|
51220
51234
|
_React$useState2 = slicedToArray_default()(_React$useState, 2),
|
|
51221
51235
|
status = _React$useState2[0],
|
|
51222
51236
|
setStatus = _React$useState2[1];
|
|
51237
|
+
var _React$useState3 = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState({}),
|
|
51238
|
+
_React$useState4 = slicedToArray_default()(_React$useState3, 2),
|
|
51239
|
+
imgCoverStyle = _React$useState4[0],
|
|
51240
|
+
setImgCoverStyle = _React$useState4[1];
|
|
51223
51241
|
var elementRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
|
|
51224
51242
|
var getUrl = function getUrl(url) {
|
|
51225
51243
|
var auto = 'autoSSL' in props ? autoSSL : use_image_config.autoSSL;
|
|
@@ -51254,6 +51272,35 @@ var useImage = function useImage() {
|
|
|
51254
51272
|
};
|
|
51255
51273
|
img.src = getUrl(alt);
|
|
51256
51274
|
};
|
|
51275
|
+
var handleCoverStyle = function handleCoverStyle(img) {
|
|
51276
|
+
var container = elementRef === null || elementRef === void 0 ? void 0 : elementRef.current;
|
|
51277
|
+
if (!container) return;
|
|
51278
|
+
|
|
51279
|
+
// 根据容器的宽高获取宽高比
|
|
51280
|
+
var containerWidth = container.clientWidth;
|
|
51281
|
+
var containerHeight = container.clientHeight;
|
|
51282
|
+
var containerRatio = containerWidth / containerHeight;
|
|
51283
|
+
|
|
51284
|
+
// 根据图片的自然尺寸获取宽高比
|
|
51285
|
+
var imageWidth = img.naturalWidth;
|
|
51286
|
+
var imageHeight = img.naturalHeight;
|
|
51287
|
+
var imageRatio = imageWidth / imageHeight;
|
|
51288
|
+
|
|
51289
|
+
// 判断宽高比,决定图片填充策略
|
|
51290
|
+
if (imageRatio > containerRatio) {
|
|
51291
|
+
// 图片更宽,宽度占满容器,高度自适应
|
|
51292
|
+
setImgCoverStyle({
|
|
51293
|
+
height: '100%',
|
|
51294
|
+
width: 'auto'
|
|
51295
|
+
});
|
|
51296
|
+
} else {
|
|
51297
|
+
// 图片更高,填满容器高度
|
|
51298
|
+
setImgCoverStyle({
|
|
51299
|
+
width: '100%',
|
|
51300
|
+
height: 'auto'
|
|
51301
|
+
});
|
|
51302
|
+
}
|
|
51303
|
+
};
|
|
51257
51304
|
var markToRender = function markToRender() {
|
|
51258
51305
|
if (!src) {
|
|
51259
51306
|
handleAlt();
|
|
@@ -51261,7 +51308,10 @@ var useImage = function useImage() {
|
|
|
51261
51308
|
}
|
|
51262
51309
|
var img = new window.Image();
|
|
51263
51310
|
img.onload = function () {
|
|
51264
|
-
|
|
51311
|
+
setStatus(SRC);
|
|
51312
|
+
if (props.fit === 'fill') {
|
|
51313
|
+
handleCoverStyle(img);
|
|
51314
|
+
}
|
|
51265
51315
|
};
|
|
51266
51316
|
img.onerror = function (e) {
|
|
51267
51317
|
return handleError(SRC, e);
|
|
@@ -51290,7 +51340,9 @@ var useImage = function useImage() {
|
|
|
51290
51340
|
alt: alt,
|
|
51291
51341
|
draggable: !noImgDrag
|
|
51292
51342
|
});
|
|
51293
|
-
return objectSpread2_default()({
|
|
51343
|
+
return objectSpread2_default()({
|
|
51344
|
+
style: imgCoverStyle
|
|
51345
|
+
}, mergedEventHandlers);
|
|
51294
51346
|
};
|
|
51295
51347
|
var getImageDivProps = function getImageDivProps() {
|
|
51296
51348
|
var externalProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -52058,7 +52110,8 @@ var Image = function Image(props) {
|
|
|
52058
52110
|
href: href,
|
|
52059
52111
|
lazy: lazy,
|
|
52060
52112
|
autoSSL: autoSSL,
|
|
52061
|
-
noImgDrag: noImgDrag
|
|
52113
|
+
noImgDrag: noImgDrag,
|
|
52114
|
+
fit: fit
|
|
52062
52115
|
}, rest)),
|
|
52063
52116
|
status = _useImage.status,
|
|
52064
52117
|
getRootProps = _useImage.getRootProps,
|
|
@@ -52137,7 +52190,7 @@ var Image = function Image(props) {
|
|
|
52137
52190
|
|
|
52138
52191
|
// 渲染 img / div 类型的内部标签
|
|
52139
52192
|
var renderInner = function renderInner(src) {
|
|
52140
|
-
return fit === '
|
|
52193
|
+
return fit === 'fit' ? renderDivInnerEl(src) : renderImgeInnerEl(src);
|
|
52141
52194
|
};
|
|
52142
52195
|
|
|
52143
52196
|
// 默认占位图
|
|
@@ -66440,6 +66493,7 @@ function attrAccept(file, acceptedFiles) {
|
|
|
66440
66493
|
|
|
66441
66494
|
|
|
66442
66495
|
|
|
66496
|
+
|
|
66443
66497
|
var VALIDATORITEMS = [{
|
|
66444
66498
|
key: 'size',
|
|
66445
66499
|
param: function param(blob) {
|
|
@@ -66473,11 +66527,12 @@ var promised = function promised(action) {
|
|
|
66473
66527
|
resolve(true);
|
|
66474
66528
|
});
|
|
66475
66529
|
};
|
|
66530
|
+
var defaultValue = [];
|
|
66476
66531
|
var useUpload = function useUpload(props) {
|
|
66477
66532
|
var _props$limit = props.limit,
|
|
66478
66533
|
limit = _props$limit === void 0 ? 100 : _props$limit,
|
|
66479
66534
|
_props$value = props.value,
|
|
66480
|
-
value = _props$value === void 0 ?
|
|
66535
|
+
value = _props$value === void 0 ? defaultValue : _props$value;
|
|
66481
66536
|
var accept = props.forceAccept || props.accept;
|
|
66482
66537
|
var forceAccept = !!props.forceAccept;
|
|
66483
66538
|
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({}),
|
|
@@ -66597,21 +66652,22 @@ var useUpload = function useUpload(props) {
|
|
|
66597
66652
|
responseType: props.responseType,
|
|
66598
66653
|
onStart: props.onStart,
|
|
66599
66654
|
onProgress: function onProgress(e, msg) {
|
|
66600
|
-
|
|
66655
|
+
var percent = typeof e.percent === 'number' ? e.percent : e.loaded / e.total * 100;
|
|
66656
|
+
if (throttle && percent !== 100) return;
|
|
66601
66657
|
throttle = true;
|
|
66602
66658
|
setTimeout(function () {
|
|
66603
66659
|
throttle = false;
|
|
66604
66660
|
}, 16);
|
|
66605
|
-
|
|
66606
|
-
|
|
66607
|
-
|
|
66608
|
-
|
|
66609
|
-
|
|
66610
|
-
|
|
66611
|
-
|
|
66612
|
-
|
|
66613
|
-
|
|
66614
|
-
}
|
|
66661
|
+
setFiles(function (files) {
|
|
66662
|
+
return utils_immer_produce(files, function (draft) {
|
|
66663
|
+
if (!draft[id]) return draft;
|
|
66664
|
+
draft[id].process = percent;
|
|
66665
|
+
if (msg) draft[id].message = msg;
|
|
66666
|
+
if (typeof props.onProgress === 'function') {
|
|
66667
|
+
props.onProgress(draft[id]);
|
|
66668
|
+
}
|
|
66669
|
+
});
|
|
66670
|
+
});
|
|
66615
66671
|
},
|
|
66616
66672
|
onLoad: function onLoad(xhr) {
|
|
66617
66673
|
if (!/^2|1223/.test("".concat(xhr.status))) {
|
|
@@ -66639,11 +66695,17 @@ var useUpload = function useUpload(props) {
|
|
|
66639
66695
|
delete draft[id];
|
|
66640
66696
|
});
|
|
66641
66697
|
});
|
|
66642
|
-
|
|
66643
|
-
|
|
66644
|
-
|
|
66645
|
-
|
|
66646
|
-
|
|
66698
|
+
if (props.functionalOnChange) {
|
|
66699
|
+
// 回调型 setState不会丢值
|
|
66700
|
+
props.onChange(function (prev) {
|
|
66701
|
+
return [].concat(toConsumableArray_default()(prev || []), [result]);
|
|
66702
|
+
});
|
|
66703
|
+
} else {
|
|
66704
|
+
var latestValue = latestState.value;
|
|
66705
|
+
var newValue = toConsumableArray_default()(latestValue);
|
|
66706
|
+
newValue.push(result);
|
|
66707
|
+
props.onChange(newValue);
|
|
66708
|
+
}
|
|
66647
66709
|
}
|
|
66648
66710
|
},
|
|
66649
66711
|
onError: function onError(xhr) {
|
|
@@ -66761,48 +66823,60 @@ var useUpload = function useUpload(props) {
|
|
|
66761
66823
|
error = _context2.sent;
|
|
66762
66824
|
case 21:
|
|
66763
66825
|
if (!(error instanceof Error)) {
|
|
66764
|
-
_context2.next =
|
|
66826
|
+
_context2.next = 29;
|
|
66765
66827
|
break;
|
|
66766
66828
|
}
|
|
66767
66829
|
if (validatorHandle(error, blob)) {
|
|
66768
|
-
_context2.next =
|
|
66830
|
+
_context2.next = 25;
|
|
66769
66831
|
break;
|
|
66770
66832
|
}
|
|
66771
|
-
|
|
66772
|
-
|
|
66833
|
+
setFiles(function (prev) {
|
|
66834
|
+
return utils_immer_produce(prev, function (draft) {
|
|
66835
|
+
delete draft[id];
|
|
66836
|
+
});
|
|
66837
|
+
});
|
|
66773
66838
|
return _context2.abrupt("return", 0);
|
|
66774
|
-
case
|
|
66839
|
+
case 25:
|
|
66775
66840
|
fileRecord.message = error.message;
|
|
66776
66841
|
fileRecord.status = 3;
|
|
66777
|
-
setFiles(
|
|
66842
|
+
setFiles(function (prev) {
|
|
66843
|
+
return objectSpread2_default()(objectSpread2_default()({}, prev), {}, defineProperty_default()({}, id, fileRecord));
|
|
66844
|
+
});
|
|
66778
66845
|
return _context2.abrupt("return", 0);
|
|
66779
|
-
case
|
|
66846
|
+
case 29:
|
|
66780
66847
|
if (!props.beforeUpload) {
|
|
66781
|
-
_context2.next =
|
|
66848
|
+
_context2.next = 36;
|
|
66782
66849
|
break;
|
|
66783
66850
|
}
|
|
66784
66851
|
beforeUploadResult = props.beforeUpload(blob); // @ts-ignoreq
|
|
66785
66852
|
if (!(beforeUploadResult && beforeUploadResult.then)) {
|
|
66786
|
-
_context2.next =
|
|
66853
|
+
_context2.next = 34;
|
|
66787
66854
|
break;
|
|
66788
66855
|
}
|
|
66789
66856
|
props.beforeUpload(blob).then(function (args) {
|
|
66790
66857
|
if (args.status !== 'error') {
|
|
66791
66858
|
newFiles[id].xhr = uploadFile(id, blob, fileRecord.src);
|
|
66792
|
-
setFiles(
|
|
66859
|
+
setFiles(function (prev) {
|
|
66860
|
+
return objectSpread2_default()(objectSpread2_default()({}, prev), {}, defineProperty_default()({}, id, fileRecord));
|
|
66861
|
+
});
|
|
66793
66862
|
}
|
|
66794
66863
|
}).catch(function () {
|
|
66795
|
-
|
|
66796
|
-
|
|
66864
|
+
setFiles(function (prev) {
|
|
66865
|
+
return utils_immer_produce(prev, function (draft) {
|
|
66866
|
+
delete draft[id];
|
|
66867
|
+
});
|
|
66868
|
+
});
|
|
66797
66869
|
});
|
|
66798
66870
|
return _context2.abrupt("return", 0);
|
|
66799
|
-
case
|
|
66800
|
-
_context2.next =
|
|
66871
|
+
case 34:
|
|
66872
|
+
_context2.next = 38;
|
|
66801
66873
|
break;
|
|
66802
|
-
case
|
|
66874
|
+
case 36:
|
|
66803
66875
|
fileRecord.xhr = uploadFile(id, blob, fileRecord.src);
|
|
66804
|
-
setFiles(
|
|
66805
|
-
|
|
66876
|
+
setFiles(function (prev) {
|
|
66877
|
+
return objectSpread2_default()(objectSpread2_default()({}, prev), {}, defineProperty_default()({}, id, fileRecord));
|
|
66878
|
+
});
|
|
66879
|
+
case 38:
|
|
66806
66880
|
case "end":
|
|
66807
66881
|
return _context2.stop();
|
|
66808
66882
|
}
|
|
@@ -67200,7 +67274,8 @@ var Upload = function Upload(props0) {
|
|
|
67200
67274
|
invalidImage: getLocale(locale, 'invalidImage')
|
|
67201
67275
|
},
|
|
67202
67276
|
value: value,
|
|
67203
|
-
onChange: onChange
|
|
67277
|
+
onChange: onChange,
|
|
67278
|
+
functionalOnChange: props.functionalOnChange
|
|
67204
67279
|
})),
|
|
67205
67280
|
func = _useUpload.func,
|
|
67206
67281
|
files = _useUpload.files,
|
|
@@ -69984,7 +70059,7 @@ var upload_interface = __webpack_require__(8821);
|
|
|
69984
70059
|
|
|
69985
70060
|
|
|
69986
70061
|
/* harmony default export */ var src_0 = ({
|
|
69987
|
-
version: '3.6.5-beta.
|
|
70062
|
+
version: '3.6.5-beta.10'
|
|
69988
70063
|
});
|
|
69989
70064
|
}();
|
|
69990
70065
|
/******/ return __webpack_exports__;
|