kui-vue 4.0.2 → 4.0.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/anchor/demo/basic.md +29 -16
- package/components/anchor/demo/nestedAnchors.md +8 -8
- package/components/anchor/demo/withinContainer.md +7 -7
- package/components/menu/styles/index.less +4 -0
- package/components/select/select.jsx +3 -3
- package/components/treeselect/treeselect.jsx +3 -3
- package/components/utils/theme.js +31 -33
- package/dist/k-ui.cjs.js +2 -2
- package/dist/k-ui.css +2 -2
- package/dist/k-ui.d.ts +44 -44
- package/dist/k-ui.esm.js +2 -2
- package/dist/k-ui.umd.js +2 -2
- package/dist/locale/de.js +1 -1
- package/dist/locale/el.js +1 -1
- package/dist/locale/en.js +1 -1
- package/dist/locale/fr.js +1 -1
- package/dist/locale/it.js +1 -1
- package/dist/locale/ja.js +1 -1
- package/dist/locale/ko.js +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/th.js +1 -1
- package/dist/locale/uk.js +1 -1
- package/dist/locale/vi.js +1 -1
- package/dist/locale/zh-CN.js +1 -1
- package/dist/locale/zh-TW.js +1 -1
- package/package.json +8 -8
- package/types/index.d.ts +6 -6
|
@@ -9,30 +9,43 @@ The most common scenario: displaying a long article on the right with fixed anch
|
|
|
9
9
|
|
|
10
10
|
```vue
|
|
11
11
|
<template>
|
|
12
|
-
<
|
|
13
|
-
<
|
|
14
|
-
<
|
|
15
|
-
<section id="part-1" style="
|
|
12
|
+
<Layout class="anchor-d1">
|
|
13
|
+
<Row :gutter="24">
|
|
14
|
+
<Col :span="18">
|
|
15
|
+
<section id="part-1" style="margin-bottom: 20px; ">
|
|
16
16
|
<h2>Part 1:Basic</h2>
|
|
17
17
|
<p>Here is the basic content...</p>
|
|
18
18
|
</section>
|
|
19
|
-
<section id="part-2" style="
|
|
19
|
+
<section id="part-2" style=" margin-bottom: 20px; ">
|
|
20
20
|
<h2>Part 2:Guide</h2>
|
|
21
21
|
<p>Here is the advanced content...</p>
|
|
22
22
|
</section>
|
|
23
|
-
<section id="part-3"
|
|
23
|
+
<section id="part-3">
|
|
24
24
|
<h2>Part 3:FQA</h2>
|
|
25
25
|
<p>Here is the FAQ content...</p>
|
|
26
26
|
</section>
|
|
27
|
-
</
|
|
28
|
-
<
|
|
29
|
-
<
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
<
|
|
33
|
-
</
|
|
34
|
-
</
|
|
35
|
-
</
|
|
36
|
-
</
|
|
27
|
+
</Col>
|
|
28
|
+
<Col :span="6">
|
|
29
|
+
<Anchor :offsetTop="20" container=".anchor-d1">
|
|
30
|
+
<AnchorLink href="#part-1" title="Basic" />
|
|
31
|
+
<AnchorLink href="#part-2" title="Guide" />
|
|
32
|
+
<AnchorLink href="#part-3" title="FAQ" />
|
|
33
|
+
</Anchor>
|
|
34
|
+
</Col>
|
|
35
|
+
</Row>
|
|
36
|
+
</Layout>
|
|
37
37
|
</template>
|
|
38
|
+
<style scoped>
|
|
39
|
+
.anchor-d1 {
|
|
40
|
+
background: var(--kui-color-bg);
|
|
41
|
+
padding: 24px;
|
|
42
|
+
max-height: 500px;
|
|
43
|
+
overflow: auto;
|
|
44
|
+
}
|
|
45
|
+
section {
|
|
46
|
+
height: 500px;
|
|
47
|
+
background: var(--kui-color-bg-container);
|
|
48
|
+
padding: 20px;
|
|
49
|
+
}
|
|
50
|
+
</style>
|
|
38
51
|
```
|
|
@@ -25,14 +25,14 @@ Suitable for documents with multi-level headings.
|
|
|
25
25
|
</Col>
|
|
26
26
|
|
|
27
27
|
<Col style="width: 200px; padding-top: 40px;">
|
|
28
|
-
<
|
|
29
|
-
<
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
</
|
|
33
|
-
<
|
|
34
|
-
</
|
|
35
|
-
</
|
|
28
|
+
<Anchor container=".anchor-d2">
|
|
29
|
+
<AnchorLink href="#api" title="API">
|
|
30
|
+
<AnchorLink href="#props" title="Props">
|
|
31
|
+
<AnchorLink href="#anchor-props" title="Anchor Props" />
|
|
32
|
+
</AnchorLink>
|
|
33
|
+
<AnchorLink href="#events" title="Events" />
|
|
34
|
+
</AnchorLink>
|
|
35
|
+
</Anchor>
|
|
36
36
|
</Col>
|
|
37
37
|
</Row>
|
|
38
38
|
</template>
|
|
@@ -14,17 +14,17 @@ If your page does not scroll in full screen but within a specific div.
|
|
|
14
14
|
<Col :span="18">
|
|
15
15
|
<div
|
|
16
16
|
class="scroll-content"
|
|
17
|
-
style="height: 300px; overflow-y: scroll; border: 1px solid
|
|
17
|
+
style="height: 300px; overflow-y: scroll; border: 1px solid var(--kui-color-border);"
|
|
18
18
|
>
|
|
19
|
-
<div id="item-1" style="height: 400px; background: #
|
|
20
|
-
<div id="item-2" style="height: 400px; background: #
|
|
19
|
+
<div id="item-1" style="height: 400px; background: #e6f7ff3c;">content 1</div>
|
|
20
|
+
<div id="item-2" style="height: 400px; background: #fff7e640;">content 2</div>
|
|
21
21
|
</div>
|
|
22
22
|
</Col>
|
|
23
23
|
<Col :span="6">
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
<
|
|
27
|
-
</
|
|
24
|
+
<Anchor container=".scroll-content">
|
|
25
|
+
<AnchorLink href="#item-1" title="part 1" />
|
|
26
|
+
<AnchorLink href="#item-2" title="part 2" />
|
|
27
|
+
</Anchor>
|
|
28
28
|
</Col>
|
|
29
29
|
</Row>
|
|
30
30
|
</div>
|
|
@@ -32,6 +32,8 @@
|
|
|
32
32
|
white-space: nowrap;
|
|
33
33
|
transition: font-size 0.3s ease-in-out;
|
|
34
34
|
line-height: 1;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
text-overflow: ellipsis;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
.k-menu-item-icon {
|
|
@@ -170,6 +172,8 @@
|
|
|
170
172
|
border-radius: var(--kui-border-radius);
|
|
171
173
|
.k-menu-submenu-title-content {
|
|
172
174
|
flex: 1;
|
|
175
|
+
overflow: hidden;
|
|
176
|
+
text-overflow: ellipsis;
|
|
173
177
|
}
|
|
174
178
|
.k-menu-submenu-arrow {
|
|
175
179
|
&::after,
|
|
@@ -466,7 +466,7 @@ const Select = defineComponent({
|
|
|
466
466
|
const loadingNode = (
|
|
467
467
|
<div class="k-select-loading">
|
|
468
468
|
<Icon type={Loading} spin />
|
|
469
|
-
<span>{locale.value
|
|
469
|
+
<span>{locale.value?.k.select.loading}</span>
|
|
470
470
|
</div>
|
|
471
471
|
);
|
|
472
472
|
overlay = (
|
|
@@ -477,7 +477,7 @@ const Select = defineComponent({
|
|
|
477
477
|
) : optionNodes.length ? (
|
|
478
478
|
<ul>{optionNodes}</ul>
|
|
479
479
|
) : (
|
|
480
|
-
<Empty onClick={emptyClick} description={locale.value
|
|
480
|
+
<Empty onClick={emptyClick} description={locale.value?.k.select.emptyText} />
|
|
481
481
|
)}
|
|
482
482
|
</div>
|
|
483
483
|
</Transition>
|
|
@@ -526,7 +526,7 @@ const Select = defineComponent({
|
|
|
526
526
|
</div>
|
|
527
527
|
);
|
|
528
528
|
|
|
529
|
-
const placeholderText = placeholder || locale?.
|
|
529
|
+
const placeholderText = placeholder || locale.value?.k.select.placeholder;
|
|
530
530
|
const placeNode =
|
|
531
531
|
placeholderText && isEmpty(labelText.value) && !queryKey.value ? (
|
|
532
532
|
<div class="k-select-placeholder">{placeholderText}</div>
|
|
@@ -394,7 +394,7 @@ const TreeSelect = defineComponent({
|
|
|
394
394
|
const loadingNode = (
|
|
395
395
|
<div class="k-tree-select-loading">
|
|
396
396
|
<Icon type={Loading} spin />
|
|
397
|
-
<span>{locale?.
|
|
397
|
+
<span>{locale.value?.k.select.loading}</span>
|
|
398
398
|
</div>
|
|
399
399
|
);
|
|
400
400
|
overlay = (
|
|
@@ -405,7 +405,7 @@ const TreeSelect = defineComponent({
|
|
|
405
405
|
) : ps.treeData?.length ? (
|
|
406
406
|
renderTree()
|
|
407
407
|
) : (
|
|
408
|
-
<Empty onClick={emptyClick} description={locale?.
|
|
408
|
+
<Empty onClick={emptyClick} description={locale.value?.k.select.emptyText} />
|
|
409
409
|
)}
|
|
410
410
|
</div>
|
|
411
411
|
</Transition>
|
|
@@ -454,7 +454,7 @@ const TreeSelect = defineComponent({
|
|
|
454
454
|
</div>
|
|
455
455
|
);
|
|
456
456
|
|
|
457
|
-
const placeholderText = placeholder || locale?.
|
|
457
|
+
const placeholderText = placeholder || locale.value?.k.select.placeholder;
|
|
458
458
|
const placeNode =
|
|
459
459
|
placeholderText && isEmpty(labelText.value) && !queryKey.value ? (
|
|
460
460
|
<div class="k-tree-select-placeholder">{placeholderText}</div>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { nextTick } from "vue";
|
|
1
2
|
import { withInstall } from "./vue";
|
|
2
3
|
const THEME_KEY = "theme-mode";
|
|
3
|
-
const
|
|
4
|
+
const toggleTheme = () => {
|
|
4
5
|
const isDark = localStorage.getItem(THEME_KEY) == "dark";
|
|
5
6
|
const root = document.documentElement;
|
|
6
7
|
if (isDark) {
|
|
@@ -16,46 +17,43 @@ const toggle = () => {
|
|
|
16
17
|
const Theme = {
|
|
17
18
|
name: "Theme",
|
|
18
19
|
setThemeMode(event, callback) {
|
|
20
|
+
const isAppearanceTransition =
|
|
21
|
+
document.startViewTransition &&
|
|
22
|
+
!window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
23
|
+
if (!isAppearanceTransition || !event) {
|
|
24
|
+
const isDark = toggleTheme();
|
|
25
|
+
callback?.(isDark);
|
|
26
|
+
}
|
|
19
27
|
const x = event.clientX;
|
|
20
28
|
const y = event.clientY;
|
|
21
29
|
const endRadius = Math.hypot(
|
|
22
30
|
Math.max(x, window.innerWidth - x),
|
|
23
31
|
Math.max(y, window.innerHeight - y)
|
|
24
32
|
);
|
|
25
|
-
|
|
26
|
-
let isDark = localStorage.getItem("theme") == "dark";
|
|
33
|
+
let isDark = localStorage.getItem(THEME_KEY) == "dark";
|
|
27
34
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
.startViewTransition(() => {
|
|
31
|
-
isDark = toggle();
|
|
32
|
-
callback?.(isDark);
|
|
33
|
-
})
|
|
34
|
-
.ready.then(() => {
|
|
35
|
-
const clippath = [
|
|
36
|
-
`circle(0px at ${x}px ${y}px)`,
|
|
37
|
-
`circle(${endRadius}px at ${x}px ${y}px)`,
|
|
38
|
-
];
|
|
39
|
-
const ani = root.animate(
|
|
40
|
-
{
|
|
41
|
-
clipPath: !isDark ? clippath.reverse() : clippath,
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
duration: 500,
|
|
45
|
-
easing: "ease-in-out",
|
|
46
|
-
pseudoElement: !isDark
|
|
47
|
-
? "::view-transition-old(root)"
|
|
48
|
-
: "::view-transition-new(root)",
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
ani.onfinish = () => {
|
|
52
|
-
// root.style.clipPath = "none";
|
|
53
|
-
};
|
|
54
|
-
});
|
|
55
|
-
} else {
|
|
56
|
-
isDark = toggle();
|
|
35
|
+
const transition = document.startViewTransition(async () => {
|
|
36
|
+
isDark = toggleTheme();
|
|
57
37
|
callback?.(isDark);
|
|
58
|
-
|
|
38
|
+
await nextTick();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
transition.ready.then(() => {
|
|
42
|
+
const clipPath = [`circle(0px at ${x}px ${y}px)`, `circle(${endRadius}px at ${x}px ${y}px)`];
|
|
43
|
+
const animate = document.documentElement.animate(
|
|
44
|
+
{
|
|
45
|
+
clipPath: !isDark ? clipPath.reverse() : clipPath,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
duration: 500,
|
|
49
|
+
easing: "ease-in-out",
|
|
50
|
+
pseudoElement: !isDark ? "::view-transition-old(root)" : "::view-transition-new(root)",
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
animate.onfinish = () => {
|
|
54
|
+
transition.skipTransition();
|
|
55
|
+
};
|
|
56
|
+
});
|
|
59
57
|
},
|
|
60
58
|
};
|
|
61
59
|
|