UNPKG

mldong-flow-designer-plus

Version:

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

68 lines (67 loc) 2.12 kB
import { b as buildProp, s as isNumber, y as isStringNumber, x as isString, f as debugWarn, m as isClient, w as isShadowRoot, c as camelize } from "./error-DEV4o0cD.js"; import { inject, computed, unref } from "vue"; const componentSizes = [ "", "default", "small", "large" ]; const useSizeProp = buildProp({ type: String, values: componentSizes, required: false }); const SIZE_INJECTION_KEY = Symbol("size"); const useGlobalSize = () => { const injectedSize = inject(SIZE_INJECTION_KEY, {}); return computed(() => { return unref(injectedSize.size) || ""; }); }; const SCOPE = "utils/dom/style"; const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim()); const hasClass = (el, cls) => { if (!el || !cls) return false; if (cls.includes(" ")) throw new Error("className should not contain space."); return el.classList.contains(cls); }; const addClass = (el, cls) => { if (!el || !cls.trim()) return; el.classList.add(...classNameToArray(cls)); }; const removeClass = (el, cls) => { if (!el || !cls.trim()) return; el.classList.remove(...classNameToArray(cls)); }; const getStyle = (element, styleName) => { var _a; if (!isClient || !element || !styleName || isShadowRoot(element)) return ""; let key = camelize(styleName); if (key === "float") key = "cssFloat"; try { const style = element.style[key]; if (style) return style; const computed2 = (_a = document.defaultView) == null ? void 0 : _a.getComputedStyle(element, ""); return computed2 ? computed2[key] : ""; } catch { return element.style[key]; } }; function addUnit(value, defaultUnit = "px") { if (!value && value !== 0) return ""; if (isNumber(value) || isStringNumber(value)) return `${value}${defaultUnit}`; else if (isString(value)) return value; debugWarn(SCOPE, "binding value must be a string or number"); } export { SIZE_INJECTION_KEY as S, addClass as a, addUnit as b, componentSizes as c, useSizeProp as d, getStyle as g, hasClass as h, removeClass as r, useGlobalSize as u }; //# sourceMappingURL=style-D2s_cWsv.js.map