shineout 1.10.12-beta.2 → 1.10.12
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/css/Form/inputable.js +7 -1
- package/css/Input/Input.js +2 -7
- package/css/Table/SeperateTable.js +2 -0
- package/css/Table/Thead.js +2 -1
- package/css/TreeSelect/Input.js +5 -1
- package/css/Upload/Upload.js +50 -33
- package/css/hoc/delay.js +0 -2
- package/css/index.d.ts +1 -1
- package/css/index.js +1 -1
- package/css/utils/cleanProps.js +1 -1
- package/dist/shineout.js +117 -92
- package/dist/shineout.js.map +1 -1
- package/dist/shineout.min.js +1 -1
- package/es/Form/inputable.js +7 -1
- package/es/Input/Input.js +2 -7
- package/es/Table/SeperateTable.js +2 -0
- package/es/Table/Thead.js +2 -1
- package/es/TreeSelect/Input.js +5 -1
- package/es/Upload/Upload.js +50 -33
- package/es/hoc/delay.js +0 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/utils/cleanProps.js +1 -1
- package/lib/Form/inputable.js +7 -1
- package/lib/Input/Input.js +2 -7
- package/lib/Table/SeperateTable.js +2 -0
- package/lib/Table/Thead.js +2 -1
- package/lib/TreeSelect/Input.js +5 -1
- package/lib/Upload/Upload.js +50 -33
- package/lib/hoc/delay.js +0 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/utils/cleanProps.js +1 -1
- package/package.json +1 -1
package/css/Form/inputable.js
CHANGED
|
@@ -88,6 +88,7 @@ var _default = (0, _func.curry)(function (Origin) {
|
|
|
88
88
|
_this.handleError = _this.handleError.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
89
89
|
_this.validate = _this.validate.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
90
90
|
_this.validateHook = _this.validateHook.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
91
|
+
_this.forceValidate = _this.forceValidate.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
91
92
|
_this.lastValue = formDatum && name ? formDatum.get(name) || {} : {};
|
|
92
93
|
return _this;
|
|
93
94
|
}
|
|
@@ -338,6 +339,10 @@ var _default = (0, _func.curry)(function (Origin) {
|
|
|
338
339
|
if (fieldSetValidate) fieldSetValidate(true);
|
|
339
340
|
};
|
|
340
341
|
|
|
342
|
+
_proto.forceValidate = function forceValidate() {
|
|
343
|
+
this.validate(this.props.value);
|
|
344
|
+
};
|
|
345
|
+
|
|
341
346
|
_proto.handleUpdate = function handleUpdate(value, sn, type) {
|
|
342
347
|
var _this5 = this;
|
|
343
348
|
|
|
@@ -400,7 +405,8 @@ var _default = (0, _func.curry)(function (Origin) {
|
|
|
400
405
|
value: this.getValue(),
|
|
401
406
|
onChange: this.handleChange,
|
|
402
407
|
onDatumBind: this.handleDatumBind,
|
|
403
|
-
validateHook: this.validateHook
|
|
408
|
+
validateHook: this.validateHook,
|
|
409
|
+
forceValidate: this.forceValidate
|
|
404
410
|
}));
|
|
405
411
|
};
|
|
406
412
|
|
package/css/Input/Input.js
CHANGED
|
@@ -207,14 +207,9 @@ function (_PureComponent) {
|
|
|
207
207
|
cancelChange = _this$props6.cancelChange;
|
|
208
208
|
if (cancelChange) cancelChange();
|
|
209
209
|
var newVal = this.fixValue(value);
|
|
210
|
+
var canForceChange = !(clearToUndefined && newVal === '' && this.props.value === undefined);
|
|
211
|
+
if (canForceChange && forceChange && !this.invalidNumber(newVal)) forceChange(newVal);
|
|
210
212
|
if (onBlur) onBlur(e);
|
|
211
|
-
if (this.invalidNumber(newVal)) return;
|
|
212
|
-
|
|
213
|
-
if (clearToUndefined && newVal === '' && this.props.value === undefined) {
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if (forceChange) forceChange(newVal);
|
|
218
213
|
};
|
|
219
214
|
|
|
220
215
|
_proto.handleAutoSelect = function handleAutoSelect(event) {
|
package/css/Table/Thead.js
CHANGED
|
@@ -176,9 +176,10 @@ function (_PureComponent) {
|
|
|
176
176
|
disabled = _this$props2.disabled,
|
|
177
177
|
treeColumnsName = _this$props2.treeColumnsName,
|
|
178
178
|
treeCheckAll = _this$props2.treeCheckAll;
|
|
179
|
+
var isEmpty = !(data && data.length);
|
|
179
180
|
var align = col.align && "align-" + col.align;
|
|
180
181
|
var ignoreBorderRight = this.rightBorderRecord[col.key] && 'ignore-right-border';
|
|
181
|
-
var resize = level === 0 && columnResizable && col.columnResizable !== false ? _react.default.createElement("span", {
|
|
182
|
+
var resize = level === 0 && !isEmpty && columnResizable && col.columnResizable !== false ? _react.default.createElement("span", {
|
|
182
183
|
onMouseDown: this.handleMouseDown,
|
|
183
184
|
className: (0, _styles.tableClass)('resize-spanner')
|
|
184
185
|
}) : null;
|
package/css/TreeSelect/Input.js
CHANGED
|
@@ -59,7 +59,11 @@ function (_Component) {
|
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
_proto.focus = function focus() {
|
|
62
|
-
|
|
62
|
+
var _this2 = this;
|
|
63
|
+
|
|
64
|
+
requestAnimationFrame(function () {
|
|
65
|
+
_element.focusElement.select(_this2.editElement);
|
|
66
|
+
});
|
|
63
67
|
};
|
|
64
68
|
|
|
65
69
|
_proto.bindElement = function bindElement(el) {
|
package/css/Upload/Upload.js
CHANGED
|
@@ -116,6 +116,7 @@ function (_PureComponent) {
|
|
|
116
116
|
_this.removeValue = _this.removeValue.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
117
117
|
_this.recoverValue = _this.recoverValue.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
118
118
|
_this.validatorHandle = _this.validatorHandle.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
119
|
+
_this.updateValidate = _this.updateValidate.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
119
120
|
_this.useValidator = _this.useValidator.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
120
121
|
_this.handleFileDrop = _this.handleFileDrop.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
121
122
|
_this.handleReplace = _this.handleReplace.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
@@ -167,6 +168,8 @@ function (_PureComponent) {
|
|
|
167
168
|
};
|
|
168
169
|
|
|
169
170
|
_proto.removeFile = function removeFile(id) {
|
|
171
|
+
var _this2 = this;
|
|
172
|
+
|
|
170
173
|
var onErrorRemove = this.props.onErrorRemove;
|
|
171
174
|
var file = this.state.files[id];
|
|
172
175
|
|
|
@@ -178,12 +181,14 @@ function (_PureComponent) {
|
|
|
178
181
|
if (file.status === _request.ERROR && onErrorRemove) {
|
|
179
182
|
onErrorRemove(file.xhr, file.blob, file);
|
|
180
183
|
}
|
|
184
|
+
|
|
185
|
+
_this2.updateValidate();
|
|
181
186
|
});
|
|
182
187
|
}
|
|
183
188
|
};
|
|
184
189
|
|
|
185
190
|
_proto.removeValue = function removeValue(index) {
|
|
186
|
-
var
|
|
191
|
+
var _this3 = this;
|
|
187
192
|
|
|
188
193
|
var _this$props = this.props,
|
|
189
194
|
recoverAble = _this$props.recoverAble,
|
|
@@ -193,19 +198,19 @@ function (_PureComponent) {
|
|
|
193
198
|
var current = this.props.value[index];
|
|
194
199
|
var startRemove = typeof beforeRemove === 'function' ? beforeRemove(current) : Promise.resolve();
|
|
195
200
|
startRemove.then(function () {
|
|
196
|
-
|
|
197
|
-
draft.recycle.push(
|
|
201
|
+
_this3.setState((0, _immer.default)(function (draft) {
|
|
202
|
+
draft.recycle.push(_this3.props.value[index]);
|
|
198
203
|
|
|
199
204
|
if (typeof recoverAble === 'number' && draft.recycle.length > recoverAble) {
|
|
200
205
|
draft.recycle.shift();
|
|
201
206
|
}
|
|
202
207
|
}));
|
|
203
208
|
|
|
204
|
-
var value = (0, _immer.default)(
|
|
209
|
+
var value = (0, _immer.default)(_this3.props.value, function (draft) {
|
|
205
210
|
draft.splice(index, 1);
|
|
206
211
|
});
|
|
207
212
|
|
|
208
|
-
|
|
213
|
+
_this3.props.onChange(value);
|
|
209
214
|
}).catch(function () {});
|
|
210
215
|
};
|
|
211
216
|
|
|
@@ -314,7 +319,7 @@ function (_PureComponent) {
|
|
|
314
319
|
var _addFile = (0, _asyncToGenerator2.default)(
|
|
315
320
|
/*#__PURE__*/
|
|
316
321
|
_regenerator.default.mark(function _callee2(e) {
|
|
317
|
-
var
|
|
322
|
+
var _this4 = this;
|
|
318
323
|
|
|
319
324
|
var _this$props3, beforeUpload, value, limit, filesFilter, files, finishedCode, fileList, addLength, list, _loop, i, _ret;
|
|
320
325
|
|
|
@@ -360,7 +365,7 @@ function (_PureComponent) {
|
|
|
360
365
|
files[id] = file; // eslint-disable-next-line no-await-in-loop
|
|
361
366
|
|
|
362
367
|
_context2.next = 6;
|
|
363
|
-
return
|
|
368
|
+
return _this4.useValidator(blob);
|
|
364
369
|
|
|
365
370
|
case 6:
|
|
366
371
|
error = _context2.sent;
|
|
@@ -370,7 +375,7 @@ function (_PureComponent) {
|
|
|
370
375
|
break;
|
|
371
376
|
}
|
|
372
377
|
|
|
373
|
-
if (
|
|
378
|
+
if (_this4.validatorHandle(error, file.blob)) {
|
|
374
379
|
_context2.next = 11;
|
|
375
380
|
break;
|
|
376
381
|
}
|
|
@@ -383,10 +388,10 @@ function (_PureComponent) {
|
|
|
383
388
|
file.status = _request.ERROR;
|
|
384
389
|
|
|
385
390
|
if (beforeUpload) {
|
|
386
|
-
beforeUpload(blob,
|
|
391
|
+
beforeUpload(blob, _this4.validatorHandle) // eslint-disable-next-line no-loop-func
|
|
387
392
|
.then(function (args) {
|
|
388
393
|
if (finishedCode) {
|
|
389
|
-
|
|
394
|
+
_this4.setState((0, _immer.default)(function (draft) {
|
|
390
395
|
draft.files[id] = Object.assign({}, draft.files[id], args);
|
|
391
396
|
}));
|
|
392
397
|
} else {
|
|
@@ -401,12 +406,12 @@ function (_PureComponent) {
|
|
|
401
406
|
|
|
402
407
|
case 15:
|
|
403
408
|
if (beforeUpload) {
|
|
404
|
-
beforeUpload(blob,
|
|
409
|
+
beforeUpload(blob, _this4.validatorHandle) // eslint-disable-next-line no-loop-func
|
|
405
410
|
.then(function (args) {
|
|
406
|
-
if (args.status !== _request.ERROR) files[id].xhr =
|
|
411
|
+
if (args.status !== _request.ERROR) files[id].xhr = _this4.uploadFile(id, blob, args.data);
|
|
407
412
|
|
|
408
413
|
if (finishedCode) {
|
|
409
|
-
|
|
414
|
+
_this4.setState((0, _immer.default)(function (draft) {
|
|
410
415
|
draft.files[id] = Object.assign({}, draft.files[id], args);
|
|
411
416
|
}));
|
|
412
417
|
} else {
|
|
@@ -415,7 +420,7 @@ function (_PureComponent) {
|
|
|
415
420
|
}) // eslint-disable-next-line no-loop-func
|
|
416
421
|
.catch(function () {
|
|
417
422
|
if (finishedCode) {
|
|
418
|
-
|
|
423
|
+
_this4.setState((0, _immer.default)(function (draft) {
|
|
419
424
|
delete draft.files[id];
|
|
420
425
|
}));
|
|
421
426
|
} else {
|
|
@@ -423,7 +428,7 @@ function (_PureComponent) {
|
|
|
423
428
|
}
|
|
424
429
|
});
|
|
425
430
|
} else {
|
|
426
|
-
files[id].xhr =
|
|
431
|
+
files[id].xhr = _this4.uploadFile(id, blob);
|
|
427
432
|
}
|
|
428
433
|
|
|
429
434
|
case 16:
|
|
@@ -462,6 +467,8 @@ function (_PureComponent) {
|
|
|
462
467
|
finishedCode = true;
|
|
463
468
|
this.setState({
|
|
464
469
|
files: files
|
|
470
|
+
}, function () {
|
|
471
|
+
_this4.updateValidate();
|
|
465
472
|
});
|
|
466
473
|
|
|
467
474
|
case 21:
|
|
@@ -480,7 +487,7 @@ function (_PureComponent) {
|
|
|
480
487
|
}();
|
|
481
488
|
|
|
482
489
|
_proto.uploadFile = function uploadFile(id, file, data) {
|
|
483
|
-
var
|
|
490
|
+
var _this5 = this;
|
|
484
491
|
|
|
485
492
|
var _this$props4 = this.props,
|
|
486
493
|
onSuccess = _this$props4.onSuccess,
|
|
@@ -514,14 +521,14 @@ function (_PureComponent) {
|
|
|
514
521
|
throttle = false;
|
|
515
522
|
}, 16);
|
|
516
523
|
|
|
517
|
-
if (
|
|
518
|
-
|
|
524
|
+
if (_this5.state.files[id]) {
|
|
525
|
+
_this5.setState((0, _immer.default)(function (draft) {
|
|
519
526
|
draft.files[id].process = percent;
|
|
520
527
|
if (msg) draft.files[id].message = msg;
|
|
521
528
|
}), // expose the file progress to Upload.Button
|
|
522
529
|
function () {
|
|
523
530
|
if (typeof _onProgress === 'function') {
|
|
524
|
-
_onProgress(
|
|
531
|
+
_onProgress(_this5.state.files[id]);
|
|
525
532
|
}
|
|
526
533
|
});
|
|
527
534
|
}
|
|
@@ -529,7 +536,7 @@ function (_PureComponent) {
|
|
|
529
536
|
onSuccess: onSuccess,
|
|
530
537
|
onLoad: function onLoad(xhr) {
|
|
531
538
|
if (!/^2|1223/.test(xhr.status)) {
|
|
532
|
-
|
|
539
|
+
_this5.handleError(id, xhr, file);
|
|
533
540
|
|
|
534
541
|
return;
|
|
535
542
|
}
|
|
@@ -543,26 +550,26 @@ function (_PureComponent) {
|
|
|
543
550
|
}
|
|
544
551
|
|
|
545
552
|
if (value instanceof Error) {
|
|
546
|
-
|
|
553
|
+
_this5.setState((0, _immer.default)(function (draft) {
|
|
547
554
|
draft.files[id].status = _request.ERROR;
|
|
548
555
|
draft.files[id].name = file.name;
|
|
549
556
|
draft.files[id].message = value.message;
|
|
550
557
|
}));
|
|
551
558
|
} else {
|
|
552
|
-
|
|
559
|
+
_this5.setState((0, _immer.default)(function (draft) {
|
|
553
560
|
delete draft.files[id];
|
|
554
561
|
})); // add value
|
|
555
562
|
|
|
556
563
|
|
|
557
|
-
var values = (0, _immer.default)(
|
|
564
|
+
var values = (0, _immer.default)(_this5.props.value, function (draft) {
|
|
558
565
|
draft.push(value);
|
|
559
566
|
});
|
|
560
567
|
|
|
561
|
-
|
|
568
|
+
_this5.props.onChange(values);
|
|
562
569
|
}
|
|
563
570
|
},
|
|
564
571
|
onError: function onError(xhr) {
|
|
565
|
-
return
|
|
572
|
+
return _this5.handleError(id, xhr, file);
|
|
566
573
|
}
|
|
567
574
|
};
|
|
568
575
|
|
|
@@ -581,11 +588,11 @@ function (_PureComponent) {
|
|
|
581
588
|
};
|
|
582
589
|
|
|
583
590
|
_proto.handleReplace = function handleReplace(files, index) {
|
|
584
|
-
var
|
|
591
|
+
var _this6 = this;
|
|
585
592
|
|
|
586
593
|
this.removeValue(index);
|
|
587
594
|
setTimeout(function () {
|
|
588
|
-
|
|
595
|
+
_this6.addFile({
|
|
589
596
|
files: files,
|
|
590
597
|
fromDragger: true
|
|
591
598
|
});
|
|
@@ -593,6 +600,8 @@ function (_PureComponent) {
|
|
|
593
600
|
};
|
|
594
601
|
|
|
595
602
|
_proto.handleError = function handleError(id, xhr, file) {
|
|
603
|
+
var _this7 = this;
|
|
604
|
+
|
|
596
605
|
var _this$props5 = this.props,
|
|
597
606
|
onError = _this$props5.onError,
|
|
598
607
|
onHttpError = _this$props5.onHttpError;
|
|
@@ -603,7 +612,14 @@ function (_PureComponent) {
|
|
|
603
612
|
if (!draft.files[id]) return;
|
|
604
613
|
draft.files[id].status = _request.ERROR;
|
|
605
614
|
draft.files[id].message = message;
|
|
606
|
-
}))
|
|
615
|
+
}), function () {
|
|
616
|
+
_this7.updateValidate();
|
|
617
|
+
});
|
|
618
|
+
};
|
|
619
|
+
|
|
620
|
+
_proto.updateValidate = function updateValidate() {
|
|
621
|
+
var forceValidate = this.props.forceValidate;
|
|
622
|
+
forceValidate();
|
|
607
623
|
};
|
|
608
624
|
|
|
609
625
|
_proto.renderHandle = function renderHandle() {
|
|
@@ -646,7 +662,7 @@ function (_PureComponent) {
|
|
|
646
662
|
};
|
|
647
663
|
|
|
648
664
|
_proto.render = function render() {
|
|
649
|
-
var
|
|
665
|
+
var _this8 = this;
|
|
650
666
|
|
|
651
667
|
var _this$props7 = this.props,
|
|
652
668
|
limit = _this$props7.limit,
|
|
@@ -697,7 +713,7 @@ function (_PureComponent) {
|
|
|
697
713
|
accept: accept,
|
|
698
714
|
dropData: i,
|
|
699
715
|
disabled: disabled,
|
|
700
|
-
onDrop:
|
|
716
|
+
onDrop: _this8.handleReplace
|
|
701
717
|
}, _react.default.createElement(ResultComponent, {
|
|
702
718
|
renderContent: renderContent,
|
|
703
719
|
value: v,
|
|
@@ -705,7 +721,7 @@ function (_PureComponent) {
|
|
|
705
721
|
index: i,
|
|
706
722
|
style: imageStyle,
|
|
707
723
|
renderResult: renderResult,
|
|
708
|
-
onRemove:
|
|
724
|
+
onRemove: _this8.getCanDelete(v, i) ? _this8.removeValue : undefined,
|
|
709
725
|
removeConfirm: removeConfirm,
|
|
710
726
|
onPreview: onPreview
|
|
711
727
|
}));
|
|
@@ -714,7 +730,7 @@ function (_PureComponent) {
|
|
|
714
730
|
key: id,
|
|
715
731
|
id: id,
|
|
716
732
|
style: imageStyle,
|
|
717
|
-
onRemove:
|
|
733
|
+
onRemove: _this8.removeFile
|
|
718
734
|
}));
|
|
719
735
|
}), imageStyle && !leftHandler && this.renderHandle(), recoverAble && recycle.map(function (v, i) {
|
|
720
736
|
return _react.default.createElement(ResultComponent, {
|
|
@@ -726,7 +742,7 @@ function (_PureComponent) {
|
|
|
726
742
|
renderResult: renderResult,
|
|
727
743
|
recoverAble: !!recoverAble,
|
|
728
744
|
showRecover: recoverAble && limit > value.length,
|
|
729
|
-
onRecover:
|
|
745
|
+
onRecover: _this8.recoverValue,
|
|
730
746
|
style: imageStyle
|
|
731
747
|
});
|
|
732
748
|
})));
|
|
@@ -759,6 +775,7 @@ Upload.propTypes = {
|
|
|
759
775
|
request: _propTypes.default.func,
|
|
760
776
|
validateHook: _propTypes.default.func,
|
|
761
777
|
validator: _propTypes.default.object,
|
|
778
|
+
forceValidate: _propTypes.default.func,
|
|
762
779
|
value: _propTypes.default.array,
|
|
763
780
|
customResult: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
|
|
764
781
|
style: _propTypes.default.object,
|
package/css/hoc/delay.js
CHANGED
package/css/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Created by scripts/src-index.js.
|
|
2
2
|
import * as utils from './utils'
|
|
3
3
|
|
|
4
|
-
export default { utils, version: '1.10.12
|
|
4
|
+
export default { utils, version: '1.10.12' }
|
|
5
5
|
export { utils }
|
|
6
6
|
export { setLocale } from './locale'
|
|
7
7
|
export { color, style } from './utils/expose'
|
package/css/index.js
CHANGED
package/css/utils/cleanProps.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.default = cleanProps;
|
|
|
7
7
|
|
|
8
8
|
var _immer = _interopRequireDefault(require("immer"));
|
|
9
9
|
|
|
10
|
-
var names = ['delay', 'onDatumBind', 'rules', 'formDatum', 'forceChange', 'trim', 'beforeChange', 'validateHook', 'innerFormNamePath', 'fieldSetValidate', 'combineRules', 'popoverProps', 'inputFocus', 'placeTitle', 'cancelChange', 'integerLimit', 'autoSelect', 'autoFix', 'numType'];
|
|
10
|
+
var names = ['delay', 'onDatumBind', 'rules', 'formDatum', 'forceChange', 'trim', 'beforeChange', 'validateHook', 'innerFormNamePath', 'fieldSetValidate', 'combineRules', 'popoverProps', 'inputFocus', 'placeTitle', 'cancelChange', 'integerLimit', 'autoSelect', 'autoFix', 'numType', 'forceValidate'];
|
|
11
11
|
/**
|
|
12
12
|
* delete some props if needed, will not modify the pass argument
|
|
13
13
|
* @param props
|