1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var lodashUnified = require('lodash-unified');
var index$2 = require('../../button/index.js');
var index$1 = require('../../icon/index.js');
require('../../../utils/index.js');
require('../../../hooks/index.js');
var step = require('./step2.js');
var helper = require('./helper.js');
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
var icon = require('../../../utils/vue/icon.js');
var index = require('../../../hooks/use-locale/index.js');
const __default__ = vue.defineComponent({
name: "ElTourStep"
});
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
...__default__,
props: step.tourStepProps,
emits: step.tourStepEmits,
setup(__props, { emit }) {
const props = __props;
const { Close } = icon.CloseComponents;
const { t } = index.useLocale();
const {
currentStep,
current,
total,
showClose,
closeIcon,
mergedType,
ns,
slots: tourSlots,
updateModelValue,
onClose: tourOnClose,
onFinish: tourOnFinish,
onChange
} = vue.inject(helper.tourKey);
vue.watch(props, (val) => {
currentStep.value = val;
}, {
immediate: true
});
const mergedShowClose = vue.computed(() => {
var _a;
return (_a = props.showClose) != null ? _a : showClose.value;
});
const mergedCloseIcon = vue.computed(() => {
var _a, _b;
return (_b = (_a = props.closeIcon) != null ? _a : closeIcon.value) != null ? _b : Close;
});
const filterButtonProps = (btnProps) => {
if (!btnProps)
return;
return lodashUnified.omit(btnProps, ["children", "onClick"]);
};
const onPrev = () => {
var _a, _b;
current.value -= 1;
if ((_a = props.prevButtonProps) == null ? void 0 : _a.onClick) {
(_b = props.prevButtonProps) == null ? void 0 : _b.onClick();
}
onChange();
};
const onNext = () => {
var _a;
if (current.value >= total.value - 1) {
onFinish();
} else {
current.value += 1;
}
if ((_a = props.nextButtonProps) == null ? void 0 : _a.onClick) {
props.nextButtonProps.onClick();
}
onChange();
};
const onFinish = () => {
onClose();
tourOnFinish();
};
const onClose = () => {
updateModelValue(false);
tourOnClose();
emit("close");
};
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
vue.unref(mergedShowClose) ? (vue.openBlock(), vue.createElementBlock("button", {
key: 0,
"aria-label": "Close",
class: vue.normalizeClass(vue.unref(ns).e("closebtn")),
type: "button",
onClick: onClose
}, [
vue.createVNode(vue.unref(index$1.ElIcon), {
class: vue.normalizeClass(vue.unref(ns).e("close"))
}, {
default: vue.withCtx(() => [
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(mergedCloseIcon))))
]),
_: 1
}, 8, ["class"])
], 2)) : vue.createCommentVNode("v-if", true),
vue.createElementVNode("header", {
class: vue.normalizeClass([vue.unref(ns).e("header"), { "show-close": vue.unref(showClose) }])
}, [
vue.renderSlot(_ctx.$slots, "header", {}, () => [
vue.createElementVNode("span", {
role: "heading",
class: vue.normalizeClass(vue.unref(ns).e("title"))
}, vue.toDisplayString(_ctx.title), 3)
])
], 2),
vue.createElementVNode("div", {
class: vue.normalizeClass(vue.unref(ns).e("body"))
}, [
vue.renderSlot(_ctx.$slots, "default", {}, () => [
vue.createElementVNode("span", null, vue.toDisplayString(_ctx.description), 1)
])
], 2),
vue.createElementVNode("footer", {
class: vue.normalizeClass(vue.unref(ns).e("footer"))
}, [
vue.createElementVNode("div", {
class: vue.normalizeClass(vue.unref(ns).b("indicators"))
}, [
vue.unref(tourSlots).indicators ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(tourSlots).indicators), {
key: 0,
current: vue.unref(current),
total: vue.unref(total)
}, null, 8, ["current", "total"])) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(vue.unref(total), (item, index) => {
return vue.openBlock(), vue.createElementBlock("span", {
key: item,
class: vue.normalizeClass([vue.unref(ns).b("indicator"), index === vue.unref(current) ? "is-active" : ""])
}, null, 2);
}), 128))
], 2),
vue.createElementVNode("div", {
class: vue.normalizeClass(vue.unref(ns).b("buttons"))
}, [
vue.unref(current) > 0 ? (vue.openBlock(), vue.createBlock(vue.unref(index$2.ElButton), vue.mergeProps({
key: 0,
size: "small",
type: vue.unref(mergedType)
}, filterButtonProps(_ctx.prevButtonProps), { onClick: onPrev }), {
default: vue.withCtx(() => {
var _a, _b;
return [
vue.createTextVNode(vue.toDisplayString((_b = (_a = _ctx.prevButtonProps) == null ? void 0 : _a.children) != null ? _b : vue.unref(t)("el.tour.previous")), 1)
];
}),
_: 1
}, 16, ["type"])) : vue.createCommentVNode("v-if", true),
vue.unref(current) <= vue.unref(total) - 1 ? (vue.openBlock(), vue.createBlock(vue.unref(index$2.ElButton), vue.mergeProps({
key: 1,
size: "small",
type: vue.unref(mergedType) === "primary" ? "default" : "primary"
}, filterButtonProps(_ctx.nextButtonProps), { onClick: onNext }), {
default: vue.withCtx(() => {
var _a, _b;
return [
vue.createTextVNode(vue.toDisplayString((_b = (_a = _ctx.nextButtonProps) == null ? void 0 : _a.children) != null ? _b : vue.unref(current) === vue.unref(total) - 1 ? vue.unref(t)("el.tour.finish") : vue.unref(t)("el.tour.next")), 1)
];
}),
_: 1
}, 16, ["type"])) : vue.createCommentVNode("v-if", true)
], 2)
], 2)
], 64);
};
}
});
var TourStep = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "step.vue"]]);
exports["default"] = TourStep;
//# sourceMappingURL=step.js.map