@radiantabyss/vue-components 1.4.6 → 1.4.8
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/Default/PaginationComponent.vue +13 -5
- package/src/Components/Default/YesNoComponent.vue +5 -5
- package/src/Components/Form/AutocompleteComponent.vue +9 -0
- package/src/Components/Form/FileComponent.vue +1 -1
- package/src/Components/Form/ImageUploadComponent.vue +4 -8
package/package.json
CHANGED
|
@@ -114,6 +114,14 @@ export default {
|
|
|
114
114
|
let url = this.computed_url.replace(/\?$/) + '?' + new URLSearchParams(params).toString();
|
|
115
115
|
this.$router.push(`${url}`)
|
|
116
116
|
},
|
|
117
|
+
|
|
118
|
+
getFullUrlWithPage(page) {
|
|
119
|
+
if ( this.full_url.match(/\?$/) ) {
|
|
120
|
+
return `${this.full_url}${this.page_param}=${page}`;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return `${this.full_url}&${this.page_param}=${page}`;
|
|
124
|
+
},
|
|
117
125
|
},
|
|
118
126
|
mounted() {
|
|
119
127
|
if ( !localStorage.getItem(`${this.computed_url}__per_page`) ) {
|
|
@@ -138,11 +146,11 @@ export default {
|
|
|
138
146
|
</div>
|
|
139
147
|
<div v-else></div>
|
|
140
148
|
<div class="flex items-center" v-if="pages > 1">
|
|
141
|
-
<router-link :to="
|
|
149
|
+
<router-link :to="getFullUrlWithPage(1)" class="page page--arrow" v-if="show_controls">
|
|
142
150
|
<sprite id="control-start" />
|
|
143
151
|
</router-link>
|
|
144
152
|
|
|
145
|
-
<router-link :to="
|
|
153
|
+
<router-link :to="getFullUrlWithPage(page - 1)" class="page page--arrow" v-if="page > 1">
|
|
146
154
|
<sprite id="arrow-left" />
|
|
147
155
|
</router-link>
|
|
148
156
|
<div class="page page--arrow page--disabled" v-else><sprite id="arrow-left" /></div>
|
|
@@ -150,16 +158,16 @@ export default {
|
|
|
150
158
|
<div class="pages">
|
|
151
159
|
<template v-for="i in visible_pages">
|
|
152
160
|
<div class="page page--current" :key="`${i}_current`" v-if="i == page">{{ i }}</div>
|
|
153
|
-
<router-link :to="
|
|
161
|
+
<router-link :to="getFullUrlWithPage(i)" class="page" :key="i" v-else>{{ i }}</router-link>
|
|
154
162
|
</template>
|
|
155
163
|
</div>
|
|
156
164
|
|
|
157
|
-
<router-link :to="
|
|
165
|
+
<router-link :to="getFullUrlWithPage(page + 1)" class="page page--arrow" v-if="page < pages">
|
|
158
166
|
<sprite id="arrow-right" />
|
|
159
167
|
</router-link>
|
|
160
168
|
<div class="page page--arrow page--disabled" v-else><sprite id="arrow-right" /></div>
|
|
161
169
|
|
|
162
|
-
<router-link :to="
|
|
170
|
+
<router-link :to="getFullUrlWithPage(pages)" class="page page--arrow" v-if="show_controls">
|
|
163
171
|
<sprite id="control-end" />
|
|
164
172
|
</router-link>
|
|
165
173
|
</div>
|
|
@@ -6,15 +6,15 @@ export default {
|
|
|
6
6
|
type: [Boolean, Number, String],
|
|
7
7
|
required: true,
|
|
8
8
|
},
|
|
9
|
-
|
|
9
|
+
green: {
|
|
10
10
|
type: Boolean,
|
|
11
11
|
required: false,
|
|
12
12
|
default: false,
|
|
13
13
|
},
|
|
14
|
-
|
|
14
|
+
red: {
|
|
15
15
|
type: Boolean,
|
|
16
16
|
required: false,
|
|
17
|
-
default:
|
|
17
|
+
default: false,
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
20
|
computed: {
|
|
@@ -35,11 +35,11 @@ export default {
|
|
|
35
35
|
},
|
|
36
36
|
|
|
37
37
|
css_class() {
|
|
38
|
-
if ( this.yes && this.
|
|
38
|
+
if ( this.yes && this.green ) {
|
|
39
39
|
return 'color-green';
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
if ( !this.yes && this.
|
|
42
|
+
if ( !this.yes && this.red ) {
|
|
43
43
|
return 'color-red';
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -76,6 +76,11 @@ export default {
|
|
|
76
76
|
required: false,
|
|
77
77
|
default: '',
|
|
78
78
|
},
|
|
79
|
+
autoselect: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
required: false,
|
|
82
|
+
default: false,
|
|
83
|
+
},
|
|
79
84
|
},
|
|
80
85
|
emits: ['update:modelValue', 'select'],
|
|
81
86
|
data() {
|
|
@@ -111,6 +116,10 @@ export default {
|
|
|
111
116
|
let data = await Request.get(this.url ? this.url : `/${this.domain}/search`, params);
|
|
112
117
|
this.results = data.items;
|
|
113
118
|
this.results_visible = is_autosearch ? false : true;
|
|
119
|
+
|
|
120
|
+
if ( this.autoselect && this.results.length == 1 ) {
|
|
121
|
+
this.select(this.results[0]);
|
|
122
|
+
}
|
|
114
123
|
},
|
|
115
124
|
|
|
116
125
|
select(result) {
|
|
@@ -23,7 +23,6 @@ export default {
|
|
|
23
23
|
data() {
|
|
24
24
|
return {
|
|
25
25
|
dz: null,
|
|
26
|
-
inited: false,
|
|
27
26
|
loading: false,
|
|
28
27
|
}
|
|
29
28
|
},
|
|
@@ -37,12 +36,6 @@ export default {
|
|
|
37
36
|
},
|
|
38
37
|
},
|
|
39
38
|
mounted() {
|
|
40
|
-
if ( this.inited || !this.$refs.dropzone ) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
this.inited = true;
|
|
45
|
-
|
|
46
39
|
this.dz = new Dropzone(this.$refs.dropzone, {
|
|
47
40
|
url: `${BACK_URL}${this.path}?jwt_token=${localStorage.getItem('jwt_token')}`,
|
|
48
41
|
thumbnailWidth: 150,
|
|
@@ -71,7 +64,10 @@ export default {
|
|
|
71
64
|
Alert.show(response, 'error');
|
|
72
65
|
}
|
|
73
66
|
});
|
|
74
|
-
}
|
|
67
|
+
},
|
|
68
|
+
unmounted() {
|
|
69
|
+
this.dz.destroy();
|
|
70
|
+
},
|
|
75
71
|
}
|
|
76
72
|
</script>
|
|
77
73
|
|