@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,581 lines (1,580 loc) • 404 kB
JavaScript
var ya = Object.defineProperty;
var ba = (e, t, n) => t in e ? ya(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
var pe = (e, t, n) => ba(e, typeof t != "symbol" ? t + "" : t, n);
import { ref as h, computed as O, watch as ee, nextTick as he, reactive as Ye, createVNode as u, withDirectives as At, resolveDirective as Ca, onMounted as Ce, vModelText as Ln, Fragment as Be, defineComponent as ve, shallowRef as yt, provide as mt, inject as ye, onUnmounted as We, isVNode as un, createApp as Nt, Transition as Vn, mergeProps as wt, createTextVNode as Se, onBeforeMount as wa, Teleport as An, render as an, h as Sa, cloneVNode as xa, onBeforeUnmount as Nn, withModifiers as Hn, resolveComponent as Ta, watchEffect as Ia, vShow as Ba, onUpdated as ka } from "vue";
import { cloneDeep as et, isPlainObject as kn, isUndefined as Ze, debounce as Ma } from "lodash-es";
import { getCustomClass as De, withInstall as zn, FormSchemaEntityField$Type as Mn, FormSchemaEntityFieldTypeName as Fn, getCustomStyle as Pn, useGuid as Fa } from "../common/index.esm.js";
import Pa from "../capsule/index.esm.js";
import { useI18n as Ue } from "vue-i18n";
import qn from "../response-toolbar/index.esm.js";
import { createPropsResolver as Ht, getSchemaByTypeForDesigner as _n, resolveAppearance as Ea } from "../dynamic-resolver/index.esm.js";
import Oa from "../section/index.esm.js";
import { LocaleService as vt } from "../locale/index.esm.js";
import { useResizeObserver as Da } from "@vueuse/core";
import { getHierarchyRow as Ra, useIdentify as Wn, useGroupData as Un, useFilter as Gn, useHierarchy as Xn, useLoading as ja, useDataView as Yn, useSelection as Jn, useSelectHierarchyItem as $a, usePagination as Qn, useDataViewContainerStyle as La, useCommandColumn as Va, useSettingColumn as Aa, useColumn as Zn, useSort as Na, useGroupColumn as Ha, useRow as Kn, useEdit as eo, useVisualDataBound as to, useVisualDataCell as no, useVisualDataRow as oo, useVisualData as ao, useCellPosition as za, useSidebar as io, useVirtualScroll as lo, useFitColumn as qa, useFilterHistory as _a, useColumnFilter as Wa, useDragColumn as Ua, getColumnHeader as Ga, getSidebar as Xa, getDisableMask as Ya, getHorizontalScrollbar as Ja, getVerticalScrollbar as Qa, getEmpty as Za, getPagination as so, getSummary as Ka, useVisualGroupRow as ei, useVisualSummaryRow as ti } from "../data-view/index.esm.js";
import { useDesignerInnerComponent as ni, useDesignerComponent as oi } from "../designer-canvas/index.esm.js";
import "../property-panel/index.esm.js";
import "../accordion/index.esm.js";
import "../avatar/index.esm.js";
import "../../designer/button-edit/index.esm.js";
import "../button-group/index.esm.js";
import "../calendar/index.esm.js";
import "../../designer/checkbox/index.esm.js";
import "../../designer/checkbox-group/index.esm.js";
import "../combo-list/index.esm.js";
import "../combo-tree/index.esm.js";
import "../component/index.esm.js";
import "../color-picker/index.esm.js";
import "../content-container/index.esm.js";
import "../date-picker/index.esm.js";
import "../../designer/data-grid/index.esm.js";
import "../dropdown/index.esm.js";
import "../dynamic-form/index.esm.js";
import "../events-editor/index.esm.js";
import "../filter-bar/index.esm.js";
import "../field-selector/index.esm.js";
import "../binding-selector/index.esm.js";
import "../image-cropper/index.esm.js";
import "../../designer/input-group/index.esm.js";
import "../layout/index.esm.js";
import "../list-nav/index.esm.js";
import "../../designer/list-view/index.esm.js";
import "../lookup/index.esm.js";
import "../mapping-editor/index.esm.js";
import "../nav/index.esm.js";
import "../number-range/index.esm.js";
import "../number-spinner/index.esm.js";
import "../order/index.esm.js";
import "../page-header/index.esm.js";
import "../page-footer/index.esm.js";
import "../pagination/index.esm.js";
import "../progress/index.esm.js";
import "../query-solution/index.esm.js";
import "../../designer/radio-group/index.esm.js";
import "../rate/index.esm.js";
import "../response-layout/index.esm.js";
import "../response-layout-editor/index.esm.js";
import "../search-box/index.esm.js";
import "../smoke-detector/index.esm.js";
import "../splitter/index.esm.js";
import "../step/index.esm.js";
import "../switch/index.esm.js";
import "../tabs/index.esm.js";
import ai from "../tags/index.esm.js";
import "../text/index.esm.js";
import "../time-picker/index.esm.js";
import "../transfer/index.esm.js";
import "../tree-view/index.esm.js";
import "../uploader/index.esm.js";
import "../verify-detail/index.esm.js";
import "../video/index.esm.js";
import "../textarea/index.esm.js";
import "../schema-selector/index.esm.js";
import "../../designer/tree-grid/index.esm.js";
import "../event-parameter/index.esm.js";
import "../filter-condition-editor/index.esm.js";
import "../fieldset/index.esm.js";
import "../sort-condition-editor/index.esm.js";
import "../menu-lookup/index.esm.js";
import "../../designer/drawer/index.esm.js";
import "../json-editor/index.esm.js";
import "../property-editor/index.esm.js";
import "../expression-editor/index.esm.js";
import "../code-editor/index.esm.js";
import "../html-template/index.esm.js";
import "../collection-property-editor/index.esm.js";
import "../modal/index.esm.js";
import "../external-container/index.esm.js";
import "../language-textbox/index.esm.js";
import "../notify/index.esm.js";
import ii from "../button-edit/index.esm.js";
import li from "../list-view/index.esm.js";
import si from "../loading/index.esm.js";
import { FCheckbox as dn } from "../checkbox/index.esm.js";
import ri from "../popover/index.esm.js";
const ci = {
injectSymbolToken: { type: Symbol },
/** 待选数据视图集合 */
viewOptions: { type: Array, default: [] },
/** 数据视图类型 */
viewType: { type: String, default: "Tabs" },
editorParams: { type: Object, default: null },
showFooter: { type: Boolean, default: !1 },
validateFunction: { type: Function, default: null }
};
function ro(e, t) {
let n;
function o(f) {
const { properties: v, title: p, ignore: m } = f, g = m && Array.isArray(m), T = Object.keys(v).reduce((M, S) => ((!g || !m.find((D) => D === S)) && (M[S] = v[S].type === "object" && v[S].properties ? o(v[S]) : et(v[S].default)), M), {});
if (p && (!g || !m.find((M) => M === "id"))) {
const M = p.toLowerCase().replace(/-/g, "_");
T.id = `${M}_${Math.random().toString().slice(2, 6)}`;
}
return T;
}
function a(f) {
const { properties: v, title: p, required: m } = f;
if (m && Array.isArray(m)) {
const g = m.reduce((T, M) => (T[M] = v[M].type === "object" && v[M].properties ? o(v[M]) : et(v[M].default), T), {});
if (p && m.find((T) => T === "id")) {
const T = p.toLowerCase().replace(/-/g, "_");
g.id = `${T}_${Math.random().toString().slice(2, 6)}`;
}
return g;
}
return {
type: p
};
}
function i(f, v = {}, p) {
const m = e[f];
if (m) {
let g = a(m);
const T = t[f];
return g = T ? T({ getSchemaByType: i }, g, v, p) : g, n != null && n.appendIdentifyForNewControl && n.appendIdentifyForNewControl(g), g;
}
return null;
}
function l(f, v) {
const p = o(v);
return Object.keys(p).reduce((m, g) => (Object.prototype.hasOwnProperty.call(f, g) && (m[g] && kn(m[g]) && kn(f[g] || !f[g]) ? Object.assign(m[g], f[g] || {}) : m[g] = f[g]), m), p), p;
}
function s(f, v) {
return Object.keys(f).filter((m) => f[m] != null).reduce((m, g) => {
if (v.has(g)) {
const T = v.get(g);
if (typeof T == "string")
m[T] = f[g];
else {
const M = T(g, f[g], f);
Object.assign(m, M);
}
} else
m[g] = f[g];
return m;
}, {});
}
function c(f, v, p = /* @__PURE__ */ new Map()) {
const m = l(f, v);
return s(m, p);
}
function r(f) {
var p;
const v = f.type;
if (v) {
const m = e[v];
if (!m)
return f;
const g = l(f, m), T = ((p = f.editor) == null ? void 0 : p.type) || "";
if (T) {
const M = e[T], S = l(f.editor, M);
g.editor = S;
}
return g;
}
return f;
}
function d(f) {
n = f;
}
return { getSchemaByType: i, resolveSchemaWithDefaultValue: r, resolveSchemaToProps: c, mappingSchemaToProps: s, setDesignerContext: d };
}
const co = {}, uo = {}, { getSchemaByType: fo, resolveSchemaWithDefaultValue: ui, resolveSchemaToProps: di, mappingSchemaToProps: fi, setDesignerContext: Gf } = ro(co, uo);
function pi(e = {}) {
function t(r, d, f, v) {
if (typeof f == "number")
return v[r].length === f;
if (typeof f == "object") {
const p = Object.keys(f)[0], m = f[p];
if (p === "not")
return Number(v[r].length) !== Number(m);
if (p === "moreThan")
return Number(v[r].length) >= Number(m);
if (p === "lessThan")
return Number(v[r].length) <= Number(m);
}
return !1;
}
function n(r, d, f, v) {
return v[r] && v[r].propertyValue && String(v[r].propertyValue.value) === String(f);
}
const o = /* @__PURE__ */ new Map([
["length", t],
["getProperty", n]
]);
Object.keys(e).reduce((r, d) => (r.set(d, e[d]), r), o);
function a(r, d) {
const f = r;
return typeof d == "number" ? [{ target: f, operator: "length", param: null, value: Number(d) }] : typeof d == "boolean" ? [{ target: f, operator: "getProperty", param: r, value: !!d }] : typeof d == "object" ? Object.keys(d).map((v) => {
if (v === "length")
return { target: f, operator: "length", param: null, value: d[v] };
const p = v, m = d[v];
return { target: f, operator: "getProperty", param: p, value: m };
}) : [];
}
function i(r) {
return Object.keys(r).reduce((f, v) => {
const p = a(v, r[v]);
return f.push(...p), f;
}, []);
}
function l(r, d) {
if (o.has(r.operator)) {
const f = o.get(r.operator);
return f && f(r.target, r.param, r.value, d) || !1;
}
return !1;
}
function s(r, d) {
return i(r).reduce((p, m) => p && l(m, d), !0);
}
function c(r, d) {
const f = Object.keys(r), v = f.includes("allOf"), p = f.includes("anyOf"), m = v || p, M = (m ? r[m ? v ? "allOf" : "anyOf" : "allOf"] : [r]).map((D) => s(D, d));
return v ? !M.includes(!1) : M.includes(!0);
}
return { parseValueSchema: c };
}
const mi = {
convertTo: (e, t, n, o) => {
e.appearance || (e.appearance = {}), e.appearance[t] = n;
},
convertFrom: (e, t, n) => e.appearance ? e.appearance[t] : e[t]
}, vi = {
convertFrom: (e, t, n) => e.buttons && e.buttons.length ? `共 ${e.buttons.length} 项` : "无"
}, gi = {
convertTo: (e, t, n, o) => {
e.editor && (e.editor[t] = n);
},
convertFrom: (e, t, n) => e.editor && Object.prototype.hasOwnProperty.call(e.editor, t) ? e.editor[t] : e[t]
}, W = {
button: { type: "button", name: "按钮" },
"response-toolbar": { type: "response-toolbar", name: "工具栏" },
"response-toolbar-item": { type: "response-toolbar-item", name: "按钮" },
"content-container": { type: "content-container", name: "容器" },
"input-group": { type: "input-group", name: "文本" },
textarea: { type: "textarea", name: "多行文本" },
lookup: { type: "lookup", name: "帮助" },
"number-spinner": { type: "number-spinner", name: "数值" },
"date-picker": { type: "date-picker", name: "日期" },
switch: { type: "switch", name: "开关" },
"radio-group": { type: "radio-group", name: "单选组" },
"check-box": { type: "check-box", name: "复选框" },
"check-group": { type: "check-group", name: "复选框组" },
"combo-list": { type: "combo-list", name: "下拉列表" },
"response-form": { type: "response-form", name: "卡片面板" },
"response-layout": { type: "response-layout", name: "布局容器", icon: "response-layout-3" },
"response-layout-item": { type: "response-layout-item", name: "布局", icon: "response-layout-1" },
"tree-grid": { type: "tree-grid", name: "树表格" },
"tree-grid-column": { type: "tree-grid-column", name: "树表格列" },
"data-grid": { type: "data-grid", name: "表格" },
"data-grid-column": { type: "data-grid-column", name: "表格列" },
module: { type: "Module", name: "模块" },
component: { type: "component", name: "组件" },
tabs: { type: "tabs", name: "标签页" },
"tab-page": { type: "tab-page", name: "标签页项", dependentParentControl: "Tab" },
"tab-toolbar-item": { type: "tab-toolbar-item", name: "标签页工具栏按钮" },
"html-template": { type: "html-template", name: "模板容器" },
"time-picker": { type: "time-picker", name: "时间选择" },
section: { type: "section", name: "分组面板" },
"section-toolbar": { type: "section-toolbar", name: "分组面板工具栏" },
"section-toolbar-item": { type: "section-toolbar-item", name: "分组面板按钮" },
splitter: { type: "splitter", name: "分栏面板" },
"splitter-pane": { type: "splitter-pane", name: "分栏面板项", dependentParentControl: "Splitter" },
"component-ref": { type: "component-ref", name: "组件引用节点" },
uploader: { type: "uploader", name: "附件上传" },
"page-header": { type: "page-header", name: "页头" },
"page-footer": { type: "page-footer", name: "页脚" },
"tab-toolbar": { type: "tab-toolbar", name: "标签页工具栏" },
fieldset: { type: "fieldset", name: "分组" },
"query-solution": { type: "query-solution", name: "筛选方案" },
drawer: { type: "drawer", name: "抽屉" },
"external-container": { type: "external-container", name: "外部容器", icon: "content-container" },
"list-nav": { type: "list-nav", name: "列表导航" },
"list-view": { type: "list-view", name: "列表" },
"filter-bar": { type: "filter-bar", name: "筛选条" },
"language-textbox": { type: "language-textbox", name: "多语输入框" }
}, hi = {
convertFrom: (e, t, n) => {
var a;
const o = e.editor && e.editor[t] ? e.editor[t] : e[t];
return ((a = W[o]) == null ? void 0 : a.name) || o;
}
}, yi = {
convertTo: (e, t, n, o) => {
e[t] = e[t];
},
convertFrom: (e, t, n) => e.editor ? n.getRealEditorType(e.editor.type) : ""
}, bi = {
convertTo: (e, t, n, o) => {
(e.type === "data-grid-column" || e.type === "tree-grid-column") && (e.formatter ? e.formatter[t] = n : e.formatter = {
[t]: n
});
},
convertFrom: (e, t, n) => {
if (e.formatter) {
if (t === "trueText")
return e.formatter.trueText;
if (t === "falseText")
return e.formatter.falseText;
if (t === "prefix")
return e.formatter.prefix;
if (t === "suffix")
return e.formatter.suffix;
if (t === "precision")
return e.formatter.precision;
if (t === "decimal")
return e.formatter.decimal;
if (t === "thousand")
return e.formatter.thousand;
if (t === "tempDateFormat")
return e.formatter.dateFormat === "yyyy年MM月dd日" ? "yearMonthDay" : e.formatter.dateFormat === "yyyy-MM-dd HH:mm:ss" ? "yyyy-MM-ddTHH:mm:ss" : e.formatter.dateFormat === "yyyy/MM/dd HH:mm:ss" ? "yyyy/MM/ddTHH:mm:ss" : e.formatter.dateFormat === "yyyy年MM月dd日 HH时mm分ss秒" ? "yearMonthDayHourMinuteSecond" : e.formatter.tempDateFormat || e.formatter.dateFormat || "yyyy-MM-dd";
if (t === "customFormat")
return e.formatter.customFormat;
if (t === "type")
return e.formatter.type || "none";
}
return "none";
}
}, Ci = {
convertTo: (e, t, n, o) => {
e.command ? e.command[t] = n : e.command = {
[t]: n
}, t === "enable" && n && (e.command.commands || (e.command.commands = [
{
text: "编辑",
type: "primary",
command: "edit"
},
{
text: "删除",
type: "danger",
command: "remove"
}
]));
},
convertFrom: (e, t, n) => e.command && t === "enable" ? e.command.enable : ""
}, wi = {
convertTo: (e, t, n, o) => {
e.column ? e.column[t] = n : e.column = {
[t]: n
}, t === "fitColumns" && n && (e.column.fitMode || (e.column.fitMode = "average"));
},
convertFrom: (e, t, n) => {
if (e.column) {
if (t === "fitColumns")
return e.column.fitColumns;
if (t === "fitMode")
return e.column.fitMode;
}
return "";
}
}, Si = {
convertTo: (e, t, n, o) => {
e.summary ? e.summary[t] = n : e.summary = {
[t]: n
}, t === "enable" && n && (e.summary ? e.summary.groupFields || (e.summary.groupFields = []) : e.summary = {
enable: n,
groupFields: []
});
},
convertFrom: (e, t, n) => e.summary && t === "enable" ? e.summary.enable : e.type === "data-grid-column" ? e.enableSummary === void 0 ? !1 : e.enableSummary : ""
}, xi = {
convertTo: (e, t, n, o) => {
e.group ? e.group[t] = n : e.group = {
[t]: n
}, t === "enable" && n && (e.group ? e.group.groupFields || (e.group.groupFields = []) : e.group = {
enable: n,
groupFields: [],
showSummary: !1
});
},
convertFrom: (e, t, n) => {
if (e.group) {
if (t === "enable")
return e.group.enable;
if (t === "showSummary")
return e.group.showSummary;
}
}
}, Ti = {
convertFrom: (e, t) => e.binding ? e.binding.path : "",
convertTo: (e, t, n) => {
if (n && n.length > 0) {
const o = n[0];
e.binding || (e.binding = {}), e.binding.type = "Form", e.binding.path = o.bindingField, e.binding.field = o.id, e.binding.fullPath = o.path, e.path = o.bindingPath;
}
}
}, Ii = {
convertTo: (e, t, n, o) => {
e.pagination || (e.pagination = {}), e.pagination[t] = n;
},
convertFrom: (e, t, n) => e.pagination ? e.pagination[t] : e[t]
}, Bi = {
convertTo: (e, t, n, o) => {
e.rowNumber || (e.rowNumber = {}), e.rowNumber[t] = n;
},
convertFrom: (e, t, n) => e.rowNumber ? e.rowNumber[t] : e[t]
}, ki = {
convertTo: (e, t, n, o) => {
e.selection || (e.selection = {}), e.selection[t] = n;
},
convertFrom: (e, t, n) => e.selection ? e.selection[t] : e[t]
}, Mi = {
convertFrom: (e, t, n) => e[t] && e[t].length ? `共 ${e[t].length} 项` : ""
}, Fi = {
convertFrom: (e, t) => e[t] || "",
convertTo: (e, t, n) => {
e[t] = n;
}
}, Pi = {
convertTo: (e, t, n, o) => {
e.size || (e.size = {}), e.size[t] = n;
},
convertFrom: (e, t, n) => e.size ? e.size[t] : e[t]
}, Ei = {
convertFrom: (e, t, n) => {
var o, a;
return (o = e.formatter) != null && o.data && t === "formatterEnumData" && !e.formatterEnumData ? (a = e.formatter) == null ? void 0 : a.data : e.formatterEnumData;
}
}, Oi = {
convertTo: (e, t, n, o) => {
e.sort || (e.sort = {}), e.sort[t] = n;
},
convertFrom: (e, t, n) => {
var o, a;
if (t === "mode")
return ((o = e.sort) == null ? void 0 : o.mode) || "client";
if (t === "multiSort")
return !!((a = e.sort) != null && a.multiSort);
}
}, Di = {
convertTo: (e, t, n, o) => {
e.filter || (e.filter = {}), e.filter[t] = n;
},
convertFrom: (e, t, n) => {
var o;
if (t === "mode")
return ((o = e.filter) == null ? void 0 : o.mode) || "client";
}
}, Ri = {
convertTo: (e, t, n, o) => {
e.rowOption ? e.rowOption[t] = n : e.rowOption = {
[t]: n
};
},
convertFrom: (e, t, n) => {
if (e.rowOption) {
if (t === "customRowStyle")
return e.rowOption.customRowStyle;
if (t === "customCellStyle")
return e.rowOption.customCellStyle;
}
return "";
}
};
function po(e, t, n) {
const o = /* @__PURE__ */ new Map([
["/converter/appearance.converter", mi],
["/converter/buttons.converter", vi],
["/converter/property-editor.converter", gi],
["/converter/items-count.converter", Mi],
["/converter/type.converter", hi],
["/converter/change-editor.converter", yi],
["/converter/change-formatter.converter", bi],
["/converter/column-command.converter", Ci],
["/converter/column-option.converter", wi],
["/converter/summary.converter", Si],
["/converter/group.converter", xi],
["/converter/form-group-label.converter", Fi],
["/converter/field-selector.converter", Ti],
["/converter/pagination.converter", Ii],
["/converter/row-number.converter", Bi],
["/converter/grid-selection.converter", ki],
["/converter/size.converter", Pi],
["/converter/change-formatter-enum.converter", Ei],
["/converter/grid-sort.converter", Oi],
["/converter/grid-filter.converter", Di],
["/converter/row-option.converter", Ri]
]), a = /* @__PURE__ */ new Map([
["string", { type: "input-group", enableClear: !1 }],
["boolean", {
type: "combo-list",
textField: "name",
valueField: "value",
idField: "value",
enableClear: !1,
editable: !1,
data: [
{
value: !0,
name: "是"
},
{
value: !1,
name: "否"
}
]
}],
["enum", { type: "combo-list", maxHeight: 128, enableClear: !1, editable: !1 }],
["array", { type: "button-edit" }],
["number", { type: "number-spinner", placeholder: "" }],
["events-editor", { type: "events-editor", hide: !0 }]
]), i = pi();
function l(m, g) {
return () => i.parseValueSchema(m, g);
}
function s(m, g, T) {
return m.includes("visible") && g.visible !== void 0 ? typeof g.visible == "boolean" ? () => !!g.visible : g.visible === void 0 ? !0 : l(g.visible, T) : () => !0;
}
function c(m, g, T) {
return m.includes("readonly") && g.readonly !== void 0 ? typeof g.readonly == "boolean" ? () => !!g.readonly : l(g.readonly, T) : () => !1;
}
function r(m, g) {
const T = m.$converter || g;
return typeof T == "string" && T && o.has(T) ? o.get(T) || null : T || null;
}
function d(m, g, T, M, S, D = "", C = "") {
return Object.keys(m).map((w) => {
const P = h(1), y = w, b = m[w], k = Object.keys(b), x = b.title, B = b.type, F = a.get(B) || { type: "input-group", enableClear: !1 }, E = b.editor ? Object.assign({}, F, b.editor) : Object.assign({}, F), R = s(k, b, g), j = c(k, b, g);
E.readonly = E.readonly === void 0 ? j() : E.readonly;
const V = b.type === "cascade" ? d(b.properties, g, T, M, S, D, C) : [], $ = !0;
let A = r(b, C);
const z = O({
get() {
if (P.value) {
if (["class", "style"].find((be) => be === y) && !A && (A = o.get("/converter/appearance.converter") || null), A && A.convertFrom)
return A.convertFrom(T, w, S, D);
const de = T[w];
return Object.prototype.hasOwnProperty.call(b, "defaultValue") && (de === void 0 || typeof de == "string" && de === "") ? b.type === "boolean" ? b.defaultValue : b.defaultValue || "" : de;
}
return null;
},
set(de) {
P.value += 1, A && A.convertTo ? (A.convertTo(M, w, de, S, D), A.convertTo(T, w, de, S, D)) : (M[w] = de, T[w] = de);
}
}), { refreshPanelAfterChanged: H, description: K, isExpand: ae, parentPropertyID: le } = b, Z = { propertyID: y, propertyName: x, propertyType: B, propertyValue: z, editor: E, visible: R, readonly: j, cascadeConfig: V, hideCascadeTitle: $, refreshPanelAfterChanged: H, description: K, isExpand: ae, parentPropertyID: le };
return g[y] = Z, Z;
});
}
function f(m, g, T = {}) {
const M = {}, S = e[m];
return S && S.categories ? Object.keys(S.categories).map((C) => {
const I = S.categories[C], w = I == null ? void 0 : I.title, P = d(I.properties || {}, M, {}, T, g);
return { categoryId: C, categoryName: w, properties: P };
}) : [];
}
function v(m, g, T, M, S = "") {
const D = g.$ref.schema, C = g.$ref.converter, I = T[D], w = I.type, P = n(I), y = {}, b = e[w];
if (b && b.categories) {
const k = b.categories[m], x = k == null ? void 0 : k.title;
C && Object.keys(k.properties).forEach((E) => {
k.properties[E].$converter = C;
});
const B = (k == null ? void 0 : k.properties) || {}, F = d(B, y, P, I, M, S);
return { categoryId: m, categoryName: x, properties: F };
}
return { categoryId: m, categoryName: "", properties: [] };
}
function p(m, g, T, M, S) {
const D = m.type, C = n(m), I = {};
let w = S || e[D];
if (w && Object.keys(w).length === 0 && T && T.getPropConfig && (w = T.getPropConfig(M)), w && w.categories) {
const P = [];
return Object.keys(w.categories).map((y) => {
const b = w.categories[y];
if (b.$ref) {
P.push(v(y, b, m, g, M));
return;
}
const k = b == null ? void 0 : b.title, x = b == null ? void 0 : b.tabId, B = b == null ? void 0 : b.tabName, F = b == null ? void 0 : b.hide, E = b == null ? void 0 : b.hideTitle, R = d(b.properties || {}, I, C, m, g, M, b.$converter), { setPropertyRelates: j } = b, V = b == null ? void 0 : b.parentPropertyID;
P.push({ categoryId: y, categoryName: k, tabId: x, tabName: B, hide: F, properties: R, hideTitle: E, setPropertyRelates: j, parentPropertyID: V });
}), P;
}
return [];
}
return {
getPropertyConfigBySchema: p,
getPropertyConfigByType: f,
propertyConverterMap: o
};
}
const mo = {}, vo = {};
po(mo, vo, ui);
const go = {}, ho = {}, { getSchemaByType: fn, resolveSchemaWithDefaultValue: ji, resolveSchemaToProps: Xf, mappingSchemaToProps: Yf, setDesignerContext: Jf } = ro(go, ho), yo = {}, bo = {};
po(yo, bo, ji);
function Re(e, t, n = /* @__PURE__ */ new Map(), o = (l, s, c, r) => s, a = {}, i = (l) => l) {
return co[t.title] = t, uo[t.title] = o, mo[t.title] = a, vo[t.title] = i, go[t.title] = t, ho[t.title] = o, yo[t.title] = a, bo[t.title] = i, (l = {}, s = !0) => {
if (!s)
return fi(l, n);
const c = di(l, t, n), r = Object.keys(e).reduce((d, f) => (d[f] = e[f].default, d), {});
return Object.assign(r, c);
};
}
function at(e, t) {
return { customClass: t.class, customStyle: t.style };
}
function $i(e, t) {
if (!e || e.length < 1)
return null;
for (const n of e) {
if (n.id === t)
return n;
if (n.children) {
const o = n.children.find((a) => a.id === t);
if (o)
return o;
}
}
return null;
}
function Li() {
function e(t, n) {
const { name: o } = n, [a, i] = n.payloads;
if (o === "tabChange" || o === "tabRemove")
return t[`on${o.charAt(0).toUpperCase()}${o.slice(1)}`];
const l = t.contents;
if (!l || l.length < 1)
return null;
const s = l.reduce((r, d) => {
const f = d.toolbar && d.toolbar.buttons || [];
return r.push(...f), r;
}, []);
if (!s || s.length < 1)
return;
const c = $i(s, i);
return c ? c.onClick || c.click : null;
}
return {
resolve: e
};
}
const zt = /* @__PURE__ */ new Map([
["appearance", at]
]);
function Vi(e, t) {
const n = Math.random().toString().slice(2, 6), o = t.parentComponentInstance, a = e.getSchemaByType("tab-page");
a.id = `tab-page-${n}`, a.title = "标题", a.toolbar = { id: `tab-page-toolbar-${n}`, buttons: [] };
const i = e.getSchemaByType("tabs");
Object.assign(i, {
id: `tabs-${n}`,
appearance: {
class: "f-component-tabs f-tabs-has-grid"
},
contents: [a],
activeId: a.id
});
const l = e.getSchemaByType("section");
Object.assign(l, {
id: `section-${n}`,
appearance: {
class: "f-section-tabs f-section-in-mainsubcard"
},
fill: !1,
showHeader: !1,
contents: [i]
});
const s = e.getSchemaByType("content-container");
Object.assign(s, {
id: `container-${n}`,
appearance: {
class: "f-struct-wrapper"
},
contents: [l]
});
const c = o.schema;
switch (c && c.type) {
case W["splitter-pane"].type: {
l.appearance.class = "f-section-tabs f-section-in-main", i.appearance.class = "f-component-tabs";
break;
}
}
const r = o.elementRef, d = window.getComputedStyle(r);
return d && d.display === "flex" && (s.appearance.class += " d-block"), s;
}
function Co(e, t, n) {
if (n.parentComponentInstance)
return Vi(e, n);
{
const a = e.getSchemaByType("tab-page");
return t.contents = [a], t;
}
}
function Ai(e, t, n) {
return t;
}
const Ni = "https://json-schema.org/draft/2020-12/schema", Hi = "https://farris-design.gitee.io/tabs.schema.json", zi = "tabs", qi = "A Farris Container Component", _i = "object", Wi = {
id: {
description: "The unique identifier for a Tabs",
type: "string"
},
type: {
description: "The type string of Tabs component",
type: "string",
default: "tabs"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string"
},
style: {
type: "string"
}
},
default: {}
},
contents: {
description: "",
type: "array",
default: []
},
autoTitleWidth: {
description: "",
type: "boolean",
default: !1
},
titleWidth: {
description: "",
type: "number"
},
titleLength: {
description: "",
type: "number",
default: 7
},
fill: {
description: "",
type: "boolean",
default: !1
},
visible: {
description: "",
type: "boolean",
default: !0
},
activeId: {
description: "",
type: "string",
default: ""
}
}, Ui = [
"id",
"type",
"contents"
], Gi = {
onTabChange: "切换标签页事件",
onTabRemove: "移除标签页事件"
}, wo = {
$schema: Ni,
$id: Hi,
title: zi,
description: qi,
type: _i,
properties: Wi,
required: Ui,
events: Gi
}, Xi = "https://json-schema.org/draft/2020-12/schema", Yi = "https://farris-design.gitee.io/tab-toolbar.schema.json", Ji = "tab-toolbar", Qi = "A Farris Toolbar Component", Zi = "object", Ki = {
id: {
description: "The unique identifier for a Tab Toolbar",
type: "string"
},
type: {
description: "The type string of Tab Toolbar",
type: "string",
default: "tab-toolbar"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string",
default: ""
}
}
},
alignment: {
description: "The alignment of Tab Toolbar Button.",
type: "string",
default: "right"
},
buttons: {
description: "The items of Tab Toolbar.",
type: "array",
default: []
},
buttonSize: {
type: "string",
default: ""
},
visible: {
description: "",
type: "boolean",
default: !0
}
}, el = [
"id",
"type",
"buttons"
], tl = {
onClick: "点击事件"
}, nl = {
$schema: Xi,
$id: Yi,
title: Ji,
description: Qi,
type: Zi,
properties: Ki,
required: el,
events: tl
}, ol = /* @__PURE__ */ new Map([
["buttons", "items"],
["appearance", at]
]);
function qt(e, t, n) {
return t;
}
const al = "https://json-schema.org/draft/2020-12/schema", il = "https://farris-design.gitee.io/response-toolbar.schema.json", ll = "response-toolbar", sl = "A Farris Toolbar Component", rl = "object", cl = {
id: {
description: "The unique identifier for a Response Toolbar",
type: "string"
},
type: {
description: "The type string of Response Toolbar",
type: "string",
default: "response-toolbar"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string",
default: ""
}
}
},
alignment: {
description: "The alignment of Response Toolbar Button.",
type: "string",
default: "right"
},
buttons: {
description: "The items of Response Toolbar.",
type: "array",
default: []
},
buttonSize: {
type: "string",
default: ""
},
visible: {
description: "",
type: "boolean",
default: !0
}
}, ul = [
"id",
"type",
"buttons"
], dl = {
onClick: "点击事件"
}, fl = {
$schema: al,
$id: il,
title: ll,
description: sl,
type: rl,
properties: cl,
required: ul,
events: dl
}, pl = "https://json-schema.org/draft/2020-12/schema", ml = "https://farris-design.gitee.io/response-toolbar-item.schema.json", vl = "response-toolbar-item", gl = "A Farris Toolbar Item Component", hl = "object", yl = {
id: {
description: "The unique identifier for a Response Toolbar",
type: "string"
},
type: {
description: "The type string of Response Toolbar",
type: "string",
default: "response-toolbar-item"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string",
default: ""
}
}
},
alignment: {
description: "对齐",
type: "string",
default: "right"
},
text: {
description: "文本",
type: "string",
default: "按钮"
},
icon: {
description: "图标",
type: "string",
default: ""
},
disabled: {
description: "禁用",
type: "boolean",
default: !1
},
visible: {
description: "是否可见",
type: "boolean",
default: !0
},
onClick: {
description: "点击事件",
type: "string",
default: ""
},
tipsEnable: {
description: "",
type: "boolean",
default: !1
},
tipsText: {
description: "",
type: "string",
default: ""
},
dropdownClass: {
description: "处于下拉菜单时的样式",
type: "string",
default: ""
},
split: {
description: "",
type: "boolean",
default: !1
}
}, bl = [
"id",
"type",
"text"
], Cl = {
onClick: "点击事件"
}, wl = {
$schema: pl,
$id: ml,
title: vl,
description: gl,
type: hl,
properties: yl,
required: bl,
events: Cl
}, _t = {
id: { type: String, default: "" },
/** 组件自定义样式 */
customClass: { type: String, default: "" },
alignment: { Type: String, default: "right" },
items: {
Type: Array,
default: []
},
/** 控制是否可见 */
visible: { type: Boolean, default: !0 }
}, Sl = Object.assign({}, _t, {
componentId: { type: String, default: "" }
});
Re(
_t,
fl,
ol,
qt
);
const So = {
id: { type: String, default: "" },
item: { type: Object, default: {} },
items: { type: Object, default: {} },
class: { type: String, default: "btn-secondary" },
text: { type: String, default: "" },
disabled: { type: Boolean, default: !1 },
icon: { type: String, default: "" },
componentId: { type: String, default: "" },
// 是否展开子级
expanded: { type: Boolean, default: !1 },
alignment: { Type: String, default: "right" },
// 下拉按钮分离
split: { type: Boolean, default: !1 },
// 是否下拉
isDP: { type: Boolean, default: !1 },
// 是否下拉项
isDPItem: { type: Boolean, default: !1 }
};
Re(
So,
wl,
void 0,
qt
);
const pn = {
/** 标签页头部区域的展示类型 */
tabType: { type: String, default: "default" },
/** 标题自适应宽度 */
autoTitleWidth: { type: Boolean, default: !1 },
titleLength: { type: Number, default: 7 },
position: { type: String, default: "top" },
showDropdown: { type: Boolean, default: !0 },
scrollStep: { type: Number, default: 10 },
autoResize: { type: Boolean, default: !1 },
width: { type: Number },
height: { type: Number },
searchBoxVisible: { type: Boolean, default: !0 },
titleWidth: { type: Number, default: 0 },
customClass: { type: String, default: "" },
/** 指定当前活动Id */
activeId: { type: String },
/** 标签页内容区域是否填充 */
fill: { type: Boolean, default: !1 },
justifyContent: { type: String, default: "left" },
/** 控制是否可见 */
visible: { type: Boolean, default: !0 }
}, xl = Re(pn, wo, zt, Co), xo = Object.assign({}, pn, {
componentId: { type: String, default: "" }
}), Tl = Re(xo, wo, zt, Co), Il = Li(), Bl = Re(
_t,
nl,
zt,
qt
);
function kl(e, t, n) {
const o = h([]), a = h(e.activeId || "");
let i = "";
const l = h(!0), s = h([]), c = h(!0), r = h(0), d = O(() => {
const y = o.value.find((k) => k.props.id === a.value);
return (y == null ? void 0 : y.props.toolbarPosition) === "inHead";
});
function f(y, b = !0) {
const k = y.findIndex((x) => x.props.show !== !1 && !x.props.disabled);
if (s.value = [], k !== -1) {
if (a.value = y[k].props.id, !b)
return;
const x = y[k];
x && x.props.toolbar && x.props.toolbar.buttons && x.props.toolbar.buttons.length && (s.value = [...x.props.toolbar.buttons], c.value = x.props.toolbarVisible);
}
}
function v(y) {
a.value = y;
const b = o.value.find((k) => k.props.id === y);
s.value = [], b && b.props.toolbar && b.props.toolbar.buttons && b.props.toolbar.buttons.length && (s.value = [...b.props.toolbar.buttons], c.value = b.props.toolbarVisible), t.emit("update:activeId", y), t.emit("tabChange", {
prevId: i,
nextId: a.value
});
}
function p(y) {
let b = -1;
if (!a.value) {
if (b = y.findIndex((k) => a.value === k.props.id && k.props.show !== !1 && !k.props.disabled), b > -1)
return;
i = a.value;
}
f(y, !1), v(a.value);
}
function m(y) {
let b = !1;
if (y) {
const k = o.value.find((x) => x.props.id === y);
b = !k || k.props.show === !1 || k.props.disabled === !0;
}
b ? p(o.value) : (a.value !== y && (i = a.value, a.value = y), v(a.value));
}
ee(() => e.activeId, (y, b) => {
y !== b && m(y);
});
function g(y) {
var k;
if (e.autoTitleWidth)
return;
const b = (k = y.value) == null ? void 0 : k.querySelectorAll(".st-tab-text");
if (!(!b || e.tabType === "pill"))
for (let x = 0; x < b.length; x++) {
const B = b[x].parentNode;
b[x].scrollWidth > B.offsetWidth ? b[x].classList.contains("farris-title-text-custom") || b[x].classList.add("farris-title-text-custom") : b[x].classList.remove("farris-title-text-custom");
}
}
const T = (y) => {
y.preventDefault(), y.stopPropagation();
};
function M(y, b, k = !1) {
const x = o.value.findIndex((B) => B.props.id === b);
o.value = o.value.filter((B) => B.props.id !== b), a.value === b && (i = b, a.value = "", f(o.value)), T(y), he(() => {
r.value++, g(n), k && (l.value = !0), t.emit("tabRemove", {
removeIndex: x,
removeId: b,
activeId: a.value
});
});
}
function S(y, b = !0) {
a.value === y && (a.value = "", i = y, m("")), he(() => {
r.value++, b && (l.value = !0);
});
}
let D;
function C(y) {
D = y;
}
function I(y) {
a.value !== y && (i = a.value, v(y), D && D());
}
function w(y) {
o.value.findIndex((k) => k.props.id === y.props.id) === -1 && o.value.push(y), r.value++;
}
function P(y) {
o.value.findIndex((k) => k.props.id === y.props.id) !== -1 && (o.value.forEach((k) => {
k.props.id === y.props.id && (k = y);
}), y.props.id === a.value && d.value, he(() => {
r.value++, g(n);
}));
}
return {
activeId: a,
addTab: w,
changeTitleStyle: g,
removeTab: M,
selectTab: I,
tabPages: o,
updateTab: P,
toolbarItems: s,
needUpdateNavigationLayout: r,
checkActiveIdAndSelect: m,
toggleShowTab: S,
hasInHeadClass: d,
setScrollToSelectedTabFunction: C,
toolbarVisible: c
};
}
function Ml(e, t, n, o, a) {
const {
activeId: i,
removeTab: l,
selectTab: s
} = a, c = O(() => {
const S = {
"st-tab-text": !0,
"text-truncate": e.tabType === "pill" && !e.autoTitleWidth,
"farris-title-auto": e.autoTitleWidth
};
return De(S, t.customTitleClass);
}), r = O(() => ({
"nav-item": !0,
"d-none": t.show !== void 0 ? !t.show : !1,
"f-state-active": t.id === i.value,
"f-state-disabled": t.disabled
})), d = O(() => ({
width: `${t.tabWidth}px`
})), f = O(() => ({
"nav-link": !0,
"tabs-text-truncate": !0,
active: t.id === i.value,
disabled: t.disabled
})), v = Ye({
content: t.title,
overflowShown: !0
});
function p() {
return e.tabType !== "pill" && !e.autoTitleWidth ? At(u("span", {
class: c.value,
"data-tabid": t.id
}, [t.title]), [[Ca("tooltip"), v]]) : u("span", {
class: c.value,
"data-tabid": t.id,
title: t.title
}, [t.title]);
}
const m = h(t.removeable);
function g() {
return m.value ? u("span", {
class: "st-drop-close",
onClick: (S) => l(S, t.id)
}, [u("i", {
class: "f-icon f-icon-close"
}, null)]) : "";
}
function T(S) {
s(t.id), e.tabType === "one-page" && o.scrollToByPaggId(t.id);
}
function M() {
return n.slots.title ? u("a", {
class: f.value,
onClick: T,
id: `${t.id}-design-item`
}, [n.slots.title(n), g()]) : t.titleRenderFunction ? u("a", {
class: f.value,
onClick: T,
id: `${t.id}-design-item`
}, [t.titleRenderFunction(), g()]) : u("a", {
class: f.value,
onClick: T,
id: `${t.id}-design-item`
}, [p(), g()]);
}
return u("li", {
class: r.value,
style: d.value
}, [M()]);
}
function Fl(e, t, n, o, a) {
const {
shouldShowNavigationButtons: i
} = n, {
tabPages: l
} = a, s = O(() => ({
spacer: !0,
"f-utils-fill": !0,
"spacer-sides-dropdown": i.value
})), c = O(() => ({
width: "100%",
"justify-content": e.justifyContent
})), r = O(() => ({
nav: !0,
"farris-nav-tabs": !0,
"flex-nowrap": !0,
"nav-fill": e.tabType === "fill",
"nav-pills": e.tabType === "pills",
"flex-row": e.position === "top" || e.position === "bottom",
"flex-column": e.position === "left" || e.position === "right"
}));
return () => u("div", {
class: s.value,
style: c.value
}, [u("ul", {
class: r.value,
ref: t
}, [l.value.map((d) => Ml(e, d.props, d, o, a))])]);
}
function To(e, t, n, o, a) {
const i = h(), {
shouldShowNavigationButtons: l
} = n, {
activeId: s,
tabPages: c,
selectTab: r
} = a, d = h(s.value), f = O(() => c.value.map((g) => ({
name: g.props.title,
value: g.props.id,
show: g.props.show,
disabled: g.props.disabled
}))), v = O(() => ({
spacer: !0,
"f-utils-fill": !0,
"spacer-sides-dropdown": l.value
})), p = O(() => ({
width: "100%",
display: "flex",
"justify-content": e.justifyContent
}));
Ce(() => {
i.value && (t.value = i.value.$el);
});
function m(g) {
r(g);
}
return ee(() => s.value, (g) => {
g !== d.value && (d.value = g);
}, {
immediate: !0
}), () => u("div", {
class: v.value,
style: p.value
}, [u(Pa, {
items: f.value,
modelValue: d.value,
"onUpdate:modelValue": (g) => d.value = g,
onChange: m,
ref: i
}, null)]);
}
function Pl(e, t, n, o) {
const {
t: a
} = Ue(), i = h(), {
activeId: l,
removeTab: s,
tabPages: c,
selectTab: r
} = o, {
hideDropDown: d,
searchTabText: f
} = t, v = 600;
let p = null;
const m = O(() => {
var k, x;
let b = [];
return e.searchBoxVisible ? b = (k = c.value) == null ? void 0 : k.filter((B) => B.props.title.includes(f.value)) : b = (x = c.value) == null ? void 0 : x.slice(), b;
}), g = O(() => ({
"dropdown-menu": !0,
"tabs-pt28": e.searchBoxVisible,
// 未看到样式定义
show: !d.value,
"d-none": d.value
}));
let T;
function M(b) {
T = b;
}
ee(d, (b) => {
if (T.value)
if (b)
i.value.style.width = null;
else {
const k = T.value.querySelector(".farris-tabs-header"), x = T.value.clientHeight - k.clientHeight - 20, F = k.querySelector(".farris-tabs-title").clientWidth - 20;
i.value.style.maxWidth = F + "px", i.value.style.maxHeight = x + "px", he(() => {
const {
width: E
} = i.value.getClientRects()[0];
i.value.style.width = E ? E + "px" : null;
});
}
});
function S(b) {
return {
"dropdown-item": !0,
"text-truncate": !0,
"px-2": !0,
disabled: b.props.disabled,
active: b.props.id === l.value,
"d-none": b.props.show !== !0
};
}
function D(b) {
b.preventDefault(), b.stopPropagation();
}
function C() {
p && clearTimeout(p);
}
function I() {
d.value || (p = setTimeout(() => {
d.value = !0;
}, v));
}
function w(b, k) {
b.stopPropagation(), k.disabled || r(k.id), d.value = !0;
}
function P(b, k) {
b.stopPropagation(), s(b, k, !0);
}
function y() {
return u("div", {
ref: i,
class: g.value,
onMouseenter: () => C(),
onMouseleave: () => I()
}, [e.searchBoxVisible && u("div", {
onClick: (b) => D(b),
class: "pb-1 tabs-li-absolute"
}, [At(u("input", {
type: "text",
class: "form-control",
"onUpdate:modelValue": (b) => f.value = b
}, null), [[Ln, f.value]]), u("span", {
class: "f-icon f-icon-page-title-query tabs-icon-search"
}, null)]), m.value.length ? u("ul", {
class: "tab-dropdown-menu--items flex-fill"
}, [m.value.map((b) => u("li", {
class: S(b),
onClick: (k) => w(k, b.props)
}, [b.props.removeable && b.props.disabled !== !0 && u("span", {
class: "float-right st-drop-close",
onClick: (k) => P(k, b.props.id)
}, [u("i", {
class: "f-icon f-icon-close"
}, null)]), u("a", {
class: "dropdown-title",
title: b.props.title
}, [b.props.title])]))]) : u("div", {
class: "dropdown-no-data"
}, [a("tabs.noData")])]);
}
return {
renderDropdownMenu: y,
setTabsRef: M
};
}
function El(e, t, n, o) {
const {
hideDropDown: a
} = t, {
renderDropdownMenu: i,
setTabsRef: l
} = Pl(e, t, n, o), s = h(e.showDropdown);
function c() {
return s.value && u(Be, null, [u("button", {
class: "btn dropdown-toggle-split dropdown-toggle",
onClick: () => {
a.value = !1;
}
}, null), i()]);
}
return {
renderMorePagesButtton: c,
setTabsRef: l
};
}
function Io(e, t, n, o) {
const a = h(!1), { selectTab: i, tabPages: l, needUpdateNavigationLayout: s, activeId: c } = o, r = 4, d = O(() => ({
btn: !0,
"sc-nav-btn": !0,
"px-1": !0,
"sc-nav-lr": !0,
"d-none": !a.value
})), f = O(() => ({
"btn-group": !0,
"sc-nav-btn": !0,
dropdown: !0,
"d-none": !a.value
})), v = O(() => ({
btn: !0,
"sc-nav-rg": !0,
"d-none": !a.value
}));
function p(S, D) {
if (!t.value)
return;
const C = t.value.scrollLeft, I = t.value.scrollWidth - t.value.offsetWidth;
if (D > 0) {
if (t.value.scrollLeft >= I)
return;
t.value.scrollLeft = C + e.scrollStep + S;
} else if (D < 0) {
if (t.value.scrollLeft <= 0)
return;
t.value.scrollLeft = C - e.scrollStep - S;
}
}
function m(S = -1) {
if (!a.value || !t.value)
return;
S < 0 && (S = l.value.findIndex((P) => P.props.id === c.value));
const D = e.tabType === "pills" ? ".f-capsule-item" : ".nav-item", C = t.value.querySelectorAll(D), { parentElement: I } = t.value, w = C[S];
if (w && I) {
const P = I.getBoundingClientRect().left, y = I.getBoundingClientRect().right, b = w.getBoundingClientRect().left, k = w.getBoundingClientRect().right;
b < P ? p(P - b, -1) : y < k && p(k - y, 1), e.tabType === "one-page" && n.scrollTo(S);
}
}
function g() {
var C;
if (!t.value)
return;
const S = t.value, D = (C = t.value) == null ? void 0 : C.parentElement;
a.value = D && S && D.offsetWidth < S.scrollWidth - r, a.value && he(() => {
m();
});
}
function T(S) {
S.disabled || i(S.id);
}
function M() {
["default", "one-page"].indexOf(e.tabType) > -1 && he(() => {
m();
});
}
return ee(s, () => {
g();
}), {
previousButtonClass: d,
nextButtonGroupClass: f,
nextButtonClass: v,
scrollTab: p,
selectAndScrollToTab: T,
shouldShowNavigationButtons: a,
updateNavigationLayout: g,
scrollToSelectedTab: M
};
}
function Bo(e, t) {
const { tabPages: n } = t, o = h(""), a = h(!0), i = O(() => e.searchBoxVisible), l = O(() => i.value ? n.value.filter((c) => c.props.title.includes(o.value)) : n.value.slice());
return ee(a, (s) => {
s || (o.value = "");
}), {
searchTabText: o,
hideDropDown: a,
shouldShowSearchBox: i,
tabsInDropdownMenu: l
};
}
function ko(e, t, n) {
const o = ".farris-tab-page", { tabPages: a } = n;
function i(s) {
const c = t.value;
if (c) {
const r = t.value.querySelectorAll(o);
if (r.length > 0) {
const d = r[s], { offsetTop: f } = d, v = f - 32 > 0 ? f - 32 : 0;
c.scrollTop = v;
}
}
}
function l(s) {
const c = a.value.findIndex((r) => r.props.id === s);
c > -1 && i(c);
}
return { scrollTo: i, scrollToByPaggId: l };
}
const dt = /* @__PURE__ */ ve({
name: "FTabs",
props: pn,
emits: ["tabChange", "tabRemove", "update:activeId", "Click"],
setup(e, t) {
const {
t: n
} = Ue(), o = h(e.tabType), a = yt(), i = h(e.customClass), l = yt(), s = yt(), c = h(), r = kl(e, t, l), {
activeId: d,
changeTitleStyle: f,
tabPages: v,
addTab: p,
updateTab: m,
toolbarItems: g,
checkActiveIdAndSelect: T,
toggleShowTab: M,
hasInHeadClass: S,
toolbarVisible: D
} = r, C = ko(e, s, r), I = Io(e, l, C, r), {
previousButtonClass: w,
nextButtonClass: P,
nextButtonGroupClass: y,
scrollTab: b,
updateNavigationLayout: k,
scrollToSelectedTab: x
} = I;
r.setScrollToSelectedTabFunction(x);
const B = Bo(e, r), F = Fl(e, l, I, C, r), E = F, R = To(e, l, I, C, r), j = /* @__PURE__ */ new Map([["default", F], ["one-page", E], ["pills", R]]);
O(() => {
const ne = v.value.find((se) => se.props.id === d.value);
return ne == null ? void 0 : ne.slots;
});
const V = O(() => e.fill);
mt("tabs", {
activeId: d,
addTab: p,
updateTab: m,
tabPages: v,
tabType: o,
shouldFillParentContaner: V,
toggleShowTab: M,
toolbarVisible: D
});
let $ = !1;
const A = O(() => ({
"farris-tabs-header": !0,
"farris-tabs-inHead": S.value,
"farris-tabs-inContent": !S.value,
"farris-tabs-nav-fill": e.tabType === "fill",
"farris-tabs-nav-pills": e.tabType === "pills"
})), z = O(() => {
const ne = {
width: S.value && e.titleWidth ? `${e.titleWidth}%` : ""
};