shineout 2.0.0 → 2.0.2

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.
Files changed (55) hide show
  1. package/css/Cascader/Cascader.js +3 -2
  2. package/css/DatePicker/Container.js +3 -2
  3. package/css/DatePicker/Props.d.ts +4 -0
  4. package/css/Form/Props.d.ts +1 -1
  5. package/css/Form/inputable.js +2 -1
  6. package/css/Select/Props.d.ts +5 -1
  7. package/css/Select/Select.js +4 -5
  8. package/css/Textarea/Textarea.d.ts +1 -1
  9. package/css/Textarea/interface.d.ts +1 -1
  10. package/css/index.js +1 -1
  11. package/css/utils/expose.d.ts +3 -1
  12. package/css/utils/expose.js +24 -5
  13. package/css/utils/validate/range.js +0 -2
  14. package/css/utils/vars-inject.d.ts +0 -2
  15. package/css/utils/vars-inject.js +0 -10
  16. package/dist/shineout.js +9658 -9496
  17. package/dist/shineout.js.map +1 -1
  18. package/dist/shineout.min.js +1 -1
  19. package/es/Cascader/Cascader.js +3 -2
  20. package/es/DatePicker/Container.js +3 -2
  21. package/es/DatePicker/Props.d.ts +4 -0
  22. package/es/Form/Props.d.ts +1 -1
  23. package/es/Form/inputable.js +2 -1
  24. package/es/Select/Props.d.ts +5 -1
  25. package/es/Select/Select.js +4 -5
  26. package/es/Textarea/Textarea.d.ts +1 -1
  27. package/es/Textarea/interface.d.ts +1 -1
  28. package/es/index.js +1 -1
  29. package/es/utils/expose.d.ts +3 -1
  30. package/es/utils/expose.js +20 -4
  31. package/es/utils/validate/range.js +0 -2
  32. package/es/utils/vars-inject.d.ts +0 -2
  33. package/es/utils/vars-inject.js +0 -6
  34. package/lib/Cascader/Cascader.js +3 -2
  35. package/lib/DatePicker/Container.js +3 -2
  36. package/lib/DatePicker/Props.d.ts +4 -0
  37. package/lib/Form/Props.d.ts +1 -1
  38. package/lib/Form/inputable.js +2 -1
  39. package/lib/Select/Props.d.ts +5 -1
  40. package/lib/Select/Select.js +4 -5
  41. package/lib/Textarea/Textarea.d.ts +1 -1
  42. package/lib/Textarea/interface.d.ts +1 -1
  43. package/lib/index.js +1 -1
  44. package/lib/utils/expose.d.ts +3 -1
  45. package/lib/utils/expose.js +24 -5
  46. package/lib/utils/validate/range.js +0 -2
  47. package/lib/utils/vars-inject.d.ts +0 -2
  48. package/lib/utils/vars-inject.js +0 -10
  49. package/package.json +1 -1
  50. /package/css/Textarea/{props.d.ts → Props.d.ts} +0 -0
  51. /package/css/Textarea/{props.js → Props.js} +0 -0
  52. /package/es/Textarea/{props.d.ts → Props.d.ts} +0 -0
  53. /package/es/Textarea/{props.js → Props.js} +0 -0
  54. /package/lib/Textarea/{props.d.ts → Props.d.ts} +0 -0
  55. /package/lib/Textarea/{props.js → Props.js} +0 -0
@@ -181,12 +181,13 @@ function (_PureComponent) {
181
181
  };
182
182
 
