tdesign-vue-next
Version:
TDesign Component for vue-next
116 lines (112 loc) • 4.04 kB
JavaScript
/**
* tdesign v1.19.2
* (c) 2026 tdesign
* @license MIT
*/
import { createVNode } from 'vue';
import 'lodash-es';
import '@babel/runtime/helpers/toConsumableArray';
import '@babel/runtime/helpers/typeof';
import '../../_chunks/dep-c68ea098.js';
import { u as usePrefixClass } from '../../_chunks/dep-e8dd47a9.js';
import '@babel/runtime/helpers/slicedToArray';
import '../../_chunks/dep-91fc762d.js';
import '@babel/runtime/helpers/defineProperty';
import 'tdesign-icons-vue-next';
import '../../checkbox/index.js';
import '../../loading/index.js';
import '@babel/runtime/helpers/asyncToGenerator';
import '@babel/runtime/helpers/classCallCheck';
import '@babel/runtime/helpers/createClass';
import '@babel/runtime/regenerator';
import { getTNode } from '../utils/index.js';
import '../../_chunks/dep-f0f392fb.js';
import '../../config-provider/hooks/useConfig.js';
import '../../config-provider/utils/context.js';
import '../../_chunks/dep-509ddbe3.js';
import 'dayjs';
import '../../checkbox/checkbox.js';
import '../../checkbox/props.js';
import '../../_chunks/dep-7bdccf65.js';
import '../../_chunks/dep-d518fdfb.js';
import '../../_chunks/dep-8d4d971b.js';
import '../../_chunks/dep-98d89c71.js';
import '../../_chunks/dep-2ba9b7d0.js';
import '../../_chunks/dep-8be9c790.js';
import '../../_chunks/dep-d67d6f8a.js';
import '../../_chunks/dep-ef7a41ce.js';
import '../../_chunks/dep-e332908e.js';
import '../../checkbox/constants/index.js';
import '../../checkbox/hooks/useCheckboxLazyLoad.js';
import '../../_chunks/dep-6f148007.js';
import '../../checkbox/hooks/useKeyboardEvent.js';
import '../../_chunks/dep-e9e05226.js';
import '../../checkbox/group.js';
import '../../checkbox/checkbox-group-props.js';
import '../../_chunks/dep-b36a4e94.js';
import '../../_chunks/dep-ae3e94b6.js';
import '../../loading/directive.js';
import '../../loading/plugin.js';
import '../../_chunks/dep-2a7145b5.js';
import '../../loading/icon/gradient.js';
import '../../_chunks/dep-fbf70ecb.js';
import '@babel/runtime/helpers/objectWithoutProperties';
import '../../loading/props.js';
function useRenderLine(state) {
var componentName = usePrefixClass("tree").value;
var renderLine = function renderLine(h) {
var node = state.node,
treeScope = state.treeScope;
var scopedSlots = treeScope.scopedSlots;
var treeProps = (treeScope === null || treeScope === void 0 ? void 0 : treeScope.treeProps) || {};
var line = treeProps.line;
var iconVisible = !!treeProps.icon;
var lineNode = null;
if (line === true) {
if (scopedSlots !== null && scopedSlots !== void 0 && scopedSlots.line) {
lineNode = scopedSlots.line({
node: node === null || node === void 0 ? void 0 : node.getModel()
});
} else if (node.parent && node.tree) {
var vmIsLeaf = node.vmIsLeaf,
vmIsFirst = node.vmIsFirst,
level = node.level;
var lineClasses = [];
lineClasses.push("".concat(componentName, "__line"));
if (vmIsLeaf || !iconVisible) {
lineClasses.push("".concat(componentName, "__line--leaf"));
}
if (vmIsFirst && iconVisible) {
lineClasses.push("".concat(componentName, "__line--first"));
}
var shadowStyles = [];
var parents = node.getParents();
parents.pop();
parents.forEach(function (pnode, index) {
if (!pnode.vmIsLast) {
shadowStyles.push("calc(-".concat(index + 1, " * var(--space)) 0 var(--color)"));
}
});
var styles = {
"--level": level ? String(level) : void 0,
"box-shadow": shadowStyles.join(",")
};
lineNode = createVNode("span", {
"class": lineClasses,
"style": styles
}, null);
}
} else {
lineNode = getTNode(line, {
createElement: h,
node: node
});
}
return lineNode;
};
return {
renderLine: renderLine
};
}
export { useRenderLine as default };
//# sourceMappingURL=useRenderLine.js.map