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
8.1 KiB

1 month ago
  1. {"ast":null,"code":"import { StarFilled, Star } from '@element-plus/icons-vue';\nimport { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';\nimport { mutable } from '../../../utils/typescript.mjs';\nimport { iconPropType } from '../../../utils/vue/icon.mjs';\nimport { useSizeProp } from '../../../hooks/use-size/index.mjs';\nimport { useAriaProps } from '../../../hooks/use-aria/index.mjs';\nimport { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '../../../constants/event.mjs';\nimport { isNumber } from '../../../utils/types.mjs';\nconst rateProps = buildProps({\n modelValue: {\n type: Number,\n default: 0\n },\n id: {\n type: String,\n default: void 0\n },\n lowThreshold: {\n type: Number,\n default: 2\n },\n highThreshold: {\n type: Number,\n default: 4\n },\n max: {\n type: Number,\n default: 5\n },\n colors: {\n type: definePropType([Array, Object]),\n default: () => mutable([\"\", \"\", \"\"])\n },\n voidColor: {\n type: String,\n default: \"\"\n },\n disabledVoidColor: {\n type: String,\n default: \"\"\n },\n icons: {\n type: definePropType([Array, Object]),\n default: () => [StarFilled, StarFilled, StarFilled]\n },\n voidIcon: {\n type: iconPropType,\n default: () => Star\n },\n disabledVoidIcon: {\n type: iconPropType,\n default: () => StarFilled\n },\n disabled: Boolean,\n allowHalf: Boolean,\n showText: Boolean,\n showScore: Boolean,\n textColor: {\n type: String,\n default: \"\"\n },\n texts: {\n type: definePropType(Array),\n default: () => mutable([\"Extremely bad\", \"Disappointed\", \"Fair\", \"Satisfied\", \"Surprise\"])\n },\n scoreTemplate: {\n type: String,\n default: \"{value}\"\n },\n size: useSizeProp,\n clearable: Boolean,\n ...useAriaProps([\"ariaLabel\"])\n});\nconst rateEmits = {\n [CHANGE_EVENT]: value => isNumber(value),\n [UPDATE_MODEL_EVENT]: value => isNumber(value)\n};\nexport { rateEmits, rateProps };","map":{"version":3,"names":["rateProps","buildProps","modelValue","type","Number","default","id","String","lowThreshold","highThreshold","max","colors","definePropType","Array","Object","mutable","voidColor","disabledVoidColor","icons","StarFilled","voidIcon","iconPropType","Star","disabledVoidIcon","disabled","Boolean","allowHalf","showText","showScore","textColor","texts","scoreTemplate","size","useSizeProp","clearable","useAriaProps","rateEmits","CHANGE_EVENT","value","isNumber","UPDATE_MODEL_EVENT"],"sources":["../../../../../../packages/components/rate/src/rate.ts"],"sourcesContent":["import { Star, StarFilled } from '@element-plus/icons-vue'\nimport { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport {\n buildProps,\n definePropType,\n iconPropType,\n isNumber,\n mutable,\n} from '@element-plus/utils'\nimport { useAriaProps, useSizeProp } from '@element-plus/hooks'\nimport type { Component, ExtractPropTypes } from 'vue'\nimport type Rate from './rate.vue'\n\nexport const rateProps = buildProps({\n /**\n * @description binding value\n */\n modelValue: {\n type: Number,\n default: 0,\n },\n /**\n * @description native `id` attribute\n */\n id: {\n type: String,\n default: undefined,\n },\n /**\n * @description threshold value between low and medium level. The value itself will be included in low level\n */\n lowThreshold: {\n type: Number,\n default: 2,\n },\n /**\n * @description threshold value between medium and high level. The value itself will be included in high level\n */\n highThreshold: {\n type: Number,\n default: 4,\n },\n /**\n * @description max rating score\n */\n max: {\n type: Number,\n default: 5,\n },\n /**\n * @description colors for icons. If array, it should have 3 elements, each of which corresponds with a score level, else if object, the key should be threshold value between two levels, and the value should be corresponding color\n */\n colors: {\n type: definePropType<string[] | Record<number, string>>([Array, Object]),\n de