183
183
  _proto.setOpenEvent = function setOpenEvent() {
184
- if (this.lastFoucs !== this.focus) if (this.focus) {
184
+ var focus = this.focus || this.props.inputFocus;
185
+ if (this.lastFoucs !== focus) if (focus) {
185
186
  this.bindClickAway();
186
187
  } else if (this.lastFoucs !== undefined) {
187
188
  this.clearClickAway();
188
189
  }
189
- this.lastFoucs = this.focus;
190
+ this.lastFoucs = focus;
190
191
  };
191
192
 
192
193
  _proto.bindRef = function bindRef(el) {
@@ -135,12 +135,13 @@ function (_PureComponent) {
135
135
  };
136
136
 
137
137
  _proto.setOpenEvent = function setOpenEvent() {
138
- if (this.lastFoucs !== this.focus) if (this.focus) {
138
+ var focus = this.focus || this.props.inputFocus;
139
+ if (this.lastFoucs !== focus) if (focus) {
139
140
  this.bindClickAway();
140
141
  } else if (this.lastFoucs !== undefined) {
141
142
  this.clearClickAway();
142
143
  }
143
- this.lastFoucs = this.focus;
144
+ this.lastFoucs = focus;
144
145
  };
145
146
 
146
147
  _proto.getOptions = function getOptions() {
@@ -180,6 +180,10 @@ export interface BaseProps<Value = DatePickerValue> extends StandardProps, Pick<
180
180
  onCollapse?: (collapse: boolean) => void;
181
181
  }
182
182
  export interface ContainerProps<T = DatePickerValue> extends Pick<BaseProps, 'disabled' | 'format' | 'formatResult' | 'inputable' | 'placeholder' | 'position' | 'range' | 'size' | 'type' | 'allowSingle' | 'defaultTime' | 'absolute' | 'zIndex' | 'quickSelect' | 'min' | 'max' | 'defaultRangeMonth' | 'defaultPickerValue' | 'hourStep' | 'minuteStep' | 'secondStep' | 'onPickerChange' | 'disabledTime' | 'align' | 'clearable' | 'clearWithUndefined' | 'innerTitle' | 'timeZone' | 'open' | 'onCollapse'> {
183
+ /**
184
+ * @inner 内部属性
185
+ */
186
+ inputFocus: boolean;
183
187
  /**
184
188
  * @en When the value is string, it needs to match the format attribute.\n When the range property is true, the value is an array of length 2.
185
189
  * @cn 值为 string 时,需要和 format 属性匹配。\n 非 string 会格式化为 string。\n range 属性为 true 时,值为长度为2的数组
@@ -476,7 +476,7 @@ export declare class Form<Value> extends React.Component<FormProps<Value>, any>
476
476
  export declare type FormCompType = typeof Form;
477
477
  export declare type FormItemWithFormConsumerKeys = 'formDatum' | 'labelWidth' | 'labelAlign' | 'labelVerticalAlign' | 'keepErrorHeight';
478
478
  /**
479
- * @title From.Item
479
+ * @title Form.Item
480
480
  * @cn 表单项,主要用来布局,显示标签,提示文案信息等
481
481
  * @en Used to layout, display labels, tips, errors, etc
482
482
  */
@@ -375,8 +375,9 @@ export default (function (Origin) {
375
375
  unbindInputFromItem = _this$props10.unbindInputFromItem,
376
376
  scuSkip = _this$props10.scuSkip,
377
377
  defaultValue = _this$props10.defaultValue,
378
+ rules = _this$props10.rules,
378
379
  reserveAble = _this$props10.reserveAble,
379
- other = _objectWithoutPropertiesLoose(_this$props10, ["formDatum", "value", "required", "bind", "onItemError", "bindInputToItem", "unbindInputFromItem", "scuSkip", "defaultValue", "reserveAble"]);
380
+ other = _objectWithoutPropertiesLoose(_this$props10, ["formDatum", "value", "required", "bind", "onItemError", "bindInputToItem", "unbindInputFromItem", "scuSkip", "defaultValue", "rules", "reserveAble"]);
380
381
 
381
382
  return React.createElement(Origin, _extends({}, other, {
382
383
  formDatum: formDatum,
@@ -11,6 +11,10 @@ declare type ReactNode = React.ReactNode;
11
11
  declare type ReactElement = React.ReactElement;
12
12
  declare type ExpandTreeKeys = 'onExpand' | 'expanded' | 'defaultExpanded' | 'defaultExpandAll' | 'expandIcons' | 'loader' | 'childrenKey';
13
13
  export interface BaseSelectProps<DataItem, Value> extends StandardProps, Pick<AbsoluteProps, 'absolute' | 'zIndex'>, Pick<InputableProps<Value>, 'formDatum'>, Pick<TreeProps<DataItem, ValueArr<Value>>, ExpandTreeKeys> {
14
+ /**
15
+ * @inner 内部属性
16
+ */
17
+ inputFocus: boolean;
14
18
  /**
15
19
  * @en Form field, used with Form
16
20
  * @cn 表单字段, 配合 Form 使用
@@ -379,7 +383,7 @@ export interface UnMatchedValue<Value> {
379
383
  }
380
384
  export declare type ResultValue<Value> = Value | UnMatchedValue<Value>;
381
385
  /** ---------- result ---------- */
382
- export interface ResultProps<Item, Value> extends Omit<BaseSelectProps<Item, Value>, 'renderItem' | 'onChange' | 'onBlur' | 'onFocus' | 'groupKey' | 'innerData' | 'value'> {
386
+ export interface ResultProps<Item, Value> extends Omit<BaseSelectProps<Item, Value>, 'renderItem' | 'onChange' | 'onBlur' | 'onFocus' | 'groupKey' | 'innerData' | 'value' | 'inputFocus'> {
383
387
  datum: List<Item, Value>;
384
388
  filterText?: string;
385
389
  focus: boolean;
@@ -175,12 +175,13 @@ function (_PureComponent) {
175
175
  };
176
176
 
177
177
  _proto.setOpenEvent = function setOpenEvent() {
178
- if (this.lastFoucs !== this.focus) if (this.focus) {
178
+ var focus = this.focus || this.props.inputFocus;
179
+ if (this.lastFoucs !== focus) if (focus) {
179
180
  this.bindClickAway();
180
181
  } else if (this.lastFoucs !== undefined) {
181
182
  this.clearClickAway();
182
183
  }
183
- this.lastFoucs = this.focus;
184
+ this.lastFoucs = focus;
184
185
  };
185
186
 
186
187
  _proto.getDisabledStatus = function getDisabledStatus() {
@@ -247,8 +248,7 @@ function (_PureComponent) {
247
248
  if (!desc) {
248
249
  if (!getParent(e.target, "[data-id=" + this.selectId + "]")) {
249
250
  this.blured = true;
250
- this.props.onBlur(); // this.clearClickAway()
251
-
251
+ this.props.onBlur();
252
252
  if (this.element) this.element.blur();
253
253
  }
254
254
 
@@ -370,7 +370,6 @@ function (_PureComponent) {
370
370
  _proto.handleFocus = function handleFocus(e) {
371
371
  if (!this.shouldFocus(e.target)) return;
372
372
  this.props.onFocus(e);
373
- this.bindClickAway();
374
373
  };
375
374
 
376
375
  _proto.handleInputFocus = function handleInputFocus() {
@@ -1,6 +1,6 @@
1
1
  import { ChangeEvent, KeyboardEvent, FocusEvent } from 'react';
2
2
  import { PureComponent } from '../component';
3
- import { OriginTextareaProps } from './props';
3
+ import { OriginTextareaProps } from './Props';
4
4
  interface TextareaState {
5
5
  height: number;
6
6
  }
@@ -1 +1 @@
1
- export { TextareaProps as Props } from './props';
1
+ export { TextareaProps as Props } from './Props';
package/es/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import * as utils from './utils';
3
3
  export default {
4
4
  utils: utils,
5
- version: '2.0.0'
5
+ version: '2.0.2'
6
6
  };
7
7
  export { utils };
8
8
  export { setLocale } from './locale';
@@ -1,10 +1,12 @@
1
1
  import { cleanCache } from './css-accessors';
2
- import { setInjectType, getInjectType, ThemeConfig } from './vars-inject';
2
+ import { ThemeConfig } from './vars-inject';
3
3
  declare const types: string[];
4
4
  declare type ObjectProps = {
5
5
  [x: string]: any;
6
6
  };
7
7
  declare function getClassname(data: ObjectProps): string;
8
+ declare function getInjectType(): "body" | "tag";
9
+ declare function setInjectType(type: ThemeConfig['injectType']): void;
8
10
  declare function setStyle(options: ObjectProps, custom?: ObjectProps, config?: Partial<ThemeConfig>): () => void;
9
11
  declare const style: {
10
12
  getClassname: typeof getClassname;
@@ -1,9 +1,10 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread";
1
2
  import { isObject } from './is';
2
3
  import { exposeClass } from '../styles/expose';
3
4
  import cssAccessors, { cleanCache } from './css-accessors';
4
5
  import { capitalize } from './strings';
5
6
  import { entries } from './objects';
6
- import { setInjectType, injectTag, getInjectType, cleanStyleObj, setThemeConfig } from './vars-inject';
7
+ import { injectTag, cleanStyleObj, setThemeConfig } from './vars-inject';
7
8
  var types = ['primary', 'warning', 'danger', 'success', 'secondary'];
8
9
  var attrs = ['background', 'color', 'border'];
9
10
 
@@ -50,12 +51,27 @@ function resetTheme() {
50
51
  });
51
52
  }
52
53
 
54
+ var defaultInjectType;
55
+
56
+ function getInjectType() {
57
+ return defaultInjectType;
58
+ }
59
+
60
+ function setInjectType(type) {
61
+ defaultInjectType = type;
62
+ }
63
+
53
64
  function setStyle(options, custom, config) {
54
65
  if (config === void 0) {
55
- config = {};
66
+ config = {
67
+ target: 'body'
68
+ };
56
69
  }
57
70
 
58
- setThemeConfig(config);
71
+ var injectType = config.injectType || getInjectType() || 'body';
72
+ setThemeConfig(_objectSpread({}, config, {
73
+ injectType: injectType
74
+ }));
59
75
  cleanStyleObj();
60
76
 
61
77
  if (!options) {
@@ -82,7 +98,7 @@ function setStyle(options, custom, config) {
82
98
  }
83
99
  }
84
100
 
85
- if (config.injectType === 'tag') {
101
+ if (injectType === 'tag') {
86
102
  var id = injectTag(custom);
87
103
  return function () {
88
104
  var target = document.getElementById(id);
@@ -20,10 +20,8 @@ export default (function (options) {
20
20
 
21
21
  if (typeof min === 'number' && val < min || typeof max === 'number' && val > max) {
22
22
  callback(new Error(message));
23
- return;
24
23
  } else {
25
24
  callback(true);
26
- return;
27
25
  }
28
26
  });
29
27
  });
@@ -8,8 +8,6 @@ export interface ThemeConfig {
8
8
  */
9
9
  target?: string | HTMLElement | (() => HTMLElement);
10
10
  }
11
- export declare function getInjectType(): "body" | "tag";
12
- export declare function setInjectType(type: ThemeConfig['injectType']): void;
13
11
  export declare function setThemeConfig(c: Partial<ThemeConfig>): void;
14
12
  export declare function getThemeConfig(name: keyof ThemeConfig): string | HTMLElement | (() => HTMLElement) | undefined;
15
13
  export declare function getThemeTarget(): HTMLElement;
@@ -28,12 +28,6 @@ var config = {
28
28
  };
29
29
  var computedCache = {};
30
30
  var styleObj = {};
31
- export function getInjectType() {
32
- return config.injectType;
33
- }
34
- export function setInjectType(type) {
35
- config.injectType = type;
36
- }
37
31
  export function setThemeConfig(c) {
38
32
  Object.keys(c).forEach(function (key) {
39
33
  if (key in config) {
@@ -193,12 +193,13 @@ function (_PureComponent) {
193
193
  };
194
194
 
195
195
  _proto.setOpenEvent = function setOpenEvent() {
196
- if (this.lastFoucs !== this.focus) if (this.focus) {
196
+ var focus = this.focus || this.props.inputFocus;
197
+ if (this.lastFoucs !== focus) if (focus) {
197
198
  this.bindClickAway();
198
199
  } else if (this.lastFoucs !== undefined) {
199
200
  this.clearClickAway();
200
201
  }
201
- this.lastFoucs = this.focus;
202
+ this.lastFoucs = focus;
202
203
  };
203
204
 
204
205
  _proto.bindRef = function bindRef(el) {
@@ -158,12 +158,13 @@ function (_PureComponent) {
158
158
  };
159
159
 
160
160
  _proto.setOpenEvent = function setOpenEvent() {
161
- if (this.lastFoucs !== this.focus) if (this.focus) {
161
+ var focus = this.focus || this.props.inputFocus;
162
+ if (this.lastFoucs !== focus) if (focus) {
162
163
  this.bindClickAway();
163
164
  } else if (this.lastFoucs !== undefined) {
164
165
  this.clearClickAway();
165
166
  }
166
- this.lastFoucs = this.focus;
167
+ this.lastFoucs = focus;
167
168
  };
168
169
 
169
170
  _proto.getOptions = function getOptions() {
@@ -180,6 +180,10 @@ export interface BaseProps<Value = DatePickerValue> extends StandardProps, Pick<
180
180
  onCollapse?: (collapse: boolean) => void;
181
181
  }
182
182
  export interface ContainerProps<T = DatePickerValue> extends Pick<BaseProps, 'disabled' | 'format' | 'formatResult' | 'inputable' | 'placeholder' | 'position' | 'range' | 'size' | 'type' | 'allowSingle' | 'defaultTime' | 'absolute' | 'zIndex' | 'quickSelect' | 'min' | 'max' | 'defaultRangeMonth' | 'defaultPickerValue' | 'hourStep' | 'minuteStep' | 'secondStep' | 'onPickerChange' | 'disabledTime' | 'align' | 'clearable' | 'clearWithUndefined' | 'innerTitle' | 'timeZone' | 'open' | 'onCollapse'> {
183
+ /**
184
+ * @inner 内部属性
185
+ */
186
+ inputFocus: boolean;
183
187
  /**
184
188
  * @en When the value is string, it needs to match the format attribute.\n When the range property is true, the value is an array of length 2.
185
189
  * @cn 值为 string 时,需要和 format 属性匹配。\n 非 string 会格式化为 string。\n range 属性为 true 时,值为长度为2的数组
@@ -476,7 +476,7 @@ export declare class Form<Value> extends React.Component<FormProps<Value>, any>
476
476
  export declare type FormCompType = typeof Form;
477
477
  export declare type FormItemWithFormConsumerKeys = 'formDatum' | 'labelWidth' | 'labelAlign' | 'labelVerticalAlign' | 'keepErrorHeight';
478
478
  /**
479
- * @title From.Item
479
+ * @title Form.Item
480
480
  * @cn 表单项,主要用来布局,显示标签,提示文案信息等
481
481
  * @en Used to layout, display labels, tips, errors, etc
482
482
  */
@@ -393,8 +393,9 @@ var _default = function _default(Origin) {
393
393
  unbindInputFromItem = _this$props10.unbindInputFromItem,
394
394
  scuSkip = _this$props10.scuSkip,
395
395
  defaultValue = _this$props10.defaultValue,
396
+ rules = _this$props10.rules,
396
397
  reserveAble = _this$props10.reserveAble,
397
- other = (0, _objectWithoutPropertiesLoose2.default)(_this$props10, ["formDatum", "value", "required", "bind", "onItemError", "bindInputToItem", "unbindInputFromItem", "scuSkip", "defaultValue", "reserveAble"]);
398
+ other = (0, _objectWithoutPropertiesLoose2.default)(_this$props10, ["formDatum", "value", "required", "bind", "onItemError", "bindInputToItem", "unbindInputFromItem", "scuSkip", "defaultValue", "rules", "reserveAble"]);
398
399
  return _react.default.createElement(Origin, (0, _extends2.default)({}, other, {
399
400
  formDatum: formDatum,
400
401
  error: this.getError(),
@@ -11,6 +11,10 @@ declare type ReactNode = React.ReactNode;
11
11
  declare type ReactElement = React.ReactElement;
12
12
  declare type ExpandTreeKeys = 'onExpand' | 'expanded' | 'defaultExpanded' | 'defaultExpandAll' | 'expandIcons' | 'loader' | 'childrenKey';
13
13
  export interface BaseSelectProps<DataItem, Value> extends StandardProps, Pick<AbsoluteProps, 'absolute' | 'zIndex'>, Pick<InputableProps<Value>, 'formDatum'>, Pick<TreeProps<DataItem, ValueArr<Value>>, ExpandTreeKeys> {
14
+ /**
15
+ * @inner 内部属性
16
+ */
17
+ inputFocus: boolean;
14
18
  /**
15
19
  * @en Form field, used with Form
16
20
  * @cn 表单字段, 配合 Form 使用
@@ -379,7 +383,7 @@ export interface UnMatchedValue<Value> {
379
383
  }
380
384
  export declare type ResultValue<Value> = Value | UnMatchedValue<Value>;
381
385
  /** ---------- result ---------- */
382
- export interface ResultProps<Item, Value> extends Omit<BaseSelectProps<Item, Value>, 'renderItem' | 'onChange' | 'onBlur' | 'onFocus' | 'groupKey' | 'innerData' | 'value'> {
386
+ export interface ResultProps<Item, Value> extends Omit<BaseSelectProps<Item, Value>, 'renderItem' | 'onChange' | 'onBlur' | 'onFocus' | 'groupKey' | 'innerData' | 'value' | 'inputFocus'> {
383
387
  datum: List<Item, Value>;
384
388
  filterText?: string;
385
389
  focus: boolean;
@@ -182,12 +182,13 @@ function (_PureComponent) {
182
182
  };
183
183
 
184
184
  _proto.setOpenEvent = function setOpenEvent() {
185
- if (this.lastFoucs !== this.focus) if (this.focus) {
185
+ var focus = this.focus || this.props.inputFocus;
186
+ if (this.lastFoucs !== focus) if (focus) {
186
187
  this.bindClickAway();
187
188
  } else if (this.lastFoucs !== undefined) {
188
189
  this.clearClickAway();
189
190
  }
190
- this.lastFoucs = this.focus;
191
+ this.lastFoucs = focus;
191
192
  };
192
193
 
193
194
  _proto.getDisabledStatus = function getDisabledStatus() {
@@ -254,8 +255,7 @@ function (_PureComponent) {
254
255
  if (!desc) {
255
256
  if (!(0, _element.getParent)(e.target, "[data-id=" + this.selectId + "]")) {
256
257
  this.blured = true;
257
- this.props.onBlur(); // this.clearClickAway()
258
-
258
+ this.props.onBlur();
259
259
  if (this.element) this.element.blur();
260
260
  }
261
261
 
@@ -377,7 +377,6 @@ function (_PureComponent) {
377
377
  _proto.handleFocus = function handleFocus(e) {
378
378
  if (!this.shouldFocus(e.target)) return;
379
379
  this.props.onFocus(e);
380
- this.bindClickAway();
381
380
  };
382
381
 
383
382
  _proto.handleInputFocus = function handleInputFocus() {
@@ -1,6 +1,6 @@
1
1
  import { ChangeEvent, KeyboardEvent, FocusEvent } from 'react';
2
2
  import { PureComponent } from '../component';
3
- import { OriginTextareaProps } from './props';
3
+ import { OriginTextareaProps } from './Props';
4
4
  interface TextareaState {
5
5
  height: number;
6
6
  }
@@ -1 +1 @@
1
- export { TextareaProps as Props } from './props';
1
+ export { TextareaProps as Props } from './Props';
package/lib/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'
223
+ version: '2.0.2'
224
224
  };
225
225
  exports.default = _default;
@@ -1,10 +1,12 @@
1
1
  import { cleanCache } from './css-accessors';
2
- import { setInjectType, getInjectType, ThemeConfig } from './vars-inject';
2
+ import { ThemeConfig } from './vars-inject';
3
3
  declare const types: string[];
4
4
  declare type ObjectProps = {
5
5
  [x: string]: any;
6
6
  };
7
7
  declare function getClassname(data: ObjectProps): string;
8
+ declare function getInjectType(): "body" | "tag";
9
+ declare function setInjectType(type: ThemeConfig['injectType']): void;
8
10
  declare function setStyle(options: ObjectProps, custom?: ObjectProps, config?: Partial<ThemeConfig>): () => void;
9
11
  declare const style: {
10
12
  getClassname: typeof getClassname;
@@ -2,9 +2,13 @@
2
2
 
3
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
4
 
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
+
5
7
  exports.__esModule = true;
6
8
  exports.types = exports.style = exports.color = void 0;
7
9
 
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread"));
11
+
8
12
  var _is = require("./is");
9
13
 
10
14
  var _expose = require("../styles/expose");
@@ -64,12 +68,27 @@ function resetTheme() {
64
68
  });
65
69
  }
66
70
 
71
+ var defaultInjectType;
72
+
73
+ function getInjectType() {
74
+ return defaultInjectType;
75
+ }
76
+
77
+ function setInjectType(type) {
78
+ defaultInjectType = type;
79
+ }
80
+
67
81
  function setStyle(options, custom, config) {
68
82
  if (config === void 0) {
69
- config = {};
83
+ config = {
84
+ target: 'body'
85
+ };
70
86
  }
71
87
 
72
- (0, _varsInject.setThemeConfig)(config);
88
+ var injectType = config.injectType || getInjectType() || 'body';
89
+ (0, _varsInject.setThemeConfig)((0, _objectSpread2.default)({}, config, {
90
+ injectType: injectType
91
+ }));
73
92
  (0, _varsInject.cleanStyleObj)();
74
93
 
75
94
  if (!options) {
@@ -96,7 +115,7 @@ function setStyle(options, custom, config) {
96
115
  }
97
116
  }
98
117
 
99
- if (config.injectType === 'tag') {
118
+ if (injectType === 'tag') {
100
119
  var id = (0, _varsInject.injectTag)(custom);
101
120
  return function () {
102
121
  var target = document.getElementById(id);
@@ -111,8 +130,8 @@ var style = {
111
130
  getClassname: getClassname,
112
131
  setStyle: setStyle,
113
132
  cleanCache: _cssAccessors.cleanCache,
114
- setInjectType: _varsInject.setInjectType,
115
- getInjectType: _varsInject.getInjectType
133
+ setInjectType: setInjectType,
134
+ getInjectType: getInjectType
116
135
  };
117
136
  exports.style = style;
118
137
  var color = _cssAccessors.default.color;
@@ -28,10 +28,8 @@ var _default = function _default(options) {
28
28
 
29
29
  if (typeof min === 'number' && val < min || typeof max === 'number' && val > max) {
30
30
  callback(new Error(message));
31
- return;
32
31
  } else {
33
32
  callback(true);
34
- return;
35
33
  }
36
34
  });
37
35
  };
@@ -8,8 +8,6 @@ export interface ThemeConfig {
8
8
  */
9
9
  target?: string | HTMLElement | (() => HTMLElement);
10
10
  }
11
- export declare function getInjectType(): "body" | "tag";
12
- export declare function setInjectType(type: ThemeConfig['injectType']): void;
13
11
  export declare function setThemeConfig(c: Partial<ThemeConfig>): void;
14
12
  export declare function getThemeConfig(name: keyof ThemeConfig): string | HTMLElement | (() => HTMLElement) | undefined;
15
13
  export declare function getThemeTarget(): HTMLElement;
@@ -3,8 +3,6 @@
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
5
  exports.__esModule = true;
6
- exports.getInjectType = getInjectType;
7
- exports.setInjectType = setInjectType;
8
6
  exports.setThemeConfig = setThemeConfig;
9
7
  exports.getThemeConfig = getThemeConfig;
10
8
  exports.getThemeTarget = getThemeTarget;
@@ -67,14 +65,6 @@ var config = {
67
65
  var computedCache = {};
68
66
  var styleObj = {};
69
67
 
70
- function getInjectType() {
71
- return config.injectType;
72
- }
73
-
74
- function setInjectType(type) {
75
- config.injectType = type;
76
- }
77
-
78
68
  function setThemeConfig(c) {
79
69
  Object.keys(c).forEach(function (key) {
80
70
  if (key in config) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shineout",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "Shein 前端组件库",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./es/index.js",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes