element-plus
Version:
A Component Library for Vue 3
1 lines • 6.4 kB
Source Map (JSON)
{"version":3,"file":"checkbox.mjs","names":[],"sources":["../../../../../../packages/components/checkbox/src/checkbox.ts"],"sourcesContent":["import { UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { useAriaProps, useSizeProp } from '@element-plus/hooks'\nimport { isBoolean, isNumber, isString } from '@element-plus/utils'\n\nimport type { ExtractPublicPropTypes } from 'vue'\nimport type { ComponentSize } from '@element-plus/constants'\nimport type { AriaProps } from '@element-plus/hooks'\nimport type Checkbox from './checkbox.vue'\n\nexport type CheckboxValueType = string | number | boolean\n\nexport interface CheckboxProps extends Pick<\n AriaProps,\n 'ariaLabel' | 'ariaControls'\n> {\n /**\n * @description binding value\n */\n modelValue?: number | string | boolean\n /**\n * @description label of the Checkbox when used inside a `checkbox-group`\n */\n label?: string | boolean | number | object\n /**\n * @description value of the Checkbox when used inside a `checkbox-group`\n */\n value?: string | boolean | number | object\n /**\n * @description Set indeterminate state, only responsible for style control\n */\n indeterminate?: boolean\n /**\n * @description whether the Checkbox is disabled\n */\n disabled?: boolean\n /**\n * @description if the Checkbox is checked\n */\n checked?: boolean\n /**\n * @description native 'name' attribute\n */\n name?: string\n /**\n * @description value of the Checkbox if it's checked\n */\n trueValue?: string | number\n /**\n * @description value of the Checkbox if it's not checked\n */\n falseValue?: string | number\n /**\n * @deprecated use `trueValue` instead\n * @description value of the Checkbox if it's checked\n */\n trueLabel?: string | number\n /**\n * @deprecated use `falseValue` instead\n * @description value of the Checkbox if it's not checked\n */\n falseLabel?: string | number\n /**\n * @description input id\n */\n id?: string\n /**\n * @description whether to add a border around Checkbox\n */\n border?: boolean\n /**\n * @description size of the Checkbox\n */\n size?: ComponentSize\n /**\n * @description input tabindex\n */\n tabindex?: string | number\n /**\n * @description whether to trigger form validation\n */\n validateEvent?: boolean\n}\n/**\n * @deprecated Removed after 3.0.0, Use `CheckboxProps` instead.\n */\nexport const checkboxProps = {\n /**\n * @description binding value\n */\n modelValue: {\n type: [Number, String, Boolean],\n default: undefined,\n },\n /**\n * @description label of the Checkbox when used inside a `checkbox-group`\n */\n label: {\n type: [String, Boolean, Number, Object],\n default: undefined,\n },\n /**\n * @description value of the Checkbox when used inside a `checkbox-group`\n */\n value: {\n type: [String, Boolean, Number, Object],\n default: undefined,\n },\n /**\n * @description Set indeterminate state, only responsible for style control\n */\n indeterminate: Boolean,\n /**\n * @description whether the Checkbox is disabled\n */\n disabled: {\n type: Boolean,\n default: undefined,\n },\n /**\n * @description if the Checkbox is checked\n */\n checked: Boolean,\n /**\n * @description native 'name' attribute\n */\n name: {\n type: String,\n default: undefined,\n },\n /**\n * @description value of the Checkbox if it's checked\n */\n trueValue: {\n type: [String, Number],\n default: undefined,\n },\n /**\n * @description value of the Checkbox if it's not checked\n */\n falseValue: {\n type: [String, Number],\n default: undefined,\n },\n /**\n * @deprecated use `trueValue` instead\n * @description value of the Checkbox if it's checked\n */\n trueLabel: {\n type: [String, Number],\n default: undefined,\n },\n /**\n * @deprecated use `falseValue` instead\n * @description value of the Checkbox if it's not checked\n */\n falseLabel: {\n type: [String, Number],\n default: undefined,\n },\n /**\n * @description input id\n */\n id: {\n type: String,\n default: undefined,\n },\n /**\n * @description whether to add a border around Checkbox\n */\n border: Boolean,\n /**\n * @description size of the Checkbox\n */\n size: useSizeProp,\n /**\n * @description input tabindex\n */\n tabindex: [String, Number],\n /**\n * @description whether to trigger form validation\n */\n validateEvent: {\n type: Boolean,\n default: true,\n },\n ariaLabel: String,\n ...useAriaProps(['ariaControls']),\n}\n\nexport const checkboxEmits = {\n [UPDATE_MODEL_EVENT]: (val: CheckboxValueType) =>\n isString(val) || isNumber(val) || isBoolean(val),\n change: (val: CheckboxValueType) =>\n isString(val) || isNumber(val) || isBoolean(val),\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `CheckboxProps` instead.\n */\nexport type CheckboxPropsPublic = ExtractPublicPropTypes<typeof checkboxProps>\nexport type CheckboxEmits = typeof checkboxEmits\nexport type CheckboxInstance = InstanceType<typeof Checkbox> & unknown\n\nexport const checkboxPropsDefaults = {\n modelValue: undefined,\n label: undefined,\n value: undefined,\n disabled: undefined,\n name: undefined,\n trueValue: undefined,\n falseValue: undefined,\n trueLabel: undefined,\n falseLabel: undefined,\n id: undefined,\n validateEvent: true,\n} as const\n"],"mappings":";;;;;;;;;AAqFA,MAAa,gBAAgB;CAI3B,YAAY;EACV,MAAM;GAAC;GAAQ;GAAQ;GAAQ;EAC/B,SAAS;EACV;CAID,OAAO;EACL,MAAM;GAAC;GAAQ;GAAS;GAAQ;GAAO;EACvC,SAAS;EACV;CAID,OAAO;EACL,MAAM;GAAC;GAAQ;GAAS;GAAQ;GAAO;EACvC,SAAS;EACV;CAID,eAAe;CAIf,UAAU;EACR,MAAM;EACN,SAAS;EACV;CAID,SAAS;CAIT,MAAM;EACJ,MAAM;EACN,SAAS;EACV;CAID,WAAW;EACT,MAAM,CAAC,QAAQ,OAAO;EACtB,SAAS;EACV;CAID,YAAY;EACV,MAAM,CAAC,QAAQ,OAAO;EACtB,SAAS;EACV;CAKD,WAAW;EACT,MAAM,CAAC,QAAQ,OAAO;EACtB,SAAS;EACV;CAKD,YAAY;EACV,MAAM,CAAC,QAAQ,OAAO;EACtB,SAAS;EACV;CAID,IAAI;EACF,MAAM;EACN,SAAS;EACV;CAID,QAAQ;CAIR,MAAM;CAIN,UAAU,CAAC,QAAQ,OAAO;CAI1B,eAAe;EACb,MAAM;EACN,SAAS;EACV;CACD,WAAW;CACX,GAAG,aAAa,CAAC,eAAe,CAAC;CAClC;AAED,MAAa,gBAAgB;EAC1B,sBAAsB,QACrB,SAAS,IAAI,IAAI,SAAS,IAAI,IAAI,UAAU,IAAI;CAClD,SAAS,QACP,SAAS,IAAI,IAAI,SAAS,IAAI,IAAI,UAAU,IAAI;CACnD;AASD,MAAa,wBAAwB;CACnC,YAAY;CACZ,OAAO;CACP,OAAO;CACP,UAAU;CACV,MAAM;CACN,WAAW;CACX,YAAY;CACZ,WAAW;CACX,YAAY;CACZ,IAAI;CACJ,eAAe;CAChB"}