UNPKG

xdesign-vue-next

Version:

XDesign Component for vue-next

80 lines (76 loc) 2.24 kB
/** * xdesign v1.0.6 * (c) 2023 xdesign * @license MIT */ import { defineComponent, computed, createVNode } from 'vue'; import ColorSlider from './slider.js'; import { useBaseClassName } from '../hooks.js'; import '@babel/runtime/helpers/defineProperty'; import './base-props.js'; import '../../_common/js/color-picker/constants.js'; import '../../_common/js/color-picker/draggable.js'; import '@babel/runtime/helpers/classCallCheck'; import '@babel/runtime/helpers/createClass'; import '../../hooks/useConfig.js'; import '../../config-provider/useConfig.js'; import 'lodash/isFunction'; import 'lodash/cloneDeep'; import 'lodash/isString'; import '../../config-provider/context.js'; import 'lodash/mergeWith'; import 'lodash/merge'; import '../../_common/js/global-config/default-config.js'; import '../../_common/js/global-config/locale/en_US.js'; import '../../_chunks/dep-3a1cce9f.js'; import 'lodash/isArray'; var AlphaSlider = defineComponent({ name: "AlphaSlider", inheritAttrs: false, props: { color: { type: Object }, disabled: { type: Boolean, "default": false }, onChange: { type: Function, "default": function _default() { return function () {}; } } }, setup: function setup(props) { var baseClassName = useBaseClassName(); var handleChange = function handleChange(v, isDragEnd) { props.onChange(v / 100, isDragEnd); }; var railStyle = computed(function () { return { background: "linear-gradient(to right, rgba(0, 0, 0, 0), ".concat(props.color.rgb, ")") }; }); return { baseClassName: baseClassName, railStyle: railStyle, handleChange: handleChange }; }, render: function render() { var baseClassName = this.baseClassName; return createVNode(ColorSlider, { "class": ["".concat(baseClassName, "__alpha"), "".concat(baseClassName, "--bg-alpha")], "color": this.color, "value": this.color.alpha * 100, "onChange": this.handleChange, "rail-style": this.railStyle, "max-value": 100, "disabled": this.disabled, "type": "alpha" }, null); } }); export { AlphaSlider as default }; //# sourceMappingURL=alpha.js.map