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 lines
8.1 KiB
1 lines
8.1 KiB
{"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 default: () => mutable(['', '', ''] as const),\n },\n /**\n * @description color of unselected icons\n */\n voidColor: {\n type: String,\n default: '',\n },\n /**\n * @description color of unselected read-only icons\n */\n disabledVoidColor: {\n type: String,\n default: '',\n },\n /**\n * @description icon components. 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 icon component\n */\n icons: {\n type: definePropType<\n Array<string | Component> | Record<number, string | Component>\n >([Array, Object]),\n default: () =>\n [StarFilled, StarFilled, StarFilled] as [Component, Component, Component],\n },\n /**\n * @description component of unselected icons\n */\n voidIcon: {\n type: iconPropType,\n default: () => Star as Component,\n },\n /**\n * @description component of unselected read-only icons\n */\n disabledVoidIcon: {\n type: iconPropType,\n default: () => StarFilled as Component,\n },\n /**\n * @description whether Rate is read-only\n */\n disabled: Boolean,\n /**\n * @description whether picking half start is allowed\n */\n allowHalf: Boolean,\n /**\n * @description whether to display texts\n */\n showText: Boolean,\n /**\n * @description whether to display current score. show-score and show-text cannot be true at the same time\n */\n showScore: Boolean,\n /**\n * @description color of texts\n */\n textColor: {\n type: String,\n default: '',\n },\n /**\n * @description text array\n */\n texts: {\n type: definePropType<string[]>(Array),\n default: () =>\n mutable([\n 'Extremely bad',\n 'Disappointed',\n 'Fair',\n 'Satisfied',\n 'Surprise',\n ] as const),\n },\n /**\n * @description score template\n */\n scoreTemplate: {\n type: String,\n default: '{value}',\n },\n /**\n * @description size of Rate\n */\n size: useSizeProp,\n /**\n * @description whether value can be reset to `0`\n */\n clearable: Boolean,\n ...useAriaProps(['ariaLabel']),\n} as const)\n\nexport type RateProps = ExtractPropTypes<typeof rateProps>\n\nexport const rateEmits = {\n [CHANGE_EVENT]: (value: number) => isNumber(value),\n [UPDATE_MODEL_EVENT]: (value: number) => isNumber(value),\n}\nexport type RateEmits = typeof rateEmits\n\nexport type RateInstance = InstanceType<typeof Rate>\n"],"mappings":";;;;;;;;AAUY,MAACA,SAAS,GAAGC,UAAU,CAAC;EAClCC,UAAU,EAAE;IACVC,IAAI,EAAEC,MAAM;IACZC,OAAO,EAAE;EACb,CAAG;EACDC,EAAE,EAAE;IACFH,IAAI,EAAEI,MAAM;IACZF,OAAO,EAAE,KAAK;EAClB,CAAG;EACDG,YAAY,EAAE;IACZL,IAAI,EAAEC,MAAM;IACZC,OAAO,EAAE;EACb,CAAG;EACDI,aAAa,EAAE;IACbN,IAAI,EAAEC,MAAM;IACZC,OAAO,EAAE;EACb,CAAG;EACDK,GAAG,EAAE;IACHP,IAAI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