@varlet/ui
Version:
A Vue3 component library based on Material Design 2 and 3, supporting mobile and desktop.
110 lines (109 loc) • 3.79 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
import { computed, defineComponent } from "vue";
import { useVModel } from "@varlet/use";
import VarTooltip from "../tooltip/index.mjs";
import { createNamespace } from "../utils/components.mjs";
import { props } from "./props.mjs";
const { name, n, classes } = createNamespace("ellipsis");
import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, openBlock as _openBlock, createElementBlock as _createElementBlock, resolveComponent as _resolveComponent, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, withCtx as _withCtx, createBlock as _createBlock } from "vue";
const _hoisted_1 = { key: 0 };
function __render__(_ctx, _cache) {
const _component_var_tooltip = _resolveComponent("var-tooltip");
return _openBlock(), _createBlock(
_component_var_tooltip,
_normalizeProps(_guardReactiveProps(_ctx.tooltipProps)),
{
content: _withCtx(() => [
_renderSlot(_ctx.$slots, "tooltip-content", {}, () => {
var _a;
return [
((_a = _ctx.tooltipProps) == null ? void 0 : _a.content) ? (_openBlock(), _createElementBlock(
"span",
_hoisted_1,
_toDisplayString(_ctx.tooltipProps.content),
1
/* TEXT */
)) : _renderSlot(_ctx.$slots, "default", { key: 1 })
];
})
]),
default: _withCtx(() => [
_createElementVNode(
"span",
{
class: _normalizeClass(
_ctx.classes(_ctx.n(), [_ctx.lineClamp, _ctx.n("--clamp"), _ctx.n("--line")], [_ctx.expandTrigger, _ctx.n("--cursor")], [_ctx.expanding, _ctx.n("--expand")])
),
style: _normalizeStyle(_ctx.rootStyles),
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
},
[
_renderSlot(_ctx.$slots, "default")
],
6
/* CLASS, STYLE */
)
]),
_: 3
/* FORWARDED */
},
16
/* FULL_PROPS */
);
}
const __sfc__ = defineComponent({
name,
components: { VarTooltip },
props,
setup(props2) {
const expanding = useVModel(props2, "expand");
const rootStyles = computed(() => props2.lineClamp ? { "-webkit-line-clamp": props2.lineClamp } : {});
const tooltipProps = computed(() => {
if (props2.tooltip === false) {
return {
disabled: true
};
}
if (props2.tooltip === true) {
return {
sameWidth: true
};
}
return __spreadValues({ sameWidth: true }, props2.tooltip);
});
function handleClick() {
if (!props2.expandTrigger) {
return;
}
expanding.value = !expanding.value;
}
return {
tooltipProps,
expanding,
rootStyles,
n,
classes,
handleClick
};
}
});
__sfc__.render = __render__;
var stdin_default = __sfc__;
export {
stdin_default as default
};