tdesign-pro-component
Version:
ProComponents tdesign-vue-next + Vue3 + TS
71 lines (70 loc) • 1.46 kB
JavaScript
import { isFunction as c } from "lodash-es";
function d(n, r, e, ...t) {
return (...u) => r[n] ? r[n](...t, ...u) : c(e[n]) ? e[n](...t, ...u) : e[n] || null;
}
function b(n) {
const r = (e) => {
n.forEach((t) => {
e.use(t);
});
};
return console.log("欢迎使用 tdesign-pro-component"), r;
}
function g(n) {
return n.install = (r) => {
const e = n.name;
r.component(e, n);
}, n;
}
function s(n) {
return toString.call(n).substring(7, toString.call(n).length - 1).toLowerCase().trim();
}
function a(n, r) {
return r.toLowerCase().trim() == s(n);
}
function o(n) {
return a(n, "function") || a(n, "asyncfunction");
}
function w(n, r = "label", e = "value") {
return new Promise((t) => {
if (!o(n) && !Array.isArray(n) && t([]), o(n))
n().then((u) => {
const i = u.map((l) => ({
label: l[r],
value: l[e],
disabled: l.disabled,
render: l.render
}));
t(i);
});
else {
const u = n.map((i) => ({
...i,
label: i[r],
value: i[e],
disabled: i.disabled,
render: i.render
}));
t(u);
}
});
}
function S(n) {
console.warn("tdesign-pro-component: ", n);
}
function h(n, r, e) {
let t = e || "default";
if (n[t])
return n[t]();
if (r[t] !== !1 && r[t])
return o(r[t]) ? r[t]() : r[t];
}
export {
h as a,
w as b,
S as c,
b as d,
d as g,
o as i,
g as w
};