@king-design/react 3.1.0-beta.2 → 3.1.0

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 (173) hide show
  1. package/__tests__/__snapshots__/Dialog.md +1 -1
  2. package/__tests__/__snapshots__/React Demos.md +216 -208
  3. package/components/affix/index.d.ts +1 -1
  4. package/components/badge/index.d.ts +1 -1
  5. package/components/breadcrumb/index.d.ts +1 -1
  6. package/components/breadcrumb/item.d.ts +1 -1
  7. package/components/button/group.d.ts +1 -1
  8. package/components/button/index.d.ts +1 -1
  9. package/components/card/column.d.ts +1 -1
  10. package/components/card/index.d.ts +1 -1
  11. package/components/carousel/index.d.ts +1 -1
  12. package/components/carousel/index.vdt.js +1 -1
  13. package/components/carousel/item.d.ts +1 -1
  14. package/components/carousel/item.vdt.js +1 -1
  15. package/components/carousel/useSlide.d.ts +1 -1
  16. package/components/cascader/index.d.ts +3 -3
  17. package/components/cascader/index.vdt.js +1 -0
  18. package/components/checkbox/index.d.ts +1 -1
  19. package/components/code/index.d.ts +1 -1
  20. package/components/collapse/index.d.ts +1 -1
  21. package/components/collapse/index.vdt.js +1 -1
  22. package/components/collapse/item.d.ts +1 -1
  23. package/components/collapse/item.vdt.js +1 -1
  24. package/components/colorpicker/drag.d.ts +1 -1
  25. package/components/colorpicker/index.d.ts +1 -1
  26. package/components/colorpicker/panel.d.ts +1 -1
  27. package/components/colorpicker/panel.vdt.js +1 -1
  28. package/components/config/index.d.ts +9 -2
  29. package/components/config/index.js +4 -3
  30. package/components/copy/index.d.ts +2 -1
  31. package/components/copy/index.js +2 -1
  32. package/components/copy/index.spec.js +64 -1
  33. package/components/copy/index.vdt.js +1 -1
  34. package/components/copy/useCopy.d.ts +1 -1
  35. package/components/copy/useCopy.js +3 -1
  36. package/components/datepicker/calendar.d.ts +1 -1
  37. package/components/datepicker/calendar.vdt.js +1 -1
  38. package/components/datepicker/index.d.ts +4 -4
  39. package/components/datepicker/index.vdt.js +1 -1
  40. package/components/datepicker/time.d.ts +1 -1
  41. package/components/datepicker/usePanel.d.ts +1 -1
  42. package/components/diagram/diagram.d.ts +1 -1
  43. package/components/diagram/layouts/layout.d.ts +1 -1
  44. package/components/diagram/shapes/line.d.ts +1 -1
  45. package/components/diagram/shapes/shape.d.ts +1 -1
  46. package/components/dialog/base.d.ts +2 -2
  47. package/components/dialog/base.js +1 -1
  48. package/components/dialog/base.vdt.js +4 -4
  49. package/components/dialog/index.spec.js +87 -5
  50. package/components/dialog/styles.js +1 -1
  51. package/components/drawer/index.d.ts +1 -1
  52. package/components/drawer/index.spec.js +6 -4
  53. package/components/dropdown/item.d.ts +1 -1
  54. package/components/dropdown/menu.d.ts +1 -1
  55. package/components/dropdown/menu.vdt.js +1 -1
  56. package/components/editable/index.d.ts +1 -1
  57. package/components/form/form.d.ts +1 -1
  58. package/components/form/item.d.ts +1 -1
  59. package/components/form/item.vdt.js +1 -1
  60. package/components/form/useError.d.ts +4 -4
  61. package/components/grid/col.d.ts +1 -1
  62. package/components/grid/row.d.ts +1 -1
  63. package/components/grid/useGutter.d.ts +3 -3
  64. package/components/icon/index.d.ts +1 -1
  65. package/components/input/index.d.ts +1 -1
  66. package/components/input/search.d.ts +1 -1
  67. package/components/input/styles.js +1 -1
  68. package/components/layout/aside.d.ts +1 -1
  69. package/components/layout/aside.vdt.js +1 -1
  70. package/components/layout/body.d.ts +1 -1
  71. package/components/layout/footer.d.ts +1 -1
  72. package/components/layout/header.d.ts +1 -1
  73. package/components/layout/layout.d.ts +1 -1
  74. package/components/menu/item.d.ts +1 -1
  75. package/components/menu/item.vdt.js +23 -3
  76. package/components/menu/menu.d.ts +2 -1
  77. package/components/menu/menu.js +2 -1
  78. package/components/menu/menu.vdt.js +1 -1
  79. package/components/menu/styles.d.ts +1 -0
  80. package/components/menu/styles.js +10 -2
  81. package/components/menu/useDropdown.d.ts +1 -1
  82. package/components/menu/useDropdown.js +3 -6
  83. package/components/message/message.d.ts +1 -1
  84. package/components/message/messages.d.ts +1 -1
  85. package/components/message/messages.vdt.js +1 -1
  86. package/components/pagination/index.d.ts +1 -1
  87. package/components/popover/content.d.ts +1 -1
  88. package/components/portal.d.ts +1 -1
  89. package/components/portal.js +7 -1
  90. package/components/progress/index.d.ts +1 -1
  91. package/components/radio/index.d.ts +1 -1
  92. package/components/rate/index.d.ts +1 -1
  93. package/components/rate/index.vdt.js +1 -1
  94. package/components/scrollSelect/index.d.ts +1 -1
  95. package/components/select/base.d.ts +1 -1
  96. package/components/select/base.vdt.js +1 -1
  97. package/components/select/group.d.ts +1 -1
  98. package/components/select/menu.d.ts +1 -1
  99. package/components/select/option.d.ts +1 -1
  100. package/components/select/option.vdt.js +1 -1
  101. package/components/select/select.d.ts +3 -3
  102. package/components/select/useCard.d.ts +1 -1
  103. package/components/select/useLabel.d.ts +1 -1
  104. package/components/select/useSearchable.d.ts +3 -3
  105. package/components/skeleton/item.d.ts +1 -1
  106. package/components/skeleton/skeleton.d.ts +1 -1
  107. package/components/slider/index.d.ts +1 -1
  108. package/components/slider/index.vdt.js +1 -1
  109. package/components/slider/useDraggable.d.ts +2 -2
  110. package/components/slider/useTooltip.d.ts +1 -1
  111. package/components/spin/index.d.ts +1 -1
  112. package/components/spin/index.vdt.js +1 -1
  113. package/components/spinner/index.d.ts +1 -1
  114. package/components/split/index.d.ts +1 -1
  115. package/components/split/memo.d.ts +1 -1
  116. package/components/split/useDraggable.d.ts +2 -2
  117. package/components/steps/context.d.ts +1 -1
  118. package/components/steps/index.d.ts +1 -1
  119. package/components/steps/step.d.ts +1 -1
  120. package/components/steps/step.vdt.js +1 -1
  121. package/components/switch/index.d.ts +1 -1
  122. package/components/table/cell.d.ts +1 -1
  123. package/components/table/column.d.ts +2 -2
  124. package/components/table/column.vdt.js +1 -1
  125. package/components/table/row.d.ts +1 -1
  126. package/components/table/row.vdt.js +3 -3
  127. package/components/table/styles.js +3 -2
  128. package/components/table/table.d.ts +2 -2
  129. package/components/table/table.vdt.js +2 -2
  130. package/components/table/useColumns.d.ts +5 -5
  131. package/components/table/useFixedColumns.d.ts +2 -2
  132. package/components/table/useGroup.d.ts +4 -4
  133. package/components/table/useResizable.d.ts +2 -2
  134. package/components/table/useSortable.d.ts +3 -3
  135. package/components/tabs/index.d.ts +1 -1
  136. package/components/tabs/tab.d.ts +1 -1
  137. package/components/tabs/useScroll.d.ts +1 -1
  138. package/components/tag/base.d.ts +1 -1
  139. package/components/tag/index.vdt.js +1 -1
  140. package/components/tag/tags.d.ts +1 -1
  141. package/components/tag/tags.vdt.js +1 -1
  142. package/components/tag/useChildren.d.ts +1 -1
  143. package/components/tag/useDraggable.d.ts +1 -1
  144. package/components/tag/useNowrap.d.ts +3 -3
  145. package/components/timeline/item.d.ts +1 -1
  146. package/components/timeline/timeline.d.ts +1 -1
  147. package/components/timepicker/index.d.ts +2 -2
  148. package/components/timepicker/panelPicker.d.ts +4 -4
  149. package/components/timepicker/selectPicker.d.ts +1 -1
  150. package/components/transfer/index.d.ts +1 -1
  151. package/components/transfer/index.vdt.js +1 -1
  152. package/components/tree/index.d.ts +6 -4
  153. package/components/tree/index.js +5 -0
  154. package/components/tree/index.spec.js +60 -39
  155. package/components/tree/index.vdt.js +1 -1
  156. package/components/tree/styles.js +1 -1
  157. package/components/tree/useDraggable.js +12 -12
  158. package/components/tree/useExpanded.d.ts +1 -0
  159. package/components/tree/useExpanded.js +23 -7
  160. package/components/tree/useNodes.d.ts +1 -0
  161. package/components/treeSelect/index.d.ts +2 -1
  162. package/components/treeSelect/index.js +4 -0
  163. package/components/treeSelect/useValue.d.ts +1 -1
  164. package/components/upload/index.d.ts +7 -6
  165. package/components/upload/index.js +1 -0
  166. package/components/upload/index.vdt.js +1 -1
  167. package/components/upload/useFiles.js +21 -8
  168. package/components/utils.d.ts +1 -1
  169. package/components/virtual.d.ts +1 -1
  170. package/components/wave/index.d.ts +1 -1
  171. package/index.d.ts +2 -2
  172. package/index.js +2 -2
  173. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  export declare const context: {
2
- Provider: import('intact-react').ComponentConstructor<import("intact").Component<import("../context").ProviderProps<any>, {}, {}, {}>>;
3
- Consumer: import("intact").ComponentConstructor<import("intact").Component<import("../context").ConsumerProps<any>, {}, {}, {}>>;
4
- useContext: () => import("intact").RefObject<any>;
2
+ Provider: import('intact-react').ComponentConstructor<import('intact-react').Component<import("../context").ProviderProps<any>, {}, {}, {}>>;
3
+ Consumer: import('intact-react').ComponentConstructor<import('intact-react').Component<import("../context").ConsumerProps<any>, {}, {}, {}>>;
4
+ useContext: () => import('intact-react').RefObject<any>;
5
5
  };
