@awes-io/ui 2.34.2 → 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,24 @@
|
|
|
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
|
+
|
|
6
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)
|
|
7
25
|
|
|
8
26
|
|
|
@@ -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.
|
|
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) =>
|
|
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
|
-
|
|
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
|
}
|
package/mixins/birthday.js
CHANGED
|
@@ -46,7 +46,9 @@ export default {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
if (this.shortParseFormat) {
|
|
49
|
-
const
|
|
49
|
+
const _formatWithYear = `${this.shortParseFormat}.YYYY`
|
|
50
|
+
const _inputWithYear = `${input}.2000` // 2000 is leap year
|
|
51
|
+
const dShort = this.dayjs(_inputWithYear, _formatWithYear)
|
|
50
52
|
if (dShort.isValid()) {
|
|
51
53
|
return dShort
|
|
52
54
|
}
|
package/nuxt/awes.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awes-io/ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.35.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": "034b0ec86005251c5b6984eeb245dfd9a4cebf07"
|
|
128
128
|
}
|