@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,599 lines • 592 kB
JavaScript
var ji = Object.defineProperty;
var Li = (e, n, t) => n in e ? ji(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
var q = (e, n, t) => Li(e, typeof n != "symbol" ? n + "" : n, t);
import { ref as C, computed as P, watch as de, nextTick as Pe, reactive as Ct, createVNode as m, withDirectives as fn, resolveDirective as Io, onMounted as je, vModelText as ko, createTextVNode as Ne, Fragment as at, defineComponent as ke, shallowRef as nn, provide as jt, inject as Oe, onUnmounted as kt, isVNode as In, getCurrentInstance as Hi, onBeforeUnmount as kn, withModifiers as Fo, resolveComponent as Ai, createApp as Fn, Transition as Mo, mergeProps as _t, triggerRef as Wi, onBeforeMount as qi, Teleport as Oo, render as Pn, h as zi, cloneVNode as Gi, watchEffect as Yi, vShow as Ui } from "vue";
import { cloneDeep as pt, isPlainObject as uo, isUndefined as gt, throttle as Xi } from "lodash-es";
import { getCustomClass as dt, useGuid as Qi, resolveField as ct, FormSchemaEntityFieldTypeName as co, withInstall as Eo, useCommonUtils as Ki, useDateFormat as Ji, useNumberFormat as Zi, setFieldValue as $n } from "../common/index.esm.js";
import Do from "../capsule/index.esm.js";
import Gn from "../response-toolbar/index.esm.js";
import { createPropsResolver as Po } from "../dynamic-resolver/index.esm.js";
import Bo from "../section/index.esm.js";
import { useDesignerInnerComponent as er, useDesignerComponent as tr } from "../designer-canvas/index.esm.js";
import nr from "../button-edit/index.esm.js";
import Ro from "../list-view/index.esm.js";
import or from "../loading/index.esm.js";
import { useFilter as Vo, useIdentify as $o, useHierarchy as No, useGroupData as jo, useDataView as Lo, useSelection as Ho, useRow as Ao, useEdit as Wo, useVisualDataBound as qo, useVisualDataCell as zo, useVisualDataRow as Go, useVisualGroupRow as ar, useVisualSummaryRow as ir, useVisualData as Yo, useLoading as rr, useSelectHierarchyItem as sr, useDataViewContainerStyle as lr, useCommandColumn as ur, useColumn as cr, useSort as dr, useGroupColumn as fr, useCellPosition as pr, useSidebar as mr, useVirtualScroll as vr, useFitColumn as hr, useFilterHistory as gr, useColumnFilter as yr, useDragColumn as br, getColumnHeader as wr, getSidebar as Cr, getDisableMask as xr, getHorizontalScrollbar as Sr, getVerticalScrollbar as Tr, getEmpty as _r } from "../data-view/index.esm.js";
import { FCheckbox as Mn } from "../checkbox/index.esm.js";
import "../modal/index.esm.js";
import Ir from "../transfer/index.esm.js";
import kr from "../tabs/index.esm.js";
import Fr from "../order/index.esm.js";
import "../condition/index.esm.js";
import Mr from "../filter-bar/index.esm.js";
import fo from "../tooltip/index.esm.js";
import Or from "../pagination/index.esm.js";
import Er from "../button/index.esm.js";
import Dr from "../search-box/index.esm.js";
import Uo from "../tags/index.esm.js";
import Pr, { FDynamicFormGroup as Br, FDynamicFormInput as Rr } from "../dynamic-form/index.esm.js";
import "../property-panel/index.esm.js";
import Vr from "../accordion/index.esm.js";
import $r from "../avatar/index.esm.js";
import Nr from "../../designer/button-edit/index.esm.js";
import jr from "../button-group/index.esm.js";
import Lr from "../calendar/index.esm.js";
import po from "../../designer/checkbox/index.esm.js";
import mo from "../../designer/checkbox-group/index.esm.js";
import Nn from "../combo-list/index.esm.js";
import Hr from "../combo-tree/index.esm.js";
import Ar from "../component/index.esm.js";
import Wr from "../color-picker/index.esm.js";
import qr from "../content-container/index.esm.js";
import zr from "../date-picker/index.esm.js";
import Gr from "../../designer/data-grid/index.esm.js";
import Yr from "../dropdown/index.esm.js";
import Ur from "../events-editor/index.esm.js";
import Xr from "../field-selector/index.esm.js";
import Qr from "../binding-selector/index.esm.js";
import Kr from "../image-cropper/index.esm.js";
import Jr from "../../designer/input-group/index.esm.js";
import Zr from "../layout/index.esm.js";
import es from "../list-nav/index.esm.js";
import ts from "../lookup/index.esm.js";
import ns from "../mapping-editor/index.esm.js";
import os from "../nav/index.esm.js";
import as from "../number-range/index.esm.js";
import is from "../number-spinner/index.esm.js";
import rs from "../page-header/index.esm.js";
import ss from "../page-footer/index.esm.js";
import ls from "../progress/index.esm.js";
import us from "../query-solution/index.esm.js";
import cs from "../../designer/radio-group/index.esm.js";
import ds from "../rate/index.esm.js";
import fs from "../response-layout/index.esm.js";
import ps from "../response-layout-editor/index.esm.js";
import ms from "../smoke-detector/index.esm.js";
import vs from "../splitter/index.esm.js";
import hs from "../step/index.esm.js";
import gs from "../switch/index.esm.js";
import ys from "../text/index.esm.js";
import bs from "../time-picker/index.esm.js";
import ws from "../tree-view/index.esm.js";
import Cs from "../uploader/index.esm.js";
import xs from "../verify-detail/index.esm.js";
import Ss from "../video/index.esm.js";
import Ts from "../textarea/index.esm.js";
import _s from "../schema-selector/index.esm.js";
import Is from "../tree-grid/index.esm.js";
import ks from "../event-parameter/index.esm.js";
import Fs from "../filter-condition-editor/index.esm.js";
import Ms from "../fieldset/index.esm.js";
import Os from "../sort-condition-editor/index.esm.js";
import Es from "../menu-lookup/index.esm.js";
import Ds from "../drawer/index.esm.js";
import Ps from "../json-editor/index.esm.js";
import Bs from "../property-editor/index.esm.js";
import Rs from "../expression-editor/index.esm.js";
import Vs from "../code-editor/index.esm.js";
import $s from "../html-template/index.esm.js";
import "../external-container/index.esm.js";
import { useResizeObserver as Xo } from "@vueuse/core";
import "../notify/index.esm.js";
import Ns from "../popover/index.esm.js";
const js = {
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 }
}, Qo = {}, Ko = {};
function Yn(e) {
const { properties: n, title: t, ignore: o } = e, a = o && Array.isArray(o), i = Object.keys(n).reduce((r, s) => ((!a || !o.find((l) => l === s)) && (r[s] = n[s].type === "object" && n[s].properties ? Yn(n[s]) : pt(n[s].default)), r), {});
if (t && (!a || !o.find((r) => r === "id"))) {
const r = t.toLowerCase().replace(/-/g, "_");
i.id = `${r}_${Math.random().toString().slice(2, 6)}`;
}
return i;
}
function Ls(e) {
const { properties: n, title: t, required: o } = e;
if (o && Array.isArray(o)) {
const a = o.reduce((i, r) => (i[r] = n[r].type === "object" && n[r].properties ? Yn(n[r]) : pt(n[r].default), i), {});
if (t && o.find((i) => i === "id")) {
const i = t.toLowerCase().replace(/-/g, "_");
a.id = `${i}_${Math.random().toString().slice(2, 6)}`;
}
return a;
}
return {
type: t
};
}
function Ht(e, n = {}, t) {
const o = Qo[e];
if (o) {
let a = Ls(o);
const i = Ko[e];
return a = i ? i({ getSchemaByType: Ht }, a, n, t) : a, a;
}
return null;
}
function Hs(e, n) {
const t = Yn(n);
return Object.keys(t).reduce((o, a) => (Object.prototype.hasOwnProperty.call(e, a) && (o[a] && uo(o[a]) && uo(e[a] || !e[a]) ? Object.assign(o[a], e[a] || {}) : o[a] = e[a]), o), t), t;
}
function Jo(e, n) {
return Object.keys(e).filter((o) => e[o] != null).reduce((o, a) => {
if (n.has(a)) {
const i = n.get(a);
if (typeof i == "string")
o[i] = e[a];
else {
const r = i(a, e[a], e);
Object.assign(o, r);
}
} else
o[a] = e[a];
return o;
}, {});
}
function As(e, n, t = /* @__PURE__ */ new Map()) {
const o = Hs(e, n);
return Jo(o, t);
}
function Ws(e = {}) {
function n(c, u, d, v) {
if (typeof d == "number")
return v[c].length === d;
if (typeof d == "object") {
const f = Object.keys(d)[0], p = d[f];
if (f === "not")
return Number(v[c].length) !== Number(p);
if (f === "moreThan")
return Number(v[c].length) >= Number(p);
if (f === "lessThan")
return Number(v[c].length) <= Number(p);
}
return !1;
}
function t(c, u, d, v) {
return v[c] && v[c].propertyValue && String(v[c].propertyValue.value) === String(d);
}
const o = /* @__PURE__ */ new Map([
["length", n],
["getProperty", t]
]);
Object.keys(e).reduce((c, u) => (c.set(u, e[u]), c), o);
function a(c, u) {
const d = c;
return typeof u == "number" ? [{ target: d, operator: "length", param: null, value: Number(u) }] : typeof u == "boolean" ? [{ target: d, operator: "getProperty", param: c, value: !!u }] : typeof u == "object" ? Object.keys(u).map((v) => {
if (v === "length")
return { target: d, operator: "length", param: null, value: u[v] };
const f = v, p = u[v];
return { target: d, operator: "getProperty", param: f, value: p };
}) : [];
}
function i(c) {
return Object.keys(c).reduce((d, v) => {
const f = a(v, c[v]);
return d.push(...f), d;
}, []);
}
function r(c, u) {
if (o.has(c.operator)) {
const d = o.get(c.operator);
return d && d(c.target, c.param, c.value, u) || !1;
}
return !1;
}
function s(c, u) {
return i(c).reduce((f, p) => f && r(p, u), !0);
}
function l(c, u) {
const d = Object.keys(c), v = d.includes("allOf"), f = d.includes("anyOf"), p = v || f, h = (p ? c[p ? v ? "allOf" : "anyOf" : "allOf"] : [c]).map((S) => s(S, u));
return v ? !h.includes(!1) : h.includes(!0);
}
return { parseValueSchema: l };
}
const ce = {
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: "列表导航" },
"filter-bar": { type: "filter-bar", name: "筛选条" }
}, qs = {}, zs = {};
Ws();
function nt(e, n, t = /* @__PURE__ */ new Map(), o = (r, s, l, c) => s, a = {}, i = (r) => r) {
return Qo[n.title] = n, Ko[n.title] = o, qs[n.title] = a, zs[n.title] = i, (r = {}, s = !0) => {
if (!s)
return Jo(r, t);
const l = As(r, n, t), c = Object.keys(e).reduce((u, d) => (u[d] = e[d].default, u), {});
return Object.assign(c, l);
};
}
function Ft(e, n) {
return { customClass: n.class, customStyle: n.style };
}
function Gs() {
function e(n, t) {
const { dataSource: o } = n || {};
return o === void 0 ? {} : {};
}
return {
resolve: e
};
}
function Ys() {
function e(n, t) {
return n.selectItemById(t);
}
return {
selectItemById: e
};
}
function Us(e, n) {
if (!e || e.length < 1)
return null;
for (const t of e) {
if (t.id === n)
return t;
if (t.children) {
const o = t.children.find((a) => a.id === n);
if (o)
return o;
}
}
return null;
}
function Xs() {
function e(n, t) {
const { name: o } = t, [a, i] = t.payloads;
if (o === "tabChange" || o === "tabRemove")
return n[`on${o.charAt(0).toUpperCase()}${o.slice(1)}`];
const r = n.contents;
if (!r || r.length < 1)
return null;
const s = r.reduce((c, u) => {
const d = u.toolbar && u.toolbar.buttons || [];
return c.push(...d), c;
}, []);
if (!s || s.length < 1)
return;
const l = Us(s, i);
return l ? l.onClick || l.click : null;
}
return {
resolve: e
};
}
function Qs() {
function e(n, t) {
const { columns: o } = t;
return n.updateColumns(o);
}
return {
updateColumns: e
};
}
const Un = /* @__PURE__ */ new Map([
["appearance", Ft]
]);
function Ks(e, n) {
const t = Math.random().toString().slice(2, 6), o = n.parentComponentInstance, a = e.getSchemaByType("tab-page");
a.id = `tab-page-${t}`, a.title = "标题", a.toolbar = { id: `tab-page-toolbar-${t}`, buttons: [] };
const i = e.getSchemaByType("tabs");
Object.assign(i, {
id: `tabs-${t}`,
appearance: {
class: "f-component-tabs f-tabs-has-grid"
},
contents: [a],
activeId: a.id
});
const r = e.getSchemaByType("section");
Object.assign(r, {
id: `section-${t}`,
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-${t}`,
appearance: {
class: "f-struct-wrapper"
},
contents: [r]
});
const l = o.schema;
switch (l && l.type) {
case ce["splitter-pane"].type: {
r.appearance.class = "f-section-tabs f-section-in-main", i.appearance.class = "f-component-tabs";
break;
}
}
const c = o.elementRef, u = window.getComputedStyle(c);
return u && u.display === "flex" && (s.appearance.class += " d-block"), s;
}
function Zo(e, n, t) {
if (t.parentComponentInstance)
return Ks(e, t);
{
const a = e.getSchemaByType("tab-page");
return n.contents = [a], n;
}
}
function Js(e, n, t) {
return n;
}
const Zs = "https://json-schema.org/draft/2020-12/schema", el = "https://farris-design.gitee.io/tabs.schema.json", tl = "tabs", nl = "A Farris Container Component", ol = "object", al = {
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: ""
}
}, il = [
"id",
"type",
"contents"
], rl = {
onTabChange: "切换标签页事件",
onTabRemove: "移除标签页事件"
}, ea = {
$schema: Zs,
$id: el,
title: tl,
description: nl,
type: ol,
properties: al,
required: il,
events: rl
}, Xn = {
/** 标签页头部区域的展示类型 */
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 }
}, sl = nt(Xn, ea, Un, Zo), ta = Object.assign({}, Xn, {
componentId: { type: String, default: "" }
}), ll = nt(ta, ea, Un, Zo), ul = Xs();
function cl(e, n, t) {
const o = C([]), a = C(e.activeId || "");
let i = "";
const r = C(!0), s = C([]), l = C(0), c = P(() => {
const F = o.value.find((g) => g.props.id === a.value);
return (F == null ? void 0 : F.props.toolbarPosition) === "inHead";
});
function u(F, T = !0) {
const g = F.findIndex((w) => w.props.show !== !1 && !w.props.disabled);
if (s.value = [], g !== -1) {
if (a.value = F[g].props.id, !T)
return;
const w = F[g];
w && w.props.toolbar && w.props.toolbar.buttons && w.props.toolbar.buttons.length && (s.value = [...w.props.toolbar.buttons]);
}
}
function d(F) {
a.value = F;
const T = o.value.find((g) => g.props.id === F);
s.value = [], T && T.props.toolbar && T.props.toolbar.buttons && T.props.toolbar.buttons.length && (s.value = [...T.props.toolbar.buttons]), n.emit("update:activeId", F), n.emit("tabChange", {
prevId: i,
nextId: a.value
});
}
function v(F) {
let T = -1;
if (!a.value) {
if (T = F.findIndex((g) => a.value === g.props.id && g.props.show !== !1 && !g.props.disabled), T > -1)
return;
i = a.value;
}
u(F, !1), d(a.value);
}
function f(F) {
let T = !1;
if (F) {
const g = o.value.find((w) => w.props.id === F);
T = !g || g.props.show === !1 || g.props.disabled === !0;
}
T ? v(o.value) : (a.value !== F && (i = a.value, a.value = F), d(a.value));
}
de(() => e.activeId, (F, T) => {
F !== T && f(F);
});
function p(F) {
var g;
if (e.autoTitleWidth)
return;
const T = (g = F.value) == null ? void 0 : g.querySelectorAll(".st-tab-text");
if (!(!T || e.tabType === "pill"))
for (let w = 0; w < T.length; w++) {
const I = T[w].parentNode;
T[w].scrollWidth > I.offsetWidth ? T[w].classList.contains("farris-title-text-custom") || T[w].classList.add("farris-title-text-custom") : T[w].classList.remove("farris-title-text-custom");
}
}
const _ = (F) => {
F.preventDefault(), F.stopPropagation();
};
function y(F, T, g = !1) {
const w = o.value.findIndex((I) => I.props.id === T);
o.value = o.value.filter((I) => I.props.id !== T), a.value === T && (i = T, a.value = "", u(o.value)), _(F), Pe(() => {
l.value++, p(t), g && (r.value = !0), n.emit("tabRemove", {
removeIndex: w,
removeId: T,
activeId: a.value
});
});
}
function h(F, T = !0) {
a.value === F && (a.value = "", i = F, f("")), Pe(() => {
l.value++, T && (r.value = !0);
});
}
function x(F) {
a.value !== F && (i = a.value, d(F));
}
function S(F) {
o.value.findIndex((g) => g.props.id === F.props.id) === -1 && o.value.push(F), l.value++;
}
function M(F) {
o.value.findIndex((g) => g.props.id === F.props.id) !== -1 && (o.value.forEach((g) => {
g.props.id === F.props.id && (g = F);
}), F.props.id === a.value && c.value, Pe(() => {
l.value++, p(t);
}));
}
return {
activeId: a,
addTab: S,
changeTitleStyle: p,
removeTab: y,
selectTab: x,
tabPages: o,
updateTab: M,
toolbarItems: s,
needUpdateNavigationLayout: l,
checkActiveIdAndSelect: f,
toggleShowTab: h,
hasInHeadClass: c
};
}
function dl(e, n, t, o, a) {
const {
activeId: i,
removeTab: r,
selectTab: s
} = a, l = P(() => {
const S = {
"st-tab-text": !0,
"text-truncate": e.tabType === "pill" && !e.autoTitleWidth,
"farris-title-auto": e.autoTitleWidth
};
return dt(S, n.customTitleClass);
}), c = P(() => ({
"nav-item": !0,
"d-none": n.show !== void 0 ? !n.show : !1,
"f-state-active": n.id === i.value,
"f-state-disabled": n.disabled
})), u = P(() => ({
width: `${n.tabWidth}px`
})), d = P(() => ({
"nav-link": !0,
"tabs-text-truncate": !0,
active: n.id === i.value,
disabled: n.disabled
})), v = Ct({
content: n.title,
overflowShown: !0
});
function f(S) {
return e.tabType !== "pill" && !e.autoTitleWidth ? fn(m("span", {
class: l.value,
"data-tabid": S.id
}, [S.title]), [[Io("tooltip"), v]]) : m("span", {
class: l.value,
"data-tabid": S.id,
title: S.title
}, [S.title]);
}
function p(S) {
return S.slots.title ? S.slots.title : f;
}
const _ = p(t), y = C(n.removeable);
function h() {
return m("span", {
class: "st-drop-close",
onClick: (S) => r(S, n.id)
}, [m("i", {
class: "f-icon f-icon-close"
}, null)]);
}
function x(S) {
s(n.id), e.tabType === "one-page" && o.scrollToByPaggId(n.id);
}
return m("li", {
class: c.value,
style: u.value
}, [m("a", {
class: d.value,
onClick: x
}, [_(n), y.value && h()])]);
}
function fl(e, n, t, o, a) {
const {
shouldShowNavigationButtons: i
} = t, {
tabPages: r
} = a, s = P(() => ({
spacer: !0,
"f-utils-fill": !0,
"spacer-sides-dropdown": i.value
})), l = P(() => ({
width: "100%",
"justify-content": e.justifyContent
})), c = P(() => ({
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 () => m("div", {
class: s.value,
style: l.value
}, [m("ul", {
class: c.value,
ref: n
}, [r.value.map((u) => dl(e, u.props, u, o, a))])]);
}
function na(e, n, t, o, a) {
const i = C(), {
shouldShowNavigationButtons: r
} = t, {
activeId: s,
tabPages: l,
selectTab: c
} = a, u = C(s.value), d = P(() => l.value.map((_) => ({
name: _.props.title,
value: _.props.id,
show: _.props.show,
disabled: _.props.disabled
}))), v = P(() => ({
spacer: !0,
"f-utils-fill": !0,
"spacer-sides-dropdown": r.value
})), f = P(() => ({
width: "100%",
display: "flex",
"justify-content": e.justifyContent
}));
je(() => {
i.value && (n.value = i.value.$el);
});
function p(_) {
c(_);
}
return de(() => s.value, (_) => {
_ !== u.value && (u.value = _);
}, {
immediate: !0
}), () => m("div", {
class: v.value,
style: f.value
}, [m(Do, {
items: d.value,
modelValue: u.value,
"onUpdate:modelValue": (_) => u.value = _,
onChange: p,
ref: i
}, null)]);
}
function pl(e, n, t, o) {
const a = C(), {
activeId: i,
removeTab: r,
tabPages: s
} = o, {
selectAndScrollToTab: l
} = t, {
hideDropDown: c,
searchTabText: u
} = n, d = 600;
let v = null;
const f = P(() => {
var I, k;
let w = [];
return e.searchBoxVisible ? w = (I = s.value) == null ? void 0 : I.filter((b) => b.props.title.includes(u.value)) : w = (k = s.value) == null ? void 0 : k.slice(), w;
}), p = P(() => ({
"dropdown-menu": !0,
"tabs-pt28": e.searchBoxVisible,
// 未看到样式定义
show: !c.value,
"d-none": c.value
}));
let _;
function y(w) {
_ = w;
}
de(c, (w) => {
if (_.value)
if (w)
a.value.style.width = null;
else {
const I = _.value.querySelector(".farris-tabs-header"), k = _.value.clientHeight - I.clientHeight - 20, E = I.querySelector(".farris-tabs-title").clientWidth - 20;
a.value.style.maxWidth = E + "px", a.value.style.maxHeight = k + "px", Pe(() => {
const {
width: R
} = a.value.getClientRects()[0];
a.value.style.width = R ? R + "px" : null;
});
}
});
function h(w) {
return {
"dropdown-item": !0,
"text-truncate": !0,
"px-2": !0,
disabled: w.props.disabled,
active: w.props.id === i.value,
"d-none": w.props.show !== !0
};
}
function x(w) {
w.preventDefault(), w.stopPropagation();
}
function S() {
v && clearTimeout(v);
}
function M() {
c.value || (v = setTimeout(() => {
c.value = !0;
}, d));
}
function F(w, I) {
w.stopPropagation(), l(w, I), c.value = !0;
}
function T(w, I) {
w.stopPropagation(), r(w, I, !0);
}
function g() {
return m("div", {
ref: a,
class: p.value,
onMouseenter: () => S(),
onMouseleave: () => M()
}, [e.searchBoxVisible && m("div", {
onClick: (w) => x(w),
class: "pb-1 tabs-li-absolute"
}, [fn(m("input", {
type: "text",
class: "form-control",
"onUpdate:modelValue": (w) => u.value = w
}, null), [[ko, u.value]]), m("span", {
class: "f-icon f-icon-page-title-query tabs-icon-search"
}, null)]), f.value.length ? m("ul", {
class: "tab-dropdown-menu--items flex-fill"
}, [f.value.map((w) => m("li", {
class: h(w),
onClick: (I) => F(I, w.props)
}, [w.props.removeable && w.props.disabled !== !0 && m("span", {
class: "float-right st-drop-close",
onClick: (I) => T(I, w.props.id)
}, [m("i", {
class: "f-icon f-icon-close"
}, null)]), m("a", {
class: "dropdown-title",
title: w.props.title
}, [w.props.title])]))]) : m("div", {
class: "dropdown-no-data"
}, [Ne("没有相关数据")])]);
}
return {
renderDropdownMenu: g,
setTabsRef: y
};
}
function ml(e, n, t, o) {
const {
hideDropDown: a
} = n, {
renderDropdownMenu: i,
setTabsRef: r
} = pl(e, n, t, o), s = C(e.showDropdown);
function l() {
return s.value && m(at, null, [m("button", {
class: "btn dropdown-toggle-split dropdown-toggle",
onClick: () => {
a.value = !1;
}
}, null), i()]);
}
return {
renderMorePagesButtton: l,
setTabsRef: r
};
}
function oa(e, n, t, o) {
const a = C(!1), { selectTab: i, tabPages: r, needUpdateNavigationLayout: s, activeId: l } = o, c = 4, u = P(() => ({
btn: !0,
"sc-nav-btn": !0,
"px-1": !0,
"sc-nav-lr": !0,
"d-none": !a.value
})), d = P(() => ({
"btn-group": !0,
"sc-nav-btn": !0,
dropdown: !0,
"d-none": !a.value
})), v = P(() => ({
btn: !0,
"sc-nav-rg": !0,
"d-none": !a.value
}));
function f(h, x) {
if (!n.value)
return;
const S = n.value.scrollLeft, M = n.value.scrollWidth - n.value.offsetWidth;
if (x > 0) {
if (n.value.scrollLeft >= M)
return;
n.value.scrollLeft = S + e.scrollStep + h;
} else if (x < 0) {
if (n.value.scrollLeft <= 0)
return;
n.value.scrollLeft = S - e.scrollStep - h;
}
}
function p(h = -1) {
if (!a.value || !n.value)
return;
h < 0 && (h = r.value.findIndex((T) => T.props.id === l.value));
const x = e.tabType === "pills" ? ".f-capsule-item" : ".nav-item", S = n.value.querySelectorAll(x), { parentElement: M } = n.value, F = S[h];
if (F && M) {
const T = M.getBoundingClientRect().left, g = M.getBoundingClientRect().right, w = F.getBoundingClientRect().left, I = F.getBoundingClientRect().right;
w < T ? f(T - w, -1) : g < I && f(I - g, 1), e.tabType === "one-page" && t.scrollTo(h);
}
}
function _() {
var S;
if (!n.value)
return;
const h = n.value, x = (S = n.value) == null ? void 0 : S.parentElement;
a.value = x && h && x.offsetWidth < h.scrollWidth - c, a.value && Pe(() => {
p();
});
}
function y(h, x) {
x.disabled || (i(x.id), Pe(() => {
p();
}));
}
return de(s, () => {
_();
}), {
previousButtonClass: u,
nextButtonGroupClass: d,
nextButtonClass: v,
scrollTab: f,
selectAndScrollToTab: y,
shouldShowNavigationButtons: a,
updateNavigationLayout: _
};
}
function aa(e, n) {
const { tabPages: t } = n, o = C(""), a = C(!0), i = P(() => e.searchBoxVisible), r = P(() => i.value ? t.value.filter((l) => l.props.title.includes(o.value)) : t.value.slice());
return de(a, (s) => {
s || (o.value = "");
}), {
searchTabText: o,
hideDropDown: a,
shouldShowSearchBox: i,
tabsInDropdownMenu: r
};
}
function ia(e, n, t) {
const o = ".farris-tab-page", { tabPages: a } = t;
function i(s) {
const l = n.value;
if (l) {
const c = n.value.querySelectorAll(o);
if (c.length > 0) {
const u = c[s], { offsetTop: d } = u, v = d - 32 > 0 ? d - 32 : 0;
l.scrollTop = v;
}
}
}
function r(s) {
const l = a.value.findIndex((c) => c.props.id === s);
l > -1 && i(l);
}
return { scrollTo: i, scrollToByPaggId: r };
}
const Qt = /* @__PURE__ */ ke({
name: "FTabs",
props: Xn,
emits: ["tabChange", "tabRemove", "update:activeId", "Click"],
setup(e, n) {
const t = C(e.tabType), o = nn(), a = C(e.customClass), i = nn(), r = nn(), s = C(), l = cl(e, n, i), {
activeId: c,
changeTitleStyle: u,
tabPages: d,
addTab: v,
updateTab: f,
toolbarItems: p,
checkActiveIdAndSelect: _,
toggleShowTab: y,
hasInHeadClass: h
} = l, x = ia(e, r, l), S = oa(e, i, x, l), {
previousButtonClass: M,
nextButtonClass: F,
nextButtonGroupClass: T,
scrollTab: g,
updateNavigationLayout: w
} = S, I = aa(e, l), k = fl(e, i, S, x, l), b = k, E = na(e, i, S, x, l), R = /* @__PURE__ */ new Map([["default", k], ["one-page", b], ["pills", E]]);
P(() => {
const U = d.value.find((le) => le.props.id === c.value);
return U == null ? void 0 : U.slots;
});
const O = P(() => e.fill);
jt("tabs", {
activeId: c,
addTab: v,
updateTab: f,
tabPages: d,
tabType: t,
shouldFillParentContaner: O,
toggleShowTab: y
});
let D = !1;
const V = P(() => ({
"farris-tabs-header": !0,
"farris-tabs-inHead": h.value,
"farris-tabs-inContent": !h.value,
"farris-tabs-nav-fill": e.tabType === "fill",
"farris-tabs-nav-pills": e.tabType === "pills"
})), H = P(() => {
const U = {
width: h.value && e.titleWidth ? `${e.titleWidth}%` : ""
};
return U.width && (U.flex = "unset"), U;
}), B = P(() => {
const U = {
"farris-tabs": !0,
"f-utils-fill-flex-column": O.value,
"flex-column": e.position === "top",
"flex-column-reverse": e.position === "bottom",
"flex-row": e.position === "left",
"flex-row-reverse": e.position === "right",
"one-page": e.tabType === "one-page"
};
return a.value && a.value.split(" ").reduce((le, we) => (le[we] = !0, le), U), U;
}), L = new ResizeObserver((U) => {
U.length && w();
});
function Q() {
s.value && !D && (L.observe(s.value), D = !0);
}
de(() => e.visible, (U) => {
Pe(() => {
d.value.length && _(e.activeId || d.value[0].props.id), w(), u(i), Q();
});
}), de(() => e.autoTitleWidth, (U) => {
Pe(() => {
w(), u(i);
});
}), je(() => {
e.visible && (d.value.length && _(e.activeId || d.value[0].props.id), Pe(() => {
w(), u(i);
}), Q());
});
function $() {
return m("button", {
title: "向左",
type: "button",
class: M.value,
onClick: () => {
g(0, -1);
}
}, null);
}
function j() {
return m("button", {
title: "向右",
type: "button",
class: F.value,
onClick: () => {
g(0, 1);
}
}, null);
}
const {
renderMorePagesButtton: Z,
setTabsRef: Y
} = ml(e, I, S, l);
Y(o);
const W = (U, le) => {
n.emit("Click", U, le, c.value);
};
function K() {
return p.value.length ? m("div", {
class: "farris-tabs-toolbar"
}, [m(Gn, {
class: "f-utils-fill",
alignment: h.value ? "right" : "left",
items: p.value,
onClick: W
}, null)]) : null;
}
const ee = R.get(e.tabType) || R.get("default");
function A() {
var U, le, we, Fe;
return m("div", {
class: V.value
}, [m("div", {
class: "farris-tabs-header-pre"
}, [(le = (U = n.slots).headerPrefix) == null ? void 0 : le.call(U)]), m("div", {
class: "farris-tabs-title scroll-tabs",
style: H.value,
ref: s
}, [$(), ee && ee(), m("div", {
class: T.value
}, [j(), Z()])]), K(), m("div", {
class: "farris-tabs-header-post"
}, [(Fe = (we = n.slots).headerSuffix) == null ? void 0 : Fe.call(we)])]);
}
const N = P(() => ({
"farris-tabs-content": !0,
"f-utils-fill-flex-column": O.value
}));
function G() {
var U, le;
return m("div", {
class: N.value,
ref: r
}, [(le = (U = n.slots).default) == null ? void 0 : le.call(U)]);
}
return () => e.visible ? m("div", {
class: B.value,
ref: o
}, [A(), G()]) : null;
}
});
function vl(e, n, t) {
return n && n.contents && n.contents.length && (n.contents.forEach((o) => {
o.title && (o.text = o.title);
}), n.buttons = n.contents, delete n.contents), { toolbar: n };
}
const hl = /* @__PURE__ */ new Map([
["appearance", Ft],
["toolbar", vl]
]), gl = "https://json-schema.org/draft/2020-12/schema", yl = "https://farris-design.gitee.io/tab-page.schema.json", bl = "tab-page", wl = "A Farris Container Component", Cl = "object", xl = {
id: {
description: "The unique identifier for a tab-page Item",
type: "string"
},
type: {
description: "The type string of tab-page Item component",
type: "string",
default: "tab-page"
},
contents: {
description: "",
type: "array",
default: []
},
title: {
description: "",
type: "string",
default: "标题"
},
disabled: {
description: "",
type: "boolean",
default: !1
},
removeable: {
description: "",
type: "boolean",
default: !1
},
show: {
description: "",
type: "boolean",
default: !0
},
toolbar: {
description: "",
type: "object"
},
tabWidth: {
description: "",
type: "number"
},
toolbarPosition: {
description: "",
type: "string",
default: "inHead"
},
customTitleClass: {
description: "",
type: "string",
default: ""
},
onTabChange: {
description: "",
type: "切换标签页事件",
default: ""
},
onTabRemove: {
description: "",
type: "string",
default: "移除标签页事件"
}
}, Sl = [
"id",
"type",
"contents"
], Tl = {
$schema: gl,
$id: yl,
title: bl,
description: wl,
type: Cl,
properties: xl,
required: Sl
}, Qn = {
tabWidth: { type: Number },
id: { type: String, default: "" },
customTitleClass: { type: String, default: "" },
// 暂未被用到
titleOverflow: { type: Boolean, default: !1 },
title: { type: String, default: "" },
// 暂未被用到
selected: { type: Boolean, default: !1 },
disabled: { type: Boolean, default: !1 },
removeable: { type: Boolean, default: !1 },
show: { type: Boolean, default: !0 },
toolbar: { type: Object, default: {} },
toolbarPosition: { type: String, default: "inHead" }
}, ra = Po(Qn, Tl, hl);
function _l(e) {
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !In(e);
}
const gn = /* @__PURE__ */ ke({
name: "FTabPage",
props: Qn,
emits: [],
setup(e, n) {
const t = Oe("tabs"), o = C(e.show), a = {
slots: n.slots,
props: e
}, i = C((t == null ? void 0 : t.tabType.value) || "default");
je(() => {
const f = t == null ? void 0 : t.tabPages.value.findIndex((p) => p.props.id === e.id);
(!f || f === -1) && (t == null || t.addTab(a));
}), kt(() => {
});
const r = P(() => (e == null ? void 0 : e.id) === (t == null ? void 0 : t.activeId.value)), s = P(() => ({
display: r.value ? "" : "none"
}));
de(() => e, (f) => {
t == null || t.updateTab({
props: f,
slots: n.slots
});
}, {
immediate: !0,
deep: !0
}), de(() => e.show, (f) => {
t == null || t.toggleShowTab(e.id);
});
function l() {
var p, _;
const f = (_ = (p = n.slots).default) == null ? void 0 : _.call(p);
return m(Bo, {
"main-title": e.title,
class: ["farris-tab-page", o.value ? "" : "f-tab-d-none"]
}, _l(f) ? f : {
default: () => [f]
});
}
const c = P(() => {
var p;
return {
"farris-tab-page": !0,
"f-tab-d-none": !o.value,
"f-utils-fill-flex-column": r.value && t && ((p = t.shouldFillParentContaner) == null ? void 0 : p.value)
};
});
function u() {
var p, _;
const f = (_ = (p = n.slots).default) == null ? void 0 : _.call(p);
return m("div", {
class: c.value,
style: s.value
}, [f]);
}
const v = (/* @__PURE__ */ new Map([["default", u], ["one-page", l]])).get(i.value) || u;
return () => v();
}
});
function Il(e, n, t, o, a, i) {
const {
activeId: r,
selectTab: s,
removeDesignTab: l,
selectDesignTab: c,
addTabPageToolbar: u,
resetPositionForSelectedElement: d
} = a, v = P(() => ({
"st-tab-text": !0,
"farris-title-auto": e.autoTitleWidth
})), f = P(() => {
const E = {
"farris-component": !0,
"nav-item": !0,
"f-state-active": n.id === r.value
};
return E[`${n.id}-design-item`] = !0, E;
}), p = P(() => {
const E = {};
return n.tabWidth && n.tabWidth > 0 && (E.width = `${n.tabWidth}px`), E;
}), _ = P(() => ({
"nav-link": !0,
"tabs-text-truncate": !0,
active: n.id === r.value
}));
function y(E) {
return m("span", {
class: v.value,
title: E.title
}, [E.title]);
}
function h(E) {
return E.slots.title ? E.slots.title : y;
}
const x = h(t), S = C(n.removeable);
function M() {
return m("span", {
class: "st-drop-close",
style: {
opacity: 0.6
}
}, [m("i", {
class: "f-icon f-icon-close"
}, null)]);
}
function F(E) {
s(n.id), e.tabType === "one-page" && o.scrollToByPaggId(n.id);
}
function T(E) {
E && (E.stopPropagation(), E.preventDefault()), c(E, n.id, i.value);
}
function g(E) {
l(E, n.id);
}
function w(E) {
u(E, n.id);
}
de(() => n.toolbarPosition, () => {
Pe(() => {
d(null);
});
}), de(() => n.tabWidth, () => {
Pe(() => {
d(null);
});
});
function I() {
return m("div", {
role: "button",
class: "btn component-settings-button",
title: "删除",
ref: "removeComponent",
onClick: (E) => g(E)
}, [m("i", {
class: "f-icon f-icon-yxs_delete"
}, null)]);
}
function k() {
return m("div", {
role: "button",
class: "btn component-settings-button",
title: "新增按钮",
ref: "addComponent",
onClick: (E) => w(E)
}, [m("i", {
class: "f-icon f-icon-plus-circle"
}, null)]);
}
function b() {
return m("div", {
class: "component-btn-group",
"data-noattach": "true"
}, [m("div", null, [I(), !n.toolbar || !n.toolbar.buttons || !n.toolbar.buttons.length ? k() : ""])]);
}
return m("li", {
onClick: (E) => T(E),
class: f.value,
style: p.value,
pageId: `${n.id}-design-item`
}, [b(), m("a", {
class: _.value,
onClick: F,
id: `${n.id}-design-item`
}, [x(n), S.value && M()])]);
}
function kl(e, n, t, o, a, i, r) {
const {
tabPages: s,
selectTab: l,
emitSelectionChange: c
} = a, u = P(() => ({
spacer: !0,
"f-utils-fill": !0
})), d = P(() => ({
width: "100%",
"justify-content": e.justifyContent
})), v = P(() => ({
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"
})), f = P(() => ({
overflow: "auto"
})), p = function(_) {
var h;
_ && (_.stopPropagation(), _.preventDefault());
const y = Ht("tab-page");
y.id = `tab_page_${Math.random().toString().slice(2, 6)}`, y.title = "标题", y.toolbar = {
id: `${y.id}_toolbar`,
buttons: []
}, (h = i.value.schema.contents) == null || h.push(y), l(y.id), Pe(() => {
c(y.id, i.value);
});
};
return () => m("div", {
class: u.value,
style: d.value
}, [m("ul", {
class: v.value,
style: f.value,
ref: n
}, [s.value.map((_) => Il(e, _.props, _, o, a, i)), m("li", {
class: "nav-item no-drag"
}, [m("a", {
class: "nav-link tabs-text-truncate",
title: "添加页签",
onClick: (_) => p(_)
}, [m("i", {
class: "f-icon f-icon-plus",
style: "font-size: 20px;margin: 0 auto;line-height: 24px;"
}, null)])])])]);
}
function Zt(e, n, t) {
var g;
const o = t && t.getStyles && t.getStyles() || "", a = t && t.getDesignerClass && t.getDesignerClass() || "", i = C();
function r() {
return (n == null ? void 0 : n.schema.componentType) === "frame" ? !1 : t && t.checkCanMoveComponent ? t.checkCanMoveComponent() : !0;
}
function s() {
return !1;
}
function l() {
return (n == null ? void 0 : n.schema.componentType) === "frame" ? !1 : t && t.checkCanDeleteComponent ? t.checkCanDeleteComponent() : !0;
}
function c() {
return (n == null ? void 0 : n.schema.componentType) === "frame" ? !0 : t && t.hideNestedPaddingInDesginerView ? t.hideNestedPaddingInDesginerView() : !1;
}
function u(w) {
if (!w || !w.value)
return null;
if (w.value.schema && w.value.schema.type === "component")
return w.value;
const I = C(w == null ? void 0 : w.value.parent), k = u(I);
return k || null;
}
function d(w = n) {
var E;
if (t != null && t.getDraggableDesignItemElement)
return t.getDraggableDesignItemElement(w);
const { componentInstance: I, designerItemElementRef: k } = w;
if (!I || !I.value)
return null;
const { getCustomButtons: b } = I.value;
return I.value.canMove || b && ((E = b()) != null && E.length) ? k : d(w.parent);
}
function v(w) {
return !!t && t.canAccepts(w);
}
function f() {
return (n == null ? void 0 : n.schema.label) || (n == null ? void 0 : n.schema.title) || (n == null ? void 0 : n.schema.name);
}
function p() {
}
function _(w, I) {
var k;
!w || !I || (t != null && t.onAcceptMovedChildElement && t.onAcceptMovedChildElement(w, I), (k = n == null ? void 0 : n.setupContext) == null || k.emit("dragEnd"));
}
function y(w, I) {
const { componentType: k } = w;
let b = Ht(k, w, I);
t && t.onResolveNewComponentSchema && (b = t.onResolveNewComponentSchema(w, b));
const E = k.toLowerCase().replace(/-/g, "_");
return b && !b.id && b.type === k && (b.id = `${E}_${Math.random().toString().slice(2, 6)}`), b;
}
function h(w) {
w && t != null && t.onChildElementMovedOut && t.onChildElementMovedOut(w);
}
function x(...w) {
if (t && t.getPropsConfig)
return t.getPropsConfig(...w);
}
function S(w) {
if (!w)
return;
const I = n == null ? void 0 : n.schema, { formSchemaUtils: k } = w;
if (I && k.getExpressions().length) {
const b = k.getExpressions().findIndex((E) => E.target === I.id);
b > -1 && k.getExpressions().splice(b, 1);
}
}
function M(w) {
t && t.onRemoveComponent && t.onRemoveComponent(), S(w), n != null && n.schema.contents && n.schema.contents.map((I) => {
let k = I.id;
I.type === "component-ref" && (k = I.component);
const b = e.value.querySelectorAll(`#${k}-design-item`);
b != null && b.length && Array.from(b).map((E) => {
var R;
(R = E == null ? void 0 : E.componentInstance) != null && R.value.onRemoveComponent && E.componentInstance.value.onRemoveComponent(w);
});
});
}
function F() {
if (t && t.getCustomButtons)
return t.getCustomButtons();
}
function T(w) {
if (t && t.onPropertyChanged)
return t.onPropertyChanged(w);
}
return i.value = {
canMove: r(),
canSelectParent: s(),
canDelete: l(),
canNested: !c(),
contents: n == null ? void 0 : n.schema.contents,
elementRef: e,
parent: (g = n == null ? void 0 : n.parent) == null ? void 0 : g.componentInstance,
schema: n == null ? void 0 : n.schema,
styles: o,
designerClass: a,
canAccepts: v,
getBelongedComponentInstance: u,
getDraggableDesignItemElement: d,
getDraggingDisplayText: f,
getPropConfig: x,
getDragScopeElement: p,
onAcceptMovedChildElement: _,
onChildElementMovedOut: h,
addNewChildComponentSchema: y,
triggerBelongedComponentToMoveWhenMoved: !!t && t.triggerBelongedComponentToMoveWhenMoved || C(!1),
triggerBelongedComponentToDeleteWhenDeleted: !!t && t.triggerBelongedComponentToDeleteWhenDeleted || C(!1),
onRemoveComponent: M,
getCustomButtons: F,
onPropertyChanged: T
}, i;
}
class sa {
getTemplateRule(n, t) {
const o = t == null ? void 0 : t.formSchemaUtils, a = o == null ? void 0 : o.getFormTemplateRule(), i = { canAccept: !0, canDelete: !0, canMove: !0 };
if (!a)
return i;
const r = this.getComponentContext(n), { componentClassList: s } = r;
return s.forEach((l) => {
if (!l || !a[l])
return;
const { canMove: c, canDelete: u, canAccept: d } = a[l];
i.canMove = i.canMove && this.resolveRuleValue(c, r), i.canDelete = i.canDelete && this.resolveRuleValue(u, r), i.canAccept = i.canAccept && this.resolveRuleValue(d, r);
}), i;
}
resolveRuleValue(n, t) {
return typeof n == "boolean" ? n : this.parseRuleValueSchema(n, t);
}
parseRuleValueSchema(n, t) {
const o = n.invalidContext || [];
let a = !0;
for (const i of o) {
if (i.firstLevelChild) {
if (i.firstLevelChild.class) {
const { firstLevelChildClassList: r } = t;
if (r && !r.includes(i.firstLevelChild.class)) {
a = !1;
continue;
}
}
if (i.firstLevelChild.type) {
const { firstLevelChildSchema: r } = t;
if (!r || r.type !== i.firstLevelChild.type) {
a = !1;
continue;
}
}
}
if (i.secondLevelChild) {
if (i.secondLevelChild.class) {
const { secondLevelChildClassList: r } = t;
if (r && !r.includes(i.secondLevelChild.class)) {
a = !1;
continue;
}
}
if (i.secondLevelChild.type) {
const { secondLevelChildSchema: r } = t;
if (!r || r.type !== i.secondLevelChild.type) {
a = !1;
continue;
}
}
}
if (i.parent) {
if (i.parent.class) {
const { parentClassList: r } = t;
if (r && !r.includes(i.parent.class)) {
a = !1;
continue;
}
}
if (i.parent.type) {
const { parentSchema: r } = t;
if (r && r.type !== i.parent.type) {
a = !1;
continue;
}
}
}
a = !0;
break;
}
return !a;
}
getComponentContext(n) {
var _, y, h, x;
const t = n.schema, o = t.appearance && t.appearance.class || "", a = o.split(" ") || [], i = t.contents || [], r = i.length ? i[0] : null, s = r && r.appearance ? r.appearance.class : "", l = s ? s.split(" ") : [], c = (_ = r == null ? void 0 : r.contents) != null && _.length ? r == null ? void 0 : r.contents[0] : null, u = c && c.appearance ? c.appearance.class : "", d = u ? u.split(" ") : [], v = t.type === "component" ? (h = (y = n.parent) == null ? void 0 : y.parent) == null ? void 0 : h.schema : (x = n.parent) == null ? void 0 : x.schema, f = v && v.appearance && v.appearance.class || "", p = f ? f.split(" ") : [];
return {
componentClass: o,
componentClassList: a,
childContents: i,
firstLevelChildSchema: r,
firstLevelChildClass: s,
firstLevelChildClassList: l,
secondLevelChildSchema: c,
seco