Comparing version 2.1.32 to 2.1.33
@@ -6,7 +6,11 @@ import { LitElement, html, css } from 'lit'; | ||
import '../select.js'; | ||
import { messageStyles } from '../../input/src/message-styles.js'; | ||
export class DileSelectAjax extends DileEmmitChange(LitElement) { | ||
static get styles() { | ||
return css` | ||
return [ | ||
messageStyles, | ||
css` | ||
* { | ||
@@ -54,3 +58,3 @@ box-sizing: border-box; | ||
} | ||
`; | ||
`]; | ||
} | ||
@@ -99,3 +103,7 @@ | ||
type: Boolean, | ||
} | ||
}, | ||
/** Message Displayed */ | ||
message: { type: String }, | ||
/** Hide errors on input */ | ||
hideErrorOnInput: { type: Boolean }, | ||
}; | ||
@@ -182,2 +190,3 @@ } | ||
</div> | ||
${this.messageTemplate} | ||
`; | ||
@@ -260,2 +269,3 @@ } | ||
name="generated-select-field" | ||
?errored=${this.errored} | ||
> | ||
@@ -272,2 +282,11 @@ <select slot="select"> | ||
get messageTemplate() { | ||
return html` | ||
${this.message | ||
? html`<div class="message ${this.errored ? 'errored-msg' : ''}"><span>${this.message}</span></div>` | ||
: '' | ||
} | ||
` | ||
} | ||
onFocus() { | ||
@@ -280,4 +299,11 @@ this.opened = true; | ||
this.loadData(); | ||
this.hideErrorOnInteraction(); | ||
} | ||
hideErrorOnInteraction() { | ||
if (this.hideErrorOnInput && this.errored) { | ||
this.clearError(); | ||
} | ||
} | ||
loadData() { | ||
@@ -318,4 +344,10 @@ this.loading = true; | ||
e.stopPropagation(); | ||
this.hideErrorOnInteraction(); | ||
} | ||
clearError() { | ||
this.errored = false; | ||
this.message = ''; | ||
} | ||
onClearSelected() { | ||
@@ -332,2 +364,3 @@ this.value = undefined; | ||
} | ||
this.hideErrorOnInteraction(); | ||
} | ||
@@ -334,0 +367,0 @@ |
{ | ||
"name": "@dile/ui", | ||
"version": "2.1.32", | ||
"version": "2.1.33", | ||
"description": "UI Core components from dile-components.", | ||
@@ -29,3 +29,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "0ec21ccb38e95cc07cb484a1385ef0adc9cc93ba" | ||
"gitHead": "425ca943ebe7570e00cb8875b117ee6af3d4b955" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
222709
7101