@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,844 lines • 179 kB
JavaScript
var qt = Object.defineProperty;
var Yt = (e, t, a) => t in e ? qt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
var ie = (e, t, a) => Yt(e, typeof t != "symbol" ? t + "" : t, a);
import { ref as c, computed as T, watch as A, nextTick as ne, reactive as rt, createVNode as n, withDirectives as Ne, resolveDirective as Xt, onMounted as ee, vModelText as dt, Fragment as Q, defineComponent as Y, shallowRef as Re, provide as Ue, inject as ae, onUnmounted as Se, isVNode as ft, resolveComponent as Kt, withModifiers as Jt, createTextVNode as K, watchEffect as vt, createApp as Ae, Transition as mt, mergeProps as Pe, Teleport as pt, onBeforeMount as Zt, render as _e, h as Qt, cloneVNode as en, vShow as tn, onUpdated as nn, onBeforeUnmount as an } from "vue";
import { FNotifyService as ln } from "../notify/index.esm.js";
import { getCustomClass as De, isMobilePhone as we, getCustomStyle as at, withInstall as on, getMaxZIndex as lt, useGuid as sn } from "../common/index.esm.js";
import un from "../capsule/index.esm.js";
import { LocaleService as Z } from "../locale/index.esm.js";
import cn from "../response-toolbar/index.esm.js";
import "bignumber.js";
import { cloneDeep as rn, debounce as gt } from "lodash-es";
import ot from "../section/index.esm.js";
import "../property-panel/index.esm.js";
import dn from "../button-edit/index.esm.js";
import { resolveAppearance as ht, createPropsResolver as Xe } from "../dynamic-resolver/index.esm.js";
import fn from "../list-view/index.esm.js";
import vn from "../loading/index.esm.js";
import { useDesignerComponent as yt } from "../designer-canvas/index.esm.js";
import { useFilter as mn, useIdentify as pn, useHierarchy as gn, useGroupData as hn, useDataView as yn, useSelection as bn, usePagination as wn, useRow as Cn, useEdit as Sn, useVisualDataBound as xn, useVisualDataCell as In, useVisualDataRow as Tn, useVisualGroupRow as Bn, useVisualSummaryRow as kn, useVisualData as Fn, useSidebar as Mn, useColumn as On, useVirtualScroll as Pn, useScreen as Vn } from "../data-view/index.esm.js";
import bt, { FCheckbox as Ke } from "../checkbox/index.esm.js";
import wt from "../popover/index.esm.js";
import "../button/index.esm.js";
import "../field-selector/index.esm.js";
import "../collection-property-editor/index.esm.js/src/use-button-items.designer";
import Rn from "../tags/index.esm.js";
import { useInputExpand as Ln } from "../common/index.esm.js/text-box/use-input-expand";
import Hn from "../drawer/index.esm.js";
const En = {
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 }
}, Dn = {
/**
* 标签页显示样式
* @default 'default'
*/
tabType: { type: String, default: "default" },
/**
* 是否自动调整标题宽度,为true,则标题显示全部字符;为false,标题最多显示 20 个字符
* @default false
*/
autoTitleWidth: { type: Boolean, default: !1 },
/**
* 标题宽度
* @default 7
*/
titleLength: { type: Number, default: 7 },
/**
* 显示页签的位置
* @default 'top'
*/
position: { type: String, default: "top" },
showDropdown: { type: Boolean, default: !0 },
/**
* 通过滚动鼠标切换页签的步长,默认是 10px
* @default 10
*/
scrollStep: { type: Number, default: 10 },
/**
* 是否允许自动调整页签高度
* @default false
*/
autoResize: { type: Boolean, default: !1 },
/**
* 组件宽度
*/
width: { type: Number },
/**
* 组件高度
*/
height: { type: Number },
/**
* 是否显示页签搜索框
* @default true
*/
searchBoxVisible: { type: Boolean, default: !0 },
/**
* 标题宽度
*/
titleWidth: { type: Number, default: 0 },
/**
* 标签自定义样式
*/
customClass: { type: String, default: "" },
/**
* 指定选中的页签(值为页签标识)
*/
activeId: { type: String },
/**
* 是否启用填充占满外层容器,默认false不填充
* @default false
*/
fill: { type: Boolean, default: !1 },
/**
* left 左对齐,center 居中对齐,right 右对齐,默认左对齐
* @default left
*/
justifyContent: { type: String, default: "left" },
/**
* 标签页是否可见
* @default true
*/
visible: { type: Boolean, default: !0 },
showHeader: { type: Boolean, default: !0 },
/**
* 标签页选中前事件
*/
beforeTabSelect: { type: Function, default: null }
};
function jn(e, t, a) {
const u = new ln(), l = c([]), o = c(e.activeId || "");
let i = "";
const s = c(!0), d = c([]), f = c(!0), r = c(0), p = T(() => {
const b = l.value.find((P) => P.props.id === o.value);
return (b == null ? void 0 : b.props.toolbarPosition) === "inHead";
});
let x;
function S(b) {
x = b;
}
function y(b, I = !0) {
const P = b.findIndex((j) => j.props.show !== !1 && !j.props.disabled);
if (P !== -1) {
if (o.value = b[P].props.id, !I)
return;
d.value = [];
const j = b[P];
j && j.props.toolbar && j.props.toolbar.buttons && j.props.toolbar.buttons.length && (d.value = [...j.props.toolbar.buttons], f.value = j.props.toolbarVisible);
}
}
function v(b) {
o.value = b;
const I = l.value.find((P) => P.props.id === b);
d.value = [], I && I.props.toolbar && I.props.toolbar.buttons && I.props.toolbar.buttons.length && (d.value = [...I.props.toolbar.buttons], f.value = I.props.toolbarVisible), t.emit("update:activeId", b), t.emit("tabChange", {
prevId: i,
nextId: o.value
});
}
async function w(b, I, P, j) {
var R;
const W = await ((R = e.beforeTabSelect) == null ? void 0 : R.call(e, {
prevId: b,
nextId: I
}));
(typeof W == "boolean" ? W : (W == null ? void 0 : W.canSelect) ?? !0) ? P && P() : (j && j(), typeof W != "boolean" && W.message && (u == null || u.warning({ message: W.message, position: "top-center" })));
}
function B(b) {
let I = -1;
if (!o.value) {
if (I = b.findIndex((P) => o.value === P.props.id && P.props.show !== !1 && !P.props.disabled), I > -1)
return;
i = o.value;
}
y(b, !1), w(i, o.value, () => {
v(o.value), x && x();
}, () => {
o.value = i;
});
}
function C(b) {
let I = !1;
if (b) {
const P = l.value.find((j) => j.props.id === b);
I = !P || P.props.show === !1 || P.props.disabled === !0;
}
if (I)
B(l.value);
else if (o.value !== b) {
const P = o.value;
w(P, b, () => {
i = P, o.value = b, v(o.value), x && x();
}, () => {
o.value = P, t.emit("update:activeId", P);
});
} else
v(o.value);
}
A(() => e.activeId, (b, I) => {
b !== I && e.activeId !== o.value && C(b);
});
function L(b) {
var P;
if (e.autoTitleWidth)
return;
const I = (P = b.value) == null ? void 0 : P.querySelectorAll(".st-tab-text");
if (!(!I || e.tabType === "pill"))
for (let j = 0; j < I.length; j++) {
const W = I[j].parentNode;
I[j].scrollWidth > W.offsetWidth ? I[j].classList.contains("farris-title-text-custom") || I[j].classList.add("farris-title-text-custom") : I[j].classList.remove("farris-title-text-custom");
}
}
const k = (b) => {
b.preventDefault(), b.stopPropagation();
};
function H(b, I, P = !1) {
const j = l.value.findIndex((W) => W.props.id === I);
l.value = l.value.filter((W) => W.props.id !== I), o.value === I && (i = I, o.value = "", y(l.value)), k(b), ne(() => {
r.value++, L(a), P && (s.value = !0), t.emit("tabRemove", {
removeIndex: j,
removeId: I,
activeId: o.value
});
});
}
function V(b, I = !0) {
const P = l.value.find((j) => j.props.id === b);
P && (P.props.show === !1 && o.value === b ? (o.value = "", i = b, C("")) : P.props.show === !0 && !o.value && B(l.value), ne(() => {
r.value++, I && (s.value = !0);
}));
}
function F(b) {
o.value !== b && w(i, b, () => {
i = o.value, v(b), x && x();
}, null);
}
function m(b) {
l.value.findIndex((P) => P.props.id === b.props.id) === -1 && l.value.push(b), r.value++;
}
function g(b) {
l.value.findIndex((P) => P.props.id === b.props.id) !== -1 && (l.value.forEach((P) => {
P.props.id === b.props.id && (P = b);
}), b.props.id === o.value && p.value, ne(() => {
r.value++, L(a);
}));
}
return {
activeId: o,
addTab: m,
changeTitleStyle: L,
removeTab: H,
selectTab: F,
tabPages: l,
updateTab: g,
toolbarItems: d,
needUpdateNavigationLayout: r,
checkActiveIdAndSelect: C,
toggleShowTab: V,
hasInHeadClass: p,
setScrollToSelectedTabFunction: S,
toolbarVisible: f
};
}
function Nn(e, t, a, u, l) {
const {
activeId: o,
removeTab: i,
selectTab: s
} = l, d = T(() => {
const C = {
"st-tab-text": !0,
"text-truncate": e.tabType === "pill" && !e.autoTitleWidth,
"farris-title-auto": e.autoTitleWidth
};
return De(C, t.customTitleClass);
}), f = T(() => ({
"nav-item": !0,
"d-none": t.show !== void 0 ? !t.show : !1,
"f-state-active": t.id === o.value,
"f-state-disabled": t.disabled
})), r = T(() => ({
width: `${t.tabWidth}px`
})), p = T(() => ({
"nav-link": !0,
"tabs-text-truncate": !0,
active: t.id === o.value,
disabled: t.disabled
})), x = rt({
content: t.title,
overflowShown: !0
});
function S() {
return e.tabType !== "pill" && !e.autoTitleWidth ? Ne(n("span", {
class: d.value,
"data-tabid": t.id
}, [t.title]), [[Xt("tooltip"), x]]) : n("span", {
class: d.value,
"data-tabid": t.id,
title: t.title
}, [t.title]);
}
const y = c(t.removeable);
function v() {
return y.value ? n("span", {
class: "st-drop-close",
onClick: (C) => i(C, t.id)
}, [n("i", {
class: "f-icon f-icon-close"
}, null)]) : "";
}
function w(C) {
s(t.id), e.tabType === "one-page" && u.scrollToByPaggId(t.id);
}
function B() {
return a.slots.title ? n("a", {
class: p.value,
onClick: w,
id: `${t.id}-tab-title`
}, [a.slots.title(a), v()]) : t.titleRenderFunction ? n("a", {
class: p.value,
onClick: w,
id: `${t.id}-tab-title`
}, [t.titleRenderFunction(), v()]) : n("a", {
class: p.value,
onClick: w,
id: `${t.id}-tab-title`
}, [S(), v()]);
}
return n("li", {
class: f.value,
style: r.value
}, [B()]);
}
function An(e, t, a, u, l) {
const {
shouldShowNavigationButtons: o
} = a, {
tabPages: i
} = l, s = T(() => ({
spacer: !0,
"f-utils-fill": !0,
"spacer-sides-dropdown": o.value
})), d = T(() => ({
width: "100%",
"justify-content": e.justifyContent
})), f = T(() => ({
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 () => n("div", {
class: s.value,
style: d.value
}, [n("ul", {
class: f.value,
ref: t
}, [i.value.map((r) => Nn(e, r.props, r, u, l))])]);
}
function zn(e, t, a, u, l) {
const o = c(), {
shouldShowNavigationButtons: i
} = a, {
activeId: s,
tabPages: d,
selectTab: f
} = l, r = c(s.value), p = T(() => d.value.map((v) => ({
name: v.props.title,
value: v.props.id,
show: v.props.show,
disabled: v.props.disabled
}))), x = T(() => ({
spacer: !0,
"f-utils-fill": !0,
"spacer-sides-dropdown": i.value
})), S = T(() => ({
width: "100%",
display: "flex",
"justify-content": e.justifyContent
}));
ee(() => {
o.value && (t.value = o.value.$el);
});
function y(v) {
f(v);
}
return A(() => s.value, (v) => {
v !== r.value && (r.value = v);
}, {
immediate: !0
}), () => n("div", {
class: x.value,
style: S.value
}, [n(un, {
items: p.value,
modelValue: r.value,
"onUpdate:modelValue": (v) => r.value = v,
onChange: y,
ref: o
}, null)]);
}
function $n(e, t, a, u) {
const l = c(), {
activeId: o,
removeTab: i,
tabPages: s,
selectTab: d
} = u, {
hideDropDown: f,
searchTabText: r
} = t, p = 600;
let x = null;
const S = T(() => {
var b, I;
let g = [];
return e.searchBoxVisible ? g = (b = s.value) == null ? void 0 : b.filter((P) => P.props.title.includes(r.value)) : g = (I = s.value) == null ? void 0 : I.slice(), g;
}), y = T(() => ({
"dropdown-menu": !0,
"tabs-pt28": e.searchBoxVisible,
// 未看到样式定义
show: !f.value,
"d-none": f.value
}));
let v;
function w(g) {
v = g;
}
A(f, (g) => {
if (v.value)
if (g)
l.value.style.width = null;
else {
const b = v.value.querySelector(".farris-tabs-header"), I = v.value.clientHeight - b.clientHeight - 20, j = b.querySelector(".farris-tabs-title").clientWidth - 20;
l.value.style.maxWidth = j + "px", l.value.style.maxHeight = I + "px", ne(() => {
const {
width: W
} = l.value.getClientRects()[0];
l.value.style.width = W ? W + "px" : null;
});
}
});
function B(g) {
return {
"dropdown-item": !0,
"text-truncate": !0,
"px-2": !0,
disabled: g.props.disabled,
active: g.props.id === o.value,
"d-none": g.props.show !== !0
};
}
function C(g) {
g.preventDefault(), g.stopPropagation();
}
function L() {
x && clearTimeout(x);
}
function k() {
f.value || (x = setTimeout(() => {
f.value = !0;
}, p));
}
function H(g, b) {
g.stopPropagation(), b.disabled || d(b.id), f.value = !0;
}
function V(g, b) {
g.stopPropagation(), i(g, b, !0);
}
function F(g) {
return g.slots.title ? n("a", {
class: "dropdown-title",
id: `${g.props.id}-dropdown-item`
}, [g.slots.title(g)]) : g.props.titleRenderFunction ? n("a", {
class: "dropdown-title",
id: `${g.props.id}-dropdown-item`
}, [g.props.titleRenderFunction()]) : n("a", {
class: "dropdown-title",
id: `${g.props.id}-dropdown-item`
}, [g.props.title]);
}
function m() {
return n("div", {
ref: l,
class: y.value,
onMouseenter: () => L(),
onMouseleave: () => k()
}, [e.searchBoxVisible && n("div", {
onClick: (g) => C(g),
class: "pb-1 tabs-li-absolute"
}, [Ne(n("input", {
type: "text",
class: "form-control",
"onUpdate:modelValue": (g) => r.value = g
}, null), [[dt, r.value]]), n("span", {
class: "f-icon f-icon-page-title-query tabs-icon-search"
}, null)]), S.value.length ? n("ul", {
class: "tab-dropdown-menu--items flex-fill"
}, [S.value.map((g) => n("li", {
class: B(g),
onClick: (b) => H(b, g.props)
}, [g.props.removeable && g.props.disabled !== !0 && n("span", {
class: "float-right st-drop-close",
onClick: (b) => V(b, g.props.id)
}, [n("i", {
class: "f-icon f-icon-close"
}, null)]), F(g)]))]) : n("div", {
class: "dropdown-no-data"
}, [Z.getLocaleValue("tabs.noData")])]);
}
return {
renderDropdownMenu: m,
setTabsRef: w
};
}
function Wn(e, t, a, u) {
const {
hideDropDown: l
} = t, {
renderDropdownMenu: o,
setTabsRef: i
} = $n(e, t, a, u), s = c(e.showDropdown);
function d() {
return s.value && n(Q, null, [n("button", {
class: "btn dropdown-toggle-split dropdown-toggle",
onClick: () => {
l.value = !1;
}
}, null), o()]);
}
return {
renderMorePagesButtton: d,
setTabsRef: i
};
}
function _n(e, t, a, u) {
const l = c(!1), { selectTab: o, tabPages: i, needUpdateNavigationLayout: s, activeId: d } = u, f = 4, r = T(() => ({
btn: !0,
"sc-nav-btn": !0,
"px-1": !0,
"sc-nav-lr": !0,
"d-none": !l.value
})), p = T(() => ({
"btn-group": !0,
"sc-nav-btn": !0,
dropdown: !0,
"d-none": !l.value
})), x = T(() => ({
btn: !0,
"sc-nav-rg": !0,
"d-none": !l.value
}));
function S(C, L) {
if (!t.value)
return;
const k = t.value.scrollLeft, H = t.value.scrollWidth - t.value.offsetWidth;
if (L > 0) {
if (t.value.scrollLeft >= H)
return;
t.value.scrollLeft = k + e.scrollStep + C;
} else if (L < 0) {
if (t.value.scrollLeft <= 0)
return;
t.value.scrollLeft = k - e.scrollStep - C;
}
}
function y(C = -1) {
if (!l.value || !t.value)
return;
C < 0 && (C = i.value.findIndex((F) => F.props.id === d.value));
const L = e.tabType === "pills" ? ".f-capsule-item" : ".nav-item", k = t.value.querySelectorAll(L), { parentElement: H } = t.value, V = k[C];
if (V && H) {
const F = H.getBoundingClientRect().left, m = H.getBoundingClientRect().right, g = V.getBoundingClientRect().left, b = V.getBoundingClientRect().right;
g < F ? S(F - g, -1) : m < b && S(b - m, 1), e.tabType === "one-page" && a.scrollTo(C);
}
}
function v() {
var k;
if (!t.value)
return;
const C = t.value, L = (k = t.value) == null ? void 0 : k.parentElement;
l.value = L && C && L.offsetWidth < C.scrollWidth - f, l.value && ne(() => {
y();
});
}
function w(C) {
C.disabled || o(C.id);
}
function B() {
["default", "one-page"].indexOf(e.tabType) > -1 && ne(() => {
y();
});
}
return A(s, () => {
v();
}), {
previousButtonClass: r,
nextButtonGroupClass: p,
nextButtonClass: x,
scrollTab: S,
selectAndScrollToTab: w,
shouldShowNavigationButtons: l,
updateNavigationLayout: v,
scrollToSelectedTab: B
};
}
function Gn(e, t) {
const { tabPages: a } = t, u = c(""), l = c(!0), o = T(() => e.searchBoxVisible), i = T(() => o.value ? a.value.filter((d) => d.props.title.includes(u.value)) : a.value.slice());
return A(l, (s) => {
s || (u.value = "");
}), {
searchTabText: u,
hideDropDown: l,
shouldShowSearchBox: o,
tabsInDropdownMenu: i
};
}
function Un(e, t, a) {
const u = ".farris-tab-page", { tabPages: l } = a;
let o = -1;
function i() {
if (o < 0) {
const f = document.querySelector(".farris-tabs-header");
f && (o = f.clientHeight);
}
return o;
}
function s(f) {
const r = t.value;
if (r) {
const p = t.value.querySelectorAll(u);
if (p.length > 0) {
const x = p[f], { offsetTop: S } = x, y = S - i();
r.scrollTop = y > 0 ? y : 0;
}
}
}
function d(f) {
const r = l.value.findIndex((p) => p.props.id === f);
r > -1 && s(r);
}
return { scrollTo: s, scrollToByPaggId: d };
}
const qn = ["moz", "ms", "webkit"];
function Yn() {
let e = 0;
return (t) => {
const a = (/* @__PURE__ */ new Date()).getTime(), u = Math.max(0, 16 - (a - e)), l = setTimeout(() => {
t(a + u);
}, u);
return e = a + u, l;
};
}
function Xn() {
if (typeof window > "u")
return () => 0;
if (window.requestAnimationFrame)
return window.requestAnimationFrame.bind(window);
const e = qn.filter((t) => `${t}RequestAnimationFrame` in window)[0];
return e ? window[`${e}RequestAnimationFrame`] : Yn();
}
Xn();
c("");
function Je() {
if (typeof window > "u" || typeof navigator > "u")
return !1;
const e = navigator.userAgent || navigator.vendor || window.opera, t = [
/iPhone/i,
/iPod/i,
/Android.*Mobile/i,
// Android 手机通常包含 "Mobile" 字样,而平板不包含
/webOS/i,
/BlackBerry/i,
/IEMobile/i,
/Opera Mini/i,
/Harmony/i
], a = [
/iPad/i,
/Android(?!.*Mobile)/i,
// Android 平板通常不含 "Mobile"
/Tablet/i,
/PlayBook/i,
/Kindle/i,
/Silk/i
];
for (const d of a)
if (d.test(e))
return !1;
for (const d of t)
if (d.test(e))
return !0;
if (typeof screen > "u")
return !1;
const u = "ontouchstart" in window || navigator.maxTouchPoints > 0, l = screen.width, o = screen.height, i = Math.min(l, o);
return !!(u && i <= 768);
}
function Kn() {
const e = Je();
return e && document.body.classList.add("f-mobile"), e;
}
typeof document < "u" && Kn();
const Le = /* @__PURE__ */ Y({
name: "FTabs",
props: Dn,
emits: ["tabChange", "tabRemove", "update:activeId", "Click"],
setup(e, t) {
const a = c(e.tabType), u = Re(), l = Je(), o = c(e.customClass), i = Re();
Re();
const s = c(), d = jn(e, t, i), {
activeId: f,
changeTitleStyle: r,
tabPages: p,
addTab: x,
updateTab: S,
toolbarItems: y,
checkActiveIdAndSelect: v,
toggleShowTab: w,
hasInHeadClass: B,
toolbarVisible: C
} = d, L = Un(e, u, d), k = _n(e, i, L, d), {
previousButtonClass: H,
nextButtonClass: V,
nextButtonGroupClass: F,
scrollTab: m,
updateNavigationLayout: g,
scrollToSelectedTab: b
} = k;
d.setScrollToSelectedTabFunction(b);
const I = Gn(e, d), P = An(e, i, k, L, d), j = P, W = zn(e, i, k, L, d), E = /* @__PURE__ */ new Map([["default", P], ["one-page", j], ["pills", W]]);
T(() => {
const G = p.value.find((te) => te.props.id === f.value);
return G == null ? void 0 : G.slots;
});
const R = T(() => e.fill), N = (G, te) => {
t.emit("Click", G, te, f.value);
};
Ue("tabs", {
activeId: f,
addTab: x,
updateTab: S,
tabPages: p,
tabType: a,
shouldFillParentContaner: R,
toggleShowTab: w,
toolbarVisible: C,
clickToolbarItemHandler: N
});
let h = !1;
const O = T(() => ({
"farris-tabs-header": !0,
"farris-tabs-inHead": B.value,
"farris-tabs-inContent": !B.value,
"farris-tabs-nav-fill": e.tabType === "fill",
"farris-tabs-nav-pills": e.tabType === "pills",
"d-none": e.showHeader === !1
})), D = T(() => {
const G = {
width: B.value && e.titleWidth ? `${e.titleWidth}%` : ""
};
return G.width && (G.flex = "unset"), G;
}), $ = T(() => {
const G = {
"farris-tabs": !0,
"f-tabs-content-fill": R.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 o.value && o.value.split(" ").reduce((te, se) => (te[se] = !0, te), G), G;
}), U = new ResizeObserver((G) => {
G.length && g();
});
function re() {
s.value && !h && (U.observe(s.value), h = !0);
}
A(() => e.visible, (G) => {
ne(() => {
p.value.length && v(e.activeId || p.value[0].props.id), g(), r(i), re();
});
}), A(() => e.autoTitleWidth, (G) => {
ne(() => {
g(), r(i);
});
}), ee(() => {
e.visible && (p.value.length && v(e.activeId || p.value[0].props.id), ne(() => {
g(), r(i);
}), re());
});
function oe() {
return n("button", {
title: Z.getLocaleValue("tabs.leftButton"),
type: "button",
class: H.value,
onClick: () => {
m(0, -1);
}
}, null);
}
function xe() {
return n("button", {
title: Z.getLocaleValue("tabs.rightButton"),
type: "button",
class: V.value,
onClick: () => {
m(0, 1);
}
}, null);
}
const {
renderMorePagesButtton: he,
setTabsRef: Ie
} = Wn(e, I, k, d);
Ie(u);
function Te() {
return y.value.length ? n("div", {
class: {
"farris-tabs-toolbar": !0,
"d-none": !C.value
}
}, [n(cn, {
class: "f-utils-fill",
alignment: B.value ? "right" : "left",
items: y.value,
visible: C.value,
onClick: N
}, null)]) : null;
}
const de = E.get(e.tabType) || E.get("default");
function Be() {
var G, te, se, Fe;
return n("div", {
class: O.value
}, [n("div", {
class: "farris-tabs-header-pre"
}, [(te = (G = t.slots).headerPrefix) == null ? void 0 : te.call(G)]), n("div", {
class: "farris-tabs-title scroll-tabs",
style: D.value,
ref: s
}, [!l && oe(), de && de(), n("div", {
hidden: l,
class: F.value
}, [xe(), he()])]), Te(), n("div", {
class: "farris-tabs-header-post"
}, [(Fe = (se = t.slots).headerSuffix) == null ? void 0 : Fe.call(se)])]);
}
T(() => ({
"farris-tabs-content": !0,
"f-utils-fill-flex-column": R.value
}));
function ke() {
var G, te;
return (
// <div class={tabsContentClass.value} ref={tabContentElementRef}>
(te = (G = t.slots).default) == null ? void 0 : te.call(G)
);
}
return () => e.visible ? n("div", {
class: $.value,
ref: u
}, [Be(), ke()]) : null;
}
}), Jn = {
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" },
// 工具栏是否可见
toolbarVisible: { type: Boolean, default: !0 },
/** 标题 */
titleRenderFunction: { type: Function }
};
function st(e) {
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !ft(e);
}
const qe = /* @__PURE__ */ Y({
name: "FTabPage",
props: Jn,
emits: [],
setup(e, t) {
const a = ae("tabs");
we();
const u = c(e.show), l = {
slots: t.slots,
props: e
}, o = c((a == null ? void 0 : a.tabType.value) || "default");
ee(() => {
const v = a == null ? void 0 : a.tabPages.value.findIndex((w) => w.props.id === e.id);
(!v || v === -1) && (a == null || a.addTab(l));
}), Se(() => {
});
const i = T(() => (e == null ? void 0 : e.id) === (a == null ? void 0 : a.activeId.value)), s = T(() => ({
display: i.value ? "" : "none"
}));
A(() => e, (v) => {
a == null || a.updateTab({
props: v,
slots: t.slots
});
}, {
immediate: !0,
deep: !0
}), A(() => e.show, (v) => {
u.value = v, a == null || a.toggleShowTab(e.id);
}), A(() => e.toolbarVisible, (v) => {
i.value && a && (a.toolbarVisible.value = v);
});
function d() {
var w, B;
const v = (B = (w = t.slots).default) == null ? void 0 : B.call(w);
return n(ot, {
"main-title": e.title,
class: ["farris-tab-page", u.value ? "" : "f-tab-d-none"]
}, st(v) ? v : {
default: () => [v]
});
}
function f(v, w) {
a && (a.activeId.value = e.id, a.clickToolbarItemHandler && a.clickToolbarItemHandler(v, w));
}
function r() {
var w, B;
const v = (B = (w = t.slots).default) == null ? void 0 : B.call(w);
return n(ot, {
customClass: "section-in-tab is-mobile",
onClick: f,
visible: e.show,
"main-title": e.title,
buttons: e.toolbar.buttons,
"button-position": e.toolbar.position || e.toolbarPosition,
"buttons-visible": e.toolbarVisible
}, st(v) ? v : {
default: () => [v]
});
}
const p = T(() => {
var w;
return {
"farris-tab-page": !0,
"f-tab-d-none": !u.value,
"f-tab-active": i.value && a && ((w = a.shouldFillParentContaner) == null ? void 0 : w.value)
};
});
function x() {
var w, B;
const v = (B = (w = t.slots).default) == null ? void 0 : B.call(w);
return n("div", {
class: p.value,
style: s.value
}, [v]);
}
const y = (/* @__PURE__ */ new Map([["default", x], ["one-page", d], ["mobile", r]])).get(o.value) || x;
return () => y();
}
});
Le.install = (e) => {
e.component(Le.name, Le), e.component(qe.name, qe);
};
const Zn = /* @__PURE__ */ new Map([
["appearance", ht]
]), Qn = "https://json-schema.org/draft/2020-12/schema", ea = "https://farris-design.gitee.io/search-box.schema.json", ta = "search-box", na = "A Farris Component", aa = "object", la = {
id: {
description: "The unique identifier for a search-box",
type: "string"
},
type: {
description: "The type string of search-box component",
type: "string",
default: "search-box"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string"
},
style: {
type: "string"
}
},
default: {}
},
binding: {
description: "",
type: "object",
default: {}
},
disable: {
type: "string",
default: !1
},
editable: {
description: "",
type: "boolean",
default: !0
},
placeholder: {
description: "",
type: "string",
default: ""
},
readonly: {
description: "",
type: "boolean",
default: !1
},
require: {
description: "",
type: "boolean",
default: !1
},
tabindex: {
description: "",
type: "number",
default: -1
},
visible: {
description: "",
type: "boolean",
default: !0
}
}, oa = [
"id",
"type"
], sa = {
$schema: Qn,
$id: ea,
title: ta,
description: na,
type: aa,
properties: la,
required: oa
};
function ia(e, t, a) {
return t;
}
const ua = "search-box", ca = "A Farris Component", ra = "object", da = {
basic: {
description: "Basic Infomation",
title: "基本信息",
properties: {
id: {
description: "组件标识",
title: "标识",
type: "string",
readonly: !0
},
type: {
description: "组件类型",
title: "控件类型",
type: "select",
editor: {
type: "waiting for modification",
enum: []
}
}
}
}
}, fa = {
title: ua,
description: ca,
type: ra,
categories: da
}, Ze = {
/**
* 自定义图标
*/
buttonContent: { type: String, default: '<i class="f-icon f-icon-search"></i>' },
/**
* 指定自定义的样式
* @default ''
*/
customClass: { type: String, default: "" },
/**
* 绑定搜索框的文本
* @default ''
*/
modelValue: { type: String, default: "" },
/**
* 搜索下拉面板面板代码插入的位置,默认是在 body 里,可以指定放置到其他元素
*/
popupHost: { type: Object },
/** */
popupRightBoundary: { type: Object },
popupOffsetX: { type: Object },
/**
* 搜索下拉面板绑定的列表数据
*/
data: { type: Array, default: [] },
/**
* 搜索框的占位文本
* @default '请输入关键词'
*/
placeholder: { type: String, default: "请输入关键词" },
/**
* 指定绑定的列表数据中的标识字段
* @default id
*/
idField: { default: "id", type: String },
/**
* 指定绑定的列表数据中的名称字段
* @default name
*/
textField: { default: "name", type: String },
/**
* 指定搜索下拉面板的最大高度
* @default 350
*/
maxHeight: { default: 350, type: Number },
/**
* 是否处于加载状态,加载状态下不能输入,不可点击搜索按钮,下拉面板中显示正在加载的图标
* @default false
*/
loading: { default: !1, type: Boolean },
/**
* 是否处于禁用状态,禁用状态下,不能输入文本,不显示清空按钮,搜索图标正常显示
* @default false
*/
disable: { default: !1, type: Boolean },
/**
* 是否展示搜索结果面板
*/
showDropdown: { default: !0, type: Boolean },
/**
* popupOnFoucs TODO
*/
/**
* 值变化事件触发时机
*/
updateOn: { default: "change", type: String }
}, Ct = Xe(Ze, sa, Zn, ia, fa), va = {
data: { type: Array, default: [] },
/** 确认结果事件 */
onConfirmResult: { type: Function, default: () => {
} },
/** 搜索点击后返回值 */
onSearchedValue: { type: Function, default: () => {
} },
/**
* 可选,数据源id字段
* 默认为`id`
*/
idField: { default: "id", type: String },
/**
* 可选,数据源的title
* 默认为`name`
*/
textField: { default: "name", type: String },
/**
* 可选,最大高度
* 默认`350`
*/
maxHeight: { default: 350, type: Number },
loading: { default: !1, type: Boolean }
}, St = /* @__PURE__ */ Y({
name: "FSearchBoxContainer",
props: va,
emits: ["confirmResult", "searchedValue"],
setup(e, t) {
const a = c(e.data), u = c(), {
slots: l
} = t, o = T(() => ({
"search-box-container": !0,
"f-utils-overflow-xhya": !0,
"position-relative": !0
}));
function i(r) {
var p;
(p = u.value) == null || p.search(r);
}
function s(r) {
r.length && (t.emit("confirmResult", r[0][e.textField]), t.emit("searchedValue", r));
}
function d(r) {
return l.default ? n(Q, null, [l.default(r)]) : n("span", null, [r.item[e.textField]]);
}
const f = T(() => {
const r = {};
return r.padding = "8px", e.maxHeight !== void 0 && e.maxHeight > 0 && (r.maxHeight = `${e.maxHeight}px`), r;
});
return A(() => e.loading, (r) => {
}), A(() => e.data, (r) => {
r !== a.value && (a.value = r), u.value.updateDataSource(r);
}), t.expose({
search: i
}), () => {
const r = {
content: d
};
return n("div", {
class: o.value,
style: f.value
}, [n(vn, {
ref: "loadingInstance",
isActive: e.loading
}, null), n(fn, {
ref: u,
itemClass: "dropdown-item",
data: a.value,
view: "ContentView",
onClickItem: (p) => s(p.data),
idField: e.idField,
textField: e.textField,
titleField: e.textField,
valueField: e.idField
}, r)]);
};
}
}), ue = /* @__PURE__ */ Y({
name: "FSearchBox",
props: Ze,
emits: ["update:modelValue", "change", "selectedValue", "clickButton"],
setup(e, t) {
c(e.data);
const a = c(), u = c(), l = c(e.placeholder), o = '<i class="f-icon f-icon-clockwise f-icon-spin"></i>', i = T(() => e.loading ? o : e.buttonContent);
c(e.editable);
const s = c(e.modelValue);
A(s, (v) => {
var w;
(w = u.value) == null || w.search(v), t.emit("update:modelValue", v);
}), A(() => e.modelValue, (v) => {
s.value = v;
});
function d(v) {
a.value.commitValue(v);
}
function f(v) {
const w = s.value;
t.emit("change", v, {
oldValue: w,
newValue: v
});
}
function r(v) {
t.emit("selectedValue", v);
}
function p(v) {
t.emit("clickButton", v);
}
function x() {
var v;
(v = a.value) == null || v.togglePopup();
}
function S() {
var v;
(v = a.value) == null || v.hidePopup();
}
function y() {
var v;
(v = a.value) == null || v.showPopup();
}
return t.expose({
togglePopup: x,
hidePopup: S,
showPopup: y
}), () => {
const v = {
default: t.slots.default
};
return n(dn, {
ref: a,
"button-content": i.value,
"custom-class": e.customClass,
updateOn: e.updateOn,
placeholder: l.value,
onChange: (w) => f(w),
onClickButton: (w) => p(w),
disable: e.disable,
"enable-clear": !0,
"button-behavior": "Execute",
modelValue: s.value,
"onUpdate:modelValue": (w) => s.value = w,
"popup-host": e.popupHost,
"popup-right-boundary": e.popupRightBoundary,
"popup-offset-x": e.popupOffsetX,
"popup-on-input": e.showDropdown,
"popup-on-focus": e.showDropdown,
limitContentBySpace: !0,
placement: "auto"
}, {
default: () => [e.showDropdown && n(St, {
ref: u,
data: e.data,
idField: e.idField,
textField: e.textField,
onConfirmResult: d,
onSearchedValue: (w) => r(w),
loading: e.loading,
maxHeight: e.maxHeight
}, v)],
...t.slots
});
};
}
}), ma = /* @__PURE__ */ Y({
name: "FSearchBoxDesign",
props: Ze,
emits: ["update:modelValue", "change"],
setup(e, t) {
const a = c(e.data), u = c(), l = c(), o = c("请输入关键词"), i = c('<i class="f-icon f-icon-search"></i>'), s = c(e.modelValue), d = c(), f = ae("design-item-context"), r = yt(d, f);
ee(() => {
d.value.componentInstance = r;
}), t.expose(r.value), A(s, (S) => {
var y;
(y = l.value) == null || y.search(S), t.emit("update:modelValue", S);
}), A(() => e.modelValue, (S) => {
s.value = S;
});
function p(S) {
u.value.commitValue(S);
}
function x(S) {
t.emit("change", S);
}
return () => n("div", {
ref: d
}, [n(Kt("f-button-edit"), {
ref: u,
"button-content": i.value,
placeholder: o.value,
onChange: x,
"enable-clear": !0,
"button-behavior": "Execute",
modelValue: s.value,
"onUpdate:modelValue": (S) => s.value = S,
"popup-host": e.popupHost,
"popup-right-boundary": e.popupRightBoundary,
"popup-offset-x": e.popupOffsetX,
"popup-on-input": !0,
"popup-on-focus": !0
}, {
default: () => [n(St, {
ref: l,
data: a.value,
onConfirmResult: p
}, null)]
})]);
}
});
ue.install = (e) => {
e.component(ue.name, ue);
};
ue.register = (e, t, a, u) => {
e["search-box"] = ue, t["search-box"] = Ct;
};
ue.registerDesigner = (e, t, a) => {
e["search-box"] = ma, t["search-box"] = Ct;
};
const xt = {
/**
* 列集合
*/
columns: {
type: Array,
default: [
{ field: "name", title: "", dataType: "string" }
]
},
customClass: { type: String, default: "" },
/**
* 列表数组数据
* @default []
*/
data: { type: Array, default: [] },
/**
* 是否可拖拽
* @default false
*/
draggable: { type: Boolean, default: !1 },
/**
* 是否支持多选
* @default false
*/
multiSelect: { type: Boolean, default: !1 },
// multiSelectMode: { type: String as PropType<MultiSelectMode>, default: 'OnCheck' },
/**
* 定义列表的唯一标识字段
* @default 'id'
*/
idField: { type: String, default: "id" },
/**
* 值字段
* @default 'id'
*/
valueField: { type: String, default: "id" },
/**
* 文本字段
* @default 'name'
*/
textField: { type: String, default: "name" },
/**
* 标题字段
* @default 'name'
*/
titleField: { type: String, default: "name" },
/**
* 视图
* @default 'ContentView'
*/
view: { type: String, default: "ContentView" },
/**
* 尺寸
* @default 'default'
*/
size: { type: String, default: "default" },
/**
* 占位符
* @default ''
*/
placeholder: { type: String, default: "" },
/**
* 列表头
* @default 'ContentHeader'
*/
header: { type: String, default: "ContentHeader" },
/**
* 列表头类
* @default ''
*/
headerClass: { type: String, default: "" },
/**
* 项目类
* @default ''
*/
itemClass: {
type: [String, Function],
default: "",
validator: (e) => typeof e == "string" || typeof e == "function"
},
itemStyle: {
type: [String, Function],
default: "",
validator: (e) => typeof e == "string" || typeof e == "function"
},
itemContentClass: { type: String, default: "" },
/**
* 已选列
* @default []
*/
selectionValues: { type: Array, default: [] },
/**
* 分组配置
*/
group: { type: Object },
/**
* 选择配置
*/
selection: {
type: Object,
default: {
enableSelectRow: !0,
multiSelect: !1,
multiSelectMode: "DependOnCheck",
showCheckbox: !1,
showSelectAll: !1,
showSelection: !0
}
},
/**
* 是否保持排序
* @default false
*/
keepOrder: { type: Boolean, default: !1 },
/**
* 不可操作字段
* @default 'disabled'
*/
disableField: { type: String, default: "disabled" },
// 搜索启用高亮
enableHighlightSearch: { type: Boolean, default: !0 },
/**
* 虚拟化渲染数据
*/
virtualized: { type: Boolean, default: !0 },
/**
* 删除数据前的检查方法,返回值为true时可以删除当前数据
*/
checkBeforeRemoveItem: { type: Function, default: null },
/**
* 头部模板
*/
headerTemplate: { type: Object },
/**
* 内容模板
*/
contentTemplate: { type: Object },
/**
* 底部模板
*/
footerTemplate: { type: Object },
/**
* 空数据模板
*/
emptyTemplate: { type: Object },
/**
* 分页
*/
pagination: { type: Object, default: { enable: !1, size: 20 } },
/**
* 定义属性,开启时,当多选开启时,展示选中项的背景色等样式;不开启时,不展示选中项的背景色等样式
*/
showActiveWhenMultiSelect: { type: Boolean, default: !0 },
/**
* 允许删除
*/
allowDelete: { type: Boolean, default: !0 }
};
function pa(e, t) {
function a(o) {
const i = [];
let s = o.nextNode();
for (; s; )
i.push(s), s = o.nextNode();
return i;
}
function u(o, i) {
const s = document.createTreeWalker(o, NodeFilter.SHOW_TEXT);
return a(s).map((p) => ({ textNode: p, text: (p.textContent || "").toLocaleLowerCase() })).map(({ textNode: p, text: x }) => {
const S = [];
let y = 0;
for (; y < x.length; ) {
const v = x.indexOf(i, y);
if (v === -1)
break;
S.push(v), y = v + i.length;
}
return S.map((v) => {
const w = new Range();
return w.setStart(p, v), w.setEnd(p, v + i.length), w;
});
}).flat();
}
function l(o) {
if (!CSS.highlights || (CSS.highlights.clear(), !o || !t))
return;
const i = u(t.value, o.toLocaleLowerCase()), s = new Highlight(...i);
CSS.highlights.set("search-result", s);
}
return { search: l };
}
function it(e, t, a, u, l, o, i, s, d, f) {
const r = c(e.size), p = c(e.textField), x = c(e.titleField), S = c(e.disableField), y = T(() => {
var g, b;
return ((g = e.selection) == null ? void 0 : g.multiSelect) && ((b = e.selection) == null ? void 0 : b.showCheckbox);
}), {
onMouseenterItem: v,
onMouseoverItem: w,
onMouseoutItem: B
} = o, {
getKey: C,
listViewItemClass: L,
listViewItemStyle: k,
onCheckItem: H,
onClickItem: V
} = i, F = T(() => {
const g = {
"text-overflow": "ellipsis",
overflow: "hidden",
"white-space": "nowrap"
};
return e.itemClass ? g : {
margin: r.value === "small" ? "0.25rem 0" : "8px 0",
...g
};
});
function m(g, b, I) {
return g.checked = s.findIndexInSelectedItems(g) > -1, n("li", {
class: L(g, b),
id: C(g, b),
key: C(g, b),
style: k(g, b),
onClick: (P) => V(g, b, P),
onMouseenter: (P) => v(P, g, b),
onMouseover: (P) => w(P, g, b),
onMouseout: (P) => B(P, g, b)
}, [y.value && n("div", {
class: "f-list-select",
onClick: (P) => P.stopPropagation()
}, [n(Ke, {
id: "list-" + C(g, b),
customClass: "listview-checkbox float-left",
disabled: g[S.value],
checked: g.checked,
"onUpdate:checked": (P) => g.checked = P,
onChange: (P) => {
H(g, b, !P.checked);
}
}, null)]), n("div", {
class: "f-list-content"
}, [n("div", {
class: e.itemContentClass,
style: F.value,
title: g.raw[x.value] || g.raw[p.value]
}, [g.raw[p.value]])])]);
}
return {
renderItem: m
};
}
function ga(e, t, a, u, l, o, i, s, d, f) {
const r = c(e.multiSelect), p = c(e.disableField), x = c(e.textField), {
onMouseenterItem: S,
onMouseoverItem: y,
onMouseoutItem: v
} = o, {
getKey: w,
listViewItemClass: B,
listViewItemStyle: C,
onCheckItem: L,
onClickItem: k,
updateSelectedItems: H
} = i;
function V(m, g, b) {
return e.contentTemplate ? n(Q, null, [e.contentTemplate({
item: m.raw,
index: g,
selectedItem: b
})]) : t.slots.content ? n(Q, null, [t.slots.content && t.slots.content({
item: m.raw,
index: g,
selectedItem: b
})]) : n("div", {
style: "margin: 10px 0;"
}, [m.raw[x.value || "name"]]);
}
function F(m, g, b) {
return n("li", {
class: B(m, g),
id: w(m, g),
key: w(m, g),
style: C(m, g),
onClick: (I) => k(m, g, I),
onMouseenter: (I) => S(I, m, g),
onMouseover: (I) => y(I, m, g),
onMouseout: (I) => v(I, m, g)
}, [r.value && n("div", {
class: "f-list-select",
onClick: (I) => I.stopPropagation()
}, [n(Ke, {
id: "list-" + w(m, g),
customClass: "listview-checkbox",
disabled: m[p.value],
checked: m.checked,
"onUpdate:checked": (I) => m.checked = I,
onChange: (I) => {
L(m, g, !I.checked), H();
}
}, null)]), n("div", {
class: "f-list-content"
}, [V(m, g, b)])]);
}
return {
renderItem: F
};
}
function ha(e, t, a, u, l, o, i, s, d, f) {
const r = c(e.multiSelect), p = c(e.disableField), x = c(e.textField), {
onMouseenterItem: S,
onMouseoverItem: y,
onMouseoutItem: v
} = o, {
getKey: w,
listViewItemClass: B,
onCheckItem: C,
onClickItem: L
} = i, {
dragstart: k,
dragenter: H,
dragover: V,
dragend: F
} = u, {
removeItem: m
} = d, g = T(() => ({
margin: r.value ? "10px 0" : "10px 0px 10px 14px"
}));
function b(E, R = "") {
const N = E.target;
N.title = N.scrollWidth > N.clientWidth ? R : "";
}
function I(E) {
return n("div", {
style: g.value,
onMouseenter: (R) => b(R, E.raw[x.value || "name"])
}, [E.raw[x.value || "name"]]);
}
function P() {
return t.slots.itemContent ? t.slots.itemContent : I;
}
const j = P();
function W(E, R, N) {
return n("li", {
class: B(E, R),
id: w(E, R),
key: w(E, R),
onClick: (h) => L(E, R, h),
onMouseenter: (h) => S(h, E, R),
onMouseover: (h) => y(h, E, R),
onMouseout: (h) => v(h, E, R),
draggable: "true",
onDragstart: (h) => k(h, E, R),
onDragenter: (h) => H(h, R),
onDragend: (h) => F(h, E),
onDragover: (h) => V(h)
}, [r.value && n("div", {
class: "f-list-select",
onClick: (h) => h.stopPropagation()
}, [n(Ke, {
id: "list-" + w(E, R),
customClass: "listview-checkbox",
disabled: E[p.value],
checked: E.checked,
"onUpdate:checked": (h) => E.checked = h,
onChange: (h) => C(E, R, !h.checked)
}, null)]), n("div", {
class: "f-list-content"
}, [j(E)]), e.allowDelete && n("div", {
class: "f-list-remove",
onClick: (h) => {
h.stopPropagation(), m(R);
}
}, [n("div", {
class: "f-list-remove-icon"
}, [n("i", {
class: "f-icon f-icon-remove_face"
}, null)])]), n("div", {
class: "f-list-handle"
}, [n("div", null, [n("i", {
class: "f-icon f-icon-drag-vertical"
}, null)])])]);
}
return {
renderItem: W
};
}
function ya(e, t, a, u, l, o, i, s, d, f) {
var w;
const r = c(((w = e.group) == null ? void 0 : w.groupFields) || []), {
collpaseGroupIconClass: p
} = l, {
toggleGroupRow: x
} = f;
function S(B, C) {
B.stopPropagation(), C.collapse = !C.collapse, a.value = x(C.collapse ? "collapse" : "expand", C, a.value);
}
function y(B, C, L) {
return t.slots.group ? n(Q, null, [t.slots.content && t.slots.group({
item: B.raw,
index: C,
selectedItem: L
})]) : n("div", {
class: "f-navlookup-recentHeader",
onClick: (k) => S(k, B)
}, [n("div", {
class: "fv-grid-group-row-icon"
}, [n("span", {
class: p(B)
}, null)]), n("div", {
class: "f-navlookup-recommandLabel"
}, [B.raw[r.value[B.layer]]])]);
}
function v(B, C, L) {
return B.layer > -1 && y(B, C, L);
}
return {
renderItem: v
};
}
function ba(e, t, a, u) {
const { dataView: l } = a, { updateSelectedItems: o } = u;
function i(s) {
if (s > -1 && s < l.value.length) {
if (e != null && e.checkBeforeRemoveItem && !e.checkBeforeRemoveItem(l.value[s]))
return;
const d = l.value.splice(s, 1);
o(), t.emit("removeItem", d[0]);
}
}
return { removeItem: i };
}
function wa(e, t, a, u, l, o, i, s, d, f) {
const r = c(e.view), p = c(e.view === "CardView"), x = c({}), S = ba(e, t, u, d), y = T(() => ({
"f-list-view-group": !0,
"f-list-view-group-multiselect": e.multiSelect,
"d-flex": p.value,
"flex-wrap": p.value
})), v = T(() => !!a.value && a.value.length > 0), w = T(() => a.value.length === 0);
T(() => w.value && !t.slots.empty);
function B() {
return r.value === "SingleView" ? it : r.value === "DraggableView" ? ha : (r.value === "ContentView" || r.value === "CardView") && (e.contentTemplate || t.slots.content) ? ga : it;
}
const C = B(), {
renderItem: L
} = C(e, t, a, f, l, o, d, i, S, s), {
renderItem: k
} = ya(e, t, a, f, l, o, d, i, S, s), H = [L, k];
function V() {
return a.value.filter((g) => g.visible !== !1).map((g, b) => H[g.type](g, b, x));
}
function F() {
return n("div", {
class: "f-list-view-emptydata",
style: "margin: 0 auto;"
}, [n("p", {
class: "f-empty-title"
}, [e.emptyTemplate ? e.emptyTemplate() : t.slots.empty ? t.slots.empty() : Z.getLocaleValue("listView.emptyMessage")])]);
}
function m() {
return n("ul", {
class: y.value,
style: "list-style: none;"
}, [v.value && V(), w.value && F()]);
}
return {
renderListArea: m
};
}
function Ca(e, t, a, u, l) {
const {
showSelectAll: o,
selectAll: i,
unSelectAll: s,
selectAllStatus: d,
indeterminateStatus: f
} = u;
function r(S) {
S ? i() : s();
}
const p = T(() => "f-list-view-group-item f-combo-list-item f-un-select");
function x() {
return n("div", {
class: "f-list-view-header"
}, [o.value && l.dataView.value.length > 0 && n("ul", {
class: "f-list-view-group f-list-view-group-multiselect",
style: "list-style: none;"
}, [n("li", {
class: p.value
}, [n("div", {
class: "f-list-select"
}, [n(bt, {
customClass: "listview-checkbox float-left",
modelValue: d.value,
indeterminate: f.value,
"onUpdate:modelValue": (S) => r(