element-plus
Version:
A Component Library for Vue 3
1 lines • 7.47 kB
Source Map (JSON)
{"version":3,"file":"checkbox.mjs","sources":["../../../../../../packages/components/checkbox/src/checkbox.ts"],"sourcesContent":["import { UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { AriaProps, 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 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 * @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"],"names":[],"mappings":";;;;;;AAoFO,MAAM,aAAA,GAAgB;AAAA;AAAA;AAAA;AAAA,EAI3B,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,CAAC,MAAA,EAAQ,MAAA,EAAQ,OAAO,CAAA;AAAA,IAC9B,OAAA,EAAS;AAAA,GACX;AAAA;AAAA;AAAA;AAAA,EAIA,KAAA,EAAO;AAAA,IACL,IAAA,EAAM,CAAC,MAAA,EAAQ,OAAA,EAAS,QAAQ,MAAM,CAAA;AAAA,IACtC,OAAA,EAAS;AAAA,GACX;AAAA;AAAA;AAAA;AAAA,EAIA,KAAA,EAAO;AAAA,IACL,IAAA,EAAM,CAAC,MAAA,EAAQ,OAAA,EAAS,QAAQ,MAAM,CAAA;AAAA,IACtC,OAAA,EAAS;AAAA,GACX;AAAA;AAAA;AAAA;AAAA,EAIA,aAAA,EAAe,OAAA;AAAA;AAAA;AAAA;AAAA,EAIf,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA;AAAA;AAAA;AAAA,EAIA,OAAA,EAAS,OAAA;AAAA;AAAA;AAAA;AAAA,EAIT,IAAA,EAAM;AAAA,IACJ,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA;AAAA;AAAA;AAAA,EAIA,SAAA,EAAW;AAAA,IACT,IAAA,EAAM,CAAC,MAAA,EAAQ,MAAM,CAAA;AAAA,IACrB,OAAA,EAAS;AAAA,GACX;AAAA;AAAA;AAAA;AAAA,EAIA,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,CAAC,MAAA,EAAQ,MAAM,CAAA;AAAA,IACrB,OAAA,EAAS;AAAA,GAC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