@king-design/intact 3.1.3 → 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/disabled.md +2 -2
- package/components/button/demos/ghost.md +3 -3
- package/components/button/demos/group.md +9 -3
- package/components/button/index.vdt +4 -4
- package/components/button/styles.ts +21 -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/config/demos/basic.md +17 -1
- package/components/dropdown/usePosition.ts +11 -12
- package/components/editable/styles.ts +1 -1
- package/components/icon/styles.ts +1 -0
- package/components/input/styles.ts +1 -0
- package/components/message/message.ts +10 -6
- package/components/message/message.vdt +1 -1
- package/components/message/messages.ts +10 -1
- package/components/message/messages.vdt +11 -8
- 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 +2 -3
- package/es/components/button/styles.js +6 -6
- 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/dropdown/usePosition.js +0 -1
- package/es/components/editable/styles.js +1 -1
- package/es/components/icon/styles.js +1 -1
- package/es/components/input/styles.js +1 -1
- package/es/components/message/message.d.ts +1 -0
- package/es/components/message/message.js +12 -10
- package/es/components/message/message.vdt.js +2 -1
- package/es/components/message/messages.d.ts +5 -1
- package/es/components/message/messages.js +5 -1
- package/es/components/message/messages.vdt.js +13 -7
- 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/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/disabled/react.js +3 -3
- package/es/site/data/components/button/demos/ghost/react.js +7 -3
- package/es/site/data/components/button/demos/group/react.js +17 -5
- 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/config/demos/basic/index.d.ts +1 -0
- package/es/site/data/components/config/demos/basic/index.js +8 -0
- package/es/site/data/components/config/demos/basic/react.d.ts +1 -0
- package/es/site/data/components/config/demos/basic/react.js +9 -1
- package/es/site/data/components/menu/demos/collapse/react.d.ts +11 -0
- package/es/site/data/components/menu/demos/size/react.d.ts +7 -0
- package/hooks/useDelayClose.ts +11 -6
- package/hooks/useMouseOutsidable.ts +6 -2
- package/index.ts +2 -2
- package/package.json +3 -3
|
@@ -6,12 +6,12 @@ order: 5
|
|
|
6
6
|
添加`disabled`属性,可以禁用按钮
|
|
7
7
|
|
|
8
8
|
```vdt
|
|
9
|
-
import {Button} from 'kpc';
|
|
9
|
+
import {Button, Icon} from 'kpc';
|
|
10
10
|
|
|
11
11
|
<div>
|
|
12
12
|
<Button disabled>disabled</Button>
|
|
13
13
|
<Button disabled type="none">disabled text</Button>
|
|
14
|
-
<Button disabled icon circle><
|
|
14
|
+
<Button disabled icon circle><Icon class="k-icon-search" /></Button>
|
|
15
15
|
<Button disabled type="link">link</Button>
|
|
16
16
|
<Button disabled type="flat">flat</Button>
|
|
17
17
|
</div>
|
|
@@ -6,11 +6,11 @@ order: 6
|
|
|
6
6
|
给组件添加`ghost`属性,可以展示透明背景的按钮,常用于深色背景下
|
|
7
7
|
|
|
8
8
|
```vdt
|
|
9
|
-
import {Button} from 'kpc';
|
|
9
|
+
import {Button, Icon} from 'kpc';
|
|
10
10
|
|
|
11
11
|
<div class="wrapper">
|
|
12
|
-
<Button ghost
|
|
13
|
-
<Button type="primary" ghost>primay
|
|
12
|
+
<Button ghost><Icon class="k-icon-left" />default</Button>
|
|
13
|
+
<Button type="primary" ghost>primay<Icon class="k-icon-right" /></Button>
|
|
14
14
|
<Button type="warning" ghost>warning</Button>
|
|
15
15
|
<Button type="danger" ghost>danger</Button>
|
|
16
16
|
<Button type="success" ghost>success</Button>
|
|
@@ -7,7 +7,7 @@ order: 1
|
|
|
7
7
|
可以是按钮组纵向排列。给`ButtonGroup`添加`checkType`属性,可以使按钮组拥有单选或复选能力。
|
|
8
8
|
|
|
9
9
|
```vdt
|
|
10
|
-
import {Button, ButtonGroup} from 'kpc';
|
|
10
|
+
import {Button, ButtonGroup, Icon} from 'kpc';
|
|
11
11
|
|
|
12
12
|
<div>
|
|
13
13
|
<ButtonGroup>
|
|
@@ -27,10 +27,10 @@ import {Button, ButtonGroup} from 'kpc';
|
|
|
27
27
|
</ButtonGroup>
|
|
28
28
|
<ButtonGroup>
|
|
29
29
|
<Button type="primary">
|
|
30
|
-
<
|
|
30
|
+
<Icon class="k-icon-left" />上一页
|
|
31
31
|
</Button>
|
|
32
32
|
<Button type="primary">
|
|
33
|
-
下一页<
|
|
33
|
+
下一页<Icon class="k-icon-right" />
|
|
34
34
|
</Button>
|
|
35
35
|
</ButtonGroup>
|
|
36
36
|
<br /><br />
|
|
@@ -68,6 +68,12 @@ import {Button, ButtonGroup} 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
|
|
@@ -41,8 +41,8 @@ if (!icon && Array.isArray(children)) {
|
|
|
41
41
|
|
|
42
42
|
const classNameObj = {
|
|
43
43
|
[cls('btn')]: true,
|
|
44
|
-
[cls(type)]: type !== 'default',
|
|
45
44
|
[cls(size)]: size !== 'default',
|
|
45
|
+
[cls(type)]: true,
|
|
46
46
|
[cls(`btn-icon`)]: icon,
|
|
47
47
|
[className]: className,
|
|
48
48
|
[cls('circle')]: circle,
|
|
@@ -182,6 +182,19 @@ export const makeButtonStyles = cache(function makeButtonStyles(k: string, iconS
|
|
|
182
182
|
.${k}-icon {
|
|
183
183
|
color: inherit;
|
|
184
184
|
}
|
|
185
|
+
&.${k}-default,
|
|
186
|
+
&.${k}-none,
|
|
187
|
+
&.${k}-flat {
|
|
188
|
+
.${k}-icon {
|
|
189
|
+
color: ${theme.color.lightBlack};
|
|
190
|
+
}
|
|
191
|
+
&:hover {
|
|
192
|
+
.${k}-icon {
|
|
193
|
+
color: inherit;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
185
198
|
&:hover,
|
|
186
199
|
&:focus {
|
|
187
200
|
border-color: ${button.hoverBorderColor};
|
|
@@ -262,6 +275,9 @@ export const makeButtonStyles = cache(function makeButtonStyles(k: string, iconS
|
|
|
262
275
|
|
|
263
276
|
// disabled
|
|
264
277
|
&.${k}-disabled {
|
|
278
|
+
.${k}-icon {
|
|
279
|
+
color: inherit;
|
|
280
|
+
}
|
|
265
281
|
&, &:hover {
|
|
266
282
|
color: ${button.disabled.color};
|
|
267
283
|
background: ${button.disabled.bgColor};
|
|
@@ -347,6 +363,9 @@ export const makeButtonStyles = cache(function makeButtonStyles(k: string, iconS
|
|
|
347
363
|
background: transparent;
|
|
348
364
|
color: ${button.ghost.color};
|
|
349
365
|
border-color: ${button.ghost.borderColor};
|
|
366
|
+
.${k}-icon {
|
|
367
|
+
color: inherit;
|
|
368
|
+
}
|
|
350
369
|
&:hover,
|
|
351
370
|
&:active {
|
|
352
371
|
background: transparent;
|
|
@@ -440,7 +459,7 @@ export const makeButtonGroupStyles = cache(function makeButtonGroupStyles(k: str
|
|
|
440
459
|
}
|
|
441
460
|
|
|
442
461
|
// horizontal
|
|
443
|
-
&:not(.${k}-vertical) {
|
|
462
|
+
&:not(.${k}-vertical):not(.${k}-seperate) {
|
|
444
463
|
> .${k}-btn {
|
|
445
464
|
&:not(:first-child) {
|
|
446
465
|
margin-left: -1px;
|
|
@@ -478,7 +497,7 @@ export const makeButtonGroupStyles = cache(function makeButtonGroupStyles(k: str
|
|
|
478
497
|
}
|
|
479
498
|
|
|
480
499
|
// vertical
|
|
481
|
-
&.${k}-vertical {
|
|
500
|
+
&.${k}-vertical:not(.${k}-seperate) {
|
|
482
501
|
flex-direction: column;
|
|
483
502
|
> .${k}-btn {
|
|
484
503
|
&:not(.${k}-btn-icon) {
|
|
@@ -516,9 +535,6 @@ export const makeButtonGroupStyles = cache(function makeButtonGroupStyles(k: str
|
|
|
516
535
|
// seperate
|
|
517
536
|
&.${k}-seperate {
|
|
518
537
|
gap: 8px;
|
|
519
|
-
> .${k}-btn {
|
|
520
|
-
border-radius: ${button.borderRadius} !important;
|
|
521
|
-
}
|
|
522
538
|
}
|
|
523
539
|
`;
|
|
524
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);
|
|
@@ -7,13 +7,29 @@ order: 0
|
|
|
7
7
|
|
|
8
8
|
> 本例中,我们将前缀设为`kd`,可以打开调试工具查看
|
|
9
9
|
|
|
10
|
+
> 对于`Message`组件,由于它是静态方法调用,我们可以通过`Message.classNamePrefix`设置样式名前缀
|
|
11
|
+
|
|
10
12
|
```vdt
|
|
11
13
|
import {ConfigProvider, Button, Input} from 'kpc';
|
|
12
14
|
|
|
13
15
|
<ConfigProvider value={{classNamePrefix: 'kd'}}>
|
|
14
|
-
<Button>Button</Button>
|
|
16
|
+
<Button ev-click={this.showMessage}>Button</Button>
|
|
15
17
|
<div style="margin-top: 8px;">
|
|
16
18
|
<Input />
|
|
17
19
|
</div>
|
|
18
20
|
</ConfigProvider>
|
|
19
21
|
```
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import {Message} from 'kpc';
|
|
25
|
+
|
|
26
|
+
Message.classNamePrefix = 'kd';
|
|
27
|
+
|
|
28
|
+
export default class extends Component {
|
|
29
|
+
static template = template;
|
|
30
|
+
|
|
31
|
+
showMessage() {
|
|
32
|
+
Message.info('Message with classNamePrefix');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
@@ -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
|
}
|
|
@@ -43,24 +43,28 @@ export class Message extends Component<MessageProps> {
|
|
|
43
43
|
static template = template;
|
|
44
44
|
static typeDefs = typeDefs;
|
|
45
45
|
static defaults = defaults;
|
|
46
|
+
static classNamePrefix: string;
|
|
46
47
|
|
|
47
48
|
static notice(
|
|
48
49
|
content: Children | Partial<MessageProps>,
|
|
49
50
|
duration: number = 3000,
|
|
50
51
|
type: MessageProps['type'] ='info'
|
|
51
52
|
) {
|
|
52
|
-
if (!messages) {
|
|
53
|
-
const container = document.createElement('div');
|
|
54
|
-
document.body.append(container);
|
|
55
|
-
render(h(Messages, {ref: i => messages = i}), container);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
53
|
if (isObject(content) && !(content as any).tag) {
|
|
59
54
|
content = {...content, type, key: id++} as Partial<Props<MessageProps>>;
|
|
60
55
|
} else {
|
|
61
56
|
content = {content, duration, type, key: id++} as Partial<Props<MessageProps>>;
|
|
62
57
|
}
|
|
63
58
|
|
|
59
|
+
if (!messages) {
|
|
60
|
+
const container = document.createElement('div');
|
|
61
|
+
document.body.append(container);
|
|
62
|
+
render(h(Messages, {
|
|
63
|
+
ref: (i: Messages | null) => messages = i,
|
|
64
|
+
classNamePrefix: Message.classNamePrefix,
|
|
65
|
+
} as any), container);
|
|
66
|
+
}
|
|
67
|
+
|
|
64
68
|
messages!.notice(h(Message, content));
|
|
65
69
|
}
|
|
66
70
|
static info(content: Children | Partial<MessageProps>, duration?: number) {
|
|
@@ -3,7 +3,7 @@ import {Icon} from '../icon';
|
|
|
3
3
|
import {getRestProps} from '../utils';
|
|
4
4
|
import {makeMessageStyles} from './styles';
|
|
5
5
|
|
|
6
|
-
const {type, content, children, closable, hideIcon} = this.get();
|
|
6
|
+
const {type, content, children, closable, hideIcon, classNamePrefix} = this.get();
|
|
7
7
|
const { k } = this.config;
|
|
8
8
|
|
|
9
9
|
const classNameObj = {
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import {Component, VNodeComponentClass} from 'intact';
|
|
1
|
+
import {Component, VNodeComponentClass, TypeDefs} from 'intact';
|
|
2
2
|
import template from './messages.vdt';
|
|
3
3
|
import type {Message} from './message';
|
|
4
4
|
import { useConfigContext } from '../config';
|
|
5
5
|
|
|
6
|
+
export interface MessagesProps {
|
|
7
|
+
classNamePrefix?: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const typeDefs: Required<TypeDefs<MessagesProps>> = {
|
|
11
|
+
classNamePrefix: String,
|
|
12
|
+
};
|
|
13
|
+
|
|
6
14
|
export class Messages extends Component {
|
|
7
15
|
static template = template;
|
|
16
|
+
static typeDefs = typeDefs;
|
|
8
17
|
|
|
9
18
|
private messages: VNodeComponentClass<Message>[] = [];
|
|
10
19
|
private config = useConfigContext();
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import {TransitionGroup, Transition} from 'intact';
|
|
2
2
|
import {makeMessagesStyles} from './styles';
|
|
3
|
+
import { ConfigProvider } from '../config';
|
|
3
4
|
|
|
4
|
-
const
|
|
5
|
+
const k = this.get('classNamePrefix') || this.config.k;
|
|
5
6
|
|
|
6
|
-
<
|
|
7
|
-
<
|
|
8
|
-
<
|
|
9
|
-
{$value}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
</
|
|
7
|
+
<ConfigProvider value={{classNamePrefix: k}}>
|
|
8
|
+
<div class={{[`${k}-messages`]: true, [makeMessagesStyles(k)]: true}}>
|
|
9
|
+
<TransitionGroup>
|
|
10
|
+
<template v-for={this.messages} key={$value.key}>
|
|
11
|
+
{$value}
|
|
12
|
+
</template>
|
|
13
|
+
</TransitionGroup>
|
|
14
|
+
</div>
|
|
15
|
+
</ConfigProvider>
|
|
@@ -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;
|
|
@@ -60,7 +59,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
60
59
|
});
|
|
61
60
|
}
|
|
62
61
|
|
|
63
|
-
var classNameObj = (_classNameObj = {}, _classNameObj[cls('btn')] = true, _classNameObj[cls(
|
|
62
|
+
var classNameObj = (_classNameObj = {}, _classNameObj[cls('btn')] = true, _classNameObj[cls(size)] = size !== 'default', _classNameObj[cls(type)] = true, _classNameObj[cls("btn-icon")] = icon, _classNameObj[className] = className, _classNameObj[cls('circle')] = circle, _classNameObj[cls('loading')] = loading, _classNameObj[cls('fluid')] = fluid, _classNameObj[cls('active')] = checked, _classNameObj[cls('disabled')] = disabled || loading, _classNameObj[cls('ghost')] = ghost, _classNameObj[makeButtonStyles(k, iconSide)] = true, _classNameObj);
|
|
64
63
|
|
|
65
64
|
var loadingIcon = _$cc(Icon, {
|
|
66
65
|
'className': _$cn("ion-load-c " + k + "-icon-loading"),
|