@weitutech/by-components 1.0.27 → 1.0.30
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/CHANGELOG.md +38 -38
- package/README.md +469 -469
- package/docs/extension.md +15 -0
- package/docs/form.md +26 -0
- package/docs/table.md +26 -0
- package/lib/by-components.common.js +29353 -29328
- package/lib/by-components.umd.js +28985 -28960
- package/lib/by-components.umd.min.js +142 -142
- package/package.json +30 -30
- package/postcss.config.js +6 -6
- package/src/components/custom-column/index.vue +369 -369
- package/src/components/fold-search/index.vue +29 -29
- package/src/components/form/comps/custom-date-picker.vue +109 -109
- package/src/components/form/comps/date-picker-range.vue +78 -78
- package/src/components/form/comps/pair-number-input.vue +67 -67
- package/src/components/form/comps/select.vue +127 -127
- package/src/components/form/form.vue +351 -351
- package/src/components/page-search/page-search.vue +114 -114
- package/src/components/pager/index.vue +81 -81
- package/src/components/table/index.vue +240 -219
- package/src/index.js +30 -30
- package/src/plugin/vxeTable.js +300 -300
- package/src/plugin/vxeTable.scss +14 -14
- package/src/style/custom-column.scss +194 -194
- package/src/style/fold-search.scss +21 -21
- package/src/style/form.scss +342 -342
- package/src/style/index.scss +6 -6
- package/src/style/page-search.scss +26 -26
- package/src/style/pager.scss +40 -40
- package/src/style/table.scss +39 -39
- package/src/utils/index.js +31 -31
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-select
|
|
3
|
-
v-bind="$props"
|
|
4
|
-
:value="value"
|
|
5
|
-
ref="selection"
|
|
6
|
-
:placeholder="config.placeholder || '请选择'"
|
|
7
|
-
@change="change"
|
|
8
|
-
@visible-change="visibleChange"
|
|
9
|
-
@remove-tag="removeTag"
|
|
10
|
-
@clear="clear"
|
|
11
|
-
@blur="blur"
|
|
12
|
-
@focus="focus"
|
|
13
|
-
>
|
|
14
|
-
<template v-if="config.mode === 'group'">
|
|
15
|
-
<el-option-group
|
|
16
|
-
v-for="group in item.options"
|
|
17
|
-
:key="group[config.optionValue || 'value']"
|
|
18
|
-
:label="group[config.optionLabel || 'label']"
|
|
19
|
-
>
|
|
20
|
-
<el-option
|
|
21
|
-
v-for="gItem in group.options"
|
|
22
|
-
:key="gItem[config.optionValue || 'value']"
|
|
23
|
-
:label="gItem[config.optionLabel || 'label']"
|
|
24
|
-
:value="gItem[config.optionValue || 'value']"
|
|
25
|
-
/>
|
|
26
|
-
</el-option-group>
|
|
27
|
-
</template>
|
|
28
|
-
<template v-else>
|
|
29
|
-
<el-option
|
|
30
|
-
v-for="(item) in filterData"
|
|
31
|
-
:key="item[config.optionValue || 'value'] +'-' +item[config.optionLabel || 'label']"
|
|
32
|
-
:label="item[config.optionLabel || 'label']"
|
|
33
|
-
:value="item[config.optionValue || 'value']"
|
|
34
|
-
/>
|
|
35
|
-
</template>
|
|
36
|
-
</el-select>
|
|
37
|
-
</template>
|
|
38
|
-
<script>
|
|
39
|
-
import { Select } from 'element-ui'
|
|
40
|
-
export default {
|
|
41
|
-
name: 'BYSelect',
|
|
42
|
-
props: {
|
|
43
|
-
...Select.props,
|
|
44
|
-
value: {
|
|
45
|
-
type: [String, Number, Array],
|
|
46
|
-
},
|
|
47
|
-
// 下拉框数据
|
|
48
|
-
placeholder: {
|
|
49
|
-
type: String,
|
|
50
|
-
default: '请选择'
|
|
51
|
-
},
|
|
52
|
-
// 下拉框数据
|
|
53
|
-
options: {
|
|
54
|
-
type: Array,
|
|
55
|
-
default: () => {
|
|
56
|
-
return []
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
//当前配置
|
|
60
|
-
config: {
|
|
61
|
-
type: Object,
|
|
62
|
-
default: null
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
data() {
|
|
66
|
-
return {
|
|
67
|
-
searchVal: '',
|
|
68
|
-
filterData: []
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
watch: {
|
|
72
|
-
options: {
|
|
73
|
-
handler() {
|
|
74
|
-
this.filterData = this.options
|
|
75
|
-
},
|
|
76
|
-
deep: true,
|
|
77
|
-
immediate: true
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
methods: {
|
|
81
|
-
change(e) {
|
|
82
|
-
this.$emit('change', arguments.length === 1 ? e : arguments)
|
|
83
|
-
this.$emit("input", e)
|
|
84
|
-
},
|
|
85
|
-
input(e) {
|
|
86
|
-
this.$emit('change', arguments.length === 1 ? e : arguments)
|
|
87
|
-
this.$emit("input", e)
|
|
88
|
-
},
|
|
89
|
-
visibleChange(e) {
|
|
90
|
-
this.$emit('visible-change', arguments.length === 1 ? e : arguments)
|
|
91
|
-
},
|
|
92
|
-
removeTag(e) {
|
|
93
|
-
this.$emit('remove-tag', arguments.length === 1 ? e : arguments)
|
|
94
|
-
},
|
|
95
|
-
clear(e) {
|
|
96
|
-
this.$emit('clear', arguments.length === 1 ? e : arguments)
|
|
97
|
-
},
|
|
98
|
-
blur(e) {
|
|
99
|
-
this.$emit('blur', arguments.length === 1 ? e : arguments)
|
|
100
|
-
},
|
|
101
|
-
focus(e) {
|
|
102
|
-
// 如果是多选模式 则做处理
|
|
103
|
-
if (this.multiple) {
|
|
104
|
-
this.searchNoReset()
|
|
105
|
-
}
|
|
106
|
-
this.$emit('blur', arguments.length === 1 ? e : arguments)
|
|
107
|
-
},
|
|
108
|
-
// 解决多选时选择后下拉数据会重置问题
|
|
109
|
-
searchNoReset() {
|
|
110
|
-
// 离开时重置数据
|
|
111
|
-
this.$refs.selection.$refs.input.blur = () => {
|
|
112
|
-
this.filterData = this.options
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// 根据数据筛选数据
|
|
116
|
-
this.$refs.selection.$refs.input.onkeyup = () => {
|
|
117
|
-
this.filterData = this.options
|
|
118
|
-
this.searchVal = this.$refs.selection.$refs.input.value
|
|
119
|
-
this.filterData = this.options.filter(
|
|
120
|
-
(item) => item[this.config.optionLabel].indexOf(this.searchVal) !== -1
|
|
121
|
-
)
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
</script>
|
|
127
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<el-select
|
|
3
|
+
v-bind="$props"
|
|
4
|
+
:value="value"
|
|
5
|
+
ref="selection"
|
|
6
|
+
:placeholder="config.placeholder || '请选择'"
|
|
7
|
+
@change="change"
|
|
8
|
+
@visible-change="visibleChange"
|
|
9
|
+
@remove-tag="removeTag"
|
|
10
|
+
@clear="clear"
|
|
11
|
+
@blur="blur"
|
|
12
|
+
@focus="focus"
|
|
13
|
+
>
|
|
14
|
+
<template v-if="config.mode === 'group'">
|
|
15
|
+
<el-option-group
|
|
16
|
+
v-for="group in item.options"
|
|
17
|
+
:key="group[config.optionValue || 'value']"
|
|
18
|
+
:label="group[config.optionLabel || 'label']"
|
|
19
|
+
>
|
|
20
|
+
<el-option
|
|
21
|
+
v-for="gItem in group.options"
|
|
22
|
+
:key="gItem[config.optionValue || 'value']"
|
|
23
|
+
:label="gItem[config.optionLabel || 'label']"
|
|
24
|
+
:value="gItem[config.optionValue || 'value']"
|
|
25
|
+
/>
|
|
26
|
+
</el-option-group>
|
|
27
|
+
</template>
|
|
28
|
+
<template v-else>
|
|
29
|
+
<el-option
|
|
30
|
+
v-for="(item) in filterData"
|
|
31
|
+
:key="item[config.optionValue || 'value'] +'-' +item[config.optionLabel || 'label']"
|
|
32
|
+
:label="item[config.optionLabel || 'label']"
|
|
33
|
+
:value="item[config.optionValue || 'value']"
|
|
34
|
+
/>
|
|
35
|
+
</template>
|
|
36
|
+
</el-select>
|
|
37
|
+
</template>
|
|
38
|
+
<script>
|
|
39
|
+
import { Select } from 'element-ui'
|
|
40
|
+
export default {
|
|
41
|
+
name: 'BYSelect',
|
|
42
|
+
props: {
|
|
43
|
+
...Select.props,
|
|
44
|
+
value: {
|
|
45
|
+
type: [String, Number, Array],
|
|
46
|
+
},
|
|
47
|
+
// 下拉框数据
|
|
48
|
+
placeholder: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: '请选择'
|
|
51
|
+
},
|
|
52
|
+
// 下拉框数据
|
|
53
|
+
options: {
|
|
54
|
+
type: Array,
|
|
55
|
+
default: () => {
|
|
56
|
+
return []
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
//当前配置
|
|
60
|
+
config: {
|
|
61
|
+
type: Object,
|
|
62
|
+
default: null
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
data() {
|
|
66
|
+
return {
|
|
67
|
+
searchVal: '',
|
|
68
|
+
filterData: []
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
watch: {
|
|
72
|
+
options: {
|
|
73
|
+
handler() {
|
|
74
|
+
this.filterData = this.options
|
|
75
|
+
},
|
|
76
|
+
deep: true,
|
|
77
|
+
immediate: true
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
methods: {
|
|
81
|
+
change(e) {
|
|
82
|
+
this.$emit('change', arguments.length === 1 ? e : arguments)
|
|
83
|
+
this.$emit("input", e)
|
|
84
|
+
},
|
|
85
|
+
input(e) {
|
|
86
|
+
this.$emit('change', arguments.length === 1 ? e : arguments)
|
|
87
|
+
this.$emit("input", e)
|
|
88
|
+
},
|
|
89
|
+
visibleChange(e) {
|
|
90
|
+
this.$emit('visible-change', arguments.length === 1 ? e : arguments)
|
|
91
|
+
},
|
|
92
|
+
removeTag(e) {
|
|
93
|
+
this.$emit('remove-tag', arguments.length === 1 ? e : arguments)
|
|
94
|
+
},
|
|
95
|
+
clear(e) {
|
|
96
|
+
this.$emit('clear', arguments.length === 1 ? e : arguments)
|
|
97
|
+
},
|
|
98
|
+
blur(e) {
|
|
99
|
+
this.$emit('blur', arguments.length === 1 ? e : arguments)
|
|
100
|
+
},
|
|
101
|
+
focus(e) {
|
|
102
|
+
// 如果是多选模式 则做处理
|
|
103
|
+
if (this.multiple) {
|
|
104
|
+
this.searchNoReset()
|
|
105
|
+
}
|
|
106
|
+
this.$emit('blur', arguments.length === 1 ? e : arguments)
|
|
107
|
+
},
|
|
108
|
+
// 解决多选时选择后下拉数据会重置问题
|
|
109
|
+
searchNoReset() {
|
|
110
|
+
// 离开时重置数据
|
|
111
|
+
this.$refs.selection.$refs.input.blur = () => {
|
|
112
|
+
this.filterData = this.options
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// 根据数据筛选数据
|
|
116
|
+
this.$refs.selection.$refs.input.onkeyup = () => {
|
|
117
|
+
this.filterData = this.options
|
|
118
|
+
this.searchVal = this.$refs.selection.$refs.input.value
|
|
119
|
+
this.filterData = this.options.filter(
|
|
120
|
+
(item) => item[this.config.optionLabel].indexOf(this.searchVal) !== -1
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
</script>
|
|
127
|
+
|