UNPKG

tdesign-vue-next

Version:
102 lines (98 loc) 3.39 kB
/** * tdesign v1.11.5 * (c) 2025 tdesign * @license MIT */ import { defineComponent, createVNode } from 'vue'; import { FileCopyIcon } from 'tdesign-icons-vue-next'; import { copyText } from './utils/index.js'; import { MessagePlugin } from '../message/plugin.js'; import props from './anchor-target-props.js'; import { Popup } from '../popup/index.js'; import { useGlobalIcon } from '../hooks/useGlobalIcon.js'; import { usePrefixClass } from '../hooks/useConfig.js'; import { useConfig } from '../config-provider/hooks/useConfig.js'; import '../_chunks/dep-caecb55d.js'; import '@babel/runtime/helpers/defineProperty'; import '../message/message-list.js'; import '../message/consts/index.js'; import '../message/message.js'; import '../loading/index.js'; import '../loading/directive.js'; import 'lodash-es'; import '../loading/plugin.js'; import '../loading/loading.js'; import '@babel/runtime/helpers/slicedToArray'; import '../loading/icon/gradient.js'; import '../_chunks/dep-d60f6309.js'; import '../_chunks/dep-56c3d46e.js'; import '@babel/runtime/helpers/toConsumableArray'; import '@babel/runtime/helpers/objectWithoutProperties'; import '../utils/dom.js'; import '../_chunks/dep-7c56a7f5.js'; import '../utils/render-tnode.js'; import '../hooks/useTeleport.js'; import '../loading/props.js'; import '../config-provider/utils/context.js'; import '../_chunks/dep-c75b9b8e.js'; import '@babel/runtime/helpers/typeof'; import 'dayjs'; import '../utils/withInstall.js'; import '../message/props.js'; import '../message/utils/animation.js'; import '../popup/popup.js'; import '@popperjs/core'; import '../hooks/useKeepAnimation.js'; import '../hooks/useVModel.js'; import '../popup/container.js'; import '../popup/props.js'; import '../hooks/useResizeObserver.js'; var _AnchorTarget = defineComponent({ name: "TAnchorTarget", props: props, setup: function setup(props2, _ref) { var slots = _ref.slots; var _useConfig = useConfig("anchor"), globalConfig = _useConfig.globalConfig, classPrefix = _useConfig.classPrefix; var _useGlobalIcon = useGlobalIcon({ FileCopyIcon: FileCopyIcon }), FileCopyIcon$1 = _useGlobalIcon.FileCopyIcon; var COMPONENT_NAME = usePrefixClass("anchor"); var toCopyText = function toCopyText() { var a = document.createElement("a"); a.href = "#".concat(props2.id); copyText(a.href); MessagePlugin.success(globalConfig.value.copySuccessText, 1e3); }; return function () { var children = slots["default"]; var TAG = props2.tag, id = props2.id; var className = ["".concat(COMPONENT_NAME.value, "__target")]; var iconClassName = "".concat(classPrefix.value, "-copy"); return createVNode(TAG, { "id": id, "class": className }, { "default": function _default() { return [children && children(null), createVNode(Popup, { "content": globalConfig.value.copyText, "placement": "top", "showArrow": true, "class": iconClassName }, { "default": function _default() { return [createVNode(FileCopyIcon$1, { "onClick": toCopyText }, null)]; } })]; } }); }; } }); export { _AnchorTarget as default }; //# sourceMappingURL=anchor-target.js.map