vue-devui 1.0.0-alpha.6 → 1.0.0-beta.12
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/README.md +32 -35
- package/accordion/index.d.ts +7 -0
- package/accordion/index.es.js +508 -1
- 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 +178 -1
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/anchor/index.d.ts +7 -0
- package/anchor/index.es.js +263 -1
- package/anchor/index.umd.js +1 -1
- package/avatar/index.d.ts +7 -0
- package/avatar/index.es.js +301 -1
- package/avatar/index.umd.js +1 -1
- package/back-top/index.d.ts +7 -0
- package/back-top/index.es.js +128 -0
- package/back-top/index.umd.js +1 -0
- package/back-top/package.json +7 -0
- package/back-top/style.css +1 -0
- package/badge/index.d.ts +7 -0
- package/badge/index.es.js +95 -1
- package/badge/index.umd.js +1 -1
- package/breadcrumb/index.d.ts +7 -0
- package/breadcrumb/index.es.js +127 -1
- package/breadcrumb/index.umd.js +1 -1
- package/button/index.d.ts +7 -0
- package/button/index.es.js +392 -1
- package/button/index.umd.js +1 -1
- package/button/style.css +1 -1
- package/card/index.d.ts +7 -0
- package/card/index.es.js +61 -1
- package/card/index.umd.js +1 -1
- package/carousel/index.d.ts +7 -0
- package/carousel/index.es.js +329 -1
- package/carousel/index.umd.js +1 -1
- package/cascader/index.d.ts +7 -0
- package/cascader/index.es.js +1343 -1
- 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 +377 -1
- package/checkbox/index.umd.js +1 -1
- package/comment/index.d.ts +7 -0
- package/comment/index.es.js +85 -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 +176 -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 +1172 -1
- package/date-picker/index.umd.js +1 -1
- package/date-picker/style.css +1 -1
- package/dragdrop/index.d.ts +7 -0
- package/dragdrop/index.es.js +32 -0
- package/dragdrop/index.umd.js +1 -0
- package/dragdrop/package.json +7 -0
- package/drawer/index.d.ts +7 -0
- package/drawer/index.es.js +287 -0
- package/drawer/index.umd.js +1 -0
- package/drawer/package.json +7 -0
- package/drawer/style.css +1 -0
- package/dropdown/index.d.ts +7 -0
- package/dropdown/index.es.js +535 -0
- package/dropdown/index.umd.js +1 -0
- package/dropdown/package.json +7 -0
- package/dropdown/style.css +1 -0
- package/editable-select/index.d.ts +7 -0
- package/editable-select/index.es.js +5857 -1
- package/editable-select/index.umd.js +27 -1
- package/editable-select/style.css +1 -1
- package/form/index.d.ts +7 -0
- package/form/index.es.js +2244 -0
- package/form/index.umd.js +1 -0
- package/form/package.json +7 -0
- package/form/style.css +1 -0
- package/fullscreen/index.d.ts +7 -0
- package/fullscreen/index.es.js +163 -1
- package/fullscreen/index.umd.js +1 -1
- package/gantt/index.d.ts +7 -0
- package/gantt/index.es.js +535 -0
- package/gantt/index.umd.js +1 -0
- package/gantt/package.json +7 -0
- package/gantt/style.css +1 -0
- package/grid/index.d.ts +7 -0
- package/grid/index.es.js +269 -0
- package/grid/index.umd.js +1 -0
- package/grid/package.json +7 -0
- package/grid/style.css +1 -0
- package/icon/index.d.ts +7 -0
- package/icon/index.es.js +75 -1
- package/icon/index.umd.js +1 -1
- package/image-preview/index.d.ts +7 -0
- package/image-preview/index.es.js +498 -1
- 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 +190 -1
- package/input/index.umd.js +1 -1
- package/input-icon/index.d.ts +7 -0
- package/input-icon/index.es.js +332 -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 +240 -1
- package/input-number/index.umd.js +1 -1
- package/layout/index.d.ts +7 -0
- package/layout/index.es.js +100 -0
- package/layout/index.umd.js +1 -0
- package/layout/package.json +7 -0
- package/layout/style.css +1 -0
- package/loading/index.d.ts +7 -0
- package/loading/index.es.js +256 -1
- package/loading/index.umd.js +1 -1
- package/modal/index.d.ts +7 -0
- package/modal/index.es.js +1225 -1
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/nav-sprite/index.d.ts +7 -0
- package/nav-sprite/index.es.js +742 -0
- package/nav-sprite/index.umd.js +1 -0
- package/nav-sprite/package.json +7 -0
- package/nuxt/components/Accordion.js +3 -0
- package/nuxt/components/Alert.js +3 -0
- package/nuxt/components/Anchor.js +3 -0
- package/nuxt/components/Aside.js +3 -0
- package/nuxt/components/Avatar.js +3 -0
- package/nuxt/components/BackTop.js +3 -0
- package/nuxt/components/Badge.js +3 -0
- package/nuxt/components/Breadcrumb.js +3 -0
- package/nuxt/components/Button.js +3 -0
- package/nuxt/components/Card.js +3 -0
- package/nuxt/components/Carousel.js +3 -0
- package/nuxt/components/Cascader.js +3 -0
- package/nuxt/components/Checkbox.js +3 -0
- package/nuxt/components/Col.js +3 -0
- package/nuxt/components/Column.js +3 -0
- package/nuxt/components/Comment.js +3 -0
- package/nuxt/components/Content.js +3 -0
- package/nuxt/components/Countdown.js +3 -0
- package/nuxt/components/DatePicker.js +3 -0
- package/nuxt/components/Drawer.js +3 -0
- package/nuxt/components/Dropdown.js +3 -0
- package/nuxt/components/EditableSelect.js +3 -0
- package/nuxt/components/FixedOverlay.js +3 -0
- package/nuxt/components/FlexibleOverlay.js +3 -0
- package/nuxt/components/Footer.js +3 -0
- package/nuxt/components/Form.js +3 -0
- package/nuxt/components/FormControl.js +3 -0
- package/nuxt/components/FormItem.js +3 -0
- package/nuxt/components/FormLabel.js +3 -0
- package/nuxt/components/FormOperation.js +3 -0
- package/nuxt/components/Fullscreen.js +3 -0
- package/nuxt/components/Gantt.js +3 -0
- package/nuxt/components/Header.js +3 -0
- package/nuxt/components/Icon.js +2 -0
- package/nuxt/components/ImagePreviewService.js +3 -0
- package/nuxt/components/Input.js +3 -0
- package/nuxt/components/InputIcon.js +3 -0
- package/nuxt/components/InputNumber.js +3 -0
- package/nuxt/components/Layout.js +3 -0
- package/nuxt/components/Loading.js +3 -0
- package/nuxt/components/LoadingService.js +3 -0
- package/nuxt/components/Modal.js +3 -0
- package/nuxt/components/NavSprite.js +2 -0
- package/nuxt/components/Pagination.js +3 -0
- package/nuxt/components/Panel.js +3 -0
- package/nuxt/components/Popover.js +3 -0
- package/nuxt/components/Progress.js +3 -0
- package/nuxt/components/QuadrantDiagram.js +3 -0
- package/nuxt/components/Radio.js +3 -0
- package/nuxt/components/RadioGroup.js +3 -0
- package/nuxt/components/Rate.js +3 -0
- package/nuxt/components/ReadTip.js +3 -0
- package/nuxt/components/Result.js +3 -0
- package/nuxt/components/Row.js +3 -0
- package/nuxt/components/Search.js +3 -0
- package/nuxt/components/Select.js +3 -0
- package/nuxt/components/Skeleton.js +3 -0
- package/nuxt/components/SkeletonItem.js +3 -0
- package/nuxt/components/Slider.js +3 -0
- package/nuxt/components/Splitter.js +3 -0
- package/nuxt/components/Statistic.js +3 -0
- package/nuxt/components/Status.js +3 -0
- package/nuxt/components/StepsGuide.js +3 -0
- package/nuxt/components/StickSlider.js +3 -0
- package/nuxt/components/Sticky.js +2 -0
- package/nuxt/components/Switch.js +3 -0
- package/nuxt/components/Table.js +3 -0
- package/nuxt/components/Tabs.js +3 -0
- package/nuxt/components/Tag.js +3 -0
- package/nuxt/components/TagInput.js +3 -0
- package/nuxt/components/Textarea.js +3 -0
- package/nuxt/components/TimeAxis.js +3 -0
- package/nuxt/components/TimeAxisItem.js +3 -0
- package/nuxt/components/TimePicker.js +3 -0
- package/nuxt/components/Toast.js +3 -0
- package/nuxt/components/ToastService.js +3 -0
- package/nuxt/components/Tooltip.js +3 -0
- package/nuxt/components/Transfer.js +3 -0
- package/nuxt/components/Tree.js +3 -0
- package/nuxt/components/TreeSelect.js +3 -0
- package/nuxt/components/Upload.js +3 -0
- package/nuxt/components/buttonProps.js +3 -0
- package/nuxt/index.js +13 -0
- package/overlay/index.d.ts +7 -0
- package/overlay/index.es.js +368 -1
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +6 -47
- package/pagination/index.d.ts +7 -0
- package/pagination/index.es.js +642 -1
- package/pagination/index.umd.js +1 -1
- package/panel/index.d.ts +7 -0
- package/panel/index.es.js +205 -1
- package/panel/index.umd.js +1 -1
- package/panel/style.css +1 -1
- package/popover/index.d.ts +7 -0
- package/popover/index.es.js +236 -1
- package/popover/index.umd.js +1 -1
- package/progress/index.d.ts +7 -0
- package/progress/index.es.js +153 -1
- package/progress/index.umd.js +3 -1
- package/quadrant-diagram/index.d.ts +7 -0
- package/quadrant-diagram/index.es.js +489 -1
- package/quadrant-diagram/index.umd.js +1 -1
- package/radio/index.d.ts +7 -0
- package/radio/index.es.js +225 -1
- package/radio/index.umd.js +1 -1
- package/rate/index.d.ts +7 -0
- package/rate/index.es.js +220 -1
- package/rate/index.umd.js +1 -1
- package/read-tip/index.d.ts +7 -0
- package/read-tip/index.es.js +258 -0
- package/read-tip/index.umd.js +1 -0
- package/read-tip/package.json +7 -0
- package/read-tip/style.css +1 -0
- package/result/index.d.ts +7 -0
- package/result/index.es.js +119 -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 +181 -1
- package/ripple/index.umd.js +1 -1
- package/search/index.d.ts +7 -0
- package/search/index.es.js +543 -1
- package/search/index.umd.js +1 -1
- package/select/index.d.ts +7 -0
- package/select/index.es.js +706 -1
- package/select/index.umd.js +1 -1
- package/skeleton/index.d.ts +7 -0
- package/skeleton/index.es.js +297 -1
- 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 +199 -1
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.d.ts +7 -0
- package/splitter/index.es.js +636 -1
- 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 +42 -1
- package/status/index.umd.js +1 -1
- package/steps-guide/index.d.ts +7 -0
- package/steps-guide/index.es.js +239 -1
- package/steps-guide/index.umd.js +1 -1
- package/steps-guide/style.css +1 -1
- package/sticky/index.d.ts +7 -0
- package/sticky/index.es.js +197 -1
- package/sticky/index.umd.js +1 -1
- package/style.css +1 -1
- package/switch/index.d.ts +7 -0
- package/switch/index.es.js +100 -1
- package/switch/index.umd.js +1 -1
- package/switch/style.css +1 -1
- package/table/index.d.ts +7 -0
- package/table/index.es.js +1836 -1
- package/table/index.umd.js +1 -1
- package/table/style.css +1 -1
- package/tabs/index.d.ts +7 -0
- package/tabs/index.es.js +195 -1
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.d.ts +7 -0
- package/tag/index.es.js +131 -0
- package/tag/index.umd.js +1 -0
- package/tag/package.json +7 -0
- package/tag/style.css +1 -0
- package/tag-input/index.d.ts +7 -0
- package/tag-input/index.es.js +329 -1
- package/tag-input/index.umd.js +1 -1
- package/textarea/index.d.ts +7 -0
- package/textarea/index.es.js +132 -0
- package/textarea/index.umd.js +1 -0
- package/textarea/package.json +7 -0
- package/textarea/style.css +1 -0
- package/time-axis/index.d.ts +7 -0
- package/time-axis/index.es.js +299 -0
- package/time-axis/index.umd.js +1 -0
- package/time-axis/package.json +7 -0
- package/time-axis/style.css +1 -0
- package/time-picker/index.d.ts +7 -0
- package/time-picker/index.es.js +1260 -1
- 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 +2060 -1
- package/toast/index.umd.js +1 -1
- package/toast/style.css +1 -1
- package/tooltip/index.d.ts +7 -0
- package/tooltip/index.es.js +171 -1
- package/tooltip/index.umd.js +1 -1
- package/transfer/index.d.ts +7 -0
- package/transfer/index.es.js +1725 -1
- 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 +907 -1
- package/tree/index.umd.js +1 -1
- package/tree/style.css +1 -1
- package/tree-select/index.d.ts +7 -0
- package/tree-select/index.es.js +528 -0
- package/tree-select/index.umd.js +1 -0
- package/tree-select/package.json +7 -0
- package/tree-select/style.css +1 -0
- package/upload/index.d.ts +7 -0
- package/upload/index.es.js +2834 -1
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +27777 -1
- package/vue-devui.umd.js +29 -1
package/progress/index.es.js
CHANGED
|
@@ -1 +1,153 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineComponent, toRefs, reactive, watch, createVNode, createTextVNode } from "vue";
|
|
2
|
+
var progress = "";
|
|
3
|
+
var Progress = defineComponent({
|
|
4
|
+
name: "DProgress",
|
|
5
|
+
props: {
|
|
6
|
+
height: {
|
|
7
|
+
type: String,
|
|
8
|
+
default: "20px"
|
|
9
|
+
},
|
|
10
|
+
percentage: {
|
|
11
|
+
type: Number,
|
|
12
|
+
default: 0
|
|
13
|
+
},
|
|
14
|
+
percentageText: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: ""
|
|
17
|
+
},
|
|
18
|
+
barBgColor: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: "#5170ff"
|
|
21
|
+
},
|
|
22
|
+
isCircle: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: false
|
|
25
|
+
},
|
|
26
|
+
strokeWidth: {
|
|
27
|
+
type: Number,
|
|
28
|
+
default: 6
|
|
29
|
+
},
|
|
30
|
+
showContent: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: true
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
setup(props) {
|
|
36
|
+
const {
|
|
37
|
+
height,
|
|
38
|
+
percentage,
|
|
39
|
+
percentageText,
|
|
40
|
+
barBgColor,
|
|
41
|
+
isCircle,
|
|
42
|
+
strokeWidth,
|
|
43
|
+
showContent
|
|
44
|
+
} = toRefs(props);
|
|
45
|
+
const data = reactive({
|
|
46
|
+
pathString: "",
|
|
47
|
+
trailPath: null,
|
|
48
|
+
strokePath: null
|
|
49
|
+
});
|
|
50
|
+
const setCircleProgress = () => {
|
|
51
|
+
if (!isCircle) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const radius = 50 - strokeWidth.value / 2;
|
|
55
|
+
const beginPositionY = -radius;
|
|
56
|
+
const endPositionY = radius * -2;
|
|
57
|
+
data.pathString = `M 50,50 m 0,${beginPositionY}
|
|
58
|
+
a ${radius},${radius} 0 1 1 0,${-endPositionY}
|
|
59
|
+
a ${radius},${radius} 0 1 1 0,${endPositionY}`;
|
|
60
|
+
const len = Math.PI * 2 * radius;
|
|
61
|
+
data.trailPath = {
|
|
62
|
+
stroke: "#dfe1e6",
|
|
63
|
+
strokeDasharray: `${len}px ${len}px`,
|
|
64
|
+
strokeDashoffset: `0`,
|
|
65
|
+
transition: "stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s"
|
|
66
|
+
};
|
|
67
|
+
data.strokePath = {
|
|
68
|
+
stroke: barBgColor || null,
|
|
69
|
+
strokeDasharray: `${percentage.value / 100 * len}px ${len}px`,
|
|
70
|
+
strokeDashoffset: `0`,
|
|
71
|
+
transition: "stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
setCircleProgress();
|
|
75
|
+
watch([height, percentage, percentageText, barBgColor, isCircle, strokeWidth, showContent], () => {
|
|
76
|
+
setCircleProgress();
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
data
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
render() {
|
|
83
|
+
var _a;
|
|
84
|
+
const {
|
|
85
|
+
height,
|
|
86
|
+
percentage,
|
|
87
|
+
percentageText,
|
|
88
|
+
barBgColor,
|
|
89
|
+
isCircle,
|
|
90
|
+
strokeWidth,
|
|
91
|
+
showContent,
|
|
92
|
+
data,
|
|
93
|
+
$slots
|
|
94
|
+
} = this;
|
|
95
|
+
const progressLine = createVNode("div", {
|
|
96
|
+
"class": "devui-progress--line",
|
|
97
|
+
"style": {
|
|
98
|
+
height,
|
|
99
|
+
borderRadius: height
|
|
100
|
+
}
|
|
101
|
+
}, [createVNode("div", {
|
|
102
|
+
"class": "devui-progress-bar",
|
|
103
|
+
"style": {
|
|
104
|
+
height,
|
|
105
|
+
borderRadius: height,
|
|
106
|
+
width: `${percentage}%`,
|
|
107
|
+
backgroundColor: barBgColor
|
|
108
|
+
}
|
|
109
|
+
}, null), createVNode("span", {
|
|
110
|
+
"style": {
|
|
111
|
+
lineHeight: height
|
|
112
|
+
}
|
|
113
|
+
}, [percentageText])]);
|
|
114
|
+
const textElement = createVNode("span", {
|
|
115
|
+
"class": "devui-progress-circle-text"
|
|
116
|
+
}, [percentage, createTextVNode("%")]);
|
|
117
|
+
const progressCircle = createVNode("div", {
|
|
118
|
+
"class": "devui-progress-circle"
|
|
119
|
+
}, [createVNode("svg", {
|
|
120
|
+
"class": "devui-progress-circle",
|
|
121
|
+
"viewBox": "0 0 100 100"
|
|
122
|
+
}, [createVNode("path", {
|
|
123
|
+
"class": "devui-progress-circle-trail",
|
|
124
|
+
"fill-opacity": "0",
|
|
125
|
+
"stroke-width": strokeWidth,
|
|
126
|
+
"style": data.trailPath,
|
|
127
|
+
"d": data.pathString
|
|
128
|
+
}, null), createVNode("path", {
|
|
129
|
+
"class": "devui-progress-circle-path",
|
|
130
|
+
"d": data.pathString,
|
|
131
|
+
"stroke-linecap": "round",
|
|
132
|
+
"fill-opacity": "0",
|
|
133
|
+
"stroke": barBgColor,
|
|
134
|
+
"stroke-width": percentage ? strokeWidth : 0,
|
|
135
|
+
"style": data.strokePath
|
|
136
|
+
}, null)]), showContent && ((_a = $slots.default) == null ? void 0 : _a.call($slots)), showContent && !$slots.default && textElement]);
|
|
137
|
+
return createVNode("div", {
|
|
138
|
+
"class": "devui-progress"
|
|
139
|
+
}, [!isCircle ? progressLine : progressCircle]);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
Progress.install = function(app) {
|
|
143
|
+
app.component(Progress.name, Progress);
|
|
144
|
+
};
|
|
145
|
+
var index = {
|
|
146
|
+
title: "Progress \u8FDB\u5EA6\u6761",
|
|
147
|
+
category: "\u6570\u636E\u5C55\u793A",
|
|
148
|
+
status: "100%",
|
|
149
|
+
install(app) {
|
|
150
|
+
app.use(Progress);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
export { Progress, index as default };
|
package/progress/index.umd.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
(function(s,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(s=typeof globalThis!="undefined"?globalThis:s||self,e(s.index={},s.Vue))})(this,function(s,e){"use strict";var P="",i=e.defineComponent({name:"DProgress",props:{height:{type:String,default:"20px"},percentage:{type:Number,default:0},percentageText:{type:String,default:""},barBgColor:{type:String,default:"#5170ff"},isCircle:{type:Boolean,default:!1},strokeWidth:{type:Number,default:6},showContent:{type:Boolean,default:!0}},setup(t){const{height:n,percentage:p,percentageText:u,barBgColor:h,isCircle:l,strokeWidth:d,showContent:a}=e.toRefs(t),r=e.reactive({pathString:"",trailPath:null,strokePath:null}),g=()=>{if(!l)return;const o=50-d.value/2,k=-o,c=o*-2;r.pathString=`M 50,50 m 0,${k}
|
|
2
|
+
a ${o},${o} 0 1 1 0,${-c}
|
|
3
|
+
a ${o},${o} 0 1 1 0,${c}`;const f=Math.PI*2*o;r.trailPath={stroke:"#dfe1e6",strokeDasharray:`${f}px ${f}px`,strokeDashoffset:"0",transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s"},r.strokePath={stroke:h||null,strokeDasharray:`${p.value/100*f}px ${f}px`,strokeDashoffset:"0",transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"}};return g(),e.watch([n,p,u,h,l,d,a],()=>{g()}),{data:r}},render(){var c;const{height:t,percentage:n,percentageText:p,barBgColor:u,isCircle:h,strokeWidth:l,showContent:d,data:a,$slots:r}=this,g=e.createVNode("div",{class:"devui-progress--line",style:{height:t,borderRadius:t}},[e.createVNode("div",{class:"devui-progress-bar",style:{height:t,borderRadius:t,width:`${n}%`,backgroundColor:u}},null),e.createVNode("span",{style:{lineHeight:t}},[p])]),o=e.createVNode("span",{class:"devui-progress-circle-text"},[n,e.createTextVNode("%")]),k=e.createVNode("div",{class:"devui-progress-circle"},[e.createVNode("svg",{class:"devui-progress-circle",viewBox:"0 0 100 100"},[e.createVNode("path",{class:"devui-progress-circle-trail","fill-opacity":"0","stroke-width":l,style:a.trailPath,d:a.pathString},null),e.createVNode("path",{class:"devui-progress-circle-path",d:a.pathString,"stroke-linecap":"round","fill-opacity":"0",stroke:u,"stroke-width":n?l:0,style:a.strokePath},null)]),d&&((c=r.default)==null?void 0:c.call(r)),d&&!r.default&&o]);return e.createVNode("div",{class:"devui-progress"},[h?k:g])}});i.install=function(t){t.component(i.name,i)};var y={title:"Progress \u8FDB\u5EA6\u6761",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(t){t.use(i)}};s.Progress=i,s.default=y,Object.defineProperty(s,"__esModule",{value:!0}),s[Symbol.toStringTag]="Module"});
|
|
@@ -1 +1,489 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineComponent, toRefs, ref, reactive, onMounted, watch, createVNode } from "vue";
|
|
2
|
+
const DEFAULT_AXIS_CONFIGS = {
|
|
3
|
+
tickWidth: 10,
|
|
4
|
+
spaceBetweenLabelsAxis: 20,
|
|
5
|
+
xAxisLabel: "\u7D27\u6025\u5EA6",
|
|
6
|
+
yAxisLabel: "\u91CD\u8981\u5EA6",
|
|
7
|
+
xAxisRange: {
|
|
8
|
+
min: 0,
|
|
9
|
+
max: 100,
|
|
10
|
+
step: 10
|
|
11
|
+
},
|
|
12
|
+
yAxisRange: {
|
|
13
|
+
min: 0,
|
|
14
|
+
max: 50,
|
|
15
|
+
step: 5
|
|
16
|
+
},
|
|
17
|
+
originPosition: {
|
|
18
|
+
left: 30,
|
|
19
|
+
bottom: 30
|
|
20
|
+
},
|
|
21
|
+
axisMargin: 35,
|
|
22
|
+
xWeight: 1,
|
|
23
|
+
yWeight: 1
|
|
24
|
+
};
|
|
25
|
+
const DEFAULT_VIEW_CONFIGS = {
|
|
26
|
+
height: 900,
|
|
27
|
+
width: 950
|
|
28
|
+
};
|
|
29
|
+
const AXIS_TITLE_SPACE = 15;
|
|
30
|
+
const quadrantDiagramProps = {
|
|
31
|
+
diagramId: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: "1"
|
|
34
|
+
},
|
|
35
|
+
axisConfigs: {
|
|
36
|
+
type: Object,
|
|
37
|
+
default: DEFAULT_AXIS_CONFIGS
|
|
38
|
+
},
|
|
39
|
+
view: {
|
|
40
|
+
type: Object,
|
|
41
|
+
default: DEFAULT_VIEW_CONFIGS
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const quadrantDiagramAxisProps = {
|
|
45
|
+
diagramId: {
|
|
46
|
+
type: String
|
|
47
|
+
},
|
|
48
|
+
axisConfigs: {
|
|
49
|
+
type: Object
|
|
50
|
+
},
|
|
51
|
+
view: {
|
|
52
|
+
type: Object
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
56
|
+
var freeGlobal$1 = freeGlobal;
|
|
57
|
+
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
58
|
+
var root = freeGlobal$1 || freeSelf || Function("return this")();
|
|
59
|
+
var root$1 = root;
|
|
60
|
+
var Symbol$1 = root$1.Symbol;
|
|
61
|
+
var Symbol$2 = Symbol$1;
|
|
62
|
+
var objectProto$1 = Object.prototype;
|
|
63
|
+
var hasOwnProperty = objectProto$1.hasOwnProperty;
|
|
64
|
+
var nativeObjectToString$1 = objectProto$1.toString;
|
|
65
|
+
var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
|
|
66
|
+
function getRawTag(value) {
|
|
67
|
+
var isOwn = hasOwnProperty.call(value, symToStringTag$1), tag = value[symToStringTag$1];
|
|
68
|
+
try {
|
|
69
|
+
value[symToStringTag$1] = void 0;
|
|
70
|
+
var unmasked = true;
|
|
71
|
+
} catch (e) {
|
|
72
|
+
}
|
|
73
|
+
var result = nativeObjectToString$1.call(value);
|
|
74
|
+
if (unmasked) {
|
|
75
|
+
if (isOwn) {
|
|
76
|
+
value[symToStringTag$1] = tag;
|
|
77
|
+
} else {
|
|
78
|
+
delete value[symToStringTag$1];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
var objectProto = Object.prototype;
|
|
84
|
+
var nativeObjectToString = objectProto.toString;
|
|
85
|
+
function objectToString(value) {
|
|
86
|
+
return nativeObjectToString.call(value);
|
|
87
|
+
}
|
|
88
|
+
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
|
|
89
|
+
var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
|
|
90
|
+
function baseGetTag(value) {
|
|
91
|
+
if (value == null) {
|
|
92
|
+
return value === void 0 ? undefinedTag : nullTag;
|
|
93
|
+
}
|
|
94
|
+
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
95
|
+
}
|
|
96
|
+
function isObjectLike(value) {
|
|
97
|
+
return value != null && typeof value == "object";
|
|
98
|
+
}
|
|
99
|
+
var symbolTag = "[object Symbol]";
|
|
100
|
+
function isSymbol(value) {
|
|
101
|
+
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
102
|
+
}
|
|
103
|
+
var reWhitespace = /\s/;
|
|
104
|
+
function trimmedEndIndex(string) {
|
|
105
|
+
var index2 = string.length;
|
|
106
|
+
while (index2-- && reWhitespace.test(string.charAt(index2))) {
|
|
107
|
+
}
|
|
108
|
+
return index2;
|
|
109
|
+
}
|
|
110
|
+
var reTrimStart = /^\s+/;
|
|
111
|
+
function baseTrim(string) {
|
|
112
|
+
return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
|
|
113
|
+
}
|
|
114
|
+
function isObject(value) {
|
|
115
|
+
var type = typeof value;
|
|
116
|
+
return value != null && (type == "object" || type == "function");
|
|
117
|
+
}
|
|
118
|
+
var NAN = 0 / 0;
|
|
119
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
120
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
121
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
122
|
+
var freeParseInt = parseInt;
|
|
123
|
+
function toNumber(value) {
|
|
124
|
+
if (typeof value == "number") {
|
|
125
|
+
return value;
|
|
126
|
+
}
|
|
127
|
+
if (isSymbol(value)) {
|
|
128
|
+
return NAN;
|
|
129
|
+
}
|
|
130
|
+
if (isObject(value)) {
|
|
131
|
+
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
132
|
+
value = isObject(other) ? other + "" : other;
|
|
133
|
+
}
|
|
134
|
+
if (typeof value != "string") {
|
|
135
|
+
return value === 0 ? value : +value;
|
|
136
|
+
}
|
|
137
|
+
value = baseTrim(value);
|
|
138
|
+
var isBinary = reIsBinary.test(value);
|
|
139
|
+
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
140
|
+
}
|
|
141
|
+
var now = function() {
|
|
142
|
+
return root$1.Date.now();
|
|
143
|
+
};
|
|
144
|
+
var now$1 = now;
|
|
145
|
+
var FUNC_ERROR_TEXT = "Expected a function";
|
|
146
|
+
var nativeMax = Math.max, nativeMin = Math.min;
|
|
147
|
+
function debounce(func, wait, options) {
|
|
148
|
+
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
149
|
+
if (typeof func != "function") {
|
|
150
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
151
|
+
}
|
|
152
|
+
wait = toNumber(wait) || 0;
|
|
153
|
+
if (isObject(options)) {
|
|
154
|
+
leading = !!options.leading;
|
|
155
|
+
maxing = "maxWait" in options;
|
|
156
|
+
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
157
|
+
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
158
|
+
}
|
|
159
|
+
function invokeFunc(time) {
|
|
160
|
+
var args = lastArgs, thisArg = lastThis;
|
|
161
|
+
lastArgs = lastThis = void 0;
|
|
162
|
+
lastInvokeTime = time;
|
|
163
|
+
result = func.apply(thisArg, args);
|
|
164
|
+
return result;
|
|
165
|
+
}
|
|
166
|
+
function leadingEdge(time) {
|
|
167
|
+
lastInvokeTime = time;
|
|
168
|
+
timerId = setTimeout(timerExpired, wait);
|
|
169
|
+
return leading ? invokeFunc(time) : result;
|
|
170
|
+
}
|
|
171
|
+
function remainingWait(time) {
|
|
172
|
+
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
|
|
173
|
+
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
|
|
174
|
+
}
|
|
175
|
+
function shouldInvoke(time) {
|
|
176
|
+
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
|
|
177
|
+
return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
|
|
178
|
+
}
|
|
179
|
+
function timerExpired() {
|
|
180
|
+
var time = now$1();
|
|
181
|
+
if (shouldInvoke(time)) {
|
|
182
|
+
return trailingEdge(time);
|
|
183
|
+
}
|
|
184
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
185
|
+
}
|
|
186
|
+
function trailingEdge(time) {
|
|
187
|
+
timerId = void 0;
|
|
188
|
+
if (trailing && lastArgs) {
|
|
189
|
+
return invokeFunc(time);
|
|
190
|
+
}
|
|
191
|
+
lastArgs = lastThis = void 0;
|
|
192
|
+
return result;
|
|
193
|
+
}
|
|
194
|
+
function cancel() {
|
|
195
|
+
if (timerId !== void 0) {
|
|
196
|
+
clearTimeout(timerId);
|
|
197
|
+
}
|
|
198
|
+
lastInvokeTime = 0;
|
|
199
|
+
lastArgs = lastCallTime = lastThis = timerId = void 0;
|
|
200
|
+
}
|
|
201
|
+
function flush() {
|
|
202
|
+
return timerId === void 0 ? result : trailingEdge(now$1());
|
|
203
|
+
}
|
|
204
|
+
function debounced() {
|
|
205
|
+
var time = now$1(), isInvoking = shouldInvoke(time);
|
|
206
|
+
lastArgs = arguments;
|
|
207
|
+
lastThis = this;
|
|
208
|
+
lastCallTime = time;
|
|
209
|
+
if (isInvoking) {
|
|
210
|
+
if (timerId === void 0) {
|
|
211
|
+
return leadingEdge(lastCallTime);
|
|
212
|
+
}
|
|
213
|
+
if (maxing) {
|
|
214
|
+
clearTimeout(timerId);
|
|
215
|
+
timerId = setTimeout(timerExpired, wait);
|
|
216
|
+
return invokeFunc(lastCallTime);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (timerId === void 0) {
|
|
220
|
+
timerId = setTimeout(timerExpired, wait);
|
|
221
|
+
}
|
|
222
|
+
return result;
|
|
223
|
+
}
|
|
224
|
+
debounced.cancel = cancel;
|
|
225
|
+
debounced.flush = flush;
|
|
226
|
+
return debounced;
|
|
227
|
+
}
|
|
228
|
+
var index$1 = "";
|
|
229
|
+
var DQuadrantDiagramAxis = defineComponent({
|
|
230
|
+
name: "DQuadrantDiagramAxis",
|
|
231
|
+
props: quadrantDiagramAxisProps,
|
|
232
|
+
setup(props) {
|
|
233
|
+
const {
|
|
234
|
+
diagramId,
|
|
235
|
+
view,
|
|
236
|
+
axisConfigs
|
|
237
|
+
} = toRefs(props);
|
|
238
|
+
const AXIS_COLOR = ref("#0000ff");
|
|
239
|
+
const AXIS_LABEL_COLOR = ref("#ff0000");
|
|
240
|
+
const quadrantAxis = ref();
|
|
241
|
+
const context = ref();
|
|
242
|
+
const axisInnerAttr = reactive({
|
|
243
|
+
axisOrigin: {
|
|
244
|
+
x: 0,
|
|
245
|
+
y: 0
|
|
246
|
+
},
|
|
247
|
+
axisTop: 0,
|
|
248
|
+
axisRight: 0,
|
|
249
|
+
axisWidth: 0,
|
|
250
|
+
axisHeight: 0,
|
|
251
|
+
yAxisTicksNum: 0,
|
|
252
|
+
xAxisTicksNum: 0,
|
|
253
|
+
xTickSpacing: 0,
|
|
254
|
+
yTickSpacing: 0
|
|
255
|
+
});
|
|
256
|
+
const axisConfigsVal = axisConfigs.value;
|
|
257
|
+
onMounted(() => {
|
|
258
|
+
resetAxis();
|
|
259
|
+
});
|
|
260
|
+
watch(view.value, () => {
|
|
261
|
+
resetAxis();
|
|
262
|
+
});
|
|
263
|
+
const resetAxis = debounce(() => {
|
|
264
|
+
initAxisData();
|
|
265
|
+
setAxisData();
|
|
266
|
+
drawAxis();
|
|
267
|
+
drawAxisLabels();
|
|
268
|
+
}, 200);
|
|
269
|
+
const initAxisData = () => {
|
|
270
|
+
quadrantAxis.value = document.querySelector("#devui-quadrant-axis-" + diagramId.value);
|
|
271
|
+
};
|
|
272
|
+
const setAxisData = () => {
|
|
273
|
+
context.value = quadrantAxis.value.getContext("2d");
|
|
274
|
+
axisInnerAttr.axisOrigin = axisConfigsVal.axisOrigin;
|
|
275
|
+
axisInnerAttr.axisTop = axisConfigsVal.axisTop;
|
|
276
|
+
axisInnerAttr.axisRight = axisConfigsVal.axisRight;
|
|
277
|
+
axisInnerAttr.axisWidth = axisConfigsVal.axisWidth;
|
|
278
|
+
axisInnerAttr.axisHeight = axisConfigsVal.axisHeight;
|
|
279
|
+
axisInnerAttr.yAxisTicksNum = axisConfigsVal.yAxisTicksNum;
|
|
280
|
+
axisInnerAttr.xAxisTicksNum = axisConfigsVal.xAxisTicksNum;
|
|
281
|
+
axisInnerAttr.xTickSpacing = axisConfigsVal.xTickSpacing;
|
|
282
|
+
axisInnerAttr.yTickSpacing = axisConfigsVal.yTickSpacing;
|
|
283
|
+
};
|
|
284
|
+
const drawAxis = () => {
|
|
285
|
+
context.value.save();
|
|
286
|
+
context.value.fillStyle = AXIS_COLOR.value;
|
|
287
|
+
context.value.strokeStyle = AXIS_COLOR.value;
|
|
288
|
+
drawXAxis();
|
|
289
|
+
drawYAxis();
|
|
290
|
+
context.value.lineWidth = 0.5;
|
|
291
|
+
drawXAxisTicks();
|
|
292
|
+
drawYAxisTicks();
|
|
293
|
+
context.value.restore();
|
|
294
|
+
};
|
|
295
|
+
const drawYAxis = () => {
|
|
296
|
+
context.value.beginPath();
|
|
297
|
+
context.value.moveTo(axisInnerAttr.axisOrigin.x, axisInnerAttr.axisOrigin.y);
|
|
298
|
+
context.value.lineTo(axisInnerAttr.axisOrigin.x, axisInnerAttr.axisTop - axisConfigsVal.axisMargin);
|
|
299
|
+
context.value.stroke();
|
|
300
|
+
context.value.moveTo(axisInnerAttr.axisOrigin.x, axisInnerAttr.axisTop - axisConfigsVal.axisMargin);
|
|
301
|
+
context.value.lineTo(axisInnerAttr.axisOrigin.x + 5, axisInnerAttr.axisTop - axisConfigsVal.axisMargin + 10);
|
|
302
|
+
context.value.lineTo(axisInnerAttr.axisOrigin.x - 5, axisInnerAttr.axisTop - axisConfigsVal.axisMargin + 10);
|
|
303
|
+
context.value.fill();
|
|
304
|
+
};
|
|
305
|
+
const drawXAxis = () => {
|
|
306
|
+
context.value.beginPath();
|
|
307
|
+
context.value.moveTo(axisInnerAttr.axisOrigin.x, axisInnerAttr.axisOrigin.y);
|
|
308
|
+
context.value.lineTo(axisInnerAttr.axisRight + axisConfigsVal.axisMargin - 10, axisInnerAttr.axisOrigin.y);
|
|
309
|
+
context.value.stroke();
|
|
310
|
+
context.value.moveTo(axisInnerAttr.axisRight + axisConfigsVal.axisMargin, axisInnerAttr.axisOrigin.y);
|
|
311
|
+
context.value.lineTo(axisInnerAttr.axisRight + axisConfigsVal.axisMargin - 10, axisInnerAttr.axisOrigin.y + 5);
|
|
312
|
+
context.value.lineTo(axisInnerAttr.axisRight + axisConfigsVal.axisMargin - 10, axisInnerAttr.axisOrigin.y - 5);
|
|
313
|
+
context.value.fill();
|
|
314
|
+
};
|
|
315
|
+
const drawXAxisTicks = () => {
|
|
316
|
+
let deltaY;
|
|
317
|
+
for (let i = 1; i < axisInnerAttr.xAxisTicksNum; i++) {
|
|
318
|
+
context.value.beginPath();
|
|
319
|
+
if (i % axisConfigsVal.xAxisRange.step === 0) {
|
|
320
|
+
deltaY = axisConfigsVal.tickWidth;
|
|
321
|
+
} else {
|
|
322
|
+
deltaY = axisConfigsVal.tickWidth / 2;
|
|
323
|
+
}
|
|
324
|
+
context.value.moveTo(axisInnerAttr.axisOrigin.x + i * axisInnerAttr.xTickSpacing, axisInnerAttr.axisOrigin.y - deltaY);
|
|
325
|
+
context.value.lineTo(axisInnerAttr.axisOrigin.x + i * axisInnerAttr.xTickSpacing, axisInnerAttr.axisOrigin.y + deltaY);
|
|
326
|
+
context.value.stroke();
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
const drawYAxisTicks = () => {
|
|
330
|
+
let deltaX;
|
|
331
|
+
for (let i = 1; i < axisInnerAttr.yAxisTicksNum; i++) {
|
|
332
|
+
context.value.beginPath();
|
|
333
|
+
if (i % axisConfigsVal.yAxisRange.step === 0) {
|
|
334
|
+
deltaX = axisConfigsVal.tickWidth;
|
|
335
|
+
} else {
|
|
336
|
+
deltaX = axisConfigsVal.tickWidth / 2;
|
|
337
|
+
}
|
|
338
|
+
context.value.moveTo(axisInnerAttr.axisOrigin.x - deltaX, axisInnerAttr.axisOrigin.y - i * axisInnerAttr.yTickSpacing);
|
|
339
|
+
context.value.lineTo(axisInnerAttr.axisOrigin.x + deltaX, axisInnerAttr.axisOrigin.y - i * axisInnerAttr.yTickSpacing);
|
|
340
|
+
context.value.stroke();
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
const drawAxisLabels = () => {
|
|
344
|
+
context.value.save();
|
|
345
|
+
context.value.fillStyle = AXIS_LABEL_COLOR.value;
|
|
346
|
+
drawXTicksLabels();
|
|
347
|
+
drawYTicksLabels();
|
|
348
|
+
context.value.restore();
|
|
349
|
+
drawAxisTitle();
|
|
350
|
+
};
|
|
351
|
+
const drawXTicksLabels = () => {
|
|
352
|
+
context.value.textAlign = "center";
|
|
353
|
+
context.value.textBaseline = "top";
|
|
354
|
+
for (let i = 0; i <= axisInnerAttr.xAxisTicksNum; i++) {
|
|
355
|
+
if (i % axisConfigsVal.xAxisRange.step === 0) {
|
|
356
|
+
context.value.fillText(i, axisInnerAttr.axisOrigin.x + i * axisInnerAttr.xTickSpacing, axisInnerAttr.axisOrigin.y + axisConfigsVal.spaceBetweenLabelsAxis);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
const drawYTicksLabels = () => {
|
|
361
|
+
context.value.textAlign = "center";
|
|
362
|
+
context.value.textBaseline = "middle";
|
|
363
|
+
for (let i = 0; i <= axisInnerAttr.yAxisTicksNum; i++) {
|
|
364
|
+
if (i % axisConfigsVal.yAxisRange.step === 0) {
|
|
365
|
+
context.value.fillText(i, axisInnerAttr.axisOrigin.x - axisConfigsVal.spaceBetweenLabelsAxis, axisInnerAttr.axisOrigin.y - i * axisInnerAttr.yTickSpacing);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
const drawAxisTitle = () => {
|
|
370
|
+
context.value.font = "12px Microsoft YaHei";
|
|
371
|
+
context.value.textAlign = "left";
|
|
372
|
+
context.value.fillStyle = AXIS_LABEL_COLOR.value;
|
|
373
|
+
const xLabelWidth = context.value.measureText(axisConfigsVal.xAxisLabel).width;
|
|
374
|
+
rotateLabel(axisConfigsVal.xAxisLabel, axisInnerAttr.axisRight + axisConfigsVal.axisMargin / 2, axisInnerAttr.axisOrigin.y - xLabelWidth - AXIS_TITLE_SPACE);
|
|
375
|
+
context.value.fillText(axisConfigsVal.yAxisLabel, axisInnerAttr.axisOrigin.x + AXIS_TITLE_SPACE, axisInnerAttr.axisTop - axisConfigsVal.axisMargin / 2);
|
|
376
|
+
};
|
|
377
|
+
const rotateLabel = (name, x, y) => {
|
|
378
|
+
for (let i = 0; i < name.length; i++) {
|
|
379
|
+
const str = name.slice(i, i + 1).toString();
|
|
380
|
+
if (str.match(/[A-Za-z0-9]/)) {
|
|
381
|
+
context.value.save();
|
|
382
|
+
context.value.translate(x, y);
|
|
383
|
+
context.value.rotate(Math.PI / 180 * 90);
|
|
384
|
+
context.value.textBaseline = "bottom";
|
|
385
|
+
context.value.fillText(str, 0, 0);
|
|
386
|
+
context.value.restore();
|
|
387
|
+
y += context.value.measureText(str).width;
|
|
388
|
+
} else if (str.match(/[\u4E00-\u9FA5]/)) {
|
|
389
|
+
context.value.save();
|
|
390
|
+
context.value.textBaseline = "top";
|
|
391
|
+
context.value.fillText(str, x, y);
|
|
392
|
+
context.value.restore();
|
|
393
|
+
y += context.value.measureText(str).width;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
},
|
|
398
|
+
render() {
|
|
399
|
+
const {
|
|
400
|
+
diagramId,
|
|
401
|
+
view
|
|
402
|
+
} = this;
|
|
403
|
+
return createVNode("div", null, [createVNode("canvas", {
|
|
404
|
+
"id": "devui-quadrant-axis-" + diagramId,
|
|
405
|
+
"height": view.height,
|
|
406
|
+
"width": view.width
|
|
407
|
+
}, null)]);
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
var QuadrantDiagram = defineComponent({
|
|
411
|
+
name: "DQuadrantDiagram",
|
|
412
|
+
props: quadrantDiagramProps,
|
|
413
|
+
setup(props) {
|
|
414
|
+
const {
|
|
415
|
+
diagramId,
|
|
416
|
+
axisConfigs,
|
|
417
|
+
view
|
|
418
|
+
} = toRefs(props);
|
|
419
|
+
const calAxisConfig = reactive({
|
|
420
|
+
axisOrigin: {
|
|
421
|
+
x: null,
|
|
422
|
+
y: null
|
|
423
|
+
},
|
|
424
|
+
axisTop: null,
|
|
425
|
+
axisRight: null,
|
|
426
|
+
axisWidth: null,
|
|
427
|
+
axisHeight: null,
|
|
428
|
+
yAxisTicksNum: null,
|
|
429
|
+
xAxisTicksNum: null,
|
|
430
|
+
xTickSpacing: null,
|
|
431
|
+
yTickSpacing: null
|
|
432
|
+
});
|
|
433
|
+
const initAxisData = () => {
|
|
434
|
+
const axisConfigKeys = Object.keys(DEFAULT_AXIS_CONFIGS);
|
|
435
|
+
for (let i = 0; i < axisConfigKeys.length; i++) {
|
|
436
|
+
if (calAxisConfig[axisConfigKeys[i]] === void 0) {
|
|
437
|
+
calAxisConfig[axisConfigKeys[i]] = DEFAULT_AXIS_CONFIGS[axisConfigKeys[i]];
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
calAxisConfig.axisOrigin = {
|
|
441
|
+
x: axisConfigs.value.originPosition.left,
|
|
442
|
+
y: view.value.height - axisConfigs.value.originPosition.bottom
|
|
443
|
+
};
|
|
444
|
+
calAxisConfig.axisTop = axisConfigs.value.axisMargin;
|
|
445
|
+
calAxisConfig.axisRight = view.value.width - axisConfigs.value.axisMargin;
|
|
446
|
+
calAxisConfig.axisWidth = calAxisConfig.axisRight - calAxisConfig.axisOrigin.x;
|
|
447
|
+
calAxisConfig.axisHeight = calAxisConfig.axisOrigin.y - calAxisConfig.axisTop;
|
|
448
|
+
calAxisConfig.yAxisTicksNum = axisConfigs.value.yAxisRange.max - axisConfigs.value.yAxisRange.min;
|
|
449
|
+
calAxisConfig.xAxisTicksNum = axisConfigs.value.xAxisRange.max - axisConfigs.value.xAxisRange.min;
|
|
450
|
+
calAxisConfig.xTickSpacing = calAxisConfig.axisWidth / calAxisConfig.xAxisTicksNum;
|
|
451
|
+
calAxisConfig.yTickSpacing = calAxisConfig.axisHeight / calAxisConfig.yAxisTicksNum;
|
|
452
|
+
};
|
|
453
|
+
initAxisData();
|
|
454
|
+
watch(view.value, () => {
|
|
455
|
+
initAxisData();
|
|
456
|
+
});
|
|
457
|
+
return {
|
|
458
|
+
diagramId,
|
|
459
|
+
calAxisConfig
|
|
460
|
+
};
|
|
461
|
+
},
|
|
462
|
+
render() {
|
|
463
|
+
const {
|
|
464
|
+
diagramId,
|
|
465
|
+
calAxisConfig,
|
|
466
|
+
view
|
|
467
|
+
} = this;
|
|
468
|
+
return createVNode("div", {
|
|
469
|
+
"class": "devui-quadrant-diagram",
|
|
470
|
+
"id": diagramId
|
|
471
|
+
}, [createVNode(DQuadrantDiagramAxis, {
|
|
472
|
+
"diagramId": diagramId,
|
|
473
|
+
"axisConfigs": calAxisConfig,
|
|
474
|
+
"view": view
|
|
475
|
+
}, null)]);
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
QuadrantDiagram.install = function(app) {
|
|
479
|
+
app.component(QuadrantDiagram.name, QuadrantDiagram);
|
|
480
|
+
};
|
|
481
|
+
var index = {
|
|
482
|
+
title: "QuadrantDiagram \u8C61\u9650\u56FE",
|
|
483
|
+
category: "\u6570\u636E\u5C55\u793A",
|
|
484
|
+
status: "10%",
|
|
485
|
+
install(app) {
|
|
486
|
+
app.use(QuadrantDiagram);
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
export { QuadrantDiagram, index as default };
|