UNPKG

ai-form-designer

Version:

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

1,164 lines (1,163 loc) 44.8 kB
import { c as q } from "./_commonjsHelpers-BVfed4GL.js"; import { r as be } from "./_vue_commonjs-external-NwvjgbHK.js"; import { _ as ut, i as vt } from "./index-B5s4z2wp.js"; import { _ as le, c as _e, a as gt, b as ht, f as mt, e as xt, l as yt, r as Ct } from "./index-CFbzusj4.js"; function Pt(o, l) { for (var c = 0; c < l.length; c++) { const b = l[c]; if (typeof b != "string" && !Array.isArray(b)) { for (const f in b) if (f !== "default" && !(f in o)) { const n = Object.getOwnPropertyDescriptor(b, f); n && Object.defineProperty(o, f, n.get ? n : { enumerable: !0, get: () => b[f] }); } } } return Object.freeze(Object.defineProperty(o, Symbol.toStringTag, { value: "Module" })); } var Be = {}, fe = {}, ee = {}; Object.defineProperty(ee, "__esModule", { value: !0 }); ee.tabsInjectionKey = void 0; const St = le; ee.tabsInjectionKey = (0, St.createInjectionKey)("n-tabs"); var pe = {}; (function(o) { Object.defineProperty(o, "__esModule", { value: !0 }), o.tabPaneProps = void 0; const l = be, c = le, b = ee; o.tabPaneProps = { tab: [String, Number, Object, Function], name: { type: [String, Number], required: !0 }, disabled: Boolean, displayDirective: { type: String, default: "if" }, closable: { type: Boolean, default: void 0 }, tabProps: Object, /** @deprecated */ label: [String, Number, Object, Function] }, o.default = (0, l.defineComponent)({ __TAB_PANE__: !0, name: "TabPane", alias: ["TabPanel"], props: o.tabPaneProps, slots: Object, setup(f) { process.env.NODE_ENV !== "production" && (0, l.watchEffect)(() => { f.label !== void 0 && (0, c.warnOnce)("tab-pane", "`label` is deprecated, please use `tab` instead."); }); const n = (0, l.inject)(b.tabsInjectionKey, null); return n || (0, c.throwError)("tab-pane", "`n-tab-pane` must be placed inside `n-tabs`."), { style: n.paneStyleRef, class: n.paneClassRef, mergedClsPrefix: n.mergedClsPrefixRef }; }, render() { return (0, l.h)("div", { class: [`${this.mergedClsPrefix}-tab-pane`, this.class], style: this.style }, this.$slots); } }); })(pe); (function(o) { Object.defineProperty(o, "__esModule", { value: !0 }), o.tabProps = void 0; const l = be, c = ut, b = vt, f = le, n = ee, G = pe; o.tabProps = Object.assign({ internalLeftPadded: Boolean, internalAddable: Boolean, internalCreatedByPane: Boolean }, (0, f.omit)(G.tabPaneProps, ["displayDirective"])), o.default = (0, l.defineComponent)({ __TAB__: !0, inheritAttrs: !1, name: "Tab", props: o.tabProps, setup(u) { const { mergedClsPrefixRef: s, valueRef: C, typeRef: V, closableRef: D, tabStyleRef: W, addTabStyleRef: B, tabClassRef: A, addTabClassRef: H, tabChangeIdRef: z, onBeforeLeaveRef: t, triggerRef: g, handleAdd: P, activateTab: M, handleClose: S } = (0, l.inject)(n.tabsInjectionKey); return { trigger: g, mergedClosable: (0, l.computed)(() => { if (u.internalAddable) return !1; const { closable: h } = u; return h === void 0 ? D.value : h; }), style: W, addStyle: B, tabClass: A, addTabClass: H, clsPrefix: s, value: C, type: V, handleClose(h) { h.stopPropagation(), !u.disabled && S(u.name); }, activateTab() { if (u.disabled) return; if (u.internalAddable) { P(); return; } const { name: h } = u, m = ++z.id; if (h !== C.value) { const { value: _ } = t; _ ? Promise.resolve(_(u.name, C.value)).then(($) => { $ && z.id === m && M(h); }) : M(h); } } }; }, render() { const { internalAddable: u, clsPrefix: s, name: C, disabled: V, label: D, tab: W, value: B, mergedClosable: A, trigger: H, $slots: { default: z } } = this, t = D ?? W; return (0, l.h)( "div", { class: `${s}-tabs-tab-wrapper` }, this.internalLeftPadded ? (0, l.h)("div", { class: `${s}-tabs-tab-pad` }) : null, (0, l.h)( "div", Object.assign({ key: C, "data-name": C, "data-disabled": V ? !0 : void 0 }, (0, l.mergeProps)({ class: [ `${s}-tabs-tab`, B === C && `${s}-tabs-tab--active`, V && `${s}-tabs-tab--disabled`, A && `${s}-tabs-tab--closable`, u && `${s}-tabs-tab--addable`, u ? this.addTabClass : this.tabClass ], onClick: H === "click" ? this.activateTab : void 0, onMouseenter: H === "hover" ? this.activateTab : void 0, style: u ? this.addStyle : this.style }, this.internalCreatedByPane ? this.tabProps || {} : this.$attrs)), (0, l.h)("span", { class: `${s}-tabs-tab__label` }, u ? (0, l.h)( l.Fragment, null, (0, l.h)("div", { class: `${s}-tabs-tab__height-placeholder` }, " "), (0, l.h)(c.NBaseIcon, { clsPrefix: s }, { default: () => (0, l.h)(b.AddIcon, null) }) ) : z ? z() : typeof t == "object" ? t : (0, f.render)(t ?? C)), A && this.type === "card" ? (0, l.h)(c.NBaseClose, { clsPrefix: s, class: `${s}-tabs-tab__close`, onClick: this.handleClose, disabled: V }) : null ) ); } }); })(fe); var we = {}, Te = {}, ue = {}, re = {}, ve = {}; Object.defineProperty(ve, "__esModule", { value: !0 }); ve.default = { tabFontSizeSmall: "14px", tabFontSizeMedium: "14px", tabFontSizeLarge: "16px", tabGapSmallLine: "36px", tabGapMediumLine: "36px", tabGapLargeLine: "36px", tabGapSmallLineVertical: "8px", tabGapMediumLineVertical: "8px", tabGapLargeLineVertical: "8px", tabPaddingSmallLine: "6px 0", tabPaddingMediumLine: "10px 0", tabPaddingLargeLine: "14px 0", tabPaddingVerticalSmallLine: "6px 12px", tabPaddingVerticalMediumLine: "8px 16px", tabPaddingVerticalLargeLine: "10px 20px", tabGapSmallBar: "36px", tabGapMediumBar: "36px", tabGapLargeBar: "36px", tabGapSmallBarVertical: "8px", tabGapMediumBarVertical: "8px", tabGapLargeBarVertical: "8px", tabPaddingSmallBar: "4px 0", tabPaddingMediumBar: "6px 0", tabPaddingLargeBar: "10px 0", tabPaddingVerticalSmallBar: "6px 12px", tabPaddingVerticalMediumBar: "8px 16px", tabPaddingVerticalLargeBar: "10px 20px", tabGapSmallCard: "4px", tabGapMediumCard: "4px", tabGapLargeCard: "4px", tabGapSmallCardVertical: "4px", tabGapMediumCardVertical: "4px", tabGapLargeCardVertical: "4px", tabPaddingSmallCard: "8px 16px", tabPaddingMediumCard: "10px 20px", tabPaddingLargeCard: "12px 24px", tabPaddingSmallSegment: "4px 0", tabPaddingMediumSegment: "6px 0", tabPaddingLargeSegment: "8px 0", tabPaddingVerticalLargeSegment: "0 8px", tabPaddingVerticalSmallCard: "8px 12px", tabPaddingVerticalMediumCard: "10px 16px", tabPaddingVerticalLargeCard: "12px 20px", tabPaddingVerticalSmallSegment: "0 4px", tabPaddingVerticalMediumSegment: "0 6px", tabGapSmallSegment: "0", tabGapMediumSegment: "0", tabGapLargeSegment: "0", tabGapSmallSegmentVertical: "0", tabGapMediumSegmentVertical: "0", tabGapLargeSegmentVertical: "0", panePaddingSmall: "8px 0 0 0", panePaddingMedium: "12px 0 0 0", panePaddingLarge: "16px 0 0 0", closeSize: "18px", closeIconSize: "14px" }; var _t = q && q.__importDefault || function(o) { return o && o.__esModule ? o : { default: o }; }; Object.defineProperty(re, "__esModule", { value: !0 }); re.self = Re; const Bt = _e, wt = _t(ve); function Re(o) { const { textColor2: l, primaryColor: c, textColorDisabled: b, closeIconColor: f, closeIconColorHover: n, closeIconColorPressed: G, closeColorHover: u, closeColorPressed: s, tabColor: C, baseColor: V, dividerColor: D, fontWeight: W, textColor1: B, borderRadius: A, fontSize: H, fontWeightStrong: z } = o; return Object.assign(Object.assign({}, wt.default), { colorSegment: C, tabFontSizeCard: H, tabTextColorLine: B, tabTextColorActiveLine: c, tabTextColorHoverLine: c, tabTextColorDisabledLine: b, tabTextColorSegment: B, tabTextColorActiveSegment: l, tabTextColorHoverSegment: l, tabTextColorDisabledSegment: b, tabTextColorBar: B, tabTextColorActiveBar: c, tabTextColorHoverBar: c, tabTextColorDisabledBar: b, tabTextColorCard: B, tabTextColorHoverCard: B, tabTextColorActiveCard: c, tabTextColorDisabledCard: b, barColor: c, closeIconColor: f, closeIconColorHover: n, closeIconColorPressed: G, closeColorHover: u, closeColorPressed: s, closeBorderRadius: A, tabColor: C, tabColorSegment: V, tabBorderColor: D, tabFontWeightActive: W, tabFontWeight: W, tabBorderRadius: A, paneTextColor: l, fontWeightStrong: z }); } const Tt = { name: "Tabs", common: Bt.commonLight, self: Re }; re.default = Tt; Object.defineProperty(ue, "__esModule", { value: !0 }); const Rt = _e, zt = re, Mt = { name: "Tabs", common: Rt.commonDark, self(o) { const l = (0, zt.self)(o), { inputColor: c } = o; return l.colorSegment = c, l.tabColorSegment = c, l; } }; ue.default = Mt; (function(o) { var l = q && q.__importDefault || function(f) { return f && f.__esModule ? f : { default: f }; }; Object.defineProperty(o, "__esModule", { value: !0 }), o.tabsLight = o.tabsDark = void 0; var c = ue; Object.defineProperty(o, "tabsDark", { enumerable: !0, get: function() { return l(c).default; } }); var b = re; Object.defineProperty(o, "tabsLight", { enumerable: !0, get: function() { return l(b).default; } }); })(Te); var ge = {}; Object.defineProperty(ge, "__esModule", { value: !0 }); const e = gt; ge.default = (0, e.cB)("tabs", ` box-sizing: border-box; width: 100%; display: flex; flex-direction: column; transition: background-color .3s var(--n-bezier), border-color .3s var(--n-bezier); `, [(0, e.cM)("segment-type", [(0, e.cB)("tabs-rail", [(0, e.c)("&.transition-disabled", [(0, e.cB)("tabs-capsule", ` transition: none; `)])])]), (0, e.cM)("top", [(0, e.cB)("tab-pane", ` padding: var(--n-pane-padding-top) var(--n-pane-padding-right) var(--n-pane-padding-bottom) var(--n-pane-padding-left); `)]), (0, e.cM)("left", [(0, e.cB)("tab-pane", ` padding: var(--n-pane-padding-right) var(--n-pane-padding-bottom) var(--n-pane-padding-left) var(--n-pane-padding-top); `)]), (0, e.cM)("left, right", ` flex-direction: row; `, [(0, e.cB)("tabs-bar", ` width: 2px; right: 0; transition: top .2s var(--n-bezier), max-height .2s var(--n-bezier), background-color .3s var(--n-bezier); `), (0, e.cB)("tabs-tab", ` padding: var(--n-tab-padding-vertical); `)]), (0, e.cM)("right", ` flex-direction: row-reverse; `, [(0, e.cB)("tab-pane", ` padding: var(--n-pane-padding-left) var(--n-pane-padding-top) var(--n-pane-padding-right) var(--n-pane-padding-bottom); `), (0, e.cB)("tabs-bar", ` left: 0; `)]), (0, e.cM)("bottom", ` flex-direction: column-reverse; justify-content: flex-end; `, [(0, e.cB)("tab-pane", ` padding: var(--n-pane-padding-bottom) var(--n-pane-padding-right) var(--n-pane-padding-top) var(--n-pane-padding-left); `), (0, e.cB)("tabs-bar", ` top: 0; `)]), (0, e.cB)("tabs-rail", ` position: relative; padding: 3px; border-radius: var(--n-tab-border-radius); width: 100%; background-color: var(--n-color-segment); transition: background-color .3s var(--n-bezier); display: flex; align-items: center; `, [(0, e.cB)("tabs-capsule", ` border-radius: var(--n-tab-border-radius); position: absolute; pointer-events: none; background-color: var(--n-tab-color-segment); box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .08); transition: transform 0.3s var(--n-bezier); `), (0, e.cB)("tabs-tab-wrapper", ` flex-basis: 0; flex-grow: 1; display: flex; align-items: center; justify-content: center; `, [(0, e.cB)("tabs-tab", ` overflow: hidden; border-radius: var(--n-tab-border-radius); width: 100%; display: flex; align-items: center; justify-content: center; `, [(0, e.cM)("active", ` font-weight: var(--n-font-weight-strong); color: var(--n-tab-text-color-active); `), (0, e.c)("&:hover", ` color: var(--n-tab-text-color-hover); `)])])]), (0, e.cM)("flex", [(0, e.cB)("tabs-nav", ` width: 100%; position: relative; `, [(0, e.cB)("tabs-wrapper", ` width: 100%; `, [(0, e.cB)("tabs-tab", ` margin-right: 0; `)])])]), (0, e.cB)("tabs-nav", ` box-sizing: border-box; line-height: 1.5; display: flex; transition: border-color .3s var(--n-bezier); `, [(0, e.cE)("prefix, suffix", ` display: flex; align-items: center; `), (0, e.cE)("prefix", "padding-right: 16px;"), (0, e.cE)("suffix", "padding-left: 16px;")]), (0, e.cM)("top, bottom", [(0, e.cB)("tabs-nav-scroll-wrapper", [(0, e.c)("&::before", ` top: 0; bottom: 0; left: 0; width: 20px; `), (0, e.c)("&::after", ` top: 0; bottom: 0; right: 0; width: 20px; `), (0, e.cM)("shadow-start", [(0, e.c)("&::before", ` box-shadow: inset 10px 0 8px -8px rgba(0, 0, 0, .12); `)]), (0, e.cM)("shadow-end", [(0, e.c)("&::after", ` box-shadow: inset -10px 0 8px -8px rgba(0, 0, 0, .12); `)])])]), (0, e.cM)("left, right", [(0, e.cB)("tabs-nav-scroll-content", ` flex-direction: column; `), (0, e.cB)("tabs-nav-scroll-wrapper", [(0, e.c)("&::before", ` top: 0; left: 0; right: 0; height: 20px; `), (0, e.c)("&::after", ` bottom: 0; left: 0; right: 0; height: 20px; `), (0, e.cM)("shadow-start", [(0, e.c)("&::before", ` box-shadow: inset 0 10px 8px -8px rgba(0, 0, 0, .12); `)]), (0, e.cM)("shadow-end", [(0, e.c)("&::after", ` box-shadow: inset 0 -10px 8px -8px rgba(0, 0, 0, .12); `)])])]), (0, e.cB)("tabs-nav-scroll-wrapper", ` flex: 1; position: relative; overflow: hidden; `, [(0, e.cB)("tabs-nav-y-scroll", ` height: 100%; width: 100%; overflow-y: auto; scrollbar-width: none; `, [(0, e.c)("&::-webkit-scrollbar, &::-webkit-scrollbar-track-piece, &::-webkit-scrollbar-thumb", ` width: 0; height: 0; display: none; `)]), (0, e.c)("&::before, &::after", ` transition: box-shadow .3s var(--n-bezier); pointer-events: none; content: ""; position: absolute; z-index: 1; `)]), (0, e.cB)("tabs-nav-scroll-content", ` display: flex; position: relative; min-width: 100%; min-height: 100%; width: fit-content; box-sizing: border-box; `), (0, e.cB)("tabs-wrapper", ` display: inline-flex; flex-wrap: nowrap; position: relative; `), (0, e.cB)("tabs-tab-wrapper", ` display: flex; flex-wrap: nowrap; flex-shrink: 0; flex-grow: 0; `), (0, e.cB)("tabs-tab", ` cursor: pointer; white-space: nowrap; flex-wrap: nowrap; display: inline-flex; align-items: center; color: var(--n-tab-text-color); font-size: var(--n-tab-font-size); background-clip: padding-box; padding: var(--n-tab-padding); transition: box-shadow .3s var(--n-bezier), color .3s var(--n-bezier), background-color .3s var(--n-bezier), border-color .3s var(--n-bezier); `, [(0, e.cM)("disabled", { cursor: "not-allowed" }), (0, e.cE)("close", ` margin-left: 6px; transition: background-color .3s var(--n-bezier), color .3s var(--n-bezier); `), (0, e.cE)("label", ` display: flex; align-items: center; z-index: 1; `)]), (0, e.cB)("tabs-bar", ` position: absolute; bottom: 0; height: 2px; border-radius: 1px; background-color: var(--n-bar-color); transition: left .2s var(--n-bezier), max-width .2s var(--n-bezier), opacity .3s var(--n-bezier), background-color .3s var(--n-bezier); `, [(0, e.c)("&.transition-disabled", ` transition: none; `), (0, e.cM)("disabled", ` background-color: var(--n-tab-text-color-disabled) `)]), (0, e.cB)("tabs-pane-wrapper", ` position: relative; overflow: hidden; transition: max-height .2s var(--n-bezier); `), (0, e.cB)("tab-pane", ` color: var(--n-pane-text-color); width: 100%; transition: color .3s var(--n-bezier), background-color .3s var(--n-bezier), opacity .2s var(--n-bezier); left: 0; right: 0; top: 0; `, [(0, e.c)("&.next-transition-leave-active, &.prev-transition-leave-active, &.next-transition-enter-active, &.prev-transition-enter-active", ` transition: color .3s var(--n-bezier), background-color .3s var(--n-bezier), transform .2s var(--n-bezier), opacity .2s var(--n-bezier); `), (0, e.c)("&.next-transition-leave-active, &.prev-transition-leave-active", ` position: absolute; `), (0, e.c)("&.next-transition-enter-from, &.prev-transition-leave-to", ` transform: translateX(32px); opacity: 0; `), (0, e.c)("&.next-transition-leave-to, &.prev-transition-enter-from", ` transform: translateX(-32px); opacity: 0; `), (0, e.c)("&.next-transition-leave-from, &.next-transition-enter-to, &.prev-transition-leave-from, &.prev-transition-enter-to", ` transform: translateX(0); opacity: 1; `)]), (0, e.cB)("tabs-tab-pad", ` box-sizing: border-box; width: var(--n-tab-gap); flex-grow: 0; flex-shrink: 0; `), (0, e.cM)("line-type, bar-type", [(0, e.cB)("tabs-tab", ` font-weight: var(--n-tab-font-weight); box-sizing: border-box; vertical-align: bottom; `, [(0, e.c)("&:hover", { color: "var(--n-tab-text-color-hover)" }), (0, e.cM)("active", ` color: var(--n-tab-text-color-active); font-weight: var(--n-tab-font-weight-active); `), (0, e.cM)("disabled", { color: "var(--n-tab-text-color-disabled)" })])]), (0, e.cB)("tabs-nav", [(0, e.cM)("line-type", [(0, e.cM)("top", [(0, e.cE)("prefix, suffix", ` border-bottom: 1px solid var(--n-tab-border-color); `), (0, e.cB)("tabs-nav-scroll-content", ` border-bottom: 1px solid var(--n-tab-border-color); `), (0, e.cB)("tabs-bar", ` bottom: -1px; `)]), (0, e.cM)("left", [(0, e.cE)("prefix, suffix", ` border-right: 1px solid var(--n-tab-border-color); `), (0, e.cB)("tabs-nav-scroll-content", ` border-right: 1px solid var(--n-tab-border-color); `), (0, e.cB)("tabs-bar", ` right: -1px; `)]), (0, e.cM)("right", [(0, e.cE)("prefix, suffix", ` border-left: 1px solid var(--n-tab-border-color); `), (0, e.cB)("tabs-nav-scroll-content", ` border-left: 1px solid var(--n-tab-border-color); `), (0, e.cB)("tabs-bar", ` left: -1px; `)]), (0, e.cM)("bottom", [(0, e.cE)("prefix, suffix", ` border-top: 1px solid var(--n-tab-border-color); `), (0, e.cB)("tabs-nav-scroll-content", ` border-top: 1px solid var(--n-tab-border-color); `), (0, e.cB)("tabs-bar", ` top: -1px; `)]), (0, e.cE)("prefix, suffix", ` transition: border-color .3s var(--n-bezier); `), (0, e.cB)("tabs-nav-scroll-content", ` transition: border-color .3s var(--n-bezier); `), (0, e.cB)("tabs-bar", ` border-radius: 0; `)]), (0, e.cM)("card-type", [(0, e.cE)("prefix, suffix", ` transition: border-color .3s var(--n-bezier); `), (0, e.cB)("tabs-pad", ` flex-grow: 1; transition: border-color .3s var(--n-bezier); `), (0, e.cB)("tabs-tab-pad", ` transition: border-color .3s var(--n-bezier); `), (0, e.cB)("tabs-tab", ` font-weight: var(--n-tab-font-weight); border: 1px solid var(--n-tab-border-color); background-color: var(--n-tab-color); box-sizing: border-box; position: relative; vertical-align: bottom; display: flex; justify-content: space-between; font-size: var(--n-tab-font-size); color: var(--n-tab-text-color); `, [(0, e.cM)("addable", ` padding-left: 8px; padding-right: 8px; font-size: 16px; justify-content: center; `, [(0, e.cE)("height-placeholder", ` width: 0; font-size: var(--n-tab-font-size); `), (0, e.cNotM)("disabled", [(0, e.c)("&:hover", ` color: var(--n-tab-text-color-hover); `)])]), (0, e.cM)("closable", "padding-right: 8px;"), (0, e.cM)("active", ` background-color: #0000; font-weight: var(--n-tab-font-weight-active); color: var(--n-tab-text-color-active); `), (0, e.cM)("disabled", "color: var(--n-tab-text-color-disabled);")])]), (0, e.cM)("left, right", ` flex-direction: column; `, [(0, e.cE)("prefix, suffix", ` padding: var(--n-tab-padding-vertical); `), (0, e.cB)("tabs-wrapper", ` flex-direction: column; `), (0, e.cB)("tabs-tab-wrapper", ` flex-direction: column; `, [(0, e.cB)("tabs-tab-pad", ` height: var(--n-tab-gap-vertical); width: 100%; `)])]), (0, e.cM)("top", [(0, e.cM)("card-type", [(0, e.cB)("tabs-scroll-padding", "border-bottom: 1px solid var(--n-tab-border-color);"), (0, e.cE)("prefix, suffix", ` border-bottom: 1px solid var(--n-tab-border-color); `), (0, e.cB)("tabs-tab", ` border-top-left-radius: var(--n-tab-border-radius); border-top-right-radius: var(--n-tab-border-radius); `, [(0, e.cM)("active", ` border-bottom: 1px solid #0000; `)]), (0, e.cB)("tabs-tab-pad", ` border-bottom: 1px solid var(--n-tab-border-color); `), (0, e.cB)("tabs-pad", ` border-bottom: 1px solid var(--n-tab-border-color); `)])]), (0, e.cM)("left", [(0, e.cM)("card-type", [(0, e.cB)("tabs-scroll-padding", "border-right: 1px solid var(--n-tab-border-color);"), (0, e.cE)("prefix, suffix", ` border-right: 1px solid var(--n-tab-border-color); `), (0, e.cB)("tabs-tab", ` border-top-left-radius: var(--n-tab-border-radius); border-bottom-left-radius: var(--n-tab-border-radius); `, [(0, e.cM)("active", ` border-right: 1px solid #0000; `)]), (0, e.cB)("tabs-tab-pad", ` border-right: 1px solid var(--n-tab-border-color); `), (0, e.cB)("tabs-pad", ` border-right: 1px solid var(--n-tab-border-color); `)])]), (0, e.cM)("right", [(0, e.cM)("card-type", [(0, e.cB)("tabs-scroll-padding", "border-left: 1px solid var(--n-tab-border-color);"), (0, e.cE)("prefix, suffix", ` border-left: 1px solid var(--n-tab-border-color); `), (0, e.cB)("tabs-tab", ` border-top-right-radius: var(--n-tab-border-radius); border-bottom-right-radius: var(--n-tab-border-radius); `, [(0, e.cM)("active", ` border-left: 1px solid #0000; `)]), (0, e.cB)("tabs-tab-pad", ` border-left: 1px solid var(--n-tab-border-color); `), (0, e.cB)("tabs-pad", ` border-left: 1px solid var(--n-tab-border-color); `)])]), (0, e.cM)("bottom", [(0, e.cM)("card-type", [(0, e.cB)("tabs-scroll-padding", "border-top: 1px solid var(--n-tab-border-color);"), (0, e.cE)("prefix, suffix", ` border-top: 1px solid var(--n-tab-border-color); `), (0, e.cB)("tabs-tab", ` border-bottom-left-radius: var(--n-tab-border-radius); border-bottom-right-radius: var(--n-tab-border-radius); `, [(0, e.cM)("active", ` border-top: 1px solid #0000; `)]), (0, e.cB)("tabs-tab-pad", ` border-top: 1px solid var(--n-tab-border-color); `), (0, e.cB)("tabs-pad", ` border-top: 1px solid var(--n-tab-border-color); `)])])])]); (function(o) { var l = q && q.__importDefault || function(t) { return t && t.__esModule ? t : { default: t }; }; Object.defineProperty(o, "__esModule", { value: !0 }), o.tabsProps = void 0; const c = yt, b = Ct, f = xt, n = be, G = mt, u = ht, s = le, C = Te, V = ee, D = l(ge), W = l(fe); o.tabsProps = Object.assign(Object.assign({}, u.useTheme.props), { value: [String, Number], defaultValue: [String, Number], trigger: { type: String, default: "click" }, type: { type: String, default: "bar" }, closable: Boolean, justifyContent: String, size: { type: String, default: "medium" }, placement: { type: String, default: "top" }, tabStyle: [String, Object], tabClass: String, addTabStyle: [String, Object], addTabClass: String, barWidth: Number, paneClass: String, paneStyle: [String, Object], paneWrapperClass: String, paneWrapperStyle: [String, Object], addable: [Boolean, Object], tabsPadding: { type: Number, default: 0 }, animated: Boolean, onBeforeLeave: Function, onAdd: Function, "onUpdate:value": [Function, Array], onUpdateValue: [Function, Array], onClose: [Function, Array], // deprecated labelSize: String, activeName: [String, Number], onActiveNameChange: [Function, Array] }), o.default = (0, n.defineComponent)({ name: "Tabs", props: o.tabsProps, slots: Object, setup(t, { slots: g }) { var P, M, S, h; process.env.NODE_ENV !== "production" && (0, n.watchEffect)(() => { t.labelSize !== void 0 && (0, s.warnOnce)("tabs", "`label-size` is deprecated, please use `size` instead."), t.activeName !== void 0 && (0, s.warnOnce)("tabs", "`active-name` is deprecated, please use `value` instead."), t.onActiveNameChange !== void 0 && (0, s.warnOnce)("tabs", "`on-active-name-change` is deprecated, please use `on-update:value` instead."); }); const { mergedClsPrefixRef: m, inlineThemeDisabled: _ } = (0, u.useConfig)(t), $ = (0, u.useTheme)("Tabs", "-tabs", D.default, C.tabsLight, t, m), L = (0, n.ref)(null), w = (0, n.ref)(null), X = (0, n.ref)(null), I = (0, n.ref)(null), x = (0, n.ref)(null), T = (0, n.ref)(null), F = (0, n.ref)(!0), k = (0, n.ref)(!0), U = (0, f.useCompitable)(t, ["labelSize", "size"]), j = (0, f.useCompitable)(t, ["activeName", "value"]), te = (0, n.ref)((M = (P = j.value) !== null && P !== void 0 ? P : t.defaultValue) !== null && M !== void 0 ? M : g.default ? (h = (S = (0, s.flatten)(g.default())[0]) === null || S === void 0 ? void 0 : S.props) === null || h === void 0 ? void 0 : h.name : null), R = (0, f.useMergedState)(j, te), p = { id: 0 }, y = (0, n.computed)(() => { if (!(!t.justifyContent || t.type === "card")) return { display: "flex", justifyContent: t.justifyContent }; }); (0, n.watch)(R, () => { p.id = 0, ne(), me(); }); function N() { var a; const { value: r } = R; return r === null ? null : (a = L.value) === null || a === void 0 ? void 0 : a.querySelector(`[data-name="${r}"]`); } function ze(a) { if (t.type === "card") return; const { value: r } = w; if (!r) return; const i = r.style.opacity === "0"; if (a) { const d = `${m.value}-tabs-bar--disabled`, { barWidth: v, placement: E } = t; if (a.dataset.disabled === "true" ? r.classList.add(d) : r.classList.remove(d), ["top", "bottom"].includes(E)) { if (he(["top", "maxHeight", "height"]), typeof v == "number" && a.offsetWidth >= v) { const O = Math.floor((a.offsetWidth - v) / 2) + a.offsetLeft; r.style.left = `${O}px`, r.style.maxWidth = `${v}px`; } else r.style.left = `${a.offsetLeft}px`, r.style.maxWidth = `${a.offsetWidth}px`; r.style.width = "8192px", i && (r.style.transition = "none"), r.offsetWidth, i && (r.style.transition = "", r.style.opacity = "1"); } else { if (he(["left", "maxWidth", "width"]), typeof v == "number" && a.offsetHeight >= v) { const O = Math.floor((a.offsetHeight - v) / 2) + a.offsetTop; r.style.top = `${O}px`, r.style.maxHeight = `${v}px`; } else r.style.top = `${a.offsetTop}px`, r.style.maxHeight = `${a.offsetHeight}px`; r.style.height = "8192px", i && (r.style.transition = "none"), r.offsetHeight, i && (r.style.transition = "", r.style.opacity = "1"); } } } function Me() { if (t.type === "card") return; const { value: a } = w; a && (a.style.opacity = "0"); } function he(a) { const { value: r } = w; if (r) for (const i of a) r.style[i] = ""; } function ne() { if (t.type === "card") return; const a = N(); a ? ze(a) : Me(); } function me() { var a; const r = (a = x.value) === null || a === void 0 ? void 0 : a.$el; if (!r) return; const i = N(); if (!i) return; const { scrollLeft: d, offsetWidth: v } = r, { offsetLeft: E, offsetWidth: O } = i; d > E ? r.scrollTo({ top: 0, left: E, behavior: "smooth" }) : E + O > d + v && r.scrollTo({ top: 0, left: E + O - v, behavior: "smooth" }); } const oe = (0, n.ref)(null); let se = 0, K = null; function $e(a) { const r = oe.value; if (r) { se = a.getBoundingClientRect().height; const i = `${se}px`, d = () => { r.style.height = i, r.style.maxHeight = i; }; K ? (d(), K(), K = null) : K = d; } } function Le(a) { const r = oe.value; if (r) { const i = a.getBoundingClientRect().height, d = () => { document.body.offsetHeight, r.style.maxHeight = `${i}px`, r.style.height = `${Math.max(se, i)}px`; }; K ? (K(), K = null, d()) : K = d; } } function je() { const a = oe.value; if (a) { a.style.maxHeight = "", a.style.height = ""; const { paneWrapperStyle: r } = t; if (typeof r == "string") a.style.cssText = r; else if (r) { const { maxHeight: i, height: d } = r; i !== void 0 && (a.style.maxHeight = i), d !== void 0 && (a.style.height = d); } } } const xe = { value: [] }, ye = (0, n.ref)("next"); function Ee(a) { const r = R.value; let i = "next"; for (const d of xe.value) { if (d === r) break; if (d === a) { i = "prev"; break; } } ye.value = i, Oe(a); } function Oe(a) { const { onActiveNameChange: r, onUpdateValue: i, "onUpdate:value": d } = t; r && (0, s.call)(r, a), i && (0, s.call)(i, a), d && (0, s.call)(d, a), te.value = a; } function We(a) { const { onClose: r } = t; r && (0, s.call)(r, a); } function Ce() { const { value: a } = w; if (!a) return; const r = "transition-disabled"; a.classList.add(r), ne(), a.classList.remove(r); } const J = (0, n.ref)(null); function de({ transitionDisabled: a }) { const r = L.value; if (!r) return; a && r.classList.add("transition-disabled"); const i = N(); i && J.value && (J.value.style.width = `${i.offsetWidth}px`, J.value.style.height = `${i.offsetHeight}px`, J.value.style.transform = `translateX(${i.offsetLeft - (0, b.depx)(getComputedStyle(r).paddingLeft)}px)`, a && J.value.offsetWidth), a && r.classList.remove("transition-disabled"); } (0, n.watch)([R], () => { t.type === "segment" && (0, n.nextTick)(() => { de({ transitionDisabled: !1 }); }); }), (0, n.onMounted)(() => { t.type === "segment" && de({ transitionDisabled: !0 }); }); let Pe = 0; function Ae(a) { var r; if (a.contentRect.width === 0 && a.contentRect.height === 0 || Pe === a.contentRect.width) return; Pe = a.contentRect.width; const { type: i } = t; if ((i === "line" || i === "bar") && Ce(), i !== "segment") { const { placement: d } = t; ce((d === "top" || d === "bottom" ? (r = x.value) === null || r === void 0 ? void 0 : r.$el : T.value) || null); } } const ke = (0, c.throttle)(Ae, 64); (0, n.watch)([() => t.justifyContent, () => t.size], () => { (0, n.nextTick)(() => { const { type: a } = t; (a === "line" || a === "bar") && Ce(); }); }); const Q = (0, n.ref)(!1); function Ve(a) { var r; const { target: i, contentRect: { width: d, height: v } } = a, E = i.parentElement.parentElement.offsetWidth, O = i.parentElement.parentElement.offsetHeight, { placement: Z } = t; if (!Q.value) Z === "top" || Z === "bottom" ? E < d && (Q.value = !0) : O < v && (Q.value = !0); else { const { value: ae } = I; if (!ae) return; Z === "top" || Z === "bottom" ? E - d > ae.$el.offsetWidth && (Q.value = !1) : O - v > ae.$el.offsetHeight && (Q.value = !1); } ce(((r = x.value) === null || r === void 0 ? void 0 : r.$el) || null); } const De = (0, c.throttle)(Ve, 64); function He() { const { onAdd: a } = t; a && a(), (0, n.nextTick)(() => { const r = N(), { value: i } = x; !r || !i || i.scrollTo({ left: r.offsetLeft, top: 0, behavior: "smooth" }); }); } function ce(a) { if (!a) return; const { placement: r } = t; if (r === "top" || r === "bottom") { const { scrollLeft: i, scrollWidth: d, offsetWidth: v } = a; F.value = i <= 0, k.value = i + v >= d; } else { const { scrollTop: i, scrollHeight: d, offsetHeight: v } = a; F.value = i <= 0, k.value = i + v >= d; } } const Ge = (0, c.throttle)((a) => { ce(a.target); }, 64); (0, n.provide)(V.tabsInjectionKey, { triggerRef: (0, n.toRef)(t, "trigger"), tabStyleRef: (0, n.toRef)(t, "tabStyle"), tabClassRef: (0, n.toRef)(t, "tabClass"), addTabStyleRef: (0, n.toRef)(t, "addTabStyle"), addTabClassRef: (0, n.toRef)(t, "addTabClass"), paneClassRef: (0, n.toRef)(t, "paneClass"), paneStyleRef: (0, n.toRef)(t, "paneStyle"), mergedClsPrefixRef: m, typeRef: (0, n.toRef)(t, "type"), closableRef: (0, n.toRef)(t, "closable"), valueRef: R, tabChangeIdRef: p, onBeforeLeaveRef: (0, n.toRef)(t, "onBeforeLeave"), activateTab: Ee, handleClose: We, handleAdd: He }), (0, f.onFontsReady)(() => { ne(), me(); }), (0, n.watchEffect)(() => { const { value: a } = X; if (!a) return; const { value: r } = m, i = `${r}-tabs-nav-scroll-wrapper--shadow-start`, d = `${r}-tabs-nav-scroll-wrapper--shadow-end`; F.value ? a.classList.remove(i) : a.classList.add(i), k.value ? a.classList.remove(d) : a.classList.add(d); }); const Ie = { syncBarPosition: () => { ne(); } }, Fe = () => { de({ transitionDisabled: !0 }); }, Se = (0, n.computed)(() => { const { value: a } = U, { type: r } = t, i = { card: "Card", bar: "Bar", line: "Line", segment: "Segment" }[r], d = `${a}${i}`, { self: { barColor: v, closeIconColor: E, closeIconColorHover: O, closeIconColorPressed: Z, tabColor: ae, tabBorderColor: Ne, paneTextColor: Ke, tabFontWeight: qe, tabBorderRadius: Ue, tabFontWeightActive: Xe, colorSegment: Je, fontWeightStrong: Qe, tabColorSegment: Ye, closeSize: Ze, closeIconSize: et, closeColorHover: tt, closeColorPressed: at, closeBorderRadius: rt, [(0, s.createKey)("panePadding", a)]: ie, [(0, s.createKey)("tabPadding", d)]: nt, [(0, s.createKey)("tabPaddingVertical", d)]: ot, [(0, s.createKey)("tabGap", d)]: it, [(0, s.createKey)("tabGap", `${d}Vertical`)]: lt, [(0, s.createKey)("tabTextColor", r)]: st, [(0, s.createKey)("tabTextColorActive", r)]: dt, [(0, s.createKey)("tabTextColorHover", r)]: ct, [(0, s.createKey)("tabTextColorDisabled", r)]: bt, [(0, s.createKey)("tabFontSize", a)]: ft }, common: { cubicBezierEaseInOut: pt } } = $.value; return { "--n-bezier": pt, "--n-color-segment": Je, "--n-bar-color": v, "--n-tab-font-size": ft, "--n-tab-text-color": st, "--n-tab-text-color-active": dt, "--n-tab-text-color-disabled": bt, "--n-tab-text-color-hover": ct, "--n-pane-text-color": Ke, "--n-tab-border-color": Ne, "--n-tab-border-radius": Ue, "--n-close-size": Ze, "--n-close-icon-size": et, "--n-close-color-hover": tt, "--n-close-color-pressed": at, "--n-close-border-radius": rt, "--n-close-icon-color": E, "--n-close-icon-color-hover": O, "--n-close-icon-color-pressed": Z, "--n-tab-color": ae, "--n-tab-font-weight": qe, "--n-tab-font-weight-active": Xe, "--n-tab-padding": nt, "--n-tab-padding-vertical": ot, "--n-tab-gap": it, "--n-tab-gap-vertical": lt, "--n-pane-padding-left": (0, b.getPadding)(ie, "left"), "--n-pane-padding-right": (0, b.getPadding)(ie, "right"), "--n-pane-padding-top": (0, b.getPadding)(ie, "top"), "--n-pane-padding-bottom": (0, b.getPadding)(ie, "bottom"), "--n-font-weight-strong": Qe, "--n-tab-color-segment": Ye }; }), Y = _ ? (0, u.useThemeClass)("tabs", (0, n.computed)(() => `${U.value[0]}${t.type[0]}`), Se, t) : void 0; return Object.assign({ mergedClsPrefix: m, mergedValue: R, renderedNames: /* @__PURE__ */ new Set(), segmentCapsuleElRef: J, tabsPaneWrapperRef: oe, tabsElRef: L, barElRef: w, addTabInstRef: I, xScrollInstRef: x, scrollWrapperElRef: X, addTabFixed: Q, tabWrapperStyle: y, handleNavResize: ke, mergedSize: U, handleScroll: Ge, handleTabsResize: De, cssVars: _ ? void 0 : Se, themeClass: Y == null ? void 0 : Y.themeClass, animationDirection: ye, renderNameListRef: xe, yScrollElRef: T, handleSegmentResize: Fe, onAnimationBeforeLeave: $e, onAnimationEnter: Le, onAnimationAfterEnter: je, onRender: Y == null ? void 0 : Y.onRender }, Ie); }, render() { const { mergedClsPrefix: t, type: g, placement: P, addTabFixed: M, addable: S, mergedSize: h, renderNameListRef: m, onRender: _, paneWrapperClass: $, paneWrapperStyle: L, $slots: { default: w, prefix: X, suffix: I } } = this; _ == null || _(); const x = w ? (0, s.flatten)(w()).filter((p) => p.type.__TAB_PANE__ === !0) : [], T = w ? (0, s.flatten)(w()).filter((p) => p.type.__TAB__ === !0) : [], F = !T.length, k = g === "card", U = g === "segment", j = !k && !U && this.justifyContent; m.value = []; const te = () => { const p = (0, n.h)( "div", { style: this.tabWrapperStyle, class: `${t}-tabs-wrapper` }, j ? null : (0, n.h)("div", { class: `${t}-tabs-scroll-padding`, style: P === "top" || P === "bottom" ? { width: `${this.tabsPadding}px` } : { height: `${this.tabsPadding}px` } }), F ? x.map((y, N) => (m.value.push(y.props.name), z((0, n.h)(W.default, Object.assign({}, y.props, { internalCreatedByPane: !0, internalLeftPadded: N !== 0 && (!j || j === "center" || j === "start" || j === "end") }), y.children ? { default: y.children.tab } : void 0)))) : T.map((y, N) => (m.value.push(y.props.name), z(N !== 0 && !j ? H(y) : y))), !M && S && k ? A(S, (F ? x.length : T.length) !== 0) : null, j ? null : (0, n.h)("div", { class: `${t}-tabs-scroll-padding`, style: { width: `${this.tabsPadding}px` } }) ); return (0, n.h)( "div", { ref: "tabsElRef", class: `${t}-tabs-nav-scroll-content` }, k && S ? (0, n.h)(G.VResizeObserver, { onResize: this.handleTabsResize }, { default: () => p }) : p, k ? (0, n.h)("div", { class: `${t}-tabs-pad` }) : null, k ? null : (0, n.h)("div", { ref: "barElRef", class: `${t}-tabs-bar` }) ); }, R = U ? "top" : P; return (0, n.h)( "div", { class: [ `${t}-tabs`, this.themeClass, `${t}-tabs--${g}-type`, `${t}-tabs--${h}-size`, j && `${t}-tabs--flex`, `${t}-tabs--${R}` ], style: this.cssVars }, (0, n.h)( "div", { class: [ // the class should be applied here since it's possible // to make tabs nested in tabs, style may influence each // other. adding a class will make it easy to write the // style. `${t}-tabs-nav--${g}-type`, `${t}-tabs-nav--${R}`, `${t}-tabs-nav` ] }, (0, s.resolveWrappedSlot)(X, (p) => p && (0, n.h)("div", { class: `${t}-tabs-nav__prefix` }, p)), U ? (0, n.h)(G.VResizeObserver, { onResize: this.handleSegmentResize }, { default: () => (0, n.h)( "div", { class: `${t}-tabs-rail`, ref: "tabsElRef" }, (0, n.h)( "div", { class: `${t}-tabs-capsule`, ref: "segmentCapsuleElRef" }, (0, n.h)( "div", { class: `${t}-tabs-wrapper` }, (0, n.h)("div", { class: `${t}-tabs-tab` }) ) ), F ? x.map((p, y) => (m.value.push(p.props.name), (0, n.h)(W.default, Object.assign({}, p.props, { internalCreatedByPane: !0, internalLeftPadded: y !== 0 }), p.children ? { default: p.children.tab } : void 0))) : T.map((p, y) => (m.value.push(p.props.name), y === 0 ? p : H(p))) ) }) : (0, n.h)(G.VResizeObserver, { onResize: this.handleNavResize }, { default: () => (0, n.h)("div", { class: `${t}-tabs-nav-scroll-wrapper`, ref: "scrollWrapperElRef" }, ["top", "bottom"].includes(R) ? (0, n.h)(G.VXScroll, { ref: "xScrollInstRef", onScroll: this.handleScroll }, { default: te }) : (0, n.h)("div", { class: `${t}-tabs-nav-y-scroll`, onScroll: this.handleScroll, ref: "yScrollElRef" }, te())) }), M && S && k ? A(S, !0) : null, (0, s.resolveWrappedSlot)(I, (p) => p && (0, n.h)("div", { class: `${t}-tabs-nav__suffix` }, p)) ), F && (this.animated && (R === "top" || R === "bottom") ? (0, n.h)("div", { ref: "tabsPaneWrapperRef", style: L, class: [`${t}-tabs-pane-wrapper`, $] }, B(x, this.mergedValue, this.renderedNames, this.onAnimationBeforeLeave, this.onAnimationEnter, this.onAnimationAfterEnter, this.animationDirection)) : B(x, this.mergedValue, this.renderedNames)) ); } }); function B(t, g, P, M, S, h, m) { const _ = []; return t.forEach(($) => { const { name: L, displayDirective: w, "display-directive": X } = $.props, I = (T) => w === T || X === T, x = g === L; if ($.key !== void 0 && ($.key = L), x || I("show") || I("show:lazy") && P.has(L)) { P.has(L) || P.add(L); const T = !I("if"); _.push(T ? (0, n.withDirectives)($, [[n.vShow, x]]) : $); } }), m ? (0, n.h)(n.TransitionGroup, { name: `${m}-transition`, onBeforeLeave: M, onEnter: S, onAfterEnter: h }, { default: () => _ }) : _; } function A(t, g) { return (0, n.h)(W.default, { ref: "addTabInstRef", key: "__addable", name: "__addable", internalCreatedByPane: !0, internalAddable: !0, internalLeftPadded: g, disabled: typeof t == "object" && t.disabled }); } function H(t) { const g = (0, n.cloneVNode)(t); return g.props ? g.props.internalLeftPadded = !0 : g.props = { internalLeftPadded: !0 }, g; } function z(t) { return Array.isArray(t.dynamicProps) ? t.dynamicProps.includes("internalLeftPadded") || t.dynamicProps.push("internalLeftPadded") : t.dynamicProps = ["internalLeftPadded"], t; } })(we); (function(o) { var l = q && q.__importDefault || function(n) { return n && n.__esModule ? n : { default: n }; }; Object.defineProperty(o, "__esModule", { value: !0 }), o.tabsProps = o.NTabs = o.tabPaneProps = o.NTabPane = o.tabProps = o.NTab = void 0; var c = fe; Object.defineProperty(o, "NTab", { enumerable: !0, get: function() { return l(c).default; } }), Object.defineProperty(o, "tabProps", { enumerable: !0, get: function() { return c.tabProps; } }); var b = pe; Object.defineProperty(o, "NTabPane", { enumerable: !0, get: function() { return l(b).default; } }), Object.defineProperty(o, "tabPaneProps", { enumerable: !0, get: function() { return b.tabPaneProps; } }); var f = we; Object.defineProperty(o, "NTabs", { enumerable: !0, get: function() { return l(f).default; } }), Object.defineProperty(o, "tabsProps", { enumerable: !0, get: function() { return f.tabsProps; } }); })(Be); const Ot = /* @__PURE__ */ Pt({ __proto__: null }, [Be]); export { Ot as i };