tdesign-vue
Version:
38 lines (34 loc) • 1.65 kB
JavaScript
/**
* tdesign v1.11.2
* (c) 2025 tdesign
* @license MIT
*/
import { h } from '@vue/composition-api';
import { isString, isFunction } from 'lodash-es';
import { ItemsType } from '../interface.js';
function renderCustomNode(node) {
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (isString(node)) {
return node;
}
if (isFunction(node)) {
return node(h, params);
}
if (isFunction(node.render)) {
return h(node);
}
return node;
}
function renderVNodeTNode(node, name1, name2) {
var _node$componentOption, _node$data$scopedSlot, _node$data$scopedSlot2, _node$data$scopedSlot3, _node$data$scopedSlot4;
var prop = (_node$componentOption = node.componentOptions.propsData) === null || _node$componentOption === void 0 ? void 0 : _node$componentOption[name1];
if (prop) return prop;
var slot = ((_node$data$scopedSlot = node.data.scopedSlots) === null || _node$data$scopedSlot === void 0 || (_node$data$scopedSlot2 = _node$data$scopedSlot[name1]) === null || _node$data$scopedSlot2 === void 0 ? void 0 : _node$data$scopedSlot2.call(_node$data$scopedSlot)) || ((_node$data$scopedSlot3 = node.data.scopedSlots) === null || _node$data$scopedSlot3 === void 0 || (_node$data$scopedSlot4 = _node$data$scopedSlot3[name2]) === null || _node$data$scopedSlot4 === void 0 ? void 0 : _node$data$scopedSlot4.call(_node$data$scopedSlot3));
if (slot) return slot;
return node.componentOptions.children;
}
function itemTypeIsProps(itemsType, item) {
return itemsType === ItemsType.props;
}
export { itemTypeIsProps, renderCustomNode, renderVNodeTNode };
//# sourceMappingURL=index.js.map