adata-ui 0.1.17 → 0.1.21

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adata-ui",
3
- "version": "0.1.17",
3
+ "version": "0.1.21",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -19,7 +19,8 @@
19
19
  "user": "0.0.0",
20
20
  "v-click-outside": "^3.1.2",
21
21
  "vue": "^2.6.11",
22
- "vue-the-mask": "^0.11.1"
22
+ "vue-the-mask": "^0.11.1",
23
+ "vue2-perfect-scrollbar": "^1.5.2"
23
24
  },
24
25
  "devDependencies": {
25
26
  "@babel/core": "^7.16.7",
@@ -0,0 +1,295 @@
1
+ *:focus {
2
+ outline: none;
3
+ }
4
+
5
+ .adt-text-block {
6
+ $self: &;
7
+ position: relative;
8
+ width: 100%;
9
+
10
+ &.magnifier {
11
+ #{$self}__input {
12
+ padding: 19px 40px 5px 40px;
13
+ }
14
+
15
+ #{$self}__label {
16
+ left: 40px;
17
+ }
18
+ }
19
+
20
+ &.magnifier-mobile {
21
+ #{$self}__magnifier {
22
+ display: block;
23
+ }
24
+
25
+ #{$self}__input {
26
+ padding: 19px 8px 5px 11px;
27
+ border-top-right-radius: 0;
28
+ border-bottom-right-radius: 0;
29
+ -webkit-appearance: none;
30
+ }
31
+
32
+ #{$self}__label {
33
+ left: 12px;
34
+ }
35
+ }
36
+
37
+ &__input-mob-search {
38
+ border-top-right-radius: 0;
39
+ border-bottom-right-radius: 0;
40
+ -webkit-appearance: none;
41
+ }
42
+
43
+ &__error {
44
+ text-align: left;
45
+ font-size: var(--fs-content-micro);
46
+ line-height: 14px;
47
+ color: #ff2e43;
48
+ margin-top: 9px;
49
+ display: flex;
50
+ align-items: center;
51
+ svg {
52
+ margin-right: 9px;
53
+ }
54
+ }
55
+
56
+ &__field {
57
+ position: relative;
58
+ overflow: hidden;
59
+ @media(max-width: 1025px) {
60
+ width: 100%;
61
+ display: flex;
62
+ }
63
+ }
64
+
65
+ &__input {
66
+ background: #ffffff;
67
+ border: 1px solid #c4c4c4;
68
+ box-sizing: border-box;
69
+ border-radius: 2px;
70
+ width: 100%;
71
+ height: 40px;
72
+ font-size: var(--fs-form);
73
+ color: #1A2030;
74
+ padding: 19px 40px 5px 16px;
75
+ transition: 0.3s all;
76
+ @media(max-width: 1025px) {
77
+ padding: 19px 36px 7px 12px;
78
+ height: 40px;
79
+ border: 1px solid #71757A;
80
+ font-size: var(--fs-content-mini);
81
+ }
82
+
83
+ &:focus ~ #{$self}__label,
84
+ &:not(:focus):valid ~ #{$self}__label,
85
+ &:-webkit-autofill ~ #{$self}__label,
86
+ &:not(:-webkit-autofill):valid ~ #{$self}__label {
87
+ top: 12px;
88
+ font-size: var(--fs-content-micro);
89
+ color: #71757A;
90
+ @media(max-width: 1025px) {
91
+ font-size: var(--fs-content-nano);
92
+ }
93
+ }
94
+
95
+ &:focus ~ #{$self}__label-red,
96
+ &:not(:focus):valid ~ #{$self}__label-red {
97
+ top: 12px;
98
+ font-size: var(--fs-content-micro);
99
+ color: #ff2e43;
100
+ @media(max-width: 1025px) {
101
+ font-size: var(--fs-content-nano);
102
+ }
103
+ }
104
+
105
+ &:focus {
106
+ border: 1px solid #2c3e50;
107
+ }
108
+
109
+ &::placeholder {
110
+ font-size: 12px;
111
+ }
112
+
113
+ &.error {
114
+ background: #ff2e431f;
115
+ }
116
+ }
117
+
118
+ &__label {
119
+ position: absolute;
120
+ pointer-events: none;
121
+ left: 16px;
122
+ top: 50%;
123
+ transform: translateY(-50%);
124
+ white-space: nowrap;
125
+ overflow: hidden;
126
+ line-height: 40px;
127
+ transition: 0.3s;
128
+ color: #71757A;
129
+ font-size: var(--fs-form-placeholder);
130
+ @media(max-width: 1025px) {
131
+ left: 12px;
132
+ font-size: var(--fs-content-micro);
133
+ line-height: 16px;
134
+ color: #71757A;
135
+ }
136
+ }
137
+
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: var(--fs-form-placeholder);
150
+
151
+ @media(max-width: 1025px) {
152
+ left: 12px;
153
+ font-size: var(--fs-content-micro);
154
+ line-height: 16px;
155
+ color: #ff2e43;
156
+ }
157
+ }
158
+
159
+
160
+ &__icon {
161
+ position: absolute;
162
+ right: 16px;
163
+ height: 100%;
164
+ top: 0;
165
+ display: flex;
166
+ align-items: center;
167
+
168
+ &:hover {
169
+ cursor: pointer;
170
+ }
171
+ }
172
+
173
+ &__required {
174
+ color: #FF000087;
175
+ }
176
+
177
+ &__options {
178
+ position: absolute;
179
+ top: calc(100% + 4px);
180
+ left: 0;
181
+ width: 100%;
182
+ background: #fff;
183
+ z-index: 1000;
184
+ border-radius: 2px;
185
+ border: 1px solid #71757A;
186
+ padding: 12px 0;
187
+ @media(max-width: 1025px) {
188
+ overflow: auto;
189
+ }
190
+
191
+ #searchVariant {
192
+ background: #eef0f5;
193
+ }
194
+ }
195
+
196
+ .search-options {
197
+ &__item {
198
+ padding: 5px 16px;
199
+ line-height: 16px;
200
+ font-size: 14px;
201
+ color: var(--newGray);
202
+ transition: 0.3s all;
203
+ cursor: pointer;
204
+ @media(max-width: 1025px) {
205
+ font-size: 10px;
206
+ }
207
+
208
+ &:hover {
209
+ background: #eef0f5;
210
+ }
211
+ }
212
+ }
213
+
214
+ .mobile-magnifier {
215
+ display: flex;
216
+ justify-content: center;
217
+ align-items: center;
218
+ height: 40px;
219
+ width: 40px;
220
+ min-width: 40px;
221
+ border: 1px solid #71757A;
222
+ border-radius: 0 2px 2px 0;
223
+ border-left: none;
224
+ background: #FFCD33;
225
+ }
226
+
227
+ &__input-mob-filter {
228
+ background: #ffffff;
229
+ border: 1px solid #71757A;
230
+ border-bottom: none;
231
+ box-sizing: border-box;
232
+ border-radius: 2px;
233
+ width: 100%;
234
+ height: 48px;
235
+ font-size: 16px;
236
+ line-height: 19px;
237
+ display: flex;
238
+ align-items: center;
239
+ color: #1A2030;
240
+ padding: 19px 40px 5px 16px;
241
+ transition: 0.3s all;
242
+ -webkit-appearance: none;
243
+ -moz-appearance: none;
244
+ appearance: none;
245
+
246
+ &:focus ~ #{$self}__label-mob-filter,
247
+ &:not(:focus):valid ~ #{$self}__label-mob-filter {
248
+ top: 11px;
249
+ font-size: 10px;
250
+ color: #71757A;
251
+ @media(max-width: 1025px) {
252
+ font-size: 7px;
253
+ }
254
+ }
255
+
256
+ &:focus {
257
+ border: 1px solid #2c3e50;
258
+ }
259
+
260
+ &::placeholder {
261
+ font-size: 12px;
262
+ }
263
+
264
+ &.error {
265
+ background: #ff2e431f;
266
+ }
267
+ }
268
+
269
+ &__label-mob-filter {
270
+ position: absolute;
271
+ pointer-events: none;
272
+ left: 16px;
273
+ top: 50%;
274
+ transform: translateY(-50%);
275
+ white-space: nowrap;
276
+ overflow: hidden;
277
+ line-height: 40px;
278
+ transition: 0.3s;
279
+ color: #71757A;
280
+ @media(max-width: 1025px) {
281
+ left: 16px;
282
+ font-size: 14px;
283
+ line-height: 16px;
284
+ color: #71757A;
285
+ }
286
+
287
+ &__red {
288
+ color: rgba(255, 0, 0, 0.53);
289
+ }
290
+ }
291
+ &__magnifier {
292
+ left: 8px;
293
+ width: fit-content;
294
+ }
295
+ }
@@ -0,0 +1 @@
1
+ @import "text_field";
@@ -13,7 +13,7 @@
13
13
  :key="index"
