UNPKG

element-plus

Version:

A Component Library for Vue 3

1 lines 4.87 kB
{"version":3,"file":"checkbox.mjs","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 { ExtractPropTypes, ExtractPublicPropTypes } from 'vue'\nimport type Checkbox from './checkbox.vue'\n\nexport type CheckboxValueType = string | number | boolean\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\nexport type CheckboxProps = ExtractPropTypes<typeof checkboxProps>\nexport type CheckboxPropsPublic = ExtractPublicPropTypes<typeof checkboxProps>\nexport type CheckboxEmits = typeof checkboxEmits\nexport type CheckboxInstance = InstanceType<typeof Checkbox> & unknown\n"],"names":[],"mappings":";;;;;;AASO,MAAM,aAAgB,GAAA;AAAA,EAI3B,UAAY,EAAA;AAAA,IACV,IAAM,EAAA,CAAC,MAAQ,EAAA,MAAA,EAAQ,OAAO,CAAA;AAAA,IAC9B,OAAS,EAAA,KAAA,CAAA;AAAA,GACX;AAAA,EAIA,KAAO,EAAA;AAAA,IACL,IAAM,EAAA,CAAC,MAAQ,EAAA,OAAA,EAAS,QAAQ,MAAM,CAAA;AAAA,IACtC,OAAS,EAAA,KAAA,CAAA;AAAA,GACX;AAAA,EAIA,KAAO,EAAA;AAAA,IACL,IAAM,EAAA,CAAC,MAAQ,EAAA,OAAA,EAAS,QAAQ,MAAM,CAAA;AAAA,IACtC,OAAS,EAAA,KAAA,CAAA;AAAA,GACX;AAAA,EAIA,aAAe,EAAA,OAAA;AAAA,EAIf,QAAU,EAAA;AAAA,IACR,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,KAAA,CAAA;AAAA,GACX;AAAA,EAIA,OAAS,EAAA,OAAA;AAAA,EAIT,IAAM,EAAA;AAAA,IACJ,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,KAAA,CAAA;AAAA,GACX;AAAA,EAIA,SAAW,EAAA;AAAA,IACT,IAAA,EAAM,CAAC,MAAA,EAAQ,MAAM,CAAA;AAAA,IACrB,OAAS,EAAA,KAA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