adata-ui 0.1.40 → 0.1.43

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-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adata-ui",
3
- "version": "0.1.33",
3
+ "version": "0.1.40",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adata-ui",
3
- "version": "0.1.40",
3
+ "version": "0.1.43",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -1,37 +1,11 @@
1
1
  <template>
2
- <div id="app">
3
- <!-- <text-field label="Пример" v-model="value" @input="inputHandle" @enterPressed="inputHandle" />-->
4
- <search-text-field label="Пример2" v-model="value" @input="inputHandle" @enterPressed="inputHandle" :options="options" :optionFields="['id', 'name']" />
5
- </div>
2
+ <div id="app"></div>
6
3
  </template>
7
4
 
8
5
  <script>
9
-
10
- // import TextField from "./components/TextField/TextField";
11
- import SearchTextField from "./components/SearchTextField/SearchTextField";
12
-
13
6
  export default {
14
- name: 'App',
15
- components: {
16
- // TextField,
17
- SearchTextField
18
- },
19
- data() {
20
- return {
21
- value: "",
22
- options: [{
23
- id: 1,
24
- name: "reg"
25
- }
26
- ]
27
- }
28
- },
29
- methods: {
30
- inputHandle(val) {
31
- console.log(val);
32
- }
33
- }
34
- }
7
+ name: "App",
8
+ };
35
9
  </script>
36
10
 
37
11
  <style>
@@ -75,7 +75,7 @@
75
75
 
76
76
  <script>
77
77
  import Profile from "./Profile";
78
- import { profileDropDown } from "@/configs/profileDropDown"
78
+ import { profileDropDown } from "../../configs/profileDropDown"
79
79
  import MobileToggle from "../transitions/VerticalMobileToggle";
80
80
 
