UNPKG

mldong-flow-designer-plus

Version:

本项目包含了作者为B站课堂视频[《工作流设计器开发最佳实践》](https://www.bilibili.com/cheese/play/ss24484)的过程源码。教程中开发的组件也可用于实际生产环境中。以下是和使用文档和课程章节说明。 ## 演示地址 本工程提供两个演示站,分别覆盖库本身和真实业务集成两种形态:

68 lines (67 loc) 2.12 kB
import { B as buildProp, k as isNumber, C as isStringNumber, e as isString, g as debugWarn, j as isClient, D as isShadowRoot, E as camelize } from "./error-DnK9DIl5.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, addUnit as a, useGlobalSize as b, componentSizes as c, addClass as d, getStyle as g, hasClass as h, removeClass as r, useSizeProp as u }; //# sourceMappingURL=style-1lZfUlv4.js.map