@king-design/intact 3.1.0-beta.1 → 3.1.0-beta.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 (90) hide show
  1. package/components/colorpicker/styles.ts +4 -4
  2. package/components/copy/index.spec.ts +28 -0
  3. package/components/copy/index.ts +2 -0
  4. package/components/copy/useCopy.ts +9 -4
  5. package/components/dialog/base.ts +1 -1
  6. package/components/dialog/base.vdt +2 -2
  7. package/components/dialog/styles.ts +1 -0
  8. package/components/editable/index.vdt +7 -5
  9. package/components/layout/aside.ts +4 -2
  10. package/components/layout/body.ts +2 -0
  11. package/components/layout/index.md +1 -0
  12. package/components/layout/styles.ts +10 -2
  13. package/components/layout/useParse.ts +1 -1
  14. package/components/menu/demos/basic.md +1 -1
  15. package/components/menu/item.vdt +17 -2
  16. package/components/menu/menu.ts +4 -0
  17. package/components/menu/menu.vdt +1 -1
  18. package/components/menu/styles.ts +20 -16
  19. package/components/menu/useDropdown.ts +3 -6
  20. package/components/message/styles.ts +2 -2
  21. package/components/select/styles.ts +1 -1
  22. package/components/table/cell.vdt +1 -1
  23. package/components/table/column.vdt +1 -1
  24. package/components/table/row.vdt +2 -2
  25. package/components/table/styles.ts +2 -2
  26. package/components/table/table.vdt +1 -1
  27. package/components/table/useFixedColumns.ts +3 -2
  28. package/components/tooltip/styles.ts +1 -1
  29. package/components/tree/demos/draggable.md +63 -48
  30. package/components/tree/index.md +4 -3
  31. package/components/tree/index.spec.ts +39 -40
  32. package/components/tree/index.ts +8 -3
  33. package/components/tree/styles.ts +2 -0
  34. package/components/tree/useDraggable.ts +5 -5
  35. package/components/tree/useExpanded.ts +1 -1
  36. package/components/tree/useNodes.ts +1 -0
  37. package/components/treeSelect/index.md +7 -1
  38. package/components/treeSelect/index.ts +4 -0
  39. package/es/components/colorpicker/styles.js +2 -2
  40. package/es/components/copy/index.d.ts +1 -0
  41. package/es/components/copy/index.js +2 -1
  42. package/es/components/copy/index.spec.js +64 -1
  43. package/es/components/copy/useCopy.d.ts +1 -1
  44. package/es/components/copy/useCopy.js +11 -5
  45. package/es/components/dialog/base.js +1 -1
  46. package/es/components/dialog/base.vdt.js +3 -3
  47. package/es/components/dialog/styles.js +1 -1
  48. package/es/components/editable/index.vdt.js +8 -5
  49. package/es/components/layout/aside.d.ts +1 -0
  50. package/es/components/layout/aside.js +5 -3
  51. package/es/components/layout/body.js +2 -1
  52. package/es/components/layout/styles.d.ts +2 -1
  53. package/es/components/layout/styles.js +7 -2
  54. package/es/components/layout/useParse.js +1 -1
  55. package/es/components/menu/item.vdt.js +22 -2
  56. package/es/components/menu/menu.d.ts +1 -0
  57. package/es/components/menu/menu.js +2 -1
  58. package/es/components/menu/menu.vdt.js +1 -1
  59. package/es/components/menu/styles.d.ts +1 -0
  60. package/es/components/menu/styles.js +10 -2
  61. package/es/components/menu/useDropdown.js +3 -6
  62. package/es/components/message/styles.js +1 -1
  63. package/es/components/select/styles.js +1 -1
  64. package/es/components/table/cell.vdt.js +1 -1
  65. package/es/components/table/column.vdt.js +1 -1
  66. package/es/components/table/row.vdt.js +1 -1
  67. package/es/components/table/styles.js +1 -1
  68. package/es/components/table/table.vdt.js +1 -1
  69. package/es/components/table/useFixedColumns.d.ts +1 -1
  70. package/es/components/table/useFixedColumns.js +2 -2
  71. package/es/components/tooltip/styles.js +1 -1
  72. package/es/components/tree/index.d.ts +5 -3
  73. package/es/components/tree/index.js +5 -0
  74. package/es/components/tree/index.spec.js +60 -39
  75. package/es/components/tree/styles.js +1 -1
  76. package/es/components/tree/useDraggable.js +12 -12
  77. package/es/components/tree/useExpanded.d.ts +1 -0
  78. package/es/components/tree/useExpanded.js +2 -1
  79. package/es/components/tree/useNodes.d.ts +1 -0
  80. package/es/components/treeSelect/index.d.ts +1 -0
  81. package/es/components/treeSelect/index.js +4 -0
  82. package/es/index.d.ts +2 -2
  83. package/es/index.js +2 -2
  84. package/es/site/data/components/menu/demos/basic/react.js +2 -2
  85. package/es/site/data/components/tree/demos/draggable/index.d.ts +23 -17
  86. package/es/site/data/components/tree/demos/draggable/index.js +45 -35
  87. package/es/site/data/components/tree/demos/draggable/react.d.ts +23 -17
  88. package/es/site/data/components/tree/demos/draggable/react.js +54 -35
  89. package/index.ts +2 -2
  90. package/package.json +2 -2
@@ -5,6 +5,7 @@ export interface AsideProps {
5
5
  fixed?: boolean;
6
6
  theme?: MenuProps['theme'];
7
7
  width?: number | string;
8
+ collapsedWidth?: number | string;
8
9
  }
