ct-component-plus 0.0.1
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 -0
- package/package.json +37 -0
- package/packages/components/button/index.js +9 -0
- package/packages/components/button/src/button.vue +172 -0
- package/packages/components/cascader/index.js +8 -0
- package/packages/components/cascader/src/cascader.vue +224 -0
- package/packages/components/cascader/src/ct-cascader.vue +261 -0
- package/packages/components/cascader/src/index.js +51 -0
- package/packages/components/checkbox/index.js +8 -0
- package/packages/components/checkbox/src/checkbox.vue +48 -0
- package/packages/components/checkbox/src/index.js +13 -0
- package/packages/components/date-picker/index.js +9 -0
- package/packages/components/date-picker/src/clear-icon.vue +3 -0
- package/packages/components/date-picker/src/date-icon.vue +3 -0
- package/packages/components/date-picker/src/date-picker.vue +77 -0
- package/packages/components/date-picker/src/index.js +34 -0
- package/packages/components/dialog/index.js +9 -0
- package/packages/components/dialog/src/dialog.vue +104 -0
- package/packages/components/empty/index.js +9 -0
- package/packages/components/empty/src/empty.vue +98 -0
- package/packages/components/index.js +71 -0
- package/packages/components/input/index.js +8 -0
- package/packages/components/input/src/index.js +14 -0
- package/packages/components/input/src/input.vue +107 -0
- package/packages/components/input-range/index.js +8 -0
- package/packages/components/input-range/src/index.js +30 -0
- package/packages/components/input-range/src/input-range.vue +234 -0
- package/packages/components/menu/index.js +8 -0
- package/packages/components/menu/src/assets/plus_line.svg +1 -0
- package/packages/components/menu/src/item.vue +47 -0
- package/packages/components/menu/src/link.vue +29 -0
- package/packages/components/menu/src/logo.vue +26 -0
- package/packages/components/menu/src/menu-item.vue +104 -0
- package/packages/components/menu/src/menu.vue +192 -0
- package/packages/components/menu/src/utils/index.js +5 -0
- package/packages/components/message/icon/ErrorIcon.vue +25 -0
- package/packages/components/message/icon/InfoIcon.vue +25 -0
- package/packages/components/message/icon/SuccessIcon.vue +25 -0
- package/packages/components/message/icon/WarningIcon.vue +25 -0
- package/packages/components/message/index.js +9 -0
- package/packages/components/message/src/method.js +55 -0
- package/packages/components/message-box/index.js +8 -0
- package/packages/components/message-box/src/message-box.vue +108 -0
- package/packages/components/pagination/index.js +8 -0
- package/packages/components/pagination/src/pagination.vue +37 -0
- package/packages/components/radio/index.js +8 -0
- package/packages/components/radio/src/index.js +13 -0
- package/packages/components/radio/src/radio.vue +48 -0
- package/packages/components/search-box/index.js +25 -0
- package/packages/components/search-box/src/index.js +30 -0
- package/packages/components/search-box/src/search-box.vue +240 -0
- package/packages/components/search-box/src/slot.vue +5 -0
- package/packages/components/select/index.js +8 -0
- package/packages/components/select/src/arrow-down.vue +3 -0
- package/packages/components/select/src/clear-icon.vue +3 -0
- package/packages/components/select/src/empty.vue +14 -0
- package/packages/components/select/src/index.js +52 -0
- package/packages/components/select/src/select.vue +331 -0
- package/packages/components/table/index.js +8 -0
- package/packages/components/table/src/TableSort.vue +179 -0
- package/packages/components/table/src/index.js +47 -0
- package/packages/components/table/src/table.vue +249 -0
- package/packages/components/tabs/index.js +8 -0
- package/packages/components/tabs/src/tabs.vue +226 -0
- package/packages/components/year-select/index.js +8 -0
- package/packages/components/year-select/src/index.js +45 -0
- package/packages/components/year-select/src/year-select.vue +274 -0
- package/packages/constants/aria.ts +17 -0
- package/packages/constants/index.ts +1 -0
- package/packages/directives/click-outside/index.ts +118 -0
- package/packages/directives/index.js +1 -0
- package/packages/echarts/bar/index.js +64 -0
- package/packages/echarts/base.js +96 -0
- package/packages/echarts/line/index.js +107 -0
- package/packages/hooks/index.js +6 -0
- package/packages/hooks/use-buried/index.js +47 -0
- package/packages/hooks/use-checked-all/index.js +37 -0
- package/packages/hooks/use-echarts/index.js +2 -0
- package/packages/hooks/use-echarts/use-bar/index.js +67 -0
- package/packages/hooks/use-echarts/use-line/index.js +83 -0
- package/packages/hooks/use-namespace/index.js +66 -0
- package/packages/hooks/use-search-component/index.js +29 -0
- package/packages/style/element.less +600 -0
- package/packages/style/init.less +114 -0
- package/packages/utils/index.js +2 -0
- package/packages/utils/operate.js +78 -0
- package/packages/utils/types.js +35 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="[ns.b(), ns.is('disabled', disabled), ns.is('multiple', multiple)]"
|
|
4
|
+
>
|
|
5
|
+
<div :class="[ns.e('wrapper')]">
|
|
6
|
+
<span :class="[ns.e('prefix')]">
|
|
7
|
+
<slot name="prefix"></slot>
|
|
8
|
+
</span>
|
|
9
|
+
<el-select
|
|
10
|
+
ref="selectRef1"
|
|
11
|
+
:class="[ns.e('select'), ns.is('start')]"
|
|
12
|
+
v-model="selectYearS"
|
|
13
|
+
:placeholder="startPlaceholder"
|
|
14
|
+
:disabled="disabled"
|
|
15
|
+
filterable
|
|
16
|
+
v-bind="eventList0"
|
|
17
|
+
>
|
|
18
|
+
<el-option
|
|
19
|
+
v-for="item in yearList"
|
|
20
|
+
:key="item.value"
|
|
21
|
+
:label="item.label"
|
|
22
|
+
:value="item.value"
|
|
23
|
+
>
|
|
24
|
+
</el-option>
|
|
25
|
+
</el-select>
|
|
26
|
+
<template v-if="multiple">
|
|
27
|
+
<span :class="[ns.e('separator')]">
|
|
28
|
+
<slot name="separator">
|
|
29
|
+
<template v-if="isString(separator)">{{ separator }}</template>
|
|
30
|
+
<component v-else :is="separator" />
|
|
31
|
+
</slot>
|
|
32
|
+
</span>
|
|
33
|
+
<el-select
|
|
34
|
+
ref="selectRef2"
|
|
35
|
+
:class="[ns.e('select'), ns.is('end')]"
|
|
36
|
+
v-model="selectYearE"
|
|
37
|
+
:placeholder="endPlaceholder"
|
|
38
|
+
filterable
|
|
39
|
+
:disabled="disabled"
|
|
40
|
+
:filter-method="filterHandleE"
|
|
41
|
+
v-bind="eventList1"
|
|
42
|
+
>
|
|
43
|
+
<el-option
|
|
44
|
+
v-for="item in yearList"
|
|
45
|
+
:key="item.value"
|
|
46
|
+
:label="item.label"
|
|
47
|
+
:value="item.value"
|
|
48
|
+
>
|
|
49
|
+
</el-option>
|
|
50
|
+
</el-select>
|
|
51
|
+
</template>
|
|
52
|
+
<span :class="[ns.e('suffix')]">
|
|
53
|
+
<slot name="suffix"></slot>
|
|
54
|
+
</span>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<script setup>
|
|
60
|
+
import { computed, onMounted, ref } from "vue";
|
|
61
|
+
import { useNamespace, useBuriedParams } from "../../../hooks";
|
|
62
|
+
import { isArray, isString } from "../../../utils";
|
|
63
|
+
import { yearSelectEmits, yearSelectProps } from "./index";
|
|
64
|
+
const props = defineProps(yearSelectProps);
|
|
65
|
+
const emit = defineEmits(yearSelectEmits);
|
|
66
|
+
|
|
67
|
+
const ns = useNamespace("year-select");
|
|
68
|
+
|
|
69
|
+
const selectRef1 = ref(null);
|
|
70
|
+
const selectRef2 = ref(null);
|
|
71
|
+
const yearList = ref([]);
|
|
72
|
+
const selectYearS = computed({
|
|
73
|
+
get() {
|
|
74
|
+
if (props.multiple) {
|
|
75
|
+
if (isArray(props.modelValue)) {
|
|
76
|
+
return props.modelValue[0];
|
|
77
|
+
}
|
|
78
|
+
return "";
|
|
79
|
+
}
|
|
80
|
+
return props.modelValue;
|
|
81
|
+
},
|
|
82
|
+
set(value) {
|
|
83
|
+
let newValue = "";
|
|
84
|
+
if (props.multiple) {
|
|
85
|
+
newValue = [toNumber(value), toNumber(selectYearE)];
|
|
86
|
+
} else {
|
|
87
|
+
newValue = toNumber(value);
|
|
88
|
+
}
|
|
89
|
+
handleNewValue(newValue);
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
const selectYearE = computed({
|
|
93
|
+
get() {
|
|
94
|
+
if (isArray(props.modelValue)) {
|
|
95
|
+
return props.modelValue[1];
|
|
96
|
+
}
|
|
97
|
+
return "";
|
|
98
|
+
},
|
|
99
|
+
set(value) {
|
|
100
|
+
let newValue = [toNumber(selectYearS), toNumber(value)];
|
|
101
|
+
handleNewValue(newValue);
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const handleNewValue = (newValue) => {
|
|
106
|
+
let newArr = JSON.parse(JSON.stringify(newValue));
|
|
107
|
+
if (isArray(newValue)) {
|
|
108
|
+
if (newArr[0] && newArr[1] && newArr[0] > newArr[1]) {
|
|
109
|
+
newArr = [newValue[1], newValue[0]];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
emit("update:modelValue", newArr);
|
|
113
|
+
emit("change", newArr);
|
|
114
|
+
};
|
|
115
|
+
const toNumber = (value) => {
|
|
116
|
+
const res = value.value || value;
|
|
117
|
+
const num = Number(res);
|
|
118
|
+
return isNaN(num) ? "" : num;
|
|
119
|
+
};
|
|
120
|
+
const judgeYear = (str) => {
|
|
121
|
+
let reg = /\d{4}/;
|
|
122
|
+
return reg.test(str);
|
|
123
|
+
};
|
|
124
|
+
const judgeRange = (str) => {
|
|
125
|
+
const range = props.range;
|
|
126
|
+
return str <= range[1] && range[0] <= str;
|
|
127
|
+
};
|
|
128
|
+
const getYearList = () => {
|
|
129
|
+
const yearRang = props.range;
|
|
130
|
+
const start = yearRang[0];
|
|
131
|
+
const end = yearRang[1];
|
|
132
|
+
let yearArr = [];
|
|
133
|
+
for (let i = end; i >= start; i--) {
|
|
134
|
+
yearArr.push({ label: i + "", value: i });
|
|
135
|
+
}
|
|
136
|
+
yearList.value = yearArr;
|
|
137
|
+
};
|
|
138
|
+
const filterHandleE = (str) => {
|
|
139
|
+
//处理结束年
|
|
140
|
+
if (judgeYear(str) && judgeRange(str)) {
|
|
141
|
+
selectYearE.value = str;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
const filterHandleS = (str) => {
|
|
145
|
+
//通过该方法把输入的年份放进数据里面
|
|
146
|
+
if (judgeYear(str) && judgeRange(str)) {
|
|
147
|
+
selectYearS.value = str;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const clearValue = () => {
|
|
151
|
+
selectYearS.value = "";
|
|
152
|
+
selectYearE.value = "";
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
// 绑定在select上的事件
|
|
156
|
+
const eventList0 = {
|
|
157
|
+
onChange: (value) => {
|
|
158
|
+
onChange(value, 0);
|
|
159
|
+
},
|
|
160
|
+
onVisibleChange: (value) => {
|
|
161
|
+
onVisibleChange(value, 0);
|
|
162
|
+
},
|
|
163
|
+
onBlur: (value) => {
|
|
164
|
+
onBlur(value, 0);
|
|
165
|
+
},
|
|
166
|
+
onFocus: (value) => {
|
|
167
|
+
onFocus(value, 0);
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
const eventList1 = {
|
|
171
|
+
onChange: (value) => {
|
|
172
|
+
onChange(value, 1);
|
|
173
|
+
},
|
|
174
|
+
onVisibleChange: (value) => {
|
|
175
|
+
onVisibleChange(value, 1);
|
|
176
|
+
},
|
|
177
|
+
onBlur: (value) => {
|
|
178
|
+
onBlur(value, 1);
|
|
179
|
+
},
|
|
180
|
+
onFocus: (value) => {
|
|
181
|
+
onFocus(value, 1);
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
const onChange = (value, index) => {
|
|
185
|
+
emit("changeSelect", value, index);
|
|
186
|
+
};
|
|
187
|
+
const onVisibleChange = (value, index) => {
|
|
188
|
+
emit("visible-change", value, index);
|
|
189
|
+
};
|
|
190
|
+
const onBlur = (value, index) => {
|
|
191
|
+
emit("blur", value, index);
|
|
192
|
+
};
|
|
193
|
+
const onFocus = (value, index) => {
|
|
194
|
+
emit("focus", value, index);
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
useBuriedParams(props, emit);
|
|
198
|
+
defineExpose({
|
|
199
|
+
ref: props.multiple ? [selectRef1, selectRef2] : selectRef1,
|
|
200
|
+
clearValue,
|
|
201
|
+
yearList,
|
|
202
|
+
});
|
|
203
|
+
onMounted(() => {
|
|
204
|
+
getYearList();
|
|
205
|
+
});
|
|
206
|
+
</script>
|
|
207
|
+
<style lang='less'>
|
|
208
|
+
.ct-year-select {
|
|
209
|
+
--el-select-input-focus-border-color: transparent;
|
|
210
|
+
--ct-year-select-select-inner-box-shadow: none;
|
|
211
|
+
position: relative;
|
|
212
|
+
display: inline-flex;
|
|
213
|
+
width: var(--ct-component-width);
|
|
214
|
+
font-size: var(--ct-font-size);
|
|
215
|
+
color: var(--ct-border-color);
|
|
216
|
+
box-sizing: border-box;
|
|
217
|
+
vertical-align: middle;
|
|
218
|
+
@R: .ct-year-select;
|
|
219
|
+
&:not(.is-disabled):hover {
|
|
220
|
+
--ct-component-border-color: var(--ct-color-grey-transition);
|
|
221
|
+
}
|
|
222
|
+
&.is-disabled {
|
|
223
|
+
cursor: not-allowed;
|
|
224
|
+
--ct-component-fill-color: var(--ct-component-disabled-bg-color);
|
|
225
|
+
}
|
|
226
|
+
&__wrapper {
|
|
227
|
+
display: inline-flex;
|
|
228
|
+
flex-grow: 1;
|
|
229
|
+
align-items: center;
|
|
230
|
+
justify-content: center;
|
|
231
|
+
padding: 1px 0;
|
|
232
|
+
background-color: var(--ct-component-fill-color);
|
|
233
|
+
background-image: none;
|
|
234
|
+
border-radius: var(--ct-component-border-radius);
|
|
235
|
+
transition: var(--el-transition-box-shadow);
|
|
236
|
+
transform: translate3d(0, 0, 0);
|
|
237
|
+
box-shadow: 0 0 0 1px var(--ct-component-border-color) inset;
|
|
238
|
+
&:focus-within {
|
|
239
|
+
--ct-component-border-color: var(--ct-color-primary);
|
|
240
|
+
.el-input {
|
|
241
|
+
.el-icon,
|
|
242
|
+
.ct-icon {
|
|
243
|
+
color: var(--ct-component-border-color);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
&__select {
|
|
249
|
+
width: 50%;
|
|
250
|
+
flex-grow: 1;
|
|
251
|
+
padding: 0 1px;
|
|
252
|
+
-webkit-appearance: none;
|
|
253
|
+
color: var(--ct-component-color);
|
|
254
|
+
font-size: inherit;
|
|
255
|
+
height: var(--ct-component-inner-height);
|
|
256
|
+
line-height: var(--ct-component-inner-height);
|
|
257
|
+
outline: 0;
|
|
258
|
+
border: none;
|
|
259
|
+
background: 0 0;
|
|
260
|
+
box-sizing: border-box;
|
|
261
|
+
.el-input {
|
|
262
|
+
--el-input-height: var(--ct-component-inner-height);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
& &__select {
|
|
266
|
+
.el-input.is-focus,
|
|
267
|
+
.el-input {
|
|
268
|
+
.el-input__wrapper {
|
|
269
|
+
box-shadow: var(--ct-year-select-select-inner-box-shadow) !important;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const EVENT_CODE = {
|
|
2
|
+
tab: 'Tab',
|
|
3
|
+
enter: 'Enter',
|
|
4
|
+
space: 'Space',
|
|
5
|
+
left: 'ArrowLeft', // 37
|
|
6
|
+
up: 'ArrowUp', // 38
|
|
7
|
+
right: 'ArrowRight', // 39
|
|
8
|
+
down: 'ArrowDown', // 40
|
|
9
|
+
esc: 'Escape',
|
|
10
|
+
delete: 'Delete',
|
|
11
|
+
backspace: 'Backspace',
|
|
12
|
+
numpadEnter: 'NumpadEnter',
|
|
13
|
+
pageUp: 'PageUp',
|
|
14
|
+
pageDown: 'PageDown',
|
|
15
|
+
home: 'Home',
|
|
16
|
+
end: 'End',
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './aria'
|
|
@@ -0,0 +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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ClickOutside } from './click-outside'
|
|
@@ -0,0 +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: [],
|
|
64
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
itemGap: 32,
|
|
36
|
+
borderRadius: 2,
|
|
37
|
+
icon: "roundRect",
|
|
38
|
+
textStyle: {
|
|
39
|
+
fontWeight: 400,
|
|
40
|
+
fontSize: 14
|
|
41
|
+
},
|
|
42
|
+
data: [],
|
|
43
|
+
},
|
|
44
|
+
grid: {
|
|
45
|
+
left: 0,
|
|
46
|
+
right: 0,
|
|
47
|
+
bottom: 40,
|
|
48
|
+
top: 30,
|
|
49
|
+
containLabel: true,
|
|
50
|
+
},
|
|
51
|
+
xAxis: {
|
|
52
|
+
type: "category",
|
|
53
|
+
boundaryGap: true,
|
|
54
|
+
axisLabel: {
|
|
55
|
+
margin: 11,
|
|
56
|
+
color: "#8F99A3",
|
|
57
|
+
fontSize: 14,
|
|
58
|
+
},
|
|
59
|
+
axisTick: {
|
|
60
|
+
show: false,
|
|
61
|
+
},
|
|
62
|
+
axisLine: {
|
|
63
|
+
show: true,
|
|
64
|
+
lineStyle: {
|
|
65
|
+
color: "#A4AFBB",
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
axisPointer: {
|
|
69
|
+
snap: true,
|
|
70
|
+
},
|
|
71
|
+
data: [],
|
|
72
|
+
},
|
|
73
|
+
yAxis: {
|
|
74
|
+
type: "value",
|
|
75
|
+
inverse: false,
|
|
76
|
+
axisLine: {
|
|
77
|
+
show: false,
|
|
78
|
+
lineStyle: {
|
|
79
|
+
color: "#C0CCD7",
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
splitLine: {
|
|
83
|
+
show: true,
|
|
84
|
+
lineStyle: {
|
|
85
|
+
type: "dashed",
|
|
86
|
+
color: "#DDE2EB",
|
|
87
|
+
dashOffset: 10,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
axisLabel: {
|
|
91
|
+
margin: 8,
|
|
92
|
+
color: "#8F99A3",
|
|
93
|
+
fontSize: 13,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { baseOption } from "../base";
|
|
2
|
+
export const baseLineOption = {
|
|
3
|
+
color: [
|
|
4
|
+
'rgba(77, 100, 255, 1)',
|
|
5
|
+
"rgba(255, 173, 44, 1)",
|
|
6
|
+
"rgba(30, 183, 173, 1)",
|
|
7
|
+
"rgba(255, 146, 24, 1)",
|
|
8
|
+
"rgba(66, 166, 255, 1)",
|
|
9
|
+
"rgba(136, 206, 119, 1)",
|
|
10
|
+
],
|
|
11
|
+
axisPointer: {
|
|
12
|
+
lineStyle: {
|
|
13
|
+
color: "#D8DEE8",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
...baseOption,
|
|
17
|
+
series: [],
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const seriesItem = {
|
|
21
|
+
name: "",
|
|
22
|
+
type: "line",
|
|
23
|
+
symbol: "circle",
|
|
24
|
+
// showSymbol: false,
|
|
25
|
+
symbolSize: 6,
|
|
26
|
+
lineStyle: {
|
|
27
|
+
width: 3,
|
|
28
|
+
},
|
|
29
|
+
itemStyle: {
|
|
30
|
+
borderColor: "#fff",
|
|
31
|
+
borderWidth: 2,
|
|
32
|
+
shadowColor: "rgba(72, 80, 119, 0.12)",
|
|
33
|
+
shadowBlur: 4,
|
|
34
|
+
shadowOffsetX: 0,
|
|
35
|
+
shadowOffsetY: 2,
|
|
36
|
+
},
|
|
37
|
+
emphasis: {
|
|
38
|
+
scale: 1.33,
|
|
39
|
+
itemStyle: {
|
|
40
|
+
borderColor: "#fff",
|
|
41
|
+
borderWidth: 2.25,
|
|
42
|
+
shadowColor: "rgba(72,80,119,0.22)",
|
|
43
|
+
shadowBlur: 8,
|
|
44
|
+
shadowOffsetX: 0,
|
|
45
|
+
shadowOffsetY: 2,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
data: [],
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const areaSeriesItem = {
|
|
52
|
+
name: "",
|
|
53
|
+
type: "line",
|
|
54
|
+
symbol: "circle",
|
|
55
|
+
showSymbol: true,
|
|
56
|
+
symbolSize: 6,
|
|
57
|
+
lineStyle: {
|
|
58
|
+
width: 3,
|
|
59
|
+
},
|
|
60
|
+
label: {
|
|
61
|
+
show: false
|
|
62
|
+
},
|
|
63
|
+
areaStyle: {
|
|
64
|
+
color: {
|
|
65
|
+
type: "linear",
|
|
66
|
+
x: 0,
|
|
67
|
+
y: 0,
|
|
68
|
+
x2: 0,
|
|
69
|
+
y2: 1,
|
|
70
|
+
colorStops: [
|
|
71
|
+
{
|
|
72
|
+
offset: 0,
|
|
73
|
+
color: "rgba(77, 100, 255, 0.22)", // 0% 处的颜色
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
offset: 1,
|
|
77
|
+
color: "rgba(77, 100, 255, 0)", // 100% 处的颜色
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
global: false, // 缺省为 false
|
|
81
|
+
},
|
|
82
|
+
origin: "start",
|
|
83
|
+
},
|
|
84
|
+
itemStyle: {
|
|
85
|
+
borderColor: "#fff",
|
|
86
|
+
borderWidth: 2,
|
|
87
|
+
shadowColor: "rgba(72, 80, 119, 0.22)",
|
|
88
|
+
shadowBlur: 4,
|
|
89
|
+
shadowOffsetX: 0,
|
|
90
|
+
shadowOffsetY: 2,
|
|
91
|
+
},
|
|
92
|
+
emphasis: {
|
|
93
|
+
scale: 1.33,
|
|
94
|
+
label: {
|
|
95
|
+
show: false
|
|
96
|
+
},
|
|
97
|
+
itemStyle: {
|
|
98
|
+
borderColor: "#fff",
|
|
99
|
+
borderWidth: 2.25,
|
|
100
|
+
shadowColor: "rgba(72,80,119,0.22)",
|
|
101
|
+
shadowBlur: 8,
|
|
102
|
+
shadowOffsetX: 0,
|
|
103
|
+
shadowOffsetY: 2,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
data: [],
|
|
107
|
+
}
|