@varlet/cli 1.27.20 → 2.0.0-alpha.1663742071515
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/LICENCE +1 -1
- package/lib/commands/commitLint.js +1 -1
- package/lib/commands/compile.d.ts +5 -3
- package/lib/commands/compile.js +2 -2
- package/lib/commands/create.d.ts +8 -3
- package/lib/commands/create.js +100 -51
- package/lib/commands/dev.d.ts +4 -2
- package/lib/commands/dev.js +3 -3
- package/lib/commands/gen.d.ts +8 -1
- package/lib/commands/gen.js +61 -33
- package/lib/commands/jest.js +11 -7
- package/lib/commands/release.d.ts +4 -2
- package/lib/commands/release.js +2 -2
- package/lib/commands/test.d.ts +7 -0
- package/lib/commands/test.js +26 -0
- package/lib/commands/useVite.d.ts +1 -0
- package/lib/commands/useVite.js +70 -0
- package/lib/commands/vite.d.ts +3 -0
- package/lib/commands/vite.js +69 -0
- package/lib/compiler/compileModule.js +9 -5
- package/lib/compiler/compileSFC.js +14 -11
- package/lib/compiler/compileScript.js +4 -12
- package/lib/compiler/compileStyle.d.ts +1 -1
- package/lib/compiler/compileStyle.js +7 -17
- package/lib/compiler/compileTypes.js +4 -7
- package/lib/config/jest.config.js +1 -0
- package/lib/config/vite.config.js +1 -1
- package/lib/config/vitest.config.d.ts +2 -0
- package/lib/config/vitest.config.js +28 -0
- package/lib/index.js +22 -3
- package/lib/shared/constant.js +1 -1
- package/lib/shared/logger.d.ts +1 -0
- package/lib/shared/logger.js +3 -0
- package/package.json +16 -12
- package/site/components/button/Button.vue +45 -23
- package/site/components/button/button.less +6 -6
- package/site/components/button/props.ts +10 -2
- package/site/components/cell/Cell.vue +24 -12
- package/site/components/cell/cell.less +11 -7
- package/site/components/cell/props.ts +2 -2
- package/site/components/code-example/CodeExample.vue +17 -23
- package/site/components/context/index.ts +4 -0
- package/site/components/context/lock.ts +30 -41
- package/site/components/icon/Icon.vue +16 -9
- package/site/components/loading/Loading.vue +54 -25
- package/site/components/loading/loading.less +120 -35
- package/site/components/loading/props.ts +7 -2
- package/site/components/popup/Popup.tsx +102 -0
- package/site/components/popup/index.ts +10 -0
- package/site/components/popup/popup.less +125 -0
- package/site/components/popup/props.ts +63 -0
- package/site/components/progress/Progress.vue +28 -24
- package/site/components/progress/progress.less +16 -13
- package/site/components/progress/props.ts +1 -1
- package/site/components/ripple/index.ts +28 -7
- package/site/components/ripple/ripple.less +3 -0
- package/site/components/snackbar/Snackbar.vue +10 -7
- package/site/components/snackbar/core.vue +37 -22
- package/site/components/snackbar/index.tsx +14 -14
- package/site/components/snackbar/props.ts +10 -7
- package/site/components/utils/components.ts +49 -1
- package/site/components/utils/elements.ts +17 -0
- package/site/mobile/App.vue +42 -42
- package/site/mobile/components/AppHome.vue +1 -1
- package/site/mobile/components/app-bar/AppBar.vue +17 -21
- package/site/mobile/components/app-bar/appBar.less +2 -1
- package/site/mobile/main.ts +6 -2
- package/site/pc/Layout.vue +93 -67
- package/site/pc/components/AnimationBox.vue +3 -15
- package/site/pc/components/AppHeader.vue +110 -97
- package/site/pc/components/AppMobile.vue +8 -2
- package/site/pc/components/AppSidebar.vue +19 -10
- package/site/pc/components/LogoAnimation.vue +29 -31
- package/site/pc/floating.ts +3 -3
- package/site/pc/main.ts +6 -0
- package/site/pc/pages/index/index.less +142 -197
- package/site/pc/pages/index/index.vue +65 -80
- package/site/pc/pages/index/locale/en-US.ts +1 -5
- package/site/pc/pages/index/locale/zh-CN.ts +1 -5
- package/site/useProgress.ts +14 -17
- package/site/utils.ts +32 -20
- package/template/create/__tests__/index.spec.ejs +8 -0
- package/template/create/docs/en-US.md +0 -0
- package/template/create/docs/zh-CN.md +0 -0
- package/template/create/example/index.ejs +15 -0
- package/template/create/example/locale/en-US.ts +3 -0
- package/{generators/config/i18n/sfc/src/button → template/create}/example/locale/index.ts +0 -0
- package/template/create/example/locale/zh-CN.ts +3 -0
- package/template/create/index.ejs +12 -0
- package/template/create/less.ejs +3 -0
- package/template/create/props.ts +1 -0
- package/template/create/tsx.ejs +13 -0
- package/template/create/vue.ejs +17 -0
- package/{generators → template/generators}/base/.prettierignore +0 -0
- package/{generators → template/generators}/base/.prettierrc +0 -0
- package/{generators → template/generators}/base/README.md +0 -0
- package/{generators → template/generators}/base/babel.config.js +0 -0
- package/{generators → template/generators}/base/public/highlight.css +0 -0
- package/{generators → template/generators}/base/public/logo.svg +0 -0
- package/{generators → template/generators}/base/shims/shims-md.d.ts +0 -0
- package/{generators → template/generators}/base/shims/shims-vue.d.ts +0 -0
- package/{generators → template/generators}/base/tsconfig.json +0 -0
- package/{generators → template/generators}/config/default/base/docs/home.zh-CN.md +0 -0
- package/{generators → template/generators}/config/default/base/package.json +1 -1
- package/{generators → template/generators}/config/default/base/types/basicComponent.d.ts +0 -0
- package/{generators → template/generators}/config/default/base/types/button.d.ts +0 -0
- package/{generators → template/generators}/config/default/base/types/index.d.ts +0 -0
- package/{generators → template/generators}/config/default/base/varlet.config.js +1 -1
- package/{generators → template/generators}/config/default/sfc/src/button/Button.vue +6 -6
- package/{generators → template/generators}/config/default/sfc/src/button/__tests__/index.spec.js +0 -0
- package/{generators/config/default/tsx → template/generators/config/default/sfc}/src/button/button.less +1 -1
- package/{generators → template/generators}/config/default/sfc/src/button/docs/zh-CN.md +0 -0
- package/{generators → template/generators}/config/default/sfc/src/button/example/BasicUse.vue +0 -0
- package/{generators → template/generators}/config/default/sfc/src/button/example/ModifyColor.vue +0 -0
- package/{generators → template/generators}/config/default/sfc/src/button/example/index.vue +2 -2
- package/{generators → template/generators}/config/default/sfc/src/button/index.ts +0 -0
- package/{generators → template/generators}/config/default/tsx/src/button/Button.tsx +11 -13
- package/{generators → template/generators}/config/default/tsx/src/button/__tests__/index.spec.js +0 -0
- package/{generators/config/i18n → template/generators/config/default}/tsx/src/button/button.less +1 -1
- package/{generators → template/generators}/config/default/tsx/src/button/docs/zh-CN.md +0 -0
- package/{generators → template/generators}/config/default/tsx/src/button/example/BasicUse.vue +0 -0
- package/{generators → template/generators}/config/default/tsx/src/button/example/ModifyColor.vue +0 -0
- package/{generators → template/generators}/config/default/tsx/src/button/example/index.vue +2 -2
- package/{generators → template/generators}/config/default/tsx/src/button/index.ts +0 -0
- package/{generators → template/generators}/config/i18n/base/docs/home.en-US.md +0 -0
- package/{generators → template/generators}/config/i18n/base/docs/home.zh-CN.md +0 -0
- package/{generators → template/generators}/config/i18n/base/package.json +1 -1
- package/{generators → template/generators}/config/i18n/base/types/basicComponent.d.ts +0 -0
- package/{generators → template/generators}/config/i18n/base/types/button.d.ts +0 -0
- package/{generators → template/generators}/config/i18n/base/types/index.d.ts +0 -0
- package/{generators → template/generators}/config/i18n/base/types/locale.d.ts +0 -0
- package/{generators → template/generators}/config/i18n/base/varlet.config.js +3 -3
- package/{generators → template/generators}/config/i18n/sfc/src/button/Button.vue +7 -7
- package/{generators → template/generators}/config/i18n/sfc/src/button/__tests__/index.spec.js +0 -0
- package/{generators → template/generators}/config/i18n/sfc/src/button/button.less +1 -1
- package/{generators → template/generators}/config/i18n/sfc/src/button/docs/en-US.md +0 -0
- package/{generators → template/generators}/config/i18n/sfc/src/button/docs/zh-CN.md +0 -0
- package/{generators → template/generators}/config/i18n/sfc/src/button/example/BasicUse.vue +0 -0
- package/{generators → template/generators}/config/i18n/sfc/src/button/example/ModifyColor.vue +0 -0
- package/{generators → template/generators}/config/i18n/sfc/src/button/example/index.vue +1 -1
- package/{generators/config/i18n/tsx → template/generators/config/i18n/sfc}/src/button/example/locale/en-US.ts +1 -1
- package/{generators/config/i18n/tsx → template/generators/config/i18n/sfc}/src/button/example/locale/index.ts +0 -0
- package/{generators/config/i18n/tsx → template/generators/config/i18n/sfc}/src/button/example/locale/zh-CN.ts +1 -1
- package/{generators → template/generators}/config/i18n/sfc/src/button/index.ts +0 -0
- package/{generators → template/generators}/config/i18n/sfc/src/locale/__tests__/index.spec.js +0 -0
- package/{generators → template/generators}/config/i18n/sfc/src/locale/docs/en-US.md +0 -0
- package/{generators → template/generators}/config/i18n/sfc/src/locale/docs/zh-CN.md +0 -0
- package/{generators → template/generators}/config/i18n/sfc/src/locale/en-US.d.ts +0 -0
- package/{generators/config/i18n/tsx → template/generators/config/i18n/sfc}/src/locale/en-US.ts +1 -1
- package/{generators → template/generators}/config/i18n/sfc/src/locale/index.ts +0 -0
- package/{generators → template/generators}/config/i18n/sfc/src/locale/zh-CN.d.ts +0 -0
- package/{generators/config/i18n/tsx → template/generators/config/i18n/sfc}/src/locale/zh-CN.ts +1 -1
- package/{generators → template/generators}/config/i18n/tsx/src/button/Button.tsx +12 -14
- package/{generators → template/generators}/config/i18n/tsx/src/button/__tests__/index.spec.js +0 -0
- package/{generators/config/default/sfc → template/generators/config/i18n/tsx}/src/button/button.less +1 -1
- package/{generators → template/generators}/config/i18n/tsx/src/button/docs/en-US.md +0 -0
- package/{generators → template/generators}/config/i18n/tsx/src/button/docs/zh-CN.md +0 -0
- package/{generators → template/generators}/config/i18n/tsx/src/button/example/BasicUse.vue +0 -0
- package/{generators → template/generators}/config/i18n/tsx/src/button/example/ModifyColor.vue +0 -0
- package/{generators → template/generators}/config/i18n/tsx/src/button/example/index.vue +1 -1
- package/{generators/config/i18n/sfc → template/generators/config/i18n/tsx}/src/button/example/locale/en-US.ts +1 -1
- package/template/generators/config/i18n/tsx/src/button/example/locale/index.ts +23 -0
- package/{generators/config/i18n/sfc → template/generators/config/i18n/tsx}/src/button/example/locale/zh-CN.ts +1 -1
- package/{generators → template/generators}/config/i18n/tsx/src/button/index.ts +0 -0
- package/{generators → template/generators}/config/i18n/tsx/src/locale/__tests__/index.spec.js +0 -0
- package/{generators → template/generators}/config/i18n/tsx/src/locale/docs/en-US.md +0 -0
- package/{generators → template/generators}/config/i18n/tsx/src/locale/docs/zh-CN.md +0 -0
- package/{generators → template/generators}/config/i18n/tsx/src/locale/en-US.d.ts +0 -0
- package/{generators/config/i18n/sfc → template/generators/config/i18n/tsx}/src/locale/en-US.ts +1 -1
- package/{generators → template/generators}/config/i18n/tsx/src/locale/index.ts +0 -0
- package/{generators → template/generators}/config/i18n/tsx/src/locale/zh-CN.d.ts +0 -0
- package/{generators/config/i18n/sfc → template/generators/config/i18n/tsx}/src/locale/zh-CN.ts +1 -1
- package/varlet.default.config.js +137 -15
- package/site/mobile/components/styles/common.less +0 -64
- package/site/mobile/components/styles/elevation.less +0 -126
- package/site/mobile/components/styles/var.less +0 -27
|
@@ -1,40 +1,59 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="
|
|
3
|
-
<div class="
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
:style="{
|
|
7
|
-
width: radius * 2 + 'px',
|
|
8
|
-
height: radius * 2 + 'px',
|
|
9
|
-
}"
|
|
10
|
-
>
|
|
11
|
-
<svg viewBox="25 25 50 50">
|
|
12
|
-
<circle cx="50" cy="50" r="20" fill="none"></circle>
|
|
13
|
-
</svg>
|
|
14
|
-
</span>
|
|
2
|
+
<div :class="n()">
|
|
3
|
+
<div :class="classes(n('content'), [loading, n('content--active')])" v-if="$slots.default">
|
|
4
|
+
<slot />
|
|
5
|
+
<div :class="n('content-mask')" v-if="loading"></div>
|
|
15
6
|
</div>
|
|
7
|
+
<div :class="classes('var-site--box', n('body'), [$slots.default, n('inside')])" v-if="isShow">
|
|
8
|
+
<div :class="n('circle')" v-if="type === 'circle'">
|
|
9
|
+
<span
|
|
10
|
+
:class="classes(n('circle-block'), n(`circle-block--${size}`))"
|
|
11
|
+
:style="{
|
|
12
|
+
width: multiplySizeUnit(radius, 2),
|
|
13
|
+
height: multiplySizeUnit(radius, 2),
|
|
14
|
+
color,
|
|
15
|
+
}"
|
|
16
|
+
>
|
|
17
|
+
<svg viewBox="25 25 50 50">
|
|
18
|
+
<circle cx="50" cy="50" r="20" fill="none"></circle>
|
|
19
|
+
</svg>
|
|
20
|
+
</span>
|
|
21
|
+
</div>
|
|
16
22
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
<template v-for="(nums, key) in loadingTypeDict" :key="key">
|
|
24
|
+
<div :class="classes(n(key), n(`${key}--${size}`))" v-if="type === key">
|
|
25
|
+
<div
|
|
26
|
+
v-for="num in nums"
|
|
27
|
+
:key="num + key"
|
|
28
|
+
:style="{ backgroundColor: color }"
|
|
29
|
+
:class="classes(n(`${key}-item`), n(`${key}-item--${size}`))"
|
|
30
|
+
></div>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
<div
|
|
34
|
+
:class="classes(n('description'), n(`description--${size}`))"
|
|
35
|
+
:style="{ color }"
|
|
36
|
+
v-if="$slots.description || description"
|
|
37
|
+
>
|
|
38
|
+
<slot name="description">{{ description }}</slot>
|
|
25
39
|
</div>
|
|
26
|
-
</
|
|
40
|
+
</div>
|
|
27
41
|
</div>
|
|
28
42
|
</template>
|
|
29
43
|
|
|
30
44
|
<script lang="ts">
|
|
31
|
-
import { defineComponent } from 'vue'
|
|
45
|
+
import { computed, defineComponent } from 'vue'
|
|
32
46
|
import { props } from './props'
|
|
47
|
+
import { createNamespace, call } from '../utils/components'
|
|
48
|
+
import { multiplySizeUnit } from '../utils/elements'
|
|
49
|
+
import type { ComputedRef } from 'vue'
|
|
50
|
+
|
|
51
|
+
const { n, classes } = createNamespace('loading')
|
|
33
52
|
|
|
34
53
|
export default defineComponent({
|
|
35
|
-
name: '
|
|
54
|
+
name: 'VarLoading',
|
|
36
55
|
props,
|
|
37
|
-
setup() {
|
|
56
|
+
setup(props, { slots }) {
|
|
38
57
|
const loadingTypeDict = {
|
|
39
58
|
wave: 5,
|
|
40
59
|
cube: 4,
|
|
@@ -42,8 +61,18 @@ export default defineComponent({
|
|
|
42
61
|
disappear: 3,
|
|
43
62
|
}
|
|
44
63
|
|
|
64
|
+
const isShow: ComputedRef<boolean> = computed(() => {
|
|
65
|
+
if (!call(slots.default)) return true
|
|
66
|
+
|
|
67
|
+
return props.loading
|
|
68
|
+
})
|
|
69
|
+
|
|
45
70
|
return {
|
|
71
|
+
n,
|
|
72
|
+
classes,
|
|
73
|
+
multiplySizeUnit,
|
|
46
74
|
loadingTypeDict,
|
|
75
|
+
isShow,
|
|
47
76
|
}
|
|
48
77
|
},
|
|
49
78
|
})
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
@import '../styles/var';
|
|
2
2
|
|
|
3
|
+
@site-loading-opacity: 0.38;
|
|
4
|
+
@site-loading-desc-margin: 8px 0 0;
|
|
3
5
|
@site-loading-normal-width: 50px;
|
|
4
6
|
@site-loading-normal-height: @site-font-size-md + 2;
|
|
5
7
|
|
|
@@ -12,18 +14,97 @@
|
|
|
12
14
|
@site-loading-mini-width: 22px;
|
|
13
15
|
@site-loading-mini-height: @site-font-size-xs + 2;
|
|
14
16
|
|
|
17
|
+
:root {
|
|
18
|
+
--site-loading-opacity: @site-loading-opacity;
|
|
19
|
+
--site-loading-desc-margin: @site-loading-desc-margin;
|
|
20
|
+
}
|
|
21
|
+
|
|
15
22
|
.var-site-loading {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
position: relative;
|
|
24
|
+
|
|
25
|
+
&__content {
|
|
26
|
+
position: relative;
|
|
27
|
+
transition: opacity 0.3s;
|
|
28
|
+
opacity: 1;
|
|
29
|
+
|
|
30
|
+
&--active {
|
|
31
|
+
opacity: var(--site-loading-opacity);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&-mask {
|
|
35
|
+
position: absolute;
|
|
36
|
+
left: 0;
|
|
37
|
+
right: 0;
|
|
38
|
+
top: 0;
|
|
39
|
+
bottom: 0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&__body {
|
|
44
|
+
display: flex;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
align-items: center;
|
|
47
|
+
height: 100%;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&__inside {
|
|
52
|
+
position: absolute;
|
|
53
|
+
left: 50%;
|
|
54
|
+
top: 50%;
|
|
55
|
+
transform: translate(-50%, -50%);
|
|
56
|
+
z-index: 1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&__description {
|
|
60
|
+
color: @site-color-primary;
|
|
61
|
+
margin: var(--site-loading-desc-margin);
|
|
62
|
+
|
|
63
|
+
&--large {
|
|
64
|
+
font-size: @site-font-size-lg;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&--normal {
|
|
68
|
+
font-size: @site-font-size-md;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&--small {
|
|
72
|
+
font-size: @site-font-size-sm;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&--mini {
|
|
76
|
+
font-size: @site-font-size-xs;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
19
79
|
|
|
20
80
|
&__circle {
|
|
21
81
|
display: flex;
|
|
22
82
|
|
|
23
83
|
&-block {
|
|
24
84
|
display: inline-block;
|
|
85
|
+
color: @site-color-primary;
|
|
25
86
|
animation: circle 1.8s linear infinite;
|
|
26
87
|
|
|
88
|
+
&--large {
|
|
89
|
+
width: 36px;
|
|
90
|
+
height: 36px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&--normal {
|
|
94
|
+
width: 30px;
|
|
95
|
+
height: 30px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&--small {
|
|
99
|
+
width: 24px;
|
|
100
|
+
height: 24px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&--mini {
|
|
104
|
+
width: 18px;
|
|
105
|
+
height: 18px;
|
|
106
|
+
}
|
|
107
|
+
|
|
27
108
|
svg {
|
|
28
109
|
display: block;
|
|
29
110
|
width: 100%;
|
|
@@ -72,22 +153,22 @@
|
|
|
72
153
|
align-items: center;
|
|
73
154
|
justify-content: center;
|
|
74
155
|
|
|
75
|
-
|
|
156
|
+
&--large {
|
|
76
157
|
width: @site-loading-large-width;
|
|
77
158
|
height: @site-loading-large-height;
|
|
78
159
|
}
|
|
79
160
|
|
|
80
|
-
|
|
161
|
+
&--normal {
|
|
81
162
|
width: @site-loading-normal-width;
|
|
82
163
|
height: @site-loading-normal-height;
|
|
83
164
|
}
|
|
84
165
|
|
|
85
|
-
|
|
166
|
+
&--small {
|
|
86
167
|
width: @site-loading-small-width;
|
|
87
168
|
height: @site-loading-small-height;
|
|
88
169
|
}
|
|
89
170
|
|
|
90
|
-
|
|
171
|
+
&--mini {
|
|
91
172
|
width: @site-loading-mini-width;
|
|
92
173
|
height: @site-loading-mini-height;
|
|
93
174
|
}
|
|
@@ -96,6 +177,7 @@
|
|
|
96
177
|
height: 100%;
|
|
97
178
|
display: inline-block;
|
|
98
179
|
animation: 1.2s ease-in-out infinite wave;
|
|
180
|
+
background-color: @site-color-primary;
|
|
99
181
|
|
|
100
182
|
&:nth-child(1) {
|
|
101
183
|
animation-delay: -1.2s;
|
|
@@ -119,22 +201,22 @@
|
|
|
119
201
|
}
|
|
120
202
|
}
|
|
121
203
|
|
|
122
|
-
&-item
|
|
204
|
+
&-item--large {
|
|
123
205
|
width: @site-loading-wave-size-item-width;
|
|
124
206
|
margin-left: @site-loading-wave-size-item-margin;
|
|
125
207
|
}
|
|
126
208
|
|
|
127
|
-
&-item
|
|
209
|
+
&-item--normal {
|
|
128
210
|
width: @site-loading-wave-size-item-width - 1;
|
|
129
211
|
margin-left: @site-loading-wave-size-item-margin - 1;
|
|
130
212
|
}
|
|
131
213
|
|
|
132
|
-
&-item
|
|
214
|
+
&-item--small {
|
|
133
215
|
width: @site-loading-wave-size-item-width - 2;
|
|
134
216
|
margin-left: @site-loading-wave-size-item-margin - 2;
|
|
135
217
|
}
|
|
136
218
|
|
|
137
|
-
&-item
|
|
219
|
+
&-item--mini {
|
|
138
220
|
width: @site-loading-wave-size-item-width - 3;
|
|
139
221
|
margin-left: @site-loading-wave-size-item-margin - 3;
|
|
140
222
|
}
|
|
@@ -159,22 +241,22 @@
|
|
|
159
241
|
display: flex;
|
|
160
242
|
align-items: center;
|
|
161
243
|
|
|
162
|
-
|
|
244
|
+
&--large {
|
|
163
245
|
width: @site-loading-large-width;
|
|
164
246
|
height: @site-loading-large-height;
|
|
165
247
|
}
|
|
166
248
|
|
|
167
|
-
|
|
249
|
+
&--normal {
|
|
168
250
|
width: @site-loading-normal-width;
|
|
169
251
|
height: @site-loading-normal-height;
|
|
170
252
|
}
|
|
171
253
|
|
|
172
|
-
|
|
254
|
+
&--small {
|
|
173
255
|
width: @site-loading-small-width;
|
|
174
256
|
height: @site-loading-small-height;
|
|
175
257
|
}
|
|
176
258
|
|
|
177
|
-
|
|
259
|
+
&--mini {
|
|
178
260
|
width: @site-loading-mini-width;
|
|
179
261
|
height: @site-loading-mini-height;
|
|
180
262
|
}
|
|
@@ -183,6 +265,7 @@
|
|
|
183
265
|
display: inline-block;
|
|
184
266
|
transform-origin: right bottom;
|
|
185
267
|
animation: 1.5s ease infinite cube;
|
|
268
|
+
background-color: @site-color-primary;
|
|
186
269
|
|
|
187
270
|
&:nth-child(1) {
|
|
188
271
|
animation-delay: 0.2s;
|
|
@@ -202,25 +285,25 @@
|
|
|
202
285
|
}
|
|
203
286
|
}
|
|
204
287
|
|
|
205
|
-
&-item
|
|
288
|
+
&-item--large {
|
|
206
289
|
height: @site-loading-cube-size-item-height;
|
|
207
290
|
width: @site-loading-cube-size-item-width;
|
|
208
291
|
margin-left: @site-loading-cube-size-item-margin;
|
|
209
292
|
}
|
|
210
293
|
|
|
211
|
-
&-item
|
|
294
|
+
&-item--normal {
|
|
212
295
|
height: @site-loading-cube-size-item-height - 2;
|
|
213
296
|
width: @site-loading-cube-size-item-width - 2;
|
|
214
297
|
margin-left: @site-loading-cube-size-item-margin - 1;
|
|
215
298
|
}
|
|
216
299
|
|
|
217
|
-
&-item
|
|
300
|
+
&-item--small {
|
|
218
301
|
height: @site-loading-cube-size-item-height - 4;
|
|
219
302
|
width: @site-loading-cube-size-item-width - 4;
|
|
220
303
|
margin-left: @site-loading-cube-size-item-margin - 2;
|
|
221
304
|
}
|
|
222
305
|
|
|
223
|
-
&-item
|
|
306
|
+
&-item--mini {
|
|
224
307
|
height: @site-loading-cube-size-item-height - 6;
|
|
225
308
|
width: @site-loading-cube-size-item-width - 6;
|
|
226
309
|
margin-left: @site-loading-cube-size-item-margin - 3;
|
|
@@ -247,28 +330,29 @@
|
|
|
247
330
|
justify-content: center;
|
|
248
331
|
align-items: center;
|
|
249
332
|
|
|
250
|
-
|
|
333
|
+
&--large {
|
|
251
334
|
width: @site-loading-large-width;
|
|
252
335
|
height: @site-loading-large-height;
|
|
253
336
|
}
|
|
254
337
|
|
|
255
|
-
|
|
338
|
+
&--normal {
|
|
256
339
|
width: @site-loading-normal-width;
|
|
257
340
|
height: @site-loading-normal-height;
|
|
258
341
|
}
|
|
259
342
|
|
|
260
|
-
|
|
343
|
+
&--small {
|
|
261
344
|
width: @site-loading-small-width;
|
|
262
345
|
height: @site-loading-small-height;
|
|
263
346
|
}
|
|
264
347
|
|
|
265
|
-
|
|
348
|
+
&--mini {
|
|
266
349
|
width: @site-loading-mini-width;
|
|
267
350
|
height: @site-loading-mini-height;
|
|
268
351
|
}
|
|
269
352
|
|
|
270
353
|
&-item {
|
|
271
354
|
animation: 2s ease-in-out infinite rect;
|
|
355
|
+
background-color: @site-color-primary;
|
|
272
356
|
|
|
273
357
|
&:nth-child(1) {
|
|
274
358
|
animation-delay: 1.75s;
|
|
@@ -303,22 +387,22 @@
|
|
|
303
387
|
}
|
|
304
388
|
}
|
|
305
389
|
|
|
306
|
-
&-item
|
|
390
|
+
&-item--large {
|
|
307
391
|
height: @site-loading-rect-size-item-height;
|
|
308
392
|
width: @site-loading-rect-size-item-width;
|
|
309
393
|
}
|
|
310
394
|
|
|
311
|
-
&-item
|
|
395
|
+
&-item--normal {
|
|
312
396
|
height: @site-loading-rect-size-item-height * 0.9;
|
|
313
397
|
width: @site-loading-rect-size-item-width * 0.8;
|
|
314
398
|
}
|
|
315
399
|
|
|
316
|
-
&-item
|
|
400
|
+
&-item--small {
|
|
317
401
|
height: @site-loading-rect-size-item-height * 0.8;
|
|
318
402
|
width: @site-loading-rect-size-item-width * 0.6;
|
|
319
403
|
}
|
|
320
404
|
|
|
321
|
-
&-item
|
|
405
|
+
&-item--mini {
|
|
322
406
|
height: @site-loading-rect-size-item-height * 0.7;
|
|
323
407
|
width: @site-loading-rect-size-item-width * 0.4;
|
|
324
408
|
}
|
|
@@ -351,22 +435,22 @@
|
|
|
351
435
|
align-items: center;
|
|
352
436
|
flex-flow: nowrap;
|
|
353
437
|
|
|
354
|
-
|
|
438
|
+
&--large {
|
|
355
439
|
width: @site-loading-large-width;
|
|
356
440
|
height: @site-loading-large-height;
|
|
357
441
|
}
|
|
358
442
|
|
|
359
|
-
|
|
443
|
+
&--normal {
|
|
360
444
|
width: @site-loading-normal-width;
|
|
361
445
|
height: @site-loading-normal-height;
|
|
362
446
|
}
|
|
363
447
|
|
|
364
|
-
|
|
448
|
+
&--small {
|
|
365
449
|
width: @site-loading-small-width;
|
|
366
450
|
height: @site-loading-small-height;
|
|
367
451
|
}
|
|
368
452
|
|
|
369
|
-
|
|
453
|
+
&--mini {
|
|
370
454
|
width: @site-loading-mini-width;
|
|
371
455
|
height: @site-loading-mini-height;
|
|
372
456
|
}
|
|
@@ -374,6 +458,7 @@
|
|
|
374
458
|
&-item {
|
|
375
459
|
border-radius: 50%;
|
|
376
460
|
animation: 0.5s ease-in-out infinite alternate disappear;
|
|
461
|
+
background-color: @site-color-primary;
|
|
377
462
|
|
|
378
463
|
&:nth-child(1) {
|
|
379
464
|
animation-delay: -0.4s;
|
|
@@ -388,22 +473,22 @@
|
|
|
388
473
|
}
|
|
389
474
|
}
|
|
390
475
|
|
|
391
|
-
&-item
|
|
476
|
+
&-item--large {
|
|
392
477
|
height: @site-loading-disappear-size-item-height;
|
|
393
478
|
width: @site-loading-disappear-size-item-width;
|
|
394
479
|
}
|
|
395
480
|
|
|
396
|
-
&-item
|
|
481
|
+
&-item--normal {
|
|
397
482
|
height: @site-loading-disappear-size-item-height * 0.8;
|
|
398
483
|
width: @site-loading-disappear-size-item-width * 0.8;
|
|
399
484
|
}
|
|
400
485
|
|
|
401
|
-
&-item
|
|
486
|
+
&-item--small {
|
|
402
487
|
height: @site-loading-disappear-size-item-height * 0.6;
|
|
403
488
|
width: @site-loading-disappear-size-item-width * 0.6;
|
|
404
489
|
}
|
|
405
490
|
|
|
406
|
-
&-item
|
|
491
|
+
&-item--mini {
|
|
407
492
|
height: @site-loading-disappear-size-item-height * 0.4;
|
|
408
493
|
width: @site-loading-disappear-size-item-width * 0.4;
|
|
409
494
|
}
|
|
@@ -21,7 +21,6 @@ export const props = {
|
|
|
21
21
|
},
|
|
22
22
|
radius: {
|
|
23
23
|
type: [String, Number],
|
|
24
|
-
default: 15,
|
|
25
24
|
},
|
|
26
25
|
// loading尺寸
|
|
27
26
|
size: {
|
|
@@ -32,6 +31,12 @@ export const props = {
|
|
|
32
31
|
// loading颜色
|
|
33
32
|
color: {
|
|
34
33
|
type: String,
|
|
35
|
-
|
|
34
|
+
},
|
|
35
|
+
description: {
|
|
36
|
+
type: String,
|
|
37
|
+
},
|
|
38
|
+
loading: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: false,
|
|
36
41
|
},
|
|
37
42
|
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { defineComponent, watch, Transition, Teleport } from 'vue'
|
|
2
|
+
import { props } from './props'
|
|
3
|
+
import { useLock } from '../context/lock'
|
|
4
|
+
import { useZIndex } from '../context/zIndex'
|
|
5
|
+
import { useRouteListener, useTeleport, createNamespace } from '../utils/components'
|
|
6
|
+
|
|
7
|
+
import '../styles/common.less'
|
|
8
|
+
import './popup.less'
|
|
9
|
+
|
|
10
|
+
const { n, classes } = createNamespace('popup')
|
|
11
|
+
|
|
12
|
+
export default defineComponent({
|
|
13
|
+
name: 'VarPopup',
|
|
14
|
+
inheritAttrs: false,
|
|
15
|
+
props,
|
|
16
|
+
setup(props, { slots, attrs }) {
|
|
17
|
+
const { zIndex } = useZIndex(() => props.show, 3)
|
|
18
|
+
const { disabled } = useTeleport()
|
|
19
|
+
|
|
20
|
+
const hidePopup = () => {
|
|
21
|
+
const { closeOnClickOverlay, onClickOverlay } = props
|
|
22
|
+
|
|
23
|
+
onClickOverlay?.()
|
|
24
|
+
|
|
25
|
+
if (!closeOnClickOverlay) {
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
props['onUpdate:show']?.(false)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
useLock(
|
|
33
|
+
() => props.show,
|
|
34
|
+
() => props.lockScroll
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
watch(
|
|
38
|
+
() => props.show,
|
|
39
|
+
(newValue: boolean) => {
|
|
40
|
+
const { onOpen, onClose } = props
|
|
41
|
+
newValue ? onOpen?.() : onClose?.()
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
// internal for Dialog
|
|
46
|
+
useRouteListener(() => props.onRouteChange?.())
|
|
47
|
+
|
|
48
|
+
const renderOverlay = () => {
|
|
49
|
+
const { overlayClass = '', overlayStyle } = props
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<div
|
|
53
|
+
class={classes(n('overlay'), overlayClass)}
|
|
54
|
+
style={{
|
|
55
|
+
zIndex: zIndex.value - 1,
|
|
56
|
+
...overlayStyle,
|
|
57
|
+
}}
|
|
58
|
+
onClick={hidePopup}
|
|
59
|
+
/>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const renderContent = () => {
|
|
64
|
+
return (
|
|
65
|
+
<div
|
|
66
|
+
class={classes(n('content'), 'var-site-elevation--3', n(`--${props.position}`))}
|
|
67
|
+
style={{ zIndex: zIndex.value }}
|
|
68
|
+
{...attrs}
|
|
69
|
+
>
|
|
70
|
+
{slots.default?.()}
|
|
71
|
+
</div>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const renderPopup = () => {
|
|
76
|
+
const { onOpened, onClosed, show, overlay, transition, position } = props
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<Transition name="var-site-fade" onAfterEnter={onOpened} onAfterLeave={onClosed}>
|
|
80
|
+
<div class={classes('var-site--box', n())} style={{ zIndex: zIndex.value - 2 }} v-show={show}>
|
|
81
|
+
{overlay && renderOverlay()}
|
|
82
|
+
<Transition name={transition || `var-site-pop-${position}`}>{show && renderContent()}</Transition>
|
|
83
|
+
</div>
|
|
84
|
+
</Transition>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return () => {
|
|
89
|
+
const { teleport } = props
|
|
90
|
+
|
|
91
|
+
if (teleport) {
|
|
92
|
+
return (
|
|
93
|
+
<Teleport to={teleport} disabled={disabled.value}>
|
|
94
|
+
{renderPopup()}
|
|
95
|
+
</Teleport>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return renderPopup()
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
})
|