@king-design/intact 3.0.0-beta.2 → 3.0.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/badge/styles.ts +1 -1
- package/components/breadcrumb/demos/separator.md +1 -1
- package/components/button/demos/group.md +7 -0
- package/components/button/group.ts +3 -1
- package/components/button/group.vdt +2 -1
- package/components/button/index.md +1 -0
- package/components/button/index.vdt +1 -1
- package/components/button/styles.ts +18 -3
- package/components/checkbox/styles.ts +6 -10
- package/components/collapse/styles.ts +0 -2
- package/components/dropdown/dropdown.ts +1 -0
- package/components/dropdown/usePosition.ts +2 -1
- package/components/form/index.spec.ts +21 -0
- package/components/form/styles.ts +1 -0
- package/components/icon/index.vdt +1 -1
- package/components/layout/body.ts +7 -2
- package/components/layout/demos/aside.md +1 -1
- package/components/layout/demos/basic.md +29 -9
- package/components/layout/header.ts +7 -1
- package/components/layout/helpers.ts +1 -0
- package/components/layout/index.md +2 -0
- package/components/layout/index.spec.ts +32 -0
- package/components/layout/layout.ts +4 -2
- package/components/layout/styles.ts +19 -3
- package/components/menu/styles.ts +8 -2
- package/components/menu/useDropdown.ts +5 -1
- package/components/message/demos/config.md +2 -2
- package/components/message/index.md +1 -1
- package/components/message/message.ts +1 -1
- package/components/pagination/styles.ts +1 -4
- package/components/popover/styles.ts +1 -1
- package/components/radio/styles.ts +4 -1
- package/components/scrollSelect/styles.ts +1 -1
- package/components/select/base.vdt +7 -4
- package/components/select/styles.ts +1 -1
- package/components/switch/styles.ts +17 -1
- package/components/table/column.vdt +3 -2
- package/components/table/demos/pagination.md +6 -0
- package/components/table/demos/showIndeterminate.md +2 -2
- package/components/table/index.md +2 -1
- package/components/table/index.spec.ts +1 -1
- package/components/table/row.ts +9 -1
- package/components/table/styles.ts +5 -2
- package/components/table/table.ts +3 -2
- package/components/table/useGroup.ts +2 -1
- package/components/table/usePagination.ts +1 -1
- package/components/tabs/demos/closable.md +1 -1
- package/components/tip/styles.ts +1 -1
- package/components/tooltip/index.spec.ts +30 -0
- package/components/tooltip/tooltip.ts +3 -0
- package/components/utils.ts +15 -0
- package/components/virtual.ts +4 -2
- package/es/components/badge/styles.js +1 -1
- package/es/components/button/group.d.ts +1 -0
- package/es/components/button/group.js +2 -1
- package/es/components/button/group.vdt.js +4 -2
- package/es/components/button/index.vdt.js +1 -1
- package/es/components/button/styles.js +11 -4
- package/es/components/checkbox/styles.js +4 -8
- package/es/components/collapse/styles.js +2 -2
- package/es/components/dropdown/dropdown.js +2 -1
- package/es/components/dropdown/usePosition.js +2 -2
- package/es/components/form/index.spec.js +45 -0
- package/es/components/form/styles.js +1 -1
- package/es/components/icon/index.vdt.js +3 -2
- package/es/components/layout/body.d.ts +1 -0
- package/es/components/layout/body.js +7 -2
- package/es/components/layout/header.d.ts +2 -0
- package/es/components/layout/header.js +9 -3
- package/es/components/layout/helpers.d.ts +1 -0
- package/es/components/layout/helpers.js +1 -0
- package/es/components/layout/index.spec.d.ts +1 -0
- package/es/components/layout/index.spec.js +53 -0
- package/es/components/layout/layout.d.ts +1 -0
- package/es/components/layout/layout.js +3 -2
- package/es/components/layout/styles.js +5 -5
- package/es/components/menu/styles.js +2 -2
- package/es/components/menu/useDropdown.js +6 -1
- package/es/components/message/message.js +1 -1
- package/es/components/pagination/styles.js +2 -5
- package/es/components/popover/styles.js +1 -1
- package/es/components/radio/styles.js +1 -1
- package/es/components/scrollSelect/styles.js +1 -1
- package/es/components/select/base.vdt.js +4 -1
- package/es/components/select/styles.js +1 -1
- package/es/components/switch/styles.js +10 -2
- package/es/components/table/column.vdt.js +4 -2
- package/es/components/table/index.spec.js +1 -1
- package/es/components/table/row.js +8 -1
- package/es/components/table/styles.js +2 -2
- package/es/components/table/table.d.ts +1 -1
- package/es/components/table/table.js +3 -2
- package/es/components/table/useGroup.d.ts +1 -1
- package/es/components/table/useGroup.js +2 -1
- package/es/components/table/usePagination.js +1 -1
- package/es/components/tip/styles.js +1 -1
- package/es/components/tooltip/index.spec.js +57 -0
- package/es/components/tooltip/tooltip.js +5 -1
- package/es/components/utils.d.ts +1 -0
- package/es/components/utils.js +16 -0
- package/es/components/virtual.js +5 -2
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/site/data/components/button/demos/group/react.js +17 -0
- package/es/site/data/components/layout/demos/aside/react.js +2 -1
- package/es/site/data/components/layout/demos/basic/react.js +13 -4
- package/es/site/data/components/message/demos/config/index.js +1 -1
- package/es/site/data/components/message/demos/config/react.js +1 -1
- package/es/site/data/components/table/demos/pagination/index.d.ts +4 -0
- package/es/site/data/components/table/demos/pagination/index.js +11 -2
- package/es/site/data/components/table/demos/pagination/react.d.ts +4 -0
- package/es/site/data/components/table/demos/pagination/react.js +11 -3
- package/es/site/data/components/table/demos/showIndeterminate/react.js +1 -1
- package/es/site/data/components/tabs/demos/closable/react.js +2 -1
- package/es/site/src/pages/layout.js +1 -3
- package/es/styles/fonts/iconfont.eot +0 -0
- package/es/styles/fonts/iconfont.js +1 -1
- package/es/styles/fonts/iconfont.svg +1 -1
- package/es/styles/fonts/iconfont.ttf +0 -0
- package/es/styles/fonts/iconfont.woff +0 -0
- package/es/styles/theme.js +1 -1
- package/es/styles/utils.d.ts +1 -0
- package/es/styles/utils.js +3 -0
- package/index.ts +2 -2
- package/package.json +3 -3
- package/styles/fonts/demo_index.html +6 -6
- package/styles/fonts/iconfont.css +6 -6
- package/styles/fonts/iconfont.eot +0 -0
- package/styles/fonts/iconfont.js +1 -1
- package/styles/fonts/iconfont.svg +1 -1
- package/styles/fonts/iconfont.ts +1 -1
- 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 +1 -1
- package/styles/utils.ts +5 -1
- package/es/site/data/components/menu/demos/collapse/react.d.ts +0 -11
- package/es/site/data/components/menu/demos/size/react.d.ts +0 -7
|
@@ -67,10 +67,13 @@ export function makeStyles() {
|
|
|
67
67
|
transform: scale(0);
|
|
68
68
|
transition: all ${radio.transition};
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
}
|
|
71
|
+
&:hover {
|
|
72
|
+
.k-radio-wrapper {
|
|
71
73
|
border: 1px solid ${radio.hoverBorderColor};
|
|
72
74
|
}
|
|
73
75
|
}
|
|
76
|
+
|
|
74
77
|
input {
|
|
75
78
|
width: 100%;
|
|
76
79
|
height: 100%;
|
|
@@ -19,7 +19,7 @@ const defaults = {
|
|
|
19
19
|
get color() { return theme.color.text },
|
|
20
20
|
get activeColor() { return theme.color.primary },
|
|
21
21
|
get hoverBgColor() { return theme.color.bg },
|
|
22
|
-
activeFontSize: `1.
|
|
22
|
+
activeFontSize: `1.3em`,
|
|
23
23
|
get disabledColor() { return theme.color.disabled },
|
|
24
24
|
border: `1px solid #e5e5e5`,
|
|
25
25
|
}
|
|
@@ -148,10 +148,13 @@ const filterInput = <Input v-if={filterable}
|
|
|
148
148
|
<span class="k-select-suffix-icon">
|
|
149
149
|
<b:suffix>
|
|
150
150
|
<Icon class="ion-load-c" rotate v-if={loading} />
|
|
151
|
-
<
|
|
152
|
-
class="k-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
<template v-else-if={!hideIcon}>
|
|
152
|
+
<Icon class="k-icon-search" v-if={filterable && show} />
|
|
153
|
+
<Icon v-else
|
|
154
|
+
class="k-select-arrow k-icon-down"
|
|
155
|
+
disabled={$props.isDisableArrow}
|
|
156
|
+
/>
|
|
157
|
+
</template>
|
|
155
158
|
</b:suffix>
|
|
156
159
|
</span>
|
|
157
160
|
</span>
|
|
@@ -11,7 +11,7 @@ type SizeStyles = {
|
|
|
11
11
|
|
|
12
12
|
const defaults = deepDefaults(
|
|
13
13
|
{
|
|
14
|
-
get transition() { return theme.transition.
|
|
14
|
+
get transition() { return theme.transition.large },
|
|
15
15
|
width: `300px`,
|
|
16
16
|
get height() { return theme.default.height },
|
|
17
17
|
bgColor: '#fff',
|
|
@@ -6,6 +6,7 @@ import '../../styles/global';
|
|
|
6
6
|
const defaults = {
|
|
7
7
|
get transition() { return theme.transition.middle },
|
|
8
8
|
get bgColor() { return theme.color.border },
|
|
9
|
+
get hoverBgColor() { return theme.color.placeholder },
|
|
9
10
|
fontSize: `12px`,
|
|
10
11
|
color: '#fff',
|
|
11
12
|
handleBorderRadius: `100%`,
|
|
@@ -16,7 +17,8 @@ const defaults = {
|
|
|
16
17
|
get bgColor() { return theme.color.primary },
|
|
17
18
|
get disabledBgColor() {
|
|
18
19
|
return palette(theme.color.primary, -3);
|
|
19
|
-
}
|
|
20
|
+
},
|
|
21
|
+
get hoverBgColor() { return theme.color.linkHover },
|
|
20
22
|
},
|
|
21
23
|
|
|
22
24
|
// default
|
|
@@ -66,6 +68,7 @@ export function makeStyles() {
|
|
|
66
68
|
user-select: none;
|
|
67
69
|
overflow: hidden;
|
|
68
70
|
box-sizing: content-box;
|
|
71
|
+
transition: background ${kswitch.transition};
|
|
69
72
|
input {
|
|
70
73
|
opacity: 0;
|
|
71
74
|
position: absolute;
|
|
@@ -91,6 +94,13 @@ export function makeStyles() {
|
|
|
91
94
|
background: ${kswitch.bgColor};
|
|
92
95
|
transition: all ${kswitch.transition};
|
|
93
96
|
}
|
|
97
|
+
&:hover {
|
|
98
|
+
&,
|
|
99
|
+
.k-switch-bar,
|
|
100
|
+
.k-switch-wrapper {
|
|
101
|
+
background: ${kswitch.hoverBgColor};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
94
104
|
.k-switch-handle {
|
|
95
105
|
border-radius: ${kswitch.handleBorderRadius};
|
|
96
106
|
background: ${kswitch.handleBgColor};
|
|
@@ -168,6 +178,12 @@ export function makeStyles() {
|
|
|
168
178
|
.k-switch-bar {
|
|
169
179
|
width: 100%;
|
|
170
180
|
}
|
|
181
|
+
&:hover {
|
|
182
|
+
.k-switch-bar,
|
|
183
|
+
.k-switch-wrapper {
|
|
184
|
+
background: ${kswitch.checked.hoverBgColor};
|
|
185
|
+
}
|
|
186
|
+
}
|
|
171
187
|
}
|
|
172
188
|
|
|
173
189
|
// disabled
|
|
@@ -95,9 +95,10 @@ const {
|
|
|
95
95
|
</DropdownItem>
|
|
96
96
|
</div>
|
|
97
97
|
<div class="k-table-group-footer" v-if={multiple}>
|
|
98
|
-
<Button
|
|
98
|
+
<Button size="small"
|
|
99
99
|
disabled={isEmptyValue(localGroupValue.value)}
|
|
100
|
-
|
|
100
|
+
type="secondary"
|
|
101
|
+
ev-click={() => reset(onChange)}
|
|
101
102
|
>重置</Button>
|
|
102
103
|
<Button type="primary" size="small"
|
|
103
104
|
ev-click={() => confirm(onChange)}
|
|
@@ -17,6 +17,7 @@ import {Table, TableColumn, Switch} from 'kpc';
|
|
|
17
17
|
ref="table"
|
|
18
18
|
draggable
|
|
19
19
|
rowKey={item => item.name}
|
|
20
|
+
ev-page={this.onChangePage}
|
|
20
21
|
>
|
|
21
22
|
<TableColumn title="Name" key="name" />
|
|
22
23
|
<TableColumn title="IP" key="ip" />
|
|
@@ -49,5 +50,10 @@ export default class extends Component {
|
|
|
49
50
|
data,
|
|
50
51
|
};
|
|
51
52
|
}
|
|
53
|
+
|
|
54
|
+
@bind
|
|
55
|
+
onChangePage(data: { value: number, limit: number }) {
|
|
56
|
+
console.log(data);
|
|
57
|
+
}
|
|
52
58
|
}
|
|
53
59
|
```
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
2
|
+
title: 取消表头半选中状态
|
|
3
3
|
order: 28
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -13,7 +13,7 @@ import {Table, TableColumn} from 'kpc';
|
|
|
13
13
|
data={this.get('data')}
|
|
14
14
|
resizable
|
|
15
15
|
ref="__test"
|
|
16
|
-
showIndeterminate={
|
|
16
|
+
showIndeterminate={false}
|
|
17
17
|
checkedKeys={[0]}
|
|
18
18
|
>
|
|
19
19
|
<TableColumn key="a" title="表头1" />
|
|
@@ -37,7 +37,7 @@ sidebar: doc
|
|
|
37
37
|
| tooltipPosition | 行提示的位置 | `"left"` | `"bottom"` | `"right"` | `"top"` | `Position` | `"top"` |
|
|
38
38
|
| tooltipContainer | 指定行提示弹层追加的位置,默认:`Dialog`类型的组件会追加到`Dialog`中,其他会追加到`body`中。你可以传入函数返回一个DOM用来作为插入的容器,或者传入字符串用来给`querySelector`进行查询 | `Container` | `undefined` |
|
|
39
39
|
| keepStatus | 是否在行销毁的时候,保持该行在`checkedKeys` | `selectedKeys` | `spreadKeys` | `expandedKeys`中的`key`值,默认会同步删除(仅在销毁行的时候有效,如果整个`Table`被销毁,则不会执行该逻辑) | `boolean` | `false` |
|
|
40
|
-
| showIndeterminate | 表头的`Checkbox`是否支持展示半选中状态 | `boolean` | `
|
|
40
|
+
| showIndeterminate | 表头的`Checkbox`是否支持展示半选中状态 | `boolean` | `true` |
|
|
41
41
|
| resizable | 是否可以表头拖动 | `boolean` | `false` |
|
|
42
42
|
| minColWidth | 指定所有列拖动时的最小宽度 | `number` | `40` |
|
|
43
43
|
| widthStoreKey | 如果要保存表格拖动后的列宽信息,可以通过该属性设置保存到`localStorage`中的`key` | `string` | `undefined` |
|
|
@@ -167,3 +167,4 @@ export type TableColumnGroupItem = {
|
|
|
167
167
|
| uncheckRow | 手动取消选中某行触发 | `(data: T, index: number, key: TableRowKey) => void` |
|
|
168
168
|
| checkAll | 手动全选触发 | `() => void` |
|
|
169
169
|
| uncheckAll | 手动取消全选触发 | `() => void` |
|
|
170
|
+
| page | 当内置翻页改变页码或每页数量时触发 | `({value: number, limit: number}) => void` |
|
package/components/table/row.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type {TableColumnProps} from './column';
|
|
|
12
12
|
import type {TableProps, TableRowKey} from './table';
|
|
13
13
|
import {bind} from '../utils';
|
|
14
14
|
import type {TableGrid} from './useMerge';
|
|
15
|
+
import { isEqualObject } from '../utils';
|
|
15
16
|
|
|
16
17
|
export interface TableRowProps {
|
|
17
18
|
key: TableRowKey
|
|
@@ -65,7 +66,14 @@ export class TableRow extends Component<TableRowProps> {
|
|
|
65
66
|
for (key in lastProps) {
|
|
66
67
|
// ignore index
|
|
67
68
|
if (key === 'index') continue;
|
|
68
|
-
|
|
69
|
+
const lastValue = lastProps[key];
|
|
70
|
+
const nextValue = nextProps[key];
|
|
71
|
+
// deeply compare for offsetMap
|
|
72
|
+
if (key === 'offsetMap' && isEqualObject(lastValue, nextValue)) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (lastValue !== nextValue) {
|
|
69
77
|
isSame = false;
|
|
70
78
|
break;
|
|
71
79
|
}
|
|
@@ -138,6 +138,7 @@ export function makeStyles() {
|
|
|
138
138
|
.k-table-title-text {
|
|
139
139
|
flex: 1;
|
|
140
140
|
display: inline-flex;
|
|
141
|
+
line-height: 1.4;
|
|
141
142
|
}
|
|
142
143
|
|
|
143
144
|
// tbody
|
|
@@ -362,9 +363,7 @@ export function makeStyles() {
|
|
|
362
363
|
|
|
363
364
|
export function makeGroupMenuStyles() {
|
|
364
365
|
return css`
|
|
365
|
-
max-height: ${table.group.menuMaxHeight};
|
|
366
366
|
min-width: ${table.group.menuMinWidth} !important;
|
|
367
|
-
overflow: auto;
|
|
368
367
|
.k-dropdown-item.k-active {
|
|
369
368
|
color: ${table.group.activeColor};
|
|
370
369
|
}
|
|
@@ -372,6 +371,10 @@ export function makeGroupMenuStyles() {
|
|
|
372
371
|
padding: ${table.group.headerPadding};
|
|
373
372
|
border-bottom: ${table.group.headerBorder};
|
|
374
373
|
}
|
|
374
|
+
.k-table-group-body {
|
|
375
|
+
max-height: ${table.group.menuMaxHeight};
|
|
376
|
+
overflow: auto;
|
|
377
|
+
}
|
|
375
378
|
.k-table-group-footer {
|
|
376
379
|
text-align: right;
|
|
377
380
|
border-top: ${table.group.headerBorder};
|
|
@@ -74,7 +74,7 @@ export interface TableEvents<T = any, K extends TableRowKey = number> {
|
|
|
74
74
|
uncheckRow: [T, number, K]
|
|
75
75
|
checkAll: []
|
|
76
76
|
uncheckAll: []
|
|
77
|
-
|
|
77
|
+
page: [PaginationChangeData]
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
export interface TableBlocks<T = unknown> {
|
|
@@ -140,6 +140,7 @@ const defaults = (): Partial<TableProps> => ({
|
|
|
140
140
|
indent: 32,
|
|
141
141
|
minColWidth: 40,
|
|
142
142
|
animation: true,
|
|
143
|
+
showIndeterminate: true,
|
|
143
144
|
});
|
|
144
145
|
|
|
145
146
|
const events: Events<TableEvents> = {
|
|
@@ -150,7 +151,7 @@ const events: Events<TableEvents> = {
|
|
|
150
151
|
uncheckRow: true,
|
|
151
152
|
checkAll: true,
|
|
152
153
|
uncheckAll: true,
|
|
153
|
-
|
|
154
|
+
page: true,
|
|
154
155
|
};
|
|
155
156
|
|
|
156
157
|
export class Table<
|
|
@@ -30,7 +30,7 @@ import {Tabs, Tab, Button, ButtonGroup, Icon} from 'kpc';
|
|
|
30
30
|
key={$value.value}
|
|
31
31
|
closable={$value.value !== 10}
|
|
32
32
|
>
|
|
33
|
-
<Icon class="k-icon-paper" size={this.get('size')} style="margin-right: 8px;" />
|
|
33
|
+
<Icon class="k-icon-paper" size={this.get('size')} style="margin-right: 8px;" color="inherit" />
|
|
34
34
|
{$value.label}
|
|
35
35
|
</Tab>
|
|
36
36
|
</Tabs>
|
package/components/tip/styles.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {Tooltip} from './';
|
|
|
8
8
|
import {Dialog} from '../dialog';
|
|
9
9
|
import {mount, unmount, dispatchEvent, getElement, wait} from '../../test/utils';
|
|
10
10
|
import { tooltip as tooltipTheme } from './styles';
|
|
11
|
+
import { Select, Option } from '../select';
|
|
11
12
|
|
|
12
13
|
describe('Tooltip', () => {
|
|
13
14
|
afterEach((done) => {
|
|
@@ -378,4 +379,33 @@ describe('Tooltip', () => {
|
|
|
378
379
|
const newWidth = content.offsetWidth;
|
|
379
380
|
expect(newWidth).to.eql(width);
|
|
380
381
|
});
|
|
382
|
+
|
|
383
|
+
it('should not impact select when wrap select with tooltip', async () => {
|
|
384
|
+
class Demo extends Component {
|
|
385
|
+
static template = `
|
|
386
|
+
const {Tooltip, Select, Option} = this;
|
|
387
|
+
<Tooltip>
|
|
388
|
+
<Select>
|
|
389
|
+
<Option value="1">Option 1</Option>
|
|
390
|
+
<Option value="2">Option 2</Option>
|
|
391
|
+
</Select>
|
|
392
|
+
</Tooltip>
|
|
393
|
+
`
|
|
394
|
+
private Tooltip = Tooltip;
|
|
395
|
+
private Select = Select;
|
|
396
|
+
private Option = Option;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
const [instance, element] = mount(Demo);
|
|
400
|
+
dispatchEvent(element, 'mouseenter');
|
|
401
|
+
await wait();
|
|
402
|
+
dispatchEvent(element, 'click');
|
|
403
|
+
await wait();
|
|
404
|
+
|
|
405
|
+
const menu = getElement(".k-select-menu")!;
|
|
406
|
+
dispatchEvent(element, 'mouseleave');
|
|
407
|
+
await wait(500);
|
|
408
|
+
|
|
409
|
+
expect(menu.style.display).to.eql('');
|
|
410
|
+
});
|
|
381
411
|
});
|
package/components/utils.ts
CHANGED
|
@@ -291,6 +291,21 @@ export function isEqualArray(a: EqualArrayValue, b: EqualArrayValue): boolean {
|
|
|
291
291
|
return false;
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
+
export function isEqualObject(a: Record<string, any>, b: Record<string, any>): boolean {
|
|
295
|
+
if (a === b) return true;
|
|
296
|
+
if (a && b) {
|
|
297
|
+
const keysA = Object.keys(a);
|
|
298
|
+
const keysB = Object.keys(b);
|
|
299
|
+
if (keysA.length !== keysB.length) return false;
|
|
300
|
+
|
|
301
|
+
return keysA.every((key) => {
|
|
302
|
+
return a[key] === b[key];
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return false;
|
|
307
|
+
}
|
|
308
|
+
|
|
294
309
|
export function last<T>(arr: T[]): T | undefined {
|
|
295
310
|
return arr[arr.length - 1];
|
|
296
311
|
}
|
package/components/virtual.ts
CHANGED
|
@@ -64,13 +64,15 @@ export class Virtual extends Component<any> {
|
|
|
64
64
|
return {...props, ...events, className: _props.className || _props.class /* vue-next */};
|
|
65
65
|
} else if (hasOwn.call(vnode, 'componentOptions') /* vue2 vnode */) {
|
|
66
66
|
const data = vnode.data;
|
|
67
|
-
|
|
67
|
+
if (!data) return props;
|
|
68
|
+
|
|
69
|
+
const on = data.on || EMPTY_OBJ;
|
|
68
70
|
const events: Record<string, Function> = {};
|
|
69
71
|
for (let key in on) {
|
|
70
72
|
events[`ev-${key}`] = on[key];
|
|
71
73
|
}
|
|
72
74
|
|
|
73
|
-
return {...props, ...events};
|
|
75
|
+
return {...props, ...events, className: data.staticClass};
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
return props;
|
|
@@ -22,5 +22,5 @@ setDefault(function () {
|
|
|
22
22
|
}).badge;
|
|
23
23
|
});
|
|
24
24
|
export default function makeStyles() {
|
|
25
|
-
return /*#__PURE__*/css("display:inline-block;position:relative;vertical-align:middle;>.k-badge-text{display:inline-block;position:absolute;width:", badge.width, ";height:", badge.height, ";border-radius:50%;top:0;right:0;transform:translate(50%, -50%);background:", badge.bgColor, ";font-size:
|
|
25
|
+
return /*#__PURE__*/css("display:inline-block;position:relative;vertical-align:middle;>.k-badge-text{display:inline-block;position:absolute;width:", badge.width, ";height:", badge.height, ";border-radius:50%;top:0;right:0;transform:translate(50%, -50%);background:", badge.bgColor, ";font-size:85%;vertical-align:baseline;}&.k-has-text>.k-badge-text{width:auto;height:", badge.textHeight, ";line-height:", badge.textHeight, ";border-radius:calc(", badge.textHeight, " / 2);padding:0 ", badge.textPadding, ";color:", badge.textColor, ";}&.k-alone>.k-badge-text{position:static;transform:none;}");
|
|
26
26
|
}
|
|
@@ -4,6 +4,7 @@ export interface ButtonGroupProps {
|
|
|
4
4
|
value?: any;
|
|
5
5
|
checkType?: 'none' | 'radio' | 'checkbox';
|
|
6
6
|
fluid?: boolean;
|
|
7
|
+
seperate?: boolean;
|
|
7
8
|
}
|
|
8
9
|
export declare class ButtonGroup extends Component<ButtonGroupProps> {
|
|
9
10
|
static template: string | import("intact").Template<any>;
|
|
@@ -13,12 +13,14 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
13
13
|
className = _this$get.className,
|
|
14
14
|
vertical = _this$get.vertical,
|
|
15
15
|
children = _this$get.children,
|
|
16
|
-
fluid = _this$get.fluid
|
|
16
|
+
fluid = _this$get.fluid,
|
|
17
|
+
seperate = _this$get.seperate;
|
|
17
18
|
|
|
18
19
|
var classNameObj = (_classNameObj = {
|
|
19
20
|
'k-btns': true,
|
|
20
21
|
'k-vertical': vertical,
|
|
21
|
-
'k-fluid': fluid
|
|
22
|
+
'k-fluid': fluid,
|
|
23
|
+
'k-seperate': seperate
|
|
22
24
|
}, _classNameObj[className] = className, _classNameObj[makeButtonGroupStyles()] = true, _classNameObj);
|
|
23
25
|
return _$cv('div', _extends({
|
|
24
26
|
'className': _$cn(classNameObj)
|
|
@@ -78,7 +78,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
78
78
|
var waveColor = typeStyles && typeStyles.borderColor || theme.primary.borderColor;
|
|
79
79
|
return _$cc(Wave, {
|
|
80
80
|
'disabled': loading || disabled || type === 'none' || type === 'link',
|
|
81
|
-
'inset': '-2px',
|
|
81
|
+
'inset': type === 'flat' ? '-1px' : '-2px',
|
|
82
82
|
'color': waveColor,
|
|
83
83
|
'children': _$cc(DynamicButton, _extends({
|
|
84
84
|
'className': _$cn(classNameObj),
|
|
@@ -14,7 +14,7 @@ var btnStyles = {
|
|
|
14
14
|
lineHeight: '1.15',
|
|
15
15
|
|
|
16
16
|
get padding() {
|
|
17
|
-
return "0 "
|
|
17
|
+
return "0 16px";
|
|
18
18
|
},
|
|
19
19
|
|
|
20
20
|
get borderColor() {
|
|
@@ -146,6 +146,13 @@ var btnSizeStyles = sizes.reduce(function (memo, size) {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
};
|
|
149
|
+
|
|
150
|
+
if (size === 'large') {
|
|
151
|
+
Object.defineProperty(memo[size], 'padding', {
|
|
152
|
+
value: "0 24px"
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
|
|
149
156
|
return memo;
|
|
150
157
|
}, {});
|
|
151
158
|
var defaults = deepDefaults({
|
|
@@ -255,13 +262,13 @@ export function makeButtonStyles(_ref) {
|
|
|
255
262
|
}) + "\n }\n }\n ", ";"));
|
|
256
263
|
}
|
|
257
264
|
export function makeButtonGroupStyles() {
|
|
258
|
-
return /*#__PURE__*/css("display:inline-
|
|
265
|
+
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) {
|
|
259
266
|
if (type === 'active') return;
|
|
260
267
|
var borderColor = button.group[type].borderColor;
|
|
261
268
|
return /*#__PURE__*/css("&.k-", type, ":not(:first-child){border-left-color:", borderColor, ";}&.k-", type, ":not(:last-child){border-right-color:", borderColor, ";}");
|
|
262
|
-
}), ";&: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{
|
|
269
|
+
}), ";&: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) {
|
|
263
270
|
if (type === 'active') return;
|
|
264
271
|
var borderColor = button.group[type].borderColor;
|
|
265
272
|
return /*#__PURE__*/css("&.k-", type, ":not(:first-child){border-top-color:", borderColor, ";}&.k-", type, ":not(:last-child){border-bottom-color:", borderColor, ";}");
|
|
266
|
-
}), ";&: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;}}}");
|
|
273
|
+
}), ";&: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;>.k-btn{border-radius:", button.borderRadius, "!important;}}");
|
|
267
274
|
}
|
|
@@ -38,11 +38,11 @@ var defaults = {
|
|
|
38
38
|
|
|
39
39
|
},
|
|
40
40
|
inner: {
|
|
41
|
-
width: '
|
|
41
|
+
width: '6px',
|
|
42
42
|
height: '10px',
|
|
43
43
|
top: '0px',
|
|
44
|
-
left: '
|
|
45
|
-
border: '
|
|
44
|
+
left: '4px',
|
|
45
|
+
border: '2px solid #fff'
|
|
46
46
|
},
|
|
47
47
|
// disabled
|
|
48
48
|
disabled: {
|
|
@@ -69,10 +69,6 @@ var defaults = {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
}
|
|
72
|
-
},
|
|
73
|
-
// indeterminate
|
|
74
|
-
indeterminate: {
|
|
75
|
-
innerLeft: '4px'
|
|
76
72
|
}
|
|
77
73
|
};
|
|
78
74
|
var checkbox;
|
|
@@ -82,5 +78,5 @@ setDefault(function () {
|
|
|
82
78
|
}).checkbox;
|
|
83
79
|
});
|
|
84
80
|
export default function makeStyles() {
|
|
85
|
-
return /*#__PURE__*/css("display:inline-flex;align-items:center;cursor:pointer;vertical-align:middle;.k-checkbox-wrapper{width:", checkbox.width, ";height:", checkbox.width, ";border:1px solid ", checkbox.borderColor, ";border-radius:", checkbox.borderRadius, ";position:relative;transition:all ", checkbox.transition, ";background:", checkbox.bgColor, ";flex:0 0 auto;&:before{content:\"\";display:block;position:absolute;width:", checkbox.inner.width, ";height:", checkbox.inner.height, ";top:", checkbox.inner.top, ";left:", checkbox.inner.left, ";border:", checkbox.inner.border, ";border-top:0;border-left:0;transform:rotate(45deg) scale(0);transition:all ", checkbox.transition, ";}&:hover{border:", checkbox.hoverBorder, ";}}input{width:100%;height:100%;opacity:0;cursor:pointer;position:absolute;left:0;top:0;margin:0;}.k-checkbox-text{margin-left:", checkbox.text.gap, ";flex:0 1 auto;}&.k-checked,&.k-indeterminate{.k-checkbox-wrapper{border-color:", checkbox.checked.borderColor, ";background:", checkbox.checked.bgColor, ";}}&.k-indeterminate{.k-checkbox-wrapper{&:before{transform:rotate(90deg) scale(1);border-bottom:0;
|
|
81
|
+
return /*#__PURE__*/css("display:inline-flex;align-items:center;cursor:pointer;vertical-align:middle;.k-checkbox-wrapper{width:", checkbox.width, ";height:", checkbox.width, ";border:1px solid ", checkbox.borderColor, ";border-radius:", checkbox.borderRadius, ";position:relative;transition:all ", checkbox.transition, ";background:", checkbox.bgColor, ";flex:0 0 auto;&:before{content:\"\";display:block;position:absolute;width:", checkbox.inner.width, ";height:", checkbox.inner.height, ";top:", checkbox.inner.top, ";left:", checkbox.inner.left, ";border:", checkbox.inner.border, ";border-top:0;border-left:0;transform:rotate(45deg) scale(0);transition:all ", checkbox.transition, ";}}&:hover{.k-checkbox-wrapper{border:", checkbox.hoverBorder, ";}}input{width:100%;height:100%;opacity:0;cursor:pointer;position:absolute;left:0;top:0;margin:0;}.k-checkbox-text{margin-left:", checkbox.text.gap, ";flex:0 1 auto;}&.k-checked,&.k-indeterminate{.k-checkbox-wrapper{border-color:", checkbox.checked.borderColor, ";background:", checkbox.checked.bgColor, ";}}&.k-indeterminate{.k-checkbox-wrapper{&:before{transform:rotate(90deg) scale(1);border-bottom:0;}}}&.k-checked{.k-checkbox-wrapper{&:before{transform:rotate(45deg) scale(1);}}}&:focus{outline:none;.k-checkbox-wrapper{border-color:", checkbox.checked.borderColor, ";}}&.k-disabled{color:", checkbox.disabled.color, ";cursor:not-allowed;.k-checkbox-wrapper{border-color:", checkbox.disabled.borderColor, ";background:", checkbox.disabled.bgColor, ";&:before{border-color:", checkbox.disabled.innerColor, ";}}input{cursor:not-allowed;}&.k-checked,&.k-indeterminate{.k-checkbox-wrapper{border-color:", checkbox.disabled.checked.borderColor, ";background:", checkbox.disabled.checked.bgColor, ";}}}");
|
|
86
82
|
}
|
|
@@ -32,9 +32,9 @@ setDefault(function () {
|
|
|
32
32
|
}).collapse;
|
|
33
33
|
});
|
|
34
34
|
export function makeStyles() {
|
|
35
|
-
return /*#__PURE__*/css("font-size:", collapse.fontSize, ";&.k-left{.", kls('arrow'), "{float:left;margin-right:", collapse.titleMarginRight, ";
|
|
35
|
+
return /*#__PURE__*/css("font-size:", collapse.fontSize, ";&.k-left{.", kls('arrow'), "{float:left;margin-right:", collapse.titleMarginRight, ";}}&.k-border{border-radius:", collapse.borderRadius, ";padding:", collapse.borderPadding, ";border:", collapse.collBorder, ";}");
|
|
36
36
|
}
|
|
37
37
|
export function makeItemStyles() {
|
|
38
38
|
var collapseItem = collapse.item;
|
|
39
|
-
return /*#__PURE__*/css("border-bottom:", collapseItem.borderBottom, ";&:last-of-type{border-bottom-color:transparent;}.", kls('title'), "{cursor:pointer;font-weight:bold;height:", collapseItem.titleHeight, ";line-height:", collapseItem.titleHeight, ";transition:color ", collapse.transition, ";}.", kls('arrow'), "{float:right;transition:transform ", collapse.transition, ";line-height:", collapseItem.titleHeight, ";height:", collapseItem.titleHeight, ";
|
|
39
|
+
return /*#__PURE__*/css("border-bottom:", collapseItem.borderBottom, ";&:last-of-type{border-bottom-color:transparent;}.", kls('title'), "{cursor:pointer;font-weight:bold;height:", collapseItem.titleHeight, ";line-height:", collapseItem.titleHeight, ";transition:color ", collapse.transition, ";}.", kls('arrow'), "{float:right;transition:transform ", collapse.transition, ";line-height:", collapseItem.titleHeight, ";height:", collapseItem.titleHeight, ";}&:not(.k-disabled){.", kls('title'), "{&:hover{color:", theme.color.primary, ";}}}.", kls('content'), "{overflow:hidden;.", kls('wrapper'), "{overflow:hidden;padding:", collapseItem.contentPadding, ";}}&.k-active{.", kls('arrow'), "{transform:rotate(90deg);}}&.k-disabled{color:", theme.color.disabledBorder, ";.", kls('title'), "{cursor:not-allowed;}}");
|
|
40
40
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
|
-
import _JSON$stringify from "@babel/runtime-corejs3/core-js/json/stringify";
|
|
3
2
|
import { useInstance, findDomFromVNode } from 'intact';
|
|
4
3
|
import { position } from '../position';
|
|
5
4
|
import { noop } from 'intact-shared';
|
|
6
5
|
import { isObject } from 'intact-shared';
|
|
6
|
+
import { isEqualObject } from '../utils';
|
|
7
7
|
export function usePosition() {
|
|
8
8
|
var instance = useInstance();
|
|
9
9
|
var positioned = {
|
|
@@ -18,7 +18,7 @@ export function usePosition() {
|
|
|
18
18
|
instance.watch(item, function (newValue, oldValue) {
|
|
19
19
|
// return if object is the same
|
|
20
20
|
if (isObject(newValue) && isObject(oldValue) && // is not event object
|
|
21
|
-
!(newValue instanceof Event) &&
|
|
21
|
+
!(newValue instanceof Event) && isEqualObject(newValue, oldValue)) {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -12,6 +12,7 @@ import { mount, unmount, dispatchEvent, wait } from '../../test/utils';
|
|
|
12
12
|
import { Component } from 'intact';
|
|
13
13
|
import { Form, FormItem } from './';
|
|
14
14
|
import { Input } from '../input';
|
|
15
|
+
import { Select } from '../select';
|
|
15
16
|
|
|
16
17
|
RemoteDemo.prototype.validateUserName = function (value) {
|
|
17
18
|
// mock api
|
|
@@ -1317,4 +1318,48 @@ describe('Form', function () {
|
|
|
1317
1318
|
}
|
|
1318
1319
|
}, _callee7);
|
|
1319
1320
|
})));
|
|
1321
|
+
it('should not validate when select is disabled on init', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
1322
|
+
var Demo, _mount8, instance, element;
|
|
1323
|
+
|
|
1324
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context11) {
|
|
1325
|
+
while (1) {
|
|
1326
|
+
switch (_context11.prev = _context11.next) {
|
|
1327
|
+
case 0:
|
|
1328
|
+
Demo = /*#__PURE__*/function (_Component3) {
|
|
1329
|
+
_inheritsLoose(Demo, _Component3);
|
|
1330
|
+
|
|
1331
|
+
function Demo() {
|
|
1332
|
+
var _context10;
|
|
1333
|
+
|
|
1334
|
+
var _this3;
|
|
1335
|
+
|
|
1336
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
1337
|
+
args[_key3] = arguments[_key3];
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
_this3 = _Component3.call.apply(_Component3, _concatInstanceProperty(_context10 = [this]).call(_context10, args)) || this;
|
|
1341
|
+
_this3.Form = Form;
|
|
1342
|
+
_this3.FormItem = FormItem;
|
|
1343
|
+
_this3.Select = Select;
|
|
1344
|
+
return _this3;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
return Demo;
|
|
1348
|
+
}(Component);
|
|
1349
|
+
|
|
1350
|
+
Demo.template = "\n const {Form, FormItem, Select} = this;\n <Form ref=\"form\">\n <FormItem rules={{required: true}}>\n <Select disabled />\n </FormItem>\n </Form>\n ";
|
|
1351
|
+
_mount8 = mount(Demo), instance = _mount8[0], element = _mount8[1];
|
|
1352
|
+
_context11.next = 5;
|
|
1353
|
+
return wait(500);
|
|
1354
|
+
|
|
1355
|
+
case 5:
|
|
1356
|
+
expect(element.querySelector('.k-form-error')).to.be.null;
|
|
1357
|
+
|
|
1358
|
+
case 6:
|
|
1359
|
+
case "end":
|
|
1360
|
+
return _context11.stop();
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
}, _callee8);
|
|
1364
|
+
})));
|
|
1320
1365
|
});
|