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,98 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="[ns.b(), ns.m(type)]">
|
|
3
|
+
<div :class="ns.e('container')">
|
|
4
|
+
<template v-if="imgSrc">
|
|
5
|
+
<img :src="imgSrc" alt="" :class="[ns.e('img')]" />
|
|
6
|
+
</template>
|
|
7
|
+
<template v-else>
|
|
8
|
+
<img :src="showSrc" alt="" :class="[ns.e('img')]" />
|
|
9
|
+
</template>
|
|
10
|
+
<div :class="ns.em('img', 'inner')" v-if="innerText">{{ innerText }}</div>
|
|
11
|
+
<div :class="ns.em('img', 'inner')" v-else>
|
|
12
|
+
<slot name="inner"></slot>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
<div :class="ns.e('hint')" v-if="outerText">{{ outerText }}</div>
|
|
16
|
+
<div :class="ns.e('hint')" v-else>
|
|
17
|
+
<slot name="outer"></slot>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup>
|
|
23
|
+
import { ref, reactive, onMounted, computed } from "vue";
|
|
24
|
+
import { useNamespace } from "../../../hooks/use-namespace";
|
|
25
|
+
|
|
26
|
+
const ns = useNamespace("empty");
|
|
27
|
+
|
|
28
|
+
const props = defineProps({
|
|
29
|
+
type: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: "no-data",
|
|
32
|
+
},
|
|
33
|
+
imgSrc: {
|
|
34
|
+
type: String,
|
|
35
|
+
},
|
|
36
|
+
innerText: {
|
|
37
|
+
type: String,
|
|
38
|
+
},
|
|
39
|
+
outerText: {
|
|
40
|
+
type: String,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const srcList = [
|
|
45
|
+
{
|
|
46
|
+
type: "no-data",
|
|
47
|
+
src: "http://ctfront.oss-cn-hangzhou.aliyuncs.com/Front/cingta-component/v2/no_data.png",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
type: "404",
|
|
51
|
+
src: "http://ctfront.oss-cn-hangzhou.aliyuncs.com/Front/cingta-component/v2/404.png",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
type: "500",
|
|
55
|
+
src: "http://ctfront.oss-cn-hangzhou.aliyuncs.com/Front/cingta-component/v2/500.png",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: "502",
|
|
59
|
+
src: "http://ctfront.oss-cn-hangzhou.aliyuncs.com/Front/cingta-component/v2/502.png",
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
const showSrc = computed(() => {
|
|
63
|
+
return srcList.find((item) => item.type === props.type)?.src;
|
|
64
|
+
});
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<style lang='less'>
|
|
68
|
+
.ct-empty {
|
|
69
|
+
width: 100%;
|
|
70
|
+
height: 100%;
|
|
71
|
+
min-height: 300px;
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
justify-content: center;
|
|
75
|
+
align-items: center;
|
|
76
|
+
&__container {
|
|
77
|
+
position: relative;
|
|
78
|
+
display: flex;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
align-items: center;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&__img {
|
|
84
|
+
width: 300px;
|
|
85
|
+
height: 300px;
|
|
86
|
+
|
|
87
|
+
&--inner {
|
|
88
|
+
position: absolute;
|
|
89
|
+
bottom: 10px;
|
|
90
|
+
color: var(--ct-color-grey-transition);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
&__hint {
|
|
94
|
+
margin-top: 10px;
|
|
95
|
+
color: var(--ct-color-grey-transition);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
</style>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import button from './button';
|
|
2
|
+
import radio from './radio';
|
|
3
|
+
import checkbox from './checkbox';
|
|
4
|
+
import input from './input';
|
|
5
|
+
import inputRange from './input-range';
|
|
6
|
+
import select from './select';
|
|
7
|
+
import yearSelect from './year-select';
|
|
8
|
+
import datePicker from './date-picker';
|
|
9
|
+
import cascader from './cascader';
|
|
10
|
+
import tabs from './tabs';
|
|
11
|
+
import pagination from './pagination';
|
|
12
|
+
import menu from './menu';
|
|
13
|
+
|
|
14
|
+
import searchBox from './search-box';
|
|
15
|
+
import table from './table';
|
|
16
|
+
import empty from "./empty";
|
|
17
|
+
import dialog from "./dialog";
|
|
18
|
+
import messageBox from './message-box';
|
|
19
|
+
import CtMessage from './message';
|
|
20
|
+
|
|
21
|
+
import ElementPlus from 'element-plus'
|
|
22
|
+
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
|
23
|
+
import cingtaIcon from 'cingta-icon';
|
|
24
|
+
// import cingtaIcon from '../../icon/components/index';
|
|
25
|
+
import { isObject } from '../utils';
|
|
26
|
+
|
|
27
|
+
const components = [
|
|
28
|
+
button,
|
|
29
|
+
radio,
|
|
30
|
+
checkbox,
|
|
31
|
+
input,
|
|
32
|
+
inputRange,
|
|
33
|
+
select,
|
|
34
|
+
yearSelect,
|
|
35
|
+
datePicker,
|
|
36
|
+
cascader,
|
|
37
|
+
tabs,
|
|
38
|
+
pagination,
|
|
39
|
+
menu,
|
|
40
|
+
searchBox,
|
|
41
|
+
table,
|
|
42
|
+
empty,
|
|
43
|
+
dialog,
|
|
44
|
+
messageBox,
|
|
45
|
+
CtMessage
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
const serviceConfig = {
|
|
49
|
+
defaultMethod: 'post'
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const install = function (app, options) {
|
|
53
|
+
components.forEach(c => app.use(c))
|
|
54
|
+
app.use(ElementPlus, { locale: zhCn, });
|
|
55
|
+
app.use(cingtaIcon)
|
|
56
|
+
let serviceOptions = {}
|
|
57
|
+
if (isObject(options)) {
|
|
58
|
+
if (!options.baseDao) {
|
|
59
|
+
console.warn('当前使用的组件库没有配置baseDao')
|
|
60
|
+
} else {
|
|
61
|
+
app.provide('$ctBaseDao', options.baseDao)
|
|
62
|
+
}
|
|
63
|
+
if (isObject(options.serviceOptions)) serviceOptions = options.serviceOptions;
|
|
64
|
+
if (isObject(options.searchBoxComponent)) app.provide('$userDefinedSearchComponent', options.searchBoxComponent)
|
|
65
|
+
}
|
|
66
|
+
app.provide('$ctServiceConfig', { ...serviceConfig, ...serviceOptions })
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export default {
|
|
70
|
+
install
|
|
71
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { buriedParamsKey, searchComponentProps } from '../../../hooks';
|
|
2
|
+
|
|
3
|
+
export const inputEmits = ["update:modelValue", buriedParamsKey];
|
|
4
|
+
export const inputProps = {
|
|
5
|
+
...searchComponentProps,
|
|
6
|
+
modelValue: String,
|
|
7
|
+
password: Boolean,
|
|
8
|
+
clearable: Boolean,
|
|
9
|
+
type: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: "text",
|
|
12
|
+
},
|
|
13
|
+
unit: String,
|
|
14
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-input
|
|
3
|
+
:class="[ns.b()]"
|
|
4
|
+
v-model="showValue"
|
|
5
|
+
v-bind="rawAttr"
|
|
6
|
+
:type="currType"
|
|
7
|
+
ref="inputRef"
|
|
8
|
+
>
|
|
9
|
+
<template #prefix>
|
|
10
|
+
<slot name="prefix"></slot>
|
|
11
|
+
</template>
|
|
12
|
+
<template #suffix>
|
|
13
|
+
<slot name="suffix"> </slot>
|
|
14
|
+
<span v-if="unit" :class="[ns.e('unit')]">{{ unit }}</span>
|
|
15
|
+
<ct-icon
|
|
16
|
+
v-if="clearable && showValue"
|
|
17
|
+
:class="[ns.e('clearable')]"
|
|
18
|
+
name="close_line"
|
|
19
|
+
@click="showValue = ''"
|
|
20
|
+
/>
|
|
21
|
+
<template v-if="password && showValue">
|
|
22
|
+
<span :class="[ns.e('password')]" @click="switchPassword">
|
|
23
|
+
<ct-icon v-if="currType === 'password'" name="preview-close2_line" />
|
|
24
|
+
<ct-icon v-else name="preview-open_line" />
|
|
25
|
+
</span>
|
|
26
|
+
</template>
|
|
27
|
+
</template>
|
|
28
|
+
</el-input>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script setup>
|
|
32
|
+
import { onMounted, computed, ref } from "vue";
|
|
33
|
+
import { useNamespace, useBuriedParams } from "../../../hooks";
|
|
34
|
+
import { inputEmits, inputProps } from "./index";
|
|
35
|
+
const props = defineProps(inputProps);
|
|
36
|
+
const emit = defineEmits(inputEmits);
|
|
37
|
+
|
|
38
|
+
useBuriedParams(props, emit);
|
|
39
|
+
const ns = useNamespace("input");
|
|
40
|
+
|
|
41
|
+
const inputRef = ref(null);
|
|
42
|
+
const currType = ref(props.type);
|
|
43
|
+
const showValue = computed({
|
|
44
|
+
get() {
|
|
45
|
+
return props.modelValue;
|
|
46
|
+
},
|
|
47
|
+
set(newValue) {
|
|
48
|
+
emit("update:modelValue", newValue);
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const switchPassword = () => {
|
|
53
|
+
currType.value = currType.value === "password" ? "text" : "password";
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
onMounted(() => {
|
|
57
|
+
if (props.password) {
|
|
58
|
+
currType.value = "password";
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
defineExpose({
|
|
62
|
+
ref: inputRef,
|
|
63
|
+
});
|
|
64
|
+
</script>
|
|
65
|
+
<style lang='less'>
|
|
66
|
+
.ct-input {
|
|
67
|
+
@R: .ct-input;
|
|
68
|
+
--ct-input-focus-color: var(--ct-color-primary);
|
|
69
|
+
--ct-input-focus-hover-color: var(--ct-color-primary);
|
|
70
|
+
--ct-input-default-width: var(--ct-component-width);
|
|
71
|
+
&.el-input {
|
|
72
|
+
width: var(--ct-input-default-width);
|
|
73
|
+
}
|
|
74
|
+
&__unit {
|
|
75
|
+
color: var(--ct-color-grey-sub);
|
|
76
|
+
}
|
|
77
|
+
&__clearable {
|
|
78
|
+
// --ct-input-focus-hover-color: var(--ct-color-danger);
|
|
79
|
+
}
|
|
80
|
+
& &__clearable {
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
opacity: 0;
|
|
83
|
+
}
|
|
84
|
+
&__password {
|
|
85
|
+
cursor: pointer;
|
|
86
|
+
color: var(--ct-color-black);
|
|
87
|
+
}
|
|
88
|
+
.el-input__inner {
|
|
89
|
+
&:focus {
|
|
90
|
+
& + .el-input__suffix {
|
|
91
|
+
@{R}__clearable {
|
|
92
|
+
opacity: 1;
|
|
93
|
+
color: var(--ct-input-focus-color);
|
|
94
|
+
&:hover {
|
|
95
|
+
color: var(--ct-input-focus-hover-color);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
&:hover {
|
|
102
|
+
@{R}__clearable {
|
|
103
|
+
opacity: 1;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
</style>
|
|
@@ -0,0 +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
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +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-color-grey-transition);
|
|
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
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.6 3.172a.5.5 0 01.5.5V10.9l6.956.001a.5.5 0 01.5.5v1.2a.5.5 0 01-.5.5h-6.957l.001 7.228a.5.5 0 01-.5.5h-1.2a.5.5 0 01-.5-.5v-7.229l-6.956.001a.5.5 0 01-.5-.5v-1.2a.5.5 0 01.5-.5H10.9l.001-7.228a.5.5 0 01.5-.5h1.2z" fill="#8F99A3"/></svg>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="[ns.b()]">
|
|
3
|
+
<span v-if="haveIcon" :class="[ns.e('icon')]">
|
|
4
|
+
<slot name="icon" :menu="menu" :title="title">
|
|
5
|
+
<ct-icon v-if="icon" :name="icon"></ct-icon>
|
|
6
|
+
</slot>
|
|
7
|
+
</span>
|
|
8
|
+
<span :class="[ns.e('title')]">
|
|
9
|
+
<slot name="title" :menu="menu" :title="title">
|
|
10
|
+
{{ title }}
|
|
11
|
+
</slot>
|
|
12
|
+
</span>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup>
|
|
17
|
+
import { computed } from "vue";
|
|
18
|
+
import { useNamespace } from "../../../hooks";
|
|
19
|
+
const props = defineProps({
|
|
20
|
+
menu: {
|
|
21
|
+
type: Object,
|
|
22
|
+
default() {
|
|
23
|
+
return {};
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
icon: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: "",
|
|
29
|
+
},
|
|
30
|
+
title: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: "",
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
const ns = useNamespace("menu-item");
|
|
36
|
+
const haveIcon = computed(() => props.icon || props.menu.haveIcon);
|
|
37
|
+
</script>
|
|
38
|
+
<style lang='less'>
|
|
39
|
+
.ct-menu-item {
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
&__icon {
|
|
43
|
+
margin-right: var(--ct-menu-icon-margin);
|
|
44
|
+
font-size: var(--ct-menu-icon-size);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
</style>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Component :is="type" v-bind="linkProps(to)">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</Component>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup>
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
to: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
type: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
const linkProps = (to) => {
|
|
19
|
+
if (props.type === "a") {
|
|
20
|
+
return {
|
|
21
|
+
href: to,
|
|
22
|
+
target: "_blank",
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
to: to,
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
</script>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="[ns.b(), ns.is('collapse', collapse)]">
|
|
3
|
+
<img :class="ns.e('logo')" src="" alt="" />
|
|
4
|
+
<span :class="ns.e('title')"></span>
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script setup>
|
|
9
|
+
import { reactive, onMounted } from "vue";
|
|
10
|
+
import { useNamespace } from "../../../hooks";
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
collapse: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: false,
|
|
15
|
+
},
|
|
16
|
+
title: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: "",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
const ns = useNamespace("logo");
|
|
22
|
+
const state = reactive({});
|
|
23
|
+
onMounted(() => {});
|
|
24
|
+
</script>
|
|
25
|
+
<style lang='less'>
|
|
26
|
+
</style>
|