UNPKG

tdesign-vue

Version:
134 lines (130 loc) 4.82 kB
/** * tdesign v1.14.1 * (c) 2025 tdesign * @license MIT */ import { h as helper } from '../_chunks/dep-6a4dc7bb.js'; import _defineProperty from '@babel/runtime/helpers/defineProperty'; import baseProps from './sticky-item-props.js'; import props from './props.js'; import { Popup } from '../popup/index.js'; import { renderTNodeJSX } from '../utils/render-tnode.js'; import mixins from '../utils/mixins.js'; import getConfigReceiverMixins, { getGlobalIconMixins } from '../config-provider/config-receiver.js'; import '../popup/popup.js'; import '@babel/runtime/helpers/typeof'; import '@popperjs/core'; import 'lodash-es'; import '../utils/dom.js'; import 'vue'; import 'raf'; import '../utils/easing.js'; import '../utils/helper.js'; import '@babel/runtime/helpers/objectWithoutProperties'; import '@babel/runtime/helpers/slicedToArray'; import '../_common/js/utils/setStyle.js'; import '../popup/props.js'; import '../popup/container.js'; import '../utils/event.js'; import '../popup/utils.js'; import '../utils/map-props.js'; import '../utils/withInstall.js'; import '../popup/plugin.js'; import '../_common/js/log/log.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 '@babel/runtime/helpers/readOnlyError'; import '@vue/composition-api'; 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 _StickyItem = mixins(getConfigReceiverMixins("sticky-item"), getGlobalIconMixins()).extend({ name: "TStickyItem", props: _objectSpread(_objectSpread({}, baseProps), {}, { type: props.type, shape: props.shape, placement: props.placement, basePopupProps: Object, baseWidth: props.width, onClick: props.onClick, onHover: props.onHover, fatherCompName: String }), computed: { baseClass: function baseClass() { return ["".concat(this.componentName), "".concat(this.componentName, "--").concat(this.type), "".concat(this.componentName, "--").concat(this.shape)]; }, labelClass: function labelClass() { return ["".concat(this.componentName, "__label")]; }, popupPlacement: function popupPlacement() { return this.placement.indexOf("right") !== -1 ? "left" : "right"; }, styles: function styles() { var styles = {}; if (this.baseWidth) { var selfWidth = this.type === "normal" ? "56px" : "40px"; styles.margin = "calc((".concat(this.baseWidth, " - ").concat(selfWidth, ")/2)"); } return styles; } }, render: function render() { var h = arguments[0]; var icon = renderTNodeJSX(this, "icon"); var label = renderTNodeJSX(this, "label"); var popup = renderTNodeJSX(this, "popup"); return h(Popup, helper([{ "attrs": { "overlayInnerClassName": "".concat(this.fatherCompName, "-popup-content"), "trigger": this.trigger, "hideEmptyPopup": true, "placement": this.popupPlacement, "content": function content() { return popup; } } }, { "props": this.popupProps || this.basePopupProps }]), [h("div", { "class": this.baseClass, "style": this.styles, "on": { "click": this.handleClickItem, "mouseenter": this.handleHoverItem } }, [icon, this.type === "normal" ? h("div", { "class": this.labelClass }, [label]) : null])]); }, methods: { handleClickItem: function handleClickItem(e) { var _this = this; var item = {}; Object.keys(baseProps).forEach(function (i) { return item[i] = _this[i]; }); this.onClick({ e: e, item: item }); }, handleHoverItem: function handleHoverItem(e) { var _this2 = this; var item = {}; Object.keys(baseProps).forEach(function (i) { return item[i] = _this2[i]; }); this.onHover({ e: e, item: item }); } } }); export { _StickyItem as default }; //# sourceMappingURL=sticky-item.js.map