ct-component-plus 0.0.43 → 0.0.44
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 +3 -3
- package/package.json +36 -36
- package/packages/components/button/index.js +8 -8
- package/packages/components/button/src/button.vue +171 -171
- package/packages/components/cascader/index.js +7 -7
- package/packages/components/cascader/src/cascader.vue +247 -247
- package/packages/components/cascader/src/ct-cascader.vue +260 -260
- package/packages/components/cascader/src/index.js +50 -50
- package/packages/components/checkbox/index.js +7 -7
- package/packages/components/checkbox/src/checkbox.vue +51 -51
- package/packages/components/checkbox/src/index.js +12 -12
- package/packages/components/date-picker/index.js +8 -8
- package/packages/components/date-picker/src/clear-icon.vue +2 -2
- package/packages/components/date-picker/src/date-icon.vue +2 -2
- package/packages/components/date-picker/src/date-picker.vue +77 -77
- package/packages/components/date-picker/src/index.js +33 -33
- package/packages/components/dialog/index.js +8 -8
- package/packages/components/dialog/src/dialog.vue +103 -103
- package/packages/components/empty/index.js +8 -8
- package/packages/components/empty/src/empty.vue +97 -97
- package/packages/components/index.js +81 -81
- package/packages/components/input/index.js +7 -7
- package/packages/components/input/src/index.js +13 -13
- package/packages/components/input/src/input.vue +106 -106
- package/packages/components/input-range/index.js +7 -7
- package/packages/components/input-range/src/index.js +29 -29
- package/packages/components/input-range/src/input-range.vue +233 -233
- package/packages/components/loading/index.js +7 -7
- package/packages/components/loading/src/CtLoading.vue +74 -74
- package/packages/components/loading/src/beating.vue +71 -71
- package/packages/components/loading/src/progress.vue +120 -120
- package/packages/components/loading/src/spinner.vue +38 -38
- package/packages/components/menu/index.js +7 -7
- package/packages/components/menu/src/item.vue +46 -46
- package/packages/components/menu/src/link.vue +28 -28
- package/packages/components/menu/src/logo.vue +25 -25
- package/packages/components/menu/src/menu-item.vue +103 -103
- package/packages/components/menu/src/menu.vue +191 -191
- package/packages/components/menu/src/utils/index.js +4 -4
- package/packages/components/message/icon/ErrorIcon.vue +25 -25
- package/packages/components/message/icon/InfoIcon.vue +25 -25
- package/packages/components/message/icon/SuccessIcon.vue +25 -25
- package/packages/components/message/icon/WarningIcon.vue +25 -25
- package/packages/components/message/index.js +8 -8
- package/packages/components/message/src/method.js +54 -54
- package/packages/components/message-box/index.js +7 -7
- package/packages/components/message-box/src/message-box.vue +107 -107
- package/packages/components/page/index.js +7 -7
- package/packages/components/page/src/modules/DownloadButton.vue +21 -21
- package/packages/components/page/src/modules/TableTitle.vue +151 -151
- package/packages/components/page/src/page.vue +382 -382
- package/packages/components/pagination/index.js +7 -7
- package/packages/components/pagination/src/pagination.vue +36 -36
- package/packages/components/radio/index.js +7 -7
- package/packages/components/radio/src/index.js +12 -12
- package/packages/components/radio/src/radio.vue +47 -47
- package/packages/components/search-box/index.js +24 -24
- package/packages/components/search-box/src/index.js +29 -29
- package/packages/components/search-box/src/search-box.vue +250 -250
- package/packages/components/search-box/src/slot.vue +4 -4
- package/packages/components/select/index.js +7 -7
- package/packages/components/select/src/arrow-down.vue +2 -2
- package/packages/components/select/src/clear-icon.vue +2 -2
- package/packages/components/select/src/empty.vue +13 -13
- package/packages/components/select/src/index.js +51 -51
- package/packages/components/select/src/select.vue +380 -380
- package/packages/components/table/index.js +7 -7
- package/packages/components/table/src/TableSort.vue +179 -179
- package/packages/components/table/src/index.js +78 -70
- package/packages/components/table/src/table.vue +288 -287
- package/packages/components/tabs/index.js +7 -7
- package/packages/components/tabs/src/tabs.vue +225 -225
- package/packages/components/year-select/index.js +7 -7
- package/packages/components/year-select/src/index.js +44 -44
- package/packages/components/year-select/src/year-select.vue +273 -273
- package/packages/constants/aria.ts +17 -17
- package/packages/constants/index.ts +1 -1
- package/packages/directives/click-outside/index.ts +118 -118
- package/packages/echarts/bar/index.js +63 -63
- package/packages/echarts/base.js +99 -99
- package/packages/echarts/line/index.js +106 -106
- package/packages/hooks/index.js +5 -5
- package/packages/hooks/use-buried/index.js +46 -46
- package/packages/hooks/use-checked-all/index.js +37 -37
- package/packages/hooks/use-echarts/index.js +1 -1
- package/packages/hooks/use-echarts/use-bar/index.js +72 -72
- package/packages/hooks/use-echarts/use-line/index.js +88 -88
- package/packages/hooks/use-namespace/index.js +65 -65
- package/packages/hooks/use-search-component/index.js +28 -28
- package/packages/style/element.less +725 -725
- package/packages/style/index.js +2 -2
- package/packages/style/init.less +114 -114
- package/packages/utils/index.js +1 -1
- package/packages/utils/operate.js +77 -77
- package/packages/utils/table.js +135 -0
- package/packages/utils/types.js +35 -35
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
import { isClient, isElement } from '../../utils'
|
|
2
|
-
|
|
3
|
-
import type {
|
|
4
|
-
ComponentPublicInstance,
|
|
5
|
-
DirectiveBinding,
|
|
6
|
-
ObjectDirective,
|
|
7
|
-
} from 'vue'
|
|
8
|
-
|
|
9
|
-
type DocumentHandler = <T extends MouseEvent>(mouseup: T, mousedown: T) => void
|
|
10
|
-
type FlushList = Map<
|
|
11
|
-
HTMLElement,
|
|
12
|
-
{
|
|
13
|
-
documentHandler: DocumentHandler
|
|
14
|
-
bindingFn: (...args: unknown[]) => unknown
|
|
15
|
-
}[]
|
|
16
|
-
>
|
|
17
|
-
|
|
18
|
-
const nodeList: FlushList = new Map()
|
|
19
|
-
|
|
20
|
-
let startClick: MouseEvent
|
|
21
|
-
|
|
22
|
-
if (isClient) {
|
|
23
|
-
document.addEventListener('mousedown', (e: MouseEvent) => (startClick = e))
|
|
24
|
-
document.addEventListener('mouseup', (e: MouseEvent) => {
|
|
25
|
-
for (const handlers of nodeList.values()) {
|
|
26
|
-
for (const { documentHandler } of handlers) {
|
|
27
|
-
documentHandler(e as MouseEvent, startClick)
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
})
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function createDocumentHandler(
|
|
34
|
-
el: HTMLElement,
|
|
35
|
-
binding: DirectiveBinding
|
|
36
|
-
): DocumentHandler {
|
|
37
|
-
let excludes: HTMLElement[] = []
|
|
38
|
-
if (Array.isArray(binding.arg)) {
|
|
39
|
-
excludes = binding.arg
|
|
40
|
-
} else if (isElement(binding.arg)) {
|
|
41
|
-
// due to current implementation on binding type is wrong the type casting is necessary here
|
|
42
|
-
excludes.push(binding.arg as unknown as HTMLElement)
|
|
43
|
-
}
|
|
44
|
-
return function (mouseup, mousedown) {
|
|
45
|
-
const popperRef = (
|
|
46
|
-
binding.instance as ComponentPublicInstance<{
|
|
47
|
-
popperRef: HTMLElement
|
|
48
|
-
}>
|
|
49
|
-
).popperRef
|
|
50
|
-
const mouseUpTarget = mouseup.target as Node
|
|
51
|
-
const mouseDownTarget = mousedown?.target as Node
|
|
52
|
-
const isBound = !binding || !binding.instance
|
|
53
|
-
const isTargetExists = !mouseUpTarget || !mouseDownTarget
|
|
54
|
-
const isContainedByEl =
|
|
55
|
-
el.contains(mouseUpTarget) || el.contains(mouseDownTarget)
|
|
56
|
-
const isSelf = el === mouseUpTarget
|
|
57
|
-
|
|
58
|
-
const isTargetExcluded =
|
|
59
|
-
(excludes.length &&
|
|
60
|
-
excludes.some((item) => item?.contains(mouseUpTarget))) ||
|
|
61
|
-
(excludes.length && excludes.includes(mouseDownTarget as HTMLElement))
|
|
62
|
-
const isContainedByPopper =
|
|
63
|
-
popperRef &&
|
|
64
|
-
(popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget))
|
|
65
|
-
if (
|
|
66
|
-
isBound ||
|
|
67
|
-
isTargetExists ||
|
|
68
|
-
isContainedByEl ||
|
|
69
|
-
isSelf ||
|
|
70
|
-
isTargetExcluded ||
|
|
71
|
-
isContainedByPopper
|
|
72
|
-
) {
|
|
73
|
-
return
|
|
74
|
-
}
|
|
75
|
-
binding.value(mouseup, mousedown)
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const ClickOutside: ObjectDirective = {
|
|
80
|
-
beforeMount(el: HTMLElement, binding: DirectiveBinding) {
|
|
81
|
-
// there could be multiple handlers on the element
|
|
82
|
-
if (!nodeList.has(el)) {
|
|
83
|
-
nodeList.set(el, [])
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
nodeList.get(el)!.push({
|
|
87
|
-
documentHandler: createDocumentHandler(el, binding),
|
|
88
|
-
bindingFn: binding.value,
|
|
89
|
-
})
|
|
90
|
-
},
|
|
91
|
-
updated(el: HTMLElement, binding: DirectiveBinding) {
|
|
92
|
-
if (!nodeList.has(el)) {
|
|
93
|
-
nodeList.set(el, [])
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const handlers = nodeList.get(el)!
|
|
97
|
-
const oldHandlerIndex = handlers.findIndex(
|
|
98
|
-
(item) => item.bindingFn === binding.oldValue
|
|
99
|
-
)
|
|
100
|
-
const newHandler = {
|
|
101
|
-
documentHandler: createDocumentHandler(el, binding),
|
|
102
|
-
bindingFn: binding.value,
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (oldHandlerIndex >= 0) {
|
|
106
|
-
// replace the old handler to the new handler
|
|
107
|
-
handlers.splice(oldHandlerIndex, 1, newHandler)
|
|
108
|
-
} else {
|
|
109
|
-
handlers.push(newHandler)
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
unmounted(el: HTMLElement) {
|
|
113
|
-
// remove all listeners when a component unmounted
|
|
114
|
-
nodeList.delete(el)
|
|
115
|
-
},
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export default ClickOutside
|
|
1
|
+
import { isClient, isElement } from '../../utils'
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
ComponentPublicInstance,
|
|
5
|
+
DirectiveBinding,
|
|
6
|
+
ObjectDirective,
|
|
7
|
+
} from 'vue'
|
|
8
|
+
|
|
9
|
+
type DocumentHandler = <T extends MouseEvent>(mouseup: T, mousedown: T) => void
|
|
10
|
+
type FlushList = Map<
|
|
11
|
+
HTMLElement,
|
|
12
|
+
{
|
|
13
|
+
documentHandler: DocumentHandler
|
|
14
|
+
bindingFn: (...args: unknown[]) => unknown
|
|
15
|
+
}[]
|
|
16
|
+
>
|
|
17
|
+
|
|
18
|
+
const nodeList: FlushList = new Map()
|
|
19
|
+
|
|
20
|
+
let startClick: MouseEvent
|
|
21
|
+
|
|
22
|
+
if (isClient) {
|
|
23
|
+
document.addEventListener('mousedown', (e: MouseEvent) => (startClick = e))
|
|
24
|
+
document.addEventListener('mouseup', (e: MouseEvent) => {
|
|
25
|
+
for (const handlers of nodeList.values()) {
|
|
26
|
+
for (const { documentHandler } of handlers) {
|
|
27
|
+
documentHandler(e as MouseEvent, startClick)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function createDocumentHandler(
|
|
34
|
+
el: HTMLElement,
|
|
35
|
+
binding: DirectiveBinding
|
|
36
|
+
): DocumentHandler {
|
|
37
|
+
let excludes: HTMLElement[] = []
|
|
38
|
+
if (Array.isArray(binding.arg)) {
|
|
39
|
+
excludes = binding.arg
|
|
40
|
+
} else if (isElement(binding.arg)) {
|
|
41
|
+
// due to current implementation on binding type is wrong the type casting is necessary here
|
|
42
|
+
excludes.push(binding.arg as unknown as HTMLElement)
|
|
43
|
+
}
|
|
44
|
+
return function (mouseup, mousedown) {
|
|
45
|
+
const popperRef = (
|
|
46
|
+
binding.instance as ComponentPublicInstance<{
|
|
47
|
+
popperRef: HTMLElement
|
|
48
|
+
}>
|
|
49
|
+
).popperRef
|
|
50
|
+
const mouseUpTarget = mouseup.target as Node
|
|
51
|
+
const mouseDownTarget = mousedown?.target as Node
|
|
52
|
+
const isBound = !binding || !binding.instance
|
|
53
|
+
const isTargetExists = !mouseUpTarget || !mouseDownTarget
|
|
54
|
+
const isContainedByEl =
|
|
55
|
+
el.contains(mouseUpTarget) || el.contains(mouseDownTarget)
|
|
56
|
+
const isSelf = el === mouseUpTarget
|
|
57
|
+
|
|
58
|
+
const isTargetExcluded =
|
|
59
|
+
(excludes.length &&
|
|
60
|
+
excludes.some((item) => item?.contains(mouseUpTarget))) ||
|
|
61
|
+
(excludes.length && excludes.includes(mouseDownTarget as HTMLElement))
|
|
62
|
+
const isContainedByPopper =
|
|
63
|
+
popperRef &&
|
|
64
|
+
(popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget))
|
|
65
|
+
if (
|
|
66
|
+
isBound ||
|
|
67
|
+
isTargetExists ||
|
|
68
|
+
isContainedByEl ||
|
|
69
|
+
isSelf ||
|
|
70
|
+
isTargetExcluded ||
|
|
71
|
+
isContainedByPopper
|
|
72
|
+
) {
|
|
73
|
+
return
|
|
74
|
+
}
|
|
75
|
+
binding.value(mouseup, mousedown)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const ClickOutside: ObjectDirective = {
|
|
80
|
+
beforeMount(el: HTMLElement, binding: DirectiveBinding) {
|
|
81
|
+
// there could be multiple handlers on the element
|
|
82
|
+
if (!nodeList.has(el)) {
|
|
83
|
+
nodeList.set(el, [])
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
nodeList.get(el)!.push({
|
|
87
|
+
documentHandler: createDocumentHandler(el, binding),
|
|
88
|
+
bindingFn: binding.value,
|
|
89
|
+
})
|
|
90
|
+
},
|
|
91
|
+
updated(el: HTMLElement, binding: DirectiveBinding) {
|
|
92
|
+
if (!nodeList.has(el)) {
|
|
93
|
+
nodeList.set(el, [])
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const handlers = nodeList.get(el)!
|
|
97
|
+
const oldHandlerIndex = handlers.findIndex(
|
|
98
|
+
(item) => item.bindingFn === binding.oldValue
|
|
99
|
+
)
|
|
100
|
+
const newHandler = {
|
|
101
|
+
documentHandler: createDocumentHandler(el, binding),
|
|
102
|
+
bindingFn: binding.value,
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (oldHandlerIndex >= 0) {
|
|
106
|
+
// replace the old handler to the new handler
|
|
107
|
+
handlers.splice(oldHandlerIndex, 1, newHandler)
|
|
108
|
+
} else {
|
|
109
|
+
handlers.push(newHandler)
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
unmounted(el: HTMLElement) {
|
|
113
|
+
// remove all listeners when a component unmounted
|
|
114
|
+
nodeList.delete(el)
|
|
115
|
+
},
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export default ClickOutside
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import { baseOption } from "../base"
|
|
2
|
-
export const baseBarOption = {
|
|
3
|
-
...baseOption,
|
|
4
|
-
color: [
|
|
5
|
-
'rgba(77, 100, 255, 1)',
|
|
6
|
-
"rgba(255, 173, 44, 1)",
|
|
7
|
-
"rgba(30, 183, 173, 1)",
|
|
8
|
-
"rgba(255, 146, 24, 1)",
|
|
9
|
-
"rgba(66, 166, 255, 1)",
|
|
10
|
-
"rgba(136, 206, 119, 1)",
|
|
11
|
-
],
|
|
12
|
-
axisPointer: {
|
|
13
|
-
lineStyle: {
|
|
14
|
-
opacity: 0
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
series: []
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const seriesItem = {
|
|
21
|
-
name: "",
|
|
22
|
-
type: 'bar',
|
|
23
|
-
silent: true,
|
|
24
|
-
barWidth: 28,
|
|
25
|
-
barGap: '50%',
|
|
26
|
-
barCategoryGap: 0,
|
|
27
|
-
label: {
|
|
28
|
-
show: false,
|
|
29
|
-
position: "outside",
|
|
30
|
-
fontSize: 14,
|
|
31
|
-
color: '#141617',
|
|
32
|
-
fontWeight: 400,
|
|
33
|
-
},
|
|
34
|
-
emphasis: {
|
|
35
|
-
label: {
|
|
36
|
-
show: false,
|
|
37
|
-
position: "outside",
|
|
38
|
-
fontSize: 14,
|
|
39
|
-
color: '#141617',
|
|
40
|
-
fontWeight: 400,
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
itemStyle: {
|
|
44
|
-
borderRadius: [4, 4, 0, 0],
|
|
45
|
-
borderWidth: 4,
|
|
46
|
-
borderColor: {
|
|
47
|
-
type: 'linear',
|
|
48
|
-
x: 0,
|
|
49
|
-
y: 0,
|
|
50
|
-
x2: 0,
|
|
51
|
-
y2: 1,
|
|
52
|
-
colorStops: [{
|
|
53
|
-
offset: 0, color: '#999CFF' // 0% 处的颜色
|
|
54
|
-
}, {
|
|
55
|
-
offset: 1, color: '#696EFF' // 100% 处的颜色
|
|
56
|
-
}],
|
|
57
|
-
global: false // 缺省为 false
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
labelLayout: {
|
|
61
|
-
draggable: true,
|
|
62
|
-
},
|
|
63
|
-
data: [],
|
|
1
|
+
import { baseOption } from "../base"
|
|
2
|
+
export const baseBarOption = {
|
|
3
|
+
...baseOption,
|
|
4
|
+
color: [
|
|
5
|
+
'rgba(77, 100, 255, 1)',
|
|
6
|
+
"rgba(255, 173, 44, 1)",
|
|
7
|
+
"rgba(30, 183, 173, 1)",
|
|
8
|
+
"rgba(255, 146, 24, 1)",
|
|
9
|
+
"rgba(66, 166, 255, 1)",
|
|
10
|
+
"rgba(136, 206, 119, 1)",
|
|
11
|
+
],
|
|
12
|
+
axisPointer: {
|
|
13
|
+
lineStyle: {
|
|
14
|
+
opacity: 0
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
series: []
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const seriesItem = {
|
|
21
|
+
name: "",
|
|
22
|
+
type: 'bar',
|
|
23
|
+
silent: true,
|
|
24
|
+
barWidth: 28,
|
|
25
|
+
barGap: '50%',
|
|
26
|
+
barCategoryGap: 0,
|
|
27
|
+
label: {
|
|
28
|
+
show: false,
|
|
29
|
+
position: "outside",
|
|
30
|
+
fontSize: 14,
|
|
31
|
+
color: '#141617',
|
|
32
|
+
fontWeight: 400,
|
|
33
|
+
},
|
|
34
|
+
emphasis: {
|
|
35
|
+
label: {
|
|
36
|
+
show: false,
|
|
37
|
+
position: "outside",
|
|
38
|
+
fontSize: 14,
|
|
39
|
+
color: '#141617',
|
|
40
|
+
fontWeight: 400,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
itemStyle: {
|
|
44
|
+
borderRadius: [4, 4, 0, 0],
|
|
45
|
+
borderWidth: 4,
|
|
46
|
+
borderColor: {
|
|
47
|
+
type: 'linear',
|
|
48
|
+
x: 0,
|
|
49
|
+
y: 0,
|
|
50
|
+
x2: 0,
|
|
51
|
+
y2: 1,
|
|
52
|
+
colorStops: [{
|
|
53
|
+
offset: 0, color: '#999CFF' // 0% 处的颜色
|
|
54
|
+
}, {
|
|
55
|
+
offset: 1, color: '#696EFF' // 100% 处的颜色
|
|
56
|
+
}],
|
|
57
|
+
global: false // 缺省为 false
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
labelLayout: {
|
|
61
|
+
draggable: true,
|
|
62
|
+
},
|
|
63
|
+
data: [],
|
|
64
64
|
}
|
package/packages/echarts/base.js
CHANGED
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
//存放基础通用配置
|
|
2
|
-
|
|
3
|
-
export const baseOption = {
|
|
4
|
-
tooltip: {
|
|
5
|
-
trigger: "axis",
|
|
6
|
-
// 设置边框样式
|
|
7
|
-
borderColor: '#fff',
|
|
8
|
-
borderWidth: 1,
|
|
9
|
-
borderRadius: 4,
|
|
10
|
-
// 设置阴影效果
|
|
11
|
-
shadowColor: 'rgba(102, 114, 144, 0.16)',
|
|
12
|
-
shadowBlur: 14,
|
|
13
|
-
shadowOffsetX: 0,
|
|
14
|
-
shadowOffsetY: 4,
|
|
15
|
-
padding: [14, 16, 18, 16],
|
|
16
|
-
formatter: (param) => {
|
|
17
|
-
let dom = `<div style="color: #141617;font-size:14px;font-weight:600;line-height: 18px;margin-bottom:18px;">${param[0].name}</div>`;
|
|
18
|
-
param.forEach((p, index) => {
|
|
19
|
-
dom += `<div style="color:#141617;font-size:14px;line-height: 18px;display:flex;align-items:center;margin-bottom:${index + 1 == param.length ? '' : '12px'};">
|
|
20
|
-
<span style="margin-right:32px;display:inline-flex;align-items:center">
|
|
21
|
-
<span style="display:inline-block;margin-right:8px;border-radius:6px;width:6px;height:6px;background-color:${p.color};"></span>
|
|
22
|
-
${p.seriesName}
|
|
23
|
-
</span>
|
|
24
|
-
<span>${p.value}</span>
|
|
25
|
-
</div>`
|
|
26
|
-
})
|
|
27
|
-
return dom
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
legend: {
|
|
31
|
-
show: true,
|
|
32
|
-
bottom: 0,
|
|
33
|
-
itemWidth: 14,
|
|
34
|
-
itemHeight: 14,
|
|
35
|
-
itemStyle: {
|
|
36
|
-
borderWidth: 0,
|
|
37
|
-
},
|
|
38
|
-
inactiveBorderWidth: 0,
|
|
39
|
-
itemGap: 32,
|
|
40
|
-
borderRadius: 2,
|
|
41
|
-
icon: "roundRect",
|
|
42
|
-
textStyle: {
|
|
43
|
-
fontWeight: 400,
|
|
44
|
-
fontSize: 14
|
|
45
|
-
},
|
|
46
|
-
data: [],
|
|
47
|
-
},
|
|
48
|
-
grid: {
|
|
49
|
-
left: 0,
|
|
50
|
-
right: 0,
|
|
51
|
-
bottom: 40,
|
|
52
|
-
top: 30,
|
|
53
|
-
containLabel: true,
|
|
54
|
-
},
|
|
55
|
-
xAxis: {
|
|
56
|
-
type: "category",
|
|
57
|
-
boundaryGap: true,
|
|
58
|
-
axisLabel: {
|
|
59
|
-
margin: 11,
|
|
60
|
-
color: "#8F99A3",
|
|
61
|
-
fontSize: 14,
|
|
62
|
-
},
|
|
63
|
-
axisTick: {
|
|
64
|
-
show: false,
|
|
65
|
-
},
|
|
66
|
-
axisLine: {
|
|
67
|
-
show: true,
|
|
68
|
-
lineStyle: {
|
|
69
|
-
color: "#A4AFBB",
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
axisPointer: {
|
|
73
|
-
snap: true,
|
|
74
|
-
},
|
|
75
|
-
data: [],
|
|
76
|
-
},
|
|
77
|
-
yAxis: {
|
|
78
|
-
type: "value",
|
|
79
|
-
inverse: false,
|
|
80
|
-
axisLine: {
|
|
81
|
-
show: false,
|
|
82
|
-
lineStyle: {
|
|
83
|
-
color: "#C0CCD7",
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
splitLine: {
|
|
87
|
-
show: true,
|
|
88
|
-
lineStyle: {
|
|
89
|
-
type: "dashed",
|
|
90
|
-
color: "#DDE2EB",
|
|
91
|
-
dashOffset: 10,
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
axisLabel: {
|
|
95
|
-
margin: 8,
|
|
96
|
-
color: "#8F99A3",
|
|
97
|
-
fontSize: 13,
|
|
98
|
-
},
|
|
99
|
-
},
|
|
1
|
+
//存放基础通用配置
|
|
2
|
+
|
|
3
|
+
export const baseOption = {
|
|
4
|
+
tooltip: {
|
|
5
|
+
trigger: "axis",
|
|
6
|
+
// 设置边框样式
|
|
7
|
+
borderColor: '#fff',
|
|
8
|
+
borderWidth: 1,
|
|
9
|
+
borderRadius: 4,
|
|
10
|
+
// 设置阴影效果
|
|
11
|
+
shadowColor: 'rgba(102, 114, 144, 0.16)',
|
|
12
|
+
shadowBlur: 14,
|
|
13
|
+
shadowOffsetX: 0,
|
|
14
|
+
shadowOffsetY: 4,
|
|
15
|
+
padding: [14, 16, 18, 16],
|
|
16
|
+
formatter: (param) => {
|
|
17
|
+
let dom = `<div style="color: #141617;font-size:14px;font-weight:600;line-height: 18px;margin-bottom:18px;">${param[0].name}</div>`;
|
|
18
|
+
param.forEach((p, index) => {
|
|
19
|
+
dom += `<div style="color:#141617;font-size:14px;line-height: 18px;display:flex;align-items:center;margin-bottom:${index + 1 == param.length ? '' : '12px'};">
|
|
20
|
+
<span style="margin-right:32px;display:inline-flex;align-items:center">
|
|
21
|
+
<span style="display:inline-block;margin-right:8px;border-radius:6px;width:6px;height:6px;background-color:${p.color};"></span>
|
|
22
|
+
${p.seriesName}
|
|
23
|
+
</span>
|
|
24
|
+
<span>${p.value}</span>
|
|
25
|
+
</div>`
|
|
26
|
+
})
|
|
27
|
+
return dom
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
legend: {
|
|
31
|
+
show: true,
|
|
32
|
+
bottom: 0,
|
|
33
|
+
itemWidth: 14,
|
|
34
|
+
itemHeight: 14,
|
|
35
|
+
itemStyle: {
|
|
36
|
+
borderWidth: 0,
|
|
37
|
+
},
|
|
38
|
+
inactiveBorderWidth: 0,
|
|
39
|
+
itemGap: 32,
|
|
40
|
+
borderRadius: 2,
|
|
41
|
+
icon: "roundRect",
|
|
42
|
+
textStyle: {
|
|
43
|
+
fontWeight: 400,
|
|
44
|
+
fontSize: 14
|
|
45
|
+
},
|
|
46
|
+
data: [],
|
|
47
|
+
},
|
|
48
|
+
grid: {
|
|
49
|
+
left: 0,
|
|
50
|
+
right: 0,
|
|
51
|
+
bottom: 40,
|
|
52
|
+
top: 30,
|
|
53
|
+
containLabel: true,
|
|
54
|
+
},
|
|
55
|
+
xAxis: {
|
|
56
|
+
type: "category",
|
|
57
|
+
boundaryGap: true,
|
|
58
|
+
axisLabel: {
|
|
59
|
+
margin: 11,
|
|
60
|
+
color: "#8F99A3",
|
|
61
|
+
fontSize: 14,
|
|
62
|
+
},
|
|
63
|
+
axisTick: {
|
|
64
|
+
show: false,
|
|
65
|
+
},
|
|
66
|
+
axisLine: {
|
|
67
|
+
show: true,
|
|
68
|
+
lineStyle: {
|
|
69
|
+
color: "#A4AFBB",
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
axisPointer: {
|
|
73
|
+
snap: true,
|
|
74
|
+
},
|
|
75
|
+
data: [],
|
|
76
|
+
},
|
|
77
|
+
yAxis: {
|
|
78
|
+
type: "value",
|
|
79
|
+
inverse: false,
|
|
80
|
+
axisLine: {
|
|
81
|
+
show: false,
|
|
82
|
+
lineStyle: {
|
|
83
|
+
color: "#C0CCD7",
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
splitLine: {
|
|
87
|
+
show: true,
|
|
88
|
+
lineStyle: {
|
|
89
|
+
type: "dashed",
|
|
90
|
+
color: "#DDE2EB",
|
|
91
|
+
dashOffset: 10,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
axisLabel: {
|
|
95
|
+
margin: 8,
|
|
96
|
+
color: "#8F99A3",
|
|
97
|
+
fontSize: 13,
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
100
|
}
|