UNPKG

ai-form-designer

Version:

vue3+adv的设计器,可视化开发页面表单

452 lines (451 loc) 17 kB
import { c as _ } from "./_commonjsHelpers-BVfed4GL.js"; import { c as J, a as F, d as se, b as Q, _ as X, e as L, p as Y, r as ce } from "./index-CFbzusj4.js"; import { r as H } from "./_vue_commonjs-external-NwvjgbHK.js"; import { _ as Z, i as de } from "./index-B5s4z2wp.js"; function pe(e, o) { for (var i = 0; i < o.length; i++) { const a = o[i]; if (typeof a != "string" && !Array.isArray(a)) { for (const t in a) if (t !== "default" && !(t in e)) { const s = Object.getOwnPropertyDescriptor(a, t); s && Object.defineProperty(e, t, s.get ? s : { enumerable: !0, get: () => a[t] }); } } } return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" })); } var ee = {}, U = {}, te = {}, W = {}, D = {}; Object.defineProperty(D, "__esModule", { value: !0 }); D.self = re; const ue = J; function re(e) { const { fontWeight: o, textColor1: i, textColor2: a, textColorDisabled: t, dividerColor: s, fontSize: f } = e; return { titleFontSize: f, titleFontWeight: o, dividerColor: s, titleTextColor: i, titleTextColorDisabled: t, fontSize: f, textColor: a, arrowColor: a, arrowColorDisabled: t, itemMargin: "16px 0 0 0", titlePadding: "16px 0 0 0" }; } const fe = { name: "Collapse", common: ue.commonLight, self: re }; D.default = fe; Object.defineProperty(W, "__esModule", { value: !0 }); const me = J, he = D, ge = { name: "Collapse", common: me.commonDark, self: he.self }; W.default = ge; var T = {}, q = {}; Object.defineProperty(q, "__esModule", { value: !0 }); const m = F; q.default = (0, m.cB)("collapse", [(0, m.cM)("rtl", ` direction: rtl; `, [(0, m.cB)("collapse-item", [(0, m.cB)("collapse-item", { marginRight: "32px", marginLeft: 0 }), (0, m.cM)("left-arrow-placement", [(0, m.cE)("header", [(0, m.cB)("collapse-item-arrow", { marginRight: 0, marginLeft: "4px" })])]), (0, m.cM)("right-arrow-placement", [(0, m.cE)("header", [(0, m.cB)("collapse-item-arrow", { marginLeft: 0, marginRight: "4px" })])]), (0, m.cM)("active", [(0, m.cE)("header", [(0, m.cM)("active", [(0, m.cB)("collapse-item-arrow", { transform: "rotate(-90deg)" })])])])])])]); var _e = _ && _.__importDefault || function(e) { return e && e.__esModule ? e : { default: e }; }; Object.defineProperty(T, "__esModule", { value: !0 }); T.collapseRtl = void 0; const ve = _e(q); T.collapseRtl = { name: "Collapse", style: ve.default }; (function(e) { var o = _ && _.__importDefault || function(s) { return s && s.__esModule ? s : { default: s }; }; Object.defineProperty(e, "__esModule", { value: !0 }), e.collapseRtl = e.collapseLight = e.collapseDark = void 0; var i = W; Object.defineProperty(e, "collapseDark", { enumerable: !0, get: function() { return o(i).default; } }); var a = D; Object.defineProperty(e, "collapseLight", { enumerable: !0, get: function() { return o(a).default; } }); var t = T; Object.defineProperty(e, "collapseRtl", { enumerable: !0, get: function() { return t.collapseRtl; } }); })(te); var K = {}, V = {}, be = _ && _.__importDefault || function(e) { return e && e.__esModule ? e : { default: e }; }; Object.defineProperty(V, "__esModule", { value: !0 }); V.fadeInHeightExpandTransition = Ce; const z = F, xe = be(se), { cubicBezierEaseInOut: x, cubicBezierEaseOut: $e, cubicBezierEaseIn: ye } = xe.default; function Ce({ overflow: e = "hidden", duration: o = ".3s", originalTransition: i = "", leavingDelay: a = "0s", foldPadding: t = !1, enterToProps: s = void 0, leaveToProps: f = void 0, reverse: I = !1 } = {}) { const w = I ? "leave" : "enter", l = I ? "enter" : "leave"; return [(0, z.c)(`&.fade-in-height-expand-transition-${l}-from, &.fade-in-height-expand-transition-${w}-to`, Object.assign(Object.assign({}, s), { opacity: 1 })), (0, z.c)(`&.fade-in-height-expand-transition-${l}-to, &.fade-in-height-expand-transition-${w}-from`, Object.assign(Object.assign({}, f), { opacity: 0, marginTop: "0 !important", marginBottom: "0 !important", paddingTop: t ? "0 !important" : void 0, paddingBottom: t ? "0 !important" : void 0 })), (0, z.c)(`&.fade-in-height-expand-transition-${l}-active`, ` overflow: ${e}; transition: max-height ${o} ${x} ${a}, opacity ${o} ${$e} ${a}, margin-top ${o} ${x} ${a}, margin-bottom ${o} ${x} ${a}, padding-top ${o} ${x} ${a}, padding-bottom ${o} ${x} ${a} ${i ? `,${i}` : ""} `), (0, z.c)(`&.fade-in-height-expand-transition-${w}-active`, ` overflow: ${e}; transition: max-height ${o} ${x}, opacity ${o} ${ye}, margin-top ${o} ${x}, margin-bottom ${o} ${x}, padding-top ${o} ${x}, padding-bottom ${o} ${x} ${i ? `,${i}` : ""} `)]; } Object.defineProperty(K, "__esModule", { value: !0 }); const we = V, r = F; K.default = (0, r.cB)("collapse", "width: 100%;", [(0, r.cB)("collapse-item", ` font-size: var(--n-font-size); color: var(--n-text-color); transition: color .3s var(--n-bezier), border-color .3s var(--n-bezier); margin: var(--n-item-margin); `, [(0, r.cM)("disabled", [(0, r.cE)("header", "cursor: not-allowed;", [(0, r.cE)("header-main", ` color: var(--n-title-text-color-disabled); `), (0, r.cB)("collapse-item-arrow", ` color: var(--n-arrow-color-disabled); `)])]), (0, r.cB)("collapse-item", "margin-left: 32px;"), (0, r.c)("&:first-child", "margin-top: 0;"), (0, r.c)("&:first-child >", [(0, r.cE)("header", "padding-top: 0;")]), (0, r.cM)("left-arrow-placement", [(0, r.cE)("header", [(0, r.cB)("collapse-item-arrow", "margin-right: 4px;")])]), (0, r.cM)("right-arrow-placement", [(0, r.cE)("header", [(0, r.cB)("collapse-item-arrow", "margin-left: 4px;")])]), (0, r.cE)("content-wrapper", [(0, r.cE)("content-inner", "padding-top: 16px;"), (0, we.fadeInHeightExpandTransition)({ duration: "0.15s" })]), (0, r.cM)("active", [(0, r.cE)("header", [(0, r.cM)("active", [(0, r.cB)("collapse-item-arrow", "transform: rotate(90deg);")])])]), (0, r.c)("&:not(:first-child)", "border-top: 1px solid var(--n-divider-color);"), (0, r.cNotM)("disabled", [(0, r.cM)("trigger-area-main", [(0, r.cE)("header", [(0, r.cE)("header-main", "cursor: pointer;"), (0, r.cB)("collapse-item-arrow", "cursor: default;")])]), (0, r.cM)("trigger-area-arrow", [(0, r.cE)("header", [(0, r.cB)("collapse-item-arrow", "cursor: pointer;")])]), (0, r.cM)("trigger-area-extra", [(0, r.cE)("header", [(0, r.cE)("header-extra", "cursor: pointer;")])])]), (0, r.cE)("header", ` font-size: var(--n-title-font-size); display: flex; flex-wrap: nowrap; align-items: center; transition: color .3s var(--n-bezier); position: relative; padding: var(--n-title-padding); color: var(--n-title-text-color); `, [(0, r.cE)("header-main", ` display: flex; flex-wrap: nowrap; align-items: center; font-weight: var(--n-title-font-weight); transition: color .3s var(--n-bezier); flex: 1; color: var(--n-title-text-color); `), (0, r.cE)("header-extra", ` display: flex; align-items: center; transition: color .3s var(--n-bezier); color: var(--n-text-color); `), (0, r.cB)("collapse-item-arrow", ` display: flex; transition: transform .15s var(--n-bezier), color .3s var(--n-bezier); font-size: 18px; color: var(--n-arrow-color); `)])])]); (function(e) { var o = _ && _.__importDefault || function(l) { return l && l.__esModule ? l : { default: l }; }; Object.defineProperty(e, "__esModule", { value: !0 }), e.collapseInjectionKey = e.collapseProps = void 0; const i = L, a = H, t = Q, s = Y, f = X, I = te, w = o(K); e.collapseProps = Object.assign(Object.assign({}, t.useTheme.props), { defaultExpandedNames: { type: [Array, String], default: null }, expandedNames: [Array, String], arrowPlacement: { type: String, default: "left" }, accordion: { type: Boolean, default: !1 }, displayDirective: { type: String, default: "if" }, triggerAreas: { type: Array, default: () => ["main", "extra", "arrow"] }, onItemHeaderClick: [Function, Array], "onUpdate:expandedNames": [Function, Array], onUpdateExpandedNames: [Function, Array], // deprecated onExpandedNamesChange: { type: [Function, Array], validator: () => (process.env.NODE_ENV !== "production" && (0, f.warn)("collapse", "`on-expanded-names-change` is deprecated, please use `on-update:expanded-names` instead."), !0), default: void 0 } }), e.collapseInjectionKey = (0, f.createInjectionKey)("n-collapse"), e.default = (0, a.defineComponent)({ name: "Collapse", props: e.collapseProps, slots: Object, setup(l, { slots: k }) { const { mergedClsPrefixRef: R, inlineThemeDisabled: u, mergedRtlRef: C } = (0, t.useConfig)(l), $ = (0, a.ref)(l.defaultExpandedNames), h = (0, a.computed)(() => l.expandedNames), y = (0, i.useMergedState)(h, $), p = (0, t.useTheme)("Collapse", "-collapse", w.default, I.collapseLight, l, R); function g(d) { const { "onUpdate:expandedNames": c, onUpdateExpandedNames: b, onExpandedNamesChange: N } = l; b && (0, f.call)(b, d), c && (0, f.call)(c, d), N && (0, f.call)(N, d), $.value = d; } function v(d) { const { onItemHeaderClick: c } = l; c && (0, f.call)(c, d); } function j(d, c, b) { const { accordion: N } = l, { value: B } = y; if (N) d ? (g([c]), v({ name: c, expanded: !0, event: b })) : (g([]), v({ name: c, expanded: !1, event: b })); else if (!Array.isArray(B)) g([c]), v({ name: c, expanded: !0, event: b }); else { const P = B.slice(), S = P.findIndex((A) => c === A); ~S ? (P.splice(S, 1), g(P), v({ name: c, expanded: !1, event: b })) : (P.push(c), g(P), v({ name: c, expanded: !0, event: b })); } } (0, a.provide)(e.collapseInjectionKey, { props: l, mergedClsPrefixRef: R, expandedNamesRef: y, slots: k, toggleItem: j }); const M = (0, s.useRtl)("Collapse", C, R), O = (0, a.computed)(() => { const { common: { cubicBezierEaseInOut: d }, self: { titleFontWeight: c, dividerColor: b, titlePadding: N, titleTextColor: B, titleTextColorDisabled: P, textColor: S, arrowColor: A, fontSize: oe, titleFontSize: le, arrowColorDisabled: ne, itemMargin: ie } } = p.value; return { "--n-font-size": oe, "--n-bezier": d, "--n-text-color": S, "--n-divider-color": b, "--n-title-padding": N, "--n-title-font-size": le, "--n-title-text-color": B, "--n-title-text-color-disabled": P, "--n-title-font-weight": c, "--n-arrow-color": A, "--n-arrow-color-disabled": ne, "--n-item-margin": ie }; }), n = u ? (0, t.useThemeClass)("collapse", void 0, O, l) : void 0; return { rtlEnabled: M, mergedTheme: p, mergedClsPrefix: R, cssVars: u ? void 0 : O, themeClass: n == null ? void 0 : n.themeClass, onRender: n == null ? void 0 : n.onRender }; }, render() { var l; return (l = this.onRender) === null || l === void 0 || l.call(this), (0, a.h)("div", { class: [ `${this.mergedClsPrefix}-collapse`, this.rtlEnabled && `${this.mergedClsPrefix}-collapse--rtl`, this.themeClass ], style: this.cssVars }, this.$slots); } }); })(U); var ae = {}, G = {}; Object.defineProperty(G, "__esModule", { value: !0 }); const Pe = L, E = H, Ee = Z; G.default = (0, E.defineComponent)({ name: "CollapseItemContent", props: { displayDirective: { type: String, required: !0 }, show: Boolean, clsPrefix: { type: String, required: !0 } }, setup(e) { return { onceTrue: (0, Pe.useFalseUntilTruthy)((0, E.toRef)(e, "show")) }; }, render() { return (0, E.h)(Ee.NFadeInExpandTransition, null, { default: () => { const { show: e, displayDirective: o, onceTrue: i, clsPrefix: a } = this, t = o === "show" && i, s = (0, E.h)( "div", { class: `${a}-collapse-item__content-wrapper` }, (0, E.h)("div", { class: `${a}-collapse-item__content-inner` }, this.$slots) ); return t ? (0, E.withDirectives)(s, [[E.vShow, e]]) : e ? s : null; } }); } }); (function(e) { var o = _ && _.__importDefault || function(u) { return u && u.__esModule ? u : { default: u }; }; Object.defineProperty(e, "__esModule", { value: !0 }), e.collapseItemProps = void 0; const i = ce, a = L, t = H, s = Z, f = de, I = Q, w = Y, l = X, k = U, R = o(G); e.collapseItemProps = { title: String, name: [String, Number], disabled: Boolean, displayDirective: String }, e.default = (0, t.defineComponent)({ name: "CollapseItem", props: e.collapseItemProps, setup(u) { const { mergedRtlRef: C } = (0, I.useConfig)(u), $ = (0, i.createId)(), h = (0, a.useMemo)(() => { var n; return (n = u.name) !== null && n !== void 0 ? n : $; }), y = (0, t.inject)(k.collapseInjectionKey); y || (0, l.throwError)("collapse-item", "`n-collapse-item` must be placed inside `n-collapse`."); const { expandedNamesRef: p, props: g, mergedClsPrefixRef: v, slots: j } = y, M = (0, t.computed)(() => { const { value: n } = p; if (Array.isArray(n)) { const { value: d } = h; return !~n.findIndex((c) => c === d); } else if (n) { const { value: d } = h; return d !== n; } return !0; }); return { rtlEnabled: (0, w.useRtl)("Collapse", C, v), collapseSlots: j, randomName: $, mergedClsPrefix: v, collapsed: M, triggerAreas: (0, t.toRef)(g, "triggerAreas"), mergedDisplayDirective: (0, t.computed)(() => { const { displayDirective: n } = u; return n || g.displayDirective; }), arrowPlacement: (0, t.computed)(() => g.arrowPlacement), handleClick(n) { let d = "main"; (0, i.happensIn)(n, "arrow") && (d = "arrow"), (0, i.happensIn)(n, "extra") && (d = "extra"), g.triggerAreas.includes(d) && y && !u.disabled && y.toggleItem(M.value, h.value, n); } }; }, render() { const { collapseSlots: u, $slots: C, arrowPlacement: $, collapsed: h, mergedDisplayDirective: y, mergedClsPrefix: p, disabled: g, triggerAreas: v } = this, j = (0, l.resolveSlotWithTypedProps)(C.header, { collapsed: h }, () => [this.title]), M = C["header-extra"] || u["header-extra"], O = C.arrow || u.arrow; return (0, t.h)( "div", { class: [ `${p}-collapse-item`, `${p}-collapse-item--${$}-arrow-placement`, g && `${p}-collapse-item--disabled`, !h && `${p}-collapse-item--active`, v.map((n) => `${p}-collapse-item--trigger-area-${n}`) ] }, (0, t.h)( "div", { class: [ `${p}-collapse-item__header`, !h && `${p}-collapse-item__header--active` ] }, (0, t.h)( "div", { class: `${p}-collapse-item__header-main`, onClick: this.handleClick }, $ === "right" && j, (0, t.h)("div", { class: `${p}-collapse-item-arrow`, key: this.rtlEnabled ? 0 : 1, "data-arrow": !0 }, (0, l.resolveSlotWithTypedProps)(O, { collapsed: h }, () => [ (0, t.h)(s.NBaseIcon, { clsPrefix: p }, { default: () => this.rtlEnabled ? (0, t.h)(f.ChevronLeftIcon, null) : (0, t.h)(f.ChevronRightIcon, null) }) ])), $ === "left" && j ), (0, l.resolveWrappedSlotWithProps)(M, { collapsed: h }, (n) => (0, t.h)("div", { class: `${p}-collapse-item__header-extra`, onClick: this.handleClick, "data-extra": !0 }, n)) ), (0, t.h)(R.default, { clsPrefix: p, displayDirective: y, show: !h }, C) ); } }); })(ae); (function(e) { var o = _ && _.__importDefault || function(t) { return t && t.__esModule ? t : { default: t }; }; Object.defineProperty(e, "__esModule", { value: !0 }), e.NCollapseItem = e.collapseItemProps = e.NCollapse = e.collapseProps = void 0; var i = U; Object.defineProperty(e, "collapseProps", { enumerable: !0, get: function() { return i.collapseProps; } }), Object.defineProperty(e, "NCollapse", { enumerable: !0, get: function() { return o(i).default; } }); var a = ae; Object.defineProperty(e, "collapseItemProps", { enumerable: !0, get: function() { return a.collapseItemProps; } }), Object.defineProperty(e, "NCollapseItem", { enumerable: !0, get: function() { return o(a).default; } }); })(ee); const Ne = /* @__PURE__ */ pe({ __proto__: null }, [ee]); export { Ne as i };