shineout 2.0.0-rc.2 → 2.0.0-rc.4

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 (82) hide show
  1. package/css/@types/common.d.ts +1 -0
  2. package/css/AnimationList/AbsoluteList.d.ts +3 -2
  3. package/css/AnimationList/Props.d.ts +3 -4
  4. package/css/Carousel/Props.d.ts +1 -1
  5. package/css/Cascader/Cascader.d.ts +5 -4
  6. package/css/Cascader/Cascader.js +0 -1
  7. package/css/Cascader/List.d.ts +2 -1
  8. package/css/Cascader/List.js +11 -1
  9. package/css/Cascader/Node.d.ts +2 -2
  10. package/css/Cascader/Props.d.ts +3 -2
  11. package/css/Cascader/Result.js +52 -38
  12. package/css/DatePicker/Props.d.ts +1 -1
  13. package/css/Datum/Tree.d.ts +2 -2
  14. package/css/Modal/Modal.js +0 -2
  15. package/css/Modal/events.js +9 -6
  16. package/css/Select/BoxOption.js +2 -4
  17. package/css/Select/Option.js +1 -2
  18. package/css/Select/OptionList.d.ts +1 -1
  19. package/css/Select/OptionList.js +1 -1
  20. package/css/Select/OptionTree.d.ts +1 -1
  21. package/css/Select/OptionTree.js +1 -1
  22. package/css/Select/Props.d.ts +29 -37
  23. package/css/Select/Select.d.ts +3 -4
  24. package/css/Select/Select.js +72 -23
  25. package/css/TreeSelect/TreeSelect.d.ts +2 -2
  26. package/css/index.js +1 -1
  27. package/dist/shineout.js +6609 -5987
  28. package/dist/shineout.js.map +1 -1
  29. package/dist/shineout.min.js +1 -1
  30. package/esm/@types/common.d.ts +1 -0
  31. package/esm/AnimationList/AbsoluteList.d.ts +3 -2
  32. package/esm/AnimationList/Props.d.ts +3 -4
  33. package/esm/Carousel/Props.d.ts +1 -1
  34. package/esm/Cascader/Cascader.d.ts +5 -4
  35. package/esm/Cascader/Cascader.js +0 -1
  36. package/esm/Cascader/List.d.ts +2 -1
  37. package/esm/Cascader/List.js +11 -1
  38. package/esm/Cascader/Node.d.ts +2 -2
  39. package/esm/Cascader/Props.d.ts +3 -2
  40. package/esm/Cascader/Result.js +52 -38
  41. package/esm/DatePicker/Props.d.ts +1 -1
  42. package/esm/Datum/Tree.d.ts +2 -2
  43. package/esm/Modal/Modal.js +0 -2
  44. package/esm/Modal/events.js +9 -6
  45. package/esm/Select/BoxOption.js +2 -4
  46. package/esm/Select/Option.js +1 -2
  47. package/esm/Select/OptionList.d.ts +1 -1
  48. package/esm/Select/OptionList.js +1 -1
  49. package/esm/Select/OptionTree.d.ts +1 -1
  50. package/esm/Select/OptionTree.js +1 -1
  51. package/esm/Select/Props.d.ts +29 -37
  52. package/esm/Select/Select.d.ts +3 -4
  53. package/esm/Select/Select.js +72 -24
  54. package/esm/TreeSelect/TreeSelect.d.ts +2 -2
  55. package/esm/index.js +1 -1
  56. package/lib/@types/common.d.ts +1 -0
  57. package/lib/AnimationList/AbsoluteList.d.ts +3 -2
  58. package/lib/AnimationList/Props.d.ts +3 -4
  59. package/lib/Carousel/Props.d.ts +1 -1
  60. package/lib/Cascader/Cascader.d.ts +5 -4
  61. package/lib/Cascader/Cascader.js +0 -1
  62. package/lib/Cascader/List.d.ts +2 -1
  63. package/lib/Cascader/List.js +11 -1
  64. package/lib/Cascader/Node.d.ts +2 -2
  65. package/lib/Cascader/Props.d.ts +3 -2
  66. package/lib/Cascader/Result.js +52 -38
  67. package/lib/DatePicker/Props.d.ts +1 -1
  68. package/lib/Datum/Tree.d.ts +2 -2
  69. package/lib/Modal/Modal.js +0 -2
  70. package/lib/Modal/events.js +9 -6
  71. package/lib/Select/BoxOption.js +2 -4
  72. package/lib/Select/Option.js +1 -2
  73. package/lib/Select/OptionList.d.ts +1 -1
  74. package/lib/Select/OptionList.js +1 -1
  75. package/lib/Select/OptionTree.d.ts +1 -1
  76. package/lib/Select/OptionTree.js +1 -1
  77. package/lib/Select/Props.d.ts +29 -37
  78. package/lib/Select/Select.d.ts +3 -4
  79. package/lib/Select/Select.js +72 -23
  80. package/lib/TreeSelect/TreeSelect.d.ts +2 -2
  81. package/lib/index.js +1 -1
  82. package/package.json +6 -2
