epic-designer
Version:
基于vue3的设计器,可视化开发页面表单
179 lines (178 loc) • 4.9 kB
JavaScript
import { ref as J } from "vue";
/* empty css */
/* empty css */
/* empty css */
/* empty css */
import "vue-draggable-plus";
import "../../git/epic/epic-designer/node_modules/.pnpm/jsep@1.4.0/node_modules/jsep/dist/jsep.js";
import "@vueuse/core";
import "../../hooks/src/store/index.js";
import { useComponentManager as Q } from "../../hooks/src/plugin/useComponentManager.js";
import { useFormSchema as R } from "../../hooks/src/plugin/useFormSchema.js";
import { useGlobal as U } from "../../hooks/src/plugin/useGlobal.js";
import { useHookManager as V } from "../../hooks/src/plugin/useHookManager.js";
import { usePanel as X } from "../../hooks/src/plugin/usePanel.js";
import { usePublicMethods as Y } from "../../hooks/src/plugin/usePublicMethods.js";
function Z() {
const { formSchema: o, setFormSchema: t } = R(), {
addBaseComponentType: n,
addComponent: r,
baseComponentTypes: i,
clearComponentGroupNameMap: e,
clearSortedGroups: a,
componentConfigs: m,
componentGroupNameMap: y,
components: b,
componentSchemaGroups: G,
getComponent: s,
getComponentConfigByType: p,
getComponentConfigs: v,
getComponents: S,
getComponentSchemaGroups: P,
getIcon: w,
getLabel: B,
getLocked: N,
hiddenComponents: T,
hideComponent: c,
registerComponent: g,
removeBaseComponents: k,
removeComponent: d,
setBaseComponentTypes: A,
setComponentGroupNameMap: u,
setHideComponents: l,
setSortedGroups: I,
showComponent: C,
sortedGroups: x
} = Q(), h = J(!1), {
activityBars: F,
hideActivitybar: j,
hideRightSidebar: E,
registerActivitybar: H,
registerRightSidebar: O,
rightSidebars: $,
showActivitybar: z,
showRightSidebar: L
} = X(), { addPublicMethod: f, methodsMap: W, removePublicMethod: M } = Y(), { global: D } = U({
// 请求服务基础地址
axiosConfig: {
headers: {}
},
// 上传文件地址
uploadFile: null,
// 上传图片地址
uploadImage: null
}), K = V();
function _(q) {
h.value = q;
}
return ee({
component: {
add: r,
addBaseComponentType: n,
baseComponentTypes: i,
clearComponentGroupNameMap: e,
clearGroupNameMap: e,
clearSortedGroups: a,
componentConfigs: m,
componentGroupNameMap: y,
components: b,
componentSchemaGroups: G,
get: s,
getComponent: s,
getComponentConfigByType: p,
getComponentConfigs: v,
getComponents: S,
getComponentSchemaGroups: P,
getConfigByType: p,
getIcon: w,
getLabel: B,
getLocked: N,
hiddenComponents: T,
hide: c,
hideComponent: c,
hideComponents: l,
register: g,
registerComponent: g,
remove: d,
removeBaseComponents: k,
removeComponent: d,
setBaseComponentTypes: A,
setComponentGroupNameMap: u,
setGroupNameMap: u,
setHideComponents: l,
setSortedGroups: I,
show: C,
showComponent: C,
sortedGroups: x
},
designer: {
formSchema: o,
initialized: h,
setFormSchema: t,
setInitialized: _
},
global: D,
hook: K,
panel: {
activityBars: F,
hideActivitybar: j,
hideRightSidebar: E,
registerActivitybar: H,
registerRightSidebar: O,
rightSidebars: $,
showActivitybar: z,
showRightSidebar: L
},
publicMethods: {
add: f,
addPublicMethod: f,
methodsMap: W,
remove: M,
removePublicMethod: M
}
});
}
function ee(o) {
const t = oe(o), n = Object.keys(o), r = {
addPublicMethod: "add",
clearComponentGroupNameMap: "clearGroupNameMap",
getComponent: "get",
getComponentConfigByType: "getConfigByType",
hideComponent: "hide",
registerComponent: "register",
removeComponent: "remove",
removePublicMethod: "remove",
setComponentGroupNameMap: "setGroupNameMap",
setHideComponents: "hideComponents",
showComponent: "show"
};
return new Proxy(o, {
get(i, e) {
if (n.includes(e))
return o[e];
if (e in t) {
const a = t[e], m = e;
return r[e] && (e = r[e]), console.warn(
`Epic Designer: 检测到已过时的 API 使用方式, 请尽快迁移到新 API.
❌ 旧写法: pluginManager.${String(m)}
✅ 新写法: pluginManager.${String(a)}.${String(e)}`
), o[a][e];
}
return o[e];
}
});
}
function oe(o) {
const t = {};
return Object.keys(o).forEach((n) => {
const r = o[n];
Object.keys(r).forEach((i) => {
t[i] = n;
});
}), t;
}
const Me = Z();
export {
Z as createPluginManager,
Me as pluginManager
};