@king-design/intact 3.1.1 → 3.1.3
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/affix/styles.ts +4 -2
- package/components/badge/index.vdt +1 -1
- package/components/badge/styles.ts +4 -3
- package/components/breadcrumb/index.vdt +1 -1
- package/components/breadcrumb/styles.ts +4 -2
- package/components/button/styles.ts +7 -5
- package/components/card/styles.ts +4 -2
- package/components/carousel/styles.ts +7 -4
- package/components/cascader/index.vdt +2 -1
- package/components/cascader/styles.ts +7 -4
- package/components/checkbox/index.vdt +1 -1
- package/components/checkbox/styles.ts +4 -2
- package/components/code/styles.ts +3 -2
- package/components/collapse/index.spec.ts +1 -1
- package/components/collapse/item.vdt +1 -1
- package/components/collapse/styles.ts +16 -12
- package/components/colorpicker/styles.ts +7 -4
- package/components/copy/styles.ts +3 -2
- package/components/datepicker/styles.ts +10 -6
- package/components/diagram/styles.ts +3 -2
- package/components/dialog/index.spec.ts +30 -0
- package/components/dialog/styles.ts +10 -6
- package/components/dialog/usePosition.ts +4 -0
- package/components/drawer/styles.ts +4 -2
- package/components/dropdown/styles.ts +7 -4
- package/components/dropdown/usePosition.ts +19 -9
- package/components/editable/styles.ts +4 -2
- package/components/form/styles.ts +7 -4
- package/components/grid/styles.ts +12 -9
- package/components/icon/index.vdt +1 -1
- package/components/icon/styles.ts +4 -2
- package/components/input/styles.ts +8 -5
- package/components/layout/styles.ts +13 -9
- package/components/menu/demos/recursive.md +340 -0
- package/components/menu/styles.ts +21 -16
- package/components/message/styles.ts +7 -5
- package/components/pagination/styles.ts +4 -2
- package/components/popover/content.vdt +1 -1
- package/components/popover/styles.ts +4 -2
- package/components/portal.ts +16 -3
- package/components/progress/styles.ts +4 -4
- package/components/radio/styles.ts +4 -2
- package/components/rate/styles.ts +4 -2
- package/components/scrollSelect/styles.ts +4 -2
- package/components/select/base.ts +3 -2
- package/components/select/base.vdt +1 -1
- package/components/select/styles.ts +10 -6
- package/components/skeleton/styles.ts +7 -4
- package/components/slider/styles.ts +4 -2
- package/components/spin/styles.ts +4 -4
- package/components/spinner/styles.ts +4 -3
- package/components/split/styles.ts +4 -2
- package/components/steps/index.vdt +2 -2
- package/components/steps/styles.ts +7 -5
- package/components/switch/styles.ts +4 -2
- package/components/table/column.ts +2 -0
- package/components/table/column.vdt +7 -3
- package/components/table/demos/basic.md +2 -2
- package/components/table/demos/fixColumn.md +3 -1
- package/components/table/demos/groupHeader.md +11 -11
- package/components/table/demos/scheme.md +1 -1
- package/components/table/index.spec.ts +8 -3
- package/components/table/styles.ts +11 -8
- package/components/table/table.vdt +3 -4
- package/components/table/useColumns.ts +1 -0
- package/components/table/useFixedColumns.ts +27 -49
- package/components/table/useGroup.ts +5 -0
- package/components/table/useResizable.ts +38 -10
- package/components/table/useWidth.ts +3 -0
- package/components/tabs/styles.ts +4 -2
- package/components/tag/styles.ts +7 -4
- package/components/timeline/styles.ts +7 -5
- package/components/timepicker/styles.ts +4 -2
- package/components/tip/styles.ts +4 -2
- package/components/tooltip/content.vdt +1 -1
- package/components/tooltip/styles.ts +4 -2
- package/components/transfer/styles.ts +4 -2
- package/components/tree/demos/checkbox.md +1 -0
- package/components/tree/demos/contextmenu.md +10 -1
- package/components/tree/index.spec.ts +7 -0
- package/components/tree/styles.ts +4 -2
- package/components/tree/useChecked.ts +3 -0
- package/components/treeSelect/styles.ts +4 -2
- package/components/upload/styles.ts +7 -4
- package/components/upload/useFiles.ts +3 -2
- package/components/utils.ts +10 -4
- package/components/wave/styles.ts +4 -2
- package/es/components/affix/styles.d.ts +4 -1
- package/es/components/affix/styles.js +4 -2
- package/es/components/badge/index.vdt.js +1 -1
- package/es/components/badge/styles.d.ts +4 -1
- package/es/components/badge/styles.js +4 -2
- package/es/components/breadcrumb/index.vdt.js +1 -1
- package/es/components/breadcrumb/styles.d.ts +4 -1
- package/es/components/breadcrumb/styles.js +4 -2
- package/es/components/button/styles.d.ts +8 -2
- package/es/components/button/styles.js +7 -4
- package/es/components/card/styles.d.ts +4 -1
- package/es/components/card/styles.js +4 -2
- package/es/components/carousel/styles.d.ts +8 -2
- package/es/components/carousel/styles.js +7 -4
- package/es/components/cascader/index.vdt.js +3 -1
- package/es/components/cascader/styles.d.ts +8 -2
- package/es/components/cascader/styles.js +7 -4
- package/es/components/checkbox/index.vdt.js +1 -1
- package/es/components/checkbox/styles.d.ts +4 -1
- package/es/components/checkbox/styles.js +4 -2
- package/es/components/code/styles.d.ts +4 -1
- package/es/components/code/styles.js +3 -2
- package/es/components/collapse/index.spec.js +1 -1
- package/es/components/collapse/item.vdt.js +3 -3
- package/es/components/collapse/styles.d.ts +8 -2
- package/es/components/collapse/styles.js +11 -8
- package/es/components/colorpicker/styles.d.ts +8 -2
- package/es/components/colorpicker/styles.js +7 -4
- package/es/components/copy/styles.d.ts +4 -1
- package/es/components/copy/styles.js +3 -2
- package/es/components/datepicker/styles.d.ts +12 -3
- package/es/components/datepicker/styles.js +10 -6
- package/es/components/diagram/styles.d.ts +4 -1
- package/es/components/diagram/styles.js +3 -2
- package/es/components/dialog/index.spec.js +61 -1
- package/es/components/dialog/styles.d.ts +12 -3
- package/es/components/dialog/styles.js +10 -6
- package/es/components/dialog/usePosition.js +7 -0
- package/es/components/drawer/styles.d.ts +4 -1
- package/es/components/drawer/styles.js +4 -2
- package/es/components/dropdown/styles.d.ts +8 -2
- package/es/components/dropdown/styles.js +7 -4
- package/es/components/dropdown/usePosition.js +14 -11
- package/es/components/editable/styles.d.ts +4 -1
- package/es/components/editable/styles.js +4 -2
- package/es/components/form/styles.d.ts +8 -2
- package/es/components/form/styles.js +7 -4
- package/es/components/grid/styles.d.ts +8 -2
- package/es/components/grid/styles.js +12 -13
- package/es/components/icon/index.vdt.js +1 -1
- package/es/components/icon/styles.d.ts +4 -1
- package/es/components/icon/styles.js +4 -2
- package/es/components/input/styles.d.ts +8 -2
- package/es/components/input/styles.js +7 -4
- package/es/components/layout/styles.d.ts +16 -4
- package/es/components/layout/styles.js +13 -8
- package/es/components/menu/styles.d.ts +16 -4
- package/es/components/menu/styles.js +14 -9
- package/es/components/message/styles.d.ts +8 -2
- package/es/components/message/styles.js +7 -4
- package/es/components/pagination/styles.d.ts +4 -1
- package/es/components/pagination/styles.js +4 -2
- package/es/components/popover/content.vdt.js +1 -1
- package/es/components/popover/styles.d.ts +4 -1
- package/es/components/popover/styles.js +4 -2
- package/es/components/portal.js +15 -3
- package/es/components/progress/styles.d.ts +4 -1
- package/es/components/progress/styles.js +4 -2
- package/es/components/radio/styles.d.ts +4 -1
- package/es/components/radio/styles.js +4 -2
- package/es/components/rate/styles.d.ts +4 -1
- package/es/components/rate/styles.js +4 -2
- package/es/components/scrollSelect/styles.d.ts +4 -1
- package/es/components/scrollSelect/styles.js +4 -2
- package/es/components/select/base.js +3 -1
- package/es/components/select/base.vdt.js +1 -1
- package/es/components/select/styles.d.ts +12 -3
- package/es/components/select/styles.js +10 -6
- package/es/components/skeleton/styles.d.ts +8 -2
- package/es/components/skeleton/styles.js +7 -4
- package/es/components/slider/styles.d.ts +4 -1
- package/es/components/slider/styles.js +4 -2
- package/es/components/spin/styles.d.ts +4 -1
- package/es/components/spin/styles.js +4 -2
- package/es/components/spinner/styles.d.ts +4 -1
- package/es/components/spinner/styles.js +4 -2
- package/es/components/split/styles.d.ts +4 -1
- package/es/components/split/styles.js +4 -2
- package/es/components/steps/index.vdt.js +2 -2
- package/es/components/steps/styles.d.ts +4 -3
- package/es/components/steps/styles.js +9 -4
- package/es/components/switch/styles.d.ts +4 -1
- package/es/components/switch/styles.js +4 -2
- package/es/components/table/column.d.ts +1 -0
- package/es/components/table/column.js +2 -1
- package/es/components/table/column.vdt.js +9 -3
- package/es/components/table/index.spec.js +18 -11
- package/es/components/table/styles.d.ts +8 -2
- package/es/components/table/styles.js +8 -5
- package/es/components/table/table.vdt.js +3 -4
- package/es/components/table/useColumns.js +1 -0
- package/es/components/table/useFixedColumns.d.ts +3 -3
- package/es/components/table/useFixedColumns.js +27 -46
- package/es/components/table/useGroup.d.ts +1 -0
- package/es/components/table/useGroup.js +11 -1
- package/es/components/table/useResizable.js +41 -5
- package/es/components/table/useWidth.js +3 -0
- package/es/components/tabs/styles.d.ts +4 -1
- package/es/components/tabs/styles.js +4 -2
- package/es/components/tag/styles.d.ts +8 -2
- package/es/components/tag/styles.js +7 -4
- package/es/components/timeline/styles.d.ts +8 -2
- package/es/components/timeline/styles.js +7 -5
- package/es/components/timepicker/styles.d.ts +4 -1
- package/es/components/timepicker/styles.js +4 -2
- package/es/components/tip/styles.d.ts +4 -1
- package/es/components/tip/styles.js +4 -2
- package/es/components/tooltip/content.vdt.js +1 -1
- package/es/components/tooltip/styles.d.ts +4 -1
- package/es/components/tooltip/styles.js +4 -2
- package/es/components/transfer/styles.d.ts +4 -1
- package/es/components/transfer/styles.js +4 -2
- package/es/components/tree/index.spec.js +13 -1
- package/es/components/tree/styles.d.ts +4 -1
- package/es/components/tree/styles.js +4 -2
- package/es/components/tree/useChecked.js +4 -0
- package/es/components/treeSelect/styles.d.ts +4 -1
- package/es/components/treeSelect/styles.js +4 -2
- package/es/components/upload/styles.d.ts +8 -2
- package/es/components/upload/styles.js +7 -4
- package/es/components/upload/useFiles.js +3 -2
- package/es/components/utils.d.ts +10 -2
- package/es/components/utils.js +9 -2
- package/es/components/wave/styles.d.ts +4 -1
- package/es/components/wave/styles.js +4 -2
- package/es/i18n/en-US.d.ts +1 -0
- package/es/i18n/en-US.js +1 -0
- 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/menu/demos/recursive/index.d.ts +29 -0
- package/es/site/data/components/menu/demos/recursive/index.js +57 -0
- package/es/site/data/components/menu/demos/recursive/react.d.ts +2 -0
- package/es/site/data/components/menu/demos/recursive/react.js +69 -0
- package/es/site/data/components/table/demos/basic/react.js +4 -2
- package/es/site/data/components/table/demos/fixColumn/react.js +2 -1
- package/es/site/data/components/table/demos/groupHeader/react.js +11 -20
- package/es/site/data/components/table/demos/scheme/react.js +2 -1
- package/es/site/data/components/tree/demos/checkbox/index.d.ts +12 -2
- package/es/site/data/components/tree/demos/checkbox/index.js +1 -0
- package/es/site/data/components/tree/demos/checkbox/react.d.ts +12 -2
- package/es/site/data/components/tree/demos/checkbox/react.js +1 -0
- package/es/site/data/components/tree/demos/contextmenu/index.d.ts +1 -0
- package/es/site/data/components/tree/demos/contextmenu/index.js +1 -0
- package/es/site/data/components/tree/demos/contextmenu/react.d.ts +1 -0
- package/es/site/data/components/tree/demos/contextmenu/react.js +1 -0
- package/es/site/src/components/article/index.js +6 -2
- package/es/styles/fonts/iconfont.d.ts +4 -1
- package/es/styles/fonts/iconfont.js +1 -1
- package/es/styles/global.js +7 -2
- package/i18n/en-US.ts +1 -0
- package/index.ts +2 -2
- package/package.json +3 -3
- package/styles/fonts/iconfont.ts +2 -2
- package/styles/global.ts +32 -0
|
@@ -2,6 +2,7 @@ import {css} from '@emotion/css';
|
|
|
2
2
|
import {theme, setDefault} from '../../styles/theme';
|
|
3
3
|
import {deepDefaults} from '../../styles/utils';
|
|
4
4
|
import '../../styles/global';
|
|
5
|
+
import { cache } from '../utils';
|
|
5
6
|
|
|
6
7
|
const defaults = {
|
|
7
8
|
zIndex: 9
|
|
@@ -10,11 +11,12 @@ const defaults = {
|
|
|
10
11
|
let affix: typeof defaults;
|
|
11
12
|
setDefault(() => {
|
|
12
13
|
affix = deepDefaults(theme, {affix: defaults}).affix;
|
|
14
|
+
makeStyles?.clearCache();
|
|
13
15
|
});
|
|
14
16
|
|
|
15
|
-
export function makeStyles(k: string) {
|
|
17
|
+
export const makeStyles = cache(function makeStyles(k: string) {
|
|
16
18
|
return css`
|
|
17
19
|
position: relative;
|
|
18
20
|
z-index: ${affix.zIndex};
|
|
19
21
|
`;
|
|
20
|
-
}
|
|
22
|
+
});
|
|
@@ -2,6 +2,7 @@ import {css, cx} from '@emotion/css';
|
|
|
2
2
|
import {theme, setDefault} from '../../styles/theme';
|
|
3
3
|
import {deepDefaults, palette} from '../../styles/utils';
|
|
4
4
|
import '../../styles/global';
|
|
5
|
+
import { cache } from '../utils';
|
|
5
6
|
|
|
6
7
|
const defaults = {
|
|
7
8
|
width: '8px',
|
|
@@ -17,9 +18,10 @@ const defaults = {
|
|
|
17
18
|
let badge: typeof defaults;
|
|
18
19
|
setDefault(() => {
|
|
19
20
|
badge = deepDefaults(theme, {badge: defaults}).badge;
|
|
21
|
+
makeStyles?.clearCache();
|
|
20
22
|
});
|
|
21
23
|
|
|
22
|
-
export
|
|
24
|
+
export const makeStyles = cache(function makeStyles(k: string) {
|
|
23
25
|
return css`
|
|
24
26
|
display: inline-block;
|
|
25
27
|
position: relative;
|
|
@@ -56,5 +58,4 @@ export default function makeStyles(k: string) {
|
|
|
56
58
|
transform: none;
|
|
57
59
|
}
|
|
58
60
|
`;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
+
});
|
|
@@ -2,6 +2,7 @@ import {css, cx} from '@emotion/css';
|
|
|
2
2
|
import {deepDefaults, darken} from '../../styles/utils';
|
|
3
3
|
import {theme, setDefault} from '../../styles/theme';
|
|
4
4
|
import '../../styles/global';
|
|
5
|
+
import { cache } from '../utils';
|
|
5
6
|
|
|
6
7
|
const defaults = {
|
|
7
8
|
fontSize: '14px',
|
|
@@ -15,9 +16,10 @@ const defaults = {
|
|
|
15
16
|
let breadcrumb: typeof defaults;
|
|
16
17
|
setDefault(() => {
|
|
17
18
|
breadcrumb = deepDefaults(theme, {breadcrumb: defaults}).breadcrumb;
|
|
19
|
+
makeStyles?.clearCache();
|
|
18
20
|
});
|
|
19
21
|
|
|
20
|
-
export
|
|
22
|
+
export const makeStyles = cache(function makeStyles(k: string) {
|
|
21
23
|
return css`
|
|
22
24
|
font-size: ${breadcrumb.fontSize};
|
|
23
25
|
display: flex;
|
|
@@ -43,4 +45,4 @@ export default function makeStyles(k: string) {
|
|
|
43
45
|
margin: 0 ${breadcrumb.gap};
|
|
44
46
|
}
|
|
45
47
|
`
|
|
46
|
-
}
|
|
48
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {css, cx} from '@emotion/css';
|
|
2
|
-
import { ButtonProps, Button } from './index';
|
|
3
2
|
import {theme, setDefault} from '../../styles/theme';
|
|
4
3
|
import {deepDefaults, palette, getLeft, darken} from '../../styles/utils';
|
|
5
4
|
import '../../styles/global';
|
|
5
|
+
import { cache } from '../utils';
|
|
6
6
|
|
|
7
7
|
type ValueOf<T extends readonly any[]> = T[number]
|
|
8
8
|
|
|
@@ -151,11 +151,13 @@ const defaults = deepDefaults(
|
|
|
151
151
|
let button: typeof defaults;
|
|
152
152
|
setDefault(() => {
|
|
153
153
|
button = deepDefaults(theme, {button: defaults}).button;
|
|
154
|
+
makeButtonStyles?.clearCache();
|
|
155
|
+
makeButtonGroupStyles?.clearCache();
|
|
154
156
|
});
|
|
155
157
|
|
|
156
158
|
export {button};
|
|
157
159
|
|
|
158
|
-
export function makeButtonStyles(k: string, iconSide?: string) {
|
|
160
|
+
export const makeButtonStyles = cache(function makeButtonStyles(k: string, iconSide?: string) {
|
|
159
161
|
const {secondary, link} = button;
|
|
160
162
|
|
|
161
163
|
return cx(
|
|
@@ -413,9 +415,9 @@ export function makeButtonStyles(k: string, iconSide?: string) {
|
|
|
413
415
|
`}
|
|
414
416
|
`
|
|
415
417
|
);
|
|
416
|
-
}
|
|
418
|
+
});
|
|
417
419
|
|
|
418
|
-
export function makeButtonGroupStyles(k: string) {
|
|
420
|
+
export const makeButtonGroupStyles = cache(function makeButtonGroupStyles(k: string) {
|
|
419
421
|
return css`
|
|
420
422
|
display: inline-flex;
|
|
421
423
|
align-items: center;
|
|
@@ -519,4 +521,4 @@ export function makeButtonGroupStyles(k: string) {
|
|
|
519
521
|
}
|
|
520
522
|
}
|
|
521
523
|
`;
|
|
522
|
-
}
|
|
524
|
+
});
|
|
@@ -2,6 +2,7 @@ import {css} from '@emotion/css';
|
|
|
2
2
|
import {theme, setDefault} from '../../styles/theme';
|
|
3
3
|
import {deepDefaults} from '../../styles/utils';
|
|
4
4
|
import '../../styles/global';
|
|
5
|
+
import { cache } from '../utils';
|
|
5
6
|
|
|
6
7
|
const defaults = {
|
|
7
8
|
border: '1px solid #e5e5e5',
|
|
@@ -16,9 +17,10 @@ const defaults = {
|
|
|
16
17
|
let card: typeof defaults;
|
|
17
18
|
setDefault(() => {
|
|
18
19
|
card = deepDefaults(theme, {card: defaults}).card;
|
|
20
|
+
makeStyles?.clearCache();
|
|
19
21
|
});
|
|
20
22
|
|
|
21
|
-
export function makeStyles(k: string) {
|
|
23
|
+
export const makeStyles = cache(function makeStyles(k: string) {
|
|
22
24
|
return css`
|
|
23
25
|
border-radius: ${card.borderRadius};
|
|
24
26
|
background: ${card.bgColor};
|
|
@@ -89,4 +91,4 @@ export function makeStyles(k: string) {
|
|
|
89
91
|
}
|
|
90
92
|
}
|
|
91
93
|
`;
|
|
92
|
-
}
|
|
94
|
+
});
|
|
@@ -2,6 +2,7 @@ import {css} from '@emotion/css';
|
|
|
2
2
|
import {theme, setDefault} from '../../styles/theme';
|
|
3
3
|
import {deepDefaults} from '../../styles/utils';
|
|
4
4
|
import '../../styles/global';
|
|
5
|
+
import { cache } from '../utils';
|
|
5
6
|
|
|
6
7
|
const defaults = {
|
|
7
8
|
get transition() { return theme.transition.large },
|
|
@@ -37,9 +38,11 @@ const defaults = {
|
|
|
37
38
|
let carousel: typeof defaults;
|
|
38
39
|
setDefault(() => {
|
|
39
40
|
carousel = deepDefaults(theme, {carousel: defaults}).carousel;
|
|
41
|
+
makeStyles?.clearCache();
|
|
42
|
+
makeItemStyles?.clearCache();
|
|
40
43
|
});
|
|
41
44
|
|
|
42
|
-
export function makeStyles(k: string) {
|
|
45
|
+
export const makeStyles = cache(function makeStyles(k: string) {
|
|
43
46
|
return css`
|
|
44
47
|
height: ${carousel.height};
|
|
45
48
|
position: relative;
|
|
@@ -129,9 +132,9 @@ export function makeStyles(k: string) {
|
|
|
129
132
|
}
|
|
130
133
|
}
|
|
131
134
|
`;
|
|
132
|
-
}
|
|
135
|
+
});
|
|
133
136
|
|
|
134
|
-
export function makeItemStyles(k: string) {
|
|
137
|
+
export const makeItemStyles = cache(function makeItemStyles(k: string) {
|
|
135
138
|
return css`
|
|
136
139
|
display: inline-block;
|
|
137
140
|
width: 100%;
|
|
@@ -147,4 +150,4 @@ export function makeItemStyles(k: string) {
|
|
|
147
150
|
opacity: 0;
|
|
148
151
|
}
|
|
149
152
|
`
|
|
150
|
-
}
|
|
153
|
+
});
|
|
@@ -3,7 +3,7 @@ import {Icon} from '../icon';
|
|
|
3
3
|
import {_$} from '../../i18n';
|
|
4
4
|
import {makeMenuStyles, makeFilterMenuStyles} from './styles';
|
|
5
5
|
|
|
6
|
-
const {data, trigger, filterable, fields} = this.get();
|
|
6
|
+
const {data, trigger, filterable, fields, multiple} = this.get();
|
|
7
7
|
const { k } = this.config;
|
|
8
8
|
const baseMenuStyles = makeMenuStyles(k);
|
|
9
9
|
const classNameObj = {
|
|
@@ -38,6 +38,7 @@ const Options = (data, level, loaded, parentSelected) => {
|
|
|
38
38
|
[`${k}-selected`]: selected,
|
|
39
39
|
}}
|
|
40
40
|
ev-select={onSelect.bind(null, value, level)}
|
|
41
|
+
hideOnSelect={!multiple}
|
|
41
42
|
>
|
|
42
43
|
{getField(item, 'label')}
|
|
43
44
|
<Icon v-if={children}
|
|
@@ -2,6 +2,7 @@ import {css} from '@emotion/css';
|
|
|
2
2
|
import {theme, setDefault} from '../../styles/theme';
|
|
3
3
|
import {deepDefaults, sizes, Sizes, getRight, getLeft} from '../../styles/utils';
|
|
4
4
|
import '../../styles/global';
|
|
5
|
+
import { cache } from '../utils';
|
|
5
6
|
|
|
6
7
|
const defaults = {
|
|
7
8
|
width: '140px',
|
|
@@ -28,9 +29,11 @@ const defaults = {
|
|
|
28
29
|
let cascader: typeof defaults;
|
|
29
30
|
setDefault(() => {
|
|
30
31
|
cascader = deepDefaults(theme, {cascader: defaults}).cascader;
|
|
32
|
+
makeMenuStyles?.clearCache();
|
|
33
|
+
makeFilterMenuStyles?.clearCache();
|
|
31
34
|
});
|
|
32
35
|
|
|
33
|
-
export function makeMenuStyles(k: string) {
|
|
36
|
+
export const makeMenuStyles = cache(function makeMenuStyles(k: string) {
|
|
34
37
|
return css`
|
|
35
38
|
min-width: ${cascader.width} !important;
|
|
36
39
|
height: ${cascader.height};
|
|
@@ -63,9 +66,9 @@ export function makeMenuStyles(k: string) {
|
|
|
63
66
|
}
|
|
64
67
|
}
|
|
65
68
|
`;
|
|
66
|
-
}
|
|
69
|
+
});
|
|
67
70
|
|
|
68
|
-
export function makeFilterMenuStyles(k: string) {
|
|
71
|
+
export const makeFilterMenuStyles = cache(function makeFilterMenuStyles(k: string) {
|
|
69
72
|
return css`
|
|
70
73
|
min-width: ${cascader.filter.minWidth} !important;
|
|
71
74
|
height: auto;
|
|
@@ -75,4 +78,4 @@ export function makeFilterMenuStyles(k: string) {
|
|
|
75
78
|
color: ${cascader.filter.highlightColor};
|
|
76
79
|
}
|
|
77
80
|
`;
|
|
78
|
-
}
|
|
81
|
+
});
|
|
@@ -2,6 +2,7 @@ import {css, cx} from '@emotion/css';
|
|
|
2
2
|
import {theme, setDefault} from '../../styles/theme';
|
|
3
3
|
import {deepDefaults, palette, getLeft} from '../../styles/utils';
|
|
4
4
|
import '../../styles/global';
|
|
5
|
+
import { cache } from '../utils';
|
|
5
6
|
|
|
6
7
|
const defaults = {
|
|
7
8
|
width: '16px',
|
|
@@ -53,9 +54,10 @@ const defaults = {
|
|
|
53
54
|
let checkbox: typeof defaults;
|
|
54
55
|
setDefault(() => {
|
|
55
56
|
checkbox = deepDefaults(theme, {checkbox: defaults}).checkbox;
|
|
57
|
+
makeStyles?.clearCache();
|
|
56
58
|
});
|
|
57
59
|
|
|
58
|
-
export
|
|
60
|
+
export const makeStyles = cache(function makeStyles(k: string) {
|
|
59
61
|
return css`
|
|
60
62
|
display: inline-flex;
|
|
61
63
|
align-items: center;
|
|
@@ -169,4 +171,4 @@ export default function makeStyles(k: string) {
|
|
|
169
171
|
|
|
170
172
|
}
|
|
171
173
|
`;
|
|
172
|
-
}
|
|
174
|
+
});
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {css} from '@emotion/css';
|
|
2
2
|
import '../../styles/global';
|
|
3
|
+
import { cache } from '../utils';
|
|
3
4
|
|
|
4
|
-
export function makeStyles(k: string) {
|
|
5
|
+
export const makeStyles = cache(function makeStyles(k: string) {
|
|
5
6
|
return css`
|
|
6
7
|
position: relative;
|
|
7
8
|
height: 100%;
|
|
8
9
|
`;
|
|
9
|
-
}
|
|
10
|
+
});
|
|
@@ -11,7 +11,7 @@ describe('Collapse', () => {
|
|
|
11
11
|
this.timeout(0);
|
|
12
12
|
const [instance, element] = mount(BasicDemo);
|
|
13
13
|
|
|
14
|
-
const [title1, title2, title3] = element.querySelectorAll<HTMLElement>(':scope > .k-collapse-title');
|
|
14
|
+
const [title1, title2, title3] = element.querySelectorAll<HTMLElement>(':scope > .k-collapse-item > .k-collapse-title');
|
|
15
15
|
title2.click();
|
|
16
16
|
await wait(500);
|
|
17
17
|
// the innerHTML is different on travis and local environment
|
|
@@ -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
|
|
@@ -2,11 +2,11 @@ import {deepDefaults} from '../../styles/utils';
|
|
|
2
2
|
import {theme, setDefault} from '../../styles/theme';
|
|
3
3
|
import {css} from '@emotion/css';
|
|
4
4
|
import '../../styles/global';
|
|
5
|
+
import { cache } from '../utils';
|
|
5
6
|
|
|
6
7
|
const defaults = {
|
|
7
8
|
get transition() { return theme.transition.large },
|
|
8
9
|
fontSize: '12px',
|
|
9
|
-
titleMarginRight: '8px',
|
|
10
10
|
borderPadding: '0 24px',
|
|
11
11
|
collBorder: '1px solid #eee',
|
|
12
12
|
get borderRadius() {
|
|
@@ -16,22 +16,24 @@ const defaults = {
|
|
|
16
16
|
item: {
|
|
17
17
|
borderBottom: '1px solid #e5e5e5',
|
|
18
18
|
titleHeight: '40px',
|
|
19
|
+
titleGap: '8px',
|
|
19
20
|
}
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
let collapse: typeof defaults;
|
|
23
24
|
setDefault(() => {
|
|
24
25
|
collapse = deepDefaults(theme, {collapse: defaults}).collapse;
|
|
26
|
+
makeStyles?.clearCache();
|
|
27
|
+
makeItemStyles?.clearCache();
|
|
25
28
|
});
|
|
26
29
|
|
|
27
|
-
export function makeStyles(k: string) {
|
|
30
|
+
export const makeStyles = cache(function makeStyles(k: string) {
|
|
28
31
|
return css`
|
|
29
32
|
font-size: ${collapse.fontSize};
|
|
30
33
|
|
|
31
34
|
&.${k}-left {
|
|
32
|
-
.${k}-collapse-
|
|
33
|
-
|
|
34
|
-
margin-right: ${collapse.titleMarginRight};
|
|
35
|
+
> .${k}-collapse-item > .${k}-collapse-title {
|
|
36
|
+
flex-direction: row-reverse;
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -41,9 +43,9 @@ export function makeStyles(k: string) {
|
|
|
41
43
|
border: ${collapse.collBorder};
|
|
42
44
|
}
|
|
43
45
|
`;
|
|
44
|
-
}
|
|
46
|
+
});
|
|
45
47
|
|
|
46
|
-
export function makeItemStyles(k: string) {
|
|
48
|
+
export const makeItemStyles = cache(function makeItemStyles(k: string) {
|
|
47
49
|
const collapseItem = collapse.item;
|
|
48
50
|
return css`
|
|
49
51
|
border-bottom: ${collapseItem.borderBottom};
|
|
@@ -55,13 +57,15 @@ export function makeItemStyles(k: string) {
|
|
|
55
57
|
cursor: pointer;
|
|
56
58
|
font-weight: bold;
|
|
57
59
|
height: ${collapseItem.titleHeight};
|
|
58
|
-
line-height: ${collapseItem.titleHeight};
|
|
59
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
|
+
}
|
|
60
67
|
.${k}-collapse-arrow {
|
|
61
|
-
float: right;
|
|
62
68
|
transition: transform ${collapse.transition};
|
|
63
|
-
line-height: ${collapseItem.titleHeight};
|
|
64
|
-
height: ${collapseItem.titleHeight};
|
|
65
69
|
}
|
|
66
70
|
}
|
|
67
71
|
|
|
@@ -86,4 +90,4 @@ export function makeItemStyles(k: string) {
|
|
|
86
90
|
}
|
|
87
91
|
}
|
|
88
92
|
`;
|
|
89
|
-
}
|
|
93
|
+
});
|
|
@@ -3,6 +3,7 @@ import {theme, setDefault} from '../../styles/theme';
|
|
|
3
3
|
import {deepDefaults, sizes, Sizes} from '../../styles/utils';
|
|
4
4
|
import '../../styles/global';
|
|
5
5
|
import {ColorFormats} from 'tinycolor2';
|
|
6
|
+
import { cache } from '../utils';
|
|
6
7
|
|
|
7
8
|
const defaults = {
|
|
8
9
|
get height() { return theme.default.height },
|
|
@@ -88,11 +89,13 @@ const defaults = {
|
|
|
88
89
|
let colorpicker: typeof defaults;
|
|
89
90
|
setDefault(() => {
|
|
90
91
|
colorpicker = deepDefaults(theme, {colorpicker: defaults}).colorpicker;
|
|
92
|
+
makeStyles?.clearCache();
|
|
93
|
+
makePanelStyles?.clearCache();
|
|
91
94
|
});
|
|
92
95
|
|
|
93
96
|
const _sizes = ['large', 'small', 'mini'] as const;
|
|
94
97
|
|
|
95
|
-
export function makeStyles(k: string) {
|
|
98
|
+
export const makeStyles = cache(function makeStyles(k: string) {
|
|
96
99
|
return css`
|
|
97
100
|
display: inline-block;
|
|
98
101
|
vertical-align: middle;
|
|
@@ -133,9 +136,9 @@ export function makeStyles(k: string) {
|
|
|
133
136
|
}
|
|
134
137
|
}
|
|
135
138
|
`;
|
|
136
|
-
}
|
|
139
|
+
});
|
|
137
140
|
|
|
138
|
-
export function makePanelStyles(k: string) {
|
|
141
|
+
export const makePanelStyles = cache(function makePanelStyles(k: string) {
|
|
139
142
|
return css`
|
|
140
143
|
padding: ${colorpicker.panel.padding};
|
|
141
144
|
width: ${colorpicker.panel.width};
|
|
@@ -267,7 +270,7 @@ export function makePanelStyles(k: string) {
|
|
|
267
270
|
user-select: none;
|
|
268
271
|
}
|
|
269
272
|
`
|
|
270
|
-
}
|
|
273
|
+
});
|
|
271
274
|
|
|
272
275
|
export function makeAlphaBgColor({r, g, b}: ColorFormats.RGBA, k: string) {
|
|
273
276
|
return css`
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {css} from '@emotion/css';
|
|
2
2
|
import '../../styles/global';
|
|
3
|
+
import { cache } from '../utils';
|
|
3
4
|
|
|
4
|
-
export function makeStyles(k: string) {
|
|
5
|
+
export const makeStyles = cache(function makeStyles(k: string) {
|
|
5
6
|
return css`
|
|
6
7
|
cursor: pointer;
|
|
7
8
|
vertical-align: middle;
|
|
8
9
|
`
|
|
9
|
-
}
|
|
10
|
+
});
|
|
@@ -2,6 +2,7 @@ import {css} from '@emotion/css';
|
|
|
2
2
|
import {theme, setDefault} from '../../styles/theme';
|
|
3
3
|
import {deepDefaults, sizes, Sizes, getRight, getLeft, palette} from '../../styles/utils';
|
|
4
4
|
import '../../styles/global';
|
|
5
|
+
import { cache } from '../utils';
|
|
5
6
|
|
|
6
7
|
const defaults = {
|
|
7
8
|
width: `300px`,
|
|
@@ -62,11 +63,14 @@ const defaults = {
|
|
|
62
63
|
let datepicker: typeof defaults;
|
|
63
64
|
setDefault(() => {
|
|
64
65
|
datepicker = deepDefaults(theme, {datepicker: defaults}).datepicker;
|
|
66
|
+
makePanelStyles?.clearCache();
|
|
67
|
+
makeCalendarStyles?.clearCache();
|
|
68
|
+
makeTimeStyles?.clearCache();
|
|
65
69
|
});
|
|
66
70
|
|
|
67
71
|
export {datepicker};
|
|
68
72
|
|
|
69
|
-
export function makePanelStyles(k: string) {
|
|
73
|
+
export const makePanelStyles = cache(function makePanelStyles(k: string) {
|
|
70
74
|
return css`
|
|
71
75
|
display: flex;
|
|
72
76
|
.${k}-datepicker-shortcuts {
|
|
@@ -106,9 +110,9 @@ export function makePanelStyles(k: string) {
|
|
|
106
110
|
text-align: right;
|
|
107
111
|
}
|
|
108
112
|
`
|
|
109
|
-
}
|
|
113
|
+
});
|
|
110
114
|
|
|
111
|
-
export function makeCalendarStyles(k: string) {
|
|
115
|
+
export const makeCalendarStyles = cache(function makeCalendarStyles(k: string) {
|
|
112
116
|
return css`
|
|
113
117
|
padding: ${datepicker.padding};
|
|
114
118
|
width: ${datepicker.width};
|
|
@@ -207,9 +211,9 @@ export function makeCalendarStyles(k: string) {
|
|
|
207
211
|
grid-template-columns: repeat(4, 1fr);
|
|
208
212
|
}
|
|
209
213
|
`
|
|
210
|
-
}
|
|
214
|
+
});
|
|
211
215
|
|
|
212
|
-
export function makeTimeStyles(k: string) {
|
|
216
|
+
export const makeTimeStyles = cache(function makeTimeStyles(k: string) {
|
|
213
217
|
return css`
|
|
214
218
|
display: flex;
|
|
215
219
|
padding: ${datepicker.padding};
|
|
@@ -220,4 +224,4 @@ export function makeTimeStyles(k: string) {
|
|
|
220
224
|
height: 305px;
|
|
221
225
|
}
|
|
222
226
|
`;
|
|
223
|
-
}
|
|
227
|
+
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {css} from '@emotion/css';
|
|
2
2
|
import '../../styles/global';
|
|
3
|
+
import { cache } from '../utils';
|
|
3
4
|
|
|
4
|
-
export function makeStyles(k: string) {
|
|
5
|
+
export const makeStyles = cache(function makeStyles(k: string) {
|
|
5
6
|
return css`
|
|
6
7
|
display: inline-block;
|
|
7
8
|
overflow: auto;
|
|
@@ -32,4 +33,4 @@ export function makeStyles(k: string) {
|
|
|
32
33
|
margin: 0;
|
|
33
34
|
}
|
|
34
35
|
`;
|
|
35
|
-
}
|
|
36
|
+
});
|
|
@@ -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>`,
|
|
@@ -2,6 +2,7 @@ import {css} from '@emotion/css';
|
|
|
2
2
|
import {theme, setDefault} from '../../styles/theme';
|
|
3
3
|
import {deepDefaults} from '../../styles/utils';
|
|
4
4
|
import '../../styles/global';
|
|
5
|
+
import { cache } from '../utils';
|
|
5
6
|
|
|
6
7
|
const defaults = {
|
|
7
8
|
width: '800px',
|
|
@@ -66,9 +67,12 @@ const defaults = {
|
|
|
66
67
|
let dialog: typeof defaults;
|
|
67
68
|
setDefault(() => {
|
|
68
69
|
dialog = deepDefaults(theme, {dialog: defaults}).dialog;
|
|
70
|
+
makeDialogStyles?.clearCache();
|
|
71
|
+
makeWrapperStyles?.clearCache();
|
|
72
|
+
makeAlertStyles?.clearCache();
|
|
69
73
|
});
|
|
70
74
|
|
|
71
|
-
export function makeDialogStyles(k: string) {
|
|
75
|
+
export const makeDialogStyles = cache(function makeDialogStyles(k: string) {
|
|
72
76
|
return css`
|
|
73
77
|
position: absolute;
|
|
74
78
|
width: ${dialog.width};
|
|
@@ -151,9 +155,9 @@ export function makeDialogStyles(k: string) {
|
|
|
151
155
|
}
|
|
152
156
|
}
|
|
153
157
|
`;
|
|
154
|
-
}
|
|
158
|
+
});
|
|
155
159
|
|
|
156
|
-
export function makeWrapperStyles(k: string) {
|
|
160
|
+
export const makeWrapperStyles = cache(function makeWrapperStyles(k: string) {
|
|
157
161
|
//.${k}-fade-leave-active will add position absolute to the styles
|
|
158
162
|
// so we must set fixed with important to .${k}-dialog-overlay
|
|
159
163
|
return css`
|
|
@@ -172,9 +176,9 @@ export function makeWrapperStyles(k: string) {
|
|
|
172
176
|
overflow: auto;
|
|
173
177
|
}
|
|
174
178
|
`;
|
|
175
|
-
}
|
|
179
|
+
});
|
|
176
180
|
|
|
177
|
-
export function makeAlertStyles(k: string) {
|
|
181
|
+
export const makeAlertStyles = cache(function makeAlertStyles(k: string) {
|
|
178
182
|
return css`
|
|
179
183
|
&.${k}-alert-dialog {
|
|
180
184
|
.${k}-dialog-body {
|
|
@@ -238,4 +242,4 @@ export function makeAlertStyles(k: string) {
|
|
|
238
242
|
}
|
|
239
243
|
}
|
|
240
244
|
`
|
|
241
|
-
}
|
|
245
|
+
});
|
|
@@ -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!, {
|
|
@@ -2,6 +2,7 @@ import {css} from '@emotion/css';
|
|
|
2
2
|
import {theme, setDefault} from '../../styles/theme';
|
|
3
3
|
import {deepDefaults} from '../../styles/utils';
|
|
4
4
|
import '../../styles/global';
|
|
5
|
+
import { cache } from '../utils';
|
|
5
6
|
|
|
6
7
|
type ValueOf<T extends readonly any[]> = T[number]
|
|
7
8
|
|
|
@@ -17,9 +18,10 @@ const defaults = {
|
|
|
17
18
|
let drawer: typeof defaults;
|
|
18
19
|
setDefault(() => {
|
|
19
20
|
drawer = deepDefaults(theme, {drawer: defaults}).drawer;
|
|
21
|
+
makeStyles?.clearCache();
|
|
20
22
|
});
|
|
21
23
|
|
|
22
|
-
export function makeStyles(overlay: boolean, k: string) {
|
|
24
|
+
export const makeStyles = cache(function makeStyles(overlay: boolean, k: string) {
|
|
23
25
|
const borderRadius = theme.largeBorderRadius;
|
|
24
26
|
return css`
|
|
25
27
|
&.k-drawer {
|
|
@@ -61,7 +63,7 @@ export function makeStyles(overlay: boolean, k: string) {
|
|
|
61
63
|
width: 100%;
|
|
62
64
|
}
|
|
63
65
|
`;
|
|
64
|
-
}
|
|
66
|
+
});
|
|
65
67
|
|
|
66
68
|
function makePlacementStyles(k: string, placement: string, styles: string, transform: string, borderRadius: string) {
|
|
67
69
|
return css`
|