UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,801 lines (1,800 loc) 295 kB
var Nn = Object.defineProperty; var Rn = (e, t, n) => t in e ? Nn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var te = (e, t, n) => Rn(e, typeof t != "symbol" ? t + "" : t, n); import { ref as S, watch as Se, createVNode as I, createTextVNode as pt, computed as H, defineComponent as Ye, Fragment as _t, reactive as it, createApp as en, onUnmounted as It, onMounted as gt, Transition as tn, mergeProps as mt, onBeforeUnmount as nn, withDirectives as $n, resolveDirective as Pn, inject as yt, provide as jn, triggerRef as Ln, isVNode as Hn, onBeforeMount as Wn, Teleport as An, shallowRef as zn, nextTick as At, render as Nt, h as Gn, cloneVNode as qn } from "vue"; import { useResizeObserver as on } from "@vueuse/core"; import { isPlainObject as Yt, cloneDeep as dt, isUndefined as Xt } from "lodash-es"; import { useIdentify as Un, useGroupData as Yn, useFilter as Xn, useHierarchy as Kn, useLoading as Qn, useDataView as Jn, useSelection as Zn, useSelectHierarchyItem as eo, useDataViewContainerStyle as to, useCommandColumn as no, useColumn as oo, useSort as ro, useGroupColumn as ao, useRow as io, useEdit as lo, useVisualDataBound as so, useVisualDataCell as uo, useVisualDataRow as co, useVisualData as fo, useCellPosition as po, useSidebar as mo, useVirtualScroll as vo, useFitColumn as ho, useFilterHistory as go, useColumnFilter as yo, useDragColumn as bo, getColumnHeader as Co, getSidebar as wo, getDisableMask as _o, getHorizontalScrollbar as So, getVerticalScrollbar as xo, getEmpty as To } from "../data-view/index.esm.js"; import "../modal/index.esm.js"; import Fo from "../transfer/index.esm.js"; import ko from "../tabs/index.esm.js"; import Eo from "../order/index.esm.js"; import "../condition/index.esm.js"; import Oo, { FCheckbox as Io } from "../checkbox/index.esm.js"; import Mo from "../filter-bar/index.esm.js"; import Kt from "../tooltip/index.esm.js"; import Bo from "../pagination/index.esm.js"; import Vo from "../button/index.esm.js"; import Do from "../search-box/index.esm.js"; import No from "../tags/index.esm.js"; import Ro, { FDynamicFormGroup as $o, FDynamicFormInput as Po } from "../dynamic-form/index.esm.js"; import "../designer-canvas/index.esm.js"; import { getCustomClass as Rt, useDateFormat as jo, useNumberFormat as Lo, resolveField as Ue, setFieldValue as Pt, withInstall as Ho } from "../common/index.esm.js"; import Wo from "../accordion/index.esm.js"; import Ao from "../avatar/index.esm.js"; import zo from "../button-edit/index.esm.js"; import Go from "../button-group/index.esm.js"; import qo from "../calendar/index.esm.js"; import Uo from "../capsule/index.esm.js"; import Yo from "../color-picker/index.esm.js"; import jt from "../combo-list/index.esm.js"; import Xo from "../content-container/index.esm.js"; import Ko from "../data-grid/index.esm.js"; import Qo from "../date-picker/index.esm.js"; import Jo from "../dropdown/index.esm.js"; import "../external-container/index.esm.js"; import Zo from "../events-editor/index.esm.js"; import er from "../image-cropper/index.esm.js"; import tr from "../input-group/index.esm.js"; import nr from "../layout/index.esm.js"; import or from "../list-nav/index.esm.js"; import rr from "../list-view/index.esm.js"; import ar from "../lookup/index.esm.js"; import ir from "../nav/index.esm.js"; import lr from "../number-spinner/index.esm.js"; import sr from "../number-range/index.esm.js"; import ur from "../page-header/index.esm.js"; import cr from "../page-footer/index.esm.js"; import dr from "../progress/index.esm.js"; import fr from "../query-solution/index.esm.js"; import pr from "../radio-group/index.esm.js"; import mr from "../rate/index.esm.js"; import vr from "../response-toolbar/index.esm.js"; import hr from "../response-layout/index.esm.js"; import gr from "../response-layout-editor/index.esm.js"; import yr from "../section/index.esm.js"; import br from "../smoke-detector/index.esm.js"; import Cr from "../splitter/index.esm.js"; import wr from "../step/index.esm.js"; import _r from "../switch/index.esm.js"; import Sr from "../text/index.esm.js"; import xr from "../time-picker/index.esm.js"; import Tr from "../tree-view/index.esm.js"; import Fr from "../uploader/index.esm.js"; import kr from "../verify-detail/index.esm.js"; import Er from "../component/index.esm.js"; import Or from "../video/index.esm.js"; import Ir from "../textarea/index.esm.js"; import Mr from "../tree-grid/index.esm.js"; import Br from "../fieldset/index.esm.js"; import Vr from "../drawer/index.esm.js"; import Dr from "../binding-selector/index.esm.js"; import "../notify/index.esm.js"; import Nr from "../combo-tree/index.esm.js"; import Rr from "../field-selector/index.esm.js"; import $r from "../mapping-editor/index.esm.js"; import Pr from "../schema-selector/index.esm.js"; import jr from "../event-parameter/index.esm.js"; import Lr from "../filter-condition-editor/index.esm.js"; import Hr from "../sort-condition-editor/index.esm.js"; import Wr from "../menu-lookup/index.esm.js"; import { createPropsResolver as Ar } from "../dynamic-resolver/index.esm.js"; const rn = {}, an = {}; function zt(e) { const { properties: t, title: n, ignore: o } = e, r = o && Array.isArray(o), i = Object.keys(t).reduce((a, u) => ((!r || !o.find((s) => s === u)) && (a[u] = t[u].type === "object" && t[u].properties ? zt(t[u]) : dt(t[u].default)), a), {}); if (n && (!r || !o.find((a) => a === "id"))) { const a = n.toLowerCase().replace(/-/g, "_"); i.id = `${a}_${Math.random().toString().slice(2, 6)}`; } return i; } function zr(e) { const { properties: t, title: n, required: o } = e; if (o && Array.isArray(o)) { const r = o.reduce((i, a) => (i[a] = t[a].type === "object" && t[a].properties ? zt(t[a]) : dt(t[a].default), i), {}); if (n && o.find((i) => i === "id")) { const i = n.toLowerCase().replace(/-/g, "_"); r.id = `${i}_${Math.random().toString().slice(2, 6)}`; } return r; } return { type: n }; } function ln(e, t = {}, n) { const o = rn[e]; if (o) { let r = zr(o); const i = an[e]; return r = i ? i({ getSchemaByType: ln }, r, t, n) : r, r; } return null; } function Gr(e, t) { const n = zt(t); return Object.keys(n).reduce((o, r) => (Object.prototype.hasOwnProperty.call(e, r) && (o[r] && Yt(o[r]) && Yt(e[r] || !e[r]) ? Object.assign(o[r], e[r] || {}) : o[r] = e[r]), o), n), n; } function sn(e, t) { return Object.keys(e).filter((o) => e[o] != null).reduce((o, r) => { if (t.has(r)) { const i = t.get(r); if (typeof i == "string") o[i] = e[r]; else { const a = i(r, e[r], e); Object.assign(o, a); } } else o[r] = e[r]; return o; }, {}); } function qr(e, t, n = /* @__PURE__ */ new Map()) { const o = Gr(e, t); return sn(o, n); } function Ur(e = {}) { function t(p, d, c, f) { if (typeof c == "number") return f[p].length === c; if (typeof c == "object") { const y = Object.keys(c)[0], w = c[y]; if (y === "not") return Number(f[p].length) !== Number(w); if (y === "moreThan") return Number(f[p].length) >= Number(w); if (y === "lessThan") return Number(f[p].length) <= Number(w); } return !1; } function n(p, d, c, f) { return f[p] && f[p].propertyValue && String(f[p].propertyValue.value) === String(c); } const o = /* @__PURE__ */ new Map([ ["length", t], ["getProperty", n] ]); Object.keys(e).reduce((p, d) => (p.set(d, e[d]), p), o); function r(p, d) { const c = p; return typeof d == "number" ? [{ target: c, operator: "length", param: null, value: Number(d) }] : typeof d == "boolean" ? [{ target: c, operator: "getProperty", param: p, value: !!d }] : typeof d == "object" ? Object.keys(d).map((f) => { if (f === "length") return { target: c, operator: "length", param: null, value: d[f] }; const y = f, w = d[f]; return { target: c, operator: "getProperty", param: y, value: w }; }) : []; } function i(p) { return Object.keys(p).reduce((c, f) => { const y = r(f, p[f]); return c.push(...y), c; }, []); } function a(p, d) { if (o.has(p.operator)) { const c = o.get(p.operator); return c && c(p.target, p.param, p.value, d) || !1; } return !1; } function u(p, d) { return i(p).reduce((y, w) => y && a(w, d), !0); } function s(p, d) { const c = Object.keys(p), f = c.includes("allOf"), y = c.includes("anyOf"), w = f || y, m = (w ? p[w ? f ? "allOf" : "anyOf" : "allOf"] : [p]).map((x) => u(x, d)); return f ? !m.includes(!1) : m.includes(!0); } return { parseValueSchema: s }; } const le = { 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: "标签页工具栏按钮" }, "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: "抽屉" } }, Yr = {}, Xr = {}; Ur(); function vt(e, t, n = /* @__PURE__ */ new Map(), o = (a, u, s, p) => u, r = {}, i = (a) => a) { return rn[t.title] = t, an[t.title] = o, Yr[t.title] = r, Xr[t.title] = i, (a = {}, u = !0) => { if (!u) return sn(a, n); const s = qr(a, t, n), p = Object.keys(e).reduce((d, c) => (d[c] = e[c].default, d), {}); return Object.assign(p, s); }; } function Mt(e, t) { return { customClass: t.class, customStyle: t.style }; } function Kr() { function e(t, n) { const { dataSource: o } = t || {}; return o === void 0 ? {} : {}; } return { resolve: e }; } function Qr() { function e(t, n) { return t.selectItemById(n); } return { selectItemById: e }; } function Jr() { function e(t, n) { const { columns: o } = n; return t.updateColumns(o); } return { updateColumns: e }; } const un = /* @__PURE__ */ new Map([ ["appearance", Mt], ["column", "columnOption"] ]); function Zr(e, t, n) { var c; const o = n.parentComponentInstance, r = o.schema.type, i = String(((c = o.schema.appearance) == null ? void 0 : c.class) || "").split(" "), a = r === "section" || r === "tab-page", u = i.includes("f-page-content-nav"), s = i.includes("f-page-main"), p = e.getSchemaByType("component"); p.id = `${t.id}-component`, p.componentType = "data-grid"; let d = ""; return d += a ? "f-struct-data-grid-in-card f-struct-is-subgrid" : "", d += u ? "f-struct-data-grid-in-nav f-struct-wrapper f-utils-fill-flex-column" : "", d += s ? "f-struct-data-grid f-struct-wrapper" : "", p.appearance = { class: d }, p.contents = [t], p; } function ea(e, t, n) { const o = n.parentComponentInstance, r = String(o.schema.appearance.class || "").split(" "), i = r.includes("f-page-content-nav"), a = r.includes("f-page-main"), u = e.getSchemaByType("section"); u.id = `${t.id}-section`; let s = ""; return s += i ? "f-section-in-nav " : "", s += a ? "f-section-in-managelist " : "", s += "f-section-grid", u.appearance = { class: s }, u.contents = [t], u; } function ta(e, t, n) { const o = e.getSchemaByType("content-container"); return o.id = `${t.id}-layout`, o.appearance = { class: "f-grid-is-sub f-utils-flex-column" }, o.contents = [t], o; } function cn(e, t, n) { const r = n.parentComponentInstance.schema.type, i = r === "section" || r === "tab-page"; t.appearance = { class: "f-component-grid" }; const u = (i ? ta : ea)(e, t, n); return Zr(e, u, n); } const na = "https://json-schema.org/draft/2020-12/schema", oa = "https://farris-design.gitee.io/tree-grid.schema.json", ra = "tree-grid", aa = "A Farris Data Grid Component", ia = "object", la = { id: { description: "The unique identifier for a Input Group", type: "string" }, type: { description: "The type string of Input Group component", type: "string", default: "tree-grid" }, appearance: { description: "", type: "object", properties: { class: { type: "string" }, style: { type: "string" } }, default: {} }, fit: { type: "boolean", default: !1 }, showStripe: { type: "boolean", default: !0 }, showBorder: { type: "boolean", default: !1 }, showTreeNodeIcons: { type: "boolean", default: !1 }, showSetting: { type: "boolean", default: !1 }, size: { description: "", type: "object", properties: { width: { type: "number" }, height: { type: "number" } }, default: null }, dataSource: { description: "", type: "string", default: "" }, columns: { description: "", type: "array", default: [] }, identifyField: { description: "", type: "string" }, editable: { description: "", type: "boolean", default: !1 }, disabled: { description: "", type: "boolean", default: !1 }, visible: { description: "", type: "boolean", default: !0 }, cell: { type: "object", properties: { highlightFocusingCell: { description: "", type: "boolean", default: !1 }, mergeCell: { description: "", type: "boolean", default: !1 }, showEditableIcon: { description: "", type: "boolean", default: !1 } } }, column: { type: "object", properties: { fitColumns: { description: "", type: "boolean", default: !1 }, fitMode: { description: "", type: "string", default: "average" }, groups: { description: "", type: "array", default: [] }, reorderColumn: { description: "Enable to drag column to reorder", type: "boolean", default: !1 }, resizeColumn: { type: "boolean", default: !0 }, resizeColumnOnDoubleClick: { description: "", type: "boolean", default: !0 } } }, command: { type: "object", properties: { enable: { description: "", type: "boolean", default: !1 }, commands: { type: "array", default: [] }, commandColumnWidth: { description: "", type: "number", default: 120 }, onClickDeleteCommand: { description: "", type: "string", default: "" }, onClickEditCommand: { description: "", type: "string", default: "" } } }, contextMenu: { description: "", type: "object", properties: { enable: { description: "", type: "boolean", default: !1 } } }, customizaiton: { type: "object", properties: { enableScheme: { description: "", type: "boolean", default: !1 }, enableSetting: { description: "", type: "boolean", default: !1 } } }, edit: { type: "obejct", properties: { mode: { description: "", type: "string", default: "cell", enum: [ "cell", "row", "card" ] }, selectOnEditing: { description: "", type: "boolean", default: !1 }, onAppendRow: { description: "", type: "string", default: "" }, onBeforeEdit: { description: "", type: "string", default: "" } } }, filter: { type: "object", properties: { enable: { description: "", type: "boolean", default: !1 }, filterStyle: { description: "", type: "string", default: "filter-column", enum: [ "filter-column", "filter-row" ] }, mode: { description: "", type: "string", default: "server", enum: [ "client", "server" ] }, showSummary: { description: "", type: "boolean", default: !0 }, onFilterChange: { description: "", type: "string", default: "" } } }, footer: { type: "object", properties: { enable: { description: "", type: "boolean", default: !1 }, customFooterStyle: { description: "", type: "object" }, footerDataCommand: { description: "", type: "string", default: "" }, footerDataFrom: { description: "", type: "string", default: "client" }, footerHeight: { description: "", type: "number", default: 29 }, footerPosition: { description: "", type: "string", default: "bottom" }, footerTemplate: { description: "", type: "string", default: "" } } }, group: { description: "", type: "object", properties: { enable: { description: "", type: "boolean", default: !1 }, customGroupRow: { description: "", type: "object" }, customGroupRowStyle: { description: "", type: "obejct" }, customSummaryStyle: { description: "", type: "obejct" }, groupColSpan: { description: "", type: "number", default: 1 }, groupFields: { description: "", type: "array", default: [] }, showGroupedColumn: { description: "", type: "boolean", default: !0 }, showGroupPanel: { description: "", type: "boolean", default: !1 }, showSummary: { description: "", type: "boolean", default: !1 }, summaryPosition: { description: "", type: "string", default: "separate", enum: [ "separate", "merge-to-group" ] }, disableGroupOnEditing: { description: "", type: "boolean", default: !0 }, expandGroupRows: { description: "", type: "boolean", default: !0 } } }, header: { type: "object", properties: { wrapHeadings: { description: "", type: "boolean", default: !1 } } }, pagination: { type: "object", properties: { enable: { description: "", type: "boolean", default: !1 }, disablePagination: { description: "", type: "string", default: "" }, contentTemplate: { description: "", type: "string", default: "" }, index: { description: "", type: "number", default: 1 }, mode: { description: "", type: "string", default: "server", enum: [ "server", "client" ] }, showGoto: { description: "", type: "boolean", default: !1 }, showIndex: { description: "", type: "boolean", default: !0 }, showLimits: { description: "", type: "boolean", default: !1 }, showPageInfo: { description: "", type: "boolean", default: !0 }, size: { description: "", type: "number", default: 20 }, sizeLimits: { description: "", type: "array", default: [ 10, 20, 30, 50, 100 ] }, onPageChange: { description: "", type: "string", default: "" }, onPageSizeChange: { description: "", type: "string", default: "" } } }, row: { type: "object", properties: { customRowStyle: { description: "", type: "object" }, disable: { description: "", type: "obejct" }, height: { description: "", type: "number", default: 30 }, showHovering: { type: "boolean", default: !0 }, wrapContent: { type: "boolean", default: !1 } } }, rowNumber: { description: "", type: "object", properties: { enable: { description: "", type: "boolean", default: !1 }, heading: { description: "", type: "string", default: "序号" }, width: { description: "", type: "number", default: 36 }, onClickRow: { description: "", type: "string", default: "" }, onDoubleClickRow: { description: "", type: "string", default: "" } } }, selection: { type: "object", properties: { enableSelectRow: { description: "允许选中行", type: "boolean", default: !0 }, enable: { description: "", type: "boolean", default: !0 }, checkOnSelect: { description: "", type: "boolean", default: !1 }, clearSelectionOnEmpty: { description: "", type: "boolean", default: !0 }, customSelectionItem: { description: "", type: "object" }, focusSelection: { description: "", type: "string", default: "current", enum: [ "current", "all" ] }, keepSelectingOnClick: { description: "", type: "boolean", default: !0 }, keepSelectingOnPaging: { description: "", type: "boolean", default: !0 }, multiSelect: { description: "", type: "boolean", default: !1 }, selectionMode: { description: "", type: "string", default: "default" }, selectOnCheck: { description: "", type: "boolean", default: !1 }, selectOnEditing: { description: "", type: "boolean", default: !1 }, showCheckbox: { description: "", type: "boolean", default: !1 }, showCheckAll: { description: "", type: "boolean", default: !1 }, showSelection: { description: "", type: "boolean", default: !1 }, onBeforeSelect: { description: "", type: "string", default: "" }, onBeforeUnCheck: { description: "", type: "", default: "" }, onBeforeUnSelect: { description: "", type: "string", default: "" }, onCheckAll: { description: "", type: "string", default: "" }, onChecked: { description: "", type: "string", default: "" }, onSelectionChange: { description: "", type: "string", default: "" }, onUnCheckAll: { description: "", type: "string", default: "" }, onUnChecked: { description: "", type: "string", default: "" }, onCheckedChange: { description: "", type: "string" } } }, sort: { type: "object", properties: { enable: { description: "", type: "boolean", default: !1 }, fields: { description: "", type: "array", default: [] }, mode: { description: "", type: "string", default: "client", enum: [ "client", "server" ] }, multiSort: { description: "", type: "boolean", default: !1 } } }, summary: { description: "", type: "object", properties: { enable: { description: "", type: "boolean", default: !1 }, customSummaryStyle: { description: "", type: "object" }, groupFields: { description: "", type: "array", default: [] }, mode: { description: "", type: "string", default: "client", enum: [ "client", "server" ] }, position: { description: "", type: "boolean", default: "bottom", enum: [ "bottom", "top", "both" ] } } }, toolbar: { description: "", type: "object", properties: { enable: { description: "", type: "boolean", default: !1 } } }, visualization: { autoHeight: { description: "", type: "boolean", default: !1 }, emptyDataHeight: { description: "", type: "number", default: 36 }, emptyTemplate: { description: "", type: "string", default: "" }, maxHeight: { description: "", type: "number", default: 300 }, scrollBarShowMode: { description: "", type: "string", default: "auto" }, showBorder: { description: "", type: "boolean", default: !1 }, showScrollArrow: { description: "", type: "boolean", default: !1 }, striped: { description: "", type: "boolean", default: !0 }, useBlankWhenDataIsEmpty: { description: "", type: "boolean", default: !1 } }, onSelectionChange: { description: "行切换事件", type: "string", default: "" } }, sa = [ "id", "type", "columns" ], dn = { $schema: na, $id: oa, title: ra, description: aa, type: ia, properties: la, required: sa }, ju = { /** 启用分页 */ 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 } }, Lu = { /** 启用排序 */ enable: { type: Boolean, default: !1 }, /** 排序字段集合 */ fields: { type: Array, default: [] }, /** 排序交互模式 */ mode: { type: String, default: "client" }, /** 多列排序 */ multiSort: { type: Boolean, default: !1 } }, Hu = { /** 自定义分组合计内容 */ 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" } }, Wu = { /** 启用筛选 */ enable: { type: Boolean, default: !1 }, /** DataGrid筛选风格 */ filterStyle: { type: String, default: "filter-column" }, /** 筛选交互模式 */ mode: { type: String, default: "server" }, /** 显示过滤条件工具条 */ showSummary: { type: Boolean, default: !0 } }, Au = { /** 允许折行显示列标题 */ wrapHeadings: { type: Boolean, default: !1 } }, zu = { /** 自定义行样式 */ customRowStyle: { type: Function, default: () => { } }, /** 禁止行选中表达式 */ disable: { type: Function, default: () => { } }, /** 默认行高度为 29px */ height: { type: Number, default: 28 }, /** 鼠标滑过行效果 */ showHovering: { type: Boolean, default: !0 }, /** 禁止数据折行 */ wrapContent: { type: Boolean, default: !1 } }, Gu = { /** 显示合计信息 */ 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" } }, qu = { /** 自动列宽。设为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 } }, Uu = { /** 编辑时选中文本 */ selectOnEditing: { type: Boolean, default: !1 }, /** 编辑模式; row:整行编辑,cell: 单元格编辑 */ editMode: { type: String, default: "cell" } }, Yu = { /** show loading */ show: { type: Boolean, default: !1 }, /** message on display when loading */ message: { type: String, default: "加载中..." } }, Gt = { /** 自动勾选子节点 */ 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: { autoCheckChildren: !1, autoCheckParent: !1, selectionRange: "All" }, parentIdField: "parent" } }, /** DataGrid组件唯一标识 */ id: { type: String, default: "" }, /** 被绑定数据的标识字段 */ idField: { type: String, default: "id", require: !0 }, // 是否展示 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, size: -1 } }, /** 行号配置 */ rowNumber: { type: Object, default: { enable: !0, width: 32, heading: "序号" } }, /** 行配置 */ rowOption: { type: Object, default: { wrapContent: !1 } }, /** 选择配置 */ selection: { type: Object, default: { enableSelectRow: !0, multiSelect: !1, multiSelectMode: "DependOnCheck", showCheckbox: !1, showSelectAll: !1, showSelection: !0 } }, /** 已选数据标识 */ 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 } }, ua = vt(Gt, dn, un, cn), ca = Qr(), da = Kr(), fn = Object.assign({}, Gt, { componentId: { type: String, default: "" } }), fa = vt(fn, dn, un, cn), pa = Jr(); var Je = /* @__PURE__ */ ((e) => (e[e.readonly = 0] = "readonly", e[e.editable = 1] = "editable", e[e.editing = 2] = "editing", e))(Je || {}), ot = /* @__PURE__ */ ((e) => (e[e.initial = 0] = "initial", e[e.editing = 1] = "editing", e))(ot || {}), bt = /* @__PURE__ */ ((e) => (e[e.data = 0] = "data", e[e.group = 1] = "group", e[e.summary = 2] = "summary", e))(bt || {}), je = /* @__PURE__ */ ((e) => (e[e.none = 0] = "none", e[e.filterable = 1] = "filterable", e[e.sortable = 2] = "sortable", e[e.filtered = 4] = "filtered", e[e.sorted = 8] = "sorted", e[e.ascending = 16] = "ascending", e[e.descending = 32] = "descending", e))(je || {}); function ma(e, t) { var y; const n = String(Date.now()), o = ((y = e.rowOption) == null ? void 0 : y.height) || 28, r = S(t.value.primaryColumnsWidth); function i(w) { const R = {}; return w.reduce( (F, m, h) => { const x = h < w.length - 1 ? w[h + 1] : null; return h === 0 && (F[m.field] = { left: 0 }), m.actualWidth !== void 0 && (F[m.field].width = m.actualWidth), x && (F[x.field] = { left: F[m.field].left + (m.actualWidth || 0) }), F; }, R ), R; } function a(w, R, F) { const m = o * (F + 1), x = R[w.field].left - m + (R[w.field].width || 0), v = w.parent.height ? `${w.parent.height}px` : ""; return { left: `${m}px`, width: `${x}px`, height: `${v}` }; } function u(w, R, F) { return { right: "0px", height: `${w.parent.height ? `${w.parent.height}px` : ""}` }; } function s(w, R) { const F = w.parent.height ? `${w.parent.height}px` : ""; return { left: `${R[w.field].left}px`, height: `${F}`, width: isNaN(Number(R[w.field].width)) ? "100%" : `${R[w.field].width}px` }; } function p(w, R, F) { const h = (R.spanned || []).reduce((v, _) => v + (_.parent.height || 0), 0) + (w.height || 0); return { top: `${w.top}px`, left: `${F[R.field].left}px`, width: `${F[R.field].width}px`, height: `${h}px`, padding: `calc(${h / 2}px - 1rem) 0` // height: `calc(${rowHeight}px * ${cell.rowSpan})`, // padding: `calc(${rowHeight * cell.rowSpan / 2}px - 1rem) 0` }; } function d(w, R) { return `${n}_${w.type}_r_${w.index}_c_${R}_${w.refreshKey || ""}`; } function c(w) { return `${n}_${w.type}_r_${w.index}_${w.refreshKey || ""}`; } function f(w) { const R = w.height ? `${w.height}px` : ""; return { top: `${w.top}px`, width: isNaN(r.value) ? "100%" : `${r.value}px`, height: `${R}` }; } return Se(t, () => { r.value = t.value.primaryColumnsWidth; }), { calculateCellPositionInRow: i, cellKey: d, cellPosition: s, groupCellPosition: a, rowKey: c, rowPosition: f, rowSpanCellPosition: p, summaryCellPosition: u }; } function va(e, t, n) { const { hasChildrenField: o } = n, r = S("#9399a0"), i = S(28); function a() { return [].concat( ...t.value.filter((f) => f.raw.__fv_descendant_index__.length !== 0).map((f) => [...f.raw.__fv_descendant_index__.slice(-1)]).flat() ).sort((f, y) => Number(f) - Number(y)); } function u(d) { const c = new Array(t.value.length).fill(0); if (e.showLines) { const f = a(); t.value.forEach((y, w) => { const R = f.includes(w), F = y.raw[o.value]; c[w] = `repeating-linear-gradient(90deg, ${r.value} 0 1px, transparent 0px 2px) ${F ? "-10px" : "0px"} ${i.value / 2}px/20px 1px no-repeat,repeating-linear-gradient(${r.value} 0 1px, transparent 0px 2px) 0px 0px/1px ${R ? "50%" : "100%"} no-repeat`; }), c[0] = ""; } return c[d]; } function s(d, c, f) { return f[d].parents.set(d, !0).forEach((w) => { f[w].childsLength = f[w].childWithLines.filter((R) => c[R].visible).length; }), c; } function p(d) { const y = d.raw.__fv_parent_index__ === void 0 || d.raw.__fv_parent_index__ === -1 ? 0 : 8, w = 0, R = d.raw[o.value], F = d.visible ? { left: `${d.layer * 10 + d.layer * y + w}px`, // paddingBottom: handlePaddingBottomReturnValue(visualTreeNode.index), background: u(d.index), display: "flex", width: "100%", position: "relative", paddingLeft: "0.75rem" } : { display: "none" }; return R || (F.paddingLeft = "2rem"), F; } return { hierarchyCellContentStyle: p, handleCollapsedPaddingBottom: s }; } function ha(e, t, n) { const o = S(e.iconField); function r(i, a) { if (o.value) return i.raw[e.iconField]; let u = ""; return i.raw[n.value] !== !0 ? u = t.value.leafnodes : u = i.collapse ? t.value.fold : t.value.unfold, u; } return { treeNodeIconsClass: r }; } function ga(e, t, n, o, r, i, a, u) { const { dataView: s, fold: p, hasRealChildren: d, unFold: c, reOrderVisibleIndex: f } = o, { collapseField: y, hasChildrenField: w } = r, { reCalculateVisualDataRows: R, updateVirticalScroll: F } = i; function m(h) { if (h.raw[w.value]) { const v = s.value[h.raw.__fv_index__]; v[y.value] = !v[y.value], o.toggleChildrenVisibiltyByCollapseStatus(v), v[w.value] = d(v), f(), R(), F(); } t.emit("expandNode", { row: h }); } return { toggleTreeNode: m }; } function ya(e) { function t(r) { return {}; } function n(r) { const { valign: i, align: a } = r; return { "d-flex": !0, "h-100": !0, "w-100": !0, "justify-content-start": a !== "center" && a !== "right", "justify-content-center": a === "center", "justify-content-right": a === "right", "align-items-start": i !== "middle" && i !== "bottom", "align-items-center": i === "middle", "align-items-end": i === "bottom" }; } function o(r) { const { align: i, showEllipsis: a } = r; return { "w-100": !0, "text-left": i !== "center" && i !== "right", "text-center": i === "center", "text-right": i === "right", "text-truncate": a }; } return { cellContentPosition: t, cellContentClass: n, cellContentClassWithEllipsis: o }; } function ba(e, t, n, o, r, i, a, u, s, p, d, c, f) { const { onClickCell: y } = i, { gridRowClass: w, onClickRow: R, onMouseoverRow: F, onMouseoutRow: m } = u, { enableMultiSelect: h, select: x, unSelect: v, selectItem: _ } = s; S(e.cellHeight); const O = S(e.treeNodeIconsData || {}), { hasChildrenField: l, shouldShowCheckBox: g, shouldShowIcon: C } = a, { toggleTreeNode: T } = ga(e, t, o, r, a, d), { toggleSelectHierarchyItem: b } = p, { cellKey: D, cellPosition: B, rowKey: V, rowPosition: k } = ma(e, n), { cellContentClass: M, cellContentPosition: E, cellContentClassWithEllipsis: N } = ya(), { hierarchyCellContentStyle: W } = va(e, o, a), { treeNodeIconsClass: X } = ha(e, O, l); function oe(J, Z) { const xe = J.raw[l.value]; return { "fv-tree-node-toggle": xe && J.collapse, "fv-tree-node-toggle-minus": xe && !J.collapse }; } function ee(J, Z) { J.stopPropagation(), T(Z); } function pe(J, Z) { return I("div", { class: oe(J), onClick: (xe) => ee(xe, J) }, null); } function L(J, Z) { return C.value && I("div", { id: "treeNodeIcons", class: X(J, Z) }, null); } function j(J) { h.value ? (J.checked ? x(J) : v(J), b(J)) : _(J); } function A(J, Z) { return g.value && I(Io, { id: "checkbox_for_" + D(J, Z.index), indeterminate: J.indeterminate, disabled: J.disabled, checked: J.checked, "onUpdate:checked": (xe) => J.checked = xe, onChange: () => j(J) }, null); } function U(J, Z) { return I("span", { title: Z.data, style: "user-select:none" }, [t.slots.cellTemplate ? t.slots.cellTemplate({ cell: Z, row: J }) : Z.mode === Je.editing ? Z.getEditor(Z) : Z.formatter ? Z.formatter(Z, J) : Z.data != null ? Z.data.toString() : Z.data]); } function Q(J, Z) { return I("div", { class: M(Z), style: E(Z) }, [I("div", { class: N(Z) }, [Z.showTips ? I(Kt, null, { default: () => U(J, Z), contentTemplate: () => U(J, Z) }) : U(J, Z)])]); } function Y(J, Z, xe) { return I("div", { ref: Z.setRef, key: D(J, Z.index), class: "fv-grid-hierarchy-cell", style: B(Z, xe) }, [I("div", { style: W(J) }, [pe(J), L(J, Z), A(J, Z), Q(J, Z)])]); } function $(J, Z, xe) { return I("div", { ref: Z.setRef, key: D(J, Z.index), class: "fv-grid-cell", style: B(Z, xe), onClick: (Fe) => y(Fe, Z, J, Z.column) }, [I("div", { class: M(Z), style: E(Z) }, [I("div", { class: N(Z) }, [Z.showTips ? I(Kt, null, { default: () => U(J, Z), contentTemplate: () => U(J, Z) }) : U(J, Z)])])]); } function G(J, Z) { return Z === "left" && n.value.leftColumns.length > 0 && n.value.leftColumns[0].field === J.field || Z === "primary" && n.value.primaryColumns.length > 0 && n.value.primaryColumns[0].field === J.field; } function ae(J, Z, xe = "primary", Fe) { return I("div", { ref: J.setRef, key: V(J), class: w(J, Fe), style: k(J), onMouseover: (Te) => F(Te, J), onMouseout: (Te) => m(Te, J), onClick: (Te) => R(Te, J) }, [Object.values(J.data).filter((Te) => Z[Te.field] && Te.rowSpan === 1).map((Te) => G(Te, xe) ? Y(J, Te, Z) : $(J, Te, Z))]); } return { renderDataRow: ae }; } function Ca(e, t, n) { const { horizontalScrollThumbStyle: o, onMouseDownScrollThumb: r, shouldShowHorizontalScrollbar: i } = n; function a() { return i.value && I("div", { class: "fv-grid-horizontal-scroll" }, [I("div", { class: "fv-grid-horizontal-scroll-thumb", style: o.value, onMousedown: (u) => r(u, t, "horizontal") }, null)]); } return { renderHorizontalScrollbar: a }; } function wa() { function e(o, r) { switch (o.command) { case "edit": case "remove": return r.status === ot.initial; case "accept": case "cancel": return r.status === ot.editing; default: return !o.hidden; } } function t(o, r, i) { switch (o.onClick(r, i.dataIndex, i), o.command) { case "edit": i.status, ot.editing; break; case "accept": case "cancel": i.status, ot.initial; break; } } function n(o, r) { return o.commands && o.commands.map((i) => e(i, r) && I(Vo, { class: "ml-2", type: i.type, size: i.size || "small", onClick: (a) => t(i, a, r), style: { "margin-bottom": "3px" } }, { default: () => [pt(" "), i.text, pt(" ")] })); } return { renderCommandColumn: n }; } function _a(e) { const t = S(e.minHeight), n = S(e.minWidth), o = S(e.height), r = S(e.width), i = H(() => o.value <= 0 ? 0 : Math.max(o.value, t.value)), a = H(() => r.value <= 0 ? 0 : Math.max(r.value, n.value)); return Se([ () => e.height, () => e.width, () => e.minHeight, () => e.minWidth ], ([s, p, d, c]) => { t.value = Number(d), n.value = Number(c), o.value = Number(s), r.value = Number(p); }), { containerStyleObject: H(() => ({ height: i.value > 0 ? `${i.value}px` : e.fit ? "100%" : "", width: a.value > 0 ? `${a.value}px` : e.fit ? "100%" : "", flex: "1 1 0" })) }; } const Sa = ""; function xa(e) { const o = S({ 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 r() { o.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 = S(e.summary), a = H(() => { const x = i.value; return (x == null ? void 0 : x.groupFields) || []; }); function u() { o.value.rightColumns.forEach((_) => { _.showSetting = !1; }), o.value.primaryColumns.forEach((_) => { _.showSetting = !1; }); const x = o.value.rightColumns.filter((_) => _.visible), v = o.value.primaryColumns.filter((_) => _.visible); x.length > 0 ? x[x.length - 1].showSetting = !0 : v.length > 0 && (v[v.length - 1].showSetting = !0); } function s(x) { r(); const v = /* @__PURE__ */ new Map(); return a.value && a.value.reduce((_, O) => (_.set(O, !0), _), v), x.reduce((_, O) => (O.visible = O.visible !== !1, O.filter = O.filter || Sa, O.fixed === "left" ? (o.value.leftColumns.push(O), o.value.leftColumnsMap.set(O.field, O), o.value.leftColumnsWidth += O.actualWidth) : O.fixed === "right" ? (o.value.rightColumns.push(O), o.value.rightColumnsMap.set(O.field, O), o.value.rightColumnsWidth += O.actualWidth) : (o.value.primaryColumns.push(O), o.value.primaryColumnsMap.set(O.field, O), o.value.primaryColumnsWidth += O.actualWidth), v.has(O.field) && o.value.summaryColumns.push(O), _), o), u(), o; } s(e.columns); const p = H(() => o.value.leftColumns.length > 0), d = H(() => o.value.rightColumns.length > 0); function c(x, v) { return v.sortable && v.sort && v.sort !== "none" && x.push(v), x; } function f(x, v) { return x.sortOrder = x.sortOrder || 0, v.sortOrder = v.sortOrder || 0, x.sortOrder === v.sortOrder ? 0 : x.sortOrder < v.sortOrder ? -1 : 1; } function y(x, v) { return x.sortOrder = x.sortOrder || 0, v.sortOrder = v.sortOrder || 0, x.sortOrder === v.sortOrder ? 0 : x.sortOrder < v.sortOrder ? 1 : -1; } function w(x, v) { return v.filterable && x.push(v), x; } function R() { const x = []; return o.value.leftColumns.reduce(w, x), o.value.primaryColumns.reduce(w, x), o.value.rightColumns.reduce(w, x), x; } function F() { const x = []; o.value.leftColumns.reduce(c, x), o.value.primaryColumns.reduce(c, x), o.value.rightColumns.reduce(c, x); const v = Math.max(...x.map((_) => _.sortOrder || 0)); return x.sort(y).map((_) => { const O = _.sortOrder || v + 1; return _.sortOrder = O, _; }).sort(f).map((_, O) => { const l = O + 1; return _.sortOrder = l, _; }); } function m(x, v, _) { const O = x.map((l) => { const g = _.getSorterByColumn(l), C = l.sort === "asc", T = l.sort === "desc", b = C ? g.ascend : T ? g.decend : void 0; return { field: l.field, compare: b }; }); v.setSorters(O); } function h(x, v) { const _ = F();