UNPKG

element-plus

Version:

A Component Library for Vue 3

1 lines 4.78 kB
{"version":3,"file":"checkbox-group.mjs","names":[],"sources":["../../../../../../packages/components/checkbox/src/checkbox-group.ts"],"sourcesContent":["import { UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { useAriaProps, useSizeProp } from '@element-plus/hooks'\nimport { buildProps, definePropType, isArray } from '@element-plus/utils'\n\nimport type { ExtractPublicPropTypes } from 'vue'\nimport type checkboxGroup from './checkbox-group.vue'\nimport type { CheckboxProps, CheckboxValueType } from './checkbox'\nimport type { ComponentSize } from '@element-plus/constants'\nimport type { AriaProps } from '@element-plus/hooks'\n\nexport type CheckboxGroupValueType = Exclude<CheckboxValueType, boolean>[]\n\nexport interface CheckboxGroupProps extends Pick<AriaProps, 'ariaLabel'> {\n /**\n * @description binding value\n */\n modelValue?: CheckboxGroupValueType\n /**\n * @description whether the nesting checkboxes are disabled\n */\n disabled?: boolean\n /**\n * @description minimum number of checkbox checked\n */\n min?: number\n /**\n * @description maximum number of checkbox checked\n */\n max?: number\n /**\n * @description size of checkbox\n */\n size?: ComponentSize\n /**\n * @description border and background color when button is active\n */\n fill?: string\n /**\n * @description font color when button is active\n */\n textColor?: string\n /**\n * @description element tag of the checkbox group\n */\n tag?: string\n /**\n * @description whether to trigger form validation\n */\n validateEvent?: boolean\n /**\n * @description data of the options, the key of `value` and `label` and `disabled` can be customize by `props`\n */\n options?: CheckboxOption[]\n /**\n * @description configuration options\n */\n props?: CheckboxOptionProps\n /**\n * @description component type to render options (e.g. `'button'`)\n */\n type?: 'checkbox' | 'button'\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `CheckboxGroupProps` instead.\n */\nexport const checkboxGroupProps = buildProps({\n /**\n * @description binding value\n */\n modelValue: {\n type: definePropType<CheckboxGroupValueType>(Array),\n default: () => [],\n },\n /**\n * @description whether the nesting checkboxes are disabled\n */\n disabled: {\n type: Boolean,\n default: undefined,\n },\n /**\n * @description minimum number of checkbox checked\n */\n min: Number,\n /**\n * @description maximum number of checkbox checked\n */\n max: Number,\n /**\n * @description size of checkbox\n */\n size: useSizeProp,\n /**\n * @description border and background color when button is active\n */\n fill: String,\n /**\n * @description font color when button is active\n */\n textColor: String,\n /**\n * @description element tag of the checkbox group\n */\n tag: {\n type: String,\n default: 'div',\n },\n /**\n * @description whether to trigger form validation\n */\n validateEvent: {\n type: Boolean,\n default: true,\n },\n options: {\n type: definePropType<CheckboxOption[]>(Array),\n },\n props: {\n type: definePropType<CheckboxOptionProps>(Object),\n default: () => checkboxDefaultProps,\n },\n type: {\n type: String,\n values: ['checkbox', 'button'] as const,\n default: 'checkbox',\n },\n ...useAriaProps(['ariaLabel']),\n} as const)\n\nexport const checkboxGroupEmits = {\n [UPDATE_MODEL_EVENT]: (val: CheckboxGroupValueType) => isArray(val),\n change: (val: CheckboxValueType[]) => isArray(val),\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `CheckboxGroupProps` instead.\n */\nexport type CheckboxGroupPropsPublic = ExtractPublicPropTypes<\n typeof checkboxGroupProps\n>\nexport type CheckboxGroupEmits = typeof checkboxGroupEmits\nexport type CheckboxGroupInstance = InstanceType<typeof checkboxGroup> & unknown\n\nexport type CheckboxOption = CheckboxProps & Record<string, any>\n\ntype CheckboxOptionProps = {\n value?: string\n label?: string\n disabled?: string\n}\nexport const checkboxDefaultProps: Required<CheckboxOptionProps> = {\n label: 'label',\n value: 'value',\n disabled: 'disabled',\n}\n"],"mappings":";;;;;;;;;;AAkEA,MAAa,qBAAqB,WAAW;CAI3C,YAAY;EACV,MAAM,eAAuC,MAAM;EACnD,eAAe,EAAE;EAClB;CAID,UAAU;EACR,MAAM;EACN,SAAS;EACV;CAID,KAAK;CAIL,KAAK;CAIL,MAAM;CAIN,MAAM;CAIN,WAAW;CAIX,KAAK;EACH,MAAM;EACN,SAAS;EACV;CAID,eAAe;EACb,MAAM;EACN,SAAS;EACV;CACD,SAAS,EACP,MAAM,eAAiC,MAAM,EAC9C;CACD,OAAO;EACL,MAAM,eAAoC,OAAO;EACjD,eAAe;EAChB;CACD,MAAM;EACJ,MAAM;EACN,QAAQ,CAAC,YAAY,SAAS;EAC9B,SAAS;EACV;CACD,GAAG,aAAa,CAAC,YAAY,CAAC;CAC/B,CAAU;AAEX,MAAa,qBAAqB;EAC/B,sBAAsB,QAAgC,QAAQ,IAAI;CACnE,SAAS,QAA6B,QAAQ,IAAI;CACnD;AAkBD,MAAa,uBAAsD;CACjE,OAAO;CACP,OAAO;CACP,UAAU;CACX"}