UNPKG

epic-designer-gold

Version:

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

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