UNPKG

mldong-flow-designer-plus

Version:

本项目包含了作者为B站课堂视频[《工作流设计器开发最佳实践》](https://www.bilibili.com/cheese/play/ss24484)的过程源码。教程中开发的组件也可用于实际生产环境中。以下是和使用文档和课程章节说明。 ## 实战项目 [演示地址](https://flow-pro.mldong.com/)

39 lines (38 loc) 1.5 kB
import { ref, getCurrentInstance, inject, computed, unref } from "vue"; import { j as isNumber, h as isClient, f as debugWarn } from "./install-La2G4dPY.js"; const initial = { current: 0 }; const zIndex = ref(0); const defaultInitialZIndex = 2e3; const ZINDEX_INJECTION_KEY = Symbol("elZIndexContextKey"); const zIndexContextKey = Symbol("zIndexContextKey"); const useZIndex = (zIndexOverrides) => { const increasingInjection = getCurrentInstance() ? inject(ZINDEX_INJECTION_KEY, initial) : initial; const zIndexInjection = zIndexOverrides || (getCurrentInstance() ? inject(zIndexContextKey, void 0) : void 0); const initialZIndex = computed(() => { const zIndexFromInjection = unref(zIndexInjection); return isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex; }); const currentZIndex = computed(() => initialZIndex.value + zIndex.value); const nextZIndex = () => { increasingInjection.current++; zIndex.value = increasingInjection.current; return currentZIndex.value; }; if (!isClient && !inject(ZINDEX_INJECTION_KEY)) { debugWarn("ZIndexInjection", `Looks like you are using server rendering, you must provide a z-index provider to ensure the hydration process to be succeed usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`); } return { initialZIndex, currentZIndex, nextZIndex }; }; export { defaultInitialZIndex as d, useZIndex as u, zIndexContextKey as z }; //# sourceMappingURL=index-CiiJvH0P.js.map