@king-design/intact 2.0.15 → 3.0.0-beta.0
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/styles.ts +4 -1
- package/components/card/styles.ts +3 -2
- package/components/checkbox/styles.ts +31 -6
- package/components/collapse/styles.ts +4 -1
- package/components/datepicker/styles.ts +3 -1
- package/components/dialog/base.vdt +4 -5
- package/components/dialog/styles.ts +18 -13
- package/components/drawer/styles.ts +20 -10
- package/components/dropdown/styles.ts +1 -1
- package/components/form/styles.ts +1 -1
- package/components/icon/demos/disabled.md +21 -0
- package/components/icon/demos/icons.md +87 -116
- package/components/icon/index.md +1 -0
- package/components/icon/index.ts +2 -0
- package/components/icon/index.vdt +6 -2
- package/components/icon/styles.ts +8 -1
- package/components/input/styles.ts +14 -20
- package/components/message/demos/basic.md +1 -1
- package/components/message/demos/duration.md +3 -3
- package/components/message/index.md +1 -1
- package/components/message/message.ts +2 -2
- package/components/message/message.vdt +6 -6
- package/components/message/styles.ts +10 -19
- package/components/pagination/index.vdt +9 -9
- package/components/pagination/styles.ts +11 -7
- package/components/radio/styles.ts +28 -9
- package/components/select/base.vdt +4 -5
- package/components/select/demos/basic.md +1 -1
- package/components/select/index.md +1 -1
- package/components/select/styles.ts +4 -27
- package/components/spinner/index.vdt +6 -4
- package/components/spinner/styles.ts +36 -36
- package/components/steps/demos/basic.md +2 -1
- package/components/steps/demos/clickable.md +6 -0
- package/components/steps/demos/error.md +25 -5
- package/components/steps/demos/line.md +7 -6
- package/components/steps/demos/simple.md +0 -6
- package/components/steps/index.md +1 -1
- package/components/steps/index.ts +4 -4
- package/components/steps/index.vdt +1 -0
- package/components/steps/step.vdt +16 -13
- package/components/steps/styles.ts +297 -259
- package/components/switch/demos/basic.md +1 -2
- package/components/switch/demos/disabled.md +20 -0
- package/components/switch/demos/onOff.md +5 -0
- package/components/switch/styles.ts +29 -37
- package/components/table/column.vdt +26 -10
- package/components/table/demos/rowExpandable.md +1 -1
- package/components/table/demos/selectedKeys.md +1 -1
- package/components/table/index.md +3 -3
- package/components/table/index.spec.ts +2 -2
- package/components/table/styles.ts +17 -6
- package/components/table/useGroup.ts +18 -2
- package/components/table/useSortable.ts +4 -1
- package/components/tabs/demos/basic.md +0 -1
- package/components/tabs/index.ts +2 -2
- package/components/tabs/index.vdt +3 -3
- package/components/tabs/styles.ts +202 -152
- package/components/tag/base.ts +1 -1
- package/components/tag/demos/border.md +2 -2
- package/components/tag/index.md +1 -1
- package/components/tag/styles.ts +12 -11
- package/components/tip/index.vdt +1 -3
- package/components/tip/styles.ts +8 -2
- package/components/tooltip/content.vdt +1 -1
- package/components/tooltip/styles.ts +8 -6
- package/components/transfer/index.vdt +3 -2
- package/components/transfer/styles.ts +1 -0
- package/components/transfer/useCheck.ts +9 -2
- package/components/upload/demos/manually.md +12 -13
- package/components/upload/index.vdt +40 -34
- package/components/upload/styles.ts +60 -64
- package/es/components/button/styles.js +2 -2
- package/es/components/card/styles.js +10 -2
- package/es/components/checkbox/styles.js +21 -10
- package/es/components/collapse/styles.js +6 -1
- package/es/components/datepicker/styles.d.ts +1 -1
- package/es/components/datepicker/styles.js +4 -1
- package/es/components/dialog/base.vdt.js +5 -6
- package/es/components/dialog/styles.js +16 -14
- package/es/components/drawer/styles.js +20 -5
- package/es/components/dropdown/styles.js +1 -1
- package/es/components/form/styles.js +1 -1
- package/es/components/icon/index.d.ts +1 -0
- package/es/components/icon/index.js +2 -1
- package/es/components/icon/index.vdt.js +4 -2
- package/es/components/icon/styles.js +10 -2
- package/es/components/input/styles.js +1 -11
- package/es/components/message/message.js +1 -1
- package/es/components/message/message.vdt.js +7 -6
- package/es/components/message/styles.js +8 -8
- package/es/components/pagination/index.vdt.js +8 -8
- package/es/components/pagination/styles.js +11 -2
- package/es/components/radio/styles.js +16 -6
- package/es/components/select/base.vdt.js +5 -6
- package/es/components/select/styles.js +4 -24
- package/es/components/spinner/index.vdt.js +6 -4
- package/es/components/spinner/styles.js +33 -5
- package/es/components/steps/index.d.ts +2 -2
- package/es/components/steps/index.js +2 -2
- package/es/components/steps/index.vdt.js +1 -0
- package/es/components/steps/step.vdt.js +17 -8
- package/es/components/steps/styles.d.ts +1 -1
- package/es/components/steps/styles.js +80 -75
- package/es/components/switch/styles.js +20 -34
- package/es/components/table/column.vdt.js +43 -7
- package/es/components/table/index.spec.js +2 -2
- package/es/components/table/styles.js +16 -5
- package/es/components/table/useGroup.d.ts +3 -0
- package/es/components/table/useGroup.js +24 -1
- package/es/components/table/useSortable.d.ts +3 -1
- package/es/components/table/useSortable.js +4 -1
- package/es/components/tabs/index.d.ts +1 -1
- package/es/components/tabs/index.js +1 -1
- package/es/components/tabs/index.vdt.js +1 -1
- package/es/components/tabs/styles.js +68 -22
- package/es/components/tag/base.js +1 -1
- package/es/components/tag/styles.js +15 -10
- package/es/components/tip/index.vdt.js +1 -3
- package/es/components/tip/styles.js +4 -3
- package/es/components/tooltip/content.vdt.js +4 -4
- package/es/components/tooltip/styles.js +12 -7
- package/es/components/transfer/index.vdt.js +3 -1
- package/es/components/transfer/styles.js +1 -1
- package/es/components/transfer/useCheck.d.ts +1 -0
- package/es/components/transfer/useCheck.js +8 -1
- package/es/components/upload/index.vdt.js +21 -20
- package/es/components/upload/styles.js +22 -30
- package/es/i18n/en-US.d.ts +2 -1
- package/es/i18n/en-US.js +2 -1
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/site/data/components/icon/demos/disabled/index.d.ts +6 -0
- package/es/site/data/components/icon/demos/disabled/index.js +18 -0
- package/es/site/data/components/icon/demos/disabled/react.d.ts +5 -0
- package/es/site/data/components/icon/demos/disabled/react.js +33 -0
- package/es/site/data/components/icon/demos/icons/index.js +1 -1
- package/es/site/data/components/icon/demos/icons/react.js +1 -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/es/site/data/components/message/demos/duration/index.js +2 -2
- package/es/site/data/components/message/demos/duration/react.js +2 -2
- package/es/site/data/components/select/demos/basic/react.js +1 -2
- package/es/site/data/components/steps/demos/basic/react.js +1 -1
- package/es/site/data/components/steps/demos/clickable/react.js +15 -0
- package/es/site/data/components/steps/demos/error/react.js +22 -2
- package/es/site/data/components/steps/demos/line/react.js +15 -11
- package/es/site/data/components/steps/demos/simple/react.js +1 -11
- package/es/site/data/components/switch/demos/basic/react.js +0 -2
- package/es/site/data/components/switch/demos/disabled/index.d.ts +6 -0
- package/es/site/data/components/switch/demos/disabled/index.js +18 -0
- package/es/site/data/components/switch/demos/disabled/react.d.ts +5 -0
- package/es/site/data/components/switch/demos/disabled/react.js +27 -0
- package/es/site/data/components/switch/demos/onOff/react.js +13 -0
- package/es/site/data/components/tag/demos/border/index.js +1 -1
- package/es/site/data/components/tag/demos/border/react.js +1 -1
- package/es/site/data/components/upload/demos/manually/react.js +5 -7
- package/es/site/src/pages/document/index.js +3 -2
- package/es/site/src/pages/document/styles.js +1 -1
- package/es/styles/fonts/iconfont.eot +0 -0
- package/es/styles/fonts/iconfont.js +1 -1
- package/es/styles/fonts/iconfont.svg +189 -369
- package/es/styles/fonts/iconfont.ttf +0 -0
- package/es/styles/fonts/iconfont.woff +0 -0
- package/es/styles/theme.d.ts +10 -2
- package/es/styles/theme.js +23 -21
- package/i18n/en-US.ts +2 -1
- package/index.ts +2 -2
- package/package.json +4 -3
- package/styles/fonts/iconfont.css +172 -289
- package/styles/fonts/iconfont.eot +0 -0
- package/styles/fonts/iconfont.svg +189 -369
- package/styles/fonts/iconfont.ts +255 -369
- package/styles/fonts/iconfont.ttf +0 -0
- package/styles/fonts/iconfont.woff +0 -0
- package/styles/fonts/iconfont.woff2 +0 -0
- package/styles/theme.ts +23 -19
|
@@ -1,50 +1,49 @@
|
|
|
1
1
|
import {css} from '@emotion/css';
|
|
2
2
|
import {theme, setDefault} from '../../styles/theme';
|
|
3
|
-
import {deepDefaults, sizes} from '../../styles/utils';
|
|
3
|
+
import {deepDefaults, sizes, palette} from '../../styles/utils';
|
|
4
4
|
import '../../styles/global';
|
|
5
5
|
|
|
6
6
|
const defaults = {
|
|
7
7
|
get transition() { return theme.transition.middle },
|
|
8
|
-
bgColor
|
|
8
|
+
get bgColor() { return theme.color.border },
|
|
9
9
|
fontSize: `12px`,
|
|
10
|
-
|
|
11
|
-
checkedBgColor: `#fff`,
|
|
10
|
+
color: '#fff',
|
|
12
11
|
handleBorderRadius: `100%`,
|
|
13
|
-
|
|
14
|
-
get border() { return `1px solid ${theme.color.border}` },
|
|
12
|
+
handleBgColor: '#fff',
|
|
15
13
|
|
|
16
14
|
// checked
|
|
17
15
|
checked: {
|
|
18
|
-
get borderColor() { return theme.color.primary },
|
|
19
|
-
get color() { return theme.color.primary },
|
|
20
16
|
get bgColor() { return theme.color.primary },
|
|
17
|
+
get disabledBgColor() {
|
|
18
|
+
return palette(theme.color.primary, -3);
|
|
19
|
+
}
|
|
21
20
|
},
|
|
22
21
|
|
|
23
22
|
// default
|
|
24
23
|
default: {
|
|
25
|
-
width: `
|
|
26
|
-
height: `
|
|
27
|
-
padding: `
|
|
24
|
+
width: `45px`,
|
|
25
|
+
height: `24px`,
|
|
26
|
+
padding: `3px`,
|
|
28
27
|
},
|
|
29
28
|
|
|
30
29
|
// large
|
|
31
30
|
large: {
|
|
32
|
-
width: `
|
|
33
|
-
height: `
|
|
34
|
-
padding: `
|
|
31
|
+
width: `58px`,
|
|
32
|
+
height: `30px`,
|
|
33
|
+
padding: `3px`,
|
|
35
34
|
},
|
|
36
35
|
|
|
37
36
|
// small
|
|
38
37
|
small: {
|
|
39
|
-
width: `
|
|
38
|
+
width: `30px`,
|
|
40
39
|
height: `16px`,
|
|
41
40
|
padding: `2px`,
|
|
42
41
|
},
|
|
43
42
|
|
|
44
43
|
// mini
|
|
45
44
|
mini: {
|
|
46
|
-
width: `
|
|
47
|
-
height: `
|
|
45
|
+
width: `18px`,
|
|
46
|
+
height: `10px`,
|
|
48
47
|
padding: `1px`,
|
|
49
48
|
},
|
|
50
49
|
|
|
@@ -66,7 +65,6 @@ export function makeStyles() {
|
|
|
66
65
|
cursor: pointer;
|
|
67
66
|
user-select: none;
|
|
68
67
|
overflow: hidden;
|
|
69
|
-
border: ${kswitch.border};
|
|
70
68
|
box-sizing: content-box;
|
|
71
69
|
input {
|
|
72
70
|
opacity: 0;
|
|
@@ -119,13 +117,12 @@ export function makeStyles() {
|
|
|
119
117
|
&.k-dragging {
|
|
120
118
|
.k-switch-bar,
|
|
121
119
|
.k-switch-wrapper {
|
|
122
|
-
background: ${kswitch.
|
|
120
|
+
background: ${kswitch.checked.bgColor};
|
|
123
121
|
transition: background ${kswitch.transition};
|
|
124
122
|
}
|
|
125
123
|
}
|
|
126
124
|
&:focus {
|
|
127
125
|
outline: none;
|
|
128
|
-
border-color: ${kswitch.checked.borderColor};
|
|
129
126
|
}
|
|
130
127
|
|
|
131
128
|
// size
|
|
@@ -164,16 +161,9 @@ export function makeStyles() {
|
|
|
164
161
|
|
|
165
162
|
// checked
|
|
166
163
|
&.k-checked {
|
|
167
|
-
border-color: ${kswitch.checked.borderColor};
|
|
168
|
-
.k-switch-on {
|
|
169
|
-
color: ${kswitch.checked.color};
|
|
170
|
-
}
|
|
171
|
-
.k-switch-handle {
|
|
172
|
-
background: ${kswitch.checked.bgColor};
|
|
173
|
-
}
|
|
174
164
|
.k-switch-bar,
|
|
175
165
|
.k-switch-wrapper {
|
|
176
|
-
background: ${kswitch.
|
|
166
|
+
background: ${kswitch.checked.bgColor};
|
|
177
167
|
}
|
|
178
168
|
.k-switch-bar {
|
|
179
169
|
width: 100%;
|
|
@@ -182,19 +172,21 @@ export function makeStyles() {
|
|
|
182
172
|
|
|
183
173
|
// disabled
|
|
184
174
|
&.k-disabled {
|
|
185
|
-
|
|
186
|
-
|
|
175
|
+
&,
|
|
176
|
+
.k-switch-handle {
|
|
177
|
+
cursor: not-allowed;
|
|
178
|
+
}
|
|
179
|
+
&,
|
|
187
180
|
.k-switch-bar,
|
|
188
181
|
.k-switch-wrapper {
|
|
189
182
|
background: ${kswitch.disabledBgColor};
|
|
190
183
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
border-bottom-right-radius: 0;
|
|
184
|
+
&.k-checked {
|
|
185
|
+
&,
|
|
186
|
+
.k-switch-bar,
|
|
187
|
+
.k-switch-wrapper {
|
|
188
|
+
background: ${kswitch.checked.disabledBgColor};
|
|
189
|
+
}
|
|
198
190
|
}
|
|
199
191
|
}
|
|
200
192
|
`;
|
|
@@ -12,9 +12,11 @@ import {context as TableContext} from './useColumns';
|
|
|
12
12
|
import {context as ResizableContext} from './useResizable';
|
|
13
13
|
import {context as FixedColumnsContext} from './useFixedColumns';
|
|
14
14
|
import {stopPropagation} from '../utils';
|
|
15
|
+
import {Input} from '../input';
|
|
16
|
+
import {_$} from '../../i18n';
|
|
15
17
|
|
|
16
18
|
const {title, fixed, group, multiple, key, sortable, cols, rows} = this.get();
|
|
17
|
-
const {onSelect, isChecked, getGroupText} = this.group;
|
|
19
|
+
const {onSelect, isChecked, getGroupText, keywords, filteredGroup} = this.group;
|
|
18
20
|
|
|
19
21
|
<TableContext.Consumer>
|
|
20
22
|
{checkType => {
|
|
@@ -61,21 +63,35 @@ const {onSelect, isChecked, getGroupText} = this.group;
|
|
|
61
63
|
<Dropdown v-if={group}
|
|
62
64
|
position={{my: 'center top', at: 'center bottom+5', collision: 'flipfit'}}
|
|
63
65
|
key="dropdown"
|
|
66
|
+
trigger="click"
|
|
67
|
+
ev-show={() => keywords.set('')}
|
|
64
68
|
>
|
|
65
69
|
<Button icon size="mini" class="k-table-group"
|
|
66
|
-
ev-click={
|
|
70
|
+
ev-click={e => e._ignoreSortable = true}
|
|
67
71
|
>
|
|
68
72
|
<Icon class="ion-android-arrow-dropdown" />
|
|
69
73
|
</Button>
|
|
70
74
|
<DropdownMenu class={{"k-table-group-dropdown": true, [makeGroupMenuStyles()]: true}}>
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
<div class="k-table-group-header">
|
|
76
|
+
<Input size="small" fluid
|
|
77
|
+
placeholder={_$('请输入关键字')}
|
|
78
|
+
value={keywords.value}
|
|
79
|
+
ev-$change:value={keywords.set}
|
|
80
|
+
clearable
|
|
81
|
+
>
|
|
82
|
+
<b:suffix><Icon class="ion-ios-search" /></b:suffix>
|
|
83
|
+
</Input>
|
|
84
|
+
</div>
|
|
85
|
+
<div class="k-table-group-body">
|
|
86
|
+
<DropdownItem v-for={filteredGroup.value}
|
|
87
|
+
ev-select={() => onSelect($value.value, groupValue, onChange)}
|
|
88
|
+
hideOnSelect={!multiple}
|
|
89
|
+
class={{'k-active': (checked = isChecked($value.value, groupValue))}}
|
|
90
|
+
>
|
|
91
|
+
<Checkbox v-if={multiple} value={checked}>{$value.label}</Checkbox>
|
|
92
|
+
<span v-else>{$value.label}</span>
|
|
93
|
+
</DropdownItem>
|
|
94
|
+
</div>
|
|
79
95
|
</DropdownMenu>
|
|
80
96
|
</Dropdown>
|
|
81
97
|
<div v-if={sortable}
|
|
@@ -5,7 +5,7 @@ order: 8
|
|
|
5
5
|
|
|
6
6
|
通过`expand`扩展点指定行展开后的模板内容。是否支持点击该行任何区域都展开内容,
|
|
7
7
|
是由`rowExpandable`控制的,默认情况下它为`true`。你也可以将它设为`false`,来自定义展开逻辑。例如:
|
|
8
|
-
点击某个`icon
|
|
8
|
+
点击某个`icon`后展开该行,而点击其它元素无效。自定义展开逻辑,修改`expandedKeys`属性值,来指定哪些`key`对应的行展开。
|
|
9
9
|
|
|
10
10
|
```vdt
|
|
11
11
|
import {Table, TableColumn} from 'kpc';
|
|
@@ -3,7 +3,7 @@ title: 行高亮
|
|
|
3
3
|
order: 5
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
给`Table`添加`rowSelectable
|
|
6
|
+
给`Table`添加`rowSelectable`属性,可以让表格点击行时高亮该行,你可以指定值为`multiple`来支持多行
|
|
7
7
|
高亮。类似`checkedKeys`,我们可以通过`selectedKeys`来绑定高亮行的`key`,当高亮的行改变时,组件也会
|
|
8
8
|
抛出`$change:selectedKeys`事件,我们可以通过`getSelectedData`来获取高亮行的数据
|
|
9
9
|
|
|
@@ -19,7 +19,7 @@ sidebar: doc
|
|
|
19
19
|
| checkedKeys | 通过`key`数组来指定哪些行被选中 | `TableRowKey[]` | `[]` |
|
|
20
20
|
| rowKey | 设置每行的key | `(value: T, index: number) => TableRowKey` | `(value: T, index: number) => index` |
|
|
21
21
|
| rowCheckable | 当行可选时,是否点击该行任意区域都可选中 | `boolean` | `true` |
|
|
22
|
-
| disableRow | 定义行禁用可选的逻辑,返回`true
|
|
22
|
+
| disableRow | 定义行禁用可选的逻辑,返回`true`,则该行被禁用选择 | `(value: T, index: number, key: TableRowKey) => boolean` | `undefined` |
|
|
23
23
|
| type | 表格类型,默认左右无边框,`"border"`类型会添加边框, `"grid"`类型会展示栅格边框 | `"default"` | `"border"` | `"grid"` | `"default"` |
|
|
24
24
|
| stripe | 相邻行是否展示不同的背景色 | `boolean` | `false` |
|
|
25
25
|
| rowClassName | 通过一个函数定义行的`className`,该函数会传入该行数据,索引和`key`当做参数,返回的字符串将被设为该行的`className` | <code>(value: T, index: number, key: TableRowKey) => string | undefined</code> | `undefined` |
|
|
@@ -28,9 +28,9 @@ sidebar: doc
|
|
|
28
28
|
| loading | 是否展示加载状态 | `boolean` | `false` |
|
|
29
29
|
| merge | 指定表格单元格合并逻辑 | `TableMerge` | `undefined` |
|
|
30
30
|
| expandedKeys | 通过`key`来指定哪些行展开 | `TableRowKey[]` | `undefined` |
|
|
31
|
-
| rowExpandable |
|
|
31
|
+
| rowExpandable | 是否点击该行任意区域即展开 | `boolean` | `true` |
|
|
32
32
|
| selectedKeys | 当`rowSelectable`取值为非`false`时,指定哪些行高亮 | `TableRowKey[]` | `undefined` |
|
|
33
|
-
| rowSelectable |
|
|
33
|
+
| rowSelectable | 是否点击行时高亮该行,取值为`multiple`时,可以同时高亮多行 | `boolean` | `"single"` | `"multiple"` | `false` |
|
|
34
34
|
| childrenKey | 树形表格指定子元素键名 | `string` | `"children"` |
|
|
35
35
|
| indent | 树形表格指定子元素缩进宽度 | `number` | `32` |
|
|
36
36
|
| spreadKeys | 树形表格指定展开的行 | `TableRowKey[]` | `undefined` |
|
|
@@ -194,7 +194,7 @@ describe('Table', () => {
|
|
|
194
194
|
const [table1, table2] = element.querySelectorAll<HTMLElement>('.k-table');
|
|
195
195
|
|
|
196
196
|
const icon = table1.querySelector('.k-table-group') as HTMLElement;
|
|
197
|
-
dispatchEvent(icon, '
|
|
197
|
+
dispatchEvent(icon, 'click');
|
|
198
198
|
await wait();
|
|
199
199
|
const dropdown = getElement('.k-table-group-dropdown')!;
|
|
200
200
|
expect(dropdown.innerHTML).to.matchSnapshot();
|
|
@@ -206,7 +206,7 @@ describe('Table', () => {
|
|
|
206
206
|
expect(table1.innerHTML).to.matchSnapshot();
|
|
207
207
|
|
|
208
208
|
const icon2 = table2.querySelector('.k-table-group') as HTMLElement;
|
|
209
|
-
dispatchEvent(icon2, '
|
|
209
|
+
dispatchEvent(icon2, 'click');
|
|
210
210
|
await wait();
|
|
211
211
|
const dropdown2 = getElement('.k-table-group-dropdown')!;
|
|
212
212
|
expect(dropdown2.innerHTML).to.matchSnapshot();
|
|
@@ -6,7 +6,8 @@ import '../../styles/global';
|
|
|
6
6
|
const defaults = {
|
|
7
7
|
get transition() { return theme.transition.large },
|
|
8
8
|
// transition: '15000s',
|
|
9
|
-
border: `1px solid #
|
|
9
|
+
border: `1px solid #e2e5e8`,
|
|
10
|
+
get borderRadius() { return theme.borderRadius },
|
|
10
11
|
fontSize: `12px`,
|
|
11
12
|
bgColor: `#fff`,
|
|
12
13
|
get color() { return theme.color.text },
|
|
@@ -20,7 +21,7 @@ const defaults = {
|
|
|
20
21
|
fontSize: `12px`,
|
|
21
22
|
fontWeight: `bold`,
|
|
22
23
|
textAlign: 'left',
|
|
23
|
-
height: `
|
|
24
|
+
height: `40px`,
|
|
24
25
|
delimiterHeight: '12px',
|
|
25
26
|
delimiterColor: '#bfbfbf',
|
|
26
27
|
},
|
|
@@ -41,13 +42,15 @@ const defaults = {
|
|
|
41
42
|
color: `#a6a6a6`,
|
|
42
43
|
menuMaxHeight: '200px',
|
|
43
44
|
get activeColor() { return theme.color.primary },
|
|
45
|
+
headerPadding: `8px`,
|
|
46
|
+
get headerBorder() { return `1px solid ${theme.color.bg}` },
|
|
44
47
|
},
|
|
45
48
|
|
|
46
49
|
// sort
|
|
47
50
|
sort: {
|
|
48
51
|
iconHeight: `7px`,
|
|
49
52
|
gap: `10px`,
|
|
50
|
-
color: `#
|
|
53
|
+
color: `#d0d5d9`,
|
|
51
54
|
disabledColor: `#ddd`,
|
|
52
55
|
},
|
|
53
56
|
|
|
@@ -74,19 +77,18 @@ export function makeStyles() {
|
|
|
74
77
|
return css`
|
|
75
78
|
font-size: ${table.fontSize};
|
|
76
79
|
color: ${table.color};
|
|
77
|
-
border-top: ${table.border};
|
|
78
80
|
position: relative;
|
|
79
81
|
z-index: 0;
|
|
80
82
|
.k-table-wrapper {
|
|
81
83
|
border-bottom: ${table.border};
|
|
82
84
|
overflow: auto;
|
|
85
|
+
border-radius: ${table.borderRadius};
|
|
83
86
|
}
|
|
84
87
|
table {
|
|
85
88
|
width: 100%;
|
|
86
89
|
// border-collapse: collapse;
|
|
87
90
|
border-spacing: 0;
|
|
88
91
|
table-layout: fixed;
|
|
89
|
-
|
|
90
92
|
td,
|
|
91
93
|
th{
|
|
92
94
|
transition: all ${table.transition};
|
|
@@ -103,12 +105,16 @@ export function makeStyles() {
|
|
|
103
105
|
z-index: 2;
|
|
104
106
|
tr {
|
|
105
107
|
height: ${table.thead.height};
|
|
108
|
+
&:not(:last-of-type) th {
|
|
109
|
+
border-bottom: ${table.border};
|
|
110
|
+
}
|
|
106
111
|
}
|
|
107
112
|
}
|
|
108
113
|
th {
|
|
109
114
|
padding: ${table.thead.padding};
|
|
110
115
|
position: relative;
|
|
111
116
|
background: ${table.thead.bgColor};
|
|
117
|
+
line-height: normal;
|
|
112
118
|
&:before {
|
|
113
119
|
content: '';
|
|
114
120
|
height: ${table.thead.delimiterHeight};
|
|
@@ -122,12 +128,12 @@ export function makeStyles() {
|
|
|
122
128
|
&:first-of-type:before {
|
|
123
129
|
display: none;
|
|
124
130
|
}
|
|
125
|
-
border-bottom: ${table.border};
|
|
126
131
|
}
|
|
127
132
|
.k-table-title {
|
|
128
133
|
display: inline-flex;
|
|
129
134
|
align-items: center;
|
|
130
135
|
max-width: 100%;
|
|
136
|
+
color: ${theme.color.lightBlack};
|
|
131
137
|
}
|
|
132
138
|
.k-table-title-text {
|
|
133
139
|
flex: 1;
|
|
@@ -211,6 +217,7 @@ export function makeStyles() {
|
|
|
211
217
|
&.k-border,
|
|
212
218
|
&.k-grid {
|
|
213
219
|
.k-table-wrapper {
|
|
220
|
+
border-top: ${table.border};
|
|
214
221
|
border-left: ${table.border};
|
|
215
222
|
border-right: ${table.border};
|
|
216
223
|
}
|
|
@@ -371,5 +378,9 @@ export function makeGroupMenuStyles() {
|
|
|
371
378
|
.k-dropdown-item.k-active {
|
|
372
379
|
color: ${table.group.activeColor};
|
|
373
380
|
}
|
|
381
|
+
.k-table-group-header {
|
|
382
|
+
padding: ${table.group.headerPadding};
|
|
383
|
+
border-bottom: ${table.group.headerBorder};
|
|
384
|
+
}
|
|
374
385
|
`
|
|
375
386
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {useInstance} from 'intact';
|
|
2
|
-
import type {TableColumn} from './column';
|
|
2
|
+
import type {TableColumn, TableColumnGroupItem} from './column';
|
|
3
3
|
import {isNullOrUndefined} from 'intact-shared';
|
|
4
4
|
import {toggleArray} from '../utils';
|
|
5
5
|
import {createContext} from '../context';
|
|
6
|
+
import {useState, watchState} from '../../hooks/useState';
|
|
6
7
|
|
|
7
8
|
type ContextValue = {
|
|
8
9
|
groupValue: any
|
|
@@ -13,6 +14,8 @@ export const context = createContext<ContextValue>();
|
|
|
13
14
|
|
|
14
15
|
export function useGroup() {
|
|
15
16
|
const instance = useInstance() as TableColumn;
|
|
17
|
+
const keywords = useState<string>('');
|
|
18
|
+
const filteredGroup = useState<TableColumnGroupItem[] | undefined>(instance.get('group'));
|
|
16
19
|
|
|
17
20
|
function onSelect(value: any, groupValue: any, onChange: ContextValue['onChange']) {
|
|
18
21
|
const {multiple, key} = instance.get();
|
|
@@ -51,5 +54,18 @@ export function useGroup() {
|
|
|
51
54
|
return null;
|
|
52
55
|
}
|
|
53
56
|
|
|
54
|
-
|
|
57
|
+
watchState(keywords, (v) => {
|
|
58
|
+
const {group = []} = instance.get();
|
|
59
|
+
v = v.trim();
|
|
60
|
+
|
|
61
|
+
if (!v) {
|
|
62
|
+
filteredGroup.set(group);
|
|
63
|
+
} else {
|
|
64
|
+
filteredGroup.set(group.filter(item => {
|
|
65
|
+
return String(item.label).includes(v) || String(item.value).includes(v);
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
return {onSelect, isChecked, getGroupText, keywords, filteredGroup};
|
|
55
71
|
}
|
|
@@ -10,7 +10,10 @@ export function useSortable() {
|
|
|
10
10
|
// if the same column has been clicked three times consecutively,
|
|
11
11
|
// then let the third click to reset the sort
|
|
12
12
|
let count = 0;
|
|
13
|
-
function onChange(key: string) {
|
|
13
|
+
function onChange(key: string, event: Event & {_ignoreSortable?: boolean}) {
|
|
14
|
+
// ignore when click group dropdown menu
|
|
15
|
+
if (event._ignoreSortable) return;
|
|
16
|
+
|
|
14
17
|
let sort = {...instance.get('sort')} as TableSortValue;
|
|
15
18
|
if (sort.key === key) {
|
|
16
19
|
count++;
|
package/components/tabs/index.ts
CHANGED
|
@@ -12,7 +12,7 @@ export interface TabsProps<T = any> {
|
|
|
12
12
|
value?: T
|
|
13
13
|
vertical?: boolean
|
|
14
14
|
size?: Sizes
|
|
15
|
-
type?: 'default' | 'card' | 'border-card' | 'no-border-card'
|
|
15
|
+
type?: 'default' | 'card' | 'border-card' | 'no-border-card' | 'flat-card'
|
|
16
16
|
closable?: boolean
|
|
17
17
|
beforeChange?: (value: T) => boolean | Promise<boolean>
|
|
18
18
|
}
|
|
@@ -25,7 +25,7 @@ const typeDefs: Required<TypeDefs<TabsProps>> = {
|
|
|
25
25
|
value: null,
|
|
26
26
|
vertical: Boolean,
|
|
27
27
|
size: sizes,
|
|
28
|
-
type: ['default', 'card', 'border-card', 'no-border-card'],
|
|
28
|
+
type: ['default', 'card', 'border-card', 'no-border-card','flat-card'],
|
|
29
29
|
closable: Boolean,
|
|
30
30
|
beforeChange: Function,
|
|
31
31
|
};
|
|
@@ -9,10 +9,10 @@ const {
|
|
|
9
9
|
} = this.scroll;
|
|
10
10
|
const classNameObj = {
|
|
11
11
|
'k-tabs': true,
|
|
12
|
-
[`k-${size}`]: size,
|
|
12
|
+
[`k-size-${size}`]: size,
|
|
13
13
|
'k-vertical': vertical,
|
|
14
|
-
'k-tabs-card': type === 'no-border-card',
|
|
15
|
-
[`k-
|
|
14
|
+
/* 'k-tabs-card': type === 'no-border-card', */
|
|
15
|
+
[`k-type-${type}`]: true,
|
|
16
16
|
[`k-is-scroll`]: isScroll.value,
|
|
17
17
|
[className]: className,
|
|
18
18
|
[makeStyles()]: true,
|