@king-design/intact 2.0.9 → 2.0.11
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/base.ts +3 -0
- package/components/dialog/demos/block.md +4 -4
- package/components/dialog/index.md +1 -0
- package/components/dialog/useDraggable.ts +4 -2
- package/components/dialog/useEscClosable.ts +1 -1
- package/components/drawer/index.ts +1 -0
- package/components/portal.ts +12 -6
- package/components/select/base.ts +3 -0
- package/components/select/useBaseLabel.ts +6 -1
- package/dist/fonts/ionicons.eot +0 -0
- package/dist/fonts/ionicons.svg +2230 -0
- package/dist/fonts/ionicons.ttf +0 -0
- package/dist/fonts/ionicons.woff +0 -0
- package/dist/i18n/en-US.js +218 -0
- package/dist/i18n/en-US.min.js +1 -0
- package/dist/kpc.css +3 -0
- package/dist/kpc.js +39860 -0
- package/dist/kpc.min.js +1 -0
- package/dist/kpc.react.js +90483 -0
- package/dist/kpc.react.min.js +1 -0
- package/dist/kpc.vue.js +48096 -0
- package/dist/kpc.vue.min.js +1 -0
- package/dist/ksyun.css +3 -0
- package/es/components/dialog/base.d.ts +1 -0
- package/es/components/dialog/base.js +4 -2
- package/es/components/dialog/useDraggable.js +4 -1
- package/es/components/dialog/useEscClosable.js +1 -1
- package/es/components/drawer/index.js +2 -1
- package/es/components/portal.js +11 -7
- package/es/components/select/base.d.ts +1 -0
- package/es/components/select/base.js +1 -0
- package/es/components/select/useBaseLabel.d.ts +1 -0
- package/es/components/select/useBaseLabel.js +5 -1
- package/es/hooks/useDraggable.d.ts +1 -0
- package/es/hooks/useDraggable.js +2 -1
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/packages/kpc-react/__tests__/components/drawer.spec.js +13 -6
- package/es/packages/kpc-react/__tests__/components/select.spec.d.ts +1 -0
- package/es/packages/kpc-react/__tests__/components/select.spec.js +64 -0
- package/es/site/data/components/dialog/demos/block/react.js +4 -4
- package/hooks/useDraggable.ts +4 -1
- package/index.ts +2 -2
- package/package.json +3 -3
package/es/hooks/useDraggable.js
CHANGED
|
@@ -5,7 +5,7 @@ export function useDraggable(options) {
|
|
|
5
5
|
|
|
6
6
|
function start(e) {
|
|
7
7
|
// ignore if it isn't left key
|
|
8
|
-
if (e.which !== 1) return;
|
|
8
|
+
if (e.which !== 1 || options.disable != null && options.disable()) return;
|
|
9
9
|
dragging.set(true);
|
|
10
10
|
|
|
11
11
|
if (options.onStart) {
|
|
@@ -17,6 +17,7 @@ export function useDraggable(options) {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
function move(e) {
|
|
20
|
+
if (options.disable != null && options.disable()) return;
|
|
20
21
|
e.preventDefault();
|
|
21
22
|
|
|
22
23
|
if (dragging.value) {
|
package/es/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.11
|
|
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.11";
|
package/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.11
|
|
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.11';
|
|
63
63
|
/* generate end */
|
|
@@ -3,7 +3,7 @@ import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import * as ReactDOM from 'react-dom';
|
|
6
|
-
import { Drawer, Card } from '../../';
|
|
6
|
+
import { Drawer, Card, Button } from '../../';
|
|
7
7
|
import { Component } from 'intact-react';
|
|
8
8
|
import { wait, dispatchEvent } from '../../../../test/utils';
|
|
9
9
|
describe('Drawer', function () {
|
|
@@ -68,7 +68,15 @@ describe('Drawer', function () {
|
|
|
68
68
|
}, "click")), /*#__PURE__*/React.createElement(Drawer, {
|
|
69
69
|
value: true,
|
|
70
70
|
placement: "left",
|
|
71
|
-
title: "2"
|
|
71
|
+
title: "2",
|
|
72
|
+
onClose: function onClose() {
|
|
73
|
+
return console.log('click');
|
|
74
|
+
},
|
|
75
|
+
slotFooter: /*#__PURE__*/React.createElement(Button, {
|
|
76
|
+
onClick: function onClick(e) {
|
|
77
|
+
return console.log(1);
|
|
78
|
+
}
|
|
79
|
+
}, "click")
|
|
72
80
|
}, /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement("div", {
|
|
73
81
|
className: "click",
|
|
74
82
|
onClick: click2
|
|
@@ -85,11 +93,10 @@ describe('Drawer', function () {
|
|
|
85
93
|
return wait();
|
|
86
94
|
|
|
87
95
|
case 13:
|
|
88
|
-
expect(click2.callCount).to.eql(1);
|
|
89
|
-
|
|
90
|
-
document.body.removeChild(container);
|
|
96
|
+
expect(click2.callCount).to.eql(1); // ReactDOM.unmountComponentAtNode(container);
|
|
97
|
+
// document.body.removeChild(container);
|
|
91
98
|
|
|
92
|
-
case
|
|
99
|
+
case 14:
|
|
93
100
|
case "end":
|
|
94
101
|
return _context2.stop();
|
|
95
102
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import * as ReactDOM from 'react-dom';
|
|
5
|
+
import { Select, OptionGroup, Option } from '../../';
|
|
6
|
+
import { getElement, wait } from '../../../../test/utils';
|
|
7
|
+
describe('Select', function () {
|
|
8
|
+
it('should conrrectly show value in filterable mode', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
9
|
+
var container, Test, trigger, dropdown;
|
|
10
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
11
|
+
while (1) {
|
|
12
|
+
switch (_context.prev = _context.next) {
|
|
13
|
+
case 0:
|
|
14
|
+
container = document.createElement('div');
|
|
15
|
+
document.body.appendChild(container);
|
|
16
|
+
|
|
17
|
+
Test = function Test() {
|
|
18
|
+
var _useState = useState(''),
|
|
19
|
+
value = _useState[0],
|
|
20
|
+
setValue = _useState[1];
|
|
21
|
+
|
|
22
|
+
var onChangeValue = function onChangeValue(v) {
|
|
23
|
+
setValue(v != null ? v : '');
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return /*#__PURE__*/React.createElement(Select, {
|
|
27
|
+
value: value,
|
|
28
|
+
onChangeValue: onChangeValue,
|
|
29
|
+
card: true,
|
|
30
|
+
filterable: true
|
|
31
|
+
}, /*#__PURE__*/React.createElement(OptionGroup, {
|
|
32
|
+
slotLabel: /*#__PURE__*/React.createElement("div", null, "xxx")
|
|
33
|
+
}, /*#__PURE__*/React.createElement(Option, {
|
|
34
|
+
value: "q"
|
|
35
|
+
}, "Q"), /*#__PURE__*/React.createElement(Option, {
|
|
36
|
+
value: "p"
|
|
37
|
+
}, "P")));
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(Test, null), container);
|
|
41
|
+
trigger = container.querySelector('.k-select');
|
|
42
|
+
trigger.click();
|
|
43
|
+
_context.next = 8;
|
|
44
|
+
return wait();
|
|
45
|
+
|
|
46
|
+
case 8:
|
|
47
|
+
dropdown = getElement('.k-select-menu');
|
|
48
|
+
dropdown.querySelector('.k-dropdown-item').click();
|
|
49
|
+
_context.next = 12;
|
|
50
|
+
return wait();
|
|
51
|
+
|
|
52
|
+
case 12:
|
|
53
|
+
expect(container.querySelector('.k-input-inner').value).to.eql('Q');
|
|
54
|
+
ReactDOM.unmountComponentAtNode(container);
|
|
55
|
+
document.body.removeChild(container);
|
|
56
|
+
|
|
57
|
+
case 15:
|
|
58
|
+
case "end":
|
|
59
|
+
return _context.stop();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}, _callee);
|
|
63
|
+
})));
|
|
64
|
+
});
|
|
@@ -50,12 +50,12 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
50
50
|
show: show
|
|
51
51
|
});
|
|
52
52
|
},
|
|
53
|
-
|
|
53
|
+
slotHeader: /*#__PURE__*/React.createElement("div", {
|
|
54
54
|
className: "k-title"
|
|
55
55
|
}, /*#__PURE__*/React.createElement("i", {
|
|
56
56
|
className: "ion-person"
|
|
57
57
|
}), "Custom Header"),
|
|
58
|
-
|
|
58
|
+
slotFooter: /*#__PURE__*/React.createElement(React.Fragment, null, "Custom Footer", /*#__PURE__*/React.createElement(Button, {
|
|
59
59
|
type: "primary",
|
|
60
60
|
onClick: function onClick() {
|
|
61
61
|
return _this2.setState({
|
|
@@ -77,8 +77,8 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
77
77
|
});
|
|
78
78
|
},
|
|
79
79
|
title: "No Footer",
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
slotBody: "body",
|
|
81
|
+
slotFooterWrapper: ""
|
|
82
82
|
}));
|
|
83
83
|
};
|
|
84
84
|
|
package/hooks/useDraggable.ts
CHANGED
|
@@ -5,6 +5,7 @@ export type Options = {
|
|
|
5
5
|
onStart?: (e: MouseEvent) => void,
|
|
6
6
|
onMove: (e: MouseEvent) => void,
|
|
7
7
|
onEnd?: (e?: MouseEvent) => void,
|
|
8
|
+
disable?: () => boolean,
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export function useDraggable(options: Options) {
|
|
@@ -12,7 +13,7 @@ export function useDraggable(options: Options) {
|
|
|
12
13
|
|
|
13
14
|
function start(e: MouseEvent) {
|
|
14
15
|
// ignore if it isn't left key
|
|
15
|
-
if (e.which !== 1) return;
|
|
16
|
+
if (e.which !== 1 || options.disable?.()) return;
|
|
16
17
|
|
|
17
18
|
dragging.set(true);
|
|
18
19
|
|
|
@@ -25,6 +26,8 @@ export function useDraggable(options: Options) {
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
function move(e: MouseEvent) {
|
|
29
|
+
if (options.disable?.()) return;
|
|
30
|
+
|
|
28
31
|
e.preventDefault();
|
|
29
32
|
|
|
30
33
|
if (dragging.value) {
|
package/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.11
|
|
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.11';
|
|
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.11",
|
|
4
4
|
"description": "A component library written in Intact for Intact, Vue, React and Angular",
|
|
5
5
|
"main": "es/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"highlight.js": "^10.4.1",
|
|
117
117
|
"history": "^5.0.0",
|
|
118
118
|
"html-webpack-plugin": "5.3.1",
|
|
119
|
-
"intact-react": "^3.0.
|
|
119
|
+
"intact-react": "^3.0.12",
|
|
120
120
|
"istanbul-instrumenter-loader": "^3.0.0",
|
|
121
121
|
"js-yaml": "^4.1.0",
|
|
122
122
|
"karma": "^6.3.2",
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
"dayjs": "^1.10.7",
|
|
179
179
|
"downloadjs": "^1.4.7",
|
|
180
180
|
"enquire.js": "^2.1.6",
|
|
181
|
-
"intact": "^3.0.
|
|
181
|
+
"intact": "^3.0.12",
|
|
182
182
|
"monaco-editor": "^0.26.1",
|
|
183
183
|
"mxgraphx": "^4.0.7",
|
|
184
184
|
"resize-observer-polyfill": "^1.5.1",
|