@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,440 lines (1,439 loc) • 136 kB
JavaScript
var Vt = Object.defineProperty;
var It = (e, t, n) => t in e ? Vt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
var lt = (e, t, n) => It(e, typeof t != "symbol" ? t + "" : t, n);
import { ref as P, computed as W, watch as Me, createVNode as le, isVNode as Pt, Fragment as ut, createTextVNode as Qe, defineComponent as rt, reactive as bt, createApp as Ht, onUnmounted as jt, onMounted as wt, Transition as Bt, mergeProps as $t, nextTick as At, inject as Lt } from "vue";
import { LocaleService as St } from "../locale/index.esm.js";
import { createPropsResolver as Wt, getSchemaByTypeForDesigner as Gt } from "../dynamic-resolver/index.esm.js";
import { cloneDeep as ct, isPlainObject as pt, isUndefined as ft, throttle as zt } from "lodash-es";
import { useFilter as qt, useIdentify as Yt, useHierarchy as Ut, useDataView as Xt, useSelection as Jt, useDataViewContainerStyle as Qt, useColumn as Zt, useGroupColumn as Kt, useRow as en, useEdit as tn, useVisualDataBound as nn, useVisualDataCell as rn, useVisualDataRow as on, useVisualData as an, useCellPosition as ln, useVirtualScroll as sn, useSidebar as un, getVerticalScrollbar as cn, getHorizontalScrollbar as fn, getSidebar as dn, useFitColumn as vn, getEmpty as hn } from "../data-view/index.esm.js";
import "../popover/index.esm.js";
import { useI18n as ht } from "vue-i18n";
import { useCommonUtils as ot, useGuid as mn, useNumberFormat as Ct, resolveField as Ee, useArrayProcessor as Ot, useDateFormat as pn, setFieldValue as dt, getCustomClass as _n, withInstall as gn } from "../common/index.esm.js";
import "../modal/index.esm.js";
import "../transfer/index.esm.js";
import "../tabs/index.esm.js";
import { FCheckbox as yn } from "../checkbox/index.esm.js";
import "../filter-bar/index.esm.js";
import "../pagination/index.esm.js";
import _t from "../button/index.esm.js";
import "../list-view/index.esm.js";
import "../date-picker/index.esm.js";
import "../number-spinner/index.esm.js";
import "../search-box/index.esm.js";
import "../tags/index.esm.js";
import { useCondition as bn, CompareType as Be, ValueType as et, TextValue as st, RadioGroupValue as wn, NumberSpinnerValue as Sn, NumberRangeValue as Cn, MonthRangeValue as On, MonthPickerValue as xn, DateRangeValue as gt, DateTimePickerValue as Tn, DatePickerValue as Nn, ComboLookupValue as Fn, ComboListValue as kn, CheckBoxValue as En } from "../condition/index.esm.js";
import { FDynamicFormInput as Dn } from "../dynamic-form/index.esm.js";
import { useResizeObserver as Rn } from "@vueuse/core";
function xt(e, t) {
let n;
function r(a) {
const { properties: l, title: T, ignore: o } = a, _ = o && Array.isArray(o), O = Object.keys(l).reduce((S, c) => ((!_ || !o.find((w) => w === c)) && (S[c] = l[c].type === "object" && l[c].properties ? r(l[c]) : ct(l[c].default)), S), {});
if (T && (!_ || !o.find((S) => S === "id"))) {
const S = T.toLowerCase().replace(/-/g, "_");
O.id = `${S}_${Math.random().toString().slice(2, 6)}`;
}
return O;
}
function u(a) {
const { properties: l, title: T, required: o } = a;
if (o && Array.isArray(o)) {
const _ = o.reduce((O, S) => (O[S] = l[S].type === "object" && l[S].properties ? r(l[S]) : ct(l[S].default), O), {});
if (T && o.find((O) => O === "id")) {
const O = T.toLowerCase().replace(/-/g, "_");
_.id = `${O}_${Math.random().toString().slice(2, 6)}`;
}
return _;
}
return {
type: T
};
}
function y(a, l = {}, T) {
const o = e[a];
if (o) {
let _ = u(o);
const O = t[a];
return _ = O ? O({ getSchemaByType: y }, _, l, T) : _, n != null && n.appendIdentifyForNewControl && n.appendIdentifyForNewControl(_), _;
}
return null;
}
function i(a, l) {
const T = r(l);
return Object.keys(T).reduce((o, _) => (Object.prototype.hasOwnProperty.call(a, _) && (o[_] && pt(o[_]) && pt(a[_] || !a[_]) ? Object.assign(o[_], a[_] || {}) : o[_] = a[_]), o), T), T;
}
function b(a, l) {
return Object.keys(a).filter((o) => a[o] != null).reduce((o, _) => {
if (l.has(_)) {
const O = l.get(_);
if (typeof O == "string")
o[O] = a[_];
else {
const S = O(_, a[_], a);
Object.assign(o, S);
}
} else
o[_] = a[_];
return o;
}, {});
}
function N(a, l, T = /* @__PURE__ */ new Map()) {
const o = i(a, l);
return b(o, T);
}
function g(a) {
var T;
const l = a.type;
if (l) {
const o = e[l];
if (!o)
return a;
const _ = i(a, o), O = ((T = a.editor) == null ? void 0 : T.type) || "";
if (O) {
const S = e[O], c = i(a.editor, S);
_.editor = c;
}
return _;
}
return a;
}
function v(a) {
n = a;
}
return { getSchemaByType: y, resolveSchemaWithDefaultValue: g, resolveSchemaToProps: N, mappingSchemaToProps: b, setDesignerContext: v };
}
const Mn = {}, Vn = {}, { getSchemaByType: Ao, resolveSchemaWithDefaultValue: In, resolveSchemaToProps: Lo, mappingSchemaToProps: Wo, setDesignerContext: Go } = xt(Mn, Vn);
function Pn(e = {}) {
function t(g, v, a, l) {
if (typeof a == "number")
return l[g].length === a;
if (typeof a == "object") {
const T = Object.keys(a)[0], o = a[T];
if (T === "not")
return Number(l[g].length) !== Number(o);
if (T === "moreThan")
return Number(l[g].length) >= Number(o);
if (T === "lessThan")
return Number(l[g].length) <= Number(o);
}
return !1;
}
function n(g, v, a, l) {
return l[g] && l[g].propertyValue && String(l[g].propertyValue.value) === String(a);
}
const r = /* @__PURE__ */ new Map([
["length", t],
["getProperty", n]
]);
Object.keys(e).reduce((g, v) => (g.set(v, e[v]), g), r);
function u(g, v) {
const a = g;
return typeof v == "number" ? [{ target: a, operator: "length", param: null, value: Number(v) }] : typeof v == "boolean" ? [{ target: a, operator: "getProperty", param: g, value: !!v }] : typeof v == "object" ? Object.keys(v).map((l) => {
if (l === "length")
return { target: a, operator: "length", param: null, value: v[l] };
const T = l, o = v[l];
return { target: a, operator: "getProperty", param: T, value: o };
}) : [];
}
function y(g) {
return Object.keys(g).reduce((a, l) => {
const T = u(l, g[l]);
return a.push(...T), a;
}, []);
}
function i(g, v) {
if (r.has(g.operator)) {
const a = r.get(g.operator);
return a && a(g.target, g.param, g.value, v) || !1;
}
return !1;
}
function b(g, v) {
return y(g).reduce((T, o) => T && i(o, v), !0);
}
function N(g, v) {
const a = Object.keys(g), l = a.includes("allOf"), T = a.includes("anyOf"), o = l || T, S = (o ? g[o ? l ? "allOf" : "anyOf" : "allOf"] : [g]).map((w) => b(w, v));
return l ? !S.includes(!1) : S.includes(!0);
}
return { parseValueSchema: N };
}
const Hn = {
convertTo: (e, t, n, r) => {
e.appearance || (e.appearance = {}), e.appearance[t] = n;
},
convertFrom: (e, t, n) => e.appearance ? e.appearance[t] : e[t]
}, jn = {
convertFrom: (e, t, n) => e.buttons && e.buttons.length ? `共 ${e.buttons.length} 项` : "无"
}, Bn = {
convertTo: (e, t, n, r) => {
e.editor && (e.editor[t] = n);
},
convertFrom: (e, t, n) => e.editor && Object.prototype.hasOwnProperty.call(e.editor, t) ? e.editor[t] : e[t]
}, Tt = {
button: { type: "button", name: "按钮" },
"response-toolbar": { type: "response-toolbar", name: "工具栏" },
"response-toolbar-item": { type: "response-toolbar-item", name: "按钮" },
"content-container": { type: "content-container", name: "容器" },
"input-group": { type: "input-group", name: "文本" },
textarea: { type: "textarea", name: "多行文本" },
lookup: { type: "lookup", name: "帮助" },
"number-spinner": { type: "number-spinner", name: "数值" },
"date-picker": { type: "date-picker", name: "日期" },
switch: { type: "switch", name: "开关" },
"radio-group": { type: "radio-group", name: "单选组" },
"check-box": { type: "check-box", name: "复选框" },
"check-group": { type: "check-group", name: "复选框组" },
"combo-list": { type: "combo-list", name: "下拉列表" },
"response-form": { type: "response-form", name: "卡片面板" },
"response-layout": { type: "response-layout", name: "布局容器", icon: "response-layout-3" },
"response-layout-item": { type: "response-layout-item", name: "布局", icon: "response-layout-1" },
"tree-grid": { type: "tree-grid", name: "树表格" },
"tree-grid-column": { type: "tree-grid-column", name: "树表格列" },
"data-grid": { type: "data-grid", name: "表格" },
"data-grid-column": { type: "data-grid-column", name: "表格列" },
module: { type: "Module", name: "模块" },
component: { type: "component", name: "组件" },
tabs: { type: "tabs", name: "标签页" },
"tab-page": { type: "tab-page", name: "标签页项", dependentParentControl: "Tab" },
"tab-toolbar-item": { type: "tab-toolbar-item", name: "标签页工具栏按钮" },
"html-template": { type: "html-template", name: "模板容器" },
"time-picker": { type: "time-picker", name: "时间选择" },
section: { type: "section", name: "分组面板" },
"section-toolbar": { type: "section-toolbar", name: "分组面板工具栏" },
"section-toolbar-item": { type: "section-toolbar-item", name: "分组面板按钮" },
splitter: { type: "splitter", name: "分栏面板" },
"splitter-pane": { type: "splitter-pane", name: "分栏面板项", dependentParentControl: "Splitter" },
"component-ref": { type: "component-ref", name: "组件引用节点" },
uploader: { type: "uploader", name: "附件上传" },
"page-header": { type: "page-header", name: "页头" },
"page-footer": { type: "page-footer", name: "页脚" },
"tab-toolbar": { type: "tab-toolbar", name: "标签页工具栏" },
fieldset: { type: "fieldset", name: "分组" },
"query-solution": { type: "query-solution", name: "筛选方案" },
drawer: { type: "drawer", name: "抽屉" },
"external-container": { type: "external-container", name: "外部容器", icon: "content-container" },
"list-nav": { type: "list-nav", name: "列表导航" },
"list-view": { type: "list-view", name: "列表" },
"filter-bar": { type: "filter-bar", name: "筛选条" },
"language-textbox": { type: "language-textbox", name: "多语输入框" }
}, $n = {
convertFrom: (e, t, n) => {
var u;
const r = e.editor && e.editor[t] ? e.editor[t] : e[t];
return ((u = Tt[r]) == null ? void 0 : u.name) || r;
}
}, An = {
convertTo: (e, t, n, r) => {
e[t] = e[t];
},
convertFrom: (e, t, n) => e.editor ? n.getRealEditorType(e.editor.type) : ""
}, Ln = {
convertTo: (e, t, n, r) => {
(e.type === "data-grid-column" || e.type === "tree-grid-column") && (e.formatter ? e.formatter[t] = n : e.formatter = {
[t]: n
});
},
convertFrom: (e, t, n) => {
if (e.formatter) {
if (t === "trueText")
return e.formatter.trueText;
if (t === "falseText")
return e.formatter.falseText;
if (t === "prefix")
return e.formatter.prefix;
if (t === "suffix")
return e.formatter.suffix;
if (t === "precision")
return e.formatter.precision;
if (t === "decimal")
return e.formatter.decimal;
if (t === "thousand")
return e.formatter.thousand;
if (t === "tempDateFormat")
return e.formatter.dateFormat === "yyyy年MM月dd日" ? "yearMonthDay" : e.formatter.dateFormat === "yyyy-MM-dd HH:mm:ss" ? "yyyy-MM-ddTHH:mm:ss" : e.formatter.dateFormat === "yyyy/MM/dd HH:mm:ss" ? "yyyy/MM/ddTHH:mm:ss" : e.formatter.dateFormat === "yyyy年MM月dd日 HH时mm分ss秒" ? "yearMonthDayHourMinuteSecond" : e.formatter.tempDateFormat || e.formatter.dateFormat || "yyyy-MM-dd";
if (t === "customFormat")
return e.formatter.customFormat;
if (t === "type")
return e.formatter.type || "none";
}
return "none";
}
}, Wn = {
convertTo: (e, t, n, r) => {
e.command ? e.command[t] = n : e.command = {
[t]: n
}, t === "enable" && n && (e.command.commands || (e.command.commands = [
{
text: "编辑",
type: "primary",
command: "edit"
},
{
text: "删除",
type: "danger",
command: "remove"
}
]));
},
convertFrom: (e, t, n) => e.command && t === "enable" ? e.command.enable : ""
}, Gn = {
convertTo: (e, t, n, r) => {
e.column ? e.column[t] = n : e.column = {
[t]: n
}, t === "fitColumns" && n && (e.column.fitMode || (e.column.fitMode = "average"));
},
convertFrom: (e, t, n) => {
if (e.column) {
if (t === "fitColumns")
return e.column.fitColumns;
if (t === "fitMode")
return e.column.fitMode;
}
return "";
}
}, zn = {
convertTo: (e, t, n, r) => {
e.summary ? e.summary[t] = n : e.summary = {
[t]: n
}, t === "enable" && n && (e.summary ? e.summary.groupFields || (e.summary.groupFields = []) : e.summary = {
enable: n,
groupFields: []
});
},
convertFrom: (e, t, n) => e.summary && t === "enable" ? e.summary.enable : e.type === "data-grid-column" ? e.enableSummary === void 0 ? !1 : e.enableSummary : ""
}, qn = {
convertTo: (e, t, n, r) => {
e.group ? e.group[t] = n : e.group = {
[t]: n
}, t === "enable" && n && (e.group ? e.group.groupFields || (e.group.groupFields = []) : e.group = {
enable: n,
groupFields: [],
showSummary: !1
});
},
convertFrom: (e, t, n) => {
if (e.group) {
if (t === "enable")
return e.group.enable;
if (t === "showSummary")
return e.group.showSummary;
}
}
}, Yn = {
convertFrom: (e, t) => e.binding ? e.binding.path : "",
convertTo: (e, t, n) => {
if (n && n.length > 0) {
const r = n[0];
e.binding || (e.binding = {}), e.binding.type = "Form", e.binding.path = r.bindingField, e.binding.field = r.id, e.binding.fullPath = r.path, e.path = r.bindingPath;
}
}
}, Un = {
convertTo: (e, t, n, r) => {
e.pagination || (e.pagination = {}), e.pagination[t] = n;
},
convertFrom: (e, t, n) => e.pagination ? e.pagination[t] : e[t]
}, Xn = {
convertTo: (e, t, n, r) => {
e.rowNumber || (e.rowNumber = {}), e.rowNumber[t] = n;
},
convertFrom: (e, t, n) => e.rowNumber ? e.rowNumber[t] : e[t]
}, Jn = {
convertTo: (e, t, n, r) => {
e.selection || (e.selection = {}), e.selection[t] = n;
},
convertFrom: (e, t, n) => e.selection ? e.selection[t] : e[t]
}, Qn = {
convertFrom: (e, t, n) => e[t] && e[t].length ? `共 ${e[t].length} 项` : ""
}, Zn = {
convertFrom: (e, t) => e[t] || "",
convertTo: (e, t, n) => {
e[t] = n;
}
}, Kn = {
convertTo: (e, t, n, r) => {
e.size || (e.size = {}), e.size[t] = n;
},
convertFrom: (e, t, n) => e.size ? e.size[t] : e[t]
}, er = {
convertFrom: (e, t, n) => {
var r, u;
return (r = e.formatter) != null && r.data && t === "formatterEnumData" && !e.formatterEnumData ? (u = e.formatter) == null ? void 0 : u.data : e.formatterEnumData;
}
}, tr = {
convertTo: (e, t, n, r) => {
e.sort || (e.sort = {}), e.sort[t] = n;
},
convertFrom: (e, t, n) => {
var r, u;
if (t === "mode")
return ((r = e.sort) == null ? void 0 : r.mode) || "client";
if (t === "multiSort")
return !!((u = e.sort) != null && u.multiSort);
}
}, nr = {
convertTo: (e, t, n, r) => {
e.filter || (e.filter = {}), e.filter[t] = n;
},
convertFrom: (e, t, n) => {
var r;
if (t === "mode")
return ((r = e.filter) == null ? void 0 : r.mode) || "client";
}
}, rr = {
convertTo: (e, t, n, r) => {
e.rowOption ? e.rowOption[t] = n : e.rowOption = {
[t]: n
};
},
convertFrom: (e, t, n) => {
if (e.rowOption) {
if (t === "customRowStyle")
return e.rowOption.customRowStyle;
if (t === "customCellStyle")
return e.rowOption.customCellStyle;
}
return "";
}
};
function Nt(e, t, n) {
const r = /* @__PURE__ */ new Map([
["/converter/appearance.converter", Hn],
["/converter/buttons.converter", jn],
["/converter/property-editor.converter", Bn],
["/converter/items-count.converter", Qn],
["/converter/type.converter", $n],
["/converter/change-editor.converter", An],
["/converter/change-formatter.converter", Ln],
["/converter/column-command.converter", Wn],
["/converter/column-option.converter", Gn],
["/converter/summary.converter", zn],
["/converter/group.converter", qn],
["/converter/form-group-label.converter", Zn],
["/converter/field-selector.converter", Yn],
["/converter/pagination.converter", Un],
["/converter/row-number.converter", Xn],
["/converter/grid-selection.converter", Jn],
["/converter/size.converter", Kn],
["/converter/change-formatter-enum.converter", er],
["/converter/grid-sort.converter", tr],
["/converter/grid-filter.converter", nr],
["/converter/row-option.converter", rr]
]), u = /* @__PURE__ */ new Map([
["string", { type: "input-group", enableClear: !1 }],
["boolean", {
type: "combo-list",
textField: "name",
valueField: "value",
idField: "value",
enableClear: !1,
editable: !1,
data: [
{
value: !0,
name: "是"
},
{
value: !1,
name: "否"
}
]
}],
["enum", { type: "combo-list", maxHeight: 128, enableClear: !1, editable: !1 }],
["array", { type: "button-edit" }],
["number", { type: "number-spinner", placeholder: "" }],
["events-editor", { type: "events-editor", hide: !0 }]
]), y = Pn();
function i(o, _) {
return () => y.parseValueSchema(o, _);
}
function b(o, _, O) {
return o.includes("visible") && _.visible !== void 0 ? typeof _.visible == "boolean" ? () => !!_.visible : _.visible === void 0 ? !0 : i(_.visible, O) : () => !0;
}
function N(o, _, O) {
return o.includes("readonly") && _.readonly !== void 0 ? typeof _.readonly == "boolean" ? () => !!_.readonly : i(_.readonly, O) : () => !1;
}
function g(o, _) {
const O = o.$converter || _;
return typeof O == "string" && O && r.has(O) ? r.get(O) || null : O || null;
}
function v(o, _, O, S, c, w = "", m = "") {
return Object.keys(o).map((s) => {
const f = P(1), d = s, h = o[s], H = Object.keys(h), X = h.title, V = h.type, I = u.get(V) || { type: "input-group", enableClear: !1 }, x = h.editor ? Object.assign({}, I, h.editor) : Object.assign({}, I), E = b(H, h, _), B = N(H, h, _);
x.readonly = x.readonly === void 0 ? B() : x.readonly;
const J = h.type === "cascade" ? v(h.properties, _, O, S, c, w, m) : [], Z = !0;
let j = g(h, m);
const G = W({
get() {
if (f.value) {
if (["class", "style"].find((M) => M === d) && !j && (j = r.get("/converter/appearance.converter") || null), j && j.convertFrom)
return j.convertFrom(O, s, c, w);
const K = O[s];
return Object.prototype.hasOwnProperty.call(h, "defaultValue") && (K === void 0 || typeof K == "string" && K === "") ? h.type === "boolean" ? h.defaultValue : h.defaultValue || "" : K;
}
return null;
},
set(K) {
f.value += 1, j && j.convertTo ? (j.convertTo(S, s, K, c, w), j.convertTo(O, s, K, c, w)) : (S[s] = K, O[s] = K);
}
}), { refreshPanelAfterChanged: C, description: A, isExpand: te, parentPropertyID: Q } = h, re = { propertyID: d, propertyName: X, propertyType: V, propertyValue: G, editor: x, visible: E, readonly: B, cascadeConfig: J, hideCascadeTitle: Z, refreshPanelAfterChanged: C, description: A, isExpand: te, parentPropertyID: Q };
return _[d] = re, re;
});
}
function a(o, _, O = {}) {
const S = {}, c = e[o];
return c && c.categories ? Object.keys(c.categories).map((m) => {
const p = c.categories[m], s = p == null ? void 0 : p.title, f = v(p.properties || {}, S, {}, O, _);
return { categoryId: m, categoryName: s, properties: f };
}) : [];
}
function l(o, _, O, S, c = "") {
const w = _.$ref.schema, m = _.$ref.converter, p = O[w], s = p.type, f = n(p), d = {}, h = e[s];
if (h && h.categories) {
const H = h.categories[o], X = H == null ? void 0 : H.title;
m && Object.keys(H.properties).forEach((x) => {
H.properties[x].$converter = m;
});
const V = (H == null ? void 0 : H.properties) || {}, I = v(V, d, f, p, S, c);
return { categoryId: o, categoryName: X, properties: I };
}
return { categoryId: o, categoryName: "", properties: [] };
}
function T(o, _, O, S, c) {
const w = o.type, m = n(o), p = {};
let s = c || e[w];
if (s && Object.keys(s).length === 0 && O && O.getPropConfig && (s = O.getPropConfig(S)), s && s.categories) {
const f = [];
return Object.keys(s.categories).map((d) => {
const h = s.categories[d];
if (h.$ref) {
f.push(l(d, h, o, _, S));
return;
}
const H = h == null ? void 0 : h.title, X = h == null ? void 0 : h.tabId, V = h == null ? void 0 : h.tabName, I = h == null ? void 0 : h.hide, x = h == null ? void 0 : h.hideTitle, E = v(h.properties || {}, p, m, o, _, S, h.$converter), { setPropertyRelates: B } = h, J = h == null ? void 0 : h.parentPropertyID;
f.push({ categoryId: d, categoryName: H, tabId: X, tabName: V, hide: I, properties: E, hideTitle: x, setPropertyRelates: B, parentPropertyID: J });
}), f;
}
return [];
}
return {
getPropertyConfigBySchema: T,
getPropertyConfigByType: a,
propertyConverterMap: r
};
}
const or = {}, ir = {};
Nt(or, ir, In);
const ar = {}, lr = {}, { getSchemaByType: zo, resolveSchemaWithDefaultValue: sr, resolveSchemaToProps: qo, mappingSchemaToProps: Yo, setDesignerContext: Uo } = xt(ar, lr), ur = {}, cr = {};
Nt(ur, cr, sr);
function fr(e, t) {
return { customClass: t.class, customStyle: t.style };
}
const dr = /* @__PURE__ */ new Map([
["appearance", fr]
]);
function vr(e, t, n) {
return t;
}
const hr = "tree-view", mr = "A Farris Component", pr = "object", _r = {
basic: {
description: "Basic Infomation",
title: "基本信息",
properties: {
id: {
description: "组件标识",
title: "标识",
type: "string",
readonly: !0
},
type: {
description: "组件类型",
title: "控件类型",
type: "select",
editor: {
type: "waiting for modification",
enum: []
}
}
}
}
}, gr = {
title: hr,
description: mr,
type: pr,
categories: _r
}, yr = "https://json-schema.org/draft/2020-12/schema", br = "https://farris-design.gitee.io/tree-view.schema.json", wr = "tree-view", Sr = "A Farris Component", Cr = "object", Or = {
id: {
description: "The unique identifier for tree-view",
type: "string"
},
type: {
description: "The type string of tree-view",
type: "string",
default: "tree-view"
},
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
},
idField: {
description: "",
type: "string",
default: "id"
}
}, xr = [
"id",
"type"
], Tr = {
$schema: yr,
$id: br,
title: wr,
description: Sr,
type: Cr,
properties: Or,
required: xr
}, Xo = {
/** 自动列宽。设为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 }
}, mt = {
/** 自定义样式 */
customClass: { type: String, default: "" },
/** 列集合 */
columns: {
type: Array,
default: [
{ field: "name", title: "", dataType: "string", width: "100%" }
]
},
columnOption: { type: Object },
displayField: { type: String, default: "name", require: !0 },
/** 是否显示连接线 */
showLines: { type: Boolean, default: !1 },
/** 树表数据 */
/** 被绑定数据 */
data: { type: Object, default: [] },
/** 禁用组件 */
disable: { type: Boolean, default: !1 },
disabledField: { type: String, default: "disabled" },
/** 适配父组件尺寸 */
fit: { type: Boolean, default: !1 },
/** 高度 */
height: { type: Number, default: -1 },
/** DataGrid组件唯一标识 */
id: { type: String, default: "" },
/** 被绑定数据的标识字段 */
idField: { type: String, default: "id", require: !0 },
/** 最小高度 */
minHeight: { type: Number, default: 300 },
/** 最小宽度 */
minWidth: { type: Number, default: 400 },
/** 分页配置 */
pagination: {
type: Object,
default: {
enable: !1,
size: -1
}
},
/** 行号配置 */
rowNumber: {
type: Object,
default: {
enable: !1,
width: 32,
heading: St.getLocaleValue("datagrid.lineNumberTitle")
}
},
/** 选择配置 */
selection: {
type: Object,
default: {
enableSelectRow: !0,
multiSelect: !1,
multiSelectMode: "DependOnCheck",
showCheckbox: !1,
showSelectAll: !1,
showSelection: !1
}
},
/** 已选数据标识 */
selectionValues: { type: Array, default: [] },
/** 是否显示图标集 */
showTreeNodeIcons: { type: Boolean, default: !1 },
/** 树节点图标数据 */
treeNodeIconsData: { type: [Object, String], default: {} },
/** 绑定数据中的图标属性key值 */
iconField: { type: String, default: "" },
/** 宽度 */
width: { type: Number, default: -1 },
/** 新增值 */
newDataItem: {
type: [Function, Object],
default: () => {
}
},
/** 连接线颜色 */
lineColor: { type: String, default: "#9399a0" },
/** 单元格高度 */
cellHeight: { type: Number, default: 28 },
onOutputValue: { type: Function, default: () => {
} },
onCurrentEvent: { type: Function, default: () => {
} },
hierarchy: {
type: Object,
default: {
cascadeOption: {
autoCheckChildren: !1,
autoCheckParent: !1,
selectionRange: "All"
},
parentIdField: "parent"
}
},
/** 行配置 */
rowOption: { type: Object },
/** 虚拟化渲染数据 */
virtualized: { type: Boolean, default: !1 },
/** 是否出现省略号 */
showEllipsis: { type: Boolean, default: !1 },
/** 自动高度 **/
autoHeight: { type: Boolean, default: !1 },
/** async loading data */
loadData: { type: Function }
}, Ft = Wt(mt, Tr, dr, vr, gr);
var De = /* @__PURE__ */ ((e) => (e[e.readonly = 0] = "readonly", e[e.editable = 1] = "editable", e[e.editing = 2] = "editing", e))(De || {}), Ae = /* @__PURE__ */ ((e) => (e[e.initial = 0] = "initial", e[e.editing = 1] = "editing", e))(Ae || {}), Ze = /* @__PURE__ */ ((e) => (e[e.data = 0] = "data", e[e.group = 1] = "group", e[e.summary = 2] = "summary", e))(Ze || {}), $e = /* @__PURE__ */ ((e) => (e.DATE = "date", e.DATE_TIME = "datetime", e.NUMBER = "number", e.ENUM = "enum", e.IMAGE = "image", e.BOOLEAN = "boolean", e.BOOLEAN2 = "boolean2", e.TIMEAGO = "timeago", e.NONE = "none", e.CUSTOM = "custom", e.MULTI_LINGUAL = "multilingual", e))($e || {});
function kt(e, t) {
var T;
const n = String(Date.now()), r = ((T = e.rowOption) == null ? void 0 : T.height) || 28, u = P(t.value.primaryColumnsWidth);
function y(o) {
const _ = {};
return o.reduce(
(O, S, c) => {
const w = c < o.length - 1 ? o[c + 1] : null;
return c === 0 && (O[S.field] = { left: 0 }), S.actualWidth !== void 0 && (O[S.field].width = S.actualWidth), w && (O[w.field] = {
left: O[S.field].left + (S.actualWidth || 0)
}), O;
},
_
), _;
}
function i(o, _, O) {
const S = r * (O + 1), w = _[o.field].left - S + (_[o.field].width || 0), m = o.parent.height ? `${o.parent.height}px` : "";
return {
left: `${S}px`,
width: `${w}px`,
height: `${m}`
};
}
function b(o, _, O) {
return {
right: "0px",
height: `${o.parent.height ? `${o.parent.height}px` : ""}`
};
}
function N(o, _) {
var c;
const O = o.parent.height ? `${o.parent.height}px` : "", S = {
left: `${_[o.field].left}px`,
height: `${O}`,
width: isNaN(Number(_[o.field].width)) ? "100%" : `${_[o.field].width}px`
};
if ((c = e.rowOption) != null && c.customCellStyle) {
const w = e.rowOption.customCellStyle(o) || {};
return Object.assign({}, S, w.style || {});
}
return S;
}
function g(o, _, O) {
const c = (_.spanned || []).reduce((m, p) => m + (p.parent.height || 0), 0) + (o.height || 0);
return {
top: `${o.top}px`,
left: `${O[_.field].left}px`,
width: `${O[_.field].width}px`,
height: `${c}px`,
padding: `calc(${c / 2}px - 1rem) 0`
// height: `calc(${rowHeight}px * ${cell.rowSpan})`,
// padding: `calc(${rowHeight * cell.rowSpan / 2}px - 1rem) 0`
};
}
function v(o, _) {
return `${n}_${o.type}_r_${o.index}_c_${_}_${o.refreshKey || ""}`;
}
function a(o) {
return `${n}_${o.type}_r_${o.index}_${o.refreshKey || ""}`;
}
function l(o) {
var S;
const _ = o.height ? `${o.height}px` : "", O = {
top: `${o.top}px`,
width: isNaN(u.value) ? "100%" : `${u.value}px`,
height: `${_}`
};
if ((S = e.rowOption) != null && S.customRowStyle) {
const c = e.rowOption.customRowStyle(o.raw) || {};
return Object.assign({}, O, c.style || {});
}
return O;
}
return Me(t, () => {
u.value = t.value.primaryColumnsWidth;
}), {
calculateCellPositionInRow: y,
cellKey: v,
cellPosition: N,
groupCellPosition: i,
rowKey: a,
rowPosition: l,
rowSpanCellPosition: g,
summaryCellPosition: b
};
}
function Nr(e, t, n) {
const { hasChildrenField: r } = n, u = P("#9399a0"), y = P(28);
function i() {
return [].concat(
...t.value.filter((l) => l.raw.__fv_descendant_index__.length !== 0).map((l) => [...l.raw.__fv_descendant_index__.slice(-1)]).flat()
).sort((l, T) => Number(l) - Number(T));
}
function b(v) {
const a = new Array(t.value.length).fill(0);
if (e.showLines) {
const l = i();
t.value.forEach((T, o) => {
const _ = l.includes(o), O = T.raw[r.value];
a[o] = `repeating-linear-gradient(90deg, ${u.value} 0 1px, transparent 0px 2px) ${O ? "-10px" : "0px"} ${y.value / 2}px/20px 1px no-repeat,repeating-linear-gradient(${u.value} 0 1px, transparent 0px 2px) 0px 0px/1px ${_ ? "50%" : "100%"} no-repeat`;
}), a[0] = "";
}
return a[v];
}
function N(v, a, l) {
return l[v].parents.set(v, !0).forEach((o) => {
l[o].childsLength = l[o].childWithLines.filter((_) => a[_].visible).length;
}), a;
}
function g(v) {
const a = v.raw.__fv_parent_index__ === void 0 || v.raw.__fv_parent_index__ === -1, T = a ? 0 : 8, o = 0, _ = v.raw[r.value], O = `${v.layer * 10 + v.layer * T + o}px`, S = v.visible || ft(v.visible) ? {
paddingLeft: `calc(${O})`,
// paddingLeft,
background: b(v.index),
display: "flex",
width: "100%",
position: "relative"
} : {
display: "none"
};
return !_ && a && (S.paddingLeft = "calc(1.18rem)"), !_ && !a && (S.paddingLeft = `calc(${O} + 1.25rem)`), S;
}
return { hierarchyCellContentStyle: g, handleCollapsedPaddingBottom: N };
}
function Fr(e, t, n) {
const r = P(e.iconField);
function u(y, i) {
if (r.value)
return y.raw[e.iconField];
let b = "";
return y.raw[n.value] !== !0 ? b = t.value.leafnodes : b = y.collapse ? t.value.fold : t.value.unfold, b;
}
return { treeNodeIconsClass: u };
}
function kr(e, t, n, r, u, y, i, b) {
const { dataView: N, hasRealChildren: g, reOrderVisibleIndex: v } = r, { collapseField: a, hasChildrenField: l } = u, { reCalculateVisualDataRows: T, updateVirticalScroll: o } = y;
function _(O) {
if (O.raw[l.value]) {
const c = N.value[O.raw.__fv_index__];
c[a.value] = !c[a.value], r.toggleChildrenVisibiltyByCollapseStatus(c), c[l.value] = g(c), v(), T(), o(), c[a.value] || t.emit("expandNode", { row: O });
}
}
return { toggleTreeNode: _ };
}
function Er(e) {
function t(u) {
return {};
}
function n(u) {
const { valign: y, align: i } = u;
return {
"d-flex": !0,
"h-100": !0,
"w-100": !0,
"justify-content-start": i !== "center" && i !== "right",
"justify-content-center": i === "center",
"justify-content-right": i === "right",
"align-items-start": y !== "middle" && y !== "bottom",
"align-items-center": y === "middle",
"align-items-end": y === "bottom"
};
}
function r(u) {
const { align: y, showEllipsis: i } = u;
return {
"w-100": !0,
"text-left": y !== "center" && y !== "right",
"text-center": y === "center",
"text-right": y === "right",
"text-truncate": i
};
}
return { cellContentPosition: t, cellContentClass: n, cellContentClassWithEllipsis: r };
}
function Dr(e, t, n, r, u, y, i, b, N, g, v, a, l) {
ot();
const {
onClickCell: T
} = y, {
gridCellClass: o,
gridHierarchyCellClass: _,
gridRowClass: O,
onClickRow: S,
onMouseoverRow: c,
onMouseoutRow: w
} = b, {
enableMultiSelect: m,
select: p,
unSelect: s,
selectItem: f,
updateSelectAllStatus: d
} = N;
P(e.cellHeight);
const h = P(e.treeNodeIconsData || {}), {
hasChildrenField: H,
shouldShowCheckBox: X,
shouldShowIcon: V
} = i, {
toggleTreeNode: I
} = kr(e, t, r, u, i, v), {
toggleSelectHierarchyItem: x
} = g, {
cellKey: E,
cellPosition: B,
rowKey: J,
rowPosition: Z
} = kt(e, n), {
cellContentClass: j,
cellContentPosition: G,
cellContentClassWithEllipsis: C
} = Er(), {
hierarchyCellContentStyle: A
} = Nr(e, r, i), {
treeNodeIconsClass: te
} = Fr(e, h, H);
function Q(k, q) {
const me = k.raw[H.value];
return {
"fv-tree-node-toggle": me && k.collapse,
"fv-tree-node-toggle-minus": me && !k.collapse
};
}
function re(k) {
return k.collapse && e.loadData ? e.loadData(k) : Promise.resolve();
}
function K(k) {
return (k || []).some((q) => Pt(q) ? !(q.type === Comment || q.type === ut && !K(q.children)) : !0) ? k : null;
}
function M(k, q) {
k.stopPropagation(), re(q).then(() => {
I(q);
});
}
function F(k) {
k.stopPropagation();
}
function $(k, q) {
return le("div", {
class: Q(k),
onClick: (me) => M(me, k),
onDblclick: F
}, null);
}
function z(k, q) {
return V.value && le("div", {
id: "treeNodeIcons",
class: te(k, q)
}, null);
}
function oe(k) {
m.value ? (k.checked ? p(k) : s(k), x(k)) : f(k), d();
}
function de(k, q) {
return X.value && le(yn, {
id: "checkbox_for_" + E(k, q.index),
indeterminate: k.indeterminate,
disabled: k.disabled,
checked: k.checked,
"onUpdate:checked": (me) => k.checked = me,
onChange: () => oe(k)
}, null);
}
function ce(k, q) {
var me, xe;
return le("div", {
class: C(k)
}, [le("span", {
style: "user-select:none"
}, [(xe = (me = t.slots).cellTemplate) == null ? void 0 : xe.call(me, {
cell: k,
row: q
})])]);
}
function ue(k, q) {
var me, xe, pe;
return k.showTips && typeof ((me = k.column) == null ? void 0 : me.formatter) != "function" && ((xe = k.column) == null ? void 0 : xe.dataType) !== "commands" && ((pe = k.column) == null ? void 0 : pe.dataType) !== "setting" ? le("div", {
class: C(k),
title: k.formatter(k, q)
}, [le("span", {
style: "user-select:none"
}, [k.formatter(k, q)])]) : le("div", {
class: C(k)
}, [le("span", {
style: "user-select:none"
}, [k.formatter(k, q)])]);
}
function ve(k) {
const q = k.data !== null && k.data !== void 0 ? k.data.toString() : k.data;
return k.showTips ? le("div", {
class: C(k)
}, [le("span", {
style: "user-select:none",
title: q
}, [q])]) : le("div", {
class: C(k)
}, [Qe(" "), le("span", {
style: "user-select:none"
}, [q])]);
}
function we(k) {
return k.getEditor(k);
}
function he(k, q) {
return t.slots.cellTemplate && K(t.slots.cellTemplate({
cell: q,
row: k
})) ? ce(q, k) : q.mode === De.editing ? we(q) : q.column.columnTemplate ? q.column.columnTemplate(q, k) : q.formatter ? ue(q, k) : ve(q);
}
function Ve(k, q, me) {
const xe = A(k);
return le("div", {
ref: q.setRef,
key: E(k, q.index),
class: "fv-grid-hierarchy-cell",
style: B(q, me)
}, [le("div", {
class: j(q),
style: xe
}, [$(k), z(k, q), de(k, q), he(k, q)])]);
}
function R(k, q, me) {
return le("div", {
ref: q.setRef,
key: E(k, q.index),
class: o(q),
style: B(q, me),
onClick: (xe) => T(xe, q, k, q.column)
}, [le("div", {
class: j(q)
}, [he(k, q)])]);
}
function ee(k, q) {
return q === "left" && n.value.leftColumns.length > 0 && n.value.leftColumns[0].field === k.field || q === "primary" && n.value.primaryColumns.length > 0 && n.value.primaryColumns[0].field === k.field;
}
function U(k, q) {
t.emit("dblclickNode", {
$event: k,
node: q.raw
});
}
function _e(k, q, me = "primary", xe) {
return le("div", {
ref: k.setRef,
key: J(k),
class: O(k, xe),
style: Z(k),
onMouseover: (pe) => c(pe, k),
onMouseout: (pe) => w(pe, k),
onClick: (pe) => S(pe, k),
onDblclick: (pe) => U(pe, k)
}, [Object.values(k.data).filter((pe) => q[pe.field] && pe.rowSpan === 1).map((pe) => ee(pe, me) ? Ve(k, pe, q) : R(k, pe, q))]);
}
return {
renderDataRow: _e
};
}
function Rr(e) {
const {
t
} = ht();
function n(i, b) {
switch (i.command) {
case "edit":
case "remove":
return b.status === Ae.initial;
case "accept":
case "cancel":
return b.status === Ae.editing;
default:
return !i.hidden;
}
}
function r(i, b, N, g) {
var v, a, l, T, o;
switch ((v = i.onClick) == null || v.call(i, b, N.dataIndex, N), i.command) {
case "edit":
N.status, Ae.editing, (l = (a = e.commandOption) == null ? void 0 : a.onClickEditCommand) == null || l.call(a, g, N);
break;
case "accept":
case "cancel":
N.status, Ae.initial;
break;
case "remove":
(o = (T = e.commandOption) == null ? void 0 : T.onClickDeleteCommand) == null || o.call(T, g, N);
break;
}
}
function u(i) {
return i === "编辑" ? t("datagrid.commandColumn.edit") : i === "确定" ? t("datagrid.commandColumn.accept") : i === "取消" ? t("datagrid.commandColumn.cancel") : i === "删除" ? t("datagrid.commandColumn.remove") : i;
}
function y(i, b) {
const {
column: N
} = i;
return N.commands && N.commands.map((g, v) => v ? n(g, b) && le(_t, {
class: "ml-1",
type: g.type,
size: g.size || "small",
onClick: (a) => r(g, a, b, i),
style: {
"margin-bottom": "3px"
}
}, {
default: () => [Qe(" "), u(g.text), Qe(" ")]
}) : n(g, b) && le(_t, {
type: g.type,
size: g.size || "small",
onClick: (a) => r(g, a, b, i),
style: {
"margin-bottom": "3px"
}
}, {
default: () => [Qe(" "), u(g.text), Qe(" ")]
}));
}
return {
renderCommandColumn: y
};
}
function Mr(e) {
const t = P(e.minHeight), n = P(e.minWidth), r = P(e.height), u = P(e.width), y = W(() => r.value <= 0 ? 0 : Math.max(r.value, t.value)), i = W(() => u.value <= 0 ? 0 : Math.max(u.value, n.value));
return Me([
() => e.height,
() => e.width,
() => e.minHeight,
() => e.minWidth
], ([N, g, v, a]) => {
t.value = Number(v), n.value = Number(a), r.value = Number(N), u.value = Number(g);
}), { containerStyleObject: W(() => ({
height: y.value > 0 ? `${y.value}px` : e.fit ? "100%" : "",
width: i.value > 0 ? `${i.value}px` : e.fit ? "100%" : "",
flex: "1 1 0"
})) };
}
const Vr = "";
function Ir(e, t) {
const u = P({
defaultColumnWidth: 120,
headerDepth: 1,
leftColumns: [],
leftColumnsMap: /* @__PURE__ */ new Map(),
leftColumnsWidth: 0,
leftHeaderColumns: [],
primaryColumns: [],
primaryColumnsMap: /* @__PURE__ */ new Map(),
primaryColumnsWidth: 0,
primaryHeaderColumns: [],
rightColumns: [],
rightColumnsMap: /* @__PURE__ */ new Map(),
rightColumnsWidth: 0,
rightHeaderColumns: [],
summaryColumns: []
});
function y() {
u.value = {
defaultColumnWidth: 120,
headerDepth: 1,
leftColumns: [],
leftColumnsMap: /* @__PURE__ */ new Map(),
leftColumnsWidth: 0,
leftHeaderColumns: [],
primaryColumns: [],
primaryColumnsMap: /* @__PURE__ */ new Map(),
primaryColumnsWidth: 0,
primaryHeaderColumns: [],
rightColumns: [],
rightColumnsMap: /* @__PURE__ */ new Map(),
rightColumnsWidth: 0,
rightHeaderColumns: [],
summaryColumns: []
};
}
const i = P(e.summary), b = W(() => {
const s = i.value;
return (s == null ? void 0 : s.groupFields) || [];
});
function N() {
u.value.rightColumns.forEach((d) => {
d.showSetting = !1;
}), u.value.primaryColumns.forEach((d) => {
d.showSetting = !1;
});
const s = u.value.rightColumns.filter((d) => d.visible), f = u.value.primaryColumns.filter((d) => d.visible);
s.length > 0 ? s[s.length - 1].showSetting = !0 : f.length > 0 && (f[f.length - 1].showSetting = !0);
}
function g(s) {
y();
const f = /* @__PURE__ */ new Map();
return b.value && b.value.reduce((d, h) => (d.set(h, !0), d), f), s.reduce((d, h) => (h.visible = h.visible !== !1, h.filter = h.filter || Vr, h.fixed === "left" ? (u.value.leftColumns.push(h), u.value.leftColumnsMap.set(h.field, h), u.value.leftColumnsWidth += h.actualWidth) : h.fixed === "right" ? (u.value.rightColumns.push(h), u.value.rightColumnsMap.set(h.field, h), u.value.rightColumnsWidth += h.actualWidth) : (u.value.primaryColumns.push(h), u.value.primaryColumnsMap.set(h.field, h), u.value.primaryColumnsWidth += h.actualWidth), f.has(h.field) && u.value.summaryColumns.push(h), d), u), N(), u;
}
g(e.columns);
const v = W(() => u.value.leftColumns.length > 0), a = W(() => u.value.rightColumns.length > 0);
function l(s, f) {
return f.sortable && f.sort && f.sort !== "none" && s.push(f), s;
}
function T(s, f) {
return s.sortOrder = s.sortOrder || 0, f.sortOrder = f.sortOrder || 0, s.sortOrder === f.sortOrder ? 0 : s.sortOrder < f.sortOrder ? -1 : 1;
}
function o(s, f) {
return s.sortOrder = s.sortOrder || 0, f.sortOrder = f.sortOrder || 0, s.sortOrder === f.sortOrder ? 0 : s.sortOrder < f.sortOrder ? 1 : -1;
}
function _(s, f) {
return f.filterable && s.push(f), s;
}
function O() {
const s = [];
return u.value.leftColumns.reduce(_, s), u.value.primaryColumns.reduce(_, s), u.value.rightColumns.reduce(_, s), s;
}
function S() {
const s = [];
u.value.leftColumns.reduce(l, s), u.value.primaryColumns.reduce(l, s), u.value.rightColumns.reduce(l, s);
const f = Math.max(...s.map((d) => d.sortOrder || 0));
return s.sort(o).map((d) => {
const h = d.sortOrder || f + 1;
return d.sortOrder = h, d;
}).sort(T).map((d, h) => {
const H = h + 1;
return d.sortOrder = H, d;
});
}
function c(s) {
return S().map((d) => {
s.getSorterByColumn(d);
const h = d.sort === "asc", H = d.sort === "desc", X = h ? 0 : H ? 1 : 2;
return { sortField: d.field, sortType: X };
}).filter((d) => d.sortType !== 2);
}
function w(s) {
t.emit("sortChanged", c(s));
}
function m(s, f, d) {
const h = s.map((H) => {
const X = d.getSorterByColumn(H), V = H.sort === "asc", I = H.sort === "desc", x = V ? X.ascend : I ? X.decend : void 0;
return { field: H.field, compare: x };
});
f.setSorters(h);
}
function p(s, f) {
const d = S();
m(d, s, f);
}
return {
applyColumnSorter: p,
collectionFilterableColumns: O,
applySortableColumns: m,
collectionSortableColumns: S,
columnContext: u,
hasLeftFixedColumn: v,
hasRightFixedColumn: a,
updateColumnRenderContext: g,
updateColumnSettingIcon: N,
sortFromServer: w,
createSortConditions: c
};
}
function Pr(e, t) {
var c;
mn();
const { idField: n } = t, r = P(e.summary), u = P(e.group), y = P(((c = e.group) == null ? void 0 : c.groupFields) || []), i = W(() => {
var w;
return (w = e.group) == null ? void 0 : w.enable;
}), b = W(() => {
var w;
return (w = e.group) == null ? void 0 : w.showGroupPanel;
}), N = W(() => {
const w = r.value;
return (w == null ? void 0 : w.groupFields) || [];
}), g = W(() => {
const w = u.value;
return w && w.showSummary;
}), v = P(0), a = /* @__PURE__ */ new Map();
let l = [];
function T(w, m, p, s, f) {
const d = s[p];
d && (m.reduce((h, H, X) => {
var x;
const V = H[d];
let I = h.get(V);
if (!I) {
const E = N.value.reduce((B, J) => (B.set(J, 0), B), /* @__PURE__ */ new Map());
I = {
field: d,
title: ((x = f.get(d)) == null ? void 0 : x.title) || d,
value: V,
layer: p,
details: [],
groupSummaries: E
}, h.set(V, I);
}
return N.value && N.value.forEach((E) => {
if (I) {
const B = I.groupSummaries.get(E) || 0;
I.groupSummaries.set(E, B + H[E]);
}
}), N.value && N.value.forEach((E) => {
if (I) {
const B = I.groupSummaries.get(E) || 0;
I.groupSummaries.set(E, Number(B.toFixed(2)));
}
}), I.details.push(H), h;
}, w), p < s.length - 1 && w.forEach((h, H) => {
h.nestGroup = /* @__PURE__ */ new Map(), T(h.nestGroup, h.details, p + 1, s, f), h.details = [];
}));
}
function o(w, m) {
return e.group && e.group.formatter ? e.group.formatter(w.value, { ...w, total: m }) : `${w.title}:${w.value} (${m})`;
}
function _(w, m) {
const p = [];
return w.forEach((s) => {
const f = {
// 如果存在二级分组,分组行标识保持唯一
[n.value]: `group_of_${m ? m[n.value] + "_" : ""}${s.field}_${s.value}`,
__fv_data_grid_group_collapse__: !1,
__fv_data_grid_group_field__: s.field,
__fv_data_grid_group_layer__: s.layer,
__fv_data_grid_group_row__: !0,
__fv_data_grid_group_value__: s.value,
groupParents: []
};
m && (f.groupParents = [...m.groupParents, m]);
let d = 0;
if (p.push(f), s.nestGroup) {
const h = _(s.nestGroup, f);
p.push(...h), d += h.length;
}
if (s.details && s.details.length && (p.push(...s.details), d += s.details.length), g.value) {
const h = {
__fv_data_grid_group_field__: s.field,
__fv_data_grid_group_layer__: s.layer,
__fv_data_grid_group_summary__: !0
};
h[n.value] = `summary_of_${s.field}_${s.value}`, h[s.field] = Array.from(s.groupSummaries.entries()).reduce(
(H, [X, V]) => `${H} ${X} total:${V} `,
""
), p.push(h);
}
s.groupSummaries && s.groupSummaries.size && s.groupSummaries.forEach((h, H) => {
f[H] = h;
}), f[s.field] = o(s, d), f.value = s.value;
}), p.forEach((s, f) => {
s.__fv_data_index__ = f;
}), p;
}
function O(w, m, p) {
return !w || w.length === 0 || !m.length ? m : (w.join(","), a.clear(), l = [], m = m.filter((s) => !s.__fv_data_grid_group_row__), T(a, m, 0, w, p), l = _(a), l);
}
function S(w) {
return {
"f-icon": !0,
"f-icon-arrow-chevron-down": !0,
"fv-grid-group-row-icon-collapse": w.collapse
};
}
return { collpaseGroupIconClass: S, generateGroupData: O, groupFields: y, shouldGroupingData: i, showGroupPanel: b, groupRowSize: v };
}
function Et(e) {
const t = "parent", n = "layer", r = "hasChildren", u = (i, b = 1, N = [], g = null) => (i = i || [], i.reduce((v, a) => (a.id = a.id || a.data[e.idField], a[t] = g, a[n] = b, a[r] = a[r] === void 0 ? !1 : a[r], a.data && Object.keys(a.data).forEach((l) => {
Object.keys(a).includes(l) || (a[l] = a.data[l]);
}), N.push(a), a.children && a.children.length && (a[r] = !0, u(a.children, b + 1, N, a.id)), v), N), N);
return { flatTreeData: u, isNestedTree: (i) => i.some((b) => Array.isArray(b.children)) };
}
function Hr(e, t, n, r) {
const u = P(0), y = P(!!e.hierarchy), { idField: i } = r, { collapseField: b, hasChildrenField: N, parentIdField: g } = n, v = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), { flatTreeData: T, isNestedTree: o } = Et(e);
function _(M, F) {
a.clear(), M.reduce(($, z) => {
const oe = z[g.value] !== void 0 ? z[g.value] : "";
if (oe && F.has(oe)) {
const ce = F.get(oe), ue = isNaN(Number(ce.__fv_layer__)) ? 1 : Number(ce.__fv_layer__);
z.__fv_layer__ = ue + 1, z.__fv_parent_index__ = ce.__fv_index__, ce.__fv_hasChildren__ = !0;
} else
z.__fv_layer__ = 1;
const de = $.has(oe) ? $.get(oe) : [];
return de.push(z), $.set(oe, de), $;
}, a);
}
function O(M) {
l.clear(), M.reduce((F, $) => {
const z = $[i.value];