element-plus
Version:
A Component Library for Vue 3
116 lines (113 loc) • 2.94 kB
JavaScript
import { isNil } from 'lodash-unified';
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
import { useAriaProps } from '../../../hooks/use-aria/index.mjs';
import { useEmptyValuesProps } from '../../../hooks/use-empty-values/index.mjs';
import { useTooltipContentProps } from '../../tooltip/src/content.mjs';
import { useSizeProp } from '../../../hooks/use-size/index.mjs';
import { isString } from '@vue/shared';
import { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '../../../constants/event.mjs';
const colorPickerProps = buildProps({
/**
* @description when color-picker inactive and persistent is false, the color panel will be destroyed
*/
persistent: {
type: Boolean,
default: true
},
/**
* @description binding value
*/
modelValue: {
type: definePropType(String),
default: void 0
},
/**
* @description ColorPicker id
*/
id: String,
/**
* @description whether to display the alpha slider
*/
showAlpha: Boolean,
/**
* @description color format of v-model
*/
colorFormat: String,
/**
* @description whether to disable the ColorPicker
*/
disabled: {
type: Boolean,
default: void 0
},
/**
* @description whether to show clear button
*/
clearable: {
type: Boolean,
default: true
},
/**
* @description size of ColorPicker
*/
size: useSizeProp,
/**
* @description custom class name for ColorPicker's dropdown
*/
popperClass: useTooltipContentProps.popperClass,
/**
* @description custom style for ColorPicker's dropdown
*/
popperStyle: useTooltipContentProps.popperStyle,
/**
* @description ColorPicker tabindex
*/
tabindex: {
type: [String, Number],
default: 0
},
/**
* @description whether color-picker popper is teleported to the body
*/
teleported: useTooltipContentProps.teleported,
/**
* @description which color-picker panel appends to
*/
appendTo: useTooltipContentProps.appendTo,
/**
* @description predefined color options
*/
predefine: {
type: definePropType(Array)
},
/**
* @description whether to trigger form validation
*/
validateEvent: {
type: Boolean,
default: true
},
...useEmptyValuesProps,
...useAriaProps(["ariaLabel"])
});
const colorPickerEmits = {
[UPDATE_MODEL_EVENT]: (val) => isString(val) || isNil(val),
[CHANGE_EVENT]: (val) => isString(val) || isNil(val),
activeChange: (val) => isString(val) || isNil(val),
focus: (evt) => evt instanceof FocusEvent,
blur: (evt) => evt instanceof FocusEvent,
clear: () => true
};
const colorPickerPropsDefaults = {
persistent: true,
modelValue: void 0,
disabled: void 0,
clearable: true,
popperStyle: void 0,
tabindex: 0,
teleported: true,
validateEvent: true,
valueOnClear: void 0
};
export { colorPickerEmits, colorPickerProps, colorPickerPropsDefaults };
//# sourceMappingURL=color-picker.mjs.map