@king-design/intact 2.0.10 → 2.0.12
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/cascader/styles.ts +1 -1
- package/components/dialog/demos/block.md +4 -4
- package/components/dialog/useEscClosable.ts +1 -1
- package/components/form/demos/basic.md +1 -1
- package/components/form/index.md +7 -4
- package/components/form/methods.ts +2 -1
- package/components/table/table.ts +0 -1
- package/components/table/useResizeObserver.ts +22 -0
- package/components/table/useStickyScrollbar.ts +2 -8
- package/components/table/useWidth.ts +4 -18
- package/es/components/cascader/styles.js +1 -1
- package/es/components/dialog/useEscClosable.js +1 -1
- package/es/components/form/methods.d.ts +2 -1
- package/es/components/table/table.js +1 -1
- package/es/components/table/useResizeObserver.d.ts +2 -0
- package/es/components/table/useResizeObserver.js +20 -0
- package/es/components/table/useStickyScrollbar.d.ts +1 -1
- package/es/components/table/useStickyScrollbar.js +4 -9
- package/es/components/table/useWidth.js +5 -15
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/packages/kpc-react/__tests__/components/drawer.spec.js +43 -20
- package/es/site/data/components/dialog/demos/block/react.js +4 -4
- package/index.ts +2 -2
- package/package.json +3 -3
- package/dist/fonts/ionicons.eot +0 -0
- package/dist/fonts/ionicons.svg +0 -2230
- package/dist/fonts/ionicons.ttf +0 -0
- package/dist/fonts/ionicons.woff +0 -0
- package/dist/i18n/en-US.js +0 -218
- package/dist/i18n/en-US.min.js +0 -1
- package/dist/kpc.css +0 -3
- package/dist/kpc.js +0 -39860
- package/dist/kpc.min.js +0 -1
- package/dist/kpc.react.js +0 -90483
- package/dist/kpc.react.min.js +0 -1
- package/dist/kpc.vue.js +0 -48096
- package/dist/kpc.vue.min.js +0 -1
- package/dist/ksyun.css +0 -3
|
@@ -105,13 +105,13 @@ export default class Demo extends React.Component {
|
|
|
105
105
|
>Show No Footer Dialog</Button>
|
|
106
106
|
<Dialog value={this.state.show}
|
|
107
107
|
onChangeValue={(show) => this.setState({show})}
|
|
108
|
-
|
|
108
|
+
slotHeader={
|
|
109
109
|
<div className="k-title">
|
|
110
110
|
<i className="ion-person"></i>
|
|
111
111
|
Custom Header
|
|
112
112
|
</div>
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
slotFooter={
|
|
115
115
|
<React.Fragment>
|
|
116
116
|
Custom Footer
|
|
117
117
|
<Button type="primary" onClick={() => this.setState({show: false})}>确认</Button>
|
|
@@ -124,8 +124,8 @@ export default class Demo extends React.Component {
|
|
|
124
124
|
<Dialog value={this.state.show1}
|
|
125
125
|
onChangeValue={(show1) => this.setState({show1})}
|
|
126
126
|
title="No Footer"
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
slotBody="body"
|
|
128
|
+
slotFooterWrapper=""
|
|
129
129
|
>
|
|
130
130
|
</Dialog>
|
|
131
131
|
</div>
|
|
@@ -32,7 +32,7 @@ export function useEscClosable() {
|
|
|
32
32
|
throw new Error('The dialog has handled hide callback. Maybe it is a bug of KPC');
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
dialogs.splice(
|
|
35
|
+
dialogs.splice(index, 1);
|
|
36
36
|
|
|
37
37
|
if (!dialogs.length) {
|
|
38
38
|
document.removeEventListener('keydown', escClose);
|
|
@@ -23,7 +23,7 @@ order: 0
|
|
|
23
23
|
12. `min {number}`:请输入不小于n的数
|
|
24
24
|
13. `range {Array<number>}`:请输入min到max之间的数
|
|
25
25
|
14. `step {number}`:请输入步长为n的数
|
|
26
|
-
15. `
|
|
26
|
+
15. `equal {string}`:两次输入不一致
|
|
27
27
|
3. 给`FormItem`添加`messages`属性,指定验证失败时展示的错误提示。默认内容如上所示
|
|
28
28
|
4. 给`FormItem`添加`classNames`属性,指定验证失败时错误元素需要额外添加的`className`,默认不添加
|
|
29
29
|
|
package/components/form/index.md
CHANGED
|
@@ -31,9 +31,9 @@ sidebar: doc
|
|
|
31
31
|
| fluid | `FormItem`的宽度默认是被子元素撑开的,添加该属性可以渲染`100%`的宽度 | `boolean` | `false` |
|
|
32
32
|
|
|
33
33
|
```ts
|
|
34
|
-
type Method = (value: any, param: any) => boolean | string
|
|
35
|
-
type Message = string | ((value: any, param: any) => string)
|
|
36
|
-
type ClassName = string | ((value: any, param: any) => string)
|
|
34
|
+
export declare type Method = (value: any, param: any) => boolean | string | Promise<boolean | string>
|
|
35
|
+
export declare type Message = string | ((value: any, param: any) => string)
|
|
36
|
+
export declare type ClassName = string | ((value: any, param: any) => string)
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
# 扩展点
|
|
@@ -72,9 +72,12 @@ type ClassName = string | ((value: any, param: any) => string)
|
|
|
72
72
|
|
|
73
73
|
| 方法名 | 说明 | 参数 | 返回值 |
|
|
74
74
|
| --- | --- | --- | --- |
|
|
75
|
-
| addMethod | 添加全局验证规则,这样在所有`FormItem`中如果需要使用该规则,只需要在`rules`中写上该规则名即可 | 1. `name` 指定规则名称,不能重复 <br /> 2. `method` 指定该规则的验证函数,该函数返回`true`或`false`来标识验证成功或失败,如果返回字符串,则直接当做错误文案展示,该函数将传入
|
|
75
|
+
| addMethod | 添加全局验证规则,这样在所有`FormItem`中如果需要使用该规则,只需要在`rules`中写上该规则名即可 | 1. `name` 指定规则名称,不能重复 <br /> 2. `method` 指定该规则的验证函数,该函数返回`true`或`false`来标识验证成功或失败,如果返回字符串,则直接当做错误文案展示,该函数将传入2个参数:1. 当前验证的值,2. 当前规则的参数,即使用该规则时指定的值 <br /> 3. `message` 验证失败时的错误提示文案,该值可以为字符串或者函数,如果为函数,传入参数同`method`,用于个性化文案提示 <br /> 4. `className` 验证失败时添加的类名 | `undefined` |
|
|
76
76
|
|
|
77
77
|
```ts
|
|
78
|
+
export declare type Method = (value: any, param: any) => boolean | string | Promise<boolean | string>
|
|
79
|
+
export declare type Message = string | ((value: any, param: any) => string)
|
|
80
|
+
export declare type ClassName = string | ((value: any, param: any) => string)
|
|
78
81
|
export declare const addMethod: (
|
|
79
82
|
name: string,
|
|
80
83
|
method: Method,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {_$} from '../../i18n';
|
|
2
2
|
import {isNumber, isNullOrUndefined, isString} from 'intact-shared';
|
|
3
3
|
|
|
4
|
-
export type
|
|
4
|
+
export type MethodReturn = boolean | string
|
|
5
|
+
export type Method = (value: any, param: any) => MethodReturn | Promise<MethodReturn>
|
|
5
6
|
export type Message = string | ((value: any, param: any) => string)
|
|
6
7
|
export type ClassName = string | ((value: any, param: any) => string)
|
|
7
8
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {onMounted, onBeforeUnmount, RefObject, useInstance} from "intact";
|
|
2
|
+
import {debounce} from '../utils';
|
|
3
|
+
import ResizeObserver from 'resize-observer-polyfill';
|
|
4
|
+
|
|
5
|
+
export function useResizeObserver(elementRef: RefObject<HTMLElement>, callback: Function) {
|
|
6
|
+
const instance = useInstance()!;
|
|
7
|
+
|
|
8
|
+
let ro: ResizeObserver;
|
|
9
|
+
onMounted(() => {
|
|
10
|
+
// use debounce instead of throttle, because if there is
|
|
11
|
+
// transition on parent container, the width is weired
|
|
12
|
+
// #342
|
|
13
|
+
ro = new ResizeObserver(debounce(() => {
|
|
14
|
+
if (instance.$unmounted) return;
|
|
15
|
+
callback();
|
|
16
|
+
}, 100, true));
|
|
17
|
+
ro.observe(elementRef.value!);
|
|
18
|
+
});
|
|
19
|
+
onBeforeUnmount(() => {
|
|
20
|
+
ro.disconnect();
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -5,13 +5,13 @@ import type {Table} from './';
|
|
|
5
5
|
import {isStringOrNumber, isNull} from 'intact-shared';
|
|
6
6
|
import {debounce} from '../utils';
|
|
7
7
|
import type {useScroll} from './useScroll';
|
|
8
|
+
import {useResizeObserver} from './useResizeObserver';
|
|
8
9
|
|
|
9
10
|
export function useStickyScrollbar(
|
|
10
11
|
elementRef: RefObject<HTMLElement>,
|
|
11
12
|
{scrollRef, callbacks}: ReturnType<typeof useScroll>,
|
|
12
13
|
tableRef: RefObject<HTMLElement>,
|
|
13
14
|
tableScroll: (scrollLeft: number) => void,
|
|
14
|
-
tableWidth: State<number | null>,
|
|
15
15
|
) {
|
|
16
16
|
const instance = useInstance() as Table;
|
|
17
17
|
const stick = useState<number | null>(null);
|
|
@@ -23,13 +23,7 @@ export function useStickyScrollbar(
|
|
|
23
23
|
stick.set(v === true ? 0 : isStringOrNumber(v) ? +v : null);
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
if (v) {
|
|
28
|
-
tableActualWidth.set(v + 'px');
|
|
29
|
-
} else {
|
|
30
|
-
setTableActualWidth();
|
|
31
|
-
}
|
|
32
|
-
});
|
|
26
|
+
useResizeObserver(scrollRef, setTableActualWidth);
|
|
33
27
|
|
|
34
28
|
onMounted(() => {
|
|
35
29
|
setTableActualWidth();
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {useInstance, RefObject, onMounted,
|
|
2
|
-
import ResizeObserver from 'resize-observer-polyfill';
|
|
1
|
+
import {useInstance, RefObject, onMounted, VNodeComponentClass, createRef} from 'intact';
|
|
3
2
|
import type {Table, TableRowKey} from './table';
|
|
4
3
|
import type {TableColumn} from './column';
|
|
5
4
|
import {useState} from '../../hooks/useState';
|
|
6
|
-
import {debounce} from '../utils';
|
|
7
5
|
import {scrollbarWidth} from '../position';
|
|
6
|
+
import {useResizeObserver} from './useResizeObserver';
|
|
8
7
|
|
|
9
8
|
const hasLocalStorage = typeof localStorage !== 'undefined';
|
|
10
9
|
|
|
@@ -19,21 +18,8 @@ export function useWidth(
|
|
|
19
18
|
|
|
20
19
|
initWidthFromStore();
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
checkTableWidth(true);
|
|
25
|
-
// use debounce instead of throttle, because if there is
|
|
26
|
-
// transition on parent container, the width is weired
|
|
27
|
-
// #342
|
|
28
|
-
ro = new ResizeObserver(debounce(() => {
|
|
29
|
-
if (instance.$unmounted) return;
|
|
30
|
-
checkTableWidth(false);
|
|
31
|
-
}, 100, true));
|
|
32
|
-
ro.observe(scrollRef.value!);
|
|
33
|
-
});
|
|
34
|
-
onBeforeUnmount(() => {
|
|
35
|
-
ro.disconnect();
|
|
36
|
-
});
|
|
21
|
+
onMounted(() => checkTableWidth(true));
|
|
22
|
+
useResizeObserver(scrollRef, () => checkTableWidth(false));
|
|
37
23
|
|
|
38
24
|
// if exist widthStoreKey, we get the default width from localStorage
|
|
39
25
|
function initWidthFromStore() {
|
|
@@ -43,7 +43,7 @@ setDefault(function () {
|
|
|
43
43
|
}).cascader;
|
|
44
44
|
});
|
|
45
45
|
export function makeMenuStyles() {
|
|
46
|
-
return /*#__PURE__*/css("min-width:", cascader.width, "!important;height:", cascader.height, ";.k-cascader-arrow{float:right;height:100%;margin-left:", cascader.arrowGap, ";line-height:inherit;}.k-cascader-loading{display:block;text-align:center;margin-top:", cascader.loadingGap, ";}.k-cascader-empty{padding:", cascader.empty.padding, ";color:", cascader.empty.color, ";text-align:center;}.k-cascader-option{&.k-selected{color:", cascader.selectedColor, ";}&.k-active{background:", cascader.activeBgColor, ";}}");
|
|
46
|
+
return /*#__PURE__*/css("min-width:", cascader.width, "!important;min-height:", cascader.height, ";.k-cascader-arrow{float:right;height:100%;margin-left:", cascader.arrowGap, ";line-height:inherit;}.k-cascader-loading{display:block;text-align:center;margin-top:", cascader.loadingGap, ";}.k-cascader-empty{padding:", cascader.empty.padding, ";color:", cascader.empty.color, ";text-align:center;}.k-cascader-option{&.k-selected{color:", cascader.selectedColor, ";}&.k-active{background:", cascader.activeBgColor, ";}}");
|
|
47
47
|
}
|
|
48
48
|
export function makeFilterMenuStyles() {
|
|
49
49
|
return /*#__PURE__*/css("min-width:", _filterInstanceProperty(cascader).minWidth, "!important;height:auto;max-height:", _filterInstanceProperty(cascader).maxHeight, ";em{font-style:normal;color:", _filterInstanceProperty(cascader).highlightColor, ";}");
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export declare type
|
|
1
|
+
export declare type MethodReturn = boolean | string;
|
|
2
|
+
export declare type Method = (value: any, param: any) => MethodReturn | Promise<MethodReturn>;
|
|
2
3
|
export declare type Message = string | ((value: any, param: any) => string);
|
|
3
4
|
export declare type ClassName = string | ((value: any, param: any) => string);
|
|
4
5
|
export declare const methods: Record<string, Method>;
|
|
@@ -106,7 +106,7 @@ export var Table = /*#__PURE__*/function (_Component) {
|
|
|
106
106
|
_this.selected = useSelected();
|
|
107
107
|
_this.resetRowStatus = useRestRowStatus(_this.disableRow.getAllKeys);
|
|
108
108
|
_this.draggable = useDraggable();
|
|
109
|
-
_this.stickyScrollbar = useStickyScrollbar(_this.stickyHeader.elementRef, _this.scroll, _this.width.tableRef, _this.fixedColumns.setScrollPosition
|
|
109
|
+
_this.stickyScrollbar = useStickyScrollbar(_this.stickyHeader.elementRef, _this.scroll, _this.width.tableRef, _this.fixedColumns.setScrollPosition);
|
|
110
110
|
return _this;
|
|
111
111
|
}
|
|
112
112
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { onMounted, onBeforeUnmount, useInstance } from "intact";
|
|
2
|
+
import { debounce } from '../utils';
|
|
3
|
+
import ResizeObserver from 'resize-observer-polyfill';
|
|
4
|
+
export function useResizeObserver(elementRef, callback) {
|
|
5
|
+
var instance = useInstance();
|
|
6
|
+
var ro;
|
|
7
|
+
onMounted(function () {
|
|
8
|
+
// use debounce instead of throttle, because if there is
|
|
9
|
+
// transition on parent container, the width is weired
|
|
10
|
+
// #342
|
|
11
|
+
ro = new ResizeObserver(debounce(function () {
|
|
12
|
+
if (instance.$unmounted) return;
|
|
13
|
+
callback();
|
|
14
|
+
}, 100, true));
|
|
15
|
+
ro.observe(elementRef.value);
|
|
16
|
+
});
|
|
17
|
+
onBeforeUnmount(function () {
|
|
18
|
+
ro.disconnect();
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -2,7 +2,7 @@ import { RefObject } from 'intact';
|
|
|
2
2
|
import { ShouldFixParam } from '../affix';
|
|
3
3
|
import { State } from '../../hooks/useState';
|
|
4
4
|
import type { useScroll } from './useScroll';
|
|
5
|
-
export declare function useStickyScrollbar(elementRef: RefObject<HTMLElement>, { scrollRef, callbacks }: ReturnType<typeof useScroll>, tableRef: RefObject<HTMLElement>, tableScroll: (scrollLeft: number) => void
|
|
5
|
+
export declare function useStickyScrollbar(elementRef: RefObject<HTMLElement>, { scrollRef, callbacks }: ReturnType<typeof useScroll>, tableRef: RefObject<HTMLElement>, tableScroll: (scrollLeft: number) => void): {
|
|
6
6
|
shouldStickScrollbar: ({ offsetBottom, viewportHeight }: ShouldFixParam) => boolean;
|
|
7
7
|
stick: State<number | null>;
|
|
8
8
|
style: State<Record<string, string> | null>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createRef, useInstance, onMounted, nextTick } from 'intact';
|
|
2
|
-
import { useState
|
|
2
|
+
import { useState } from '../../hooks/useState';
|
|
3
3
|
import { isStringOrNumber, isNull } from 'intact-shared';
|
|
4
4
|
import { debounce } from '../utils';
|
|
5
|
-
|
|
5
|
+
import { useResizeObserver } from './useResizeObserver';
|
|
6
|
+
export function useStickyScrollbar(elementRef, _ref, tableRef, tableScroll) {
|
|
6
7
|
var scrollRef = _ref.scrollRef,
|
|
7
8
|
callbacks = _ref.callbacks;
|
|
8
9
|
var instance = useInstance();
|
|
@@ -13,13 +14,7 @@ export function useStickyScrollbar(elementRef, _ref, tableRef, tableScroll, tabl
|
|
|
13
14
|
instance.on('$receive:stickScrollbar', function (v) {
|
|
14
15
|
stick.set(v === true ? 0 : isStringOrNumber(v) ? +v : null);
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
if (v) {
|
|
18
|
-
tableActualWidth.set(v + 'px');
|
|
19
|
-
} else {
|
|
20
|
-
setTableActualWidth();
|
|
21
|
-
}
|
|
22
|
-
});
|
|
17
|
+
useResizeObserver(scrollRef, setTableActualWidth);
|
|
23
18
|
onMounted(function () {
|
|
24
19
|
setTableActualWidth();
|
|
25
20
|
});
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
2
2
|
import _JSON$stringify from "@babel/runtime-corejs3/core-js/json/stringify";
|
|
3
|
-
import { useInstance, onMounted,
|
|
4
|
-
import ResizeObserver from 'resize-observer-polyfill';
|
|
3
|
+
import { useInstance, onMounted, createRef } from 'intact';
|
|
5
4
|
import { useState } from '../../hooks/useState';
|
|
6
|
-
import { debounce } from '../utils';
|
|
7
5
|
import { scrollbarWidth } from '../position';
|
|
6
|
+
import { useResizeObserver } from './useResizeObserver';
|
|
8
7
|
var hasLocalStorage = typeof localStorage !== 'undefined';
|
|
9
8
|
export function useWidth(scrollRef, getColumns) {
|
|
10
9
|
var instance = useInstance();
|
|
@@ -12,20 +11,11 @@ export function useWidth(scrollRef, getColumns) {
|
|
|
12
11
|
var widthMap = useState({});
|
|
13
12
|
var tableWidth = useState(null);
|
|
14
13
|
initWidthFromStore();
|
|
15
|
-
var ro;
|
|
16
14
|
onMounted(function () {
|
|
17
|
-
checkTableWidth(true);
|
|
18
|
-
// transition on parent container, the width is weired
|
|
19
|
-
// #342
|
|
20
|
-
|
|
21
|
-
ro = new ResizeObserver(debounce(function () {
|
|
22
|
-
if (instance.$unmounted) return;
|
|
23
|
-
checkTableWidth(false);
|
|
24
|
-
}, 100, true));
|
|
25
|
-
ro.observe(scrollRef.value);
|
|
15
|
+
return checkTableWidth(true);
|
|
26
16
|
});
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
useResizeObserver(scrollRef, function () {
|
|
18
|
+
return checkTableWidth(false);
|
|
29
19
|
}); // if exist widthStoreKey, we get the default width from localStorage
|
|
30
20
|
|
|
31
21
|
function initWidthFromStore() {
|
package/es/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.12
|
|
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.12";
|
package/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.12
|
|
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.12';
|
|
63
63
|
/* generate end */
|
|
@@ -1,20 +1,41 @@
|
|
|
1
1
|
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
4
|
-
import React from 'react';
|
|
4
|
+
import React, { useState } 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 () {
|
|
10
|
+
var container;
|
|
11
|
+
beforeEach(function () {
|
|
12
|
+
container = document.createElement('div');
|
|
13
|
+
document.body.appendChild(container);
|
|
14
|
+
});
|
|
15
|
+
afterEach(function () {
|
|
16
|
+
ReactDOM.unmountComponentAtNode(container);
|
|
17
|
+
document.body.removeChild(container);
|
|
18
|
+
});
|
|
10
19
|
it('should render react element correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
11
|
-
var
|
|
20
|
+
var Test, App;
|
|
12
21
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
13
22
|
while (1) {
|
|
14
23
|
switch (_context.prev = _context.next) {
|
|
15
24
|
case 0:
|
|
16
|
-
|
|
17
|
-
|
|
25
|
+
App = function _App() {
|
|
26
|
+
var _useState = useState(false),
|
|
27
|
+
show = _useState[0],
|
|
28
|
+
setShow = _useState[1];
|
|
29
|
+
|
|
30
|
+
return /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
onClick: function onClick() {
|
|
32
|
+
return setShow(true);
|
|
33
|
+
}
|
|
34
|
+
}, "show"), /*#__PURE__*/React.createElement(Drawer, {
|
|
35
|
+
value: show,
|
|
36
|
+
mode: "destroy"
|
|
37
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Test, null))));
|
|
38
|
+
};
|
|
18
39
|
|
|
19
40
|
Test = /*#__PURE__*/function (_Component) {
|
|
20
41
|
_inheritsLoose(Test, _Component);
|
|
@@ -33,11 +54,9 @@ describe('Drawer', function () {
|
|
|
33
54
|
}(Component);
|
|
34
55
|
|
|
35
56
|
Test.template = "<div ref=\"a\">test</div>";
|
|
36
|
-
ReactDOM.render( /*#__PURE__*/React.createElement(
|
|
37
|
-
ReactDOM.unmountComponentAtNode(container);
|
|
38
|
-
document.body.removeChild(container);
|
|
57
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(App, null), container);
|
|
39
58
|
|
|
40
|
-
case
|
|
59
|
+
case 4:
|
|
41
60
|
case "end":
|
|
42
61
|
return _context.stop();
|
|
43
62
|
}
|
|
@@ -45,14 +64,12 @@ describe('Drawer', function () {
|
|
|
45
64
|
}, _callee);
|
|
46
65
|
})));
|
|
47
66
|
it('should handle event correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
48
|
-
var
|
|
67
|
+
var click1, click2, _document$querySelect, element1, element2;
|
|
49
68
|
|
|
50
69
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
51
70
|
while (1) {
|
|
52
71
|
switch (_context2.prev = _context2.next) {
|
|
53
72
|
case 0:
|
|
54
|
-
container = document.createElement('div');
|
|
55
|
-
document.body.appendChild(container);
|
|
56
73
|
click1 = sinon.spy(function () {
|
|
57
74
|
return console.log(1);
|
|
58
75
|
});
|
|
@@ -68,28 +85,34 @@ describe('Drawer', function () {
|
|
|
68
85
|
}, "click")), /*#__PURE__*/React.createElement(Drawer, {
|
|
69
86
|
value: true,
|
|
70
87
|
placement: "left",
|
|
71
|
-
title: "2"
|
|
88
|
+
title: "2",
|
|
89
|
+
onClose: function onClose() {
|
|
90
|
+
return console.log('click');
|
|
91
|
+
},
|
|
92
|
+
slotFooter: /*#__PURE__*/React.createElement(Button, {
|
|
93
|
+
onClick: function onClick(e) {
|
|
94
|
+
return console.log(1);
|
|
95
|
+
}
|
|
96
|
+
}, "click")
|
|
72
97
|
}, /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement("div", {
|
|
73
98
|
className: "click",
|
|
74
99
|
onClick: click2
|
|
75
100
|
}, "click")))), container);
|
|
76
101
|
_document$querySelect = document.querySelectorAll('.click'), element1 = _document$querySelect[0], element2 = _document$querySelect[1];
|
|
77
102
|
dispatchEvent(element1, 'click');
|
|
78
|
-
_context2.next =
|
|
103
|
+
_context2.next = 7;
|
|
79
104
|
return wait();
|
|
80
105
|
|
|
81
|
-
case
|
|
106
|
+
case 7:
|
|
82
107
|
expect(click1.callCount).to.eql(1);
|
|
83
108
|
dispatchEvent(element2, 'click');
|
|
84
|
-
_context2.next =
|
|
109
|
+
_context2.next = 11;
|
|
85
110
|
return wait();
|
|
86
111
|
|
|
87
|
-
case
|
|
112
|
+
case 11:
|
|
88
113
|
expect(click2.callCount).to.eql(1);
|
|
89
|
-
ReactDOM.unmountComponentAtNode(container);
|
|
90
|
-
document.body.removeChild(container);
|
|
91
114
|
|
|
92
|
-
case
|
|
115
|
+
case 12:
|
|
93
116
|
case "end":
|
|
94
117
|
return _context2.stop();
|
|
95
118
|
}
|
|
@@ -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/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.12
|
|
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.12';
|
|
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.12",
|
|
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.13",
|
|
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.13",
|
|
182
182
|
"monaco-editor": "^0.26.1",
|
|
183
183
|
"mxgraphx": "^4.0.7",
|
|
184
184
|
"resize-observer-polyfill": "^1.5.1",
|
package/dist/fonts/ionicons.eot
DELETED
|
Binary file
|