shineout 2.0.0-rc.6 → 2.0.0-rc.7

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.
@@ -31,6 +31,8 @@ var _is = require("../utils/is");
31
31
 
32
32
  var _Input = _interopRequireDefault(require("../Input"));
33
33
 
34
+ var _Spin = _interopRequireDefault(require("../Spin"));
35
+
34
36
  var _styles = require("./styles");
35
37
 
36
38
  var _config = require("../config");
@@ -154,11 +156,13 @@ function checkItem(type) {
154
156
  size = _this$props5.size,
155
157
  children = _this$props5.children,
156
158
  inputable = _this$props5.inputable,
157
- onClick = _this$props5.onClick;
159
+ onClick = _this$props5.onClick,
160
+ loading = _this$props5.loading;
158
161
  var rtl = (0, _config.isRTL)();
159
162
  var checked = this.getChecked();
160
163
  var isSwitch = type === 'switch';
161
- var className = (0, _classnames.default)((0, _styles.checkinputClass)('_', disabled && 'disabled', checked === true && 'checked', checked === 'indeterminate' && 'indeterminate', isSwitch && 'switch', type + "-container", rtl && 'rtl', {
164
+ var ban = disabled || isSwitch && loading;
165
+ var className = (0, _classnames.default)((0, _styles.checkinputClass)('_', ban && 'disabled', checked === true && 'checked', checked === 'indeterminate' && 'indeterminate', isSwitch && 'switch', loading && 'loading', type + "-container", rtl && 'rtl', {
162
166
  large: size === 'large',
163
167
  small: size === 'small'
164
168
  }), this.props.className);
@@ -180,10 +184,10 @@ function checkItem(type) {
180
184
  ref: this.bindRef
181
185
  /* @ts-ignore */
182
186
  ,
183
- disabled: disabled
187
+ disabled: ban
184
188
  }, (0, _getDataset.default)(this.props)), switchChildren, _react.default.createElement("input", {
185
189
  id: this.id,
186
- disabled: disabled,
190
+ disabled: ban,
187
191
  tabIndex: -1,
188
192
  type: isSwitch ? 'checkbox' : type,
189
193
  onClick: onClick,
@@ -199,7 +203,11 @@ function checkItem(type) {
199
203
  value: value
200
204
  }), isSwitch && _react.default.createElement("span", {
201
205
  className: (0, _styles.checkinputClass)((0, _classname.getDirectionClass)('switch-indicator'))
202
- }));
206
+ }, loading ? _react.default.createElement(_Spin.default, {
207
+ size: "auto",
208
+ color: "none",
209
+ name: "ring"
210
+ }) : null));
203
211
  };
204
212
 
205
213
  return CheckItem;
