Refactor #2801 - Checkbox
parent
b774bf282f
commit
14cb8073a8
|
@ -18,16 +18,28 @@ const CheckboxProps = [
|
||||||
description: "Allows to select a boolean value instead of multiple values."
|
description: "Allows to select a boolean value instead of multiple values."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "class",
|
name: "disabled",
|
||||||
type: "string",
|
type: "boolean",
|
||||||
default: "null",
|
default: "false",
|
||||||
description: "Style class of the component."
|
description: "When present, it specifies that the element should be disabled."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "style",
|
name: "readonly",
|
||||||
type: "any",
|
type: "boolean",
|
||||||
|
default: "false",
|
||||||
|
description: "When present, it specifies that an input field is read-only."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "required",
|
||||||
|
type: "boolean",
|
||||||
|
default: "false",
|
||||||
|
description: "When present, it specifies that the element is required."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "tabindex",
|
||||||
|
type: "number",
|
||||||
default: "null",
|
default: "null",
|
||||||
description: "Inline of the component."
|
description: "Index of the element in tabbing order."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "trueValue",
|
name: "trueValue",
|
||||||
|
@ -40,6 +52,24 @@ const CheckboxProps = [
|
||||||
type: "any",
|
type: "any",
|
||||||
default: "null",
|
default: "null",
|
||||||
description: "Value in unchecked state."
|
description: "Value in unchecked state."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "inputId",
|
||||||
|
type: "string",
|
||||||
|
default: "null",
|
||||||
|
description: "Identifier of the underlying input element."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "inputClass",
|
||||||
|
type: "any",
|
||||||
|
default: "null",
|
||||||
|
description: "Style class of the input field."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "inputStyle",
|
||||||
|
type: "any",
|
||||||
|
default: "null",
|
||||||
|
description: "Inline style of the input field."
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -9,18 +9,30 @@ export interface CheckboxProps {
|
||||||
* Value binding of the checkbox.
|
* Value binding of the checkbox.
|
||||||
*/
|
*/
|
||||||
modelValue?: any;
|
modelValue?: any;
|
||||||
|
/**
|
||||||
|
* Name of the input element.
|
||||||
|
*/
|
||||||
|
name?: string | undefined;
|
||||||
/**
|
/**
|
||||||
* Allows to select a boolean value instead of multiple values.
|
* Allows to select a boolean value instead of multiple values.
|
||||||
*/
|
*/
|
||||||
binary?: boolean;
|
binary?: boolean;
|
||||||
/**
|
/**
|
||||||
* Style class of the component input field.
|
* When present, it specifies that the element should be disabled.
|
||||||
*/
|
*/
|
||||||
class?: any;
|
disabled?: boolean | undefined;
|
||||||
/**
|
/**
|
||||||
* Inline style of the component.
|
* When present, it specifies that an input field is read-only.
|
||||||
*/
|
*/
|
||||||
style?: any;
|
readonly?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* When present, it specifies that the element is required.
|
||||||
|
*/
|
||||||
|
required?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* Index of the element in tabbing order.
|
||||||
|
*/
|
||||||
|
tabindex?: number | undefined;
|
||||||
/**
|
/**
|
||||||
* Value in checked state.
|
* Value in checked state.
|
||||||
*/
|
*/
|
||||||
|
@ -29,6 +41,22 @@ export interface CheckboxProps {
|
||||||
* Value in unchecked state.
|
* Value in unchecked state.
|
||||||
*/
|
*/
|
||||||
falseValue?: any;
|
falseValue?: any;
|
||||||
|
/**
|
||||||
|
* Identifier of the underlying input element.
|
||||||
|
*/
|
||||||
|
inputId?: string | undefined;
|
||||||
|
/**
|
||||||
|
* Style class of the input field.
|
||||||
|
*/
|
||||||
|
inputClass?: any | undefined;
|
||||||
|
/**
|
||||||
|
* Inline style of the input field.
|
||||||
|
*/
|
||||||
|
inputStyle?: any | undefined;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
inputProps?: object | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CheckboxSlots {
|
export interface CheckboxSlots {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div :class="containerClass" @click="onClick($event)">
|
<div :class="containerClass" @click="onClick($event)">
|
||||||
<div class="p-hidden-accessible">
|
<div class="p-hidden-accessible">
|
||||||
<input :id="inputId" ref="input" type="checkbox" :value="value" :name="name" :checked="checked" :tabindex="tabindex" :disabled="disabled" :readonly="readonly" :required="required" :aria-labelledby="ariaLabelledby" :aria-label="ariaLabel"
|
<input :id="inputId" ref="input" type="checkbox" :value="value" :class="inputClass" :style="inputStyle" :name="name" :checked="checked" :tabindex="tabindex" :disabled="disabled" :readonly="readonly" :required="required" :aria-labelledby="ariaLabelledby" :aria-label="ariaLabel"
|
||||||
@focus="onFocus($event)" @blur="onBlur($event)" v-bind="inputProps">
|
@focus="onFocus($event)" @blur="onBlur($event)" v-bind="inputProps">
|
||||||
</div>
|
</div>
|
||||||
<div ref="box" :class="['p-checkbox-box', {'p-highlight': checked, 'p-disabled': disabled, 'p-focus': focused}]">
|
<div ref="box" :class="['p-checkbox-box', {'p-highlight': checked, 'p-disabled': disabled, 'p-focus': focused}]">
|
||||||
|
@ -44,12 +44,14 @@ export default {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
inputId: null,
|
|
||||||
inputProps: null,
|
|
||||||
tabindex: {
|
tabindex: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null
|
default: null
|
||||||
},
|
},
|
||||||
|
inputId: null,
|
||||||
|
inputClass: null,
|
||||||
|
inputStyle: null,
|
||||||
|
inputProps: null,
|
||||||
'aria-labelledby': {
|
'aria-labelledby': {
|
||||||
type: String,
|
type: String,
|
||||||
default: null
|
default: null
|
||||||
|
|
|
@ -69,24 +69,18 @@ export default {
|
||||||
<td>null</td>
|
<td>null</td>
|
||||||
<td>Value binding of the checkbox.</td>
|
<td>Value binding of the checkbox.</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>name</td>
|
||||||
|
<td>string</td>
|
||||||
|
<td>null</td>
|
||||||
|
<td>Name of the input element.</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>binary</td>
|
<td>binary</td>
|
||||||
<td>boolean</td>
|
<td>boolean</td>
|
||||||
<td>false</td>
|
<td>false</td>
|
||||||
<td>Allows to select a boolean value instead of multiple values.</td>
|
<td>Allows to select a boolean value instead of multiple values.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td>style</td>
|
|
||||||
<td>any</td>
|
|
||||||
<td>null</td>
|
|
||||||
<td>Style class of the component input field.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>class</td>
|
|
||||||
<td>string</td>
|
|
||||||
<td>null</td>
|
|
||||||
<td>Inline style of the component.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>trueValue</td>
|
<td>trueValue</td>
|
||||||
<td>any</td>
|
<td>any</td>
|
||||||
|
@ -98,6 +92,54 @@ export default {
|
||||||
<td>any</td>
|
<td>any</td>
|
||||||
<td>null</td>
|
<td>null</td>
|
||||||
<td>Value in unchecked state.</td>
|
<td>Value in unchecked state.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>disabled</td>
|
||||||
|
<td>boolean</td>
|
||||||
|
<td>false</td>
|
||||||
|
<td>When present, it specifies that the element should be disabled.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>readonly</td>
|
||||||
|
<td>boolean</td>
|
||||||
|
<td>false</td>
|
||||||
|
<td>When present, it specifies that an input field is read-only.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>required</td>
|
||||||
|
<td>boolean</td>
|
||||||
|
<td>false</td>
|
||||||
|
<td>When present, it specifies that the element is required.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>tabindex</td>
|
||||||
|
<td>number</td>
|
||||||
|
<td>null</td>
|
||||||
|
<td>Index of the element in tabbing order.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>inputId</td>
|
||||||
|
<td>string</td>
|
||||||
|
<td>null</td>
|
||||||
|
<td>Identifier of the underlying input element.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>inputClass</td>
|
||||||
|
<td>any</td>
|
||||||
|
<td>null</td>
|
||||||
|
<td>Style class of the input field.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>inputStyle</td>
|
||||||
|
<td>any</td>
|
||||||
|
<td>null</td>
|
||||||
|
<td>Inline style of the input field.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>inputProps</td>
|
||||||
|
<td>object</td>
|
||||||
|
<td>null</td>
|
||||||
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in New Issue