1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-24 23:37:51 +01:00
Maicol Battistini bda53b272a refactor: ♻️ Refactor generale
- Fix problemi rilevati da ESLint (per togliere alcune regole commentate)
- Spostati i tipi nella cartella typings
- Aggiunti alcuni alias per la cartella resources
2022-01-26 16:24:20 +01:00

90 lines
1.9 KiB
TypeScript

import {ListItemBase} from '@material/mwc-list/mwc-list-item-base.js';
import {
TextAreaCharCounter,
TextFieldInputMode,
TextFieldType
} from '@material/mwc-textfield';
import {MaterialIcons} from './icons';
export interface FieldT {
id?: string
name?: string
value?: string
label?: string
outlined?: boolean
helper?: string
icon?: string | MaterialIcons
placeholder?: string
disabled?: boolean
required?: boolean
validity?: ValidityState
validityTransform?: (
value: string,
nativeValidity: ValidityState,
) => Partial<ValidityState> | null
validateOnInitialRender?: boolean
validationMessage?: string
// Custom
type?: string
}
export type TextFieldT = FieldT & {
type?: TextFieldType
prefix?: string
suffix?: string
iconTrailing?: string
charCounter?: boolean
helperPersistent?: boolean | string
minLength?: number
maxLength?: number
pattern?: string
min?: number | string
max?: number | string
size?: number | null
step?: number | null
autoValidate?: boolean
willValidate?: boolean
name?: string
inputMode?: TextFieldInputMode
readOnly?: boolean
autocapitalize?:
| 'on'
| 'off'
| 'sentences'
| 'none'
| 'words'
| 'characters'
endAligned?: boolean
elementType?: 'text-field'
};
export type TextAreaT = FieldT & {
rows?: number
cols?: number
type?: TextFieldType
iconTrailing?: string
charCounter?: boolean | TextAreaCharCounter
willValidate?: boolean
helperPersistent?: boolean | string
maxLength?: number
elementType?: 'text-area'
};
export type SelectOptionsT = {
label: string
value: string
}[];
export type SelectT = FieldT & {
multiple?: boolean
naturalMenuWidth?: boolean
fixedMenuPosition?: boolean
willValidate?: boolean
elementType?: 'material-select'
selected?: ListItemBase | null
items?: ListItemBase[]
index?: number
options?: SelectOptionsT | Promise<SelectOptionsT>
};