@king-design/intact 3.1.4-beta.0 → 3.1.4-beta.1
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/usePosition.ts +11 -12
- package/components/icon/styles.ts +1 -0
- package/components/input/styles.ts +1 -0
- 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/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/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/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/hooks/useDelayClose.ts +11 -6
- package/hooks/useMouseOutsidable.ts +6 -2
- package/index.ts +2 -2
- package/package.json +2 -2
|
@@ -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);
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|
|
@@ -31,11 +31,10 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
31
31
|
name = _this$get.name,
|
|
32
32
|
ghost = _this$get.ghost;
|
|
33
33
|
|
|
34
|
-
var checked = this.isChecked();
|
|
35
|
-
if (!this.config) debugger;
|
|
36
34
|
var _this$config = this.config,
|
|
37
35
|
cls = _this$config.cls,
|
|
38
36
|
k = _this$config.k;
|
|
37
|
+
var checked = this.isChecked();
|
|
39
38
|
|
|
40
39
|
var isIcon = function isIcon(child) {
|
|
41
40
|
return child.tag === Icon || child.className && child.className.indexOf('icon') > -1;
|
|
@@ -264,13 +264,13 @@ export var makeButtonStyles = cache(function makeButtonStyles(k, iconSide) {
|
|
|
264
264
|
}), ";.", k, "-icon-loading{margin-left:-1em;}}}"), ";"));
|
|
265
265
|
});
|
|
266
266
|
export var makeButtonGroupStyles = cache(function makeButtonGroupStyles(k) {
|
|
267
|
-
return /*#__PURE__*/css("display:inline-flex;align-items:center;flex-wrap:wrap;vertical-align:middle;.", k, "-btn{margin:0;vertical-align:middle;&:hover,&:focus,&.", k, "-active{z-index:1;position:relative;}}&.", k, "-fluid{width:100%;}&:not(.", k, "-vertical){>.", k, "-btn{", _mapInstanceProperty(types).call(types, function (type) {
|
|
267
|
+
return /*#__PURE__*/css("display:inline-flex;align-items:center;flex-wrap:wrap;vertical-align:middle;.", k, "-btn{margin:0;vertical-align:middle;&:hover,&:focus,&.", k, "-active{z-index:1;position:relative;}}&.", k, "-fluid{width:100%;}&:not(.", k, "-vertical):not(.", k, "-seperate){>.", k, "-btn{", _mapInstanceProperty(types).call(types, function (type) {
|
|
268
268
|
if (type === 'active') return;
|
|
269
269
|
var borderColor = button.group[type].borderColor;
|
|
270
270
|
return /*#__PURE__*/css("&.", k, "-", type, ":not(:first-child){border-left-color:", borderColor, ";}&.", k, "-", type, ":not(:last-child){border-right-color:", borderColor, ";}");
|
|
271
|
-
}), ";&:not(:first-child){margin-left:-1px;&:not(:last-child){border-radius:0;}}&:not(:only-child):first-child{border-top-right-radius:0;border-bottom-right-radius:0;}&:not(:only-child):last-child{border-top-left-radius:0;border-bottom-left-radius:0;}}&.", k, "-fluid{display:flex;>.", k, "-btn{flex:1;}}}&.", k, "-vertical{flex-direction:column;>.", k, "-btn{", _mapInstanceProperty(types).call(types, function (type) {
|
|
271
|
+
}), ";&:not(:first-child){margin-left:-1px;&:not(:last-child){border-radius:0;}}&:not(:only-child):first-child{border-top-right-radius:0;border-bottom-right-radius:0;}&:not(:only-child):last-child{border-top-left-radius:0;border-bottom-left-radius:0;}}&.", k, "-fluid{display:flex;>.", k, "-btn{flex:1;}}}&.", k, "-vertical:not(.", k, "-seperate){flex-direction:column;>.", k, "-btn{", _mapInstanceProperty(types).call(types, function (type) {
|
|
272
272
|
if (type === 'active') return;
|
|
273
273
|
var borderColor = button.group[type].borderColor;
|
|
274
274
|
return /*#__PURE__*/css("&.", k, "-", type, ":not(:first-child){border-top-color:", borderColor, ";}&.", k, "-", type, ":not(:last-child){border-bottom-color:", borderColor, ";}");
|
|
275
|
-
}), ";&:not(.", k, "-btn-icon){width:100%;}&:not(:first-child){margin-top:-1px;&:not(:last-child){border-radius:0;}}&:not(:only-child):first-child{border-bottom-left-radius:0;border-bottom-right-radius:0;}&:not(:only-child):last-child{border-top-left-radius:0;border-top-right-radius:0;}}}&.", k, "-seperate{gap:8px
|
|
275
|
+
}), ";&:not(.", k, "-btn-icon){width:100%;}&:not(:first-child){margin-top:-1px;&:not(:last-child){border-radius:0;}}&:not(:only-child):first-child{border-bottom-left-radius:0;border-bottom-right-radius:0;}&:not(:only-child):last-child{border-top-left-radius:0;border-top-right-radius:0;}}}&.", k, "-seperate{gap:8px;}");
|
|
276
276
|
});
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Component, VNode, TypeDefs } from 'intact';
|
|
2
2
|
export * from './column';
|
|
3
|
+
import { Sizes } from '../types';
|
|
3
4
|
export interface CardProps {
|
|
4
5
|
title?: string | VNode;
|
|
5
6
|
type?: 'shadow' | 'border' | 'none';
|
|
7
|
+
size?: Sizes;
|
|
6
8
|
}
|
|
7
9
|
export interface CardEvents {
|
|
8
10
|
}
|
|
@@ -6,12 +6,14 @@ export * from './column';
|
|
|
6
6
|
import { useConfigContext } from '../config';
|
|
7
7
|
var typeDefs = {
|
|
8
8
|
title: [String, VNode],
|
|
9
|
-
type: ['shadow', 'border', 'none']
|
|
9
|
+
type: ['shadow', 'border', 'none'],
|
|
10
|
+
size: String
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
var defaults = function defaults() {
|
|
13
14
|
return {
|
|
14
|
-
type: 'shadow'
|
|
15
|
+
type: 'shadow',
|
|
16
|
+
size: 'default'
|
|
15
17
|
};
|
|
16
18
|
};
|
|
17
19
|
|
|
@@ -16,7 +16,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
16
16
|
children = _this$get.children,
|
|
17
17
|
className = _this$get.className,
|
|
18
18
|
title = _this$get.title,
|
|
19
|
-
type = _this$get.type
|
|
19
|
+
type = _this$get.type,
|
|
20
|
+
size = _this$get.size;
|
|
20
21
|
|
|
21
22
|
var k = this.config.k;
|
|
22
23
|
var hasHeader = $blocks.header || $blocks.title || title || $blocks.extra;
|
|
@@ -33,7 +34,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
var classNameObj = (_classNameObj = {}, _classNameObj[k + "-card"] = true, _classNameObj[k + "-shadow"] = type === 'shadow', _classNameObj[k + "-border"] = type === 'border', _classNameObj[k + "-none"] = type === 'none', _classNameObj[k + "-no-header"] = !hasHeader, _classNameObj[k + "-card-grid"] = hasColumn, _classNameObj[className] = className, _classNameObj[makeStyles(k)] = true, _classNameObj);
|
|
37
|
+
var classNameObj = (_classNameObj = {}, _classNameObj[k + "-card"] = true, _classNameObj[k + "-shadow"] = type === 'shadow', _classNameObj[k + "-border"] = type === 'border', _classNameObj[k + "-none"] = type === 'none', _classNameObj[k + "-no-header"] = !hasHeader, _classNameObj[k + "-card-grid"] = hasColumn, _classNameObj[k + "-" + size] = size !== 'default', _classNameObj[className] = className, _classNameObj[makeStyles(k)] = true, _classNameObj);
|
|
37
38
|
return _$cv('div', _extends({
|
|
38
39
|
'className': _$cn(classNameObj)
|
|
39
40
|
}, getRestProps(this)), [hasHeader ? _$ce(2, 'div', (_$blocks['header'] = function ($super) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
1
2
|
import { css } from '@emotion/css';
|
|
2
3
|
import { theme, setDefault } from '../../styles/theme';
|
|
3
4
|
import { deepDefaults } from '../../styles/utils';
|
|
@@ -5,7 +6,7 @@ import '../../styles/global';
|
|
|
5
6
|
import { cache } from '../utils';
|
|
6
7
|
var defaults = {
|
|
7
8
|
border: '1px solid #e5e5e5',
|
|
8
|
-
padding: '
|
|
9
|
+
padding: '24px',
|
|
9
10
|
|
|
10
11
|
get boxShadow() {
|
|
11
12
|
return theme.boxShadow;
|
|
@@ -17,7 +18,19 @@ var defaults = {
|
|
|
17
18
|
|
|
18
19
|
headerHeight: '48px',
|
|
19
20
|
headerFontSize: '14px',
|
|
20
|
-
bgColor: '#fff'
|
|
21
|
+
bgColor: '#fff',
|
|
22
|
+
large: {
|
|
23
|
+
padding: '32px',
|
|
24
|
+
headerHeight: '48px'
|
|
25
|
+
},
|
|
26
|
+
small: {
|
|
27
|
+
padding: '16px',
|
|
28
|
+
headerHeight: '48px'
|
|
29
|
+
},
|
|
30
|
+
mini: {
|
|
31
|
+
padding: '8px',
|
|
32
|
+
headerHeight: '32px'
|
|
33
|
+
}
|
|
21
34
|
};
|
|
22
35
|
var card;
|
|
23
36
|
setDefault(function () {
|
|
@@ -26,6 +39,12 @@ setDefault(function () {
|
|
|
26
39
|
}).card;
|
|
27
40
|
makeStyles == null ? void 0 : makeStyles.clearCache();
|
|
28
41
|
});
|
|
42
|
+
var sizes = ['large', 'small', 'mini'];
|
|
29
43
|
export var makeStyles = cache(function makeStyles(k) {
|
|
30
|
-
return /*#__PURE__*/css("border-radius:", card.borderRadius, ";background:", card.bgColor, ";.", k, "-card-header{height:", card.headerHeight, ";
|
|
44
|
+
return /*#__PURE__*/css("border-radius:", card.borderRadius, ";background:", card.bgColor, ";.", k, "-card-header{height:", card.headerHeight, ";padding:0 ", card.padding, ";display:flex;align-items:center;}.", k, "-card-title{font-size:", card.headerFontSize, ";flex:1;}.", k, "-card-extra{display:flex;align-items:center;}.", k, "-card-body{padding:0 ", card.padding, " ", card.padding, ";}&.", k, "-shadow{box-shadow:", card.boxShadow, ";}&.", k, "-none{box-shadow:none;}&.", k, "-border{border:", card.border, ";.", k, "-card-header{border-bottom:", card.border, ";}.", k, "-card-body{padding-top:", card.padding, ";}}&.", k, "-no-header{.", k, "-card-body{padding-top:", card.padding, ";}}&.", k, "-card-grid{.", k, "-card-body{display:flex;padding:0;}&.", k, "-border{.", k, "-card-column:not(:last-of-type){border-right:", card.border, ";}}}.", k, "-card-column{display:flex;align-items:center;padding:", card.padding, ";&.", k, "-fluid{flex:1;}&.", k, "-center{justify-content:center;}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
45
|
+
var _card$size = card[size],
|
|
46
|
+
padding = _card$size.padding,
|
|
47
|
+
headerHeight = _card$size.headerHeight;
|
|
48
|
+
return /*#__PURE__*/css("&.", k, "-", size, "{.", k, "-card-header{padding:0 ", padding, ";height:", headerHeight, ";}.", k, "-card-body{padding:0 ", padding, " ", padding, ";}&.", k, "-border,&.", k, "-no-header{.", k, "-card-body{padding-top:", padding, ";}}.", k, "-card-column{padding:", padding, ";}}");
|
|
49
|
+
}), ";");
|
|
31
50
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useInstance, onBeforeUnmount } from 'intact';
|
|
2
2
|
export function useAutoplay(next) {
|
|
3
3
|
var instance = useInstance();
|
|
4
|
-
var timer;
|
|
4
|
+
var timer = null;
|
|
5
5
|
var ms;
|
|
6
6
|
instance.on('$receive:autoplay', function (v) {
|
|
7
7
|
if (v === true) {
|
|
@@ -24,7 +24,10 @@ export function useAutoplay(next) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
function stop() {
|
|
27
|
-
|
|
27
|
+
if (timer) {
|
|
28
|
+
window.clearTimeout(timer);
|
|
29
|
+
timer = null;
|
|
30
|
+
}
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
onBeforeUnmount(stop);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { TypeDefs } from 'intact';
|
|
2
|
+
import { BaseSelect, BaseSelectProps, BaseSelectEvents, BaseSelectBlocks } from '../select/base';
|
|
3
|
+
export interface CascaderProps<V = any, Multipe extends boolean = boolean, Data extends BaseCascaderData = CascaderData<V>> extends BaseSelectProps<V[], Multipe> {
|
|
4
|
+
data?: Data[];
|
|
5
|
+
trigger?: 'click' | 'hover';
|
|
6
|
+
changeOnSelect?: boolean;
|
|
7
|
+
format?: (labels: string[]) => string;
|
|
8
|
+
loadData?: (data: Data) => any;
|
|
9
|
+
filter?: (keywords: string, data: Data) => boolean;
|
|
10
|
+
fields?: CascaderFields<Data>;
|
|
11
|
+
}
|
|
12
|
+
export declare type CascaderFields<Data> = {
|
|
13
|
+
value?: keyof Data;
|
|
14
|
+
label?: keyof Data;
|
|
15
|
+
children?: keyof Data;
|
|
16
|
+
disabled?: keyof Data;
|
|
17
|
+
};
|
|
18
|
+
export interface BaseCascaderData {
|
|
19
|
+
loaded?: boolean;
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
}
|
|
22
|
+
export interface CascaderData<V> extends BaseCascaderData {
|
|
23
|
+
value: V;
|
|
24
|
+
label: string;
|
|
25
|
+
children?: CascaderData<V>[];
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface CascaderEvents extends BaseSelectEvents {
|
|
29
|
+
}
|
|
30
|
+
export interface CascaderBlocks<V> extends BaseSelectBlocks<V> {
|
|
31
|
+
}
|
|
32
|
+
export declare class Cascader<V = any, Multipe extends boolean = false, Data extends BaseCascaderData = CascaderData<V>> extends BaseSelect<CascaderProps<V, Multipe, Data>, CascaderEvents, CascaderBlocks<V>> {
|
|
33
|
+
static template: string | import("intact").Template<any>;
|
|
34
|
+
static typeDefs: Required<TypeDefs<CascaderProps<any, boolean, CascaderData<any>>>>;
|
|
35
|
+
static defaults: () => Partial<CascaderProps<any, boolean, CascaderData<any>>>;
|
|
36
|
+
private fields;
|
|
37
|
+
private value;
|
|
38
|
+
private label;
|
|
39
|
+
private load;
|
|
40
|
+
private filterable;
|
|
41
|
+
private positionObj;
|
|
42
|
+
protected getPlaceholder(): string | number | boolean | import("misstime/dist/utils/types").VNode<any> | import("intact").Children[];
|
|
43
|
+
protected getLabel(): import("intact").Children;
|
|
44
|
+
protected hasValue(): any;
|
|
45
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { TypeDefs } from 'intact';
|
|
2
|
+
import dayjs from './dayjs';
|
|
3
|
+
import { State } from '../../hooks/useState';
|
|
4
|
+
import { Shortcut } from './shortcuts';
|
|
5
|
+
import { BasePicker, BasePickerProps, BasePickerEvents, BasePickerBlocks, Value } from './basepicker';
|
|
6
|
+
export * as shortcuts from './shortcuts';
|
|
7
|
+
export interface DatepickerProps<V extends Value = Value, M extends boolean = boolean, R extends boolean = boolean> extends BasePickerProps<V extends string ? V : V | string, M, R> {
|
|
8
|
+
type?: 'date' | 'datetime' | 'year' | 'month';
|
|
9
|
+
shortcuts?: Shortcut[];
|
|
10
|
+
}
|
|
11
|
+
export interface DatepickerEvents extends BasePickerEvents {
|
|
12
|
+
}
|
|
13
|
+
export interface DatepickerBlocks<V extends Value = Value, R extends boolean = boolean> extends BasePickerBlocks<V, R> {
|
|
14
|
+
}
|
|
15
|
+
export declare class Datepicker<V extends Value = Value, M extends boolean = false, R extends boolean = false> extends BasePicker<DatepickerProps<V, M, R>, DatepickerEvents, DatepickerBlocks<V, R>> {
|
|
16
|
+
static template: string | import("intact").Template<any>;
|
|
17
|
+
static typeDefs: Required<TypeDefs<DatepickerProps<Value, boolean, boolean>>>;
|
|
18
|
+
static defaults: () => Partial<DatepickerProps<Value, boolean, boolean>>;
|
|
19
|
+
formats: {
|
|
20
|
+
getValueFormat: () => string;
|
|
21
|
+
getShowFormat: () => string;
|
|
22
|
+
createDateByValueFormat: (value: Value) => dayjs.Dayjs;
|
|
23
|
+
createDateByShowFormat: (value: string) => dayjs.Dayjs;
|
|
24
|
+
getShowString: (value: dayjs.Dayjs) => string;
|
|
25
|
+
getValueString: (value: dayjs.Dayjs) => string;
|
|
26
|
+
};
|
|
27
|
+
disabled: {
|
|
28
|
+
isDisabled: (value: dayjs.Dayjs, type?: dayjs.OpUnitType) => boolean;
|
|
29
|
+
isDisabledTime: (value: dayjs.Dayjs, flag: import("./usePanel").PanelFlags) => boolean;
|
|
30
|
+
isDisabledConfirm: () => boolean;
|
|
31
|
+
maxDate: State<dayjs.Dayjs | null>;
|
|
32
|
+
minDate: State<dayjs.Dayjs | null>;
|
|
33
|
+
};
|
|
34
|
+
panel: {
|
|
35
|
+
startPanel: State<import("./usePanel").PanelTypes>;
|
|
36
|
+
endPanel: State<import("./usePanel").PanelTypes>;
|
|
37
|
+
changePanel: (type: import("./usePanel").PanelTypes, flag?: import("./usePanel").PanelFlags) => void;
|
|
38
|
+
getPanel: (flag: import("./usePanel").PanelFlags) => State<import("./usePanel").PanelTypes>;
|
|
39
|
+
reset: () => void;
|
|
40
|
+
startRef: import("intact").RefObject<import("./calendar").DatepickerCalendar>;
|
|
41
|
+
endRef: import("intact").RefObject<import("./calendar").DatepickerCalendar>;
|
|
42
|
+
};
|
|
43
|
+
focusDate: {
|
|
44
|
+
focusDate: State<dayjs.Dayjs | null>;
|
|
45
|
+
reset: () => void;
|
|
46
|
+
};
|
|
47
|
+
value: {
|
|
48
|
+
format: () => string | string[];
|
|
49
|
+
onConfirm: () => void;
|
|
50
|
+
onChangeTime: (date: dayjs.Dayjs, flag: import("./usePanel").PanelFlags) => void;
|
|
51
|
+
getTimeValue: (flag: import("./usePanel").PanelFlags) => dayjs.Dayjs | null | undefined;
|
|
52
|
+
convertToDayjs: (v: Value | [Value, Value] | Value[] | [Value, Value][] | null | undefined) => import("./basepicker").DayjsValue;
|
|
53
|
+
getDayjsValue: () => import("./basepicker").DayjsValue;
|
|
54
|
+
value: State<import("./basepicker").StateValue>;
|
|
55
|
+
setValue: (v: import("./basepicker").StateValueItem, fromInput: boolean) => void;
|
|
56
|
+
onChangeDate: (v: dayjs.Dayjs, flag: import("./usePanel").PanelFlags) => void;
|
|
57
|
+
};
|
|
58
|
+
init(): void;
|
|
59
|
+
protected getPlaceholder(): string | number | boolean | import("misstime/dist/utils/types").VNode<any> | import("intact").Children[];
|
|
60
|
+
protected getLabel(): string | string[];
|
|
61
|
+
protected clear(e: MouseEvent): void;
|
|
62
|
+
private setByShortcut;
|
|
63
|
+
}
|