Refactor #5176 - invalid property added

This commit is contained in:
tugcekucukoglu 2024-01-30 14:27:56 +03:00
parent b42c9eb7ee
commit a9a254915c
54 changed files with 198 additions and 12 deletions

View file

@ -350,6 +350,11 @@ export interface AutoCompleteProps {
* @defaultValue false * @defaultValue false
*/ */
loading?: boolean | undefined; loading?: boolean | undefined;
/**
* When present, it specifies that the component should have invalid state style.
* @defaultValue false
*/
invalid?: boolean | undefined;
/** /**
* When present, it specifies that the component should be disabled. * When present, it specifies that the component should be disabled.
* @defaultValue false * @defaultValue false

View file

@ -45,6 +45,10 @@ export default {
type: Boolean, type: Boolean,
default: false default: false
}, },
invalid: {
type: Boolean,
default: false
},
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false

View file

@ -110,6 +110,7 @@ const classes = {
'p-autocomplete p-component p-inputwrapper', 'p-autocomplete p-component p-inputwrapper',
{ {
'p-disabled': props.disabled, 'p-disabled': props.disabled,
'p-invalid': props.invalid,
'p-focus': instance.focused, 'p-focus': instance.focused,
'p-autocomplete-dd': props.dropdown, 'p-autocomplete-dd': props.dropdown,
'p-autocomplete-multiple': props.multiple, 'p-autocomplete-multiple': props.multiple,

View file

@ -176,6 +176,10 @@ export default {
type: [String, Object], type: [String, Object],
default: 'body' default: 'body'
}, },
invalid: {
type: Boolean,
default: false
},
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false

View file

@ -711,6 +711,11 @@ export interface CalendarProps {
* @defaultValue true * @defaultValue true
*/ */
manualInput?: boolean | undefined; manualInput?: boolean | undefined;
/**
* When present, it specifies that the component should have invalid state style.
* @defaultValue false
*/
invalid?: boolean | undefined;
/** /**
* When present, it specifies that the component should be disabled. * When present, it specifies that the component should be disabled.
* @defaultValue false * @defaultValue false

View file

@ -166,6 +166,7 @@ const classes = {
'p-input-icon-right': props.showIcon && props.iconDisplay === 'input', 'p-input-icon-right': props.showIcon && props.iconDisplay === 'input',
'p-calendar-timeonly': props.timeOnly, 'p-calendar-timeonly': props.timeOnly,
'p-calendar-disabled': props.disabled, 'p-calendar-disabled': props.disabled,
'p-invalid': props.invalid,
'p-inputwrapper-filled': props.modelValue, 'p-inputwrapper-filled': props.modelValue,
'p-inputwrapper-focus': state.focused, 'p-inputwrapper-focus': state.focused,
'p-focus': state.focused || state.overlayVisible 'p-focus': state.focused || state.overlayVisible

View file

@ -14,6 +14,10 @@ export default {
optionGroupLabel: null, optionGroupLabel: null,
optionGroupChildren: null, optionGroupChildren: null,
placeholder: String, placeholder: String,
invalid: {
type: Boolean,
default: false
},
disabled: Boolean, disabled: Boolean,
dataKey: null, dataKey: null,
inputId: { inputId: {

View file

@ -271,6 +271,11 @@ export interface CascadeSelectProps {
* Default text to display when no option is selected. * Default text to display when no option is selected.
*/ */
placeholder?: string | undefined; placeholder?: string | undefined;
/**
* When present, it specifies that the component should have invalid state style.
* @defaultValue false
*/
invalid?: boolean | undefined;
/** /**
* When present, it specifies that the component should be disabled. * When present, it specifies that the component should be disabled.
* @defaultValue false * @defaultValue false

View file

@ -103,6 +103,7 @@ const classes = {
'p-cascadeselect p-component p-inputwrapper', 'p-cascadeselect p-component p-inputwrapper',
{ {
'p-disabled': props.disabled, 'p-disabled': props.disabled,
'p-invalid': props.invalid,
'p-focus': instance.focused, 'p-focus': instance.focused,
'p-inputwrapper-filled': props.modelValue, 'p-inputwrapper-filled': props.modelValue,
'p-inputwrapper-focus': instance.focused || instance.overlayVisible, 'p-inputwrapper-focus': instance.focused || instance.overlayVisible,

View file

@ -21,6 +21,10 @@ export default {
type: null, type: null,
default: false default: false
}, },
invalid: {
type: Boolean,
default: false
},
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false

View file

@ -111,6 +111,11 @@ export interface CheckboxProps {
* @default false * @default false
*/ */
binary?: boolean; binary?: boolean;
/**
* When present, it specifies that the component should have invalid state style.
* @defaultValue false
*/
invalid?: boolean | undefined;
/** /**
* When present, it specifies that the element should be disabled. * When present, it specifies that the element should be disabled.
* @default false * @default false

View file

@ -26,7 +26,8 @@ const classes = {
'p-checkbox p-component', 'p-checkbox p-component',
{ {
'p-highlight': instance.checked, 'p-highlight': instance.checked,
'p-disabled': props.disabled 'p-disabled': props.disabled,
'p-invalid': props.invalid
} }
], ],
box: 'p-checkbox-box', box: 'p-checkbox-box',

View file

@ -30,6 +30,10 @@ export default {
type: String, type: String,
default: null default: null
}, },
invalid: {
type: Boolean,
default: false
},
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false

View file

@ -184,8 +184,14 @@ export interface ChipsProps {
* @deprecated since v3.27.0. Use 'removetokenicon' slot. * @deprecated since v3.27.0. Use 'removetokenicon' slot.
*/ */
removeTokenIcon?: string | undefined; removeTokenIcon?: string | undefined;
/**
* When present, it specifies that the component should have invalid state style.
* @defaultValue false
*/
invalid?: boolean | undefined;
/** /**
* When present, it specifies that the element should be disabled. * When present, it specifies that the element should be disabled.
* @defaultValue false
*/ */
disabled?: boolean | undefined; disabled?: boolean | undefined;
/** /**

View file

@ -55,6 +55,7 @@ const classes = {
'p-chips p-component p-inputwrapper', 'p-chips p-component p-inputwrapper',
{ {
'p-disabled': props.disabled, 'p-disabled': props.disabled,
'p-invalid': props.invalid,
'p-focus': instance.focused, 'p-focus': instance.focused,
'p-inputwrapper-filled': (props.modelValue && props.modelValue.length) || (instance.inputValue && instance.inputValue.length), 'p-inputwrapper-filled': (props.modelValue && props.modelValue.length) || (instance.inputValue && instance.inputValue.length),
'p-inputwrapper-focus': instance.focused 'p-inputwrapper-focus': instance.focused

View file

@ -33,6 +33,10 @@ export default {
type: String, type: String,
default: null default: null
}, },
invalid: {
type: Boolean,
default: false
},
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false

View file

@ -319,6 +319,11 @@ export interface DropdownProps {
* Default text to display when no option is selected. * Default text to display when no option is selected.
*/ */
placeholder?: string | undefined; placeholder?: string | undefined;
/**
* When present, it specifies that the component should have invalid state style.
* @defaultValue false
*/
invalid?: boolean | undefined;
/** /**
* When present, it specifies that the component should be disabled. * When present, it specifies that the component should be disabled.
* @defaultValue false * @defaultValue false

View file

@ -104,6 +104,7 @@ const classes = {
'p-dropdown p-component p-inputwrapper', 'p-dropdown p-component p-inputwrapper',
{ {
'p-disabled': props.disabled, 'p-disabled': props.disabled,
'p-invalid': props.invalid,
'p-dropdown-clearable': props.showClear, 'p-dropdown-clearable': props.showClear,
'p-focus': state.focused, 'p-focus': state.focused,
'p-inputwrapper-filled': instance.hasSelectedOption, 'p-inputwrapper-filled': instance.hasSelectedOption,

View file

@ -109,6 +109,10 @@ export default {
type: Boolean, type: Boolean,
default: false default: false
}, },
invalid: {
type: Boolean,
default: false
},
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false

View file

@ -262,6 +262,11 @@ export interface InputNumberProps {
* @defaultValue false * @defaultValue false
*/ */
highlightOnFocus?: boolean | undefined; highlightOnFocus?: boolean | undefined;
/**
* When present, it specifies that the component should have invalid state style.
* @defaultValue false
*/
invalid?: boolean | undefined;
/** /**
* When present, it specifies that the component should be disabled. * When present, it specifies that the component should be disabled.
* @defaultValue false * @defaultValue false

View file

@ -113,7 +113,8 @@ const classes = {
'p-inputwrapper-focus': instance.focused, 'p-inputwrapper-focus': instance.focused,
'p-inputnumber-buttons-stacked': props.showButtons && props.buttonLayout === 'stacked', 'p-inputnumber-buttons-stacked': props.showButtons && props.buttonLayout === 'stacked',
'p-inputnumber-buttons-horizontal': props.showButtons && props.buttonLayout === 'horizontal', 'p-inputnumber-buttons-horizontal': props.showButtons && props.buttonLayout === 'horizontal',
'p-inputnumber-buttons-vertical': props.showButtons && props.buttonLayout === 'vertical' 'p-inputnumber-buttons-vertical': props.showButtons && props.buttonLayout === 'vertical',
'p-invalid': props.invalid
} }
], ],
input: 'p-inputnumber-input', input: 'p-inputnumber-input',

View file

@ -18,6 +18,10 @@ export default {
type: null, type: null,
default: false default: false
}, },
invalid: {
type: Boolean,
default: false
},
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false

View file

@ -105,6 +105,11 @@ export interface InputSwitchProps {
* @defaultValue false * @defaultValue false
*/ */
falseValue?: any; falseValue?: any;
/**
* When present, it specifies that the component should have invalid state style.
* @defaultValue false
*/
invalid?: boolean | undefined;
/** /**
* When present, it specifies that the component should be disabled. * When present, it specifies that the component should be disabled.
* @defaultValue false * @defaultValue false

View file

@ -37,7 +37,8 @@ const classes = {
'p-inputswitch p-component', 'p-inputswitch p-component',
{ {
'p-highlight': instance.checked, 'p-highlight': instance.checked,
'p-disabled': props.disabled 'p-disabled': props.disabled,
'p-invalid': props.invalid
} }
], ],
input: 'p-inputswitch-input', input: 'p-inputswitch-input',

View file

@ -10,6 +10,10 @@ export default {
size: { size: {
type: String, type: String,
default: null default: null
},
invalid: {
type: Boolean,
default: false
} }
}, },
style: InputTextStyle, style: InputTextStyle,

View file

@ -91,6 +91,11 @@ export interface InputTextProps extends InputHTMLAttributes {
* Defines the size of the component. * Defines the size of the component.
*/ */
size?: 'small' | 'large' | undefined; size?: 'small' | 'large' | undefined;
/**
* When present, it specifies that the component should have invalid state style.
* @defaultValue false
*/
invalid?: boolean | undefined;
/** /**
* Used to pass attributes to DOM elements inside the component. * Used to pass attributes to DOM elements inside the component.
* @type {InputTextPassThroughOptions} * @type {InputTextPassThroughOptions}

View file

@ -6,7 +6,8 @@ const classes = {
{ {
'p-filled': instance.filled, 'p-filled': instance.filled,
'p-inputtext-sm': props.size === 'small', 'p-inputtext-sm': props.size === 'small',
'p-inputtext-lg': props.size === 'large' 'p-inputtext-lg': props.size === 'large',
'p-invalid': props.invalid
} }
] ]
}; };

View file

@ -14,6 +14,10 @@ export default {
optionGroupLabel: null, optionGroupLabel: null,
optionGroupChildren: null, optionGroupChildren: null,
listStyle: null, listStyle: null,
invalid: {
type: Boolean,
default: false
},
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false

View file

@ -240,6 +240,11 @@ export interface ListboxProps {
* Inline style of inner list element. * Inline style of inner list element.
*/ */
listStyle?: string | undefined; listStyle?: string | undefined;
/**
* When present, it specifies that the component should have invalid state style.
* @defaultValue false
*/
invalid?: boolean | undefined;
/** /**
* When specified, disables the component. * When specified, disables the component.
* @defaultValue false * @defaultValue false

View file

@ -42,7 +42,8 @@ const classes = {
root: ({ instance, props }) => [ root: ({ instance, props }) => [
'p-listbox p-component', 'p-listbox p-component',
{ {
'p-disabled': props.disabled 'p-disabled': props.disabled,
'p-invalid': props.invalid
} }
], ],
header: 'p-listbox-header', header: 'p-listbox-header',

View file

@ -18,6 +18,10 @@ export default {
default: '200px' default: '200px'
}, },
placeholder: String, placeholder: String,
invalid: {
type: Boolean,
default: false
},
disabled: Boolean, disabled: Boolean,
inputId: { inputId: {
type: String, type: String,

View file

@ -331,6 +331,11 @@ export interface MultiSelectProps {
* Label to display when there are no selections. * Label to display when there are no selections.
*/ */
placeholder?: string | undefined; placeholder?: string | undefined;
/**
* When present, it specifies that the component should have invalid state style.
* @defaultValue false
*/
invalid?: boolean | undefined;
/** /**
* When present, it specifies that the component should be disabled. * When present, it specifies that the component should be disabled.
* @defaultValue false * @defaultValue false

View file

@ -120,6 +120,7 @@ const classes = {
{ {
'p-multiselect-chip': props.display === 'chip', 'p-multiselect-chip': props.display === 'chip',
'p-disabled': props.disabled, 'p-disabled': props.disabled,
'p-invalid': props.invalid,
'p-focus': instance.focused, 'p-focus': instance.focused,
'p-inputwrapper-filled': props.modelValue && props.modelValue.length, 'p-inputwrapper-filled': props.modelValue && props.modelValue.length,
'p-inputwrapper-focus': instance.focused || instance.overlayVisible, 'p-inputwrapper-focus': instance.focused || instance.overlayVisible,

View file

@ -51,6 +51,10 @@ export default {
type: String, type: String,
default: undefined default: undefined
}, },
invalid: {
type: Boolean,
default: false
},
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false

View file

@ -221,6 +221,11 @@ export interface PasswordProps extends InputHTMLAttributes {
* @deprecated since v3.27.0. Use 'showicon' slot. * @deprecated since v3.27.0. Use 'showicon' slot.
*/ */
showIcon?: string | undefined; showIcon?: string | undefined;
/**
* When present, it specifies that the component should have invalid state style.
* @defaultValue false
*/
invalid?: boolean | undefined;
/** /**
* When present, it specifies that the component should be disabled. * When present, it specifies that the component should be disabled.
* @defaultValue false * @defaultValue false

View file

@ -41,7 +41,8 @@ const classes = {
{ {
'p-inputwrapper-filled': instance.filled, 'p-inputwrapper-filled': instance.filled,
'p-inputwrapper-focus': instance.focused, 'p-inputwrapper-focus': instance.focused,
'p-input-icon-right': props.toggleMask 'p-input-icon-right': props.toggleMask,
'p-invalid': props.invalid
} }
], ],
input: ({ props }) => [ input: ({ props }) => [

View file

@ -13,6 +13,10 @@ export default {
type: String, type: String,
default: null default: null
}, },
invalid: {
type: Boolean,
default: false
},
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false

View file

@ -110,6 +110,11 @@ export interface RadioButtonProps {
* @default false * @default false
*/ */
binary?: boolean; binary?: boolean;
/**
* When present, it specifies that the component should have invalid state style.
* @defaultValue false
*/
invalid?: boolean | undefined;
/** /**
* When present, it specifies that the component should be disabled. * When present, it specifies that the component should be disabled.
* @defaultValue false * @defaultValue false

View file

@ -39,7 +39,8 @@ const classes = {
'p-radiobutton p-component', 'p-radiobutton p-component',
{ {
'p-highlight': instance.checked, 'p-highlight': instance.checked,
'p-disabled': props.disabled 'p-disabled': props.disabled,
'p-invalid': props.invalid
} }
], ],
box: 'p-radiobutton-box', box: 'p-radiobutton-box',

View file

@ -20,6 +20,10 @@ export default {
type: Boolean, type: Boolean,
default: true default: true
}, },
invalid: {
type: Boolean,
default: false
},
disabled: Boolean, disabled: Boolean,
dataKey: null, dataKey: null,
ariaLabelledby: { ariaLabelledby: {

View file

@ -153,6 +153,11 @@ export interface SelectButtonProps {
* @defaultValue false * @defaultValue false
*/ */
multiple?: boolean | undefined; multiple?: boolean | undefined;
/**
* When present, it specifies that the component should have invalid state style.
* @defaultValue false
*/
invalid?: boolean | undefined;
/** /**
* When present, it specifies that the element should be disabled. * When present, it specifies that the element should be disabled.
* @defaultValue false * @defaultValue false

View file

@ -1,7 +1,13 @@
import BaseStyle from 'primevue/base/style'; import BaseStyle from 'primevue/base/style';
const classes = { const classes = {
root: ({ props }) => ['p-selectbutton p-buttonset p-component', { 'p-disabled': props.disabled }], root: ({ props }) => [
'p-selectbutton p-buttonset p-component',
{
'p-disabled': props.disabled,
'p-invalid': props.invalid
}
],
button: ({ instance, option }) => [ button: ({ instance, option }) => [
'p-button p-component', 'p-button p-component',
{ {

View file

@ -7,7 +7,11 @@ export default {
extends: BaseComponent, extends: BaseComponent,
props: { props: {
modelValue: null, modelValue: null,
autoResize: Boolean autoResize: Boolean,
invalid: {
type: Boolean,
default: false
}
}, },
style: TextareaStyle, style: TextareaStyle,
provide() { provide() {

View file

@ -97,6 +97,11 @@ export interface TextareaProps extends TextareaHTMLAttributes {
* @defaultValue false * @defaultValue false
*/ */
autoResize?: boolean | undefined; autoResize?: boolean | undefined;
/**
* When present, it specifies that the component should have invalid state style.
* @defaultValue false
*/
invalid?: boolean | undefined;
/** /**
* Used to pass attributes to DOM elements inside the component. * Used to pass attributes to DOM elements inside the component.
* @type {TextareaPassThroughOptions} * @type {TextareaPassThroughOptions}

View file

@ -18,7 +18,8 @@ const classes = {
'p-inputtextarea p-inputtext p-component', 'p-inputtextarea p-inputtext p-component',
{ {
'p-filled': instance.filled, 'p-filled': instance.filled,
'p-inputtextarea-resizable ': props.autoResize 'p-inputtextarea-resizable ': props.autoResize,
'p-invalid': props.invalid
} }
] ]
}; };

View file

@ -21,6 +21,10 @@ export default {
type: String, type: String,
default: 'left' default: 'left'
}, },
invalid: {
type: Boolean,
default: false
},
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false

View file

@ -144,6 +144,11 @@ export interface ToggleButtonProps {
* @defaultValue left * @defaultValue left
*/ */
iconPos?: 'left' | 'right' | undefined; iconPos?: 'left' | 'right' | undefined;
/**
* When present, it specifies that the component should have invalid state style.
* @defaultValue false
*/
invalid?: boolean | undefined;
/** /**
* When present, it specifies that the element should be disabled. * When present, it specifies that the element should be disabled.
* @defaultValue false * @defaultValue false

View file

@ -24,7 +24,8 @@ const classes = {
'p-togglebutton p-component', 'p-togglebutton p-component',
{ {
'p-disabled': props.disabled, 'p-disabled': props.disabled,
'p-highlight': instance.active 'p-highlight': instance.active,
'p-invalid': props.invalid
} }
], ],
input: 'p-togglebutton-input', input: 'p-togglebutton-input',

View file

@ -16,6 +16,10 @@ export default {
type: String, type: String,
default: null default: null
}, },
invalid: {
type: Boolean,
default: false
},
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false

View file

@ -179,6 +179,11 @@ export interface TreeSelectProps {
* Label to display when there are no selections. * Label to display when there are no selections.
*/ */
placeholder?: string | undefined; placeholder?: string | undefined;
/**
* When present, it specifies that the component should have invalid state style.
* @defaultValue false
*/
invalid?: boolean | undefined;
/** /**
* When present, it specifies that the component should be disabled. * When present, it specifies that the component should be disabled.
* @defaultValue false * @defaultValue false

View file

@ -65,6 +65,7 @@ const classes = {
{ {
'p-treeselect-chip': props.display === 'chip', 'p-treeselect-chip': props.display === 'chip',
'p-disabled': props.disabled, 'p-disabled': props.disabled,
'p-invalid': props.invalid,
'p-focus': instance.focused, 'p-focus': instance.focused,
'p-inputwrapper-filled': !instance.emptyValue, 'p-inputwrapper-filled': !instance.emptyValue,
'p-inputwrapper-focus': instance.focused || instance.overlayVisible 'p-inputwrapper-focus': instance.focused || instance.overlayVisible

View file

@ -7,6 +7,10 @@ export default {
extends: BaseComponent, extends: BaseComponent,
props: { props: {
modelValue: null, modelValue: null,
invalid: {
type: Boolean,
default: false
},
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false

View file

@ -127,6 +127,11 @@ export interface TriStateCheckboxProps {
* @defaultValue null * @defaultValue null
*/ */
modelValue?: Nullable<boolean>; modelValue?: Nullable<boolean>;
/**
* When present, it specifies that the component should have invalid state style.
* @defaultValue false
*/
invalid?: boolean | undefined;
/** /**
* When present, it specifies that the component should be disabled. * When present, it specifies that the component should be disabled.
* @defaultValue false * @defaultValue false

View file

@ -26,7 +26,8 @@ const classes = {
'p-tristatecheckbox p-checkbox p-component', 'p-tristatecheckbox p-checkbox p-component',
{ {
'p-highlight': instance.active, 'p-highlight': instance.active,
'p-disabled': props.disabled 'p-disabled': props.disabled,
'p-invalid': props.invalid
} }
], ],
box: 'p-checkbox-box', box: 'p-checkbox-box',