fit2cloud-ui-plus 0.0.1-beta.16 → 0.0.1-beta.17
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/lib/fit2cloud-ui-plus.es.js +144 -118
- package/lib/fit2cloud-ui-plus.umd.js +1 -1
- package/package.json +1 -1
- package/src/components/search-bar/FuComplexSearch.vue +170 -170
- package/src/components/search-bar/FuQuickSearch.vue +1 -41
- package/src/components/search-bar/FuSearchBar.vue +149 -149
- package/src/components/search-bar/complex-components/index.js +16 -16
- package/src/components/search-bar/index.js +16 -16
- 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/table/demo/TablePagination.vue.d.ts +1 -1
- package/types/src/components/filter-bar/FuFilter.vue.d.ts +3 -0
- package/types/src/components/filter-bar/FuFilterBar.vue.d.ts +12 -1
- package/types/src/components/filter-bar/FuFilterInput.vue.d.ts +17 -0
- package/types/src/components/filter-bar/index.d.ts +2 -2
- package/types/src/components/search-bar/FuComplexSearch.vue.d.ts +2 -0
- package/types/src/components/search-bar/FuQuickSearch.vue.d.ts +33 -0
- package/types/src/components/search-bar/FuSearchBar.vue.d.ts +2 -0
- package/types/src/components/search-bar/FuSearchBarButton.vue.d.ts +12 -0
- package/types/src/components/search-bar/FuSearchContions.vue.d.ts +12 -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 +0 -0
- package/types/src/components/search-bar/types.d.ts +17 -0
|
@@ -1,170 +1,170 @@
|
|
|
1
|
-
|
|
2
|
-
<div class="fu-complex-search"
|
|
3
|
-
<el-popover
|
|
4
|
-
trigger="manual"
|
|
5
|
-
v-model="active"
|
|
6
|
-
:visible-arrow="false"
|
|
7
|
-
@hide="closePopover"
|
|
8
|
-
popper-class="fu-complex-components"
|
|
9
|
-
|
|
10
|
-
<div class="fu-complex-components__body"
|
|
11
|
-
<slot></slot
|
|
12
|
-
</div
|
|
13
|
-
<div class="fu-complex-components__footer"
|
|
14
|
-
<el-button @click="active=false" :size="size">{{ t('fu.search_bar.cancel') }}</el-button
|
|
15
|
-
<el-button type="primary" @click="ok" :size="size">{{ t('fu.search_bar.ok') }}</el-button
|
|
16
|
-
</div
|
|
17
|
-
|
|
18
|
-
<fu-search-bar-button
|
|
19
|
-
slot="reference"
|
|
20
|
-
icon="el-icon-arrow-right"
|
|
21
|
-
@click="toggle"
|
|
22
|
-
:size="size"
|
|
23
|
-
:class="['fu-complex-search__trigger',{'is-active':active}]"
|
|
24
|
-
:tooltip="t('fu.search_bar.adv_search')"
|
|
25
|
-
</el-popover
|
|
26
|
-
</div
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
import {ref, computed} from "vue"
|
|
31
|
-
import {useLocale} from "@/hooks"
|
|
32
|
-
import {validateSize} from "@/tools/size"
|
|
33
|
-
import FuSearchBarButton from "@/components/search-bar/FuSearchBarButton"
|
|
34
|
-
|
|
35
|
-
defineOptions({name: "FuComplexSearch"})
|
|
36
|
-
|
|
37
|
-
defineProps({
|
|
38
|
-
size: {
|
|
39
|
-
type: String
|
|
40
|
-
validator: validateSize
|
|
41
|
-
}
|
|
42
|
-
resultCount: Number
|
|
43
|
-
quickPlaceholder: String
|
|
44
|
-
components: Array
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
const emit = defineEmits(["exec"])
|
|
48
|
-
|
|
49
|
-
const quick = ref("")
|
|
50
|
-
const conditions = ref([])
|
|
51
|
-
|
|
52
|
-
const filterRef = ref()
|
|
53
|
-
|
|
54
|
-
const {t} = useLocale()
|
|
55
|
-
|
|
56
|
-
function open() {
|
|
57
|
-
filterRef.value?.open()
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function change() {
|
|
61
|
-
emit("exec", conditionObj.value)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function filter(c: any) {
|
|
65
|
-
conditions.value = c
|
|
66
|
-
emit("exec", conditionObj.value)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function setConditions(conditionObj: any) {
|
|
70
|
-
filterRef.value?.setConditions(conditionObj)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const conditionObj = computed(() => {
|
|
74
|
-
let obj: any = {quick: quick.value}
|
|
75
|
-
conditions.value.forEach((c: any) => {
|
|
76
|
-
obj[c.field] = c
|
|
77
|
-
})
|
|
78
|
-
return obj
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
defineExpose({
|
|
82
|
-
setConditions
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
import FuSearchBarButton from "@/components/search-bar/FuSearchBarButton"
|
|
88
|
-
import Locale from "@/mixins/locale"
|
|
89
|
-
import ConfigSize from "@/mixins/config-size"
|
|
90
|
-
|
|
91
|
-
export default {
|
|
92
|
-
name: "FuComplexSearch"
|
|
93
|
-
components: {FuSearchBarButton}
|
|
94
|
-
mixins: [Locale, ConfigSize]
|
|
95
|
-
props: {
|
|
96
|
-
components: Array
|
|
97
|
-
}
|
|
98
|
-
data() {
|
|
99
|
-
return {
|
|
100
|
-
active: false
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
methods: {
|
|
104
|
-
closePopover() {
|
|
105
|
-
this.$emit("close")
|
|
106
|
-
}
|
|
107
|
-
toggle() {
|
|
108
|
-
this.active = !this.active
|
|
109
|
-
this.refs.forEach(r => {
|
|
110
|
-
if (r.init) {
|
|
111
|
-
r.init()
|
|
112
|
-
} else {
|
|
113
|
-
console.warn("init undefined", r)
|
|
114
|
-
}
|
|
115
|
-
})
|
|
116
|
-
}
|
|
117
|
-
close() {
|
|
118
|
-
this.active = false
|
|
119
|
-
}
|
|
120
|
-
ok() {
|
|
121
|
-
this.active = false
|
|
122
|
-
let conditions = []
|
|
123
|
-
this.refs.forEach(r => {
|
|
124
|
-
let condition
|
|
125
|
-
if (r.getCondition) {
|
|
126
|
-
condition = r.getCondition()
|
|
127
|
-
} else {
|
|
128
|
-
console.warn("getCondition undefined", r)
|
|
129
|
-
}
|
|
130
|
-
if (condition && condition.value !== undefined) {
|
|
131
|
-
conditions.push(condition)
|
|
132
|
-
}
|
|
133
|
-
})
|
|
134
|
-
this.$emit("change", conditions)
|
|
135
|
-
}
|
|
136
|
-
createConditions(conditions) {
|
|
137
|
-
let result = []
|
|
138
|
-
if (conditions) {
|
|
139
|
-
Object.keys(conditions).forEach(key => {
|
|
140
|
-
let c = conditions[key]
|
|
141
|
-
this.refs.forEach(r => {
|
|
142
|
-
if (r.field === key) {
|
|
143
|
-
result.push(r.createCondition(c.value, c.operator))
|
|
144
|
-
}
|
|
145
|
-
})
|
|
146
|
-
})
|
|
147
|
-
}
|
|
148
|
-
return result
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
computed: {
|
|
152
|
-
refs() {
|
|
153
|
-
let refs = []
|
|
154
|
-
if (this.$slots?.default) {
|
|
155
|
-
// 使用slot
|
|
156
|
-
this.$slots.default.forEach(component => {
|
|
157
|
-
refs.push(component.componentInstance)
|
|
158
|
-
})
|
|
159
|
-
} else {
|
|
160
|
-
// 使用components
|
|
161
|
-
let $refs = this.$refs
|
|
162
|
-
this.components.forEach(c => {
|
|
163
|
-
refs.push($refs[c.field][0])
|
|
164
|
-
})
|
|
165
|
-
}
|
|
166
|
-
return refs
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
1
|
+
<!--<template>-->
|
|
2
|
+
<!-- <div class="fu-complex-search">-->
|
|
3
|
+
<!-- <el-popover-->
|
|
4
|
+
<!-- trigger="manual"-->
|
|
5
|
+
<!-- v-model="active"-->
|
|
6
|
+
<!-- :visible-arrow="false"-->
|
|
7
|
+
<!-- @hide="closePopover"-->
|
|
8
|
+
<!-- popper-class="fu-complex-components">-->
|
|
9
|
+
|
|
10
|
+
<!-- <div class="fu-complex-components__body">-->
|
|
11
|
+
<!-- <slot></slot>-->
|
|
12
|
+
<!-- </div>-->
|
|
13
|
+
<!-- <div class="fu-complex-components__footer">-->
|
|
14
|
+
<!-- <el-button @click="active=false" :size="size">{{ t('fu.search_bar.cancel') }}</el-button>-->
|
|
15
|
+
<!-- <el-button type="primary" @click="ok" :size="size">{{ t('fu.search_bar.ok') }}</el-button>-->
|
|
16
|
+
<!-- </div>-->
|
|
17
|
+
|
|
18
|
+
<!-- <fu-search-bar-button-->
|
|
19
|
+
<!-- slot="reference"-->
|
|
20
|
+
<!-- icon="el-icon-arrow-right"-->
|
|
21
|
+
<!-- @click="toggle"-->
|
|
22
|
+
<!-- :size="size"-->
|
|
23
|
+
<!-- :class="['fu-complex-search__trigger',{'is-active':active}]"-->
|
|
24
|
+
<!-- :tooltip="t('fu.search_bar.adv_search')"/>-->
|
|
25
|
+
<!-- </el-popover>-->
|
|
26
|
+
<!-- </div>-->
|
|
27
|
+
<!--</template>-->
|
|
28
|
+
|
|
29
|
+
<!--<script setup lang="ts">-->
|
|
30
|
+
<!--import {ref, computed} from "vue";-->
|
|
31
|
+
<!--import {useLocale} from "@/hooks"-->
|
|
32
|
+
<!--import {validateSize} from "@/tools/size";-->
|
|
33
|
+
<!--import FuSearchBarButton from "@/components/search-bar/FuSearchBarButton";-->
|
|
34
|
+
|
|
35
|
+
<!--defineOptions({name: "FuComplexSearch"});-->
|
|
36
|
+
|
|
37
|
+
<!--defineProps({-->
|
|
38
|
+
<!-- size: {-->
|
|
39
|
+
<!-- type: String,-->
|
|
40
|
+
<!-- validator: validateSize-->
|
|
41
|
+
<!-- },-->
|
|
42
|
+
<!-- resultCount: Number,-->
|
|
43
|
+
<!-- quickPlaceholder: String,-->
|
|
44
|
+
<!-- components: Array-->
|
|
45
|
+
<!--})-->
|
|
46
|
+
|
|
47
|
+
<!--const emit = defineEmits(["exec"])-->
|
|
48
|
+
|
|
49
|
+
<!--const quick = ref("")-->
|
|
50
|
+
<!--const conditions = ref([])-->
|
|
51
|
+
|
|
52
|
+
<!--const filterRef = ref()-->
|
|
53
|
+
|
|
54
|
+
<!--const {t} = useLocale()-->
|
|
55
|
+
|
|
56
|
+
<!--function open() {-->
|
|
57
|
+
<!-- filterRef.value?.open()-->
|
|
58
|
+
<!--}-->
|
|
59
|
+
|
|
60
|
+
<!--function change() {-->
|
|
61
|
+
<!-- emit("exec", conditionObj.value)-->
|
|
62
|
+
<!--}-->
|
|
63
|
+
|
|
64
|
+
<!--function filter(c: any) {-->
|
|
65
|
+
<!-- conditions.value = c-->
|
|
66
|
+
<!-- emit("exec", conditionObj.value)-->
|
|
67
|
+
<!--}-->
|
|
68
|
+
|
|
69
|
+
<!--function setConditions(conditionObj: any) {-->
|
|
70
|
+
<!-- filterRef.value?.setConditions(conditionObj)-->
|
|
71
|
+
<!--}-->
|
|
72
|
+
|
|
73
|
+
<!--const conditionObj = computed(() => {-->
|
|
74
|
+
<!-- let obj: any = {quick: quick.value}-->
|
|
75
|
+
<!-- conditions.value.forEach((c: any) => {-->
|
|
76
|
+
<!-- obj[c.field] = c-->
|
|
77
|
+
<!-- })-->
|
|
78
|
+
<!-- return obj-->
|
|
79
|
+
<!--});-->
|
|
80
|
+
|
|
81
|
+
<!--defineExpose({-->
|
|
82
|
+
<!-- setConditions-->
|
|
83
|
+
<!--})-->
|
|
84
|
+
<!--</script>-->
|
|
85
|
+
|
|
86
|
+
<!--<script>-->
|
|
87
|
+
<!--import FuSearchBarButton from "@/components/search-bar/FuSearchBarButton";-->
|
|
88
|
+
<!--import Locale from "@/mixins/locale";-->
|
|
89
|
+
<!--import ConfigSize from "@/mixins/config-size";-->
|
|
90
|
+
|
|
91
|
+
<!--export default {-->
|
|
92
|
+
<!-- name: "FuComplexSearch",-->
|
|
93
|
+
<!-- components: {FuSearchBarButton},-->
|
|
94
|
+
<!-- mixins: [Locale, ConfigSize],-->
|
|
95
|
+
<!-- props: {-->
|
|
96
|
+
<!-- components: Array,-->
|
|
97
|
+
<!-- },-->
|
|
98
|
+
<!-- data() {-->
|
|
99
|
+
<!-- return {-->
|
|
100
|
+
<!-- active: false,-->
|
|
101
|
+
<!-- }-->
|
|
102
|
+
<!-- },-->
|
|
103
|
+
<!-- methods: {-->
|
|
104
|
+
<!-- closePopover() {-->
|
|
105
|
+
<!-- this.$emit("close")-->
|
|
106
|
+
<!-- },-->
|
|
107
|
+
<!-- toggle() {-->
|
|
108
|
+
<!-- this.active = !this.active-->
|
|
109
|
+
<!-- this.refs.forEach(r => {-->
|
|
110
|
+
<!-- if (r.init) {-->
|
|
111
|
+
<!-- r.init()-->
|
|
112
|
+
<!-- } else {-->
|
|
113
|
+
<!-- console.warn("init undefined", r)-->
|
|
114
|
+
<!-- }-->
|
|
115
|
+
<!-- })-->
|
|
116
|
+
<!-- },-->
|
|
117
|
+
<!-- close() {-->
|
|
118
|
+
<!-- this.active = false-->
|
|
119
|
+
<!-- },-->
|
|
120
|
+
<!-- ok() {-->
|
|
121
|
+
<!-- this.active = false-->
|
|
122
|
+
<!-- let conditions = [];-->
|
|
123
|
+
<!-- this.refs.forEach(r => {-->
|
|
124
|
+
<!-- let condition-->
|
|
125
|
+
<!-- if (r.getCondition) {-->
|
|
126
|
+
<!-- condition = r.getCondition()-->
|
|
127
|
+
<!-- } else {-->
|
|
128
|
+
<!-- console.warn("getCondition undefined", r)-->
|
|
129
|
+
<!-- }-->
|
|
130
|
+
<!-- if (condition && condition.value !== undefined) {-->
|
|
131
|
+
<!-- conditions.push(condition)-->
|
|
132
|
+
<!-- }-->
|
|
133
|
+
<!-- })-->
|
|
134
|
+
<!-- this.$emit("change", conditions)-->
|
|
135
|
+
<!-- },-->
|
|
136
|
+
<!-- createConditions(conditions) {-->
|
|
137
|
+
<!-- let result = []-->
|
|
138
|
+
<!-- if (conditions) {-->
|
|
139
|
+
<!-- Object.keys(conditions).forEach(key => {-->
|
|
140
|
+
<!-- let c = conditions[key]-->
|
|
141
|
+
<!-- this.refs.forEach(r => {-->
|
|
142
|
+
<!-- if (r.field === key) {-->
|
|
143
|
+
<!-- result.push(r.createCondition(c.value, c.operator))-->
|
|
144
|
+
<!-- }-->
|
|
145
|
+
<!-- })-->
|
|
146
|
+
<!-- })-->
|
|
147
|
+
<!-- }-->
|
|
148
|
+
<!-- return result-->
|
|
149
|
+
<!-- }-->
|
|
150
|
+
<!-- },-->
|
|
151
|
+
<!-- computed: {-->
|
|
152
|
+
<!-- refs() {-->
|
|
153
|
+
<!-- let refs = [];-->
|
|
154
|
+
<!-- if (this.$slots?.default) {-->
|
|
155
|
+
<!-- // 使用slot-->
|
|
156
|
+
<!-- this.$slots.default.forEach(component => {-->
|
|
157
|
+
<!-- refs.push(component.componentInstance)-->
|
|
158
|
+
<!-- })-->
|
|
159
|
+
<!-- } else {-->
|
|
160
|
+
<!-- // 使用components-->
|
|
161
|
+
<!-- let $refs = this.$refs-->
|
|
162
|
+
<!-- this.components.forEach(c => {-->
|
|
163
|
+
<!-- refs.push($refs[c.field][0])-->
|
|
164
|
+
<!-- })-->
|
|
165
|
+
<!-- }-->
|
|
166
|
+
<!-- return refs-->
|
|
167
|
+
<!-- }-->
|
|
168
|
+
<!-- }-->
|
|
169
|
+
<!--}-->
|
|
170
|
+
<!--</script>-->
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div :class="['fu-quick-search', 'fu-quick-search--' + size]">
|
|
3
3
|
<i class="el-icon-search" v-if="useIcon"/>
|
|
4
4
|
<label>
|
|
5
|
-
<input :placeholder="placeholder" v-model="quick" @
|
|
5
|
+
<input :placeholder="placeholder" v-model="quick" @blur="blur" @keydown="keydown"/>
|
|
6
6
|
</label>
|
|
7
7
|
</div>
|
|
8
8
|
</template>
|
|
@@ -52,43 +52,3 @@ function keydown(e: KeyboardEvent) {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
</script>
|
|
55
|
-
|
|
56
|
-
<script>
|
|
57
|
-
import ConfigSize from "@/mixins/config-size";
|
|
58
|
-
|
|
59
|
-
export default {
|
|
60
|
-
name: "FuQuickSearch",
|
|
61
|
-
mixins: [ConfigSize],
|
|
62
|
-
props: {
|
|
63
|
-
value: String,
|
|
64
|
-
placeholder: String,
|
|
65
|
-
useIcon: {
|
|
66
|
-
type: Boolean,
|
|
67
|
-
default: true
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
data() {
|
|
71
|
-
return {
|
|
72
|
-
quick: ""
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
watch: {
|
|
76
|
-
value(v) {
|
|
77
|
-
this.quick = v
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
methods: {
|
|
81
|
-
input(e) {
|
|
82
|
-
this.$emit("input", this.quick, e)
|
|
83
|
-
},
|
|
84
|
-
blur(e) {
|
|
85
|
-
this.$emit("change", this.quick, e)
|
|
86
|
-
},
|
|
87
|
-
keydown(e) {
|
|
88
|
-
if (e.keyCode === 13) {
|
|
89
|
-
this.$emit("change", this.quick, e)
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
</script>
|