6
6
  export declare function useSortable(): {
7
7
  onChange: (key: string, event: Event & {
@@ -15,7 +15,7 @@ export interface TabsEvents<T = any> {
15
15
  remove: [T];
16
16
  }
17
17
  export declare class Tabs<T = any> extends Component<TabsProps<T>, TabsEvents<T>> {
18
- static template: string | import("intact").Template<any>;
18
+ static template: string | import('intact-react').Template<any>;
19
19
  static typeDefs: Required<TypeDefs<TabsProps<any>>>;
20
20
  static defaults: () => Partial<TabsProps<any>>;
21
21
  static events: Events<TabsEvents<any>>;
@@ -9,7 +9,7 @@ export interface TabEvents {
9
9
  click: [MouseEvent];
10
10
  }
11
11
  export declare class Tab extends Component<TabProps, TabEvents> {
12
- static template: string | import("intact").Template<any>;
12
+ static template: string | import('intact-react').Template<any>;
13
13
  private tabs;
14
14
  private config;
15
15
  private onClick;
@@ -6,5 +6,5 @@ export declare function useScroll(): {
6
6
  prev: () => void;
7
7
  next: () => void;
8
8
  scrollRef: import('intact-react').RefObject<HTMLElement>;
9
- wrapperRef: import("intact").RefObject<HTMLElement>;
9
+ wrapperRef: import('intact-react').RefObject<HTMLElement>;
10
10
  };
@@ -16,7 +16,7 @@ export interface TagBlocks {
16
16
  }
17
17
  export declare const typeDefs: Required<TypeDefs<TagProps>>;
18
18
  export declare class Tag<T extends TagProps = TagProps, E extends TagEvents = TagEvents, B extends TagBlocks = TagBlocks> extends Component<T, E, B> {
19
- static template: string | import("intact").Template<any>;
19
+ static template: string | import('intact-react').Template<any>;
20
20
  static typeDefs: Required<TypeDefs<TagProps>>;
21
21
  static defaults: () => Partial<TagProps>;
22
22
  static events: Events<TagEvents>;
@@ -3,7 +3,7 @@ import { createUnknownComponentVNode as _$cc, createVNode as _$cv, className as
3
3
  import { Icon } from '../icon';
4
4
  import { getRestProps } from '../utils';
5
5
  import { makeStyles } from './styles';
6
- import { Transition } from 'intact';
6
+ import { Transition } from 'intact-react';
7
7
  export default function ($props, $blocks, $__proto__) {
8
8
  var _classNameObj;
9
9
 
@@ -17,7 +17,7 @@ export interface TagsEvents {
17
17
  dragend: [TagsDragEndParam];
18
18
  }
19
19
  export declare class Tags extends Component<TagsProps, TagsEvents> {
20
- static template: string | import("intact").Template<any>;
20
+ static template: string | import('intact-react').Template<any>;
21
21
  static typeDefs: Required<TypeDefs<TagsProps>>;
22
22
  static defaults: () => Partial<TagsProps>;
23
23
  static events: Events<TagsEvents>;
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/extends";
2
2
  import { createVNode as _$cv, className as _$cn, createUnknownComponentVNode as _$cc, createTextVNode as _$ct, extend as _$ex, EMPTY_OBJ as _$em, createElementVNode as _$ce, noop as _$no } from 'intact-react';
3
- import { TransitionGroup } from 'intact';
3
+ import { TransitionGroup } from 'intact-react';
4
4
  import { getRestProps } from '../utils';
5
5
  import { makeTagsStyles } from './styles';
6
6
  import { Tag } from './';
@@ -1,2 +1,2 @@
1
1
  import { VNode } from 'intact-react';
2
- export declare function useChildren(): import("../../hooks/useState").State<VNode<import("intact").VNodeTag>[]>;
2
+ export declare function useChildren(): import("../../hooks/useState").State<VNode<import('intact-react').VNodeTag>[]>;
@@ -1,3 +1,3 @@
1
1
  import { VNode } from 'intact-react';
2
2
  import { State } from '../../hooks/useState';
3
- export declare function useDraggable(originVNodes: State<VNode[]>): State<VNode<import("intact").VNodeTag>[]>;
3
+ export declare function useDraggable(originVNodes: State<VNode[]>): State<VNode<import('intact-react').VNodeTag>[]>;
@@ -1,7 +1,7 @@
1
1
  import { VNode } from 'intact-react';
2
2
  import { State } from '../../hooks/useState';
3
3
  export declare function useNowrap(originVNodes: State<VNode[]>): {
4
- containerRef: import("intact").RefObject<HTMLDivElement>;
5
- children: State<VNode<import("intact").VNodeTag>[]>;
6
- hiddenChildren: State<VNode<import("intact").VNodeTag>[]>;
4
+ containerRef: import('intact-react').RefObject<HTMLDivElement>;
5
+ children: State<VNode<import('intact-react').VNodeTag>[]>;
6
+ hiddenChildren: State<VNode<import('intact-react').VNodeTag>[]>;
7
7
  };
@@ -11,7 +11,7 @@ export interface TimelineItemBlocks {
11
11
  dot: null;
12
12
  }
13
13
  export declare class TimelineItem extends Component<TimelineItemProps, TimelineItemEvents, TimelineItemBlocks> {
14
- static template: string | import("intact").Template<any>;
14
+ static template: string | import('intact-react').Template<any>;
15
15
  static typeDefs: Required<TypeDefs<TimelineItemProps>>;
16
16
  static defaults: () => Partial<TimelineItemProps>;
17
17
  private config;
@@ -2,6 +2,6 @@ import { Component } from 'intact-react';
2
2
  export interface TimelineProps {
3
3
  }
4
4
  export declare class Timeline extends Component<TimelineProps> {
5
- static template: string | import("intact").Template<any>;
5
+ static template: string | import('intact-react').Template<any>;
6
6
  private config;
7
7
  }
@@ -5,6 +5,6 @@ import { SelectPicker } from './selectPicker';
5
5
  export type { TimepickerProps, TimepickerEvents, TimepickerBlocks };
6
6
  export declare class Timepicker<Multipe extends boolean = false, Range extends boolean = false> extends Component<TimepickerProps<Multipe, Range>, TimepickerEvents, TimepickerBlocks<Range>> {
7
7
  static $doubleVNodes: boolean;
8
- static template(this: Timepicker): import("intact").VNode<typeof SelectPicker> | import("intact").VNode<typeof PanelPicker>;
9
- static typeDefs: Required<import("intact").TypeDefs<TimepickerProps<boolean, boolean>>>;
8
+ static template(this: Timepicker): import('intact-react').VNode<typeof SelectPicker> | import('intact-react').VNode<typeof PanelPicker>;
9
+ static typeDefs: Required<import('intact-react').TypeDefs<TimepickerProps<boolean, boolean>>>;
10
10
  }
@@ -5,7 +5,7 @@ import { State } from '../../hooks/useState';
5
5
  import { PanelTypes } from '../datepicker/usePanel';
6
6
  import { TimepickerProps, TimepickerEvents, TimepickerBlocks } from './constants';
7
7
  export declare class PanelPicker<Multipe extends boolean = false, Range extends boolean = false> extends BasePicker<TimepickerProps<Multipe, Range>, TimepickerEvents, TimepickerBlocks> {
8
- static template: string | import("intact").Template<any>;
8
+ static template: string | import('intact-react').Template<any>;
9
9
  static typeDefs: Required<TypeDefs<TimepickerProps<boolean, boolean>>>;
10
10
  formats: {
11
11
  getValueFormat: () => string;
@@ -29,8 +29,8 @@ export declare class PanelPicker<Multipe extends boolean = false, Range extends
29
29
  changePanel: (type: PanelTypes, flag?: import("../datepicker/usePanel").PanelFlags) => void;
30
30
  getPanel: (flag: import("../datepicker/usePanel").PanelFlags) => State<PanelTypes>;
31
31
  reset: () => void;
32
- startRef: import("intact").RefObject<import("../datepicker/calendar").DatepickerCalendar>;
33
- endRef: import("intact").RefObject<import("../datepicker/calendar").DatepickerCalendar>;
32
+ startRef: import('intact-react').RefObject<import("../datepicker/calendar").DatepickerCalendar>;
33
+ endRef: import('intact-react').RefObject<import("../datepicker/calendar").DatepickerCalendar>;
34
34
  };
35
35
  value: {
36
36
  format: () => string | string[];
@@ -49,6 +49,6 @@ export declare class PanelPicker<Multipe extends boolean = false, Range extends
49
49
  label: string;
50
50
  }[] | null>;
51
51
  };
52
- protected getPlaceholder(): string | number | boolean | import("misstime/dist/utils/types").VNode<any> | import("intact").Children[];
52
+ protected getPlaceholder(): string | number | boolean | import("misstime/dist/utils/types").VNode<any> | import('intact-react').Children[];
53
53
  protected getLabel(): string | string[];
54
54
  }
@@ -1,7 +1,7 @@
1
1
  import { Component, TypeDefs } from 'intact-react';
2
2
  import { TimepickerProps, TimepickerEvents, TimepickerBlocks } from './constants';
3
3
  export declare class SelectPicker extends Component<TimepickerProps, TimepickerEvents, TimepickerBlocks> {
4
- static template: string | import("intact").Template<any>;
4
+ static template: string | import('intact-react').Template<any>;
5
5
  static typeDefs: Required<TypeDefs<TimepickerProps<boolean, boolean>>>;
6
6
  formats: {
7
7
  getValueFormat: () => string;
@@ -36,7 +36,7 @@ export interface TransferBlocks<T, V> {
36
36
  label: [T, V, Model];
37
37
  }
38
38
  export declare class Transfer<K extends string = 'key', L extends string = 'label', T extends TransferDataItem<K, L> = TransferDataItem<K, L>, V extends T[K] = T[K]> extends Component<TransferProps<K, L, T, V>, TransferEvents, TransferBlocks<T, V>> {
39
- static template: string | import("intact").Template<any>;
39
+ static template: string | import('intact-react').Template<any>;
40
40
  static typeDefs: Required<TypeDefs<TransferProps<"key", "label", TransferDataItem<"key", "label">, Key>>>;
41
41
  static defaults: () => Partial<TransferProps<"key", "label", TransferDataItem<"key", "label">, Key>>;
42
42
  static events: Events<TransferEvents>;
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/extends";
2
2
  import _filterInstanceProperty from "@babel/runtime-corejs3/core-js/instance/filter";
3
3
  import { createElementVNode as _$ce, createTextVNode as _$ct, className as _$cn, createUnknownComponentVNode as _$cc, noop as _$no, extend as _$ex, EMPTY_OBJ as _$em, map as _$ma, createVNode as _$cv } from 'intact-react';
4
- import { linkEvent, Transition, TransitionGroup } from 'intact';
4
+ import { linkEvent, Transition, TransitionGroup } from 'intact-react';
5
5
  import { getRestProps } from '../utils';
6
6
  import { makeStyles } from './styles';
7
7
  import { Input } from '../input';
@@ -2,7 +2,8 @@ import { Component, Key, TypeDefs } from 'intact-react';
2
2
  import { DataItem, Node } from './useNodes';
3
3
  import { Mode } from './useDraggable';
4
4
  import type { Events } from '../types';
5
- export type { Node as TreeNode, DataItem as TreeDataItem, Mode as TreeMode, };
5
+ export type { Node as TreeNode, DataItem as TreeDataItem, };
6
+ export { Mode as TreeMode };
6
7
  export interface TreeProps<K extends Key = Key> {
7
8
  data?: DataItem<K>[];
8
9
  filter?: Filter<K>;
@@ -18,11 +19,11 @@ export interface TreeProps<K extends Key = Key> {
18
19
  showLine?: boolean;
19
20
  draggable?: boolean;
20
21
  allowDrag?: (node: Node<K>) => boolean;
21
- allowDrop?: (node: Node<K>) => boolean;
22
+ allowDrop?: (node: Node<K>, srcNode: Node<K>, mode: Mode) => boolean;
22
23
  }
23
24
  export interface TreeEvents<K extends Key> {
24
25
  denydrag: [Node<K>];
25
- denydrop: [Node<K>];
26
+ denydrop: [Node<K>, Node<K>, Mode];
26
27
  dragend: [DragEndData<K>];
27
28
  transitionEnd: [];
28
29
  }
@@ -37,7 +38,7 @@ declare type DragEndData<K extends Key> = {
37
38
  export declare type TreeDragEndData<K extends Key = Key> = DragEndData<K>;
38
39
  declare type Filter<K extends Key> = (data: DataItem<K>, node: Node<K>) => boolean;
39
40
  export declare class Tree<K extends Key = Key> extends Component<TreeProps<K>, TreeEvents<K>, TreeBlocks<K>> {
40
- static template: string | import("intact").Template<any>;
41
+ static template: string | import('intact-react').Template<any>;
41
42
  static typeDefs: Required<TypeDefs<TreeProps<Key>>>;
42
43
  static defaults: () => Partial<TreeProps<Key>>;
43
44
  static events: Events<TreeEvents<Key>>;
@@ -54,5 +55,6 @@ export declare class Tree<K extends Key = Key> extends Component<TreeProps<K>, T
54
55
  expand(key: K): void;
55
56
  shrink(key: K): void;
56
57
  getNodes(): Node<K>[];
58
+ expandAll(): void;
57
59
  private onClick;
58
60
  }
@@ -13,6 +13,7 @@ import { useFilter } from './useFilter';
13
13
  import { useDraggable, Mode } from './useDraggable';
14
14
  import { useTransitionEvent } from './useTransitionEvent';
15
15
  import { useConfigContext } from '../config';
16
+ export { Mode as TreeMode };
16
17
  var typeDefs = {
17
18
  data: Array,
18
19
  filter: Function,
@@ -98,6 +99,10 @@ export var Tree = /*#__PURE__*/function (_Component) {
98
99
  return this.nodes.getNodes();
99
100
  };
100
101
 
102
+ _proto.expandAll = function expandAll() {
103
+ this.expanded.expandAll();
104
+ };
105
+
101
106
  _proto.onClick = function onClick(node) {
102
107
  if (node.data.disabled) return;
103
108
 
@@ -306,7 +306,7 @@ describe('Tree', function () {
306
306
  }, _callee6);
307
307
  })));
308
308
  it('draggable', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
309
- var onDenyDrag, onDenyDrop, onDragEnd, _mount7, instance, element, disabled, nodes, notAllowed;
309
+ var onDenyDrag, onDenyDrop, onDragEnd, _mount7, instance, element, _element$querySelecto13, notAllowed, file1, file2, dir1, file3, dir2, disabled;
310
310
 
311
311
  return _regeneratorRuntime.wrap(function _callee7$(_context7) {
312
312
  while (1) {
@@ -320,53 +320,74 @@ describe('Tree', function () {
320
320
  DraggableDemo.prototype.onDenyDrop = onDenyDrop;
321
321
  DraggableDemo.prototype.onDragEnd = onDragEnd;
322
322
  _mount7 = mount(DraggableDemo), instance = _mount7[0], element = _mount7[1];
323
- instance.set('expandedKeys', ['2', '2-1', '1', '1-1']);
323
+ instance.set('expandedKeys', ['guide']);
324
324
  _context7.next = 11;
325
325
  return wait(500);
326
326
 
327
327
  case 11:
328
- // can not drag disabled item
329
- disabled = element.querySelector('.k-disabled'); // dispatchEvent(disabled, 'mousedown');
328
+ _element$querySelecto13 = element.querySelectorAll('.k-tree-label'), notAllowed = _element$querySelecto13[0], file1 = _element$querySelecto13[1], file2 = _element$querySelecto13[2], dir1 = _element$querySelecto13[3], file3 = _element$querySelecto13[4], dir2 = _element$querySelecto13[5], disabled = _element$querySelecto13[6]; // can not drag disabled item
330
329
 
331
330
  dispatchEvent(disabled, 'dragstart');
332
- expect(onDenyDrag.callCount).to.eql(1);
333
- nodes = element.querySelectorAll('.k-tree-label'); // can not drag not-allowed item
334
-
335
- notAllowed = nodes[2]; // dispatchEvent(notAllowed, 'mousedown');
331
+ expect(onDenyDrag.callCount).to.eql(1); // can not drag not-allowed item
336
332
 
337
333
  dispatchEvent(notAllowed, 'dragstart');
338
- expect(onDenyDrag.callCount).to.eql(2); // drag insert
339
-
340
- return _context7.abrupt("return", dragInsert(nodes[6], nodes[6]).then(function () {
341
- // drag to self will do nothing
342
- expect(element.innerHTML).to.matchSnapshot();
343
- expect(onDragEnd.callCount).to.eql(0);
344
- return dragInsert(nodes[6], notAllowed);
345
- }).then(function () {
346
- // drag to not-allowed item will do nothing
347
- expect(element.innerHTML).to.matchSnapshot();
348
- expect(onDragEnd.callCount).to.eql(0);
349
- return dragInsert(nodes[6], disabled);
350
- }).then(function () {
351
- // drag to disabled item will do nothing
352
- expect(element.innerHTML).to.matchSnapshot();
353
- expect(onDragEnd.callCount).to.eql(0);
354
- return dragInsert(nodes[6], nodes[5], 'before');
355
- }).then(function () {
356
- expect(element.innerHTML).to.matchSnapshot();
357
- expect(onDragEnd.callCount).to.eql(1);
358
- expect(instance.get('data')).to.matchSnapshot();
359
- return dragInsert(nodes[6], nodes[5], 'after');
360
- }).then(function () {
361
- expect(element.innerHTML).to.matchSnapshot();
362
- expect(instance.get('data')).to.matchSnapshot();
363
- return dragInsert(nodes[6], nodes[5]);
364
- }).then(function () {
365
- expect(element.innerHTML).to.matchSnapshot();
366
- expect(instance.get('data')).to.matchSnapshot();
367
- }));
334
+ expect(onDenyDrag.callCount).to.eql(2);
335
+ _context7.next = 18;
336
+ return dragInsert(dir1, dir1);
337
+
338
+ case 18:
339
+ // drag to self will do nothing
340
+ expect(element.innerHTML).to.matchSnapshot();
341
+ expect(onDragEnd.callCount).to.eql(0);
342
+ _context7.next = 22;
343
+ return dragInsert(file1, notAllowed);
344
+
345
+ case 22:
346
+ // drag to not-allowed item will do nothing
347
+ expect(element.innerHTML).to.matchSnapshot();
348
+ expect(onDragEnd.callCount).to.eql(0);
349
+ _context7.next = 26;
350
+ return dragInsert(file1, disabled);
368
351
 
369
- case 19:
352
+ case 26:
353
+ // drag to disabled item will do nothing
354
+ expect(element.innerHTML).to.matchSnapshot();
355
+ expect(onDragEnd.callCount).to.eql(0);
356
+ _context7.next = 30;
357
+ return dragInsert(file2, file1, 'before');
358
+
359
+ case 30:
360
+ expect(element.innerHTML).to.matchSnapshot();
361
+ expect(onDragEnd.callCount).to.eql(1);
362
+ expect(instance.get('data')).to.matchSnapshot();
363
+ _context7.next = 35;
364
+ return dragInsert(file2, file1, 'after');
365
+
366
+ case 35:
367
+ expect(element.innerHTML).to.matchSnapshot();
368
+ expect(onDragEnd.callCount).to.eql(2);
369
+ expect(instance.get('data')).to.matchSnapshot();
370
+ _context7.next = 40;
371
+ return dragInsert(file1, dir1);
372
+
373
+ case 40:
374
+ expect(onDragEnd.callCount).to.eql(3);
375
+ expect(element.innerHTML).to.matchSnapshot();
376
+ expect(instance.get('data')).to.matchSnapshot();
377
+ _context7.next = 45;
378
+ return dragInsert(dir2, dir1);
379
+
380
+ case 45:
381
+ expect(onDragEnd.callCount).to.eql(3);
382
+ expect(onDenyDrag.callCount).to.eql(2);
383
+ _context7.next = 49;
384
+ return dragInsert(dir2, file3, 'before');
385
+
386
+ case 49:
387
+ expect(onDragEnd.callCount).to.eql(3);
388
+ expect(onDenyDrag.callCount).to.eql(2);
389
+
390
+ case 51:
370
391
  case "end":
371
392
  return _context7.stop();
372
393
  }
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime-corejs3/helpers/extends";
2
2
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
3
3
  import _filterInstanceProperty from "@babel/runtime-corejs3/core-js/instance/filter";
4
4
  import { createElementVNode as _$ce, createUnknownComponentVNode as _$cc, className as _$cn, noop as _$no, createVNode as _$cv } from 'intact-react';
5
- import { Transition, TransitionGroup, linkEvent } from 'intact';
5
+ import { Transition, TransitionGroup, linkEvent } from 'intact-react';
6
6
  import { Checkbox } from '../checkbox';
7
7
  import { getRestProps } from '../utils';
8
8
  import { makeStyles } from './styles';
@@ -69,5 +69,5 @@ setDefault(function () {
69
69
  }).tree;
70
70
  });
71
71
  export function makeStyles(k) {
72
- return /*#__PURE__*/css("font-size:", tree.fontSize, ";line-height:", tree.lineHeight, ";position:relative;.", k, "-tree-label{position:relative;display:flex;align-items:center;&.", k, "-before,&.", k, "-after{&:before{position:absolute;content:'';display:block;border-top:", tree.dragging.border, ";width:100%;left:0;}}&.", k, "-before:before{top:0;}&.", k, "-after:before{bottom:0;}&.", k, "-inner{background:", tree.selected.bgColor, ";}}.", k, "-tree-icon,.", k, "-tree-text{cursor:pointer;}.", k, "-tree-text{padding:", tree.textPadding, ";border-radius:", tree.borderRadius, ";flex:1;}.", k, "-tree-leaf{padding-left:", tree.leafIndent, ";}.", k, "-tree-icon{width:", tree.iconWidth, ";text-align:center;color:", tree.iconColor, ";&:before{transform:rotate(-90deg);transition:transform ", tree.transition, ";}}.", k, "-tree-checkbox{margin-right:", tree.checkboxGap, ";}&.", k, "-selectable{.", k, "-tree-node{&.", k, "-selected{>.", k, "-tree-label .", k, "-tree-text{background:", tree.selected.bgColor, "!important;}}}}.", k, "-tree-node{background:#fff;&:not(.", k, "-disabled){>.", k, "-tree-label .", k, "-tree-text:hover{background:", theme.color.bg, ";}}&.", k, "-expanded{>.", k, "-tree-label .", k, "-tree-icon:before{transform:rotate(0);}}&.", k, "-disabled{>.", k, "-tree-label{color:", tree.disabledColor, ";.", k, "-tree-text{cursor:not-allowed;}}}&.", k, "-dragging{background:", tree.dragging.bgColor, ";.", k, "-tree-node{background:", tree.dragging.bgColor, ";}}}.", k, "-tree{margin-left:", tree.marginLeft, ";padding-left:", tree.paddingLeft, ";}&.", k, "-line .", k, "-tree{border-left:", tree.line, ";}");
72
+ return /*#__PURE__*/css("font-size:", tree.fontSize, ";line-height:", tree.lineHeight, ";position:relative;.", k, "-tree-label{position:relative;display:flex;align-items:center;&.", k, "-before,&.", k, "-after{&:before{position:absolute;content:'';display:block;border-top:", tree.dragging.border, ";width:100%;left:0;}}&.", k, "-before:before{top:0;}&.", k, "-after:before{bottom:0;}&.", k, "-inner{background:", tree.selected.bgColor, ";}}.", k, "-tree-icon,.", k, "-tree-text{cursor:pointer;}.", k, "-tree-text{padding:", tree.textPadding, ";border-radius:", tree.borderRadius, ";flex:1;display:flex;align-items:center;}.", k, "-tree-leaf{padding-left:", tree.leafIndent, ";}.", k, "-tree-icon{width:", tree.iconWidth, ";text-align:center;color:", tree.iconColor, ";&:before{transform:rotate(-90deg);transition:transform ", tree.transition, ";}}.", k, "-tree-checkbox{margin-right:", tree.checkboxGap, ";}&.", k, "-selectable{.", k, "-tree-node{&.", k, "-selected{>.", k, "-tree-label .", k, "-tree-text{background:", tree.selected.bgColor, "!important;}}}}.", k, "-tree-node{background:#fff;&:not(.", k, "-disabled){>.", k, "-tree-label .", k, "-tree-text:hover{background:", theme.color.bg, ";}}&.", k, "-expanded{>.", k, "-tree-label .", k, "-tree-icon:before{transform:rotate(0);}}&.", k, "-disabled{>.", k, "-tree-label{color:", tree.disabledColor, ";.", k, "-tree-text{cursor:not-allowed;}}}&.", k, "-dragging{background:", tree.dragging.bgColor, ";.", k, "-tree-node{background:", tree.dragging.bgColor, ";}}}.", k, "-tree{margin-left:", tree.marginLeft, ";padding-left:", tree.paddingLeft, ";}&.", k, "-line .", k, "-tree{border-left:", tree.line, ";}");
73
73
  }
@@ -57,18 +57,18 @@ export function useDraggable() {
57
57
  if (node !== overNode || newMode !== mode.value) {
58
58
  overNode = node;
59
59
  mode.set(newMode);
60
- overKey.set(node.key); // if the node does not allow drop, prevent the dragging ndoe from inserting to it
61
-
62
- if (mode.value === Mode.Inner) {
63
- var _instance$get2 = instance.get(),
64
- allowDrop = _instance$get2.allowDrop;
65
-
66
- if (node.data.disabled || allowDrop && !allowDrop(node)) {
67
- instance.trigger('denydrop', node);
68
- valid = false;
69
- return;
70
- }
71
- }
60
+ overKey.set(node.key); // if the node does not allow drop, prevent the dragging node from inserting to it
61
+ // if (mode.value === Mode.Inner) {
62
+
63
+ var _instance$get2 = instance.get(),
64
+ allowDrop = _instance$get2.allowDrop;
65
+
66
+ if (node.data.disabled || allowDrop && !allowDrop(node, draggingNode, newMode)) {
67
+ instance.trigger('denydrop', node, draggingNode, newMode);
68
+ valid = false;
69
+ return;
70
+ } // }
71
+
72
72
 
73
73
  valid = true;
74
74
  }
@@ -3,4 +3,5 @@ import type { Node } from './useNodes';
3
3
  export declare function useExpanded(getNodes: () => Node<Key>[]): {
4
4
  get: () => Set<Key>;
5
5
  toggle: (node: Node<Key>) => Promise<void>;
6
+ expandAll: () => void;
6
7
  };
@@ -10,8 +10,23 @@ export function useExpanded(getNodes) {
10
10
  expandedKeys = new _Set(v);
11
11
  });
12
12
  onBeforeMount(function () {
13
- if (instance.get('defaultExpandAll')) {
14
- expandAll();
13
+ /**
14
+ * change the behavior
15
+ * if the data is undefined, we expand all keys after we received data
16
+ */
17
+ var _instance$get = instance.get(),
18
+ defaultExpandAll = _instance$get.defaultExpandAll,
19
+ data = _instance$get.data;
20
+
21
+ if (defaultExpandAll) {
22
+ if (data && data.length) {
23
+ expandAll();
24
+ } else {
25
+ instance.on("$receive:data", function cb() {
26
+ expandAll();
27
+ instance.off("$receive:data", cb);
28
+ });
29
+ }
15
30
  }
16
31
  });
17
32
 
@@ -21,13 +36,13 @@ export function useExpanded(getNodes) {
21
36
 
22
37
  function _toggle() {
23
38
  _toggle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(node) {
24
- var _instance$get2, load, key, expanded;
39
+ var _instance$get3, load, key, expanded;
25
40
 
26
41
  return _regeneratorRuntime.wrap(function _callee$(_context) {
27
42
  while (1) {
28
43
  switch (_context.prev = _context.next) {
29
44
  case 0:
30
- _instance$get2 = instance.get(), load = _instance$get2.load;
45
+ _instance$get3 = instance.get(), load = _instance$get3.load;
31
46
  key = node.key;
32
47
  expanded = expandedKeys.has(key);
33
48
 
@@ -64,8 +79,8 @@ export function useExpanded(getNodes) {
64
79
  }
65
80
 
66
81
  function expandAll() {
67
- var _instance$get = instance.get(),
68
- load = _instance$get.load;
82
+ var _instance$get2 = instance.get(),
83
+ load = _instance$get2.load;
69
84
 
70
85
  var loop = function loop(nodes) {
71
86
  for (var i = 0; i < nodes.length; i++) {
@@ -89,6 +104,7 @@ export function useExpanded(getNodes) {
89
104
  get: function get() {
90
105
  return expandedKeys;
91
106
  },
92
- toggle: toggle
107
+ toggle: toggle,
108
+ expandAll: expandAll
93
109
  };
94
110
  }
@@ -5,6 +5,7 @@ export declare type DataItem<K extends Key> = {
5
5
  disabled?: boolean;
6
6
  loaded?: boolean;
7
7
  children?: DataItem<K>[];
8
+ [key: string]: any;
8
9
  };
9
10
  export declare function useNodes(): {
10
11
  getNodes: () => Node<Key>[];
@@ -16,11 +16,12 @@ export interface TreeSelectEvents extends BaseSelectEvents {
16
16
  export interface TreeSelectBlocks<K> extends BaseSelectBlocks<K> {
17
17
  }
18
18
  export declare class TreeSelect<K extends Key = Key, Checkbox extends boolean = false, Multipe extends boolean = Checkbox extends true ? true : false> extends BaseSelect<TreeSelectProps<K, Multipe, Checkbox>, TreeSelectEvents, TreeSelectBlocks<K>> {
19
- static template: string | import("intact").Template<any>;
19
+ static template: string | import('intact-react').Template<any>;
20
20
  static typeDefs: Required<TypeDefs<TreeSelectProps<Key, boolean, boolean>>>;
21
21
  static defaults: () => Partial<TreeSelectProps<Key, boolean, boolean>>;
22
22
  private value;
23
23
  init(): void;
24
+ expandAll(): void;
24
25
  protected getPlaceholder(): string | number | boolean | import("misstime/dist/utils/types").VNode<any> | Children[];
25
26
  protected getLabel(): Children;
26
27
  private filter;
@@ -66,6 +66,10 @@ export var TreeSelect = /*#__PURE__*/function (_BaseSelect) {
66
66
  });
67
67
  };
68
68
 
69
+ _proto.expandAll = function expandAll() {
70
+ this.value.treeRef.value.expandAll();
71
+ };
72
+
69
73
  _proto.getPlaceholder = function getPlaceholder() {
70
74
  var _this$get = this.get(),
71
75
  placeholder = _this$get.placeholder;
@@ -3,7 +3,7 @@ import type { Tree } from '../tree';
3
3
  export declare function useValue(): {
4
4
  selectedKeys: import("../../hooks/useState").State<Key[]>;
5
5
  checkedKeys: import("../../hooks/useState").State<Key[]>;
6
- treeRef: import("intact").RefObject<Tree<Key>>;
6
+ treeRef: import('intact-react').RefObject<Tree<Key>>;
7
7
  onChangeCheckedKeys: () => void;
8
8
  onChangeSelectedKeys: (keys: Key[]) => void;
9
9
  };
@@ -2,7 +2,8 @@ import { Component, TypeDefs } from 'intact-react';
2
2
  import { UploadFileStatus } from './useUpload';
3
3
  import type { RequestError } from './ajaxUploader';
4
4
  import type { Events } from '../types';
5
- export type { RequestError, UploadFileStatus };
5
+ export type { RequestError };
6
+ export { UploadFileStatus };
6
7
  export interface UploadProps {
7
8
  accept?: string;
8
9
  files?: UploadFile[];
@@ -33,13 +34,13 @@ export interface UploadBlocks {
33
34
  tip: null;
34
35
  }
35
36
  export declare type UploadFile = {
36
- status: UploadFileStatus;
37
+ status?: UploadFileStatus;
37
38
  type?: string;
38
39
  size?: number;
39
40
  name: string;
40
- percent: number;
41
- uid: number;
42
- raw: File | Partial<UploadFile>;
41
+ percent?: number;
42
+ uid?: number | string;
43
+ raw?: File | Partial<UploadFile>;
43
44
  url?: string;
44
45
  request?: any;
45
46
  };
@@ -47,7 +48,7 @@ declare type BeforeCallback = (file: UploadFile, files: UploadFile[]) => Promise
47
48
  declare type DataObject = Record<string | number, any>;
48
49
  declare type DataFunction = (file: UploadFile) => DataObject;
49
50
  export declare class Upload extends Component<UploadProps, UploadEvents, UploadBlocks> {
50
- static template: string | import("intact").Template<any>;
51
+ static template: string | import('intact-react').Template<any>;
51
52
  static typeDefs: Required<TypeDefs<UploadProps>>;
52
53
  static defaults: () => Partial<UploadProps>;
53
54
  static events: Events<UploadEvents>;
@@ -10,6 +10,7 @@ import { bind } from '../utils';
10
10
  import { useDrag } from './useDrag';
11
11
  import { useShowImage } from './useShowImage';
12
12
  import { useConfigContext } from '../config';
13
+ export { UploadFileStatus };
13
14
  var typeDefs = {
14
15
  accept: String,
15
16
  files: Array,
@@ -5,7 +5,7 @@ import { Progress } from '../progress';
5
5
  import { Dialog } from '../dialog';
6
6
  import { expandAnimationCallbacks, getRestProps } from '../utils';
7
7
  import { makeStyles, makeUploadDialogStyles } from './styles';
8
- import { TransitionGroup, Transition, linkEvent } from 'intact';
8
+ import { TransitionGroup, Transition, linkEvent } from 'intact-react';
9
9
  import { _$ } from '../../i18n';
10
10
  import { Icon } from '../icon';
11
11
  import { UploadFileStatus } from './useUpload';