fit2cloud-ui-plus 0.0.1-beta.8 → 1.0.0-beta.2
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 +61 -9
- package/lib/fit2cloud-ui-plus.es.js +1438 -533
- package/lib/fit2cloud-ui-plus.umd.js +1 -1
- package/package.json +10 -5
- package/src/components/filter-bar/FuFilter.vue +36 -22
- package/src/components/filter-bar/FuFilterBar.vue +31 -17
- package/src/components/filter-bar/FuFilterInput.vue +48 -0
- package/src/components/filter-bar/filter-components/FuFilterDate.vue +13 -5
- package/src/components/filter-bar/filter-components/FuFilterDateTime.vue +17 -14
- package/src/components/filter-bar/filter-components/FuFilterSelect.vue +19 -13
- package/src/components/filter-bar/index.ts +11 -12
- package/src/components/icon-button/FuIconButton.vue +54 -0
- package/src/components/icon-button/index.ts +9 -0
- package/src/components/read-write-switch/FuSelectRwSwitch.vue +23 -10
- package/src/components/search-bar/FuComplexSearch.vue +104 -0
- package/src/components/search-bar/FuQuickSearch.vue +64 -0
- package/src/components/search-bar/FuSearchBar.vue +153 -0
- package/src/components/search-bar/FuSearchBarButton.vue +23 -0
- package/src/components/search-bar/FuSearchContions.vue +40 -0
- package/src/components/search-bar/complex-components/FuComplexDate.vue +70 -0
- package/src/components/search-bar/complex-components/FuComplexDateTime.vue +74 -0
- package/src/components/search-bar/complex-components/FuComplexInput.vue +57 -0
- package/src/components/search-bar/complex-components/FuComplexSelect.vue +93 -0
- package/src/components/search-bar/index.ts +20 -0
- package/src/components/search-bar/types.ts +23 -0
- package/src/components/speed-dial/FuSpeedDial.vue +71 -60
- package/src/components/speed-dial/FuSpeedDialActionButton.vue +55 -55
- package/src/components/speed-dial/FuSpeedDialButton.vue +14 -11
- package/src/components/speed-dial/FuSpeedDialItem.vue +9 -15
- package/src/components/speed-dial/types.ts +12 -0
- package/src/components/split-pane/FuSplitPane.vue +2 -2
- package/src/components/table/FuTable.vue +12 -13
- package/src/components/table/{table-column-dropdown/FuTableColumnDropdown.vue → FuTableColumnDropdown.vue} +0 -0
- package/src/components/table/index.ts +11 -7
- package/src/components/table/table-column-select/FuTableColumnSelectDialog.vue +3 -9
- package/src/components/table/table-column-select/FuTableColumnSelectPopover.vue +4 -3
- package/src/components/table/table-operations/FuTableButton.vue +1 -4
- package/src/components/table/table-operations/FuTableMoreButton.vue +1 -1
- package/src/components/table/table-operations/FuTableOperations.vue +1 -2
- package/src/components/table/types.ts +3 -0
- package/src/components/tabs/FuTabs.vue +4 -3
- package/src/hooks/index.ts +2 -1
- package/src/hooks/use-global-config/index.ts +25 -22
- package/src/hooks/use-locale/index.ts +1 -1
- package/src/hooks/use-size/index.ts +35 -0
- package/src/index.ts +5 -2
- package/src/styles/common/function.scss +14 -4
- package/src/styles/common/mixins.scss +9 -4
- package/src/styles/common/variables.scss +55 -18
- package/src/styles/components/filter-bar.scss +16 -16
- package/src/styles/components/icon-button.scss +66 -0
- package/src/styles/components/search-bar.scss +240 -0
- package/src/styles/components/speed-dial.scss +1 -51
- package/src/styles/components/table.scss +7 -9
- package/src/styles/index.scss +2 -0
- package/src/styles/themes/default.scss +91 -0
- package/src/tools/size.ts +6 -0
- package/src/tools/theme.ts +0 -12
- package/types/examples/App.vue.d.ts +2 -0
- package/types/examples/components/CodeExample.vue.d.ts +29 -0
- package/types/examples/components/DocumentTable.vue.d.ts +14 -0
- package/types/examples/components/Markdown.vue.d.ts +12 -0
- package/types/examples/layout/components/AppHeader.vue.d.ts +2 -0
- package/types/examples/layout/components/Sidebar.vue.d.ts +2 -0
- package/types/examples/layout/index.vue.d.ts +2 -0
- package/types/examples/main.d.ts +2 -0
- package/types/examples/pages/filter-bar/attributes.d.ts +63 -0
- package/types/examples/pages/filter-bar/demo/BaseFilterBar.vue.d.ts +2 -0
- package/types/examples/pages/filter-bar/demo/SetConditionsDemo.vue.d.ts +2 -0
- package/types/examples/pages/filter-bar/demo/SlotDemo.vue.d.ts +2 -0
- package/types/examples/pages/filter-bar/index.vue.d.ts +2 -0
- package/types/examples/pages/icon-button/attributes.d.ts +45 -0
- package/types/examples/pages/icon-button/demo/BaseIconButton.vue.d.ts +2 -0
- package/types/examples/pages/icon-button/demo/SlotDemo.vue.d.ts +2 -0
- package/types/examples/pages/icon-button/index.vue.d.ts +2 -0
- package/types/examples/pages/index.d.ts +3 -0
- package/types/examples/pages/read-write-switch/attributes.d.ts +63 -0
- package/types/examples/pages/read-write-switch/demo/BaseDemo.vue.d.ts +2 -0
- package/types/examples/pages/read-write-switch/demo/CustomContentDemo.vue.d.ts +2 -0
- package/types/examples/pages/read-write-switch/demo/InputRwSwitchDemo.vue.d.ts +2 -0
- package/types/examples/pages/read-write-switch/demo/ReadSwitchDemo.vue.d.ts +2 -0
- package/types/examples/pages/read-write-switch/demo/SelectRwSwitchDemo.vue.d.ts +2 -0
- package/types/examples/pages/read-write-switch/demo/TableInnerEditDemo.vue.d.ts +2 -0
- package/types/examples/pages/read-write-switch/demo/WriteSwitchDemo.vue.d.ts +2 -0
- package/types/examples/pages/read-write-switch/index.vue.d.ts +2 -0
- package/types/examples/pages/search/attributes.d.ts +57 -0
- package/types/examples/pages/search/demo/BaseSearchbar.vue.d.ts +66 -0
- package/types/examples/pages/search/demo/ComplexComponentsDemo.vue.d.ts +60 -0
- package/types/examples/pages/search/demo/ComplexSearchDemo.vue.d.ts +84 -0
- package/types/examples/pages/search/demo/CustomComponentsDemo.vue.d.ts +50 -0
- package/types/examples/pages/search/demo/EchoConditionsDemo.vue.d.ts +52 -0
- package/types/examples/pages/search/demo/QuickSearchDemo.vue.d.ts +18 -0
- package/types/examples/pages/search/demo/SearchBarButtonDemo.vue.d.ts +54 -0
- package/types/examples/pages/search/index.vue.d.ts +150 -0
- package/types/examples/pages/search-bar/attributes.d.ts +63 -0
- package/types/examples/pages/search-bar/demo/BaseSearchbar.vue.d.ts +31 -0
- package/types/examples/pages/search-bar/demo/ComplexSearchDemo.vue.d.ts +40 -0
- package/types/examples/pages/search-bar/demo/EchoConditionsDemo.vue.d.ts +32 -0
- package/types/examples/pages/search-bar/demo/QuickSearchDemo.vue.d.ts +7 -0
- package/types/examples/pages/search-bar/demo/SearchBarButtonDemo.vue.d.ts +32 -0
- package/types/examples/pages/search-bar/index.vue.d.ts +2 -0
- package/types/examples/pages/speed-dial/attributes.d.ts +63 -0
- package/types/examples/pages/speed-dial/demo/BaseSpeedDial.vue.d.ts +2 -0
- package/types/examples/pages/speed-dial/demo/SpeedDialCustom.vue.d.ts +2 -0
- package/types/examples/pages/speed-dial/demo/SpeedDialPosition.vue.d.ts +2 -0
- package/types/examples/pages/speed-dial/demo/SpeedDialTrigger.vue.d.ts +2 -0
- package/types/examples/pages/speed-dial/index.vue.d.ts +2 -0
- package/types/examples/pages/split-pane/attributes.d.ts +63 -0
- package/types/examples/pages/split-pane/demo/BaseSplit.vue.d.ts +2 -0
- package/types/examples/pages/split-pane/demo/CustomResizer.vue.d.ts +2 -0
- package/types/examples/pages/split-pane/demo/NestSplit.vue.d.ts +2 -0
- package/types/examples/pages/split-pane/demo/ResizerType.vue.d.ts +2 -0
- package/types/examples/pages/split-pane/index.vue.d.ts +2 -0
- package/types/examples/pages/table/attributes.d.ts +121 -0
- package/types/examples/pages/table/demo/BaseTable.vue.d.ts +2 -0
- package/types/examples/pages/table/demo/DropdownColumn.vue.d.ts +2 -0
- package/types/examples/pages/table/demo/DropdownColumnSlot.vue.d.ts +2 -0
- package/types/examples/pages/table/demo/SaveSelectColumn.vue.d.ts +2 -0
- package/types/examples/pages/table/demo/SelectColumn.vue.d.ts +2 -0
- package/types/examples/pages/table/demo/TableOperations.vue.d.ts +2 -0
- package/types/examples/pages/table/demo/TablePagination.vue.d.ts +2 -0
- package/types/examples/pages/table/index.vue.d.ts +2 -0
- package/types/examples/pages/tabs/attributes.d.ts +63 -0
- package/types/examples/pages/tabs/demo/AddCloseTab.vue.d.ts +2 -0
- package/types/examples/pages/tabs/index.vue.d.ts +2 -0
- package/types/examples/router/doc-routes.d.ts +12 -0
- package/types/examples/router/index.d.ts +4 -0
- package/types/examples/router/styles-routes.d.ts +12 -0
- package/types/examples/style-guide/button/BaseButton.vue.d.ts +2 -0
- package/types/examples/style-guide/button/IconButton.vue.d.ts +2 -0
- package/types/examples/style-guide/button/PlainButton.vue.d.ts +2 -0
- package/types/examples/style-guide/button/TextButton.vue.d.ts +2 -0
- package/types/examples/style-guide/button/index.vue.d.ts +2 -0
- package/types/examples/style-guide/input/BaseInput.vue.d.ts +2 -0
- package/types/examples/style-guide/input/SearchInput.vue.d.ts +2 -0
- package/types/examples/style-guide/input/Textarea.vue.d.ts +2 -0
- package/types/examples/style-guide/input/index.vue.d.ts +2 -0
- package/types/examples/style-guide/select/BaseSelect.vue.d.ts +2 -0
- package/types/examples/style-guide/select/index.vue.d.ts +2 -0
- package/types/plugins/example-transform.d.ts +5 -0
- package/types/src/components/filter-bar/FuFilter.vue.d.ts +42 -0
- package/types/src/components/filter-bar/FuFilterBar.vue.d.ts +33 -0
- package/types/src/components/filter-bar/FuFilterConditions.vue.d.ts +8 -0
- package/types/src/components/filter-bar/FuFilterInput.vue.d.ts +17 -0
- package/types/src/components/filter-bar/FuSearchInput.vue.d.ts +17 -0
- package/types/src/components/filter-bar/filter-components/FuFilterDate.vue.d.ts +36 -0
- package/types/src/components/filter-bar/filter-components/FuFilterDateTime.vue.d.ts +36 -0
- package/types/src/components/filter-bar/filter-components/FuFilterOption.vue.d.ts +24 -0
- package/types/src/components/filter-bar/filter-components/FuFilterSelect.vue.d.ts +66 -0
- package/types/src/components/filter-bar/index.d.ts +2 -0
- package/types/src/components/filter-bar/types.d.ts +22 -0
- package/types/src/components/icon-button/FuIconButton.vue.d.ts +43 -0
- package/types/src/components/icon-button/index.d.ts +2 -0
- package/types/src/components/read-write-switch/FuInputRwSwitch.vue.d.ts +21 -0
- package/types/src/components/read-write-switch/FuReadWriteSwitch.vue.d.ts +23 -0
- package/types/src/components/read-write-switch/FuSelectRwSwitch.vue.d.ts +43 -0
- package/types/src/components/read-write-switch/index.d.ts +2 -0
- package/types/src/components/read-write-switch/types.d.ts +4 -0
- package/types/src/components/search-bar/FuComplexSearch.vue.d.ts +22 -0
- package/types/src/components/search-bar/FuQuickSearch.vue.d.ts +29 -0
- package/types/src/components/search-bar/FuSearchBar.vue.d.ts +58 -0
- package/types/src/components/search-bar/FuSearchBarButton.vue.d.ts +14 -0
- package/types/src/components/search-bar/FuSearchContions.vue.d.ts +26 -0
- package/types/src/components/search-bar/complex-components/FuComplexDate.vue.d.ts +36 -0
- package/types/src/components/search-bar/complex-components/FuComplexDateTime.vue.d.ts +36 -0
- package/types/src/components/search-bar/complex-components/FuComplexInput.vue.d.ts +26 -0
- package/types/src/components/search-bar/complex-components/FuComplexSelect.vue.d.ts +50 -0
- package/types/src/components/search-bar/complex-components/index.d.ts +0 -0
- package/types/src/components/search-bar/complex-components/mixins.d.ts +6 -0
- package/types/src/components/search-bar/index.d.ts +2 -0
- package/types/src/components/search-bar/types.d.ts +17 -0
- package/types/src/components/speed-dial/FuSpeedDial.vue.d.ts +218 -0
- package/types/src/components/speed-dial/FuSpeedDialActionButton.vue.d.ts +32 -0
- package/types/src/components/speed-dial/FuSpeedDialButton.vue.d.ts +42 -0
- package/types/src/components/speed-dial/FuSpeedDialItem.vue.d.ts +12 -0
- package/types/src/components/speed-dial/index.d.ts +2 -0
- package/types/src/components/speed-dial/types.d.ts +8 -0
- package/types/src/components/split-pane/FuSplitPane.vue.d.ts +59 -0
- package/types/src/components/split-pane/index.d.ts +2 -0
- package/types/src/components/table/FuTable.vue.d.ts +18 -0
- package/types/src/components/table/FuTableBody.d.ts +3 -0
- package/types/src/components/table/FuTableColumnDropdown.vue.d.ts +50 -0
- package/types/src/components/table/FuTablePagination.vue.d.ts +47 -0
- package/types/src/components/table/index.d.ts +2 -0
- package/types/src/components/table/table-column-select/FuTableColumnSelect.vue.d.ts +10 -0
- package/types/src/components/table/table-column-select/FuTableColumnSelectDialog.vue.d.ts +23 -0
- package/types/src/components/table/table-column-select/FuTableColumnSelectPopover.vue.d.ts +34 -0
- package/types/src/components/table/table-column-select/utils.d.ts +8 -0
- package/types/src/components/table/table-operations/FuTableButton.vue.d.ts +13 -0
- package/types/src/components/table/table-operations/FuTableMoreButton.vue.d.ts +37 -0
- package/types/src/components/table/table-operations/FuTableOperations.vue.d.ts +46 -0
- package/types/src/components/table/types.d.ts +2 -0
- package/types/src/components/tabs/FuTabs.vue.d.ts +54 -0
- package/types/src/components/tabs/index.d.ts +2 -0
- package/types/src/hooks/index.d.ts +3 -0
- package/types/src/hooks/use-global-config/index.d.ts +9 -0
- package/types/src/hooks/use-locale/index.d.ts +14 -0
- package/types/src/hooks/use-size/index.d.ts +9 -0
- package/types/src/index.d.ts +8 -0
- package/types/src/locale/index.d.ts +10 -0
- package/types/src/locale/lang/en.d.ts +59 -0
- package/types/src/locale/lang/zh-cn.d.ts +59 -0
- package/types/src/locale/lang/zh-tw.d.ts +59 -0
- package/types/src/tools/size.d.ts +4 -0
- package/types/src/tools/theme.d.ts +1 -0
- package/types/src/tools/time.d.ts +2 -0
- package/types/src/tools/types.d.ts +8 -0
- package/types/src/tools/utils.d.ts +2 -0
- package/types/src/tools/vnode.d.ts +9 -0
- package/src/components/filter-bar/FuSearchInput.vue +0 -31
- package/src/components/steps/FuHorizontalNavigation.vue +0 -18
- package/src/components/steps/FuHorizontalSteps.vue +0 -94
- package/src/components/steps/FuStep.vue +0 -13
- package/src/components/steps/FuSteps.vue +0 -22
- package/src/components/steps/FuStepsFooter.ts +0 -79
- package/src/components/steps/FuVerticalNavigation.vue +0 -35
- package/src/components/steps/FuVerticalSteps.vue +0 -79
- package/src/components/steps/Stepper.ts +0 -188
- package/src/components/steps/index.ts +0 -11
- package/src/components/table/table-column-dropdown/index.ts +0 -7
- package/src/components/table/table-column-select/index.ts +0 -8
- package/src/components/table/table-operations/index.ts +0 -12
- package/src/components/virtual-scroller/FuVirtualHorizontalScroll.js +0 -96
- package/src/components/virtual-scroller/FuVirtualScroll.js +0 -15
- package/src/components/virtual-scroller/FuVirtualVerticalScroll.js +0 -95
- package/src/components/virtual-scroller/index.js +0 -10
|
@@ -5,43 +5,53 @@
|
|
|
5
5
|
<slot name="tl"></slot>
|
|
6
6
|
</div>
|
|
7
7
|
<div class="top_right">
|
|
8
|
-
<slot name="tr">
|
|
9
|
-
|
|
10
|
-
<FuSearchInput v-model="quick" :placeholder="quickPlaceholder" @change="change"/>
|
|
11
|
-
<el-button @click="open" icon="Filter">{{ t('fu.filter_bar.filter') }}
|
|
12
|
-
<span v-if="conditions.length > 0">({{ conditions.length }})</span>
|
|
13
|
-
</el-button>
|
|
8
|
+
<slot name="tr" :condition="conditionObj">
|
|
9
|
+
<fu-filter-input :size="configSize" v-model="quick" :placeholder="quickPlaceholder" @change="change"/>
|
|
14
10
|
</slot>
|
|
11
|
+
<el-button class="fu-filter-button" @click="open" icon="Filter" :size="configSize">{{ t('fu.filter_bar.filter') }}
|
|
12
|
+
<span v-if="conditions.length > 0">({{ conditions.length }})</span>
|
|
13
|
+
</el-button>
|
|
14
|
+
|
|
15
15
|
<slot name="buttons"></slot>
|
|
16
16
|
</div>
|
|
17
17
|
</div>
|
|
18
18
|
<div class="fu-filter-bar__bottom">
|
|
19
|
-
<
|
|
19
|
+
<fu-filter ref="filterRef" @filter="filter" :count="resultCount" :components="components" :size="configSize"
|
|
20
|
+
:show-empty="showEmpty">
|
|
20
21
|
<slot></slot>
|
|
21
|
-
</
|
|
22
|
+
</fu-filter>
|
|
22
23
|
</div>
|
|
23
24
|
</div>
|
|
24
25
|
</template>
|
|
25
26
|
|
|
26
27
|
<script setup lang="ts">
|
|
27
28
|
import {ref, computed} from "vue";
|
|
28
|
-
import {useLocale} from "@/hooks"
|
|
29
|
-
import
|
|
29
|
+
import {useLocale, useSize} from "@/hooks"
|
|
30
|
+
import {validateSize} from "@/tools/size";
|
|
31
|
+
import FuFilterInput from "@/components/filter-bar/FuFilterInput.vue";
|
|
30
32
|
import FuFilter from "@/components/filter-bar/FuFilter.vue";
|
|
31
|
-
defineOptions({ name: "FuFilterBar" });
|
|
32
|
-
const {t} = useLocale()
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
defineOptions({name: "FuFilterBar"});
|
|
35
|
+
const {t} = useLocale()
|
|
36
|
+
defineProps({
|
|
37
|
+
size: {
|
|
38
|
+
type: String,
|
|
39
|
+
validator: validateSize
|
|
40
|
+
},
|
|
35
41
|
resultCount: Number,
|
|
36
42
|
quickPlaceholder: String,
|
|
37
|
-
components: Array
|
|
43
|
+
components: Array,
|
|
44
|
+
showEmpty: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false
|
|
47
|
+
}
|
|
38
48
|
})
|
|
39
49
|
|
|
40
50
|
const emit = defineEmits(["exec"])
|
|
41
51
|
|
|
52
|
+
const configSize = useSize()
|
|
42
53
|
const quick = ref("")
|
|
43
54
|
const conditions = ref([])
|
|
44
|
-
|
|
45
55
|
const filterRef = ref()
|
|
46
56
|
|
|
47
57
|
function open() {
|
|
@@ -62,7 +72,10 @@ function setConditions(conditionObj: any) {
|
|
|
62
72
|
}
|
|
63
73
|
|
|
64
74
|
const conditionObj = computed(() => {
|
|
65
|
-
let obj: any = {
|
|
75
|
+
let obj: any = {}
|
|
76
|
+
if (quick.value) {
|
|
77
|
+
obj.quick = quick.value
|
|
78
|
+
}
|
|
66
79
|
conditions.value.forEach((c: any) => {
|
|
67
80
|
obj[c.field] = c
|
|
68
81
|
})
|
|
@@ -70,6 +83,7 @@ const conditionObj = computed(() => {
|
|
|
70
83
|
});
|
|
71
84
|
|
|
72
85
|
defineExpose({
|
|
73
|
-
setConditions
|
|
86
|
+
setConditions,
|
|
87
|
+
open
|
|
74
88
|
})
|
|
75
89
|
</script>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-input class="fu-filter-input" prefix-icon="Search" v-model="quick" @input="input" @blur="blur" @keydown="keydown"
|
|
3
|
+
@clear="clear" v-bind="$attrs" clearable :size="configSize"/>
|
|
4
|
+
</template>
|
|
5
|
+
|
|
6
|
+
<script setup lang="ts">
|
|
7
|
+
import {ref, watch} from "vue";
|
|
8
|
+
import {validateSize} from "@/tools/size";
|
|
9
|
+
import {useSize} from "@/hooks";
|
|
10
|
+
|
|
11
|
+
defineOptions({name: "FuFilterInput"});
|
|
12
|
+
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
size: {
|
|
15
|
+
type: String,
|
|
16
|
+
validator: validateSize
|
|
17
|
+
},
|
|
18
|
+
modelValue: String,
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const emit = defineEmits(["update:modelValue", "change"])
|
|
22
|
+
const quick = ref("")
|
|
23
|
+
const configSize = useSize()
|
|
24
|
+
|
|
25
|
+
watch(() => props.modelValue, (val: any) => {
|
|
26
|
+
quick.value = val
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
function input(e: Event) {
|
|
30
|
+
emit("update:modelValue", quick.value, e)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function blur(e: Event) {
|
|
34
|
+
emit("change", quick.value, e)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function clear() {
|
|
38
|
+
emit("update:modelValue", quick.value)
|
|
39
|
+
emit("change", quick.value)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function keydown(e: Event) {
|
|
43
|
+
const event = e as KeyboardEvent
|
|
44
|
+
if (event.key === "Enter") {
|
|
45
|
+
emit("change", quick.value, e)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
</script>
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
<div class="fu-filter-component">
|
|
3
3
|
<div class="fu-filter-component__label">{{ label }}</div>
|
|
4
4
|
<div class="fu-filter-component__content">
|
|
5
|
-
<!--
|
|
6
|
-
<el-date-picker class="fu-filter-date" v-model="value" v-bind="$attrs"
|
|
5
|
+
<!--configSize-->
|
|
6
|
+
<el-date-picker class="fu-filter-date" v-model="value" v-bind="$attrs" :size="configSize"
|
|
7
7
|
:placeholder="t('fu.search_bar.select_date')" type="daterange" :value-format="valueFormat"
|
|
8
8
|
:start-placeholder="t('fu.search_bar.start_date')" :end-placeholder="t('fu.search_bar.end_date')">
|
|
9
9
|
</el-date-picker>
|
|
@@ -15,11 +15,16 @@
|
|
|
15
15
|
import {ref, computed, inject} from "vue";
|
|
16
16
|
import {FilterCondition, ReferenceContext, referenceKey} from "../types";
|
|
17
17
|
import {dateFormat} from "@/tools/time";
|
|
18
|
-
import {useLocale} from "@/hooks"
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
import {useLocale, useSize} from "@/hooks"
|
|
19
|
+
import {validateSize} from "@/tools/size";
|
|
20
|
+
|
|
21
|
+
defineOptions({name: "FuFilterDate"});
|
|
21
22
|
|
|
22
23
|
const props = defineProps({
|
|
24
|
+
size: {
|
|
25
|
+
type: String,
|
|
26
|
+
validator: validateSize
|
|
27
|
+
},
|
|
23
28
|
label: String,
|
|
24
29
|
field: {
|
|
25
30
|
type: String,
|
|
@@ -31,6 +36,7 @@ const props = defineProps({
|
|
|
31
36
|
},
|
|
32
37
|
})
|
|
33
38
|
const value = ref('')
|
|
39
|
+
const configSize = useSize()
|
|
34
40
|
|
|
35
41
|
const valueLabel = computed(() => {
|
|
36
42
|
return (
|
|
@@ -40,6 +46,8 @@ const valueLabel = computed(() => {
|
|
|
40
46
|
);
|
|
41
47
|
})
|
|
42
48
|
|
|
49
|
+
const {t} = useLocale()
|
|
50
|
+
|
|
43
51
|
function getCondition(): FilterCondition | undefined {
|
|
44
52
|
if (!String(value.value)) return;
|
|
45
53
|
let {field, label} = props
|
|
@@ -3,25 +3,27 @@
|
|
|
3
3
|
<div class="fu-filter-component__label">{{ label }}</div>
|
|
4
4
|
<div class="fu-filter-component__content">
|
|
5
5
|
<!-- :size="configSize" -->
|
|
6
|
-
<el-date-picker class="fu-filter-date" v-model="value" v-bind="$attrs"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
:start-placeholder="t('fu.search_bar.start_date_time')"
|
|
10
|
-
:end-placeholder="t('fu.search_bar.end_date_time')">
|
|
6
|
+
<el-date-picker class="fu-filter-date" v-model="value" v-bind="$attrs" :size="configSize"
|
|
7
|
+
:placeholder="t('fu.search_bar.select_date_time')" type="datetimerange" :value-format="valueFormat"
|
|
8
|
+
:start-placeholder="t('fu.search_bar.start_date_time')" :end-placeholder="t('fu.search_bar.end_date_time')">
|
|
11
9
|
</el-date-picker>
|
|
12
10
|
</div>
|
|
13
11
|
</div>
|
|
14
12
|
</template>
|
|
15
13
|
|
|
16
14
|
<script setup lang="ts">
|
|
17
|
-
import {ref, computed, inject} from "vue";
|
|
18
|
-
import {FilterCondition, ReferenceContext, referenceKey} from "../types";
|
|
19
|
-
import {datetimeFormat} from "@/tools/time";
|
|
20
|
-
import {useLocale} from "@/hooks"
|
|
15
|
+
import { ref, computed, inject } from "vue";
|
|
16
|
+
import { FilterCondition, ReferenceContext, referenceKey } from "../types";
|
|
17
|
+
import { datetimeFormat } from "@/tools/time";
|
|
18
|
+
import {useLocale, useSize} from "@/hooks"
|
|
19
|
+
import { validateSize } from "@/tools/size";
|
|
21
20
|
defineOptions({ name: "FuFilterDateTime" });
|
|
22
|
-
const {t} = useLocale()
|
|
23
21
|
|
|
24
22
|
const props = defineProps({
|
|
23
|
+
size: {
|
|
24
|
+
type: String,
|
|
25
|
+
validator: validateSize
|
|
26
|
+
},
|
|
25
27
|
label: String,
|
|
26
28
|
field: {
|
|
27
29
|
type: String,
|
|
@@ -34,7 +36,7 @@ const props = defineProps({
|
|
|
34
36
|
})
|
|
35
37
|
|
|
36
38
|
const value = ref('')
|
|
37
|
-
|
|
39
|
+
const configSize = useSize()
|
|
38
40
|
const valueLabel = computed(() => {
|
|
39
41
|
return (
|
|
40
42
|
datetimeFormat(value.value[0]) +
|
|
@@ -42,11 +44,12 @@ const valueLabel = computed(() => {
|
|
|
42
44
|
datetimeFormat(value.value[1])
|
|
43
45
|
);
|
|
44
46
|
})
|
|
47
|
+
const { t } = useLocale()
|
|
45
48
|
|
|
46
49
|
function getCondition(): FilterCondition | undefined {
|
|
47
50
|
if (!String(value.value)) return;
|
|
48
|
-
let {field, label} = props
|
|
49
|
-
return {field, label, value: value.value, valueLabel: valueLabel.value}
|
|
51
|
+
let { field, label } = props
|
|
52
|
+
return { field, label, value: value.value, valueLabel: valueLabel.value }
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
function init(v: any) {
|
|
@@ -55,7 +58,7 @@ function init(v: any) {
|
|
|
55
58
|
|
|
56
59
|
const references = inject(referenceKey)
|
|
57
60
|
const field = props.field
|
|
58
|
-
const reference: ReferenceContext = {field, init, getCondition}
|
|
61
|
+
const reference: ReferenceContext = { field, init, getCondition }
|
|
59
62
|
references?.value.push(reference)
|
|
60
63
|
|
|
61
64
|
defineExpose({
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
<div class="fu-filter-component">
|
|
3
3
|
<div class="fu-filter-component__label">{{ label }}</div>
|
|
4
4
|
<div class="fu-filter-component__content">
|
|
5
|
-
<fu-filter-option :label="o.label" :value="o.value" v-for="o in showOptions" :key="o.value"/>
|
|
5
|
+
<fu-filter-option :label="o.label" :value="o.value" v-for="o in showOptions" :key="o.value" />
|
|
6
6
|
<el-popover popper-class="fu-filter-component-popover" :show-arrow="false" placement="bottom-start"
|
|
7
|
-
|
|
7
|
+
trigger="click" width="240">
|
|
8
8
|
<el-select v-model="selection" v-bind="$attrs" :multiple="multiple" @change="change" :teleported="false"
|
|
9
|
-
|
|
9
|
+
:size="configSize" :placeholder="t('fu.search_bar.please_select')">
|
|
10
10
|
<el-option value="" v-if="useSelectAll && multiple">
|
|
11
11
|
<div @click="selectAll">{{ t('fu.filter_bar.select_all') }}</div>
|
|
12
12
|
</el-option>
|
|
13
|
-
<el-option :label="o.label" :value="o.value" v-for="o in options" :key="o.value"/>
|
|
13
|
+
<el-option :label="o.label" :value="o.value" v-for="o in options" :key="o.value" />
|
|
14
14
|
</el-select>
|
|
15
15
|
<template #reference>
|
|
16
16
|
<div class="fu-filter-option">
|
|
17
17
|
<el-icon>
|
|
18
|
-
<Plus/>
|
|
18
|
+
<Plus />
|
|
19
19
|
</el-icon>
|
|
20
20
|
{{ t('fu.filter_bar.more') }}
|
|
21
21
|
</div>
|
|
@@ -26,15 +26,19 @@
|
|
|
26
26
|
</template>
|
|
27
27
|
|
|
28
28
|
<script setup lang="ts">
|
|
29
|
-
import {ref, provide, computed, PropType, Ref, inject} from "vue";
|
|
29
|
+
import { ref, provide, computed, PropType, Ref, inject } from "vue";
|
|
30
30
|
import FuFilterOption from "./FuFilterOption.vue";
|
|
31
|
-
import {FilterCondition, OptionProps, ReferenceContext, referenceKey, selectKey} from "../types";
|
|
31
|
+
import { FilterCondition, OptionProps, ReferenceContext, referenceKey, selectKey } from "../types";
|
|
32
32
|
|
|
33
|
-
import {useLocale} from "@/hooks"
|
|
33
|
+
import {useLocale, useSize} from "@/hooks"
|
|
34
|
+
import { validateSize } from "@/tools/size";
|
|
34
35
|
defineOptions({ name: "FuFilterSelect" });
|
|
35
|
-
const {t} = useLocale()
|
|
36
36
|
|
|
37
37
|
const props = defineProps({
|
|
38
|
+
size: {
|
|
39
|
+
type: String,
|
|
40
|
+
validator: validateSize
|
|
41
|
+
},
|
|
38
42
|
multiple: {
|
|
39
43
|
type: Boolean,
|
|
40
44
|
default: false
|
|
@@ -60,7 +64,7 @@ const props = defineProps({
|
|
|
60
64
|
const emit = defineEmits(["change"])
|
|
61
65
|
|
|
62
66
|
const selection: Ref<Array<string | number> | string | number> = ref(props.multiple ? [] : '')
|
|
63
|
-
|
|
67
|
+
const configSize = useSize()
|
|
64
68
|
const showOptions = computed(() => {
|
|
65
69
|
return props.options.filter((o, i) => {
|
|
66
70
|
let show = props.showLimit < 0 ? true : i < props.showLimit
|
|
@@ -83,6 +87,8 @@ const valueLabel = computed(() => {
|
|
|
83
87
|
return getValueLabel(selection.value);
|
|
84
88
|
})
|
|
85
89
|
|
|
90
|
+
const { t } = useLocale()
|
|
91
|
+
|
|
86
92
|
function change(v: string) {
|
|
87
93
|
if (v.includes("")) {
|
|
88
94
|
selection.value = props.options.map(o => o.value)
|
|
@@ -118,8 +124,8 @@ function getValueLabel(value: string | number) {
|
|
|
118
124
|
|
|
119
125
|
function getCondition(): FilterCondition | undefined {
|
|
120
126
|
if (!selection.value || (Array.isArray(selection.value) && selection.value.length === 0)) return;
|
|
121
|
-
let {field, label} = props
|
|
122
|
-
return {field, label, value: selection.value, valueLabel: valueLabel.value}
|
|
127
|
+
let { field, label } = props
|
|
128
|
+
return { field, label, value: selection.value, valueLabel: valueLabel.value }
|
|
123
129
|
}
|
|
124
130
|
|
|
125
131
|
function init(v: any) {
|
|
@@ -133,7 +139,7 @@ provide(selectKey, {
|
|
|
133
139
|
|
|
134
140
|
const references = inject(referenceKey)
|
|
135
141
|
const field = props.field
|
|
136
|
-
const reference: ReferenceContext = {field, init, getCondition}
|
|
142
|
+
const reference: ReferenceContext = { field, init, getCondition }
|
|
137
143
|
references?.value.push(reference)
|
|
138
144
|
|
|
139
145
|
defineExpose({
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import FuFilterInput from "./FuFilterInput.vue";
|
|
2
2
|
import FuFilterBar from "./FuFilterBar.vue";
|
|
3
3
|
import FuFilter from "./FuFilter.vue";
|
|
4
4
|
import FuFilterSelect from "./filter-components/FuFilterSelect.vue";
|
|
5
5
|
import FuFilterDate from "./filter-components/FuFilterDate.vue";
|
|
6
6
|
import FuFilterDateTime from "./filter-components/FuFilterDateTime.vue";
|
|
7
|
+
import type { App } from "vue";
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
FuFilterBar.install = (app: App): void => {
|
|
10
|
+
app.component(FuFilterBar.name, FuFilterBar);
|
|
11
|
+
app.component(FuFilter.name, FuFilter);
|
|
12
|
+
app.component(FuFilterInput.name, FuFilterInput);
|
|
13
|
+
app.component(FuFilterSelect.name, FuFilterSelect);
|
|
14
|
+
app.component(FuFilterDate.name, FuFilterDate);
|
|
15
|
+
app.component(FuFilterDateTime.name, FuFilterDateTime);
|
|
16
|
+
};
|
|
9
17
|
|
|
10
|
-
export default
|
|
11
|
-
install: (app: App): void => {
|
|
12
|
-
app.component(FuFilterBar.name, FuFilterBar)
|
|
13
|
-
app.component(FuFilter.name, FuFilter)
|
|
14
|
-
app.component(FuSearchInput.name, FuSearchInput)
|
|
15
|
-
app.component(FuFilterSelect.name, FuFilterSelect)
|
|
16
|
-
app.component(FuFilterDate.name, FuFilterDate)
|
|
17
|
-
app.component(FuFilterDateTime.name, FuFilterDateTime)
|
|
18
|
-
}
|
|
19
|
-
}
|
|
18
|
+
export default FuFilterBar;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="fu-icon-button" :class="[{'is-disabled':disabled}, typeClass]" :tabindex="tabindex" @click="click">
|
|
3
|
+
<slot>
|
|
4
|
+
<el-icon :color="color" :size="size" :class="{'is-loading': loading}">
|
|
5
|
+
<component :is="name"/>
|
|
6
|
+
</el-icon>
|
|
7
|
+
</slot>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
|
|
14
|
+
import {computed} from "vue";
|
|
15
|
+
import {validateType} from "@/tools/theme";
|
|
16
|
+
|
|
17
|
+
defineOptions({name: "FuIconButton"});
|
|
18
|
+
|
|
19
|
+
const props = defineProps({
|
|
20
|
+
name: String,
|
|
21
|
+
size: {
|
|
22
|
+
type: [Number, String],
|
|
23
|
+
default: 20,
|
|
24
|
+
},
|
|
25
|
+
color: String,
|
|
26
|
+
loading: Boolean,
|
|
27
|
+
disabled: Boolean,
|
|
28
|
+
type: {
|
|
29
|
+
type: String,
|
|
30
|
+
validator: validateType
|
|
31
|
+
},
|
|
32
|
+
tabindex: {
|
|
33
|
+
type: [String, Number],
|
|
34
|
+
default: 0,
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const typeClass = computed(() => {
|
|
39
|
+
return props.type ? `fu-icon-button--${props.type}` : ""
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const emit = defineEmits(["click"])
|
|
43
|
+
|
|
44
|
+
function click(e: MouseEvent) {
|
|
45
|
+
if (!props.disabled) {
|
|
46
|
+
emit("click", e)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<style scoped>
|
|
53
|
+
|
|
54
|
+
</style>
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
</template>
|
|
8
8
|
<template #default="{ read }">
|
|
9
9
|
<el-select v-model="data" v-bind="$attrs" @input="input" @blur="blur(read, $event)"
|
|
10
|
-
|
|
10
|
+
@change="change(read, $event)">
|
|
11
11
|
<slot>
|
|
12
|
-
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"
|
|
12
|
+
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"/>
|
|
13
13
|
</slot>
|
|
14
14
|
</el-select>
|
|
15
15
|
</template>
|
|
@@ -17,15 +17,22 @@
|
|
|
17
17
|
</template>
|
|
18
18
|
|
|
19
19
|
<script setup lang="ts">
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
22
|
-
|
|
20
|
+
import FuReadWriteSwitch from "./FuReadWriteSwitch.vue";
|
|
21
|
+
import {watch, ref, PropType} from "vue";
|
|
22
|
+
import {OptionProps} from "./types";
|
|
23
|
+
|
|
24
|
+
defineOptions({name: "FuSelectRwSwitch"});
|
|
25
|
+
|
|
23
26
|
const props = defineProps({
|
|
24
27
|
modelValue: [String, Number],
|
|
25
28
|
options: {
|
|
26
29
|
type: Array as PropType<OptionProps[]>,
|
|
27
30
|
default: []
|
|
28
31
|
},
|
|
32
|
+
blurTime: {
|
|
33
|
+
type: Number,
|
|
34
|
+
default: 150
|
|
35
|
+
},
|
|
29
36
|
writeTrigger: {
|
|
30
37
|
type: String,
|
|
31
38
|
default: "onClick",
|
|
@@ -34,22 +41,28 @@ const props = defineProps({
|
|
|
34
41
|
}
|
|
35
42
|
}
|
|
36
43
|
})
|
|
37
|
-
const emit = defineEmits(["input", "blur", "change"])
|
|
44
|
+
const emit = defineEmits(["input", "blur", "change", "update:modelValue"])
|
|
38
45
|
const data = ref(props.modelValue)
|
|
39
46
|
|
|
40
47
|
watch(() => props.modelValue, (v) => {
|
|
41
48
|
data.value = v
|
|
42
49
|
})
|
|
50
|
+
|
|
43
51
|
function input(e: Event) {
|
|
44
52
|
emit("input", data.value, e)
|
|
45
53
|
}
|
|
54
|
+
|
|
46
55
|
function blur(read: Function, e: Event) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
if (props.blurTime > 0) {
|
|
57
|
+
setTimeout(() => {
|
|
58
|
+
read()
|
|
59
|
+
}, props.blurTime)
|
|
60
|
+
emit("blur", e)
|
|
61
|
+
}
|
|
51
62
|
}
|
|
63
|
+
|
|
52
64
|
function change(read: Function, e: Event) {
|
|
65
|
+
emit("update:modelValue", data.value, e)
|
|
53
66
|
emit("change", data.value, e)
|
|
54
67
|
read()
|
|
55
68
|
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-popover :visible="active" :show-arrow="false" @hide="hide" width="auto" popper-class="fu-complex-components">
|
|
3
|
+
<div class="fu-complex-components">
|
|
4
|
+
<div class="fu-complex-components__body">
|
|
5
|
+
<slot>
|
|
6
|
+
<component v-for="c in components" :is="c.component" v-bind="c" :size="configSize"/>
|
|
7
|
+
</slot>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="fu-complex-components__footer">
|
|
10
|
+
<el-button @click="close" :size="configSize">{{ t('fu.search_bar.cancel') }}</el-button>
|
|
11
|
+
<el-button type="primary" @click="ok" :size="configSize">{{ t('fu.search_bar.ok') }}</el-button>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
<template #reference>
|
|
15
|
+
<el-button circle icon="ArrowRightBold" @click="toggle" :size="configSize" v-show="showComplex"
|
|
16
|
+
:class="['fu-complex-components-trigger', {'is-active':active}]"/>
|
|
17
|
+
</template>
|
|
18
|
+
</el-popover>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup lang="ts">
|
|
22
|
+
import {ref, inject, computed, PropType} from "vue";
|
|
23
|
+
import {useLocale, useSize} from "@/hooks"
|
|
24
|
+
import {validateSize} from "@/tools/size";
|
|
25
|
+
import {ComplexCondition, referenceKey} from "./types";
|
|
26
|
+
|
|
27
|
+
defineOptions({name: "FuComplexSearch"});
|
|
28
|
+
|
|
29
|
+
const props = defineProps({
|
|
30
|
+
size: {
|
|
31
|
+
type: String,
|
|
32
|
+
validator: validateSize
|
|
33
|
+
},
|
|
34
|
+
components: Array as PropType<any[]>,
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
const emit = defineEmits(["close", "change"])
|
|
38
|
+
|
|
39
|
+
const active = ref(false)
|
|
40
|
+
const references = inject(referenceKey)
|
|
41
|
+
|
|
42
|
+
const configSize = useSize()
|
|
43
|
+
|
|
44
|
+
const showComplex = computed(() => {
|
|
45
|
+
return references ? references.value.length > 0 : false
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
const {t} = useLocale()
|
|
49
|
+
|
|
50
|
+
function hide() {
|
|
51
|
+
emit("close")
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function toggle() {
|
|
55
|
+
active.value = !active.value
|
|
56
|
+
if (active.value) {
|
|
57
|
+
references?.value.forEach(r => r.init())
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function close() {
|
|
62
|
+
active.value = false
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function ok() {
|
|
66
|
+
close()
|
|
67
|
+
exec()
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function exec() {
|
|
71
|
+
let conditions: any = [];
|
|
72
|
+
references?.value.forEach(r => {
|
|
73
|
+
let condition = r.getCondition()
|
|
74
|
+
if (condition && condition.value !== undefined) {
|
|
75
|
+
conditions.push(condition)
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
emit("change", conditions)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function setConditions(conditionObj: any): ComplexCondition[] {
|
|
82
|
+
let result: ComplexCondition[] = []
|
|
83
|
+
if (conditionObj) {
|
|
84
|
+
Object.keys(conditionObj).forEach(key => {
|
|
85
|
+
let c = conditionObj[key]
|
|
86
|
+
references?.value.forEach(r => {
|
|
87
|
+
if (r.field === key) {
|
|
88
|
+
r.init(c.value)
|
|
89
|
+
const condition = r.getCondition()
|
|
90
|
+
if (condition) {
|
|
91
|
+
result.push(condition)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
return result
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
defineExpose({
|
|
101
|
+
setConditions,
|
|
102
|
+
close
|
|
103
|
+
})
|
|
104
|
+
</script>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="['fu-quick-search', 'fu-quick-search--' + configSize]">
|
|
3
|
+
<el-icon v-if="useIcon">
|
|
4
|
+
<Search/>
|
|
5
|
+
</el-icon>
|
|
6
|
+
<label>
|
|
7
|
+
<input :placeholder="placeholder" v-model="value" @blur="blur" @focus="focus" @keydown="keydown"/>
|
|
8
|
+
</label>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import {computed, ref, watch} from "vue";
|
|
15
|
+
import {validateSize} from "@/tools/size";
|
|
16
|
+
import {useSize} from "@/hooks";
|
|
17
|
+
|
|
18
|
+
defineOptions({name: "FuQuickSearch"});
|
|
19
|
+
|
|
20
|
+
const props = defineProps({
|
|
21
|
+
size: {
|
|
22
|
+
type: String,
|
|
23
|
+
validator: validateSize
|
|
24
|
+
},
|
|
25
|
+
modelValue: String,
|
|
26
|
+
placeholder: String,
|
|
27
|
+
useIcon: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: true
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const focused = ref(false)
|
|
34
|
+
|
|
35
|
+
const emit = defineEmits(["update:modelValue", "change"])
|
|
36
|
+
|
|
37
|
+
const configSize = useSize()
|
|
38
|
+
|
|
39
|
+
const value = computed({
|
|
40
|
+
get: () => props.modelValue,
|
|
41
|
+
set: (val) => {
|
|
42
|
+
emit("update:modelValue", val as string)
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
function focus() {
|
|
47
|
+
focused.value = true
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function blur(e: Event) {
|
|
51
|
+
if (focused.value) {
|
|
52
|
+
emit("change", value.value, e)
|
|
53
|
+
}
|
|
54
|
+
focused.value = false
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function keydown(e: KeyboardEvent) {
|
|
58
|
+
const {code} = e
|
|
59
|
+
if (code === "Enter") {
|
|
60
|
+
focused.value = false
|
|
61
|
+
emit("change", value.value, e)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
</script>
|