tdesign-vue
Version:
162 lines (158 loc) • 5.5 kB
JavaScript
/**
* tdesign v1.14.1
* (c) 2025 tdesign
* @license MIT
*/
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
import { ChevronRightIcon, ChevronLeftIcon } from 'tdesign-icons-vue';
import { Button } from '../../button/index.js';
import mixins from '../../utils/mixins.js';
import { getClassPrefixMixins, getGlobalIconMixins } from '../../config-provider/config-receiver.js';
import '../../button/button.js';
import '@babel/runtime/helpers/defineProperty';
import '../../loading/index.js';
import '../../loading/directive.js';
import 'lodash-es';
import '../../loading/plugin.js';
import 'vue';
import '../../loading/loading.js';
import '../../loading/icon/gradient.js';
import '../../_common/js/loading/circle-adapter.js';
import '../../_common/js/utils/setStyle.js';
import '../../_common/js/utils/helper.js';
import '@babel/runtime/helpers/toConsumableArray';
import '@babel/runtime/helpers/objectWithoutProperties';
import '../../utils/dom.js';
import 'raf';
import '../../utils/easing.js';
import '../../utils/render-tnode.js';
import '@babel/runtime/helpers/readOnlyError';
import '@babel/runtime/helpers/typeof';
import '@vue/composition-api';
import '../../utils/transfer-dom.js';
import '../../loading/props.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 '../../config.js';
import '../../utils/withInstall.js';
import '../../button/props.js';
import '../../utils/ripple.js';
var classPrefixMixins = getClassPrefixMixins("transfer");
var TransferOperations = mixins(classPrefixMixins, getGlobalIconMixins()).extend({
name: "TTransferOperations",
props: {
leftDisabled: {
type: Boolean,
required: true
},
rightDisabled: {
type: Boolean,
required: true
},
operation: {
type: [String, Array, Function, Boolean]
}
},
methods: {
moveToRight: function moveToRight() {
this.$emit("moveToRight");
},
moveToLeft: function moveToLeft() {
this.$emit("moveToLeft");
},
getIconRight: function getIconRight() {
var h = this.$createElement;
var _this$useGlobalIcon = this.useGlobalIcon({
ChevronRightIcon: ChevronRightIcon
}),
ChevronRightIcon$1 = _this$useGlobalIcon.ChevronRightIcon;
return h(ChevronRightIcon$1);
},
getIconLeft: function getIconLeft() {
var h = this.$createElement;
var _this$useGlobalIcon2 = this.useGlobalIcon({
ChevronLeftIcon: ChevronLeftIcon
}),
ChevronLeftIcon$1 = _this$useGlobalIcon2.ChevronLeftIcon;
return h(ChevronLeftIcon$1);
},
getIcon: function getIcon(direction) {
if (typeof this.operation === "function") {
return null;
}
if (direction === "right" && this.operation && typeof this.operation[0] === "function") {
return null;
}
if (direction === "left" && this.operation && typeof this.operation[1] === "function") {
return null;
}
if (this.$scopedSlots.operation) {
return null;
}
return direction === "left" ? this.getIconLeft : this.getIconRight;
},
_renderButton: function _renderButton(h, direction) {
if (typeof this.$scopedSlots.operation === "function") {
return this.$scopedSlots.operation({
direction: direction
});
}
if (typeof this.operation === "function") {
var renderContent2 = this.operation;
return renderContent2(h, {
direction: direction
});
}
var renderContent;
if (Array.isArray(this.operation)) {
var _this$operation = _slicedToArray(this.operation, 2),
left = _this$operation[0],
right = _this$operation[1];
renderContent = direction === "right" ? right : left;
} else {
renderContent = "";
}
return renderContent;
}
},
render: function render(h) {
var _this$operation2, _this$operation3;
var _this$$props = this.$props,
leftDisabled = _this$$props.leftDisabled,
rightDisabled = _this$$props.rightDisabled;
return h("div", {
"class": "".concat(this.componentName, "__operations")
}, [h(Button, {
"attrs": {
"variant": "outline",
"size": "small",
"shape": typeof ((_this$operation2 = this.operation) === null || _this$operation2 === void 0 ? void 0 : _this$operation2[1]) === "string" ? "rectangle" : "square",
"disabled": rightDisabled,
"icon": this.getIcon("right")
},
"key": rightDisabled ? "right-outline" : "right-base",
"on": {
"click": this.moveToRight
}
}, [this._renderButton(h, "right")]), h(Button, {
"attrs": {
"variant": "outline",
"size": "small",
"shape": typeof ((_this$operation3 = this.operation) === null || _this$operation3 === void 0 ? void 0 : _this$operation3[0]) === "string" ? "rectangle" : "square",
"disabled": leftDisabled,
"icon": this.getIcon("left")
},
"key": leftDisabled ? "left-outline" : "left-base",
"on": {
"click": this.moveToLeft
}
}, [this._renderButton(h, "left")])]);
}
});
export { TransferOperations as default };
//# sourceMappingURL=transfer-operations.js.map