@king-design/vue 2.0.5 → 2.0.6
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 +1 -1
- package/__tests__/components/dialog.spec.ts +36 -0
- package/components/dialog/index.js +6 -5
- package/components/dialog/staticMethods.d.ts +1 -0
- package/components/dialog/staticMethods.js +3 -2
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +1 -1
|
@@ -515,7 +515,7 @@
|
|
|
515
515
|
#### `Form custom`
|
|
516
516
|
|
|
517
517
|
```
|
|
518
|
-
"<form class=\"k-form k-horizontal css-11cgyra\" novalidate=\"true\"><div class=\"k-form-item css-1frgjei\"><label class=\"k-form-label\">描述</label><div class=\"k-form-content\"><div class=\"k-form-item css-1frgjei\" model=\"descriptions[0]\"><div class=\"k-form-content\"><div class=\"k-input css-1cug0ah\"><div class=\"k-input-wrapper\"><input class=\"k-input-inner\" type=\"text\"></div></div><
|
|
518
|
+
"<form class=\"k-form k-horizontal css-11cgyra\" novalidate=\"true\"><div class=\"k-form-item css-1frgjei\"><label class=\"k-form-label\">描述</label><div class=\"k-form-content\"><div class=\"k-form-item css-1frgjei\" model=\"descriptions[0]\"><div class=\"k-form-content\"><div class=\"k-input css-1cug0ah\"><div class=\"k-input-wrapper\"><input class=\"k-input-inner\" type=\"text\"></div></div></div><div class=\"k-form-append\"><button class=\"k-btn css-12uxt25\" tabindex=\"0\" type=\"button\">删除</button></div></div><div class=\"k-form-item css-1frgjei\" model=\"descriptions[1]\"><div class=\"k-form-content\"><div class=\"k-input css-1cug0ah\"><div class=\"k-input-wrapper\"><input class=\"k-input-inner\" type=\"text\"></div></div></div><div class=\"k-form-append\"><button class=\"k-btn css-12uxt25\" tabindex=\"0\" type=\"button\">删除</button></div></div><button class=\"k-btn css-12uxt25\" tabindex=\"0\" type=\"button\">添加</button></div></div></form>"
|
|
519
519
|
```
|
|
520
520
|
|
|
521
521
|
#### `Form label`
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {createApp, render} from 'vue';
|
|
2
|
+
import {mount, unmount, dispatchEvent, getElement, wait} from '@/test/utils';
|
|
3
|
+
import {Dialog} from '../../';
|
|
4
|
+
|
|
5
|
+
describe('Dialog', () => {
|
|
6
|
+
it('call static method', async () => {
|
|
7
|
+
const container = document.createElement('div');
|
|
8
|
+
document.body.appendChild(container);
|
|
9
|
+
const vue = createApp({
|
|
10
|
+
template: `
|
|
11
|
+
<div @click="test">click</div>
|
|
12
|
+
`,
|
|
13
|
+
methods: {
|
|
14
|
+
test() {
|
|
15
|
+
Dialog.success({
|
|
16
|
+
content: 'test',
|
|
17
|
+
ref: i => this.dialog = i,
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
close() {
|
|
21
|
+
this.dialog.close();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}).mount(container);
|
|
25
|
+
|
|
26
|
+
(vue.$el as HTMLElement).click();
|
|
27
|
+
await wait();
|
|
28
|
+
expect(getElement('.k-dialog')).to.be.exist;
|
|
29
|
+
|
|
30
|
+
(vue as any).close();
|
|
31
|
+
await wait(500);
|
|
32
|
+
|
|
33
|
+
render(null, container);
|
|
34
|
+
document.body.removeChild(container);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -15,7 +15,7 @@ export var BaseDialog = /*#__PURE__*/function (_BaseDialog2) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
if ($vNode === void 0) {
|
|
18
|
-
$vNode =
|
|
18
|
+
$vNode = createVNode(BaseDialog);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
if ($SVG === void 0) {
|
|
@@ -38,13 +38,14 @@ export var BaseDialog = /*#__PURE__*/function (_BaseDialog2) {
|
|
|
38
38
|
var _proto = BaseDialog.prototype;
|
|
39
39
|
|
|
40
40
|
_proto.init = function init() {
|
|
41
|
-
_BaseDialog2.prototype.init.call(this);
|
|
41
|
+
_BaseDialog2.prototype.init.call(this); // @ts-ignore
|
|
42
42
|
|
|
43
|
-
usePosition(this.dialogRef);
|
|
44
43
|
|
|
45
|
-
if (this.$vNode) {
|
|
44
|
+
if (this.$vNode.tag !== BaseDialog) {
|
|
46
45
|
this.useAsComponent = true;
|
|
47
46
|
}
|
|
47
|
+
|
|
48
|
+
usePosition(this.dialogRef);
|
|
48
49
|
};
|
|
49
50
|
|
|
50
51
|
_proto.show = function show() {
|
|
@@ -68,7 +69,7 @@ export var BaseDialog = /*#__PURE__*/function (_BaseDialog2) {
|
|
|
68
69
|
|
|
69
70
|
_this2.$init(null);
|
|
70
71
|
|
|
71
|
-
var vNode = _this2.$vNode
|
|
72
|
+
var vNode = _this2.$vNode;
|
|
72
73
|
vNode.children = _this2;
|
|
73
74
|
|
|
74
75
|
_this2.$render(null, vNode, document.body, null, mountedQueue);
|
|
@@ -5,6 +5,7 @@ export interface AlertDialogProps extends DialogProps {
|
|
|
5
5
|
type?: 'success' | 'warning' | 'error' | 'confirm';
|
|
6
6
|
hideIcon?: boolean;
|
|
7
7
|
hideFooter?: boolean;
|
|
8
|
+
ref?: (i: Dialog) => void;
|
|
8
9
|
}
|
|
9
10
|
export declare type StaticMethod = (options?: AlertDialogProps) => Promise<void>;
|
|
10
11
|
export declare function addStaticMethods(Component: typeof Dialog): void;
|
|
@@ -29,9 +29,10 @@ export function addStaticMethods(Component) {
|
|
|
29
29
|
options = {};
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
var dialog = new AlertDialog(options);
|
|
33
|
+
dialog.show();
|
|
34
|
+
if (options.ref) options.ref(dialog);
|
|
32
35
|
return new _Promise(function (resolve, reject) {
|
|
33
|
-
var dialog = new AlertDialog(options, null, false, [], null);
|
|
34
|
-
dialog.show();
|
|
35
36
|
dialog.on('ok', function () {
|
|
36
37
|
resolve();
|
|
37
38
|
});
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.6
|
|
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.0.
|
|
60
|
+
export declare const version = "2.0.6";
|
|
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.0.
|
|
2
|
+
* @king-design v2.0.6
|
|
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.0.
|
|
62
|
+
export var version = '2.0.6';
|
|
63
63
|
/* generate end */
|
|
64
64
|
|
|
65
65
|
export {normalize} from 'intact-vue-next';
|