9
10
  export declare class Aside extends Component<AsideProps> {
10
11
  static template: string | import("intact").Template<any>;
@@ -10,7 +10,8 @@ var typeDefs = {
10
10
  collapse: Boolean,
11
11
  fixed: Boolean,
12
12
  theme: themes,
13
- width: [Number, String]
13
+ width: [Number, String],
14
+ collapsedWidth: [Number, String]
14
15
  };
15
16
 
16
17
  var defaults = function defaults() {
@@ -44,10 +45,11 @@ export var Aside = /*#__PURE__*/function (_Component) {
44
45
  var _this$get = this.get(),
45
46
  fixed = _this$get.fixed,
46
47
  width = _this$get.width,
47
- collapse = _this$get.collapse;
48
+ collapse = _this$get.collapse,
49
+ collapsedWidth = _this$get.collapsedWidth;
48
50
 
49
51
  var style = addStyle(this.get('style'), {
50
- width: !collapse ? getStyle(width) : getCollapseWidth()
52
+ width: !collapse ? getStyle(width) : getCollapseWidth(collapsedWidth)
51
53
  });
52
54
  if (!fixed) return style;
53
55
 
@@ -5,6 +5,7 @@ import template from './template.vdt';
5
5
  import { LAYOUT, getStyle, BODY } from './helpers';
6
6
  import { addStyle } from '../utils';
7
7
  import { useConfigContext } from '../config';
8
+ import { makeBodyStyles } from './styles';
8
9
  export var Body = /*#__PURE__*/function (_Component) {
9
10
  _inheritsLoose(Body, _Component);
10
11
 
@@ -36,7 +37,7 @@ export var Body = /*#__PURE__*/function (_Component) {
36
37
  className = _this$get.className;
37
38
 
38
39
  var k = this.config.k;
39
- return _ref = {}, _ref[k + "-layout-body"] = true, _ref[className] = className, _ref;
40
+ return _ref = {}, _ref[k + "-layout-body"] = true, _ref[className] = className, _ref[makeBodyStyles(k)] = true, _ref;
40
41
  };
41
42
 
42
43
  _proto.getStyles = function getStyles() {
@@ -1,6 +1,7 @@
1
1
  import '../../styles/global';
2
2
  export declare const themes: readonly ["light", "dark", "white"];
3
- export declare function getCollapseWidth(): string;
3
+ export declare function getCollapseWidth(collapsedWidth?: string | number): string;
4
4
  export declare function makeLayoutStyles(k: string): string;
5
5
  export declare function makeHeaderStyles(k: string): string;
6
6
  export declare function makeAsideStyles(k: string): string;
7
+ export declare function makeBodyStyles(k: string): string;
@@ -4,6 +4,8 @@ import { theme, setDefault } from '../../styles/theme';
4
4
  import { deepDefaults, getLeft, setAlpha } from '../../styles/utils';
5
5
  import '../../styles/global';
6
6
  import { menu } from '../menu/styles';
7
+ import { isNullOrUndefined } from 'intact-shared';
8
+ import { getStyle } from './helpers';
7
9
  var sizes = ['small', 'large'];
8
10
  export var themes = ['light', 'dark', 'white'];
9
11
  var defaults = {
@@ -61,8 +63,8 @@ setDefault(function () {
61
63
  layout: defaults
62
64
  }).layout;
63
65
  });
64
- export function getCollapseWidth() {
65
- return layout.collapsedWidth;
66
+ export function getCollapseWidth(collapsedWidth) {
67
+ return isNullOrUndefined(collapsedWidth) ? layout.collapsedWidth : getStyle(collapsedWidth);
66
68
  }
67
69
  export function makeLayoutStyles(k) {
68
70
  return /*#__PURE__*/css("display:flex;flex-direction:column;flex:1;transition:padding-left ", layout.transition, ";&.", k, "-has-aside{flex-direction:row;}.", k, "-layout-footer{padding:", layout.footerPadding, ";}.", k, "-layout-body{flex:1;}");
@@ -80,4 +82,7 @@ export function makeAsideStyles(k) {
80
82
  var styles = layout[theme];
81
83
  return /*#__PURE__*/css("&.", k, "-", theme, "{background:", styles.bgColor, ";color:", styles.color, ";border-right:", styles.border, ";}");
82
84
  }), " &.", k, "-fixed{position:fixed;overflow:auto;left:0;top:0;bottom:0;z-index:", theme.midZIndex, ";}.", k, "-menu{width:auto!important;}");
85
+ }
86
+ export function makeBodyStyles(k) {
87
+ return /*#__PURE__*/css("transition:padding-left ", layout.transition, ";");
83
88
  }
@@ -31,7 +31,7 @@ export function useParse() {
31
31
  }
32
32
 
33
33
  if (props.collapse) {
34
- asideWidth = getCollapseWidth();
34
+ asideWidth = getCollapseWidth(props.collapsedWidth);
35
35
  }
36
36
 
37
37
  if (props.fixed) {
@@ -7,7 +7,7 @@ import { Icon } from '../icon';
7
7
  import { Menu } from './menu';
8
8
  import { getRestProps, expandAnimationCallbacks } from '../utils';
9
9
  import { isNullOrUndefined } from 'intact-shared';
10
- import { makeItemStyles, makeTitleStyles } from './styles';
10
+ import { makeItemStyles, makeTitleStyles, makeNestedMenuStyles } from './styles';
11
11
  export default function ($props, $blocks, $__proto__) {
12
12
  var _classNameObj,
13
13
  _this = this;
@@ -67,7 +67,27 @@ export default function ($props, $blocks, $__proto__) {
67
67
  'show': isExpanded,
68
68
  'key': 'subMenu'
69
69
  }, expandAnimationCallbacks, {
70
- 'children': subMenuVNode
70
+ 'children': function () {
71
+ if (subMenuVNode) {
72
+ var _$cn3;
73
+
74
+ var paddingLeft = _this.parentMenu.get('_paddingLeft');
75
+
76
+ var _makeNestedMenuStyles = makeNestedMenuStyles(k, showDot || !!iconVNode, paddingLeft),
77
+ _classname = _makeNestedMenuStyles[0],
78
+ _paddingLeft = _makeNestedMenuStyles[1];
79
+
80
+ var _className = _$cn((_$cn3 = {}, _$cn3[_classname] = true, _$cn3[subMenuVNode.className] = subMenuVNode.className, _$cn3));
81
+
82
+ var clonedVNode = directClone(subMenuVNode);
83
+ clonedVNode.props = _extends({}, clonedVNode.props, {
84
+ className: _className,
85
+ _paddingLeft: _paddingLeft
86
+ });
87
+ clonedVNode.className = _className;
88
+ return clonedVNode;
89
+ }
90
+ }()
71
91
  }), 'subMenu')] : !subMenuVNode ? isTopItem && isCollapse ? _$cc(Tooltip, {
72
92
  'position': rootMenu.get('type') !== 'horizontal' ? 'right' : 'bottom',
73
93
  'theme': rootMenu.get('theme') === 'dark' ? 'dark' : 'light',
@@ -9,6 +9,7 @@ export interface MenuProps<K extends Key = Key> {
9
9
  size?: 'large' | 'default' | 'small';
10
10
  accordion?: boolean;
11
11
  dot?: boolean;
12
+ _paddingLeft?: string;
12
13
  }
13
14
  export interface MenuEvents {
14
15
  }
@@ -12,7 +12,8 @@ var typeDefs = {
12
12
  type: ['vertical', 'horizontal'],
13
13
  size: ['large', 'default', 'small'],
14
14
  accordion: Boolean,
15
- dot: Boolean
15
+ dot: Boolean,
16
+ _paddingLeft: String
16
17
  };
17
18
 
18
19
  var defaults = function defaults() {
@@ -44,7 +44,7 @@ export default function ($props, $blocks, $__proto__) {
44
44
  }), 0, _$cn((_$cn2 = {}, _$cn2[k + "-menu-header"] = true, _$cn2[makeTitleStyles(k)] = true, _$cn2))) : undefined, children];
45
45
  return !isDropdownMenu ? _$cv('div', _extends({}, getRestProps(this), {
46
46
  'className': _$cn(classNameObj)
47
- }), [content, null]) : _$cc(DropdownMenu, _extends({}, getRestProps(this), {
47
+ }), content) : _$cc(DropdownMenu, _extends({}, getRestProps(this), {
48
48
  'className': _$cn(classNameObj),
49
49
  'children': content
50
50
  }));
@@ -65,3 +65,4 @@ export { menu };
65
65
  export declare function makeMenuStyles(k: string): string;
66
66
  export declare function makeTitleStyles(k: string): string;
67
67
  export declare function makeItemStyles(k: string): string;
68
+ export declare function makeNestedMenuStyles(k: string, hasIcon: boolean, parentPaddingLeft?: string): string[];
@@ -122,7 +122,7 @@ export function makeMenuStyles(k) {
122
122
 
123
123
  // we must increase the priority by adding &.${k}-menu
124
124
  // to override the css of dropdownMenu
125
- return /*#__PURE__*/css("&.", k, "-menu{width:", menu.width, ";transition:width ", menu.transition, ";background:", menu.bgColor, ";font-size:", menu.fontSize, ";}&:not(.", k, "-dropdown-menu) &:not(.", k, "-dropdown-menu){width:auto;background:", menu.subBgColor, ";.", k, "-menu-title{padding-left:calc(", getLeft(menu.item.padding), " + ", menu.icon.width, " + ", menu.icon.gap, ");}}&:not(.", k, "-dropdown-menu) &:not(.", k, "-dropdown-menu) &:not(.", k, "-dropdown-menu){.", k, "-menu-title{padding-left:calc(", getLeft(menu.item.padding), " + ", menu.icon.width, " * 2 + ", menu.icon.gap, ");}}.", k, "-icon{width:", menu.icon.width, ";margin-right:", menu.icon.gap, ";text-align:center;flex-shrink:0;}.", k, "-menu-header{height:", menu.header.height, ";font-size:", menu.header.fontSize, ";font-weight:bold;border-bottom:", menu.header.borderBottom, ";}", _mapInstanceProperty(_context = ['light', 'white']).call(_context, function (theme) {
125
+ return /*#__PURE__*/css("&.", k, "-menu{width:", menu.width, ";transition:width ", menu.transition, ";background:", menu.bgColor, ";font-size:", menu.fontSize, ";}.", k, "-icon{width:", menu.icon.width, ";margin-right:", menu.icon.gap, ";text-align:center;flex-shrink:0;}.", k, "-menu-header{height:", menu.header.height, ";font-size:", menu.header.fontSize, ";font-weight:bold;border-bottom:", menu.header.borderBottom, ";}", _mapInstanceProperty(_context = ['light', 'white']).call(_context, function (theme) {
126
126
  var styles = menu[theme];
127
127
  return /*#__PURE__*/css("&.", k, "-", theme, "{background:", styles.bgColor, ";.", k, "-menu-header{color:", styles.item.color, ";border-bottom:", styles.border, ";}.", k, "-menu-item{.", k, "-menu-title{color:", styles.item.color, ";&:hover{color:", styles.item.hoverColor, ";}}&.", k, "-highlighted{>.", k, "-menu-title{color:", styles.item.hoverColor, ";}}&.", k, "-disabled{>.", k, "-menu-title{color:", styles.item.disabledColor, "!important;}}}.", k, "-menu:not(.", k, "-dropdown-menu){background:", styles.subBgColor, ";}&.", k, "-horizontal{.", k, "-menu-header{border-right:", styles.border, ";}}}");
128
128
  }), " &.", k, "-white{.", k, "-menu-item.", k, "-active{>.", k, "-menu-title{color:", menu.white.active.color, "!important;background:", menu.white.active.bgColor, ";}}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
@@ -136,5 +136,13 @@ export function makeTitleStyles(k) {
136
136
  }
137
137
  export function makeItemStyles(k) {
138
138
  var item = menu.item;
139
- return /*#__PURE__*/css(".", k, "-menu-title{cursor:pointer;height:", menu.item.height, ";transition:all ", menu.transition, ";&:hover{color:", menu.item.hoverColor, ";}}.", k, "-menu-name{flex:1;display:flex;align-items:center;min-width:0;span{overflow:hidden;text-overflow:ellipsis;min-width:0;}}.", k, "-menu-arrow{transition:transform ", menu.transition, ";margin-left:", menu.icon.gap, ";}&.", k, "-expanded{>.", k, "-menu-title{color:", menu.item.hoverColor, ";.", k, "-menu-arrow{transform:rotateX(180deg);}}}&.", k, "-highlighted{>.", k, "-menu-title{color:", menu.item.hoverColor, ";}}&.", k, "-active{>.", k, "-menu-title{color:", menu.item.hoverColor, "!important;background:", menu.item.activeBgColor, ";}}&.", k, "-disabled{>.", k, "-menu-title{color:", menu.item.disabledColor, "!important;cursor:not-allowed;}}.", k, "-menu-dot{font-size:", menu.item.dotFontSize, ";transform:scale(.4);}");
139
+ return /*#__PURE__*/css(".", k, "-menu-title{cursor:pointer;height:", menu.item.height, ";&:hover{color:", menu.item.hoverColor, ";}}.", k, "-menu-name{flex:1;display:flex;align-items:center;min-width:0;span{overflow:hidden;text-overflow:ellipsis;min-width:0;}.", k, "-icon{color:inherit;}}.", k, "-menu-arrow{transition:transform ", menu.transition, ";margin:0 0 0 ", menu.icon.gap, ";}&.", k, "-expanded{>.", k, "-menu-title{color:", menu.item.hoverColor, ";.", k, "-menu-arrow{transform:rotateX(180deg);}}}&.", k, "-highlighted{>.", k, "-menu-title{color:", menu.item.hoverColor, ";}}&.", k, "-active{>.", k, "-menu-title{color:", menu.item.hoverColor, "!important;background:", menu.item.activeBgColor, ";}}&.", k, "-disabled{>.", k, "-menu-title{color:", menu.item.disabledColor, "!important;cursor:not-allowed;}}.", k, "-menu-dot{font-size:", menu.item.dotFontSize, ";transform:scale(.4);}");
140
+ }
141
+ export function makeNestedMenuStyles(k, hasIcon, parentPaddingLeft) {
142
+ if (parentPaddingLeft === void 0) {
143
+ parentPaddingLeft = getLeft(menu.item.padding);
144
+ }
145
+
146
+ var paddingLeft = "" + parentPaddingLeft + (hasIcon ? ' + ' + menu.icon.width : '') + " + " + menu.icon.gap;
147
+ return [/*#__PURE__*/css("&.", k, "-menu{width:auto;background:", menu.subBgColor, ";.", k, "-menu-title{padding-left:calc(", paddingLeft, ");}}"), paddingLeft];
140
148
  }
@@ -31,16 +31,13 @@ export function useDropdown(rootMenu, parentMenu) {
31
31
  eachChildren(children, function (vNode) {
32
32
  if (isComponentVNode(vNode, Menu)) {
33
33
  subMenuVNode = vNode;
34
- } else if (isTopItem && isCollapse) {
35
- if (isStringOrNumberNotEmpty(vNode) || isTextVNode(vNode)) {
36
- tooltipContents.push(vNode);
37
- } else if (!iconVNode && isComponentVNode(vNode, Icon)) {
38
- iconVNode = vNode;
39
- }
40
34
  } else {
41
35
  if (isStringOrNumberNotEmpty(vNode) || isTextVNode(vNode)) {
42
36
  // wrap with span for showing text ellipsis
43
37
  vNode = createVNode('span', null, vNode);
38
+ tooltipContents.push(vNode);
39
+ } else if (!iconVNode && isComponentVNode(vNode, Icon)) {
40
+ iconVNode = vNode;
44
41
  }
45
42
 
46
43
  titleVNodes.push(vNode);
@@ -57,7 +57,7 @@ export function makeMessagesStyles(k) {
57
57
  export function makeMessageStyles(k) {
58
58
  var _context;
59
59
 
60
- return /*#__PURE__*/css("text-align:center;width:100%;font-size:", message.fontSize, ";color:", message.color, ";.", k, "-message-container{display:inline-block;box-shadow:", message.boxShadow, ";border-radius:", message.borderRadius, ";margin-bottom:", message.gap, ";pointer-events:all;min-width:", message.minWidth, ";max-width:", message.maxWidth, ";position:relative;text-align:", message.textAlign, ";min-height:", message.minHeight, ";}.", k, "-message-wrapper{position:relative;display:inline-block;&.", k, "-with-icon{padding-left:calc(", message.icon.left, " + 14px);}}.", k, "-message-content{display:inline-block;padding:", message.padding, ";vertical-align:middle;word-break:bre.", k, "-word;word-wrap:bre.", k, "-word;}.", k, "-message-close{vertical-align:middle;position:absolute;right:0;top:0;&:hover{background:none;}}.", k, "-message-icon{position:absolute;left:", message.icon.left, ";top:", message.icon.top, ";font-size:", message.icon.fontSize, ";}", _mapInstanceProperty(_context = ['info', 'error', 'success', 'warning']).call(_context, function (type) {
60
+ return /*#__PURE__*/css("text-align:center;width:100%;font-size:", message.fontSize, ";color:", message.color, ";.", k, "-message-container{display:inline-block;box-shadow:", message.boxShadow, ";border-radius:", message.borderRadius, ";margin-bottom:", message.gap, ";pointer-events:all;min-width:", message.minWidth, ";max-width:", message.maxWidth, ";position:relative;text-align:", message.textAlign, ";min-height:", message.minHeight, ";}.", k, "-message-wrapper{position:relative;display:inline-block;&.", k, "-with-icon{padding-left:calc(", message.icon.left, " + 14px);}}.", k, "-message-content{display:inline-block;padding:", message.padding, ";vertical-align:middle;word-break:break-word;word-wrap:break-word;}.", k, "-message-close{vertical-align:middle;position:absolute;right:0;top:0;&:hover{background:none;}}.", k, "-message-icon{position:absolute;left:", message.icon.left, ";top:", message.icon.top, ";font-size:", message.icon.fontSize, ";}", _mapInstanceProperty(_context = ['info', 'error', 'success', 'warning']).call(_context, function (type) {
61
61
  var color = theme.color[type === 'error' ? 'danger' : type];
62
62
  return /*#__PURE__*/css("&.", k, "-", type, "{.", k, "-message-container{background:", palette(color, -4), ";}.", k, "-message-icon{color:", color, ";}}");
63
63
  }), "&.transition-enter-from,&.transition-leave-to{opacity:0;transform:", message.transform, ";}&.transition-enter-active,&.transition-leave-active{transition:transform ", message.transition, ",opacity ", message.transition, ";}&.transition-move{transition:transform ", message.transition, ";}");
@@ -174,7 +174,7 @@ setDefault(function () {
174
174
  }).select;
175
175
  });
176
176
  export default function makeStyles(k) {
177
- return /*#__PURE__*/css("display:inline-flex;align-items:center;vertical-align:middle;position:relative;width:", select.width, ";cursor:pointer;outline:none;border:", select.border, ";background:", select.bgColor, ";transition:border ", select.transition, ",background ", select.transition, ",box-shadow ", select.transition, ";border-radius:", select.borderRadius, ";.", k, "-select-main{flex:1;min-width:0;}.", k, "-select-prefix,.", k, "-select-suffix{display:flex;align-items:center;position:relative;}.", k, "-select-suffix{margin-left:", select.suffixGap, ";}.", k, "-select-placeholder{color:", select.placeholderColor, ";user-select:none;}.", k, "-input .", k, "-input-inner{background:transparent;}&.", k, "-fluid{width:100%;}.", k, "-select-clear{opacity:0;transition:opacity ", select.transition, ",color ", select.transition, "!important;pointer-events:none;position:absolute;z-index:1;top:50%;left:50%;transform:translate(-50%, -50%);}&:hover{border:", select.hoverBorder, ";.", k, "-select-clear.", k, "-show{opacity:1;pointer-events:all;+.", k, "-select-suffix-icon{opacity:0;}}}.", k, "-select-suffix-icon{display:inline-flex;align-items:center;transition:opacity ", select.transition, ";}.", k, "-select-arrow{display:inline-block;transition:transform ", select.transition, ";}&.", k, "-dropdown-open{border:", select.focusBorder, ";.", k, "-select-arrow{transform:rotateX(180deg);}}&:focus{outline:none;border:", select.focusBorder, ";}.", k, "-tags{padding:3px 0;}.", k, "-tag{word-break:bre.", k, "-word;height:auto;max-width:calc(100% - ", getRight(select.tag.margin), " - 1px);}", _mapInstanceProperty(sizes).call(sizes, function (size) {
177
+ return /*#__PURE__*/css("display:inline-flex;align-items:center;vertical-align:middle;position:relative;width:", select.width, ";cursor:pointer;outline:none;border:", select.border, ";background:", select.bgColor, ";transition:border ", select.transition, ",background ", select.transition, ",box-shadow ", select.transition, ";border-radius:", select.borderRadius, ";.", k, "-select-main{flex:1;min-width:0;}.", k, "-select-prefix,.", k, "-select-suffix{display:flex;align-items:center;position:relative;}.", k, "-select-suffix{margin-left:", select.suffixGap, ";}.", k, "-select-placeholder{color:", select.placeholderColor, ";user-select:none;}.", k, "-input .", k, "-input-inner{background:transparent;}&.", k, "-fluid{width:100%;}.", k, "-select-clear{opacity:0;transition:opacity ", select.transition, ",color ", select.transition, "!important;pointer-events:none;position:absolute;z-index:1;top:50%;left:50%;transform:translate(-50%, -50%);}&:hover{border:", select.hoverBorder, ";.", k, "-select-clear.", k, "-show{opacity:1;pointer-events:all;+.", k, "-select-suffix-icon{opacity:0;}}}.", k, "-select-suffix-icon{display:inline-flex;align-items:center;transition:opacity ", select.transition, ";}.", k, "-select-arrow{display:inline-block;transition:transform ", select.transition, ";}&.", k, "-dropdown-open{border:", select.focusBorder, ";.", k, "-select-arrow{transform:rotateX(180deg);}}&:focus{outline:none;border:", select.focusBorder, ";}.", k, "-tags{padding:3px 0;}.", k, "-tag{word-break:break-word;height:auto;max-width:calc(100% - ", getRight(select.tag.margin), " - 1px);}", _mapInstanceProperty(sizes).call(sizes, function (size) {
178
178
  var styles = select[size];
179
179
  var className = /*#__PURE__*/css("font-size:", styles.fontSize, ";min-height:", styles.height, ";padding:", styles.padding, ";");
180
180
  if (size === 'default') return className;
@@ -35,7 +35,7 @@ export default function ($props, $blocks, $__proto__) {
35
35
  }
36
36
  }
37
37
 
38
- var _getClassAndStyleForF = getClassAndStyleForFixed(props, offset, checkType),
38
+ var _getClassAndStyleForF = getClassAndStyleForFixed(props, offset, k, checkType),
39
39
  className = _getClassAndStyleForF.className,
40
40
  style = _getClassAndStyleForF.style;
41
41
 
@@ -66,7 +66,7 @@ export default function ($props, $blocks, $__proto__) {
66
66
  'children': function children(offsetMap) {
67
67
  var _classNameObj, _$cn2, _$cn4;
68
68
 
69
- var _getClassAndStyleForF = getClassAndStyleForFixed(_this.get(), offsetMap[key], checkType),
69
+ var _getClassAndStyleForF = getClassAndStyleForFixed(_this.get(), offsetMap[key], k, checkType),
70
70
  className = _getClassAndStyleForF.className,
71
71
  style = _getClassAndStyleForF.style;
72
72
 
@@ -62,7 +62,7 @@ export default function ($props, $blocks, $__proto__) {
62
62
  }, getClassAndStyleForFixed({
63
63
  fixed: hasFixedLeft ? 'left' : false,
64
64
  className: [k + "-table-check"]
65
- }, 0), spans), children));
65
+ }, 0, k), spans), children));
66
66
  };
67
67
 
68
68
  if (checkType === 'checkbox') {
@@ -102,7 +102,7 @@ setDefault(function () {
102
102
  }).table;
103
103
  });
104
104
  export function makeStyles(k) {
105
- return /*#__PURE__*/css("font-size:", table.fontSize, ";color:", table.color, ";position:relative;z-index:0;.", k, "-table-wrapper{border-bottom:", table.border, ";overflow:auto;border-radius:", table.borderRadius, ";}table{width:100%;border-spacing:0;table-layout:fixed;td,th{transition:all ", table.transition, ";}}thead{text-align:", table.thead.textAlign, ";font-size:", table.thead.fontSize, ";font-weight:", table.thead.fontWeight, ";position:sticky;top:0;z-index:2;tr{height:", table.thead.height, ";&:not(:last-of-type) th{border-bottom:", table.border, ";}}}th{padding:", table.thead.padding, ";position:relative;background:", table.thead.bgColor, ";line-height:normal;&:before{content:'';height:", table.thead.delimiterHeight, ";position:absolute;background-color:", table.thead.delimiterColor, ";width:1px;left:1px;top:50%;transform:translateY(-50%);}&:first-of-type:before{display:none;}}.", k, "-table-title{display:inline-flex;align-items:center;max-width:100%;color:", table.thead.color, ";}.", k, "-table-title-text{flex:1;display:inline-flex;line-height:1.4;}tbody{tr{&:hover td{background:", table.tbody.hoverBgcolor, ";}&:last-of-type td{border-bottom-color:transparent;}}}td{padding:", table.tbody.padding, ";border-bottom:", table.border, ";background:", table.bgColor, ";word-wrap:bre.", k, "-word;}.", k, "-fixed-left,.", k, "-fixed-right{position:sticky;z-index:1;&:after{content:'';display:block;transition:box-shadow ", table.transition, ";position:absolute;top:0;bottom:0px;width:10px;pointer-events:none;}}.", k, "-fixed-left:after{right:-11px;}.", k, "-fixed-right:after{left:-11px;}&.", k, "-scroll-left .", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}&.", k, "-scroll-right .", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}&.", k, "-scroll-middle{.", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}.", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}}.", k, "-fixed-right+.", k, "-fixed-right:after{display:none;}.", k, "-table-affix-header{position:sticky;top:0;left:0;.", k, "-affix-wrapper{overflow:hidden;}&.", k, "-fixed{position:relative;}}&.", k, "-border,&.", k, "-grid{.", k, "-table-wrapper{border-top:", table.border, ";border-left:", table.border, ";border-right:", table.border, ";}}&.", k, "-grid{td:not(:last-of-type),th:not(:last-of-type){border-right:", table.border, ";}th:before{display:none;}}&.", k, "-stripe{tr:nth-child(even):not(:hover) td{background:", table.stripeBgColor, ";}}.", k, "-table-group{margin-left:", table.group.gap, ";}.", k, "-table-check{.", k, "-checkbox,.", k, "-radio{position:relative;top:-1px;}}.", k, "-column-sortable{cursor:pointer;}.", k, "-column-sort{.", k, "-icon{display:block;height:", _sortInstanceProperty(table).iconHeight, ";line-height:", _sortInstanceProperty(table).iconHeight, ";margin:0 0 1px ", _sortInstanceProperty(table).gap, ";}&.", k, "-desc .", k, "-icon.", k, "-desc,&.", k, "-asc .", k, "-icon.", k, "-asc{color:", _sortInstanceProperty(table).enabledColor, ";}}.", k, "-table-spin.", k, "-overlay{z-index:2;}.", k, "-table-empty{text-align:center;}tr.", k, "-expand{td{padding:0;background:#fdfcff;}}&.", k, "-with-expand{tr:not(.", k, "-expand){td{border-bottom:none;}}}.", k, "-table-expand{border-top:", table.border, ";box-sizing:content-box;}tbody tr.", k, "-selected td{background:", table.selectedBgColor, ";}.", k, "-table-arrow{margin-right:", table.arrow.gap, ";transition:transform ", table.transition, ";position:relative;top:-1px;}tr.", k, "-spreaded{.", k, "-table-arrow{transform:rotate(90deg);}}.", k, "-table-resize{height:100%;width:", table.resizeWidth, ";position:absolute;top:0;left:-1px;cursor:ew-resize;}tr.", k, "-dragging{opacity:", table.draggingOpacity, ";}.", k, "-table-scrollbar{overflow-x:auto;overflow-y:hidden;}.", k, "-table-scrollbar-inner{height:1px;}", _mapInstanceProperty(aligns).call(aligns, function (type) {
105
+ return /*#__PURE__*/css("font-size:", table.fontSize, ";color:", table.color, ";position:relative;z-index:0;.", k, "-table-wrapper{border-bottom:", table.border, ";overflow:auto;border-radius:", table.borderRadius, ";}table{width:100%;border-spacing:0;table-layout:fixed;td,th{transition:all ", table.transition, ";}}thead{text-align:", table.thead.textAlign, ";font-size:", table.thead.fontSize, ";font-weight:", table.thead.fontWeight, ";position:sticky;top:0;z-index:2;tr{height:", table.thead.height, ";&:not(:last-of-type) th{border-bottom:", table.border, ";}}}th{padding:", table.thead.padding, ";position:relative;background:", table.thead.bgColor, ";line-height:normal;&:before{content:'';height:", table.thead.delimiterHeight, ";position:absolute;background-color:", table.thead.delimiterColor, ";width:1px;left:1px;top:50%;transform:translateY(-50%);}&:first-of-type:before{display:none;}}.", k, "-table-title{display:inline-flex;align-items:center;max-width:100%;color:", table.thead.color, ";}.", k, "-table-title-text{flex:1;display:inline-flex;line-height:1.4;}tbody{tr{&:hover td{background:", table.tbody.hoverBgcolor, ";}&:last-of-type td{border-bottom-color:transparent;}}}td{padding:", table.tbody.padding, ";border-bottom:", table.border, ";background:", table.bgColor, ";word-wrap:break-word;}.", k, "-fixed-left,.", k, "-fixed-right{position:sticky;z-index:1;&:after{content:'';display:block;transition:box-shadow ", table.transition, ";position:absolute;top:0;bottom:0px;width:10px;pointer-events:none;}}.", k, "-fixed-left:after{right:-11px;}.", k, "-fixed-right:after{left:-11px;}&.", k, "-scroll-left .", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}&.", k, "-scroll-right .", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}&.", k, "-scroll-middle{.", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}.", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}}.", k, "-fixed-right+.", k, "-fixed-right:after{display:none;}.", k, "-table-affix-header{position:sticky;top:0;left:0;.", k, "-affix-wrapper{overflow:hidden;}&.", k, "-fixed{position:relative;}}&.", k, "-border,&.", k, "-grid{.", k, "-table-wrapper{border-top:", table.border, ";border-left:", table.border, ";border-right:", table.border, ";}}&.", k, "-grid{td:not(:last-of-type),th:not(:last-of-type){border-right:", table.border, ";}th:before{display:none;}}&.", k, "-stripe{tr:nth-child(even):not(:hover) td{background:", table.stripeBgColor, ";}}.", k, "-table-group{margin-left:", table.group.gap, ";}.", k, "-table-check{.", k, "-checkbox,.", k, "-radio{position:relative;top:-1px;}}.", k, "-column-sortable{cursor:pointer;}.", k, "-column-sort{.", k, "-icon{display:block;height:", _sortInstanceProperty(table).iconHeight, ";line-height:", _sortInstanceProperty(table).iconHeight, ";margin:0 0 1px ", _sortInstanceProperty(table).gap, ";}&.", k, "-desc .", k, "-icon.", k, "-desc,&.", k, "-asc .", k, "-icon.", k, "-asc{color:", _sortInstanceProperty(table).enabledColor, ";}}.", k, "-table-spin.", k, "-overlay{z-index:2;}.", k, "-table-empty{text-align:center;}tr.", k, "-expand{td{padding:0;background:#fdfcff;}}&.", k, "-with-expand{tr:not(.", k, "-expand){td{border-bottom:none;}}}.", k, "-table-expand{border-top:", table.border, ";box-sizing:content-box;}tbody tr.", k, "-selected td{background:", table.selectedBgColor, ";}.", k, "-table-arrow{margin-right:", table.arrow.gap, ";transition:transform ", table.transition, ";position:relative;top:-1px;}tr.", k, "-spreaded{.", k, "-table-arrow{transform:rotate(90deg);}}.", k, "-table-resize{height:100%;width:", table.resizeWidth, ";position:absolute;top:0;left:-1px;cursor:ew-resize;}tr.", k, "-dragging{opacity:", table.draggingOpacity, ";}.", k, "-table-scrollbar{overflow-x:auto;overflow-y:hidden;}.", k, "-table-scrollbar-inner{height:1px;}", _mapInstanceProperty(aligns).call(aligns, function (type) {
106
106
  return /*#__PURE__*/css(".", k, "-align-", type, "{text-align:", type, ";}");
107
107
  }), ">.", k, "-pagination{margin:16px 0;}");
108
108
  }
@@ -131,7 +131,7 @@ export default function ($props, $blocks, $__proto__) {
131
131
  return _$ce(2, 'tr', function () {
132
132
  var ths = [$key === 0 && checkType !== 'none' ? _$cv('th', _extends({}, getClassAndStyleForFixed({
133
133
  fixed: hasFixedLeft ? 'left' : false
134
- }, 0), {
134
+ }, 0, k), {
135
135
  'rowspan': maxRows,
136
136
  'key': '$checktype'
137
137
  }), checkType === 'checkbox' ? _$cc(Checkbox, {
@@ -16,7 +16,7 @@ export declare function useFixedColumns(getColumns: () => VNodeComponentClass<Ta
16
16
  getHasFixedLeft: () => boolean;
17
17
  getOffsetMap: () => Record<Key, number>;
18
18
  };
19
- export declare function getClassAndStyleForFixed({ className, fixed, align }: Props<TableColumnProps>, offset: number, checkType?: TableProps['checkType']): {
19
+ export declare function getClassAndStyleForFixed({ className, fixed, align }: Props<TableColumnProps>, offset: number, k: string, checkType?: TableProps['checkType']): {
20
20
  className: string;
21
21
  style: {
22
22
  [x: string]: string;
@@ -121,7 +121,7 @@ export function useFixedColumns(getColumns, _ref, widthMap) {
121
121
  }
122
122
  };
123
123
  }
124
- export function getClassAndStyleForFixed(_ref2, offset, checkType) {
124
+ export function getClassAndStyleForFixed(_ref2, offset, k, checkType) {
125
125
  var _cx, _ref3;
126
126
 
127
127
  var className = _ref2.className,
@@ -129,7 +129,7 @@ export function getClassAndStyleForFixed(_ref2, offset, checkType) {
129
129
  align = _ref2.align;
130
130
  var extraOffset = checkType && checkType !== 'none' && fixed === 'left' ? 40 : 0;
131
131
  return {
132
- className: cx((_cx = {}, _cx[className] = !!className, _cx["k-fixed-" + fixed] = !!fixed, _cx["k-align-" + align] = !!align, _cx)),
132
+ className: cx((_cx = {}, _cx[className] = !!className, _cx[k + "-fixed-" + fixed] = !!fixed, _cx[k + "-align-" + align] = !!align, _cx)),
133
133
  style: fixed ? (_ref3 = {}, _ref3[fixed] = offset + extraOffset + "px", _ref3) : null
134
134
  };
135
135
  }
@@ -60,7 +60,7 @@ export default function makeStyles(k) {
60
60
  var arrowLong = tooltip.arrow.width;
61
61
  var arrowShort = "calc(" + arrowLong + " - 1px)"; // use &.${k}-tooltip-content to override css in dropdown menu
62
62
 
63
- return /*#__PURE__*/css("&.", k, "-tooltip-content{max-width:", tooltip.maxWidth, ";min-width:0;padding:", tooltip.padding, ";line-height:", tooltip.lineHeight, ";word-wrap:bre.", k, "-word;pointer-events:none;box-shadow:", tooltip.boxShadow, ";&.", k, "-hoverable,&.", k, "-always{pointer-events:all;}.", k, "-tooltip-arrow{pointer-events:none;&:before,&{position:absolute;display:block;border-style:solid;border-color:transparent;}&:before{content:' ';}&.", k, "-top,&.", k, "-bottom{&:before,&{border-width:", arrowLong, " ", arrowShort, ";}&:before{left:calc(-1 * ", arrowShort, ");}}&.", k, "-top{top:calc(-2 * ", arrowLong, ");&:before{top:calc(-", arrowLong, " + 1px);}}&.", k, "-bottom{bottom:calc(-2 * ", arrowLong, ");&:before{bottom:calc(-", arrowLong, " + 1px);}}&.", k, "-left,&.", k, "-right{&:before,&{border-width:", arrowShort, " ", arrowLong, ";}&:before{top:calc(-1 * ", arrowShort, ");}}&.", k, "-left{left:calc(-2 * ", arrowLong, ");&:before{left:calc(-", arrowLong, " + 1px);}}&.", k, "-right{right:calc(-2 * ", arrowLong, ");&:before{right:calc(-", arrowLong, " + 1px);}}}", _mapInstanceProperty(themes).call(themes, function (theme) {
63
+ return /*#__PURE__*/css("&.", k, "-tooltip-content{max-width:", tooltip.maxWidth, ";min-width:0;padding:", tooltip.padding, ";line-height:", tooltip.lineHeight, ";word-wrap:break-word;pointer-events:none;box-shadow:", tooltip.boxShadow, ";&.", k, "-hoverable,&.", k, "-always{pointer-events:all;}.", k, "-tooltip-arrow{pointer-events:none;&:before,&{position:absolute;display:block;border-style:solid;border-color:transparent;}&:before{content:' ';}&.", k, "-top,&.", k, "-bottom{&:before,&{border-width:", arrowLong, " ", arrowShort, ";}&:before{left:calc(-1 * ", arrowShort, ");}}&.", k, "-top{top:calc(-2 * ", arrowLong, ");&:before{top:calc(-", arrowLong, " + 1px);}}&.", k, "-bottom{bottom:calc(-2 * ", arrowLong, ");&:before{bottom:calc(-", arrowLong, " + 1px);}}&.", k, "-left,&.", k, "-right{&:before,&{border-width:", arrowShort, " ", arrowLong, ";}&:before{top:calc(-1 * ", arrowShort, ");}}&.", k, "-left{left:calc(-2 * ", arrowLong, ");&:before{left:calc(-", arrowLong, " + 1px);}}&.", k, "-right{right:calc(-2 * ", arrowLong, ");&:before{right:calc(-", arrowLong, " + 1px);}}}", _mapInstanceProperty(themes).call(themes, function (theme) {
64
64
  var _context;
65
65
 
66
66
  var borderColor;
@@ -2,7 +2,8 @@ import { Component, Key, TypeDefs } from 'intact';
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
  }
@@ -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
  }
@@ -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
  };
@@ -89,6 +89,7 @@ export function useExpanded(getNodes) {
89
89
  get: function get() {
90
90
  return expandedKeys;
91
91
  },
92
- toggle: toggle
92
+ toggle: toggle,
93
+ expandAll: expandAll
93
94
  };
94
95
  }
@@ -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>[];