@opentiny/vue-renderless
Version:
An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.
30 lines (29 loc) • 1.06 kB
JavaScript
import "../chunk-G2ADBYYC.js";
import { initEspace } from "@opentiny/utils";
import { getUserHref, doUserAction, initEspaceLink, openEspace } from "./index";
import { testUID } from "../espace";
const api = ["show", "getUserHref", "doUserAction", "initEspaceLink", "openEspace", "testUID"];
const renderless = (props, { reactive, ref }, { service }) => {
const api2 = {};
const { setting = {} } = service || {};
const { widgets = {} } = setting;
const eSpaceCtrlDisabled = widgets.ESpaceCtrl && !widgets.ESpaceCtrl.autoLink;
const eSpaceCtrl = eSpaceCtrlDisabled ? {} : initEspace();
const state = reactive({
initialized: false
});
Object.assign(api2, {
state,
testUID,
show: ref(false),
getUserHref: getUserHref({ api: api2, props }),
initEspaceLink: initEspaceLink({ api: api2, props, state, eSpaceCtrl, eSpaceCtrlDisabled }),
doUserAction: doUserAction({ api: api2, props, state, eSpaceCtrl }),
openEspace: openEspace({ api: api2, props, eSpaceCtrl })
});
return api2;
};
export {
api,
renderless
};