ct-component-plus 0.0.42 → 0.0.43
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/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 -251
- 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 +70 -66
- package/packages/components/table/src/table.vue +287 -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/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/types.js +35 -35
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { buriedParamsKey, searchComponentProps } from '../../../hooks';
|
|
2
|
-
|
|
3
|
-
export const inputEmits = [
|
|
4
|
-
"update:modelValue",
|
|
5
|
-
buriedParamsKey,
|
|
6
|
-
'blur',
|
|
7
|
-
'focus',
|
|
8
|
-
'change',
|
|
9
|
-
'input',
|
|
10
|
-
'clear'
|
|
11
|
-
];
|
|
12
|
-
export const inputProps = {
|
|
13
|
-
...searchComponentProps,
|
|
14
|
-
placeholder: {
|
|
15
|
-
type: Array,
|
|
16
|
-
default: () => [],
|
|
17
|
-
},
|
|
18
|
-
startPlaceholder: String,
|
|
19
|
-
endPlaceholder: String,
|
|
20
|
-
modelValue: {
|
|
21
|
-
type: Array,
|
|
22
|
-
default: () => [],
|
|
23
|
-
},
|
|
24
|
-
disabled: Boolean,
|
|
25
|
-
clearable: Boolean,
|
|
26
|
-
separator: {
|
|
27
|
-
type: [String, Object],
|
|
28
|
-
default: '-'
|
|
29
|
-
}
|
|
1
|
+
import { buriedParamsKey, searchComponentProps } from '../../../hooks';
|
|
2
|
+
|
|
3
|
+
export const inputEmits = [
|
|
4
|
+
"update:modelValue",
|
|
5
|
+
buriedParamsKey,
|
|
6
|
+
'blur',
|
|
7
|
+
'focus',
|
|
8
|
+
'change',
|
|
9
|
+
'input',
|
|
10
|
+
'clear'
|
|
11
|
+
];
|
|
12
|
+
export const inputProps = {
|
|
13
|
+
...searchComponentProps,
|
|
14
|
+
placeholder: {
|
|
15
|
+
type: Array,
|
|
16
|
+
default: () => [],
|
|
17
|
+
},
|
|
18
|
+
startPlaceholder: String,
|
|
19
|
+
endPlaceholder: String,
|
|
20
|
+
modelValue: {
|
|
21
|
+
type: Array,
|
|
22
|
+
default: () => [],
|
|
23
|
+
},
|
|
24
|
+
disabled: Boolean,
|
|
25
|
+
clearable: Boolean,
|
|
26
|
+
separator: {
|
|
27
|
+
type: [String, Object],
|
|
28
|
+
default: '-'
|
|
29
|
+
}
|
|
30
30
|
}
|
|
@@ -1,234 +1,234 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
:class="[
|
|
4
|
-
ns.b(),
|
|
5
|
-
ns.is('disabled', disabled),
|
|
6
|
-
ns.is('clearable', clearable),
|
|
7
|
-
]"
|
|
8
|
-
>
|
|
9
|
-
<div :class="[ns.e('wrapper')]">
|
|
10
|
-
<span :class="[ns.e('prefix')]">
|
|
11
|
-
<slot name="prefix"></slot>
|
|
12
|
-
</span>
|
|
13
|
-
<input
|
|
14
|
-
ref="inputRef1"
|
|
15
|
-
:class="[ns.e('inner')]"
|
|
16
|
-
:placeholder="placeholderShow[0]"
|
|
17
|
-
v-model="inputModel1"
|
|
18
|
-
:disabled="disabled"
|
|
19
|
-
@blur="handleBlur($event, 0)"
|
|
20
|
-
@focus="handleFocus($event, 0)"
|
|
21
|
-
@keydown.enter="handleEnter($event, 0)"
|
|
22
|
-
/>
|
|
23
|
-
<span :class="[ns.e('separator')]">
|
|
24
|
-
<slot name="separator">
|
|
25
|
-
<template v-if="isString(separator)">{{ separator }}</template>
|
|
26
|
-
<component v-else :is="separator" />
|
|
27
|
-
</slot>
|
|
28
|
-
</span>
|
|
29
|
-
<input
|
|
30
|
-
ref="inputRef2"
|
|
31
|
-
:class="[ns.e('inner')]"
|
|
32
|
-
:placeholder="placeholderShow[1]"
|
|
33
|
-
v-model="inputModel2"
|
|
34
|
-
:disabled="disabled"
|
|
35
|
-
@blur="handleBlur($event, 1)"
|
|
36
|
-
@focus="handleFocus($event, 1)"
|
|
37
|
-
@keydown.enter="handleEnter($event, 1)"
|
|
38
|
-
/>
|
|
39
|
-
<span :class="[ns.e('suffix')]">
|
|
40
|
-
<slot name="suffix"></slot>
|
|
41
|
-
<ct-icon
|
|
42
|
-
v-if="clearable && haveValue"
|
|
43
|
-
:class="[ns.e('clearable')]"
|
|
44
|
-
name="close_line"
|
|
45
|
-
@click="clearValue"
|
|
46
|
-
/>
|
|
47
|
-
</span>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
</template>
|
|
51
|
-
|
|
52
|
-
<script setup>
|
|
53
|
-
import { onMounted, computed, ref, watch, nextTick } from "vue";
|
|
54
|
-
import { useNamespace, useBuriedParams } from "../../../hooks";
|
|
55
|
-
import { isArray, isString } from "../../../utils";
|
|
56
|
-
import { inputEmits, inputProps } from "./index";
|
|
57
|
-
const props = defineProps(inputProps);
|
|
58
|
-
const emit = defineEmits(inputEmits);
|
|
59
|
-
|
|
60
|
-
useBuriedParams(props, emit);
|
|
61
|
-
const ns = useNamespace("input-range");
|
|
62
|
-
|
|
63
|
-
const inputRef1 = ref(null);
|
|
64
|
-
const inputRef2 = ref(null);
|
|
65
|
-
const isChange = ref(false);
|
|
66
|
-
|
|
67
|
-
const inputModel1 = computed({
|
|
68
|
-
get() {
|
|
69
|
-
return isArray(props.modelValue) ? props.modelValue[0] : "";
|
|
70
|
-
},
|
|
71
|
-
set(newValue) {
|
|
72
|
-
emit("update:modelValue", [newValue, inputModel2.value || ""]);
|
|
73
|
-
},
|
|
74
|
-
});
|
|
75
|
-
const inputModel2 = computed({
|
|
76
|
-
get() {
|
|
77
|
-
return isArray(props.modelValue) ? props.modelValue[1] : "";
|
|
78
|
-
},
|
|
79
|
-
set(newValue) {
|
|
80
|
-
emit("update:modelValue", [inputModel1.value || "", newValue]);
|
|
81
|
-
},
|
|
82
|
-
});
|
|
83
|
-
const placeholderShow = computed(() => {
|
|
84
|
-
return isArray(props.placeholder)
|
|
85
|
-
? props.placeholder
|
|
86
|
-
: [props.startPlaceholder, props.endPlaceholder];
|
|
87
|
-
});
|
|
88
|
-
const haveValue = computed(() => {
|
|
89
|
-
return inputModel1.value || inputModel2.value;
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
watch(
|
|
93
|
-
() => props.modelValue,
|
|
94
|
-
(newValue) => {
|
|
95
|
-
isChange.value = true;
|
|
96
|
-
emit("input", newValue);
|
|
97
|
-
}
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
const emitChange = (e, index) => {
|
|
101
|
-
isChange.value && emit("change", props.modelValue, index, e);
|
|
102
|
-
isChange.value = false;
|
|
103
|
-
};
|
|
104
|
-
const handleEnter = (e, index) => {
|
|
105
|
-
emitChange(e, index);
|
|
106
|
-
};
|
|
107
|
-
const clearValue = () => {
|
|
108
|
-
emit("update:modelValue", []);
|
|
109
|
-
emit("clear");
|
|
110
|
-
};
|
|
111
|
-
const handleBlur = (e, index) => {
|
|
112
|
-
emit("blur", e, index);
|
|
113
|
-
emitChange(e, index);
|
|
114
|
-
};
|
|
115
|
-
const handleFocus = (e, index) => {
|
|
116
|
-
emit("focus", e, index);
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
const focus = async (index) => {
|
|
120
|
-
// see: https://github.com/ElemeFE/element/issues/18573
|
|
121
|
-
await nextTick();
|
|
122
|
-
if (inputRef1.value && !index) {
|
|
123
|
-
inputRef1.value.focus();
|
|
124
|
-
}
|
|
125
|
-
if (index == 1 && inputRef2.value) {
|
|
126
|
-
inputRef2.value.focus();
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const blur = (index) => {
|
|
131
|
-
const blurIndex = index === undefined ? [0, 1] : [index];
|
|
132
|
-
if (inputRef1.value && blurIndex.includes(0)) {
|
|
133
|
-
inputRef1.value.blur();
|
|
134
|
-
}
|
|
135
|
-
if (inputRef2.value && blurIndex.includes(1)) {
|
|
136
|
-
inputRef2.value.blur();
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
defineExpose({
|
|
141
|
-
ref: [inputRef1, inputRef2],
|
|
142
|
-
clearValue,
|
|
143
|
-
haveValue,
|
|
144
|
-
isChange,
|
|
145
|
-
blur,
|
|
146
|
-
focus,
|
|
147
|
-
});
|
|
148
|
-
onMounted(() => {});
|
|
149
|
-
</script>
|
|
150
|
-
<style lang='less'>
|
|
151
|
-
.ct-input-range {
|
|
152
|
-
position: relative;
|
|
153
|
-
display: inline-flex;
|
|
154
|
-
width: var(--ct-component-width);
|
|
155
|
-
font-size: var(--ct-font-size);
|
|
156
|
-
color: var(--ct-border-color);
|
|
157
|
-
box-sizing: border-box;
|
|
158
|
-
vertical-align: middle;
|
|
159
|
-
@R: .ct-input-range;
|
|
160
|
-
&.is-disabled {
|
|
161
|
-
cursor: not-allowed;
|
|
162
|
-
--ct-component-fill-color: var(--ct-component-disabled-bg-color);
|
|
163
|
-
@{R}__wrapper {
|
|
164
|
-
input {
|
|
165
|
-
cursor: not-allowed;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
&:not(.is-disabled):hover {
|
|
170
|
-
--ct-component-border-color: var(--ct-component-hover-border-color);
|
|
171
|
-
}
|
|
172
|
-
&.is-clearable {
|
|
173
|
-
@{R}__wrapper {
|
|
174
|
-
// padding-right: var(--ct-component-inner-padding);
|
|
175
|
-
@{R}__inner {
|
|
176
|
-
padding-right: 30px;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
&:hover {
|
|
180
|
-
@{R}__clearable {
|
|
181
|
-
display: inline-block;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
&__wrapper {
|
|
186
|
-
display: inline-flex;
|
|
187
|
-
flex-grow: 1;
|
|
188
|
-
align-items: center;
|
|
189
|
-
justify-content: center;
|
|
190
|
-
padding: 1px 0;
|
|
191
|
-
background-color: var(--ct-component-fill-color);
|
|
192
|
-
background-image: none;
|
|
193
|
-
border-radius: var(--ct-component-border-radius);
|
|
194
|
-
transition: var(--el-transition-box-shadow);
|
|
195
|
-
transform: translate3d(0, 0, 0);
|
|
196
|
-
box-shadow: 0 0 0 1px var(--ct-component-border-color) inset;
|
|
197
|
-
&:focus-within {
|
|
198
|
-
--ct-component-border-color: var(--ct-color-primary);
|
|
199
|
-
.el-icon,
|
|
200
|
-
.ct-icon {
|
|
201
|
-
color: var(--ct-component-border-color);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
&__inner {
|
|
206
|
-
width: 50%;
|
|
207
|
-
flex-grow: 1;
|
|
208
|
-
padding: 0 var(--ct-component-inner-padding);
|
|
209
|
-
-webkit-appearance: none;
|
|
210
|
-
color: var(--ct-component-color);
|
|
211
|
-
font-size: inherit;
|
|
212
|
-
height: var(--ct-component-inner-height);
|
|
213
|
-
line-height: var(--ct-component-inner-height);
|
|
214
|
-
outline: 0;
|
|
215
|
-
border: none;
|
|
216
|
-
background: 0 0;
|
|
217
|
-
box-sizing: border-box;
|
|
218
|
-
}
|
|
219
|
-
&__clearable {
|
|
220
|
-
cursor: pointer;
|
|
221
|
-
display: none;
|
|
222
|
-
position: absolute;
|
|
223
|
-
right: var(--ct-component-inner-padding);
|
|
224
|
-
top: 50%;
|
|
225
|
-
transform: translateY(-50%);
|
|
226
|
-
&.ct-icon {
|
|
227
|
-
display: none;
|
|
228
|
-
}
|
|
229
|
-
&:hover {
|
|
230
|
-
// color: var(--ct-color-danger);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="[
|
|
4
|
+
ns.b(),
|
|
5
|
+
ns.is('disabled', disabled),
|
|
6
|
+
ns.is('clearable', clearable),
|
|
7
|
+
]"
|
|
8
|
+
>
|
|
9
|
+
<div :class="[ns.e('wrapper')]">
|
|
10
|
+
<span :class="[ns.e('prefix')]">
|
|
11
|
+
<slot name="prefix"></slot>
|
|
12
|
+
</span>
|
|
13
|
+
<input
|
|
14
|
+
ref="inputRef1"
|
|
15
|
+
:class="[ns.e('inner')]"
|
|
16
|
+
:placeholder="placeholderShow[0]"
|
|
17
|
+
v-model="inputModel1"
|
|
18
|
+
:disabled="disabled"
|
|
19
|
+
@blur="handleBlur($event, 0)"
|
|
20
|
+
@focus="handleFocus($event, 0)"
|
|
21
|
+
@keydown.enter="handleEnter($event, 0)"
|
|
22
|
+
/>
|
|
23
|
+
<span :class="[ns.e('separator')]">
|
|
24
|
+
<slot name="separator">
|
|
25
|
+
<template v-if="isString(separator)">{{ separator }}</template>
|
|
26
|
+
<component v-else :is="separator" />
|
|
27
|
+
</slot>
|
|
28
|
+
</span>
|
|
29
|
+
<input
|
|
30
|
+
ref="inputRef2"
|
|
31
|
+
:class="[ns.e('inner')]"
|
|
32
|
+
:placeholder="placeholderShow[1]"
|
|
33
|
+
v-model="inputModel2"
|
|
34
|
+
:disabled="disabled"
|
|
35
|
+
@blur="handleBlur($event, 1)"
|
|
36
|
+
@focus="handleFocus($event, 1)"
|
|
37
|
+
@keydown.enter="handleEnter($event, 1)"
|
|
38
|
+
/>
|
|
39
|
+
<span :class="[ns.e('suffix')]">
|
|
40
|
+
<slot name="suffix"></slot>
|
|
41
|
+
<ct-icon
|
|
42
|
+
v-if="clearable && haveValue"
|
|
43
|
+
:class="[ns.e('clearable')]"
|
|
44
|
+
name="close_line"
|
|
45
|
+
@click="clearValue"
|
|
46
|
+
/>
|
|
47
|
+
</span>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<script setup>
|
|
53
|
+
import { onMounted, computed, ref, watch, nextTick } from "vue";
|
|
54
|
+
import { useNamespace, useBuriedParams } from "../../../hooks";
|
|
55
|
+
import { isArray, isString } from "../../../utils";
|
|
56
|
+
import { inputEmits, inputProps } from "./index";
|
|
57
|
+
const props = defineProps(inputProps);
|
|
58
|
+
const emit = defineEmits(inputEmits);
|
|
59
|
+
|
|
60
|
+
useBuriedParams(props, emit);
|
|
61
|
+
const ns = useNamespace("input-range");
|
|
62
|
+
|
|
63
|
+
const inputRef1 = ref(null);
|
|
64
|
+
const inputRef2 = ref(null);
|
|
65
|
+
const isChange = ref(false);
|
|
66
|
+
|
|
67
|
+
const inputModel1 = computed({
|
|
68
|
+
get() {
|
|
69
|
+
return isArray(props.modelValue) ? props.modelValue[0] : "";
|
|
70
|
+
},
|
|
71
|
+
set(newValue) {
|
|
72
|
+
emit("update:modelValue", [newValue, inputModel2.value || ""]);
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
const inputModel2 = computed({
|
|
76
|
+
get() {
|
|
77
|
+
return isArray(props.modelValue) ? props.modelValue[1] : "";
|
|
78
|
+
},
|
|
79
|
+
set(newValue) {
|
|
80
|
+
emit("update:modelValue", [inputModel1.value || "", newValue]);
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
const placeholderShow = computed(() => {
|
|
84
|
+
return isArray(props.placeholder)
|
|
85
|
+
? props.placeholder
|
|
86
|
+
: [props.startPlaceholder, props.endPlaceholder];
|
|
87
|
+
});
|
|
88
|
+
const haveValue = computed(() => {
|
|
89
|
+
return inputModel1.value || inputModel2.value;
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
watch(
|
|
93
|
+
() => props.modelValue,
|
|
94
|
+
(newValue) => {
|
|
95
|
+
isChange.value = true;
|
|
96
|
+
emit("input", newValue);
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
const emitChange = (e, index) => {
|
|
101
|
+
isChange.value && emit("change", props.modelValue, index, e);
|
|
102
|
+
isChange.value = false;
|
|
103
|
+
};
|
|
104
|
+
const handleEnter = (e, index) => {
|
|
105
|
+
emitChange(e, index);
|
|
106
|
+
};
|
|
107
|
+
const clearValue = () => {
|
|
108
|
+
emit("update:modelValue", []);
|
|
109
|
+
emit("clear");
|
|
110
|
+
};
|
|
111
|
+
const handleBlur = (e, index) => {
|
|
112
|
+
emit("blur", e, index);
|
|
113
|
+
emitChange(e, index);
|
|
114
|
+
};
|
|
115
|
+
const handleFocus = (e, index) => {
|
|
116
|
+
emit("focus", e, index);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const focus = async (index) => {
|
|
120
|
+
// see: https://github.com/ElemeFE/element/issues/18573
|
|
121
|
+
await nextTick();
|
|
122
|
+
if (inputRef1.value && !index) {
|
|
123
|
+
inputRef1.value.focus();
|
|
124
|
+
}
|
|
125
|
+
if (index == 1 && inputRef2.value) {
|
|
126
|
+
inputRef2.value.focus();
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const blur = (index) => {
|
|
131
|
+
const blurIndex = index === undefined ? [0, 1] : [index];
|
|
132
|
+
if (inputRef1.value && blurIndex.includes(0)) {
|
|
133
|
+
inputRef1.value.blur();
|
|
134
|
+
}
|
|
135
|
+
if (inputRef2.value && blurIndex.includes(1)) {
|
|
136
|
+
inputRef2.value.blur();
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
defineExpose({
|
|
141
|
+
ref: [inputRef1, inputRef2],
|
|
142
|
+
clearValue,
|
|
143
|
+
haveValue,
|
|
144
|
+
isChange,
|
|
145
|
+
blur,
|
|
146
|
+
focus,
|
|
147
|
+
});
|
|
148
|
+
onMounted(() => {});
|
|
149
|
+
</script>
|
|
150
|
+
<style lang='less'>
|
|
151
|
+
.ct-input-range {
|
|
152
|
+
position: relative;
|
|
153
|
+
display: inline-flex;
|
|
154
|
+
width: var(--ct-component-width);
|
|
155
|
+
font-size: var(--ct-font-size);
|
|
156
|
+
color: var(--ct-border-color);
|
|
157
|
+
box-sizing: border-box;
|
|
158
|
+
vertical-align: middle;
|
|
159
|
+
@R: .ct-input-range;
|
|
160
|
+
&.is-disabled {
|
|
161
|
+
cursor: not-allowed;
|
|
162
|
+
--ct-component-fill-color: var(--ct-component-disabled-bg-color);
|
|
163
|
+
@{R}__wrapper {
|
|
164
|
+
input {
|
|
165
|
+
cursor: not-allowed;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
&:not(.is-disabled):hover {
|
|
170
|
+
--ct-component-border-color: var(--ct-component-hover-border-color);
|
|
171
|
+
}
|
|
172
|
+
&.is-clearable {
|
|
173
|
+
@{R}__wrapper {
|
|
174
|
+
// padding-right: var(--ct-component-inner-padding);
|
|
175
|
+
@{R}__inner {
|
|
176
|
+
padding-right: 30px;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
&:hover {
|
|
180
|
+
@{R}__clearable {
|
|
181
|
+
display: inline-block;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
&__wrapper {
|
|
186
|
+
display: inline-flex;
|
|
187
|
+
flex-grow: 1;
|
|
188
|
+
align-items: center;
|
|
189
|
+
justify-content: center;
|
|
190
|
+
padding: 1px 0;
|
|
191
|
+
background-color: var(--ct-component-fill-color);
|
|
192
|
+
background-image: none;
|
|
193
|
+
border-radius: var(--ct-component-border-radius);
|
|
194
|
+
transition: var(--el-transition-box-shadow);
|
|
195
|
+
transform: translate3d(0, 0, 0);
|
|
196
|
+
box-shadow: 0 0 0 1px var(--ct-component-border-color) inset;
|
|
197
|
+
&:focus-within {
|
|
198
|
+
--ct-component-border-color: var(--ct-color-primary);
|
|
199
|
+
.el-icon,
|
|
200
|
+
.ct-icon {
|
|
201
|
+
color: var(--ct-component-border-color);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
&__inner {
|
|
206
|
+
width: 50%;
|
|
207
|
+
flex-grow: 1;
|
|
208
|
+
padding: 0 var(--ct-component-inner-padding);
|
|
209
|
+
-webkit-appearance: none;
|
|
210
|
+
color: var(--ct-component-color);
|
|
211
|
+
font-size: inherit;
|
|
212
|
+
height: var(--ct-component-inner-height);
|
|
213
|
+
line-height: var(--ct-component-inner-height);
|
|
214
|
+
outline: 0;
|
|
215
|
+
border: none;
|
|
216
|
+
background: 0 0;
|
|
217
|
+
box-sizing: border-box;
|
|
218
|
+
}
|
|
219
|
+
&__clearable {
|
|
220
|
+
cursor: pointer;
|
|
221
|
+
display: none;
|
|
222
|
+
position: absolute;
|
|
223
|
+
right: var(--ct-component-inner-padding);
|
|
224
|
+
top: 50%;
|
|
225
|
+
transform: translateY(-50%);
|
|
226
|
+
&.ct-icon {
|
|
227
|
+
display: none;
|
|
228
|
+
}
|
|
229
|
+
&:hover {
|
|
230
|
+
// color: var(--ct-color-danger);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
234
|
</style>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import CtLoading from "./src/CtLoading.vue";
|
|
2
|
-
|
|
3
|
-
/* istanbul ignore next */
|
|
4
|
-
CtLoading.install = function (Vue) {
|
|
5
|
-
Vue.component('CtLoading', CtLoading);
|
|
6
|
-
};
|
|
7
|
-
|
|
1
|
+
import CtLoading from "./src/CtLoading.vue";
|
|
2
|
+
|
|
3
|
+
/* istanbul ignore next */
|
|
4
|
+
CtLoading.install = function (Vue) {
|
|
5
|
+
Vue.component('CtLoading', CtLoading);
|
|
6
|
+
};
|
|
7
|
+
|
|
8
8
|
export default CtLoading;
|