@king-design/intact 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/components/dialog/demos/block.md +9 -5
- package/components/dialog/index.md +1 -0
- package/components/dialog/index.ts +8 -7
- package/components/dialog/staticMethods.ts +6 -2
- package/components/table/demos/basic.md +2 -8
- package/es/components/dialog/index.js +6 -5
- package/es/components/dialog/staticMethods.d.ts +1 -0
- package/es/components/dialog/staticMethods.js +3 -2
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/packages/kpc-react/__tests__/index.js +1 -1
- package/es/site/data/components/table/demos/basic/react.js +2 -8
- package/index.ts +2 -2
- package/package.json +2 -1
|
@@ -50,10 +50,12 @@ import {Button, Dialog} from 'kpc';
|
|
|
50
50
|
<Button @click="show = true" type="primary">Show Dialog</Button>
|
|
51
51
|
<Button @click="show1 = true" type="primary">Show No Footer Dialog</Button>
|
|
52
52
|
<Dialog v-model="show">
|
|
53
|
-
<
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
<template slot="header">
|
|
54
|
+
<div class="k-title">
|
|
55
|
+
<i class="ion-person"></i>
|
|
56
|
+
Custom Header
|
|
57
|
+
</div>
|
|
58
|
+
</template>
|
|
57
59
|
|
|
58
60
|
Dialog Body
|
|
59
61
|
|
|
@@ -65,7 +67,9 @@ import {Button, Dialog} from 'kpc';
|
|
|
65
67
|
</Dialog>
|
|
66
68
|
<Dialog v-model="show1" title="No Footer">
|
|
67
69
|
<template slot="body">body</template>
|
|
68
|
-
<
|
|
70
|
+
<template slot="footer-wrapper">
|
|
71
|
+
<div></div>
|
|
72
|
+
</template>
|
|
69
73
|
</Dialog>
|
|
70
74
|
</div>
|
|
71
75
|
```
|
|
@@ -101,6 +101,7 @@ export type Container = string | ((parentDom: Element, anchor: Node | null) => E
|
|
|
101
101
|
| size | 弹窗尺寸 | `"large"` | `"default"` | `"small"` | `"mini"` | `"default"` |
|
|
102
102
|
| hideIcon | 是否隐藏提示图标 | `boolean` | `false` |
|
|
103
103
|
| hideFooter | 是否隐藏底部按钮 | `boolean` | `false` |
|
|
104
|
+
| ref | 传入一个函数,组件会调用该函数,将当前`Dialog`实例传入 | `(i: Dialog) => void` | `undefined` |
|
|
104
105
|
|
|
105
106
|
其中`Promise`对象会在点击“确定”按钮时`resolve()`,在点击“取消”按钮时`reject()`,你可以在`then()`
|
|
106
107
|
中书写用户点击不同按钮的逻辑
|
|
@@ -15,11 +15,11 @@ export class BaseDialog<
|
|
|
15
15
|
public useAsComponent = false;
|
|
16
16
|
|
|
17
17
|
constructor(
|
|
18
|
-
props: Props<P, BaseDialog> | null | undefined = null
|
|
19
|
-
$vNode: VNodeComponentClass =
|
|
18
|
+
props: Props<P, BaseDialog> | null | undefined = null,
|
|
19
|
+
$vNode: VNodeComponentClass = createVNode(BaseDialog),
|
|
20
20
|
$SVG: boolean = false,
|
|
21
21
|
$mountedQueue: Function[] = [],
|
|
22
|
-
$senior: ComponentClass | null = null
|
|
22
|
+
$senior: ComponentClass | null = null,
|
|
23
23
|
) {
|
|
24
24
|
super(props, $vNode, $SVG, $mountedQueue, $senior);
|
|
25
25
|
}
|
|
@@ -27,11 +27,12 @@ export class BaseDialog<
|
|
|
27
27
|
init() {
|
|
28
28
|
super.init();
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (this.$vNode) {
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
if (this.$vNode.tag !== BaseDialog) {
|
|
33
32
|
this.useAsComponent = true;
|
|
34
33
|
}
|
|
34
|
+
|
|
35
|
+
usePosition(this.dialogRef);
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
public show() {
|
|
@@ -50,7 +51,7 @@ export class BaseDialog<
|
|
|
50
51
|
// use as intance
|
|
51
52
|
const mountedQueue = this.$mountedQueue;
|
|
52
53
|
this.$init(null);
|
|
53
|
-
const vNode = this.$vNode
|
|
54
|
+
const vNode = this.$vNode;
|
|
54
55
|
vNode.children = this;
|
|
55
56
|
this.$render(null, vNode, document.body, null, mountedQueue);
|
|
56
57
|
callAll(mountedQueue);
|
|
@@ -7,6 +7,7 @@ export interface AlertDialogProps extends DialogProps {
|
|
|
7
7
|
type?: 'success' | 'warning' | 'error' | 'confirm'
|
|
8
8
|
hideIcon?: boolean
|
|
9
9
|
hideFooter?: boolean
|
|
10
|
+
ref?: (i: Dialog) => void
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export type StaticMethod = (options?: AlertDialogProps) => Promise<void>
|
|
@@ -24,9 +25,12 @@ export function addStaticMethods(Component: typeof Dialog) {
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
function show(options: AlertDialogProps = {}) {
|
|
28
|
+
const dialog = new AlertDialog(options);
|
|
29
|
+
dialog.show();
|
|
30
|
+
|
|
31
|
+
if (options.ref) options.ref(dialog);
|
|
32
|
+
|
|
27
33
|
return new Promise<void>((resolve, reject) => {
|
|
28
|
-
const dialog = new AlertDialog(options, null as unknown as VNodeComponentClass<any>, false, [], null);
|
|
29
|
-
dialog.show();
|
|
30
34
|
dialog.on('ok', () => {
|
|
31
35
|
resolve();
|
|
32
36
|
});
|
|
@@ -7,16 +7,10 @@ order: 0
|
|
|
7
7
|
组件定义表格结构,详见”定义表格结构“说明
|
|
8
8
|
|
|
9
9
|
```vdt
|
|
10
|
-
import {Table, TableColumn
|
|
10
|
+
import {Table, TableColumn} from 'kpc';
|
|
11
11
|
|
|
12
12
|
<Table data={this.get('data')} resizable>
|
|
13
|
-
<TableColumn key="a" title="Title 1"
|
|
14
|
-
<b:template args="[data]">
|
|
15
|
-
<Select>
|
|
16
|
-
<Option value="a">test</Option>
|
|
17
|
-
</Select>
|
|
18
|
-
</b:template>
|
|
19
|
-
</TableColumn>
|
|
13
|
+
<TableColumn key="a" title="Title 1" />
|
|
20
14
|
<TableColumn key="b" title="Title 2" />
|
|
21
15
|
</Table>
|
|
22
16
|
```
|
|
@@ -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/es/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,4 +57,4 @@ 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";
|
package/es/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,5 +59,5 @@ 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 */
|
|
@@ -73,7 +73,7 @@ describe('React Demos', function () {
|
|
|
73
73
|
return wait(100);
|
|
74
74
|
|
|
75
75
|
case 3:
|
|
76
|
-
// FIXME: I don't why the width of `autoWidth` input is an unexpected value
|
|
76
|
+
// FIXME: I don't know why the width of `autoWidth` input is an unexpected value
|
|
77
77
|
// while we run test on Github Actions.
|
|
78
78
|
innerHTML = element.innerHTML.replace(/(\<input.*?style="width: )(?:.*?)(px;")/g, '$1$2');
|
|
79
79
|
expect(innerHTML).to.matchSnapshot();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
2
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { Table, TableColumn
|
|
4
|
+
import { Table, TableColumn } from '@king-design/react';
|
|
5
5
|
|
|
6
6
|
var Demo = /*#__PURE__*/function (_React$Component) {
|
|
7
7
|
_inheritsLoose(Demo, _React$Component);
|
|
@@ -36,13 +36,7 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
36
36
|
resizable: true
|
|
37
37
|
}, /*#__PURE__*/React.createElement(TableColumn, {
|
|
38
38
|
key: "a",
|
|
39
|
-
title: "Title 1"
|
|
40
|
-
slotTemplate: function slotTemplate(_ref) {
|
|
41
|
-
var data = _ref[0];
|
|
42
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Select, null, /*#__PURE__*/React.createElement(Option, {
|
|
43
|
-
value: "a"
|
|
44
|
-
}, "test")));
|
|
45
|
-
}
|
|
39
|
+
title: "Title 1"
|
|
46
40
|
}), /*#__PURE__*/React.createElement(TableColumn, {
|
|
47
41
|
key: "b",
|
|
48
42
|
title: "Title 2"
|
package/index.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
|
|
@@ -62,6 +62,6 @@ export * from './components/treeSelect';
|
|
|
62
62
|
export * from './components/upload';
|
|
63
63
|
export * from './components/wave';
|
|
64
64
|
|
|
65
|
-
export const version = '2.0.
|
|
65
|
+
export const version = '2.0.6';
|
|
66
66
|
|
|
67
67
|
/* generate end */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@king-design/intact",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "A component library written in Intact for Intact, Vue, React and Angular",
|
|
5
5
|
"main": "es/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"snapshots": "cross-env UPDATE=1 npm run test",
|
|
9
9
|
"test:all": "lerna exec -- npm run test",
|
|
10
10
|
"test:react": "lerna exec --scope @king-design/react -- npm run test",
|
|
11
|
+
"test:vue": "lerna exec --scope @king-design/vue -- npm run test",
|
|
11
12
|
"snapshots:all": "lerna exec -- npm run snapshots",
|
|
12
13
|
"cover": "cross-env UPDATE=2 npm run test",
|
|
13
14
|
"start": "node server.js",
|