UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,353 lines 87.3 kB
var Ce = Object.defineProperty; var Ae = (i, t, e) => t in i ? Ce(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e; var b = (i, t, e) => Ae(i, typeof t != "symbol" ? t + "" : t, e); import { ref as B, computed as G, defineComponent as te, watch as X, createVNode as Y, nextTick as Fe, inject as $, onMounted as Ee } from "vue"; import { isPlainObject as K, cloneDeep as Z } from "lodash-es"; import { resolveAppearance as we } from "../dynamic-resolver/index.esm.js"; import { getCustomClass as ie, FormSchemaEntityField$Type as _, FormSchemaEntityFieldType$Type as xe, withInstall as Ie } from "../common/index.esm.js"; import { DgControl as f, canvasChanged as U, refreshCanvas as Me, useDesignerComponent as Se } from "../designer-canvas/index.esm.js"; function ne(i, t) { let e; function n(o) { const { properties: m, title: h, ignore: a } = o, u = a && Array.isArray(a), y = Object.keys(m).reduce((v, C) => ((!u || !a.find((w) => w === C)) && (v[C] = m[C].type === "object" && m[C].properties ? n(m[C]) : Z(m[C].default)), v), {}); if (h && (!u || !a.find((v) => v === "id"))) { const v = h.toLowerCase().replace(/-/g, "_"); y.id = `${v}_${Math.random().toString().slice(2, 6)}`; } return y; } function r(o) { const { properties: m, title: h, required: a } = o; if (a && Array.isArray(a)) { const u = a.reduce((y, v) => (y[v] = m[v].type === "object" && m[v].properties ? n(m[v]) : Z(m[v].default), y), {}); if (h && a.find((y) => y === "id")) { const y = h.toLowerCase().replace(/-/g, "_"); u.id = `${y}_${Math.random().toString().slice(2, 6)}`; } return u; } return { type: h }; } function s(o, m = {}, h) { const a = i[o]; if (a) { let u = r(a); const y = t[o]; return u = y ? y({ getSchemaByType: s }, u, m, h) : u, e != null && e.appendIdentifyForNewControl && e.appendIdentifyForNewControl(u), u; } return null; } function l(o, m) { const h = n(m); return Object.keys(h).reduce((a, u) => (Object.prototype.hasOwnProperty.call(o, u) && (a[u] && K(a[u]) && K(o[u] || !o[u]) ? Object.assign(a[u], o[u] || {}) : a[u] = o[u]), a), h), h; } function g(o, m) { return Object.keys(o).filter((a) => o[a] != null).reduce((a, u) => { if (m.has(u)) { const y = m.get(u); if (typeof y == "string") a[y] = o[u]; else { const v = y(u, o[u], o); Object.assign(a, v); } } else a[u] = o[u]; return a; }, {}); } function c(o, m, h = /* @__PURE__ */ new Map()) { const a = l(o, m); return g(a, h); } function p(o) { var h; const m = o.type; if (m) { const a = i[m]; if (!a) return o; const u = l(o, a), y = ((h = o.editor) == null ? void 0 : h.type) || ""; if (y) { const v = i[y], C = l(o.editor, v); u.editor = C; } return u; } return o; } function d(o) { e = o; } return { getSchemaByType: s, resolveSchemaWithDefaultValue: p, resolveSchemaToProps: c, mappingSchemaToProps: g, setDesignerContext: d }; } const re = {}, oe = {}, { resolveSchemaWithDefaultValue: Pe, resolveSchemaToProps: Te, mappingSchemaToProps: ke } = ne(re, oe); function Ve(i = {}) { function t(p, d, o, m) { if (typeof o == "number") return m[p].length === o; if (typeof o == "object") { const h = Object.keys(o)[0], a = o[h]; if (h === "not") return Number(m[p].length) !== Number(a); if (h === "moreThan") return Number(m[p].length) >= Number(a); if (h === "lessThan") return Number(m[p].length) <= Number(a); } return !1; } function e(p, d, o, m) { return m[p] && m[p].propertyValue && String(m[p].propertyValue.value) === String(o); } const n = /* @__PURE__ */ new Map([ ["length", t], ["getProperty", e] ]); Object.keys(i).reduce((p, d) => (p.set(d, i[d]), p), n); function r(p, d) { const o = p; return typeof d == "number" ? [{ target: o, operator: "length", param: null, value: Number(d) }] : typeof d == "boolean" ? [{ target: o, operator: "getProperty", param: p, value: !!d }] : typeof d == "object" ? Object.keys(d).map((m) => { if (m === "length") return { target: o, operator: "length", param: null, value: d[m] }; const h = m, a = d[m]; return { target: o, operator: "getProperty", param: h, value: a }; }) : []; } function s(p) { return Object.keys(p).reduce((o, m) => { const h = r(m, p[m]); return o.push(...h), o; }, []); } function l(p, d) { if (n.has(p.operator)) { const o = n.get(p.operator); return o && o(p.target, p.param, p.value, d) || !1; } return !1; } function g(p, d) { return s(p).reduce((h, a) => h && l(a, d), !0); } function c(p, d) { const o = Object.keys(p), m = o.includes("allOf"), h = o.includes("anyOf"), a = m || h, v = (a ? p[a ? m ? "allOf" : "anyOf" : "allOf"] : [p]).map((w) => g(w, d)); return m ? !v.includes(!1) : v.includes(!0); } return { parseValueSchema: c }; } const Oe = { convertTo: (i, t, e, n) => { i.appearance || (i.appearance = {}), i.appearance[t] = e; }, convertFrom: (i, t, e) => i.appearance ? i.appearance[t] : i[t] }, Be = { convertFrom: (i, t, e) => i.buttons && i.buttons.length ? `共 ${i.buttons.length} 项` : "无" }, Le = { convertTo: (i, t, e, n) => { i.editor && (i.editor[t] = e); }, convertFrom: (i, t, e) => i.editor && Object.prototype.hasOwnProperty.call(i.editor, t) ? i.editor[t] : i[t] }, Ne = { 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: "标签页工具栏按钮" }, "drawer-toolbar-item": { type: "drawer-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: "标签页工具栏" }, "drawer-toolbar": { type: "drawer-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: "多语输入框" }, image: { type: "image", name: "图像" }, "discussion-editor": { type: "discussion-editor", name: "评论编辑区" }, "discussion-list": { type: "discussion-list", name: "评论列表" }, comment: { type: "comment", name: "评论区" }, "rich-text-editor": { type: "rich-text-editor", name: "富文本", icon: "rich-text-box" }, calendar: { type: "calendar", name: "日历", icon: "date-picker" }, wizard: { type: "wizard", name: "向导", icon: "wizard" }, "wizard-page": { type: "wizard-page", name: "向导页", icon: "wizard" }, "wizard-page-detail": { type: "wizard-page-detail", name: "向导详情", icon: "wizard" }, step: { type: "step", name: "步骤条", icon: "step" }, "dynamic-form": { type: "dynamic-form", name: "动态表单" } }, Re = { convertFrom: (i, t, e) => { var r; const n = i.editor && i.editor[t] ? i.editor[t] : i[t]; return ((r = Ne[n]) == null ? void 0 : r.name) || n; } }, Ge = { convertTo: (i, t, e, n) => { i[t] = i[t]; }, convertFrom: (i, t, e) => i.editor ? e.getRealEditorType(i.editor.type) : "" }, je = { convertTo: (i, t, e, n) => { (i.type === "data-grid-column" || i.type === "tree-grid-column") && (i.formatter ? i.formatter[t] = e : i.formatter = { [t]: e }); }, convertFrom: (i, t, e) => { if (i.formatter) { if (t === "trueText") return i.formatter.trueText; if (t === "falseText") return i.formatter.falseText; if (t === "prefix") return i.formatter.prefix; if (t === "suffix") return i.formatter.suffix; if (t === "precision") return i.formatter.precision; if (t === "decimal") return i.formatter.decimal; if (t === "thousand") return i.formatter.thousand; if (t === "dateFormat") return i.formatter.dateFormat || "yyyy-MM-dd"; if (t === "customFormat") return i.formatter.customFormat; if (t === "type") return i.formatter.type || "none"; if (t === "customFormat") return i.formmater.customFormat; } return "none"; } }, Ue = { convertTo: (i, t, e, n) => { i.command ? i.command[t] = e : i.command = { [t]: e }, t === "enableType" && e === "default" && (i.command.enable = !0, i.command.commands = [ { text: "编辑", type: "primary", command: "edit" }, { text: "删除", type: "danger", command: "remove" } ]), t === "enableType" && e === "custom" && (i.command.enable = !0, i.command.commands = [ { value: "add", text: "增加", type: "link" }, { value: "edit", text: "编辑", type: "danger" }, { value: "remove", text: "删除", type: "remove" } ]), t === "enableType" && e === "unable" && (i.command.enable = !1); }, convertFrom: (i, t, e) => { var n, r; if (i.command) { if (t === "enableType") { const s = (r = (n = i.command) == null ? void 0 : n.commands) == null ? void 0 : r.find((l) => l.command === "edit" && l.type === "primary"); return i.command.enable ? s ? "default" : "custom" : "unable"; } if (t === "commands") return i.command.enableType === "custom" ? i.command.commands : []; if (t === "formatter") return i.command.formatter; if (t === "count") return i.command.count; if (t === "columnWidth") return i.command.columnWidth || 200; } return ""; } }, Ye = { convertTo: (i, t, e, n) => { i.column ? i.column[t] = e : i.column = { [t]: e }, t === "fitColumns" && e && (i.column.fitMode || (i.column.fitMode = "average")); }, convertFrom: (i, t, e) => { if (i.column) { if (t === "fitColumns") return i.column.fitColumns; if (t === "fitMode") return i.column.fitMode; } return ""; } }, ze = { convertTo: (i, t, e, n) => { i.summary ? i.summary[t] = e : i.summary = { [t]: e }, t === "enable" && e && (i.summary ? i.summary.groupFields || (i.summary.groupFields = []) : i.summary = { enable: e, groupFields: [] }); }, convertFrom: (i, t, e) => { var n, r; return t === "customSummaryStyle" ? i.summary.customSummaryStyle : t === "position" ? ((n = i.summary) == null ? void 0 : n[t]) || "bottom" : t === "customRender" ? ((r = i.summary) == null ? void 0 : r[t]) || "" : i.summary && t === "enable" ? i.summary.enable : i.type === "data-grid-column" ? i.enableSummary === void 0 ? !1 : i.enableSummary : ""; } }, qe = { convertTo: (i, t, e, n) => { i.group ? i.group[t] = e : i.group = { [t]: e }, t === "enable" && e && (i.group ? i.group.groupFields || (i.group.groupFields = []) : i.group = { enable: e, groupFields: [], showSummary: !1, customRender: "" }); }, convertFrom: (i, t, e) => { if (i.group) { if (t === "enable") return i.group.enable; if (t === "showSummary") return i.group.showSummary; if (t === "customRender") return i.group.customRender; if (t === "groupFields") return i.group.groupFields; } } }, We = { convertFrom: (i, t) => i.binding ? i.binding.path : "", convertTo: (i, t, e) => { if (e && e.length > 0) { const n = e[0]; i.binding || (i.binding = {}), i.binding.type = "Form", i.binding.path = n.bindingField, i.binding.field = n.id, i.binding.fullPath = n.path, i.path = n.bindingPath; } } }, Je = { convertTo: (i, t, e, n) => { i.pagination || (i.pagination = {}), t === "sizeLimits" ? i.pagination.sizeLimits = e.split(",") : i.pagination[t] = e; }, convertFrom: (i, t, e) => i.pagination ? t === "sizeLimits" ? i.pagination.sizeLimits.join(",") : i.pagination[t] : i[t] }, He = { convertTo: (i, t, e, n) => { i.rowNumber || (i.rowNumber = {}), i.rowNumber[t] = e; }, convertFrom: (i, t, e) => i.rowNumber ? i.rowNumber[t] : i[t] }, Ze = { convertTo: (i, t, e, n) => { i.selection || (i.selection = {}), i.selection[t] = e; }, convertFrom: (i, t, e) => { var n, r; return t === "showCheckbox" ? (n = i.selection) != null && n.multiSelect ? !0 : (r = i.selection) == null ? void 0 : r.showCheckbox : i.selection ? i.selection[t] : i[t]; } }, Qe = { convertFrom: (i, t, e) => i[t] && i[t].length ? `共 ${i[t].length} 项` : "" }, De = { convertFrom: (i, t) => i[t] || "", convertTo: (i, t, e) => { i[t] = e; } }, Xe = { convertTo: (i, t, e, n) => { i.size || (i.size = {}), i.size[t] = e; }, convertFrom: (i, t, e) => i.size ? i.size[t] : i[t] }, $e = { convertFrom: (i, t, e) => { var n, r; return (n = i.formatter) != null && n.data && t === "formatterEnumData" && !i.formatterEnumData ? (r = i.formatter) == null ? void 0 : r.data : i.formatterEnumData; } }, Ke = { convertTo: (i, t, e, n) => { i.sort || (i.sort = {}), i.sort[t] = e; }, convertFrom: (i, t, e) => { var n, r; if (t === "mode") return ((n = i.sort) == null ? void 0 : n.mode) || "client"; if (t === "multiSort") return !!((r = i.sort) != null && r.multiSort); } }, _e = { convertTo: (i, t, e, n) => { i.filter || (i.filter = {}), i.filter[t] = e; }, convertFrom: (i, t, e) => { var n; if (t === "mode") return ((n = i.filter) == null ? void 0 : n.mode) || "client"; } }, et = { convertTo: (i, t, e, n) => { i.rowOption ? i.rowOption[t] = e : i.rowOption = { [t]: e }; }, convertFrom: (i, t, e) => { if (i.rowOption) { if (t === "customRowStyle") return i.rowOption.customRowStyle; if (t === "customCellStyle") return i.rowOption.customCellStyle; if (t === "height") return i.rowOption.height; } return ""; } }, tt = { convertTo: (i, t, e, n) => { (i.type === "data-grid-column" || i.type === "tree-grid-column") && (i[t] = e, t === "columnTemplateType" && e === "hyperlink" && (i.onClickLinkCommand ? i.columnTemplate = ` <span class="f-pretend-link f-cursor-pointer" @click="(ctx)=>viewModel.current.${i.onClickLinkCommand || ""}({id: rowData.id,context: ctx})"> {{rowData.${i.field}}} </span>` : i.columnTemplate = ` <span class="f-pretend-link f-cursor-pointer"> {{rowData.${i.field}}} </span>`), t === "columnTemplateType" && e === "default" && (i.columnTemplate = ""), t === "columnTemplateType" && e === "custom" && (i.columnTemplate = "")); }, convertFrom: (i, t, e) => t === "columnTemplate" ? i.columnTemplate : t === "columnTemplateType" ? i.columnTemplateType ? i.columnTemplateType || "default" : i.columnTemplate && !i.onClickLinkCommand ? "custom" : i.columnTemplate && i.onClickLinkCommand ? "hyperlink" : "default" : "" }; function se(i, t, e) { const n = /* @__PURE__ */ new Map([ ["/converter/appearance.converter", Oe], ["/converter/buttons.converter", Be], ["/converter/property-editor.converter", Le], ["/converter/items-count.converter", Qe], ["/converter/type.converter", Re], ["/converter/change-editor.converter", Ge], ["/converter/change-formatter.converter", je], ["/converter/column-command.converter", Ue], ["/converter/column-option.converter", Ye], ["/converter/summary.converter", ze], ["/converter/group.converter", qe], ["/converter/form-group-label.converter", De], ["/converter/field-selector.converter", We], ["/converter/pagination.converter", Je], ["/converter/row-number.converter", He], ["/converter/grid-selection.converter", Ze], ["/converter/size.converter", Xe], ["/converter/change-formatter-enum.converter", $e], ["/converter/grid-sort.converter", Ke], ["/converter/grid-filter.converter", _e], ["/converter/row-option.converter", et], ["/converter/change-formatter-type.converter", tt] ]), 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 }], ["multiLanguage", { type: "language-textbox" }] ]), s = Ve(); function l(a, u) { return () => s.parseValueSchema(a, u); } function g(a, u, y) { return a.includes("visible") && u.visible !== void 0 ? typeof u.visible == "boolean" ? () => !!u.visible : u.visible === void 0 ? !0 : l(u.visible, y) : () => !0; } function c(a, u, y) { return a.includes("readonly") && u.readonly !== void 0 ? typeof u.readonly == "boolean" ? () => !!u.readonly : l(u.readonly, y) : () => !1; } function p(a, u) { const y = a.$converter || u; return typeof y == "string" && y && n.has(y) ? n.get(y) || null : y || null; } function d(a, u, y, v, C, w = "", I = "") { return Object.keys(a).map((E) => { const S = B(1), M = E, F = a[E], A = Object.keys(F), N = F.title, V = F.type, O = r.get(V) || { type: "input-group", enableClear: !1 }, k = F.editor ? Object.assign({}, O, F.editor) : Object.assign({}, O), W = g(A, F, u), j = c(A, F, u); k.readonly = k.readonly === void 0 ? j() : k.readonly; const J = F.type === "cascade" ? d(F.properties, u, y, v, C, w, I) : [], H = !0; let P = p(F, I); const fe = G({ get() { if (S.value) { if (["class", "style"].find((be) => be === M) && !P && (P = n.get("/converter/appearance.converter") || null), P && P.convertFrom) return P.convertFrom(y, E, C, w); const T = y[E]; return Object.prototype.hasOwnProperty.call(F, "defaultValue") && (T === void 0 || typeof T == "string" && T === "") ? F.type === "boolean" ? F.defaultValue : F.defaultValue || "" : T; } return null; }, set(T) { S.value += 1, P && P.convertTo ? (P.convertTo(v, E, T, C, w), P.convertTo(y, E, T, C, w)) : (v[E] = T, y[E] = T); } }), { refreshPanelAfterChanged: ge, description: he, isExpand: ye, parentPropertyID: ve } = F, D = { propertyID: M, propertyName: N, propertyType: V, propertyValue: fe, editor: k, visible: W, readonly: j, cascadeConfig: J, hideCascadeTitle: H, refreshPanelAfterChanged: ge, description: he, isExpand: ye, parentPropertyID: ve }; return u[M] = D, D; }); } function o(a, u, y = {}) { const v = {}, C = i[a]; return C && C.categories ? Object.keys(C.categories).map((I) => { const x = C.categories[I], E = x == null ? void 0 : x.title, S = d(x.properties || {}, v, {}, y, u); return { categoryId: I, categoryName: E, properties: S }; }) : []; } function m(a, u, y, v, C = "") { const w = u.$ref.schema, I = u.$ref.converter, x = y[w], E = x.type, S = e(x), M = {}, F = i[E]; if (F && F.categories) { const A = F.categories[a], N = A == null ? void 0 : A.title; I && Object.keys(A.properties).forEach((k) => { A.properties[k].$converter = I; }); const V = (A == null ? void 0 : A.properties) || {}, O = d(V, M, S, x, v, C); return { categoryId: a, categoryName: N, properties: O }; } return { categoryId: a, categoryName: "", properties: [] }; } function h(a, u, y, v, C) { const w = a.type, I = e(a), x = {}; let E = C || i[w]; if (!(E && Object.keys(E).length > 0) && y && y.getPropConfig && (E = y.getPropConfig(v)), E && E.categories) { const M = []; return Object.keys(E.categories).map((F) => { const A = E.categories[F]; if (A.$ref) { M.push(m(F, A, a, u, v)); return; } const N = A == null ? void 0 : A.title, V = A == null ? void 0 : A.tabId, O = A == null ? void 0 : A.tabName, k = A == null ? void 0 : A.hide, W = A == null ? void 0 : A.hideTitle, j = d(A.properties || {}, x, I, a, u, v, A.$converter), { setPropertyRelates: J } = A, H = A == null ? void 0 : A.parentPropertyID; M.push({ categoryId: F, categoryName: N, tabId: V, tabName: O, hide: k, properties: j, hideTitle: W, setPropertyRelates: J, parentPropertyID: H }); }), M; } return []; } return { getPropertyConfigBySchema: h, getPropertyConfigByType: o, propertyConverterMap: n }; } const le = {}, ae = {}; se(le, ae, Pe); const de = {}, ce = {}, { resolveSchemaWithDefaultValue: it } = ne(de, ce), ue = {}, pe = {}; se(ue, pe, it); function nt(i, t, e = /* @__PURE__ */ new Map(), n = (l, g, c, p) => g, r = {}, s = (l) => l) { return re[t.title] = t, oe[t.title] = n, le[t.title] = r, ae[t.title] = s, de[t.title] = t, ce[t.title] = n, ue[t.title] = r, pe[t.title] = s, (l = {}, g = !0) => { if (!g) return ke(l, e); const c = Te(l, t, e), p = Object.keys(i).reduce((d, o) => (d[o] = i[o].default, d), {}); return Object.assign(p, c); }; } function rt(i, t, e) { return t; } const ot = /* @__PURE__ */ new Map([ ["appearance", we] ]), st = "https://json-schema.org/draft/2020-12/schema", lt = "https://farris-design.gitee.io/image.schema.json", at = "image", dt = "A Farris Component", ct = "object", ut = { id: { description: "The unique identifier for image", type: "string" }, type: { description: "The type string of image", type: "string", default: "image" }, appearance: { description: "", type: "object", properties: { class: { type: "string" }, style: { type: "string" } }, default: {} }, binding: { description: "", type: "object", default: {} }, rootId: { description: "", type: "string", default: "default-root" }, src: { description: "", type: "string", default: "" }, errorSrc: { description: "", type: "string", default: "" }, alt: { description: "", type: "string", default: "" }, title: { description: "", type: "string", default: "" }, visible: { description: "", type: "boolean", default: !0 }, width: { description: "", type: "Number" }, height: { description: "", type: "Number" } }, pt = [ "id", "type" ], mt = [ "id", "appearance", "binding", "visible" ], ft = { $schema: st, $id: lt, title: at, description: dt, type: ct, properties: ut, required: pt, ignore: mt }, Q = { // 绑定特殊字段,辅助构造src,指定服务器端图像Id modelValue: { type: String, default: "" }, // 指定直接路径 src: { type: String, default: "" }, errorSrc: { type: String, default: "" }, alt: { type: String, default: "" }, title: { type: String, default: "" }, // 指定自定义样式 customClass: { type: Object, default: "" }, id: { type: String, default: "" }, width: { type: Number }, height: { type: Number }, // 是否只读 readonly: { type: Boolean, default: !1 }, visible: { type: Boolean, default: !0 } }, me = nt(Q, ft, ot, rt), gt = Object.assign({}, Q, { componentId: { type: String, default: "" } }), z = /* @__PURE__ */ te({ name: "FImage", props: Q, emits: ["change", "update:modelValue"], setup(i, t) { const e = B(i.modelValue), n = G(() => ie({ "f-imgcontainer-in-form": !0 }, i.customClass)), r = G(() => { const o = {}; return i.width && i.width > 0 && (o.width = i.width + "px"), i.height && i.height > 0 && (o.height = i.height + "px"), o; }), s = B(i.alt ? i.alt : void 0), l = B(i.title ? i.title : void 0), g = i.errorSrc ? i.errorSrc : "data:image/png;base64,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", c = B(i.modelValue || i.src); function p() { i.title && (l.value = i.title); } X(() => i.src, (o) => { p(), c.value = o; }), X(() => i.modelValue, (o) => { p(), e.value = o, c.value = o || i.src || g; }); function d() { c.value === g && (l.value = void 0), c.value = g; } return () => i.visible ? Y("div", { class: n.value }, [Y("img", { alt: s.value, title: l.value, style: r.value, src: c.value, onError: d }, null)]) : null; } }); function ht(i) { const { formSchemaUtils: t, formStateMachineUtils: e } = i; function n(c, p = "") { return { path: p + c.code, field: c.id, fullPath: c.code }; } function r(c, p = "") { const d = t.getViewModelById(c); return d ? d.states.map((o) => n(o, p)) : []; } function s(c) { const p = t.getRootViewModelId(), d = r(c); if (c === p) return d; const o = r(p, "root-component."); return [...d, ...o]; } function l(c) { return c.binding && c.binding.path || c.id || ""; } function g() { return e && e.getRenderStates() || []; } return { getVariables: s, getControlName: l, getStateMachines: g }; } class yt { constructor(t) { b(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'" } ]); b(this, "expressionNames", { compute: "计算表达式", dependency: "依赖表达式", validate: "验证表达式", dataPicking: "帮助前表达式", visible: "可见表达式", readonly: "只读表达式", required: "必填表达式" }); b(this, "getExpressionConverter", (t, e) => ({ convertFrom: (n, r, s, l) => { const g = s.getExpressionRuleValue(t, e || r); return g && g.value || ""; }, convertTo: (n, r, s, l, g) => { var c; if (r === "dataPicking" && (s != null && s.target)) { const p = `${s.target}_dataPicking`; ((c = s.rules) == null ? void 0 : c.some( (o) => o.id === p && o.value )) ? n.dictPickingExpressionId = p : delete n.dictPickingExpressionId; } l.updateExpression(s); } })); this.formSchemaService = t; } getExpressionRule(t, e) { const n = this.getExpressionData(); if (!n) return ""; const r = n.find((l) => l.target === t); if (!r) return ""; const s = r.rules.find((l) => l.type === e); return s || ""; } // 获取上下文表单变量 getContextFormVariables() { const { module: t } = this.formSchemaService.getFormSchema(); if (!t.viewmodels || t.viewmodels.length === 0) return []; const e = this.formSchemaService.getRootViewModelId(), n = this.formSchemaService.getViewModelById(e); if (!n || !n.states || n.states.length === 0) return []; const r = []; return n.states.filter((s) => s.category === "remote").forEach((s) => { r.push({ key: s.code, name: s.name, description: s.name, category: s.category }); }), r; } createTreeNode(t, e, n = "label") { return { id: t.id, name: t.name, bindingPath: t[n], parents: e, type: "field" }; } buildEntityFieldsTreeData(t = null, e) { const n = []; return t == null || t.forEach((r) => { var g; const s = this.createTreeNode(r, e); let l = []; (g = r.type) != null && g.fields && (l = this.buildEntityFieldsTreeData(r.type.fields, [...e, r.label])), n.push({ data: s, children: l, expanded: !0 }); }), n; } buildChildEntityTreeData(t = null, e) { const n = []; return t == null || t.forEach((r) => { var c, p; const s = this.createTreeNode(r, e); s.type = "entity"; const l = this.buildEntityFieldsTreeData((c = r.type) == null ? void 0 : c.fields, [...e, r.label]), g = this.buildChildEntityTreeData((p = r.type) == null ? void 0 : p.entities, [...e, r.label]); g != null && g.length && (l == null || l.push(...g)), n.push({ data: s, children: l || [], // 空值回退 expanded: !0 }); }), n; } getEntitiesTreeData() { const t = this.formSchemaService.getSchemaEntities(); if (!(t != null && t.length)) return []; const e = t[0]; if (!(e != null && e.type)) return []; const n = this.buildEntityFieldsTreeData(e.type.fields, [e.code]), r = this.buildChildEntityTreeData(e.type.entities, [e.code]); return r != null && r.length && (n == null || n.push(...r)), { entityCode: e.code, fields: [{ data: this.createTreeNode(e, [], "code"), children: n || [] }] }; } getEntitiesAndVariables() { return { entities: this.getEntitiesTreeData(), variables: { session: { name: "系统变量", items: this.sessionVariables, visible: !1 }, forms: { name: "表单变量", items: this.getContextFormVariables(), visible: !0 } } }; } onBeforeOpenExpression(t, e, n) { const r = n === "Field" ? t.binding.field : t.id, s = this.getExpressionRule(r, e), l = this.getEntitiesAndVariables(), g = { message: ["validate", "required", "dataPicking"].includes(e) && s ? s.message : "", ...l }; return s.messageType != null && (g.messageType = s.messageType), g; } buildRule(t, e, n, r) { const { expression: s, message: l, messageType: g } = e, c = { id: `${t}_${n}`, type: n, value: s }; return (n === "validate" || n === "dataPicking" || n === "required") && (c.message = l), n === "dataPicking" && (c.messageType = g), n === "validate" && r && (c.elementId = r), c; } getExpressionData() { const { expressions: t } = this.formSchemaService.getFormSchema().module; return t || []; } updateExpression(t, e, n, r) { const s = e === "Field" ? t.binding.field : t.id, l = this.buildRule(s, n, r, t.type === "form-group" ? t.id : ""); let c = this.getExpressionData().find((d) => d.targetType === e && d.target === s); const p = (d) => d.value.trim() === ""; if (c) { const d = c.rules.find((o) => o.id === l.id); if (d) p(l) ? c.rules = c.rules.filter((o) => o.id !== l.id) : (Object.assign(d, l), r === "validate" && t.type === "form-group" && (d.elementId = t.id)); else { if (p(l)) return null; c.rules = c.rules || [], c.rules.push(l); } } else { if (p(l)) return null; c = { target: `${s}`, rules: [l], targetType: e }; } return c; } getExpressionEditorOptions(t, e, n, r) { return n.reduce((s, l) => { var c, p; const g = e === "Field" ? (c = t == null ? void 0 : t.binding) == null ? void 0 : c.field : t.id; return s[l] = { hide: e === "Field" ? !!((p = t == null ? void 0 : t.binding) != null && p.field) : !1, description: "", title: this.expressionNames[l], type: "string", $converter: this.getExpressionConverter(g), refreshPanelAfterChanged: !0, editor: { type: "expression-editor", singleExpand: !1, dialogTitle: `${this.expressionNames[l]}编辑器`, showMessage: l === "validate" || l === "dataPicking" || l === "required", showMessageType: l === "dataPicking", beforeOpen: () => this.onBeforeOpenExpression(t, l, e), onSubmitModal: (d) => { const o = this.updateExpression(t, e, d, l); if (r) { const m = this.buildRule(g, d, l); r(m); } return o; } } }, s; }, {}); } getExpressionInfo(t, e, n) { const r = e === "Field" ? t.binding.field : t.id, s = this.getExpressionRule(r, n), l = { value: s && s.value, targetId: r, targetType: e, expressionType: n }; return s && s.message && (l.message = s.message), l; } getExpressionConfig(t, e, n = ["compute", "dependency", "validate"], r) { return { description: "表达式", title: "表达式", hide: !t.binding, properties: { ...this.getExpressionEditorOptions(t, e, n, r) } }; } getExpressionOptions(t, e, n) { const r = this.getExpressionInfo(t, e, n); return { dialogTitle: `${this.expressionNames[n] || "表达式"}编辑器`, singleExpand: !1, showMessage: n === "required", beforeOpen: () => this.onBeforeOpenExpression(t, n, e), expressionInfo: r }; } } class vt { constructor(t, e) { b(this, "componentId"); b(this, "viewModelId"); b(this, "eventsEditorUtils"); b(this, "formSchemaUtils"); b(this, "formMetadataConverter"); b(this, "designViewModelUtils"); b(this, "designViewModelField"); b(this, "controlCreatorUtils"); b(this, "designerHostService"); b(this, "designerContext"); b(this, "modalService", null); /** 表单规则 */ b(this, "formRule", null); b(this, "schemaService", null); b(this, "metadataService", null); b(this, "propertyConfig", { type: "object", categories: {} }); b(this, "expressionProperty"); var n; this.componentId = t, this.designerHostService = e, this.eventsEditorUtils = e.eventsEditorUtils, this.formSchemaUtils = e.formSchemaUtils, this.formMetadataConverter = e.formMetadataConverter, this.viewModelId = ((n = this.formSchemaUtils) == null ? void 0 : n.getViewModelIdByComponentId(t)) || "", this.designViewModelUtils = e.designViewModelUtils, this.controlCreatorUtils = e.controlCreatorUtils, this.metadataService = e.metadataService, this.schemaService = e.schemaService, this.designerContext = e.designerContext, this.modalService = e.modalService, this.expressionProperty = new yt(this.formSchemaUtils); } getFormDesignerInstance() { var t, e; return (e = (t = this.designerContext) == null ? void 0 : t.instances) == null ? void 0 : e.formDesigner.value; } getTableInfo() { var t; return (t = this.schemaService) == null ? void 0 : t.getTableInfoByViewModelId(this.viewModelId); } setDesignViewModelField(t) { var n; const e = t.binding && t.binding.type === "Form" && t.binding.field; if (e) { if (!this.designViewModelField) { const r = this.designViewModelUtils.getDgViewModel(this.viewModelId); this.designViewModelField = r.fields.find((s) => s.id === e); } t.updateOn = (n = this.designViewModelField) == null ? void 0 : n.updateOn; } } getBasicPropConfig(t) { 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: t.type, name: f[t.type] && f[t.type].name }] } } } }; } getAppearanceConfig(t = null, e = {}, n) { const r = { title: "外观", description: "Appearance" }, s = { 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 l in e) s[l] = Object.assign(s[l] || {}, e[l]); return { ...r, properties: { ...s }, setPropertyRelates(l, g) { if (l) { switch (l && l.propertyID) { case "class": case "style": { U.value++; break; } } n && n(l, t, g); } } }; } /** * * @param propertyData * @param propertyTypes * @param propertyName * @param constInfos * @param variableInfos * @param expressionType 指定表达式类型,存在属性和表达式类型不一致的情况 * @returns */ getPropertyEditorParams(t, e = [], n = "visible", r = {}, s = {}, l = "") { const { getVariables: g, getControlName: c, getStateMachines: p } = ht(this.designerHostService), d = this.getRealTargetType(t), o = e && e.length > 0 ? e : ["Const", "Variable", "StateMachine", "Expression"], m = { type: "property-editor", propertyTypes: o }; return o.map((h) => { switch (h) { case "Const": Object.assign(m, { constType: "enum", constEnums: [{ id: !0, name: "是" }, { id: !1, name: "否" }] }, r); break; case "Expression": m.expressionConfig = this.getExpressionOptions(t, d, l || n); break; case "StateMachine": m.stateMachines = p(); break; case "Variable": Object.assign(m, { controlName: c(t), newVariablePrefix: "is", newVariableType: "Boolean", variables: g(this.viewModelId), parentComponentId: this.componentId === "root-component" ? "" : "root-component", onBeforeOpenVariables: (a) => { a.value = g(this.viewModelId); } }, s), this.designerContext.designerMode === "PC_RTC" && (m.newVariablePrefix = "ext_" + m.newVariablePrefix); break; } }), m; } getVisibleProperty(t, e = "") { var s; let n = ["Const", "Variable", "StateMachine", "Expression"]; return e === "gridFieldEditor" ? n = ["Const", "Expression"] : e === "form-group" && !((s = t.binding) != null && s.field) && (n = ["Const", "Variable", "StateMachine"]), { visible: { title: "是否可见", type: "boolean", description: "运行时组件是否可见", editor: this.getPropertyEditorParams(t, n, "visible") } }; } /** * 获取行为 * @param propertyData * @param viewModelId * @returns */ getBehaviorConfig(t, e = "", n = {}, r) { const s = { title: "行为", description: "" }, l = this.getVisibleProperty(t, e); for (const c in n) l[c] = Object.assign(l[c] || {}, n[c]); const g = this; return { ...s, properties: { ...l }, setPropertyRelates(c, p) { if (c) { switch (c.propertyID) { case "disabled": case "readonly": case "visible": g.afterMutilEditorChanged(t, c); break; } r && r(c, p); } } }; } /** * 当多值编辑器变更时 * @param propertyData * @param changeObject */ afterMutilEditorChanged(t, e) { this.addNewVariableToViewModel(e, this.viewModelId), this.updateExpressionValue(e, t), this.clearExpression(e, t); } /** * * @param propertyId * @param componentInstance * @returns */ updateElementByParentContainer(t, e) { const n = e && e.parent && e.parent.schema; if (!n) return; const r = n.contents.findIndex((l) => l.id === t), s = Z(n.contents[r]); n.contents.splice(r, 1), n.contents.splice(r, 0, s), Me(); } /** * 属性编辑器,在编辑过程中会新增变量,此处需要将新增的变量追加到ViewModel中 * @param changeObject * @param viewModelId * @returns */ addNewVariableToViewModel(t, e) { const n = t.propertyValue; if (!(n && typeof n == "object") || !(n.type === "Variable" && n.isNewVariable)) return; const l = { id: n.field, category: "locale", code: n.fullPath, name: n.fullPath, type: n.newVariableType || "String", isRtcVariable: this.designerContext.designerMode === "PC_RTC" ? !0 : void 0 }; delete n.newVariableType, delete n.isNewVariable, this.formSchemaUtils.getVariableByCode(l.code) || this.formSchemaUtils.getViewModelById("root-viewmodel").states.push(l); } getExpressions() { let t = []; return this.formRule ? (this.formRule.expressions = this.formRule.expressions || [], t = this.formRule.expressions || []) : t = this.formSchemaUtils.getExpressions(), t; } /** * 更新表达式到expressions节点 * @param changeObject */ updateExpressionValue(t, e) { const n = t.propertyValue; if (!((n && n.type) === "Expression" && n.expressionInfo)) return; const { expressionId: l, expressionInfo: g } = n, { targetId: c, targetType: p, expressionType: d, value: o, message: m } = g, h = this.getExpressions(); let a = h.find((y) => y.target === c); a || (a = { target: c, rules: [], targetType: p }, h.push(a)); const u = a.rules.find((y) => y.type === d); if (u) u.value = o, u.message = m, (d === "minDate" || d === "maxDate" || d === "defaultTime") && (u.elementId = e.id); else { const y = { id: l, type: d, value: o, message: m, elementId: e.id }; a.rules.push(y); } delete n.expressionInfo; } /** * 属性类型切换为非表达式后,清除原表达式 * @param changeObject * @param propertyData * @returns */ clearExpression(t, e) { const n = t.propertyValue; if (n && n.type === "Expression") return; const s = t.propertyID, l = this.getExpressions(), g = e.binding ? e.binding.field : e.id, c = l.find((p) => p.target === g); !c || !c.rules || (c.rules = c.rules.filter((p) => p.type !== s)); } getExpressionOptions(t, e, n) { return this.expressionProperty.getExpressionOptions(t, e, n); } getRealTargetType(t) { return ["response-toolbar-item", "tab-toolbar-item", "section-toolbar-item", "drawer-toolbar-item"].indexOf(t.type) > -1 ? "Button" : t.binding && t.binding.field ? "Field" : "Container"; } createBaseEventProperty(t) { const e = {}; return e[this.viewModelId] = { type: "events-editor", editor: { initialData: t, viewSourceHandle: (n) => { var r; ((r = n.controller) == null ? void 0 : r.label.indexOf(this.formSchemaUtils.getModule().code)) > -1 && this.eventsEditorUtils.jumpToMethod(n); } } }, e; } } const L = class L { /** * 根据绑定字段类型获取可用的输入类控件 */ static getEditorTypesByMDataType(t, e = !1, n = "") { if (e) return [{ key: f["language-textbox"].type, value: f["language-textbox"].name }]; let r = L.fieldControlTypeMapping[t]; if (n === "data-grid-column" && (r != null && r.length)) { const s = [f["check-group"].type, f["radio-group"].type, f.image.type, f["rich-text-editor"].type]; r = r.filter((l) => !s.includes(l.key)); } return r; } /** * 获取所有输入类控件 */ static getAllInputTypes() { const t = []; for (const e in L.fieldControlTypeMapping) L.fieldControlTypeMapping[e].forEach((n) => { t.find((r) => r.key === n.key && r.value === n.value) || t.push({ key: n.key, value: n.value }); }); return t; } /** * 提供schema字段基础属性和DOM控件属性的映射 * @param control 控件元数据 */ static mappingDomPropAndSchemaProp(t, e) { var s; const n = (s = t.editor) == null ? void 0 : s.type, r = []; return (t.type === f["data-grid-column"].type || t.type === f["tree-grid-column"].type) && e && e.categoryId && e.categoryId.indexOf("gridFieldEditor") < 0 && r.push({ domField: "title", schemaField: "name" }), r.push({ domField: "label", schemaField: "name" }), r.push({ domField: "editor.required", schemaField: "require" }), r.push({ domField: "editor.readonly", schemaField: "readonly" }), (n === f["input-group"].type || n === f.textarea.type || n === f["number-spinner"].type) && r.push({ domField: "editor.maxLength", schemaField: "type.length" }), n === f["number-spinner"].type && r.push({ domField: "editor.precision", schemaField: "type.precision" }), (t.type === f[