UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,530 lines 163 kB
var an = Object.defineProperty; var ln = (t, e, n) => e in t ? an(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n; var G = (t, e, n) => ln(t, typeof e != "symbol" ? e + "" : e, n); import { ref as Y, computed as ee, defineComponent as Se, watch as we, createVNode as F, createTextVNode as Ie, Teleport as cn, getCurrentInstance as un, reactive as Oe, withDirectives as Ae, resolveDirective as Re, onMounted as ke, onUnmounted as gt, nextTick as Me, inject as de, provide as mt, onBeforeUnmount as dn, withModifiers as fn } from "vue"; import { cloneDeep as xe, isPlainObject as lt } from "lodash-es"; import pn from "../response-toolbar/index.esm.js"; import { getCustomClass as oe, useGuid as gn, withInstall as mn } from "../common/index.esm.js"; import { getSchemaByTypeForDesigner as ht } from "../dynamic-resolver/index.esm.js"; import { useI18n as hn } from "vue-i18n"; import { useDesignerInnerComponent as vn, useDesignerComponent as bn } from "../designer-canvas/index.esm.js"; function vt(t, e) { let n; function o(a) { const { properties: p, title: h, ignore: u } = a, l = u && Array.isArray(u), S = Object.keys(p).reduce((O, D) => ((!l || !u.find((R) => R === D)) && (O[D] = p[D].type === "object" && p[D].properties ? o(p[D]) : xe(p[D].default)), O), {}); if (h && (!l || !u.find((O) => O === "id"))) { const O = h.toLowerCase().replace(/-/g, "_"); S.id = `${O}_${Math.random().toString().slice(2, 6)}`; } return S; } function r(a) { const { properties: p, title: h, required: u } = a; if (u && Array.isArray(u)) { const l = u.reduce((S, O) => (S[O] = p[O].type === "object" && p[O].properties ? o(p[O]) : xe(p[O].default), S), {}); if (h && u.find((S) => S === "id")) { const S = h.toLowerCase().replace(/-/g, "_"); l.id = `${S}_${Math.random().toString().slice(2, 6)}`; } return l; } return { type: h }; } function i(a, p = {}, h) { const u = t[a]; if (u) { let l = r(u); const S = e[a]; return l = S ? S({ getSchemaByType: i }, l, p, h) : l, n != null && n.appendIdentifyForNewControl && n.appendIdentifyForNewControl(l), l; } return null; } function s(a, p) { const h = o(p); return Object.keys(h).reduce((u, l) => (Object.prototype.hasOwnProperty.call(a, l) && (u[l] && lt(u[l]) && lt(a[l] || !a[l]) ? Object.assign(u[l], a[l] || {}) : u[l] = a[l]), u), h), h; } function g(a, p) { return Object.keys(a).filter((u) => a[u] != null).reduce((u, l) => { if (p.has(l)) { const S = p.get(l); if (typeof S == "string") u[S] = a[l]; else { const O = S(l, a[l], a); Object.assign(u, O); } } else u[l] = a[l]; return u; }, {}); } function c(a, p, h = /* @__PURE__ */ new Map()) { const u = s(a, p); return g(u, h); } function m(a) { var h; const p = a.type; if (p) { const u = t[p]; if (!u) return a; const l = s(a, u), S = ((h = a.editor) == null ? void 0 : h.type) || ""; if (S) { const O = t[S], D = s(a.editor, O); l.editor = D; } return l; } return a; } function C(a) { n = a; } return { getSchemaByType: i, resolveSchemaWithDefaultValue: m, resolveSchemaToProps: c, mappingSchemaToProps: g, setDesignerContext: C }; } const bt = {}, yt = {}, { getSchemaByType: Ct, resolveSchemaWithDefaultValue: yn, resolveSchemaToProps: Cn, mappingSchemaToProps: wn, setDesignerContext: ur } = vt(bt, yt); function xn(t = {}) { function e(m, C, a, p) { if (typeof a == "number") return p[m].length === a; if (typeof a == "object") { const h = Object.keys(a)[0], u = a[h]; if (h === "not") return Number(p[m].length) !== Number(u); if (h === "moreThan") return Number(p[m].length) >= Number(u); if (h === "lessThan") return Number(p[m].length) <= Number(u); } return !1; } function n(m, C, a, p) { return p[m] && p[m].propertyValue && String(p[m].propertyValue.value) === String(a); } const o = /* @__PURE__ */ new Map([ ["length", e], ["getProperty", n] ]); Object.keys(t).reduce((m, C) => (m.set(C, t[C]), m), o); function r(m, C) { const a = m; return typeof C == "number" ? [{ target: a, operator: "length", param: null, value: Number(C) }] : typeof C == "boolean" ? [{ target: a, operator: "getProperty", param: m, value: !!C }] : typeof C == "object" ? Object.keys(C).map((p) => { if (p === "length") return { target: a, operator: "length", param: null, value: C[p] }; const h = p, u = C[p]; return { target: a, operator: "getProperty", param: h, value: u }; }) : []; } function i(m) { return Object.keys(m).reduce((a, p) => { const h = r(p, m[p]); return a.push(...h), a; }, []); } function s(m, C) { if (o.has(m.operator)) { const a = o.get(m.operator); return a && a(m.target, m.param, m.value, C) || !1; } return !1; } function g(m, C) { return i(m).reduce((h, u) => h && s(u, C), !0); } function c(m, C) { const a = Object.keys(m), p = a.includes("allOf"), h = a.includes("anyOf"), u = p || h, O = (u ? m[u ? p ? "allOf" : "anyOf" : "allOf"] : [m]).map((R) => g(R, C)); return p ? !O.includes(!1) : O.includes(!0); } return { parseValueSchema: c }; } const Tn = { convertTo: (t, e, n, o) => { t.appearance || (t.appearance = {}), t.appearance[e] = n; }, convertFrom: (t, e, n) => t.appearance ? t.appearance[e] : t[e] }, Sn = { convertFrom: (t, e, n) => t.buttons && t.buttons.length ? `共 ${t.buttons.length} 项` : "无" }, Pn = { 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] }, De = { 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: "多语输入框" } }, En = { convertFrom: (t, e, n) => { var r; const o = t.editor && t.editor[e] ? t.editor[e] : t[e]; return ((r = De[o]) == null ? void 0 : r.name) || o; } }, Mn = { convertTo: (t, e, n, o) => { t[e] = t[e]; }, convertFrom: (t, e, n) => t.editor ? n.getRealEditorType(t.editor.type) : "" }, Dn = { 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"; } }, kn = { 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 : "" }, Bn = { 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 ""; } }, In = { 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 : "" }, Fn = { 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; } } }, On = { 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; } } }, An = { convertTo: (t, e, n, o) => { t.pagination || (t.pagination = {}), t.pagination[e] = n; }, convertFrom: (t, e, n) => t.pagination ? t.pagination[e] : t[e] }, Rn = { convertTo: (t, e, n, o) => { t.rowNumber || (t.rowNumber = {}), t.rowNumber[e] = n; }, convertFrom: (t, e, n) => t.rowNumber ? t.rowNumber[e] : t[e] }, Nn = { convertTo: (t, e, n, o) => { t.selection || (t.selection = {}), t.selection[e] = n; }, convertFrom: (t, e, n) => t.selection ? t.selection[e] : t[e] }, $n = { convertFrom: (t, e, n) => t[e] && t[e].length ? `共 ${t[e].length} 项` : "" }, jn = { convertFrom: (t, e) => t[e] || "", convertTo: (t, e, n) => { t[e] = n; } }, Vn = { convertTo: (t, e, n, o) => { t.size || (t.size = {}), t.size[e] = n; }, convertFrom: (t, e, n) => t.size ? t.size[e] : t[e] }, _n = { convertFrom: (t, e, n) => { var o, r; return (o = t.formatter) != null && o.data && e === "formatterEnumData" && !t.formatterEnumData ? (r = t.formatter) == null ? void 0 : r.data : t.formatterEnumData; } }, Ln = { convertTo: (t, e, n, o) => { t.sort || (t.sort = {}), t.sort[e] = n; }, convertFrom: (t, e, n) => { var o, r; if (e === "mode") return ((o = t.sort) == null ? void 0 : o.mode) || "client"; if (e === "multiSort") return !!((r = t.sort) != null && r.multiSort); } }, qn = { 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"; } }, Hn = { 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 wt(t, e, n) { const o = /* @__PURE__ */ new Map([ ["/converter/appearance.converter", Tn], ["/converter/buttons.converter", Sn], ["/converter/property-editor.converter", Pn], ["/converter/items-count.converter", $n], ["/converter/type.converter", En], ["/converter/change-editor.converter", Mn], ["/converter/change-formatter.converter", Dn], ["/converter/column-command.converter", kn], ["/converter/column-option.converter", Bn], ["/converter/summary.converter", In], ["/converter/group.converter", Fn], ["/converter/form-group-label.converter", jn], ["/converter/field-selector.converter", On], ["/converter/pagination.converter", An], ["/converter/row-number.converter", Rn], ["/converter/grid-selection.converter", Nn], ["/converter/size.converter", Vn], ["/converter/change-formatter-enum.converter", _n], ["/converter/grid-sort.converter", Ln], ["/converter/grid-filter.converter", qn], ["/converter/row-option.converter", Hn] ]), r = /* @__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 }] ]), i = xn(); function s(u, l) { return () => i.parseValueSchema(u, l); } function g(u, l, S) { return u.includes("visible") && l.visible !== void 0 ? typeof l.visible == "boolean" ? () => !!l.visible : l.visible === void 0 ? !0 : s(l.visible, S) : () => !0; } function c(u, l, S) { return u.includes("readonly") && l.readonly !== void 0 ? typeof l.readonly == "boolean" ? () => !!l.readonly : s(l.readonly, S) : () => !1; } function m(u, l) { const S = u.$converter || l; return typeof S == "string" && S && o.has(S) ? o.get(S) || null : S || null; } function C(u, l, S, O, D, R = "", k = "") { return Object.keys(u).map((A) => { const P = Y(1), f = A, B = u[A], T = Object.keys(B), y = B.title, v = B.type, d = r.get(v) || { type: "input-group", enableClear: !1 }, b = B.editor ? Object.assign({}, d, B.editor) : Object.assign({}, d), M = g(T, B, l), w = c(T, B, l); b.readonly = b.readonly === void 0 ? w() : b.readonly; const I = B.type === "cascade" ? C(B.properties, l, S, O, D, R, k) : [], V = !0; let _ = m(B, k); const L = ee({ get() { if (P.value) { if (["class", "style"].find((N) => N === f) && !_ && (_ = o.get("/converter/appearance.converter") || null), _ && _.convertFrom) return _.convertFrom(S, A, D, R); const ne = S[A]; return Object.prototype.hasOwnProperty.call(B, "defaultValue") && (ne === void 0 || typeof ne == "string" && ne === "") ? B.type === "boolean" ? B.defaultValue : B.defaultValue || "" : ne; } return null; }, set(ne) { P.value += 1, _ && _.convertTo ? (_.convertTo(O, A, ne, D, R), _.convertTo(S, A, ne, D, R)) : (O[A] = ne, S[A] = ne); } }), { refreshPanelAfterChanged: q, description: Z, isExpand: X, parentPropertyID: J } = B, U = { propertyID: f, propertyName: y, propertyType: v, propertyValue: L, editor: b, visible: M, readonly: w, cascadeConfig: I, hideCascadeTitle: V, refreshPanelAfterChanged: q, description: Z, isExpand: X, parentPropertyID: J }; return l[f] = U, U; }); } function a(u, l, S = {}) { const O = {}, D = t[u]; return D && D.categories ? Object.keys(D.categories).map((k) => { const x = D.categories[k], A = x == null ? void 0 : x.title, P = C(x.properties || {}, O, {}, S, l); return { categoryId: k, categoryName: A, properties: P }; }) : []; } function p(u, l, S, O, D = "") { const R = l.$ref.schema, k = l.$ref.converter, x = S[R], A = x.type, P = n(x), f = {}, B = t[A]; if (B && B.categories) { const T = B.categories[u], y = T == null ? void 0 : T.title; k && Object.keys(T.properties).forEach((b) => { T.properties[b].$converter = k; }); const v = (T == null ? void 0 : T.properties) || {}, d = C(v, f, P, x, O, D); return { categoryId: u, categoryName: y, properties: d }; } return { categoryId: u, categoryName: "", properties: [] }; } function h(u, l, S, O, D) { const R = u.type, k = n(u), x = {}; let A = D || t[R]; if (A && Object.keys(A).length === 0 && S && S.getPropConfig && (A = S.getPropConfig(O)), A && A.categories) { const P = []; return Object.keys(A.categories).map((f) => { const B = A.categories[f]; if (B.$ref) { P.push(p(f, B, u, l, O)); return; } const T = B == null ? void 0 : B.title, y = B == null ? void 0 : B.tabId, v = B == null ? void 0 : B.tabName, d = B == null ? void 0 : B.hide, b = B == null ? void 0 : B.hideTitle, M = C(B.properties || {}, x, k, u, l, O, B.$converter), { setPropertyRelates: w } = B, I = B == null ? void 0 : B.parentPropertyID; P.push({ categoryId: f, categoryName: T, tabId: y, tabName: v, hide: d, properties: M, hideTitle: b, setPropertyRelates: w, parentPropertyID: I }); }), P; } return []; } return { getPropertyConfigBySchema: h, getPropertyConfigByType: a, propertyConverterMap: o }; } const xt = {}, Tt = {}; wt(xt, Tt, yn); const St = {}, Pt = {}, { getSchemaByType: Wn, resolveSchemaWithDefaultValue: Un, resolveSchemaToProps: dr, mappingSchemaToProps: fr, setDesignerContext: pr } = vt(St, Pt), Et = {}, Mt = {}; wt(Et, Mt, Un); function $e(t, e, n = /* @__PURE__ */ new Map(), o = (s, g, c, m) => g, r = {}, i = (s) => s) { return bt[e.title] = e, yt[e.title] = o, xt[e.title] = r, Tt[e.title] = i, St[e.title] = e, Pt[e.title] = o, Et[e.title] = r, Mt[e.title] = i, (s = {}, g = !0) => { if (!g) return wn(s, n); const c = Cn(s, e, n), m = Object.keys(t).reduce((C, a) => (C[a] = t[a].default, C), {}); return Object.assign(m, c); }; } function Dt(t, e) { return { customClass: e.class, customStyle: e.style }; } function zn(t, e) { var o, r; const n = {}; if (e != null && e.buttons) { const i = []; (o = e == null ? void 0 : e.buttons) == null || o.map((s) => { const g = {}; Object.keys(s).map((c) => { var m; c === "appearance" ? g.class = ((m = s[c]) == null ? void 0 : m.class) || "" : g[c] = s[c]; }), i.push(g); }), n.buttons = i; } return (r = e == null ? void 0 : e.appearance) != null && r.class && (n.buttonClass = e.appearance.class || "col-6"), e != null && e.id && (n.toolbarId = e.id), e && Object.prototype.hasOwnProperty.call(e, "visible") && (n.buttonsVisible = e.visible), n; } function kt(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((r) => r.id === e); if (o) return o; } } return null; } function Gn() { function t(e, n) { var g; const o = (g = e.toolbar) == null ? void 0 : g.buttons; if (!o || o.length < 1) return null; const [r, i] = n.payloads, s = kt(o, i); return s ? s.onClick || s.click : null; } return { resolve: t }; } function Yn() { function t(e, n) { const o = e.buttons; if (!o || o.length < 1) return null; const [r, i] = n.payloads, s = kt(o, i); return s ? s.onClick || s.click : null; } return { resolve: t }; } const Bt = /* @__PURE__ */ new Map([ ["appearance", Dt], ["toolbar", zn] // 内部处理可见、Id、样式、按钮 ]), Xn = "https://json-schema.org/draft/2020-12/schema", Qn = "https://farris-design.gitee.io/page-header.schema.json", Zn = "page-header", Jn = "A Farris Container Component", Kn = "object", eo = { id: { description: "The unique identifier for a Page Header", type: "string" }, type: { description: "The type string of Page Header component", type: "string", default: "page-header" }, appearance: { description: "", type: "object", properties: { class: { type: "string" }, style: { type: "string" } }, default: {} }, showIcon: { description: "", type: "boolean", default: !0 }, icon: { description: "", type: "string", default: "f-icon-page-title-record" }, iconClass: { description: "", type: "string", default: "f-text-orna-bill" }, title: { description: "", type: "string", default: "" }, subTitle: { description: "", type: "string", default: "" }, toolbar: { description: "", type: "object", properties: { appearance: { description: "", type: "object", properties: { class: { type: "string", default: "col-6" } } }, id: { description: "", type: "string" }, type: { description: "", type: "string", default: "response-toolbar" }, alignment: { description: "The alignment of Response Toolbar Button.", type: "string", default: "right" }, buttons: { description: "The items of Response Toolbar.", type: "array", default: [] }, visible: { description: "", type: "boolean", default: !0 } } }, buttonClass: { description: "", type: "string", default: "col-6" }, toolbarId: { description: "", type: "string", default: "" }, titleContentClass: { description: "", type: "string", default: "" }, contentClass: { description: "", type: "string", default: "" }, downContentClass: { description: "", type: "string", default: "" }, showPagination: { description: "", type: "boolean", default: !1 }, prePaginationDisabled: { description: "", type: "boolean", default: !0 }, nextPaginationDisabled: { description: "", type: "boolean", default: !1 }, visible: { description: "", type: "boolean", default: !0 }, buttonsVisible: { description: "", type: "boolean", default: !0 }, titleContentHtml: { description: "", type: "string", default: "" }, titleRenderFunction: { description: "", type: "function", default: null }, contentHtml: { description: "", type: "string", default: "" }, contentRenderFunction: { description: "", type: "function", default: null }, downContentHtml: { description: "", type: "string", default: "" }, downContentRenderFunction: { description: "", type: "function", default: null } }, to = [ "id", "type" ], It = { $schema: Xn, $id: Qn, title: Zn, description: Jn, type: Kn, properties: eo, required: to }; function Ft(t, e, n) { return e.title = "标题", e; } const Xe = { /** 组件自定义样式 */ customClass: { type: String, default: "" }, /** 是否显示图标 */ showIcon: { type: Boolean, default: !0 }, /** 图标的名称 */ icon: { type: String, default: "f-icon-page-title-record" }, /** 图标自定义样式,比如颜色、背景 */ iconClass: { type: String, default: "f-text-orna-bill" }, /** 主标题 */ title: { type: String, default: "" }, /** 副标题 */ subTitle: { type: String, default: "" }, /** 按钮组的样式 */ buttonClass: { type: String, default: "col-6" }, /** 按钮组的标识 */ toolbarId: { type: String, default: "" }, /** 按钮组 */ buttons: { type: Array, default: [] }, /** 标题区域模板自定义样式 */ titleContentClass: { type: String, default: "" }, /** 内容区域模板自定义样式 */ contentClass: { type: String, default: "" }, /** 下方扩展区域模板自定义样式 */ downContentClass: { type: String, default: "" }, /** 是否显示翻页图标 */ showPagination: { type: Boolean, default: !1 }, /** 向前翻页是否禁用 */ prePaginationDisabled: { type: Boolean, default: !0 }, /** 向后翻页是否禁用 */ nextPaginationDisabled: { type: Boolean, default: !1 }, /** 控制是否可见 */ visible: { type: Boolean, default: !0 }, /** 控制按钮是否可见 */ buttonsVisible: { type: Boolean, default: !0 }, /** 标题区域 */ titleRenderFunction: { type: Function }, /** 内容区域 */ contentRenderFunction: { type: Function }, /** 下方扩展区域 */ downContentRenderFunction: { type: Function } }, Ot = Object.assign({}, Xe, { componentId: { type: String, default: "" }, titleContentHtml: { type: String, default: "" }, contentHtml: { type: String, default: "" }, downContentHtml: { type: String, default: "" } }), no = $e(Xe, It, Bt, Ft), oo = $e(Ot, It, Bt, Ft), ro = Gn(), ze = /* @__PURE__ */ Se({ name: "FPageHeader", props: Xe, emits: ["click", "prePaginationClick", "nextPaginationClick"], setup(t, e) { const n = Y(t.buttons), o = (D, R) => { e.emit("click", D, R); }, r = ee(() => { const D = { "f-page-header": !0, "d-none": !t.visible }; return oe(D, t.customClass); }), i = ee(() => oe({ "f-title-icon": !0 }, t.iconClass)), s = ee(() => oe({ "f-icon": !0 }, t.icon)), g = ee(() => oe({ "f-title": !0 }, t.titleContentClass)), c = ee(() => oe({ "f-content": !0 }, t.contentClass)), m = ee(() => oe({ "f-page-header-extend": !0 }, t.downContentClass)), C = ee(() => ({ "f-icon f-icon-arrow-w": !0, "f-state-disabled": t.prePaginationDisabled })), a = ee(() => ({ "f-icon f-icon-arrow-e": !0, "f-state-disabled": t.nextPaginationDisabled })); function p(D) { t.prePaginationDisabled || e.emit("prePaginationClick", D); } function h(D) { t.nextPaginationDisabled || e.emit("nextPaginationClick", D); } function u() { return e.slots.titleContent ? F("div", { class: g.value }, [Ie(" "), e.slots.titleContent()]) : t.titleRenderFunction ? F("div", { class: g.value }, [t.titleRenderFunction()]) : F("div", { class: "f-title" }, [t.showIcon && t.icon ? F("span", { class: i.value }, [F("i", { class: s.value }, null)]) : "", F("h4", { class: "f-title-text" }, [t.title]), t.subTitle ? F("h5", { class: "f-title-subtitle" }, [t.subTitle]) : "", t.showPagination ? F("div", { class: "f-title-pagination" }, [F("span", { class: C.value, onClick: p }, null), F("span", { class: a.value, onClick: h }, null)]) : ""]); } function l() { return e.slots.content ? F("div", { class: c.value }, [Ie(" "), e.slots.content()]) : t.contentRenderFunction ? F("div", { class: c.value }, [t.contentRenderFunction()]) : null; } function S() { if (t.buttons && t.buttons.length > 0) return F(pn, { id: t.toolbarId, customClass: t.buttonClass, visible: t.buttonsVisible, items: n.value, onClick: o }, null); } function O() { return e.slots.downContent ? F("div", { class: m.value }, [Ie(" "), e.slots.downContent()]) : t.downContentRenderFunction ? F("div", { class: m.value }, [t.downContentRenderFunction()]) : null; } return we(() => t.buttons, (D) => { n.value = D; }, { deep: !0 }), () => t.visible ? F("div", { class: r.value }, [F("nav", { class: "f-page-header-base" }, [u(), l(), S()]), O()]) : null; } }); function io(t, e, n) { var y; const o = n && n.getStyles && n.getStyles() || "", r = n && n.getDesignerClass && n.getDesignerClass() || "", i = Y(); let s; function g() { return (e == null ? void 0 : e.schema.componentType) === "frame" ? !1 : n && n.checkCanMoveComponent ? n.checkCanMoveComponent() : !0; } function c() { return !1; } function m() { return (e == null ? void 0 : e.schema.componentType) === "frame" ? !1 : n && n.checkCanDeleteComponent ? n.checkCanDeleteComponent() : !0; } function C() { return (e == null ? void 0 : e.schema.componentType) === "frame" ? !0 : n && n.hideNestedPaddingInDesginerView ? n.hideNestedPaddingInDesginerView() : !1; } function a(v) { if (!v || !v.value) return null; if (v.value.schema && v.value.schema.type === "component") return v.value; const d = Y(v == null ? void 0 : v.value.parent), b = a(d); return b || null; } function p(v = e) { var w; if (n != null && n.getDraggableDesignItemElement) return n.getDraggableDesignItemElement(v); const { componentInstance: d, designerItemElementRef: b } = v; if (!d || !d.value) return null; const { getCustomButtons: M } = d.value; return d.value.canMove || M && ((w = M()) != null && w.length) ? b : p(v.parent); } function h(v) { return !!n && n.canAccepts(v); } function u() { return (e == null ? void 0 : e.schema.label) || (e == null ? void 0 : e.schema.title) || (e == null ? void 0 : e.schema.name); } function l() { } function S(v, d) { var b; !v || !d || (n != null && n.onAcceptMovedChildElement && n.onAcceptMovedChildElement(v, d), (b = e == null ? void 0 : e.setupContext) == null || b.emit("dragEnd")); } function O(v, d) { const { componentType: b } = v; let M = ht(b, v, d); n && n.onResolveNewComponentSchema && (M = n.onResolveNewComponentSchema(v, M)); const w = b.toLowerCase().replace(/-/g, "_"); return M && !M.id && M.type === b && (M.id = `${w}_${Math.random().toString().slice(2, 6)}`), M; } function D(v) { v && n != null && n.onChildElementMovedOut && n.onChildElementMovedOut(v); } function R(...v) { if (n && n.getPropsConfig) return n.getPropsConfig(...v); } function k(v) { if (!v) return; const d = e == null ? void 0 : e.schema, { formSchemaUtils: b } = v; if (d && b.getExpressions().length) { const M = b.getExpressions().findIndex((w) => w.target === d.id); M > -1 && b.getExpressions().splice(M, 1); } } function x(v) { if (!v || !(e != null && e.schema)) return; const d = e.schema, { formSchemaUtils: b } = v; b.removeCommunicationInComponent(d); } function A(v) { n && n.onRemoveComponent && n.onRemoveComponent(), k(v), x(v), e != null && e.schema.contents && e.schema.contents.map((d) => { let b = d.id; d.type === "component-ref" && (b = d.component); const M = t.value.querySelectorAll(`#${b}-design-item`); M != null && M.length && Array.from(M).map((w) => { var I; (I = w == null ? void 0 : w.componentInstance) != null && I.value.onRemoveComponent && w.componentInstance.value.onRemoveComponent(v); }); }); } function P() { if (n && n.getCustomButtons) return n.getCustomButtons(); } function f(v) { var b, M; if (!((b = e == null ? void 0 : e.schema) != null && b.id)) return; if (!s && v && (s = v.formSchemaUtils), n != null && n.setComponentBasicInfoMap) { n.setComponentBasicInfoMap(); return; } let d = ""; if (n != null && n.getComponentTitle) d = n.getComponentTitle(); else { const { text: w, title: I, label: V, mainTitle: _, name: L, type: q } = e.schema; d = w || I || V || _ || L || ((M = De[q]) == null ? void 0 : M.name); } d && s.getControlBasicInfoMap().set(e.schema.id, { componentTitle: d, parentPathName: d }); } function B(v) { var w; const { changeObject: d } = v, { propertyID: b, propertyValue: M } = d; if (["text", "title", "label", "name", "mainTitle"].includes((w = v == null ? void 0 : v.changeObject) == null ? void 0 : w.propertyID) && b && M && (f(), s)) { const I = s.getControlBasicInfoMap(), V = I.keys().toArray().filter((_) => { var L, q; return ((L = I.get(_)) == null ? void 0 : L.reliedComponentId) === ((q = e == null ? void 0 : e.schema) == null ? void 0 : q.id); }); V != null && V.length && V.forEach((_) => { const L = I.get(_).parentPathName.split(" > "); L[0] = M, I.get(_).parentPathName = L.join(" > "); }); } } function T(v) { if (B(v), n && n.onPropertyChanged) return n.onPropertyChanged(v); } return i.value = { canMove: g(), canSelectParent: c(), canDelete: m(), canNested: !C(), contents: e == null ? void 0 : e.schema.contents, elementRef: t, parent: (y = e == null ? void 0 : e.parent) == null ? void 0 : y.componentInstance, schema: e == null ? void 0 : e.schema, styles: o, designerClass: r, canAccepts: h, getBelongedComponentInstance: a, getDraggableDesignItemElement: p, getDraggingDisplayText: u, getPropConfig: R, getDragScopeElement: l, onAcceptMovedChildElement: S, onChildElementMovedOut: D, addNewChildComponentSchema: O, triggerBelongedComponentToMoveWhenMoved: !!n && n.triggerBelongedComponentToMoveWhenMoved || Y(!1), triggerBelongedComponentToDeleteWhenDeleted: !!n && n.triggerBelongedComponentToDeleteWhenDeleted || Y(!1), onRemoveComponent: A, getCustomButtons: P, onPropertyChanged: T, setComponentBasicInfoMap: f, updateContextSchema: e == null ? void 0 : e.updateContextSchema }, i; } const so = Y(0); function ao() { so.value++; } const Te = Y(0); function lo(t, e) { const n = e.getBoundingClientRect(), o = t.getBoundingClientRect(), r = o.top >= n.top, i = o.top <= n.bottom; return r && i; } function At(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 r = o.getBoundingClientRect(); o.style.top = n.top + "px"; let i = n.left - r.width; const s = document.querySelector(".editorDiv"); if (s) { const g = s.getBoundingClientRect(); i < g.left && ({ left: i } = t.getBoundingClientRect()); } o.style.left = i + "px"; } } } function co(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 Rt(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 r = co(t); if (r && (o = lo(t, r)), !o) { n.style.display = "none"; return; } At(t); } } function uo(t) { if (!t) return; let e; t.className.includes("dgComponentSelected") ? e = t : e = t.querySelector(".dgComponentSelected"), e && Rt(e); } function fo(t) { const { formSchemaUtils: e, formStateMachineUtils: n } = t; function o(c, m = "") { return { path: m + c.code, field: c.id, fullPath: c.code }; } function r(c, m = "") { return e.getViewModelById(c).states.map((a) => o(a, m)); } function i(c) { const m = e.getRootViewModelId(), C = r(c); if (c === m) return C; const a = r(m, "root-component."); return [...C, ...a]; } function s(c) { return c.binding && c.binding.path || c.id || ""; } function g() { return n && n.getRenderStates() || []; } return { getVariables: i, getControlName: s, getStateMachines: g }; } class po { constructor(e) { G(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'" } ]); G(this, "expressionNames", { compute: "计算表达式", dependency: "依赖表达式", validate: "验证表达式", dataPicking: "帮助前表达式", visible: "可见表达式", readonly: "只读表达式", required: "必填表达式" }); G(this, "getExpressionConverter", (e, n) => ({ convertFrom: (o, r, i, s) => { const g = i.getExpressionRuleValue(e, n || r); return g && g.value || ""; }, convertTo: (o, r, i, s, g) => { var c; if (r === "dataPicking" && (i != null && i.target)) { const m = `${i.target}_dataPicking`; ((c = i.rules) == null ? void 0 : c.some( (a) => a.id === m && a.value )) ? o.dictPickingExpressionId = m : delete o.dictPickingExpressionId; } s.updateExpression(i); } })); this.formSchemaService = e; } getExpressionRule(e, n) { const o = this.formSchemaService.getExpressions(); if (!o) return ""; const r = o.find((s) => s.target === e); if (!r) return ""; const i = r.rules.find((s) => s.type === n); return i || ""; } // 获取上下文表单变量 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 r = []; return o.states.forEach((i) => { r.push({ key: i.code, name: i.name, description: i.name, category: i.category }); }), r; } 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((r) => { var g; const i = this.createTreeNode(r, n); let s = []; (g = r.type) != null && g.fields && (s = this.buildEntityFieldsTreeData(r.type.fields, [...n, r.label])), o.push({ data: i, children: s, expanded: !0 }); }), o; } buildChildEntityTreeData(e = null, n) { const o = []; return e == null || e.forEach((r) => { var c, m; const i = this.createTreeNode(r, n); i.type = "entity"; const s = this.buildEntityFieldsTreeData((c = r.type) == null ? void 0 : c.fields, [...n, r.label]), g = this.buildChildEntityTreeData((m = r.type) == null ? void 0 : m.entities, [...n, r.label]); g != null && g.length && (s == null || s.push(...g)), o.push({ data: i, children: s || [], // 空值回退 expanded: !0 }); }), o; } getEntitiesTreeData() { const e = this.formSchemaService.getSchemaEntities(); if (!(e != null && e.length)) return []; const n = e[0]; if (!(n != null && n.type)) return []; const o = this.buildEntityFieldsTreeData(n.type.fields, [n.code]), r = this.buildChildEntityTreeData(n.type.entities, [n.code]); return r != null && r.length && (o == null || o.push(...r)), { entityCode: n.code, fields: [{ data: this.createTreeNode(n, [], "code"), children: o || [] }] }; } getEntitiesAndVariables() { return { entities: this.getEntitiesTreeData(), variables: { session: { name: "系统变量", items: this.sessionVariables, visible: !1 }, forms: { name: "表单变量", items: this.getContextFormVariables(), visible: !0 } } }; } onBeforeOpenExpression(e, n, o) { const r = o === "Field" ? e.binding.field : e.id, i = this.getExpressionRule(r, n), s = this.getEntitiesAndVariables(), g = { message: ["validate", "required", "dataPicking"].includes(n) && i ? i.message : "", ...s }; return i.messageType != null && (g.messageType = i.messageType), g; } buildRule(e, n, o, r) { const { expression: i, message: s, messageType: g } = n, c = { id: `${e}_${o}`, type: o, value: i }; return (o === "validate" || o === "dataPicking" || o === "required") && (c.message = s), o === "dataPicking" && (c.messageType = g), o === "validate" && r && (c.elementId = r), c; } getExpressionData() { const { expressions: e } = this.formSchemaService.getFormSchema().module; return e || []; } updateExpression(e, n, o, r) { const i = n === "Field" ? e.binding.field : e.id, s = this.buildRule(i, o, r, e.type === "form-group" ? e.id : ""); let c = this.getExpressionData().find((C) => C.targetType === n && C.target === i); const m = (C) => C.value.trim() === ""; if (c) { const C = c.rules.find((a) => a.id === s.id); if (C) m(s) ? c.rules = c.rules.filter((a) => a.id !== s.id) : (Object.assign(C, s), r === "validate" && e.type === "form-group" && (C.elementId = e.id)); else { if (m(s)) return null; c.rules = c.rules || [], c.rules.push(s); } } else { if (m(s)) return null; c = { target: `${i}`, rules: [s], targetType: n }; } return c; } getExpressionEditorOptions(e, n, o, r) { return o.reduce((i, s) => { var c, m; const g = n === "Field" ? (c = e == null ? void 0 : e.binding) == null ? void 0 : c.field : e.id; return i[s] = { hide: n === "Field" ? !!((m = e == null ? void 0 : e.binding) != null && m.field) : !1, description: "", title: this.expressionNames[s], type: "string", $converter: this.getExpressionConverter(g), refreshPanelAfterChanged: !0, editor: { type: "expression-editor", singleExpand: !1, dialogTitle: `${this.expressionNames[s]}编辑器`, showMessage: s === "validate" || s === "dataPicking" || s === "required", showMessageType: s === "dataPicking", beforeOpen: () => this.onBeforeOpenExpression(e, s, n), onSubmitModal: (C) => { const a = this.updateExpression(e, n, C, s); if (r) { const p = this.buildRule(g, C, s); r(p); } return a; } } }, i; }, {}); } getExpressionInfo(e, n, o) { const r = n === "Field" ? e.binding.field : e.id, i = this.getExpressionRule(r, o), s = { value: i && i.value, targetId: r, targetType: n, expressionType: o }; return i && i.message && (s.message = i.message), s; } getExpressionConfig(e, n, o = ["compute", "dependency", "validate"], r) { return { description: "表达式", title: "表达式", hide: !e.binding, properties: { ...this.getExpressionEditorOptions(e, n, o, r) } }; } getExpressionOptions(e, n, o) { const r = this.getExpressionInfo(e, n, o); return { dialogTitle: `${this.expressionNames[o]}编辑器`, singleExpand: !1, showMessage: o === "required", beforeOpen: () => this.onBeforeOpenExpression(e, o, n), expressionInfo: r }; } } class je { constructor(e, n) { G(this, "componentId"); G(this, "viewModelId"); G(this, "eventsEditorUtils"); G(this, "formSchemaUtils"); G(this, "formMetadataConverter"); G(this, "designViewModelUtils"); G(this, "designViewModelField"); G(this, "controlCreatorUtils"); G(this, "designerHostService"); G(this, "designerContext"); G(this, "schemaService", null); G(this, "metadataService", null); G(this, "propertyConfig", { type: "object", categories: {} }); var o; this.componentId = e, this.designerHostService = n, this.eventsEditorUtils = n.eventsEditorUtils, this.formSchemaUtils = n.formSchemaUtils, this.formMetadataConverter = n.formMetadataConverter, this.viewModelId = ((o = this.formSchemaUtils) == null ? void 0 : o.getViewModelIdByComponentId(e)) || "", this.designViewModelUtils = n.designViewModelUtils, this.controlCreatorUtils = n.controlCreatorUtils, this.metadataService = n.metadataService, this.schemaService = n.schemaService, this.designerContext = n.designerContext; } getFormDesignerInstance() { var e, n; return (n = (e = this.designerContext) == null ? void 0 : e.instances) == null ? void 0 : n.formDesigner.value; } getTableInfo() { var e; return (e = this.schemaService) == null ? void 0 : e.getTableInfoByViewModelId(this.viewModelId); } setDesignViewModelField(e) { var o; const n = e.binding && e.binding.type === "Form" && e.binding.field; if (n) { if (!this.designViewModelField) { const r = this.designViewModelUtils.getDgViewModel(this.viewModelId); this.designViewModelField = r.fields.find((i) => i.id === n); } e.updateOn = (o = this.designViewModelField) == null ? void 0 : o.updateOn; } } getBasicPropConfig(e) { return { description: "Basic Information", title: "基本信息", properties: { id: { description: "组件标识", title: "标识", type: "string", readonly: !0 }, type: { description: "组件类型", title: "控件类型", type: "select", editor: { type: "combo-list", textField: "name", valueField: "value", idField: "value", editable: !1, data: [{ value: e.type, name: De[e.type] && De[e.type].name }] } } } }; } getAppearanceConfig(e = null, n = {}, o) { const r = { title: "外观", description: "Appearance" }, i = { class: { title: "class样式", type: "string", description: "组件的CSS样式", $converter: "/converter/appearance.converter", parentPropertyID: "appearance" }, style: { title: "style样式", type: "string", description: "组件的样式", $converter: "/converter/appearance.converter", parentPropertyID: "appearance" } }; for (const s in n) i[s] = Object.assign(i[s] || {}, n[s]); return { ...r, properties: { ...i }, setPropertyRelates(s, g) { if (s) { switch (s && s.propertyID) { case "class": case "style": { Te.value++; break; } } o && o(s, e, g); } } }; } getPropertyEditorParams(e, n = [], o = "visible", r = {}, i = {}) { const { getVariables: s, getControlName: g, getStateMachines: c } = fo(this.designerHostService), m = this.getRealTargetType(e), C = n && n.length > 0 ? n : ["Const", "Variable", "StateMachine", "Expression"], a = { type: "property-editor", propertyTypes: C }; return C.map((p