@awes-io/ui 2.33.0 → 2.35.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 CHANGED
@@ -3,6 +3,57 @@
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.35.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.34.2...@awes-io/ui@2.35.0) (2021-12-04)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * default date format ([3435466](https://github.com/awes-io/client/commit/3435466e8ff789d64682ba99e5125eaa5dabf723))
12
+
13
+
14
+ ### Features
15
+
16
+ * **aw-birthday-picker:** leap year support ([43805c3](https://github.com/awes-io/client/commit/43805c3cecacec61340f512fe8e9dfcfae4ba1fb))
17
+ * **aw-date:** editable format validation added ([307ec9e](https://github.com/awes-io/client/commit/307ec9e662f32839178cab4d3c14e506b2abbc97))
18
+ * **aw-date:** editable input ([f6f7237](https://github.com/awes-io/client/commit/f6f723755f3cc9ca1c09d33860ea38c403c023ff))
19
+
20
+
21
+
22
+
23
+
24
+ ## [2.34.2](https://github.com/awes-io/client/compare/@awes-io/ui@2.34.1...@awes-io/ui@2.34.2) (2021-11-26)
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * **aw-tel:** type button added to dropdown button ([c1369cd](https://github.com/awes-io/client/commit/c1369cd16efb9b569f5a41a94da2eee746a8e40d))
30
+
31
+
32
+
33
+
34
+
35
+ ## [2.34.1](https://github.com/awes-io/client/compare/@awes-io/ui@2.34.0...@awes-io/ui@2.34.1) (2021-11-25)
36
+
37
+
38
+ ### Bug Fixes
39
+
40
+ * **aw-tel:** check if given value is string before parsing ([4161fb6](https://github.com/awes-io/client/commit/4161fb67b57ccea772a390769dab200baee15a44))
41
+
42
+
43
+
44
+
45
+
46
+ # [2.34.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.33.0...@awes-io/ui@2.34.0) (2021-11-25)
47
+
48
+
49
+ ### Features
50
+
51
+ * aw-tel component rewrited ([a072dda](https://github.com/awes-io/client/commit/a072dda44254d783b6445416bede84459639ce8d))
52
+
53
+
54
+
55
+
56
+
6
57
  # [2.33.0](https://github.com/awes-io/client/compare/@awes-io/ui@2.32.5...@awes-io/ui@2.33.0) (2021-11-15)
7
58
 
8
59
 
@@ -62,6 +62,8 @@
62
62
 
63
63
  @import './tab-nav.css';
64
64
 
65
+ @import './tel.css';
66
+
65
67
  @import './notification.css';
66
68
 
67
69
  @import './tags.css';
@@ -0,0 +1,49 @@
1
+ .aw-tel {
2
+ position: relative;
3
+
4
+ .aw-text-field__prefix {
5
+ overflow: hidden;
6
+ flex-shrink: 0;
7
+ }
8
+
9
+ &__flag {
10
+ display: inline-flex;
11
+ align-items: center;
12
+ justify-content: center;
13
+ width: 1.5rem;
14
+ height: 1.5rem;
15
+ vertical-align: middle;
16
+
17
+ .flag {
18
+ display: block !important;
19
+ flex-shrink: 0;
20
+ transform: scale(0.75);
21
+ }
22
+ }
23
+
24
+ &__country-toggler {
25
+ padding-left: 1rem;
26
+ padding-right: 1rem;
27
+ align-self: stretch;
28
+ }
29
+
30
+ &__dropdown {
31
+ width: 100%;
32
+ max-height: 50vh;
33
+ }
34
+
35
+ &__validity {
36
+ @apply px-4;
37
+ display: none;
38
+
39
+ &--valid {
40
+ @apply text-accent;
41
+ display: block;
42
+ }
43
+
44
+ &--invalid {
45
+ @apply text-error;
46
+ display: block;
47
+ }
48
+ }
49
+ }
@@ -1,5 +1,3 @@
1
- @import 'vue-tel-input/dist/vue-tel-input.css';
2
-
3
1
  .aw-text-field {
4
2
  @apply border rounded text-base;
5
3
  position: relative;
@@ -64,83 +62,6 @@
64
62
  }
65
63
  }
66
64
 
67
- /**
68
- * Tel styles (overwrite vue-tel-input)
69
- */
70
- &.is-tel .vue-tel-input {
71
- @apply bg-surface border-none;
72
- border-color: theme('borderColor.default');
73
- border-radius: theme('borderRadius.default');
74
-
75
- input {
76
- /* background-color: transparent; */
77
- box-shadow: none;
78
- min-width: 0;
79
- }
80
-
81
- .vti__dropdown {
82
- position: static;
83
- padding-left: theme('spacing.4');
84
-
85
- &:focus {
86
- outline: none;
87
- }
88
-
89
- &:hover,
90
- &.open {
91
- @apply bg-mono-300;
92
- }
93
- }
94
-
95
- .vti__dropdown-list {
96
- @apply shadow-lg bg-surface;
97
- max-width: 100%;
98
- max-height: 147px; /* include 53px of footer height */
99
- border: none;
100
- margin: 0;
101
- top: 100%;
102
- left: 0;
103
- z-index: 11;
104
-
105
- &:focus {
106
- outline: none;
107
- }
108
-
109
- &.above {
110
- top: auto;
111
- bottom: 100%;
112
- box-shadow: theme('boxShadow.lg-top');
113
- }
114
- }
115
-
116
- &:focus-within {
117
- box-shadow: none !important;
118
- border-color: theme('borderColor.info');
119
- }
120
-
121
- .vti__dropdown-item {
122
- @apply text-sm tracking-wider;
123
- line-height: 19px;
124
- padding: theme('spacing.3') theme('spacing.4');
125
-
126
- &.highlighted,
127
- &:hover,
128
- &:focus {
129
- outline: none;
130
- @apply bg-mono-300;
131
- }
132
- }
133
- }
134
-
135
- &.is-tel.has-error .vue-tel-input {
136
- @apply border-error;
137
-
138
- input::placeholder {
139
- @apply text-error opacity-100;
140
- }
141
- }
142
-
143
-
144
65
  /**
145
66
  * Textarea styles
146
67
  */
@@ -755,6 +755,9 @@ export default {
755
755
  },
756
756
 
757
757
  _selectIndex(index) {
758
+ const _option = this.optionsList.find((opt) => opt.index === index)
759
+ if (_option && _option.disabled) return
760
+
758
761
  if (this.multiple) {
759
762
  const selected = this.selectedIndexes
760
763
 
@@ -38,7 +38,10 @@
38
38
  :name="_inputKeys.year"
39
39
  :label="$t('AwBirthdayPicker.year')"
40
40
  :clearable="!showYear"
41
+ :option-disabled="isOptionDisabled"
41
42
  class="w-full"
43
+ track-by="year"
44
+ option-label="year"
42
45
  @input="checkMaxDay"
43
46
  @clear="clearYear"
44
47
  />
@@ -128,15 +131,9 @@ export default {
128
131
  },
129
132
 
130
133
  daysList() {
131
- const date = this.dayjs()
132
-
133
- if (this.year) {
134
- date.year(this.year)
135
- }
134
+ const date = this.dayjs().year(this.year || 2000)
136
135
 
137
- const maxDays = this.dayjs()
138
- .month(this.month || 0)
139
- .daysInMonth()
136
+ const maxDays = date.month(this.month || 0).daysInMonth()
140
137
 
141
138
  const arr = [...Array(maxDays + 1).keys()]
142
139
  arr.shift()
@@ -145,7 +142,12 @@ export default {
145
142
 
146
143
  yearsList() {
147
144
  const current = this.dayjs().year()
148
- return [...Array(101).keys()].map((el) => current - el)
145
+ return [...Array(101).keys()].map((el) => ({
146
+ year: current - el,
147
+ isLeapYear: this.dayjs()
148
+ .year(current - el)
149
+ .isLeapYear()
150
+ }))
149
151
  }
150
152
  },
151
153
 
@@ -171,25 +173,10 @@ export default {
171
173
  this.emit()
172
174
  },
173
175
 
174
- // parseString(str) {
175
- // if (!str) return
176
-
177
- // const d = this.toDayjs(str)
178
- // this.day = d.date()
179
- // this.month = d.month()
180
-
181
- // const y = d.year()
182
- // const yString = this.getYearString(str)
183
-
184
- // if (yString.includes(y)) {
185
- // this.year = y
186
- // this.isYearHidden = false
187
- // }
188
- // },
189
-
190
176
  emit() {
191
177
  if (!isNil(this.month) && this.day) {
192
178
  let d = this.dayjs()
179
+ .year(this.year || 2000)
193
180
  .month(this.month)
194
181
  .date(this.day)
195
182
  let formatVal = this.shortParseFormat || 'MM-DD'
@@ -210,6 +197,14 @@ export default {
210
197
  this.isYearHidden = true
211
198
  this.year = null
212
199
  this.emit()
200
+ },
201
+
202
+ isOptionDisabled(option) {
203
+ if (this.month === 1 && this.day === 29) {
204
+ return !option.isLeapYear
205
+ }
206
+
207
+ return false
213
208
  }
214
209
  }
215
210
  }
@@ -5,9 +5,11 @@
5
5
  :value="inputValue"
6
6
  :prefix="prefix"
7
7
  :postfix="postfix"
8
- readonly
8
+ :pattern="_editable ? mask : null"
9
+ :readonly="!_editable"
9
10
  @focus="isOpened = true"
10
11
  @click.stop="isOpened = true"
12
+ @input="onInput"
11
13
  >
12
14
  <template #icon>
13
15
  <AwButton
@@ -107,7 +109,12 @@ export default {
107
109
  /**
108
110
  * Show clear button if value exists
109
111
  */
110
- clearable: Boolean
112
+ clearable: Boolean,
113
+
114
+ /**
115
+ * If false input is readonly
116
+ */
117
+ editable: Boolean
111
118
  },
112
119
 
113
120
  data() {
@@ -118,6 +125,12 @@ export default {
118
125
  },
119
126
 
120
127
  computed: {
128
+ _editable() {
129
+ return (
130
+ this.editable && !this.range && /^[DMY\W]+$/.test(this.format)
131
+ )
132
+ },
133
+
121
134
  inputValue() {
122
135
  const result = []
123
136
 
@@ -170,6 +183,10 @@ export default {
170
183
  }
171
184
 
172
185
  return views
186
+ },
187
+
188
+ mask() {
189
+ return this.format.replace(/[DMY]/g, '#')
173
190
  }
174
191
  },
175
192
 
@@ -224,6 +241,16 @@ export default {
224
241
  'resize',
225
242
  this._checkMaxViewsOnResize
226
243
  )
244
+ },
245
+
246
+ onInput(val) {
247
+ if (val.length === this.format.length) {
248
+ const d = this.$dayjs(val, this.format)
249
+ if (d.isValid()) {
250
+ this.viewDate = d
251
+ this.$emit('input', this._getNonRangeValue(d))
252
+ }
253
+ }
227
254
  }
228
255
  }
229
256
  }
@@ -256,7 +256,7 @@ export default {
256
256
 
257
257
  onFileLoaded($event) {
258
258
  this.openCropModal($event.target.files[0])
259
-
259
+ $event.target.value = '' // reset to allow upload same file
260
260
  this.$refs.dropdown && this.$refs.dropdown.close()
261
261
  },
262
262
 
@@ -11,6 +11,7 @@
11
11
  v-tooltip.show.prepend="errorTooltip"
12
12
  :aria-describedby="errorText ? errorId : null"
13
13
  :class="cssClass"
14
+ type="tel"
14
15
  v-on="_listeners"
15
16
  />
16
17
  </template>
@@ -32,6 +33,8 @@ const AW_INPUT_PROPS_KEYS = keys(AwInput.props)
32
33
  export default {
33
34
  name: 'AwMoney',
34
35
 
36
+ inheritAttrs: false,
37
+
35
38
  _config,
36
39
 
37
40
  components: {