UNPKG

@techui/base

Version:

TechUI Base is a basic component library developed based on Vue

141 lines (134 loc) 3.73 kB
import "@techui/icons"; import "./dist/index.css"; import { dynamicEcharts, toComps, toDirective, toGlobal, toRoot } from "./dist/index.js"; const initComps=(app,license,features,debug=false)=>{ const {echarts=false,advanced=false,}=features app.use(toGlobal.$gAttention) // app.use(toGlobal.$gContextMenu) app.use(toGlobal.$gMask) app.use(toGlobal.$gLoading) app.use(toGlobal.$gPopover) app.use(toGlobal.$gPopoverDirectiveCloseAll) app.directive('tuiMenu', toDirective.$dMenu) app.directive('tuiResize', toDirective.$dResize) app.directive('tuiDrag', toDirective.$dDrag) app.directive('tuiPopover', toDirective.$dPopover) app.directive('tuiCursorTip', toDirective.$dCursorTip) app.directive('tuiVcid', toDirective.$dVcid) const tService=toRoot.tuiService(advanced,debug) app.config.globalProperties.$tBus = toRoot.tuiBus app.config.globalProperties.$tService = tService app.config.globalProperties.$tState = tService.state app.config.globalProperties.isActAdvFeatures = advanced||license!=null app.config.globalProperties.isActEchartsFeatures = echarts app.config.globalProperties.isActAdminFeatures=false const advanceComps=[ "Tui3DPanel", "TuiBar3D", "TuiBar3DGroup", "TuiPie", "TuiToggleT3DPanel", "TuiPanicAlert", ] dynamicEcharts(app,echarts); toComps.forEach((com) => { if(com.name){ const isAdvanced = advanceComps.includes(com.name); const isEcharts = com.name.includes("Echarts"); const skipAdvanced = isAdvanced && !advanced && !license; const skipEcharts = isEcharts && !echarts; const shouldSkip = skipAdvanced || skipEcharts; if (!shouldSkip) { app.component(com.name, com); } }else{ console.warn("TechUI Warning: Missing component name",com); } }); }; import { initLang } from "@techui/utils"; import init, { coreInfo, techuiCoreInit } from './core/core.js'; export { adptCalc, bar3DPathGen, cidGen, cidVaild, coreConsoleError, coreConsoleInfo, coreConsoleWarn, cssVarGen, floatInfo, getEnv, getVer, md5Enc, openDec, openEnc, pieArcPathGen, svgPatBlocks, svgPatCircuitDiagram, svgPatCircularOverlayA, svgPatCircularOverlayB, svgPatContourLine, svgPatCrosshairA, svgPatCrosshairB, svgPatCubeA, svgPatCubeB, svgPatCubeC, svgPatDiamondFlipped, svgPatDiamondLattice, svgPatDiamondPixel, svgPatDiamondWeaving, svgPatDots, svgPatHexagonA, svgPatHexagonB, svgPatHexagonC, svgPatHexagonCurved, svgPatHexagonD, svgPatLineGrid, svgPatLineWeaving, svgPatMazeA, svgPatMazeB, svgPatMazeC, svgPatMountains, svgPatRain, svgPatRectWeavingA, svgPatRectWeavingB, svgPatRectWeavingC, svgPatShellA, svgPatShellB, svgPatSlashParallel, svgPatTest, svgPatTotem, svgPatTriangleA, svgPatTriangleB, svgPatWaveA, svgPatWaveB, svgPatZigzagA, svgPatZigzagB, svgSpinBarsA, svgSpinBarsB, svgSpinBarsC, svgSpinBlocksA, svgSpinBlocksB, svgSpinBlocksC, svgSpinClock, svgSpinPointA, svgSpinPointB, svgSpinPointC, svgSpinPulseDotA, svgSpinPulseDotB, svgSpinPulseDotC, svgSpinPulseRingA, svgSpinPulseRingB, svgSpinPulseRingC, svgSpinRingA, svgSpinRingB, svgSpinRingC, t3dCoeffCalc, t3dUpdateOrient, t3dUpdateRotate } from './core/core.js'; const coreEnt=async ({ app, license=null, subLicense=null, features={}, debug=false })=>{ initLang(); await init(); window.tuiCoreInfo=coreInfo techuiCoreInit(license,subLicense,coreEnt.toString()); app.use(initComps,license,features,debug) }; export default coreEnt