@king-design/intact 3.1.4-beta.0 → 3.1.4-beta.2
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/button/demos/group.md +6 -0
- package/components/button/index.vdt +3 -3
- package/components/button/styles.ts +2 -5
- package/components/card/demos/size.md +34 -0
- package/components/card/index.md +1 -0
- package/components/card/index.ts +5 -1
- package/components/card/index.vdt +2 -1
- package/components/card/styles.ts +43 -5
- package/components/carousel/useAutoplay.ts +5 -2
- package/components/dropdown/dropdown.ts +7 -1
- package/components/dropdown/usePosition.ts +11 -12
- package/components/icon/styles.ts +1 -0
- package/components/input/styles.ts +1 -0
- package/components/table/exportTable.ts +5 -2
- package/components/table/table.ts +2 -2
- package/components/table/useFixedColumns.ts +1 -1
- package/components/table/{useRestRowStatus.ts → useResetRowStatus.ts} +1 -1
- package/components/tabs/tab.ts +1 -0
- package/components/wave/index.ts +5 -2
- 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/button/index.vdt.js +1 -2
- package/es/components/button/styles.js +3 -3
- package/es/components/card/index.d.ts +2 -0
- package/es/components/card/index.js +4 -2
- package/es/components/card/index.vdt.js +3 -2
- package/es/components/card/styles.js +22 -3
- package/es/components/carousel/useAutoplay.js +5 -2
- package/es/components/cascader/index.d.ts +45 -0
- package/es/components/datepicker/index.d.ts +63 -0
- package/es/components/diagram/index.d.ts +1 -1
- package/es/components/dropdown/dropdown.js +7 -1
- package/es/components/dropdown/usePosition.js +0 -1
- package/es/components/icon/styles.js +1 -1
- package/es/components/input/styles.js +1 -1
- package/es/components/select/select.d.ts +33 -0
- package/es/components/steps/context.d.ts +3 -3
- package/es/components/table/exportTable.js +5 -2
- package/es/components/table/table.js +2 -2
- package/es/components/table/useFixedColumns.js +1 -1
- package/es/components/table/{useRestRowStatus.d.ts → useResetRowStatus.d.ts} +1 -1
- package/es/components/table/{useRestRowStatus.js → useResetRowStatus.js} +1 -1
- package/es/components/tabs/tab.d.ts +2 -1
- package/es/components/tabs/tab.js +1 -0
- package/es/components/timepicker/panelPicker.d.ts +54 -0
- package/es/components/treeSelect/index.d.ts +28 -0
- package/es/components/wave/index.js +6 -2
- package/es/hooks/useDelayClose.js +11 -6
- package/es/hooks/useMouseOutsidable.js +6 -2
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/site/data/components/button/demos/group/react.js +12 -0
- package/es/site/data/components/card/demos/size/index.d.ts +6 -0
- package/es/site/data/components/card/demos/size/index.js +18 -0
- package/es/site/data/components/card/demos/size/react.d.ts +5 -0
- package/es/site/data/components/card/demos/size/react.js +37 -0
- package/es/site/data/components/menu/demos/collapse/react.d.ts +1 -1
- package/es/site/data/components/menu/demos/size/react.d.ts +1 -1
- package/es/site/data/components/tree/demos/draggable/react.js +1 -1
- package/es/site/data/components/upload/demos/files/react.js +0 -1
- package/hooks/useDelayClose.ts +11 -6
- package/hooks/useMouseOutsidable.ts +6 -2
- package/index.ts +2 -2
- package/package.json +3 -3
|
@@ -68,6 +68,12 @@ import {Button, ButtonGroup, Icon} from 'kpc';
|
|
|
68
68
|
<Button value="guangzhou">广州</Button>
|
|
69
69
|
<Button value="shenzhen">深圳</Button>
|
|
70
70
|
</ButtonGroup>
|
|
71
|
+
<ButtonGroup seperate>
|
|
72
|
+
<Button value="beijing" type="primary" disabled>北京</Button>
|
|
73
|
+
<Button value="shanghai">上海</Button>
|
|
74
|
+
<Button value="guangzhou">广州</Button>
|
|
75
|
+
<Button value="shenzhen">深圳</Button>
|
|
76
|
+
</ButtonGroup>
|
|
71
77
|
</div>
|
|
72
78
|
```
|
|
73
79
|
|
|
@@ -8,13 +8,13 @@ import {button as theme} from './styles';
|
|
|
8
8
|
let {
|
|
9
9
|
type, className, size, icon, circle, ref, key, tabindex,
|
|
10
10
|
tagName, htmlType, fluid, children, loading, disabled,
|
|
11
|
-
name, ghost
|
|
11
|
+
name, ghost,
|
|
12
12
|
} = this.get();
|
|
13
13
|
|
|
14
|
-
const checked = this.isChecked();
|
|
15
|
-
if (!this.config) debugger;
|
|
16
14
|
const { cls, k } = this.config;
|
|
17
15
|
|
|
16
|
+
const checked = this.isChecked();
|
|
17
|
+
|
|
18
18
|
const isIcon = child => (
|
|
19
19
|
child.tag === Icon ||
|
|
20
20
|
child.className && child.className.indexOf('icon') > -1
|
|
@@ -459,7 +459,7 @@ export const makeButtonGroupStyles = cache(function makeButtonGroupStyles(k: str
|
|
|
459
459
|
}
|
|
460
460
|
|
|
461
461
|
// horizontal
|
|
462
|
-
&:not(.${k}-vertical) {
|
|
462
|
+
&:not(.${k}-vertical):not(.${k}-seperate) {
|
|
463
463
|
> .${k}-btn {
|
|
464
464
|
&:not(:first-child) {
|
|
465
465
|
margin-left: -1px;
|
|
@@ -497,7 +497,7 @@ export const makeButtonGroupStyles = cache(function makeButtonGroupStyles(k: str
|
|
|
497
497
|
}
|
|
498
498
|
|
|
499
499
|
// vertical
|
|
500
|
-
&.${k}-vertical {
|
|
500
|
+
&.${k}-vertical:not(.${k}-seperate) {
|
|
501
501
|
flex-direction: column;
|
|
502
502
|
> .${k}-btn {
|
|
503
503
|
&:not(.${k}-btn-icon) {
|
|
@@ -535,9 +535,6 @@ export const makeButtonGroupStyles = cache(function makeButtonGroupStyles(k: str
|
|
|
535
535
|
// seperate
|
|
536
536
|
&.${k}-seperate {
|
|
537
537
|
gap: 8px;
|
|
538
|
-
> .${k}-btn {
|
|
539
|
-
border-radius: ${button.borderRadius} !important;
|
|
540
|
-
}
|
|
541
538
|
}
|
|
542
539
|
`;
|
|
543
540
|
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 尺寸
|
|
3
|
+
order: 4
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
通过`size`属性可以指定组件的尺寸(主要改变padding):`large`, `default`,`small`, `mini`。
|
|
7
|
+
|
|
8
|
+
```vdt
|
|
9
|
+
import {Card} from 'kpc';
|
|
10
|
+
|
|
11
|
+
<div>
|
|
12
|
+
<Card title="用户信息" type="border" size="large">
|
|
13
|
+
<div>卡片内容</div>
|
|
14
|
+
<div>卡片内容</div>
|
|
15
|
+
</Card>
|
|
16
|
+
<Card title="用户信息" type="border">
|
|
17
|
+
<div>卡片内容</div>
|
|
18
|
+
<div>卡片内容</div>
|
|
19
|
+
</Card>
|
|
20
|
+
<Card title="用户信息" type="border" size="small">
|
|
21
|
+
<div>卡片内容</div>
|
|
22
|
+
<div>卡片内容</div>
|
|
23
|
+
</Card>
|
|
24
|
+
<Card title="用户信息" type="border" size="mini">
|
|
25
|
+
<div>卡片内容</div>
|
|
26
|
+
<div>卡片内容</div>
|
|
27
|
+
</Card>
|
|
28
|
+
</div>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```styl
|
|
32
|
+
.k-card
|
|
33
|
+
margin-bottom 16px
|
|
34
|
+
```
|
package/components/card/index.md
CHANGED
|
@@ -13,6 +13,7 @@ sidebar: doc
|
|
|
13
13
|
| --- | --- | --- | --- |
|
|
14
14
|
| title | 卡片标题 | `string` | `VNode` | `undefined` |
|
|
15
15
|
| type | 卡片类型 | `"shadow"` | `"border"` | `"none"` | `"shadow"` |
|
|
16
|
+
| size | 卡片尺寸 | `"default"` | `"small"` | `"mini"` | `"default"` |
|
|
16
17
|
|
|
17
18
|
## CardColumn
|
|
18
19
|
|
package/components/card/index.ts
CHANGED
|
@@ -2,10 +2,12 @@ import {Component, VNode, TypeDefs} from 'intact';
|
|
|
2
2
|
import template from './index.vdt';
|
|
3
3
|
export * from './column';
|
|
4
4
|
import { useConfigContext } from '../config';
|
|
5
|
+
import {Sizes} from '../types';
|
|
5
6
|
|
|
6
7
|
export interface CardProps {
|
|
7
8
|
title?: string | VNode
|
|
8
9
|
type?: 'shadow' | 'border' | 'none',
|
|
10
|
+
size?: Sizes,
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
export interface CardEvents { }
|
|
@@ -19,10 +21,12 @@ export interface CardBlocks {
|
|
|
19
21
|
const typeDefs: Required<TypeDefs<CardProps>> = {
|
|
20
22
|
title: [String, VNode],
|
|
21
23
|
type: ['shadow', 'border', 'none'],
|
|
24
|
+
size: String,
|
|
22
25
|
};
|
|
23
26
|
|
|
24
27
|
const defaults = (): Partial<CardProps> => ({
|
|
25
|
-
type: 'shadow'
|
|
28
|
+
type: 'shadow',
|
|
29
|
+
size: 'default',
|
|
26
30
|
});
|
|
27
31
|
|
|
28
32
|
export class Card extends Component<CardProps, CardEvents, CardBlocks> {
|
|
@@ -3,7 +3,7 @@ import {CardColumn} from './column';
|
|
|
3
3
|
import {makeStyles} from './styles';
|
|
4
4
|
|
|
5
5
|
const {
|
|
6
|
-
children, className, title, type
|
|
6
|
+
children, className, title, type, size,
|
|
7
7
|
} = this.get();
|
|
8
8
|
const { k } = this.config;
|
|
9
9
|
|
|
@@ -25,6 +25,7 @@ const classNameObj = {
|
|
|
25
25
|
[`${k}-none`]: type === 'none',
|
|
26
26
|
[`${k}-no-header`]: !hasHeader,
|
|
27
27
|
[`${k}-card-grid`]: hasColumn,
|
|
28
|
+
[`${k}-${size}`]: size !== 'default',
|
|
28
29
|
[className]: className,
|
|
29
30
|
[makeStyles(k)]: true,
|
|
30
31
|
};
|
|
@@ -6,12 +6,24 @@ import { cache } from '../utils';
|
|
|
6
6
|
|
|
7
7
|
const defaults = {
|
|
8
8
|
border: '1px solid #e5e5e5',
|
|
9
|
-
padding: '
|
|
9
|
+
padding: '24px',
|
|
10
10
|
get boxShadow() { return theme.boxShadow },
|
|
11
11
|
get borderRadius() {return theme.largeBorderRadius},
|
|
12
12
|
headerHeight: '48px',
|
|
13
13
|
headerFontSize: '14px',
|
|
14
14
|
bgColor: '#fff',
|
|
15
|
+
large: {
|
|
16
|
+
padding: '32px',
|
|
17
|
+
headerHeight: '48px',
|
|
18
|
+
},
|
|
19
|
+
small: {
|
|
20
|
+
padding: '16px',
|
|
21
|
+
headerHeight: '48px',
|
|
22
|
+
},
|
|
23
|
+
mini: {
|
|
24
|
+
padding: '8px',
|
|
25
|
+
headerHeight: '32px',
|
|
26
|
+
}
|
|
15
27
|
};
|
|
16
28
|
|
|
17
29
|
let card: typeof defaults;
|
|
@@ -20,22 +32,23 @@ setDefault(() => {
|
|
|
20
32
|
makeStyles?.clearCache();
|
|
21
33
|
});
|
|
22
34
|
|
|
35
|
+
const sizes = ['large', 'small', 'mini'] as const;
|
|
36
|
+
|
|
23
37
|
export const makeStyles = cache(function makeStyles(k: string) {
|
|
24
38
|
return css`
|
|
25
39
|
border-radius: ${card.borderRadius};
|
|
26
40
|
background: ${card.bgColor};
|
|
27
41
|
.${k}-card-header {
|
|
28
42
|
height: ${card.headerHeight};
|
|
29
|
-
line-height: ${card.headerHeight};
|
|
30
43
|
padding: 0 ${card.padding};
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
31
46
|
}
|
|
32
47
|
.${k}-card-title {
|
|
33
48
|
font-size: ${card.headerFontSize};
|
|
34
|
-
|
|
49
|
+
flex: 1;
|
|
35
50
|
}
|
|
36
51
|
.${k}-card-extra {
|
|
37
|
-
float: right;
|
|
38
|
-
height: 100%;
|
|
39
52
|
display: flex;
|
|
40
53
|
align-items: center;
|
|
41
54
|
}
|
|
@@ -90,5 +103,30 @@ export const makeStyles = cache(function makeStyles(k: string) {
|
|
|
90
103
|
justify-content: center;
|
|
91
104
|
}
|
|
92
105
|
}
|
|
106
|
+
|
|
107
|
+
// size
|
|
108
|
+
${sizes.map(size => {
|
|
109
|
+
const { padding, headerHeight } = card[size];
|
|
110
|
+
return css`
|
|
111
|
+
&.${k}-${size} {
|
|
112
|
+
.${k}-card-header {
|
|
113
|
+
padding: 0 ${padding};
|
|
114
|
+
height: ${headerHeight};
|
|
115
|
+
}
|
|
116
|
+
.${k}-card-body {
|
|
117
|
+
padding: 0 ${padding} ${padding};
|
|
118
|
+
}
|
|
119
|
+
&.${k}-border,
|
|
120
|
+
&.${k}-no-header {
|
|
121
|
+
.${k}-card-body {
|
|
122
|
+
padding-top: ${padding};
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
.${k}-card-column {
|
|
126
|
+
padding: ${padding};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
`
|
|
130
|
+
})}
|
|
93
131
|
`;
|
|
94
132
|
});
|
|
@@ -4,7 +4,7 @@ import type {Carousel} from './';
|
|
|
4
4
|
export function useAutoplay(next: () => void) {
|
|
5
5
|
const instance = useInstance() as Carousel;
|
|
6
6
|
|
|
7
|
-
let timer: number;
|
|
7
|
+
let timer: number | null = null;
|
|
8
8
|
let ms: number;
|
|
9
9
|
|
|
10
10
|
instance.on('$receive:autoplay', v => {
|
|
@@ -28,7 +28,10 @@ export function useAutoplay(next: () => void) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
function stop() {
|
|
31
|
-
|
|
31
|
+
if (timer) {
|
|
32
|
+
window.clearTimeout(timer);
|
|
33
|
+
timer = null;
|
|
34
|
+
}
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
onBeforeUnmount(stop);
|
|
@@ -112,7 +112,13 @@ export class Dropdown<
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
let [trigger, menu] = children as DropdownChildren;
|
|
116
|
+
/**
|
|
117
|
+
* In vue-legacy, if the menu is TooltipContent, the menu will be InUsed when update,
|
|
118
|
+
* so we clone it here, #954
|
|
119
|
+
*/
|
|
120
|
+
menu = directClone(menu);
|
|
121
|
+
|
|
116
122
|
const props = this.initEventCallbacks();
|
|
117
123
|
let {className, value, container} = this.get();
|
|
118
124
|
const { k } = this.config;
|
|
@@ -53,18 +53,17 @@ export function usePosition() {
|
|
|
53
53
|
let pos = instance.get('position');
|
|
54
54
|
switch (pos) {
|
|
55
55
|
case 'left':
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
break;
|
|
56
|
+
pos = {my: 'right-10 center', at: 'left center'};
|
|
57
|
+
break;
|
|
58
|
+
case 'bottom':
|
|
59
|
+
pos = {my: 'center top+10', at: 'center bottom'};
|
|
60
|
+
break;
|
|
61
|
+
case 'right':
|
|
62
|
+
pos = {my: 'left+10 center', at: 'right center'};
|
|
63
|
+
break;
|
|
64
|
+
case 'top':
|
|
65
|
+
pos = {my: 'center bottom-10', at: 'center top'};
|
|
66
|
+
break;
|
|
68
67
|
}
|
|
69
68
|
position(findDomFromVNode(instance.menuVNode!, true) as HTMLElement, {
|
|
70
69
|
my: 'left top+8',
|
|
@@ -37,6 +37,7 @@ export const makeStyles = cache(function makeStyles(k: string, color?: string) {
|
|
|
37
37
|
font-size: ${icon.fontSize.default};
|
|
38
38
|
line-height: 1;
|
|
39
39
|
// display: inline-block;
|
|
40
|
+
font-weight: normal;
|
|
40
41
|
${sizes.map(size => {
|
|
41
42
|
const fontSize = icon.fontSize[size];
|
|
42
43
|
return css`
|
|
@@ -105,6 +105,7 @@ export const makeStyles = cache(function makeStyles(k: string) {
|
|
|
105
105
|
background: transparent;
|
|
106
106
|
padding: 0;
|
|
107
107
|
width: 0; // must set width to 0, otherwise it has min width
|
|
108
|
+
max-width: 100%;
|
|
108
109
|
&::placeholder {
|
|
109
110
|
color: ${input.placeholderColor};
|
|
110
111
|
}
|
|
@@ -70,12 +70,15 @@ function pushTextContext(rows: string[], dom: HTMLElement, content: string | und
|
|
|
70
70
|
|
|
71
71
|
export function download(content: string, filename: string) {
|
|
72
72
|
if ((navigator as any).msSaveBlob) { // IE10+
|
|
73
|
-
const blob = new Blob([content], { type: 'text/csv;charset=utf-8' });
|
|
73
|
+
const blob = new Blob(['\uFEFF' + content], { type: 'text/csv;charset=utf-8' });
|
|
74
74
|
(navigator as any).msSaveBlob(blob, filename);
|
|
75
75
|
} else {
|
|
76
76
|
const link = document.createElement('a');
|
|
77
77
|
if ('download' in link) {
|
|
78
|
-
|
|
78
|
+
/**
|
|
79
|
+
* should add \uFEFF, otherwise it will be error codes in MSExcel
|
|
80
|
+
*/
|
|
81
|
+
const blob = new Blob(['\uFEFF' + content], { type: 'text/csv;charset=utf-8' });
|
|
79
82
|
const url = URL.createObjectURL(blob);
|
|
80
83
|
link.setAttribute('href', url);
|
|
81
84
|
link.setAttribute('download', filename);
|
|
@@ -12,7 +12,7 @@ import {useExpandable} from './useExpandable';
|
|
|
12
12
|
import {useSelected} from './useSelected';
|
|
13
13
|
import {useTree} from './useTree';
|
|
14
14
|
import {TooltipProps, Tooltip} from '../tooltip/tooltip';
|
|
15
|
-
import {
|
|
15
|
+
import {useResetRowStatus} from './useResetRowStatus';
|
|
16
16
|
import {exportTable} from './exportTable';
|
|
17
17
|
import {useResizable} from './useResizable';
|
|
18
18
|
import {useDraggable} from './useDraggable';
|
|
@@ -208,7 +208,7 @@ export class Table<
|
|
|
208
208
|
private sortable = useSortable();
|
|
209
209
|
private expandable = useExpandable();
|
|
210
210
|
private selected = useSelected();
|
|
211
|
-
private resetRowStatus =
|
|
211
|
+
private resetRowStatus = useResetRowStatus(this.disableRow.getAllKeys);
|
|
212
212
|
private draggable = useDraggable(this.pagination.data);
|
|
213
213
|
private stickyScrollbar = useStickyScrollbar(
|
|
214
214
|
this.stickyHeader.elementRef,
|
|
@@ -107,7 +107,7 @@ export function useFixedColumns(
|
|
|
107
107
|
|
|
108
108
|
function updateScrollPositionOnResize() {
|
|
109
109
|
const scrollDom = scrollRef.value!;
|
|
110
|
-
if (scrollDom.scrollWidth - scrollDom.offsetWidth <= 0) {
|
|
110
|
+
if (!hasFixed.value || scrollDom.scrollWidth - scrollDom.offsetWidth <= 0) {
|
|
111
111
|
scrollPosition.set(null);
|
|
112
112
|
} else {
|
|
113
113
|
setScrollPosition(scrollRef.value!.scrollLeft);
|
|
@@ -2,7 +2,7 @@ import {useInstance, onBeforeUnmount, onUpdated} from 'intact';
|
|
|
2
2
|
import type {Table, TableRowKey} from './table';
|
|
3
3
|
import {addOrRemove} from './useChecked';
|
|
4
4
|
|
|
5
|
-
export function
|
|
5
|
+
export function useResetRowStatus(
|
|
6
6
|
getAllKeys: () => TableRowKey[]
|
|
7
7
|
) {
|
|
8
8
|
const instance = useInstance() as Table;
|
package/components/tabs/tab.ts
CHANGED
package/components/wave/index.ts
CHANGED
|
@@ -37,7 +37,7 @@ export class Wave extends Component<WaveProps> {
|
|
|
37
37
|
|
|
38
38
|
private instance: HTMLElement | null = null;
|
|
39
39
|
private className!: string;
|
|
40
|
-
private timer: number =
|
|
40
|
+
private timer: number | null = null;
|
|
41
41
|
private config = useConfigContext();
|
|
42
42
|
|
|
43
43
|
private initClassName() {
|
|
@@ -91,6 +91,9 @@ export class Wave extends Component<WaveProps> {
|
|
|
91
91
|
|
|
92
92
|
node.classList.remove(this.className);
|
|
93
93
|
node.removeEventListener('animationend', this.resetAnimation);
|
|
94
|
-
|
|
94
|
+
if (this.timer) {
|
|
95
|
+
clearTimeout(this.timer);
|
|
96
|
+
this.timer = null;
|
|
97
|
+
}
|
|
95
98
|
}
|
|
96
99
|
}
|
|
Binary file
|