UNPKG

tdesign-vue-next

Version:
160 lines (156 loc) 5.61 kB
/** * tdesign v1.19.2 * (c) 2026 tdesign * @license MIT */ import { defineComponent, createVNode, isVNode, h } from 'vue'; import _slicedToArray from '@babel/runtime/helpers/slicedToArray'; import { ChevronRightIcon, ChevronLeftIcon } from 'tdesign-icons-vue-next'; import { Button } from '../../button/index.js'; import { isArray, isString, isFunction } from 'lodash-es'; import '@babel/runtime/helpers/toConsumableArray'; import '@babel/runtime/helpers/typeof'; import '../../_chunks/dep-c68ea098.js'; import { u as usePrefixClass } from '../../_chunks/dep-e8dd47a9.js'; import { u as useGlobalIcon } from '../../_chunks/dep-52eae58a.js'; import '../../_chunks/dep-91fc762d.js'; import '@babel/runtime/helpers/defineProperty'; import props from '../props.js'; import '../../button/button.js'; import '../../loading/index.js'; import '../../loading/directive.js'; import '../../loading/plugin.js'; import '../../_chunks/dep-2a7145b5.js'; import '../../loading/icon/gradient.js'; import '../../_chunks/dep-ef7a41ce.js'; import '../../_chunks/dep-fbf70ecb.js'; import '@babel/runtime/helpers/objectWithoutProperties'; import '../../_chunks/dep-d518fdfb.js'; import '../../_chunks/dep-7bdccf65.js'; import '../../_chunks/dep-8d4d971b.js'; import '../../_chunks/dep-98d89c71.js'; import '../../config-provider/hooks/useConfig.js'; import '../../config-provider/utils/context.js'; import '../../_chunks/dep-509ddbe3.js'; import '../../_chunks/dep-f0f392fb.js'; import 'dayjs'; import '../../loading/props.js'; import '@babel/runtime/helpers/createClass'; import '@babel/runtime/helpers/classCallCheck'; import '../../_chunks/dep-ae3e94b6.js'; import '../../button/props.js'; import '../../_chunks/dep-2ba9b7d0.js'; import '../../_chunks/dep-d67d6f8a.js'; function _isSlot(s) { return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s); } var TransferOperations = defineComponent({ name: "TTransferOperations", props: { leftDisabled: { type: Boolean, required: true }, rightDisabled: { type: Boolean, required: true }, operation: props.operation }, emits: ["moveToRight", "moveToLeft"], setup: function setup(props2, _ref) { var slots = _ref.slots, emit = _ref.emit; var classPrefix = usePrefixClass(); var _useGlobalIcon = useGlobalIcon({ ChevronRightIcon: ChevronRightIcon, ChevronLeftIcon: ChevronLeftIcon }), ChevronRightIcon$1 = _useGlobalIcon.ChevronRightIcon, ChevronLeftIcon$1 = _useGlobalIcon.ChevronLeftIcon; var moveToRight = function moveToRight() { emit("moveToRight"); }; var moveToLeft = function moveToLeft() { emit("moveToLeft"); }; var getIconRight = function getIconRight() { return createVNode(ChevronRightIcon$1, null, null); }; var getIconLeft = function getIconLeft() { return createVNode(ChevronLeftIcon$1, null, null); }; var getIcon = function getIcon(direction) { if (isFunction(props2.operation)) { return null; } if (direction === "right" && props2.operation && isFunction(props2.operation[0])) { return null; } if (direction === "left" && props2.operation && isFunction(props2.operation[1])) { return null; } if (slots.operation) { return null; } return direction === "left" ? getIconLeft : getIconRight; }; var renderButton = function renderButton(h2, direction) { if (isFunction(slots.operation)) { return slots.operation({ direction: direction }); } if (isFunction(props2.operation)) { var renderContent2 = props2.operation; return renderContent2(h2, { direction: direction }); } var renderContent; if (isArray(props2.operation)) { var _props2$operation = _slicedToArray(props2.operation, 2), left = _props2$operation[0], right = _props2$operation[1]; var directionOp = direction === "right" ? right : left; var content = isFunction(directionOp) ? directionOp(h2) : directionOp; renderContent = content === false || content === true ? "" : content; } else { renderContent = ""; } return renderContent; }; return function () { var _slot, _slot2; return createVNode("div", { "class": "".concat(classPrefix.value, "-transfer__operations") }, [createVNode(Button, { "variant": "outline", "size": "small", "shape": isArray(props2.operation) && isString(props2.operation[1]) ? "rectangle" : "square", "key": props2.rightDisabled ? "right-outline" : "right-base", "disabled": props2.rightDisabled, "onClick": moveToRight, "icon": getIcon("right") }, _isSlot(_slot = renderButton(h, "right")) ? _slot : { "default": function _default() { return [_slot]; } }), createVNode(Button, { "variant": "outline", "size": "small", "shape": isArray(props2.operation) && isString(props2.operation[0]) ? "rectangle" : "square", "key": props2.rightDisabled ? "left-outline" : "left-base", "disabled": props2.leftDisabled, "onClick": moveToLeft, "icon": getIcon("left") }, _isSlot(_slot2 = renderButton(h, "left")) ? _slot2 : { "default": function _default() { return [_slot2]; } })]); }; } }); export { TransferOperations as default }; //# sourceMappingURL=transfer-operations.js.map