UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,593 lines 262 kB
var Kn = Object.defineProperty; var eo = (t, e, n) => e in t ? Kn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n; var ee = (t, e, n) => eo(t, typeof e != "symbol" ? e + "" : e, n); import { ref as k, computed as L, createVNode as y, defineComponent as Te, watch as be, onMounted as Pe, Fragment as pt, reactive as He, createApp as ln, onUnmounted as mt, Transition as cn, mergeProps as Vt, nextTick as et, createTextVNode as un, inject as Ce, onBeforeMount as to, Teleport as no, shallowRef as oo, render as $t, h as io, cloneVNode as ro, provide as dn, onBeforeUnmount as ao, withModifiers as so } from "vue"; import { cloneDeep as Qe, isPlainObject as en, isUndefined as Ve } from "lodash-es"; import lo from "../response-toolbar/index.esm.js"; import { LocaleService as rt } from "../locale/index.esm.js"; import { getCustomClass as ve, withInstall as fn, FormSchemaEntityField$Type as tn, FormSchemaEntityFieldTypeName as nn } from "../common/index.esm.js"; import { useI18n as zt } from "vue-i18n"; import { useResizeObserver as co } from "@vueuse/core"; import { getHierarchyRow as uo, useIdentify as fo, useGroupData as po, useFilter as mo, useHierarchy as vo, useLoading as ho, useDataView as go, useSelection as yo, useSelectHierarchyItem as bo, usePagination as Co, useDataViewContainerStyle as wo, useCommandColumn as xo, useSettingColumn as So, useColumn as To, useSort as Mo, useGroupColumn as ko, useRow as Bo, useEdit as Eo, useVisualDataBound as Io, useVisualDataCell as Fo, useVisualDataRow as Po, useVisualData as Do, useCellPosition as Oo, useSidebar as Ro, useVirtualScroll as jo, useFitColumn as $o, useFilterHistory as No, useColumnFilter as Ao, useDragColumn as Lo, getColumnHeader as Vo, getSidebar as zo, getDisableMask as Ho, getHorizontalScrollbar as qo, getVerticalScrollbar as _o, getEmpty as Uo, getPagination as Wo, getSummary as Go } from "../data-view/index.esm.js"; import { getSchemaByTypeForDesigner as pn, createPropsResolver as mn, resolveAppearance as Yo } from "../dynamic-resolver/index.esm.js"; import { useDesignerInnerComponent as Xo, useDesignerComponent as Jo } from "../designer-canvas/index.esm.js"; import "../property-panel/index.esm.js"; import "../accordion/index.esm.js"; import "../avatar/index.esm.js"; import "../../designer/button-edit/index.esm.js"; import "../button-group/index.esm.js"; import "../calendar/index.esm.js"; import "../capsule/index.esm.js"; import "../../designer/checkbox/index.esm.js"; import "../../designer/checkbox-group/index.esm.js"; import "../combo-list/index.esm.js"; import "../combo-tree/index.esm.js"; import "../component/index.esm.js"; import "../color-picker/index.esm.js"; import "../content-container/index.esm.js"; import "../date-picker/index.esm.js"; import "../../designer/data-grid/index.esm.js"; import "../dropdown/index.esm.js"; import "../dynamic-form/index.esm.js"; import "../events-editor/index.esm.js"; import "../filter-bar/index.esm.js"; import "../field-selector/index.esm.js"; import "../binding-selector/index.esm.js"; import "../image-cropper/index.esm.js"; import "../../designer/input-group/index.esm.js"; import "../layout/index.esm.js"; import "../list-nav/index.esm.js"; import "../../designer/list-view/index.esm.js"; import "../lookup/index.esm.js"; import "../mapping-editor/index.esm.js"; import "../nav/index.esm.js"; import "../number-range/index.esm.js"; import "../number-spinner/index.esm.js"; import "../order/index.esm.js"; import "../page-header/index.esm.js"; import "../page-footer/index.esm.js"; import "../pagination/index.esm.js"; import "../progress/index.esm.js"; import "../query-solution/index.esm.js"; import "../../designer/radio-group/index.esm.js"; import "../rate/index.esm.js"; import "../response-layout/index.esm.js"; import "../response-layout-editor/index.esm.js"; import "../search-box/index.esm.js"; import "../section/index.esm.js"; import "../smoke-detector/index.esm.js"; import "../splitter/index.esm.js"; import "../step/index.esm.js"; import "../switch/index.esm.js"; import "../tabs/index.esm.js"; import "../tags/index.esm.js"; import "../text/index.esm.js"; import "../time-picker/index.esm.js"; import "../transfer/index.esm.js"; import "../tree-view/index.esm.js"; import "../uploader/index.esm.js"; import "../verify-detail/index.esm.js"; import "../video/index.esm.js"; import "../textarea/index.esm.js"; import "../schema-selector/index.esm.js"; import "../../designer/tree-grid/index.esm.js"; import "../event-parameter/index.esm.js"; import "../filter-condition-editor/index.esm.js"; import "../fieldset/index.esm.js"; import "../sort-condition-editor/index.esm.js"; import "../menu-lookup/index.esm.js"; import "../../designer/drawer/index.esm.js"; import "../json-editor/index.esm.js"; import "../property-editor/index.esm.js"; import "../expression-editor/index.esm.js"; import "../code-editor/index.esm.js"; import "../html-template/index.esm.js"; import "../collection-property-editor/index.esm.js"; import "../modal/index.esm.js"; import "../external-container/index.esm.js"; import "../language-textbox/index.esm.js"; import "../notify/index.esm.js"; function vn(t, e) { let n; function o(u) { const { properties: m, title: d, ignore: f } = u, b = f && Array.isArray(f), C = Object.keys(m).reduce((B, T) => ((!b || !f.find((E) => E === T)) && (B[T] = m[T].type === "object" && m[T].properties ? o(m[T]) : Qe(m[T].default)), B), {}); if (d && (!b || !f.find((B) => B === "id"))) { const B = d.toLowerCase().replace(/-/g, "_"); C.id = `${B}_${Math.random().toString().slice(2, 6)}`; } return C; } function i(u) { const { properties: m, title: d, required: f } = u; if (f && Array.isArray(f)) { const b = f.reduce((C, B) => (C[B] = m[B].type === "object" && m[B].properties ? o(m[B]) : Qe(m[B].default), C), {}); if (d && f.find((C) => C === "id")) { const C = d.toLowerCase().replace(/-/g, "_"); b.id = `${C}_${Math.random().toString().slice(2, 6)}`; } return b; } return { type: d }; } function r(u, m = {}, d) { const f = t[u]; if (f) { let b = i(f); const C = e[u]; return b = C ? C({ getSchemaByType: r }, b, m, d) : b, n != null && n.appendIdentifyForNewControl && n.appendIdentifyForNewControl(b), b; } return null; } function a(u, m) { const d = o(m); return Object.keys(d).reduce((f, b) => (Object.prototype.hasOwnProperty.call(u, b) && (f[b] && en(f[b]) && en(u[b] || !u[b]) ? Object.assign(f[b], u[b] || {}) : f[b] = u[b]), f), d), d; } function c(u, m) { return Object.keys(u).filter((f) => u[f] != null).reduce((f, b) => { if (m.has(b)) { const C = m.get(b); if (typeof C == "string") f[C] = u[b]; else { const B = C(b, u[b], u); Object.assign(f, B); } } else f[b] = u[b]; return f; }, {}); } function s(u, m, d = /* @__PURE__ */ new Map()) { const f = a(u, m); return c(f, d); } function l(u) { var d; const m = u.type; if (m) { const f = t[m]; if (!f) return u; const b = a(u, f), C = ((d = u.editor) == null ? void 0 : d.type) || ""; if (C) { const B = t[C], T = a(u.editor, B); b.editor = T; } return b; } return u; } function p(u) { n = u; } return { getSchemaByType: r, resolveSchemaWithDefaultValue: l, resolveSchemaToProps: s, mappingSchemaToProps: c, setDesignerContext: p }; } const hn = {}, gn = {}, { getSchemaByType: Ht, resolveSchemaWithDefaultValue: Qo, resolveSchemaToProps: Zo, mappingSchemaToProps: Ko, setDesignerContext: hc } = vn(hn, gn); function ei(t = {}) { function e(l, p, u, m) { if (typeof u == "number") return m[l].length === u; if (typeof u == "object") { const d = Object.keys(u)[0], f = u[d]; if (d === "not") return Number(m[l].length) !== Number(f); if (d === "moreThan") return Number(m[l].length) >= Number(f); if (d === "lessThan") return Number(m[l].length) <= Number(f); } return !1; } function n(l, p, u, m) { return m[l] && m[l].propertyValue && String(m[l].propertyValue.value) === String(u); } const o = /* @__PURE__ */ new Map([ ["length", e], ["getProperty", n] ]); Object.keys(t).reduce((l, p) => (l.set(p, t[p]), l), o); function i(l, p) { const u = l; return typeof p == "number" ? [{ target: u, operator: "length", param: null, value: Number(p) }] : typeof p == "boolean" ? [{ target: u, operator: "getProperty", param: l, value: !!p }] : typeof p == "object" ? Object.keys(p).map((m) => { if (m === "length") return { target: u, operator: "length", param: null, value: p[m] }; const d = m, f = p[m]; return { target: u, operator: "getProperty", param: d, value: f }; }) : []; } function r(l) { return Object.keys(l).reduce((u, m) => { const d = i(m, l[m]); return u.push(...d), u; }, []); } function a(l, p) { if (o.has(l.operator)) { const u = o.get(l.operator); return u && u(l.target, l.param, l.value, p) || !1; } return !1; } function c(l, p) { return r(l).reduce((d, f) => d && a(f, p), !0); } function s(l, p) { const u = Object.keys(l), m = u.includes("allOf"), d = u.includes("anyOf"), f = m || d, B = (f ? l[f ? m ? "allOf" : "anyOf" : "allOf"] : [l]).map((E) => c(E, p)); return m ? !B.includes(!1) : B.includes(!0); } return { parseValueSchema: s }; } const ti = { convertTo: (t, e, n, o) => { t.appearance || (t.appearance = {}), t.appearance[e] = n; }, convertFrom: (t, e, n) => t.appearance ? t.appearance[e] : t[e] }, ni = { convertFrom: (t, e, n) => t.buttons && t.buttons.length ? `共 ${t.buttons.length} 项` : "无" }, oi = { convertTo: (t, e, n, o) => { t.editor && (t.editor[e] = n); }, convertFrom: (t, e, n) => t.editor && Object.prototype.hasOwnProperty.call(t.editor, e) ? t.editor[e] : t[e] }, z = { 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: "多语输入框" } }, ii = { convertFrom: (t, e, n) => { var i; const o = t.editor && t.editor[e] ? t.editor[e] : t[e]; return ((i = z[o]) == null ? void 0 : i.name) || o; } }, ri = { convertTo: (t, e, n, o) => { t[e] = t[e]; }, convertFrom: (t, e, n) => t.editor ? n.getRealEditorType(t.editor.type) : "" }, ai = { convertTo: (t, e, n, o) => { (t.type === "data-grid-column" || t.type === "tree-grid-column") && (t.formatter ? t.formatter[e] = n : t.formatter = { [e]: n }); }, convertFrom: (t, e, n) => { if (t.formatter) { if (e === "trueText") return t.formatter.trueText; if (e === "falseText") return t.formatter.falseText; if (e === "prefix") return t.formatter.prefix; if (e === "suffix") return t.formatter.suffix; if (e === "precision") return t.formatter.precision; if (e === "decimal") return t.formatter.decimal; if (e === "thousand") return t.formatter.thousand; if (e === "tempDateFormat") return t.formatter.dateFormat === "yyyy年MM月dd日" ? "yearMonthDay" : t.formatter.dateFormat === "yyyy-MM-dd HH:mm:ss" ? "yyyy-MM-ddTHH:mm:ss" : t.formatter.dateFormat === "yyyy/MM/dd HH:mm:ss" ? "yyyy/MM/ddTHH:mm:ss" : t.formatter.dateFormat === "yyyy年MM月dd日 HH时mm分ss秒" ? "yearMonthDayHourMinuteSecond" : t.formatter.tempDateFormat || t.formatter.dateFormat || "yyyy-MM-dd"; if (e === "customFormat") return t.formatter.customFormat; if (e === "type") return t.formatter.type || "none"; } return "none"; } }, si = { convertTo: (t, e, n, o) => { t.command ? t.command[e] = n : t.command = { [e]: n }, e === "enable" && n && (t.command.commands || (t.command.commands = [ { text: "编辑", type: "primary", command: "edit" }, { text: "删除", type: "danger", command: "remove" } ])); }, convertFrom: (t, e, n) => t.command && e === "enable" ? t.command.enable : "" }, li = { convertTo: (t, e, n, o) => { t.column ? t.column[e] = n : t.column = { [e]: n }, e === "fitColumns" && n && (t.column.fitMode || (t.column.fitMode = "average")); }, convertFrom: (t, e, n) => { if (t.column) { if (e === "fitColumns") return t.column.fitColumns; if (e === "fitMode") return t.column.fitMode; } return ""; } }, ci = { convertTo: (t, e, n, o) => { t.summary ? t.summary[e] = n : t.summary = { [e]: n }, e === "enable" && n && (t.summary ? t.summary.groupFields || (t.summary.groupFields = []) : t.summary = { enable: n, groupFields: [] }); }, convertFrom: (t, e, n) => t.summary && e === "enable" ? t.summary.enable : t.type === "data-grid-column" ? t.enableSummary === void 0 ? !1 : t.enableSummary : "" }, ui = { convertTo: (t, e, n, o) => { t.group ? t.group[e] = n : t.group = { [e]: n }, e === "enable" && n && (t.group ? t.group.groupFields || (t.group.groupFields = []) : t.group = { enable: n, groupFields: [], showSummary: !1 }); }, convertFrom: (t, e, n) => { if (t.group) { if (e === "enable") return t.group.enable; if (e === "showSummary") return t.group.showSummary; } } }, di = { convertFrom: (t, e) => t.binding ? t.binding.path : "", convertTo: (t, e, n) => { if (n && n.length > 0) { const o = n[0]; t.binding || (t.binding = {}), t.binding.type = "Form", t.binding.path = o.bindingField, t.binding.field = o.id, t.binding.fullPath = o.path, t.path = o.bindingPath; } } }, fi = { convertTo: (t, e, n, o) => { t.pagination || (t.pagination = {}), t.pagination[e] = n; }, convertFrom: (t, e, n) => t.pagination ? t.pagination[e] : t[e] }, pi = { convertTo: (t, e, n, o) => { t.rowNumber || (t.rowNumber = {}), t.rowNumber[e] = n; }, convertFrom: (t, e, n) => t.rowNumber ? t.rowNumber[e] : t[e] }, mi = { convertTo: (t, e, n, o) => { t.selection || (t.selection = {}), t.selection[e] = n; }, convertFrom: (t, e, n) => t.selection ? t.selection[e] : t[e] }, vi = { convertFrom: (t, e, n) => t[e] && t[e].length ? `共 ${t[e].length} 项` : "" }, hi = { convertFrom: (t, e) => t[e] || "", convertTo: (t, e, n) => { t[e] = n; } }, gi = { convertTo: (t, e, n, o) => { t.size || (t.size = {}), t.size[e] = n; }, convertFrom: (t, e, n) => t.size ? t.size[e] : t[e] }, yi = { convertFrom: (t, e, n) => { var o, i; return (o = t.formatter) != null && o.data && e === "formatterEnumData" && !t.formatterEnumData ? (i = t.formatter) == null ? void 0 : i.data : t.formatterEnumData; } }, bi = { convertTo: (t, e, n, o) => { t.sort || (t.sort = {}), t.sort[e] = n; }, convertFrom: (t, e, n) => { var o, i; if (e === "mode") return ((o = t.sort) == null ? void 0 : o.mode) || "client"; if (e === "multiSort") return !!((i = t.sort) != null && i.multiSort); } }, Ci = { convertTo: (t, e, n, o) => { t.filter || (t.filter = {}), t.filter[e] = n; }, convertFrom: (t, e, n) => { var o; if (e === "mode") return ((o = t.filter) == null ? void 0 : o.mode) || "client"; } }, wi = { convertTo: (t, e, n, o) => { t.rowOption ? t.rowOption[e] = n : t.rowOption = { [e]: n }; }, convertFrom: (t, e, n) => { if (t.rowOption) { if (e === "customRowStyle") return t.rowOption.customRowStyle; if (e === "customCellStyle") return t.rowOption.customCellStyle; } return ""; } }; function yn(t, e, n) { const o = /* @__PURE__ */ new Map([ ["/converter/appearance.converter", ti], ["/converter/buttons.converter", ni], ["/converter/property-editor.converter", oi], ["/converter/items-count.converter", vi], ["/converter/type.converter", ii], ["/converter/change-editor.converter", ri], ["/converter/change-formatter.converter", ai], ["/converter/column-command.converter", si], ["/converter/column-option.converter", li], ["/converter/summary.converter", ci], ["/converter/group.converter", ui], ["/converter/form-group-label.converter", hi], ["/converter/field-selector.converter", di], ["/converter/pagination.converter", fi], ["/converter/row-number.converter", pi], ["/converter/grid-selection.converter", mi], ["/converter/size.converter", gi], ["/converter/change-formatter-enum.converter", yi], ["/converter/grid-sort.converter", bi], ["/converter/grid-filter.converter", Ci], ["/converter/row-option.converter", wi] ]), i = /* @__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 }] ]), r = ei(); function a(f, b) { return () => r.parseValueSchema(f, b); } function c(f, b, C) { return f.includes("visible") && b.visible !== void 0 ? typeof b.visible == "boolean" ? () => !!b.visible : b.visible === void 0 ? !0 : a(b.visible, C) : () => !0; } function s(f, b, C) { return f.includes("readonly") && b.readonly !== void 0 ? typeof b.readonly == "boolean" ? () => !!b.readonly : a(b.readonly, C) : () => !1; } function l(f, b) { const C = f.$converter || b; return typeof C == "string" && C && o.has(C) ? o.get(C) || null : C || null; } function p(f, b, C, B, T, E = "", v = "") { return Object.keys(f).map((x) => { const R = k(1), $ = x, I = f[x], F = Object.keys(I), S = I.title, w = I.type, g = i.get(w) || { type: "input-group", enableClear: !1 }, M = I.editor ? Object.assign({}, g, I.editor) : Object.assign({}, g), O = c(F, I, b), D = s(F, I, b); M.readonly = M.readonly === void 0 ? D() : M.readonly; const A = I.type === "cascade" ? p(I.properties, b, C, B, T, E, v) : [], P = !0; let N = l(I, v); const H = L({ get() { if (R.value) { if (["class", "style"].find((ue) => ue === $) && !N && (N = o.get("/converter/appearance.converter") || null), N && N.convertFrom) return N.convertFrom(C, x, T, E); const ae = C[x]; return Object.prototype.hasOwnProperty.call(I, "defaultValue") && (ae === void 0 || typeof ae == "string" && ae === "") ? I.type === "boolean" ? I.defaultValue : I.defaultValue || "" : ae; } return null; }, set(ae) { R.value += 1, N && N.convertTo ? (N.convertTo(B, x, ae, T, E), N.convertTo(C, x, ae, T, E)) : (B[x] = ae, C[x] = ae); } }), { refreshPanelAfterChanged: V, description: J, isExpand: K, parentPropertyID: te } = I, Y = { propertyID: $, propertyName: S, propertyType: w, propertyValue: H, editor: M, visible: O, readonly: D, cascadeConfig: A, hideCascadeTitle: P, refreshPanelAfterChanged: V, description: J, isExpand: K, parentPropertyID: te }; return b[$] = Y, Y; }); } function u(f, b, C = {}) { const B = {}, T = t[f]; return T && T.categories ? Object.keys(T.categories).map((v) => { const h = T.categories[v], x = h == null ? void 0 : h.title, R = p(h.properties || {}, B, {}, C, b); return { categoryId: v, categoryName: x, properties: R }; }) : []; } function m(f, b, C, B, T = "") { const E = b.$ref.schema, v = b.$ref.converter, h = C[E], x = h.type, R = n(h), $ = {}, I = t[x]; if (I && I.categories) { const F = I.categories[f], S = F == null ? void 0 : F.title; v && Object.keys(F.properties).forEach((M) => { F.properties[M].$converter = v; }); const w = (F == null ? void 0 : F.properties) || {}, g = p(w, $, R, h, B, T); return { categoryId: f, categoryName: S, properties: g }; } return { categoryId: f, categoryName: "", properties: [] }; } function d(f, b, C, B, T) { const E = f.type, v = n(f), h = {}; let x = T || t[E]; if (x && Object.keys(x).length === 0 && C && C.getPropConfig && (x = C.getPropConfig(B)), x && x.categories) { const R = []; return Object.keys(x.categories).map(($) => { const I = x.categories[$]; if (I.$ref) { R.push(m($, I, f, b, B)); return; } const F = I == null ? void 0 : I.title, S = I == null ? void 0 : I.tabId, w = I == null ? void 0 : I.tabName, g = I == null ? void 0 : I.hide, M = I == null ? void 0 : I.hideTitle, O = p(I.properties || {}, h, v, f, b, B, I.$converter), { setPropertyRelates: D } = I, A = I == null ? void 0 : I.parentPropertyID; R.push({ categoryId: $, categoryName: F, tabId: S, tabName: w, hide: g, properties: O, hideTitle: M, setPropertyRelates: D, parentPropertyID: A }); }), R; } return []; } return { getPropertyConfigBySchema: d, getPropertyConfigByType: u, propertyConverterMap: o }; } const bn = {}, Cn = {}; yn(bn, Cn, Qo); const wn = {}, xn = {}, { getSchemaByType: xi, resolveSchemaWithDefaultValue: Si, resolveSchemaToProps: gc, mappingSchemaToProps: yc, setDesignerContext: bc } = vn(wn, xn), Sn = {}, Tn = {}; yn(Sn, Tn, Si); function De(t, e, n = /* @__PURE__ */ new Map(), o = (a, c, s, l) => c, i = {}, r = (a) => a) { return hn[e.title] = e, gn[e.title] = o, bn[e.title] = i, Cn[e.title] = r, wn[e.title] = e, xn[e.title] = o, Sn[e.title] = i, Tn[e.title] = r, (a = {}, c = !0) => { if (!c) return Ko(a, n); const s = Zo(a, e, n), l = Object.keys(t).reduce((p, u) => (p[u] = t[u].default, p), {}); return Object.assign(l, s); }; } function xt(t, e) { return { customClass: e.class, customStyle: e.style }; } function Ti(t, e) { if (!t || t.length < 1) return null; for (const n of t) { if (n.id === e) return n; if (n.children) { const o = n.children.find((i) => i.id === e); if (o) return o; } } return null; } function Mi() { function t(e, n) { var c; const o = (c = e.toolbar) == null ? void 0 : c.buttons; if (!o || o.length < 1) return null; const [i, r] = n.payloads, a = Ti(o, r); return a ? a.onClick || a.click : null; } return { resolve: t }; } function ki(t, e, n) { return e ? { enableAccordion: n.accordionMode } : { enableAccordion: "" }; } function Bi(t, e) { var n; return { buttons: e.buttons, buttonPosition: e.position, buttonsClass: (n = e.appearance) == null ? void 0 : n.class, buttonsVisible: e.visible }; } const qt = /* @__PURE__ */ new Map([ ["appearance", xt], ["expanded", "expandStatus"], ["enableAccordion", ki], ["toolbar", Bi] ]); function Ei(t, e) { const n = Math.random().toString().slice(2, 6), o = e.parentComponentInstance, i = t.getSchemaByType("section"); Object.assign(i, { id: `section-${n}`, appearance: { class: "f-section-in-mainsubcard" }, mainTitle: e.mainTitle || i.mainTitle || "标题" }); const r = t.getSchemaByType("content-container"); Object.assign(r, { id: `container-${n}`, appearance: { class: "f-struct-wrapper" }, contents: [i] }); const a = o.schema; switch (a && a.type) { case z["splitter-pane"].type: { i.appearance.class = "f-section-in-main"; break; } } const c = o.elementRef, s = window.getComputedStyle(c); return s && s.display === "flex" && (r.appearance.class += " d-block"), r; } function Mn(t, e, n) { return n.parentComponentInstance ? Ei(t, n) : e; } const Ii = "https://json-schema.org/draft/2020-12/schema", Fi = "https://farris-design.gitee.io/section.schema.json", Pi = "section", Di = "A Farris Container Component", Oi = "object", Ri = { id: { description: "The unique identifier for a Section", type: "string" }, type: { description: "The type string of Section component", type: "string", default: "section" }, appearance: { description: "", type: "object", properties: { class: { type: "string" }, style: { type: "string" } }, default: {} }, contentClass: { description: "", type: "string", default: "" }, contents: { description: "", type: "array", default: [] }, enableAccordion: { description: "", type: "string", default: "" }, accordionMode: { description: "", type: "string", default: "default" }, enableMaximize: { description: "", type: "boolean", default: !1 }, expanded: { description: "", type: "boolean", default: !0 }, fill: { description: "", type: "boolean", default: !1 }, headerClass: { description: "", type: "string", default: "" }, size: { description: "", type: "object", properties: { width: { type: "number" }, height: { type: "number" } }, default: null }, showHeader: { description: "", type: "string", default: !0 }, mainTitle: { description: "", type: "string", default: "" }, subTitle: { description: "", type: "string", default: "" }, headerContentClass: { description: "", type: "string", default: "" }, extendClass: { description: "", type: "string", default: "" }, visible: { description: "", type: "boolean", default: !0 }, expandStatus: { description: "", type: "boolean", default: !0 }, toolbar: { description: "", type: "object", properties: { type: { type: "string", default: "section-toolbar" }, position: { type: "string", default: "inHead" }, buttons: { type: "array", default: [] }, appearance: { description: "", type: "object", properties: { class: { type: "string", default: "" } } } }, default: null }, headerTitleHtml: { description: "", type: "string", default: "" }, headerTitleRenderFunction: { description: "", type: "function", default: null }, headerHtml: { description: "", type: "string", default: "" }, headerRenderFunction: { description: "", type: "function", default: null }, headerContentHtml: { description: "", type: "string", default: "" }, headerContentRenderFunction: { description: "", type: "function", default: null }, toolbarHtml: { description: "", type: "string", default: "" }, toolbarRenderFunction: { description: "", type: "function", default: null } }, ji = [ "id", "type", "contents" ], kn = { $schema: Ii, $id: Fi, title: Pi, description: Di, type: Oi, properties: Ri, required: ji }, $i = "https://json-schema.org/draft/2020-12/schema", Ni = "https://farris-design.gitee.io/section-toolbar.schema.json", Ai = "section-toolbar", Li = "A Farris Toolbar Component", Vi = "object", zi = { id: { description: "The unique identifier for a Section Toolbar", type: "string" }, type: { description: "The type string of Section Toolbar", type: "string", default: "section-toolbar" }, appearance: { description: "", type: "object", properties: { class: { type: "string", default: "" } } }, alignment: { description: "The alignment of Section Toolbar Button.", type: "string", default: "right" }, buttons: { description: "The items of Section Toolbar.", type: "array", default: [] }, buttonSize: { type: "string", default: "" }, visible: { description: "", type: "boolean", default: !0 } }, Hi = [ "id", "type", "buttons" ], qi = { onClick: "点击事件" }, _i = { $schema: $i, $id: Ni, title: Ai, description: Li, type: Vi, properties: zi, required: Hi, events: qi }, Ui = /* @__PURE__ */ new Map([ ["buttons", "items"], ["appearance", xt] ]); function _t(t, e, n) { return e; } const Wi = "https://json-schema.org/draft/2020-12/schema", Gi = "https://farris-design.gitee.io/response-toolbar.schema.json", Yi = "response-toolbar", Xi = "A Farris Toolbar Component", Ji = "object", Qi = { id: { description: "The unique identifier for a Response Toolbar", type: "string" }, type: { description: "The type string of Response Toolbar", type: "string", default: "response-toolbar" }, appearance: { description: "", type: "object", properties: { class: { type: "string", default: "" } } }, alignment: { description: "The alignment of Response Toolbar Button.", type: "string", default: "right" }, buttons: { description: "The items of Response Toolbar.", type: "array", default: [] }, buttonSize: { type: "string", default: "" }, visible: { description: "", type: "boolean", default: !0 } }, Zi = [ "id", "type", "buttons" ], Ki = { onClick: "点击事件" }, er = { $schema: Wi, $id: Gi, title: Yi, description: Xi, type: Ji, properties: Qi, required: Zi, events: Ki }, tr = "https://json-schema.org/draft/2020-12/schema", nr = "https://farris-design.gitee.io/response-toolbar-item.schema.json", or = "response-toolbar-item", ir = "A Farris Toolbar Item Component", rr = "object", ar = { id: { description: "The unique identifier for a Response Toolbar", type: "string" }, type: { description: "The type string of Response Toolbar", type: "string", default: "response-toolbar-item" }, appearance: { description: "", type: "object", properties: { class: { type: "string", default: "" } } }, alignment: { description: "对齐", type: "string", default: "right" }, text: { description: "文本", type: "string", default: "按钮" }, icon: { description: "图标", type: "string", default: "" }, disabled: { description: "禁用", type: "boolean", default: !1 }, visible: { description: "是否可见", type: "boolean", default: !0 }, onClick: { description: "点击事件", type: "string", default: "" }, tipsEnable: { description: "", type: "boolean", default: !1 }, tipsText: { description: "", type: "string", default: "" }, dropdownClass: { description: "处于下拉菜单时的样式", type: "string", default: "" }, split: { description: "", type: "boolean", default: !1 } }, sr = [ "id", "type", "text" ], lr = { onClick: "点击事件" }, cr = { $schema: tr, $id: nr, title: or, description: ir, type: rr, properties: ar, required: sr, events: lr }, Ut = { id: { type: String, default: "" }, /** 组件自定义样式 */ customClass: { type: String, default: "" }, alignment: { Type: String, default: "right" }, items: { Type: Array, default: [] }, /** 控制是否可见 */ visible: { type: Boolean, default: !0 } }, ur = Object.assign({}, Ut, { componentId: { type: String, default: "" } }); De( Ut, er, Ui, _t ); const Bn = { id: { type: String, default: "" }, item: { type: Object, default: {} }, items: { type: Object, default: {} }, class: { type: String, default: "btn-secondary" }, text: { type: String, default: "" }, disabled: { type: Boolean, default: !1 }, icon: { type: String, default: "" }, componentId: { type: String, default: "" }, // 是否展开子级 expanded: { type: Boolean, default: !1 }, alignment: { Type: String, default: "right" }, // 下拉按钮分离 split: { type: Boolean, default: !1 }, // 是否下拉 isDP: { type: Boolean, default: !1 }, // 是否下拉项 isDPItem: { type: Boolean, default: !1 } }; De( Bn, cr, void 0, _t ); const Wt = { /** 设置内容区域样式 */ contentClass: { type: String, default: "" }, /** 自定义样式 */ customClass: { type: String, default: "" }, customStyle: { type: String, default: "" }, /** 设置是否启用収折功能。支持:空字符串,不启用収折 | default 默认収折方式 || custom自定义収折方式 */ enableAccordion: { type: String, default: "" }, /** 设置初始是否处于展开状态,支持:true 内容区域被展开|false 内容区域被収折 */ expandStatus: { type: Boolean, default: !0 }, /** 设置Section的主标题 */ mainTitle: { type: String, default: "" }, /** 设置是否显示头部区域 */ showHeader: { type: Boolean, default: !0 }, /** 设置Section的副标题 */ subTitle: { type: String, default: "" }, /** 展开文本 */ expandLabel: { type: String, default: "展开" }, /** 收起文本 */ collapseLabel: { type: String, default: "收起" }, /** 头部区域的自定义样式。配置头部自定义模板后,此属性有效。 */ headerClass: { type: String, default: "" }, /** 设置是否启用最大化 */ enableMaximize: { type: Boolean, default: !1 }, /** 头部扩展区域的自定义样式。配置头部扩展区域模板后,此属性有效。 */ headerContentClass: { type: String, default: "" }, /** 扩展区域的自定义样式。配置扩展区域模板后,此属性有效。 */ extendClass: { type: String, default: "" }, /** 按钮组 */ buttons: { type: Array, default: [] }, /** 按钮组的位置,inHead:头部区域| inContent:内容区域 */ buttonPosition: { type: String, default: "inHead" }, /** 按钮组整体样式*/ buttonsClass: { type: String, default: "" }, /** 按钮组是否可见*/ buttonsVisible: { type: Boolean, default: !0 }, /** 设置是否铺满剩余空间,支持:false按照内容自动高度|true 铺满剩余空间 */ fill: { type: Boolean, default: !1 }, /** 控制是否可见 */ visible: { type: Boolean, default: !0 }, /** 标题 */ headerTitleRenderFunction: { type: Function }, /** 头部区域 */ headerRenderFunction: { type: Function }, /** 头部扩展区区域 */ headerContentRenderFunction: { type: Function }, /** 工具栏区域 */ toolbarRenderFunction: { type: Function } // 暂未使用该属性 // clickThrottleTime: { type: Number, default: 350 }, // context: { type: Object }, // 暂未使用该属性 // index: { type: Number }, // maxStatus: { type: Boolean, default: false }, // showToolbarMoreButton: { type: Boolean, default: true }, // 暂未使用该属性 // toolbarPosition: { type: String, default: '' }, // toolbarButtons: { type: Array<object>, default: [] }, // toolbar: { type: Object as PropType<ToolbarConfig>, default: {} } }, dr = De(Wt, kn, qt, Mn), fr = Mi(), En = Object.assign( {}, Wt, { componentId: { type: String, default: "" }, headerTitleHtml: { type: String, default: "" }, headerHtml: { type: String, default: "" }, headerContentHtml: { type: String, default: "" }, toolbarHtml: { type: String, default: "" } } ), pr = De( Ut, _i, qt, _t ), mr = De(En, kn, qt, Mn); function In(t, e, n) { let o; function i(s = 1) { const l = [ "body>.f-datagrid-settings-simple-host", "body>div", "body>farris-dialog>.farris-modal.show", "body>.farris-modal.show", "body>farris-filter-panel>.f-filter-panel-wrapper", "body .f-sidebar-show>.f-sidebar-main", "body>.popover.show", "body>filter-row-panel>.f-datagrid-filter-panel", "body>.f-section-maximize" ], p = Array.from(document.body.querySelectorAll(l.join(","))).filter((m) => m).map((m) => { const { display: d, zIndex: f } = window.getComputedStyle(m); return d === "none" ? 0 : parseInt(f, 10); }).filter((m) => m); let u = Math.max(...p); return u < 1040 && (u = 1040), u + s; } function r() { o = t.value.nextElementSibling; const s = document && document.querySelector("body"); s && (s.appendChild(t.value), t.value.style.zIndex = i()); } function a() { o ? e.value.insertBefore( t.value, o ) : e.value.appendChild(t.value), t.value.style.zIndex = null; } function c() { !t || !e.value || (n.value = !n.value, n.value ? r() : a()); } return { onClickMaxMinIcon: c }; } function Fn(t, e) { const n = k(t.buttons), o = L(() => t.buttonPosition === "inHead" ? "right" : "left"), i = L(() => "f-section-toolbar col-6" + (t.buttonPosition === "inHead" ? " f-toolbar f-section-header--toolbar" : " f-section-content--toolbar") + (t.buttonsClass ? " " + t.buttonsClass : "")), r = L(() => t.buttons && t.buttons.length > 0 && t.buttonPosition === "inHead"); function a(l, p) { e.emit("click", l, p); } function c() { return r.value && y(lo, { customClass: i.value, items: n.value, onClick: a, alignment: o.value, visible: t.buttonsVisible }, null); } function s() { return y("div", { class: i.value }, [y("div", { class: "w-100", style: "flex:1" }, [t.toolbarRenderFunction()])]); } return () => t.toolbarRenderFunction ? s() : c(); } function vr(t, e, n, o, i, r) { const a = { collapseLabel: rt.getRealPropertyValue(t.collapseLabel, "收起", "section.collapseLabel"), expandLabel: rt.getRealPropertyValue(t.expandLabel, "展开", "section.expandLabel") }, c = L(() => t.buttonPosition), s = Fn(t, e), { onClickMaxMinIcon: l } = In(o, i, r), p = L(() => t.enableMaximize), u = L(() => t.enableAccordion !== ""), m = L(() => { const v = { "f-section-header": !0 }; return e.slots.header && t.headerClass.split(" ").reduce((x, R) => (x[R] = !0, x), v), v; }); function d(v) { v.stopPropagation(), t.enableAccordion !== "" && (n.value = !n.value); } function f() { const v = L(() => ({ btn: !0, "f-btn-collapse-expand": !0, "f-btn-mx": !0, "f-state-expand": n.value })), h = L(() => ({ "f-icon": !0, "f-icon-maximize": !r.value, "f-icon-minimize": r.value })); return y("div", { class: "f-max-accordion" }, [p.value ? y("span", { class: h.value, onClick: l }, null) : "", u.value ? y("button", { class: v.value, onClick: d }, [y("span", null, [n.value ? a.collapseLabel : a.expandLabel])]) : ""]); } function b() { return y("div", { class: "f-title" }, [y("h4", { class: "f-title-text" }, [t.mainTitle]), t.subTitle && y("span", null, [t.subTitle])]); } function C() { const v = L(() => { const h = { "f-content": !0 }; return t.headerContentClass && t.headerContentClass.split(" ").reduce((R, $) => (R[$] = !0, R), h), h; }); return e.slots.headerContent ? y("div", { class: v.value }, [e.slots.headerContent()]) : t.headerContentRenderFunction ? y("div", { class: v.value }, [t.headerContentRenderFunction()]) : null; } function B() { return e.slots.headerTitle ? e.slots.headerTitle() : t.headerTitleRenderFunction ? t.headerTitleRenderFunction() : b(); } function T() { return y("div", { class: m.value }, [B(), C(), c.value === "inHead" && s(), (p.value || u.value) && f()]); } function E() { return e.slots.header ? y("div", { class: m.value }, [e.slots.header()]) : t.headerRenderFunction ? y("div", { class: m.value }, [t.headerRenderFunction()]) : T(); } return () => t.showHeader && E(); } const Ct = /* @__PURE__ */ Te({ name: "FSection", props: Wt, emits: ["click"], setup(t, e) { const n = k(), o = k(), i = k(t.customClass), r = L(() => t.enableAccordion), a = k(t.expandStatus), c = L(() => t.buttonPosition), s = k(!1), l = vr(t, e, a, n, o, s), p = Fn(t, e), u = L(() => { const C = { "f-section": !0, "f-section-accordion": r.value === "default", "f-state-collapse": (r.value === "default" || r.value === "custom") && !a.value, "f-section-custom-accordion": r.value === "custom", "f-section-fill": t.fill, "f-section-maximize": s.value }; return ve(C, i.value); }), m = L(() => ve({ "f-section-content": !0 }, t.contentClass)), d = L(() => ve({ "f-section-extend": !0 }, t.extendClass)); function f() { return e.slots.extend && y("div", { class: d.value }, [e.slots.extend()]); } function b() { return y("div", { class: m.value }, [c.value === "inContent" && p(), e.slots.default && e.slots.default()]); } return be(() => t.expandStatus, (C, B) => { C !== B && (a.value = C); }), Pe(() => { n.value && n.value && (o.value = n.value.parentElement); }), () => t.visible ? y("div", { class: u.value, ref: n, style: t.customStyle }, [l(), f(), b()]) : null; } }); function hr() { function t(e, n) { var a; if (!e) return !1; const o = ((a = e.targetContainer) == null ? void 0 : a.componentInstance) && e.targetContainer.componentInstance.value; if (!o) return !1; const i = o.schema.type, r = n == null ? void 0 : n.formSchemaUtils.getComponentById(o.belongedComponentId); return !((e.componentCategory === "input" || e.componentType === "form-group") && ![z["response-layout-item"].type, z["response-form"].type, z.fieldset.type].includes(i) || (e.componentType === z.tabs.type || e.componentType === z.section.type) && ((r == null ? void 0 : r.componentType) !== "frame" || ![z["content-container"].type, z["splitter-pane"].type, z["response-layout-item"].type].includes(i)) || [z["query-solution"].type, z["filter-bar"].type].includes(e.componentType) || e.componentType === z.fieldset.type && i !== z["response-form"].type); } return { basalDragulaRuleForContainer: t }; } const Ke = k(0); function gr(t, e) { const n = e.getBoundingClientRect(), o = t.getBoundingClientRect(), i = o.top >= n.top, r = o.top <= n.bottom; return i && r; } function Gt(t) { const e = t.querySelector(".component-btn-group"); if (!e) return; e.style.display = ""; const n = e.getBoundingClientRect(); if (!(n.top === 0 && n.left === 0)) { const o = e.querySelector("div"); if (o) { const i = o.getBoundingClientRect(); o.style.top = n.top + "px"; let r = n.left - i.width; const a = document.querySelector(".editorDiv"); if (a) { const c = a.getBoundingClientRect(); r < c.left && ({ left: r } = t.getBoundingClientRect()); } o.style.left = r + "px"; } } } function yr(t) { if (!window.scrollContainerList) return; const e = Array.from(window.scrollContainerList); if (e.length && e.length === 1) { const n = e[0], o = document.querySelector(`[id=${n}]`); if (o && o.contains(t)) return o; } } function Pn(t) { if (!t) return; const e = t.getBoundingClientRect(); if (e.width === 0 && e.height === 0) return; const n = t.querySelector(".component-btn-group"); if (n) { let o = !0; const i = yr(t); if (i && (o = gr(t, i)), !o) { n.style.display = "none"; return; } Gt(t); } } function br(t) { if (!t) return; let e; t.className.includes("dgComponentSelected") ? e = t : e = t.querySelector(".dgComponentSelected"), e && Pn(e); } function Cr(t) { const e = document.querySelector(".dgComponentSelected"); if (!e) return; const n = e.getBoundingClientRect(), o = t.getBoundingClientRect(), i = e.querySelector(".component-btn-group"); if (i) { const r = i.getBoundingClientRect(), a = o.top < n.top; r.top !== 0 && a && Gt(e); } } const wr = k(0); function xr() { wr.value++; } function Sr(t) { const { formSchemaUtils: e, formStateMachineUtils: n } = t; function o(s, l = "") { return { path: l + s.code, field: s.id, fullPath: s.code }; } function i(s, l = "") { return e.getViewModelById(s).states.map((u) => o(u, l)); } function r(s) { const l = e.getRootViewModelId(), p = i(s); if (s === l) return p; const u = i(l, "root-component."); return [...p, ...u]; } function a(s) { return s.binding && s.binding.path || s.id || ""; } function c() { return n && n.getRenderStates() || []; } return { getVariables: r, getControlName: a, getStateMachines: c }; } class Tr { constructor(e) { ee(this, "sessionVariables", [ { key: "CurrentSysOrgName", name: "当前组织Name", description: "当前组织Name" }, // { // key: "CurrentSysOrgCode", // name: "当前组织Code", // description: "当前组织Code" // }, { key: "CurrentSysOrgId", name: "当前组织Id", description: "当前组织Id" }, { key: "CurrentUserName", name: "当前用户Name", description: "当前用户Name" }, { key: "CurrentUserCode", name: "当前用户Code", description: "当前用户Code" }, { key: "CurrentUserId", name: "当前用户Id", description: "当前用户Id" }, { key: "CurrentLanguage", name: "当前语言编号", description: "当前登录的语言编号,例如简体中文返回'zh-CHS',英文返回'en',繁体中文'zh-CHT'" } ]); ee(this, "expressionNames", { compute: "计算表达式", dependency: "依赖表达式", validate: "验证表达式", dataPicking: "帮助前表达式", visible: "可见表达式", readonly: "只读表达式", required: "必填表达式" }); ee(this, "getExpressionConverter", (e, n) => ({ convertFrom: (o, i, r, a) => { const c = r.getExpressionRuleValue(e, n || i); return c && c.value || ""; }, convertTo: (o, i, r, a, c) => { var s; if (i === "dataPicking" && (r != null && r.target)) { const l = `${r.target}_dataPicking`; ((s = r.rules) == null ? void 0 : s.some( (u) => u.id === l && u.value )) ? o.dictPickingExpressionId = l : delete o.dictPickingExpressionId; } a.updateExpression(r); } })); this.formSchemaService = e; } getExpressionRule(e, n) { const o = this.formSchemaService.getExpressions(); if (!o) return ""; const i = o.find((a) => a.target === e); if (!i) return ""; const r = i.rules.find((a) => a.type === n); return r || ""; } // 获取上下文表单变量 getContextFormVariables() { const { module: e } = this.formSchemaService.getFormSchema(); if (!e.viewmodels || e.viewmodels.length === 0) return []; const n = this.formSchemaService.getRootViewModelId(), o = this.formSchemaService.getViewModelById(n); if (!o || !o.states || o.states.length === 0) return []; const i = []; return o.states.forEach((r) => { i.push({ key: r.code, name: r.name, description: r.name, category: r.category }); }), i; } createTreeNode(e, n, o = "label") { return { id: e.id, name: e.name, bindingPath: e[o], parents: n, type: "field" }; } buildEntityFieldsTreeData(e = null, n) { const o = []; return e == null || e.forEach((i) => { var c; const r = this.createTreeNode(i, n); let a = []; (c = i.type) != null && c.fields && (a = this.buildEntityFieldsTreeData(i.type.fields, [...n, i.label])), o.push({ data: r, children: a, expanded: !0 }); }), o; } b