mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-24 23:37:51 +01:00
- Fix problemi rilevati da ESLint (per togliere alcune regole commentate) - Spostati i tipi nella cartella typings - Aggiunti alcuni alias per la cartella resources
41 lines
951 B
TypeScript
41 lines
951 B
TypeScript
import {TextArea as MWCTextArea} from '@material/mwc-textarea';
|
|
import {customElement} from 'lit/decorators.js';
|
|
|
|
import {type JSXElement} from '../typings';
|
|
|
|
declare global {
|
|
namespace JSX {
|
|
interface IntrinsicElements {
|
|
'text-area': JSXElement<TextArea>;
|
|
}
|
|
}
|
|
}
|
|
|
|
@customElement('text-area')
|
|
export default class TextArea extends MWCTextArea {
|
|
private _initialValidationMessage: string | undefined;
|
|
|
|
get nativeValidationMessage() {
|
|
return this.formElement.validationMessage;
|
|
}
|
|
|
|
firstUpdated() {
|
|
if (this.validationMessage) {
|
|
this._initialValidationMessage = this.validationMessage;
|
|
}
|
|
|
|
super.firstUpdated();
|
|
}
|
|
|
|
reportValidity() {
|
|
const isValid = super.reportValidity();
|
|
|
|
// Note(cg): override validationMessage only if no initial message set.
|
|
if (!this._initialValidationMessage && !isValid) {
|
|
this.validationMessage = this.nativeValidationMessage;
|
|
}
|
|
|
|
return isValid;
|
|
}
|
|
}
|