@king-design/intact 3.5.1 → 3.6.0-beta.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/components/breadcrumb/demos/separator.md +4 -4
- package/components/breadcrumb/index.vdt +1 -1
- package/components/breadcrumb/styles.ts +3 -2
- package/components/button/index.md +1 -0
- package/components/datepicker/basepicker.ts +60 -13
- package/components/datepicker/calendar.ts +5 -1
- package/components/datepicker/calendar.vdt +20 -6
- package/components/datepicker/dayjs.ts +22 -2
- package/components/datepicker/demos/multiple.md +0 -5
- package/components/datepicker/demos/nowrap.md +35 -0
- package/components/datepicker/demos/yearMonth.md +8 -2
- package/components/datepicker/helpers.ts +5 -5
- package/components/datepicker/index.md +3 -2
- package/components/datepicker/index.spec.ts +107 -90
- package/components/datepicker/index.ts +23 -5
- package/components/datepicker/index.vdt +34 -35
- package/components/datepicker/styles.ts +102 -3
- package/components/datepicker/useDisabled.ts +3 -3
- package/components/datepicker/useFormats.ts +2 -0
- package/components/datepicker/useMergeRange.ts +54 -0
- package/components/datepicker/usePosition.ts +169 -0
- package/components/datepicker/useQuarters.ts +47 -0
- package/components/datepicker/useShowDate.ts +42 -11
- package/components/datepicker/useValue.ts +35 -4
- package/components/datepicker/useWeeks.ts +58 -0
- package/components/dialog/useFixBody.ts +7 -64
- package/components/ellipsis/styles.ts +4 -0
- package/components/form/styles.ts +1 -0
- package/components/scrollSelect/index.spec.ts +3 -3
- package/components/scrollSelect/useMouseEvents.ts +23 -10
- package/components/select/base.vdt +2 -1
- package/components/select/demos/creatable.md +13 -0
- package/components/select/index.md +1 -0
- package/components/select/index.spec.ts +180 -0
- package/components/select/option.ts +9 -1
- package/components/select/select.ts +2 -0
- package/components/select/useFilterable.ts +1 -1
- package/components/select/useInput.ts +4 -2
- package/components/select/useSearchable.ts +2 -2
- package/components/table/table.vdt +3 -3
- package/components/timepicker/demos/step.md +1 -1
- package/components/timepicker/panelPicker.vdt +5 -1
- package/components/timepicker/styles.ts +0 -1
- package/components/tour/demos/basic.md +73 -0
- package/components/tour/demos/beforeChange.md +109 -0
- package/components/tour/demos/closable.md +70 -0
- package/components/tour/demos/custom.md +98 -0
- package/components/tour/demos/customText.md +94 -0
- package/components/tour/demos/declarative.md +72 -0
- package/components/tour/demos/events.md +101 -0
- package/components/tour/demos/maskClosable.md +76 -0
- package/components/tour/demos/notarget.md +59 -0
- package/components/tour/index.md +48 -0
- package/components/tour/index.spec.ts +259 -0
- package/components/tour/index.ts +2 -0
- package/components/tour/step.ts +55 -0
- package/components/tour/step.vdt +75 -0
- package/components/tour/styles.ts +283 -0
- package/components/tour/tour.ts +107 -0
- package/components/tour/tour.vdt +83 -0
- package/components/tour/useArrow.ts +46 -0
- package/components/tour/useFixBody.ts +22 -0
- package/components/tour/useHighlight.ts +36 -0
- package/components/tour/useMaskClosable.ts +26 -0
- package/components/tour/useNavigation.ts +46 -0
- package/components/tour/usePosition.ts +91 -0
- package/components/tour/useSteps.ts +80 -0
- package/components/tree/useChecked.ts +6 -4
- package/components/treeSelect/index.spec.ts +13 -1
- package/components/virtualList/useVirtualRows.ts +1 -1
- package/es/components/breadcrumb/index.vdt.js +2 -1
- package/es/components/breadcrumb/styles.js +5 -3
- package/es/components/datepicker/basepicker.d.ts +4 -2
- package/es/components/datepicker/basepicker.js +46 -13
- package/es/components/datepicker/calendar.d.ts +34 -6
- package/es/components/datepicker/calendar.js +4 -0
- package/es/components/datepicker/calendar.vdt.js +21 -5
- package/es/components/datepicker/dayjs.d.ts +13 -2
- package/es/components/datepicker/dayjs.js +6 -0
- package/es/components/datepicker/helpers.d.ts +5 -5
- package/es/components/datepicker/index.d.ts +17 -2
- package/es/components/datepicker/index.js +23 -5
- package/es/components/datepicker/index.spec.js +356 -355
- package/es/components/datepicker/index.vdt.js +25 -29
- package/es/components/datepicker/styles.d.ts +17 -0
- package/es/components/datepicker/styles.js +29 -2
- package/es/components/datepicker/useDisabled.d.ts +2 -2
- package/es/components/datepicker/useDisabled.js +1 -1
- package/es/components/datepicker/useFormats.js +3 -1
- package/es/components/datepicker/useMergeRange.d.ts +5 -0
- package/es/components/datepicker/useMergeRange.js +50 -0
- package/es/components/datepicker/usePosition.d.ts +10 -0
- package/es/components/datepicker/usePosition.js +166 -0
- package/es/components/datepicker/useQuarters.d.ts +15 -0
- package/es/components/datepicker/useQuarters.js +36 -0
- package/es/components/datepicker/useShowDate.d.ts +1 -1
- package/es/components/datepicker/useShowDate.js +42 -9
- package/es/components/datepicker/useStatus.d.ts +1 -1
- package/es/components/datepicker/useValue.d.ts +1 -0
- package/es/components/datepicker/useValue.js +26 -2
- package/es/components/datepicker/useWeeks.d.ts +19 -0
- package/es/components/datepicker/useWeeks.js +48 -0
- package/es/components/dialog/useFixBody.js +6 -58
- package/es/components/ellipsis/styles.js +1 -1
- package/es/components/form/styles.js +1 -1
- package/es/components/scrollSelect/index.spec.js +4 -6
- package/es/components/scrollSelect/useMouseEvents.js +21 -9
- package/es/components/select/base.vdt.js +4 -2
- package/es/components/select/index.spec.js +269 -42
- package/es/components/select/option.d.ts +1 -0
- package/es/components/select/option.js +9 -2
- package/es/components/select/select.d.ts +1 -0
- package/es/components/select/select.js +2 -1
- package/es/components/select/useFilterable.js +2 -1
- package/es/components/select/useInput.js +5 -2
- package/es/components/select/useSearchable.js +1 -0
- package/es/components/table/table.vdt.js +4 -2
- package/es/components/timepicker/panelPicker.d.ts +2 -1
- package/es/components/timepicker/panelPicker.vdt.js +12 -4
- package/es/components/timepicker/selectPicker.d.ts +1 -1
- package/es/components/timepicker/styles.js +1 -1
- package/es/components/timepicker/useDisabled.d.ts +1 -1
- package/es/components/timepicker/useValue.d.ts +1 -0
- package/es/components/tour/index.d.ts +2 -0
- package/es/components/tour/index.js +2 -0
- package/es/components/tour/index.spec.d.ts +1 -0
- package/es/components/tour/index.spec.js +356 -0
- package/es/components/tour/step.d.ts +23 -0
- package/es/components/tour/step.js +46 -0
- package/es/components/tour/step.vdt.js +74 -0
- package/es/components/tour/styles.d.ts +7 -0
- package/es/components/tour/styles.js +84 -0
- package/es/components/tour/tour.d.ts +73 -0
- package/es/components/tour/tour.js +70 -0
- package/es/components/tour/tour.vdt.js +66 -0
- package/es/components/tour/useArrow.d.ts +4 -0
- package/es/components/tour/useArrow.js +40 -0
- package/es/components/tour/useFixBody.d.ts +4 -0
- package/es/components/tour/useFixBody.js +17 -0
- package/es/components/tour/useHighlight.d.ts +4 -0
- package/es/components/tour/useHighlight.js +31 -0
- package/es/components/tour/useMaskClosable.d.ts +1 -0
- package/es/components/tour/useMaskClosable.js +25 -0
- package/es/components/tour/useNavigation.d.ts +5 -0
- package/es/components/tour/useNavigation.js +103 -0
- package/es/components/tour/usePosition.d.ts +6 -0
- package/es/components/tour/usePosition.js +93 -0
- package/es/components/tour/useSteps.d.ts +6 -0
- package/es/components/tour/useSteps.js +68 -0
- package/es/components/tree/useChecked.js +6 -4
- package/es/components/treeSelect/index.spec.js +20 -5
- package/es/components/virtualList/useVirtualRows.js +1 -1
- package/es/hooks/useDocumentClick.js +3 -3
- package/es/hooks/useFixBody.d.ts +11 -0
- package/es/hooks/useFixBody.js +72 -0
- package/es/index.d.ts +3 -2
- package/es/index.js +3 -2
- package/es/site/data/components/breadcrumb/demos/separator/react.js +7 -5
- package/es/site/data/components/datepicker/demos/multiple/index.d.ts +0 -1
- package/es/site/data/components/datepicker/demos/multiple/index.js +1 -2
- package/es/site/data/components/datepicker/demos/multiple/react.d.ts +0 -1
- package/es/site/data/components/datepicker/demos/multiple/react.js +2 -13
- package/es/site/data/components/datepicker/demos/nowrap/index.d.ts +10 -0
- package/es/site/data/components/datepicker/demos/nowrap/index.js +19 -0
- package/es/site/data/components/datepicker/demos/nowrap/react.d.ts +10 -0
- package/es/site/data/components/datepicker/demos/nowrap/react.js +49 -0
- package/es/site/data/components/datepicker/demos/yearMonth/index.d.ts +2 -0
- package/es/site/data/components/datepicker/demos/yearMonth/index.js +3 -1
- package/es/site/data/components/datepicker/demos/yearMonth/react.d.ts +2 -0
- package/es/site/data/components/datepicker/demos/yearMonth/react.js +21 -1
- package/es/site/data/components/select/demos/creatable/index.d.ts +1 -0
- package/es/site/data/components/select/demos/creatable/index.js +2 -1
- package/es/site/data/components/select/demos/creatable/react.d.ts +1 -0
- package/es/site/data/components/select/demos/creatable/react.js +31 -2
- package/es/site/data/components/select/demos/searchable/index.js +1 -1
- package/es/site/data/components/select/demos/searchable/react.js +1 -1
- package/es/site/data/components/tour/demos/basic/index.d.ts +17 -0
- package/es/site/data/components/tour/demos/basic/index.js +46 -0
- package/es/site/data/components/tour/demos/basic/react.d.ts +16 -0
- package/es/site/data/components/tour/demos/basic/react.js +82 -0
- package/es/site/data/components/tour/demos/beforeChange/index.d.ts +20 -0
- package/es/site/data/components/tour/demos/beforeChange/index.js +69 -0
- package/es/site/data/components/tour/demos/beforeChange/react.d.ts +19 -0
- package/es/site/data/components/tour/demos/beforeChange/react.js +129 -0
- package/es/site/data/components/tour/demos/closable/index.d.ts +18 -0
- package/es/site/data/components/tour/demos/closable/index.js +42 -0
- package/es/site/data/components/tour/demos/closable/react.d.ts +17 -0
- package/es/site/data/components/tour/demos/closable/react.js +85 -0
- package/es/site/data/components/tour/demos/custom/index.d.ts +11 -0
- package/es/site/data/components/tour/demos/custom/index.js +35 -0
- package/es/site/data/components/tour/demos/custom/react.d.ts +11 -0
- package/es/site/data/components/tour/demos/custom/react.js +108 -0
- package/es/site/data/components/tour/demos/customButtons/index.d.ts +33 -0
- package/es/site/data/components/tour/demos/customButtons/index.js +55 -0
- package/es/site/data/components/tour/demos/customButtons/react.d.ts +33 -0
- package/es/site/data/components/tour/demos/customButtons/react.js +99 -0
- package/es/site/data/components/tour/demos/customText/index.d.ts +20 -0
- package/es/site/data/components/tour/demos/customText/index.js +54 -0
- package/es/site/data/components/tour/demos/customText/react.d.ts +19 -0
- package/es/site/data/components/tour/demos/customText/react.js +95 -0
- package/es/site/data/components/tour/demos/declarative/index.d.ts +11 -0
- package/es/site/data/components/tour/demos/declarative/index.js +36 -0
- package/es/site/data/components/tour/demos/declarative/react.d.ts +10 -0
- package/es/site/data/components/tour/demos/declarative/react.js +80 -0
- package/es/site/data/components/tour/demos/events/index.d.ts +18 -0
- package/es/site/data/components/tour/demos/events/index.js +58 -0
- package/es/site/data/components/tour/demos/events/react.d.ts +18 -0
- package/es/site/data/components/tour/demos/events/react.js +101 -0
- package/es/site/data/components/tour/demos/maskClosable/index.d.ts +18 -0
- package/es/site/data/components/tour/demos/maskClosable/index.js +47 -0
- package/es/site/data/components/tour/demos/maskClosable/react.d.ts +17 -0
- package/es/site/data/components/tour/demos/maskClosable/react.js +95 -0
- package/es/site/data/components/tour/demos/notarget/index.d.ts +11 -0
- package/es/site/data/components/tour/demos/notarget/index.js +35 -0
- package/es/site/data/components/tour/demos/notarget/react.d.ts +10 -0
- package/es/site/data/components/tour/demos/notarget/react.js +61 -0
- package/es/site/data/components/tour/index.d.ts +57 -0
- package/es/site/data/components/tour/index.js +32 -0
- package/es/site/src/pages/resource/index.js +1 -1
- package/es/styles/fonts/iconfont.js +2 -1
- package/es/styles/global.js +2 -1
- package/hooks/useDocumentClick.ts +3 -3
- package/hooks/useFixBody.ts +87 -0
- package/index.ts +3 -2
- package/package.json +1 -1
- package/styles/fonts/iconfont.ts +2 -1
- package/styles/global.ts +2 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
3
|
+
import _findInstanceProperty from "@babel/runtime-corejs3/core-js/instance/find";
|
|
4
|
+
import _Array$from from "@babel/runtime-corejs3/core-js/array/from";
|
|
5
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js/instance/includes";
|
|
6
|
+
import _trimInstanceProperty from "@babel/runtime-corejs3/core-js/instance/trim";
|
|
7
|
+
import BasicDemo from '~/components/tour/demos/basic';
|
|
8
|
+
import DeclarativeDemo from '~/components/tour/demos/declarative';
|
|
9
|
+
import ClosableDemo from '~/components/tour/demos/closable';
|
|
10
|
+
import CustomTextDemo from '~/components/tour/demos/customText';
|
|
11
|
+
import BeforeChangeDemo from '~/components/tour/demos/beforeChange';
|
|
12
|
+
import EventsDemo from '~/components/tour/demos/events';
|
|
13
|
+
import MaskClosableDemo from '~/components/tour/demos/maskClosable';
|
|
14
|
+
import NotargetDemo from '~/components/tour/demos/notarget';
|
|
15
|
+
import { mount, unmount, dispatchEvent, getElement, wait } from '../../test/utils';
|
|
16
|
+
describe('Tour', function () {
|
|
17
|
+
afterEach(function () {
|
|
18
|
+
unmount();
|
|
19
|
+
});
|
|
20
|
+
it('should show and hide tour correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
21
|
+
var _context, _context2;
|
|
22
|
+
var _mount, instance, element, tourContent, buttons, startBtn, indicator, nextBtn, updatedContent, doneBtn;
|
|
23
|
+
return _regeneratorRuntime.wrap(function _callee$(_context3) {
|
|
24
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
25
|
+
case 0:
|
|
26
|
+
_mount = mount(BasicDemo), instance = _mount[0], element = _mount[1];
|
|
27
|
+
tourContent = getElement('.k-tour-step');
|
|
28
|
+
expect(tourContent).to.be.undefined;
|
|
29
|
+
buttons = element.querySelectorAll('.k-btn');
|
|
30
|
+
startBtn = _findInstanceProperty(_context = _Array$from(buttons)).call(_context, function (btn) {
|
|
31
|
+
var _btn$textContent;
|
|
32
|
+
return (_btn$textContent = btn.textContent) == null ? void 0 : _includesInstanceProperty(_btn$textContent).call(_btn$textContent, '启动引导');
|
|
33
|
+
});
|
|
34
|
+
startBtn.click();
|
|
35
|
+
_context3.next = 8;
|
|
36
|
+
return wait();
|
|
37
|
+
case 8:
|
|
38
|
+
tourContent = getElement('.k-tour-step');
|
|
39
|
+
expect(tourContent).to.exist;
|
|
40
|
+
expect(tourContent.querySelector('.k-tour-step-title').textContent).to.eql('第一步');
|
|
41
|
+
indicator = tourContent.querySelector('.k-tour-step-indicator');
|
|
42
|
+
expect(_trimInstanceProperty(_context2 = indicator.textContent).call(_context2)).to.eql('1 / 2');
|
|
43
|
+
nextBtn = tourContent.querySelector('.k-tour-step-buttons .k-primary');
|
|
44
|
+
nextBtn.click();
|
|
45
|
+
_context3.next = 17;
|
|
46
|
+
return wait();
|
|
47
|
+
case 17:
|
|
48
|
+
updatedContent = getElement('.k-tour-step');
|
|
49
|
+
expect(updatedContent.querySelector('.k-tour-step-title').textContent).to.eql('第二步');
|
|
50
|
+
doneBtn = updatedContent.querySelector('.k-tour-step-buttons .k-primary');
|
|
51
|
+
doneBtn.click();
|
|
52
|
+
_context3.next = 23;
|
|
53
|
+
return wait();
|
|
54
|
+
case 23:
|
|
55
|
+
expect(getElement('.k-tour-step')).to.be.undefined;
|
|
56
|
+
case 24:
|
|
57
|
+
case "end":
|
|
58
|
+
return _context3.stop();
|
|
59
|
+
}
|
|
60
|
+
}, _callee);
|
|
61
|
+
})));
|
|
62
|
+
it('should work with declarative TourStep components', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
63
|
+
var _context4;
|
|
64
|
+
var _mount2, instance, element, buttons, startBtn, tourContent, nextBtn, updatedContent;
|
|
65
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context5) {
|
|
66
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
67
|
+
case 0:
|
|
68
|
+
_mount2 = mount(DeclarativeDemo), instance = _mount2[0], element = _mount2[1];
|
|
69
|
+
buttons = element.querySelectorAll('.k-btn');
|
|
70
|
+
startBtn = _findInstanceProperty(_context4 = _Array$from(buttons)).call(_context4, function (btn) {
|
|
71
|
+
var _btn$textContent2;
|
|
72
|
+
return (_btn$textContent2 = btn.textContent) == null ? void 0 : _includesInstanceProperty(_btn$textContent2).call(_btn$textContent2, '启动引导');
|
|
73
|
+
});
|
|
74
|
+
startBtn.click();
|
|
75
|
+
_context5.next = 6;
|
|
76
|
+
return wait(50);
|
|
77
|
+
case 6:
|
|
78
|
+
tourContent = getElement('.k-tour-step');
|
|
79
|
+
expect(tourContent).to.exist;
|
|
80
|
+
expect(tourContent.querySelector('.k-tour-step-title').textContent).to.eql('第一步');
|
|
81
|
+
expect(tourContent.querySelector('.k-tour-step-body').textContent).to.include('子组件方式的第一步');
|
|
82
|
+
nextBtn = tourContent.querySelector('.k-tour-step-buttons .k-primary');
|
|
83
|
+
nextBtn.click();
|
|
84
|
+
_context5.next = 14;
|
|
85
|
+
return wait(50);
|
|
86
|
+
case 14:
|
|
87
|
+
updatedContent = getElement('.k-tour-step');
|
|
88
|
+
expect(updatedContent.querySelector('.k-tour-step-title').textContent).to.eql('第二步');
|
|
89
|
+
expect(updatedContent.querySelector('.k-tour-step-body').textContent).to.include('子组件方式的第二步');
|
|
90
|
+
case 17:
|
|
91
|
+
case "end":
|
|
92
|
+
return _context5.stop();
|
|
93
|
+
}
|
|
94
|
+
}, _callee2);
|
|
95
|
+
})));
|
|
96
|
+
it('should handle closable property correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
97
|
+
var _context6;
|
|
98
|
+
var _mount3, instance, element, buttons, startBtn, tourContent, closeIcon;
|
|
99
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context7) {
|
|
100
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
101
|
+
case 0:
|
|
102
|
+
_mount3 = mount(ClosableDemo), instance = _mount3[0], element = _mount3[1];
|
|
103
|
+
buttons = element.querySelectorAll('.k-btn');
|
|
104
|
+
startBtn = _findInstanceProperty(_context6 = _Array$from(buttons)).call(_context6, function (btn) {
|
|
105
|
+
var _btn$textContent3;
|
|
106
|
+
return (_btn$textContent3 = btn.textContent) == null ? void 0 : _includesInstanceProperty(_btn$textContent3).call(_btn$textContent3, '启动引导');
|
|
107
|
+
});
|
|
108
|
+
startBtn.click();
|
|
109
|
+
_context7.next = 6;
|
|
110
|
+
return wait(50);
|
|
111
|
+
case 6:
|
|
112
|
+
instance.set('closable', true);
|
|
113
|
+
_context7.next = 9;
|
|
114
|
+
return wait(50);
|
|
115
|
+
case 9:
|
|
116
|
+
tourContent = getElement('.k-tour-step');
|
|
117
|
+
expect(tourContent).to.exist;
|
|
118
|
+
closeIcon = tourContent.querySelector('.k-tour-step-close');
|
|
119
|
+
expect(closeIcon).to.be.null;
|
|
120
|
+
case 13:
|
|
121
|
+
case "end":
|
|
122
|
+
return _context7.stop();
|
|
123
|
+
}
|
|
124
|
+
}, _callee3);
|
|
125
|
+
})));
|
|
126
|
+
it('should handle beforeChange correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
127
|
+
var _context8;
|
|
128
|
+
var _mount4, instance, element, buttons, startBtn, tourContent, nextBtn, input;
|
|
129
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context9) {
|
|
130
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
131
|
+
case 0:
|
|
132
|
+
_mount4 = mount(BeforeChangeDemo), instance = _mount4[0], element = _mount4[1];
|
|
133
|
+
buttons = element.querySelectorAll('.k-btn');
|
|
134
|
+
startBtn = _findInstanceProperty(_context8 = _Array$from(buttons)).call(_context8, function (btn) {
|
|
135
|
+
var _btn$textContent4;
|
|
136
|
+
return (_btn$textContent4 = btn.textContent) == null ? void 0 : _includesInstanceProperty(_btn$textContent4).call(_btn$textContent4, '启动引导');
|
|
137
|
+
});
|
|
138
|
+
startBtn.click();
|
|
139
|
+
_context9.next = 6;
|
|
140
|
+
return wait();
|
|
141
|
+
case 6:
|
|
142
|
+
expect(instance.get('currentStep')).to.eql(0);
|
|
143
|
+
tourContent = getElement('.k-tour-step');
|
|
144
|
+
nextBtn = tourContent.querySelector('.k-tour-step-buttons .k-primary');
|
|
145
|
+
nextBtn.click();
|
|
146
|
+
_context9.next = 12;
|
|
147
|
+
return wait();
|
|
148
|
+
case 12:
|
|
149
|
+
expect(instance.get('currentStep')).to.eql(1);
|
|
150
|
+
tourContent = getElement('.k-tour-step');
|
|
151
|
+
nextBtn = tourContent.querySelector('.k-tour-step-buttons .k-primary');
|
|
152
|
+
nextBtn.click();
|
|
153
|
+
_context9.next = 18;
|
|
154
|
+
return wait();
|
|
155
|
+
case 18:
|
|
156
|
+
expect(instance.get('currentStep')).to.eql(2);
|
|
157
|
+
tourContent = getElement('.k-tour-step');
|
|
158
|
+
nextBtn = tourContent.querySelector('.k-tour-step-buttons .k-primary');
|
|
159
|
+
nextBtn.click();
|
|
160
|
+
_context9.next = 24;
|
|
161
|
+
return wait();
|
|
162
|
+
case 24:
|
|
163
|
+
input = element.querySelector('.step3-input .k-input-inner');
|
|
164
|
+
input.value = 'next';
|
|
165
|
+
dispatchEvent(input, 'input');
|
|
166
|
+
_context9.next = 29;
|
|
167
|
+
return wait();
|
|
168
|
+
case 29:
|
|
169
|
+
tourContent = getElement('.k-tour-step');
|
|
170
|
+
nextBtn = tourContent.querySelector('.k-tour-step-buttons .k-primary');
|
|
171
|
+
nextBtn.click();
|
|
172
|
+
_context9.next = 34;
|
|
173
|
+
return wait();
|
|
174
|
+
case 34:
|
|
175
|
+
console.log('currentStep', instance.get('currentStep'));
|
|
176
|
+
expect(instance.get('currentStep')).to.eql(3);
|
|
177
|
+
case 36:
|
|
178
|
+
case "end":
|
|
179
|
+
return _context9.stop();
|
|
180
|
+
}
|
|
181
|
+
}, _callee4);
|
|
182
|
+
})));
|
|
183
|
+
it('should trigger events correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
184
|
+
var _context10;
|
|
185
|
+
var _mount5, instance, element, prevSpy, nextSpy, finishSpy, buttons, startBtn, tourContent, nextBtn, prevBtn, doneBtn;
|
|
186
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context11) {
|
|
187
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
188
|
+
case 0:
|
|
189
|
+
_mount5 = mount(EventsDemo), instance = _mount5[0], element = _mount5[1];
|
|
190
|
+
prevSpy = sinon.spy(instance, 'handlePrev');
|
|
191
|
+
nextSpy = sinon.spy(instance, 'handleNext');
|
|
192
|
+
finishSpy = sinon.spy(instance, 'handleFinish');
|
|
193
|
+
buttons = element.querySelectorAll('.k-btn');
|
|
194
|
+
startBtn = _findInstanceProperty(_context10 = _Array$from(buttons)).call(_context10, function (btn) {
|
|
195
|
+
var _btn$textContent5;
|
|
196
|
+
return (_btn$textContent5 = btn.textContent) == null ? void 0 : _includesInstanceProperty(_btn$textContent5).call(_btn$textContent5, '开始引导');
|
|
197
|
+
});
|
|
198
|
+
startBtn.click();
|
|
199
|
+
_context11.next = 9;
|
|
200
|
+
return wait();
|
|
201
|
+
case 9:
|
|
202
|
+
tourContent = getElement('.k-tour-step');
|
|
203
|
+
nextBtn = tourContent.querySelector('.k-tour-step-buttons .k-primary');
|
|
204
|
+
nextBtn.click();
|
|
205
|
+
_context11.next = 14;
|
|
206
|
+
return wait();
|
|
207
|
+
case 14:
|
|
208
|
+
expect(nextSpy.callCount).to.eql(1);
|
|
209
|
+
prevBtn = getElement('.k-tour-step').querySelector('.k-tour-step-buttons .k-btn:not(.k-primary)');
|
|
210
|
+
prevBtn.click();
|
|
211
|
+
_context11.next = 19;
|
|
212
|
+
return wait();
|
|
213
|
+
case 19:
|
|
214
|
+
expect(prevSpy.callCount).to.eql(1);
|
|
215
|
+
nextBtn.click();
|
|
216
|
+
_context11.next = 23;
|
|
217
|
+
return wait();
|
|
218
|
+
case 23:
|
|
219
|
+
nextBtn.click();
|
|
220
|
+
_context11.next = 26;
|
|
221
|
+
return wait();
|
|
222
|
+
case 26:
|
|
223
|
+
doneBtn = getElement('.k-tour-step').querySelector('.k-tour-step-buttons .k-primary');
|
|
224
|
+
doneBtn.click();
|
|
225
|
+
_context11.next = 30;
|
|
226
|
+
return wait();
|
|
227
|
+
case 30:
|
|
228
|
+
console.log('finishSpy.callCount', finishSpy.callCount);
|
|
229
|
+
expect(finishSpy.callCount).to.eql(0);
|
|
230
|
+
case 32:
|
|
231
|
+
case "end":
|
|
232
|
+
return _context11.stop();
|
|
233
|
+
}
|
|
234
|
+
}, _callee5);
|
|
235
|
+
})));
|
|
236
|
+
it('should handle maskClosable correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
237
|
+
var _context12;
|
|
238
|
+
var _mount6, instance, element, buttons, startBtn, highlight;
|
|
239
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context13) {
|
|
240
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
241
|
+
case 0:
|
|
242
|
+
_mount6 = mount(MaskClosableDemo), instance = _mount6[0], element = _mount6[1];
|
|
243
|
+
buttons = element.querySelectorAll('.k-btn');
|
|
244
|
+
startBtn = _findInstanceProperty(_context12 = _Array$from(buttons)).call(_context12, function (btn) {
|
|
245
|
+
var _btn$textContent6;
|
|
246
|
+
return (_btn$textContent6 = btn.textContent) == null ? void 0 : _includesInstanceProperty(_btn$textContent6).call(_btn$textContent6, '启动引导');
|
|
247
|
+
});
|
|
248
|
+
startBtn.click();
|
|
249
|
+
_context13.next = 6;
|
|
250
|
+
return wait(50);
|
|
251
|
+
case 6:
|
|
252
|
+
highlight = getElement('.k-tour-target-highlight');
|
|
253
|
+
expect(highlight).to.exist;
|
|
254
|
+
dispatchEvent(document, 'click');
|
|
255
|
+
_context13.next = 11;
|
|
256
|
+
return wait(50);
|
|
257
|
+
case 11:
|
|
258
|
+
expect(getElement('.k-tour-step')).to.be.undefined;
|
|
259
|
+
startBtn.click();
|
|
260
|
+
_context13.next = 15;
|
|
261
|
+
return wait(50);
|
|
262
|
+
case 15:
|
|
263
|
+
instance.set('maskClosable', false);
|
|
264
|
+
_context13.next = 18;
|
|
265
|
+
return wait(50);
|
|
266
|
+
case 18:
|
|
267
|
+
dispatchEvent(document, 'click');
|
|
268
|
+
_context13.next = 21;
|
|
269
|
+
return wait(50);
|
|
270
|
+
case 21:
|
|
271
|
+
expect(getElement('.k-tour-step')).to.exist;
|
|
272
|
+
case 22:
|
|
273
|
+
case "end":
|
|
274
|
+
return _context13.stop();
|
|
275
|
+
}
|
|
276
|
+
}, _callee6);
|
|
277
|
+
})));
|
|
278
|
+
it('should handle custom text correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
279
|
+
var _context14;
|
|
280
|
+
var _mount7, instance, element, buttons, startBtn;
|
|
281
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context15) {
|
|
282
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
283
|
+
case 0:
|
|
284
|
+
_mount7 = mount(CustomTextDemo), instance = _mount7[0], element = _mount7[1];
|
|
285
|
+
buttons = element.querySelectorAll('.k-btn');
|
|
286
|
+
startBtn = _findInstanceProperty(_context14 = _Array$from(buttons)).call(_context14, function (btn) {
|
|
287
|
+
var _btn$textContent7;
|
|
288
|
+
return (_btn$textContent7 = btn.textContent) == null ? void 0 : _includesInstanceProperty(_btn$textContent7).call(_btn$textContent7, '启动引导');
|
|
289
|
+
});
|
|
290
|
+
startBtn.click();
|
|
291
|
+
_context15.next = 6;
|
|
292
|
+
return wait(50);
|
|
293
|
+
case 6:
|
|
294
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
295
|
+
case 7:
|
|
296
|
+
case "end":
|
|
297
|
+
return _context15.stop();
|
|
298
|
+
}
|
|
299
|
+
}, _callee7);
|
|
300
|
+
})));
|
|
301
|
+
it('should handle target correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
302
|
+
var _mount8, instance, element, btn;
|
|
303
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context16) {
|
|
304
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
305
|
+
case 0:
|
|
306
|
+
_mount8 = mount(NotargetDemo), instance = _mount8[0], element = _mount8[1];
|
|
307
|
+
btn = element.querySelector('.k-btn');
|
|
308
|
+
btn.click();
|
|
309
|
+
_context16.next = 5;
|
|
310
|
+
return wait(50);
|
|
311
|
+
case 5:
|
|
312
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
313
|
+
case 6:
|
|
314
|
+
case "end":
|
|
315
|
+
return _context16.stop();
|
|
316
|
+
}
|
|
317
|
+
}, _callee8);
|
|
318
|
+
})));
|
|
319
|
+
// it('should handle theme correctly', async () => {
|
|
320
|
+
// interface DemoProps {
|
|
321
|
+
// theme: string;
|
|
322
|
+
// tourData: any[];
|
|
323
|
+
// }
|
|
324
|
+
// class Demo extends Component<DemoProps> {
|
|
325
|
+
// static template = `
|
|
326
|
+
// const { Tour } = this;
|
|
327
|
+
// <div>
|
|
328
|
+
// <Tour
|
|
329
|
+
// data={this.get('tourData')}
|
|
330
|
+
// visible={true}
|
|
331
|
+
// theme={this.get('theme')}
|
|
332
|
+
// />
|
|
333
|
+
// </div>
|
|
334
|
+
// `;
|
|
335
|
+
// Tour = Tour;
|
|
336
|
+
// static defaults() {
|
|
337
|
+
// return {
|
|
338
|
+
// theme: 'dark',
|
|
339
|
+
// tourData: [
|
|
340
|
+
// {
|
|
341
|
+
// target: 'body',
|
|
342
|
+
// title: '主题测试',
|
|
343
|
+
// content: '测试深色主题'
|
|
344
|
+
// }
|
|
345
|
+
// ]
|
|
346
|
+
// } as DemoProps;
|
|
347
|
+
// }
|
|
348
|
+
// }
|
|
349
|
+
// const [instance, element] = mount(Demo);
|
|
350
|
+
// await wait(50);
|
|
351
|
+
// expect(element.innerHTML).to.matchSnapshot();
|
|
352
|
+
// instance.set('theme', 'light');
|
|
353
|
+
// await wait(50);
|
|
354
|
+
// expect(element.innerHTML).to.matchSnapshot();
|
|
355
|
+
// });
|
|
356
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Component, TypeDefs, VNode, Children } from 'intact';
|
|
2
|
+
export interface TourStepProps {
|
|
3
|
+
title?: string | VNode;
|
|
4
|
+
content?: Children;
|
|
5
|
+
target?: string | HTMLElement;
|
|
6
|
+
position?: string | any;
|
|
7
|
+
nextText?: string;
|
|
8
|
+
prevText?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface TourStepEvents {
|
|
11
|
+
}
|
|
12
|
+
export interface TourStepBlocks {
|
|
13
|
+
header: null;
|
|
14
|
+
content: null;
|
|
15
|
+
footer: null;
|
|
16
|
+
}
|
|
17
|
+
export declare class TourStep extends Component<TourStepProps, TourStepEvents, TourStepBlocks> {
|
|
18
|
+
static template: string | import("intact").Template<any>;
|
|
19
|
+
static typeDefs: Required<TypeDefs<TourStepProps>>;
|
|
20
|
+
static defaults: () => Partial<TourStepProps>;
|
|
21
|
+
private config;
|
|
22
|
+
getTarget(): HTMLElement | null;
|
|
23
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
+
import { Component, VNode } from 'intact';
|
|
4
|
+
import template from './step.vdt';
|
|
5
|
+
import { useConfigContext } from '../config';
|
|
6
|
+
var typeDefs = {
|
|
7
|
+
title: [String, VNode],
|
|
8
|
+
content: [String, VNode, Array],
|
|
9
|
+
target: [String, Object],
|
|
10
|
+
position: [String, Object],
|
|
11
|
+
nextText: String,
|
|
12
|
+
prevText: String
|
|
13
|
+
};
|
|
14
|
+
var defaults = function defaults() {
|
|
15
|
+
return {
|
|
16
|
+
position: 'bottom',
|
|
17
|
+
nextText: '下一步',
|
|
18
|
+
prevText: '上一步'
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export var TourStep = /*#__PURE__*/function (_Component) {
|
|
22
|
+
_inheritsLoose(TourStep, _Component);
|
|
23
|
+
function TourStep() {
|
|
24
|
+
var _context;
|
|
25
|
+
var _this;
|
|
26
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
27
|
+
args[_key] = arguments[_key];
|
|
28
|
+
}
|
|
29
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
30
|
+
_this.config = useConfigContext();
|
|
31
|
+
return _this;
|
|
32
|
+
}
|
|
33
|
+
var _proto = TourStep.prototype;
|
|
34
|
+
_proto.getTarget = function getTarget() {
|
|
35
|
+
var target = this.get('target');
|
|
36
|
+
if (!target) return null;
|
|
37
|
+
if (typeof target === 'string') {
|
|
38
|
+
return document.querySelector(target);
|
|
39
|
+
}
|
|
40
|
+
return target;
|
|
41
|
+
};
|
|
42
|
+
return TourStep;
|
|
43
|
+
}(Component);
|
|
44
|
+
TourStep.template = template;
|
|
45
|
+
TourStep.typeDefs = typeDefs;
|
|
46
|
+
TourStep.defaults = defaults;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
|
+
import { createUnknownComponentVNode as _$cc, createVNode as _$cv, className as _$cn, createElementVNode as _$ce, noop as _$no, createTextVNode as _$ct } from 'intact';
|
|
3
|
+
import { Button } from '../button';
|
|
4
|
+
import { Icon } from '../icon';
|
|
5
|
+
import { makeStyles } from './styles';
|
|
6
|
+
import { TourContext } from './tour';
|
|
7
|
+
import { getRestProps } from '../utils';
|
|
8
|
+
export default function ($props, $blocks, $__proto__) {
|
|
9
|
+
var _classNameObj,
|
|
10
|
+
_this = this;
|
|
11
|
+
$blocks || ($blocks = {});
|
|
12
|
+
$props || ($props = {});
|
|
13
|
+
var $this = this;
|
|
14
|
+
var _$blocks = {};
|
|
15
|
+
var __$blocks = {};
|
|
16
|
+
var _this$get = this.get(),
|
|
17
|
+
title = _this$get.title,
|
|
18
|
+
content = _this$get.content,
|
|
19
|
+
className = _this$get.className,
|
|
20
|
+
_children = _this$get.children,
|
|
21
|
+
nextText = _this$get.nextText,
|
|
22
|
+
prevText = _this$get.prevText;
|
|
23
|
+
var k = this.config.k;
|
|
24
|
+
var classNameObj = (_classNameObj = {}, _classNameObj[k + "-tour-step"] = true, _classNameObj[className] = className, _classNameObj);
|
|
25
|
+
return _$cc(TourContext.Consumer, {
|
|
26
|
+
'children': function children(_ref) {
|
|
27
|
+
var value = _ref.value,
|
|
28
|
+
total = _ref.total,
|
|
29
|
+
doneText = _ref.doneText,
|
|
30
|
+
onPrev = _ref.onPrev,
|
|
31
|
+
onNext = _ref.onNext,
|
|
32
|
+
onFinish = _ref.onFinish,
|
|
33
|
+
closable = _ref.closable;
|
|
34
|
+
var isFirst = value === 0;
|
|
35
|
+
var isLast = value === total - 1;
|
|
36
|
+
var showHeader = !!title;
|
|
37
|
+
var displayIndex = value + 1;
|
|
38
|
+
return _$cv('div', _extends({
|
|
39
|
+
'className': _$cn(classNameObj)
|
|
40
|
+
}, getRestProps(_this)), [null, !!title || $blocks.header ? _$ce(2, 'div', [_$ce(2, 'div', (_$blocks['header'] = function ($super) {
|
|
41
|
+
return title;
|
|
42
|
+
}, __$blocks['header'] = function ($super, data) {
|
|
43
|
+
var block = $blocks['header'];
|
|
44
|
+
var callBlock = function callBlock() {
|
|
45
|
+
return _$blocks['header'].call($this, $super, data);
|
|
46
|
+
};
|
|
47
|
+
return block ? block.call($this, callBlock, data) : callBlock();
|
|
48
|
+
}, __$blocks['header'](_$no)), 0, _$cn(k + "-tour-step-title")), !closable ? _$ce(2, 'div', _$cc(Icon, {
|
|
49
|
+
'className': _$cn(k + "-icon-close")
|
|
50
|
+
}), 2, _$cn(k + "-tour-step-close"), {
|
|
51
|
+
'ev-click': onFinish
|
|
52
|
+
}) : undefined], 0, _$cn(k + "-tour-step-header")) : undefined, null, _$ce(2, 'div', _children || content, 0, _$cn(k + "-tour-step-body")), null, _$ce(2, 'div', (_$blocks['footer'] = function ($super) {
|
|
53
|
+
return [_$ce(2, 'div', [displayIndex, _$ct(' / '), total], 0, _$cn(k + "-tour-step-indicator")), _$ce(2, 'div', [!isFirst ? _$cc(Button, {
|
|
54
|
+
'size': 'small',
|
|
55
|
+
'type': 'secondary',
|
|
56
|
+
'ev-click': onPrev,
|
|
57
|
+
'children': prevText
|
|
58
|
+
}) : undefined, _$cc(Button, {
|
|
59
|
+
'size': 'small',
|
|
60
|
+
'type': 'primary',
|
|
61
|
+
'ev-click': isLast ? onFinish : onNext,
|
|
62
|
+
'children': isLast ? doneText : nextText
|
|
63
|
+
})], 0, _$cn(k + "-tour-step-buttons"))];
|
|
64
|
+
}, __$blocks['footer'] = function ($super, data) {
|
|
65
|
+
var block = $blocks['footer'];
|
|
66
|
+
var callBlock = function callBlock() {
|
|
67
|
+
return _$blocks['footer'].call($this, $super, data);
|
|
68
|
+
};
|
|
69
|
+
return block ? block.call($this, callBlock, data) : callBlock();
|
|
70
|
+
}, __$blocks['footer'](_$no)), 0, _$cn(k + "-tour-step-footer"))]);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
2
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js/object/keys";
|
|
3
|
+
import { css } from '@emotion/css';
|
|
4
|
+
import { theme, setDefault } from '../../styles/theme';
|
|
5
|
+
import { deepDefaults } from '../../styles/utils';
|
|
6
|
+
import { cache } from '../utils';
|
|
7
|
+
var defaults = {
|
|
8
|
+
minWidth: '280px',
|
|
9
|
+
maxWidth: '400px',
|
|
10
|
+
gap: '8px',
|
|
11
|
+
get color() {
|
|
12
|
+
return theme.color.text;
|
|
13
|
+
},
|
|
14
|
+
bgColor: '#fff',
|
|
15
|
+
padding: {
|
|
16
|
+
body: '16px',
|
|
17
|
+
header: '12px 16px',
|
|
18
|
+
footer: '12px 16px'
|
|
19
|
+
},
|
|
20
|
+
fontSize: {
|
|
21
|
+
title: '16px',
|
|
22
|
+
content: '12px'
|
|
23
|
+
},
|
|
24
|
+
border: '1px solid var(--kui-color-border)',
|
|
25
|
+
arrow: {
|
|
26
|
+
size: '8px',
|
|
27
|
+
offset: '10px',
|
|
28
|
+
borderColor: 'rgba(221, 221, 221, .5)'
|
|
29
|
+
},
|
|
30
|
+
mask: {
|
|
31
|
+
color: 'rgba(0, 0, 0, 0.5)',
|
|
32
|
+
targetPadding: '8px',
|
|
33
|
+
targetBorderRadius: '4px'
|
|
34
|
+
},
|
|
35
|
+
// dark
|
|
36
|
+
dark: {
|
|
37
|
+
get bgColor() {
|
|
38
|
+
return theme.color.title;
|
|
39
|
+
},
|
|
40
|
+
color: '#fff',
|
|
41
|
+
get arrowBorderColor() {
|
|
42
|
+
return theme.color.title;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
var tour;
|
|
47
|
+
setDefault(function () {
|
|
48
|
+
tour = deepDefaults(theme, {
|
|
49
|
+
tour: defaults
|
|
50
|
+
}).tour;
|
|
51
|
+
makeStyles == null || makeStyles.clearCache();
|
|
52
|
+
});
|
|
53
|
+
export var themes = ['dark', 'light'];
|
|
54
|
+
var directionMap = {
|
|
55
|
+
top: 'bottom',
|
|
56
|
+
bottom: 'top',
|
|
57
|
+
left: 'right',
|
|
58
|
+
right: 'left'
|
|
59
|
+
};
|
|
60
|
+
export var makeStyles = cache(function makeStyles(k) {
|
|
61
|
+
var arrowLong = tour.arrow.size;
|
|
62
|
+
var arrowShort = "calc(" + arrowLong + " - 1px)";
|
|
63
|
+
return /*#__PURE__*/css(".", k, "-tour{position:fixed;top:0;left:0;width:100%;height:100%;z-index:1000;pointer-events:none;}.", k, "-tour-target-highlight{position:fixed;box-shadow:0 0 0 9999px ", tour.mask.color, ";border-radius:", tour.mask.targetBorderRadius, ";z-index:999;pointer-events:none;transition:all 0.3s ease;&.", k, "-hoverable{pointer-events:auto;cursor:pointer;&:hover{box-shadow:0 0 0 9999px rgba(0, 0, 0, 0.65);&:after{content:'';position:absolute;top:-4px;left:-4px;right:-4px;bottom:-4px;border:2px solid rgba(255, 255, 255, 0.5);border-radius:", tour.mask.targetBorderRadius, ";animation:pulse 1.5s infinite;}}}}@keyframes pulse{0%{transform:scale(1);opacity:0.8;}50%{transform:scale(1.05);opacity:0.5;}100%{transform:scale(1);opacity:0.8;}}.", k, "-tour-step-wrapper{position:absolute;z-index:1000;filter:drop-shadow(0 2px 8px rgba(0, 0, 0, 0.15));pointer-events:auto;&.", k, "-tour-centered{position:fixed!important;top:50%!important;left:50%!important;transform:translate(-50%, -50%)!important;}}.", k, "-tour-step{background:#fff;border-radius:4px;padding:0;min-width:240px;max-width:400px;position:relative;}.", k, "-tour-step-container{display:flex;flex-direction:column;}.", k, "-tour-step-header{display:flex;justify-content:space-between;align-items:center;padding:16px 16px 8px;border-bottom:1px solid #f0f0f0;}.", k, "-tour-step-title{font-weight:500;font-size:16px;color:#262626;}.", k, "-tour-step-close{cursor:pointer;color:#999;&:hover{color:#666;}}.", k, "-tour-step-body{font-size:", tour.fontSize.content, ";padding:16px;color:#595959;}.", k, "-tour-step-footer{display:flex;justify-content:space-between;align-items:center;padding:8px 16px 16px;}.", k, "-tour-step-indicator{color:#8c8c8c;}.", k, "-tour-step-buttons{display:flex;gap:8px;}.", k, "-tour-arrow{pointer-events:none;&:before,&{position:absolute;display:block;border-style:solid;border-color:transparent;}&:before{content:' ';}&.", k, "-top,&.", k, "-bottom{&:before,&{border-width:", arrowLong, " ", arrowShort, ";}&:before{left:calc(-1 * ", arrowShort, ");}}&.", k, "-top{top:calc(-2 * ", arrowLong, ");&:before{top:calc(-", arrowLong, " + 1px);}}&.", k, "-bottom{bottom:calc(-2 * ", arrowLong, ");&:before{bottom:calc(-", arrowLong, " + 1px);}}&.", k, "-left,&.", k, "-right{&:before,&{border-width:", arrowShort, " ", arrowLong, ";}&:before{top:calc(-1 * ", arrowShort, ");}}&.", k, "-left{left:calc(-2 * ", arrowLong, ");&:before{left:calc(-", arrowLong, " + 1px);}}&.", k, "-right{right:calc(-2 * ", arrowLong, ");&:before{right:calc(-", arrowLong, " + 1px);}}}", _mapInstanceProperty(themes).call(themes, function (theme) {
|
|
64
|
+
var _context;
|
|
65
|
+
var borderColor;
|
|
66
|
+
var bgColor;
|
|
67
|
+
var color;
|
|
68
|
+
if (theme === 'dark') {
|
|
69
|
+
borderColor = tour.dark.arrowBorderColor;
|
|
70
|
+
bgColor = tour.dark.bgColor;
|
|
71
|
+
color = tour.dark.color;
|
|
72
|
+
} else {
|
|
73
|
+
borderColor = tour.arrow.borderColor;
|
|
74
|
+
bgColor = tour.bgColor;
|
|
75
|
+
color = tour.color;
|
|
76
|
+
}
|
|
77
|
+
return /*#__PURE__*/css("&.", k, "-", theme, "{background:", bgColor, ";color:", color, ";.", k, "-tour-step-wrapper .", k, "-tour-arrow{", _mapInstanceProperty(_context = _Object$keys(directionMap)).call(_context, function (direction) {
|
|
78
|
+
var borderDirection = directionMap[direction];
|
|
79
|
+
return /*#__PURE__*/css("&.", k, "-", direction, "{&:before{border-", borderDirection, "-color:", bgColor, ";}}");
|
|
80
|
+
}), ";}}");
|
|
81
|
+
}), ";");
|
|
82
|
+
});
|
|
83
|
+
// 让样式能被导入
|
|
84
|
+
export default makeStyles;
|