element-plus
Version:
A Component Library for Vue 3
1 lines • 4.28 kB
Source Map (JSON)
{"version":3,"file":"color-picker-panel.mjs","names":[],"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 ExtractPublicPropTypes,\n InjectionKey,\n StyleValue,\n} from 'vue'\nimport type { ColorFormats } from '@ctrl/tinycolor'\nimport type ColorPickerPanel from './color-picker-panel.vue'\nimport type Color from './utils/color'\n\ntype ClassObjectType = Record<string, boolean>\ntype ClassType = string | ClassObjectType | ClassType[]\n\nexport interface ColorPickerPanelProps {\n /**\n * @description binding value\n */\n modelValue?: string | null\n /**\n * @description whether the color picker is bordered\n */\n border?: boolean\n /**\n * @description whether to display the alpha slider\n */\n showAlpha?: boolean\n /**\n * @description color format of v-model\n */\n colorFormat?: ColorFormats\n /**\n * @description whether to disable the color picker\n */\n disabled?: boolean\n /**\n * @description predefined color options\n */\n predefine?: string[]\n /**\n * @description whether to trigger form validation\n */\n validateEvent?: boolean\n /**\n * @description class names will be passed to hue-slider\n */\n hueSliderClass?: ClassType\n /**\n * @description styles will be passed to hue-slider\n */\n hueSliderStyle?: StyleValue\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `ColorPickerPanelProps` instead.\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: {\n type: definePropType<ColorFormats>(String),\n },\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 /**\n * @description class names will be passed to <hue-slider />\n */\n hueSliderClass: {\n type: definePropType<ClassType>([String, Array, Object]),\n },\n /**\n * @description styles will be passed to <hue-slider />\n */\n hueSliderStyle: {\n type: definePropType<StyleValue>([String, Array, Object]),\n },\n} as const)\nexport const colorPickerPanelEmits = {\n [UPDATE_MODEL_EVENT]: (val: string | null) => isString(val) || isNil(val),\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `ColorPickerPanelProps` instead.\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"],"mappings":";;;;;;;;;AA2DA,MAAa,wBAAwB,WAAW;CAI9C,YAAY;EACV,MAAM,eAA8B,OAAO;EAC3C,SAAS;EACV;CAID,QAAQ;EACN,MAAM;EACN,SAAS;EACV;CAID,WAAW;CAIX,aAAa,EACX,MAAM,eAA6B,OAAO,EAC3C;CAID,UAAU;CAIV,WAAW,EACT,MAAM,eAAyB,MAAM,EACtC;CAID,eAAe;EACb,MAAM;EACN,SAAS;EACV;CAID,gBAAgB,EACd,MAAM,eAA0B;EAAC;EAAQ;EAAO;EAAO,CAAC,EACzD;CAID,gBAAgB,EACd,MAAM,eAA2B;EAAC;EAAQ;EAAO;EAAO,CAAC,EAC1D;CACF,CAAU;AACX,MAAa,wBAAwB,GAClC,sBAAsB,QAAuB,SAAS,IAAI,IAAI,MAAM,IAAI,EAC1E;AAoBD,MAAa,kCACX,OAAO,uBAAuB;AAChC,MAAa,6BACX,OAAO,6BAA6B"}