@king-design/intact 3.1.2 → 3.1.4-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/button/demos/disabled.md +2 -2
- package/components/button/demos/ghost.md +3 -3
- package/components/button/demos/group.md +3 -3
- package/components/button/index.vdt +1 -1
- package/components/button/styles.ts +19 -0
- package/components/collapse/item.vdt +1 -1
- package/components/collapse/styles.ts +9 -8
- package/components/config/demos/basic.md +17 -1
- package/components/dialog/index.spec.ts +30 -0
- package/components/dialog/usePosition.ts +4 -0
- package/components/dropdown/usePosition.ts +19 -9
- package/components/editable/styles.ts +1 -1
- package/components/message/message.ts +10 -6
- package/components/message/message.vdt +1 -1
- package/components/message/messages.ts +10 -1
- package/components/message/messages.vdt +11 -8
- package/components/portal.ts +16 -3
- package/components/upload/useFiles.ts +3 -2
- package/es/components/button/index.vdt.js +1 -1
- package/es/components/button/styles.js +3 -3
- package/es/components/collapse/item.vdt.js +3 -3
- package/es/components/collapse/styles.js +4 -4
- package/es/components/diagram/index.d.ts +1 -1
- package/es/components/dialog/index.spec.js +61 -1
- package/es/components/dialog/usePosition.js +7 -0
- package/es/components/dropdown/usePosition.js +14 -11
- package/es/components/editable/styles.js +1 -1
- package/es/components/message/message.d.ts +1 -0
- package/es/components/message/message.js +12 -10
- package/es/components/message/message.vdt.js +2 -1
- package/es/components/message/messages.d.ts +5 -1
- package/es/components/message/messages.js +5 -1
- package/es/components/message/messages.vdt.js +13 -7
- package/es/components/portal.js +15 -3
- package/es/components/steps/context.d.ts +3 -3
- package/es/components/upload/useFiles.js +3 -2
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/packages/kpc-react/__tests__/components/cascader.spec.js +0 -1
- package/es/site/data/components/button/demos/disabled/react.js +3 -3
- package/es/site/data/components/button/demos/ghost/react.js +7 -3
- package/es/site/data/components/button/demos/group/react.js +5 -5
- package/es/site/data/components/config/demos/basic/index.d.ts +1 -0
- package/es/site/data/components/config/demos/basic/index.js +8 -0
- package/es/site/data/components/config/demos/basic/react.d.ts +1 -0
- package/es/site/data/components/config/demos/basic/react.js +9 -1
- package/es/site/data/components/menu/demos/collapse/react.d.ts +11 -0
- package/es/site/data/components/menu/demos/size/react.d.ts +7 -0
- package/es/styles/global.js +7 -2
- package/index.ts +2 -2
- package/package.json +4 -4
- package/styles/global.ts +28 -18
- package/es/components/cascader/index.d.ts +0 -45
- package/es/components/datepicker/index.d.ts +0 -63
- package/es/components/select/select.d.ts +0 -33
- package/es/components/timepicker/panelPicker.d.ts +0 -54
- package/es/components/treeSelect/index.d.ts +0 -28
|
@@ -6,12 +6,12 @@ order: 5
|
|
|
6
6
|
添加`disabled`属性,可以禁用按钮
|
|
7
7
|
|
|
8
8
|
```vdt
|
|
9
|
-
import {Button} from 'kpc';
|
|
9
|
+
import {Button, Icon} from 'kpc';
|
|
10
10
|
|
|
11
11
|
<div>
|
|
12
12
|
<Button disabled>disabled</Button>
|
|
13
13
|
<Button disabled type="none">disabled text</Button>
|
|
14
|
-
<Button disabled icon circle><
|
|
14
|
+
<Button disabled icon circle><Icon class="k-icon-search" /></Button>
|
|
15
15
|
<Button disabled type="link">link</Button>
|
|
16
16
|
<Button disabled type="flat">flat</Button>
|
|
17
17
|
</div>
|
|
@@ -6,11 +6,11 @@ order: 6
|
|
|
6
6
|
给组件添加`ghost`属性,可以展示透明背景的按钮,常用于深色背景下
|
|
7
7
|
|
|
8
8
|
```vdt
|
|
9
|
-
import {Button} from 'kpc';
|
|
9
|
+
import {Button, Icon} from 'kpc';
|
|
10
10
|
|
|
11
11
|
<div class="wrapper">
|
|
12
|
-
<Button ghost
|
|
13
|
-
<Button type="primary" ghost>primay
|
|
12
|
+
<Button ghost><Icon class="k-icon-left" />default</Button>
|
|
13
|
+
<Button type="primary" ghost>primay<Icon class="k-icon-right" /></Button>
|
|
14
14
|
<Button type="warning" ghost>warning</Button>
|
|
15
15
|
<Button type="danger" ghost>danger</Button>
|
|
16
16
|
<Button type="success" ghost>success</Button>
|
|
@@ -7,7 +7,7 @@ order: 1
|
|
|
7
7
|
可以是按钮组纵向排列。给`ButtonGroup`添加`checkType`属性,可以使按钮组拥有单选或复选能力。
|
|
8
8
|
|
|
9
9
|
```vdt
|
|
10
|
-
import {Button, ButtonGroup} from 'kpc';
|
|
10
|
+
import {Button, ButtonGroup, Icon} from 'kpc';
|
|
11
11
|
|
|
12
12
|
<div>
|
|
13
13
|
<ButtonGroup>
|
|
@@ -27,10 +27,10 @@ import {Button, ButtonGroup} from 'kpc';
|
|
|
27
27
|
</ButtonGroup>
|
|
28
28
|
<ButtonGroup>
|
|
29
29
|
<Button type="primary">
|
|
30
|
-
<
|
|
30
|
+
<Icon class="k-icon-left" />上一页
|
|
31
31
|
</Button>
|
|
32
32
|
<Button type="primary">
|
|
33
|
-
下一页<
|
|
33
|
+
下一页<Icon class="k-icon-right" />
|
|
34
34
|
</Button>
|
|
35
35
|
</ButtonGroup>
|
|
36
36
|
<br /><br />
|
|
@@ -41,8 +41,8 @@ if (!icon && Array.isArray(children)) {
|
|
|
41
41
|
|
|
42
42
|
const classNameObj = {
|
|
43
43
|
[cls('btn')]: true,
|
|
44
|
-
[cls(type)]: type !== 'default',
|
|
45
44
|
[cls(size)]: size !== 'default',
|
|
45
|
+
[cls(type)]: true,
|
|
46
46
|
[cls(`btn-icon`)]: icon,
|
|
47
47
|
[className]: className,
|
|
48
48
|
[cls('circle')]: circle,
|
|
@@ -182,6 +182,19 @@ export const makeButtonStyles = cache(function makeButtonStyles(k: string, iconS
|
|
|
182
182
|
.${k}-icon {
|
|
183
183
|
color: inherit;
|
|
184
184
|
}
|
|
185
|
+
&.${k}-default,
|
|
186
|
+
&.${k}-none,
|
|
187
|
+
&.${k}-flat {
|
|
188
|
+
.${k}-icon {
|
|
189
|
+
color: ${theme.color.lightBlack};
|
|
190
|
+
}
|
|
191
|
+
&:hover {
|
|
192
|
+
.${k}-icon {
|
|
193
|
+
color: inherit;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
185
198
|
&:hover,
|
|
186
199
|
&:focus {
|
|
187
200
|
border-color: ${button.hoverBorderColor};
|
|
@@ -262,6 +275,9 @@ export const makeButtonStyles = cache(function makeButtonStyles(k: string, iconS
|
|
|
262
275
|
|
|
263
276
|
// disabled
|
|
264
277
|
&.${k}-disabled {
|
|
278
|
+
.${k}-icon {
|
|
279
|
+
color: inherit;
|
|
280
|
+
}
|
|
265
281
|
&, &:hover {
|
|
266
282
|
color: ${button.disabled.color};
|
|
267
283
|
background: ${button.disabled.bgColor};
|
|
@@ -347,6 +363,9 @@ export const makeButtonStyles = cache(function makeButtonStyles(k: string, iconS
|
|
|
347
363
|
background: transparent;
|
|
348
364
|
color: ${button.ghost.color};
|
|
349
365
|
border-color: ${button.ghost.borderColor};
|
|
366
|
+
.${k}-icon {
|
|
367
|
+
color: inherit;
|
|
368
|
+
}
|
|
350
369
|
&:hover,
|
|
351
370
|
&:active {
|
|
352
371
|
background: transparent;
|
|
@@ -21,7 +21,7 @@ const classNameObj = {
|
|
|
21
21
|
|
|
22
22
|
<div class={classNameObj} {...getRestProps(this)}>
|
|
23
23
|
<div class={`${k}-collapse-title`} ev-click={this.toggle}>
|
|
24
|
-
<b:title>{title}</b:title>
|
|
24
|
+
<div class={`${k}-collapse-title-wrapper`}><b:title>{title}</b:title></div>
|
|
25
25
|
<Icon
|
|
26
26
|
class={{[`${k}-collapse-arrow`]: true, [`${k}-icon-right`]: true}}
|
|
27
27
|
hoverable
|
|
@@ -7,7 +7,6 @@ import { cache } from '../utils';
|
|
|
7
7
|
const defaults = {
|
|
8
8
|
get transition() { return theme.transition.large },
|
|
9
9
|
fontSize: '12px',
|
|
10
|
-
titleMarginRight: '8px',
|
|
11
10
|
borderPadding: '0 24px',
|
|
12
11
|
collBorder: '1px solid #eee',
|
|
13
12
|
get borderRadius() {
|
|
@@ -17,6 +16,7 @@ const defaults = {
|
|
|
17
16
|
item: {
|
|
18
17
|
borderBottom: '1px solid #e5e5e5',
|
|
19
18
|
titleHeight: '40px',
|
|
19
|
+
titleGap: '8px',
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
|
|
@@ -32,9 +32,8 @@ export const makeStyles = cache(function makeStyles(k: string) {
|
|
|
32
32
|
font-size: ${collapse.fontSize};
|
|
33
33
|
|
|
34
34
|
&.${k}-left {
|
|
35
|
-
.${k}-collapse-
|
|
36
|
-
|
|
37
|
-
margin-right: ${collapse.titleMarginRight};
|
|
35
|
+
> .${k}-collapse-item > .${k}-collapse-title {
|
|
36
|
+
flex-direction: row-reverse;
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
|
|
@@ -58,13 +57,15 @@ export const makeItemStyles = cache(function makeItemStyles(k: string) {
|
|
|
58
57
|
cursor: pointer;
|
|
59
58
|
font-weight: bold;
|
|
60
59
|
height: ${collapseItem.titleHeight};
|
|
61
|
-
line-height: ${collapseItem.titleHeight};
|
|
62
60
|
transition: color ${collapse.transition};
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
gap: ${collapseItem.titleGap};
|
|
64
|
+
.${k}-collapse-title-wrapper {
|
|
65
|
+
flex: 1;
|
|
66
|
+
}
|
|
63
67
|
.${k}-collapse-arrow {
|
|
64
|
-
float: right;
|
|
65
68
|
transition: transform ${collapse.transition};
|
|
66
|
-
line-height: ${collapseItem.titleHeight};
|
|
67
|
-
height: ${collapseItem.titleHeight};
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
|
|
@@ -7,13 +7,29 @@ order: 0
|
|
|
7
7
|
|
|
8
8
|
> 本例中,我们将前缀设为`kd`,可以打开调试工具查看
|
|
9
9
|
|
|
10
|
+
> 对于`Message`组件,由于它是静态方法调用,我们可以通过`Message.classNamePrefix`设置样式名前缀
|
|
11
|
+
|
|
10
12
|
```vdt
|
|
11
13
|
import {ConfigProvider, Button, Input} from 'kpc';
|
|
12
14
|
|
|
13
15
|
<ConfigProvider value={{classNamePrefix: 'kd'}}>
|
|
14
|
-
<Button>Button</Button>
|
|
16
|
+
<Button ev-click={this.showMessage}>Button</Button>
|
|
15
17
|
<div style="margin-top: 8px;">
|
|
16
18
|
<Input />
|
|
17
19
|
</div>
|
|
18
20
|
</ConfigProvider>
|
|
19
21
|
```
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import {Message} from 'kpc';
|
|
25
|
+
|
|
26
|
+
Message.classNamePrefix = 'kd';
|
|
27
|
+
|
|
28
|
+
export default class extends Component {
|
|
29
|
+
static template = template;
|
|
30
|
+
|
|
31
|
+
showMessage() {
|
|
32
|
+
Message.info('Message with classNamePrefix');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
@@ -337,6 +337,36 @@ describe('Dialog', () => {
|
|
|
337
337
|
expect(dialog2.querySelector('.k-dialog-body')!.textContent).to.eql('test');
|
|
338
338
|
});
|
|
339
339
|
|
|
340
|
+
it('should update position when change container', async () => {
|
|
341
|
+
class Demo extends Component<{show: boolean, container: any}> {
|
|
342
|
+
static template = `
|
|
343
|
+
var Dialog = this.Dialog;
|
|
344
|
+
<Dialog value={true} container={this.get('container')} ref="dialog">test</Dialog>
|
|
345
|
+
`;
|
|
346
|
+
|
|
347
|
+
private Dialog = Dialog;
|
|
348
|
+
|
|
349
|
+
static defaults() {
|
|
350
|
+
return {
|
|
351
|
+
container: (parentDom: HTMLElement) => parentDom,
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
const [instance, element] = mount(Demo);
|
|
357
|
+
|
|
358
|
+
await wait();
|
|
359
|
+
instance.set('container', undefined);
|
|
360
|
+
await wait();
|
|
361
|
+
const dialogDom = instance.refs.dialog.dialogRef.value;
|
|
362
|
+
const style = dialogDom.style;
|
|
363
|
+
expect(style.left).not.eql('');
|
|
364
|
+
expect(style.top).not.eql('');
|
|
365
|
+
|
|
366
|
+
// should append to body
|
|
367
|
+
expect(dialogDom.closest('.k-dialog-wrapper').parentElement).to.eql(document.body);
|
|
368
|
+
});
|
|
369
|
+
|
|
340
370
|
// it('should handle v-if and v-model at the same time correctly in Vue', async () => {
|
|
341
371
|
// const Test = {
|
|
342
372
|
// template: `<Dialog v-model="show" v-if="show" ref="dialog">test</Dialog>`,
|
|
@@ -8,6 +8,10 @@ export function usePosition(elementRef: RefObject<HTMLDivElement>) {
|
|
|
8
8
|
|
|
9
9
|
instance.on(SHOW, center);
|
|
10
10
|
instance.on('afterClose', onAfterLeave);
|
|
11
|
+
instance.watch('container', () => {
|
|
12
|
+
if (!instance.get('value')) return;
|
|
13
|
+
center();
|
|
14
|
+
}, { presented: true, inited: true });
|
|
11
15
|
|
|
12
16
|
function center() {
|
|
13
17
|
position(elementRef.value!, {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import {useInstance, findDomFromVNode} from 'intact';
|
|
2
2
|
import type {Dropdown} from './';
|
|
3
3
|
import {Options, position, Feedback} from '../position';
|
|
4
|
-
import {noop} from 'intact-shared';
|
|
5
|
-
import {isObject} from 'intact-shared';
|
|
4
|
+
import {noop, isObject, isFunction} from 'intact-shared';
|
|
6
5
|
import { isEqualObject } from '../utils';
|
|
7
6
|
|
|
8
7
|
export type FeedbackCallback = (feedback: Feedback) => void;
|
|
@@ -19,21 +18,32 @@ export function usePosition() {
|
|
|
19
18
|
|
|
20
19
|
(['of', 'position'] as const).forEach(item => {
|
|
21
20
|
instance.watch(item, (newValue, oldValue) => {
|
|
22
|
-
// return if object is the same
|
|
23
21
|
if (
|
|
22
|
+
!instance.get('value') ||
|
|
23
|
+
// return if object is the same
|
|
24
24
|
isObject(newValue) && isObject(oldValue) &&
|
|
25
25
|
// is not event object
|
|
26
26
|
!(newValue instanceof Event) &&
|
|
27
27
|
isEqualObject(newValue, oldValue)
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (instance.get('value')) {
|
|
32
|
-
handle(noop);
|
|
33
|
-
}
|
|
28
|
+
) return;
|
|
29
|
+
|
|
30
|
+
handle(noop);
|
|
34
31
|
}, {presented: true, inited: true});
|
|
35
32
|
});
|
|
36
33
|
|
|
34
|
+
// watch container, it is not commonly used
|
|
35
|
+
instance.watch('container', (newValue, oldValue) => {
|
|
36
|
+
if (
|
|
37
|
+
!instance.get('value') ||
|
|
38
|
+
// return if function is the same. Not rigorous!
|
|
39
|
+
isFunction(newValue) &&
|
|
40
|
+
isFunction(oldValue) &&
|
|
41
|
+
newValue.toString() === oldValue.toString()
|
|
42
|
+
) return;
|
|
43
|
+
|
|
44
|
+
handle(noop);
|
|
45
|
+
}, { presented: true, inited: true });
|
|
46
|
+
|
|
37
47
|
// if the dropdown is nested, we must show child after parent has positioned
|
|
38
48
|
function p(
|
|
39
49
|
ofElement: HTMLElement | MouseEvent | undefined,
|
|
@@ -43,24 +43,28 @@ export class Message extends Component<MessageProps> {
|
|
|
43
43
|
static template = template;
|
|
44
44
|
static typeDefs = typeDefs;
|
|
45
45
|
static defaults = defaults;
|
|
46
|
+
static classNamePrefix: string;
|
|
46
47
|
|
|
47
48
|
static notice(
|
|
48
49
|
content: Children | Partial<MessageProps>,
|
|
49
50
|
duration: number = 3000,
|
|
50
51
|
type: MessageProps['type'] ='info'
|
|
51
52
|
) {
|
|
52
|
-
if (!messages) {
|
|
53
|
-
const container = document.createElement('div');
|
|
54
|
-
document.body.append(container);
|
|
55
|
-
render(h(Messages, {ref: i => messages = i}), container);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
53
|
if (isObject(content) && !(content as any).tag) {
|
|
59
54
|
content = {...content, type, key: id++} as Partial<Props<MessageProps>>;
|
|
60
55
|
} else {
|
|
61
56
|
content = {content, duration, type, key: id++} as Partial<Props<MessageProps>>;
|
|
62
57
|
}
|
|
63
58
|
|
|
59
|
+
if (!messages) {
|
|
60
|
+
const container = document.createElement('div');
|
|
61
|
+
document.body.append(container);
|
|
62
|
+
render(h(Messages, {
|
|
63
|
+
ref: (i: Messages | null) => messages = i,
|
|
64
|
+
classNamePrefix: Message.classNamePrefix,
|
|
65
|
+
} as any), container);
|
|
66
|
+
}
|
|
67
|
+
|
|
64
68
|
messages!.notice(h(Message, content));
|
|
65
69
|
}
|
|
66
70
|
static info(content: Children | Partial<MessageProps>, duration?: number) {
|
|
@@ -3,7 +3,7 @@ import {Icon} from '../icon';
|
|
|
3
3
|
import {getRestProps} from '../utils';
|
|
4
4
|
import {makeMessageStyles} from './styles';
|
|
5
5
|
|
|
6
|
-
const {type, content, children, closable, hideIcon} = this.get();
|
|
6
|
+
const {type, content, children, closable, hideIcon, classNamePrefix} = this.get();
|
|
7
7
|
const { k } = this.config;
|
|
8
8
|
|
|
9
9
|
const classNameObj = {
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import {Component, VNodeComponentClass} from 'intact';
|
|
1
|
+
import {Component, VNodeComponentClass, TypeDefs} from 'intact';
|
|
2
2
|
import template from './messages.vdt';
|
|
3
3
|
import type {Message} from './message';
|
|
4
4
|
import { useConfigContext } from '../config';
|
|
5
5
|
|
|
6
|
+
export interface MessagesProps {
|
|
7
|
+
classNamePrefix?: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const typeDefs: Required<TypeDefs<MessagesProps>> = {
|
|
11
|
+
classNamePrefix: String,
|
|
12
|
+
};
|
|
13
|
+
|
|
6
14
|
export class Messages extends Component {
|
|
7
15
|
static template = template;
|
|
16
|
+
static typeDefs = typeDefs;
|
|
8
17
|
|
|
9
18
|
private messages: VNodeComponentClass<Message>[] = [];
|
|
10
19
|
private config = useConfigContext();
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import {TransitionGroup, Transition} from 'intact';
|
|
2
2
|
import {makeMessagesStyles} from './styles';
|
|
3
|
+
import { ConfigProvider } from '../config';
|
|
3
4
|
|
|
4
|
-
const
|
|
5
|
+
const k = this.get('classNamePrefix') || this.config.k;
|
|
5
6
|
|
|
6
|
-
<
|
|
7
|
-
<
|
|
8
|
-
<
|
|
9
|
-
{$value}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
</
|
|
7
|
+
<ConfigProvider value={{classNamePrefix: k}}>
|
|
8
|
+
<div class={{[`${k}-messages`]: true, [makeMessagesStyles(k)]: true}}>
|
|
9
|
+
<TransitionGroup>
|
|
10
|
+
<template v-for={this.messages} key={$value.key}>
|
|
11
|
+
{$value}
|
|
12
|
+
</template>
|
|
13
|
+
</TransitionGroup>
|
|
14
|
+
</div>
|
|
15
|
+
</ConfigProvider>
|
package/components/portal.ts
CHANGED
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
remove,
|
|
11
11
|
TypeDefs,
|
|
12
12
|
inject,
|
|
13
|
+
unmount,
|
|
14
|
+
removeVNodeDom,
|
|
13
15
|
} from 'intact';
|
|
14
16
|
import {isString} from 'intact-shared';
|
|
15
17
|
import {DIALOG} from './dialog/constants';
|
|
@@ -59,7 +61,9 @@ export class Portal<T extends PortalProps = PortalProps> extends Component<T> {
|
|
|
59
61
|
const fakeContainer = document.createDocumentFragment();
|
|
60
62
|
|
|
61
63
|
(mountedQueue.priority || mountedQueue).push(() => {
|
|
62
|
-
const parentDom = this.$lastInput!.dom!.parentElement
|
|
64
|
+
const parentDom = this.$lastInput!.dom!.parentElement;
|
|
65
|
+
// maybe the <!-- portal --> has been removed by react, #938
|
|
66
|
+
if (!parentDom) return;
|
|
63
67
|
this.initContainer(nextProps.container, parentDom, anchor);
|
|
64
68
|
this.container!.appendChild(fakeContainer);
|
|
65
69
|
});
|
|
@@ -130,8 +134,13 @@ export class Portal<T extends PortalProps = PortalProps> extends Component<T> {
|
|
|
130
134
|
}
|
|
131
135
|
|
|
132
136
|
$unmount(vNode: VNodeComponentClass<this>, nextVNode: VNodeComponentClass<this> | null) {
|
|
133
|
-
|
|
134
|
-
|
|
137
|
+
const children = vNode.props!.children as VNode;
|
|
138
|
+
unmount(children, null);
|
|
139
|
+
if (this.container) {
|
|
140
|
+
// maybe the <!-- portal --> has been removed by react, #938
|
|
141
|
+
// remove(children, this.container, false);
|
|
142
|
+
removeVNodeDom(children, this.container);
|
|
143
|
+
}
|
|
135
144
|
super.$unmount(vNode, nextVNode);
|
|
136
145
|
}
|
|
137
146
|
|
|
@@ -142,7 +151,11 @@ export class Portal<T extends PortalProps = PortalProps> extends Component<T> {
|
|
|
142
151
|
} else {
|
|
143
152
|
this.container = container(parentDom, anchor);
|
|
144
153
|
}
|
|
154
|
+
} else {
|
|
155
|
+
// let below logic to set container to default if container does not exist.
|
|
156
|
+
this.container = null;
|
|
145
157
|
}
|
|
158
|
+
|
|
146
159
|
if (!this.container) {
|
|
147
160
|
if (this.$senior instanceof BaseDialog) {
|
|
148
161
|
// Dialog and Drawer must be inserted into document.body
|
|
@@ -2,6 +2,7 @@ import {useInstance} from 'intact';
|
|
|
2
2
|
import {Upload, UploadFile} from './';
|
|
3
3
|
import {_$} from '../../i18n';
|
|
4
4
|
import {UploadFileStatus} from './useUpload';
|
|
5
|
+
import { isEqualArray } from '../utils';
|
|
5
6
|
|
|
6
7
|
let uid = 0;
|
|
7
8
|
|
|
@@ -28,8 +29,8 @@ export function useFiles(
|
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
instance.on(`$receive:files`, (files) => {
|
|
32
|
-
if (!files) return;
|
|
32
|
+
instance.on(`$receive:files`, (files, oldFiles) => {
|
|
33
|
+
if (!files || isEqualArray(files, oldFiles)) return;
|
|
33
34
|
instance.set('files', files.map(normalizeFile));
|
|
34
35
|
});
|
|
35
36
|
|
|
@@ -60,7 +60,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
var classNameObj = (_classNameObj = {}, _classNameObj[cls('btn')] = true, _classNameObj[cls(
|
|
63
|
+
var classNameObj = (_classNameObj = {}, _classNameObj[cls('btn')] = true, _classNameObj[cls(size)] = size !== 'default', _classNameObj[cls(type)] = true, _classNameObj[cls("btn-icon")] = icon, _classNameObj[className] = className, _classNameObj[cls('circle')] = circle, _classNameObj[cls('loading')] = loading, _classNameObj[cls('fluid')] = fluid, _classNameObj[cls('active')] = checked, _classNameObj[cls('disabled')] = disabled || loading, _classNameObj[cls('ghost')] = ghost, _classNameObj[makeButtonStyles(k, iconSide)] = true, _classNameObj);
|
|
64
64
|
|
|
65
65
|
var loadingIcon = _$cc(Icon, {
|
|
66
66
|
'className': _$cn("ion-load-c " + k + "-icon-loading"),
|
|
@@ -242,16 +242,16 @@ export var makeButtonStyles = cache(function makeButtonStyles(k, iconSide) {
|
|
|
242
242
|
return cx(
|
|
243
243
|
/*#__PURE__*/
|
|
244
244
|
// extract static styles to individual css method for performance
|
|
245
|
-
css("display:inline-flex;align-items:center;justify-content:center;cursor:pointer;height:", button.height, ";padding:", button.padding, ";outline:none;vertical-align:middle;color:", button.color, ";background:", button.bgColor, ";border-radius:", button.borderRadius, ";border:1px solid ", button.borderColor, ";font-size:", button.fontSize, ";white-space:nowrap;transition:all ", button.transition, ";line-height:", button.lineHeight, ";.", k, "-icon{color:inherit;}&:hover,&:focus{border-color:", button.hoverBorderColor, ";color:", button.hoverColor, ";}&:active{background:", palette(theme.color.primary, -4), ";}.", k, "-button-input{position:absolute;opacity:0;width:0;height:0;}", _mapInstanceProperty(types).call(types, function (type) {
|
|
245
|
+
css("display:inline-flex;align-items:center;justify-content:center;cursor:pointer;height:", button.height, ";padding:", button.padding, ";outline:none;vertical-align:middle;color:", button.color, ";background:", button.bgColor, ";border-radius:", button.borderRadius, ";border:1px solid ", button.borderColor, ";font-size:", button.fontSize, ";white-space:nowrap;transition:all ", button.transition, ";line-height:", button.lineHeight, ";.", k, "-icon{color:inherit;}&.", k, "-default,&.", k, "-none,&.", k, "-flat{.", k, "-icon{color:", theme.color.lightBlack, ";}&:hover{.", k, "-icon{color:inherit;}}}&:hover,&:focus{border-color:", button.hoverBorderColor, ";color:", button.hoverColor, ";}&:active{background:", palette(theme.color.primary, -4), ";}.", k, "-button-input{position:absolute;opacity:0;width:0;height:0;}", _mapInstanceProperty(types).call(types, function (type) {
|
|
246
246
|
var typeStyles = button[type];
|
|
247
247
|
return /*#__PURE__*/css("&.", k, "-", type, "{background:", typeStyles.bgColor, ";color:", typeStyles.color, ";border-color:", typeStyles.borderColor, ";&:hover,&:focus{background:", palette(typeStyles.bgColor, -1), ";border-color:", typeStyles.hoverBorderColor, ";color:", typeStyles.color, ";}&:active{background:", palette(typeStyles.bgColor, 1), ";border-color:", palette(typeStyles.borderColor, 1), ";}}");
|
|
248
|
-
}), "&.", k, "-secondary{color:", secondary.color, ";border-color:", secondary.borderColor, ";&:hover,&:focus{background:", secondary.hoverBgColor, ";}&:active{background:", secondary.activeBgColor, ";}}&.", k, "-link{color:", link.color, ";&:hover{color:", link.hoverColor, ";background:", link.hoverBgColor, ";}}&.", k, "-none,&.", k, "-link,&.", k, "-flat{background:transparent;&,&:hover{border:none;}&.", k, "-active{color:", theme.color.primary, ";}}&.", k, "-none:hover{background:", button.none.hoverBgColor, ";}&.", k, "-flat{background:", button.none.hoverBgColor, ";}&.", k, "-disabled{&,&:hover{color:", button.disabled.color, ";background:", button.disabled.bgColor, ";border-color:", button.disabled.borderColor, ";cursor:not-allowed;}}&.", k, "-none.", k, "-disabled,&.", k, "-link.", k, "-disabled{&,&:hover{background:transparent;}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
248
|
+
}), "&.", k, "-secondary{color:", secondary.color, ";border-color:", secondary.borderColor, ";&:hover,&:focus{background:", secondary.hoverBgColor, ";}&:active{background:", secondary.activeBgColor, ";}}&.", k, "-link{color:", link.color, ";&:hover{color:", link.hoverColor, ";background:", link.hoverBgColor, ";}}&.", k, "-none,&.", k, "-link,&.", k, "-flat{background:transparent;&,&:hover{border:none;}&.", k, "-active{color:", theme.color.primary, ";}}&.", k, "-none:hover{background:", button.none.hoverBgColor, ";}&.", k, "-flat{background:", button.none.hoverBgColor, ";}&.", k, "-disabled{.", k, "-icon{color:inherit;}&,&:hover{color:", button.disabled.color, ";background:", button.disabled.bgColor, ";border-color:", button.disabled.borderColor, ";cursor:not-allowed;}}&.", k, "-none.", k, "-disabled,&.", k, "-link.", k, "-disabled{&,&:hover{background:transparent;}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
249
249
|
var styles = button[size];
|
|
250
250
|
return /*#__PURE__*/css("&.", k, "-", size, "{font-size:", styles.fontSize, ";height:", styles.height, ";padding:", styles.padding, ";&.", k, "-btn-icon{width:", styles.height, ";}}");
|
|
251
251
|
}), "&.", k, "-btn-icon{width:", button.height, ";padding:0;.", k, "-icon{margin:0;}}&.", k, "-fluid{width:100%;padding:0;}&.", k, "-circle{border-radius:calc(", button.large.height, " / 2);}&.", k, "-loading{", _mapInstanceProperty(types).call(types, function (type) {
|
|
252
252
|
var styles = button[type];
|
|
253
253
|
return /*#__PURE__*/css("&.", k, "-", type, "{&,&:hover{background:", palette(styles.bgColor, -2), ";color:", palette(styles.color, -2), ";border-color:", palette(styles.borderColor, -2), ";}}");
|
|
254
|
-
}), ";&,&:hover{background:", palette(button.bgColor, -2), ";color:", palette(button.color, -2), ";border-color:", palette(button.borderColor, -2), ";}.", k, "-icon:not(.", k, "-icon-loading){display:none;}}&:not(button){display:inline-flex;align-items:center;justify-content:center;}&.", k, "-ghost{background:transparent;color:", button.ghost.color, ";border-color:", button.ghost.borderColor, "
|
|
254
|
+
}), ";&,&:hover{background:", palette(button.bgColor, -2), ";color:", palette(button.color, -2), ";border-color:", palette(button.borderColor, -2), ";}.", k, "-icon:not(.", k, "-icon-loading){display:none;}}&:not(button){display:inline-flex;align-items:center;justify-content:center;}&.", k, "-ghost{background:transparent;color:", button.ghost.color, ";border-color:", button.ghost.borderColor, ";.", k, "-icon{color:inherit;}&:hover,&:active{background:transparent;}&:hover{color:", button.ghost.hoverColor, ";border-color:", button.ghost.hoverBorderColor, ";}&:active{color:", theme.color.primary, ";border-color:", theme.color.primary, ";}", _mapInstanceProperty(types).call(types, function (type) {
|
|
255
255
|
var _button$type = button[type],
|
|
256
256
|
ghostColor = _button$type.ghostColor,
|
|
257
257
|
borderColor = _button$type.borderColor;
|
|
@@ -27,7 +27,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
27
27
|
var classNameObj = (_classNameObj = {}, _classNameObj[k + "-collapse-item"] = true, _classNameObj[makeItemStyles(k)] = true, _classNameObj[className] = className, _classNameObj[k + "-active"] = isActive, _classNameObj[k + "-disabled"] = disabled, _classNameObj);
|
|
28
28
|
return _$cv('div', _extends({
|
|
29
29
|
'className': _$cn(classNameObj)
|
|
30
|
-
}, getRestProps(this)), [_$ce(2, 'div', [(_$blocks['title'] = function ($super) {
|
|
30
|
+
}, getRestProps(this)), [_$ce(2, 'div', [_$ce(2, 'div', (_$blocks['title'] = function ($super) {
|
|
31
31
|
return title;
|
|
32
32
|
}, __$blocks['title'] = function ($super, data) {
|
|
33
33
|
var block = $blocks['title'];
|
|
@@ -37,11 +37,11 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
return block ? block.call($this, callBlock, data) : callBlock();
|
|
40
|
-
}, __$blocks['title'](_$no)), _$cc(Icon, {
|
|
40
|
+
}, __$blocks['title'](_$no)), 0, _$cn(k + "-collapse-title-wrapper")), _$cc(Icon, {
|
|
41
41
|
'className': _$cn((_$cn2 = {}, _$cn2[k + "-collapse-arrow"] = true, _$cn2[k + "-icon-right"] = true, _$cn2)),
|
|
42
42
|
'hoverable': true,
|
|
43
43
|
'disabled': disabled
|
|
44
|
-
})],
|
|
44
|
+
})], 4, _$cn(k + "-collapse-title"), {
|
|
45
45
|
'ev-click': this.toggle
|
|
46
46
|
}), _$cc(Transition, _extends({
|
|
47
47
|
'show': isActive
|
|
@@ -9,7 +9,6 @@ var defaults = {
|
|
|
9
9
|
},
|
|
10
10
|
|
|
11
11
|
fontSize: '12px',
|
|
12
|
-
titleMarginRight: '8px',
|
|
13
12
|
borderPadding: '0 24px',
|
|
14
13
|
collBorder: '1px solid #eee',
|
|
15
14
|
|
|
@@ -19,7 +18,8 @@ var defaults = {
|
|
|
19
18
|
|
|
20
19
|
item: {
|
|
21
20
|
borderBottom: '1px solid #e5e5e5',
|
|
22
|
-
titleHeight: '40px'
|
|
21
|
+
titleHeight: '40px',
|
|
22
|
+
titleGap: '8px'
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
var collapse;
|
|
@@ -31,9 +31,9 @@ setDefault(function () {
|
|
|
31
31
|
makeItemStyles == null ? void 0 : makeItemStyles.clearCache();
|
|
32
32
|
});
|
|
33
33
|
export var makeStyles = cache(function makeStyles(k) {
|
|
34
|
-
return /*#__PURE__*/css("font-size:", collapse.fontSize, ";&.", k, "-left{
|
|
34
|
+
return /*#__PURE__*/css("font-size:", collapse.fontSize, ";&.", k, "-left{>.", k, "-collapse-item>.", k, "-collapse-title{flex-direction:row-reverse;}}&.", k, "-border{border-radius:", collapse.borderRadius, ";padding:", collapse.borderPadding, ";border:", collapse.collBorder, ";}");
|
|
35
35
|
});
|
|
36
36
|
export var makeItemStyles = cache(function makeItemStyles(k) {
|
|
37
37
|
var collapseItem = collapse.item;
|
|
38
|
-
return /*#__PURE__*/css("border-bottom:", collapseItem.borderBottom, ";&:last-of-type{border-bottom-color:transparent;}>.", k, "-collapse-title{cursor:pointer;font-weight:bold;height:", collapseItem.titleHeight, ";
|
|
38
|
+
return /*#__PURE__*/css("border-bottom:", collapseItem.borderBottom, ";&:last-of-type{border-bottom-color:transparent;}>.", k, "-collapse-title{cursor:pointer;font-weight:bold;height:", collapseItem.titleHeight, ";transition:color ", collapse.transition, ";display:flex;align-items:center;gap:", collapseItem.titleGap, ";.", k, "-collapse-title-wrapper{flex:1;}.", k, "-collapse-arrow{transition:transform ", collapse.transition, ";}}&:not(.", k, "-disabled){>.", k, "-collapse-title{&:hover{color:", theme.color.primary, ";}}}&.", k, "-active{>.", k, "-collapse-title .", k, "-collapse-arrow{transform:rotate(90deg);}}&.", k, "-disabled{color:", theme.color.disabledBorder, ";>.", k, "-collapse-title{cursor:not-allowed;}}");
|
|
39
39
|
});
|
|
@@ -10,7 +10,7 @@ export * from './shapes/rectangle';
|
|
|
10
10
|
export * from './shapes/square';
|
|
11
11
|
export * from './shapes/text';
|
|
12
12
|
export * from './shapes/line';
|
|
13
|
-
declare const DDiamond: import("
|
|
13
|
+
declare const DDiamond: import("vdt").ComponentConstructor<import("./shapes/shape").DShape<import("./shapes/shape").DShapeProps>>, DTriangle: import("vdt").ComponentConstructor<import("./shapes/shape").DShape<import("./shapes/shape").DShapeProps>>, DCylinder: import("vdt").ComponentConstructor<import("./shapes/shape").DShape<import("./shapes/shape").DShapeProps>>, DCloud: import("vdt").ComponentConstructor<import("./shapes/shape").DShape<import("./shapes/shape").DShapeProps>>;
|
|
14
14
|
export { DDiamond, DTriangle, DCylinder, DCloud };
|
|
15
15
|
export * from './layouts/layout';
|
|
16
16
|
export * from './layouts/circle';
|