You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

0 lines
7.8 KiB

1 month ago
  1. {"ast":null,"code":"import { isValidComponentSize } from '../../../utils/vue/validator.mjs';\nimport { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';\nimport { iconPropType } from '../../../utils/vue/icon.mjs';\nimport { useAriaProps } from '../../../hooks/use-aria/index.mjs';\nimport { UPDATE_MODEL_EVENT, CHANGE_EVENT, INPUT_EVENT } from '../../../constants/event.mjs';\nimport { isBoolean, isNumber } from '../../../utils/types.mjs';\nimport { isString } from '@vue/shared';\nconst switchProps = buildProps({\n modelValue: {\n type: [Boolean, String, Number],\n default: false\n },\n disabled: Boolean,\n loading: Boolean,\n size: {\n type: String,\n validator: isValidComponentSize\n },\n width: {\n type: [String, Number],\n default: \"\"\n },\n inlinePrompt: Boolean,\n inactiveActionIcon: {\n type: iconPropType\n },\n activeActionIcon: {\n type: iconPropType\n },\n activeIcon: {\n type: iconPropType\n },\n inactiveIcon: {\n type: iconPropType\n },\n activeText: {\n type: String,\n default: \"\"\n },\n inactiveText: {\n type: String,\n default: \"\"\n },\n activeValue: {\n type: [Boolean, String, Number],\n default: true\n },\n inactiveValue: {\n type: [Boolean, String, Number],\n default: false\n },\n name: {\n type: String,\n default: \"\"\n },\n validateEvent: {\n type: Boolean,\n default: true\n },\n beforeChange: {\n type: definePropType(Function)\n },\n id: String,\n tabindex: {\n type: [String, Number]\n },\n ...useAriaProps([\"ariaLabel\"])\n});\nconst switchEmits = {\n [UPDATE_MODEL_EVENT]: val => isBoolean(val) || isString(val) || isNumber(val),\n [CHANGE_EVENT]: val => isBoolean(val) || isString(val) || isNumber(val),\n [INPUT_EVENT]: val => isBoolean(val) || isString(val) || isNumber(val)\n};\nexport { switchEmits, switchProps };","map":{"version":3,"names":["switchProps","buildProps","modelValue","type","Boolean","String","Number","default","disabled","loading","size","validator","isValidComponentSize","width","inlinePrompt","inactiveActionIcon","iconPropType","activeActionIcon","activeIcon","inactiveIcon","activeText","inactiveText","activeValue","inactiveValue","name","validateEvent","beforeChange","definePropType","Function","id","tabindex","useAriaProps","switchEmits","UPDATE_MODEL_EVENT","val","isBoolean","isString","isNumber","CHANGE_EVENT","INPUT_EVENT"],"sources":["../../../../../../packages/components/switch/src/switch.ts"],"sourcesContent":["import {\n buildProps,\n definePropType,\n iconPropType,\n isBoolean,\n isNumber,\n isString,\n isValidComponentSize,\n} from '@element-plus/utils'\nimport {\n CHANGE_EVENT,\n INPUT_EVENT,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { useAriaProps } from '@element-plus/hooks'\nimport type { ComponentSize } from '@element-plus/constants'\nimport type Switch from './switch.vue'\nimport type { ExtractPropTypes, PropType } from 'vue'\n\nexport const switchProps = buildProps({\n /**\n * @description binding value, it should be equivalent to either `active-value` or `inactive-value`, by default it's `boolean` type\n */\n modelValue: {\n type: [Boolean, String, Number],\n default: false,\n },\n /**\n * @description whether Switch is disabled\n */\n disabled: Boolean,\n /**\n * @description whether Switch is in loading state\n */\n loading: Boolean,\n /**\n * @description size of Switch\n */\n size: {\n type: String as PropType<ComponentSize>,\n validator: isValidComponentSize,\n },\n /**\n * @description width of Switch\n */\n width: {\n type: [String, Number],\n default: '',\n },\n /**\n * @description whether icon or text is displayed inside dot, only the first character will be rendered for text\n */\n inlinePrompt: Boolean,\n /**\n * @description component of the icon displayed in action when in `off` state\n */\n inactiveActionIcon: {\n type: iconPropType,\n },\n /**\n * @description component of the icon displayed in action when in