element-plus
Version:
A Component Library for Vue 3
1 lines • 2.93 kB
Source Map (JSON)
{"version":3,"file":"color-picker-panel.mjs","sources":["../../../../../../packages/components/color-picker-panel/src/color-picker-panel.ts"],"sourcesContent":["import { isNil } from 'lodash-unified'\nimport { buildProps, definePropType, isString } from '@element-plus/utils'\nimport { UPDATE_MODEL_EVENT } from '@element-plus/constants'\n\nimport type {\n ComputedRef,\n ExtractPropTypes,\n ExtractPublicPropTypes,\n InjectionKey,\n} from 'vue'\nimport type ColorPickerPanel from './color-picker-panel.vue'\nimport type Color from './utils/color'\n\nexport const colorPickerPanelProps = buildProps({\n /**\n * @description binding value\n */\n modelValue: {\n type: definePropType<string | null>(String),\n default: undefined,\n },\n /**\n * @description whether the color picker is bordered\n */\n border: {\n type: Boolean,\n default: true,\n },\n /**\n * @description whether to display the alpha slider\n */\n showAlpha: Boolean,\n /**\n * @description color format of v-model\n */\n colorFormat: String,\n /**\n * @description whether to disable the color picker\n */\n disabled: Boolean,\n /**\n * @description predefined color options\n */\n predefine: {\n type: definePropType<string[]>(Array),\n },\n /**\n * @description whether to trigger form validation\n */\n validateEvent: {\n type: Boolean,\n default: true,\n },\n} as const)\nexport const colorPickerPanelEmits = {\n [UPDATE_MODEL_EVENT]: (val: string | null) => isString(val) || isNil(val),\n}\n\nexport type ColorPickerPanelProps = ExtractPropTypes<\n typeof colorPickerPanelProps\n>\nexport type ColorPickerPanelPropsPublic = ExtractPublicPropTypes<\n typeof colorPickerPanelProps\n>\nexport type ColorPickerPanelEmits = typeof colorPickerPanelEmits\nexport type ColorPickerPanelInstance = InstanceType<typeof ColorPickerPanel> &\n unknown\n\nexport interface ColorPickerPanelContext {\n currentColor: ComputedRef<string>\n}\n\nexport interface CommonColorContext {\n color: Color\n}\n\nexport const ROOT_COMMON_COLOR_INJECTION_KEY: InjectionKey<CommonColorContext> =\n Symbol('colorCommonPickerKey')\nexport const colorPickerPanelContextKey: InjectionKey<ColorPickerPanelContext> =\n Symbol('colorPickerPanelContextKey')\n"],"names":[],"mappings":";;;;;AAaO,MAAM,wBAAwB,UAAW,CAAA;AAAA,EAI9C,UAAY,EAAA;AAAA,IACV,IAAA,EAAM,eAA8B,MAAM,CAAA;AAAA,IAC1C,OAAS,EAAA,KAAA,CAAA;AAAA,GACX;AAAA,EAIA,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,IAAA;AAAA,GACX;AAAA,EAIA,SAAW,EAAA,OAAA;AAAA,EAIX,WAAa,EAAA,MAAA;AAAA,EAIb,QAAU,EAAA,OAAA;AAAA,EAIV,SAAW,EAAA;AAAA,IACT,IAAA,EAAM,eAAyB,KAAK,CAAA;AAAA,GACtC;AAAA,EAIA,aAAe,EAAA;AAAA,IACb,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,IAAA;AAAA,GACX;AACF,CAAU,EAAA;AACH,MAAM,qBAAwB,GAAA;AAAA,EACnC,CAAC,qBAAqB,CAAC,GAAA,KAAuB,SAAS,GAAG,CAAA,IAAK,MAAM,GAAG,CAAA;AAC1E,EAAA;AAoBa,MAAA,+BAAA,GACX,OAAO,sBAAsB,EAAA;AAClB,MAAA,0BAAA,GACX,OAAO,4BAA4B;;;;"}