14
14
  class="menu__wrapper menu__items"
15
15
  :class="{active: locationUrl.includes(toAdtdev(item.url))}"
16
- :href="item.url"
16
+ :href="toAdtdev(item.url)"
17
17
  >
18
18
  {{ item.name }}
19
19
  </a>
@@ -59,15 +59,15 @@
59
59
  fill="#2C3E50"></path>
60
60
  </svg>
61
61
  </div>
62
- <div
62
+ <a
63
63
  v-for="(item, index) in subheaderItems"
64
64
  :key="index"
65
65
  class="menu_mobile-wrapper"
66
66
  :class="{'active-burger-tab': locationUrl.includes(toAdtdev(item.url))}"
67
- @click="handleClick(item.url)"
67
+ :href="toAdtdev(item.url)"
68
68
  >
69
69
  {{ item.name }}
70
- </div>
70
+ </a>
71
71
  </div>
72
72
  </MobileToggle>
73
73
  </header>
@@ -75,7 +75,6 @@
75
75
 
76
76
  <script>
77
77
  import Profile from "./Profile";
78
- import { menuList } from "../../configs/navigationBarConfig";
79
78
  import { profileDropDown } from "../../configs/profileDropDown"
80
79
  import MobileToggle from "../transitions/VerticalMobileToggle";
