@king-design/intact 3.1.0-beta.2 → 3.1.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/cascader/index.vdt +1 -0
- package/components/config/demos/basic.md +19 -0
- package/components/config/index.md +20 -0
- package/components/config/index.ts +8 -4
- package/components/copy/index.spec.ts +28 -0
- package/components/copy/index.ts +2 -0
- package/components/copy/useCopy.ts +3 -1
- package/components/dialog/base.ts +1 -1
- package/components/dialog/base.vdt +2 -2
- package/components/dialog/index.spec.ts +41 -2
- package/components/dialog/styles.ts +1 -0
- package/components/drawer/index.spec.ts +4 -2
- package/components/icon/demos/icons.md +20 -9
- package/components/input/demos/blocks.md +16 -1
- package/components/input/styles.ts +2 -1
- package/components/menu/demos/basic.md +1 -1
- package/components/menu/item.vdt +17 -2
- package/components/menu/menu.ts +4 -0
- package/components/menu/menu.vdt +1 -1
- package/components/menu/styles.ts +19 -15
- package/components/menu/useDropdown.ts +3 -6
- package/components/portal.ts +6 -1
- package/components/table/row.vdt +2 -2
- package/components/table/styles.ts +2 -0
- package/components/table/table.vdt +1 -1
- package/components/tree/demos/draggable.md +63 -48
- package/components/tree/demos/expandAll.md +36 -8
- package/components/tree/index.md +3 -2
- package/components/tree/index.spec.ts +39 -40
- package/components/tree/index.ts +8 -3
- package/components/tree/styles.ts +2 -0
- package/components/tree/useDraggable.ts +5 -5
- package/components/tree/useExpanded.ts +15 -3
- package/components/tree/useNodes.ts +1 -0
- package/components/treeSelect/index.md +7 -1
- package/components/treeSelect/index.ts +4 -0
- package/components/upload/demos/files.md +14 -12
- package/components/upload/index.md +5 -5
- package/components/upload/index.ts +6 -5
- package/components/upload/useFiles.ts +19 -8
- package/es/components/cascader/index.vdt.js +1 -0
- package/es/components/config/index.d.ts +9 -2
- package/es/components/config/index.js +4 -3
- package/es/components/copy/index.d.ts +1 -0
- package/es/components/copy/index.js +2 -1
- package/es/components/copy/index.spec.js +64 -1
- package/es/components/copy/useCopy.d.ts +1 -1
- package/es/components/copy/useCopy.js +3 -1
- package/es/components/dialog/base.js +1 -1
- package/es/components/dialog/base.vdt.js +3 -3
- package/es/components/dialog/index.spec.js +87 -5
- package/es/components/dialog/styles.js +1 -1
- package/es/components/drawer/index.spec.js +6 -4
- package/es/components/input/styles.js +1 -1
- package/es/components/menu/item.vdt.js +22 -2
- package/es/components/menu/menu.d.ts +1 -0
- package/es/components/menu/menu.js +2 -1
- package/es/components/menu/menu.vdt.js +1 -1
- package/es/components/menu/styles.d.ts +1 -0
- package/es/components/menu/styles.js +10 -2
- package/es/components/menu/useDropdown.js +3 -6
- package/es/components/portal.js +7 -1
- package/es/components/table/row.vdt.js +1 -1
- package/es/components/table/styles.js +3 -2
- package/es/components/table/table.vdt.js +1 -1
- package/es/components/tree/index.d.ts +5 -3
- package/es/components/tree/index.js +5 -0
- package/es/components/tree/index.spec.js +60 -39
- package/es/components/tree/styles.js +1 -1
- package/es/components/tree/useDraggable.js +12 -12
- package/es/components/tree/useExpanded.d.ts +1 -0
- package/es/components/tree/useExpanded.js +23 -7
- package/es/components/tree/useNodes.d.ts +1 -0
- package/es/components/treeSelect/index.d.ts +1 -0
- package/es/components/treeSelect/index.js +4 -0
- package/es/components/upload/index.d.ts +6 -5
- package/es/components/upload/index.js +1 -0
- package/es/components/upload/useFiles.js +21 -8
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/site/data/components/config/demos/basic/index.d.ts +5 -0
- package/es/site/data/components/config/demos/basic/index.js +17 -0
- package/es/site/data/components/config/demos/basic/react.d.ts +4 -0
- package/es/site/data/components/config/demos/basic/react.js +29 -0
- package/es/site/data/components/config/index.d.ts +57 -0
- package/es/site/data/components/config/index.js +42 -0
- package/es/site/data/components/icon/demos/icons/index.js +3 -2
- package/es/site/data/components/input/demos/blocks/react.js +11 -1
- package/es/site/data/components/menu/demos/basic/react.js +2 -2
- package/es/site/data/components/tree/demos/draggable/index.d.ts +23 -17
- package/es/site/data/components/tree/demos/draggable/index.js +45 -35
- package/es/site/data/components/tree/demos/draggable/react.d.ts +23 -17
- package/es/site/data/components/tree/demos/draggable/react.js +55 -36
- package/es/site/data/components/tree/demos/expandAll/index.d.ts +9 -1
- package/es/site/data/components/tree/demos/expandAll/index.js +14 -2
- package/es/site/data/components/tree/demos/expandAll/react.d.ts +10 -1
- package/es/site/data/components/tree/demos/expandAll/react.js +24 -5
- package/es/site/data/components/upload/demos/files/index.d.ts +2 -5
- package/es/site/data/components/upload/demos/files/index.js +5 -1
- package/es/site/data/components/upload/demos/files/react.d.ts +2 -5
- package/es/site/data/components/upload/demos/files/react.js +13 -2
- package/es/site/src/pages/document/styles.js +1 -1
- package/index.ts +2 -2
- package/package.json +2 -2
- package/es/site/data/components/icon/demos/icons/react.d.ts +0 -15
- package/es/site/data/components/icon/demos/icons/react.js +0 -107
|
@@ -5,6 +5,7 @@ import {makeMenuStyles, makeFilterMenuStyles} from './styles';
|
|
|
5
5
|
|
|
6
6
|
const {data, trigger, filterable, fields} = this.get();
|
|
7
7
|
const { k } = this.config;
|
|
8
|
+
const baseMenuStyles = makeMenuStyles(k);
|
|
8
9
|
const classNameObj = {
|
|
9
10
|
[`${k}-cascader-menu`]: true,
|
|
10
11
|
[makeMenuStyles(k)]: true,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 改变className前缀
|
|
3
|
+
order: 0
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
通过配置`classNamePrefix`,可以改变样式名className的前缀,组件默认是`k`开头,如: `k-datepicker`
|
|
7
|
+
|
|
8
|
+
> 本例中,我们将前缀设为`kd`,可以打开调试工具查看
|
|
9
|
+
|
|
10
|
+
```vdt
|
|
11
|
+
import {ConfigProvider, Button, Input} from 'kpc';
|
|
12
|
+
|
|
13
|
+
<ConfigProvider value={{classNamePrefix: 'kd'}}>
|
|
14
|
+
<Button>Button</Button>
|
|
15
|
+
<div style="margin-top: 8px;">
|
|
16
|
+
<Input />
|
|
17
|
+
</div>
|
|
18
|
+
</ConfigProvider>
|
|
19
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 全局配置
|
|
3
|
+
category: 组件
|
|
4
|
+
order: 99
|
|
5
|
+
sidebar: doc
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 属性
|
|
9
|
+
|
|
10
|
+
## ConfigProvider
|
|
11
|
+
|
|
12
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
13
|
+
| --- | --- | --- | --- |
|
|
14
|
+
| value | 全局配置参数 | `ConfigProps` | `undefined` |
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
export interface ConfigProps {
|
|
18
|
+
classNamePrefix?: string
|
|
19
|
+
}
|
|
20
|
+
```
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { createContext, ProviderProps } from '../context';
|
|
2
|
-
import { EMPTY_OBJ } from 'intact';
|
|
3
|
-
import {makeIconStyles} from '../../styles/fonts/iconfont';
|
|
2
|
+
import { EMPTY_OBJ, Component } from 'intact';
|
|
4
3
|
|
|
5
4
|
export interface ConfigProps {
|
|
6
5
|
classNamePrefix?: string
|
|
7
6
|
}
|
|
8
7
|
|
|
9
8
|
const {
|
|
10
|
-
Provider
|
|
9
|
+
Provider,
|
|
11
10
|
Consumer: ConfigConsumer,
|
|
12
11
|
useContext,
|
|
13
12
|
} = createContext<ConfigProps>(EMPTY_OBJ);
|
|
@@ -21,8 +20,13 @@ function useConfigContext() {
|
|
|
21
20
|
}
|
|
22
21
|
}
|
|
23
22
|
|
|
23
|
+
/**
|
|
24
|
+
* for vue/react type checking
|
|
25
|
+
*/
|
|
26
|
+
export declare class _ConfigProvider extends Component<ProviderProps<ConfigProps>> { }
|
|
27
|
+
export const ConfigProvider = Provider as typeof _ConfigProvider;
|
|
28
|
+
|
|
24
29
|
export {
|
|
25
|
-
ConfigProvider,
|
|
26
30
|
ConfigConsumer,
|
|
27
31
|
useConfigContext,
|
|
28
32
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import BasicDemo from '~/components/copy/demos/basic';
|
|
2
2
|
import {mount, unmount, dispatchEvent, wait, getElement} from '../../test/utils';
|
|
3
|
+
import { Tooltip } from '../tooltip';
|
|
4
|
+
import { Component } from 'intact';
|
|
5
|
+
import { Copy } from '.';
|
|
3
6
|
|
|
4
7
|
describe('Copy', () => {
|
|
5
8
|
afterEach(async () => {
|
|
@@ -18,4 +21,29 @@ describe('Copy', () => {
|
|
|
18
21
|
console.log(e);
|
|
19
22
|
}
|
|
20
23
|
});
|
|
24
|
+
|
|
25
|
+
it('wrap copy with tooltip', async () => {
|
|
26
|
+
class Demo extends Component {
|
|
27
|
+
static template = `
|
|
28
|
+
const { Tooltip, Copy } = this;
|
|
29
|
+
<Tooltip content="test">
|
|
30
|
+
<Copy text="test" />
|
|
31
|
+
</Tooltip>
|
|
32
|
+
`;
|
|
33
|
+
Tooltip = Tooltip;
|
|
34
|
+
Copy = Copy;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const [instance, element] = mount(Demo);
|
|
38
|
+
|
|
39
|
+
element.click();
|
|
40
|
+
await wait();
|
|
41
|
+
try {
|
|
42
|
+
const text = await navigator.clipboard.readText();
|
|
43
|
+
expect(text).to.eql('test');
|
|
44
|
+
} catch (e) {
|
|
45
|
+
// Read permisson denied
|
|
46
|
+
console.log(e);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
21
49
|
});
|
package/components/copy/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface CopyProps {
|
|
|
12
12
|
export interface CopyEvents {
|
|
13
13
|
success: [string]
|
|
14
14
|
error: []
|
|
15
|
+
click: [MouseEvent]
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
const typeDefs: Required<TypeDefs<CopyProps>> = {
|
|
@@ -26,6 +27,7 @@ const defaults = (): Partial<CopyProps> => ({
|
|
|
26
27
|
const events: Events<CopyEvents> = {
|
|
27
28
|
success: true,
|
|
28
29
|
error: true,
|
|
30
|
+
click: true,
|
|
29
31
|
};
|
|
30
32
|
|
|
31
33
|
export class Copy extends Component<CopyProps, CopyEvents> {
|
|
@@ -11,7 +11,7 @@ export function useCopy() {
|
|
|
11
11
|
let timer: number;
|
|
12
12
|
|
|
13
13
|
return {
|
|
14
|
-
startCopy: () => {
|
|
14
|
+
startCopy: (e: MouseEvent) => {
|
|
15
15
|
const { text, showMessage } = instance.get();
|
|
16
16
|
|
|
17
17
|
if (clipboardCopy(text) || commandCopy(text)) {
|
|
@@ -27,6 +27,8 @@ export function useCopy() {
|
|
|
27
27
|
success.set(false);
|
|
28
28
|
instance.trigger('error');
|
|
29
29
|
}
|
|
30
|
+
|
|
31
|
+
instance.trigger('click', e);
|
|
30
32
|
},
|
|
31
33
|
success,
|
|
32
34
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Component} from 'intact';
|
|
2
2
|
import {Dialog, BaseDialog, DialogProps} from './';
|
|
3
3
|
import {bind} from '../utils';
|
|
4
|
-
import {getElement, mount, unmount, dispatchEvent, wait} from '../../test/utils';
|
|
4
|
+
import {getElement, mount, unmount, dispatchEvent, wait, getElements} from '../../test/utils';
|
|
5
5
|
import BasicDemo from '~/components/dialog/demos/basic';
|
|
6
6
|
import AsyncCloseDemo from '~/components/dialog/demos/asyncClose';
|
|
7
7
|
import TerminateDemo from '~/components/dialog/demos/terminate';
|
|
@@ -295,7 +295,46 @@ describe('Dialog', () => {
|
|
|
295
295
|
instance.refs.dialog.close();
|
|
296
296
|
|
|
297
297
|
await wait();
|
|
298
|
-
|
|
298
|
+
const style = document.body.getAttribute('style');
|
|
299
|
+
expect(style === null || style === '').to.be.true;
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
it('show nested dialog', async () => {
|
|
303
|
+
class Test extends Component {
|
|
304
|
+
static template = `
|
|
305
|
+
const { Dialog } = this;
|
|
306
|
+
<Dialog v-model="value">test</Dialog>
|
|
307
|
+
`
|
|
308
|
+
Dialog = Dialog;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
class Demo extends Component<{show: boolean, testShow: boolean}> {
|
|
312
|
+
static template = `
|
|
313
|
+
const { Test, Dialog } = this;
|
|
314
|
+
<Dialog v-model="show">
|
|
315
|
+
<div ev-click={this.showTest}>click</div>
|
|
316
|
+
<Test v-model="testShow" />
|
|
317
|
+
</Dialog>
|
|
318
|
+
`
|
|
319
|
+
Test = Test;
|
|
320
|
+
Dialog = Dialog;
|
|
321
|
+
|
|
322
|
+
@bind
|
|
323
|
+
showTest() {
|
|
324
|
+
this.set('testShow', true);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
const [instance, element] = mount(Demo);
|
|
329
|
+
|
|
330
|
+
instance.set('show', true);
|
|
331
|
+
await wait();
|
|
332
|
+
|
|
333
|
+
instance.showTest();
|
|
334
|
+
await wait();
|
|
335
|
+
|
|
336
|
+
const [dialog1, dialog2] = getElements('.k-dialog');
|
|
337
|
+
expect(dialog2.querySelector('.k-dialog-body')!.textContent).to.eql('test');
|
|
299
338
|
});
|
|
300
339
|
|
|
301
340
|
// it('should handle v-if and v-model at the same time correctly in Vue', async () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import BasicDemo from '~/components/drawer/demos/basic';
|
|
2
2
|
import PlacementDemo from '~/components/drawer/demos/placement';
|
|
3
3
|
import overlayDemo from '~/components/drawer/demos/overlay';
|
|
4
|
-
import {mount, unmount, dispatchEvent, getElement, wait} from '../../test/utils';
|
|
4
|
+
import {mount, unmount, dispatchEvent, getElement, wait, getElements} from '../../test/utils';
|
|
5
5
|
import {Component} from 'intact';
|
|
6
6
|
import {Drawer} from '.';
|
|
7
7
|
import {Dialog} from '../dialog';
|
|
@@ -85,6 +85,8 @@ describe('Drawer', () => {
|
|
|
85
85
|
const [instance, element] = mount(Demo);
|
|
86
86
|
|
|
87
87
|
await wait();
|
|
88
|
-
expect(instance.refs.dialog.dialogRef.value.parentElement.parentElement).to.eql(document.body);
|
|
88
|
+
// expect(instance.refs.dialog.dialogRef.value.parentElement.parentElement).to.eql(document.body);
|
|
89
|
+
const [dialog1, dialog2] = getElements('.k-dialog');
|
|
90
|
+
expect(dialog2.querySelector('.k-dialog-body')!.textContent).to.eql('Dialog');
|
|
89
91
|
});
|
|
90
92
|
});
|
|
@@ -6,18 +6,20 @@ order: 3
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
```vdt
|
|
9
|
-
import {Icon, Input} from 'kpc';
|
|
9
|
+
import {Icon, Input, Copy} from 'kpc';
|
|
10
10
|
|
|
11
11
|
<div>
|
|
12
12
|
<Input v-model="keywords" placeholder="Search icon" clearable />
|
|
13
13
|
<div class="icons">
|
|
14
|
-
<
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
<Copy v-for={this.filter()} text={this.config.k + '-icon-' + $value[0]}>
|
|
15
|
+
<div class="icon">
|
|
16
|
+
<Icon
|
|
17
|
+
class={this.config.k + '-icon-' + $value[0]}
|
|
18
|
+
size="large"
|
|
19
|
+
/>
|
|
20
|
+
<div>{this.config.k + '-icon-' + $value[0]}</div>
|
|
21
|
+
</div>
|
|
22
|
+
</Copy>
|
|
21
23
|
</div>
|
|
22
24
|
</div>
|
|
23
25
|
```
|
|
@@ -158,8 +160,17 @@ export default class extends Component<Props> {
|
|
|
158
160
|
if (!keywords) return fonts;
|
|
159
161
|
|
|
160
162
|
return fonts.filter((font) => {
|
|
161
|
-
return font[0]
|
|
163
|
+
return `${this.config.k}-icon-${font[0]}`.includes(keywords) ||
|
|
164
|
+
font[1] && font[1].includes(keywords);
|
|
162
165
|
});
|
|
163
166
|
}
|
|
164
167
|
}
|
|
165
168
|
```
|
|
169
|
+
|
|
170
|
+
```vue-ignore
|
|
171
|
+
该示例无展示代码
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
```react-ignore
|
|
175
|
+
该示例无展示代码
|
|
176
|
+
```
|
|
@@ -6,7 +6,7 @@ order: 1
|
|
|
6
6
|
使用`append`,`prepend`,`suffix`,`prefix`扩展点,可以往组件追加内容
|
|
7
7
|
|
|
8
8
|
```vdt
|
|
9
|
-
import {Input, Button, Icon} from 'kpc';
|
|
9
|
+
import {Input, Button, Icon, ButtonGroup} from 'kpc';
|
|
10
10
|
|
|
11
11
|
<div>
|
|
12
12
|
<Input placeholder="please enter">
|
|
@@ -22,6 +22,21 @@ import {Input, Button, Icon} from 'kpc';
|
|
|
22
22
|
</b:append>
|
|
23
23
|
</Input>
|
|
24
24
|
<br />
|
|
25
|
+
<Input placeholder="please enter">
|
|
26
|
+
<b:append>
|
|
27
|
+
<Button>提交</Button>
|
|
28
|
+
</b:append>
|
|
29
|
+
</Input>
|
|
30
|
+
<br />
|
|
31
|
+
<Input placeholder="please enter">
|
|
32
|
+
<b:append>
|
|
33
|
+
<ButtonGroup>
|
|
34
|
+
<Button type="primary">提交</Button>
|
|
35
|
+
<Button type="primary">创建</Button>
|
|
36
|
+
</ButtonGroup>
|
|
37
|
+
</b:append>
|
|
38
|
+
</Input>
|
|
39
|
+
<br />
|
|
25
40
|
<Input placeholder="please enter">
|
|
26
41
|
<b:append>
|
|
27
42
|
<Button icon type="primary">
|
|
@@ -167,6 +167,7 @@ export function makeStyles(k: string) {
|
|
|
167
167
|
display: inline-flex;
|
|
168
168
|
.${k}-input-wrapper {
|
|
169
169
|
border-radius: 0;
|
|
170
|
+
flex: 1;
|
|
170
171
|
}
|
|
171
172
|
.${k}-input-wrapper:first-child {
|
|
172
173
|
border-radius: ${input.borderRadius} 0 0 ${input.borderRadius};
|
|
@@ -184,7 +185,7 @@ export function makeStyles(k: string) {
|
|
|
184
185
|
white-space: nowrap;
|
|
185
186
|
.${k}-btn {
|
|
186
187
|
margin: -1px;
|
|
187
|
-
border: none;
|
|
188
|
+
// border: none;
|
|
188
189
|
&.${k}-none:hover {
|
|
189
190
|
background: transparent;
|
|
190
191
|
}
|
|
@@ -26,7 +26,7 @@ import {Menu, MenuItem, Icon} from 'kpc';
|
|
|
26
26
|
</MenuItem>
|
|
27
27
|
<MenuItem key="2" disabled><Icon class="ion-star" />menu 2</MenuItem>
|
|
28
28
|
<MenuItem key="3">
|
|
29
|
-
<
|
|
29
|
+
<Icon class="ion-heart" />menu 3
|
|
30
30
|
<Menu>
|
|
31
31
|
<MenuItem key="3-1">sub menu 1</MenuItem>
|
|
32
32
|
<MenuItem key="3-2">sub menu 2</MenuItem>
|
package/components/menu/item.vdt
CHANGED
|
@@ -5,7 +5,7 @@ import {Icon} from '../icon';
|
|
|
5
5
|
import {Menu} from './menu';
|
|
6
6
|
import {getRestProps, expandAnimationCallbacks} from '../utils';
|
|
7
7
|
import {isNullOrUndefined} from 'intact-shared';
|
|
8
|
-
import {makeItemStyles, makeTitleStyles} from './styles';
|
|
8
|
+
import {makeItemStyles, makeTitleStyles, makeNestedMenuStyles} from './styles';
|
|
9
9
|
|
|
10
10
|
const rootMenu = this.rootMenu;
|
|
11
11
|
const {theme, type, dot: rootDot} = rootMenu.get();
|
|
@@ -18,6 +18,7 @@ const {
|
|
|
18
18
|
tooltipContents, iconVNode, titleVNodes,
|
|
19
19
|
position, isCollapse,
|
|
20
20
|
} = this.dropdown();
|
|
21
|
+
|
|
21
22
|
const { k } = this.config;
|
|
22
23
|
const classNameObj = {
|
|
23
24
|
[`${k}-menu-item`]: true,
|
|
@@ -48,7 +49,21 @@ const title = (children) => (
|
|
|
48
49
|
key="subMenu"
|
|
49
50
|
{...expandAnimationCallbacks}
|
|
50
51
|
>
|
|
51
|
-
{
|
|
52
|
+
{(() => {
|
|
53
|
+
if (subMenuVNode) {
|
|
54
|
+
const paddingLeft = this.parentMenu.get('_paddingLeft');
|
|
55
|
+
const [_classname, _paddingLeft] = makeNestedMenuStyles(k, showDot || !!iconVNode, paddingLeft);
|
|
56
|
+
const className = _$cn({
|
|
57
|
+
[_classname]: true,
|
|
58
|
+
[subMenuVNode.className]: subMenuVNode.className,
|
|
59
|
+
});
|
|
60
|
+
const clonedVNode = directClone(subMenuVNode);
|
|
61
|
+
clonedVNode.props = { ...clonedVNode.props, className, _paddingLeft };
|
|
62
|
+
clonedVNode.className = className;
|
|
63
|
+
|
|
64
|
+
return clonedVNode;
|
|
65
|
+
}
|
|
66
|
+
})()}
|
|
52
67
|
</Transition>
|
|
53
68
|
</template>
|
|
54
69
|
|
package/components/menu/menu.ts
CHANGED
|
@@ -12,6 +12,8 @@ export interface MenuProps<K extends Key = Key> {
|
|
|
12
12
|
size?: 'large' | 'default' | 'small'
|
|
13
13
|
accordion?: boolean
|
|
14
14
|
dot?: boolean
|
|
15
|
+
|
|
16
|
+
_paddingLeft?: string
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
export interface MenuEvents { }
|
|
@@ -29,6 +31,8 @@ const typeDefs: Required<TypeDefs<MenuProps>> = {
|
|
|
29
31
|
size: ['large', 'default', 'small'],
|
|
30
32
|
accordion: Boolean,
|
|
31
33
|
dot: Boolean,
|
|
34
|
+
|
|
35
|
+
_paddingLeft: String,
|
|
32
36
|
};
|
|
33
37
|
|
|
34
38
|
const defaults = (): Partial<MenuProps> => ({
|
package/components/menu/menu.vdt
CHANGED
|
@@ -96,20 +96,6 @@ export function makeMenuStyles(k: string) {
|
|
|
96
96
|
font-size: ${menu.fontSize};
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
// nested menu
|
|
100
|
-
&:not(.${k}-dropdown-menu) &:not(.${k}-dropdown-menu) {
|
|
101
|
-
width: auto;
|
|
102
|
-
background: ${menu.subBgColor};
|
|
103
|
-
.${k}-menu-title {
|
|
104
|
-
padding-left: calc(${getLeft(menu.item.padding)} + ${menu.icon.width} + ${menu.icon.gap});
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
&:not(.${k}-dropdown-menu) &:not(.${k}-dropdown-menu) &:not(.${k}-dropdown-menu) {
|
|
108
|
-
.${k}-menu-title {
|
|
109
|
-
padding-left: calc(${getLeft(menu.item.padding)} + ${menu.icon.width} * 2 + ${menu.icon.gap});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
99
|
.${k}-icon {
|
|
114
100
|
width: ${menu.icon.width};
|
|
115
101
|
margin-right: ${menu.icon.gap};
|
|
@@ -244,7 +230,6 @@ export function makeItemStyles(k: string) {
|
|
|
244
230
|
.${k}-menu-title {
|
|
245
231
|
cursor: pointer;
|
|
246
232
|
height: ${menu.item.height};
|
|
247
|
-
transition: all ${menu.transition};
|
|
248
233
|
&:hover {
|
|
249
234
|
color: ${menu.item.hoverColor};
|
|
250
235
|
}
|
|
@@ -259,6 +244,9 @@ export function makeItemStyles(k: string) {
|
|
|
259
244
|
text-overflow: ellipsis;
|
|
260
245
|
min-width: 0;
|
|
261
246
|
}
|
|
247
|
+
.${k}-icon {
|
|
248
|
+
color: inherit;
|
|
249
|
+
}
|
|
262
250
|
}
|
|
263
251
|
.${k}-menu-arrow {
|
|
264
252
|
transition: transform ${menu.transition};
|
|
@@ -305,3 +293,19 @@ export function makeItemStyles(k: string) {
|
|
|
305
293
|
}
|
|
306
294
|
`
|
|
307
295
|
}
|
|
296
|
+
|
|
297
|
+
export function makeNestedMenuStyles(k: string, hasIcon: boolean, parentPaddingLeft: string = getLeft(menu.item.padding)) {
|
|
298
|
+
const paddingLeft = `${parentPaddingLeft}${hasIcon ? ' + ' + menu.icon.width : ''} + ${menu.icon.gap}`;
|
|
299
|
+
return [
|
|
300
|
+
css`
|
|
301
|
+
&.${k}-menu {
|
|
302
|
+
width: auto;
|
|
303
|
+
background: ${menu.subBgColor};
|
|
304
|
+
.${k}-menu-title {
|
|
305
|
+
padding-left: calc(${paddingLeft});
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
`,
|
|
309
|
+
paddingLeft,
|
|
310
|
+
]
|
|
311
|
+
}
|
|
@@ -45,16 +45,13 @@ export function useDropdown(rootMenu: Menu, parentMenu: Menu) {
|
|
|
45
45
|
eachChildren(children, vNode => {
|
|
46
46
|
if (isComponentVNode(vNode, Menu)) {
|
|
47
47
|
subMenuVNode = vNode;
|
|
48
|
-
} else if (isTopItem && isCollapse) {
|
|
49
|
-
if (isStringOrNumberNotEmpty(vNode) || isTextVNode(vNode)) {
|
|
50
|
-
tooltipContents.push(vNode);
|
|
51
|
-
} else if (!iconVNode && isComponentVNode(vNode, Icon)) {
|
|
52
|
-
iconVNode = vNode;
|
|
53
|
-
}
|
|
54
48
|
} else {
|
|
55
49
|
if (isStringOrNumberNotEmpty(vNode) || isTextVNode(vNode)) {
|
|
56
50
|
// wrap with span for showing text ellipsis
|
|
57
51
|
vNode = createVNode('span', null, vNode);
|
|
52
|
+
tooltipContents.push(vNode);
|
|
53
|
+
} else if (!iconVNode && isComponentVNode(vNode, Icon)) {
|
|
54
|
+
iconVNode = vNode;
|
|
58
55
|
}
|
|
59
56
|
titleVNodes.push(vNode);
|
|
60
57
|
}
|
package/components/portal.ts
CHANGED
|
@@ -146,7 +146,12 @@ export class Portal<T extends PortalProps = PortalProps> extends Component<T> {
|
|
|
146
146
|
if (!this.container) {
|
|
147
147
|
if (this.$senior instanceof BaseDialog) {
|
|
148
148
|
// Dialog and Drawer must be inserted into document.body
|
|
149
|
-
this.container = document.body;
|
|
149
|
+
// this.container = document.body;
|
|
150
|
+
/**
|
|
151
|
+
* @Modify https://github.com/ksc-fe/kpc/issues/915
|
|
152
|
+
* shoud insert to parent .k-dialog-wrapper to show nested dialog in Vue
|
|
153
|
+
*/
|
|
154
|
+
this.container = parentDom.closest(`.${this.config.k}-dialog-wrapper`) || document.body;
|
|
150
155
|
} else {
|
|
151
156
|
// find the closest dialog if exists
|
|
152
157
|
this.container = parentDom.closest(`.${this.config.k}-dialog`) || document.body;
|
package/components/table/row.vdt
CHANGED
|
@@ -39,8 +39,8 @@ const pushCheckTypeVNode = (children) => {
|
|
|
39
39
|
<td key="$checktype"
|
|
40
40
|
{...getClassAndStyleForFixed({
|
|
41
41
|
fixed: hasFixedLeft ? 'left' : false,
|
|
42
|
-
className: [`${k}-table-check`]
|
|
43
|
-
}, 0)}
|
|
42
|
+
className: [`${k}-table-check`],
|
|
43
|
+
}, 0, k)}
|
|
44
44
|
{...spans}
|
|
45
45
|
>{children}</td>
|
|
46
46
|
)
|
|
@@ -60,6 +60,7 @@ const defaults = {
|
|
|
60
60
|
// tree
|
|
61
61
|
arrow: {
|
|
62
62
|
gap: `4px`,
|
|
63
|
+
width: `16px`,
|
|
63
64
|
},
|
|
64
65
|
|
|
65
66
|
resizeWidth: `5px`,
|
|
@@ -311,6 +312,7 @@ export function makeStyles(k: string) {
|
|
|
311
312
|
// display: none;
|
|
312
313
|
// }
|
|
313
314
|
.${k}-table-arrow {
|
|
315
|
+
width: ${table.arrow.width} !important;
|
|
314
316
|
margin-right: ${table.arrow.gap};
|
|
315
317
|
transition: transform ${table.transition};
|
|
316
318
|
position: relative;
|