@king-design/vue 3.1.0-beta.2 → 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.
- package/components/copy/index.d.ts +1 -0
- package/components/copy/index.js +2 -1
- package/components/copy/index.spec.js +64 -1
- package/components/copy/useCopy.d.ts +1 -1
- package/components/copy/useCopy.js +3 -1
- package/components/dialog/base.js +1 -1
- package/components/dialog/base.vdt.js +3 -3
- package/components/dialog/styles.js +1 -1
- package/components/menu/item.vdt.js +22 -2
- package/components/menu/menu.d.ts +1 -0
- package/components/menu/menu.js +2 -1
- package/components/menu/menu.vdt.js +1 -1
- package/components/menu/styles.d.ts +1 -0
- package/components/menu/styles.js +10 -2
- package/components/menu/useDropdown.js +3 -6
- package/components/table/row.vdt.js +1 -1
- package/components/table/table.vdt.js +1 -1
- package/components/tree/index.d.ts +5 -3
- package/components/tree/index.js +5 -0
- package/components/tree/index.spec.js +60 -39
- package/components/tree/styles.js +1 -1
- package/components/tree/useDraggable.js +12 -12
- package/components/tree/useExpanded.d.ts +1 -0
- package/components/tree/useExpanded.js +2 -1
- package/components/tree/useNodes.d.ts +1 -0
- package/components/treeSelect/index.d.ts +1 -0
- package/components/treeSelect/index.js +4 -0
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +1 -1
package/components/copy/index.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
1
2
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
3
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
2
4
|
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
3
5
|
import BasicDemo from '~/components/copy/demos/basic';
|
|
4
|
-
import { mount, unmount } from '../../test/utils';
|
|
6
|
+
import { mount, unmount, wait } from '../../test/utils';
|
|
7
|
+
import { Tooltip } from '../tooltip';
|
|
8
|
+
import { Component } from 'intact-vue-next';
|
|
9
|
+
import { Copy } from '.';
|
|
5
10
|
describe('Copy', function () {
|
|
6
11
|
afterEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
7
12
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
@@ -49,4 +54,62 @@ describe('Copy', function () {
|
|
|
49
54
|
}
|
|
50
55
|
}, _callee2, null, [[2, 9]]);
|
|
51
56
|
})));
|
|
57
|
+
it('wrap copy with tooltip', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
58
|
+
var Demo, _mount2, instance, element, text;
|
|
59
|
+
|
|
60
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context4) {
|
|
61
|
+
while (1) {
|
|
62
|
+
switch (_context4.prev = _context4.next) {
|
|
63
|
+
case 0:
|
|
64
|
+
Demo = /*#__PURE__*/function (_Component) {
|
|
65
|
+
_inheritsLoose(Demo, _Component);
|
|
66
|
+
|
|
67
|
+
function Demo() {
|
|
68
|
+
var _context3;
|
|
69
|
+
|
|
70
|
+
var _this;
|
|
71
|
+
|
|
72
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
73
|
+
args[_key] = arguments[_key];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context3 = [this]).call(_context3, args)) || this;
|
|
77
|
+
_this.Tooltip = Tooltip;
|
|
78
|
+
_this.Copy = Copy;
|
|
79
|
+
return _this;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return Demo;
|
|
83
|
+
}(Component);
|
|
84
|
+
|
|
85
|
+
Demo.template = "\n const { Tooltip, Copy } = this;\n <Tooltip content=\"test\">\n <Copy text=\"test\" />\n </Tooltip>\n ";
|
|
86
|
+
_mount2 = mount(Demo), instance = _mount2[0], element = _mount2[1];
|
|
87
|
+
element.click();
|
|
88
|
+
_context4.next = 6;
|
|
89
|
+
return wait();
|
|
90
|
+
|
|
91
|
+
case 6:
|
|
92
|
+
_context4.prev = 6;
|
|
93
|
+
_context4.next = 9;
|
|
94
|
+
return navigator.clipboard.readText();
|
|
95
|
+
|
|
96
|
+
case 9:
|
|
97
|
+
text = _context4.sent;
|
|
98
|
+
expect(text).to.eql('test');
|
|
99
|
+
_context4.next = 16;
|
|
100
|
+
break;
|
|
101
|
+
|
|
102
|
+
case 13:
|
|
103
|
+
_context4.prev = 13;
|
|
104
|
+
_context4.t0 = _context4["catch"](6);
|
|
105
|
+
// Read permisson denied
|
|
106
|
+
console.log(_context4.t0);
|
|
107
|
+
|
|
108
|
+
case 16:
|
|
109
|
+
case "end":
|
|
110
|
+
return _context4.stop();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}, _callee3, null, [[6, 13]]);
|
|
114
|
+
})));
|
|
52
115
|
});
|
|
@@ -8,7 +8,7 @@ export function useCopy() {
|
|
|
8
8
|
var success = useState(false);
|
|
9
9
|
var timer;
|
|
10
10
|
return {
|
|
11
|
-
startCopy: function startCopy() {
|
|
11
|
+
startCopy: function startCopy(e) {
|
|
12
12
|
var _instance$get = instance.get(),
|
|
13
13
|
text = _instance$get.text,
|
|
14
14
|
showMessage = _instance$get.showMessage;
|
|
@@ -30,6 +30,8 @@ export function useCopy() {
|
|
|
30
30
|
success.set(false);
|
|
31
31
|
instance.trigger('error');
|
|
32
32
|
}
|
|
33
|
+
|
|
34
|
+
instance.trigger('click', e);
|
|
33
35
|
},
|
|
34
36
|
success: success
|
|
35
37
|
};
|
|
@@ -142,7 +142,7 @@ export var BaseDialog = /*#__PURE__*/function (_Component) {
|
|
|
142
142
|
};
|
|
143
143
|
|
|
144
144
|
_proto.onClickWrapper = function onClickWrapper(e) {
|
|
145
|
-
if (this.get('closable')) {
|
|
145
|
+
if (this.get('closable') && e.target === this.overlayRef.value) {
|
|
146
146
|
this.terminate();
|
|
147
147
|
}
|
|
148
148
|
};
|
|
@@ -123,15 +123,15 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
123
123
|
|
|
124
124
|
return _$cc(Portal, {
|
|
125
125
|
'container': container,
|
|
126
|
-
'children': _$ce(2, 'div',
|
|
126
|
+
'children': _$ce(2, 'div', overlay ? _$cc(Transition, {
|
|
127
127
|
'key': 'overlay',
|
|
128
128
|
'show': overlay ? value : false,
|
|
129
129
|
'appear': value,
|
|
130
130
|
'name': 'k-fade',
|
|
131
|
-
'children': _$ce(2, 'div',
|
|
131
|
+
'children': _$ce(2, 'div', dialog, 0, _$cn(k + "-dialog-overlay"), {
|
|
132
132
|
'ev-click': this.onClickWrapper
|
|
133
133
|
}, null, this.overlayRef)
|
|
134
|
-
}, 'overlay') :
|
|
134
|
+
}, 'overlay') : dialog, 0, _$cn((_$cn2 = {}, _$cn2[k + "-dialog-wrapper"] = true, _$cn2[k + "-open"] = value, _$cn2[makeWrapperStyles(k)] = true, _$cn2)))
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
;
|
|
@@ -92,7 +92,7 @@ export function makeDialogStyles(k) {
|
|
|
92
92
|
export function makeWrapperStyles(k) {
|
|
93
93
|
//.${k}-fade-leave-active will add position absolute to the styles
|
|
94
94
|
// so we must set fixed with important to .${k}-dialog-overlay
|
|
95
|
-
return /*#__PURE__*/css("position:absolute;z-index:", theme.maxZIndex, ";top:0;left:0;width:100%;.", k, "-dialog-overlay{position:fixed!important;top:0;left:0;width:100%;height:100%;background:rgba(0, 0, 0, .5);}");
|
|
95
|
+
return /*#__PURE__*/css("position:absolute;z-index:", theme.maxZIndex, ";top:0;left:0;width:100%;.", k, "-dialog-overlay{position:fixed!important;top:0;left:0;width:100%;height:100%;background:rgba(0, 0, 0, .5);overflow:auto;}");
|
|
96
96
|
}
|
|
97
97
|
export function makeAlertStyles(k) {
|
|
98
98
|
var _context2;
|
|
@@ -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':
|
|
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',
|
package/components/menu/menu.js
CHANGED
|
@@ -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
|
-
}),
|
|
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, ";}
|
|
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, "
|
|
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);
|
|
@@ -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') {
|
|
@@ -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, {
|
|
@@ -2,7 +2,8 @@ import { Component, Key, TypeDefs } from 'intact-vue-next';
|
|
|
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,
|
|
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
|
|
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
|
}
|
package/components/tree/index.js
CHANGED
|
@@ -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,
|
|
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', ['
|
|
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);
|
|
339
|
-
|
|
340
|
-
return
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
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
|
|
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
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
}
|
|
@@ -21,6 +21,7 @@ export declare class TreeSelect<K extends Key = Key, Checkbox extends 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;
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v3.1.0-beta.
|
|
2
|
+
* @king-design v3.1.0-beta.3
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -60,7 +60,7 @@ export * from './components/tree';
|
|
|
60
60
|
export * from './components/treeSelect';
|
|
61
61
|
export * from './components/upload';
|
|
62
62
|
export * from './components/wave';
|
|
63
|
-
export declare const version = "3.1.0-beta.
|
|
63
|
+
export declare const version = "3.1.0-beta.3";
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
export {normalize} from 'intact-vue-next';
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v3.1.0-beta.
|
|
2
|
+
* @king-design v3.1.0-beta.3
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -62,7 +62,7 @@ export * from './components/tree';
|
|
|
62
62
|
export * from './components/treeSelect';
|
|
63
63
|
export * from './components/upload';
|
|
64
64
|
export * from './components/wave';
|
|
65
|
-
export var version = '3.1.0-beta.
|
|
65
|
+
export var version = '3.1.0-beta.3';
|
|
66
66
|
/* generate end */
|
|
67
67
|
|
|
68
68
|
export {normalize} from 'intact-vue-next';
|