UNPKG

tdesign-vue-next

Version:
164 lines (160 loc) 5.67 kB
/** * tdesign v1.15.2 * (c) 2025 tdesign * @license MIT */ import { _ as _defineProperty } from '../../_chunks/dep-0bd8597f.mjs'; import { camelCase } from 'lodash-es'; import { isVueNext } from './adapt.mjs'; import '../../_chunks/dep-612a2c2b.mjs'; import '../../_chunks/dep-15464fee.mjs'; import 'vue'; import '../../_chunks/dep-465c43e8.mjs'; import '../../_chunks/dep-d0add92f.mjs'; import '../../_chunks/dep-32b59907.mjs'; import '../../_chunks/dep-d58b61b6.mjs'; import '../../_chunks/dep-779bddf7.mjs'; import '../../config-provider/hooks/useConfig.mjs'; import '../../config-provider/utils/context.mjs'; import '../../_chunks/dep-afae046d.mjs'; import '../../_chunks/dep-8a6c1499.mjs'; import '../../_chunks/dep-5c28ada1.mjs'; import '../../_chunks/dep-614f307d.mjs'; import '../../_chunks/dep-d913bc66.mjs'; import '../../_chunks/dep-1690abc9.mjs'; import '../../_chunks/dep-62c11543.mjs'; import '../../_chunks/dep-27c2b283.mjs'; import '../../_chunks/dep-67238d91.mjs'; import 'tdesign-icons-vue-next'; import '../../checkbox/index.mjs'; import '../../checkbox/checkbox.mjs'; import '../../checkbox/props.mjs'; import '../../checkbox/consts/index.mjs'; import '../../checkbox/hooks/useCheckboxLazyLoad.mjs'; import '../../checkbox/hooks/useKeyboardEvent.mjs'; import '../../checkbox/group.mjs'; import '../../checkbox/checkbox-group-props.mjs'; import './style/css.mjs'; import '../../loading/index.mjs'; import '../../loading/directive.mjs'; import '../../loading/plugin.mjs'; import '../../loading/loading.mjs'; import '../../loading/icon/gradient.mjs'; import '../../_chunks/dep-6b6765a0.mjs'; import '../../_chunks/dep-3ea2b330.mjs'; import '../../loading/props.mjs'; import '../../_chunks/dep-517a8ba2.mjs'; import '../../_chunks/dep-40c5ec80.mjs'; import '../../_chunks/dep-6686ef20.mjs'; 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; } function emitEvent(props, context, evtName) { var apiName = camelCase("on-".concat(evtName)); evtName.replace(/^on/, "").toLowerCase(); for (var _len = arguments.length, args = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { args[_key - 3] = arguments[_key]; } if (typeof props[apiName] === "function") { props[apiName].apply(props, args); } if (!isVueNext) { context.emit.apply(context, [evtName].concat(args)); } } function getParentsToRoot(element, root) { var list = []; var el = element; while (el && el.parentNode) { list.push(el); if (el === root) { break; } el = el.parentNode; } return list; } function getParentMarks(name, element, root) { var list = getParentsToRoot(element, root); return list.map(function (el) { var mark = { name: name, value: (el === null || el === void 0 ? void 0 : el.getAttribute(name)) || "", el: el }; return mark; }).filter(function (mark) { return mark.value; }); } function getMark(name, element, root) { var list = getParentMarks(name, element, root); var info = list.pop() || null; return info; } function pathMatchClass(name, element, root) { var list = getParentsToRoot(element, root); var rs = list.some(function (el) { return el.classList.contains(name); }); return rs; } function getTNode(prop, options) { var tnode = null; var item = null; var conf = _objectSpread({}, options); if (typeof prop === "function") { var _conf$node; item = prop(conf.createElement, (_conf$node = conf.node) === null || _conf$node === void 0 ? void 0 : _conf$node.getModel()); } else if (typeof prop === "string") { item = prop; } if (typeof item === "string") { tnode = item; } else if (item) { tnode = item; } return tnode; } function getLineModel(nodes, node, index) { var lineModel = { top: false, right: false, bottom: false, left: false }; var nodeChildren = []; if (Array.isArray(node.children)) { nodeChildren = node.children; } var childNode = nodes[index - 1] || null; var nodeItemIndex = childNode ? childNode.getIndex() : 0; if (index === 0) { lineModel.left = !!node.parent; lineModel.bottom = node.children && node.expanded; lineModel.right = node.parent && !node.children; } else if (index === 1) { lineModel.top = true; lineModel.right = true; lineModel.bottom = nodeItemIndex < nodeChildren.length - 1; } else if (nodeItemIndex < nodeChildren.length - 1) { lineModel.top = true; lineModel.bottom = true; } return lineModel; } function isTreeNodeValue(item) { return typeof item === "string" || typeof item === "number"; } function getNode(store, item) { var node = null; var val = null; if (typeof item === "string" || typeof item === "number") { val = item; } else if (item && isTreeNodeValue(item.value)) { val = item.value; } node = store.getNode(val); return node; } export { emitEvent, getLineModel, getMark, getNode, getParentMarks, getParentsToRoot, getTNode, isTreeNodeValue, pathMatchClass }; //# sourceMappingURL=index.mjs.map