81
81
  export default {
@@ -50,15 +50,15 @@
50
50
  <div v-for="(elem, index) in listDropDown" :key="index">
51
51
  <div :class="elem.link ? 'profile-menu__balance-link': 'profile-menu__links'"
52
52
  class="gray-text"
53
- v-if="elem.url"
54
- @click="handleClick(elem.url, elem.name)"
53
+ v-if="elem[mode]"
54
+ @click="handleClick(elem[mode], elem.name)"
55
55
  >
56
56
  <div>
57
57
  {{ elem.name }}
58
58
  </div>
59
59
  <span
60
60
  v-if="elem.link"
61
- @click="showModal(elem.url, elem.name)"
61
+ @click="showModal(elem[mode], elem.name)"
62
62
  class="profile-menu__balance"
63
63
  >
64
64
  {{ elem.link }}
@@ -79,8 +79,8 @@
79
79
  <div
80
80
  class="profile-menu__item__child"
81
81
  :key="idx + 'link'"
82
- v-if="child.url"
83
- @click="handleClick(child.url, child.name)"
82
+ v-if="child[mode]"
83
+ @click="handleClick(child[mode], child.name)"
84
84
  >
85
85
  <span>
86
86
  <svg width="4" height="4" viewBox="0 0 4 4" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -122,8 +122,8 @@
122
122
  <div class="profile-menu-mobile__items" v-if="listDropDown.length > 0">
123
123
  <div v-for="(elem, index) in listDropDown" :key="index" class="bb">
124
124
  <div
125
- @click="handleClick(elem.url, elem.name)"
126
- v-if="elem.url"
125
+ @click="handleClick(elem[mode], elem.name)"
126
+ v-if="elem[mode]"
127
127
  :class="elem.link ? 'profile-menu-mobile__balance-link': 'profile-menu-mobile__links'"
128
128
  >
129
129
  <div v-if="!elem.link" class="button-inner">
@@ -201,8 +201,8 @@
201
201
  <div class="profile-menu-mobile__inner">
202
202
  <div class="profile-menu-mobile__items" v-if="chosenElem.children.length > 0">
203
203
  <div v-for="(elem, index) in chosenElem.children" :key="index" class="bb">
204
- <div @click="handleClick(elem.url, elem.name)"
205
- v-if="elem.url"
204
+ <div @click="handleClick(elem[mode], elem.name)"
205
+ v-if="elem[mode]"
206
206
  :class="elem.link ? 'profile-menu-mobile__balance-link': 'profile-menu-mobile__links'">
207
207
  <div class="button-inner">
208
208
  <div>{{ elem.name }}</div>
@@ -330,8 +330,8 @@ export default {
330
330
  handleClick(url, name) {
331
331
  if (!name.includes('Текущий')) {
332
332
  window.open(url, "_self");
333
- this.active = false;
334
- if (this.chosenElem) this.chosenElem.opened = false;
333
+ // this.active = false;
334
+ // if (this.chosenElem) this.chosenElem.opened = false;
335
335
  }
336
336
  },
337
337
  rotateItem(index) {
@@ -1,52 +1,86 @@
1
1
  <template>
2
- <div class="adt-text-block"
3
- v-click-outside="onOutsideClick"
4
- @keydown.down.up.prevent="onUpOrDownClicked"
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
- ref="input"
9
- :type="type"
10
- v-mask="mask"
11
- v-model="value"
12
- :placeholder="placeholder"
13
- required
14
- @keyup.enter="pressedEnter"
15
- @input="inputHandler"
16
- @focus="showAutocomplete = true"
17
- @click="$emit('showVTour')"
18
- class="adt-text-block__input"
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 class="adt-text-block__icon" v-if="clearable && value" @click="$emit('input', '')">
25
- <svg width="12" height="12" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="clearIcon">
26
- <path d="M2 2l12 12m0-12L2 14" stroke="#2C3E50" stroke-linecap="round" stroke-linejoin="round"></path>
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 width="14" height="14" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" id="icon__attention">
32
- <path 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" fill="#FF2E43"/>
33
- <path 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" fill="#FF2E43"/>
34
- <circle cx="8" cy="8" r="7" stroke="#FF2E43"/>
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 class="adt-text-block__options search-options" v-show="options && options.length > 0 && showAutocomplete">
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
- class="search-options__item"
43
- v-for="(option, index) in options"
44
- :key="index"
45
- @click="onAutocompleteOptionClick(option)"
46
- ref="searchOptions"
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"> ${{ option.type }}$</div>
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 '../../assets/style.scss';
59
- import { VueMaskDirective } from "v-mask";
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
- value: ""
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
- pressedEnter() {
132
- this.$emit('enter', this.showAutocomplete, this.value);
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, 'nextElementSibling');
180
+ this.moveOption(autoCompleteOptions, "nextElementSibling");
144
181
  break;
145
182
  case 38:
146
- this.moveOption(autoCompleteOptions, 'previousElementSibling');
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) => option.hasAttribute('id'));
189
+ const selectedOption = autoCompleteOptions.find((option) =>
190
+ option.hasAttribute("id")
191
+ );
153
192
  if (selectedOption) {
154
193
  const siblingElement = selectedOption[elementType];
155
- this.$emit('castOption', siblingElement?.innerText || "");
156
- if (siblingElement?.classList.contains('search-options__item')) {
194
+ this.$emit("castOption", siblingElement?.innerText || "");
195
+ if (siblingElement?.classList.contains("search-options__item")) {
157
196
  selectedOption.removeAttribute("id");
158
- siblingElement.setAttribute("id", 'searchVariant');
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 === 'nextElementSibling')
204
+ if (elementType === "nextElementSibling")
166
205
  innerText = this.getAutocompleteOptionText(autoCompleteOptions?.[0]);
167
- if (elementType === 'previousElementSibling')
168
- innerText = this.getAutocompleteOptionText(autoCompleteOptions?.[autoCompleteOptions.length - 1]);
169
- this.$emit('castOption', innerText);
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", 'searchVariant');
213
+ autocompleteOption.setAttribute("id", "searchVariant");
173
214
  return autocompleteOption.innerText;
174
215
  },
175
- inputHandler() {
176
- this.$emit('input', this.value);
216
+ inputHandler(e) {
217
+ this.$emit("input", e.target.value);
177
218
  this.showAutocomplete = true;
178
219
  },
179
220
  onAutocompleteOptionClick(option) {
180
- this.$emit('click', option);
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
-
@@ -2,51 +2,74 @@
2
2
  <div class="adt-text-block">
3
3
  <div :class="['adt-text-block__field', { error: !!errorText }]">
4
4
  <input
5
- ref="input"
6
- v-mask="mask"
7
- :type="type"
8
- v-model="value"
9
- :placeholder="placeholder"
10
- required
11
- @keyup.enter="pressedEnter"
12
- class="adt-text-block__input"
13
- :class="{ error: !!errorText }"
14
- @input="() => {$emit('input', value)}"
5
+ ref="input"
6
+ :type="type"
7
+ :value="value"
8
+ :placeholder="placeholder"
9
+ required
10
+ @input="$emit('input', $event.target.value)"
11
+ @keyup.enter="enterPressed"
12
+ class="adt-text-block__input"
13
+ :class="{ error: !!errorText }"
15
14
  />
16
15
  <label class="adt-text-block__label">
17
16
  {{ label }}
18
17
  <span v-if="required" class="adt-text-block__required">*</span>
19
18
  </label>
20
- <div class="adt-text-block__icon desktop" v-if="clearable && value && value.length > 0"
21
- @click="$emit('input', '')">
22
- <svg width="12" height="12" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="clearIcon">
23
- <path d="M2 2l12 12m0-12L2 14" stroke="#2C3E50" stroke-linecap="round" stroke-linejoin="round"></path>
19
+ <div
20
+ class="adt-text-block__icon desktop"
21
+ v-if="clearable && value && value.length > 0"
22
+ @click="$emit('input', '')"
23
+ >
24
+ <svg
25
+ width="12"
26
+ height="12"
27
+ fill="none"
28
+ xmlns="http://www.w3.org/2000/svg"
29
+ viewBox="0 0 16 16"
30
+ id="clearIcon"
31
+ >
32
+ <path
33
+ d="M2 2l12 12m0-12L2 14"
34
+ stroke="#2C3E50"
35
+ stroke-linecap="round"
36
+ stroke-linejoin="round"
37
+ ></path>
24
38
  </svg>
25
39
  </div>
26
40
  </div>
27
41
  <div class="adt-text-block__error" v-if="!!errorText">
28
- <svg width="14" height="14" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" id="icon__attention">
29
- <path 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" fill="#FF2E43"/>
30
- <path 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" fill="#FF2E43"/>
31
- <circle cx="8" cy="8" r="7" stroke="#FF2E43"/>
42
+ <svg
43
+ width="14"
44
+ height="14"
45
+ viewBox="0 0 16 16"
46
+ fill="none"
47
+ xmlns="http://www.w3.org/2000/svg"
48
+ id="icon__attention"
49
+ >
50
+ <path
51
+ 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"
52
+ fill="#FF2E43"
53
+ />
54
+ <path
55
+ 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"
56
+ fill="#FF2E43"
57
+ />
58
+ <circle cx="8" cy="8" r="7" stroke="#FF2E43" />
32
59
  </svg>
33
60
  {{ errorText }}
34
61
  </div>
35
62
  </div>
36
63
  </template>
37
64
  <script>
38
- import '../../assets/style.scss';
39
- import { VueMaskDirective } from "v-mask";
65
+ import "../../assets/style.scss";
40
66
 
41
67
  export default {
42
68
  name: "TextField",
43
- directives: {
44
- mask: VueMaskDirective
45
- },
46
69
  props: {
47
70
  errorText: {
48
71
  type: String,
49
- default: ""
72
+ default: "",
50
73
  },
51
74
  label: {
52
75
  type: String,
@@ -56,38 +79,42 @@ export default {
56
79
  type: String,
57
80
  default: "text",
58
81
  },
59
- mask: {
82
+ value: {
60
83
  type: String,
61
- default: ""
84
+ required: true,
85
+ default: "",
62
86
  },
63
87
  placeholder: {
64
88
  type: String,
65
- default: ""
89
+ default: "",
66
90
  },
67
91
  clearable: {
68
92
  type: Boolean,
69
- default: false
93
+ default: false,
70
94
  },
71
95
  required: {
72
96
  type: Boolean,
73
- default: false
74
- }
97
+ default: false,
98
+ },
75
99
  },
76
100
  data() {
77
101
  return {
78
102
  showPlaceholder: false,
79
- value: ""
80
- }
103
+ };
81
104
  },
82
105
  computed: {
83
106
  inputPlaceholder() {
84
- return this.showPlaceholder ? this.placeholder : ""
85
- }
107
+ return this.showPlaceholder ? this.placeholder : "";
108
+ },
86
109
  },
87
110
  methods: {
88
- pressedEnter() {
89
- this.$emit('enterPressed', this.value);
90
- }
91
- }
92
- }
111
+ enterPressed() {
112
+ this.$emit("enterPressed", this.showAutocomplete);
113
+ },
114
+ inputHandler(e) {
115
+ this.$emit("input", e.target.value);
116
+ this.showAutocomplete = true;
117
+ },
118
+ },
119
+ };
93
120
  </script>