@king-design/vue 2.1.0 → 2.1.1
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/__tests__/__snapshots__/Vue Next Demos.md +11 -11
- package/components/dropdown/dropdown.d.ts +6 -5
- package/components/dropdown/dropdown.js +40 -68
- package/components/dropdown/index.spec.js +96 -17
- package/components/dropdown/item.d.ts +1 -1
- package/components/dropdown/item.js +16 -4
- package/components/dropdown/usePosition.js +4 -2
- package/components/menu/index.spec.js +26 -15
- package/components/menu/item.d.ts +2 -0
- package/components/menu/item.js +5 -0
- package/components/pagination/index.js +4 -1
- package/components/pagination/index.spec.js +49 -0
- package/components/tooltip/content.d.ts +1 -0
- package/components/tooltip/content.js +18 -1
- package/components/tooltip/content.vdt.js +3 -1
- package/components/tooltip/index.spec.js +108 -0
- package/components/tooltip/styles.d.ts +22 -0
- package/components/tooltip/styles.js +1 -1
- package/components/tooltip/tooltip.d.ts +1 -0
- package/components/tooltip/tooltip.js +11 -0
- package/components/virtual.d.ts +8 -0
- package/components/virtual.js +126 -0
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +2 -2
|
@@ -1,4 +1,26 @@
|
|
|
1
1
|
import '../../styles/global';
|
|
2
|
+
declare const defaults: {
|
|
3
|
+
padding: string;
|
|
4
|
+
readonly color: string;
|
|
5
|
+
bgColor: string;
|
|
6
|
+
lineHeight: number;
|
|
7
|
+
maxWidth: string;
|
|
8
|
+
arrow: {
|
|
9
|
+
borderColor: string;
|
|
10
|
+
width: string;
|
|
11
|
+
};
|
|
12
|
+
confirm: {
|
|
13
|
+
gaps: string;
|
|
14
|
+
};
|
|
15
|
+
dark: {
|
|
16
|
+
readonly bgColor: string;
|
|
17
|
+
color: string;
|
|
18
|
+
readonly arrowBorderColor: string;
|
|
19
|
+
};
|
|
20
|
+
smallPadding: string;
|
|
21
|
+
};
|
|
22
|
+
export declare let tooltip: typeof defaults;
|
|
2
23
|
export declare type Theme = 'dark' | 'light';
|
|
3
24
|
export declare const themes: Theme[];
|
|
4
25
|
export default function makeStyles(): string;
|
|
26
|
+
export {};
|
|
@@ -23,5 +23,6 @@ export declare class Tooltip<T extends TooltipProps = TooltipProps, E extends To
|
|
|
23
23
|
static typeDefs: Required<TypeDefs<TooltipProps>>;
|
|
24
24
|
static defaults: () => Partial<TooltipProps>;
|
|
25
25
|
static events: Events<TooltipEvents>;
|
|
26
|
+
show(shouldFocus?: boolean): void;
|
|
26
27
|
hide(immediately: boolean): void;
|
|
27
28
|
}
|
|
@@ -25,6 +25,7 @@ var defaults = function defaults() {
|
|
|
25
25
|
at: 'center top',
|
|
26
26
|
collision: 'flipfit'
|
|
27
27
|
},
|
|
28
|
+
collison: 'flipfit',
|
|
28
29
|
hoverable: false,
|
|
29
30
|
always: false,
|
|
30
31
|
confirm: false,
|
|
@@ -48,6 +49,16 @@ export var Tooltip = /*#__PURE__*/function (_Dropdown) {
|
|
|
48
49
|
|
|
49
50
|
var _proto = Tooltip.prototype;
|
|
50
51
|
|
|
52
|
+
_proto.show = function show(shouldFocus) {
|
|
53
|
+
if (shouldFocus === void 0) {
|
|
54
|
+
shouldFocus = false;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (this.get('disabled')) return;
|
|
58
|
+
clearTimeout(this.timer);
|
|
59
|
+
this.set('value', true);
|
|
60
|
+
};
|
|
61
|
+
|
|
51
62
|
_proto.hide = function hide(immediately) {
|
|
52
63
|
if (this.get('always')) return;
|
|
53
64
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Component, VNode } from 'intact-vue-next';
|
|
2
|
+
export declare class Virtual extends Component<any> {
|
|
3
|
+
static template(this: Virtual): VNode<import("intact").VNodeTag>;
|
|
4
|
+
private vNodeProps;
|
|
5
|
+
private getVNodeProps;
|
|
6
|
+
private getEventProps;
|
|
7
|
+
private callEvent;
|
|
8
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime-corejs3/helpers/objectWithoutPropertiesLoose";
|
|
3
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
4
|
+
var _excluded = ["children"];
|
|
5
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
6
|
+
import _startsWithInstanceProperty from "@babel/runtime-corejs3/core-js/instance/starts-with";
|
|
7
|
+
import { Component, directClone, createVNode } from 'intact-vue-next';
|
|
8
|
+
import { isTextChildren } from './utils';
|
|
9
|
+
import { EMPTY_OBJ, isFunction, hasOwn } from 'intact-shared';
|
|
10
|
+
import { cx } from '@emotion/css';
|
|
11
|
+
var reactEventReg = /on[A-Z]/;
|
|
12
|
+
export var Virtual = /*#__PURE__*/function (_Component) {
|
|
13
|
+
_inheritsLoose(Virtual, _Component);
|
|
14
|
+
|
|
15
|
+
function Virtual() {
|
|
16
|
+
var _context;
|
|
17
|
+
|
|
18
|
+
var _this;
|
|
19
|
+
|
|
20
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
21
|
+
args[_key] = arguments[_key];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
25
|
+
_this.vNodeProps = null;
|
|
26
|
+
return _this;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
Virtual.template = function template() {
|
|
30
|
+
var _cx;
|
|
31
|
+
|
|
32
|
+
var _this$get = this.get(),
|
|
33
|
+
children = _this$get.children,
|
|
34
|
+
props = _objectWithoutPropertiesLoose(_this$get, _excluded);
|
|
35
|
+
|
|
36
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
37
|
+
if (!children || Array.isArray(children) && children.length !== 1) {
|
|
38
|
+
throw new Error('Component must receive one children');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var vNode = Array.isArray(children) ? children[0] : children;
|
|
43
|
+
var clonedVNode = isTextChildren(vNode) ? createVNode('span', null, vNode) : directClone(vNode);
|
|
44
|
+
var vNodeProps = this.vNodeProps = this.getVNodeProps(clonedVNode.props || EMPTY_OBJ);
|
|
45
|
+
var eventProps = this.getEventProps(); // merge className
|
|
46
|
+
|
|
47
|
+
var className = clonedVNode.className || vNodeProps.className;
|
|
48
|
+
className = cx((_cx = {}, _cx[className] = !!className, _cx[props.className] = !!props.className, _cx));
|
|
49
|
+
clonedVNode.props = _extends({}, props, vNodeProps, eventProps, {
|
|
50
|
+
className: className
|
|
51
|
+
});
|
|
52
|
+
clonedVNode.className = className;
|
|
53
|
+
return clonedVNode;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
var _proto = Virtual.prototype;
|
|
57
|
+
|
|
58
|
+
_proto.getVNodeProps = function getVNodeProps(props) {
|
|
59
|
+
var vnode = props.vnode;
|
|
60
|
+
if (!vnode) return props; // maybe we render the intact component in react slot property, in this case
|
|
61
|
+
// the $isReact is false. so use the vnode $$typeof field as gauge
|
|
62
|
+
|
|
63
|
+
if (vnode.$$typeof || vnode.__v_isVNode
|
|
64
|
+
/* vue3 vnode */
|
|
65
|
+
) {
|
|
66
|
+
var _props = vnode.props;
|
|
67
|
+
if (!_props) return props;
|
|
68
|
+
var events = {};
|
|
69
|
+
|
|
70
|
+
for (var key in _props) {
|
|
71
|
+
if (reactEventReg.test(key)) {
|
|
72
|
+
events["ev-" + key.substring(2).toLowerCase()] = _props[key];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return _extends({}, props, events, {
|
|
77
|
+
className: _props.className || _props.class
|
|
78
|
+
/* vue-next */
|
|
79
|
+
|
|
80
|
+
});
|
|
81
|
+
} else if (hasOwn.call(vnode, 'componentOptions')
|
|
82
|
+
/* vue2 vnode */
|
|
83
|
+
) {
|
|
84
|
+
var data = vnode.data;
|
|
85
|
+
var on = data && data.on || EMPTY_OBJ;
|
|
86
|
+
var _events = {};
|
|
87
|
+
|
|
88
|
+
for (var _key2 in on) {
|
|
89
|
+
_events["ev-" + _key2] = on[_key2];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return _extends({}, props, _events);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return props;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
_proto.getEventProps = function getEventProps() {
|
|
99
|
+
var _this2 = this;
|
|
100
|
+
|
|
101
|
+
var props = {};
|
|
102
|
+
|
|
103
|
+
var _loop = function _loop(prop) {
|
|
104
|
+
if (_startsWithInstanceProperty(prop).call(prop, 'ev-')) {
|
|
105
|
+
props[prop] = function (e) {
|
|
106
|
+
return _this2.callEvent(prop, e);
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
for (var prop in this.get()) {
|
|
112
|
+
_loop(prop);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return props;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
_proto.callEvent = function callEvent(name, e) {
|
|
119
|
+
var callback = this.vNodeProps[name];
|
|
120
|
+
var callbackOnVirtual = this.get(name);
|
|
121
|
+
if (isFunction(callback)) callback(e);
|
|
122
|
+
if (isFunction(callbackOnVirtual)) callbackOnVirtual(e);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
return Virtual;
|
|
126
|
+
}(Component);
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.1.
|
|
2
|
+
* @king-design v2.1.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -57,7 +57,7 @@ export * from './components/tree';
|
|
|
57
57
|
export * from './components/treeSelect';
|
|
58
58
|
export * from './components/upload';
|
|
59
59
|
export * from './components/wave';
|
|
60
|
-
export declare const version = "2.1.
|
|
60
|
+
export declare const version = "2.1.1";
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
export {normalize} from 'intact-vue-next';
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.1.
|
|
2
|
+
* @king-design v2.1.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -59,7 +59,7 @@ export * from './components/tree';
|
|
|
59
59
|
export * from './components/treeSelect';
|
|
60
60
|
export * from './components/upload';
|
|
61
61
|
export * from './components/wave';
|
|
62
|
-
export var version = '2.1.
|
|
62
|
+
export var version = '2.1.1';
|
|
63
63
|
/* generate end */
|
|
64
64
|
|
|
65
65
|
export {normalize} from 'intact-vue-next';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@king-design/vue",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "King-Design UI components for Vue3.0.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"component",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"dayjs": "^1.10.7",
|
|
39
39
|
"downloadjs": "^1.4.7",
|
|
40
40
|
"enquire.js": "^2.1.6",
|
|
41
|
-
"intact-vue-next": "
|
|
41
|
+
"intact-vue-next": "3.0.19",
|
|
42
42
|
"monaco-editor": "^0.26.1",
|
|
43
43
|
"mxgraphx": "^4.0.7",
|
|
44
44
|
"resize-observer-polyfill": "^1.5.1",
|