UNPKG

epic-designer-gold

Version:

基于vue3的设计器,可视化开发页面表单

1,167 lines (1,166 loc) 45.1 kB
import { c as q } from "./_commonjsHelpers-BVfed4GL.js"; import { r as pe } from "./_vue_commonjs-external-NwvjgbHK.js"; import { _ as ht, e as mt } from "./index-kOCEDlqX.js"; import { d as de, b as we, c as xt, l as yt, a as Ct, r as Pt, e as St, f as _t } from "./index-B2_JTx7E.js"; function Bt(i, 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 i)) { const r = Object.getOwnPropertyDescriptor(b, f); r && Object.defineProperty(i, f, r.get ? r : { enumerable: !0, get: () => b[f] }); } } } return Object.freeze(Object.defineProperty(i, Symbol.toStringTag, { value: "Module" })); } var Te = {}, ue = {}, ae = {}; Object.defineProperty(ae, "__esModule", { value: !0 }); ae.tabsInjectionKey = void 0; const wt = de; ae.tabsInjectionKey = (0, wt.createInjectionKey)("n-tabs"); var ve = {}; (function(i) { Object.defineProperty(i, "__esModule", { value: !0 }), i.tabPaneProps = void 0; const l = pe, c = de, b = ae; i.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] }, i.default = (0, l.defineComponent)({ __TAB_PANE__: !0, name: "TabPane", alias: ["TabPanel"], props: i.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 r = (0, l.inject)(b.tabsInjectionKey, null); return r || (0, c.throwError)("tab-pane", "`n-tab-pane` must be placed inside `n-tabs`."), { style: r.paneStyleRef, class: r.paneClassRef, mergedClsPrefix: r.mergedClsPrefixRef }; }, render() { return (0, l.h)("div", { class: [`${this.mergedClsPrefix}-tab-pane`, this.class], style: this.style }, this.$slots); } }); })(ve); (function(i) { Object.defineProperty(i, "__esModule", { value: !0 }), i.tabProps = void 0; const l = pe, c = ht, b = mt, f = de, r = ae, I = ve; i.tabProps = Object.assign({ internalLeftPadded: Boolean, internalAddable: Boolean, internalCreatedByPane: Boolean }, (0, f.omit)(I.tabPaneProps, ["displayDirective"])), i.default = (0, l.defineComponent)({ __TAB__: !0, inheritAttrs: !1, name: "Tab", props: i.tabProps, setup(u) { const { mergedClsPrefixRef: s, valueRef: P, typeRef: A, closableRef: k, tabStyleRef: L, addTabStyleRef: S, tabClassRef: j, addTabClassRef: V, tabChangeIdRef: E, onBeforeLeaveRef: B, triggerRef: n, handleAdd: m, activateTab: C, handleClose: $ } = (0, l.inject)(r.tabsInjectionKey); return { trigger: n, mergedClosable: (0, l.computed)(() => { if (u.internalAddable) return !1; const { closable: v } = u; return v === void 0 ? k.value : v; }), style: L, addStyle: S, tabClass: j, addTabClass: V, clsPrefix: s, value: P, type: A, handleClose(v) { v.stopPropagation(), !u.disabled && $(u.name); }, activateTab() { if (u.disabled) return; if (u.internalAddable) { m(); return; } const { name: v } = u, D = ++E.id; if (v !== P.value) { const { value: x } = B; x ? Promise.resolve(x(u.name, P.value)).then((_) => { _ && E.id === D && C(v); }) : C(v); } } }; }, render() { const { internalAddable: u, clsPrefix: s, name: P, disabled: A, label: k, tab: L, value: S, mergedClosable: j, trigger: V, $slots: { default: E } } = this, B = k ?? L; 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: P, "data-name": P, "data-disabled": A ? !0 : void 0 }, (0, l.mergeProps)({ class: [ `${s}-tabs-tab`, S === P && `${s}-tabs-tab--active`, A && `${s}-tabs-tab--disabled`, j && `${s}-tabs-tab--closable`, u && `${s}-tabs-tab--addable`, u ? this.addTabClass : this.tabClass ], onClick: V === "click" ? this.activateTab : void 0, onMouseenter: V === "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) }) ) : E ? E() : typeof B == "object" ? B : (0, f.render)(B ?? P)), j && this.type === "card" ? (0, l.h)(c.NBaseClose, { clsPrefix: s, class: `${s}-tabs-tab__close`, onClick: this.handleClose, disabled: A }) : null ) ); } }); })(ue); var Re = {}, ze = {}, ge = {}, ne = {}, he = {}; Object.defineProperty(he, "__esModule", { value: !0 }); he.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 Tt = q && q.__importDefault || function(i) { return i && i.__esModule ? i : { default: i }; }; Object.defineProperty(ne, "__esModule", { value: !0 }); ne.self = Me; const Rt = we, zt = Tt(he); function Me(i) { const { textColor2: l, primaryColor: c, textColorDisabled: b, closeIconColor: f, closeIconColorHover: r, closeIconColorPressed: I, closeColorHover: u, closeColorPressed: s, tabColor: P, baseColor: A, dividerColor: k, fontWeight: L, textColor1: S, borderRadius: j, fontSize: V, fontWeightStrong: E } = i; return Object.assign(Object.assign({}, zt.default), { colorSegment: P, tabFontSizeCard: V, tabTextColorLine: S, tabTextColorActiveLine: c, tabTextColorHoverLine: c, tabTextColorDisabledLine: b, tabTextColorSegment: S, tabTextColorActiveSegment: l, tabTextColorHoverSegment: l, tabTextColorDisabledSegment: b, tabTextColorBar: S, tabTextColorActiveBar: c, tabTextColorHoverBar: c, tabTextColorDisabledBar: b, tabTextColorCard: S, tabTextColorHoverCard: S, tabTextColorActiveCard: c, tabTextColorDisabledCard: b, barColor: c, closeIconColor: f, closeIconColorHover: r, closeIconColorPressed: I, closeColorHover: u, closeColorPressed: s, closeBorderRadius: j, tabColor: P, tabColorSegment: A, tabBorderColor: k, tabFontWeightActive: L, tabFontWeight: L, tabBorderRadius: j, paneTextColor: l, fontWeightStrong: E }); } const Mt = { name: "Tabs", common: Rt.commonLight, self: Me }; ne.default = Mt; Object.defineProperty(ge, "__esModule", { value: !0 }); const Lt = we, jt = ne, Et = { name: "Tabs", common: Lt.commonDark, self(i) { const l = (0, jt.self)(i), { inputColor: c } = i; return l.colorSegment = c, l.tabColorSegment = c, l; } }; ge.default = Et; (function(i) { var l = q && q.__importDefault || function(f) { return f && f.__esModule ? f : { default: f }; }; Object.defineProperty(i, "__esModule", { value: !0 }), i.tabsLight = i.tabsDark = void 0; var c = ge; Object.defineProperty(i, "tabsDark", { enumerable: !0, get: function() { return l(c).default; } }); var b = ne; Object.defineProperty(i, "tabsLight", { enumerable: !0, get: function() { return l(b).default; } }); })(ze); var me = {}; Object.defineProperty(me, "__esModule", { value: !0 }); const e = xt; me.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.c)(">", [(0, e.cB)("tabs-nav", [(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.c)(">", [(0, e.cB)("tabs-nav", [(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(i) { var l = q && q.__importDefault || function(n) { return n && n.__esModule ? n : { default: n }; }; Object.defineProperty(i, "__esModule", { value: !0 }), i.tabsProps = void 0; const c = yt, b = _t, f = St, r = pe, I = Pt, u = Ct, s = de, P = ze, A = ae, k = l(me), L = l(ue), S = c.throttle; i.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: String, 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] }), i.default = (0, r.defineComponent)({ name: "Tabs", props: i.tabsProps, slots: Object, setup(n, { slots: m }) { var C, $, v, D; process.env.NODE_ENV !== "production" && (0, r.watchEffect)(() => { n.labelSize !== void 0 && (0, s.warnOnce)("tabs", "`label-size` is deprecated, please use `size` instead."), n.activeName !== void 0 && (0, s.warnOnce)("tabs", "`active-name` is deprecated, please use `value` instead."), n.onActiveNameChange !== void 0 && (0, s.warnOnce)("tabs", "`on-active-name-change` is deprecated, please use `on-update:value` instead."); }); const { mergedClsPrefixRef: x, inlineThemeDisabled: _, mergedComponentPropsRef: w } = (0, u.useConfig)(n), H = (0, u.useTheme)("Tabs", "-tabs", k.default, P.tabsLight, n, x), O = (0, r.ref)(null), G = (0, r.ref)(null), F = (0, r.ref)(null), T = (0, r.ref)(null), y = (0, r.ref)(null), U = (0, r.ref)(null), W = (0, r.ref)(!0), X = (0, r.ref)(!0), R = (0, f.useCompitable)(n, ["labelSize", "size"]), J = (0, r.computed)(() => { var t, a; if (R.value) return R.value; const o = (a = (t = w == null ? void 0 : w.value) === null || t === void 0 ? void 0 : t.Tabs) === null || a === void 0 ? void 0 : a.size; return o || "medium"; }), N = (0, f.useCompitable)(n, ["activeName", "value"]), p = (0, r.ref)(($ = (C = N.value) !== null && C !== void 0 ? C : n.defaultValue) !== null && $ !== void 0 ? $ : m.default ? (D = (v = (0, s.flatten)(m.default())[0]) === null || v === void 0 ? void 0 : v.props) === null || D === void 0 ? void 0 : D.name : null), h = (0, f.useMergedState)(N, p), Q = { id: 0 }, Le = (0, r.computed)(() => { if (!(!n.justifyContent || n.type === "card")) return { display: "flex", justifyContent: n.justifyContent }; }); (0, r.watch)(h, () => { Q.id = 0, ie(), ye(); }); function oe() { var t; const { value: a } = h; return a === null ? null : (t = O.value) === null || t === void 0 ? void 0 : t.querySelector(`[data-name="${a}"]`); } function je(t) { if (n.type === "card") return; const { value: a } = G; if (!a) return; const o = a.style.opacity === "0"; if (t) { const d = `${x.value}-tabs-bar--disabled`, { barWidth: g, placement: z } = n; if (t.dataset.disabled === "true" ? a.classList.add(d) : a.classList.remove(d), ["top", "bottom"].includes(z)) { if (xe(["top", "maxHeight", "height"]), typeof g == "number" && t.offsetWidth >= g) { const M = Math.floor((t.offsetWidth - g) / 2) + t.offsetLeft; a.style.left = `${M}px`, a.style.maxWidth = `${g}px`; } else a.style.left = `${t.offsetLeft}px`, a.style.maxWidth = `${t.offsetWidth}px`; a.style.width = "8192px", o && (a.style.transition = "none"), a.offsetWidth, o && (a.style.transition = "", a.style.opacity = "1"); } else { if (xe(["left", "maxWidth", "width"]), typeof g == "number" && t.offsetHeight >= g) { const M = Math.floor((t.offsetHeight - g) / 2) + t.offsetTop; a.style.top = `${M}px`, a.style.maxHeight = `${g}px`; } else a.style.top = `${t.offsetTop}px`, a.style.maxHeight = `${t.offsetHeight}px`; a.style.height = "8192px", o && (a.style.transition = "none"), a.offsetHeight, o && (a.style.transition = "", a.style.opacity = "1"); } } } function Ee() { if (n.type === "card") return; const { value: t } = G; t && (t.style.opacity = "0"); } function xe(t) { const { value: a } = G; if (a) for (const o of t) a.style[o] = ""; } function ie() { if (n.type === "card") return; const t = oe(); t ? je(t) : Ee(); } function ye() { var t; const a = (t = y.value) === null || t === void 0 ? void 0 : t.$el; if (!a) return; const o = oe(); if (!o) return; const { scrollLeft: d, offsetWidth: g } = a, { offsetLeft: z, offsetWidth: M } = o; d > z ? a.scrollTo({ top: 0, left: z, behavior: "smooth" }) : z + M > d + g && a.scrollTo({ top: 0, left: z + M - g, behavior: "smooth" }); } const le = (0, r.ref)(null); let ce = 0, K = null; function $e(t) { const a = le.value; if (a) { ce = t.getBoundingClientRect().height; const o = `${ce}px`, d = () => { a.style.height = o, a.style.maxHeight = o; }; K ? (d(), K(), K = null) : K = d; } } function Oe(t) { const a = le.value; if (a) { const o = t.getBoundingClientRect().height, d = () => { document.body.offsetHeight, a.style.maxHeight = `${o}px`, a.style.height = `${Math.max(ce, o)}px`; }; K ? (K(), K = null, d()) : K = d; } } function We() { const t = le.value; if (t) { t.style.maxHeight = "", t.style.height = ""; const { paneWrapperStyle: a } = n; if (typeof a == "string") t.style.cssText = a; else if (a) { const { maxHeight: o, height: d } = a; o !== void 0 && (t.style.maxHeight = o), d !== void 0 && (t.style.height = d); } } } const Ce = { value: [] }, Pe = (0, r.ref)("next"); function Ae(t) { const a = h.value; let o = "next"; for (const d of Ce.value) { if (d === a) break; if (d === t) { o = "prev"; break; } } Pe.value = o, ke(t); } function ke(t) { const { onActiveNameChange: a, onUpdateValue: o, "onUpdate:value": d } = n; a && (0, s.call)(a, t), o && (0, s.call)(o, t), d && (0, s.call)(d, t), p.value = t; } function Ve(t) { const { onClose: a } = n; a && (0, s.call)(a, t); } function Se() { const { value: t } = G; if (!t) return; const a = "transition-disabled"; t.classList.add(a), ie(), t.classList.remove(a); } const Y = (0, r.ref)(null); function be({ transitionDisabled: t }) { const a = O.value; if (!a) return; t && a.classList.add("transition-disabled"); const o = oe(); o && Y.value && (Y.value.style.width = `${o.offsetWidth}px`, Y.value.style.height = `${o.offsetHeight}px`, Y.value.style.transform = `translateX(${o.offsetLeft - (0, b.depx)(getComputedStyle(a).paddingLeft)}px)`, t && Y.value.offsetWidth), t && a.classList.remove("transition-disabled"); } (0, r.watch)([h], () => { n.type === "segment" && (0, r.nextTick)(() => { be({ transitionDisabled: !1 }); }); }), (0, r.onMounted)(() => { n.type === "segment" && be({ transitionDisabled: !0 }); }); let _e = 0; function De(t) { var a; if (t.contentRect.width === 0 && t.contentRect.height === 0 || _e === t.contentRect.width) return; _e = t.contentRect.width; const { type: o } = n; if ((o === "line" || o === "bar") && Se(), o !== "segment") { const { placement: d } = n; fe((d === "top" || d === "bottom" ? (a = y.value) === null || a === void 0 ? void 0 : a.$el : U.value) || null); } } const He = S(De, 64); (0, r.watch)([() => n.justifyContent, () => n.size], () => { (0, r.nextTick)(() => { const { type: t } = n; (t === "line" || t === "bar") && Se(); }); }); const Z = (0, r.ref)(!1); function Ge(t) { var a; const { target: o, contentRect: { width: d, height: g } } = t, z = o.parentElement.parentElement.offsetWidth, M = o.parentElement.parentElement.offsetHeight, { placement: te } = n; if (!Z.value) te === "top" || te === "bottom" ? z < d && (Z.value = !0) : M < g && (Z.value = !0); else { const { value: re } = T; if (!re) return; te === "top" || te === "bottom" ? z - d > re.$el.offsetWidth && (Z.value = !1) : M - g > re.$el.offsetHeight && (Z.value = !1); } fe(((a = y.value) === null || a === void 0 ? void 0 : a.$el) || null); } const Ie = S(Ge, 64); function Fe() { const { onAdd: t } = n; t && t(), (0, r.nextTick)(() => { const a = oe(), { value: o } = y; !a || !o || o.scrollTo({ left: a.offsetLeft, top: 0, behavior: "smooth" }); }); } function fe(t) { if (!t) return; const { placement: a } = n; if (a === "top" || a === "bottom") { const { scrollLeft: o, scrollWidth: d, offsetWidth: g } = t; W.value = o <= 0, X.value = o + g >= d; } else { const { scrollTop: o, scrollHeight: d, offsetHeight: g } = t; W.value = o <= 0, X.value = o + g >= d; } } const Ne = S((t) => { fe(t.target); }, 64); (0, r.provide)(A.tabsInjectionKey, { triggerRef: (0, r.toRef)(n, "trigger"), tabStyleRef: (0, r.toRef)(n, "tabStyle"), tabClassRef: (0, r.toRef)(n, "tabClass"), addTabStyleRef: (0, r.toRef)(n, "addTabStyle"), addTabClassRef: (0, r.toRef)(n, "addTabClass"), paneClassRef: (0, r.toRef)(n, "paneClass"), paneStyleRef: (0, r.toRef)(n, "paneStyle"), mergedClsPrefixRef: x, typeRef: (0, r.toRef)(n, "type"), closableRef: (0, r.toRef)(n, "closable"), valueRef: h, tabChangeIdRef: Q, onBeforeLeaveRef: (0, r.toRef)(n, "onBeforeLeave"), activateTab: Ae, handleClose: Ve, handleAdd: Fe }), (0, f.onFontsReady)(() => { ie(), ye(); }), (0, r.watchEffect)(() => { const { value: t } = F; if (!t) return; const { value: a } = x, o = `${a}-tabs-nav-scroll-wrapper--shadow-start`, d = `${a}-tabs-nav-scroll-wrapper--shadow-end`; W.value ? t.classList.remove(o) : t.classList.add(o), X.value ? t.classList.remove(d) : t.classList.add(d); }); const Ke = { syncBarPosition: () => { ie(); } }, qe = () => { be({ transitionDisabled: !0 }); }, Be = (0, r.computed)(() => { const { value: t } = J, { type: a } = n, o = { card: "Card", bar: "Bar", line: "Line", segment: "Segment" }[a], d = `${t}${o}`, { self: { barColor: g, closeIconColor: z, closeIconColorHover: M, closeIconColorPressed: te, tabColor: re, tabBorderColor: Ue, paneTextColor: Xe, tabFontWeight: Je, tabBorderRadius: Qe, tabFontWeightActive: Ye, colorSegment: Ze, fontWeightStrong: et, tabColorSegment: tt, closeSize: at, closeIconSize: rt, closeColorHover: nt, closeColorPressed: ot, closeBorderRadius: it, [(0, s.createKey)("panePadding", t)]: se, [(0, s.createKey)("tabPadding", d)]: lt, [(0, s.createKey)("tabPaddingVertical", d)]: st, [(0, s.createKey)("tabGap", d)]: dt, [(0, s.createKey)("tabGap", `${d}Vertical`)]: ct, [(0, s.createKey)("tabTextColor", a)]: bt, [(0, s.createKey)("tabTextColorActive", a)]: ft, [(0, s.createKey)("tabTextColorHover", a)]: pt, [(0, s.createKey)("tabTextColorDisabled", a)]: ut, [(0, s.createKey)("tabFontSize", t)]: vt }, common: { cubicBezierEaseInOut: gt } } = H.value; return { "--n-bezier": gt, "--n-color-segment": Ze, "--n-bar-color": g, "--n-tab-font-size": vt, "--n-tab-text-color": bt, "--n-tab-text-color-active": ft, "--n-tab-text-color-disabled": ut, "--n-tab-text-color-hover": pt, "--n-pane-text-color": Xe, "--n-tab-border-color": Ue, "--n-tab-border-radius": Qe, "--n-close-size": at, "--n-close-icon-size": rt, "--n-close-color-hover": nt, "--n-close-color-pressed": ot, "--n-close-border-radius": it, "--n-close-icon-color": z, "--n-close-icon-color-hover": M, "--n-close-icon-color-pressed": te, "--n-tab-color": re, "--n-tab-font-weight": Je, "--n-tab-font-weight-active": Ye, "--n-tab-padding": lt, "--n-tab-padding-vertical": st, "--n-tab-gap": dt, "--n-tab-gap-vertical": ct, "--n-pane-padding-left": (0, b.getPadding)(se, "left"), "--n-pane-padding-right": (0, b.getPadding)(se, "right"), "--n-pane-padding-top": (0, b.getPadding)(se, "top"), "--n-pane-padding-bottom": (0, b.getPadding)(se, "bottom"), "--n-font-weight-strong": et, "--n-tab-color-segment": tt }; }), ee = _ ? (0, u.useThemeClass)("tabs", (0, r.computed)(() => `${J.value[0]}${n.type[0]}`), Be, n) : void 0; return Object.assign({ mergedClsPrefix: x, mergedValue: h, renderedNames: /* @__PURE__ */ new Set(), segmentCapsuleElRef: Y, tabsPaneWrapperRef: le, tabsElRef: O, barElRef: G, addTabInstRef: T, xScrollInstRef: y, scrollWrapperElRef: F, addTabFixed: Z, tabWrapperStyle: Le, handleNavResize: He, mergedSize: J, handleScroll: Ne, handleTabsResize: Ie, cssVars: _ ? void 0 : Be, themeClass: ee == null ? void 0 : ee.themeClass, animationDirection: Pe, renderNameListRef: Ce, yScrollElRef: U, handleSegmentResize: qe, onAnimationBeforeLeave: $e, onAnimationEnter: Oe, onAnimationAfterEnter: We, onRender: ee == null ? void 0 : ee.onRender }, Ke); }, render() { const { mergedClsPrefix: n, type: m, placement: C, addTabFixed: $, addable: v, mergedSize: D, renderNameListRef: x, onRender: _, paneWrapperClass: w, paneWrapperStyle: H, $slots: { default: O, prefix: G, suffix: F } } = this; _ == null || _(); const T = O ? (0, s.flatten)(O()).filter((p) => p.type.__TAB_PANE__ === !0) : [], y = O ? (0, s.flatten)(O()).filter((p) => p.type.__TAB__ === !0) : [], U = !y.length, W = m === "card", X = m === "segment", R = !W && !X && this.justifyContent; x.value = []; const J = () => { const p = (0, r.h)( "div", { style: this.tabWrapperStyle, class: `${n}-tabs-wrapper` }, R ? null : (0, r.h)("div", { class: `${n}-tabs-scroll-padding`, style: C === "top" || C === "bottom" ? { width: `${this.tabsPadding}px` } : { height: `${this.tabsPadding}px` } }), U ? T.map((h, Q) => (x.value.push(h.props.name), B((0, r.h)(L.default, Object.assign({}, h.props, { internalCreatedByPane: !0, internalLeftPadded: Q !== 0 && (!R || R === "center" || R === "start" || R === "end") }), h.children ? { default: h.children.tab } : void 0)))) : y.map((h, Q) => (x.value.push(h.props.name), B(Q !== 0 && !R ? E(h) : h))), !$ && v && W ? V(v, (U ? T.length : y.length) !== 0) : null, R ? null : (0, r.h)("div", { class: `${n}-tabs-scroll-padding`, style: { width: `${this.tabsPadding}px` } }) ); return (0, r.h)( "div", { ref: "tabsElRef", class: `${n}-tabs-nav-scroll-content` }, W && v ? (0, r.h)(I.VResizeObserver, { onResize: this.handleTabsResize }, { default: () => p }) : p, W ? (0, r.h)("div", { class: `${n}-tabs-pad` }) : null, W ? null : (0, r.h)("div", { ref: "barElRef", class: `${n}-tabs-bar` }) ); }, N = X ? "top" : C; return (0, r.h)( "div", { class: [ `${n}-tabs`, this.themeClass, `${n}-tabs--${m}-type`, `${n}-tabs--${D}-size`, R && `${n}-tabs--flex`, `${n}-tabs--${N}` ], style: this.cssVars }, (0, r.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. `${n}-tabs-nav--${m}-type`, `${n}-tabs-nav--${N}`, `${n}-tabs-nav` ] }, (0, s.resolveWrappedSlot)(G, (p) => p && (0, r.h)("div", { class: `${n}-tabs-nav__prefix` }, p)), X ? (0, r.h)(I.VResizeObserver, { onResize: this.handleSegmentResize }, { default: () => (0, r.h)( "div", { class: `${n}-tabs-rail`, ref: "tabsElRef" }, (0, r.h)( "div", { class: `${n}-tabs-capsule`, ref: "segmentCapsuleElRef" }, (0, r.h)( "div", { class: `${n}-tabs-wrapper` }, (0, r.h)("div", { class: `${n}-tabs-tab` }) ) ), U ? T.map((p, h) => (x.value.push(p.props.name), (0, r.h)(L.default, Object.assign({}, p.props, { internalCreatedByPane: !0, internalLeftPadded: h !== 0 }), p.children ? { default: p.children.tab } : void 0))) : y.map((p, h) => (x.value.push(p.props.name), h === 0 ? p : E(p))) ) }) : (0, r.h)(I.VResizeObserver, { onResize: this.handleNavResize }, { default: () => (0, r.h)("div", { class: `${n}-tabs-nav-scroll-wrapper`, ref: "scrollWrapperElRef" }, ["top", "bottom"].includes(N) ? (0, r.h)(I.VXScroll, { ref: "xScrollInstRef", onScroll: this.handleScroll }, { default: J }) : (0, r.h)("div", { class: `${n}-tabs-nav-y-scroll`, onScroll: this.handleScroll, ref: "yScrollElRef" }, J())) }), $ && v && W ? V(v, !0) : null, (0, s.resolveWrappedSlot)(F, (p) => p && (0, r.h)("div", { class: `${n}-tabs-nav__suffix` }, p)) ), U && (this.animated && (N === "top" || N === "bottom") ? (0, r.h)("div", { ref: "tabsPaneWrapperRef", style: H, class: [`${n}-tabs-pane-wrapper`, w] }, j(T, this.mergedValue, this.renderedNames, this.onAnimationBeforeLeave, this.onAnimationEnter, this.onAnimationAfterEnter, this.animationDirection)) : j(T, this.mergedValue, this.renderedNames)) ); } }); function j(n, m, C, $, v, D, x) { const _ = []; return n.forEach((w) => { const { name: H, displayDirective: O, "display-directive": G } = w.props, F = (y) => O === y || G === y, T = m === H; if (w.key !== void 0 && (w.key = H), T || F("show") || F("show:lazy") && C.has(H)) { C.has(H) || C.add(H); const y = !F("if"); _.push(y ? (0, r.withDirectives)(w, [[r.vShow, T]]) : w); } }), x ? (0, r.h)(r.TransitionGroup, { name: `${x}-transition`, onBeforeLeave: $, onEnter: v, onAfterEnter: D }, { default: () => _ }) : _; } function V(n, m) { return (0, r.h)(L.default, { ref: "addTabInstRef", key: "__addable", name: "__addable", internalCreatedByPane: !0, internalAddable: !0, internalLeftPadded: m, disabled: typeof n == "object" && n.disabled }); } function E(n) { const m = (0, r.cloneVNode)(n); return m.props ? m.props.internalLeftPadded = !0 : m.props = { internalLeftPadded: !0 }, m; } function B(n) { return Array.isArray(n.dynamicProps) ? n.dynamicProps.includes("internalLeftPadded") || n.dynamicProps.push("internalLeftPadded") : n.dynamicProps = ["internalLeftPadded"], n; } })(Re); (function(i) { var l = q && q.__importDefault || function(r) { return r && r.__esModule ? r : { default: r }; }; Object.defineProperty(i, "__esModule", { value: !0 }), i.tabsProps = i.NTabs = i.tabPaneProps = i.NTabPane = i.tabProps = i.NTab = void 0; var c = ue; Object.defineProperty(i, "NTab", { enumerable: !0, get: function() { return l(c).default; } }), Object.defineProperty(i, "tabProps", { enumerable: !0, get: function() { return c.tabProps; } }); var b = ve; Object.defineProperty(i, "NTabPane", { enumerable: !0, get: function() { return l(b).default; } }), Object.defineProperty(i, "tabPaneProps", { enumerable: !0, get: function() { return b.tabPaneProps; } }); var f = Re; Object.defineProperty(i, "NTabs", { enumerable: !0, get: function() { return l(f).default; } }), Object.defineProperty(i, "tabsProps", { enumerable: !0, get: function() { return f.tabsProps; } }); })(Te); const kt = /* @__PURE__ */ Bt({ __proto__: null }, [Te]); export { kt as i };