vue-devui 1.0.0-beta.5 → 1.0.0-beta.9
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/accordion/index.d.ts +7 -0
- package/accordion/index.es.js +186 -139
- package/accordion/index.umd.js +1 -1
- package/accordion/style.css +1 -1
- package/alert/index.d.ts +7 -0
- package/alert/index.es.js +1 -1
- package/alert/index.umd.js +1 -1
- package/anchor/index.d.ts +7 -0
- package/avatar/index.d.ts +7 -0
- package/avatar/index.es.js +1 -1
- package/avatar/index.umd.js +1 -1
- package/back-top/index.d.ts +7 -0
- package/back-top/index.es.js +61 -5
- package/back-top/index.umd.js +1 -1
- package/back-top/style.css +1 -1
- package/badge/index.d.ts +7 -0
- package/badge/index.es.js +1 -1
- package/badge/index.umd.js +1 -1
- package/breadcrumb/index.d.ts +7 -0
- package/button/index.d.ts +7 -0
- package/button/index.es.js +4 -4
- package/button/index.umd.js +1 -1
- package/card/index.d.ts +7 -0
- package/card/index.es.js +1 -1
- package/card/index.umd.js +1 -1
- package/carousel/index.d.ts +7 -0
- package/carousel/index.es.js +3 -3
- package/carousel/index.umd.js +1 -1
- package/cascader/index.d.ts +7 -0
- package/cascader/index.es.js +1239 -83
- package/cascader/index.umd.js +1 -1
- package/cascader/style.css +1 -1
- package/checkbox/index.d.ts +7 -0
- package/checkbox/index.es.js +1 -1
- package/checkbox/index.umd.js +1 -1
- package/comment/index.d.ts +7 -0
- package/comment/index.es.js +57 -0
- package/comment/index.umd.js +1 -0
- package/comment/package.json +7 -0
- package/comment/style.css +1 -0
- package/countdown/index.d.ts +7 -0
- package/countdown/index.es.js +167 -0
- package/countdown/index.umd.js +1 -0
- package/countdown/package.json +7 -0
- package/countdown/style.css +1 -0
- package/date-picker/index.d.ts +7 -0
- package/date-picker/index.es.js +15 -15
- package/date-picker/index.umd.js +1 -1
- package/dragdrop/index.d.ts +7 -0
- package/drawer/index.d.ts +7 -0
- package/drawer/index.es.js +33 -9
- package/drawer/index.umd.js +1 -1
- package/dropdown/index.d.ts +7 -0
- package/dropdown/index.es.js +7 -5
- package/dropdown/index.umd.js +1 -1
- package/editable-select/index.d.ts +7 -0
- package/editable-select/index.es.js +166 -104
- package/editable-select/index.umd.js +16 -16
- package/editable-select/style.css +1 -1
- package/form/index.d.ts +7 -0
- package/form/index.es.js +23 -8
- package/form/index.umd.js +1 -1
- package/form/style.css +1 -1
- package/fullscreen/index.d.ts +7 -0
- package/fullscreen/index.es.js +14 -4
- package/fullscreen/index.umd.js +1 -1
- package/gantt/index.d.ts +7 -0
- package/grid/index.d.ts +7 -0
- package/grid/index.es.js +2 -2
- package/grid/index.umd.js +1 -1
- package/icon/index.d.ts +7 -0
- package/icon/index.es.js +4 -4
- package/icon/index.umd.js +1 -1
- package/image-preview/index.d.ts +7 -0
- package/image-preview/index.es.js +51 -11
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/index.d.ts +7 -0
- package/input/index.d.ts +7 -0
- package/input/index.es.js +12 -12
- package/input/index.umd.js +1 -1
- package/input-icon/index.d.ts +7 -0
- package/input-icon/index.es.js +331 -0
- package/input-icon/index.umd.js +1 -0
- package/input-icon/package.json +7 -0
- package/input-icon/style.css +1 -0
- package/input-number/index.d.ts +7 -0
- package/input-number/index.es.js +3 -3
- package/input-number/index.umd.js +1 -1
- package/layout/index.d.ts +7 -0
- package/layout/index.es.js +1 -1
- package/layout/index.umd.js +1 -1
- package/loading/index.d.ts +7 -0
- package/loading/index.es.js +1 -1
- package/loading/index.umd.js +1 -1
- package/modal/index.d.ts +7 -0
- package/modal/index.es.js +9 -7
- package/modal/index.umd.js +1 -1
- package/nav-sprite/index.d.ts +7 -0
- package/overlay/index.d.ts +7 -0
- package/overlay/index.es.js +6 -4
- package/overlay/index.umd.js +1 -1
- package/package.json +2 -31
- package/pagination/index.d.ts +7 -0
- package/pagination/index.es.js +3 -3
- package/pagination/index.umd.js +1 -1
- package/panel/index.d.ts +7 -0
- package/popover/index.d.ts +7 -0
- package/popover/index.es.js +1 -1
- package/popover/index.umd.js +1 -1
- package/progress/index.d.ts +7 -0
- package/progress/index.es.js +1 -1
- package/progress/index.umd.js +2 -2
- package/quadrant-diagram/index.d.ts +7 -0
- package/radio/index.d.ts +7 -0
- package/radio/index.es.js +1 -1
- package/radio/index.umd.js +1 -1
- package/rate/index.d.ts +7 -0
- package/rate/index.es.js +1 -1
- package/rate/index.umd.js +1 -1
- package/read-tip/index.d.ts +7 -0
- package/read-tip/index.es.js +74 -24
- package/read-tip/index.umd.js +1 -1
- package/read-tip/style.css +1 -1
- package/result/index.d.ts +7 -0
- package/result/index.es.js +118 -0
- package/result/index.umd.js +1 -0
- package/result/package.json +7 -0
- package/result/style.css +1 -0
- package/ripple/index.d.ts +7 -0
- package/ripple/index.es.js +5 -2
- package/ripple/index.umd.js +1 -1
- package/search/index.d.ts +7 -0
- package/search/index.es.js +23 -20
- package/search/index.umd.js +1 -1
- package/select/index.d.ts +7 -0
- package/select/index.es.js +3 -3
- package/select/index.umd.js +1 -1
- package/skeleton/index.d.ts +7 -0
- package/skeleton/index.es.js +148 -26
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.d.ts +7 -0
- package/slider/index.es.js +1 -1
- package/slider/index.umd.js +1 -1
- package/splitter/index.d.ts +7 -0
- package/splitter/index.es.js +24 -25
- package/splitter/index.umd.js +1 -1
- package/statistic/index.d.ts +7 -0
- package/statistic/index.es.js +280 -0
- package/statistic/index.umd.js +1 -0
- package/statistic/package.json +7 -0
- package/statistic/style.css +1 -0
- package/status/index.d.ts +7 -0
- package/status/index.es.js +2 -2
- package/status/index.umd.js +1 -1
- package/steps-guide/index.d.ts +7 -0
- package/steps-guide/index.es.js +100 -75
- package/steps-guide/index.umd.js +1 -1
- package/sticky/index.d.ts +7 -0
- package/style.css +1 -1
- package/switch/index.d.ts +7 -0
- package/switch/index.es.js +1 -1
- package/switch/index.umd.js +1 -1
- package/table/index.d.ts +7 -0
- package/table/index.es.js +1492 -157
- package/table/index.umd.js +1 -1
- package/table/style.css +1 -1
- package/tabs/index.d.ts +7 -0
- package/tag/index.d.ts +7 -0
- package/tag/index.es.js +94 -12
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/tag-input/index.d.ts +7 -0
- package/tag-input/index.es.js +1 -1
- package/tag-input/index.umd.js +1 -1
- package/textarea/index.d.ts +7 -0
- package/textarea/index.es.js +1 -1
- package/textarea/index.umd.js +1 -1
- package/time-axis/index.d.ts +7 -0
- package/time-axis/index.es.js +6 -4
- package/time-axis/index.umd.js +1 -1
- package/time-picker/index.d.ts +7 -0
- package/time-picker/index.es.js +12 -7
- package/time-picker/index.umd.js +1 -1
- package/time-picker/style.css +1 -1
- package/toast/index.d.ts +7 -0
- package/toast/index.es.js +4 -4
- package/toast/index.umd.js +1 -1
- package/tooltip/index.d.ts +7 -0
- package/transfer/index.d.ts +7 -0
- package/transfer/index.es.js +310 -68
- package/transfer/index.umd.js +1 -1
- package/transfer/style.css +1 -1
- package/tree/index.d.ts +7 -0
- package/tree/index.es.js +160 -31
- package/tree/index.umd.js +1 -1
- package/tree-select/index.d.ts +7 -0
- package/tree-select/index.es.js +435 -110
- package/tree-select/index.umd.js +1 -1
- package/tree-select/style.css +1 -1
- package/upload/index.d.ts +7 -0
- package/upload/index.es.js +4 -4
- package/upload/index.umd.js +1 -1
- package/vue-devui.es.js +14125 -11791
- package/vue-devui.umd.js +18 -18
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
import { defineComponent, ref, computed, onMounted, watch, createVNode, mergeProps } from "vue";
|
|
8
|
+
const statisticProps = {
|
|
9
|
+
title: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: ""
|
|
12
|
+
},
|
|
13
|
+
value: {
|
|
14
|
+
type: [Number, String]
|
|
15
|
+
},
|
|
16
|
+
prefix: {
|
|
17
|
+
type: String
|
|
18
|
+
},
|
|
19
|
+
suffix: {
|
|
20
|
+
type: String
|
|
21
|
+
},
|
|
22
|
+
precision: {
|
|
23
|
+
type: Number
|
|
24
|
+
},
|
|
25
|
+
groupSeparator: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: ","
|
|
28
|
+
},
|
|
29
|
+
showGroupSeparator: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
33
|
+
titleStyle: {
|
|
34
|
+
type: Object
|
|
35
|
+
},
|
|
36
|
+
contentStyle: {
|
|
37
|
+
type: Object
|
|
38
|
+
},
|
|
39
|
+
animationDuration: {
|
|
40
|
+
type: Number,
|
|
41
|
+
default: 2e3
|
|
42
|
+
},
|
|
43
|
+
valueFrom: {
|
|
44
|
+
type: Number
|
|
45
|
+
},
|
|
46
|
+
animation: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
49
|
+
},
|
|
50
|
+
start: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false
|
|
53
|
+
},
|
|
54
|
+
extra: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: ""
|
|
57
|
+
},
|
|
58
|
+
easing: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: "easeOutCubic"
|
|
61
|
+
},
|
|
62
|
+
delay: {
|
|
63
|
+
type: Number,
|
|
64
|
+
default: 0
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const separator = (SeparatorString, groupSeparator, showGroupSeparator) => {
|
|
68
|
+
const res = SeparatorString.replace(/\d+/, function(n) {
|
|
69
|
+
return n.replace(/(\d)(?=(\d{3})+$)/g, function($1) {
|
|
70
|
+
return $1 + `${showGroupSeparator ? groupSeparator : ""}`;
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
return res;
|
|
74
|
+
};
|
|
75
|
+
const isHasDot = (value) => {
|
|
76
|
+
if (!isNaN(value)) {
|
|
77
|
+
return (value + "").indexOf(".") !== -1;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const analysisValueType = (value, propsValue, groupSeparator, splitPrecisionNumber, showGroupSeparator) => {
|
|
81
|
+
const fixedNumber = propsValue.toString().indexOf(".") !== -1 ? propsValue.toString().length - propsValue.toString().indexOf(".") - 1 : 0;
|
|
82
|
+
if (typeof value === "number") {
|
|
83
|
+
if (isHasDot(value)) {
|
|
84
|
+
return splitPrecisionNumber ? separator(value.toFixed(splitPrecisionNumber).toString(), groupSeparator, showGroupSeparator) : separator(value.toFixed(fixedNumber).toString(), groupSeparator, showGroupSeparator);
|
|
85
|
+
} else {
|
|
86
|
+
return splitPrecisionNumber ? separator(value.toFixed(splitPrecisionNumber).toString(), groupSeparator, showGroupSeparator) : separator(value.toString(), groupSeparator, showGroupSeparator);
|
|
87
|
+
}
|
|
88
|
+
} else {
|
|
89
|
+
return value;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const pow = Math.pow;
|
|
93
|
+
const sqrt = Math.sqrt;
|
|
94
|
+
const easeOutCubic = function(x) {
|
|
95
|
+
return 1 - pow(1 - x, 3);
|
|
96
|
+
};
|
|
97
|
+
const linear = (x) => x;
|
|
98
|
+
const easeOutExpo = function(x) {
|
|
99
|
+
return x === 1 ? 1 : 1 - pow(2, -10 * x);
|
|
100
|
+
};
|
|
101
|
+
const easeInOutExpo = function(x) {
|
|
102
|
+
return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? pow(2, 20 * x - 10) / 2 : (2 - pow(2, -20 * x + 10)) / 2;
|
|
103
|
+
};
|
|
104
|
+
const easeInExpo = function(x) {
|
|
105
|
+
return x === 0 ? 0 : pow(2, 10 * x - 10);
|
|
106
|
+
};
|
|
107
|
+
const easeInOutCirc = function(x) {
|
|
108
|
+
return x < 0.5 ? (1 - sqrt(1 - pow(2 * x, 2))) / 2 : (sqrt(1 - pow(-2 * x + 2, 2)) + 1) / 2;
|
|
109
|
+
};
|
|
110
|
+
var easing = /* @__PURE__ */ Object.freeze({
|
|
111
|
+
__proto__: null,
|
|
112
|
+
[Symbol.toStringTag]: "Module",
|
|
113
|
+
easeOutCubic,
|
|
114
|
+
linear,
|
|
115
|
+
easeOutExpo,
|
|
116
|
+
easeInOutExpo,
|
|
117
|
+
easeInExpo,
|
|
118
|
+
easeInOutCirc
|
|
119
|
+
});
|
|
120
|
+
class Tween {
|
|
121
|
+
constructor(options) {
|
|
122
|
+
__publicField(this, "from");
|
|
123
|
+
__publicField(this, "to");
|
|
124
|
+
__publicField(this, "duration");
|
|
125
|
+
__publicField(this, "delay");
|
|
126
|
+
__publicField(this, "easing");
|
|
127
|
+
__publicField(this, "onStart");
|
|
128
|
+
__publicField(this, "onUpdate");
|
|
129
|
+
__publicField(this, "onFinish");
|
|
130
|
+
__publicField(this, "startTime");
|
|
131
|
+
__publicField(this, "started");
|
|
132
|
+
__publicField(this, "finished");
|
|
133
|
+
__publicField(this, "timer");
|
|
134
|
+
__publicField(this, "time");
|
|
135
|
+
__publicField(this, "elapsed");
|
|
136
|
+
__publicField(this, "keys");
|
|
137
|
+
const { from, to, duration, delay, easing: easing2, onStart, onUpdate, onFinish } = options;
|
|
138
|
+
for (const key in from) {
|
|
139
|
+
if (to[key] === void 0) {
|
|
140
|
+
to[key] = from[key];
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
for (const key in to) {
|
|
144
|
+
if (from[key] === void 0) {
|
|
145
|
+
from[key] = to[key];
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
this.from = from;
|
|
149
|
+
this.to = to;
|
|
150
|
+
this.duration = duration;
|
|
151
|
+
this.delay = delay;
|
|
152
|
+
this.easing = easing2;
|
|
153
|
+
this.onStart = onStart;
|
|
154
|
+
this.onUpdate = onUpdate;
|
|
155
|
+
this.onFinish = onFinish;
|
|
156
|
+
this.startTime = Date.now() + this.delay;
|
|
157
|
+
this.started = false;
|
|
158
|
+
this.finished = false;
|
|
159
|
+
this.timer = null;
|
|
160
|
+
this.keys = {};
|
|
161
|
+
}
|
|
162
|
+
update() {
|
|
163
|
+
this.time = Date.now();
|
|
164
|
+
if (this.time < this.startTime) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (this.finished) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (this.elapsed === this.duration) {
|
|
171
|
+
if (!this.finished) {
|
|
172
|
+
this.finished = true;
|
|
173
|
+
this.onFinish && this.onFinish(this.keys);
|
|
174
|
+
}
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
this.elapsed = this.time - this.startTime;
|
|
178
|
+
this.elapsed = this.elapsed > this.duration ? this.duration : this.elapsed;
|
|
179
|
+
for (const key in this.to) {
|
|
180
|
+
this.keys[key] = this.from[key] + (this.to[key] - this.from[key]) * easing[this.easing](this.elapsed / this.duration);
|
|
181
|
+
}
|
|
182
|
+
if (!this.started) {
|
|
183
|
+
this.onStart && this.onStart(this.keys);
|
|
184
|
+
this.started = true;
|
|
185
|
+
}
|
|
186
|
+
this.onUpdate(this.keys);
|
|
187
|
+
}
|
|
188
|
+
start() {
|
|
189
|
+
this.startTime = Date.now() + this.delay;
|
|
190
|
+
const tick = () => {
|
|
191
|
+
this.update();
|
|
192
|
+
this.timer = requestAnimationFrame(tick);
|
|
193
|
+
if (this.finished) {
|
|
194
|
+
cancelAnimationFrame(this.timer);
|
|
195
|
+
this.timer = null;
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
tick();
|
|
199
|
+
}
|
|
200
|
+
stop() {
|
|
201
|
+
cancelAnimationFrame(this.timer);
|
|
202
|
+
this.timer = null;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
var statistic = "";
|
|
206
|
+
var Statistic = defineComponent({
|
|
207
|
+
name: "DStatistic",
|
|
208
|
+
props: statisticProps,
|
|
209
|
+
inheritAttrs: false,
|
|
210
|
+
setup(props, ctx) {
|
|
211
|
+
var _a;
|
|
212
|
+
const innerValue = ref((_a = props.valueFrom) != null ? _a : props.value);
|
|
213
|
+
const tween = ref(null);
|
|
214
|
+
const animation = (from = ((_b) => (_b = props.valueFrom) != null ? _b : 0)(), to = typeof props.value === "number" ? props.value : Number(props.value)) => {
|
|
215
|
+
if (from !== to) {
|
|
216
|
+
tween.value = new Tween({
|
|
217
|
+
from: {
|
|
218
|
+
value: from
|
|
219
|
+
},
|
|
220
|
+
to: {
|
|
221
|
+
value: to
|
|
222
|
+
},
|
|
223
|
+
delay: props.delay,
|
|
224
|
+
duration: props.animationDuration,
|
|
225
|
+
easing: props.easing,
|
|
226
|
+
onUpdate: (keys) => {
|
|
227
|
+
innerValue.value = keys.value;
|
|
228
|
+
},
|
|
229
|
+
onFinish: () => {
|
|
230
|
+
innerValue.value = to;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
tween.value.start();
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
const statisticValue = computed(() => {
|
|
237
|
+
return analysisValueType(innerValue.value, props.value, props.groupSeparator, props.precision, props.showGroupSeparator, props.animation);
|
|
238
|
+
});
|
|
239
|
+
onMounted(() => {
|
|
240
|
+
if (props.animation && props.start) {
|
|
241
|
+
animation();
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
watch(() => props.start, (value) => {
|
|
245
|
+
if (value && !tween.value) {
|
|
246
|
+
animation();
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
return () => {
|
|
250
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
251
|
+
return createVNode("div", mergeProps({
|
|
252
|
+
"class": "devui-statistic"
|
|
253
|
+
}, ctx.attrs), [createVNode("div", {
|
|
254
|
+
"class": "devui-statistic-title",
|
|
255
|
+
"style": props.titleStyle
|
|
256
|
+
}, [((_b = (_a2 = ctx.slots).title) == null ? void 0 : _b.call(_a2)) || props.title]), createVNode("div", {
|
|
257
|
+
"class": "devui-statistic-content",
|
|
258
|
+
"style": props.contentStyle
|
|
259
|
+
}, [props.prefix || ((_d = (_c = ctx.slots).prefix) == null ? void 0 : _d.call(_c)) ? createVNode("span", {
|
|
260
|
+
"class": "devui-statistic-prefix"
|
|
261
|
+
}, [((_f = (_e = ctx.slots).prefix) == null ? void 0 : _f.call(_e)) || props.prefix]) : null, createVNode("span", {
|
|
262
|
+
"class": "devui-statistic--value"
|
|
263
|
+
}, [statisticValue.value]), props.suffix || ((_h = (_g = ctx.slots).suffix) == null ? void 0 : _h.call(_g)) ? createVNode("span", {
|
|
264
|
+
"class": "devui-statistic-suffix"
|
|
265
|
+
}, [((_j = (_i = ctx.slots).suffix) == null ? void 0 : _j.call(_i)) || props.suffix]) : null]), ((_l = (_k = ctx.slots).extra) == null ? void 0 : _l.call(_k)) || props.extra]);
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
Statistic.install = function(app) {
|
|
270
|
+
app.component(Statistic.name, Statistic);
|
|
271
|
+
};
|
|
272
|
+
var index = {
|
|
273
|
+
title: "Statistic \u7EDF\u8BA1\u6570\u503C",
|
|
274
|
+
category: "\u6570\u636E\u5C55\u793A",
|
|
275
|
+
status: void 0,
|
|
276
|
+
install(app) {
|
|
277
|
+
app.use(Statistic);
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
export { Statistic, index as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var q=Object.defineProperty;var B=(a,e,f)=>e in a?q(a,e,{enumerable:!0,configurable:!0,writable:!0,value:f}):a[e]=f;var s=(a,e,f)=>(B(a,typeof e!="symbol"?e+"":e,f),f);(function(a,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(a=typeof globalThis!="undefined"?globalThis:a||self,e(a.index={},a.Vue))})(this,function(a,e){"use strict";const f={title:{type:String,default:""},value:{type:[Number,String]},prefix:{type:String},suffix:{type:String},precision:{type:Number},groupSeparator:{type:String,default:","},showGroupSeparator:{type:Boolean,default:!1},titleStyle:{type:Object},contentStyle:{type:Object},animationDuration:{type:Number,default:2e3},valueFrom:{type:Number},animation:{type:Boolean,default:!1},start:{type:Boolean,default:!1},extra:{type:String,default:""},easing:{type:String,default:"easeOutCubic"},delay:{type:Number,default:0}},g=(t,i,n)=>t.replace(/\d+/,function(u){return u.replace(/(\d)(?=(\d{3})+$)/g,function(h){return h+`${n?i:""}`})}),w=t=>{if(!isNaN(t))return(t+"").indexOf(".")!==-1},C=(t,i,n,o,u)=>{const h=i.toString().indexOf(".")!==-1?i.toString().length-i.toString().indexOf(".")-1:0;return typeof t=="number"?w(t)?g(o?t.toFixed(o).toString():t.toFixed(h).toString(),n,u):g(o?t.toFixed(o).toString():t.toString(),n,u):t},c=Math.pow,v=Math.sqrt,D=function(t){return 1-c(1-t,3)},E=t=>t,V=function(t){return t===1?1:1-c(2,-10*t)},A=function(t){return t===0?0:t===1?1:t<.5?c(2,20*t-10)/2:(2-c(2,-20*t+10))/2},I=function(t){return t===0?0:c(2,10*t-10)},M=function(t){return t<.5?(1-v(1-c(2*t,2)))/2:(v(1-c(-2*t+2,2))+1)/2};var _=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",easeOutCubic:D,linear:E,easeOutExpo:V,easeInOutExpo:A,easeInExpo:I,easeInOutCirc:M});class j{constructor(i){s(this,"from");s(this,"to");s(this,"duration");s(this,"delay");s(this,"easing");s(this,"onStart");s(this,"onUpdate");s(this,"onFinish");s(this,"startTime");s(this,"started");s(this,"finished");s(this,"timer");s(this,"time");s(this,"elapsed");s(this,"keys");const{from:n,to:o,duration:u,delay:h,easing:S,onStart:l,onUpdate:d,onFinish:m}=i;for(const r in n)o[r]===void 0&&(o[r]=n[r]);for(const r in o)n[r]===void 0&&(n[r]=o[r]);this.from=n,this.to=o,this.duration=u,this.delay=h,this.easing=S,this.onStart=l,this.onUpdate=d,this.onFinish=m,this.startTime=Date.now()+this.delay,this.started=!1,this.finished=!1,this.timer=null,this.keys={}}update(){if(this.time=Date.now(),!(this.time<this.startTime)&&!this.finished){if(this.elapsed===this.duration){this.finished||(this.finished=!0,this.onFinish&&this.onFinish(this.keys));return}this.elapsed=this.time-this.startTime,this.elapsed=this.elapsed>this.duration?this.duration:this.elapsed;for(const i in this.to)this.keys[i]=this.from[i]+(this.to[i]-this.from[i])*_[this.easing](this.elapsed/this.duration);this.started||(this.onStart&&this.onStart(this.keys),this.started=!0),this.onUpdate(this.keys)}}start(){this.startTime=Date.now()+this.delay;const i=()=>{this.update(),this.timer=requestAnimationFrame(i),this.finished&&(cancelAnimationFrame(this.timer),this.timer=null)};i()}stop(){cancelAnimationFrame(this.timer),this.timer=null}}var $="",y=e.defineComponent({name:"DStatistic",props:f,inheritAttrs:!1,setup(t,i){var S;const n=e.ref((S=t.valueFrom)!=null?S:t.value),o=e.ref(null),u=(l=(m=>(m=t.valueFrom)!=null?m:0)(),d=typeof t.value=="number"?t.value:Number(t.value))=>{l!==d&&(o.value=new j({from:{value:l},to:{value:d},delay:t.delay,duration:t.animationDuration,easing:t.easing,onUpdate:r=>{n.value=r.value},onFinish:()=>{n.value=d}}),o.value.start())},h=e.computed(()=>C(n.value,t.value,t.groupSeparator,t.precision,t.showGroupSeparator,t.animation));return e.onMounted(()=>{t.animation&&t.start&&u()}),e.watch(()=>t.start,l=>{l&&!o.value&&u()}),()=>{var l,d,m,r,x,F,O,b,N,p,T,k;return e.createVNode("div",e.mergeProps({class:"devui-statistic"},i.attrs),[e.createVNode("div",{class:"devui-statistic-title",style:t.titleStyle},[((d=(l=i.slots).title)==null?void 0:d.call(l))||t.title]),e.createVNode("div",{class:"devui-statistic-content",style:t.contentStyle},[t.prefix||((r=(m=i.slots).prefix)==null?void 0:r.call(m))?e.createVNode("span",{class:"devui-statistic-prefix"},[((F=(x=i.slots).prefix)==null?void 0:F.call(x))||t.prefix]):null,e.createVNode("span",{class:"devui-statistic--value"},[h.value]),t.suffix||((b=(O=i.slots).suffix)==null?void 0:b.call(O))?e.createVNode("span",{class:"devui-statistic-suffix"},[((p=(N=i.slots).suffix)==null?void 0:p.call(N))||t.suffix]):null]),((k=(T=i.slots).extra)==null?void 0:k.call(T))||t.extra])}}});y.install=function(t){t.component(y.name,y)};var U={title:"Statistic \u7EDF\u8BA1\u6570\u503C",category:"\u6570\u636E\u5C55\u793A",status:void 0,install(t){t.use(y)}};a.Statistic=y,a.default=U,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.devui-statistic{box-sizing:border-box;margin:0;padding:0;font-size:14px;font-variant:tabular-nums;line-height:1.5715;list-style:none}.devui-statistic-title{margin-bottom:4 px;opacity:.7;font-size:14px}.devui-statistic-content{font-size:24px;display:flex;align-items:center;vertical-align:center}.devui-statistic-prefix{margin-right:6px}.devui-statistic-suffix{margin-left:6px}.devui-statistic--value{display:inline-block}
|
package/status/index.es.js
CHANGED
|
@@ -4,7 +4,7 @@ var Status = defineComponent({
|
|
|
4
4
|
name: "DStatus",
|
|
5
5
|
props: {
|
|
6
6
|
type: {
|
|
7
|
-
default: "
|
|
7
|
+
default: "invalid",
|
|
8
8
|
type: String
|
|
9
9
|
}
|
|
10
10
|
},
|
|
@@ -34,7 +34,7 @@ Status.install = function(app) {
|
|
|
34
34
|
var index = {
|
|
35
35
|
title: "Status \u72B6\u6001",
|
|
36
36
|
category: "\u901A\u7528",
|
|
37
|
-
status: "
|
|
37
|
+
status: "100%",
|
|
38
38
|
install(app) {
|
|
39
39
|
app.use(Status);
|
|
40
40
|
}
|
package/status/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(t,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(t=typeof globalThis!="undefined"?globalThis:t||self,e(t.index={},t.Vue))})(this,function(t,e){"use strict";var l="",
|
|
1
|
+
(function(t,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(t=typeof globalThis!="undefined"?globalThis:t||self,e(t.index={},t.Vue))})(this,function(t,e){"use strict";var l="",n=e.defineComponent({name:"DStatus",props:{type:{default:"invalid",type:String}},setup(u,o){const r=e.computed(()=>{const{type:s}=u,i=["success","error","initial","warning","waiting","running","invalid"];let a="devui-status devui-status-bg-invalid";return i.includes(s)&&(a=`devui-status devui-status-bg-${s}`),a});return()=>{var s,i;return e.createVNode("span",{class:r.value},[(i=(s=o.slots).default)==null?void 0:i.call(s)])}}});n.install=function(u){u.component(n.name,n)};var d={title:"Status \u72B6\u6001",category:"\u901A\u7528",status:"100%",install(u){u.use(n)}};t.Status=n,t.default=d,Object.defineProperty(t,"__esModule",{value:!0}),t[Symbol.toStringTag]="Module"});
|
package/steps-guide/index.es.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { reactive, ref, nextTick, computed, defineComponent, onMounted, createVNode, Teleport } from "vue";
|
|
2
2
|
var stepsGuide = "";
|
|
3
3
|
const stepsGuideProps = {
|
|
4
4
|
steps: Array,
|
|
5
|
+
stepIndex: {
|
|
6
|
+
type: Number,
|
|
7
|
+
default: void 0
|
|
8
|
+
},
|
|
5
9
|
showClose: {
|
|
6
10
|
type: Boolean,
|
|
7
11
|
default: true
|
|
@@ -9,22 +13,33 @@ const stepsGuideProps = {
|
|
|
9
13
|
showDots: {
|
|
10
14
|
type: Boolean,
|
|
11
15
|
default: true
|
|
16
|
+
},
|
|
17
|
+
scrollToTargetSwitch: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: true
|
|
20
|
+
},
|
|
21
|
+
zIndex: {
|
|
22
|
+
type: Number,
|
|
23
|
+
default: 1100
|
|
24
|
+
},
|
|
25
|
+
stepChange: {
|
|
26
|
+
type: Function,
|
|
27
|
+
default() {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
12
30
|
}
|
|
13
31
|
};
|
|
14
|
-
function
|
|
15
|
-
const
|
|
16
|
-
const _step = steps[stepIndex.value];
|
|
17
|
-
_step.position = _step.position || "top";
|
|
18
|
-
return _step;
|
|
19
|
-
});
|
|
20
|
-
const guideClassList = ["devui-steps-guide"];
|
|
32
|
+
function useStepsGuidePosition(props, currentStep) {
|
|
33
|
+
const guideClassList = reactive(["devui-steps-guide"]);
|
|
21
34
|
const stepsRef = ref(null);
|
|
22
35
|
const guidePosition = reactive({
|
|
23
36
|
left: "",
|
|
24
37
|
top: "",
|
|
25
|
-
zIndex:
|
|
38
|
+
zIndex: props.zIndex
|
|
26
39
|
});
|
|
27
40
|
const updateGuidePosition = () => {
|
|
41
|
+
if (!currentStep.value || !stepsRef.value)
|
|
42
|
+
return;
|
|
28
43
|
const baseTop = window.pageYOffset - document.documentElement.clientTop;
|
|
29
44
|
const baseLeft = window.pageXOffset - document.documentElement.clientLeft;
|
|
30
45
|
const currentStepPosition = currentStep.value.position;
|
|
@@ -39,6 +54,10 @@ function useStepsGuideNav(steps, stepIndex) {
|
|
|
39
54
|
guideClassList.splice(1, 1, currentStepPosition);
|
|
40
55
|
const triggerSelector = currentStep.value.target || currentStep.value.trigger;
|
|
41
56
|
const triggerElement = document.querySelector(triggerSelector);
|
|
57
|
+
if (!triggerElement) {
|
|
58
|
+
console.warn(`${triggerSelector} \u4E0D\u5B58\u5728!`);
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
42
61
|
const targetRect = triggerElement.getBoundingClientRect();
|
|
43
62
|
_left = targetRect.left + triggerElement.clientWidth / 2 - stepGuideElement.clientWidth / 2 + baseLeft;
|
|
44
63
|
_top = targetRect.top + triggerElement.clientHeight / 2 - stepGuideElement.clientHeight / 2 + baseTop;
|
|
@@ -70,96 +89,95 @@ function useStepsGuideNav(steps, stepIndex) {
|
|
|
70
89
|
}
|
|
71
90
|
guidePosition.left = _left + "px";
|
|
72
91
|
guidePosition.top = _top + "px";
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
92
|
+
if (props.scrollToTargetSwitch && typeof stepGuideElement.scrollIntoView === "function") {
|
|
93
|
+
nextTick(() => {
|
|
94
|
+
stepGuideElement.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
|
|
95
|
+
});
|
|
96
|
+
}
|
|
76
97
|
};
|
|
77
98
|
return {
|
|
78
|
-
currentStep,
|
|
79
99
|
stepsRef,
|
|
80
100
|
guidePosition,
|
|
81
101
|
guideClassList,
|
|
82
102
|
updateGuidePosition
|
|
83
103
|
};
|
|
84
104
|
}
|
|
85
|
-
function useStepsGuideCtrl(
|
|
86
|
-
const
|
|
87
|
-
const
|
|
88
|
-
|
|
105
|
+
function useStepsGuideCtrl(props, ctx, updateGuidePosition, stepIndex) {
|
|
106
|
+
const stepsCount = computed(() => props.steps.length);
|
|
107
|
+
const closeGuide = () => {
|
|
108
|
+
const _index = stepIndex.value;
|
|
109
|
+
stepIndex.value = -1;
|
|
110
|
+
nextTick(() => {
|
|
111
|
+
ctx.emit("guide-close", _index);
|
|
112
|
+
});
|
|
89
113
|
};
|
|
90
114
|
const setCurrentIndex = (index2) => {
|
|
91
|
-
if (index2
|
|
92
|
-
index2
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
updateGuidePosition();
|
|
115
|
+
if (index2 !== -1 && props.stepChange()) {
|
|
116
|
+
if (index2 > -1 && index2 < stepsCount.value) {
|
|
117
|
+
stepIndex.value = index2;
|
|
118
|
+
nextTick(() => {
|
|
119
|
+
updateGuidePosition();
|
|
120
|
+
});
|
|
121
|
+
} else {
|
|
122
|
+
console.error(`stepIndex is not within the value range`);
|
|
123
|
+
}
|
|
101
124
|
}
|
|
125
|
+
if (index2 === -1)
|
|
126
|
+
closeGuide();
|
|
102
127
|
};
|
|
103
128
|
return {
|
|
104
|
-
|
|
105
|
-
|
|
129
|
+
stepsCount,
|
|
130
|
+
closeGuide,
|
|
106
131
|
setCurrentIndex
|
|
107
132
|
};
|
|
108
133
|
}
|
|
109
134
|
var StepsGuide = defineComponent({
|
|
110
135
|
name: "DStepsGuide",
|
|
111
136
|
props: stepsGuideProps,
|
|
112
|
-
emits: [],
|
|
137
|
+
emits: ["guide-close", "update:stepIndex"],
|
|
113
138
|
setup(props, ctx) {
|
|
114
|
-
|
|
115
|
-
const
|
|
139
|
+
var _a;
|
|
140
|
+
const stepIndexData = ref((_a = props.stepIndex) != null ? _a : 0);
|
|
141
|
+
const stepIndex = computed({
|
|
142
|
+
set: (val) => {
|
|
143
|
+
if (props.stepIndex != null) {
|
|
144
|
+
ctx.emit("update:stepIndex", val);
|
|
145
|
+
}
|
|
146
|
+
stepIndexData.value = val;
|
|
147
|
+
},
|
|
148
|
+
get: () => stepIndexData.value
|
|
149
|
+
});
|
|
150
|
+
const currentStep = computed(() => {
|
|
151
|
+
const _step = props.steps[stepIndex.value];
|
|
152
|
+
if (_step)
|
|
153
|
+
_step.position = _step.position || "top";
|
|
154
|
+
return _step;
|
|
155
|
+
});
|
|
116
156
|
const {
|
|
117
|
-
currentStep,
|
|
118
157
|
stepsRef,
|
|
119
158
|
guidePosition,
|
|
120
159
|
guideClassList,
|
|
121
160
|
updateGuidePosition
|
|
122
|
-
} =
|
|
161
|
+
} = useStepsGuidePosition(props, currentStep);
|
|
123
162
|
const {
|
|
124
|
-
|
|
125
|
-
|
|
163
|
+
stepsCount,
|
|
164
|
+
closeGuide,
|
|
126
165
|
setCurrentIndex
|
|
127
|
-
} = useStepsGuideCtrl(
|
|
166
|
+
} = useStepsGuideCtrl(props, ctx, updateGuidePosition, stepIndex);
|
|
128
167
|
onMounted(() => {
|
|
129
168
|
updateGuidePosition();
|
|
130
169
|
});
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
guideClassList,
|
|
137
|
-
stepsRef,
|
|
138
|
-
currentStep,
|
|
139
|
-
setCurrentIndex,
|
|
140
|
-
closeSteps
|
|
141
|
-
};
|
|
142
|
-
},
|
|
143
|
-
render(props) {
|
|
144
|
-
const {
|
|
145
|
-
showSteps,
|
|
146
|
-
guidePosition,
|
|
147
|
-
guideClassList,
|
|
148
|
-
currentStep,
|
|
149
|
-
stepIndex,
|
|
150
|
-
stepsCount,
|
|
151
|
-
setCurrentIndex,
|
|
152
|
-
closeSteps,
|
|
153
|
-
showClose,
|
|
154
|
-
showDots
|
|
155
|
-
} = props;
|
|
156
|
-
return showSteps ? createVNode(Teleport, {
|
|
170
|
+
ctx.expose({
|
|
171
|
+
closeGuide,
|
|
172
|
+
setCurrentIndex
|
|
173
|
+
});
|
|
174
|
+
return () => stepIndex.value > -1 && stepsCount.value > 0 ? createVNode(Teleport, {
|
|
157
175
|
"to": "body"
|
|
158
176
|
}, {
|
|
159
177
|
default: () => [createVNode("div", {
|
|
160
178
|
"style": guidePosition,
|
|
161
179
|
"class": guideClassList,
|
|
162
|
-
"ref":
|
|
180
|
+
"ref": stepsRef
|
|
163
181
|
}, [createVNode("div", {
|
|
164
182
|
"class": "devui-shining-dot"
|
|
165
183
|
}, null), createVNode("div", {
|
|
@@ -170,45 +188,52 @@ var StepsGuide = defineComponent({
|
|
|
170
188
|
"class": "devui-guide-container"
|
|
171
189
|
}, [createVNode("p", {
|
|
172
190
|
"class": "devui-title"
|
|
173
|
-
}, [currentStep.title]), showClose ? createVNode("div", {
|
|
191
|
+
}, [currentStep.value.title]), props.showClose ? createVNode("div", {
|
|
174
192
|
"class": "icon icon-close",
|
|
175
|
-
"onClick":
|
|
193
|
+
"onClick": closeGuide
|
|
176
194
|
}, null) : null, createVNode("div", {
|
|
177
195
|
"class": "devui-content"
|
|
178
|
-
}, [currentStep.content]), createVNode("div", {
|
|
196
|
+
}, [currentStep.value.content]), createVNode("div", {
|
|
179
197
|
"class": "devui-ctrl"
|
|
180
|
-
}, [showDots ? createVNode("div", {
|
|
198
|
+
}, [props.showDots ? createVNode("div", {
|
|
181
199
|
"class": "devui-dots"
|
|
182
200
|
}, [props.steps.map((step, index2) => {
|
|
183
201
|
return createVNode("em", {
|
|
184
|
-
"class": ["icon icon-dot-status", currentStep === step ? "devui-active" : ""],
|
|
202
|
+
"class": ["icon icon-dot-status", currentStep.value === step ? "devui-active" : ""],
|
|
185
203
|
"key": index2
|
|
186
204
|
}, null);
|
|
187
205
|
})]) : null, createVNode("div", {
|
|
188
206
|
"class": "devui-guide-btn"
|
|
189
|
-
}, [stepIndex > 0 ? createVNode("div", {
|
|
207
|
+
}, [stepIndex.value > 0 ? createVNode("div", {
|
|
190
208
|
"class": "devui-prev-step",
|
|
191
|
-
"onClick": () => setCurrentIndex(
|
|
192
|
-
}, ["\u4E0A\u4E00\u6B65"]) : null, stepIndex === stepsCount ? createVNode("div", {
|
|
193
|
-
"onClick":
|
|
209
|
+
"onClick": () => setCurrentIndex(stepIndex.value - 1)
|
|
210
|
+
}, ["\u4E0A\u4E00\u6B65"]) : null, stepIndex.value === stepsCount.value - 1 ? createVNode("div", {
|
|
211
|
+
"onClick": closeGuide
|
|
194
212
|
}, ["\u6211\u77E5\u9053\u5566"]) : createVNode("div", {
|
|
195
213
|
"class": "devui-next-step",
|
|
196
214
|
"onClick": () => {
|
|
197
|
-
setCurrentIndex(
|
|
215
|
+
setCurrentIndex(stepIndex.value + 1);
|
|
198
216
|
}
|
|
199
217
|
}, ["\u6211\u77E5\u9053\u5566,\u7EE7\u7EED"])])])])])]
|
|
200
218
|
}) : null;
|
|
201
219
|
}
|
|
202
220
|
});
|
|
221
|
+
var StepsGuideDirective = {
|
|
222
|
+
mounted(el, binding, vNode) {
|
|
223
|
+
},
|
|
224
|
+
updated(el, binding) {
|
|
225
|
+
}
|
|
226
|
+
};
|
|
203
227
|
StepsGuide.install = function(app) {
|
|
204
228
|
app.component(StepsGuide.name, StepsGuide);
|
|
205
229
|
};
|
|
206
230
|
var index = {
|
|
207
231
|
title: "StepsGuide \u64CD\u4F5C\u6307\u5F15",
|
|
208
232
|
category: "\u5BFC\u822A",
|
|
209
|
-
status: "
|
|
233
|
+
status: "80%",
|
|
210
234
|
install(app) {
|
|
211
235
|
app.use(StepsGuide);
|
|
236
|
+
app.directive("StepsGuide", StepsGuideDirective);
|
|
212
237
|
}
|
|
213
238
|
};
|
|
214
239
|
export { StepsGuide, index as default };
|
package/steps-guide/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(a,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(a=typeof globalThis!="undefined"?globalThis:a||self,e(a.index={},a.Vue))})(this,function(a,e){"use strict";var x="";const y={steps:Array,stepIndex:{type:Number,default:void 0},showClose:{type:Boolean,default:!0},showDots:{type:Boolean,default:!0},scrollToTargetSwitch:{type:Boolean,default:!0},zIndex:{type:Number,default:1100},stepChange:{type:Function,default(){return!0}}};function b(i,o){const r=e.reactive(["devui-steps-guide"]),n=e.ref(null),l=e.reactive({left:"",top:"",zIndex:i.zIndex});return{stepsRef:n,guidePosition:l,guideClassList:r,updateGuidePosition:()=>{if(!o.value||!n.value)return;const m=window.pageYOffset-document.documentElement.clientTop,c=window.pageXOffset-document.documentElement.clientLeft,p=o.value.position,s=n.value;let d,u;if(typeof p!="string"){const{top:f=0,left:t=0,type:g="top"}=p;r.splice(1,1,g),d=t,u=f}else{r.splice(1,1,p);const f=o.value.target||o.value.trigger,t=document.querySelector(f);if(!t)return console.warn(`${f} \u4E0D\u5B58\u5728!`),!1;const g=t.getBoundingClientRect();d=g.left+t.clientWidth/2-s.clientWidth/2+c,u=g.top+t.clientHeight/2-s.clientHeight/2+m;const C=p.split("-");switch(C[0]){case"top":u+=-s.clientHeight/2-t.clientHeight;break;case"bottom":u+=s.clientHeight/2+t.clientHeight;break;case"left":u+=s.clientHeight/2-t.clientHeight,d+=-s.clientWidth/2-t.clientWidth/2;break;case"right":u+=s.clientHeight/2-t.clientHeight,d+=s.clientWidth/2+t.clientWidth/2;break}switch(C[1]){case"left":d+=s.clientWidth/2-t.clientWidth/2;break;case"right":d+=-s.clientWidth/2+t.clientWidth/2;break}}l.left=d+"px",l.top=u+"px",i.scrollToTargetSwitch&&typeof s.scrollIntoView=="function"&&e.nextTick(()=>{s.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})})}}}function N(i,o,r,n){const l=e.computed(()=>i.steps.length),v=()=>{const c=n.value;n.value=-1,e.nextTick(()=>{o.emit("guide-close",c)})};return{stepsCount:l,closeGuide:v,setCurrentIndex:c=>{c!==-1&&i.stepChange()&&(c>-1&&c<l.value?(n.value=c,e.nextTick(()=>{r()})):console.error("stepIndex is not within the value range")),c===-1&&v()}}}var h=e.defineComponent({name:"DStepsGuide",props:y,emits:["guide-close","update:stepIndex"],setup(i,o){var f;const r=e.ref((f=i.stepIndex)!=null?f:0),n=e.computed({set:t=>{i.stepIndex!=null&&o.emit("update:stepIndex",t),r.value=t},get:()=>r.value}),l=e.computed(()=>{const t=i.steps[n.value];return t&&(t.position=t.position||"top"),t}),{stepsRef:v,guidePosition:m,guideClassList:c,updateGuidePosition:p}=b(i,l),{stepsCount:s,closeGuide:d,setCurrentIndex:u}=N(i,o,p,n);return e.onMounted(()=>{p()}),o.expose({closeGuide:d,setCurrentIndex:u}),()=>n.value>-1&&s.value>0?e.createVNode(e.Teleport,{to:"body"},{default:()=>[e.createVNode("div",{style:m,class:c,ref:v},[e.createVNode("div",{class:"devui-shining-dot"},null),e.createVNode("div",{class:"devui-shining-plus"},null),e.createVNode("div",{class:"devui-arrow"},null),e.createVNode("div",{class:"devui-guide-container"},[e.createVNode("p",{class:"devui-title"},[l.value.title]),i.showClose?e.createVNode("div",{class:"icon icon-close",onClick:d},null):null,e.createVNode("div",{class:"devui-content"},[l.value.content]),e.createVNode("div",{class:"devui-ctrl"},[i.showDots?e.createVNode("div",{class:"devui-dots"},[i.steps.map((t,g)=>e.createVNode("em",{class:["icon icon-dot-status",l.value===t?"devui-active":""],key:g},null))]):null,e.createVNode("div",{class:"devui-guide-btn"},[n.value>0?e.createVNode("div",{class:"devui-prev-step",onClick:()=>u(n.value-1)},["\u4E0A\u4E00\u6B65"]):null,n.value===s.value-1?e.createVNode("div",{onClick:d},["\u6211\u77E5\u9053\u5566"]):e.createVNode("div",{class:"devui-next-step",onClick:()=>{u(n.value+1)}},["\u6211\u77E5\u9053\u5566,\u7EE7\u7EED"])])])])])]}):null}}),V={mounted(i,o,r){},updated(i,o){}};h.install=function(i){i.component(h.name,h)};var w={title:"StepsGuide \u64CD\u4F5C\u6307\u5F15",category:"\u5BFC\u822A",status:"80%",install(i){i.use(h),i.directive("StepsGuide",V)}};a.StepsGuide=h,a.default=w,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
|