adata-ui 0.1.38 → 0.1.41
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/dist/adata-ui.common.js +120 -71
- package/dist/adata-ui.common.js.map +1 -1
- package/dist/adata-ui.css +1 -1
- package/dist/adata-ui.umd.js +120 -71
- package/dist/adata-ui.umd.js.map +1 -1
- package/dist/adata-ui.umd.min.js +2 -2
- package/dist/adata-ui.umd.min.js.map +1 -1
- package/package-lock.json +1 -1
- package/package.json +1 -1
- package/src/App.vue +27 -14
- package/src/assets/_text_field.scss +4 -114
- package/src/components/Header/Header.vue +30 -15
- package/src/components/Header/Profile.vue +9 -9
- package/src/components/SearchTextField/SearchTextField.vue +106 -66
package/package-lock.json
CHANGED
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -1,37 +1,50 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div id="app">
|
|
3
|
-
<!-- <text-field label="Пример" v-model="value" @input="inputHandle" @enterPressed="inputHandle" />-->
|
|
4
|
-
<search-text-field
|
|
3
|
+
<!-- <text-field label="Пример" v-model="value" @input="inputHandle" @enterPressed="inputHandle" />-->
|
|
4
|
+
<search-text-field
|
|
5
|
+
label="Пример2"
|
|
6
|
+
v-model="value"
|
|
7
|
+
@input="inputHandle"
|
|
8
|
+
@enterPressed="inputHandle"
|
|
9
|
+
:options="options"
|
|
10
|
+
:optionFields="['id', 'name']"
|
|
11
|
+
v-mask="'####-##'"
|
|
12
|
+
clearable
|
|
13
|
+
/>
|
|
5
14
|
</div>
|
|
6
15
|
</template>
|
|
7
16
|
|
|
8
17
|
<script>
|
|
9
|
-
|
|
18
|
+
import { VueMaskDirective } from "v-mask";
|
|
10
19
|
// import TextField from "./components/TextField/TextField";
|
|
11
20
|
import SearchTextField from "./components/SearchTextField/SearchTextField";
|
|
12
21
|
|
|
13
22
|
export default {
|
|
14
|
-
name:
|
|
23
|
+
name: "App",
|
|
24
|
+
directives: {
|
|
25
|
+
mask: VueMaskDirective,
|
|
26
|
+
},
|
|
15
27
|
components: {
|
|
16
28
|
// TextField,
|
|
17
|
-
SearchTextField
|
|
29
|
+
SearchTextField,
|
|
18
30
|
},
|
|
19
31
|
data() {
|
|
20
32
|
return {
|
|
21
33
|
value: "",
|
|
22
|
-
options: [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
options: [
|
|
35
|
+
{
|
|
36
|
+
id: 1,
|
|
37
|
+
name: "reg",
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
};
|
|
28
41
|
},
|
|
29
42
|
methods: {
|
|
30
43
|
inputHandle(val) {
|
|
31
44
|
console.log(val);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
35
48
|
</script>
|
|
36
49
|
|
|
37
50
|
<style>
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
|
|
65
65
|
&__input {
|
|
66
66
|
background: #ffffff;
|
|
67
|
-
border:
|
|
67
|
+
border: 0.5px solid #c4c4c4;
|
|
68
68
|
box-sizing: border-box;
|
|
69
69
|
border-radius: 2px;
|
|
70
70
|
width: 100%;
|
|
@@ -90,19 +90,12 @@
|
|
|
90
90
|
font-size: 8px;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
&:not(:focus):valid ~ #{$self}__label-red {
|
|
96
|
-
top: 12px;
|
|
97
|
-
font-size: 10px;
|
|
98
|
-
color: #ff2e43;
|
|
99
|
-
@media(max-width: 1025px) {
|
|
100
|
-
font-size: 8px;
|
|
101
|
-
}
|
|
93
|
+
&:hover {
|
|
94
|
+
border: 0.5px solid #2C3E50;
|
|
102
95
|
}
|
|
103
96
|
|
|
104
97
|
&:focus {
|
|
105
|
-
border:
|
|
98
|
+
border: 0.5px solid #2C3E50;
|
|
106
99
|
}
|
|
107
100
|
|
|
108
101
|
&::placeholder {
|
|
@@ -135,28 +128,6 @@
|
|
|
135
128
|
}
|
|
136
129
|
}
|
|
137
130
|
|
|
138
|
-
&__label-red {
|
|
139
|
-
position: absolute;
|
|
140
|
-
pointer-events: none;
|
|
141
|
-
left: 16px;
|
|
142
|
-
top: 50%;
|
|
143
|
-
transform: translateY(-50%);
|
|
144
|
-
white-space: nowrap;
|
|
145
|
-
overflow: hidden;
|
|
146
|
-
line-height: 40px;
|
|
147
|
-
transition: 0.3s;
|
|
148
|
-
color: #ff2e43;
|
|
149
|
-
font-size: 12px;
|
|
150
|
-
|
|
151
|
-
@media(max-width: 1025px) {
|
|
152
|
-
left: 12px;
|
|
153
|
-
font-size: 10px;
|
|
154
|
-
line-height: 16px;
|
|
155
|
-
color: #ff2e43;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
|
|
160
131
|
&__icon {
|
|
161
132
|
position: absolute;
|
|
162
133
|
right: 16px;
|
|
@@ -209,85 +180,4 @@
|
|
|
209
180
|
}
|
|
210
181
|
}
|
|
211
182
|
}
|
|
212
|
-
|
|
213
|
-
.mobile-magnifier {
|
|
214
|
-
display: flex;
|
|
215
|
-
justify-content: center;
|
|
216
|
-
align-items: center;
|
|
217
|
-
height: 40px;
|
|
218
|
-
width: 40px;
|
|
219
|
-
min-width: 40px;
|
|
220
|
-
border-radius: 0 2px 2px 0;
|
|
221
|
-
border-left: none;
|
|
222
|
-
background: #FFCD33;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
&__input-mob-filter {
|
|
226
|
-
background: #ffffff;
|
|
227
|
-
border-bottom: none;
|
|
228
|
-
box-sizing: border-box;
|
|
229
|
-
border-radius: 2px;
|
|
230
|
-
width: 100%;
|
|
231
|
-
height: 48px;
|
|
232
|
-
font-size: 16px;
|
|
233
|
-
line-height: 19px;
|
|
234
|
-
display: flex;
|
|
235
|
-
align-items: center;
|
|
236
|
-
color: #1A2030;
|
|
237
|
-
padding: 19px 40px 5px 16px;
|
|
238
|
-
transition: 0.3s all;
|
|
239
|
-
-webkit-appearance: none;
|
|
240
|
-
-moz-appearance: none;
|
|
241
|
-
appearance: none;
|
|
242
|
-
|
|
243
|
-
&:focus ~ #{$self}__label-mob-filter,
|
|
244
|
-
&:not(:focus):valid ~ #{$self}__label-mob-filter {
|
|
245
|
-
top: 11px;
|
|
246
|
-
font-size: 10px;
|
|
247
|
-
color: #71757A;
|
|
248
|
-
@media(max-width: 1025px) {
|
|
249
|
-
font-size: 7px;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
&:focus {
|
|
254
|
-
border: 1px solid #2c3e50;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
&::placeholder {
|
|
258
|
-
font-size: 12px;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
&.error {
|
|
262
|
-
border: 1px solid #FF2E43;
|
|
263
|
-
background: #ff2e431f;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
&__label-mob-filter {
|
|
268
|
-
position: absolute;
|
|
269
|
-
pointer-events: none;
|
|
270
|
-
left: 16px;
|
|
271
|
-
top: 50%;
|
|
272
|
-
transform: translateY(-50%);
|
|
273
|
-
white-space: nowrap;
|
|
274
|
-
overflow: hidden;
|
|
275
|
-
line-height: 40px;
|
|
276
|
-
transition: 0.3s;
|
|
277
|
-
color: #71757A;
|
|
278
|
-
@media(max-width: 1025px) {
|
|
279
|
-
left: 16px;
|
|
280
|
-
font-size: 14px;
|
|
281
|
-
line-height: 16px;
|
|
282
|
-
color: #71757A;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
&__red {
|
|
286
|
-
color: rgba(255, 0, 0, 0.53);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
&__magnifier {
|
|
290
|
-
left: 8px;
|
|
291
|
-
width: fit-content;
|
|
292
|
-
}
|
|
293
183
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<header class="a-header" :class="[{'bordered': isBordered}, {'fixed': isFixed}]">
|
|
3
3
|
<div class="container">
|
|
4
4
|
<div class="a-header__left">
|
|
5
|
-
<a class="logo" :href="
|
|
5
|
+
<a class="logo" :href="main[mode]">
|
|
6
6
|
<svg class="adata-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 166 48">
|
|
7
7
|
<path d="M62.926 38.22v-28h10.316c10.342 0 15.511 4.55 15.508 13.652 0 4.36-1.41 7.843-4.232 10.448-2.822 2.605-6.58 3.907-11.276 3.904l-10.316-.004zm6.56-22.868v17.752h3.248c2.839 0 5.069-.82 6.69-2.46 1.622-1.64 2.43-3.873 2.424-6.7 0-2.667-.8-4.767-2.403-6.3-1.602-1.533-3.853-2.297-6.752-2.292h-3.206zM118.5 38.22h-7.131l-2.079-6.228H98.958l-2.079 6.228h-7.093l10.598-28h7.775l10.341 28zm-10.723-11.072l-3.127-9.416a11.94 11.94 0 01-.486-2.516h-.162c-.07.83-.24 1.649-.508 2.44l-3.168 9.492h7.451zm31.833-11.796h-8.316V38.22h-6.557V15.352h-8.274v-5.136h23.147v5.136zM166 38.22h-7.143l-2.079-6.228h-10.349l-2.05 6.228h-7.106l10.598-28h7.776l10.353 28zm-10.719-11.072l-3.127-9.416a11.94 11.94 0 01-.486-2.516h-.163c-.069.83-.239 1.649-.507 2.44l-3.168 9.492h7.451zM24.553 15.252h-.163c-.069.83-.24 1.649-.507 2.44L20.715 27.2h7.45l-3.126-9.412a12.02 12.02 0 01-.486-2.536z"></path>
|
|
8
8
|
<path d="M44.905 0H4.99a5.091 5.091 0 00-3.528 1.406A4.71 4.71 0 000 4.8v38.4a4.71 4.71 0 001.461 3.394A5.091 5.091 0 004.99 48h39.916a5.091 5.091 0 003.528-1.406 4.71 4.71 0 001.462-3.394V4.8a4.71 4.71 0 00-1.462-3.394A5.091 5.091 0 0044.905 0zM31.737 38.26l-2.079-6.232H19.305l-2.05 6.232h-7.097l10.598-28h7.776l10.353 28h-7.148z"></path>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
:key="index"
|
|
14
14
|
class="menu__wrapper menu__items"
|
|
15
15
|
:class="{active: item.key === activeTabKey}"
|
|
16
|
-
:href="
|
|
16
|
+
:href="item[mode]"
|
|
17
17
|
>
|
|
18
18
|
{{ item.name }}
|
|
19
19
|
</a>
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
<slot name="chooseCountry"></slot>
|
|
24
24
|
<Profile
|
|
25
25
|
v-bind:profileDropDown="profileDropDown"
|
|
26
|
-
:
|
|
26
|
+
:mode="mode"
|
|
27
27
|
:isAuthenticated="isAuthenticated"
|
|
28
28
|
:requestCount="requestCount"
|
|
29
29
|
:daysRemaining="daysRemaining"
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
:key="index"
|
|
65
65
|
class="menu_mobile-wrapper"
|
|
66
66
|
:class="{'active-burger-tab': item.key === activeTabKey}"
|
|
67
|
-
:href="
|
|
67
|
+
:href="item[mode]"
|
|
68
68
|
>
|
|
69
69
|
{{ item.name }}
|
|
70
70
|
</a>
|
|
@@ -84,9 +84,12 @@ export default {
|
|
|
84
84
|
MobileToggle,
|
|
85
85
|
},
|
|
86
86
|
props: {
|
|
87
|
-
|
|
88
|
-
type:
|
|
89
|
-
|
|
87
|
+
mode: {
|
|
88
|
+
type: String,
|
|
89
|
+
required: true,
|
|
90
|
+
validator: function (value) {
|
|
91
|
+
return ['prod', 'dev', 'staging'].indexOf(value) !== -1
|
|
92
|
+
}
|
|
90
93
|
},
|
|
91
94
|
isAuthenticated: {
|
|
92
95
|
type: Boolean,
|
|
@@ -130,35 +133,50 @@ export default {
|
|
|
130
133
|
data() {
|
|
131
134
|
return {
|
|
132
135
|
profileDropDown,
|
|
136
|
+
main: {
|
|
137
|
+
dev: 'https://adtdev.kz',
|
|
138
|
+
prod: 'https://adata.kz',
|
|
139
|
+
staging: 'https://adada.kz'
|
|
140
|
+
},
|
|
133
141
|
subheaderItems: [
|
|
134
142
|
{
|
|
135
143
|
id: 1,
|
|
136
144
|
name: "Контрагенты",
|
|
137
|
-
|
|
145
|
+
dev: 'https://pk.adtdev.kz',
|
|
146
|
+
prod: 'https://pk.adata.kz',
|
|
147
|
+
staging: 'https://pk.adada.kz',
|
|
138
148
|
key: 'counterparty'
|
|
139
149
|
},
|
|
140
150
|
{
|
|
141
151
|
id: 2,
|
|
142
152
|
name: "Тендеры",
|
|
143
|
-
|
|
153
|
+
dev: 'https://tender.adtdev.kz',
|
|
154
|
+
prod: 'https://tender.adata.kz',
|
|
155
|
+
staging: 'https://tender.adada.kz',
|
|
144
156
|
key: 'tenders'
|
|
145
157
|
},
|
|
146
158
|
{
|
|
147
159
|
id: 3,
|
|
148
160
|
name: "Работа",
|
|
149
|
-
|
|
161
|
+
dev: 'https://work.adtdev.kz',
|
|
162
|
+
prod: 'https://work.adata.kz',
|
|
163
|
+
staging: 'https://work.adada.kz',
|
|
150
164
|
key: 'work'
|
|
151
165
|
},
|
|
152
166
|
{
|
|
153
167
|
id: 4,
|
|
154
168
|
name: "Штрафы",
|
|
155
|
-
|
|
169
|
+
dev: 'https://avto.adtdev.kz',
|
|
170
|
+
prod: 'https://avto.adata.kz',
|
|
171
|
+
staging: 'https://avto.adada.kz',
|
|
156
172
|
key: 'fines'
|
|
157
173
|
},
|
|
158
174
|
{
|
|
159
175
|
id: 5,
|
|
160
176
|
name: "Маркетинг",
|
|
161
|
-
|
|
177
|
+
dev: 'https://marketing.adtdev.kz',
|
|
178
|
+
prod: 'https://marketing.adata.kz',
|
|
179
|
+
staging: 'https://marketing.adada.kz',
|
|
162
180
|
key: 'marketing'
|
|
163
181
|
}
|
|
164
182
|
],
|
|
@@ -173,9 +191,6 @@ export default {
|
|
|
173
191
|
this.isOpen = !this.isOpen
|
|
174
192
|
this.$emit('menuOpen', this.isOpen)
|
|
175
193
|
},
|
|
176
|
-
toAdtdev(url) {
|
|
177
|
-
return this.isDev ? url.replace("adata", "adtdev") : url;
|
|
178
|
-
},
|
|
179
194
|
setBalance(balance) {
|
|
180
195
|
if (balance !== 0) {
|
|
181
196
|
this.profileDropDown[2].name = 'Текущий баланс: ' + this.thousandSeparator(balance) + ' ₸';
|
|
@@ -241,9 +241,12 @@ export default {
|
|
|
241
241
|
clickOutside: vClickOutside.directive,
|
|
242
242
|
},
|
|
243
243
|
props: {
|
|
244
|
-
|
|
245
|
-
type:
|
|
246
|
-
|
|
244
|
+
mode: {
|
|
245
|
+
type: String,
|
|
246
|
+
required: true,
|
|
247
|
+
validator: function (value) {
|
|
248
|
+
return ['prod', 'dev', 'staging'].indexOf(value) !== -1
|
|
249
|
+
}
|
|
247
250
|
},
|
|
248
251
|
profileDropDown: {
|
|
249
252
|
type: Array,
|
|
@@ -316,17 +319,17 @@ export default {
|
|
|
316
319
|
},
|
|
317
320
|
async showModal(url, name) {
|
|
318
321
|
if (name.includes('Текущий')) {
|
|
319
|
-
if(window.location.href.includes(
|
|
322
|
+
if(window.location.href.includes(url)) {
|
|
320
323
|
this.$emit("setIsReplenishModal", true);
|
|
321
324
|
this.setShowModal(true);
|
|
322
325
|
} else {
|
|
323
|
-
await window.open(
|
|
326
|
+
await window.open(url + "&modal=show", "_self")
|
|
324
327
|
}
|
|
325
328
|
}
|
|
326
329
|
},
|
|
327
330
|
handleClick(url, name) {
|
|
328
331
|
if (!name.includes('Текущий')) {
|
|
329
|
-
window.open(
|
|
332
|
+
window.open(url, "_self");
|
|
330
333
|
this.active = false;
|
|
331
334
|
if (this.chosenElem) this.chosenElem.opened = false;
|
|
332
335
|
}
|
|
@@ -335,9 +338,6 @@ export default {
|
|
|
335
338
|
this.chosenElem = this.listDropDown[index];
|
|
336
339
|
this.$set(this.listDropDown[index], 'opened', !this.listDropDown[index].opened)
|
|
337
340
|
},
|
|
338
|
-
toAdtdev(url) {
|
|
339
|
-
return this.isDev ? url.replace("adata", "adtdev") : url;
|
|
340
|
-
}
|
|
341
341
|
}
|
|
342
342
|
};
|
|
343
343
|
</script>
|
|
@@ -1,52 +1,86 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
<div
|
|
3
|
+
class="adt-text-block"
|
|
4
|
+
v-click-outside="onOutsideClick"
|
|
5
|
+
@keydown.down.up.prevent="onUpOrDownClicked"
|
|
5
6
|
>
|
|
6
7
|
<div :class="['adt-text-block__field', { error: !!errorText }]">
|
|
7
8
|
<input
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
:class="{ error: !!errorText }"
|
|
9
|
+
ref="input"
|
|
10
|
+
:type="type"
|
|
11
|
+
:value="value"
|
|
12
|
+
:placeholder="placeholder"
|
|
13
|
+
required
|
|
14
|
+
@keyup.enter="enterPressed"
|
|
15
|
+
@input="$emit('input', $event.target.value)"
|
|
16
|
+
@focus="showAutocomplete = true"
|
|
17
|
+
@click="$emit('showVTour')"
|
|
18
|
+
class="adt-text-block__input"
|
|
19
|
+
:class="{ error: !!errorText }"
|
|
20
20
|
/>
|
|
21
21
|
<label class="adt-text-block__label">
|
|
22
22
|
{{ label }}
|
|
23
23
|
</label>
|
|
24
|
-
<div
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
<div
|
|
25
|
+
class="adt-text-block__icon"
|
|
26
|
+
v-if="clearable && value"
|
|
27
|
+
@click="$emit('input', '')"
|
|
28
|
+
>
|
|
29
|
+
<svg
|
|
30
|
+
width="12"
|
|
31
|
+
height="12"
|
|
32
|
+
fill="none"
|
|
33
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
34
|
+
viewBox="0 0 16 16"
|
|
35
|
+
id="clearIcon"
|
|
36
|
+
>
|
|
37
|
+
<path
|
|
38
|
+
d="M2 2l12 12m0-12L2 14"
|
|
39
|
+
stroke="#2C3E50"
|
|
40
|
+
stroke-linecap="round"
|
|
41
|
+
stroke-linejoin="round"
|
|
42
|
+
></path>
|
|
27
43
|
</svg>
|
|
28
44
|
</div>
|
|
29
45
|
</div>
|
|
30
46
|
<div class="adt-text-block__error" v-if="!!errorText">
|
|
31
|
-
<svg
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
47
|
+
<svg
|
|
48
|
+
width="14"
|
|
49
|
+
height="14"
|
|
50
|
+
viewBox="0 0 16 16"
|
|
51
|
+
fill="none"
|
|
52
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
53
|
+
id="icon__attention"
|
|
54
|
+
>
|
|
55
|
+
<path
|
|
56
|
+
d="M8.5 4C8.5 3.72386 8.27614 3.5 8 3.5C7.72386 3.5 7.5 3.72386 7.5 4H8.5ZM7.5 9C7.5 9.27614 7.72386 9.5 8 9.5C8.27614 9.5 8.5 9.27614 8.5 9H7.5ZM7.5 4V9H8.5V4H7.5Z"
|
|
57
|
+
fill="#FF2E43"
|
|
58
|
+
/>
|
|
59
|
+
<path
|
|
60
|
+
d="M8.5 11C8.5 10.7239 8.27614 10.5 8 10.5C7.72386 10.5 7.5 10.7239 7.5 11H8.5ZM7.5 11.5C7.5 11.7761 7.72386 12 8 12C8.27614 12 8.5 11.7761 8.5 11.5H7.5ZM7.5 11V11.5H8.5V11H7.5Z"
|
|
61
|
+
fill="#FF2E43"
|
|
62
|
+
/>
|
|
63
|
+
<circle cx="8" cy="8" r="7" stroke="#FF2E43" />
|
|
35
64
|
</svg>
|
|
36
65
|
{{ errorText }}
|
|
37
66
|
</div>
|
|
38
|
-
<div
|
|
67
|
+
<div
|
|
68
|
+
class="adt-text-block__options search-options"
|
|
69
|
+
v-show="options && options.length > 0 && showAutocomplete"
|
|
70
|
+
>
|
|
39
71
|
<PerfectScrollbar>
|
|
40
72
|
<div class="search-options__wrapper">
|
|
41
73
|
<div
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
74
|
+
class="search-options__item"
|
|
75
|
+
v-for="(option, index) in options"
|
|
76
|
+
:key="index"
|
|
77
|
+
@click="onAutocompleteOptionClick(option)"
|
|
78
|
+
ref="searchOptions"
|
|
47
79
|
>
|
|
48
80
|
{{ !!optionFields.length ? textByOption(option) : option }}
|
|
49
|
-
<div class="hiddenOne" v-if="option.type && isTypeRequired">
|
|
81
|
+
<div class="hiddenOne" v-if="option.type && isTypeRequired">
|
|
82
|
+
${{ option.type }}$
|
|
83
|
+
</div>
|
|
50
84
|
</div>
|
|
51
85
|
</div>
|
|
52
86
|
</PerfectScrollbar>
|
|
@@ -55,8 +89,8 @@
|
|
|
55
89
|
</template>
|
|
56
90
|
|
|
57
91
|
<script>
|
|
58
|
-
import
|
|
59
|
-
|
|
92
|
+
import "../../assets/style.scss";
|
|
93
|
+
|
|
60
94
|
import { PerfectScrollbar } from "vue2-perfect-scrollbar";
|
|
61
95
|
import vClickOutside from "v-click-outside";
|
|
62
96
|
|
|
@@ -64,20 +98,24 @@ export default {
|
|
|
64
98
|
name: "SearchTextField",
|
|
65
99
|
directives: {
|
|
66
100
|
clickOutside: vClickOutside.directive,
|
|
67
|
-
mask: VueMaskDirective
|
|
68
101
|
},
|
|
69
102
|
props: {
|
|
70
103
|
errorText: {
|
|
71
104
|
type: String,
|
|
72
|
-
default: ""
|
|
105
|
+
default: "",
|
|
73
106
|
},
|
|
74
107
|
placeholder: {
|
|
75
108
|
type: String,
|
|
76
|
-
default: ""
|
|
109
|
+
default: "",
|
|
77
110
|
},
|
|
78
111
|
mask: {
|
|
79
112
|
type: String,
|
|
80
|
-
default: ""
|
|
113
|
+
default: "",
|
|
114
|
+
},
|
|
115
|
+
value: {
|
|
116
|
+
type: String,
|
|
117
|
+
required: true,
|
|
118
|
+
default: "",
|
|
81
119
|
},
|
|
82
120
|
label: {
|
|
83
121
|
type: String,
|
|
@@ -89,15 +127,15 @@ export default {
|
|
|
89
127
|
},
|
|
90
128
|
clearable: {
|
|
91
129
|
type: Boolean,
|
|
92
|
-
default: false
|
|
130
|
+
default: false,
|
|
93
131
|
},
|
|
94
132
|
isWithIcon: {
|
|
95
133
|
type: Boolean,
|
|
96
|
-
default: false
|
|
134
|
+
default: false,
|
|
97
135
|
},
|
|
98
136
|
isTypeRequired: {
|
|
99
137
|
type: Boolean,
|
|
100
|
-
default: false
|
|
138
|
+
default: false,
|
|
101
139
|
},
|
|
102
140
|
options: {
|
|
103
141
|
type: Array,
|
|
@@ -105,34 +143,33 @@ export default {
|
|
|
105
143
|
},
|
|
106
144
|
optionFields: {
|
|
107
145
|
type: Array,
|
|
108
|
-
default: null
|
|
146
|
+
default: null,
|
|
109
147
|
},
|
|
110
148
|
isMobile: {
|
|
111
149
|
type: Boolean,
|
|
112
|
-
default: false
|
|
150
|
+
default: false,
|
|
113
151
|
},
|
|
114
152
|
},
|
|
115
153
|
components: {
|
|
116
|
-
PerfectScrollbar
|
|
154
|
+
PerfectScrollbar,
|
|
117
155
|
},
|
|
118
156
|
data() {
|
|
119
157
|
return {
|
|
120
158
|
showAutocomplete: false,
|
|
121
159
|
showPlaceholder: false,
|
|
122
|
-
|
|
123
|
-
}
|
|
160
|
+
};
|
|
124
161
|
},
|
|
125
162
|
computed: {
|
|
126
163
|
inputPlaceholder() {
|
|
127
|
-
return this.showPlaceholder ? this.placeholder : ""
|
|
128
|
-
}
|
|
164
|
+
return this.showPlaceholder ? this.placeholder : "";
|
|
165
|
+
},
|
|
129
166
|
},
|
|
130
167
|
methods: {
|
|
131
|
-
|
|
132
|
-
this.$emit(
|
|
168
|
+
enterPressed() {
|
|
169
|
+
this.$emit("enterPressed", this.showAutocomplete);
|
|
133
170
|
},
|
|
134
171
|
onOutsideClick() {
|
|
135
|
-
if (!this.isMobile) this.showAutocomplete = false
|
|
172
|
+
if (!this.isMobile) this.showAutocomplete = false;
|
|
136
173
|
},
|
|
137
174
|
onUpOrDownClicked(e) {
|
|
138
175
|
const autoCompleteOptions = this.$refs.searchOptions;
|
|
@@ -140,44 +177,48 @@ export default {
|
|
|
140
177
|
if (length > 0) {
|
|
141
178
|
switch (e.which) {
|
|
142
179
|
case 40:
|
|
143
|
-
this.moveOption(autoCompleteOptions,
|
|
180
|
+
this.moveOption(autoCompleteOptions, "nextElementSibling");
|
|
144
181
|
break;
|
|
145
182
|
case 38:
|
|
146
|
-
this.moveOption(autoCompleteOptions,
|
|
183
|
+
this.moveOption(autoCompleteOptions, "previousElementSibling");
|
|
147
184
|
break;
|
|
148
185
|
}
|
|
149
186
|
}
|
|
150
187
|
},
|
|
151
188
|
moveOption(autoCompleteOptions, elementType) {
|
|
152
|
-
const selectedOption = autoCompleteOptions.find((option) =>
|
|
189
|
+
const selectedOption = autoCompleteOptions.find((option) =>
|
|
190
|
+
option.hasAttribute("id")
|
|
191
|
+
);
|
|
153
192
|
if (selectedOption) {
|
|
154
193
|
const siblingElement = selectedOption[elementType];
|
|
155
|
-
this.$emit(
|
|
156
|
-
if (siblingElement?.classList.contains(
|
|
194
|
+
this.$emit("castOption", siblingElement?.innerText || "");
|
|
195
|
+
if (siblingElement?.classList.contains("search-options__item")) {
|
|
157
196
|
selectedOption.removeAttribute("id");
|
|
158
|
-
siblingElement.setAttribute("id",
|
|
197
|
+
siblingElement.setAttribute("id", "searchVariant");
|
|
159
198
|
return;
|
|
160
199
|
}
|
|
161
200
|
selectedOption.removeAttribute("id");
|
|
162
201
|
return;
|
|
163
202
|
}
|
|
164
203
|
let innerText = "";
|
|
165
|
-
if (elementType ===
|
|
204
|
+
if (elementType === "nextElementSibling")
|
|
166
205
|
innerText = this.getAutocompleteOptionText(autoCompleteOptions?.[0]);
|
|
167
|
-
if (elementType ===
|
|
168
|
-
innerText = this.getAutocompleteOptionText(
|
|
169
|
-
|
|
206
|
+
if (elementType === "previousElementSibling")
|
|
207
|
+
innerText = this.getAutocompleteOptionText(
|
|
208
|
+
autoCompleteOptions?.[autoCompleteOptions.length - 1]
|
|
209
|
+
);
|
|
210
|
+
this.$emit("castOption", innerText);
|
|
170
211
|
},
|
|
171
212
|
getAutocompleteOptionText(autocompleteOption) {
|
|
172
|
-
autocompleteOption.setAttribute("id",
|
|
213
|
+
autocompleteOption.setAttribute("id", "searchVariant");
|
|
173
214
|
return autocompleteOption.innerText;
|
|
174
215
|
},
|
|
175
|
-
inputHandler() {
|
|
176
|
-
this.$emit(
|
|
216
|
+
inputHandler(e) {
|
|
217
|
+
this.$emit("input", e.target.value);
|
|
177
218
|
this.showAutocomplete = true;
|
|
178
219
|
},
|
|
179
220
|
onAutocompleteOptionClick(option) {
|
|
180
|
-
this.$emit(
|
|
221
|
+
this.$emit("click", option);
|
|
181
222
|
this.showAutocomplete = false;
|
|
182
223
|
},
|
|
183
224
|
textByOption(obj) {
|
|
@@ -186,8 +227,7 @@ export default {
|
|
|
186
227
|
acc += obj[curr];
|
|
187
228
|
return acc;
|
|
188
229
|
}, "");
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
};
|
|
192
233
|
</script>
|
|
193
|
-
|