@@ -15,6 +15,15 @@ export interface CheckItemProps extends StandardProps {
15
15
  * default: false
16
16
  */
17
17
  disabled?: boolean;
18
+ /**
19
+ *
20
+ * loading
21
+ *
22
+ * 加载中
23
+ *
24
+ * default: false
25
+ */
26
+ loading?: boolean;
18
27
  /**
19
28
  * if not set, use (value === htmlValue).
20
29
  *
@@ -61,10 +70,10 @@ export interface CheckItemProps extends StandardProps {
61
70
  size?: 'small' | 'default' | 'large';
62
71
  content?: [ReactNode, ReactNode] | [];
63
72
  }
64
- export declare type SimpleCheckProps = Omit<CheckItemProps, 'content' | 'onChange'> & {
73
+ export declare type SimpleCheckProps = Omit<CheckItemProps, 'content' | 'onChange' | 'loading'> & {
65
74
  onChange?: ((value: any, checked: CheckValueType, index?: number) => void);
66
75
  };
67
- export declare type SimpleRadioProps = Omit<CheckItemProps, 'content' | 'onChange' | 'onRawChange' | 'inputable' | 'value'> & {
76
+ export declare type SimpleRadioProps = Omit<CheckItemProps, 'content' | 'onChange' | 'onRawChange' | 'inputable' | 'value' | 'loading'> & {
68
77
  checked?: boolean | ((htmlValue: any) => boolean);
69
78
  onChange?: ((value: any, checked: CheckValueType, index?: number) => void);
70
79
  };
@@ -393,11 +393,22 @@ fieldset[disabled] .so-checkinput-button .so-checkinput.so-checkinput-checked:ac
393
393
  border-radius: 50%;
394
394
  -webkit-box-shadow: 0 1px 4px var(--gray-500, #adb5bd);
395
395
  box-shadow: 0 1px 4px var(--gray-500, #adb5bd);
396
+ font-size: var(--switch-indicator-size, 24px);
397
+ color: var(--switch-unchecked-bg, #ced4da);
396
398
  }
397
399
  .so-checkinput-rtl .so-checkinput-switch-indicator {
398
400
  left: auto;
399
401
  right: var(--switch-indicator-padding-horizontal, 0px);
400
402
  }
403
+ .so-checkinput-loading .so-checkinput-switch-indicator .so-spin-ring {
404
+ position: absolute;
405
+ top: 12%;
406
+ left: 12%;
407
+ right: 12%;
408
+ bottom: 12%;
409
+ border-width: 0.12em;
410
+ border-top-color: currentColor;
411
+ }
401
412
  .so-checkinput-switch-children {
402
413
  font-size: 12px;
403
414
  color: #fff;
@@ -416,6 +427,7 @@ fieldset[disabled] .so-checkinput-button .so-checkinput.so-checkinput-checked:ac
416
427
  -webkit-box-shadow: var(--switch-checked-box-shadow, 0 1px 4px var(--primary-color-fade-50, rgba(51, 153, 255, 0.5)));
417
428
  box-shadow: var(--switch-checked-box-shadow, 0 1px 4px var(--primary-color-fade-50, rgba(51, 153, 255, 0.5)));
418
429
  background: var(--switch-indicator-checked-bg, var(--primary-color, #3399ff));
430
+ color: var(--switch-checked-bg, var(--primary-color-fade-50, rgba(51, 153, 255, 0.5)));
419
431
  }
420
432
  .so-checkinput-checked.so-checkinput-switch .so-checkinput-switch-indicator-ltr {
421
433
  left: 100%;
@@ -465,6 +477,7 @@ fieldset[disabled] .so-checkinput-button .so-checkinput.so-checkinput-checked:ac
465
477
  top: var(--switch-small-indicator-top, -3px);
466
478
  padding-left: 8px;
467
479
  padding-right: 8px;
480
+ font-size: var(--switch-small-indicator-size, 16px);
468
481
  }
469
482
  .so-checkinput-large.so-checkinput-switch {
470
483
  min-width: 60px;
@@ -482,6 +495,7 @@ fieldset[disabled] .so-checkinput-button .so-checkinput.so-checkinput-checked:ac
482
495
  width: var(--switch-large-indicator-size, 32px);
483
496
  height: var(--switch-large-indicator-size, 32px);
484
497
  top: var(--switch-large-indicator-top, -5px);
498
+ font-size: var(--switch-large-indicator-size, 32px);
485
499
  }
486
500
  .so-checkinput-disabled.so-checkinput-switch {
487
501
  opacity: 0.4;
package/css/index.js CHANGED
@@ -220,6 +220,6 @@ exports.Upload = _Upload.default;
220
220
  // Created by scripts/src-index.js.
221
221
  var _default = {
222
222
  utils: utils,
223
- version: '2.0.0-rc.6'
223
+ version: '2.0.0-rc.7'
224
224
  };
225
225
  exports.default = _default;
@@ -18,6 +18,20 @@ var cloneObject = function cloneObject(source, specialKeys) {
18
18
  }
19
19
 
20
20
  var target = Object.create(Object.getPrototypeOf(source));
21
+ /* File or Response (non-serializable data) will throw error */
22
+
23
+ try {
24
+ // eslint-disable-next-line guard-for-in
25
+ for (var key in target) {
26
+ target[key] = target[key];
27
+ }
28
+ } catch (e) {
29
+ console.error('should not pass non-serializable data', source);
30
+ console.error(e);
31
+ target = {};
32
+ }
33
+
34
+ ;
21
35
  [].concat(specialKeys, Object.keys(source)).forEach(function (k) {
22
36
  // eslint-disable-next-line
23
37
  target[k] = deepClone(source[k]);