UNPKG

tdesign-vue

Version:
124 lines (120 loc) 4.35 kB
/** * tdesign v1.14.1 * (c) 2025 tdesign * @license MIT */ import _defineProperty from '@babel/runtime/helpers/defineProperty'; import { defineComponent, ref, watch } from '@vue/composition-api'; import { COLOR_MODES } from '../../_common/js/color-picker/constants.js'; import { RadioGroup, RadioButton } from '../../radio/index.js'; import { useBaseClassName } from '../hooks.js'; import props from '../props.js'; import { useConfig } from '../../config-provider/useConfig.js'; import '../../radio/radio.js'; import '../../_chunks/dep-6a4dc7bb.js'; import 'vue'; import '../../utils/helper.js'; import '@babel/runtime/helpers/objectWithoutProperties'; import '@babel/runtime/helpers/slicedToArray'; import 'lodash-es'; import '../../utils/render-tnode.js'; import '@babel/runtime/helpers/readOnlyError'; import '@babel/runtime/helpers/typeof'; import '../../radio/props.js'; import '../../utils/event.js'; import '../../config-provider/config-receiver.js'; import '../../config-provider/context.js'; import '../../_common/js/global-config/default-config.js'; import '../../_common/js/global-config/locale/zh_CN.js'; import '../../_chunks/dep-ba613a02.js'; import '../../_chunks/dep-fdb1b253.js'; import 'dayjs'; import '../../_common/js/global-config/t.js'; import '../../utils/mixins.js'; import '../../radio/group.js'; import '@babel/runtime/helpers/asyncToGenerator'; import '@babel/runtime/regenerator'; import '../../radio/radio-group-props.js'; import '../../radio/radio-button.js'; import '../../utils/dom.js'; import 'raf'; import '../../utils/easing.js'; import '../../_common/js/common.js'; import '../../utils/map-props.js'; import '../../utils/withInstall.js'; import '../../hooks/useConfig.js'; function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } var PanelHeader = defineComponent({ name: "PanelHeader", components: { TRadioGroup: RadioGroup, TRadioButton: RadioButton }, props: _objectSpread(_objectSpread({}, props), {}, { mode: { type: String, "default": "color" }, handleModeChange: { type: Function, "default": function _default() { return function () {}; } } }), setup: function setup(props2) { var _useConfig = useConfig("colorPicker"), globalConfig = _useConfig.globalConfig; var baseClassName = useBaseClassName(); var modeValue = ref(props2.mode); watch(function () { return props2.mode; }, function (v) { modeValue.value = v; }); return { globalConfig: globalConfig, baseClassName: baseClassName, modeValue: modeValue }; }, render: function render() { var _this$colorModes, _this = this; var h = arguments[0]; if (((_this$colorModes = this.colorModes) === null || _this$colorModes === void 0 ? void 0 : _this$colorModes.length) === 1) { return null; } var baseClassName = this.baseClassName; return h("div", { "class": "".concat(baseClassName, "__head") }, [h("div", { "class": "".concat(baseClassName, "__mode") }, [h("t-radio-group", { "attrs": { "variant": "default-filled", "size": "small", "disabled": this.disabled }, "on": { "change": this.handleModeChange }, "model": { value: _this.modeValue, callback: function callback($$v) { _this.modeValue = $$v; } } }, [this.colorModes.map(function (key) { return h("t-radio-button", { "key": key, "attrs": { "value": key } }, [Reflect.get(_this.globalConfig, COLOR_MODES[key])]); })])])]); } }); export { PanelHeader as default }; //# sourceMappingURL=header.js.map