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,250 +1,250 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="[ns.b()]">
|
|
3
|
-
<div :class="[ns.e('container')]">
|
|
4
|
-
<div :class="[ns.e('list')]">
|
|
5
|
-
<div
|
|
6
|
-
v-for="(item, index) in searchList"
|
|
7
|
-
:class="[
|
|
8
|
-
ns.e('item'),
|
|
9
|
-
...getComponentClass(item),
|
|
10
|
-
ns.is('outer-border', outerBorder),
|
|
11
|
-
]"
|
|
12
|
-
:key="item.param || index"
|
|
13
|
-
:style="{ ...getComponentStyle(item) }">
|
|
14
|
-
<slot v-bind="getComponentSlotScope(item)">
|
|
15
|
-
<slot name="item-before" v-bind="getComponentSlotScope(item)">
|
|
16
|
-
</slot>
|
|
17
|
-
<span
|
|
18
|
-
:class="[
|
|
19
|
-
ns.e('item-label'),
|
|
20
|
-
ns.is('required', item.required),
|
|
21
|
-
ns.is('outer-border', outerBorder),
|
|
22
|
-
]">
|
|
23
|
-
<span>{{ item.label }}</span>
|
|
24
|
-
<span :class="[ns.is('required')]" v-if="!outerBorder">:</span>
|
|
25
|
-
</span>
|
|
26
|
-
<div :class="[ns.e('item-component')]">
|
|
27
|
-
<slot
|
|
28
|
-
:name="item.componentName || item.param"
|
|
29
|
-
v-bind="getComponentSlotScope(item)">
|
|
30
|
-
<component
|
|
31
|
-
:is="getComponent(item.type)"
|
|
32
|
-
v-model="searchParamsCurrent[item.param]"
|
|
33
|
-
v-bind="getComponentProps(item)">
|
|
34
|
-
</component>
|
|
35
|
-
</slot>
|
|
36
|
-
</div>
|
|
37
|
-
<slot name="item-after" v-bind="getComponentSlotScope(item)"></slot>
|
|
38
|
-
</slot>
|
|
39
|
-
</div>
|
|
40
|
-
<div :class="[ns.e('buttons')]">
|
|
41
|
-
<slot name="solt-search">
|
|
42
|
-
<ct-button type="border-plain" @click="resetData" v-if="haveReset"
|
|
43
|
-
>重置</ct-button
|
|
44
|
-
>
|
|
45
|
-
<ct-button type="border" @click="doSearch">{{
|
|
46
|
-
searchBtnName
|
|
47
|
-
}}</ct-button>
|
|
48
|
-
</slot>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
</template>
|
|
54
|
-
|
|
55
|
-
<script setup>
|
|
56
|
-
import { computed, inject, onMounted, ref, watch } from "vue";
|
|
57
|
-
import { searchBoxEmits, searchBoxProps } from "./index";
|
|
58
|
-
import { useNamespace, buriedParamsKey } from "../../../hooks";
|
|
59
|
-
import { isObject, isString, isArray, toFirstUpperCase } from "../../../utils";
|
|
60
|
-
import { searchComponents } from "../index";
|
|
61
|
-
const userDefinedSearchComponent = inject("$userDefinedSearchComponent", {});
|
|
62
|
-
const searchBoxConfig = inject("$searchBoxConfig", {});
|
|
63
|
-
const props = defineProps(searchBoxProps);
|
|
64
|
-
const emit = defineEmits(searchBoxEmits);
|
|
65
|
-
|
|
66
|
-
const ns = useNamespace("search-box");
|
|
67
|
-
|
|
68
|
-
const searchParamsCurrent = ref({});
|
|
69
|
-
watch(searchParamsCurrent, (newVal) => {
|
|
70
|
-
emit("update:searchParamsCurrent", newVal);
|
|
71
|
-
});
|
|
72
|
-
watch(
|
|
73
|
-
() => props.modelValue,
|
|
74
|
-
(newValue) => {
|
|
75
|
-
searchParamsCurrent.value = newValue || {};
|
|
76
|
-
},
|
|
77
|
-
{ immediate: true }
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
const getComponentClass = (item) => {
|
|
81
|
-
const classList = [];
|
|
82
|
-
if (item.componentClass) {
|
|
83
|
-
const cla = item.componentClass;
|
|
84
|
-
if (isString(cla)) classList.push(cla);
|
|
85
|
-
if (isArray(cla)) classList.push(...cla);
|
|
86
|
-
}
|
|
87
|
-
return classList;
|
|
88
|
-
};
|
|
89
|
-
const getComponentStyle = (item) => {
|
|
90
|
-
const style = {};
|
|
91
|
-
if (item.componentStyle) {
|
|
92
|
-
const sty = item.componentStyle;
|
|
93
|
-
if (isObject(sty)) Object.assign(style, sty);
|
|
94
|
-
}
|
|
95
|
-
return style;
|
|
96
|
-
};
|
|
97
|
-
const componentAll = computed(() => {
|
|
98
|
-
const { CtInput, CtSelect, CtDatePicker, CtCascader, CtYearSelect } =
|
|
99
|
-
searchComponents;
|
|
100
|
-
const componentMap = {
|
|
101
|
-
0: CtInput,
|
|
102
|
-
1: CtSelect,
|
|
103
|
-
2: CtCascader,
|
|
104
|
-
4: CtDatePicker,
|
|
105
|
-
12: CtYearSelect,
|
|
106
|
-
13: "div",
|
|
107
|
-
...userDefinedSearchComponent,
|
|
108
|
-
};
|
|
109
|
-
return componentMap;
|
|
110
|
-
});
|
|
111
|
-
const buriedParams = ref({});
|
|
112
|
-
const handleBuriedParams = (params) => {
|
|
113
|
-
const key = params.value;
|
|
114
|
-
if (key) {
|
|
115
|
-
buriedParams.value[key] = params;
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
const getComponentProps = (item) => {
|
|
119
|
-
const bpKey = toFirstUpperCase(buriedParamsKey);
|
|
120
|
-
const attrObj = {
|
|
121
|
-
...item,
|
|
122
|
-
};
|
|
123
|
-
delete attrObj.type;
|
|
124
|
-
// const
|
|
125
|
-
return {
|
|
126
|
-
...attrObj,
|
|
127
|
-
// param: item.param,
|
|
128
|
-
// label: item.label,
|
|
129
|
-
// multiple: item.multiple,
|
|
130
|
-
// api: item.api,
|
|
131
|
-
// placeholder: item.placeholder,
|
|
132
|
-
// clearable: item.clearable,
|
|
133
|
-
// disabled: item.disabled,
|
|
134
|
-
// range: item.range,
|
|
135
|
-
// mapObj: item.mapObj,
|
|
136
|
-
options: item.list,
|
|
137
|
-
name: item.param, //用作插槽名
|
|
138
|
-
// rawAttr: item.rawAttr,
|
|
139
|
-
|
|
140
|
-
["on" + bpKey]: handleBuriedParams,
|
|
141
|
-
};
|
|
142
|
-
};
|
|
143
|
-
const getComponent = (type) => {
|
|
144
|
-
return isObject(type) ? type : componentAll.value[type] || "div";
|
|
145
|
-
};
|
|
146
|
-
const getComponentSlotScope = (item) => {
|
|
147
|
-
return isObject(item) ? item : {};
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
const haveReset = computed(() => {
|
|
151
|
-
return props.haveReset;
|
|
152
|
-
});
|
|
153
|
-
const resetData = () => {
|
|
154
|
-
const keys = Object.keys(searchParamsCurrent.value);
|
|
155
|
-
keys.forEach((key) => {
|
|
156
|
-
const oldValue = searchParamsCurrent.value[key];
|
|
157
|
-
searchParamsCurrent.value[key] = Array.isArray(oldValue) ? [] : "";
|
|
158
|
-
});
|
|
159
|
-
emit("doReset");
|
|
160
|
-
};
|
|
161
|
-
const doSearch = () => {
|
|
162
|
-
emit("update:searchParams", searchParamsCurrent);
|
|
163
|
-
emit("doSearch", searchParamsCurrent.value);
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
defineExpose({
|
|
167
|
-
searchParamsCurrent,
|
|
168
|
-
componentAll: componentAll.value,
|
|
169
|
-
getComponent,
|
|
170
|
-
buriedParams,
|
|
171
|
-
doSearch,
|
|
172
|
-
});
|
|
173
|
-
onMounted(() => {});
|
|
174
|
-
</script>
|
|
175
|
-
<style lang="less">
|
|
176
|
-
.ct-search-box {
|
|
177
|
-
--ct-search-box-item-margin-right: 16px;
|
|
178
|
-
--ct-search-box-item-margin-top: 14px;
|
|
179
|
-
.el-input {
|
|
180
|
-
--ct-input-default-width: auto;
|
|
181
|
-
}
|
|
182
|
-
&__list {
|
|
183
|
-
display: flex;
|
|
184
|
-
align-items: center;
|
|
185
|
-
flex-wrap: wrap;
|
|
186
|
-
margin-right: calc(-1 * var(--ct-search-box-item-margin-right));
|
|
187
|
-
margin-top: calc(-1 * var(--ct-search-box-item-margin-top));
|
|
188
|
-
> * {
|
|
189
|
-
margin-right: var(--ct-search-box-item-margin-right);
|
|
190
|
-
margin-top: var(--ct-search-box-item-margin-top);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
&__item {
|
|
194
|
-
display: flex;
|
|
195
|
-
align-items: center;
|
|
196
|
-
width: calc(
|
|
197
|
-
(100% - v-bind(rowNumber) * var(--ct-search-box-item-margin-right)) /
|
|
198
|
-
v-bind(rowNumber)
|
|
199
|
-
);
|
|
200
|
-
--ct-search-box-item-component-width: 100%;
|
|
201
|
-
&.is-outer-border {
|
|
202
|
-
--ct-font-size: 13px;
|
|
203
|
-
--el-font-size-base: var(--ct-font-size, 13px);
|
|
204
|
-
--ct-search-box-border-color: var(--ct-border-color);
|
|
205
|
-
--ct-search-box-inner-border-color: transparent;
|
|
206
|
-
font-size: var(--ct-font-size);
|
|
207
|
-
height: 36px;
|
|
208
|
-
padding-left: 14px;
|
|
209
|
-
box-shadow: 0 0 0 1px var(--ct-search-box-border-color);
|
|
210
|
-
border-radius: var(--ct-border-radius);
|
|
211
|
-
&:hover {
|
|
212
|
-
--ct-search-box-border-color: var(--ct-color-grey-sub);
|
|
213
|
-
}
|
|
214
|
-
&:focus-within {
|
|
215
|
-
--ct-search-box-border-color: var(--ct-color-primary);
|
|
216
|
-
}
|
|
217
|
-
.el-input__wrapper,
|
|
218
|
-
.el-select__wrapper,
|
|
219
|
-
.ct-year-select__wrapper {
|
|
220
|
-
--el-select-input-focus-border-color: var(
|
|
221
|
-
--ct-search-box-inner-border-color
|
|
222
|
-
);
|
|
223
|
-
box-shadow: 0 0 0 1px var(--ct-search-box-inner-border-color) !important;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
&-label {
|
|
227
|
-
line-height: 1;
|
|
228
|
-
&.is-outer-border {
|
|
229
|
-
color: var(--ct-color-grey-sub);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
&-component {
|
|
233
|
-
flex: 1;
|
|
234
|
-
> * {
|
|
235
|
-
width: var(--ct-search-box-item-component-width) !important;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
&__buttons {
|
|
240
|
-
margin-left: auto;
|
|
241
|
-
button {
|
|
242
|
-
width: 96px;
|
|
243
|
-
padding: 0;
|
|
244
|
-
height: 34px;
|
|
245
|
-
line-height: 34px;
|
|
246
|
-
border-radius: 4px;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="[ns.b()]">
|
|
3
|
+
<div :class="[ns.e('container')]">
|
|
4
|
+
<div :class="[ns.e('list')]">
|
|
5
|
+
<div
|
|
6
|
+
v-for="(item, index) in searchList"
|
|
7
|
+
:class="[
|
|
8
|
+
ns.e('item'),
|
|
9
|
+
...getComponentClass(item),
|
|
10
|
+
ns.is('outer-border', outerBorder),
|
|
11
|
+
]"
|
|
12
|
+
:key="item.param || index"
|
|
13
|
+
:style="{ ...getComponentStyle(item) }">
|
|
14
|
+
<slot v-bind="getComponentSlotScope(item)">
|
|
15
|
+
<slot name="item-before" v-bind="getComponentSlotScope(item)">
|
|
16
|
+
</slot>
|
|
17
|
+
<span
|
|
18
|
+
:class="[
|
|
19
|
+
ns.e('item-label'),
|
|
20
|
+
ns.is('required', item.required),
|
|
21
|
+
ns.is('outer-border', outerBorder),
|
|
22
|
+
]">
|
|
23
|
+
<span>{{ item.label }}</span>
|
|
24
|
+
<span :class="[ns.is('required')]" v-if="!outerBorder">:</span>
|
|
25
|
+
</span>
|
|
26
|
+
<div :class="[ns.e('item-component')]">
|
|
27
|
+
<slot
|
|
28
|
+
:name="item.componentName || item.param"
|
|
29
|
+
v-bind="getComponentSlotScope(item)">
|
|
30
|
+
<component
|
|
31
|
+
:is="getComponent(item.type)"
|
|
32
|
+
v-model="searchParamsCurrent[item.param]"
|
|
33
|
+
v-bind="getComponentProps(item)">
|
|
34
|
+
</component>
|
|
35
|
+
</slot>
|
|
36
|
+
</div>
|
|
37
|
+
<slot name="item-after" v-bind="getComponentSlotScope(item)"></slot>
|
|
38
|
+
</slot>
|
|
39
|
+
</div>
|
|
40
|
+
<div :class="[ns.e('buttons')]">
|
|
41
|
+
<slot name="solt-search">
|
|
42
|
+
<ct-button type="border-plain" @click="resetData" v-if="haveReset"
|
|
43
|
+
>重置</ct-button
|
|
44
|
+
>
|
|
45
|
+
<ct-button type="border" @click="doSearch">{{
|
|
46
|
+
searchBtnName
|
|
47
|
+
}}</ct-button>
|
|
48
|
+
</slot>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script setup>
|
|
56
|
+
import { computed, inject, onMounted, ref, watch } from "vue";
|
|
57
|
+
import { searchBoxEmits, searchBoxProps } from "./index";
|
|
58
|
+
import { useNamespace, buriedParamsKey } from "../../../hooks";
|
|
59
|
+
import { isObject, isString, isArray, toFirstUpperCase } from "../../../utils";
|
|
60
|
+
import { searchComponents } from "../index";
|
|
61
|
+
const userDefinedSearchComponent = inject("$userDefinedSearchComponent", {});
|
|
62
|
+
const searchBoxConfig = inject("$searchBoxConfig", {});
|
|
63
|
+
const props = defineProps(searchBoxProps);
|
|
64
|
+
const emit = defineEmits(searchBoxEmits);
|
|
65
|
+
|
|
66
|
+
const ns = useNamespace("search-box");
|
|
67
|
+
|
|
68
|
+
const searchParamsCurrent = ref({});
|
|
69
|
+
watch(searchParamsCurrent, (newVal) => {
|
|
70
|
+
emit("update:searchParamsCurrent", newVal);
|
|
71
|
+
});
|
|
72
|
+
watch(
|
|
73
|
+
() => props.modelValue,
|
|
74
|
+
(newValue) => {
|
|
75
|
+
searchParamsCurrent.value = newValue || {};
|
|
76
|
+
},
|
|
77
|
+
{ immediate: true }
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const getComponentClass = (item) => {
|
|
81
|
+
const classList = [];
|
|
82
|
+
if (item.componentClass) {
|
|
83
|
+
const cla = item.componentClass;
|
|
84
|
+
if (isString(cla)) classList.push(cla);
|
|
85
|
+
if (isArray(cla)) classList.push(...cla);
|
|
86
|
+
}
|
|
87
|
+
return classList;
|
|
88
|
+
};
|
|
89
|
+
const getComponentStyle = (item) => {
|
|
90
|
+
const style = {};
|
|
91
|
+
if (item.componentStyle) {
|
|
92
|
+
const sty = item.componentStyle;
|
|
93
|
+
if (isObject(sty)) Object.assign(style, sty);
|
|
94
|
+
}
|
|
95
|
+
return style;
|
|
96
|
+
};
|
|
97
|
+
const componentAll = computed(() => {
|
|
98
|
+
const { CtInput, CtSelect, CtDatePicker, CtCascader, CtYearSelect } =
|
|
99
|
+
searchComponents;
|
|
100
|
+
const componentMap = {
|
|
101
|
+
0: CtInput,
|
|
102
|
+
1: CtSelect,
|
|
103
|
+
2: CtCascader,
|
|
104
|
+
4: CtDatePicker,
|
|
105
|
+
12: CtYearSelect,
|
|
106
|
+
13: "div",
|
|
107
|
+
...userDefinedSearchComponent,
|
|
108
|
+
};
|
|
109
|
+
return componentMap;
|
|
110
|
+
});
|
|
111
|
+
const buriedParams = ref({});
|
|
112
|
+
const handleBuriedParams = (params) => {
|
|
113
|
+
const key = params.value;
|
|
114
|
+
if (key) {
|
|
115
|
+
buriedParams.value[key] = params;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const getComponentProps = (item) => {
|
|
119
|
+
const bpKey = toFirstUpperCase(buriedParamsKey);
|
|
120
|
+
const attrObj = {
|
|
121
|
+
...item,
|
|
122
|
+
};
|
|
123
|
+
delete attrObj.type;
|
|
124
|
+
// const
|
|
125
|
+
return {
|
|
126
|
+
...attrObj,
|
|
127
|
+
// param: item.param,
|
|
128
|
+
// label: item.label,
|
|
129
|
+
// multiple: item.multiple,
|
|
130
|
+
// api: item.api,
|
|
131
|
+
// placeholder: item.placeholder,
|
|
132
|
+
// clearable: item.clearable,
|
|
133
|
+
// disabled: item.disabled,
|
|
134
|
+
// range: item.range,
|
|
135
|
+
// mapObj: item.mapObj,
|
|
136
|
+
options: item.list,
|
|
137
|
+
name: item.param, //用作插槽名
|
|
138
|
+
// rawAttr: item.rawAttr,
|
|
139
|
+
|
|
140
|
+
["on" + bpKey]: handleBuriedParams,
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
const getComponent = (type) => {
|
|
144
|
+
return isObject(type) ? type : componentAll.value[type] || "div";
|
|
145
|
+
};
|
|
146
|
+
const getComponentSlotScope = (item) => {
|
|
147
|
+
return isObject(item) ? item : {};
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const haveReset = computed(() => {
|
|
151
|
+
return props.haveReset;
|
|
152
|
+
});
|
|
153
|
+
const resetData = () => {
|
|
154
|
+
const keys = Object.keys(searchParamsCurrent.value);
|
|
155
|
+
keys.forEach((key) => {
|
|
156
|
+
const oldValue = searchParamsCurrent.value[key];
|
|
157
|
+
searchParamsCurrent.value[key] = Array.isArray(oldValue) ? [] : "";
|
|
158
|
+
});
|
|
159
|
+
emit("doReset");
|
|
160
|
+
};
|
|
161
|
+
const doSearch = () => {
|
|
162
|
+
emit("update:searchParams", searchParamsCurrent);
|
|
163
|
+
emit("doSearch", searchParamsCurrent.value);
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
defineExpose({
|
|
167
|
+
searchParamsCurrent,
|
|
168
|
+
componentAll: componentAll.value,
|
|
169
|
+
getComponent,
|
|
170
|
+
buriedParams,
|
|
171
|
+
doSearch,
|
|
172
|
+
});
|
|
173
|
+
onMounted(() => {});
|
|
174
|
+
</script>
|
|
175
|
+
<style lang="less">
|
|
176
|
+
.ct-search-box {
|
|
177
|
+
--ct-search-box-item-margin-right: 16px;
|
|
178
|
+
--ct-search-box-item-margin-top: 14px;
|
|
179
|
+
.el-input {
|
|
180
|
+
--ct-input-default-width: auto;
|
|
181
|
+
}
|
|
182
|
+
&__list {
|
|
183
|
+
display: flex;
|
|
184
|
+
align-items: center;
|
|
185
|
+
flex-wrap: wrap;
|
|
186
|
+
margin-right: calc(-1 * var(--ct-search-box-item-margin-right));
|
|
187
|
+
margin-top: calc(-1 * var(--ct-search-box-item-margin-top));
|
|
188
|
+
> * {
|
|
189
|
+
margin-right: var(--ct-search-box-item-margin-right);
|
|
190
|
+
margin-top: var(--ct-search-box-item-margin-top);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
&__item {
|
|
194
|
+
display: flex;
|
|
195
|
+
align-items: center;
|
|
196
|
+
width: calc(
|
|
197
|
+
(100% - v-bind(rowNumber) * var(--ct-search-box-item-margin-right)) /
|
|
198
|
+
v-bind(rowNumber)
|
|
199
|
+
);
|
|
200
|
+
--ct-search-box-item-component-width: 100%;
|
|
201
|
+
&.is-outer-border {
|
|
202
|
+
--ct-font-size: 13px;
|
|
203
|
+
--el-font-size-base: var(--ct-font-size, 13px);
|
|
204
|
+
--ct-search-box-border-color: var(--ct-border-color);
|
|
205
|
+
--ct-search-box-inner-border-color: transparent;
|
|
206
|
+
font-size: var(--ct-font-size);
|
|
207
|
+
height: 36px;
|
|
208
|
+
padding-left: 14px;
|
|
209
|
+
box-shadow: 0 0 0 1px var(--ct-search-box-border-color);
|
|
210
|
+
border-radius: var(--ct-border-radius);
|
|
211
|
+
&:hover {
|
|
212
|
+
--ct-search-box-border-color: var(--ct-color-grey-sub);
|
|
213
|
+
}
|
|
214
|
+
&:focus-within {
|
|
215
|
+
--ct-search-box-border-color: var(--ct-color-primary);
|
|
216
|
+
}
|
|
217
|
+
.el-input__wrapper,
|
|
218
|
+
.el-select__wrapper,
|
|
219
|
+
.ct-year-select__wrapper {
|
|
220
|
+
--el-select-input-focus-border-color: var(
|
|
221
|
+
--ct-search-box-inner-border-color
|
|
222
|
+
);
|
|
223
|
+
box-shadow: 0 0 0 1px var(--ct-search-box-inner-border-color) !important;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
&-label {
|
|
227
|
+
line-height: 1;
|
|
228
|
+
&.is-outer-border {
|
|
229
|
+
color: var(--ct-color-grey-sub);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
&-component {
|
|
233
|
+
flex: 1;
|
|
234
|
+
> * {
|
|
235
|
+
width: var(--ct-search-box-item-component-width) !important;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
&__buttons {
|
|
240
|
+
margin-left: auto;
|
|
241
|
+
button {
|
|
242
|
+
width: 96px;
|
|
243
|
+
padding: 0;
|
|
244
|
+
height: 34px;
|
|
245
|
+
line-height: 34px;
|
|
246
|
+
border-radius: 4px;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<slot></slot>
|
|
4
|
-
</div>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
5
|
</template>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import CtSelect from './src/select.vue';
|
|
2
|
-
|
|
3
|
-
/* istanbul ignore next */
|
|
4
|
-
CtSelect.install = function (Vue) {
|
|
5
|
-
Vue.component('CtSelect', CtSelect);
|
|
6
|
-
};
|
|
7
|
-
|
|
1
|
+
import CtSelect from './src/select.vue';
|
|
2
|
+
|
|
3
|
+
/* istanbul ignore next */
|
|
4
|
+
CtSelect.install = function (Vue) {
|
|
5
|
+
Vue.component('CtSelect', CtSelect);
|
|
6
|
+
};
|
|
7
|
+
|
|
8
8
|
export default CtSelect;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<ct-icon name="arrow-down_line"></ct-icon>
|
|
1
|
+
<template>
|
|
2
|
+
<ct-icon name="arrow-down_line"></ct-icon>
|
|
3
3
|
</template>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<ct-icon name="close_line"></ct-icon>
|
|
1
|
+
<template>
|
|
2
|
+
<ct-icon name="close_line"></ct-icon>
|
|
3
3
|
</template>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="ct-select__empty">
|
|
3
|
-
<span>{{ text }}</span>
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script setup>
|
|
8
|
-
defineProps({
|
|
9
|
-
text: {
|
|
10
|
-
type: String,
|
|
11
|
-
default: "暂无数据",
|
|
12
|
-
},
|
|
13
|
-
});
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ct-select__empty">
|
|
3
|
+
<span>{{ text }}</span>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup>
|
|
8
|
+
defineProps({
|
|
9
|
+
text: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: "暂无数据",
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
14
|
</script>
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { buriedParamsKey, searchComponentProps } from '../../../hooks';
|
|
2
|
-
import arrowDown from './arrow-down.vue';
|
|
3
|
-
import clearIcon from './clear-icon.vue';
|
|
4
|
-
|
|
5
|
-
export const selectEmits = ["update:modelValue", buriedParamsKey];
|
|
6
|
-
export const selectProps = {
|
|
7
|
-
...searchComponentProps,
|
|
8
|
-
modelValue: [String, Number, Array],
|
|
9
|
-
multiple: Boolean,
|
|
10
|
-
options: {
|
|
11
|
-
type: Array,
|
|
12
|
-
default() {
|
|
13
|
-
return []
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
filterable: Boolean,
|
|
17
|
-
api: String,
|
|
18
|
-
serviceMethod: String,
|
|
19
|
-
serviceParams: Object,
|
|
20
|
-
mapObj: {
|
|
21
|
-
type: Object,
|
|
22
|
-
default() {
|
|
23
|
-
return {}
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
selectAllText: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: '全部'
|
|
29
|
-
},
|
|
30
|
-
connectors: {
|
|
31
|
-
type: String,
|
|
32
|
-
default: '、'
|
|
33
|
-
},
|
|
34
|
-
fitInputWidth: {
|
|
35
|
-
type: Boolean,
|
|
36
|
-
default: true,
|
|
37
|
-
},
|
|
38
|
-
clearIcon: {
|
|
39
|
-
type: [String, Object],
|
|
40
|
-
default() {
|
|
41
|
-
return clearIcon
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
suffixIcon: {
|
|
45
|
-
type: [String, Object],
|
|
46
|
-
default() {
|
|
47
|
-
return arrowDown
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
noMatchText: String,
|
|
51
|
-
noDataText: String,
|
|
1
|
+
import { buriedParamsKey, searchComponentProps } from '../../../hooks';
|
|
2
|
+
import arrowDown from './arrow-down.vue';
|
|
3
|
+
import clearIcon from './clear-icon.vue';
|
|
4
|
+
|
|
5
|
+
export const selectEmits = ["update:modelValue", buriedParamsKey];
|
|
6
|
+
export const selectProps = {
|
|
7
|
+
...searchComponentProps,
|
|
8
|
+
modelValue: [String, Number, Array],
|
|
9
|
+
multiple: Boolean,
|
|
10
|
+
options: {
|
|
11
|
+
type: Array,
|
|
12
|
+
default() {
|
|
13
|
+
return []
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
filterable: Boolean,
|
|
17
|
+
api: String,
|
|
18
|
+
serviceMethod: String,
|
|
19
|
+
serviceParams: Object,
|
|
20
|
+
mapObj: {
|
|
21
|
+
type: Object,
|
|
22
|
+
default() {
|
|
23
|
+
return {}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
selectAllText: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: '全部'
|
|
29
|
+
},
|
|
30
|
+
connectors: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: '、'
|
|
33
|
+
},
|
|
34
|
+
fitInputWidth: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: true,
|
|
37
|
+
},
|
|
38
|
+
clearIcon: {
|
|
39
|
+
type: [String, Object],
|
|
40
|
+
default() {
|
|
41
|
+
return clearIcon
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
suffixIcon: {
|
|
45
|
+
type: [String, Object],
|
|
46
|
+
default() {
|
|
47
|
+
return arrowDown
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
noMatchText: String,
|
|
51
|
+
noDataText: String,
|
|
52
52
|
}
|