added version
This commit is contained in:
@@ -0,0 +1,225 @@
|
||||
import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
|
||||
import _extends from '@babel/runtime/helpers/esm/extends';
|
||||
import { defineComponent, ref, computed, createVNode, Fragment } from 'vue';
|
||||
import { _ as __nuxt_component_2, t as tooltipDefaultProps, b as abstractTooltipProps, c as getArrowStyle, P as PresetColors } from './index-DN2Eqyc3.mjs';
|
||||
import { V as withInstall, aw as warning, z as useConfigInject, A as classNames, E as omit, Y as getTransitionName, Q as initDefaultProps, B as genComponentStyleHook, C as merge, a0 as initZoomMotion, R as filterEmpty, ao as anyType, J as resetComponent } from './server.mjs';
|
||||
|
||||
const genBaseStyle = (token) => {
|
||||
const {
|
||||
componentCls,
|
||||
popoverBg,
|
||||
popoverColor,
|
||||
width,
|
||||
fontWeightStrong,
|
||||
popoverPadding,
|
||||
boxShadowSecondary,
|
||||
colorTextHeading,
|
||||
borderRadiusLG: borderRadius,
|
||||
zIndexPopup,
|
||||
marginXS,
|
||||
colorBgElevated
|
||||
} = token;
|
||||
return [
|
||||
{
|
||||
[componentCls]: _extends(_extends({}, resetComponent(token)), {
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
// use `left` to fix https://github.com/ant-design/ant-design/issues/39195
|
||||
left: {
|
||||
_skip_check_: true,
|
||||
value: 0
|
||||
},
|
||||
zIndex: zIndexPopup,
|
||||
fontWeight: "normal",
|
||||
whiteSpace: "normal",
|
||||
textAlign: "start",
|
||||
cursor: "auto",
|
||||
userSelect: "text",
|
||||
"--antd-arrow-background-color": colorBgElevated,
|
||||
"&-rtl": {
|
||||
direction: "rtl"
|
||||
},
|
||||
"&-hidden": {
|
||||
display: "none"
|
||||
},
|
||||
[`${componentCls}-content`]: {
|
||||
position: "relative"
|
||||
},
|
||||
[`${componentCls}-inner`]: {
|
||||
backgroundColor: popoverBg,
|
||||
backgroundClip: "padding-box",
|
||||
borderRadius,
|
||||
boxShadow: boxShadowSecondary,
|
||||
padding: popoverPadding
|
||||
},
|
||||
[`${componentCls}-title`]: {
|
||||
minWidth: width,
|
||||
marginBottom: marginXS,
|
||||
color: colorTextHeading,
|
||||
fontWeight: fontWeightStrong
|
||||
},
|
||||
[`${componentCls}-inner-content`]: {
|
||||
color: popoverColor
|
||||
}
|
||||
})
|
||||
},
|
||||
// Arrow Style
|
||||
getArrowStyle(token, {
|
||||
colorBg: "var(--antd-arrow-background-color)"
|
||||
}),
|
||||
// Pure Render
|
||||
{
|
||||
[`${componentCls}-pure`]: {
|
||||
position: "relative",
|
||||
maxWidth: "none",
|
||||
[`${componentCls}-content`]: {
|
||||
display: "inline-block"
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
};
|
||||
const genColorStyle = (token) => {
|
||||
const {
|
||||
componentCls
|
||||
} = token;
|
||||
return {
|
||||
[componentCls]: PresetColors.map((colorKey) => {
|
||||
const lightColor = token[`${colorKey}-6`];
|
||||
return {
|
||||
[`&${componentCls}-${colorKey}`]: {
|
||||
"--antd-arrow-background-color": lightColor,
|
||||
[`${componentCls}-inner`]: {
|
||||
backgroundColor: lightColor
|
||||
},
|
||||
[`${componentCls}-arrow`]: {
|
||||
background: "transparent"
|
||||
}
|
||||
}
|
||||
};
|
||||
})
|
||||
};
|
||||
};
|
||||
const genWireframeStyle = (token) => {
|
||||
const {
|
||||
componentCls,
|
||||
lineWidth,
|
||||
lineType,
|
||||
colorSplit,
|
||||
paddingSM,
|
||||
controlHeight,
|
||||
fontSize,
|
||||
lineHeight,
|
||||
padding
|
||||
} = token;
|
||||
const titlePaddingBlockDist = controlHeight - Math.round(fontSize * lineHeight);
|
||||
const popoverTitlePaddingBlockTop = titlePaddingBlockDist / 2;
|
||||
const popoverTitlePaddingBlockBottom = titlePaddingBlockDist / 2 - lineWidth;
|
||||
const popoverPaddingHorizontal = padding;
|
||||
return {
|
||||
[componentCls]: {
|
||||
[`${componentCls}-inner`]: {
|
||||
padding: 0
|
||||
},
|
||||
[`${componentCls}-title`]: {
|
||||
margin: 0,
|
||||
padding: `${popoverTitlePaddingBlockTop}px ${popoverPaddingHorizontal}px ${popoverTitlePaddingBlockBottom}px`,
|
||||
borderBottom: `${lineWidth}px ${lineType} ${colorSplit}`
|
||||
},
|
||||
[`${componentCls}-inner-content`]: {
|
||||
padding: `${paddingSM}px ${popoverPaddingHorizontal}px`
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
const useStyle = genComponentStyleHook("Popover", (token) => {
|
||||
const {
|
||||
colorBgElevated,
|
||||
colorText,
|
||||
wireframe
|
||||
} = token;
|
||||
const popoverToken = merge(token, {
|
||||
popoverBg: colorBgElevated,
|
||||
popoverColor: colorText,
|
||||
popoverPadding: 12
|
||||
// Fixed Value
|
||||
});
|
||||
return [genBaseStyle(popoverToken), genColorStyle(popoverToken), wireframe && genWireframeStyle(popoverToken), initZoomMotion(popoverToken, "zoom-big")];
|
||||
}, (_ref) => {
|
||||
let {
|
||||
zIndexPopupBase
|
||||
} = _ref;
|
||||
return {
|
||||
zIndexPopup: zIndexPopupBase + 30,
|
||||
width: 177
|
||||
};
|
||||
});
|
||||
const popoverProps = () => _extends(_extends({}, abstractTooltipProps()), {
|
||||
content: anyType(),
|
||||
title: anyType()
|
||||
});
|
||||
const Popover = defineComponent({
|
||||
compatConfig: {
|
||||
MODE: 3
|
||||
},
|
||||
name: "APopover",
|
||||
inheritAttrs: false,
|
||||
props: initDefaultProps(popoverProps(), _extends(_extends({}, tooltipDefaultProps()), {
|
||||
trigger: "hover",
|
||||
placement: "top",
|
||||
mouseEnterDelay: 0.1,
|
||||
mouseLeaveDelay: 0.1
|
||||
})),
|
||||
setup(props, _ref) {
|
||||
let {
|
||||
expose,
|
||||
slots,
|
||||
attrs
|
||||
} = _ref;
|
||||
const tooltipRef = ref();
|
||||
warning(props.visible === void 0);
|
||||
expose({
|
||||
getPopupDomNode: () => {
|
||||
var _a, _b;
|
||||
return (_b = (_a = tooltipRef.value) === null || _a === void 0 ? void 0 : _a.getPopupDomNode) === null || _b === void 0 ? void 0 : _b.call(_a);
|
||||
}
|
||||
});
|
||||
const {
|
||||
prefixCls,
|
||||
configProvider
|
||||
} = useConfigInject("popover", props);
|
||||
const [wrapSSR, hashId] = useStyle(prefixCls);
|
||||
const rootPrefixCls = computed(() => configProvider.getPrefixCls());
|
||||
const getOverlay = () => {
|
||||
var _a, _b;
|
||||
const {
|
||||
title = filterEmpty((_a = slots.title) === null || _a === void 0 ? void 0 : _a.call(slots)),
|
||||
content = filterEmpty((_b = slots.content) === null || _b === void 0 ? void 0 : _b.call(slots))
|
||||
} = props;
|
||||
const hasTitle = !!(Array.isArray(title) ? title.length : title);
|
||||
const hasContent = !!(Array.isArray(content) ? content.length : title);
|
||||
if (!hasTitle && !hasContent) return null;
|
||||
return createVNode(Fragment, null, [hasTitle && createVNode("div", {
|
||||
"class": `${prefixCls.value}-title`
|
||||
}, [title]), createVNode("div", {
|
||||
"class": `${prefixCls.value}-inner-content`
|
||||
}, [content])]);
|
||||
};
|
||||
return () => {
|
||||
const overlayCls = classNames(props.overlayClassName, hashId.value);
|
||||
return wrapSSR(createVNode(__nuxt_component_2, _objectSpread(_objectSpread(_objectSpread({}, omit(props, ["title", "content"])), attrs), {}, {
|
||||
"prefixCls": prefixCls.value,
|
||||
"ref": tooltipRef,
|
||||
"overlayClassName": overlayCls,
|
||||
"transitionName": getTransitionName(rootPrefixCls.value, "zoom-big", props.transitionName),
|
||||
"data-popover-inject": true
|
||||
}), {
|
||||
title: getOverlay,
|
||||
default: slots.default
|
||||
}));
|
||||
};
|
||||
}
|
||||
});
|
||||
const __nuxt_component_1 = withInstall(Popover);
|
||||
|
||||
export { __nuxt_component_1 as _ };
|
||||
Reference in New Issue
Block a user