@king-design/intact 3.4.3 → 3.4.4
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 +3 -3
- package/components/button/group.ts +5 -0
- package/components/button/group.vdt +2 -2
- package/components/button/index.md +2 -1
- package/components/button/styles.ts +4 -4
- package/components/table/cell.ts +2 -2
- package/components/table/cell.vdt +5 -3
- package/components/table/column.vdt +4 -3
- package/components/table/demos/asyncTree.md +3 -0
- package/components/table/demos/fixFooter.md +1 -1
- package/components/table/demos/tree.md +22 -10
- package/components/table/index.md +1 -0
- package/components/table/row.ts +1 -0
- package/components/table/row.vdt +2 -0
- package/components/table/styles.ts +3 -0
- package/components/table/table.ts +4 -3
- package/components/table/table.vdt +4 -2
- package/components/table/useColumns.ts +24 -1
- package/components/tip/demos/icon.md +53 -0
- package/components/tip/demos/size.md +39 -0
- package/components/tip/index.md +2 -0
- package/components/tip/index.ts +17 -1
- package/components/tip/index.vdt +38 -5
- package/components/tip/styles.ts +84 -3
- package/components/tooltip/demos/always.md +6 -0
- package/components/tooltip/tooltip.ts +2 -1
- package/components/transfer/index.vdt +2 -4
- package/components/tree/demos/loading.md +3 -0
- package/components/upload/demos/files.md +1 -0
- package/components/upload/index.vdt +4 -1
- package/components/upload/styles.ts +1 -0
- package/es/components/button/group.d.ts +1 -0
- package/es/components/button/group.js +4 -0
- package/es/components/button/group.vdt.js +3 -2
- package/es/components/button/styles.js +3 -3
- package/es/components/table/cell.d.ts +1 -0
- package/es/components/table/cell.vdt.js +5 -3
- package/es/components/table/column.vdt.js +16 -12
- package/es/components/table/row.d.ts +1 -0
- package/es/components/table/row.vdt.js +4 -2
- package/es/components/table/styles.d.ts +49 -0
- package/es/components/table/styles.js +2 -1
- package/es/components/table/table.d.ts +1 -0
- package/es/components/table/table.js +1 -0
- package/es/components/table/table.vdt.js +11 -2
- package/es/components/table/useColumns.d.ts +9 -0
- package/es/components/table/useColumns.js +29 -1
- package/es/components/tip/index.d.ts +6 -1
- package/es/components/tip/index.js +12 -1
- package/es/components/tip/index.vdt.js +25 -5
- package/es/components/tip/styles.js +44 -2
- package/es/components/tooltip/tooltip.js +5 -1
- package/es/components/transfer/index.vdt.js +2 -4
- package/es/components/upload/index.vdt.js +4 -1
- package/es/components/upload/styles.js +1 -1
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/site/data/components/button/demos/group/react.js +2 -2
- package/es/site/data/components/table/demos/tree/react.js +18 -2
- package/es/site/data/components/tip/demos/icon/index.d.ts +9 -0
- package/es/site/data/components/tip/demos/icon/index.js +19 -0
- package/es/site/data/components/tip/demos/icon/react.d.ts +8 -0
- package/es/site/data/components/tip/demos/icon/react.js +54 -0
- package/es/site/data/components/tip/demos/size/index.d.ts +9 -0
- package/es/site/data/components/tip/demos/size/index.js +19 -0
- package/es/site/data/components/tip/demos/size/react.d.ts +8 -0
- package/es/site/data/components/tip/demos/size/react.js +39 -0
- package/es/site/data/components/tooltip/demos/always/react.js +5 -0
- package/es/site/data/components/upload/demos/files/index.js +3 -0
- package/es/site/data/components/upload/demos/files/react.js +3 -0
- package/es/site/src/pages/font/index.js +1 -1
- package/es/site/src/pages/font/styles.js +1 -1
- package/index.ts +2 -2
- package/package.json +2 -2
|
@@ -4,7 +4,7 @@ order: 1
|
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
将`Button`作为`ButtonGroup`的子元素,可以展示按钮组。给`ButtonGroup`添加`vertical`属性,
|
|
7
|
-
|
|
7
|
+
可以使按钮组纵向排列。给`ButtonGroup`添加`separate`属性,可以在按钮之间插入间隔。给`ButtonGroup`添加`checkType`属性,可以使按钮组拥有单选或复选能力。
|
|
8
8
|
|
|
9
9
|
```vdt
|
|
10
10
|
import {Button, ButtonGroup, Icon} from 'kpc';
|
|
@@ -62,13 +62,13 @@ import {Button, ButtonGroup, Icon} from 'kpc';
|
|
|
62
62
|
<Button value="shenzhen" size="small">深圳</Button>
|
|
63
63
|
</ButtonGroup>
|
|
64
64
|
<p>有间隔的按钮组</p>
|
|
65
|
-
<ButtonGroup checkType="radio" v-model="city"
|
|
65
|
+
<ButtonGroup checkType="radio" v-model="city" separate>
|
|
66
66
|
<Button value="beijing">北京</Button>
|
|
67
67
|
<Button value="shanghai">上海</Button>
|
|
68
68
|
<Button value="guangzhou">广州</Button>
|
|
69
69
|
<Button value="shenzhen">深圳</Button>
|
|
70
70
|
</ButtonGroup>
|
|
71
|
-
<ButtonGroup
|
|
71
|
+
<ButtonGroup separate>
|
|
72
72
|
<Button value="beijing" type="primary" disabled>北京</Button>
|
|
73
73
|
<Button value="shanghai">上海</Button>
|
|
74
74
|
<Button value="guangzhou">广州</Button>
|
|
@@ -10,6 +10,7 @@ export interface ButtonGroupProps {
|
|
|
10
10
|
checkType?: 'none' | 'radio' | 'checkbox'
|
|
11
11
|
fluid?: boolean
|
|
12
12
|
seperate?: boolean
|
|
13
|
+
separate?: boolean
|
|
13
14
|
btnWidth?: number | string
|
|
14
15
|
}
|
|
15
16
|
|
|
@@ -19,6 +20,7 @@ const typeDefs: Required<TypeDefs<ButtonGroupProps>> = {
|
|
|
19
20
|
fluid: Boolean,
|
|
20
21
|
checkType: ['none', 'radio', 'checkbox'],
|
|
21
22
|
seperate: Boolean,
|
|
23
|
+
separate: Boolean,
|
|
22
24
|
btnWidth: [Number, String],
|
|
23
25
|
};
|
|
24
26
|
|
|
@@ -35,6 +37,9 @@ export class ButtonGroup extends Component<ButtonGroupProps> {
|
|
|
35
37
|
|
|
36
38
|
init() {
|
|
37
39
|
provide(BUTTON_GROUP, this);
|
|
40
|
+
if (typeof this.get().seperate === 'boolean') {
|
|
41
|
+
console.warn("`seperate` is a typo which will be removed in next version, please using `separate` instead");
|
|
42
|
+
}
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
setValue(v: any): void {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {getRestProps} from '../utils';
|
|
2
2
|
import {makeButtonGroupStyles} from './styles';
|
|
3
3
|
|
|
4
|
-
const {className, vertical, children, fluid, seperate} = this.get();
|
|
4
|
+
const {className, vertical, children, fluid, seperate, separate} = this.get();
|
|
5
5
|
const {k} = this.config;
|
|
6
6
|
|
|
7
7
|
const classNameObj = {
|
|
8
8
|
[`${k}-btns`]: true,
|
|
9
9
|
[`${k}-vertical`]: vertical,
|
|
10
10
|
[`${k}-fluid`]: fluid,
|
|
11
|
-
[`${k}-
|
|
11
|
+
[`${k}-separate`]: typeof separate === 'boolean' ? separate : separate,
|
|
12
12
|
[className]: className,
|
|
13
13
|
[makeButtonGroupStyles(k)]: true,
|
|
14
14
|
};
|
|
@@ -33,7 +33,8 @@ sidebar: doc
|
|
|
33
33
|
| checkType | 指定按钮组为单选或复选类型,此时需要给每个按钮指定`value`来作为选中的值 | `"radio"` | `"checkbox"` | `"none"` | `"none"` |
|
|
34
34
|
| value | 对于`radio`和`checkbox`类型按钮组,该值表示选中的按钮的值,可以使用`v-model`进行双向绑定 | `*` | `undefined` |
|
|
35
35
|
| fluid | 是否宽度100% | `boolean` | `false` |
|
|
36
|
-
| seperate |
|
|
36
|
+
| seperate | 是否展示间隔,此属性为错别字,将会在下个版本被删除,请使用正确的属性 `separate`,若两个属性同时使用,则会优先使用`separate`属性 | `boolean` | `false` |
|
|
37
|
+
| separate | 是否展示间隔 | `boolean` | `false` |
|
|
37
38
|
|
|
38
39
|
# 方法
|
|
39
40
|
|
|
@@ -502,7 +502,7 @@ export const makeButtonGroupStyles = cache(function makeButtonGroupStyles(k: str
|
|
|
502
502
|
}
|
|
503
503
|
|
|
504
504
|
// horizontal
|
|
505
|
-
&:not(.${k}-vertical):not(.${k}-
|
|
505
|
+
&:not(.${k}-vertical):not(.${k}-separate) {
|
|
506
506
|
> .${k}-btn {
|
|
507
507
|
&:not(:first-child) {
|
|
508
508
|
margin-left: -1px;
|
|
@@ -540,7 +540,7 @@ export const makeButtonGroupStyles = cache(function makeButtonGroupStyles(k: str
|
|
|
540
540
|
}
|
|
541
541
|
|
|
542
542
|
// vertical
|
|
543
|
-
&.${k}-vertical:not(.${k}-
|
|
543
|
+
&.${k}-vertical:not(.${k}-separate) {
|
|
544
544
|
flex-direction: column;
|
|
545
545
|
> .${k}-btn {
|
|
546
546
|
&:not(.${k}-btn-icon) {
|
|
@@ -575,8 +575,8 @@ export const makeButtonGroupStyles = cache(function makeButtonGroupStyles(k: str
|
|
|
575
575
|
}
|
|
576
576
|
}
|
|
577
577
|
|
|
578
|
-
//
|
|
579
|
-
&.${k}-
|
|
578
|
+
// separate
|
|
579
|
+
&.${k}-separate {
|
|
580
580
|
gap: 8px;
|
|
581
581
|
}
|
|
582
582
|
`;
|
package/components/table/cell.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Component, Props, VNodeComponentClass, IntactDom} from 'intact';
|
|
1
|
+
import {Component, Props, VNodeComponentClass, IntactDom, inject} from 'intact';
|
|
2
2
|
import template from './cell.vdt';
|
|
3
3
|
import type {TableColumnProps} from './column';
|
|
4
4
|
import type {TableProps} from './table';
|
|
@@ -19,11 +19,11 @@ export interface TableCellProps {
|
|
|
19
19
|
onClickArrow: (e: MouseEvent) => void
|
|
20
20
|
hasChildren: boolean
|
|
21
21
|
loaded: boolean
|
|
22
|
+
spreadArrowIndex: number
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
export class TableCell extends Component<TableCellProps> {
|
|
25
26
|
static template = template;
|
|
26
|
-
|
|
27
27
|
private config = useConfigContext();
|
|
28
28
|
|
|
29
29
|
$update(
|
|
@@ -8,12 +8,14 @@ import {Ellipsis} from '../ellipsis';
|
|
|
8
8
|
const {
|
|
9
9
|
props, rowIndex, columnIndex, offset,
|
|
10
10
|
data, checkType, indent, grid,
|
|
11
|
-
colspan, rowspan, onClickArrow, hasChildren, loaded
|
|
11
|
+
colspan, rowspan, onClickArrow, hasChildren, loaded,
|
|
12
|
+
spreadArrowIndex
|
|
12
13
|
} = this.get();
|
|
13
14
|
const { k } = this.config;
|
|
14
15
|
|
|
15
16
|
const blocks = props.$blocks;
|
|
16
17
|
let children = get(data, props.key);
|
|
18
|
+
const isTree = !spreadArrowIndex ? columnIndex === 0 : columnIndex === spreadArrowIndex
|
|
17
19
|
if (blocks) {
|
|
18
20
|
const template = blocks.template || blocks.default;
|
|
19
21
|
if (template) {
|
|
@@ -26,7 +28,7 @@ if (props.ellipsis) {
|
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
let {className, style} = getClassAndStyleForFixed(props, offset, k, checkType);
|
|
29
|
-
if (
|
|
31
|
+
if (isTree && indent) {
|
|
30
32
|
style || (style = {});
|
|
31
33
|
style.paddingLeft = `${indent}px`;
|
|
32
34
|
}
|
|
@@ -42,7 +44,7 @@ const classNameObj = {
|
|
|
42
44
|
rowspan={rowspan}
|
|
43
45
|
colspan={colspan}
|
|
44
46
|
>
|
|
45
|
-
<Button v-if={
|
|
47
|
+
<Button v-if={hasChildren && isTree}
|
|
46
48
|
type="none" icon circle size="mini"
|
|
47
49
|
class={`${k}-table-arrow`}
|
|
48
50
|
ev-click={onClickArrow}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {getClassAndStyleForFixed} from './useFixedColumns';
|
|
2
|
+
import {getStyleForLastColumn} from './useColumns';
|
|
2
3
|
import {Dropdown, DropdownMenu, DropdownItem} from '../dropdown';
|
|
3
4
|
import {Button} from '../button';
|
|
4
5
|
import {Icon} from '../icon';
|
|
@@ -11,7 +12,7 @@ import {linkEvent} from 'intact';
|
|
|
11
12
|
import {context as TableContext} from './useColumns';
|
|
12
13
|
import {context as ResizableContext} from './useResizable';
|
|
13
14
|
import {context as FixedColumnsContext} from './useFixedColumns';
|
|
14
|
-
import {stopPropagation} from '../utils';
|
|
15
|
+
import {stopPropagation, addStyle} from '../utils';
|
|
15
16
|
import {Input} from '../input';
|
|
16
17
|
import {_$} from '../../i18n';
|
|
17
18
|
import {ignoreSortable} from './useSortable';
|
|
@@ -25,7 +26,7 @@ const {
|
|
|
25
26
|
const { k } = this.config;
|
|
26
27
|
|
|
27
28
|
<TableContext.Consumer>
|
|
28
|
-
{checkType => {
|
|
29
|
+
{({checkType, lastCellKey, lastCellStyle}) => {
|
|
29
30
|
return <GroupContext.Consumer>
|
|
30
31
|
{({group: currentGroup, onChange}) => {
|
|
31
32
|
return <SortableContext.Consumer>
|
|
@@ -46,7 +47,7 @@ const { k } = this.config;
|
|
|
46
47
|
|
|
47
48
|
let checked;
|
|
48
49
|
return <th className={classNameObj}
|
|
49
|
-
style={style}
|
|
50
|
+
style={key === lastCellKey ? addStyle(style, lastCellStyle) : style}
|
|
50
51
|
title={isStringOrNumber(title) ? title : null}
|
|
51
52
|
ev-click={sortable ? linkEvent(key, onChangeSort) : null}
|
|
52
53
|
colspan={cols}
|
|
@@ -10,6 +10,9 @@ order: 33
|
|
|
10
10
|
组件默认遇到`children`为`[]`空数组的情况就会去进行异步加载,你可以通过`loaded`属性设为`true`来
|
|
11
11
|
标识该子节点已经加载完成,无需再次加载
|
|
12
12
|
|
|
13
|
+
> 组件在该行数据异步加载完成后,会往原始数据上自动添加`loaded=true`。你也可以手动指定某行数据
|
|
14
|
+
> `loaded=true`,这样即使组件发现该行数据`children`为空`[]`,也不会去加载了
|
|
15
|
+
|
|
13
16
|
```vdt
|
|
14
17
|
import {Table, TableColumn} from 'kpc';
|
|
15
18
|
|
|
@@ -11,19 +11,31 @@ order: 24
|
|
|
11
11
|
|
|
12
12
|
树形表格下,必须通过`rowKey`指定每行的`key`
|
|
13
13
|
|
|
14
|
-
> 如果数据中恰好存在`children`字段,但是你又不想展示树形表格,将`childrenKey`设为`false
|
|
14
|
+
> 如果数据中恰好存在`children`字段,但是你又不想展示树形表格,将`childrenKey`设为`false`即可。
|
|
15
|
+
> 假如你的数据为:`{name: 'xxx', books: [{name: 'a'}, {name: 'b'}]}`,想把books展示成子树,
|
|
16
|
+
> 可以指定`childrenKey="books"`
|
|
15
17
|
|
|
16
18
|
```vdt
|
|
17
19
|
import {Table, TableColumn} from 'kpc';
|
|
18
|
-
|
|
19
|
-
<Table data={this.get('data')} rowKey={data => data.name}>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
</Table>
|
|
20
|
+
<div>
|
|
21
|
+
<Table data={this.get('data')} rowKey={data => data.name}>
|
|
22
|
+
<TableColumn key="name" title="Name" />
|
|
23
|
+
<TableColumn key="size" title="Size">
|
|
24
|
+
<b:template args="[data]">
|
|
25
|
+
{data.size}MB
|
|
26
|
+
</b:template>
|
|
27
|
+
</TableColumn>
|
|
28
|
+
</Table>
|
|
29
|
+
<h4>自定义展开Icon位置</h4>
|
|
30
|
+
<Table data={this.get('data')} rowKey={data => data.name} spreadArrowIndex={1}>
|
|
31
|
+
<TableColumn key="name" title="Name" />
|
|
32
|
+
<TableColumn key="size" title="Size">
|
|
33
|
+
<b:template args="[data]">
|
|
34
|
+
{data.size}MB
|
|
35
|
+
</b:template>
|
|
36
|
+
</TableColumn>
|
|
37
|
+
</Table>
|
|
38
|
+
</div>
|
|
27
39
|
```
|
|
28
40
|
|
|
29
41
|
```ts
|
|
@@ -47,6 +47,7 @@ sidebar: doc
|
|
|
47
47
|
| pagination | 是否支持分页 | `boolean` | `PaginationProps` | `false` |
|
|
48
48
|
| fixFooter | `table`给定需要固定高度时,自定义footer固定 | `boolean` | `false` |
|
|
49
49
|
| load | 指定异步加载节点数据的函数,该函数通过`Promise`返回数组来添加子节点数据 | <code>(node: any) => Promise<void> | void</code> | `undefined` |
|
|
50
|
+
| spreadArrowIndex | 指定树形表格展开Icon的所在列,默认在第一列 | `number` | `0` |
|
|
50
51
|
|
|
51
52
|
```ts
|
|
52
53
|
import {Props} from 'intact';
|
package/components/table/row.ts
CHANGED
package/components/table/row.vdt
CHANGED
|
@@ -12,6 +12,7 @@ const {
|
|
|
12
12
|
allDisabled, selected, /* hidden, */spreaded,
|
|
13
13
|
hasChildren, indent, key, offsetMap,
|
|
14
14
|
draggable, draggingKey, animation, loaded,
|
|
15
|
+
spreadArrowIndex
|
|
15
16
|
} = this.get();
|
|
16
17
|
const { k } = this.config;
|
|
17
18
|
|
|
@@ -87,6 +88,7 @@ cols.forEach((props, columnIndex) => {
|
|
|
87
88
|
onClickArrow={this.onClickArrow}
|
|
88
89
|
hasChildren={hasChildren}
|
|
89
90
|
key={columnKey}
|
|
91
|
+
spreadArrowIndex={spreadArrowIndex}
|
|
90
92
|
/>
|
|
91
93
|
);
|
|
92
94
|
});
|
|
@@ -77,6 +77,8 @@ setDefault(() => {
|
|
|
77
77
|
makeGroupMenuStyles?.clearCache();
|
|
78
78
|
});
|
|
79
79
|
|
|
80
|
+
export {table};
|
|
81
|
+
|
|
80
82
|
export const makeStyles = cache(function makeStyles(k: string) {
|
|
81
83
|
return css`
|
|
82
84
|
font-size: ${table.fontSize};
|
|
@@ -117,6 +119,7 @@ export const makeStyles = cache(function makeStyles(k: string) {
|
|
|
117
119
|
tr {
|
|
118
120
|
td {
|
|
119
121
|
border-top: ${table.border};
|
|
122
|
+
border-bottom-color: transparent;
|
|
120
123
|
}
|
|
121
124
|
}
|
|
122
125
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Component, TypeDefs} from 'intact';
|
|
1
|
+
import {Component, TypeDefs, provide} from 'intact';
|
|
2
2
|
import template from './table.vdt';
|
|
3
3
|
import {useColumns} from './useColumns';
|
|
4
4
|
import {useFixedColumns} from './useFixedColumns';
|
|
@@ -65,7 +65,8 @@ export interface TableProps<
|
|
|
65
65
|
animation?: boolean | [boolean, boolean]
|
|
66
66
|
hideHeader?: boolean
|
|
67
67
|
pagination?: boolean | PaginationProps
|
|
68
|
-
fixFooter?: boolean
|
|
68
|
+
fixFooter?: boolean
|
|
69
|
+
spreadArrowIndex?: number
|
|
69
70
|
load?: (value: T) => Promise<void> | void
|
|
70
71
|
}
|
|
71
72
|
|
|
@@ -134,6 +135,7 @@ const typeDefs: Required<TypeDefs<TableProps<unknown>>> = {
|
|
|
134
135
|
hideHeader: Boolean,
|
|
135
136
|
pagination: [Boolean, Object],
|
|
136
137
|
fixFooter: Boolean,
|
|
138
|
+
spreadArrowIndex: Number,
|
|
137
139
|
load: Function,
|
|
138
140
|
};
|
|
139
141
|
|
|
@@ -171,7 +173,6 @@ export class Table<
|
|
|
171
173
|
static typeDefs = typeDefs;
|
|
172
174
|
static defaults = defaults;
|
|
173
175
|
static events = events;
|
|
174
|
-
|
|
175
176
|
// use public for unit test to get paginationRef
|
|
176
177
|
public pagination = usePagination();
|
|
177
178
|
private tree = useTree(this.pagination.data);
|
|
@@ -25,10 +25,11 @@ const {
|
|
|
25
25
|
merge, childrenKey, indent, tooltipPosition,
|
|
26
26
|
tooltipContainer, showIndeterminate, resizable,
|
|
27
27
|
draggable, animation: _animation, hideHeader,
|
|
28
|
-
pagination, fixFooter,
|
|
28
|
+
pagination, fixFooter, spreadArrowIndex
|
|
29
29
|
} = this.get();
|
|
30
30
|
const animation = !Array.isArray(_animation) ? [_animation, _animation] : _animation;
|
|
31
31
|
const {columns, cols, maxRows, maxCols} = this.columns.getData();
|
|
32
|
+
const {lastCellKey, lastCellStyle} = this.columns.getStyleForLastColumn();
|
|
32
33
|
const {scrollPosition, hasFixed, getHasFixedLeft, offsetMap} = this.fixedColumns;
|
|
33
34
|
const {scrollRef} = this.scroll;
|
|
34
35
|
const {stickHeader, excludeStickHeader, elementRef, headRef} = this.stickyHeader;
|
|
@@ -71,7 +72,7 @@ const hasFixedLeft = getHasFixedLeft();
|
|
|
71
72
|
const {getAllCheckedStatus, toggleCheckedAll, getAllStatus, onChangeChecked} = this.checked;
|
|
72
73
|
const allCheckedStatus = getAllCheckedStatus();
|
|
73
74
|
const thead = hideHeader ? null : (
|
|
74
|
-
<TableContext.Provider value={checkType}>
|
|
75
|
+
<TableContext.Provider value={{checkType, lastCellKey, lastCellStyle}}>
|
|
75
76
|
<GroupContext.Provider value={{group, onChange: this.onChangeGroup}}>
|
|
76
77
|
<SortableContext.Provider value={{sort, onChange: this.sortable.onChange}}>
|
|
77
78
|
<ResizableContext.Provider value={{resizable, onStart}}>
|
|
@@ -163,6 +164,7 @@ const tbody = (
|
|
|
163
164
|
onBeforeUnmount={this.resetRowStatus.onRowBeforeUnmount}
|
|
164
165
|
offsetMap={offsetMap.value}
|
|
165
166
|
animation={animation[1]}
|
|
167
|
+
spreadArrowIndex={spreadArrowIndex}
|
|
166
168
|
|
|
167
169
|
draggable={draggable}
|
|
168
170
|
draggingKey={draggingKey.value}
|
|
@@ -4,6 +4,7 @@ import {TableColumn, TableColumnProps} from './column';
|
|
|
4
4
|
import {useState} from '../../hooks/useState';
|
|
5
5
|
import type {Table, TableProps} from './table';
|
|
6
6
|
import {createContext} from '../context';
|
|
7
|
+
import {table as theme} from './styles';
|
|
7
8
|
|
|
8
9
|
export const context = createContext<TableProps['checkType']>();
|
|
9
10
|
|
|
@@ -118,5 +119,27 @@ export function useColumns() {
|
|
|
118
119
|
}
|
|
119
120
|
}
|
|
120
121
|
|
|
121
|
-
|
|
122
|
+
|
|
123
|
+
function getStyleForLastColumn() {
|
|
124
|
+
if (instance.get('type') !== 'grid' || !columns.length || !cols.length) {
|
|
125
|
+
return {lastCellKey: null, lastCellStyle: null};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const lastRow = columns[columns.length - 1];
|
|
129
|
+
const lastTrItem = lastRow[lastRow.length - 1];
|
|
130
|
+
const lastCol = cols[cols.length - 1];
|
|
131
|
+
|
|
132
|
+
if (!lastTrItem || !lastCol) {
|
|
133
|
+
return {lastCellKey: null, lastCellStyle: null};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return lastCol.key === lastTrItem.key
|
|
137
|
+
? {lastCellKey: null, lastCellStyle: null}
|
|
138
|
+
: {
|
|
139
|
+
lastCellKey: lastTrItem.key,
|
|
140
|
+
lastCellStyle: {'border-right': `${theme.border}`}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return {getColumns, getCols, getData, getStyleForLastColumn}
|
|
122
145
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 支持Icon
|
|
3
|
+
order: 3
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
标签类型:`default`, `primary`, `success`, `warning` `danger`
|
|
7
|
+
|
|
8
|
+
```vdt
|
|
9
|
+
import {Tip, Icon} from 'kpc';
|
|
10
|
+
|
|
11
|
+
<div>
|
|
12
|
+
<Tip v-for={this.get('types')}
|
|
13
|
+
type={$value}
|
|
14
|
+
showIcon
|
|
15
|
+
closable
|
|
16
|
+
>{$value}</Tip>
|
|
17
|
+
<Tip type="success" showIcon closable>
|
|
18
|
+
这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容,这是一条测试内容。
|
|
19
|
+
</Tip>
|
|
20
|
+
<h3>自定义Icon</h3>
|
|
21
|
+
<Tip>
|
|
22
|
+
<b:icon><Icon class="k-icon-internet" /></b:icon>
|
|
23
|
+
custom Icon
|
|
24
|
+
</Tip>
|
|
25
|
+
<h3>标题带Icon</h3>
|
|
26
|
+
<Tip type="primary" showIcon>
|
|
27
|
+
<b:title>这是标题</b:title>
|
|
28
|
+
This is a tip.
|
|
29
|
+
</Tip>
|
|
30
|
+
<h3>标题自定义Icon</h3>
|
|
31
|
+
<Tip type="primary" showIcon closable>
|
|
32
|
+
<b:icon><Icon class="k-icon-internet" /></b:icon>
|
|
33
|
+
<b:title>这是标题</b:title>
|
|
34
|
+
This is a tip.
|
|
35
|
+
</Tip>
|
|
36
|
+
</div>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```styl
|
|
40
|
+
.k-tip
|
|
41
|
+
margin-bottom 8px
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
export default class extends Component {
|
|
46
|
+
static template = template;
|
|
47
|
+
static defaults() {
|
|
48
|
+
return {
|
|
49
|
+
types: ['default', 'primary', 'success', 'warning', 'danger'] as const
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 尺寸
|
|
3
|
+
order: 4
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
尺寸大小:`large`, `default`, `small`, `mini`
|
|
7
|
+
|
|
8
|
+
```vdt
|
|
9
|
+
import {Tip} from 'kpc';
|
|
10
|
+
|
|
11
|
+
<div>
|
|
12
|
+
<Tip v-for={this.get('sizes')}
|
|
13
|
+
type="primary"
|
|
14
|
+
size={$value}
|
|
15
|
+
>{$value}</Tip>
|
|
16
|
+
<h3>带关闭按钮</h3>
|
|
17
|
+
<Tip v-for={this.get('sizes')}
|
|
18
|
+
type="primary"
|
|
19
|
+
size={$value}
|
|
20
|
+
closable
|
|
21
|
+
>{$value}</Tip>
|
|
22
|
+
</div>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```styl
|
|
26
|
+
.k-tip
|
|
27
|
+
margin-bottom 8px
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
export default class extends Component {
|
|
32
|
+
static template = template;
|
|
33
|
+
static defaults() {
|
|
34
|
+
return {
|
|
35
|
+
sizes: ['large', 'default', 'small', 'mini'] as const
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
package/components/tip/index.md
CHANGED
|
@@ -17,6 +17,7 @@ sidebar: doc
|
|
|
17
17
|
| disabled | 是否展示禁用状态 | `boolean` | `false` |
|
|
18
18
|
| size | 组件尺寸 | `"large"` | `"default"` | `"small"` | `"mini"` | `"default"` |
|
|
19
19
|
| border | 定义边框样式 | `"solid"` | `"dashed"` | `"none"` | `"solid"` |
|
|
20
|
+
| showIcon | 展示Icon | `boolean` | `false` |
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
# 扩展点
|
|
@@ -25,6 +26,7 @@ sidebar: doc
|
|
|
25
26
|
| --- | --- |
|
|
26
27
|
| title | 自定义标题内容 |
|
|
27
28
|
| close | 自定义关闭按钮内容 |
|
|
29
|
+
| icon | 自定义Icon内容 |
|
|
28
30
|
|
|
29
31
|
# 事件
|
|
30
32
|
|
package/components/tip/index.ts
CHANGED
|
@@ -1,15 +1,31 @@
|
|
|
1
|
+
import {TypeDefs} from 'intact';
|
|
1
2
|
import template from './index.vdt';
|
|
2
3
|
import {Tag, TagProps, TagEvents, TagBlocks} from '../tag/base';
|
|
3
4
|
|
|
4
|
-
export interface TipProps extends TagProps {
|
|
5
|
+
export interface TipProps extends TagProps {
|
|
6
|
+
showIcon?: boolean
|
|
7
|
+
}
|
|
5
8
|
|
|
6
9
|
export interface TipEvents extends TagEvents { }
|
|
7
10
|
|
|
8
11
|
export interface TipBlocks extends TagBlocks {
|
|
9
12
|
title: null
|
|
10
13
|
close: null
|
|
14
|
+
icon: null
|
|
11
15
|
}
|
|
12
16
|
|
|
17
|
+
const typeDefs: Required<TypeDefs<TipProps>> = {
|
|
18
|
+
...Tag.typeDefs,
|
|
19
|
+
showIcon: Boolean,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const defaults = (): Partial<TipProps> => ({
|
|
23
|
+
...Tag.defaults(),
|
|
24
|
+
showIcon: false,
|
|
25
|
+
});
|
|
26
|
+
|
|
13
27
|
export class Tip extends Tag<TipProps, TipEvents, TipBlocks> {
|
|
14
28
|
static template = template;
|
|
29
|
+
static typeDefs = typeDefs;
|
|
30
|
+
static defaults = defaults;
|
|
15
31
|
}
|
package/components/tip/index.vdt
CHANGED
|
@@ -2,20 +2,53 @@ import {Button} from '../button';
|
|
|
2
2
|
import {Icon} from '../icon';
|
|
3
3
|
import {makeStyles} from './styles';
|
|
4
4
|
|
|
5
|
-
const {children, closable, type, disabled} = this.get();
|
|
5
|
+
const {children, closable, type, disabled, showIcon} = this.get();
|
|
6
6
|
const { k } = this.config;
|
|
7
|
+
|
|
8
|
+
const iconMap = {
|
|
9
|
+
default: 'information-fill',
|
|
10
|
+
info: 'information-fill',
|
|
11
|
+
warning: 'warning-fill',
|
|
12
|
+
success: 'success-fill',
|
|
13
|
+
error: 'error-fill',
|
|
14
|
+
};
|
|
15
|
+
|
|
7
16
|
const classNameObj = {
|
|
8
17
|
[`${k}-tip`]: true,
|
|
9
18
|
[makeStyles(k)]: true,
|
|
10
19
|
};
|
|
11
20
|
|
|
21
|
+
const iconWrapper = <template>
|
|
22
|
+
<template v-if={!$blocks.icon}>
|
|
23
|
+
<Icon class={{
|
|
24
|
+
[`${k}-icon-${iconMap[type] || iconMap.info}`]: true,
|
|
25
|
+
[`${k}-tip-icon`]: true,
|
|
26
|
+
}} />
|
|
27
|
+
</template>
|
|
28
|
+
<b:icon v-else />
|
|
29
|
+
</template>
|
|
30
|
+
|
|
12
31
|
<t:super class={classNameObj} name="k-fade">
|
|
13
32
|
<b:body>
|
|
14
|
-
<div class={
|
|
15
|
-
|
|
16
|
-
|
|
33
|
+
<div class={{
|
|
34
|
+
[`${k}-tip-wrapper`]: true,
|
|
35
|
+
[`${k}-with-icon`]: !$blocks.title && (showIcon || $blocks.icon)
|
|
36
|
+
}}>
|
|
37
|
+
<template v-if={!$blocks.title && (showIcon || $blocks.icon)}>
|
|
38
|
+
{iconWrapper}
|
|
39
|
+
</template>
|
|
40
|
+
<div v-if={$blocks.title} class={{
|
|
41
|
+
[`${k}-tip-title`]: true,
|
|
42
|
+
[`${k}-with-icon`]: showIcon
|
|
43
|
+
}}>
|
|
44
|
+
<template v-if={showIcon}>
|
|
45
|
+
{iconWrapper}
|
|
46
|
+
</template>
|
|
47
|
+
<span class={`${k}-title-content`}><b:title /></span>
|
|
48
|
+
</div>
|
|
49
|
+
<div class={`${k}-tip-content`}>
|
|
50
|
+
{children}
|
|
17
51
|
</div>
|
|
18
|
-
{children}
|
|
19
52
|
</div>
|
|
20
53
|
</b:body>
|
|
21
54
|
<b:_close>
|