@king-design/intact 3.0.0 → 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/dropdown/usePosition.ts +2 -1
- package/components/form/styles.ts +1 -0
- 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/table/demos/pagination.md +6 -0
- package/components/table/index.md +1 -0
- package/components/table/index.spec.ts +1 -1
- package/components/table/row.ts +9 -1
- package/components/table/styles.ts +4 -2
- package/components/table/table.ts +2 -2
- package/components/table/usePagination.ts +1 -1
- package/components/utils.ts +15 -0
- package/components/virtual.ts +4 -2
- package/es/components/dropdown/usePosition.js +2 -2
- package/es/components/form/styles.js +1 -1
- 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/table/index.spec.js +1 -1
- package/es/components/table/row.js +8 -1
- package/es/components/table/styles.js +1 -1
- package/es/components/table/table.d.ts +1 -1
- package/es/components/table/table.js +1 -1
- package/es/components/table/usePagination.js +1 -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/layout/demos/aside/react.js +2 -1
- package/es/site/data/components/layout/demos/basic/react.js +13 -4
- 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/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/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
|
@@ -3,6 +3,7 @@ import type {Dropdown} from './';
|
|
|
3
3
|
import {Options, position, Feedback} from '../position';
|
|
4
4
|
import {noop} from 'intact-shared';
|
|
5
5
|
import {isObject} from 'intact-shared';
|
|
6
|
+
import { isEqualObject } from '../utils';
|
|
6
7
|
|
|
7
8
|
export type FeedbackCallback = (feedback: Feedback) => void;
|
|
8
9
|
|
|
@@ -23,7 +24,7 @@ export function usePosition() {
|
|
|
23
24
|
isObject(newValue) && isObject(oldValue) &&
|
|
24
25
|
// is not event object
|
|
25
26
|
!(newValue instanceof Event) &&
|
|
26
|
-
|
|
27
|
+
isEqualObject(newValue, oldValue)
|
|
27
28
|
) {
|
|
28
29
|
return;
|
|
29
30
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {Component, inject} from 'intact';
|
|
1
|
+
import {Component, inject, provide} from 'intact';
|
|
2
2
|
import template from './template.vdt';
|
|
3
|
-
import {LAYOUT, getStyle} from './helpers';
|
|
3
|
+
import {LAYOUT, getStyle, BODY} from './helpers';
|
|
4
4
|
import type {Layout} from './layout';
|
|
5
5
|
import {addStyle} from '../utils';
|
|
6
6
|
|
|
@@ -9,6 +9,10 @@ export class Body extends Component {
|
|
|
9
9
|
|
|
10
10
|
private layout = inject<Layout>(LAYOUT)!;
|
|
11
11
|
|
|
12
|
+
init() {
|
|
13
|
+
provide(BODY, this);
|
|
14
|
+
}
|
|
15
|
+
|
|
12
16
|
private getClassNames() {
|
|
13
17
|
const {className} = this.get();
|
|
14
18
|
return {
|
|
@@ -24,6 +28,7 @@ export class Body extends Component {
|
|
|
24
28
|
if (!hasFixedAside && !hasFixedHeader) return style;
|
|
25
29
|
|
|
26
30
|
return addStyle(style, {
|
|
31
|
+
// FIXME: we must use padding instead of margin, otherwise the table's width is wired
|
|
27
32
|
paddingLeft: hasFixedAside ? getStyle(asideWidth) : null,
|
|
28
33
|
marginTop: hasFixedHeader ? getStyle(headerHeight) : null,
|
|
29
34
|
});
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
</Aside>
|
|
48
48
|
<Layout>
|
|
49
49
|
<Header>
|
|
50
|
-
<Button type="none" size="large" style="height: 64px" ev-click={this.toggle}>
|
|
50
|
+
<Button type="none" size="large" style="height: 64px" ev-click={this.toggle} ghost>
|
|
51
51
|
<Icon class="ion-navicon" size="30"/>
|
|
52
52
|
</Button>
|
|
53
53
|
</Header>
|
|
@@ -21,9 +21,9 @@ import {Icon} from 'kpc';
|
|
|
21
21
|
import {Breadcrumb, BreadcrumbItem} from 'kpc';
|
|
22
22
|
|
|
23
23
|
<Layout class="layout">
|
|
24
|
-
<Header class="header">
|
|
24
|
+
<Header class="header" blur boxShadow theme="white" height="54px" fixed>
|
|
25
25
|
<div class="logo">LOGO</div>
|
|
26
|
-
<Menu type="horizontal">
|
|
26
|
+
<Menu type="horizontal" theme="white">
|
|
27
27
|
<MenuItem key="1">menu 1</MenuItem>
|
|
28
28
|
<MenuItem key="2" disabled>menu 2</MenuItem>
|
|
29
29
|
<MenuItem key="3">
|
|
@@ -45,7 +45,7 @@ import {Breadcrumb, BreadcrumbItem} from 'kpc';
|
|
|
45
45
|
</Menu>
|
|
46
46
|
</Header>
|
|
47
47
|
<Layout>
|
|
48
|
-
<Aside theme="light">
|
|
48
|
+
<Aside theme="light" fixed>
|
|
49
49
|
<Menu
|
|
50
50
|
v-model:expandedKeys="expandedKeys"
|
|
51
51
|
v-model:selectedKey="selectedKey"
|
|
@@ -74,11 +74,29 @@ import {Breadcrumb, BreadcrumbItem} from 'kpc';
|
|
|
74
74
|
</Menu>
|
|
75
75
|
</Aside>
|
|
76
76
|
<Body>
|
|
77
|
-
<
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
<div class="content">
|
|
78
|
+
<Breadcrumb>
|
|
79
|
+
<BreadcrumbItem>Home</BreadcrumbItem>
|
|
80
|
+
<BreadcrumbItem>Detail</BreadcrumbItem>
|
|
81
|
+
</Breadcrumb>
|
|
82
|
+
<div>content</div>
|
|
83
|
+
<div>content</div>
|
|
84
|
+
<div>content</div>
|
|
85
|
+
<div>content</div>
|
|
86
|
+
<div>content</div>
|
|
87
|
+
<div>content</div>
|
|
88
|
+
<div>content</div>
|
|
89
|
+
<div>content</div>
|
|
90
|
+
<div>content</div>
|
|
91
|
+
<div>content</div>
|
|
92
|
+
<div>content</div>
|
|
93
|
+
<div>content</div>
|
|
94
|
+
<div>content</div>
|
|
95
|
+
<div>content</div>
|
|
96
|
+
<div>content</div>
|
|
97
|
+
<div>content</div>
|
|
98
|
+
<div>content</div>
|
|
99
|
+
</div>
|
|
82
100
|
</Body>
|
|
83
101
|
</Layout>
|
|
84
102
|
</Layout>
|
|
@@ -92,8 +110,10 @@ import {Breadcrumb, BreadcrumbItem} from 'kpc';
|
|
|
92
110
|
text-align center
|
|
93
111
|
background gray
|
|
94
112
|
margin 0 20px
|
|
113
|
+
.content
|
|
114
|
+
padding: 20px
|
|
95
115
|
.k-breadcrumb
|
|
96
|
-
margin 20px
|
|
116
|
+
margin-bottom 20px
|
|
97
117
|
```
|
|
98
118
|
|
|
99
119
|
```ts
|
|
@@ -12,6 +12,8 @@ export interface HeaderProps {
|
|
|
12
12
|
height?: number | string
|
|
13
13
|
style?: string | Record<string, string>
|
|
14
14
|
theme?: MenuProps['theme']
|
|
15
|
+
blur?: boolean
|
|
16
|
+
boxShadow?: boolean
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
const typeDefs: Required<TypeDefs<HeaderProps>> = {
|
|
@@ -19,6 +21,8 @@ const typeDefs: Required<TypeDefs<HeaderProps>> = {
|
|
|
19
21
|
height: [Number, String],
|
|
20
22
|
style: [String, Object],
|
|
21
23
|
theme: themes,
|
|
24
|
+
blur: Boolean,
|
|
25
|
+
boxShadow: Boolean,
|
|
22
26
|
};
|
|
23
27
|
|
|
24
28
|
const defaults = (): Partial<HeaderProps> => ({
|
|
@@ -34,10 +38,12 @@ export class Header extends Component<HeaderProps> {
|
|
|
34
38
|
private rootLayout = inject<Layout>(ROOT_LAYOUT)!;
|
|
35
39
|
|
|
36
40
|
private getClassNames() {
|
|
37
|
-
const {className, fixed, theme} = this.get();
|
|
41
|
+
const {className, fixed, theme, blur, boxShadow} = this.get();
|
|
38
42
|
return {
|
|
39
43
|
'k-layout-header': true,
|
|
40
44
|
'k-fixed': fixed,
|
|
45
|
+
'k-blur': blur,
|
|
46
|
+
'k-box-shadow': boxShadow,
|
|
41
47
|
[`k-${theme!}`]: true,
|
|
42
48
|
[className as string]: className,
|
|
43
49
|
[makeHeaderStyles()]: true,
|
|
@@ -14,6 +14,8 @@ sidebar: doc
|
|
|
14
14
|
| fixed | 是否固定头部 | `boolean` | `false` |
|
|
15
15
|
| theme | 主题颜色 | `"dark"` | `"light"` | `"white"` | `"dark"` |
|
|
16
16
|
| height | 高度 | `string` | `number` | `"64px"` |
|
|
17
|
+
| blur | 是否高斯模糊背景 | `boolean` | `false` |
|
|
18
|
+
| boxShadow | 是否展示阴影 | `boolean` | `false` |
|
|
17
19
|
|
|
18
20
|
## Aside
|
|
19
21
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {mount, unmount, dispatchEvent, wait, getElement} from '../../test/utils';
|
|
2
|
+
import { Component } from 'intact';
|
|
3
|
+
import { Layout, Header, Aside, Body } from './';
|
|
4
|
+
|
|
5
|
+
describe('Layout', () => {
|
|
6
|
+
afterEach(() => {unmount()});
|
|
7
|
+
|
|
8
|
+
it('nest Layout in Body with fixed header', async () => {
|
|
9
|
+
class Demo extends Component {
|
|
10
|
+
static template = `
|
|
11
|
+
const { Layout, Header, Aside, Body } = this;
|
|
12
|
+
<Layout>
|
|
13
|
+
<Header fixed />
|
|
14
|
+
<Body>
|
|
15
|
+
<Layout>
|
|
16
|
+
<Aside fixed />
|
|
17
|
+
<Body>body</Body>
|
|
18
|
+
</Layout>
|
|
19
|
+
</Body>
|
|
20
|
+
</Layout>
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
Layout = Layout;
|
|
24
|
+
Header = Header;
|
|
25
|
+
Aside = Aside;
|
|
26
|
+
Body = Body;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const [instance, element] = mount(Demo);
|
|
30
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -2,14 +2,16 @@ import {Component, TypeDefs, inject, provide} from 'intact';
|
|
|
2
2
|
import template from './template.vdt';
|
|
3
3
|
import {makeLayoutStyles} from './styles';
|
|
4
4
|
import {addStyle} from '../utils';
|
|
5
|
-
import {ROOT_LAYOUT, LAYOUT, getStyle} from './helpers';
|
|
5
|
+
import {ROOT_LAYOUT, LAYOUT, getStyle, BODY} from './helpers';
|
|
6
6
|
import {useParse} from './useParse';
|
|
7
|
+
import type { Body } from './body';
|
|
7
8
|
|
|
8
9
|
export class Layout extends Component {
|
|
9
10
|
static template = template;
|
|
10
11
|
|
|
11
12
|
public parse = useParse();
|
|
12
13
|
public layout = inject<Layout | null>(LAYOUT, null);
|
|
14
|
+
private body = inject<Body | null>(BODY, null);
|
|
13
15
|
|
|
14
16
|
init() {
|
|
15
17
|
provide(LAYOUT, this);
|
|
@@ -32,7 +34,7 @@ export class Layout extends Component {
|
|
|
32
34
|
private getStyles() {
|
|
33
35
|
const style = this.get<string>('style');
|
|
34
36
|
const layout = this.layout;
|
|
35
|
-
if (!layout) return style;
|
|
37
|
+
if (!layout || this.body) return style;
|
|
36
38
|
|
|
37
39
|
const {hasFixedHeader, headerHeight, hasFixedAside, asideWidth} = layout.parse();
|
|
38
40
|
if (!hasFixedHeader && !hasFixedAside) return style;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {css} from '@emotion/css';
|
|
2
2
|
import {theme, setDefault} from '../../styles/theme';
|
|
3
|
-
import {deepDefaults, getLeft} from '../../styles/utils';
|
|
3
|
+
import {deepDefaults, getLeft, setAlpha} from '../../styles/utils';
|
|
4
4
|
import '../../styles/global';
|
|
5
5
|
import {menu} from '../menu/styles';
|
|
6
6
|
|
|
@@ -12,12 +12,12 @@ const defaults = {
|
|
|
12
12
|
get color() { return menu.item.color },
|
|
13
13
|
get bgColor() { return menu.bgColor },
|
|
14
14
|
light: {
|
|
15
|
-
get color() { return menu.light.
|
|
15
|
+
get color() { return menu.light.item.color },
|
|
16
16
|
get bgColor() { return menu.light.bgColor },
|
|
17
17
|
get border() { return menu.light.border },
|
|
18
18
|
},
|
|
19
19
|
white: {
|
|
20
|
-
get color() { return menu.white.
|
|
20
|
+
get color() { return menu.white.item.color },
|
|
21
21
|
get bgColor() { return menu.white.bgColor },
|
|
22
22
|
get border() { return menu.white.border },
|
|
23
23
|
},
|
|
@@ -69,6 +69,19 @@ export function makeHeaderStyles() {
|
|
|
69
69
|
top: 0;
|
|
70
70
|
z-index: ${theme.midZIndex + 1};
|
|
71
71
|
}
|
|
72
|
+
> .k-menu {
|
|
73
|
+
background: transparent !important;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&.k-blur {
|
|
77
|
+
backdrop-filter: blur(20px);
|
|
78
|
+
background: ${setAlpha(layout.bgColor, 0.1)};
|
|
79
|
+
}
|
|
80
|
+
&.k-box-shadow {
|
|
81
|
+
border-bottom: none !important;
|
|
82
|
+
box-shadow: ${theme.boxShadow};
|
|
83
|
+
}
|
|
84
|
+
|
|
72
85
|
${themes.map(theme => {
|
|
73
86
|
if (theme === 'dark') return;
|
|
74
87
|
const styles = layout[theme];
|
|
@@ -77,6 +90,9 @@ export function makeHeaderStyles() {
|
|
|
77
90
|
background: ${styles.bgColor};
|
|
78
91
|
color: ${styles.color};
|
|
79
92
|
border-bottom: ${styles.border};
|
|
93
|
+
&.k-blur {
|
|
94
|
+
background: ${setAlpha(styles.bgColor, 0.1)};
|
|
95
|
+
}
|
|
80
96
|
}
|
|
81
97
|
`
|
|
82
98
|
})}
|
|
@@ -230,8 +230,8 @@ export function makeTitleStyles() {
|
|
|
230
230
|
return css`
|
|
231
231
|
display: flex;
|
|
232
232
|
align-items: center;
|
|
233
|
-
padding: ${
|
|
234
|
-
color: ${
|
|
233
|
+
padding: ${item.padding};
|
|
234
|
+
color: ${item.color};
|
|
235
235
|
white-space: nowrap;
|
|
236
236
|
overflow: hidden;
|
|
237
237
|
flex-wrap: nowrap;
|
|
@@ -253,6 +253,12 @@ export function makeItemStyles() {
|
|
|
253
253
|
flex: 1;
|
|
254
254
|
display: flex;
|
|
255
255
|
align-items: center;
|
|
256
|
+
min-width: 0;
|
|
257
|
+
span {
|
|
258
|
+
overflow: hidden;
|
|
259
|
+
text-overflow: ellipsis;
|
|
260
|
+
min-width: 0;
|
|
261
|
+
}
|
|
256
262
|
}
|
|
257
263
|
.k-menu-arrow {
|
|
258
264
|
transition: transform ${menu.transition};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useInstance, VNodeComponentClass, onBeforeMount, onBeforeUpdate, inject} from 'intact';
|
|
1
|
+
import {useInstance, VNodeComponentClass, onBeforeMount, onBeforeUpdate, inject, createVNode} from 'intact';
|
|
2
2
|
import {Menu, MenuItem, MenuProps} from './';
|
|
3
3
|
import {Icon} from '../icon';
|
|
4
4
|
import {
|
|
@@ -52,6 +52,10 @@ export function useDropdown(rootMenu: Menu, parentMenu: Menu) {
|
|
|
52
52
|
iconVNode = vNode;
|
|
53
53
|
}
|
|
54
54
|
} else {
|
|
55
|
+
if (isStringOrNumberNotEmpty(vNode) || isTextVNode(vNode)) {
|
|
56
|
+
// wrap with span for showing text ellipsis
|
|
57
|
+
vNode = createVNode('span', null, vNode);
|
|
58
|
+
}
|
|
55
59
|
titleVNodes.push(vNode);
|
|
56
60
|
}
|
|
57
61
|
});
|
|
@@ -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
|
```
|
|
@@ -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
|
}
|
|
@@ -363,9 +363,7 @@ export function makeStyles() {
|
|
|
363
363
|
|
|
364
364
|
export function makeGroupMenuStyles() {
|
|
365
365
|
return css`
|
|
366
|
-
max-height: ${table.group.menuMaxHeight};
|
|
367
366
|
min-width: ${table.group.menuMinWidth} !important;
|
|
368
|
-
overflow: auto;
|
|
369
367
|
.k-dropdown-item.k-active {
|
|
370
368
|
color: ${table.group.activeColor};
|
|
371
369
|
}
|
|
@@ -373,6 +371,10 @@ export function makeGroupMenuStyles() {
|
|
|
373
371
|
padding: ${table.group.headerPadding};
|
|
374
372
|
border-bottom: ${table.group.headerBorder};
|
|
375
373
|
}
|
|
374
|
+
.k-table-group-body {
|
|
375
|
+
max-height: ${table.group.menuMaxHeight};
|
|
376
|
+
overflow: auto;
|
|
377
|
+
}
|
|
376
378
|
.k-table-group-footer {
|
|
377
379
|
text-align: right;
|
|
378
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> {
|
|
@@ -151,7 +151,7 @@ const events: Events<TableEvents> = {
|
|
|
151
151
|
uncheckRow: true,
|
|
152
152
|
checkAll: true,
|
|
153
153
|
uncheckAll: true,
|
|
154
|
-
|
|
154
|
+
page: true,
|
|
155
155
|
};
|
|
156
156
|
|
|
157
157
|
export class Table<
|
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;
|
|
@@ -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
|
|
|
@@ -50,7 +50,7 @@ setDefault(function () {
|
|
|
50
50
|
}).form;
|
|
51
51
|
});
|
|
52
52
|
export function makeItemStyles() {
|
|
53
|
-
return /*#__PURE__*/css("display:flex;position:relative;&:not(:last-of-type){margin-bottom:", form.item.gap, ";}&.k-fluid>.k-form-content{flex:1;}.k-form-label{display:flex;align-items:center;justify-content:", form.item.labelTextAlign === 'right' ? 'end' : 'start', ";width:", form.item.labelWidth, ";padding-right:", form.item.labelGap, ";max-height:", form.item.labelHeight, ";}.k-form-star{color:", form.item.starColor, ";margin-right:", form.item.starGap, ";}.k-form-content{position:relative;}.k-form-error{position:absolute;color:", form.item.errorColor, ";font-size:", form.item.errorFontSize, ";left:0;right:0;display:flex;align-items:center;&.k-ellipsis{.k-form-error-more{display:inline-block;}}}.k-form-error-more{line-height:", form.item.errorFontSize, ";display:none;}&.k-invalid{.k-input{.k-input-wrapper{border:", form.item.invalidBorder, ";position:relative;z-index:1;}}.k-select,.k-checkbox-wrapper,.k-radio-wrapper{border:", form.item.invalidBorder, "!important;}.k-select .k-input .k-input-wrapper{border:none;}}.k-form-append{padding:", form.item.appendPadding, ";vertical-align:middle;}");
|
|
53
|
+
return /*#__PURE__*/css("display:flex;position:relative;&:not(:last-of-type){margin-bottom:", form.item.gap, ";}&.k-fluid>.k-form-content{flex:1;}.k-form-label{display:flex;align-items:center;justify-content:", form.item.labelTextAlign === 'right' ? 'end' : 'start', ";width:", form.item.labelWidth, ";padding-right:", form.item.labelGap, ";max-height:", form.item.labelHeight, ";flex-shrink:0;}.k-form-star{color:", form.item.starColor, ";margin-right:", form.item.starGap, ";}.k-form-content{position:relative;}.k-form-error{position:absolute;color:", form.item.errorColor, ";font-size:", form.item.errorFontSize, ";left:0;right:0;display:flex;align-items:center;&.k-ellipsis{.k-form-error-more{display:inline-block;}}}.k-form-error-more{line-height:", form.item.errorFontSize, ";display:none;}&.k-invalid{.k-input{.k-input-wrapper{border:", form.item.invalidBorder, ";position:relative;z-index:1;}}.k-select,.k-checkbox-wrapper,.k-radio-wrapper{border:", form.item.invalidBorder, "!important;}.k-select .k-input .k-input-wrapper{border:none;}}.k-form-append{padding:", form.item.appendPadding, ";vertical-align:middle;}");
|
|
54
54
|
}
|
|
55
55
|
export function makeFormStyles() {
|
|
56
56
|
var _context;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
2
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
-
import { Component, inject } from 'intact';
|
|
3
|
+
import { Component, inject, provide } from 'intact';
|
|
4
4
|
import template from './template.vdt';
|
|
5
|
-
import { LAYOUT, getStyle } from './helpers';
|
|
5
|
+
import { LAYOUT, getStyle, BODY } from './helpers';
|
|
6
6
|
import { addStyle } from '../utils';
|
|
7
7
|
export var Body = /*#__PURE__*/function (_Component) {
|
|
8
8
|
_inheritsLoose(Body, _Component);
|
|
@@ -23,6 +23,10 @@ export var Body = /*#__PURE__*/function (_Component) {
|
|
|
23
23
|
|
|
24
24
|
var _proto = Body.prototype;
|
|
25
25
|
|
|
26
|
+
_proto.init = function init() {
|
|
27
|
+
provide(BODY, this);
|
|
28
|
+
};
|
|
29
|
+
|
|
26
30
|
_proto.getClassNames = function getClassNames() {
|
|
27
31
|
var _ref;
|
|
28
32
|
|
|
@@ -45,6 +49,7 @@ export var Body = /*#__PURE__*/function (_Component) {
|
|
|
45
49
|
|
|
46
50
|
if (!hasFixedAside && !hasFixedHeader) return style;
|
|
47
51
|
return addStyle(style, {
|
|
52
|
+
// FIXME: we must use padding instead of margin, otherwise the table's width is wired
|
|
48
53
|
paddingLeft: hasFixedAside ? getStyle(asideWidth) : null,
|
|
49
54
|
marginTop: hasFixedHeader ? getStyle(headerHeight) : null
|
|
50
55
|
});
|
|
@@ -5,6 +5,8 @@ export interface HeaderProps {
|
|
|
5
5
|
height?: number | string;
|
|
6
6
|
style?: string | Record<string, string>;
|
|
7
7
|
theme?: MenuProps['theme'];
|
|
8
|
+
blur?: boolean;
|
|
9
|
+
boxShadow?: boolean;
|
|
8
10
|
}
|
|
9
11
|
export declare class Header extends Component<HeaderProps> {
|
|
10
12
|
static template: string | import("intact").Template<any>;
|
|
@@ -9,7 +9,9 @@ var typeDefs = {
|
|
|
9
9
|
fixed: Boolean,
|
|
10
10
|
height: [Number, String],
|
|
11
11
|
style: [String, Object],
|
|
12
|
-
theme: themes
|
|
12
|
+
theme: themes,
|
|
13
|
+
blur: Boolean,
|
|
14
|
+
boxShadow: Boolean
|
|
13
15
|
};
|
|
14
16
|
|
|
15
17
|
var defaults = function defaults() {
|
|
@@ -44,11 +46,15 @@ export var Header = /*#__PURE__*/function (_Component) {
|
|
|
44
46
|
var _this$get = this.get(),
|
|
45
47
|
className = _this$get.className,
|
|
46
48
|
fixed = _this$get.fixed,
|
|
47
|
-
theme = _this$get.theme
|
|
49
|
+
theme = _this$get.theme,
|
|
50
|
+
blur = _this$get.blur,
|
|
51
|
+
boxShadow = _this$get.boxShadow;
|
|
48
52
|
|
|
49
53
|
return _ref = {
|
|
50
54
|
'k-layout-header': true,
|
|
51
|
-
'k-fixed': fixed
|
|
55
|
+
'k-fixed': fixed,
|
|
56
|
+
'k-blur': blur,
|
|
57
|
+
'k-box-shadow': boxShadow
|
|
52
58
|
}, _ref["k-" + theme] = true, _ref[className] = className, _ref[makeHeaderStyles()] = true, _ref;
|
|
53
59
|
};
|
|
54
60
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const ROOT_LAYOUT = "RootLayout";
|
|
2
2
|
export declare const LAYOUT = "Layout";
|
|
3
|
+
export declare const BODY = "LayoutBody";
|
|
3
4
|
export declare const defaultHeight = "64px";
|
|
4
5
|
export declare const defaultWidth = "200px";
|
|
5
6
|
export declare function getStyle(height: number | string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
4
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
5
|
+
import { mount, unmount } from '../../test/utils';
|
|
6
|
+
import { Component } from 'intact';
|
|
7
|
+
import { Layout, Header, Aside, Body } from './';
|
|
8
|
+
describe('Layout', function () {
|
|
9
|
+
afterEach(function () {
|
|
10
|
+
unmount();
|
|
11
|
+
});
|
|
12
|
+
it('nest Layout in Body with fixed header', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
13
|
+
var Demo, _mount, instance, element;
|
|
14
|
+
|
|
15
|
+
return _regeneratorRuntime.wrap(function _callee$(_context2) {
|
|
16
|
+
while (1) {
|
|
17
|
+
switch (_context2.prev = _context2.next) {
|
|
18
|
+
case 0:
|
|
19
|
+
Demo = /*#__PURE__*/function (_Component) {
|
|
20
|
+
_inheritsLoose(Demo, _Component);
|
|
21
|
+
|
|
22
|
+
function Demo() {
|
|
23
|
+
var _context;
|
|
24
|
+
|
|
25
|
+
var _this;
|
|
26
|
+
|
|
27
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
28
|
+
args[_key] = arguments[_key];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
32
|
+
_this.Layout = Layout;
|
|
33
|
+
_this.Header = Header;
|
|
34
|
+
_this.Aside = Aside;
|
|
35
|
+
_this.Body = Body;
|
|
36
|
+
return _this;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return Demo;
|
|
40
|
+
}(Component);
|
|
41
|
+
|
|
42
|
+
Demo.template = "\n const { Layout, Header, Aside, Body } = this;\n <Layout>\n <Header fixed />\n <Body>\n <Layout>\n <Aside fixed />\n <Body>body</Body>\n </Layout>\n </Body>\n </Layout>\n ";
|
|
43
|
+
_mount = mount(Demo), instance = _mount[0], element = _mount[1];
|
|
44
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
45
|
+
|
|
46
|
+
case 4:
|
|
47
|
+
case "end":
|
|
48
|
+
return _context2.stop();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}, _callee);
|
|
52
|
+
})));
|
|
53
|
+
});
|
|
@@ -4,7 +4,7 @@ import { Component, inject, provide } from 'intact';
|
|
|
4
4
|
import template from './template.vdt';
|
|
5
5
|
import { makeLayoutStyles } from './styles';
|
|
6
6
|
import { addStyle } from '../utils';
|
|
7
|
-
import { ROOT_LAYOUT, LAYOUT, getStyle } from './helpers';
|
|
7
|
+
import { ROOT_LAYOUT, LAYOUT, getStyle, BODY } from './helpers';
|
|
8
8
|
import { useParse } from './useParse';
|
|
9
9
|
export var Layout = /*#__PURE__*/function (_Component) {
|
|
10
10
|
_inheritsLoose(Layout, _Component);
|
|
@@ -21,6 +21,7 @@ export var Layout = /*#__PURE__*/function (_Component) {
|
|
|
21
21
|
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
22
22
|
_this.parse = useParse();
|
|
23
23
|
_this.layout = inject(LAYOUT, null);
|
|
24
|
+
_this.body = inject(BODY, null);
|
|
24
25
|
return _this;
|
|
25
26
|
}
|
|
26
27
|
|
|
@@ -52,7 +53,7 @@ export var Layout = /*#__PURE__*/function (_Component) {
|
|
|
52
53
|
_proto.getStyles = function getStyles() {
|
|
53
54
|
var style = this.get('style');
|
|
54
55
|
var layout = this.layout;
|
|
55
|
-
if (!layout) return style;
|
|
56
|
+
if (!layout || this.body) return style;
|
|
56
57
|
|
|
57
58
|
var _layout$parse = layout.parse(),
|
|
58
59
|
hasFixedHeader = _layout$parse.hasFixedHeader,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
2
2
|
import { css } from '@emotion/css';
|
|
3
3
|
import { theme, setDefault } from '../../styles/theme';
|
|
4
|
-
import { deepDefaults, getLeft } from '../../styles/utils';
|
|
4
|
+
import { deepDefaults, getLeft, setAlpha } from '../../styles/utils';
|
|
5
5
|
import '../../styles/global';
|
|
6
6
|
import { menu } from '../menu/styles';
|
|
7
7
|
var sizes = ['small', 'large'];
|
|
@@ -21,7 +21,7 @@ var defaults = {
|
|
|
21
21
|
|
|
22
22
|
light: {
|
|
23
23
|
get color() {
|
|
24
|
-
return menu.light.
|
|
24
|
+
return menu.light.item.color;
|
|
25
25
|
},
|
|
26
26
|
|
|
27
27
|
get bgColor() {
|
|
@@ -35,7 +35,7 @@ var defaults = {
|
|
|
35
35
|
},
|
|
36
36
|
white: {
|
|
37
37
|
get color() {
|
|
38
|
-
return menu.white.
|
|
38
|
+
return menu.white.item.color;
|
|
39
39
|
},
|
|
40
40
|
|
|
41
41
|
get bgColor() {
|
|
@@ -68,10 +68,10 @@ export function makeLayoutStyles() {
|
|
|
68
68
|
return /*#__PURE__*/css("display:flex;flex-direction:column;flex:1;transition:padding-left ", layout.transition, ";&.k-has-aside{flex-direction:row;}.k-layout-footer{padding:", layout.footerPadding, ";}.k-layout-body{flex:1;}");
|
|
69
69
|
}
|
|
70
70
|
export function makeHeaderStyles() {
|
|
71
|
-
return /*#__PURE__*/css("display:flex;align-items:center;color:", layout.color, ";background:", layout.bgColor, ";left:0;transition:left ", layout.transition, ";&.k-fixed{position:fixed;left:0;right:0;top:0;z-index:", theme.midZIndex + 1, ";}", _mapInstanceProperty(themes).call(themes, function (theme) {
|
|
71
|
+
return /*#__PURE__*/css("display:flex;align-items:center;color:", layout.color, ";background:", layout.bgColor, ";left:0;transition:left ", layout.transition, ";&.k-fixed{position:fixed;left:0;right:0;top:0;z-index:", theme.midZIndex + 1, ";}>.k-menu{background:transparent!important;}&.k-blur{backdrop-filter:blur(20px);background:", setAlpha(layout.bgColor, 0.1), ";}&.k-box-shadow{border-bottom:none!important;box-shadow:", theme.boxShadow, ";}", _mapInstanceProperty(themes).call(themes, function (theme) {
|
|
72
72
|
if (theme === 'dark') return;
|
|
73
73
|
var styles = layout[theme];
|
|
74
|
-
return /*#__PURE__*/css("&.k-", theme, "{background:", styles.bgColor, ";color:", styles.color, ";border-bottom:", styles.border, ";}");
|
|
74
|
+
return /*#__PURE__*/css("&.k-", theme, "{background:", styles.bgColor, ";color:", styles.color, ";border-bottom:", styles.border, ";&.k-blur{background:", setAlpha(styles.bgColor, 0.1), ";}}");
|
|
75
75
|
}), ";");
|
|
76
76
|
}
|
|
77
77
|
export function makeAsideStyles() {
|
|
@@ -132,9 +132,9 @@ export function makeMenuStyles() {
|
|
|
132
132
|
}
|
|
133
133
|
export function makeTitleStyles() {
|
|
134
134
|
var item = menu.item;
|
|
135
|
-
return /*#__PURE__*/css("display:flex;align-items:center;padding:",
|
|
135
|
+
return /*#__PURE__*/css("display:flex;align-items:center;padding:", item.padding, ";color:", item.color, ";white-space:nowrap;overflow:hidden;flex-wrap:nowrap;");
|
|
136
136
|
}
|
|
137
137
|
export function makeItemStyles() {
|
|
138
138
|
var item = menu.item;
|
|
139
|
-
return /*#__PURE__*/css(".k-menu-title{cursor:pointer;height:", menu.item.height, ";transition:all ", menu.transition, ";&:hover{color:", menu.item.hoverColor, ";}}.k-menu-name{flex:1;display:flex;align-items:center;}.k-menu-arrow{transition:transform ", menu.transition, ";margin-left:", menu.icon.gap, ";}&.k-expanded{>.k-menu-title{color:", menu.item.hoverColor, ";.k-menu-arrow{transform:rotateX(180deg);}}}&.k-highlighted{>.k-menu-title{color:", menu.item.hoverColor, ";}}&.k-active{>.k-menu-title{color:", menu.item.hoverColor, "!important;background:", menu.item.activeBgColor, ";}}&.k-disabled{>.k-menu-title{color:", menu.item.disabledColor, "!important;cursor:not-allowed;}}.k-menu-dot{font-size:", menu.item.dotFontSize, ";transform:scale(.4);}");
|
|
139
|
+
return /*#__PURE__*/css(".k-menu-title{cursor:pointer;height:", menu.item.height, ";transition:all ", menu.transition, ";&:hover{color:", menu.item.hoverColor, ";}}.k-menu-name{flex:1;display:flex;align-items:center;min-width:0;span{overflow:hidden;text-overflow:ellipsis;min-width:0;}}.k-menu-arrow{transition:transform ", menu.transition, ";margin-left:", menu.icon.gap, ";}&.k-expanded{>.k-menu-title{color:", menu.item.hoverColor, ";.k-menu-arrow{transform:rotateX(180deg);}}}&.k-highlighted{>.k-menu-title{color:", menu.item.hoverColor, ";}}&.k-active{>.k-menu-title{color:", menu.item.hoverColor, "!important;background:", menu.item.activeBgColor, ";}}&.k-disabled{>.k-menu-title{color:", menu.item.disabledColor, "!important;cursor:not-allowed;}}.k-menu-dot{font-size:", menu.item.dotFontSize, ";transform:scale(.4);}");
|
|
140
140
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useInstance, onBeforeMount, onBeforeUpdate, inject } from 'intact';
|
|
1
|
+
import { useInstance, onBeforeMount, onBeforeUpdate, inject, createVNode } from 'intact';
|
|
2
2
|
import { Menu } from './';
|
|
3
3
|
import { Icon } from '../icon';
|
|
4
4
|
import { isComponentVNode, eachChildren, isTextVNode, isStringOrNumberNotEmpty } from '../utils';
|
|
@@ -38,6 +38,11 @@ export function useDropdown(rootMenu, parentMenu) {
|
|
|
38
38
|
iconVNode = vNode;
|
|
39
39
|
}
|
|
40
40
|
} else {
|
|
41
|
+
if (isStringOrNumberNotEmpty(vNode) || isTextVNode(vNode)) {
|
|
42
|
+
// wrap with span for showing text ellipsis
|
|
43
|
+
vNode = createVNode('span', null, vNode);
|
|
44
|
+
}
|
|
45
|
+
|
|
41
46
|
titleVNodes.push(vNode);
|
|
42
47
|
}
|
|
43
48
|
});
|
|
@@ -1141,7 +1141,7 @@ describe('Table', function () {
|
|
|
1141
1141
|
table = instance.refs.table;
|
|
1142
1142
|
pagination = table.pagination.paginationRef;
|
|
1143
1143
|
spy = sinon.spy();
|
|
1144
|
-
table.on('
|
|
1144
|
+
table.on('page', spy); // check all
|
|
1145
1145
|
|
|
1146
1146
|
table.checkAll();
|
|
1147
1147
|
expect(table.getCheckedData()).to.have.length(10); // next page
|
|
@@ -3,6 +3,7 @@ import { __decorate } from "tslib";
|
|
|
3
3
|
import { Component } from 'intact';
|
|
4
4
|
import template from './row.vdt';
|
|
5
5
|
import { bind } from '../utils';
|
|
6
|
+
import { isEqualObject } from '../utils';
|
|
6
7
|
export var TableRow = /*#__PURE__*/function (_Component) {
|
|
7
8
|
_inheritsLoose(TableRow, _Component);
|
|
8
9
|
|
|
@@ -21,8 +22,14 @@ export var TableRow = /*#__PURE__*/function (_Component) {
|
|
|
21
22
|
for (key in lastProps) {
|
|
22
23
|
// ignore index
|
|
23
24
|
if (key === 'index') continue;
|
|
25
|
+
var lastValue = lastProps[key];
|
|
26
|
+
var nextValue = nextProps[key]; // deeply compare for offsetMap
|
|
24
27
|
|
|
25
|
-
if (
|
|
28
|
+
if (key === 'offsetMap' && isEqualObject(lastValue, nextValue)) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (lastValue !== nextValue) {
|
|
26
33
|
isSame = false;
|
|
27
34
|
break;
|
|
28
35
|
}
|
|
@@ -107,5 +107,5 @@ export function makeStyles() {
|
|
|
107
107
|
}), ">.k-pagination{margin:16px 0;}");
|
|
108
108
|
}
|
|
109
109
|
export function makeGroupMenuStyles() {
|
|
110
|
-
return /*#__PURE__*/css("
|
|
110
|
+
return /*#__PURE__*/css("min-width:", table.group.menuMinWidth, "!important;.k-dropdown-item.k-active{color:", table.group.activeColor, ";}.k-table-group-header{padding:", table.group.headerPadding, ";border-bottom:", table.group.headerBorder, ";}.k-table-group-body{max-height:", table.group.menuMaxHeight, ";overflow:auto;}.k-table-group-footer{text-align:right;border-top:", table.group.headerBorder, ";padding:8px;.k-btn{margin-left:8px;}}");
|
|
111
111
|
}
|
|
@@ -54,7 +54,7 @@ export interface TableEvents<T = any, K extends TableRowKey = number> {
|
|
|
54
54
|
uncheckRow: [T, number, K];
|
|
55
55
|
checkAll: [];
|
|
56
56
|
uncheckAll: [];
|
|
57
|
-
|
|
57
|
+
page: [PaginationChangeData];
|
|
58
58
|
}
|
|
59
59
|
export interface TableBlocks<T = unknown> {
|
|
60
60
|
empty: null;
|
package/es/components/utils.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export declare function range(start: number, end: number): number[];
|
|
|
24
24
|
export declare function strPad(str: number | string, length: number, pad?: string): string;
|
|
25
25
|
declare type EqualArrayValue = any | EqualArrayValue[];
|
|
26
26
|
export declare function isEqualArray(a: EqualArrayValue, b: EqualArrayValue): boolean;
|
|
27
|
+
export declare function isEqualObject(a: Record<string, any>, b: Record<string, any>): boolean;
|
|
27
28
|
export declare function last<T>(arr: T[]): T | undefined;
|
|
28
29
|
export declare const expandAnimationCallbacks: {
|
|
29
30
|
name: string;
|
package/es/components/utils.js
CHANGED
|
@@ -290,6 +290,22 @@ export function isEqualArray(a, b) {
|
|
|
290
290
|
|
|
291
291
|
return false;
|
|
292
292
|
}
|
|
293
|
+
export function isEqualObject(a, b) {
|
|
294
|
+
if (a === b) return true;
|
|
295
|
+
|
|
296
|
+
if (a && b) {
|
|
297
|
+
var keysA = _Object$keys(a);
|
|
298
|
+
|
|
299
|
+
var keysB = _Object$keys(b);
|
|
300
|
+
|
|
301
|
+
if (keysA.length !== keysB.length) return false;
|
|
302
|
+
return keysA.every(function (key) {
|
|
303
|
+
return a[key] === b[key];
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
293
309
|
export function last(arr) {
|
|
294
310
|
return arr[arr.length - 1];
|
|
295
311
|
}
|
package/es/components/virtual.js
CHANGED
|
@@ -82,14 +82,17 @@ export var Virtual = /*#__PURE__*/function (_Component) {
|
|
|
82
82
|
/* vue2 vnode */
|
|
83
83
|
) {
|
|
84
84
|
var data = vnode.data;
|
|
85
|
-
|
|
85
|
+
if (!data) return props;
|
|
86
|
+
var on = data.on || EMPTY_OBJ;
|
|
86
87
|
var _events = {};
|
|
87
88
|
|
|
88
89
|
for (var _key2 in on) {
|
|
89
90
|
_events["ev-" + _key2] = on[_key2];
|
|
90
91
|
}
|
|
91
92
|
|
|
92
|
-
return _extends({}, props, _events
|
|
93
|
+
return _extends({}, props, _events, {
|
|
94
|
+
className: data.staticClass
|
|
95
|
+
});
|
|
93
96
|
}
|
|
94
97
|
|
|
95
98
|
return props;
|
package/es/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v3.0.
|
|
2
|
+
* @king-design v3.0.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -59,4 +59,4 @@ export * from './components/tree';
|
|
|
59
59
|
export * from './components/treeSelect';
|
|
60
60
|
export * from './components/upload';
|
|
61
61
|
export * from './components/wave';
|
|
62
|
-
export declare const version = "3.0.
|
|
62
|
+
export declare const version = "3.0.1";
|
package/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v3.0.
|
|
2
|
+
* @king-design v3.0.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -61,5 +61,5 @@ export * from './components/tree';
|
|
|
61
61
|
export * from './components/treeSelect';
|
|
62
62
|
export * from './components/upload';
|
|
63
63
|
export * from './components/wave';
|
|
64
|
-
export var version = '3.0.
|
|
64
|
+
export var version = '3.0.1';
|
|
65
65
|
/* generate end */
|
|
@@ -35,11 +35,17 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
35
35
|
return /*#__PURE__*/React.createElement(Layout, {
|
|
36
36
|
className: "layout"
|
|
37
37
|
}, /*#__PURE__*/React.createElement(Header, {
|
|
38
|
-
className: "header"
|
|
38
|
+
className: "header",
|
|
39
|
+
blur: true,
|
|
40
|
+
boxShadow: true,
|
|
41
|
+
theme: "white",
|
|
42
|
+
height: "54px",
|
|
43
|
+
fixed: true
|
|
39
44
|
}, /*#__PURE__*/React.createElement("div", {
|
|
40
45
|
className: "logo"
|
|
41
46
|
}, "LOGO"), /*#__PURE__*/React.createElement(Menu, {
|
|
42
|
-
type: "horizontal"
|
|
47
|
+
type: "horizontal",
|
|
48
|
+
theme: "white"
|
|
43
49
|
}, /*#__PURE__*/React.createElement(MenuItem, {
|
|
44
50
|
key: "1"
|
|
45
51
|
}, "menu 1"), /*#__PURE__*/React.createElement(MenuItem, {
|
|
@@ -63,7 +69,8 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
63
69
|
}, "option 2"))))), /*#__PURE__*/React.createElement(MenuItem, {
|
|
64
70
|
key: "4"
|
|
65
71
|
}, "menu 4"))), /*#__PURE__*/React.createElement(Layout, null, /*#__PURE__*/React.createElement(Aside, {
|
|
66
|
-
theme: "light"
|
|
72
|
+
theme: "light",
|
|
73
|
+
fixed: true
|
|
67
74
|
}, /*#__PURE__*/React.createElement(Menu, {
|
|
68
75
|
expandedKeys: this.state.expandedKeys,
|
|
69
76
|
onChangeExpandedKeys: function onChangeExpandedKeys(expandedKeys) {
|
|
@@ -113,7 +120,9 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
113
120
|
key: "4"
|
|
114
121
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
115
122
|
className: "ion-gear-b"
|
|
116
|
-
}), "menu 4"))), /*#__PURE__*/React.createElement(Body, null, /*#__PURE__*/React.createElement(
|
|
123
|
+
}), "menu 4"))), /*#__PURE__*/React.createElement(Body, null, /*#__PURE__*/React.createElement("div", {
|
|
124
|
+
className: "content"
|
|
125
|
+
}, /*#__PURE__*/React.createElement(Breadcrumb, null, /*#__PURE__*/React.createElement(BreadcrumbItem, null, "Home"), /*#__PURE__*/React.createElement(BreadcrumbItem, null, "Detail")), /*#__PURE__*/React.createElement("div", null, "content"), /*#__PURE__*/React.createElement("div", null, "content"), /*#__PURE__*/React.createElement("div", null, "content"), /*#__PURE__*/React.createElement("div", null, "content"), /*#__PURE__*/React.createElement("div", null, "content"), /*#__PURE__*/React.createElement("div", null, "content"), /*#__PURE__*/React.createElement("div", null, "content"), /*#__PURE__*/React.createElement("div", null, "content"), /*#__PURE__*/React.createElement("div", null, "content"), /*#__PURE__*/React.createElement("div", null, "content"), /*#__PURE__*/React.createElement("div", null, "content"), /*#__PURE__*/React.createElement("div", null, "content"), /*#__PURE__*/React.createElement("div", null, "content"), /*#__PURE__*/React.createElement("div", null, "content"), /*#__PURE__*/React.createElement("div", null, "content"), /*#__PURE__*/React.createElement("div", null, "content"), /*#__PURE__*/React.createElement("div", null, "content")))));
|
|
117
126
|
};
|
|
118
127
|
|
|
119
128
|
return Demo;
|
|
@@ -3,10 +3,11 @@ import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
|
3
3
|
var _context;
|
|
4
4
|
|
|
5
5
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
6
|
+
import { __decorate } from "tslib";
|
|
6
7
|
export { default as data } from './index.json';
|
|
7
8
|
import { Component } from 'intact';
|
|
8
9
|
import template from './index.vdt';
|
|
9
|
-
import { range } from 'kpc/components/utils';
|
|
10
|
+
import { range, bind } from 'kpc/components/utils';
|
|
10
11
|
|
|
11
12
|
var data = _mapInstanceProperty(_context = range(1, 20)).call(_context, function (item) {
|
|
12
13
|
return {
|
|
@@ -28,8 +29,16 @@ var default_1 = /*#__PURE__*/function (_Component) {
|
|
|
28
29
|
};
|
|
29
30
|
};
|
|
30
31
|
|
|
32
|
+
var _proto = default_1.prototype;
|
|
33
|
+
|
|
34
|
+
_proto.onChangePage = function onChangePage(data) {
|
|
35
|
+
console.log(data);
|
|
36
|
+
};
|
|
37
|
+
|
|
31
38
|
return default_1;
|
|
32
39
|
}(Component);
|
|
33
40
|
|
|
34
41
|
default_1.template = template;
|
|
35
|
-
export { default_1 as default };
|
|
42
|
+
export { default_1 as default };
|
|
43
|
+
|
|
44
|
+
__decorate([bind], default_1.prototype, "onChangePage", null);
|
|
@@ -4,9 +4,10 @@ var _context;
|
|
|
4
4
|
|
|
5
5
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
6
6
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
7
|
+
import { __decorate } from "tslib";
|
|
7
8
|
import React from 'react';
|
|
8
9
|
import { Table, TableColumn } from '@king-design/react';
|
|
9
|
-
import { range } from '@king-design/react/components/utils';
|
|
10
|
+
import { range, bind } from '@king-design/react/components/utils';
|
|
10
11
|
|
|
11
12
|
var data = _mapInstanceProperty(_context = range(1, 20)).call(_context, function (item) {
|
|
12
13
|
return {
|
|
@@ -37,6 +38,10 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
37
38
|
|
|
38
39
|
var _proto = Demo.prototype;
|
|
39
40
|
|
|
41
|
+
_proto.onChangePage = function onChangePage(data) {
|
|
42
|
+
console.log(data);
|
|
43
|
+
};
|
|
44
|
+
|
|
40
45
|
_proto.render = function render() {
|
|
41
46
|
var _this2 = this;
|
|
42
47
|
|
|
@@ -49,7 +54,8 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
49
54
|
draggable: true,
|
|
50
55
|
rowKey: function rowKey(item) {
|
|
51
56
|
return item.name;
|
|
52
|
-
}
|
|
57
|
+
},
|
|
58
|
+
onPage: this.onChangePage
|
|
53
59
|
}, /*#__PURE__*/React.createElement(TableColumn, {
|
|
54
60
|
title: "Name",
|
|
55
61
|
key: "name"
|
|
@@ -62,4 +68,6 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
62
68
|
return Demo;
|
|
63
69
|
}(React.Component);
|
|
64
70
|
|
|
65
|
-
export { Demo as default };
|
|
71
|
+
export { Demo as default };
|
|
72
|
+
|
|
73
|
+
__decorate([bind], Demo.prototype, "onChangePage", null);
|
package/es/styles/utils.d.ts
CHANGED
|
@@ -10,5 +10,6 @@ export declare function palette(color: string, level: number): string;
|
|
|
10
10
|
export declare function getLeft(padding: string): string;
|
|
11
11
|
export declare function getRight(padding: string): string;
|
|
12
12
|
export declare function darken(color: string, number: number): string;
|
|
13
|
+
export declare function setAlpha(color: string, number: number): string;
|
|
13
14
|
export declare type Sizes = 'large' | 'default' | 'small' | 'mini';
|
|
14
15
|
export declare const sizes: Sizes[];
|
package/es/styles/utils.js
CHANGED
|
@@ -111,4 +111,7 @@ export function getRight(padding) {
|
|
|
111
111
|
export function darken(color, number) {
|
|
112
112
|
return tinycolor(color).darken(number).toHexString();
|
|
113
113
|
}
|
|
114
|
+
export function setAlpha(color, number) {
|
|
115
|
+
return tinycolor(color).setAlpha(number).toRgbString();
|
|
116
|
+
}
|
|
114
117
|
export var sizes = ['large', 'default', 'small', 'mini'];
|
package/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v3.0.
|
|
2
|
+
* @king-design v3.0.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -64,6 +64,6 @@ export * from './components/treeSelect';
|
|
|
64
64
|
export * from './components/upload';
|
|
65
65
|
export * from './components/wave';
|
|
66
66
|
|
|
67
|
-
export const version = '3.0.
|
|
67
|
+
export const version = '3.0.1';
|
|
68
68
|
|
|
69
69
|
/* generate end */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@king-design/intact",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "A component library written in Intact for Intact, Vue, React and Angular",
|
|
5
5
|
"main": "es/index.js",
|
|
6
6
|
"engines": {
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"highlight.js": "^10.4.1",
|
|
121
121
|
"history": "^5.0.0",
|
|
122
122
|
"html-webpack-plugin": "5.3.1",
|
|
123
|
-
"intact-react": "^3.0.
|
|
123
|
+
"intact-react": "^3.0.21",
|
|
124
124
|
"istanbul-instrumenter-loader": "^3.0.0",
|
|
125
125
|
"js-yaml": "^4.1.0",
|
|
126
126
|
"karma": "^6.3.2",
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
"dependencies": {
|
|
180
180
|
"@babel/runtime-corejs3": "^7.16.0",
|
|
181
181
|
"@emotion/css": "^11.5.0",
|
|
182
|
-
"@king-design/react": "^3.0.
|
|
182
|
+
"@king-design/react": "^3.0.1",
|
|
183
183
|
"dayjs": "^1.10.7",
|
|
184
184
|
"downloadjs": "^1.4.7",
|
|
185
185
|
"enquire.js": "^2.1.6",
|
package/styles/utils.ts
CHANGED
|
@@ -103,5 +103,9 @@ export function darken(color: string, number: number) {
|
|
|
103
103
|
return tinycolor(color).darken(number).toHexString()
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
export function setAlpha(color: string, number: number) {
|
|
107
|
+
return tinycolor(color).setAlpha(number).toRgbString();
|
|
108
|
+
}
|
|
109
|
+
|
|
106
110
|
export type Sizes = 'large' | 'default' | 'small' | 'mini';
|
|
107
|
-
export const sizes: Sizes[] = ['large', 'default', 'small', 'mini'];
|
|
111
|
+
export const sizes: Sizes[] = ['large', 'default', 'small', 'mini'];
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { MenuProps } from '@king-design/react';
|
|
3
|
-
interface Props extends MenuProps {
|
|
4
|
-
}
|
|
5
|
-
export default class Demo extends React.Component<{}, Props> {
|
|
6
|
-
state: MenuProps<import("misstime").Key>;
|
|
7
|
-
private __test;
|
|
8
|
-
setTheme(theme?: string): void;
|
|
9
|
-
render(): JSX.Element;
|
|
10
|
-
}
|
|
11
|
-
export {};
|