tdesign-vue
Version:
198 lines (194 loc) • 6.79 kB
JavaScript
/**
* tdesign v1.12.1
* (c) 2025 tdesign
* @license MIT
*/
import _defineProperty from '@babel/runtime/helpers/defineProperty';
import { camelCase } from 'lodash-es';
import { isVueNext } from './adapt.js';
import '@vue/composition-api';
import 'vue';
import '../utils/withInstall.js';
import '../hooks/useVModel.js';
import '../hooks/useDefaultValue.js';
import 'tdesign-icons-vue';
import '../checkbox/index.js';
import '../checkbox/group.js';
import '../_chunks/dep-323b993c.js';
import '@babel/runtime/helpers/typeof';
import '@babel/runtime/helpers/toConsumableArray';
import '@babel/runtime/helpers/slicedToArray';
import '../utils/helper.js';
import '@babel/runtime/helpers/objectWithoutProperties';
import '../checkbox/checkbox.js';
import '../checkbox/props.js';
import '../hooks/index.js';
import '../utils/render-tnode.js';
import '@babel/runtime/helpers/readOnlyError';
import '../hooks/slots.js';
import '../hooks/useCommonClassName.js';
import '../config-provider/useConfig.js';
import '../config-provider/context.js';
import '../_common/js/global-config/default-config.js';
import '../_common/js/global-config/locale/zh_CN.js';
import '../_chunks/dep-c44a474d.js';
import '../_chunks/dep-d639fbd7.js';
import 'dayjs';
import '../_chunks/dep-3c66615e.js';
import '../config-provider/type.js';
import '../_common/js/global-config/t.js';
import '../hooks/useConfig.js';
import '../hooks/useDestroyOnClose.js';
import '../hooks/useElementLazyRender.js';
import '../_common/js/utils/observe.js';
import '../hooks/useFormDisabled.js';
import '../hooks/useGlobalIcon.js';
import '../hooks/useLazyLoad.js';
import '../hooks/useResizeObserver.js';
import '../hooks/useVirtualScrollNew.js';
import '../hooks/useImagePreviewUrl.js';
import '../_common/js/upload/utils.js';
import '../_common/js/log/log.js';
import '../checkbox/constants.js';
import '../checkbox/store.js';
import '@babel/runtime/helpers/classCallCheck';
import '@babel/runtime/helpers/createClass';
import '../checkbox/hooks/useKeyboardEvent.js';
import '../_common/js/common.js';
import '../checkbox/checkbox-group-props.js';
import './style/index.js';
import '../checkbox/type.js';
import '../loading/index.js';
import '../loading/directive.js';
import '../loading/plugin.js';
import '../loading/loading.js';
import '../loading/icon/gradient.js';
import '../_common/js/loading/circle-adapter.js';
import '../_common/js/utils/setStyle.js';
import '../_common/js/utils/helper.js';
import '../config-provider/config-receiver.js';
import '../utils/mixins.js';
import '../utils/dom.js';
import 'raf';
import '../utils/easing.js';
import '../utils/transfer-dom.js';
import '../loading/props.js';
import '../config.js';
import '../loading/type.js';
import '../_common/js/tree/tree-node.js';
import '@babel/runtime/helpers/asyncToGenerator';
import '@babel/runtime/regenerator';
import '../_common/js/tree/tree-node-model.js';
import '../_common/js/log/index.js';
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=util.js.map