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.
1 line
7.9 KiB
1 line
7.9 KiB
{"ast":null,"code":"import '../../../utils/index.mjs';\nimport '../../../constants/index.mjs';\nimport '../../../hooks/index.mjs';\nimport { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';\nimport { isValidComponentSize } from '../../../utils/vue/validator.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 `on` state\n */\n activeActionIcon: {\n type: iconPropType,\n },\n /**\n * @description component of the icon displayed when in `on` state, overrides `active-text`\n */\n activeIcon: {\n type: iconPropType,\n },\n /**\n * @description component of the icon displayed when in `off` state, overrides `inactive-text`\n */\n inactiveIcon: {\n type: iconPropType,\n },\n /**\n * @description text displayed when in `on` state\n */\n activeText: {\n type: String,\n default: '',\n },\n /**\n * @description text displayed when in `off` state\n */\n inactiveText: {\n type: String,\n default: '',\n },\n /**\n * @description switch value when in `on` state\n */\n activeValue: {\n type: [Boolean, String, Number],\n default: true,\n },\n /**\n * @description switch value when in `off` state\n */\n inactiveValue: {\n type: [Boolean, String, Number],\n default: false,\n },\n /**\n * @description input name of Switch\n */\n name: {\n type: String,\n default: '',\n },\n /**\n * @description whether to trigger form validation\n */\n validateEvent: {\n type: Boolean,\n default: true,\n },\n /**\n * @description before-change hook before the switch state changes. If `false` is returned or a `Promise` is returned and then is rejected, will stop switching\n */\n beforeChange: {\n type: definePropType<() => Promise<boolean> | boolean>(Function),\n },\n /**\n * @description id for input\n */\n id: String,\n /**\n * @description tabindex for input\n */\n tabindex: {\n type: [String, Number],\n },\n ...useAriaProps(['ariaLabel']),\n} as const)\n\nexport type SwitchProps = ExtractPropTypes<typeof switchProps>\n\nexport const switchEmits = {\n [UPDATE_MODEL_EVENT]: (val: boolean | string | number) =>\n isBoolean(val) || isString(val) || isNumber(val),\n [CHANGE_EVENT]: (val: boolean | string | number) =>\n isBoolean(val) || isString(val) || isNumber(val),\n [INPUT_EVENT]: (val: boolean | string | number) =>\n isBoolean(val) || isString(val) || isNumber(val),\n}\nexport type SwitchEmits = typeof switchEmits\n\nexport type SwitchInstance = InstanceType<typeof Switch>\n"],"mappings":";;;;;;;;;;AAeY,MAACA,WAAW,GAAGC,UAAU,CAAC;EACpCC,UAAU,EAAE;IACVC,IAAI,EAAE,CAACC,OAAO,EAAEC,MAAM,EAAEC,MAAM,CAAC;IAC/BC,OAAO,EAAE;EACb,CAAG;EACDC,QAAQ,EAAEJ,OAAO;EACjBK,OAAO,EAAEL,OAAO;EAChBM,IAAI,EAAE;IACJP,IAAI,EAAEE,MAAM;IACZM,SAAS,EAAEC;EACf,CAAG;EACDC,KAAK,EAAE;IACLV,IAAI,EAAE,CAACE,MAAM,EAAEC,MAAM,CAAC;IACtBC,OAAO,EAAE;EACb,CAAG;EACDO,YAAY,EAAEV,O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