@awes-io/ui 2.32.5 → 2.34.2
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 +49 -0
- package/assets/css/components/_index.css +2 -0
- package/assets/css/components/tel.css +49 -0
- package/assets/css/components/text-field.css +3 -79
- package/components/1_atoms/AwInput.vue +23 -2
- package/components/3_organisms/AwIslandAvatar.vue +1 -1
- package/components/3_organisms/AwMoney.vue +3 -0
- package/components/3_organisms/AwTel.vue +308 -43
- package/components/_config.js +7 -1
- package/dist/css/aw-icons.css +168 -0
- package/dist/css/ui.css +1 -0
- package/dist/fonts/aw-icons.svg +159 -0
- package/dist/fonts/aw-icons.ttf +0 -0
- package/dist/fonts/aw-icons.woff +0 -0
- package/dist/fonts/aw-icons.woff2 +0 -0
- package/dist/js/ui.esm.js +20 -0
- package/dist/js/ui.min.js +20 -0
- package/dist/js/ui.ssr.js +24996 -0
- package/mixins/arrow-focus.js +65 -4
- package/mixins/text-field.js +61 -31
- package/nuxt/icons.css +168 -0
- package/package.json +6 -5
package/mixins/arrow-focus.js
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
|
+
const IS_SEARCH_KEY_RE = /^\S$/i
|
|
2
|
+
|
|
1
3
|
export default {
|
|
4
|
+
computed: {
|
|
5
|
+
_arrowFocusSelector() {
|
|
6
|
+
return '[data-arrow-focus]'
|
|
7
|
+
},
|
|
8
|
+
|
|
9
|
+
_arrowFocusInited() {
|
|
10
|
+
return this.isOpened
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
|
|
2
14
|
methods: {
|
|
3
15
|
_arrowFocusItem(offset = 0, $event) {
|
|
4
|
-
if (!this.
|
|
16
|
+
if (!this._arrowFocusInited) return
|
|
5
17
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
18
|
+
this._arrowFocus(offset, $event)
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
_arrowFocus(offset, $event) {
|
|
22
|
+
const buttons = this._getFocusItems()
|
|
9
23
|
const active = document.activeElement
|
|
10
24
|
const activeIndex = buttons.indexOf(active)
|
|
11
25
|
let nextIndex
|
|
@@ -25,6 +39,53 @@ export default {
|
|
|
25
39
|
}
|
|
26
40
|
button.focus()
|
|
27
41
|
}
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
_keyFocusItem($event) {
|
|
45
|
+
const { key, keyCode } = $event
|
|
46
|
+
|
|
47
|
+
if (keyCode === 38 || keyCode === 40) {
|
|
48
|
+
const offset = keyCode === 38 ? -1 : 1
|
|
49
|
+
|
|
50
|
+
this._arrowFocus(offset, $event)
|
|
51
|
+
} else if (IS_SEARCH_KEY_RE.test(key)) {
|
|
52
|
+
const buttons = this._getFocusItems()
|
|
53
|
+
const active = document.activeElement
|
|
54
|
+
const re = new RegExp('^(\\s+)?' + key, 'i')
|
|
55
|
+
let button
|
|
56
|
+
|
|
57
|
+
if (buttons.includes(active) && re.test(active.textContent)) {
|
|
58
|
+
const currentIndex = buttons.indexOf(active)
|
|
59
|
+
const next = buttons[currentIndex + 1]
|
|
60
|
+
|
|
61
|
+
if (next && re.test(next.textContent)) {
|
|
62
|
+
button = next
|
|
63
|
+
} else {
|
|
64
|
+
const firstIndex = buttons.findIndex((_btn) =>
|
|
65
|
+
re.test(_btn.textContent)
|
|
66
|
+
)
|
|
67
|
+
if (firstIndex !== currentIndex) {
|
|
68
|
+
button = buttons[firstIndex]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
} else {
|
|
72
|
+
button = buttons.find((_btn) => re.test(_btn.textContent))
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (button) {
|
|
76
|
+
if ($event) {
|
|
77
|
+
$event.preventDefault()
|
|
78
|
+
$event.stopPropagation()
|
|
79
|
+
}
|
|
80
|
+
button.focus()
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
_getFocusItems() {
|
|
86
|
+
return Array.from(
|
|
87
|
+
this.$el.querySelectorAll(this._arrowFocusSelector)
|
|
88
|
+
)
|
|
28
89
|
}
|
|
29
90
|
}
|
|
30
91
|
}
|
package/mixins/text-field.js
CHANGED
|
@@ -75,6 +75,22 @@ export default {
|
|
|
75
75
|
invalid: this._onInvalid,
|
|
76
76
|
animationstart: this._autoFillHack
|
|
77
77
|
}
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
_isMaskable() {
|
|
81
|
+
const type = this.type || this.$attrs.type
|
|
82
|
+
|
|
83
|
+
return !type || ['text', 'search', 'url', 'password'].includes(type)
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
process() {
|
|
87
|
+
return this.pattern &&
|
|
88
|
+
typeof (
|
|
89
|
+
this.pattern === 'string' || this.pattern instanceof RegExp
|
|
90
|
+
) &&
|
|
91
|
+
this._isMaskable
|
|
92
|
+
? this._applyFormat
|
|
93
|
+
: this._stub
|
|
78
94
|
}
|
|
79
95
|
},
|
|
80
96
|
|
|
@@ -89,33 +105,14 @@ export default {
|
|
|
89
105
|
|
|
90
106
|
methods: {
|
|
91
107
|
_onInput($event) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const el = $event.target
|
|
95
|
-
const value = this._applyFormat(el.value) // get masked value
|
|
96
|
-
const eventType = $event.type
|
|
97
|
-
|
|
98
|
-
let pos = el.selectionEnd // save caret position
|
|
99
|
-
const lastSign = el.value[pos - 1] // save last sign
|
|
100
|
-
|
|
101
|
-
el.value = value
|
|
102
|
-
|
|
103
|
-
// calculate new caret position if mask inserted symbols
|
|
104
|
-
while (pos < value.length && value.charAt(pos - 1) !== lastSign) {
|
|
105
|
-
pos++
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// restore caret position
|
|
109
|
-
this.$nextTick(() => {
|
|
110
|
-
el.setSelectionRange(pos, pos)
|
|
111
|
-
})
|
|
108
|
+
const value = this.process($event)
|
|
112
109
|
|
|
113
110
|
if (this.hasError) {
|
|
114
111
|
this.setError('')
|
|
115
112
|
}
|
|
116
113
|
|
|
117
|
-
if (this.$listeners[
|
|
118
|
-
this.$emit(
|
|
114
|
+
if (this.$listeners[$event.type]) {
|
|
115
|
+
this.$emit($event.type, value)
|
|
119
116
|
} else {
|
|
120
117
|
this.inputValue = value
|
|
121
118
|
}
|
|
@@ -136,26 +133,48 @@ export default {
|
|
|
136
133
|
}
|
|
137
134
|
},
|
|
138
135
|
|
|
139
|
-
_applyFormat(
|
|
136
|
+
_applyFormat($event) {
|
|
137
|
+
const el = $event.target
|
|
138
|
+
let value = el.value
|
|
139
|
+
|
|
140
140
|
// mask
|
|
141
141
|
if (typeof this.pattern === 'string') {
|
|
142
|
-
|
|
142
|
+
value = this._mask(value)
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
// regex pattern
|
|
146
146
|
if (this.pattern instanceof RegExp) {
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
value = this._regex(value)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// avoid infinite loop
|
|
151
|
+
if ($event.isTrusted) {
|
|
152
|
+
let pos = el.selectionEnd // save caret position
|
|
153
|
+
const lastSign = el.value[pos - 1] // save last sign
|
|
154
|
+
|
|
155
|
+
el.value = value
|
|
156
|
+
|
|
157
|
+
// calculate new caret position if mask inserted symbols
|
|
158
|
+
while (
|
|
159
|
+
pos < value.length &&
|
|
160
|
+
value.charAt(pos - 1) !== lastSign
|
|
161
|
+
) {
|
|
162
|
+
pos++
|
|
163
|
+
}
|
|
149
164
|
|
|
150
|
-
|
|
165
|
+
// restore caret position
|
|
166
|
+
this.$nextTick(() => {
|
|
167
|
+
el.setSelectionRange(pos, pos)
|
|
168
|
+
})
|
|
151
169
|
}
|
|
152
170
|
|
|
153
171
|
return value
|
|
154
172
|
},
|
|
155
173
|
|
|
156
|
-
_mask(value
|
|
174
|
+
_mask(value) {
|
|
157
175
|
value = value || ''
|
|
158
|
-
|
|
176
|
+
|
|
177
|
+
let mask = this.pattern || ''
|
|
159
178
|
let iMask = 0
|
|
160
179
|
let iValue = 0
|
|
161
180
|
let output = ''
|
|
@@ -178,7 +197,7 @@ export default {
|
|
|
178
197
|
iMask++ // take the next mask char and treat it as char
|
|
179
198
|
cMask = mask[iMask]
|
|
180
199
|
}
|
|
181
|
-
|
|
200
|
+
output += cMask
|
|
182
201
|
if (cValue === cMask) iValue++ // user typed the same char
|
|
183
202
|
iMask++
|
|
184
203
|
}
|
|
@@ -187,7 +206,7 @@ export default {
|
|
|
187
206
|
// fix mask that ends with a char: (#)
|
|
188
207
|
let restOutput = ''
|
|
189
208
|
|
|
190
|
-
while (iMask < mask.length
|
|
209
|
+
while (iMask < mask.length) {
|
|
191
210
|
let cMask = mask[iMask]
|
|
192
211
|
if (this.maskTokens[cMask]) {
|
|
193
212
|
restOutput = ''
|
|
@@ -198,6 +217,17 @@ export default {
|
|
|
198
217
|
}
|
|
199
218
|
|
|
200
219
|
return output + restOutput
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
_regex(value) {
|
|
223
|
+
const match = this.pattern.exec(value)
|
|
224
|
+
this.pattern.lastIndex = 0 // reset for next cycles
|
|
225
|
+
|
|
226
|
+
return match ? match[0] : ''
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
_stub($event) {
|
|
230
|
+
return ($event.target && $event.target.value) || ''
|
|
201
231
|
}
|
|
202
232
|
}
|
|
203
233
|
}
|
package/nuxt/icons.css
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: "aw-icons";
|
|
3
|
+
src: url("../dist/fonts/aw-icons.woff2?f7781284402a16642f82aa8273369343") format("woff2"),
|
|
4
|
+
url("../dist/fonts/aw-icons.woff?f7781284402a16642f82aa8273369343") format("woff");
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.aw-icon {
|
|
8
|
+
display: inline-block;
|
|
9
|
+
line-height: 1;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
vertical-align: middle;
|
|
12
|
+
text-align: center;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.aw-icon:before {
|
|
16
|
+
font-family: aw-icons !important;
|
|
17
|
+
font-style: normal;
|
|
18
|
+
font-weight: normal !important;
|
|
19
|
+
vertical-align: top;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.aw-icon-arrow-d:before {
|
|
23
|
+
content: "\f101";
|
|
24
|
+
}
|
|
25
|
+
.aw-icon-arrow-l:before {
|
|
26
|
+
content: "\f102";
|
|
27
|
+
}
|
|
28
|
+
.aw-icon-arrow-r:before {
|
|
29
|
+
content: "\f103";
|
|
30
|
+
}
|
|
31
|
+
.aw-icon-arrow-u:before {
|
|
32
|
+
content: "\f104";
|
|
33
|
+
}
|
|
34
|
+
.aw-icon-bold:before {
|
|
35
|
+
content: "\f105";
|
|
36
|
+
}
|
|
37
|
+
.aw-icon-briefcase:before {
|
|
38
|
+
content: "\f106";
|
|
39
|
+
}
|
|
40
|
+
.aw-icon-burger:before {
|
|
41
|
+
content: "\f107";
|
|
42
|
+
}
|
|
43
|
+
.aw-icon-check-circle:before {
|
|
44
|
+
content: "\f108";
|
|
45
|
+
}
|
|
46
|
+
.aw-icon-check-solid:before {
|
|
47
|
+
content: "\f109";
|
|
48
|
+
}
|
|
49
|
+
.aw-icon-check:before {
|
|
50
|
+
content: "\f10a";
|
|
51
|
+
}
|
|
52
|
+
.aw-icon-chevron-d:before {
|
|
53
|
+
content: "\f10b";
|
|
54
|
+
}
|
|
55
|
+
.aw-icon-chevron-l:before {
|
|
56
|
+
content: "\f10c";
|
|
57
|
+
}
|
|
58
|
+
.aw-icon-chevron-r:before {
|
|
59
|
+
content: "\f10d";
|
|
60
|
+
}
|
|
61
|
+
.aw-icon-chevron-u:before {
|
|
62
|
+
content: "\f10e";
|
|
63
|
+
}
|
|
64
|
+
.aw-icon-circle:before {
|
|
65
|
+
content: "\f10f";
|
|
66
|
+
}
|
|
67
|
+
.aw-icon-close-circle:before {
|
|
68
|
+
content: "\f110";
|
|
69
|
+
}
|
|
70
|
+
.aw-icon-close-solid:before {
|
|
71
|
+
content: "\f111";
|
|
72
|
+
}
|
|
73
|
+
.aw-icon-close:before {
|
|
74
|
+
content: "\f112";
|
|
75
|
+
}
|
|
76
|
+
.aw-icon-copy:before {
|
|
77
|
+
content: "\f113";
|
|
78
|
+
}
|
|
79
|
+
.aw-icon-drag:before {
|
|
80
|
+
content: "\f114";
|
|
81
|
+
}
|
|
82
|
+
.aw-icon-external:before {
|
|
83
|
+
content: "\f115";
|
|
84
|
+
}
|
|
85
|
+
.aw-icon-eye-no:before {
|
|
86
|
+
content: "\f116";
|
|
87
|
+
}
|
|
88
|
+
.aw-icon-eye:before {
|
|
89
|
+
content: "\f117";
|
|
90
|
+
}
|
|
91
|
+
.aw-icon-font-size:before {
|
|
92
|
+
content: "\f118";
|
|
93
|
+
}
|
|
94
|
+
.aw-icon-graph:before {
|
|
95
|
+
content: "\f119";
|
|
96
|
+
}
|
|
97
|
+
.aw-icon-intelligence:before {
|
|
98
|
+
content: "\f11a";
|
|
99
|
+
}
|
|
100
|
+
.aw-icon-italic:before {
|
|
101
|
+
content: "\f11b";
|
|
102
|
+
}
|
|
103
|
+
.aw-icon-loader:before {
|
|
104
|
+
content: "\f11c";
|
|
105
|
+
}
|
|
106
|
+
.aw-icon-location:before {
|
|
107
|
+
content: "\f11d";
|
|
108
|
+
}
|
|
109
|
+
.aw-icon-minus:before {
|
|
110
|
+
content: "\f11e";
|
|
111
|
+
}
|
|
112
|
+
.aw-icon-more-v:before {
|
|
113
|
+
content: "\f11f";
|
|
114
|
+
}
|
|
115
|
+
.aw-icon-more:before {
|
|
116
|
+
content: "\f120";
|
|
117
|
+
}
|
|
118
|
+
.aw-icon-plus-solid:before {
|
|
119
|
+
content: "\f121";
|
|
120
|
+
}
|
|
121
|
+
.aw-icon-plus:before {
|
|
122
|
+
content: "\f122";
|
|
123
|
+
}
|
|
124
|
+
.aw-icon-quote:before {
|
|
125
|
+
content: "\f123";
|
|
126
|
+
}
|
|
127
|
+
.aw-icon-schedule:before {
|
|
128
|
+
content: "\f124";
|
|
129
|
+
}
|
|
130
|
+
.aw-icon-search:before {
|
|
131
|
+
content: "\f125";
|
|
132
|
+
}
|
|
133
|
+
.aw-icon-settings:before {
|
|
134
|
+
content: "\f126";
|
|
135
|
+
}
|
|
136
|
+
.aw-icon-speaker:before {
|
|
137
|
+
content: "\f127";
|
|
138
|
+
}
|
|
139
|
+
.aw-icon-speed:before {
|
|
140
|
+
content: "\f128";
|
|
141
|
+
}
|
|
142
|
+
.aw-icon-storage:before {
|
|
143
|
+
content: "\f129";
|
|
144
|
+
}
|
|
145
|
+
.aw-icon-triangle-d:before {
|
|
146
|
+
content: "\f12a";
|
|
147
|
+
}
|
|
148
|
+
.aw-icon-triangle-l:before {
|
|
149
|
+
content: "\f12b";
|
|
150
|
+
}
|
|
151
|
+
.aw-icon-triangle-r:before {
|
|
152
|
+
content: "\f12c";
|
|
153
|
+
}
|
|
154
|
+
.aw-icon-triangle-solid-r:before {
|
|
155
|
+
content: "\f12d";
|
|
156
|
+
}
|
|
157
|
+
.aw-icon-triangle-u:before {
|
|
158
|
+
content: "\f12e";
|
|
159
|
+
}
|
|
160
|
+
.aw-icon-upload:before {
|
|
161
|
+
content: "\f12f";
|
|
162
|
+
}
|
|
163
|
+
.aw-icon-user-solid:before {
|
|
164
|
+
content: "\f130";
|
|
165
|
+
}
|
|
166
|
+
.aw-icon-user:before {
|
|
167
|
+
content: "\f131";
|
|
168
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awes-io/ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.34.2",
|
|
4
4
|
"description": "User Interface (UI) components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@casl/ability": "^4.1.6",
|
|
53
53
|
"@casl/vue": "^1.1.1",
|
|
54
|
-
"@nuxtjs/axios": "^5.
|
|
54
|
+
"@nuxtjs/axios": "^5.13.6",
|
|
55
55
|
"@nuxtjs/svg-sprite": "^0.5.2",
|
|
56
56
|
"@popperjs/core": "^2.0.5",
|
|
57
57
|
"autosize": "^4.0.2",
|
|
@@ -62,10 +62,11 @@
|
|
|
62
62
|
"cookies": "^0.8.0",
|
|
63
63
|
"core-js": "^2.6.5",
|
|
64
64
|
"croppie": "^2.6.5",
|
|
65
|
-
"dayjs": "^1.
|
|
65
|
+
"dayjs": "^1.10.7",
|
|
66
66
|
"hammerjs": "^2.0.8",
|
|
67
67
|
"insane": "^2.6.2",
|
|
68
68
|
"js-cookie": "^2.2.1",
|
|
69
|
+
"libphonenumber-js": "^1.9.43",
|
|
69
70
|
"loadjs": "^3.6.1",
|
|
70
71
|
"marked": "^0.7.0",
|
|
71
72
|
"postcss-color-function": "^4.1.0",
|
|
@@ -76,7 +77,7 @@
|
|
|
76
77
|
"tailwindcss": "^1.9.6",
|
|
77
78
|
"vue-currency-input": "^1.22.3",
|
|
78
79
|
"vue-i18n": "^8.14.0",
|
|
79
|
-
"
|
|
80
|
+
"world-flags-sprite": "^0.0.2"
|
|
80
81
|
},
|
|
81
82
|
"devDependencies": {
|
|
82
83
|
"@babel/core": "^7.5.5",
|
|
@@ -123,5 +124,5 @@
|
|
|
123
124
|
"vue-template-compiler": "^2.6.10",
|
|
124
125
|
"webfonts-generator": "^0.4.0"
|
|
125
126
|
},
|
|
126
|
-
"gitHead": "
|
|
127
|
+
"gitHead": "00c9d7a17f45c384bc15d55e3c7a5d2025b54956"
|
|
127
128
|
}
|