@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
784 lines (783 loc) • 26.7 kB
JavaScript
import { getCustomClass as Lt, withInstall as zt } from "../common/index.esm.js";
import { createVNode as m, defineComponent as Wt, ref as h, computed as I, onMounted as Ut, nextTick as pe, onUnmounted as Kt, watch as Se, Fragment as Yt, createTextVNode as qt } from "vue";
import { useResizeObserver as $t } from "@vueuse/core";
import { isUndefined as B } from "lodash-es";
import { LocaleService as Jt } from "../locale/index.esm.js";
import { getHierarchyRow as Qt, useIdentify as Xt, useGroupData as Zt, useFilter as el, useHierarchy as tl, useLoading as ll, useDataView as al, useSelection as nl, useSelectHierarchyItem as il, usePagination as ol, useDataViewContainerStyle as ul, useCommandColumn as sl, useSettingColumn as rl, useColumn as dl, useSort as cl, useGroupColumn as fl, useRow as ml, useEdit as vl, useVisualDataBound as yl, useVisualDataCell as hl, useVisualDataRow as gl, useVisualData as Cl, useCellPosition as pl, useSidebar as Sl, useVirtualScroll as wl, useFitColumn as bl, useFilterHistory as Il, useColumnFilter as Bl, useDragColumn as Fl, getColumnHeader as Dl, getSidebar as xl, getDisableMask as Ol, getHorizontalScrollbar as Rl, getVerticalScrollbar as Vl, getEmpty as Tl, getPagination as _l, getSummary as Gl, ColumnSettingSolution as Hl, COMMAND_COLUMN_DATA_TYPE as we, SETTING_COLUMN_DATA_TYPE as be } from "../data-view/index.esm.js";
import Pl from "../input-group/index.esm.js";
import kl from "../button/index.esm.js";
const $l = {
/** 启用分页 */
enable: { type: Boolean, default: !1 },
/** 当前页码 */
index: { type: Number, default: 1 },
/** 分页交互模式 */
mode: { type: String, default: "server" },
/** 显示页码输入框 */
showGoto: { type: Boolean, default: !1 },
/** 显示页码 */
showIndex: { type: Boolean, default: !0 },
/** 显示每页记录数 */
showLimits: { type: Boolean, default: !1 },
/** 显示分页汇总信息 */
showPageInfo: { type: Boolean, default: !0 },
/** 默认每页记录数 */
size: { type: Number, default: 20 },
/** 可选择的没有记录数据 */
sizeLimits: { type: Array, default: [10, 20, 30, 50, 100] },
/** 总记录数 */
total: { type: Number, default: 0 },
/** 禁用分页 */
disabled: { type: Boolean, default: !1 }
}, Jl = {
/** 启用排序 */
enable: { type: Boolean, default: !1 },
/** 排序字段集合 */
fields: { type: Array, default: [] },
/** 排序交互模式 */
mode: { type: String, default: "client" },
/** 多列排序 */
multiSort: { type: Boolean, default: !1 }
}, Ql = {
/** 自定义分组合计内容 */
customGroupRow: { type: Function, default: () => {
} },
/** 自定义分组行样式 */
customGroupRowStyle: { type: Function, default: () => {
} },
/** 自行分组合计行样式 */
customSummaryStyle: { type: Function, default: () => {
} },
/** 启用行数据分组 */
enable: { type: Boolean, default: !1 },
/** 分组行合并列数 */
groupColSpan: { type: Number, default: 1 },
/** 行数据分组字段;多字段分组以英文逗号分隔 */
groupFields: { type: Array, default: [] },
/** 在DataGrid中显示被分组的列 */
showGroupedColumn: { type: Boolean, default: !0 },
/** 显示分组面板 */
showGroupPanel: { type: Boolean, default: !1 },
/** 启用合计行 */
showSummary: { type: Boolean, default: !1 },
/** 显示合计行位置; */
summaryPosition: { type: String, default: "separate" }
}, Xl = {
/** 启用筛选 */
enable: { type: Boolean, default: !1 },
/** DataGrid筛选风格 */
filterStyle: { type: String, default: "filter-column" },
/** 筛选交互模式 */
mode: { type: String, default: "server" },
/** 显示过滤条件工具条 */
showSummary: { type: Boolean, default: !0 }
}, Zl = {
/** 允许折行显示列标题 */
wrapHeadings: { type: Boolean, default: !1 }
}, ea = {
/** 自定义行样式 */
customRowStyle: { type: Function, default: () => {
} },
customCellStyle: { type: Function, default: () => {
} },
/** 禁止行选中表达式 */
disable: { type: Function, default: () => {
} },
/** 默认行高度为 29px */
height: { type: Number, default: 28 },
/** 鼠标滑过行效果 */
showHovering: { type: Boolean, default: !0 },
/** 禁止数据折行 */
wrapContent: { type: Boolean, default: !1 }
}, ta = {
/** 显示合计信息 */
enable: { type: Boolean, default: !1 },
/** 合计行自定义样式,对启用合计行模板无效 */
customSummaryStyle: { type: Function, default: () => {
} },
/** 分组合计字段 */
groupFields: { type: Array, default: [] },
/** 合计交互模式 */
mode: { type: String, default: "client" },
/** 合计行显示位置, top: 顶部 bottom: 底部, both: 顶部与底部同时显示 */
position: { type: String, default: "bottom" }
}, la = {
/** 自动列宽。设为true后,所有列将填满表格并不会出现横向滚动条。 */
fitColumns: { type: Boolean, default: !1 },
/** 自动适配列宽度模式 */
fitMode: { type: String, default: "average" },
groups: { type: Array, defaut: [] },
/** 允许拖动表头改变列显示顺序 */
reorderColumn: { type: Boolean, default: !1 },
/** 允许拖动改变列宽度 */
resizeColumn: { type: Boolean, default: !0 },
/** 双击表头列自适应内容宽度 */
resizeColumnOnDoubleClick: { type: Boolean, default: !0 }
}, aa = {
/** 编辑时选中文本 */
selectOnEditing: { type: Boolean, default: !1 },
/** 编辑模式; row:整行编辑,cell: 单元格编辑 */
editMode: { type: String, default: "cell" }
}, na = {
/** show loading */
show: { type: Boolean, default: !1 },
/** message on display when loading */
message: { type: String, default: `${Jt.getLocaleValue("datagrid.loadingMessage")}...` }
}, Nl = {
/** 自定义样式 */
customClass: { type: String, default: "" },
/** 排序配置 */
sort: { type: Object },
/** 筛选配置 */
filter: { type: Object },
/** 自动勾选子节点 */
autoCheckChildren: { type: Boolean, default: !1 },
/** 列集合 */
columns: { type: Array, default: [] },
/** 列配置 */
columnOption: { type: Object },
/** 命令列配置选项 */
commandOption: {
type: Object,
default: {
enable: !1,
commands: []
}
},
/** 被绑定数据 */
data: { type: Array, default: [] },
/** 禁用组件 */
disabled: { type: Boolean, default: !1 },
/** 用于控制节点禁用状态的字段 */
disabledField: { type: String, default: "disabled" },
/** 用于显示信息的字段 */
displayField: { type: String, default: "name" },
/** 允许编辑 */
editable: { type: Boolean, default: !1 },
/** 编辑配置 */
editOption: { type: Object, default: { selectOnEditing: !1, editMode: "cell" } },
/** 适配父组件尺寸 */
fit: { type: Boolean, default: !1 },
/** 列标题配置 */
header: { type: Object },
/** 高度 */
height: { type: Number, default: -1 },
/** 层级关系配置对象 */
hierarchy: {
type: Object,
default: {
cascadeOption: {
autoCancelParent: !0,
autoCheckChildren: !1,
autoCheckParent: !1,
selectionRange: "All"
},
parentIdField: "parent"
}
},
/** DataGrid组件唯一标识 */
id: { type: String, default: "" },
/** 被绑定数据的标识字段 */
idField: { type: String, default: "id", require: !0 },
/** async loading data */
loadData: { type: Function },
// 是否展示 loading
loading: {
type: Boolean,
default: !1
},
/** 最小高度 */
minHeight: { type: Number, default: 300 },
/** 最小宽度 */
minWidth: { type: Number, default: 400 },
/** 新建数据 */
newDataItem: {
type: Function,
default: () => {
}
},
/** 分页配置 */
pagination: {
type: Object,
default: {
enable: !1,
mode: "server",
size: -1
}
},
/** 行号配置 */
rowNumber: {
type: Object,
default: {
enable: !0,
width: 36,
heading: "序号"
}
},
/** 行配置 */
rowOption: {
type: Object,
default: {
wrapContent: !1
}
},
/** 选择配置 */
selection: {
type: Object,
default: {
enableSelectRow: !0,
multiSelect: !1,
multiSelectMode: "DependOnCheck",
showCheckbox: !1,
showSelectAll: !1,
showSelection: !1
}
},
/** 已选数据标识 */
selectionValues: { type: Array, default: [] },
/** 显示边框 */
showBorder: { type: Boolean, default: !1 },
/** 显示列头 */
showHeader: { type: Boolean, default: !0 },
/** 显示横向行分割线 */
showHorizontalLines: { type: Boolean, default: !0 },
/** 显示节点连接线 */
showLines: { type: Boolean, default: !1 },
/** 显示配置按钮 */
showOptions: { type: Boolean, default: !1 },
/** 显示滚动条 */
showScrollBar: { type: String, default: "auto" },
/** 显示设置按钮 */
showSetting: { type: Boolean, default: !1 },
/** 显示条纹 */
showStripe: { type: Boolean, default: !0 },
/** 显示树节点图标 */
showTreeNodeIcons: { type: Boolean, default: !1 },
/** 显示纵向列分割线 */
showVerticallLines: { type: Boolean, default: !1 },
/** 树节点图标数据 */
treeNodeIconsData: { type: [Object, String], default: {} },
/** 宽度 */
width: { type: Number, default: -1 },
/** 启用虚拟渲染 */
virtualized: { type: Boolean, default: !1 },
/** 空数据模板 */
emptyTemplate: { type: Object },
/** 合计配置 */
summary: {
type: Object,
default: {
// 默认合计行开启后,后面不展示值,所以默认不开启
enable: !1,
groupFields: ["numericField1", "numericField2"]
}
},
/** 自动高度 **/
autoHeight: { type: Boolean, default: !1 },
/** 是否可见, 为了适配低代码表单,该属性不应该属于表格组件的行为 */
visible: { type: Boolean, default: !0 },
/** 复选框位置 */
checkboxPosition: { type: String, default: "after-expand" },
enableColumnSettingSolution: { type: Boolean, default: !1 },
/** 搜索配置 */
searchable: {
type: Boolean,
default: !1
},
customSearch: { type: Function }
};
function jl(l, C, A, M, F, D, L, q, R, g, v, V, $, s, T, J, _, d, w) {
const {
calculateCellPositionInRow: ne
} = D, {
columnContext: G,
hasLeftFixedColumn: Q,
hasRightFixedColumn: b
} = L, {
gridDataStyle: X,
leftFixedGridDataStyle: ie,
rightFixedGridDataStyle: oe
} = s, {
renderDataRow: a
} = Qt(l, C, G, _, q, R, g, v, V, $, s, T, J, d, w), ue = [a];
function c(f, Z) {
const ee = ne(f);
return _.value.filter((P) => P.visible !== !1).map((P, k) => ue[P.type](P, ee, Z, k));
}
function H() {
return m("div", {
ref: M,
class: "fv-grid-content-left-fixed"
}, [m("div", {
class: "fv-grid-data",
style: ie.value
}, [c(G.value.leftColumns.filter((f) => f.visible), "left")])]);
}
function se() {
return m("div", {
ref: A,
class: "fv-grid-content-primary"
}, [m("div", {
class: "fv-grid-data",
style: X.value
}, [c(G.value.primaryColumns.filter((f) => f.visible), "primary")])]);
}
function O() {
return m("div", {
ref: F,
class: "fv-grid-content-right-fixed"
}, [m("div", {
class: "fv-grid-data",
style: oe.value
}, [c(G.value.rightColumns.filter((f) => f.visible), "right")])]);
}
function re() {
const f = [];
return Q.value && f.push(H()), f.push(se()), b.value && f.push(O()), f;
}
return {
renderDataArea: re
};
}
const El = /* @__PURE__ */ Wt({
name: "FTreeGrid",
props: Nl,
emits: ["selectionChange", "clickRow", "expandNode", "unSelectItem", "dblclickNode", "doubleClickRow", "unSelectItem", "selectItem", "filterChanged", "unSelectAll", "selectAll", "sortChanged", "selectionUpdate", "endEditCell"],
setup(l, C) {
var _e, Ge;
const A = h(!1), M = h(!1), F = 0, D = h(((_e = l.rowOption) == null ? void 0 : _e.height) || 28);
let L = [], q = [];
const R = h(20), g = h(l.columns), v = Xt(l), {
idField: V
} = v, $ = h(), s = h(), T = h(), J = h(), _ = h(), d = h([]), w = h(!1), ne = h(((Ge = l.rowOption) == null ? void 0 : Ge.wrapContent) || !1), G = Zt(l, v), Q = el(l, C), b = tl(l), {
collapseField: X
} = b, {
showLoading: ie,
renderLoading: oe
} = ll(l, $), a = al(l, /* @__PURE__ */ new Map(), Q, b, v), {
dataView: ue
} = a, c = nl(l, a, v, d, C), {
showSelection: H,
selectedValues: se
} = c, O = il(l, d, a, v, c, C), re = I(() => l.disabled), f = I(() => l.virtualized ? Math.min(a.dataView.value.length, R.value) : a.dataView.value.length), Z = ol(l, a), {
shouldRenderPagination: ee
} = Z, {
containerStyleObject: P
} = ul(l, d), k = h(""), te = h([]), He = I(() => l.searchable || !1), N = h(0), Pe = sl(l), {
applyCommands: Ie
} = Pe;
Ie(g);
const {
applyColumnSetting: de,
removeColumnSetting: ke
} = rl(l);
l.showSetting && de(g);
const z = dl(l, C), ce = cl(l), {
applyColumnSorter: Be,
columnContext: le,
updateColumnRenderContext: Ne
} = z;
Be(a, ce);
const fe = fl(l, le), j = ml(l, C, c, v), E = vl(l, C, v, j, d), me = yl(l, a, D), je = hl(l, E, me), Ee = gl(l, a, E, b, v, me, je, D), ve = Cl(l, g, a, f, F, Ee), {
getVisualData: W
} = ve, Ae = pl(l, le, D, A), ye = Sl(l, c), {
sidebarWidth: Me
} = ye, y = wl(l, a, d, le, ve, f, F, Me, D, A), {
onWheel: Le,
dataGridWidth: Fe,
viewPortHeight: De,
viewPortWidth: ae,
resetScroll: he,
updateVisibleRowsOnLatestVisibleScope: ze
} = y, xe = bl(l, le, s, ae, fe), {
calculateColumnsSize: U
} = xe, Oe = Il(), We = Bl(s, _, a, Oe, y), Ue = Fl(l, C, z, a, fe, G, y), Ke = I(() => {
const e = {
"fv-grid": !0,
"fv-grid-bordered": l.showBorder,
"fv-grid-horizontal-bordered": l.showHorizontalLines,
"fv-datagrid-strip": l.showStripe
};
return Lt(e, l.customClass);
}), Ye = I(() => ({
"fv-grid-content": !0,
"fv-grid-content-hover": w.value,
"fv-grid-wrap-content": ne.value,
"fv-grid-scrollbar-visible": y.shouldShowVirticalScrollbar.value && w.value
})), {
renderDataArea: qe
} = jl(l, C, T, J, _, Ae, z, a, E, b, j, c, O, y, ve, me, d, D, A), {
renderGridHeader: $e,
renderGridColumnResizeOverlay: Je,
shouldShowHeader: Qe
} = Dl(l, C, s, J, _, z, a, Ue, We, Q, Oe, xe, fe, c, ye, ce, y, ae, d, M), {
renderDataGridSidebar: Xe
} = xl(l, j, c, ye, y), {
renderDisableMask: Ze
} = Ol(), {
renderHorizontalScrollbar: et
} = Rl(l, s, y), {
renderVerticalScrollbar: tt
} = Vl(l, s, y);
function lt() {
var e, t, r;
if (s.value && s.value.clientHeight > 0 && ((e = s.value) == null ? void 0 : e.clientWidth) > 0) {
const n = Math.ceil(s.value.clientHeight / D.value);
n > R.value && (R.value = n, ze()), De.value = ((t = T.value) == null ? void 0 : t.clientHeight) || 0, Fe.value = ((r = s.value) == null ? void 0 : r.clientWidth) || 0;
}
s.value && (s.value.clientHeight > 0 || s.value.clientWidth > 0) && U();
}
Ut(() => {
s.value && (R.value = Math.max(Math.ceil(s.value.clientHeight / D.value), R.value), d.value = W(0, f.value + F - 1), $t(s.value, lt), U(), pe(() => {
s.value && (Fe.value = s.value.clientWidth), T.value && (ae.value = T.value.clientWidth, De.value = T.value.clientHeight);
})), ie.value && oe();
}), Kt(() => {
}), Se(ae, () => {
s.value && U();
});
function at(e) {
a.collapseTo(e), a.reOrderVisibleIndex(), he();
}
function nt(e) {
a.expandTo(e), a.reOrderVisibleIndex(), he();
}
function ge() {
const e = c.getSelectionRow();
return e ? e.dataIndex - 1 : -1;
}
function it(e) {
const t = e !== void 0 ? e : ge(), r = a.insertNewDataItem(t === -1 ? 0 : t);
return d.value = W(0, f.value + F - 1), r;
}
function ot() {
const e = ge();
a.insertNewChildDataItem(e), d.value = W(0, f.value + F - 1);
}
function ut(e, t) {
const r = d.value.find((u) => u.raw[V.value] === t), n = r ? r.dataIndex - 1 : -1;
a.insertNewChildDataItems(e, n);
}
function st() {
const e = ge(), t = O.getNextSelectableHierarchyItemId(e);
a.removeHierarchyDataItem(e), d.value = W(0, f.value + F - 1), t && O.selectItemById(t);
}
function rt(e) {
E.onEditingRow(e);
}
function dt(e) {
E.acceptEditingRow(e);
}
function ct(e) {
E.cancelEditingRow(e);
}
function K(e) {
e && (g.value = e, Ie(g), l.showSetting && de(g), Ne(g.value), Be(a, ce), U());
}
Se(() => l.columns, (e) => {
if (l.showSetting && l.enableColumnSettingSolution) {
K(g.value);
return;
}
K(e);
});
function ft(e, t) {
e && (a.load(e), a.reOrderVisibleIndex(), t != null && t.keepScrollPosition ? y.scrollTo(y.offsetY.value) : he());
}
function Ce(e) {
j.activeRowById(e);
}
function mt(e, t = {
isCurrent: !0
}) {
t != null && t.isCurrent && Ce(e), O.selectItemById(e);
}
function vt(e) {
const t = d.value.find((r) => r.raw[v.idField.value] === e);
t && j.clickRowItem(t);
}
function yt(e) {
O.selectItemByIds(e);
}
function ht() {
return c.getSelectedItems();
}
function Re() {
c.clearSelection();
}
function gt() {
c.emptyCurrentRowId();
}
const Ct = I(() => !d.value || !d.value.length), {
renderEmpty: pt
} = Tl(l, C);
function St() {
return c.getSelectionRow();
}
function wt(e, t = {
clearCurrent: !0
}) {
t != null && t.clearCurrent && Ce(""), O.unSelectItemByIds(e);
}
function bt() {
return c.currentSelectedDataId.value;
}
function It(e, t, r) {
const n = ue.value.find((u) => u[V.value] === e);
if (n) {
if (Object.keys(n).forEach((o) => {
Object.prototype.hasOwnProperty.call(t, o) && (n[o] = t[o]);
}), r) {
const {
collapseField: o,
disabledField: p,
checkedField: x,
visibleField: S,
hasChildren: Y
} = r;
o && !B(t[o]) && (n.__fv_collapse__ = t[o]), x && !B(t[x]) && (n.__fv_checked__ = t[x]), p && !B(t[p]) && (n.__fv_disabled__ = t[p]), S && !B(t[S]) && (n.__fv_visible__ = t[S]), B(Y) || (n.__fv_hasChildren__ = Y);
}
const u = d.value.find((o) => o.raw[V.value] === e), i = d.value.findIndex((o) => o.raw[V.value] === e);
if (u) {
if (u.raw = n, Object.keys(u.data).forEach((o) => {
u.data[o].updateData(n);
}), r) {
const {
collapseField: o,
disabledField: p,
checkedField: x,
visibleField: S,
hasChildren: Y
} = r;
o && !B(t[o]) && (u.collapse = t[o]), x && !B(t[x]) && (u.checked = t[x]), p && !B(t[p]) && (u.disabled = t[p]), S && !B(t[S]) && (u.visible = t[S]), B(Y) || (u.raw.__fv_hasChildren__ = Y);
}
d.value = [...d.value.slice(0, i), u, ...d.value.slice(i + 1)], a.updateSummary();
}
}
}
function Bt(e) {
return Object.prototype.hasOwnProperty.call(e, "raw") ? a.hasRealChildren(e.raw) : a.hasRealChildren(e);
}
function Ft(e) {
const t = a.dataView.value.find((r) => r[V.value] === e);
return t ? t[X.value] : "";
}
function Dt() {
return X.value;
}
Se(() => l.showSetting, (e, t) => {
e !== t && (e ? de(g) : ke(g), K(g.value));
});
function xt(e) {
return d.value.filter((t) => e.includes(t.raw[l.idField]));
}
function Ve(e) {
const t = v.idField.value, r = d.value.find((n) => n.raw[t] === e);
r && j.changeRow(r);
}
function Ot() {
c.keepSelectingOnPaging.value || Re(), a.updateVisibleDataSummary(d.value);
}
function Rt(e) {
c.updateSelectedValues(e);
}
function Vt(e) {
c.removeSelectedValues(e);
}
function Tt(e) {
pe(() => {
y.scrollToRowByIndex(e.dataIndex - 1);
});
}
function _t(e) {
let t = e;
const r = [];
for (; t && t[b.parentIdField.value]; ) {
const n = a.rawView.value.find((u) => u[v.idField.value] === t[b.parentIdField.value]);
if (n)
n[b.collapseField.value] && r.push(n), t = n;
else
break;
}
r.reverse().forEach((n) => {
n[b.collapseField.value] = !1, a.toggleChildrenVisibiltyByCollapseStatus(n);
});
}
function Gt(e, t) {
if (e.length !== t.length)
return !1;
const r = e.map((u) => u[v.idField.value]).sort(), n = t.map((u) => u[v.idField.value]).sort();
return r.every((u, i) => u === n[i]);
}
function Te() {
if (!k.value.trim()) {
te.value = [], N.value = 0;
return;
}
const e = [], t = k.value.toLowerCase().trim();
a.rawView.value.forEach((n) => {
var i;
let u = !1;
(i = l.search) != null && i.customSearch ? u = l.search.customSearch(t, n, l.columns) : l.columns.forEach((o) => {
!u && o.field && n[o.field] !== void 0 && String(n[o.field]).toLowerCase().includes(t) && (u = !0);
}), u && e.push(n);
});
const r = !Gt(e, te.value);
if (e.length > 0) {
r ? (te.value = e, N.value = 0) : N.value = (N.value + 1) % e.length;
const n = e[N.value];
n && (_t(n), pe(() => {
a.reOrderVisibleIndex(), d.value = W(0, f.value + F - 1);
const u = n[v.idField.value], i = d.value.find((o) => o.raw[v.idField.value] === u);
i ? (Ve(u), Tt(i)) : console.warn("搜索结果的节点未在可视数据中找到");
}));
} else
te.value = [], N.value = 0;
}
function Ht(e) {
e.key === "Enter" && Te();
}
function Pt() {
Te();
}
C.expose({
activeRowById: Ce,
addNewDataItem: it,
addNewChildDataItem: ot,
addChildrenToNode: ut,
collapseTo: at,
expandTo: nt,
removeDataItem: st,
editDataItem: rt,
acceptDataItem: dt,
cancelDataItem: ct,
updateColumns: K,
updateDataSource: ft,
selectItemById: mt,
selectItemByIds: yt,
getSelectedItems: ht,
clearSelection: Re,
getSelectionRow: St,
clickRowItemById: vt,
unSelectItemByIds: wt,
getCurrentRowId: bt,
reassignRowData: It,
hasChildren: Bt,
getCollapseField: Dt,
getCollapseStatusById: Ft,
getVisibleDataByIds: xt,
selectRowById: Ve,
updateDerivedData: Ot,
emptyCurrentRowId: gt,
calculateColumnsSize: U,
updateSelectedValues: Rt,
removeSelectedValues: Vt
});
const kt = I(() => {
const e = {};
return y.shouldShowHorizontalScrollbar.value && w.value && (e.paddingBottom = "10px"), y.shouldShowVirticalScrollbar.value && w.value, e;
}), Nt = I(() => ({
...P.value,
borderRadius: "5px"
})), {
renderDataGridPagination: Al
} = _l(l, C, a, y, Z, c), jt = I(() => ({
"d-flex": !0,
"justify-content-between": ee.value && H.value,
"justify-content-end": ee.value && !H.value,
"position-relative": !0
})), Et = I(() => ({
"d-flex": !0,
"align-items-center": !0
}));
function At(e) {
const t = e.map((i) => i.id), r = [...g.value, ...L, ...q];
r.filter((i) => i.dataType !== we && i.dataType !== be).forEach((i) => {
const o = e.find((p) => p.id === i.id);
o && (i.width = o.actualWidth || i.width || 120, o.actualWidth !== void 0 && (i.actualWidth = o.actualWidth), i.title = o.title, i.halign = o.halign, i.align = o.align, i.fixed = o.fixed);
}), q = r.filter((i) => i.dataType === we || i.dataType === be);
const n = r.filter((i) => i.dataType !== we && i.dataType !== be), u = n.filter((i) => t.includes(i.id));
L = n.filter((i) => !t.includes(i.id)), u.sort((i, o) => {
const p = e.findIndex((S) => S.id === i.id), x = e.findIndex((S) => S.id === o.id);
return p - x;
}), K(u);
}
const {
renderDataGridSummary: Mt
} = Gl(l, a, z);
return () => l.visible && m(Yt, null, [He.value && m("div", {
class: "fv-grid-search",
style: {
padding: "8px 12px",
border: "1px solid #e0e0e0",
borderBottom: "none",
borderRadius: "4px 4px 0 0"
}
}, [m("div", {
style: {
display: "flex",
alignItems: "center"
}
}, [m(Pl, {
value: k.value,
onInput: (e) => k.value = e,
onKeydown: Ht,
placeholder: "搜索数据...",
style: {
flex: 1
}
}, null), m(kl, {
type: "link",
onClick: Pt,
style: {
cursor: "pointer",
marginLeft: "8px"
}
}, {
default: () => [m("i", {
class: "f-icon f-icon-search"
}, null)]
})])]), m("div", {
ref: $,
class: Ke.value,
style: Nt.value,
onWheel: Le
}, [s.value && Qe.value && $e(), m("div", {
ref: s,
class: Ye.value,
onMouseover: () => w.value = !0,
onMouseleave: () => w.value = !1,
onTouchstart: (e) => {
e.stopPropagation(), w.value = !0, y.onTouchstartScrollThumb(e, s);
},
onTouchend: (e) => {
w.value = !1;
},
style: kt.value
}, [s.value && Xe(d), s.value && qe(), s.value && Ct.value && pt(), s.value && et(), s.value && tt()]), s.value && Mt(), H.value && m("div", {
class: jt.value
}, [H.value && m("div", {
class: Et.value
}, [m("div", null, ["已选:" + se.value.length, qt(" 条")])])]), Je(), re.value && Ze()]), l.enableColumnSettingSolution && m(Hl, {
columns: [...g.value, ...L],
componentId: l.id,
modelValue: M.value,
"onUpdate:modelValue": (e) => M.value = e,
onChangeColumnSetting: At
}, null)]);
}
}), ia = zt(El);
export {
El as FTreeGrid,
la as columnOptions,
ia as default,
aa as editOptions,
Xl as filterOptions,
Ql as groupOptions,
Zl as headerOptions,
na as loadingOptions,
$l as paginationOptions,
ea as rowOptions,
Jl as sortOptions,
ta as summaryOptions,
Nl as treeGridProps
};