@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,82 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
+
import { __decorate } from "tslib";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { Tour, Button } from '@king-design/react';
|
|
6
|
+
import { bind } from '@king-design/react';
|
|
7
|
+
var Demo = /*#__PURE__*/function (_React$Component) {
|
|
8
|
+
_inheritsLoose(Demo, _React$Component);
|
|
9
|
+
function Demo() {
|
|
10
|
+
var _context;
|
|
11
|
+
var _this;
|
|
12
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
13
|
+
args[_key] = arguments[_key];
|
|
14
|
+
}
|
|
15
|
+
_this = _React$Component.call.apply(_React$Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
16
|
+
_this.state = {
|
|
17
|
+
currentStep: 0,
|
|
18
|
+
showTour: false,
|
|
19
|
+
tourData: [{
|
|
20
|
+
target: '#btn1',
|
|
21
|
+
title: '第一步',
|
|
22
|
+
content: '这是第一步的引导说明',
|
|
23
|
+
position: 'bottom'
|
|
24
|
+
}, {
|
|
25
|
+
target: '#btn2',
|
|
26
|
+
title: '第二步',
|
|
27
|
+
content: '这是第二步的引导说明',
|
|
28
|
+
position: 'right'
|
|
29
|
+
}]
|
|
30
|
+
};
|
|
31
|
+
return _this;
|
|
32
|
+
}
|
|
33
|
+
var _proto = Demo.prototype;
|
|
34
|
+
_proto.settour = function settour() {
|
|
35
|
+
this.setState({
|
|
36
|
+
showTour: true,
|
|
37
|
+
currentStep: 0
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
_proto.close = function close() {
|
|
41
|
+
this.setState({
|
|
42
|
+
showTour: false
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
_proto.render = function render() {
|
|
46
|
+
var _this2 = this;
|
|
47
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
className: "example-container"
|
|
49
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
50
|
+
id: "btn1"
|
|
51
|
+
}, "\u793A\u4F8B\u5143\u7D201"), /*#__PURE__*/React.createElement(Button, {
|
|
52
|
+
id: "btn2",
|
|
53
|
+
style: {
|
|
54
|
+
"marginLeft": "20px"
|
|
55
|
+
}
|
|
56
|
+
}, "\u793A\u4F8B\u5143\u7D202")), /*#__PURE__*/React.createElement(Tour, {
|
|
57
|
+
value: this.state.currentStep,
|
|
58
|
+
onChangeValue: function onChangeValue(currentStep) {
|
|
59
|
+
return _this2.setState({
|
|
60
|
+
currentStep: currentStep
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
visible: this.state.showTour,
|
|
64
|
+
data: this.state.tourData,
|
|
65
|
+
onFinish: this.close
|
|
66
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
style: {
|
|
68
|
+
"marginTop": "20px"
|
|
69
|
+
}
|
|
70
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
71
|
+
onClick: this.settour
|
|
72
|
+
}, "\u542F\u52A8\u5F15\u5BFC"), /*#__PURE__*/React.createElement("span", {
|
|
73
|
+
style: {
|
|
74
|
+
"marginLeft": "10px"
|
|
75
|
+
}
|
|
76
|
+
}, "\u5F53\u524D\u6B65\u9AA4: ", this.state.currentStep >= 0 ? this.state.currentStep + 1 : '未启动')));
|
|
77
|
+
};
|
|
78
|
+
return Demo;
|
|
79
|
+
}(React.Component);
|
|
80
|
+
export { Demo as default };
|
|
81
|
+
__decorate([bind], Demo.prototype, "settour", null);
|
|
82
|
+
__decorate([bind], Demo.prototype, "close", null);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { default as data } from './index.json';
|
|
2
|
+
import { Component } from 'intact';
|
|
3
|
+
export default class extends Component {
|
|
4
|
+
static template: string | import("intact").Template<any>;
|
|
5
|
+
static defaults(): {
|
|
6
|
+
currentStep: number;
|
|
7
|
+
showTour: boolean;
|
|
8
|
+
inputValue: string;
|
|
9
|
+
errorMsg: string;
|
|
10
|
+
tourData: {
|
|
11
|
+
target: string;
|
|
12
|
+
title: string;
|
|
13
|
+
content: string;
|
|
14
|
+
position: string;
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
17
|
+
startTour(): void;
|
|
18
|
+
finishTour(): void;
|
|
19
|
+
handleBeforeChange(current: number): boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import { __decorate } from "tslib";
|
|
3
|
+
export { default as data } from './index.json';
|
|
4
|
+
import { Component } from 'intact';
|
|
5
|
+
import template from './index.vdt';
|
|
6
|
+
import { bind, Message } from 'kpc';
|
|
7
|
+
var default_1 = /*#__PURE__*/function (_Component) {
|
|
8
|
+
_inheritsLoose(default_1, _Component);
|
|
9
|
+
function default_1() {
|
|
10
|
+
return _Component.apply(this, arguments) || this;
|
|
11
|
+
}
|
|
12
|
+
default_1.defaults = function defaults() {
|
|
13
|
+
return {
|
|
14
|
+
currentStep: 0,
|
|
15
|
+
showTour: false,
|
|
16
|
+
inputValue: '',
|
|
17
|
+
errorMsg: '',
|
|
18
|
+
tourData: [{
|
|
19
|
+
target: '#step1',
|
|
20
|
+
title: '第一步',
|
|
21
|
+
content: '这是第一步的引导说明',
|
|
22
|
+
position: 'bottom'
|
|
23
|
+
}, {
|
|
24
|
+
target: '#step2',
|
|
25
|
+
title: '第二步',
|
|
26
|
+
content: '这是第二步的引导说明',
|
|
27
|
+
position: 'right'
|
|
28
|
+
}, {
|
|
29
|
+
target: '.step3-input',
|
|
30
|
+
title: '第三步',
|
|
31
|
+
content: '请在输入框中输入"next"以继续',
|
|
32
|
+
position: 'bottom'
|
|
33
|
+
}, {
|
|
34
|
+
target: '#step4',
|
|
35
|
+
title: '最后一步',
|
|
36
|
+
content: '恭喜您完成了所有步骤',
|
|
37
|
+
position: 'top'
|
|
38
|
+
}]
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
var _proto = default_1.prototype;
|
|
42
|
+
_proto.startTour = function startTour() {
|
|
43
|
+
this.set({
|
|
44
|
+
showTour: true,
|
|
45
|
+
currentStep: 0
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
_proto.finishTour = function finishTour() {
|
|
49
|
+
this.set({
|
|
50
|
+
showTour: false
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
_proto.handleBeforeChange = function handleBeforeChange(current) {
|
|
54
|
+
var inputValue = this.get('inputValue');
|
|
55
|
+
if (current === 3) {
|
|
56
|
+
if (inputValue !== 'next') {
|
|
57
|
+
Message.error('请在输入框中输入"next"才能进入下一步');
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return true;
|
|
62
|
+
};
|
|
63
|
+
return default_1;
|
|
64
|
+
}(Component);
|
|
65
|
+
default_1.template = template;
|
|
66
|
+
export { default_1 as default };
|
|
67
|
+
__decorate([bind], default_1.prototype, "startTour", null);
|
|
68
|
+
__decorate([bind], default_1.prototype, "finishTour", null);
|
|
69
|
+
__decorate([bind], default_1.prototype, "handleBeforeChange", null);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export default class Demo extends React.Component {
|
|
3
|
+
state: {
|
|
4
|
+
currentStep: number;
|
|
5
|
+
showTour: boolean;
|
|
6
|
+
inputValue: string;
|
|
7
|
+
errorMsg: string;
|
|
8
|
+
tourData: {
|
|
9
|
+
target: string;
|
|
10
|
+
title: string;
|
|
11
|
+
content: string;
|
|
12
|
+
position: string;
|
|
13
|
+
}[];
|
|
14
|
+
};
|
|
15
|
+
startTour(): void;
|
|
16
|
+
finishTour(): void;
|
|
17
|
+
handleBeforeChange(current: number): boolean;
|
|
18
|
+
render(): React.JSX.Element;
|
|
19
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
+
import { __decorate } from "tslib";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { Tour, Button, Input } from '@king-design/react';
|
|
6
|
+
import { bind, Message } from '@king-design/react';
|
|
7
|
+
var Demo = /*#__PURE__*/function (_React$Component) {
|
|
8
|
+
_inheritsLoose(Demo, _React$Component);
|
|
9
|
+
function Demo() {
|
|
10
|
+
var _context;
|
|
11
|
+
var _this;
|
|
12
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
13
|
+
args[_key] = arguments[_key];
|
|
14
|
+
}
|
|
15
|
+
_this = _React$Component.call.apply(_React$Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
16
|
+
_this.state = {
|
|
17
|
+
currentStep: 0,
|
|
18
|
+
showTour: false,
|
|
19
|
+
inputValue: '',
|
|
20
|
+
errorMsg: '',
|
|
21
|
+
tourData: [{
|
|
22
|
+
target: '#step1',
|
|
23
|
+
title: '第一步',
|
|
24
|
+
content: '这是第一步的引导说明',
|
|
25
|
+
position: 'bottom'
|
|
26
|
+
}, {
|
|
27
|
+
target: '#step2',
|
|
28
|
+
title: '第二步',
|
|
29
|
+
content: '这是第二步的引导说明',
|
|
30
|
+
position: 'right'
|
|
31
|
+
}, {
|
|
32
|
+
target: '.step3-input',
|
|
33
|
+
title: '第三步',
|
|
34
|
+
content: '请在输入框中输入"next"以继续',
|
|
35
|
+
position: 'bottom'
|
|
36
|
+
}, {
|
|
37
|
+
target: '#step4',
|
|
38
|
+
title: '最后一步',
|
|
39
|
+
content: '恭喜您完成了所有步骤',
|
|
40
|
+
position: 'top'
|
|
41
|
+
}]
|
|
42
|
+
};
|
|
43
|
+
return _this;
|
|
44
|
+
}
|
|
45
|
+
var _proto = Demo.prototype;
|
|
46
|
+
_proto.startTour = function startTour() {
|
|
47
|
+
this.setState({
|
|
48
|
+
showTour: true,
|
|
49
|
+
currentStep: 0
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
_proto.finishTour = function finishTour() {
|
|
53
|
+
this.setState({
|
|
54
|
+
showTour: false
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
_proto.handleBeforeChange = function handleBeforeChange(current) {
|
|
58
|
+
var inputValue = this.state.inputValue;
|
|
59
|
+
if (current === 3) {
|
|
60
|
+
if (inputValue !== 'next') {
|
|
61
|
+
Message.error('请在输入框中输入"next"才能进入下一步');
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return true;
|
|
66
|
+
};
|
|
67
|
+
_proto.render = function render() {
|
|
68
|
+
var _this2 = this;
|
|
69
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
70
|
+
className: "example-container"
|
|
71
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
72
|
+
id: "step1"
|
|
73
|
+
}, "\u6B65\u9AA41"), /*#__PURE__*/React.createElement(Button, {
|
|
74
|
+
id: "step2",
|
|
75
|
+
style: {
|
|
76
|
+
"marginLeft": "20px"
|
|
77
|
+
}
|
|
78
|
+
}, "\u6B65\u9AA42"), /*#__PURE__*/React.createElement("div", {
|
|
79
|
+
style: {
|
|
80
|
+
"marginTop": "20px"
|
|
81
|
+
}
|
|
82
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
83
|
+
className: "step3-input",
|
|
84
|
+
placeholder: "\u901A\u8FC7\u9A8C\u8BC1\u624D\u80FD\u8FDB\u5165\u4E0B\u4E00\u6B65",
|
|
85
|
+
value: this.state.inputValue,
|
|
86
|
+
onChangeValue: function onChangeValue(inputValue) {
|
|
87
|
+
return _this2.setState({
|
|
88
|
+
inputValue: inputValue
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
})), /*#__PURE__*/React.createElement(Button, {
|
|
92
|
+
id: "step4",
|
|
93
|
+
style: {
|
|
94
|
+
"marginTop": "20px"
|
|
95
|
+
}
|
|
96
|
+
}, "\u6B65\u9AA44")), /*#__PURE__*/React.createElement(Tour, {
|
|
97
|
+
value: this.state.currentStep,
|
|
98
|
+
onChangeValue: function onChangeValue(currentStep) {
|
|
99
|
+
return _this2.setState({
|
|
100
|
+
currentStep: currentStep
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
visible: this.state.showTour,
|
|
104
|
+
data: this.state.tourData,
|
|
105
|
+
beforeChange: this.handleBeforeChange,
|
|
106
|
+
onFinish: this.finishTour
|
|
107
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
108
|
+
style: {
|
|
109
|
+
"marginTop": "20px"
|
|
110
|
+
}
|
|
111
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
112
|
+
onClick: this.startTour
|
|
113
|
+
}, "\u542F\u52A8\u5F15\u5BFC"), /*#__PURE__*/React.createElement("span", {
|
|
114
|
+
style: {
|
|
115
|
+
"marginLeft": "10px"
|
|
116
|
+
}
|
|
117
|
+
}, "\u5F53\u524D\u6B65\u9AA4: ", this.state.currentStep >= 0 ? this.state.currentStep + 1 : '未启动'), this.state.errorMsg ? /*#__PURE__*/React.createElement("div", {
|
|
118
|
+
style: {
|
|
119
|
+
"marginTop": "10px",
|
|
120
|
+
"color": "#f56c6c"
|
|
121
|
+
}
|
|
122
|
+
}, this.state.errorMsg) : undefined));
|
|
123
|
+
};
|
|
124
|
+
return Demo;
|
|
125
|
+
}(React.Component);
|
|
126
|
+
export { Demo as default };
|
|
127
|
+
__decorate([bind], Demo.prototype, "startTour", null);
|
|
128
|
+
__decorate([bind], Demo.prototype, "finishTour", null);
|
|
129
|
+
__decorate([bind], Demo.prototype, "handleBeforeChange", null);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { default as data } from './index.json';
|
|
2
|
+
import { Component } from 'intact';
|
|
3
|
+
export default class extends Component {
|
|
4
|
+
static template: string | import("intact").Template<any>;
|
|
5
|
+
static defaults(): {
|
|
6
|
+
currentStep: number;
|
|
7
|
+
showTour: boolean;
|
|
8
|
+
closable: boolean;
|
|
9
|
+
tourData: {
|
|
10
|
+
target: string;
|
|
11
|
+
title: string;
|
|
12
|
+
content: string;
|
|
13
|
+
position: string;
|
|
14
|
+
}[];
|
|
15
|
+
};
|
|
16
|
+
startTour(): void;
|
|
17
|
+
finishTour(): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import { __decorate } from "tslib";
|
|
3
|
+
export { default as data } from './index.json';
|
|
4
|
+
import { Component } from 'intact';
|
|
5
|
+
import template from './index.vdt';
|
|
6
|
+
import { bind } from 'kpc';
|
|
7
|
+
var default_1 = /*#__PURE__*/function (_Component) {
|
|
8
|
+
_inheritsLoose(default_1, _Component);
|
|
9
|
+
function default_1() {
|
|
10
|
+
return _Component.apply(this, arguments) || this;
|
|
11
|
+
}
|
|
12
|
+
default_1.defaults = function defaults() {
|
|
13
|
+
return {
|
|
14
|
+
currentStep: 0,
|
|
15
|
+
showTour: false,
|
|
16
|
+
closable: false,
|
|
17
|
+
tourData: [{
|
|
18
|
+
target: '#closabelDemo',
|
|
19
|
+
title: '禁用关闭图标',
|
|
20
|
+
content: '当closable为true时,header区域关闭图标隐藏',
|
|
21
|
+
position: 'right'
|
|
22
|
+
}]
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
var _proto = default_1.prototype;
|
|
26
|
+
_proto.startTour = function startTour() {
|
|
27
|
+
this.set({
|
|
28
|
+
showTour: true,
|
|
29
|
+
currentStep: 0
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
_proto.finishTour = function finishTour() {
|
|
33
|
+
this.set({
|
|
34
|
+
showTour: false
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
return default_1;
|
|
38
|
+
}(Component);
|
|
39
|
+
default_1.template = template;
|
|
40
|
+
export { default_1 as default };
|
|
41
|
+
__decorate([bind], default_1.prototype, "startTour", null);
|
|
42
|
+
__decorate([bind], default_1.prototype, "finishTour", null);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export default class Demo extends React.Component {
|
|
3
|
+
state: {
|
|
4
|
+
currentStep: number;
|
|
5
|
+
showTour: boolean;
|
|
6
|
+
closable: boolean;
|
|
7
|
+
tourData: {
|
|
8
|
+
target: string;
|
|
9
|
+
title: string;
|
|
10
|
+
content: string;
|
|
11
|
+
position: string;
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
startTour(): void;
|
|
15
|
+
finishTour(): void;
|
|
16
|
+
render(): React.JSX.Element;
|
|
17
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
+
import { __decorate } from "tslib";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { Tour, Button, Switch } from '@king-design/react';
|
|
6
|
+
import { bind } from '@king-design/react';
|
|
7
|
+
var Demo = /*#__PURE__*/function (_React$Component) {
|
|
8
|
+
_inheritsLoose(Demo, _React$Component);
|
|
9
|
+
function Demo() {
|
|
10
|
+
var _context;
|
|
11
|
+
var _this;
|
|
12
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
13
|
+
args[_key] = arguments[_key];
|
|
14
|
+
}
|
|
15
|
+
_this = _React$Component.call.apply(_React$Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
16
|
+
_this.state = {
|
|
17
|
+
currentStep: 0,
|
|
18
|
+
showTour: false,
|
|
19
|
+
closable: false,
|
|
20
|
+
tourData: [{
|
|
21
|
+
target: '#closabelDemo',
|
|
22
|
+
title: '禁用关闭图标',
|
|
23
|
+
content: '当closable为true时,header区域关闭图标隐藏',
|
|
24
|
+
position: 'right'
|
|
25
|
+
}]
|
|
26
|
+
};
|
|
27
|
+
return _this;
|
|
28
|
+
}
|
|
29
|
+
var _proto = Demo.prototype;
|
|
30
|
+
_proto.startTour = function startTour() {
|
|
31
|
+
this.setState({
|
|
32
|
+
showTour: true,
|
|
33
|
+
currentStep: 0
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
_proto.finishTour = function finishTour() {
|
|
37
|
+
this.setState({
|
|
38
|
+
showTour: false
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
_proto.render = function render() {
|
|
42
|
+
var _this2 = this;
|
|
43
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
className: "example-container"
|
|
45
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
46
|
+
id: "closabelDemo"
|
|
47
|
+
}, "\u76EE\u6807\u5143\u7D201")), /*#__PURE__*/React.createElement(Tour, {
|
|
48
|
+
value: this.state.currentStep,
|
|
49
|
+
onChangeValue: function onChangeValue(currentStep) {
|
|
50
|
+
return _this2.setState({
|
|
51
|
+
currentStep: currentStep
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
visible: this.state.showTour,
|
|
55
|
+
data: this.state.tourData,
|
|
56
|
+
closable: this.state.closable,
|
|
57
|
+
onFinish: this.finishTour
|
|
58
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
59
|
+
style: {
|
|
60
|
+
"marginTop": "20px"
|
|
61
|
+
}
|
|
62
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
63
|
+
style: {
|
|
64
|
+
"marginBottom": "10px"
|
|
65
|
+
}
|
|
66
|
+
}, /*#__PURE__*/React.createElement(Switch, {
|
|
67
|
+
value: this.state.closable,
|
|
68
|
+
onChangeValue: function onChangeValue(closable) {
|
|
69
|
+
return _this2.setState({
|
|
70
|
+
closable: closable
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
74
|
+
style: {
|
|
75
|
+
"marginLeft": "10px"
|
|
76
|
+
}
|
|
77
|
+
}, "\u5173\u95ED\u56FE\u6807: ", this.state.closable ? '启用' : '禁用')), /*#__PURE__*/React.createElement(Button, {
|
|
78
|
+
onClick: this.startTour
|
|
79
|
+
}, "\u542F\u52A8\u5F15\u5BFC")));
|
|
80
|
+
};
|
|
81
|
+
return Demo;
|
|
82
|
+
}(React.Component);
|
|
83
|
+
export { Demo as default };
|
|
84
|
+
__decorate([bind], Demo.prototype, "startTour", null);
|
|
85
|
+
__decorate([bind], Demo.prototype, "finishTour", null);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default as data } from './index.json';
|
|
2
|
+
import { Component } from 'intact';
|
|
3
|
+
export default class extends Component {
|
|
4
|
+
static template: string | import("intact").Template<any>;
|
|
5
|
+
static defaults(): {
|
|
6
|
+
currentStep: number;
|
|
7
|
+
showTour: boolean;
|
|
8
|
+
};
|
|
9
|
+
settour(): void;
|
|
10
|
+
close(): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import { __decorate } from "tslib";
|
|
3
|
+
export { default as data } from './index.json';
|
|
4
|
+
import { Component } from 'intact';
|
|
5
|
+
import template from './index.vdt';
|
|
6
|
+
import { bind } from 'kpc';
|
|
7
|
+
var default_1 = /*#__PURE__*/function (_Component) {
|
|
8
|
+
_inheritsLoose(default_1, _Component);
|
|
9
|
+
function default_1() {
|
|
10
|
+
return _Component.apply(this, arguments) || this;
|
|
11
|
+
}
|
|
12
|
+
default_1.defaults = function defaults() {
|
|
13
|
+
return {
|
|
14
|
+
currentStep: 0,
|
|
15
|
+
showTour: false
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
var _proto = default_1.prototype;
|
|
19
|
+
_proto.settour = function settour() {
|
|
20
|
+
this.set({
|
|
21
|
+
showTour: true,
|
|
22
|
+
currentStep: 0
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
_proto.close = function close() {
|
|
26
|
+
this.set({
|
|
27
|
+
showTour: false
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
return default_1;
|
|
31
|
+
}(Component);
|
|
32
|
+
default_1.template = template;
|
|
33
|
+
export { default_1 as default };
|
|
34
|
+
__decorate([bind], default_1.prototype, "settour", null);
|
|
35
|
+
__decorate([bind], default_1.prototype, "close", null);
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
+
import { __decorate } from "tslib";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { Tour, TourStep, Button, Icon } from '@king-design/react';
|
|
6
|
+
import './index.styl';
|
|
7
|
+
import { bind } from '@king-design/react';
|
|
8
|
+
var Demo = /*#__PURE__*/function (_React$Component) {
|
|
9
|
+
_inheritsLoose(Demo, _React$Component);
|
|
10
|
+
function Demo() {
|
|
11
|
+
var _context;
|
|
12
|
+
var _this;
|
|
13
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
14
|
+
args[_key] = arguments[_key];
|
|
15
|
+
}
|
|
16
|
+
_this = _React$Component.call.apply(_React$Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
17
|
+
_this.state = {
|
|
18
|
+
currentStep: 0,
|
|
19
|
+
showTour: false
|
|
20
|
+
};
|
|
21
|
+
return _this;
|
|
22
|
+
}
|
|
23
|
+
var _proto = Demo.prototype;
|
|
24
|
+
_proto.settour = function settour() {
|
|
25
|
+
this.setState({
|
|
26
|
+
showTour: true,
|
|
27
|
+
currentStep: 0
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
_proto.close = function close() {
|
|
31
|
+
this.setState({
|
|
32
|
+
showTour: false
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
_proto.render = function render() {
|
|
36
|
+
var _this2 = this;
|
|
37
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
className: "example-container"
|
|
39
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
40
|
+
id: "btn5"
|
|
41
|
+
}, "\u793A\u4F8B\u5143\u7D20")), /*#__PURE__*/React.createElement(Tour, {
|
|
42
|
+
value: this.state.currentStep,
|
|
43
|
+
onChangeValue: function onChangeValue(currentStep) {
|
|
44
|
+
return _this2.setState({
|
|
45
|
+
currentStep: currentStep
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
visible: this.state.showTour,
|
|
49
|
+
onFinish: this.close
|
|
50
|
+
}, /*#__PURE__*/React.createElement(TourStep, {
|
|
51
|
+
slotHeader: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
style: {
|
|
53
|
+
"display": "flex",
|
|
54
|
+
"alignItems": "center"
|
|
55
|
+
}
|
|
56
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
57
|
+
className: "ion-android-star",
|
|
58
|
+
style: {
|
|
59
|
+
"marginRight": "5px",
|
|
60
|
+
"color": "#f0ad4e"
|
|
61
|
+
}
|
|
62
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
63
|
+
className: "custom-title"
|
|
64
|
+
}, "\u81EA\u5B9A\u4E49\u6807\u9898"), /*#__PURE__*/React.createElement("span", {
|
|
65
|
+
style: {
|
|
66
|
+
"marginLeft": "8px",
|
|
67
|
+
"color": "#999",
|
|
68
|
+
"fontSize": "12px"
|
|
69
|
+
}
|
|
70
|
+
}, "\u5E26\u56FE\u6807\u548C\u6837\u5F0F"))),
|
|
71
|
+
slotFooter: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
72
|
+
className: "step-indicator"
|
|
73
|
+
}, this.state.currentStep + 1, " / 1"), /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
className: "custom-footer"
|
|
75
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
76
|
+
size: "small",
|
|
77
|
+
type: "danger",
|
|
78
|
+
style: {
|
|
79
|
+
"marginRight": "8px"
|
|
80
|
+
},
|
|
81
|
+
onClick: this.close
|
|
82
|
+
}, "\u8DF3\u8FC7"), /*#__PURE__*/React.createElement(Button, {
|
|
83
|
+
size: "small",
|
|
84
|
+
type: "primary",
|
|
85
|
+
onClick: this.close
|
|
86
|
+
}, "\u6211\u77E5\u9053\u4E86"))),
|
|
87
|
+
target: "#btn5",
|
|
88
|
+
position: "bottom"
|
|
89
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
className: "custom-content"
|
|
91
|
+
}, /*#__PURE__*/React.createElement("p", null, "\u8FD9\u662F\u4E00\u4E2A\u81EA\u5B9A\u4E49\u7684\u590D\u6742\u5185\u5BB9\uFF0C\u53EF\u4EE5\u5305\u542B\u56FE\u7247\u3001\u94FE\u63A5\u7B49\u4EFB\u4F55\u5143\u7D20\u3002"), /*#__PURE__*/React.createElement("a", {
|
|
92
|
+
href: "javascript:;",
|
|
93
|
+
style: {
|
|
94
|
+
"color": "#2d8cf0"
|
|
95
|
+
}
|
|
96
|
+
}, "\u4E86\u89E3\u66F4\u591A")))), /*#__PURE__*/React.createElement("div", {
|
|
97
|
+
style: {
|
|
98
|
+
"marginTop": "20px"
|
|
99
|
+
}
|
|
100
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
101
|
+
onClick: this.settour
|
|
102
|
+
}, "\u542F\u52A8\u81EA\u5B9A\u4E49\u5F15\u5BFC")));
|
|
103
|
+
};
|
|
104
|
+
return Demo;
|
|
105
|
+
}(React.Component);
|
|
106
|
+
export { Demo as default };
|
|
107
|
+
__decorate([bind], Demo.prototype, "settour", null);
|
|
108
|
+
__decorate([bind], Demo.prototype, "close", null);
|