shineout 2.0.0 → 2.0.1

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 (43) 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/index.js +1 -1
  9. package/css/utils/expose.d.ts +3 -1
  10. package/css/utils/expose.js +24 -5
  11. package/css/utils/validate/range.js +0 -2
  12. package/css/utils/vars-inject.d.ts +0 -2
  13. package/css/utils/vars-inject.js +0 -10
  14. package/dist/shineout.js +9658 -9496
  15. package/dist/shineout.js.map +1 -1
  16. package/dist/shineout.min.js +1 -1
  17. package/es/Cascader/Cascader.js +3 -2
  18. package/es/DatePicker/Container.js +3 -2
  19. package/es/DatePicker/Props.d.ts +4 -0
  20. package/es/Form/Props.d.ts +1 -1
  21. package/es/Form/inputable.js +2 -1
  22. package/es/Select/Props.d.ts +5 -1
  23. package/es/Select/Select.js +4 -5
  24. package/es/index.js +1 -1
  25. package/es/utils/expose.d.ts +3 -1
  26. package/es/utils/expose.js +20 -4
  27. package/es/utils/validate/range.js +0 -2
  28. package/es/utils/vars-inject.d.ts +0 -2
  29. package/es/utils/vars-inject.js +0 -6
  30. package/lib/Cascader/Cascader.js +3 -2
  31. package/lib/DatePicker/Container.js +3 -2
  32. package/lib/DatePicker/Props.d.ts +4 -0
  33. package/lib/Form/Props.d.ts +1 -1
  34. package/lib/Form/inputable.js +2 -1
  35. package/lib/Select/Props.d.ts +5 -1
  36. package/lib/Select/Select.js +4 -5
  37. package/lib/index.js +1 -1
  38. package/lib/utils/expose.d.ts +3 -1
  39. package/lib/utils/expose.js +24 -5
  40. package/lib/utils/validate/range.js +0 -2
  41. package/lib/utils/vars-inject.d.ts +0 -2
  42. package/lib/utils/vars-inject.js +0 -10
  43. package/package.json +1 -1
@@ -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() {
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'
223
+ version: '2.0.1'
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) {