shineout 2.0.0-rc.2 → 2.0.0-rc.3

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/Carousel/Props.d.ts +1 -1
  2. package/css/Cascader/Cascader.d.ts +3 -3
  3. package/css/Cascader/Cascader.js +0 -1
  4. package/css/Cascader/List.d.ts +2 -1
  5. package/css/Cascader/List.js +11 -1
  6. package/css/Cascader/Node.d.ts +2 -2
  7. package/css/Cascader/Props.d.ts +3 -2
  8. package/css/Cascader/Result.js +52 -38
  9. package/css/DatePicker/Props.d.ts +1 -1
  10. package/css/Datum/Tree.d.ts +2 -2
  11. package/css/Modal/Modal.js +0 -2
  12. package/css/Modal/events.js +9 -6
  13. package/css/index.js +1 -1
  14. package/dist/shineout.js +1792 -1358
  15. package/dist/shineout.js.map +1 -1
  16. package/dist/shineout.min.js +1 -1
  17. package/esm/Carousel/Props.d.ts +1 -1
  18. package/esm/Cascader/Cascader.d.ts +3 -3
  19. package/esm/Cascader/Cascader.js +0 -1
  20. package/esm/Cascader/List.d.ts +2 -1
  21. package/esm/Cascader/List.js +11 -1
  22. package/esm/Cascader/Node.d.ts +2 -2
  23. package/esm/Cascader/Props.d.ts +3 -2
  24. package/esm/Cascader/Result.js +52 -38
  25. package/esm/DatePicker/Props.d.ts +1 -1
  26. package/esm/Datum/Tree.d.ts +2 -2
  27. package/esm/Modal/Modal.js +0 -2
  28. package/esm/Modal/events.js +9 -6
  29. package/esm/index.js +1 -1
  30. package/lib/Carousel/Props.d.ts +1 -1
  31. package/lib/Cascader/Cascader.d.ts +3 -3
  32. package/lib/Cascader/Cascader.js +0 -1
  33. package/lib/Cascader/List.d.ts +2 -1
  34. package/lib/Cascader/List.js +11 -1
  35. package/lib/Cascader/Node.d.ts +2 -2
  36. package/lib/Cascader/Props.d.ts +3 -2
  37. package/lib/Cascader/Result.js +52 -38
  38. package/lib/DatePicker/Props.d.ts +1 -1
  39. package/lib/Datum/Tree.d.ts +2 -2
  40. package/lib/Modal/Modal.js +0 -2
  41. package/lib/Modal/events.js +9 -6
  42. package/lib/index.js +1 -1
  43. package/package.json +5 -1
@@ -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,20 @@
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
6
  interface State {
7
7
  focus: boolean;
8
8
  path: string[];
9
9
  position: 'drop-down' | 'drop-up';
10
10
  }
11
- declare class Cascader<DataItem, Value extends (string | number)[]> extends PureComponent<OriginCascaderProps<DataItem, Value>, State> {
11
+ declare class Cascader<DataItem, Value extends CascaderBaseValue> extends PureComponent<OriginCascaderProps<DataItem, Value>, State> {
12
12
  static defaultProps: {
13
13
  data: never[];
14
14
  height: number;
15
15
  clearable: boolean;
16
16
  showArrow: boolean;
17
17
  expandTrigger: string;
18
- childrenKey: any;
18
+ childrenKey: string;
19
19
  };
20
20
  datum: DatumTree<DataItem>;
21
21
  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
  });
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.2'
223
+ version: '2.0.0-rc.3'
224
224
  };
225
225
  exports.default = _default;