element-plus
Version:
A Component Library for Vue 3
1 lines • 5.39 kB
Source Map (JSON)
{"version":3,"file":"checkbox-group.mjs","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 * @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"],"names":[],"mappings":";;;;;;AAiEO,MAAM,qBAAqB,UAAA,CAAW;AAAA;AAAA;AAAA;AAAA,EAI3C,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,eAAuC,KAAK,CAAA;AAAA,IAClD,OAAA,EAAS,MAAM;AAAC,GAClB;AAAA;AAAA;AAAA;AAAA,EAIA,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA;AAAA;AAAA;AAAA,EAIA,GAAA,EAAK,MAAA;AAAA;AA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