sard-uniapp 1.17.0 → 1.18.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/CHANGELOG.md +25 -0
- package/components/button/button.vue +1 -1
- package/components/calendar-month/calendar-month.vue +8 -8
- package/components/config/index.d.ts +2 -0
- package/components/config/index.js +2 -0
- package/components/datetime-picker/common.d.ts +7 -3
- package/components/datetime-picker/common.js +181 -9
- package/components/datetime-picker/datetime-picker.d.ts +1 -0
- package/components/datetime-picker/datetime-picker.vue +116 -20
- package/components/datetime-picker-input/common.d.ts +1 -0
- package/components/datetime-picker-input/datetime-picker-input.d.ts +1 -0
- package/components/datetime-picker-input/datetime-picker-input.vue +2 -0
- package/components/datetime-picker-popout/common.d.ts +1 -0
- package/components/datetime-picker-popout/datetime-picker-popout.d.ts +1 -0
- package/components/datetime-picker-popout/datetime-picker-popout.vue +2 -0
- package/components/datetime-range-picker/datetime-range-picker.vue +1 -0
- package/components/datetime-range-picker-input/datetime-range-picker-input.vue +1 -0
- package/components/datetime-range-picker-popout/datetime-range-picker-popout.vue +1 -0
- package/components/dropdown/common.d.ts +2 -1
- package/components/dropdown-item/dropdown-item.d.ts +5 -7
- package/components/dropdown-item/dropdown-item.vue +3 -1
- package/components/empty/empty.vue +1 -1
- package/components/fab/fab.vue +1 -1
- package/components/grid-item/grid-item.vue +1 -1
- package/components/icon/icon.vue +9 -4
- package/components/list-item/list-item.vue +1 -1
- package/components/menu-item/menu-item.vue +1 -1
- package/components/navbar-item/navbar-item.vue +1 -1
- package/components/popup/popup.vue +14 -1
- package/components/rate/rate.vue +2 -2
- package/components/result/result.vue +1 -1
- package/components/share-sheet/share-sheet.vue +1 -1
- package/components/step/common.d.ts +22 -0
- package/components/step/common.js +1 -0
- package/components/step/index.d.ts +1 -0
- package/components/step/index.js +1 -0
- package/components/step/index.scss +215 -0
- package/components/step/step.d.ts +10 -0
- package/components/step/step.vue +97 -0
- package/components/steps/common.d.ts +18 -1
- package/components/steps/common.js +1 -0
- package/components/steps/index.d.ts +1 -1
- package/components/steps/index.scss +0 -216
- package/components/steps/steps.d.ts +10 -2
- package/components/steps/steps.vue +34 -56
- package/components/tabbar-item/tabbar-item.vue +1 -5
- package/components/timeline-item/timeline-item.vue +1 -5
- package/global.d.ts +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +1 -1
- package/utils/date.d.ts +33 -3
- package/utils/date.js +209 -11
|
@@ -63,6 +63,7 @@ export default _defineComponent({
|
|
|
63
63
|
rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
64
64
|
rootClass: { type: String, required: false },
|
|
65
65
|
type: { type: String, required: false },
|
|
66
|
+
calendar: { type: String, required: false },
|
|
66
67
|
min: { type: [Date, String], required: false },
|
|
67
68
|
max: { type: [Date, String], required: false },
|
|
68
69
|
filter: { type: Function, required: false },
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type StyleValue, type Ref } from 'vue';
|
|
2
|
+
import { type TransitionHookEmits } from '../popup/common';
|
|
2
3
|
export interface DropdownProps {
|
|
3
4
|
rootStyle?: StyleValue;
|
|
4
5
|
rootClass?: string;
|
|
@@ -40,7 +41,7 @@ export declare const defaultDropdownItemProps: {
|
|
|
40
41
|
export interface DropdownItemSlots {
|
|
41
42
|
default?(props: Record<string, never>): any;
|
|
42
43
|
}
|
|
43
|
-
export interface DropdownItemEmits {
|
|
44
|
+
export interface DropdownItemEmits extends TransitionHookEmits {
|
|
44
45
|
(e: 'update:model-value', value: any): void;
|
|
45
46
|
(e: 'change', value: any): void;
|
|
46
47
|
(e: 'update:visible', visible: boolean): void;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { type DropdownItemProps, type DropdownItemSlots, type DropdownOption } from '../dropdown/common';
|
|
2
2
|
declare function __VLS_template(): Readonly<DropdownItemSlots> & DropdownItemSlots;
|
|
3
|
-
declare const __VLS_component: import("vue").DefineComponent<DropdownItemProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
declare const __VLS_component: import("vue").DefineComponent<DropdownItemProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
} & {
|
|
6
|
+
[x: string]: any;
|
|
7
7
|
}, string, import("vue").PublicProps, Readonly<DropdownItemProps> & Readonly<{
|
|
8
|
-
|
|
9
|
-
onChange?: ((value: any) => any) | undefined;
|
|
10
|
-
"onUpdate:visible"?: ((visible: boolean) => any) | undefined;
|
|
8
|
+
[x: `on${Capitalize<any>}`]: ((...args: any) => any) | undefined;
|
|
11
9
|
}>, {
|
|
12
10
|
options: DropdownOption[];
|
|
13
11
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -128,7 +128,7 @@ export default _defineComponent({
|
|
|
128
128
|
separator: { type: String, required: false },
|
|
129
129
|
placeholder: { type: String, required: false }
|
|
130
130
|
}, defaultDropdownItemProps),
|
|
131
|
-
emits: ["update:model-value", "change", "update:visible"],
|
|
131
|
+
emits: ["update:model-value", "change", "update:visible", "before-enter", "enter", "after-enter", "enter-cancelled", "before-leave", "leave", "after-leave", "leave-cancelled", "visible-hook"],
|
|
132
132
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
133
133
|
__expose();
|
|
134
134
|
const props = __props;
|
|
@@ -254,6 +254,8 @@ export default _defineComponent({
|
|
|
254
254
|
if (name === "after-leave") {
|
|
255
255
|
onAfterLeave();
|
|
256
256
|
}
|
|
257
|
+
emit("visible-hook", name);
|
|
258
|
+
emit(name);
|
|
257
259
|
}
|
|
258
260
|
})
|
|
259
261
|
);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<view :class="emptyClass" :style="emptyStyle">
|
|
3
3
|
<view :class="bem.e('icon')" :style="iconStyle">
|
|
4
4
|
<slot name="icon">
|
|
5
|
-
<sar-icon :family="iconFamily
|
|
5
|
+
<sar-icon :family="iconFamily" :name="icon" />
|
|
6
6
|
</slot>
|
|
7
7
|
</view>
|
|
8
8
|
<slot name="description">
|
package/components/fab/fab.vue
CHANGED
package/components/icon/icon.vue
CHANGED
|
@@ -33,12 +33,17 @@ export default _defineComponent({
|
|
|
33
33
|
return isFileUrl(props.name);
|
|
34
34
|
});
|
|
35
35
|
const iconClass = computed(() => {
|
|
36
|
+
if (isImg.value) {
|
|
37
|
+
return classNames(bem.b(), props.rootClass);
|
|
38
|
+
}
|
|
39
|
+
if (props.name.includes(":")) {
|
|
40
|
+
const [family, name] = props.name.split(":");
|
|
41
|
+
return classNames(bem.b(), family, `${family}-${name}`, props.rootClass);
|
|
42
|
+
}
|
|
36
43
|
return classNames(
|
|
37
44
|
bem.b(),
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
[`${props.family}-${props.name}`]: !isImg.value
|
|
41
|
-
},
|
|
45
|
+
props.family,
|
|
46
|
+
`${props.family}-${props.name}`,
|
|
42
47
|
props.rootClass
|
|
43
48
|
);
|
|
44
49
|
});
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
v-if="icon || (withIcon && direction === 'vertical')"
|
|
5
5
|
:class="bem.e('icon')"
|
|
6
6
|
>
|
|
7
|
-
<sar-icon v-if="icon" :name="icon" :family="iconFamily
|
|
7
|
+
<sar-icon v-if="icon" :name="icon" :family="iconFamily" />
|
|
8
8
|
</view>
|
|
9
9
|
<view v-if="text" :class="bem.e('text')">
|
|
10
10
|
{{ text }}
|
|
@@ -17,13 +17,25 @@
|
|
|
17
17
|
:root-class="overlayClass"
|
|
18
18
|
@click="onOverlayClick"
|
|
19
19
|
/>
|
|
20
|
+
<!-- #ifndef MP -->
|
|
20
21
|
<view
|
|
22
|
+
v-bind="$attrs"
|
|
21
23
|
:class="popupClass"
|
|
22
24
|
:style="popupStyle"
|
|
23
25
|
@transitionend="onTransitionEnd"
|
|
24
26
|
>
|
|
25
27
|
<slot></slot>
|
|
26
28
|
</view>
|
|
29
|
+
<!-- #endif -->
|
|
30
|
+
<!-- #ifdef MP -->
|
|
31
|
+
<view
|
|
32
|
+
:class="popupClass"
|
|
33
|
+
:style="popupStyle"
|
|
34
|
+
@transitionend="onTransitionEnd"
|
|
35
|
+
>
|
|
36
|
+
<slot></slot>
|
|
37
|
+
</view>
|
|
38
|
+
<!-- #endif -->
|
|
27
39
|
</view>
|
|
28
40
|
<!-- #ifdef MP -->
|
|
29
41
|
</root-portal>
|
|
@@ -52,7 +64,8 @@ export default _defineComponent({
|
|
|
52
64
|
options: {
|
|
53
65
|
virtualHost: true,
|
|
54
66
|
styleIsolation: "shared"
|
|
55
|
-
}
|
|
67
|
+
},
|
|
68
|
+
inheritAttrs: false
|
|
56
69
|
},
|
|
57
70
|
__name: "popup",
|
|
58
71
|
props: _mergeDefaults({
|
package/components/rate/rate.vue
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
<template v-if="voidText">
|
|
32
32
|
{{ voidText }}
|
|
33
33
|
</template>
|
|
34
|
-
<sar-icon v-else :name="voidIcon" :family="iconFamily
|
|
34
|
+
<sar-icon v-else :name="voidIcon" :family="iconFamily" />
|
|
35
35
|
</view>
|
|
36
36
|
<view
|
|
37
37
|
:class="bem.e('star')"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
<template v-if="text">
|
|
46
46
|
{{ text }}
|
|
47
47
|
</template>
|
|
48
|
-
<sar-icon v-else :name="icon" :family="iconFamily
|
|
48
|
+
<sar-icon v-else :name="icon" :family="iconFamily" />
|
|
49
49
|
</view>
|
|
50
50
|
</view>
|
|
51
51
|
</view>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type StyleValue } from 'vue';
|
|
2
|
+
import { type StepsStatus } from '../steps/common';
|
|
3
|
+
export interface StepProps {
|
|
4
|
+
rootStyle?: StyleValue;
|
|
5
|
+
rootClass?: string;
|
|
6
|
+
status?: StepsStatus;
|
|
7
|
+
name?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
index: number;
|
|
10
|
+
}
|
|
11
|
+
export interface StepSlots {
|
|
12
|
+
default?(props: {
|
|
13
|
+
status: StepsStatus;
|
|
14
|
+
}): any;
|
|
15
|
+
icon?(props: {
|
|
16
|
+
status: StepsStatus;
|
|
17
|
+
}): any;
|
|
18
|
+
}
|
|
19
|
+
export interface StepEmits {
|
|
20
|
+
}
|
|
21
|
+
export interface StepExpose {
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { StepProps, StepSlots, StepEmits, StepExpose } from './common';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
@use '../style/base' as *;
|
|
2
|
+
|
|
3
|
+
@include bem(step) {
|
|
4
|
+
@include b() {
|
|
5
|
+
@include universal;
|
|
6
|
+
flex: 1;
|
|
7
|
+
font-size: var(--sar-steps-step-font-size);
|
|
8
|
+
|
|
9
|
+
&:first-child {
|
|
10
|
+
@include e(line-before) {
|
|
11
|
+
opacity: 0;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&:last-child {
|
|
16
|
+
flex: none;
|
|
17
|
+
white-space: nowrap;
|
|
18
|
+
|
|
19
|
+
@include e(line) {
|
|
20
|
+
display: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@include e(line-after) {
|
|
24
|
+
opacity: 0;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@include m(behind) {
|
|
29
|
+
@include e(line) {
|
|
30
|
+
background-color: var(--sar-steps-line-active-color);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@include m(self) {
|
|
35
|
+
@include e(line-before) {
|
|
36
|
+
background-color: var(--sar-steps-line-active-color);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@include m(finish) {
|
|
41
|
+
@include e(icon) {
|
|
42
|
+
color: var(--sar-steps-icon-finish-color);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@include e(body) {
|
|
46
|
+
color: var(--sar-steps-text-finish-color);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@include m(process) {
|
|
51
|
+
@include e(icon) {
|
|
52
|
+
color: var(--sar-steps-icon-process-color);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@include e(body) {
|
|
56
|
+
color: var(--sar-steps-text-process-color);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@include m(wait) {
|
|
61
|
+
@include e(icon) {
|
|
62
|
+
color: var(--sar-steps-icon-wait-color);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@include e(body) {
|
|
66
|
+
color: var(--sar-steps-text-wait-color);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@include m(error) {
|
|
71
|
+
@include e(icon) {
|
|
72
|
+
color: var(--sar-steps-icon-error-color);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@include e(body) {
|
|
76
|
+
color: var(--sar-steps-text-error-color);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@include e(header) {
|
|
82
|
+
@include universal;
|
|
83
|
+
flex-direction: row;
|
|
84
|
+
align-items: center;
|
|
85
|
+
padding-top: var(--sar-steps-header-gap-y);
|
|
86
|
+
padding-bottom: var(--sar-steps-header-gap-y);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@include e(line) {
|
|
90
|
+
@include universal;
|
|
91
|
+
height: var(--sar-steps-line-thickness);
|
|
92
|
+
width: 0;
|
|
93
|
+
flex-grow: 1;
|
|
94
|
+
flex-shrink: 1;
|
|
95
|
+
flex-basis: 0;
|
|
96
|
+
margin-left: var(--sar-steps-line-gap);
|
|
97
|
+
margin-right: var(--sar-steps-line-gap);
|
|
98
|
+
background-color: var(--sar-steps-line-color);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@include e(line-before) {
|
|
102
|
+
display: none;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@include e(icon) {
|
|
106
|
+
@include universal;
|
|
107
|
+
font-size: var(--sar-steps-icon-font-size);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@include e(body) {
|
|
111
|
+
@include universal;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@include e(name) {
|
|
115
|
+
font-size: var(--sar-steps-name-font-size);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@include e(description) {
|
|
119
|
+
margin-top: var(--sar-steps-description-margin-top);
|
|
120
|
+
font-size: var(--sar-steps-description-font-size);
|
|
121
|
+
color: var(--sar-steps-description-color);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@include m(vertical) {
|
|
125
|
+
flex-direction: row;
|
|
126
|
+
min-height: var(--sar-steps-step-min-height);
|
|
127
|
+
|
|
128
|
+
&:last-child {
|
|
129
|
+
@include e(line) {
|
|
130
|
+
white-space: unset;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@include e(header) {
|
|
135
|
+
top: calc(
|
|
136
|
+
var(--sar-steps-header-vertical-top) + var(--sar-steps-body-padding-y)
|
|
137
|
+
);
|
|
138
|
+
flex: none;
|
|
139
|
+
flex-direction: column;
|
|
140
|
+
padding-top: 0;
|
|
141
|
+
padding-bottom: 0;
|
|
142
|
+
padding-left: var(--sar-steps-header-gap-x);
|
|
143
|
+
padding-right: var(--sar-steps-header-gap-x);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@include e(line) {
|
|
147
|
+
width: var(--sar-steps-line-thickness);
|
|
148
|
+
height: 0;
|
|
149
|
+
margin-left: 0;
|
|
150
|
+
margin-right: 0;
|
|
151
|
+
margin-top: var(--sar-steps-line-gap);
|
|
152
|
+
margin-bottom: var(--sar-steps-line-gap);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
@include e(body) {
|
|
156
|
+
flex: 1;
|
|
157
|
+
padding-top: var(--sar-steps-body-padding-y);
|
|
158
|
+
padding-bottom: var(--sar-steps-body-padding-y);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
@include m(center) {
|
|
163
|
+
justify-content: center;
|
|
164
|
+
|
|
165
|
+
&:last-child {
|
|
166
|
+
flex: 1;
|
|
167
|
+
white-space: unset;
|
|
168
|
+
|
|
169
|
+
@include e(line) {
|
|
170
|
+
display: flex;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
@include e(line-before) {
|
|
175
|
+
display: flex;
|
|
176
|
+
margin-left: 0;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
@include e(line-after) {
|
|
180
|
+
margin-right: 0;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
@include e(body) {
|
|
184
|
+
align-items: center;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
@include m-intersect(center, vertical) {
|
|
189
|
+
justify-content: center;
|
|
190
|
+
align-items: center;
|
|
191
|
+
|
|
192
|
+
&:last-child {
|
|
193
|
+
flex: 1;
|
|
194
|
+
white-space: unset;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
@include e(header) {
|
|
198
|
+
top: 0;
|
|
199
|
+
align-self: stretch;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
@include e(line-before) {
|
|
203
|
+
margin-top: 0;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
@include e(line-after) {
|
|
207
|
+
margin-bottom: 0;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
@include e(body) {
|
|
211
|
+
justify-content: center;
|
|
212
|
+
align-items: flex-start;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type StepProps, type StepSlots } from './common';
|
|
2
|
+
declare function __VLS_template(): Readonly<StepSlots> & StepSlots;
|
|
3
|
+
declare const __VLS_component: import("vue").DefineComponent<StepProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<StepProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
4
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
5
|
+
export default _default;
|
|
6
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
7
|
+
new (): {
|
|
8
|
+
$slots: S;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="stepClass" :style="stepStyle">
|
|
3
|
+
<view :class="bem.e('header')">
|
|
4
|
+
<view :class="classNames(bem.e('line'), bem.e('line-before'))"></view>
|
|
5
|
+
<view :class="bem.e('icon')">
|
|
6
|
+
<slot name="icon" :status="currentStatus">
|
|
7
|
+
<sar-icon
|
|
8
|
+
:family="context.iconFamily"
|
|
9
|
+
:name="statusIcon"
|
|
10
|
+
:size="context.iconSize"
|
|
11
|
+
/>
|
|
12
|
+
</slot>
|
|
13
|
+
</view>
|
|
14
|
+
<view :class="classNames(bem.e('line'), bem.e('line-after'))"></view>
|
|
15
|
+
</view>
|
|
16
|
+
<view :class="bem.e('body')">
|
|
17
|
+
<slot :status="currentStatus">
|
|
18
|
+
<view :class="bem.e('name')">{{ name }}</view>
|
|
19
|
+
<view v-if="description" :class="bem.e('description')">
|
|
20
|
+
{{ description }}
|
|
21
|
+
</view>
|
|
22
|
+
</slot>
|
|
23
|
+
</view>
|
|
24
|
+
</view>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script>
|
|
28
|
+
import { defineComponent as _defineComponent } from "vue";
|
|
29
|
+
import { computed, inject } from "vue";
|
|
30
|
+
import SarIcon from "../icon/icon.vue";
|
|
31
|
+
import { classNames, stringifyStyle, createBem } from "../../utils";
|
|
32
|
+
import { stepsContextSymbol } from "../steps/common";
|
|
33
|
+
export default _defineComponent({
|
|
34
|
+
components: {
|
|
35
|
+
SarIcon,
|
|
36
|
+
},
|
|
37
|
+
...{
|
|
38
|
+
options: {
|
|
39
|
+
virtualHost: true,
|
|
40
|
+
styleIsolation: "shared"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
__name: "step",
|
|
44
|
+
props: {
|
|
45
|
+
rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
46
|
+
rootClass: { type: String, required: false },
|
|
47
|
+
status: { type: String, required: false },
|
|
48
|
+
name: { type: String, required: false },
|
|
49
|
+
description: { type: String, required: false },
|
|
50
|
+
index: { type: Number, required: true }
|
|
51
|
+
},
|
|
52
|
+
setup(__props, { expose: __expose }) {
|
|
53
|
+
const props = __props;
|
|
54
|
+
__expose({});
|
|
55
|
+
const bem = createBem("step");
|
|
56
|
+
const context = inject(stepsContextSymbol);
|
|
57
|
+
if (!context) {
|
|
58
|
+
throw new Error("Step must be included in Steps.");
|
|
59
|
+
}
|
|
60
|
+
const currentStatus = computed(() => {
|
|
61
|
+
return props.status ?? (props.index < context.current ? "finish" : props.index === context.current ? context.status ?? "process" : "wait");
|
|
62
|
+
});
|
|
63
|
+
const statusIcon = computed(() => {
|
|
64
|
+
return {
|
|
65
|
+
finish: context.finishIcon,
|
|
66
|
+
process: context.processIcon,
|
|
67
|
+
wait: context.waitIcon,
|
|
68
|
+
error: context.errorIcon
|
|
69
|
+
}[currentStatus.value];
|
|
70
|
+
});
|
|
71
|
+
const position = computed(() => {
|
|
72
|
+
return props.index < context.current ? "behind" : context.current === props.index ? "self" : "front";
|
|
73
|
+
});
|
|
74
|
+
const stepClass = computed(() => {
|
|
75
|
+
return classNames(
|
|
76
|
+
bem.b(),
|
|
77
|
+
bem.m("center", context.center),
|
|
78
|
+
bem.m(currentStatus.value),
|
|
79
|
+
bem.m(position.value),
|
|
80
|
+
bem.m(context.direction),
|
|
81
|
+
props.rootClass
|
|
82
|
+
);
|
|
83
|
+
});
|
|
84
|
+
const stepStyle = computed(() => {
|
|
85
|
+
return stringifyStyle(props.rootStyle);
|
|
86
|
+
});
|
|
87
|
+
const __returned__ = { props, bem, context, currentStatus, statusIcon, position, stepClass, stepStyle, SarIcon, get classNames() {
|
|
88
|
+
return classNames;
|
|
89
|
+
} };
|
|
90
|
+
return __returned__;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<style lang="scss">
|
|
96
|
+
@import './index.scss';
|
|
97
|
+
</style>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type StyleValue } from 'vue';
|
|
1
|
+
import { InjectionKey, type StyleValue } from 'vue';
|
|
2
2
|
export type StepsStatus = 'wait' | 'process' | 'error' | 'finish';
|
|
3
3
|
export interface StepsItem {
|
|
4
4
|
status?: StepsStatus;
|
|
@@ -23,9 +23,26 @@ export interface StepsProps {
|
|
|
23
23
|
export declare const defaultStepsProps: {
|
|
24
24
|
current: number;
|
|
25
25
|
center: boolean;
|
|
26
|
+
itemList: () => never[];
|
|
26
27
|
direction: StepsProps["direction"];
|
|
27
28
|
finishIcon: string;
|
|
28
29
|
processIcon: string;
|
|
29
30
|
waitIcon: string;
|
|
30
31
|
errorIcon: string;
|
|
31
32
|
};
|
|
33
|
+
export interface StepsSlots {
|
|
34
|
+
default?(props: Record<string, never>): any;
|
|
35
|
+
}
|
|
36
|
+
export interface StepsContext {
|
|
37
|
+
current: number;
|
|
38
|
+
center?: boolean;
|
|
39
|
+
direction?: StepsProps['direction'];
|
|
40
|
+
iconFamily?: string;
|
|
41
|
+
iconSize?: string;
|
|
42
|
+
finishIcon?: string;
|
|
43
|
+
processIcon?: string;
|
|
44
|
+
waitIcon?: string;
|
|
45
|
+
errorIcon?: string;
|
|
46
|
+
status?: StepsStatus;
|
|
47
|
+
}
|
|
48
|
+
export declare const stepsContextSymbol: InjectionKey<StepsContext>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { StepsStatus, StepsItem,
|
|
1
|
+
export type { StepsProps, StepsSlots, StepsContext, StepsStatus, StepsItem, } from './common';
|