zydx-plus 1.4.23 → 1.5.24
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/package.json +1 -1
- package/src/components/buttonGroup/index.js +6 -0
- package/src/components/buttonGroup/src/buttonGroup.vue +215 -0
- package/src/components/tipBox/index.js +7 -9
- package/src/components/tipBox/src/main.vue +3 -1
- package/src/components/tipBox/src/zydxStyle.css +4 -2
- package/src/index.js +9 -3
package/package.json
CHANGED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
|
|
2
|
+
<script>
|
|
3
|
+
import { defineComponent } from 'vue';
|
|
4
|
+
export default defineComponent({
|
|
5
|
+
name: 'zydx-button-group',
|
|
6
|
+
props: {
|
|
7
|
+
buttons: {
|
|
8
|
+
type: Array,
|
|
9
|
+
default: () => []
|
|
10
|
+
},
|
|
11
|
+
accordian: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: false
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
data() {
|
|
17
|
+
return {
|
|
18
|
+
active_state: [],
|
|
19
|
+
is_show_search: false,
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
mounted() {
|
|
23
|
+
this.active_state = this.buttons.map(() => false)
|
|
24
|
+
},
|
|
25
|
+
methods: {
|
|
26
|
+
trackClick(idx) {
|
|
27
|
+
if (this.accordian) {
|
|
28
|
+
this.active_state = this.active_state.map((_, i) => {
|
|
29
|
+
if (i === idx) {
|
|
30
|
+
return this.active_state[i] = !this.active_state[i]
|
|
31
|
+
} else {
|
|
32
|
+
return false
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
} else {
|
|
36
|
+
this.active_state[idx] = !this.active_state[idx]
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
},
|
|
40
|
+
onInputChange({ event, accept = '*', file_size = 2, cb }) {
|
|
41
|
+
let file = event.target.files[0]
|
|
42
|
+
let accept_list = accept.split(',')
|
|
43
|
+
if (file.size > file_size * 1024 * 1024) {
|
|
44
|
+
this.$messages({
|
|
45
|
+
title: '提示',
|
|
46
|
+
promptContent: `文件大小不能超过${file_size}M`,
|
|
47
|
+
cancelShow: false,
|
|
48
|
+
})
|
|
49
|
+
return
|
|
50
|
+
}
|
|
51
|
+
if (!accept_list.includes(file.type)) {
|
|
52
|
+
this.$messages({
|
|
53
|
+
title: '提示',
|
|
54
|
+
promptContent: `请选择${accept_list.join('、')}格式的文件`,
|
|
55
|
+
cancelShow: false,
|
|
56
|
+
})
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
cb(file)
|
|
60
|
+
},
|
|
61
|
+
showSearch: function () {
|
|
62
|
+
this.is_show_search = true
|
|
63
|
+
},
|
|
64
|
+
handleClose: function () {
|
|
65
|
+
this.is_show_search = false
|
|
66
|
+
},
|
|
67
|
+
handleSearch: function () {
|
|
68
|
+
this.$emit('search', this.$el.querySelector('.search_input').value)
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
render() {
|
|
72
|
+
const { trackClick, onInputChange, showSearch, handleSearch, handleClose, is_show_search } = this
|
|
73
|
+
const render = ({ type, name, accept = '', file_size, flip = null, onClick, disabled, idx }) => {
|
|
74
|
+
let active_name = flip ? flip : name
|
|
75
|
+
switch (type) {
|
|
76
|
+
case 'button':
|
|
77
|
+
return <button
|
|
78
|
+
class={this.active_state[idx] ? 'z-button active' : 'z-button'}
|
|
79
|
+
onClick={() => { onClick(); trackClick(idx) }
|
|
80
|
+
}
|
|
81
|
+
disabled={disabled}
|
|
82
|
+
>
|
|
83
|
+
{this.active_state[idx] ? active_name : name}
|
|
84
|
+
</button>
|
|
85
|
+
case 'file':
|
|
86
|
+
return <label class="z-button">
|
|
87
|
+
<span>{name}</span>
|
|
88
|
+
<input type="file" class="hidden" onClick={(e) => e.target.value = null} onChange={(e) => onInputChange({ event: e, accept, file_size, cb: onClick })}></input>
|
|
89
|
+
</label>
|
|
90
|
+
case 'search':
|
|
91
|
+
return is_show_search
|
|
92
|
+
?
|
|
93
|
+
<div class="search_container">
|
|
94
|
+
<input type="text" class="search_input"></input>
|
|
95
|
+
<div class="icons">
|
|
96
|
+
<span class="search" onClick={handleSearch}>
|
|
97
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path fill="#333" d="m19.6 21l-6.3-6.3q-.75.6-1.725.95Q10.6 16 9.5 16q-2.725 0-4.612-1.887Q3 12.225 3 9.5q0-2.725 1.888-4.613Q6.775 3 9.5 3t4.613 1.887Q16 6.775 16 9.5q0 1.1-.35 2.075q-.35.975-.95 1.725l6.3 6.3ZM9.5 14q1.875 0 3.188-1.312Q14 11.375 14 9.5q0-1.875-1.312-3.188Q11.375 5 9.5 5Q7.625 5 6.312 6.312Q5 7.625 5 9.5q0 1.875 1.312 3.188Q7.625 14 9.5 14Z" /></svg>
|
|
98
|
+
</span>
|
|
99
|
+
<span class="separator"></span>
|
|
100
|
+
<span class="close" onClick={handleClose}>
|
|
101
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path fill="#333" d="M6.4 19L5 17.6l5.6-5.6L5 6.4L6.4 5l5.6 5.6L17.6 5L19 6.4L13.4 12l5.6 5.6l-1.4 1.4l-5.6-5.6Z" /></svg>
|
|
102
|
+
</span>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
: <button
|
|
106
|
+
class="z-button"
|
|
107
|
+
onClick={showSearch}
|
|
108
|
+
>
|
|
109
|
+
{name}
|
|
110
|
+
</button>
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return (
|
|
114
|
+
<div class="z-button-group">
|
|
115
|
+
{
|
|
116
|
+
this.buttons
|
|
117
|
+
.map(({ onClick, disabled, file_size, accept, flip, type = "button", name }, idx) => {
|
|
118
|
+
return render({ type, name, accept, file_size, flip, onClick, disabled, idx })
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
</div>
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
</script>
|
|
127
|
+
|
|
128
|
+
<style scoped>
|
|
129
|
+
.z-button-group {
|
|
130
|
+
display: flex;
|
|
131
|
+
align-items: center;
|
|
132
|
+
justify-content: center;
|
|
133
|
+
width: auto;
|
|
134
|
+
height: 30px;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.z-button {
|
|
138
|
+
margin: 1px;
|
|
139
|
+
width: auto;
|
|
140
|
+
min-width: 60px;
|
|
141
|
+
max-width: 60px;
|
|
142
|
+
text-overflow: ellipsis;
|
|
143
|
+
white-space: nowrap;
|
|
144
|
+
overflow: hidden;
|
|
145
|
+
height: 20px;
|
|
146
|
+
background-color: #FFFFFF;
|
|
147
|
+
color: #000000;
|
|
148
|
+
border: #000000 1px solid;
|
|
149
|
+
line-height: 18px;
|
|
150
|
+
border-radius: 3px;
|
|
151
|
+
font-size: 12px !important;
|
|
152
|
+
letter-spacing: 0px !important;
|
|
153
|
+
text-align: center;
|
|
154
|
+
cursor: pointer;
|
|
155
|
+
padding: 0 5px;
|
|
156
|
+
font-weight: normal;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.search_container {
|
|
160
|
+
width: 180px;
|
|
161
|
+
height: 20px;
|
|
162
|
+
border: 1px solid #ccc;
|
|
163
|
+
border-radius: 2px;
|
|
164
|
+
padding-right: 40px;
|
|
165
|
+
display: flex;
|
|
166
|
+
align-items: center;
|
|
167
|
+
position: relative;
|
|
168
|
+
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.search_container .icons {
|
|
172
|
+
position: absolute;
|
|
173
|
+
right: 0;
|
|
174
|
+
top: 0;
|
|
175
|
+
height: 18px;
|
|
176
|
+
width: 40px;
|
|
177
|
+
gap: 3px;
|
|
178
|
+
display: flex;
|
|
179
|
+
align-items: center;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.search_container .icons .separator {
|
|
183
|
+
width: 1px;
|
|
184
|
+
height: 14px;
|
|
185
|
+
background-color: #ccc;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.search_container .icons .search,
|
|
189
|
+
.search_container .icons .close {
|
|
190
|
+
display: flex;
|
|
191
|
+
align-items: center;
|
|
192
|
+
justify-content: center;
|
|
193
|
+
cursor: pointer;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.search_input {
|
|
197
|
+
width: 100%;
|
|
198
|
+
height: 18px;
|
|
199
|
+
border: none;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.z-button.active {
|
|
203
|
+
color: #00ff00 !important;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.z-button:disabled {
|
|
207
|
+
background-color: #ffffff;
|
|
208
|
+
color: #717171;
|
|
209
|
+
border: #717171 1px solid;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.hidden {
|
|
213
|
+
display: none;
|
|
214
|
+
}
|
|
215
|
+
</style>
|
|
@@ -13,16 +13,14 @@ const Confirm = ({ type, url ,title, promptContent, middle, cancelShow, inputArr
|
|
|
13
13
|
return new Promise((resolve, reject) => {
|
|
14
14
|
// 2. 点击确认按钮,触发resolve同时销毁组件
|
|
15
15
|
const submit = () => {
|
|
16
|
-
let val =
|
|
16
|
+
let val = []
|
|
17
17
|
if(type === 'input') {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return x.selectValue
|
|
25
|
-
})
|
|
18
|
+
for(let i=0; i< inputArr.length; i++) {
|
|
19
|
+
if(inputArr[i].type === 'input') {
|
|
20
|
+
val.push(inputArr[i].value)
|
|
21
|
+
}else {
|
|
22
|
+
val.push(inputArr[i].selectValue)
|
|
23
|
+
}
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
26
|
render(null, container)
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
<div class="tip-input" v-for="(item,index) in inputArr" :key="index">
|
|
16
16
|
<span>{{ item.name }}</span>
|
|
17
17
|
<input v-if="item.type === 'input'" type="text" :placeholder="item.placeholder" v-model="item.value" :disabled="item.disabled" />
|
|
18
|
-
<
|
|
18
|
+
<div style="display: inline-block;">
|
|
19
|
+
<Select v-if="item.type === 'select'" :options="item.option" v-model:value="item.selectValue"></Select>
|
|
20
|
+
</div>
|
|
19
21
|
<div v-if="item.type === 'text'" class="text">{{ item.value }}</div>
|
|
20
22
|
</div>
|
|
21
23
|
</div>
|
|
@@ -101,13 +101,15 @@ font-size: 12px;
|
|
|
101
101
|
padding-right: 10px;
|
|
102
102
|
}
|
|
103
103
|
.tip-input>input{
|
|
104
|
-
width:
|
|
105
|
-
height:
|
|
104
|
+
width: 211px;
|
|
105
|
+
height: 32px;
|
|
106
106
|
box-sizing: border-box;
|
|
107
107
|
font-size: 16px;
|
|
108
108
|
outline: none;
|
|
109
109
|
padding-left: 10px;
|
|
110
110
|
border: 1px solid #ccc;
|
|
111
|
+
border-radius: 3px;
|
|
112
|
+
box-shadow: 0 1px 0 1px rgb(0 0 0 / 4%);
|
|
111
113
|
}
|
|
112
114
|
.tip-input>select{
|
|
113
115
|
width: 210px;
|
package/src/index.js
CHANGED
|
@@ -8,6 +8,8 @@ import Pagination from './components/pagination/index';
|
|
|
8
8
|
import Select from './components/select/index';
|
|
9
9
|
import Year from './components/year/index';
|
|
10
10
|
import Table from './components/data_table/index';
|
|
11
|
+
import buttonGroup from './components/buttonGroup/index';
|
|
12
|
+
import spinner from './components/spinner/index';
|
|
11
13
|
|
|
12
14
|
const components = [
|
|
13
15
|
Calendar,
|
|
@@ -18,7 +20,8 @@ const components = [
|
|
|
18
20
|
Pagination,
|
|
19
21
|
Select,
|
|
20
22
|
Year,
|
|
21
|
-
Table
|
|
23
|
+
Table,
|
|
24
|
+
buttonGroup
|
|
22
25
|
];
|
|
23
26
|
|
|
24
27
|
function install(app) {
|
|
@@ -26,13 +29,15 @@ function install(app) {
|
|
|
26
29
|
app.component(component.name, component);
|
|
27
30
|
});
|
|
28
31
|
app.config.globalProperties.$message = Message
|
|
32
|
+
app.config.globalProperties.$spinner = spinner
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
export default {
|
|
32
|
-
version: '1.
|
|
36
|
+
version: '1.5.24',
|
|
33
37
|
install,
|
|
34
38
|
Calendar,
|
|
35
39
|
Message,
|
|
40
|
+
spinner,
|
|
36
41
|
Switch,
|
|
37
42
|
menuTree,
|
|
38
43
|
coloring,
|
|
@@ -40,6 +45,7 @@ export default {
|
|
|
40
45
|
Pagination,
|
|
41
46
|
Select,
|
|
42
47
|
Year,
|
|
43
|
-
Table
|
|
48
|
+
Table,
|
|
49
|
+
buttonGroup
|
|
44
50
|
};
|
|
45
51
|
|