81
80
 
@@ -131,17 +130,40 @@ export default {
131
130
  data() {
132
131
  return {
133
132
  profileDropDown,
134
- subheaderItems: [],
133
+ subheaderItems: [
134
+ {
135
+ id: 1,
136
+ name: "Контрагенты",
137
+ url: 'https://pk.adata.kz',
138
+ },
139
+ {
140
+ id: 2,
141
+ name: "Тендеры",
142
+ url: 'https://tender.adata.kz',
143
+ },
144
+ {
145
+ id: 3,
146
+ name: "Работа",
147
+ url: 'https://work.adata.kz',
148
+ },
149
+ {
150
+ id: 4,
151
+ name: "Штрафы",
152
+ url: 'https://avto.adata.kz',
153
+ }
154
+ ],
135
155
  isOpen: false
136
156
  };
137
157
  },
138
158
  mounted() {
139
159
  this.setBalance(this.balance);
140
- this.subheaderItems = menuList;
141
160
  },
142
161
  computed: {
143
162
  locationUrl() {
144
- return window.location.href;
163
+ if (window)
164
+ return window.location.href;
165
+ else
166
+ return ''
145
167
  }
146
168
  },
147
169
  methods: {
@@ -160,9 +182,6 @@ export default {
160
182
  thousandSeparator(val) {
161
183
  return val ? val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " "): '';
162
184
  },
163
- handleClick(url) {
164
- window.open(this.toAdtdev(url), "_self");
165
- }
166
185
  },
167
186
  watch: {
168
187
  balance(newBalance) {
@@ -37,6 +37,8 @@
37
37
  </template>
38
38
 
39
39
  <script>
40
+ import '../../assets/style.scss';
41
+
40
42
  export default {
41
43
  name: "PasswordField",
42
44
  props: {
@@ -0,0 +1,39 @@
1
+ import ASearchTextField from "./SearchTextField.vue";
2
+
3
+ export default {
4
+ title: 'SearchTextField',
5
+ component: ASearchTextField,
6
+ data: () => ({ value: "" }),
7
+ methods: {
8
+ inputHandle(val) {
9
+ console.log(val);
10
+ }
11
+ },
12
+ template: "<a-search-text-field v-model='value' @input='inputHandle' label='Example'></a-search-text-field>>"
13
+ }
14
+
15
+ const Template = (args, { argTypes }) => ({
16
+ components: { ASearchTextField },
17
+ props: Object.keys(argTypes),
18
+ data: () => ({ val: "" }),
19
+ template: '<a-search-text-field v-model="val" v-bind="$props"></a-search-text-field>'
20
+ })
21
+
22
+ export const WithIcon = Template.bind({});
23
+ WithIcon.args = {
24
+ label: "Найти то, что нужно",
25
+ clearable: true,
26
+ isWithIcon: true,
27
+ isTypeRequired: true,
28
+ options: [
29
+ {
30
+ id: 1,
31
+ name: "a"
32
+ },
33
+ {
34
+ id: 2,
35
+ name: "b"
36
+ }
37
+ ],
38
+ optionFields: ["name"]
39
+ }
@@ -0,0 +1,207 @@
1
+ <template>
2
+ <div :class="[{magnifier: isWithIcon},{'magnifier-mobile': magnifierMob}]"
3
+ class="adt-text-block"
4
+ v-click-outside="onOutsideClick"
5
+ @keydown.down.up.prevent="onUpOrDownClicked"
6
+ >
7
+ <div class="adt-text-block__field">
8
+ <input
9
+ ref="input"
10
+ :type="type"
11
+ :value="value"
12
+ required
13
+ @input="inputHandler($event)"
14
+ @keydown="handleKeyDown"
15
+ @keypress.enter="$emit('enterPressed')"
16
+ @focus="showAutocomplete = true"
17
+ @click="$emit('showVTour')"
18
+ :class="[
19
+ {'adt-text-block__input-mob-search' : magnifierMob},
20
+ {'adt-text-block__input-mob-filter' : forMobileFilter},
21
+ {'adt-text-block__input': !forMobileFilter}
22
+ ]"
23
+ />
24
+ <label
25
+ :class="{
26
+ 'adt-text-block__label-red' : !forMobileFilter && getIsError,
27
+ 'adt-text-block__label' : !forMobileFilter && !getIsError,
28
+ 'adt-text-block__label-mob-filter' : forMobileFilter,
29
+ }"
30
+ >
31
+ {{ label }}
32
+ </label>
33
+ <div class="mobile-magnifier" v-if="magnifierMob" @click="$emit('onMagnifierClick')">
34
+ <svg width="24" height="24" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="magnifier">
35
+ <path d="M13.95 13.95L10 10" stroke="#2C3E50" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round">
36
+ </path>
37
+ <circle cx="6.5" cy="6.5" r="4.5" stroke="#2C3E50"></circle>
38
+ </svg>
39
+ </div>
40
+ <div class="adt-text-block__icon adt-text-block__magnifier" v-if="isWithIcon" @click="$emit('input', '')">
41
+ <svg width="24" height="24" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="magnifier">
42
+ <path d="M13.95 13.95L10 10" stroke="#2C3E50" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round">
43
+ </path>
44
+ <circle cx="6.5" cy="6.5" r="4.5" stroke="#2C3E50"></circle>
45
+ </svg>
46
+ </div>
47
+ <div class="adt-text-block__icon" v-if="clearable && value && value.length > 0" @click="$emit('input', '')">
48
+ <svg width="12" height="12" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="clearIcon">
49
+ <path d="M2 2l12 12m0-12L2 14" stroke="#2C3E50" stroke-linecap="round" stroke-linejoin="round"></path>
50
+ </svg>
51
+ </div>
52
+ </div>
53
+ <div class="adt-text-block__options search-options" v-show="options && options.length > 0 && showAutocomplete">
54
+ <PerfectScrollbar>
55
+ <div class="search-options__wrapper">
56
+ <div
57
+ class="search-options__item"
58
+ v-for="(option, index) in options"
59
+ :key="index"
60
+ @click="onAutocompleteOptionClick(option)"
61
+ ref="searchOptions"
62
+ >
63
+ {{ !!optionFields.length ? textByOption(option) : option }}
64
+ <div class="hiddenOne" v-if="option.type && isTypeRequired"> ${{ option.type }}$</div>
65
+ </div>
66
+ </div>
67
+ </PerfectScrollbar>
68
+ </div>
69
+ </div>
70
+ </template>
71
+
72
+ <script>
73
+ import '../../assets/style.scss';
74
+ import { PerfectScrollbar } from "vue2-perfect-scrollbar";
75
+ import vClickOutside from "v-click-outside";
76
+
77
+ export default {
78
+ name: "SearchTextField",
79
+ directives: {
80
+ clickOutside: vClickOutside.directive
81
+ },
82
+ props: {
83
+ label: {
84
+ type: String,
85
+ required: true,
86
+ },
87
+ type: {
88
+ type: String,
89
+ default: "text",
90
+ },
91
+ value: {
92
+ type: String,
93
+ required: true,
94
+ },
95
+ clearable: {
96
+ type: Boolean,
97
+ default: false
98
+ },
99
+ isWithIcon: {
100
+ type: Boolean,
101
+ default: false
102
+ },
103
+ magnifierMob: {
104
+ type: Boolean,
105
+ default: false
106
+ },
107
+ forMobileFilter: {
108
+ type: Boolean,
109
+ default: false
110
+ },
111
+ isTypeRequired: {
112
+ type: Boolean,
113
+ default: false
114
+ },
115
+ options: {
116
+ type: Array,
117
+ default: () => [],
118
+ },
119
+ optionFields: {
120
+ type: Array,
121
+ default: null
122
+ },
123
+ isMobile: {
124
+ type: Boolean,
125
+ default: false
126
+ },
127
+ getIsError: {
128
+ type: Boolean,
129
+ default: false
130
+ }
131
+ },
132
+ components: {
133
+ PerfectScrollbar
134
+ },
135
+ data() {
136
+ return {
137
+ showAutocomplete: false
138
+ }
139
+ },
140
+ methods: {
141
+ onOutsideClick() {
142
+ if (!this.isMobile) this.showAutocomplete = false
143
+ },
144
+ onUpOrDownClicked(e) {
145
+ const autoCompleteOptions = this.$refs.searchOptions;
146
+ const length = autoCompleteOptions ? autoCompleteOptions.length : 0;
147
+ if (length > 0) {
148
+ switch (e.which) {
149
+ case 40:
150
+ this.moveOption(autoCompleteOptions, 'nextElementSibling');
151
+ break;
152
+ case 38:
153
+ this.moveOption(autoCompleteOptions, 'previousElementSibling');
154
+ break;
155
+ }
156
+ }
157
+ },
158
+ moveOption(autoCompleteOptions, elementType) {
159
+ const selectedOption = autoCompleteOptions.find((option) => option.hasAttribute('id'));
160
+ if (selectedOption) {
161
+ const siblingElement = selectedOption[elementType];
162
+ this.$emit('castOption', siblingElement?.innerText || "");
163
+ if (siblingElement?.classList.contains('search-options__item')) {
164
+ selectedOption.removeAttribute("id");
165
+ siblingElement.setAttribute("id", 'searchVariant');
166
+ return;
167
+ }
168
+ selectedOption.removeAttribute("id");
169
+ return;
170
+ }
171
+ let innerText = "";
172
+ if (elementType === 'nextElementSibling')
173
+ innerText = this.getAutocompleteOptionText(autoCompleteOptions?.[0]);
174
+ if (elementType === 'previousElementSibling')
175
+ innerText = this.getAutocompleteOptionText(autoCompleteOptions?.[autoCompleteOptions.length - 1]);
176
+ this.$emit('castOption', innerText);
177
+ },
178
+ getAutocompleteOptionText(autocompleteOption) {
179
+ autocompleteOption.setAttribute("id", 'searchVariant');
180
+ return autocompleteOption.innerText;
181
+ },
182
+ handleKeyDown(e) {
183
+ if (+e.keyCode === 9) this.showAutocomplete = false;
184
+ const specialKeys = [8, 188, 190, 110] // 8 - Backspace, 188 - ",", 190 and 110 - "."
185
+ const charCode = e.keyCode
186
+ if ((charCode >= 48 && charCode <= 57) || (charCode >= 96 && charCode <= 105) || specialKeys.indexOf(charCode) !== -1) return;
187
+ else e.preventDefault()
188
+ },
189
+ inputHandler(e) {
190
+ this.$emit('input', e.target.value);
191
+ this.showAutocomplete = true;
192
+ },
193
+ onAutocompleteOptionClick(option) {
194
+ this.$emit('click', option);
195
+ this.showAutocomplete = false;
196
+ },
197
+ textByOption(obj) {
198
+ return this.optionFields.reduce((acc, curr, index) => {
199
+ if (index !== 0) acc += " - ";
200
+ acc += obj[curr];
201
+ return acc;
202
+ }, "");
203
+ }
204
+ }
205
+ }
206
+ </script>
207
+