@@ -29,6 +29,7 @@ export declare namespace RegularAttributes {
29
29
  type Size = 'small' | 'default' | 'large';
30
30
  type Type = 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger';
31
31
  type Align = 'left' | 'center' | 'right';
32
+ type ListPosition = 'drop-down' | 'drop-up';
32
33
  }
33
34
  export declare type ObjectType<V = any> = {
34
35
  [name: string]: V;
@@ -1,2 +1,3 @@
1
- import { ComponentType } from 'react';
2
- export default function <U extends {}>(List: ComponentType<U>): any;
1
+ import React, { ComponentType } from 'react';
2
+ import { AbsoluteProps } from './Props';
3
+ export default function <U extends {}>(List: ComponentType<U>): React.ComponentType<import("../Scroll/Props").GetScrollContextConsumerValue<{ [P in Exclude<keyof U, "getRef"> | Exclude<Exclude<"fixed", keyof U>, "getRef"> | Exclude<Exclude<"absolute", keyof U>, "getRef"> | Exclude<Exclude<"position", keyof U>, "getRef"> | Exclude<Exclude<"zIndex", keyof U>, "getRef"> | Exclude<Exclude<"value", keyof U>, "getRef"> | Exclude<Exclude<"style", keyof U>, "getRef"> | Exclude<Exclude<"focus", keyof U>, "getRef"> | Exclude<Exclude<"scrollLeft", keyof U>, "getRef"> | Exclude<Exclude<"scrollTop", keyof U>, "getRef"> | Exclude<Exclude<"parentElement", keyof U>, "getRef"> | Exclude<Exclude<"scrollElement", keyof U>, "getRef"> | Exclude<Exclude<"rootClass", keyof U>, "getRef"> | Exclude<Exclude<"autoClass", keyof U>, "getRef"> | Exclude<Exclude<"getResetPosition", keyof U>, "getRef"> | Exclude<Exclude<"autoAdapt", keyof U>, "getRef">]: import("../@types/common").ForceAdd<U, AbsoluteProps>[P]; }>>;
@@ -1,8 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { GetScrollContextConsumerValue } from '../Scroll/Props';
3
3
  import { GetZIndexConsumerProps } from '../Modal/Props';
4
- import { ForceAdd, KeygenType, StandardProps } from '../@types/common';
5
- declare type ListPosition = 'drop-down' | 'drop-up';
4
+ import { ForceAdd, KeygenType, RegularAttributes, StandardProps } from '../@types/common';
6
5
  declare type PickerPosition = 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top';
7
6
  declare type DropdownPosition = 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right';
8
7
  export declare type ListDurationType = 'fast' | 'slow' | number;
@@ -11,7 +10,7 @@ export interface AbsoluteProps {
11
10
  focus?: boolean;
12
11
  fixed?: boolean | 'min';
13
12
  parentElement?: HTMLElement;
14
- position?: ListPosition | PickerPosition | DropdownPosition;
13
+ position?: RegularAttributes.ListPosition | PickerPosition | DropdownPosition;
15
14
  /**
16
15
  * When it is true, the pop-up layer of option append into document.body.
17
16
  *
@@ -33,7 +32,7 @@ export interface AbsoluteProps {
33
32
  */
34
33
  zIndex?: number;
35
34
  style?: React.CSSProperties;
36
- autoClass?: StyleSheet;
35
+ autoClass?: string;
37
36
  value?: any;
38
37
  getResetPosition?: (resetFunc: () => void) => void;
39
38
  autoAdapt?: boolean;
@@ -25,7 +25,7 @@ export interface CarouselProps extends StandardProps {
25
25
  *
26
26
  * default: 'circle'
27
27
  */
28
- indicatorType?: ((current: number, moveTo: (index: number) => void) => ReactNode) | string;
28
+ indicatorType?: ((current: number, moveTo: (index: number) => void) => ReactNode) | 'circle' | 'number' | 'line';
29
29
  /**
30
30
  * the interval of animation, When it is not 0, play automatically
31
31
  *
@@ -2,20 +2,21 @@
2
2
  import { PureComponent } from '../component';
3
3
  import DatumTree from '../Datum/Tree';
4
4
  import Input from './Input';
5
- import { OriginCascaderProps } from './Props';
5
+ import { CascaderBaseValue, OriginCascaderProps } from './Props';
6
+ import { RegularAttributes } from '../@types/common';
6
7
  interface State {
7
8
  focus: boolean;
8
9
  path: string[];
9
- position: 'drop-down' | 'drop-up';
10
+ position: RegularAttributes.ListPosition;
10
11
  }
11
- declare class Cascader<DataItem, Value extends (string | number)[]> extends PureComponent<OriginCascaderProps<DataItem, Value>, State> {
12
+ declare class Cascader<DataItem, Value extends CascaderBaseValue> extends PureComponent<OriginCascaderProps<DataItem, Value>, State> {
12
13
  static defaultProps: {
13
14
  data: never[];
14
15
  height: number;
15
16
  clearable: boolean;
16
17
  showArrow: boolean;
17
18
  expandTrigger: string;
18
- childrenKey: any;
19
+ childrenKey: string;
19
20
  };
20
21
  datum: DatumTree<DataItem>;
21
22
  selectId: string;
@@ -131,7 +131,6 @@ function (_PureComponent) {
131
131
  if ((0, _is.isFunc)(props.getComponentRef)) {
132
132
  props.getComponentRef((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
133
133
  } else {
134
- ;
135
134
  props.getComponentRef.current = (0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this));
136
135
  }
137
136
  }
@@ -1,5 +1,6 @@
1
1
  import { Component } from 'react';
2
2
  import { CascaderListProps } from './Props';
3
+ import { KeygenResult } from '../@types/common';
3
4
  declare class List<U, T extends any[]> extends Component<CascaderListProps<U, T>> {
4
5
  static defaultProps: {
5
6
  id: string;
@@ -7,7 +8,7 @@ declare class List<U, T extends any[]> extends Component<CascaderListProps<U, T>
7
8
  text: {};
8
9
  };
9
10
  constructor(props: CascaderListProps<U, T>);
10
- getKey(data: U, index: number): string | number;
11
+ getKey(data: U, index: number): KeygenResult;
11
12
  getText(key: string): any;
12
13
  render(): JSX.Element;
13
14
  }
@@ -54,7 +54,17 @@ function (_Component) {
54
54
  keygen = _this$props.keygen,
55
55
  parentId = _this$props.parentId;
56
56
  if (typeof keygen === 'function') return keygen(data, parentId);
57
- if (keygen && typeof keygen === 'string') return data[keygen];
57
+
58
+ if (keygen && typeof keygen === 'string') {
59
+ var key = data[keygen];
60
+
61
+ if (typeof key === 'string' || typeof key === 'number') {
62
+ return key;
63
+ }
64
+
65
+ console.error('key must be number or string but get', key);
66
+ }
67
+
58
68
  return parentId + (parentId ? ',' : '') + index;
59
69
  };
60
70
 
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
- import { NodeProps } from './Props';
2
+ import { CascaderBaseValue, NodeProps } from './Props';
3
3
  import { PureComponent } from '../component';
4
4
  interface NodeState {
5
5
  loading: boolean;
6
6
  }
7
- declare class Node<U, T extends any[]> extends PureComponent<NodeProps<U, T>, NodeState> {
7
+ declare class Node<U, T extends CascaderBaseValue> extends PureComponent<NodeProps<U, T>, NodeState> {
8
8
  handleUpdate: Function;
9
9
  constructor(props: NodeProps<U, T>);
10
10
  componentWillUnmount(): void;
@@ -26,6 +26,7 @@ export declare type GetFilterProps<Props, DataItem> = Omit<Props, 'filterText' |
26
26
  };
27
27
  /** ------ Cascader ------ * */
28
28
  export interface OriginCascaderProps<DataItem, Value extends CascaderBaseValue> extends Pick<AbsoluteProps, 'absolute' | 'zIndex'>, Pick<InputTitleProps, 'innerTitle'>, Pick<TreeDatumOptions<DataItem>, 'mode'>, Pick<StandardProps, 'style'> {
29
+ renderUnmatched?: (data: any) => ReactNode;
29
30
  inputFocus: boolean;
30
31
  /**
31
32
  * Set visible of cascader popup
@@ -212,8 +213,8 @@ export interface OriginCascaderProps<DataItem, Value extends CascaderBaseValue>
212
213
  * default: -
213
214
  *
214
215
  */
215
- getComponentRef?: (comp: componentRef) => void | {
216
- current?: componentRef;
216
+ getComponentRef?: ((comp: componentRef) => void) | {
217
+ current: componentRef | undefined;
217
218
  };
218
219
  /**
219
220
  * When it is a string, return d[string]. When it is a function, return the result of the function.
@@ -252,8 +252,22 @@ function (_PureComponent) {
252
252
  raw = _ref3.raw,
253
253
  className = _ref3.className,
254
254
  options = (0, _objectWithoutPropertiesLoose2.default)(_ref3, ["index", "render", "data", "raw", "className"]);
255
- var singleRemove = this.props.singleRemove;
256
- var res = data && render(data, raw);
255
+ var _this$props3 = this.props,
256
+ singleRemove = _this$props3.singleRemove,
257
+ datum = _this$props3.datum,
258
+ renderUnmatched = _this$props3.renderUnmatched;
259
+ var res;
260
+
261
+ if (datum.isUnMatch(data)) {
262
+ if (renderUnmatched) {
263
+ res = renderUnmatched(data.value);
264
+ } else {
265
+ res = typeof data.value === 'string' ? data.value : null;
266
+ }
267
+ } else {
268
+ res = data && render(data, raw);
269
+ }
270
+
257
271
  if (!res) return null;
258
272
  var more = this.getCompressedBound();
259
273
  return _react.default.createElement(Item, (0, _extends2.default)({
@@ -270,10 +284,10 @@ function (_PureComponent) {
270
284
  };
271
285
 
272
286
  _proto.renderMore = function renderMore(list) {
273
- var _this$props3 = this.props,
274
- selectId = _this$props3.selectId,
275
- size = _this$props3.size,
276
- compressed = _this$props3.compressed;
287
+ var _this$props4 = this.props,
288
+ selectId = _this$props4.selectId,
289
+ size = _this$props4.size,
290
+ compressed = _this$props4.compressed;
277
291
  var more = this.getCompressedBound();
278
292
  return [_react.default.createElement(_More.default, {
279
293
  key: "more",
@@ -288,12 +302,12 @@ function (_PureComponent) {
288
302
  };
289
303
 
290
304
  _proto.renderInput = function renderInput() {
291
- var _this$props4 = this.props,
292
- onFilter = _this$props4.onFilter,
293
- focus = _this$props4.focus,
294
- trim = _this$props4.trim,
295
- bindInput = _this$props4.bindInput,
296
- filterText = _this$props4.filterText;
305
+ var _this$props5 = this.props,
306
+ onFilter = _this$props5.onFilter,
307
+ focus = _this$props5.focus,
308
+ trim = _this$props5.trim,
309
+ bindInput = _this$props5.bindInput,
310
+ filterText = _this$props5.filterText;
297
311
  return _react.default.createElement(_Input.default, {
298
312
  filterText: filterText,
299
313
  ref: bindInput,
@@ -305,10 +319,10 @@ function (_PureComponent) {
305
319
  };
306
320
 
307
321
  _proto.renderPlaceholder = function renderPlaceholder() {
308
- var _this$props5 = this.props,
309
- focus = _this$props5.focus,
310
- onFilter = _this$props5.onFilter,
311
- innerTitle = _this$props5.innerTitle;
322
+ var _this$props6 = this.props,
323
+ focus = _this$props6.focus,
324
+ onFilter = _this$props6.onFilter,
325
+ innerTitle = _this$props6.innerTitle;
312
326
 
313
327
  if (focus && onFilter) {
314
328
  return this.renderInput();
@@ -321,10 +335,10 @@ function (_PureComponent) {
321
335
  };
322
336
 
323
337
  _proto.renderIndicator = function renderIndicator() {
324
- var _this$props6 = this.props,
325
- multiple = _this$props6.multiple,
326
- showArrow = _this$props6.showArrow,
327
- compressed = _this$props6.compressed;
338
+ var _this$props7 = this.props,
339
+ multiple = _this$props7.multiple,
340
+ showArrow = _this$props7.showArrow,
341
+ compressed = _this$props7.compressed;
328
342
  if (!showArrow || multiple && !compressed) return null;
329
343
  var showCaret = !multiple; // eslint-disable-next-line
330
344
 
@@ -336,15 +350,15 @@ function (_PureComponent) {
336
350
  };
337
351
 
338
352
  _proto.renderResult = function renderResult() {
339
- var _this$props7 = this.props,
340
- datum = _this$props7.datum,
341
- _this$props7$value = _this$props7.value,
342
- value = _this$props7$value === void 0 ? [] : _this$props7$value,
343
- renderItem = _this$props7.renderItem,
344
- renderResult = _this$props7.renderResult,
345
- compressed = _this$props7.compressed,
346
- focus = _this$props7.focus,
347
- onFilter = _this$props7.onFilter;
353
+ var _this$props8 = this.props,
354
+ datum = _this$props8.datum,
355
+ _this$props8$value = _this$props8.value,
356
+ value = _this$props8$value === void 0 ? [] : _this$props8$value,
357
+ renderItem = _this$props8.renderItem,
358
+ renderResult = _this$props8.renderResult,
359
+ compressed = _this$props8.compressed,
360
+ focus = _this$props8.focus,
361
+ onFilter = _this$props8.onFilter;
348
362
  var nodes = value.map(function (v) {
349
363
  return datum.getDataById(v);
350
364
  });
@@ -374,15 +388,15 @@ function (_PureComponent) {
374
388
  };
375
389
 
376
390
  _proto.render = function render() {
377
- var _this$props8 = this.props,
378
- style = _this$props8.style,
379
- _this$props8$value = _this$props8.value,
380
- value = _this$props8$value === void 0 ? [] : _this$props8$value,
381
- compressed = _this$props8.compressed,
382
- multiple = _this$props8.multiple,
383
- innerTitle = _this$props8.innerTitle,
384
- onFilter = _this$props8.onFilter,
385
- focus = _this$props8.focus;
391
+ var _this$props9 = this.props,
392
+ style = _this$props9.style,
393
+ _this$props9$value = _this$props9.value,
394
+ value = _this$props9$value === void 0 ? [] : _this$props9$value,
395
+ compressed = _this$props9.compressed,
396
+ multiple = _this$props9.multiple,
397
+ innerTitle = _this$props9.innerTitle,
398
+ onFilter = _this$props9.onFilter,
399
+ focus = _this$props9.focus;
386
400
  var empty = value.length === 0;
387
401
  var result = empty ? this.renderPlaceholder() : this.renderResult();
388
402
  var clearEl = this.renderClear();
@@ -64,7 +64,7 @@ export interface BaseProps<T = DatePickerValue> extends StandardProps, Pick<Abso
64
64
  *
65
65
  * default: false
66
66
  */
67
- disabled?: ((date: Date, type?: DisabledType, value?: DatePickerValue) => boolean) | boolean;
67
+ disabled?: ((date: Date, type?: DisabledType, value0?: Date, value1?: Date) => boolean) | boolean;
68
68
  /**
69
69
  * default values for different types: 'date': 'yyyy-MM-dd'. 'time': 'HH:mm:ss'. 'week': 'RRRR II'. 'month': 'yyyy-MM'. 'week': 'RRRR II'. 'quarter': 'yyyy-[Q]Q'. 'year': 'yyyy'. 'datetime': 'yyyy-MM-dd HH:mm:ss'
70
70
  *
@@ -1,4 +1,4 @@
1
- import { KeygenResult, ObjectType, KeygenType } from '../@types/common';
1
+ import { KeygenResult, ObjectType, KeygenType, UnMatchedValue } from '../@types/common';
2
2
  export declare const CheckedMode: {
3
3
  Full: number;
4
4
  Half: number;
@@ -54,7 +54,7 @@ export default class<Item> {
54
54
  bind(id: number | string, update: Function): void;
55
55
  unbind(id: KeygenResult): void;
56
56
  setUnmatedValue(): void;
57
- isUnMatch(data: ObjectType | null): boolean;
57
+ isUnMatch(data: ObjectType | null): data is UnMatchedValue;
58
58
  setValue(value?: Value): void;
59
59
  getValue(): Value;
60
60
  setValueMap(id: KeygenResult, checked: CheckedStatus): void;
@@ -51,8 +51,6 @@ function (_Component) {
51
51
  var _proto = Modal.prototype;
52
52
 
53
53
  _proto.componentDidMount = function componentDidMount() {
54
- console.log(this.props.visible);
55
-
56
54
  if (this.props.visible && !this.props.usePortal) {
57
55
  (0, _events.open)(this.getOption(), false);
58
56
  }
@@ -287,9 +287,13 @@ exports.method = method;
287
287
 
288
288
  var closeAll = function closeAll() {
289
289
  Object.keys(containers).filter(function (id) {
290
- return containers[id].visible;
290
+ return containers[id].props.from === 'method' && containers[id].visible;
291
291
  }).forEach(function (id) {
292
- close(containers[id].props);
292
+ var _containers$id$props = containers[id].props,
293
+ onClose = _containers$id$props.onClose,
294
+ usePortal = _containers$id$props.usePortal;
295
+ if (onClose) onClose();
296
+ if (!usePortal) close(containers[id].props);
293
297
  });
294
298
  };
295
299
 
@@ -302,11 +306,10 @@ exports.closeAll = closeAll;
302
306
  return containers[id].visible && containers[id].props.esc;
303
307
  });
304
308
  if (!opened) return;
305
- var props = containers[opened].props; // @ts-ignore may be always true
306
-
309
+ var props = containers[opened].props;
307
310
  var onClose = props.onClose,
308
- isPortal = props.isPortal;
311
+ usePortal = props.usePortal;
309
312
  if (onClose) onClose();
310
- if (!isPortal) close(props);
313
+ if (!usePortal) close(props);
311
314
  });
312
315
  });
@@ -46,11 +46,10 @@ function (_PureComponent) {
46
46
  data = _this$props.data,
47
47
  onClick = _this$props.onClick,
48
48
  isActive = _this$props.isActive,
49
- index = _this$props.index,
50
49
  disabled = _this$props.disabled;
51
50
  if (this.locked || disabled) return;
52
51
  this.locked = true;
53
- onClick(!isActive, data, index);
52
+ onClick(!isActive, data);
54
53
  setTimeout(function () {
55
54
  _this2.locked = false;
56
55
  }, 200);
@@ -59,7 +58,6 @@ function (_PureComponent) {
59
58
  _proto.render = function render() {
60
59
  var _this$props2 = this.props,
61
60
  data = _this$props2.data,
62
- index = _this$props2.index,
63
61
  isActive = _this$props2.isActive,
64
62
  renderItem = _this$props2.renderItem,
65
63
  columns = _this$props2.columns,
@@ -68,7 +66,7 @@ function (_PureComponent) {
68
66
  var className = (0, _styles.selectClass)((0, _classname.getDirectionClass)('option'));
69
67
  var width = columns < 0 ? undefined : 1 / columns * 100 + "%";
70
68
  var Input = multiple ? _Checkbox.default : _Radio.default;
71
- var result = renderItem(data, index);
69
+ var result = renderItem(data);
72
70
  var title = typeof result === 'string' ? result : undefined;
73
71
  return _react.default.createElement(Input, {
74
72
  disabled: disabled,
@@ -56,12 +56,11 @@ function (_React$Component) {
56
56
  data = _this$props.data,
57
57
  onClick = _this$props.onClick,
58
58
  isActive = _this$props.isActive,
59
- index = _this$props.index,
60
59
  disabled = _this$props.disabled,
61
60
  groupKey = _this$props.groupKey;
62
61
  if (this.locked || disabled || data && data[groupKey]) return;
63
62
  this.locked = true;
64
- onClick(!isActive, data, index);
63
+ onClick(!isActive, data);
65
64
  setTimeout(function () {
66
65
  _this2.locked = false;
67
66
  }, 200);
@@ -10,7 +10,7 @@ declare class OptionList<Item, Value> extends Component<OptionListProps<Item, Va
10
10
  lastScrollTop: number;
11
11
  constructor(props: OptionListProps<Item, Value>);
12
12
  componentDidUpdate(prevProps: OptionListProps<Item, Value>): void;
13
- getText(key: string): Function | (() => string) | (() => string) | (() => Object) | ((v: PropertyKey) => boolean) | ((v: Object) => boolean) | ((v: PropertyKey) => boolean);
13
+ getText(key: 'noData'): any;
14
14
  hoverMove(step: number): void;
15
15
  handleScroll(_x: number, y: number, _max: number, _bar: HTMLElement, _v: number, h: number, _pixelX?: number, pixelY?: number): void;
16
16
  handleHover(index: number, force: boolean): void;
@@ -92,7 +92,7 @@ function (_Component) {
92
92
  };
93
93
 
94
94
  _proto.getText = function getText(key) {
95
- return this.props.text[key] || (0, _locale.getLocale)(key);
95
+ return this.props.text && this.props.text[key] || (0, _locale.getLocale)(key);
96
96
  };
97
97
 
98
98
  _proto.hoverMove = function hoverMove(step) {
@@ -2,7 +2,7 @@ import { Component } from 'react';
2
2
  import { OptionTreeProps } from './Props';
3
3
  declare class OptionList<Item, Value> extends Component<OptionTreeProps<Item, Value>> {
4
4
  constructor(props: OptionTreeProps<Item, Value>);
5
- getText(key: string): Function | (() => string) | (() => string) | (() => Object) | ((v: PropertyKey) => boolean) | ((v: Object) => boolean) | ((v: PropertyKey) => boolean);
5
+ getText(key: 'noData'): any;
6
6
  handleClick(data: Item, _: any, p: {
7
7
  path: string;
8
8
  }): void;
@@ -48,7 +48,7 @@ function (_Component) {
48
48
  var _proto = OptionList.prototype;
49
49
 
50
50
  _proto.getText = function getText(key) {
51
- return this.props.text[key] || (0, _locale.getLocale)(key);
51
+ return this.props.text && this.props.text[key] || (0, _locale.getLocale)(key);
52
52
  };
53
53
 
54
54
  _proto.handleClick = function handleClick(data, _, p) {
@@ -1,15 +1,16 @@
1
1
  import * as React from 'react';
2
- import { StandardProps, RegularAttributes, KeygenType, ValueItem, ResultItem, LiteralUnion } from '../@types/common';
2
+ import { StandardProps, RegularAttributes, KeygenType, ValueItem, ResultItem, LiteralUnion, ValueArr } from '../@types/common';
3
3
  import List from '../Datum/List';
4
4
  import { GetTableConsumerProps } from '../Table/Props';
5
5
  import { GetInputableProps, InputableProps } from '../Form/Props';
6
6
  import { GetInputBorderProps } from '../hoc/Props';
7
7
  import { GetDatumListProps } from '../Datum/Props';
8
- import { AbsoluteProps } from '../AnimationList/Props';
8
+ import { AbsoluteProps, GetAbsoluteProps } from '../AnimationList/Props';
9
+ import { TreeProps } from '../Tree/Props';
9
10
  declare type ReactNode = React.ReactNode;
10
11
  declare type ReactElement = React.ReactElement;
11
- export declare type Position = 'drop-down' | 'drop-up';
12
- export interface BaseSelectProps<Item, Value> extends StandardProps, Pick<AbsoluteProps, 'absolute' | 'zIndex'>, Pick<InputableProps<Value>, 'formDatum'> {
12
+ declare type ExpandTreeKeys = 'onExpand' | 'expanded' | 'defaultExpanded' | 'defaultExpandAll' | 'expandIcons' | 'loader' | 'childrenKey';
13
+ export interface BaseSelectProps<Item, Value> extends StandardProps, Pick<AbsoluteProps, 'absolute' | 'zIndex'>, Pick<InputableProps<Value>, 'formDatum'>, Pick<TreeProps<Item, ValueArr<Value>>, ExpandTreeKeys> {
13
14
  /**
14
15
  * If clearable is true, show clear value icon
15
16
  *
@@ -96,7 +97,7 @@ export interface BaseSelectProps<Item, Value> extends StandardProps, Pick<Absolu
96
97
  *
97
98
  * default: auto
98
99
  */
99
- position?: Position;
100
+ position?: RegularAttributes.ListPosition;
100
101
  /**
101
102
  * When it is a string, return d[string]. When it is a function, return the result of the function.
102
103
  *
@@ -339,15 +340,6 @@ export interface BaseSelectProps<Item, Value> extends StandardProps, Pick<Absolu
339
340
  * default: false
340
341
  */
341
342
  defaultExpandAll?: boolean;
342
- /**
343
- * treeData,the key of the children data name
344
- *
345
- * 树形数据下,指定子数据的属性名
346
- *
347
- * default: 'children'
348
- */
349
- childrenKey?: string;
350
- loader?: (key: ValueItem<Value>, data: Item) => void;
351
343
  /**
352
344
  * custom empty copy
353
345
  *
@@ -400,31 +392,30 @@ export interface BaseSelectProps<Item, Value> extends StandardProps, Pick<Absolu
400
392
  groupKey: string;
401
393
  innerData: Item;
402
394
  inputable?: boolean;
403
- text?: React.ReactNode;
395
+ text?: {
396
+ noData?: string;
397
+ };
404
398
  expanded?: string[];
405
399
  }
406
400
  /** ---------- optionList ---------- */
407
401
  export declare type Control = 'mouse' | 'keyboard';
408
- export interface OptionListProps<Item, Value> extends Omit<BaseSelectProps<Item, Value>, 'onChange'> {
402
+ export interface OptionListProps<Item, Value> extends Pick<BaseSelectProps<Item, Value>, 'hideCreateOption' | 'loading' | 'keygen' | 'multiple' | 'renderOptionList' | 'data' | 'datum' | 'text' | 'groupKey' | 'emptyText'>, Pick<Required<BaseSelectProps<Item, Value>>, 'itemsInView' | 'lineHeight' | 'height'> {
409
403
  control: Control;
410
- data: Item[];
411
- datum: List<Item, Value>;
412
404
  focus?: boolean;
413
- height: number;
414
- itemsInView: number;
415
- lineHeight: number;
416
405
  onControlChange: (control: Control) => void;
417
- onChange: (isActive: boolean, data: Item, index?: number) => void;
406
+ onChange: (isActive: boolean, data: Item) => void;
418
407
  renderItem: ((data: Item, index?: number) => ReactNode);
419
408
  renderPending?: boolean;
420
409
  selectId: string;
421
410
  bindOptionFunc: (name: string, fn: Function) => void;
422
411
  autoClass: string;
423
- text: Object;
424
- groupKey: keyof Item & string;
425
412
  getRef: (el: HTMLElement) => void;
426
413
  customHeader?: ReactNode;
427
414
  filterText?: string;
415
+ style: React.CSSProperties;
416
+ }
417
+ export declare class WrappedOptionListComp<Item, Value> extends React.Component<GetAbsoluteProps<OptionListProps<Item, Value>>, any> {
418
+ render: () => JSX.Element;
428
419
  }
429
420
  /** ---------- option ---------- */
430
421
  export interface OptionProps<Item> {
@@ -441,22 +432,21 @@ export interface OptionProps<Item> {
441
432
  filterText?: string;
442
433
  }
443
434
  /** ---------- optionTree ---------- */
444
- export interface OptionTreeProps<Item, Value> extends BaseSelectProps<Item, Value> {
435
+ export interface OptionTreeProps<Item, Value> extends Pick<BaseSelectProps<Item, Value>, ExpandTreeKeys | 'loading' | 'treeData' | 'loader' | 'emptyText' | 'height' | 'renderOptionList' | 'text'> {
445
436
  onChange: (_: any, data: Item, fromInput?: boolean) => void;
446
- defaultExpanded?: string[];
447
- expanded?: string[];
448
437
  renderPending?: boolean;
449
438
  treeData: Item[];
450
439
  datum: List<Item, Value>;
451
440
  focus?: boolean;
452
- onExpand?: () => void;
453
441
  keygen: KeygenType<Item>;
454
442
  renderItem: ((data: Item, index?: number) => ReactNode);
455
443
  selectId: string;
456
- text: Object;
457
444
  getRef?: () => void;
458
445
  customHeader?: React.ReactNode;
459
- expandIcons?: ReactNode[];
446
+ style?: React.CSSProperties;
447
+ }
448
+ export declare class WrappedOptionTreeComp<Item, Value> extends React.Component<GetAbsoluteProps<OptionTreeProps<Item, Value>>, any> {
449
+ render: () => JSX.Element;
460
450
  }
461
451
  export interface UnMatchedValue<Value> {
462
452
  IS_NOT_MATCHED_VALUE: boolean;
@@ -508,29 +498,31 @@ export interface InputProps {
508
498
  bindFocusInputFunc: (fn: (flag?: boolean) => void) => void;
509
499
  }
510
500
  /** ---------- boxList ---------- */
511
- export interface BoxListProps<Item, Value> extends Omit<BaseSelectProps<Item, Value>, 'onChange' | 'renderItem' | 'data'> {
512
- data: Item[];
501
+ export interface BoxListProps<Item, Value> extends Pick<BaseSelectProps<Item, Value>, 'datum' | 'keygen' | 'renderResult' | 'multiple' | 'lineHeight' | 'columnWidth' | 'data' | 'loading' | 'renderOptionList' | 'emptyText' | 'itemsInView' | 'height' | 'columnsTitle'> {
513
502
  columns: number;
514
- onChange: (isActive: boolean, data: Item, index?: number) => void;
503
+ onChange: (isActive: boolean, data: Item) => void;
515
504
  bindOptionFunc: (name: string, fn: Function) => void;
516
505
  text: any;
517
506
  selectId: string;
518
507
  focus: boolean;
519
508
  renderPending?: boolean;
520
- renderItem: (data: Item, index: number) => React.ReactNode;
509
+ renderItem: (data: Item, index?: number) => React.ReactNode;
521
510
  getRef?: (el: HTMLDivElement) => void;
522
511
  customHeader: React.ReactNode;
512
+ style: React.CSSProperties;
513
+ }
514
+ export declare class WrappedBoxListComp<Item, Value> extends React.Component<GetAbsoluteProps<BoxListProps<Item, Value>>, any> {
515
+ render: () => JSX.Element;
523
516
  }
524
517
  /** ---------- boxOption ---------- */
525
518
  export interface BoxOptionProps<Item> {
526
519
  columns: number;
527
520
  data: Item;
528
521
  disabled: boolean;
529
- index?: number;
530
522
  isActive: boolean;
531
523
  multiple?: boolean;
532
- onClick: (isActive: boolean, data: Item, index?: number) => void;
533
- renderItem: (data: Item, index?: number) => ReactNode;
524
+ onClick: (isActive: boolean, data: Item) => void;
525
+ renderItem: (data: Item) => ReactNode;
534
526
  }
535
527
  /** ---------- filter ---------- */
536
528
  export interface FilterProps<Item, Value> {
@@ -1,12 +1,12 @@
1
1
  /// <reference types="node" />
2
2
  import React from 'react';
3
3
  import { PureComponent } from '../component';
4
- import { ResultItem } from '../@types/common';
5
- import { BaseSelectProps, Control, Position } from './Props';
4
+ import { RegularAttributes, ResultItem } from '../@types/common';
5
+ import { BaseSelectProps, Control } from './Props';
6
6
  interface SelectState {
7
7
  control: Control;
8
8
  focus: boolean;
9
- position: Position;
9
+ position: RegularAttributes.ListPosition;
10
10
  }
11
11
  declare class Select<Item, Value> extends PureComponent<BaseSelectProps<Item, Value>, SelectState> {
12
12
  static defaultProps: {
@@ -41,7 +41,6 @@ declare class Select<Item, Value> extends PureComponent<BaseSelectProps<Item, Va
41
41
  blured: boolean;
42
42
  inputBlurTimer: NodeJS.Timer | null;
43
43
  lastChangeIsOptionClick: boolean;
44
- handleBlur: (e?: any) => void;
45
44
  handleRemove: (data: ResultItem<Item>, fromInput?: boolean) => void;
46
45
  inputLocked: boolean;
47
46
  keyLocked: boolean;