Skip to content

Commit ecf724e

Browse files
committed
[5.13.7] Added check for promise for handleChange to set suffixIcon internally
1 parent 9fd9bbd commit ecf724e

File tree

5 files changed

+29
-4
lines changed

5 files changed

+29
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 5.13.7
2+
3+
### Updated
4+
5+
- Added check for promise for `handleChange` to set `suffixIcon` internally
6+
17
## 5.13.6
28

39
### Updated

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ See demo at [https://detools-vue-form.netlify.com](https://detools-vue-form.netl
8282

8383
## Changelog
8484

85+
- [5.13.7](/CHANGELOG.md#5137)
8586
- [5.13.6](/CHANGELOG.md#5136)
8687
- [5.13.5](/CHANGELOG.md#5135)
8788
- [5.13.4](/CHANGELOG.md#5134)

VueForm/components/ConnectedSelect.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ const ConnectedSelect = {
9595

9696
mixins: [ConnectedSelectMixin],
9797

98+
data() {
99+
return {
100+
loadingState: false,
101+
}
102+
},
103+
98104
methods: {
99105
generateOption(option) {
100106
const { valueKey, labelKey } = this
@@ -140,7 +146,19 @@ const ConnectedSelect = {
140146

141147
handleFieldChange(...args) {
142148
this.setDirty()
143-
this.handleChange(...args)
149+
150+
const posiblePromise = this.handleChange(...args)
151+
if (posiblePromise && posiblePromise.then) {
152+
this.loadingState = true
153+
154+
posiblePromise
155+
.then(() => {
156+
this.loadingState = false
157+
})
158+
.catch(() => {
159+
this.loadingState = false
160+
})
161+
}
144162

145163
return this.setAsyncError(this.asyncValidators)()
146164
},
@@ -171,7 +189,7 @@ const ConnectedSelect = {
171189
no-match-text={this.noMatchText}
172190
no-data-text={this.noDataText}
173191
reserve-keyword={this.reserveKeyword}
174-
suffixIcon={this.suffixIcon}
192+
suffixIcon={this.suffixIcon || (this.loadingState ? 'el-icon-loading' : '')}
175193
default-first-option={defaultFirstOption}
176194
popper-append-to-body={this.popperAppendToBody}
177195
automatic-dropdown={this.automaticDropdown}

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@detools/vue-form",
3-
"version": "5.13.6",
3+
"version": "5.13.7",
44
"description": "Form State Management for VueJS",
55
"main": "VueForm/index.js",
66
"scripts": {

0 commit comments

Comments
 (0)