@awes-io/ui 2.43.0 → 2.46.0
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/CHANGELOG.md +40 -0
- package/assets/css/components/animation.css +34 -0
- package/assets/css/components/birthday-picker.css +23 -9
- package/assets/css/components/bottom-bar.css +1 -0
- package/assets/css/components/text-field.css +1 -35
- package/assets/css/components/tooltip.css +1 -1
- package/components/1_atoms/AwSwitcher.vue +2 -2
- package/components/2_molecules/AwSelectObject.vue +1 -2
- package/components/3_organisms/AwBirthdayPicker.vue +307 -107
- package/components/4_pages/_AwButtonFixed.vue +1 -1
- package/components/5_layouts/_AwNoty.vue +21 -3
- package/components/_config.js +6 -0
- package/nuxt/templates/lang.plugin.js +1 -1
- package/package.json +2 -2
- package/store/awesIo.js +9 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,46 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.46.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.45.0...@awes-io/ui@2.46.0) (2022-03-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **store:** user name preformatting added ([36de390](https://github.com/awes-io/client/commit/36de3908308dde463a93198974cca2e79f5945a2))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [2.45.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.44.0...@awes-io/ui@2.45.0) (2022-03-17)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* birthday-picker updated ([4b7bedc](https://github.com/awes-io/client/commit/4b7bedc64c5358673540120fb8a7b647d8444e90))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# [2.44.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.43.0...@awes-io/ui@2.44.0) (2022-03-10)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* remove mask import ([5fd53f3](https://github.com/awes-io/client/commit/5fd53f3e5204dd25fdbcbb727111c9d490c74788))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Features
|
|
37
|
+
|
|
38
|
+
* replace vue-the-mask with pattern ([a9af187](https://github.com/awes-io/client/commit/a9af18764acee563ca6ec242b9b18dbba95f4542))
|
|
39
|
+
* ui updates ([a2d34b7](https://github.com/awes-io/client/commit/a2d34b77c8a0e0a680066a0a81382b3dc2d7d243))
|
|
40
|
+
* **aw-birthday-picker:** refactor ([79f3459](https://github.com/awes-io/client/commit/79f345921520f91488d5b3c1feafc10c3897ac54))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
6
46
|
# [2.43.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.42.1...@awes-io/ui@2.43.0) (2022-02-28)
|
|
7
47
|
|
|
8
48
|
|
|
@@ -23,3 +23,37 @@
|
|
|
23
23
|
transform: scale(1.3);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
@keyframes aw-shake {
|
|
28
|
+
0%,
|
|
29
|
+
100% {
|
|
30
|
+
transform:translateX(0)
|
|
31
|
+
}
|
|
32
|
+
10% {
|
|
33
|
+
transform:translateX(-9px)
|
|
34
|
+
}
|
|
35
|
+
20% {
|
|
36
|
+
transform:translateX(8px)
|
|
37
|
+
}
|
|
38
|
+
30% {
|
|
39
|
+
transform:translateX(-7px)
|
|
40
|
+
}
|
|
41
|
+
40% {
|
|
42
|
+
transform:translateX(6px)
|
|
43
|
+
}
|
|
44
|
+
50% {
|
|
45
|
+
transform:translateX(-5px)
|
|
46
|
+
}
|
|
47
|
+
60% {
|
|
48
|
+
transform:translateX(4px)
|
|
49
|
+
}
|
|
50
|
+
70% {
|
|
51
|
+
transform:translateX(-3px)
|
|
52
|
+
}
|
|
53
|
+
80% {
|
|
54
|
+
transform:translateX(2px)
|
|
55
|
+
}
|
|
56
|
+
90% {
|
|
57
|
+
transform:translateX(-1px)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
.aw-birthday-picker {
|
|
2
2
|
&__wrap {
|
|
3
|
+
@apply border rounded bg-surface justify-between;
|
|
3
4
|
display: flex;
|
|
4
5
|
align-items: center;
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
text-align: center;
|
|
7
|
+
transition: 200ms border-color;
|
|
8
|
+
|
|
9
|
+
&.has-error {
|
|
10
|
+
@apply border-error;
|
|
11
|
+
animation: 700ms aw-shake ease-out-quad;
|
|
12
|
+
}
|
|
7
13
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
14
|
+
&:focus-within {
|
|
15
|
+
border-color: var(--c-info);
|
|
16
|
+
}
|
|
11
17
|
}
|
|
12
18
|
|
|
13
|
-
&
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
&__input {
|
|
20
|
+
@apply p-3;
|
|
21
|
+
text-align: center;
|
|
22
|
+
border-width: none;
|
|
23
|
+
border-radius: 0;
|
|
24
|
+
flex: 1 1 auto;
|
|
25
|
+
|
|
26
|
+
& + & {
|
|
27
|
+
@apply border-l;
|
|
28
|
+
border-top-left-radius: 0;
|
|
29
|
+
border-bottom-left-radius: 0;
|
|
30
|
+
}
|
|
17
31
|
}
|
|
18
32
|
}
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
*/
|
|
159
159
|
|
|
160
160
|
&.has-error {
|
|
161
|
-
animation: 700ms shake ease-out-quad;
|
|
161
|
+
animation: 700ms aw-shake ease-out-quad;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
&.has-error {
|
|
@@ -198,40 +198,6 @@
|
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
@keyframes shake {
|
|
202
|
-
0%,
|
|
203
|
-
100% {
|
|
204
|
-
transform:translateX(0)
|
|
205
|
-
}
|
|
206
|
-
10% {
|
|
207
|
-
transform:translateX(-9px)
|
|
208
|
-
}
|
|
209
|
-
20% {
|
|
210
|
-
transform:translateX(8px)
|
|
211
|
-
}
|
|
212
|
-
30% {
|
|
213
|
-
transform:translateX(-7px)
|
|
214
|
-
}
|
|
215
|
-
40% {
|
|
216
|
-
transform:translateX(6px)
|
|
217
|
-
}
|
|
218
|
-
50% {
|
|
219
|
-
transform:translateX(-5px)
|
|
220
|
-
}
|
|
221
|
-
60% {
|
|
222
|
-
transform:translateX(4px)
|
|
223
|
-
}
|
|
224
|
-
70% {
|
|
225
|
-
transform:translateX(-3px)
|
|
226
|
-
}
|
|
227
|
-
80% {
|
|
228
|
-
transform:translateX(2px)
|
|
229
|
-
}
|
|
230
|
-
90% {
|
|
231
|
-
transform:translateX(-1px)
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
201
|
@keyframes autoFillStart {
|
|
236
202
|
from {
|
|
237
203
|
opacity: 1
|
|
@@ -193,9 +193,9 @@ export default {
|
|
|
193
193
|
const isDisabled =
|
|
194
194
|
Object.keys(this.$attrs).includes('disabled') &&
|
|
195
195
|
this.$attrs.disabled
|
|
196
|
-
const hasTooltip = !!this.errorText
|
|
196
|
+
// const hasTooltip = !!this.errorText /* blocks switcher */
|
|
197
197
|
|
|
198
|
-
if (this.startPos !== null || isDisabled || hasTooltip) return
|
|
198
|
+
if (this.startPos !== null || isDisabled /* || hasTooltip */) return
|
|
199
199
|
|
|
200
200
|
this.startPos = $event.screenX
|
|
201
201
|
this.isTouch = $event.type === 'touchstart'
|
|
@@ -687,6 +687,7 @@ export default {
|
|
|
687
687
|
_selectOnEnter() {
|
|
688
688
|
// close if nothing typed
|
|
689
689
|
if (this._showNotFound) {
|
|
690
|
+
this.$emit('not-found', this.searchPhrase)
|
|
690
691
|
this.searchPhrase = ''
|
|
691
692
|
this.close()
|
|
692
693
|
return
|
|
@@ -698,9 +699,7 @@ export default {
|
|
|
698
699
|
if (firstOption) {
|
|
699
700
|
this._selectIndex(firstOption.index)
|
|
700
701
|
} else {
|
|
701
|
-
// emit not found
|
|
702
702
|
this.isOpened = false
|
|
703
|
-
this.$emit('not-found', this.searchPhrase)
|
|
704
703
|
}
|
|
705
704
|
},
|
|
706
705
|
|
|
@@ -1,69 +1,79 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<AwInfo :label="label" class="aw-birthday-picker">
|
|
3
|
-
<div
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
<div
|
|
4
|
+
ref="element"
|
|
5
|
+
v-tooltip.show.prepend="errorTooltip"
|
|
6
|
+
:class="{ 'has-error': hasError && errorText }"
|
|
7
|
+
class="aw-text-field aw-birthday-picker__wrap"
|
|
8
|
+
>
|
|
9
|
+
<input
|
|
10
|
+
v-for="{ key, ...attrs } in _inputs"
|
|
11
|
+
:key="key"
|
|
7
12
|
:required="required"
|
|
8
|
-
:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
@input="
|
|
13
|
+
:value="$data[key]"
|
|
14
|
+
v-bind="attrs"
|
|
15
|
+
inputmode="numeric"
|
|
16
|
+
class="aw-text-field__element aw-birthday-picker__input"
|
|
17
|
+
@keydown="onKeydown"
|
|
18
|
+
@input="onInput"
|
|
19
|
+
@focus="onInputFocus"
|
|
14
20
|
/>
|
|
15
|
-
|
|
16
|
-
<AwSelect
|
|
17
|
-
v-model="day"
|
|
18
|
-
:options="daysList"
|
|
19
|
-
:required="required"
|
|
20
|
-
:name="_inputKeys.day"
|
|
21
|
-
:label="$t('AwBirthdayPicker.day')"
|
|
22
|
-
class="aw-birthday-picker__day"
|
|
23
|
-
@input="emit"
|
|
24
|
-
/>
|
|
25
|
-
|
|
26
|
-
<div class="aw-birthday-picker__year">
|
|
27
|
-
<AwLink
|
|
28
|
-
v-if="!_showYear"
|
|
29
|
-
:text="$t('AwBirthdayPicker.set_year')"
|
|
30
|
-
@click="isYearHidden = false"
|
|
31
|
-
/>
|
|
32
|
-
|
|
33
|
-
<AwSelect
|
|
34
|
-
v-else
|
|
35
|
-
v-model="year"
|
|
36
|
-
:options="yearsList"
|
|
37
|
-
:required="required"
|
|
38
|
-
:name="_inputKeys.year"
|
|
39
|
-
:label="$t('AwBirthdayPicker.year')"
|
|
40
|
-
:clearable="!showYear"
|
|
41
|
-
:option-disabled="isOptionDisabled"
|
|
42
|
-
class="w-full"
|
|
43
|
-
track-by="year"
|
|
44
|
-
option-label="year"
|
|
45
|
-
@input="checkMaxDay"
|
|
46
|
-
@clear="clearYear"
|
|
47
|
-
/>
|
|
48
|
-
</div>
|
|
49
21
|
</div>
|
|
50
22
|
</AwInfo>
|
|
51
23
|
</template>
|
|
52
24
|
|
|
53
25
|
<script>
|
|
54
26
|
import birthdayMixin from '@AwMixins/birthday'
|
|
55
|
-
import
|
|
27
|
+
import errorMixin from '@AwMixins/error'
|
|
28
|
+
import { AwBirthdayPicker as _config } from '@AwConfig'
|
|
29
|
+
import { conf } from '@AwUtils/component'
|
|
30
|
+
|
|
31
|
+
const KEY_ATTR = 'data-key'
|
|
32
|
+
|
|
33
|
+
const ALLOWED_KEYS = [
|
|
34
|
+
'Delete',
|
|
35
|
+
'Backspace',
|
|
36
|
+
'Shift',
|
|
37
|
+
'ArrowLeft',
|
|
38
|
+
'ArrowRight',
|
|
39
|
+
'Tab'
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
const PLACEHOLDER_KEY_MAP = {
|
|
43
|
+
DD: 'day',
|
|
44
|
+
MM: 'month',
|
|
45
|
+
YYYY: 'year'
|
|
46
|
+
}
|
|
56
47
|
|
|
57
|
-
const
|
|
48
|
+
const PLACEHOLDER_MAP = {
|
|
49
|
+
day: 'DD',
|
|
50
|
+
month: 'MM',
|
|
51
|
+
year: 'YYYY'
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const NAME_MAP = {
|
|
58
55
|
day: 'birthday_day',
|
|
59
56
|
month: 'birthday_month',
|
|
60
57
|
year: 'birthday_year'
|
|
61
58
|
}
|
|
62
59
|
|
|
60
|
+
const MASK_MAP = {
|
|
61
|
+
day: '\\d{2}',
|
|
62
|
+
month: '\\d{2}',
|
|
63
|
+
year: '\\d{4}'
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const PROCESSOR_MAP = {
|
|
67
|
+
day: '_processDay',
|
|
68
|
+
month: '_processMonth'
|
|
69
|
+
}
|
|
70
|
+
|
|
63
71
|
export default {
|
|
64
72
|
name: 'AwBirthdayPicker',
|
|
65
73
|
|
|
66
|
-
mixins: [birthdayMixin],
|
|
74
|
+
mixins: [birthdayMixin, errorMixin],
|
|
75
|
+
|
|
76
|
+
_config,
|
|
67
77
|
|
|
68
78
|
props: {
|
|
69
79
|
value: {
|
|
@@ -76,14 +86,6 @@ export default {
|
|
|
76
86
|
default: false
|
|
77
87
|
},
|
|
78
88
|
|
|
79
|
-
/**
|
|
80
|
-
* If true show year select by default
|
|
81
|
-
*/
|
|
82
|
-
showYear: {
|
|
83
|
-
type: Boolean,
|
|
84
|
-
default: false
|
|
85
|
-
},
|
|
86
|
-
|
|
87
89
|
/**
|
|
88
90
|
* Inputs names for native form submission,
|
|
89
91
|
* Accepted values: day, month, year.
|
|
@@ -98,55 +100,76 @@ export default {
|
|
|
98
100
|
default() {
|
|
99
101
|
return this.$t('AwBirthdayPicker.birthday')
|
|
100
102
|
}
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Custom parse format for string dates with year,
|
|
107
|
+
* for example `YYYY-MM-DD`.
|
|
108
|
+
*/
|
|
109
|
+
fullParseFormat: {
|
|
110
|
+
type: String,
|
|
111
|
+
default() {
|
|
112
|
+
return conf(this, 'fullParseFormat')
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Custom parse format for string dates without year,
|
|
118
|
+
* for example `MM-DD`.
|
|
119
|
+
*/
|
|
120
|
+
shortParseFormat: {
|
|
121
|
+
type: String,
|
|
122
|
+
default() {
|
|
123
|
+
return conf(this, 'shortParseFormat')
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Input fields order
|
|
129
|
+
*/
|
|
130
|
+
fieldsOrder: {
|
|
131
|
+
type: String,
|
|
132
|
+
default() {
|
|
133
|
+
return conf(this, 'fieldsOrder')
|
|
134
|
+
}
|
|
101
135
|
}
|
|
102
136
|
},
|
|
103
137
|
|
|
104
138
|
data() {
|
|
105
139
|
return {
|
|
106
|
-
month: null,
|
|
107
140
|
day: null,
|
|
141
|
+
month: null,
|
|
108
142
|
year: null,
|
|
109
|
-
|
|
143
|
+
maxDay: 31
|
|
110
144
|
}
|
|
111
145
|
},
|
|
112
146
|
|
|
113
147
|
computed: {
|
|
114
|
-
|
|
115
|
-
return this.
|
|
148
|
+
_inputsOrder() {
|
|
149
|
+
return this.fieldsOrder
|
|
150
|
+
.split(/(\.|-)/)
|
|
151
|
+
.reduce((acc, placeholder) => {
|
|
152
|
+
const key = PLACEHOLDER_KEY_MAP[placeholder]
|
|
153
|
+
return key ? acc.concat(key) : acc
|
|
154
|
+
}, [])
|
|
116
155
|
},
|
|
117
156
|
|
|
118
|
-
|
|
119
|
-
return {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
monthsList() {
|
|
126
|
-
const date = this.$dayjs()
|
|
127
|
-
return [...Array(12).keys()].map((el) => ({
|
|
128
|
-
value: el,
|
|
129
|
-
text: date.month(el).format('MMMM')
|
|
157
|
+
_inputNames() {
|
|
158
|
+
return this._inputsOrder.map((key) => ({
|
|
159
|
+
name: this.inputNames[key] || NAME_MAP[key],
|
|
160
|
+
key
|
|
130
161
|
}))
|
|
131
162
|
},
|
|
132
163
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
yearsList() {
|
|
144
|
-
const current = this.$dayjs().year()
|
|
145
|
-
return [...Array(101).keys()].map((el) => ({
|
|
146
|
-
year: current - el,
|
|
147
|
-
isLeapYear: this.$dayjs()
|
|
148
|
-
.year(current - el)
|
|
149
|
-
.isLeapYear()
|
|
164
|
+
_inputs() {
|
|
165
|
+
return this._inputsOrder.map((key, i) => ({
|
|
166
|
+
key,
|
|
167
|
+
[KEY_ATTR]: key,
|
|
168
|
+
name: this._inputNames[i].name,
|
|
169
|
+
placeholder: this.$t('AwBirthdayPicker.' + key),
|
|
170
|
+
pattern: MASK_MAP[key],
|
|
171
|
+
maxlength: PLACEHOLDER_MAP[key].length,
|
|
172
|
+
inputmode: 'numeric'
|
|
150
173
|
}))
|
|
151
174
|
}
|
|
152
175
|
},
|
|
@@ -156,11 +179,23 @@ export default {
|
|
|
156
179
|
immediate: true,
|
|
157
180
|
handler(val) {
|
|
158
181
|
const date = this.parseDate(val)
|
|
182
|
+
|
|
159
183
|
if (date) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
184
|
+
const { day, month, year } = date
|
|
185
|
+
|
|
186
|
+
let d = this.$dayjs()
|
|
187
|
+
.year(2000)
|
|
188
|
+
.month(month)
|
|
189
|
+
.date(day)
|
|
190
|
+
.startOf('day')
|
|
191
|
+
|
|
192
|
+
if (year) {
|
|
193
|
+
d = d.year(year)
|
|
194
|
+
this.year = d.format(PLACEHOLDER_MAP.year)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
this.day = d.format(PLACEHOLDER_MAP.day)
|
|
198
|
+
this.month = d.format(PLACEHOLDER_MAP.month)
|
|
164
199
|
}
|
|
165
200
|
}
|
|
166
201
|
}
|
|
@@ -168,21 +203,113 @@ export default {
|
|
|
168
203
|
|
|
169
204
|
methods: {
|
|
170
205
|
checkMaxDay() {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
206
|
+
if (this.day) {
|
|
207
|
+
const m = this.month || 1
|
|
208
|
+
let d = this.$dayjs()
|
|
209
|
+
.year(this.year || 2000)
|
|
210
|
+
.month(m - 1)
|
|
211
|
+
.startOf('month')
|
|
212
|
+
|
|
213
|
+
this.maxDay = d.daysInMonth()
|
|
214
|
+
this.day = this.day > this.maxDay ? this.maxDay : this.day
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
|
|
218
|
+
onKeydown($event) {
|
|
219
|
+
if (
|
|
220
|
+
isNaN(parseInt($event.key)) &&
|
|
221
|
+
!ALLOWED_KEYS.includes($event.key)
|
|
222
|
+
) {
|
|
223
|
+
$event.preventDefault()
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const key = this._getKey($event.target)
|
|
227
|
+
|
|
228
|
+
// arrow navigation
|
|
229
|
+
if ($event.key === 'ArrowRight' || $event.key === 'ArrowLeft') {
|
|
230
|
+
const length = $event.target.value.length
|
|
231
|
+
const { selectionStart, selectionEnd } = $event.target
|
|
232
|
+
|
|
233
|
+
let offset = 0
|
|
234
|
+
|
|
235
|
+
if (
|
|
236
|
+
$event.key === 'ArrowRight' &&
|
|
237
|
+
selectionStart === length &&
|
|
238
|
+
selectionEnd === length
|
|
239
|
+
) {
|
|
240
|
+
offset = 1
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (
|
|
244
|
+
$event.key === 'ArrowLeft' &&
|
|
245
|
+
selectionStart === 0 &&
|
|
246
|
+
selectionEnd === 0
|
|
247
|
+
) {
|
|
248
|
+
offset = -1
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (offset) {
|
|
252
|
+
$event.preventDefault()
|
|
253
|
+
this._focusByOffset(key, offset)
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// backspace navigation
|
|
258
|
+
if ($event.key === 'Backspace' && !$event.target.value) {
|
|
259
|
+
$event.preventDefault()
|
|
260
|
+
this._focusByOffset(this._getKey($event.target), -1)
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
onInput($event) {
|
|
265
|
+
const key = this._getKey($event.target)
|
|
266
|
+
const processor = PROCESSOR_MAP[key]
|
|
267
|
+
|
|
268
|
+
if (processor) {
|
|
269
|
+
const correctValue = this[processor]($event.target.value)
|
|
270
|
+
|
|
271
|
+
if (correctValue !== $event.target.value) {
|
|
272
|
+
$event.target.value = correctValue
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
this[key] = $event.target.value
|
|
277
|
+
|
|
278
|
+
this.checkMaxDay()
|
|
279
|
+
|
|
280
|
+
this.$nextTick(() => {
|
|
281
|
+
if (this._isComplete(this[key], key)) {
|
|
282
|
+
this._focusByOffset(key, 1)
|
|
283
|
+
this.emit()
|
|
284
|
+
} else if (this[key] === '') {
|
|
285
|
+
this.emit()
|
|
286
|
+
}
|
|
287
|
+
})
|
|
288
|
+
},
|
|
289
|
+
|
|
290
|
+
onInputFocus($event) {
|
|
291
|
+
if ($event.target.value) {
|
|
292
|
+
setTimeout(() => {
|
|
293
|
+
$event.target.setSelectionRange(
|
|
294
|
+
0,
|
|
295
|
+
$event.target.value.length
|
|
296
|
+
)
|
|
297
|
+
}, 10)
|
|
298
|
+
}
|
|
174
299
|
},
|
|
175
300
|
|
|
176
301
|
emit() {
|
|
177
|
-
if (!
|
|
302
|
+
if (!this.month || !this.day) {
|
|
303
|
+
this.$emit('input', null)
|
|
304
|
+
} else if (this.month && this.day) {
|
|
178
305
|
let d = this.$dayjs()
|
|
179
306
|
.year(this.year || 2000)
|
|
180
|
-
.month(this.month)
|
|
307
|
+
.month(this.month - 1)
|
|
181
308
|
.date(this.day)
|
|
309
|
+
.startOf('day')
|
|
182
310
|
let formatVal = this.shortParseFormat || 'MM-DD'
|
|
183
311
|
|
|
184
|
-
if (
|
|
185
|
-
d = d.year(this.year)
|
|
312
|
+
if (this.year) {
|
|
186
313
|
formatVal = this.fullParseFormat || null
|
|
187
314
|
}
|
|
188
315
|
|
|
@@ -193,18 +320,91 @@ export default {
|
|
|
193
320
|
}
|
|
194
321
|
},
|
|
195
322
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
this.year = null
|
|
199
|
-
this.emit()
|
|
323
|
+
_getKey(el) {
|
|
324
|
+
return el.getAttribute(KEY_ATTR)
|
|
200
325
|
},
|
|
201
326
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
327
|
+
_getKeyByOffset(key, offset) {
|
|
328
|
+
const index = this._inputsOrder.indexOf(key)
|
|
329
|
+
|
|
330
|
+
return index > -1 ? this._inputsOrder[index + offset] : undefined
|
|
331
|
+
},
|
|
332
|
+
|
|
333
|
+
_getKeyElement(key) {
|
|
334
|
+
return this.$refs.element.querySelector(`[${KEY_ATTR}="${key}"]`)
|
|
335
|
+
},
|
|
336
|
+
|
|
337
|
+
_isComplete(val = '', key) {
|
|
338
|
+
const numVal = parseInt(val)
|
|
339
|
+
|
|
340
|
+
// check if a number
|
|
341
|
+
if (isNaN(numVal)) {
|
|
342
|
+
return false
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// check value length
|
|
346
|
+
if (
|
|
347
|
+
PLACEHOLDER_MAP[key] &&
|
|
348
|
+
val.length !== PLACEHOLDER_MAP[key].length
|
|
349
|
+
) {
|
|
350
|
+
return false
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// check range
|
|
354
|
+
switch (key) {
|
|
355
|
+
case 'day':
|
|
356
|
+
return numVal > 1 && numVal <= this.maxDay
|
|
357
|
+
case 'month':
|
|
358
|
+
return numVal > 1 && numVal <= 12
|
|
359
|
+
case 'year':
|
|
360
|
+
return true
|
|
361
|
+
default:
|
|
362
|
+
return false
|
|
205
363
|
}
|
|
364
|
+
},
|
|
365
|
+
|
|
366
|
+
_focusByOffset(key, offset) {
|
|
367
|
+
const el = this._getKeyElement(this._getKeyByOffset(key, offset))
|
|
368
|
+
|
|
369
|
+
if (el) {
|
|
370
|
+
el.focus()
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
|
|
374
|
+
_processDateVal(val, min = 0, max) {
|
|
375
|
+
if (!val) return ''
|
|
376
|
+
|
|
377
|
+
const numVal = parseInt(val)
|
|
378
|
+
|
|
379
|
+
if (isNaN(numVal)) {
|
|
380
|
+
return ''
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
if (numVal > max) {
|
|
384
|
+
return String(max)
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
if (numVal < min) {
|
|
388
|
+
return ''
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
if (val.length === 1) {
|
|
392
|
+
const maxFirstDigit = Math.floor(max / 10)
|
|
393
|
+
|
|
394
|
+
if (numVal > maxFirstDigit) {
|
|
395
|
+
return '0' + String(numVal)
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
return val
|
|
400
|
+
},
|
|
401
|
+
|
|
402
|
+
_processDay(val) {
|
|
403
|
+
return this._processDateVal(val, 0, this.maxDay)
|
|
404
|
+
},
|
|
206
405
|
|
|
207
|
-
|
|
406
|
+
_processMonth(val) {
|
|
407
|
+
return this._processDateVal(val, 0, 12)
|
|
208
408
|
}
|
|
209
409
|
}
|
|
210
410
|
}
|
|
@@ -15,7 +15,14 @@
|
|
|
15
15
|
class="aw-noty__icon"
|
|
16
16
|
:class="`text-${props.type}`"
|
|
17
17
|
/>
|
|
18
|
-
<
|
|
18
|
+
<Component
|
|
19
|
+
:is="$options.components.AwIconSystemMono"
|
|
20
|
+
v-else-if="props.icon === true"
|
|
21
|
+
:name="$options.getDefaultIconName(props.type)"
|
|
22
|
+
class="aw-noty__icon"
|
|
23
|
+
:class="`text-${props.type}`"
|
|
24
|
+
/>
|
|
25
|
+
<!-- <svg
|
|
19
26
|
v-else-if="props.icon"
|
|
20
27
|
width="20"
|
|
21
28
|
height="20"
|
|
@@ -25,7 +32,7 @@
|
|
|
25
32
|
<path
|
|
26
33
|
d="M10 1.8a8.2 8.2 0 100 16.4 8.2 8.2 0 000-16.4zm4.1 6.5l-4.4 4.4a.7.7 0 01-1 0l-2.2-2.2a.7.7 0 111-1l1.7 1.8 4-4a.7.7 0 111 1zm0 0"
|
|
27
34
|
/>
|
|
28
|
-
</svg>
|
|
35
|
+
</svg> -->
|
|
29
36
|
|
|
30
37
|
<!-- content -->
|
|
31
38
|
<div class="aw-noty__content" :class="{ 'has-text': props.text }">
|
|
@@ -100,6 +107,17 @@ export default {
|
|
|
100
107
|
}
|
|
101
108
|
},
|
|
102
109
|
|
|
103
|
-
sanitize
|
|
110
|
+
sanitize,
|
|
111
|
+
|
|
112
|
+
getDefaultIconName(type) {
|
|
113
|
+
switch (type) {
|
|
114
|
+
case 'error':
|
|
115
|
+
return 'close-solid'
|
|
116
|
+
case 'warning':
|
|
117
|
+
return 'attention'
|
|
118
|
+
default:
|
|
119
|
+
return 'check-solid'
|
|
120
|
+
}
|
|
121
|
+
}
|
|
104
122
|
}
|
|
105
123
|
</script>
|
package/components/_config.js
CHANGED
|
@@ -13,6 +13,12 @@ export const AwAvatar = {
|
|
|
13
13
|
colors: COLORS
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
export const AwBirthdayPicker = {
|
|
17
|
+
fullParseFormat: 'DD.MM.YYYY',
|
|
18
|
+
shortParseFormat: 'DD.MM',
|
|
19
|
+
fieldsOrder: 'DD.MM.YYYY'
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
export const AwButton = {
|
|
17
23
|
routerComponent: 'router-link',
|
|
18
24
|
size: 'md',
|
|
@@ -137,7 +137,7 @@ export default async ({ app, $axios }) => {
|
|
|
137
137
|
if (loadedLocales[locale]) return loadedLocales[locale]
|
|
138
138
|
|
|
139
139
|
const requestConfig = isType('Function', fetchTranslation)
|
|
140
|
-
? fetchTranslation(locale)
|
|
140
|
+
? fetchTranslation(locale, locales.find(({ code }) => code === locale))
|
|
141
141
|
: { url: fetchTranslation }
|
|
142
142
|
|
|
143
143
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awes-io/ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.46.0",
|
|
4
4
|
"description": "User Interface (UI) components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui",
|
|
@@ -124,5 +124,5 @@
|
|
|
124
124
|
"vue-template-compiler": "^2.6.10",
|
|
125
125
|
"webfonts-generator": "^0.4.0"
|
|
126
126
|
},
|
|
127
|
-
"gitHead": "
|
|
127
|
+
"gitHead": "45bd6aa3df580ebb16241da5502dbf4f781bf96a"
|
|
128
128
|
}
|
package/store/awesIo.js
CHANGED
|
@@ -19,6 +19,7 @@ export const state = () => ({
|
|
|
19
19
|
screen: {},
|
|
20
20
|
|
|
21
21
|
profileUrl: null,
|
|
22
|
+
userName: '',
|
|
22
23
|
|
|
23
24
|
logo: {
|
|
24
25
|
default: { src: '' },
|
|
@@ -55,12 +56,14 @@ export const getters = {
|
|
|
55
56
|
user(state, getters, rootState) {
|
|
56
57
|
const user = pathOr({}, 'auth.user', rootState)
|
|
57
58
|
const src = pathOr('', 'avatar', user)
|
|
58
|
-
const name =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
const name =
|
|
60
|
+
state.userName ||
|
|
61
|
+
[
|
|
62
|
+
pathOr('', 'profile.first_name', user),
|
|
63
|
+
pathOr('', 'profile.last_name', user)
|
|
64
|
+
]
|
|
65
|
+
.filter(Boolean)
|
|
66
|
+
.join(' ')
|
|
64
67
|
const description = pathOr(
|
|
65
68
|
pathOr('', 'profile.description', user),
|
|
66
69
|
'profile.position',
|