UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,515 lines 144 kB
var Sn = Object.defineProperty; var En = (e, o, i) => o in e ? Sn(e, o, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[o] = i; var _e = (e, o, i) => En(e, typeof o != "symbol" ? o + "" : o, i); import { inject as oe, ref as w, defineComponent as ce, createVNode as n, onMounted as Ne, computed as J, createTextVNode as te, Fragment as Qe, onBeforeMount as mn, reactive as xe, withDirectives as $e, resolveDirective as Oe, watch as Ce, mergeProps as fn, onUnmounted as Nn, provide as ze } from "vue"; import { resolveAppearance as vn, createPropsResolver as Je, schemaMap as nn, schemaResolverMap as Pn, propertyEffectMap as Mn, propertyConfigSchemaMap as Vn } from "../dynamic-resolver/index.esm.js"; import { cloneDeep as X, mergeWith as Ln, merge as Tn } from "lodash-es"; import { useGuid as tn, ControllerSchemaRepositorySymbol as kn, FormSchemaEntityField$Type as an, FormSchemaEntityFieldTypeName as rn, getCustomClass as hn, useThirdComponent as Bn, isMobilePhone as In } from "../common/index.esm.js"; import { DgControl as xn } from "../designer-canvas/index.esm.js"; import { FNotifyService as Pe } from "../notify/index.esm.js"; import $n, { FTreeView as On } from "../tree-view/index.esm.js"; import An, { FSchemaSelector as Rn } from "../schema-selector/index.esm.js"; import { F_MODAL_SERVICE_TOKEN as Dn } from "../modal/index.esm.js"; import jn from "../input-group/index.esm.js"; import pn from "../combo-list/index.esm.js"; import on from "../event-parameter/index.esm.js"; import { LocaleService as gn } from "../locale/index.esm.js"; import { loadRegister as Un, useComponentManager as qn, useEntityState as Hn, useDynamicViewUtils as Gn, componentMap as Xe, resolverMap as _n, componentPropsConverter as zn } from "../dynamic-view/index.esm.js"; import Wn from "../section/index.esm.js"; import Kn from "../accordion/index.esm.js"; import Qn from "../../designer/avatar/index.esm.js"; import Jn from "../../designer/approval-logs/index.esm.js"; import Yn from "../../designer/button-edit/index.esm.js"; import Xn from "../button-group/index.esm.js"; import Zn from "../button/index.esm.js"; import et from "../calendar/index.esm.js"; import nt from "../../designer/capsule/index.esm.js"; import ln from "../../designer/checkbox/index.esm.js"; import sn from "../../designer/checkbox-group/index.esm.js"; import tt from "../combo-tree/index.esm.js"; import ot from "../component/index.esm.js"; import at from "../color-picker/index.esm.js"; import rt from "../content-container/index.esm.js"; import lt from "../table/index.esm.js"; import it from "../../designer/date-picker/index.esm.js"; import st from "../../designer/data-grid/index.esm.js"; import ct from "../dropdown/index.esm.js"; import ut from "../../designer/dynamic-form/index.esm.js"; import dt from "../events-editor/index.esm.js"; import mt from "../filter-bar/index.esm.js"; import ft from "../field-selector/index.esm.js"; import vt from "../binding-selector/index.esm.js"; import ht from "../image-cropper/index.esm.js"; import pt from "../../designer/input-group/index.esm.js"; import gt from "../layout/index.esm.js"; import Ct from "../list-nav/index.esm.js"; import bt from "../../designer/list-view/index.esm.js"; import yt from "../lookup/index.esm.js"; import Ft from "../mapping-editor/index.esm.js"; import wt from "../../designer/nav/index.esm.js"; import St from "../number-range/index.esm.js"; import Et from "../../designer/number-spinner/index.esm.js"; import Nt from "../order/index.esm.js"; import Pt from "../page-header/index.esm.js"; import Mt from "../page-footer/index.esm.js"; import Vt from "../pagination/index.esm.js"; import Lt from "../progress/index.esm.js"; import Tt from "../query-solution/index.esm.js"; import kt from "../../designer/radio-group/index.esm.js"; import Bt from "../../designer/rate/index.esm.js"; import It from "../../designer/response-toolbar/index.esm.js"; import xt from "../response-layout/index.esm.js"; import $t from "../../designer/response-layout-editor/index.esm.js"; import Ot from "../search-box/index.esm.js"; import At from "../../designer/section/index.esm.js"; import Rt from "../smoke-detector/index.esm.js"; import Dt from "../splitter/index.esm.js"; import jt from "../step/index.esm.js"; import Ut from "../../designer/switch/index.esm.js"; import qt from "../../designer/tabs/index.esm.js"; import Ht from "../../designer/tags/index.esm.js"; import Gt from "../text/index.esm.js"; import _t from "../../designer/time-picker/index.esm.js"; import zt from "../transfer/index.esm.js"; import Wt from "../uploader/index.esm.js"; import Kt from "../verify-detail/index.esm.js"; import Qt from "../video/index.esm.js"; import Jt from "../../designer/textarea/index.esm.js"; import Yt from "../../designer/tree-grid/index.esm.js"; import Xt from "../filter-condition-editor/index.esm.js"; import Zt from "../fieldset/index.esm.js"; import eo from "../sort-condition-editor/index.esm.js"; import no from "../menu-lookup/index.esm.js"; import to from "../../designer/drawer/index.esm.js"; import oo from "../json-editor/index.esm.js"; import ao from "../property-editor/index.esm.js"; import ro from "../expression-editor/index.esm.js"; import lo from "../code-editor/index.esm.js"; import io from "../html-template/index.esm.js"; import so from "../collection-property-editor/index.esm.js"; import co from "../../designer/modal/index.esm.js"; import uo from "../external-container/index.esm.js"; import mo from "../language-textbox/index.esm.js"; import fo from "../image/index.esm.js"; import vo from "../comment/index.esm.js"; import ho from "../../designer/wizard/index.esm.js"; import po from "../tooltip/index.esm.js"; import "../property-panel/index.esm.js"; const go = /* @__PURE__ */ new Map([ ["appearance", vn] ]); function Co(e, o, i) { return o; } const bo = "https://json-schema.org/draft/2020-12/schema", yo = "https://farris-design.gitee.io/events-editor.schema.json", Fo = "events-editor", wo = "A Farris Component", So = "object", Eo = { id: { description: "The unique identifier for events-editor", type: "string" }, type: { description: "The type events of events-editor", type: "events", default: "events-editor" }, initialData: { description: "", type: "object", default: {} }, viewSourceHandle: { description: "", type: "function", default: null } }, No = [ "id", "type" ], Po = { $schema: bo, $id: yo, title: Fo, description: wo, type: So, properties: Eo, required: No }, Mo = "events-editor", Vo = "A Farris Component", Lo = "object", To = {}, ko = { title: Mo, description: Vo, type: Lo, categories: To }, cn = [ { label: "pageChange", name: "MockMock切换页码" }, { label: "pageSizeChanged", name: "Mock分页条数变化事件" }, { label: "scrollYLoad", name: "Mock滚动加载事件" }, { label: "onEditClicked", name: "Mock操作列点击编辑" }, { label: "onDeleteClicked", name: "Mock操作列点击删除" } ], Bo = { propertyID: "data-grid-component-viewmodel", propertyType: "events", /** 内置构件显示的命令列表 */ internalCommandList: [ { controllerName: { id: "70b4abd4-9f2c-4b7c-90e9-6ac6f4b74c72", label: "ListController", name: "列表控制器" }, controllerList: [ { id: "93ee1cd2-cf0b-40b3-b99f-958a3d1fad1c", label: "Load", name: "Mock加载数据", handlerName: "Load" }, { id: "71ae8a4c-6202-4875-9246-2e2d959da37f", label: "Search", name: "Mock查询", handlerName: "Search" }, { id: "77556491-41c0-4356-8ccf-25e39817060e", label: "Add", name: "Mock添加数据", handlerName: "Add" }, { id: "52fdcac3-46c8-466e-aa5d-19920ece2076", label: "View", name: "Mock查看数据", handlerName: "View" }, { id: "7ade9996-0531-4401-b1bc-fb9ec8ee3f8e", label: "Edit", name: "Mock编辑数据", handlerName: "Edit" }, { id: "6d5a354f-871f-43e6-82bc-7837184380d3", label: "RemoveRows", name: "Mock删除选中行", handlerName: "RemoveRows" }, { id: "1a1b7c33-38f0-469f-a017-223086ee6259", label: "ChangePage", name: "Mock切换页码", handlerName: "ChangePage" }, { id: "debae2dd-3387-48cf-90ba-96e74ab5a8e5", label: "Remove", name: "Mock删除指定数据", handlerName: "Remove" } ] } ], /** (事件设定)可绑定事件默认列表; */ events: cn, /** 已绑定的事件(拼接已有的参数值,拼接当前事件->待集成-从dom结构中取值,事件及对应的字符串) */ boundEventsList: [], /** 视图模型已有命令 */ viewModel: [], /** 目标组件对应的所有可选的组件 */ componentLists: [ { componentId: "root-component", viewModelId: "root-viewmodel" }, { componentId: "data-grid-component", viewModelId: "data-grid-component-viewmodel" } ], /** 所有组件列表 */ allComponentList: [ { componentId: "root-component", viewModelId: "root-viewmodel" }, { componentId: "data-grid-component", viewModelId: "data-grid-component-viewmodel" } ], /** 初始为空,用于存储用户点击「导入新命令」的控制器值 */ newController: [], isAddControllerMethod: !1, getEventList: () => ({ events: cn, boundEventsList: [] }) }, Cn = { initialData: { type: Object, default: Bo }, viewSourceHandle: { type: Function, default: () => { } } }, Io = Je( Cn, Po, go, Co, ko ); function bn() { function e(i, s) { const t = [ { controllerId: "45be24f9-c1f7-44f7-b447-fe2ada458a61", controllerLabel: "AdvancedListCardController", controllerName: "高级列卡控制器", commands: [ { name: "增加子表数据", id: "250cd2a2-9995-4c01-64aa-5029afba08ca", handlerName: "AddItem" }, { name: "删除子表数据", id: "a2c06958-29b1-0582-5f3e-c3cfcc741f8f", handlerName: "RemoveItem" }, { name: "插入数据", id: "3208b00c-543d-c050-3c54-081715972dda", handlerName: "Insert" }, { name: "查询从表数据(分页)", id: "b60b7754-35cf-7eaa-0f1d-bc5e5d61c0bc", handlerName: "queryChild" }, { name: "批量删除子表", id: "378fcd7d-ce91-c052-5947-d60ecdb38df9", handlerName: "batchDelete" }, { name: "移动数据", id: "fcac5d5e-2367-2b61-a82a-f8e874e8efc0", handlerName: "move" }, { name: "打开批量编辑界面", id: "8d8b05d6-2d22-b0b7-7cb8-51bbb8cd8a18", handlerName: "openBatchEditDialog" } ] }, { controllerId: "d7ce1ba6-49c7-4a27-805f-f78f42e72725", controllerLabel: "EditableListController", controllerName: "可编辑列表控制器", commands: [ { name: "打开批量编辑界面", id: "c3831e36-27d1-1c98-dd60-30e2d7ec04d2", handlerName: "openBatchEditDialog" }, { name: "加载列表数据", id: "f80e026b-bd9b-002b-d2aa-52c44a633bec", handlerName: "Load" } ] }, { controllerId: "8fe977a1-2b32-4f0f-a6b3-2657c4d03574", controllerLabel: "TreeCardController", controllerName: "树卡控制器", commands: [ { name: "新增子表数据", id: "21b0c3af-3caf-b11d-2360-d9af20016501", handlerName: "AddItem" }, { name: "删除子表数据", id: "113f1d77-65a4-63bf-3973-80dd15f294d1", handlerName: "RemoveItem" }, { name: "批量删除子表", id: "bf13585c-a8f3-384b-356c-bd8bf06751c4", handlerName: "batchDelete" } ] }, { controllerId: "8d21e69c-70b3-44f6-88b5-fd6a8d3ce11b", controllerLabel: "PopController", controllerName: "弹出控制器", commands: [ { name: "新增子表数据", id: "d6933772-8047-9bde-220b-449481883142", handlerName: "AddItem" }, { name: "删除子表数据", id: "03c233eb-e39e-8e34-6809-ee4ab3a0d97c", handlerName: "RemoveItem" }, { name: "加载并新增", id: "6882ab4a-9c23-8d59-6aac-de891eae20d2", handlerName: "LoadAndAdd" } ] }, { controllerId: "43f68561-eae4-4495-b318-d629615523f8", controllerLabel: "BatchEditCommands", controlleName: "批量编辑控制器", commands: [ { name: "打开批量编辑界面", id: "a659aaba-daa4-3c07-8b26-164b01726022", handlerName: "openBatchEditDialog" }, { name: "复制行", id: "d5f67e0a-767d-a238-5ad4-b1285476c16f", handlerName: "copyRow" }, { name: "复制行", id: "229d2dd3-2fe7-f06a-b705-cfa0fc711614", handlerName: "clone" } ] }, { controllerId: "c121742e-6028-48bf-817c-1dda7fb098df", controllerLabel: "AdvancedListCardWithSidebarController", controllerName: "高级列卡控制器(侧边栏)", commands: [ { name: "增加子表数据(侧边栏)", id: "250cd2a2-9995-4c01-64aa-5029afba08ca", handlerName: "AddItem" }, { name: "删除子表数据(侧边栏)", id: "a2c06958-29b1-0582-5f3e-c3cfcc741f8f", handlerName: "RemoveItem" } ] }, { controllerId: "8172a979-2c80-4637-ace7-b13074d3f393", controllerLabel: "CardController", controllerName: "卡片控制器", commands: [ { name: "新增子表数据", id: "6f987222-ebe2-0f3c-1594-a12408b22801", handlerName: "AddItem" }, { name: "删除子表数据", id: "0cdeddcc-8332-f13f-be96-b5eeac84a334", handlerName: "RemoveItem" }, { name: "插入数据", id: "2666b526-a1b2-f268-1629-b1b95b71c8dd", handlerName: "Insert" }, { name: "打开批量编辑界面", id: "8104dd8e-bb27-a659-ff7c-a0321523f727", handlerName: "openBatchEditDialog" }, { name: "新增子节点(子表树)", id: "bbd11957-de2a-c727-11d6-64788c4b0fa8", handlerName: "addSubChild" }, { name: "删除子表树节点", id: "c8c9f652-ba52-3a9b-5eb9-dadd42c832cd", handlerName: "RemoveTreeItem" }, { name: "批量删除子表", id: "e96857fa-1617-fd92-8a05-5c684e0819a1", handlerName: "batchDelete" } ] }, { controllerId: "31c1022c-ab40-4e8d-bc31-85d539f1d36c", controllerLabel: "FileController", controllerName: "文件控制器", commands: [ { name: "批量删除文件数据", id: "d5bf021b-1aa4-06fe-3236-188fd218f4f7", handlerName: "removeFileRows" } ] }, { controllerId: "2eb7bbd1-fabd-4d0f-991d-7242f53225b1", controllerLabel: "AttachmentController", controllerName: "附件控制器", commands: [ { name: "上传并更新行", id: "2a84e28f-7202-d858-1466-748a8040c1f9", handlerName: "UploadAndUpdateRow" }, { name: "通过属性名上传并更新行", id: "0f98c9b8-a01b-55d4-3115-269a73f7ccff", handlerName: "uploadAndUpdateRowWithPropertyName" }, { name: "移除版本附件行", id: "b441b6a7-9e13-9f75-77a2-10b2c1f7ef26", handlerName: "RemoveAttachmentItem" }, { name: "上传并批量新增行", id: "e6fc25ca-853b-0b2d-76c9-a1f7a253679b", handlerName: "UploadAndBatchAddRows" }, { name: "通过属性名上传并批量更新行", id: "e00b70db-9de3-8e3e-eb59-1c550a255fec", handlerName: "uploadAndBatchAddRowsWithPropertyName" } ] }, { controllerId: "e353b4e9-e073-4e18-b9f7-ec4cc8ac72b1", controllerLabel: "PrintService", controllerName: "打印控制器", commands: [ { name: "根据数据条件批量打印", id: "774fa275-2da1-e927-e8bf-d27d9886a168", handlerName: "printMulti" } ] }, { controllerId: "70b4abd4-9f2c-4b7c-90e9-6ac6f4b74c72", controllerLabel: "ListController", controllerName: "列表控制器", commands: [ { name: "加载数据", id: "86c9f281-e5bc-5d5c-1b86-d1e17ab2e850", handlerName: "Load" } ] }, { controllerId: "7c48ef46-339c-42d4-8365-a21236c63044", controllerLabel: "ListCardController", controllerName: "列卡控制器", commands: [ { name: "加载列表数据", id: "e573d6a2-8261-9ad4-c9f1-2e59af53302d", handlerName: "loadList" } ] }, { controllerId: "26436aa8-88a7-4aee-bf0b-9843c1e8afbf", controllerLabel: "ListListController", controllerName: "双列表控制器", commands: [ { name: "加载导航列表数据", id: "f7dd2c84-7abd-d4bf-6b31-71d96035c034", handlerName: "LoadNavList" } ] } ]; let c = -1; const y = t.findIndex((b) => i === b.controllerId); return y !== -1 && (c = t[y].commands.findIndex((b) => s === b.handlerName)), c !== -1; } function o(i, s, t) { const c = e(i.controllerName.id, s.handlerName); return t.componentLists.length !== 0 && c && (s.hasPath = !0, s.targetComponent = s.targetComponent || t.componentLists[0].componentId, s.componentLists = X(t.componentLists)), s; } return { isContextDependent: e, setComponentLists: o }; } var Se = /* @__PURE__ */ ((e) => (e.Frame = "frame", e.dataGrid = "data-grid", e.listView = "list-view", e.form = "form", e.uploader = "uploader", e.calendar = "calendar", e.page = "page", e.table = "table", e))(Se || {}); function xo(e, o) { const i = oe("designerContext"), s = i && i.dgControl ? i.dgControl : xn, t = w(""), c = w(""); function y(a) { var v, g, S, r; let f = "controlIcon fd-i-Family ", E = ""; switch (a == null ? void 0 : a.type) { case "form-group": { E = ((v = s[a.type]) == null ? void 0 : v.icon) || ((g = a.editor) == null ? void 0 : g.type) || "", (S = s[a.editor.type]) != null && S.icon && (E = s[a.editor.type].icon); break; } default: E = ((r = s[a.type]) == null ? void 0 : r.icon) || a.type; } const p = `fd_pc-${E}`; return f += p, f; } function b(a, f) { var v; let E = a.id; const p = f == null ? void 0 : f.contents; if ((f == null ? void 0 : f.type) === "splitter" && p && p.length === 2) { const g = f.direction !== "column"; a.id === ((v = p[0]) == null ? void 0 : v.id) ? E = g ? "左侧区域" : "上方区域" : E = g ? "右侧区域" : "下方区域"; } return E; } function L(a) { if (a.isLikeCardContainer) return "区块"; const f = a.appearance && a.appearance.class || "", E = f.split(" "); return a.id === "page-header" && f && f === "f-page-header" ? "页头" : E.includes("f-page-header-base") ? "页头容器" : E.includes("f-page-header-extend") ? "页头扩展容器" : E.includes("f-title") ? "标题容器" : E.includes("f-page") ? "根容器" : E.includes("f-page-main") ? "内容区域" : E.includes("f-scrollspy-content") && a.isScrollspyContainer ? "滚动监听容器" : E.includes("f-grid-is-sub") ? "表格容器" : E.includes("f-filter-container") ? "筛选条容器" : "容器"; } function O(a) { const { componentType: f } = a; switch (f) { case Se.Frame: return "根组件"; case Se.dataGrid: return (e == null ? void 0 : e.formSchemaUtils.selectNode(a, (p) => p.type === (s["tree-grid"] && s["tree-grid"].type))) ? "树表格组件" : "表格组件"; case Se.uploader: return "附件组件"; case Se.listView: return "列表视图组件"; case Se.form: return "卡片组件"; case Se.calendar: return "日历组件"; case Se.table: return "表格布局组件"; case Se.page: return a.name || "页面"; default: return "组件"; } } function V(a, f) { const E = a.name || a.text || a.label || a.title || a.mainTitle; if (a.type !== "component" && E && typeof E == "string") return E.trim(); switch (a.type) { case "content-container": return L(a); case "splitter-pane": return b(a, f); case "component": return O(a); default: return s[a.type] && s[a.type].name || a.id; } } function N(a, f) { const E = a.length ? a[0] : null; if (!E) return; c.value = "", t.value = E.originalId; const p = E ? `${E.originalId}-design-item` : "", v = document.getElementById(p); v && v.click(), o.emit("selectionChanged", E); } function d(a) { if (!a) return; const f = `${a}-design-item`, E = document.getElementById(f); E && E.click(); } return { getIcon: y, getTitle: V, onChanged: N, currentSelectedNodeId: t, currentSelectedOutsideNodeId: c, triggerOutsideClick: d }; } function $o(e, o, i = !1) { const { getIcon: s, getTitle: t } = o; function c(N, d, a, f, E) { var v; const p = (v = e.data.module) == null ? void 0 : v.components.find((g) => g.id === N.component); p && y([p], d, a, f, E); } function y(N, d, a, f, E) { return N.forEach((p) => { var g, S; if (p.type === "component" && (E = p.id), p.type === "component-ref") { c(p, d, a, f, E); return; } const v = { originalId: p.id, layer: a, originalParent: f == null ? void 0 : f.id, componentId: E, name: t(p, f), type: p.type, controlIcon: s(p), rawSchema: p }; d.push(X(v)), (p.contents || p.buttons) && y(p.contents || p.buttons, d, a + 1, p, E), i && (S = (g = p.toolbar) == null ? void 0 : g.buttons) != null && S.length && y(p.toolbar.buttons, d, a + 1, p, E); }), d; } function b(N) { const d = [], a = N.find((v) => v.layer === 0); N = N.filter((v) => v.layer !== 0), d.push(a); let f = a.originalId, E = 0, p = 1e3; for (; N.length !== 0 || p === 0; ) { const v = N.find((g) => g.originalParent === f); v ? (d.push(v), f = v.originalId, N = N.filter((g) => g.originalId !== f), E = 0) : (E -= 1, f = d.slice(E)[0].originalId), p -= 1; } return d; } function L(N) { return N.forEach((d, a) => { d.id = (a + 1).toString(); }), N.forEach((d) => { var a; d.parent = ((a = N.find((f) => f.originalId === d.originalParent)) == null ? void 0 : a.id) || ""; }), N.forEach((d) => { d.hasChildren = N.findIndex((a) => a.parent === d.id) > 0; }), N; } function O(N) { const d = { originalId: e.data.module.id, layer: 0, originalParent: null, name: "页面", type: "module", controlIcon: "controlIcon fd-i-Family fd_pc-module", rawSchema: e.data.module }, a = []; return N.forEach((f) => { f[0].originalParent = d.originalId, a.push(...f); }), a.unshift(d), a; } function V() { const N = e.data.module ? w(e.data.module.components) : w([e.data]); if (!N.value) return; const d = []; N.value.forEach((p) => { if (p) { const v = []; v.push(p); const r = y(v, [], 1, null, p.id); d.push(r); } }); const a = O(d), f = b(a); return L(f); } return { getData: V }; } function Ae(e) { const o = oe("sourceOutlineData") || [], i = w(), s = w(!1), t = w([]), c = w(); function y(p, v, g, S) { var r, _, z, U; return { id: tn().guid(), source: S || { formId: (r = p.sourceCommunication) == null ? void 0 : r.formId, formCode: (_ = p.sourceCommunication) == null ? void 0 : _.formCode, componentId: (z = p.sourceCommunication) == null ? void 0 : z.componentId, externalContainerId: (U = p.sourceCommunication) == null ? void 0 : U.externalContainerId, event: v || "onCommunication" }, target: { formId: (g == null ? void 0 : g.formId) || "", formCode: (g == null ? void 0 : g.formCode) || "", externalContainerId: (g == null ? void 0 : g.externalContainerId) || "", commandCode: (g == null ? void 0 : g.commandCode) || "", commandViewmodelId: (g == null ? void 0 : g.commandViewmodelId) || "" }, paramMappings: [] }; } function b(p) { var v, g; (v = p == null ? void 0 : p.communication) != null && v.length && ((g = p == null ? void 0 : p.communication) == null || g.map((S) => { var r, _; if (S != null && S.id && !((r = S == null ? void 0 : S.source) != null && r.componentId)) { const z = (_ = e.getFormSchema().module.communications) == null ? void 0 : _.find((U) => U.id === (S == null ? void 0 : S.id)); z && Object.assign(S, z); } })); } function L(p) { const v = e.getFormSchema(), { communications: g } = v.module; g || (v.module.communications = []); const S = v.module.communications.findIndex((r) => r.id === p.id); S === -1 ? v.module.communications.push(p) : Object.assign(v.module.communications[S], p); } function O(p) { var v; if ((v = p == null ? void 0 : p.communication) != null && v.length) { const g = e.getFormSchema(); p.communication.map((S) => { g.module.communications && S && (g.module.communications = g.module.communications.filter((r) => r.id !== S.id)); }), p.communication = []; } } function V(p) { var g; const v = e.getFormSchema(); p && ((g = v.module.communications) != null && g.length) && (v.module.communications = v.module.communications.filter((S) => S.id !== p)); } function N(p, v, g) { const S = xo(p, v), r = e.externalFormSchema.get(g); if (r != null && r.content) { const _ = { data: r.content }, { getData: z } = $o(_, S, !0); return z(); } return []; } function d(p) { var g; if (!((g = p == null ? void 0 : p.source) != null && g.componentId)) { s.value = !1; return; } const v = o.find((S) => S.originalId === p.source.componentId); v ? (s.value = !1, i.value = v) : (s.value = !0, i.value = { id: p.source.componentId }); } function a(p) { var S, r, _; t.value = []; const v = (S = i.value) == null ? void 0 : S.rawSchema; if (!v) { c.value = null; return; } const g = e.resolveComponentEvents(nn, v); g && Object.keys(g).forEach((z) => { t.value.push({ eventCode: z, eventName: g[z] }); }), (r = p.source) != null && r.event && ((_ = t.value) != null && _.length) && (c.value = t.value.find((z) => { var U; return z.eventCode === ((U = p.source) == null ? void 0 : U.event); })); } function f(p) { var S, r, _, z, U, I, A, u; if (!(p != null && p.length)) return; d(p[0]), a(p[0]); let v = "", g = ""; return s.value ? v = `${((S = p[0].source) == null ? void 0 : S.componentId) || ""}-${((r = p[0].source) == null ? void 0 : r.event) || ""}` : (v = (_ = i.value) == null ? void 0 : _.name, v && ((z = c.value) != null && z.eventName) && (v += `-${(U = c.value) == null ? void 0 : U.eventName}`), g = `${(I = i.value) == null ? void 0 : I.name} (${(A = i.value) == null ? void 0 : A.originalId})`, g = `${g} ${(u = c.value) == null ? void 0 : u.eventName} (${c.value.eventCode})`), { title: v, titleTip: g, isControlInvalid: s.value }; } function E(p) { var v; if ((v = p == null ? void 0 : p.communication) != null && v.length) { const g = p == null ? void 0 : p.communication[0]; return g == null ? void 0 : g.source; } } return { createNewCommunication: y, resolveCommunication: b, clearAllCommunication: O, clearCommunicationById: V, saveCommunication: L, assembleSourceOutline: N, resolveSourceControlEventTitle: f, resolveCommunicationSource: E }; } function Oo(e, o, i) { const s = w([]), { boundEvents: t, unBoundEvent: c } = o; function y(d) { var f, E; return { /** 当前事件名称及label */ event: { label: (f = d.boundEvents) == null ? void 0 : f.label, name: (E = d.boundEvents) == null ? void 0 : E.name }, /** 控制组件的展示及顺序: * 0:事件下拉框 * 1:事件名称 * 2:来源+方法列表 * 3:方法名 * 4:方法参数*/ showSwitch: [{ // 存储所有的展示设定 showSection: [[!1, !1, !1, !1, !1], [!1, !1, !0, !1, !1], [!1, !0, !1, !0, !1]], // 展示哪个部分 showSwitchNumber: 2 }], /** 方法列表 */ command: X(d.command), /** 当前的控制器 */ controller: X(d.controller), /** 通讯 */ communication: d.communication }; } function b() { var d; s.value = (d = t.value) == null ? void 0 : d.map((a) => y(a)); } function L(d, a) { const E = y({ boundEvents: d, command: null, controller: { id: "", name: "", label: "" }, communication: a ? [a] : [] }); if (a) { E.showSwitch[0].showSwitchNumber = 2, E.showSwitch[0].showSection[2][2] = !1, E.showSwitch[0].showSection[2][3] = !1, E.needSelectCommunicationCommand = !0, s.value.unshift(E); return; } d && (E.showSwitch[0].showSwitchNumber = 1, E.showSwitch[0].showSection[2][3] = !0, s.value.unshift(E)); } function O() { var d; (d = s.value) == null || d.forEach((a) => { a.showSwitch.forEach((f) => { f.showSection[2][3] = !1; }), a.shouldShowCommunicationPanel = !1; }); } function V(d) { s.value[d].showSwitch.forEach((a) => { a.showSection[2][3] = !a.showSection[2][3]; }); } function N(d) { if (d >= 0 && d <= s.value.length - 1) { const a = s.value[d]; c(a.event), s.value.splice(d, 1); const { clearAllCommunication: f } = Ae(e); f(a); } } return { addNewInteraction: L, collapseInteractions: O, deleteInteracton: N, toggleMethodInInteraction: V, interactions: s, loadInteractions: b }; } function Ao(e) { const o = w([]), i = w([]), s = w([]), { isContextDependent: t } = bn(); function c() { const { allComponentList: d } = e.value; e.value.componentLists.length && e.value.viewModel && e.value.viewModel.forEach((a) => { a.controllerList.forEach((f) => { if (f.targetComponent) { const E = d.find((v) => v.componentId === f.targetComponent); if ((E ? E.viewModelId : void 0) === e.value.viewModelId) f.hasPath = !1; else { const v = t(a.controllerName.id, f.handlerName); f.hasPath = v ? !0 : f.hasPath, f.componentLists = v ? X(e.value.componentLists) : f.componentLists; } } }); }), e.value.componentLists.length && e.value.boundEventsList && e.value.boundEventsList.forEach((a) => { var f; if ((f = a.command) != null && f.targetComponent) { const E = d.find( (v) => { var g; return v.componentId === (((g = a.command) == null ? void 0 : g.targetComponent) || ""); } ); if ((E ? E.viewModelId : void 0) === e.value.viewModelId) a.command.hasPath = !1; else { const v = t( a.controller.id, a.command.handlerName ); a.command.hasPath = v ? !0 : a.command.hasPath, a.command.componentLists = v ? X(e.value.componentLists) : a.command.componentLists; } } }); } function y() { const d = i.value.reduce( (f, E) => (f.set(E.boundEvents.label, !0), f), /* @__PURE__ */ new Map() ); return o.value.filter((f) => !d.has(f.label)); } function b() { var a; const d = ((a = i.value) == null ? void 0 : a.length) > 0; s.value = d ? y() : o.value; } function L() { c(), o.value = e.value.events, i.value = e.value.boundEventsList, b(); } function O(d) { s.value = s.value.filter((a) => a.label !== d.label); } function V(d) { i.value = i.value.filter((a) => a.boundEvents.label !== d.label), b(); } function N() { var f; const d = (f = e.value) == null ? void 0 : f.getEventList(), { events: a } = d; d && (e.value.events = X(a), e.value.boundEventsList = d.boundEventsList), e.value.boundEventsList && (e.value.boundEventsList = e.value.boundEventsList.filter(function(E) { return a.find((p) => p.label === E.boundEvents.label); })); } return { allEvents: o, boundEvents: i, candidateEvents: s, excludeFromCandidates: O, loadEvents: L, resetBoundEvents: N, unBoundEvent: V }; } const Ro = { sourceCommunication: { type: Object, default: {} } }, Do = { events: { type: Array, default: [] } }, jo = /* @__PURE__ */ ce({ name: "FEventList", props: Do, emits: ["click"], setup(e, o) { const i = w(e.events); function s(c) { o.emit("click", c); } function t(c) { return n("div", { class: "f-page-events-editor-first-bound-event" }, [n("div", { onClick: () => s(c), class: "f-page-events-editor-first-bound-event-name" }, [c.name])]); } return () => n("div", { class: "f-page-events-editor-events" }, [i.value.map((c) => t(c))]); } }), Re = { /** 通讯id */ communication: { type: Object }, /** 通讯来源 */ sourceCommunication: { type: Object, default: {} }, /** 当前事件编号 */ event: { type: String, default: "" } }, Uo = /* @__PURE__ */ ce({ name: "FSelectSourceControl", props: Re, emits: ["selectSourceEvent", "deleteControl"], setup(e, o) { const i = oe("useFormSchema"), { createNewCommunication: s } = Ae(i), t = w(); t.value = s(e); const c = w([{ field: "name", title: "", dataType: "string" }]), y = w([]), b = w(), L = w(), O = w(!0), V = w(!1), N = w([]), d = w(), a = w(!0), f = w(!1); function E() { const I = oe("sourceOutlineData"); y.value = I || [], L.value.updateDataSource(y.value); } function p() { var A, u, l; if (!((u = (A = t.value) == null ? void 0 : A.source) != null && u.componentId)) { f.value = !1; return; } const I = (l = y.value) == null ? void 0 : l.find((m) => m.originalId === t.value.source.componentId); I ? (L.value.selectItemById(I.id), f.value = !1) : (f.value = !0, b.value = { id: t.value.source.componentId }); } function v() { var I, A, u; (A = (I = t.value) == null ? void 0 : I.source) != null && A.event && ((u = N.value) != null && u.length) && (d.value = N.value.find((l) => { var m, C; return l.eventCode === ((C = (m = t.value) == null ? void 0 : m.source) == null ? void 0 : C.event); })); } Ne(() => { E(), p(), v(), a.value = !1; }); function g() { N.value = []; const I = b.value.rawSchema, A = i.resolveComponentEvents(nn, I); A && Object.keys(A).forEach((u) => { N.value.push({ eventCode: u, eventName: A[u] }); }); } function S(I) { O.value = !1, f.value = !1; const A = b.value !== I[0]; A && (b.value = I[0], g()), a.value || (V.value = !0), !a.value && A && (d.value = null); } const r = J(() => ({ "item-list": !0, "d-none": !O.value })), _ = J(() => (I) => { var A; return { item: !0, selected: ((A = d.value) == null ? void 0 : A.eventCode) === I }; }); function z(I) { var A; O.value = !1, V.value = !1, d.value = I, t.value.source.componentId = b.value.rawSchema.id, t.value.source.event = (A = d.value) == null ? void 0 : A.eventCode, o.emit("selectSourceEvent", t.value); } const U = J(() => ({ "form-container": !0, "position-relative": !0, invalid: f.value })); return () => n("div", { class: U.value }, [n("div", { class: r.value, style: "min-height:220px;" }, [n("span", { class: "tip" }, [te("请选择源控件")]), n("div", { style: "overflow:auto;flex:1;display:block" }, [n(On, { ref: L, autoExpandWidth: !0, data: y.value, columns: c.value, columnOption: { fitColumns: !0, fitMode: "expand" }, showTreeNodeIcons: !0, fit: !1, autoHeight: !0, iconField: "controlIcon", onSelectionChange: S }, null)])]), V.value && n(Qe, null, [n("div", { class: "item-list" }, [n("span", { class: "tip" }, [te("请选择事件")]), N.value.map((I) => n("span", { class: _.value(I.eventCode), onClick: () => z(I) }, [I.eventName]))])])]); } }), qo = /* @__PURE__ */ ce({ name: "FInteractionButton", props: Ro, emits: ["clickEventItem", "selectSourceControl"], setup(e, o) { const i = new Pe(), s = oe("useEventsComposition"), t = oe("useInteractionCompostion"), { candidateEvents: c } = s, { collapseInteractions: y } = t, b = w(!1), L = w(!1); function O(f) { c.value = c.value.filter((E) => E.label !== f.label); } function V() { var f; (f = e.sourceCommunication) != null && f.needSelectSourceControl ? L.value = !L.value : b.value = !b.value; } function N(f) { V(), O(f), o.emit("clickEventItem", f); } function d() { var f; if (!((f = e.sourceCommunication) != null && f.needSelectSourceControl) && c.value.length === 0) { i.info({ position: "top-center", message: "事件已全部绑定" }); return; } y(), V(); } function a(f) { L.value = !1, o.emit("selectSourceControl", f); } return () => n(Qe, null, [n("div", { class: "f-page-events-editor-top-button" }, [n("button", { class: "f-page-events-editor-button", onClick: d }, [n("span", { class: "f-page-events-editor-text" }, [te("新建交互事件")])])]), b.value && n(jo, { events: c.value, onClick: N }, null), L.value && n(Uo, { sourceCommunication: e.sourceCommunication, onSelectSourceEvent: a }, null)]); } }), Ho = { collapsed: { type: Boolean, default: !0 }, displayOrder: { type: Number, default: -1 }, interaction: { type: Object, default: {} }, controllers: { type: Array, default: [] }, sourceCommunication: { type: Object, default: {} }, viewSourceHandle: { type: Function, default: () => { } }, /** 接收是否显示「可选择方法」功能 */ haveBoundCommand: { Type: Boolean, default: !1 } }, Go = { /** 判断是否为新引入的方法 */ newImport: { Type: Boolean, default: !1 }, /** 新增的内置构件列表 */ addInternalCommandList: { Type: Array, default: [] }, /** 外层传入数据 */ outerLayerValue: { Type: Number, default: 0 }, /** 判断是否为:点击“导入此方法”后,绑定了新增值 */ exit: { Type: Number, default: -1 }, /** 接收是否显示「可选择方法」功能 */ haveBoundCommand: { Type: Boolean, default: !1 }, controllers: { type: Array, default: [] }, iteractionDisplayOrder: { Type: Number, default: 0 }, /** 当前编辑的事件编号、事件名称 */ event: { Type: Object }, /** 通讯来源 */ sourceCommunication: { type: Object, default: {} } }, _o = { controllers: { type: Array, default: [] } }, zo = /* @__PURE__ */ ce({ name: "FCommandList", props: _o, emits: ["selectMethod"], setup(e, o) { function i(b) { return b.controllerList.length !== 0; } function s(b) { return i(b) && n("div", { class: "f-page-internals-controller" }, [n("div", { class: "f-page-internals-controller-name", title: b.controllerName.name }, [b.controllerName.name])]); } function t(b, L) { o.emit("selectMethod", { method: b, controller: L }); } function c(b) { return b.controllerList.map((L) => n("div", { class: "f-page-internals-command", onClick: () => t(L, b) }, [n("div", { class: "f-page-internals-command-name", title: L.label }, [L.name])])); } function y(b) { return n("div", null, [s(b), c(b)]); } return () => n("div", { class: "f-page-internals" }, [e.controllers.map((b) => y(b))]); } }), Wo = { getEventPath: { type: Function, default: null }, notifyService: { type: Object }, useFormSchema: { type: Object }, /** 通讯来源 */ sourceCommunication: { type: Object, default: {} }, /** 当前编辑的事件编号、事件名称 */ event: { Type: Object } }, Ko = /* @__PURE__ */ ce({ name: "FBoundEventSelector", props: Wo, emits: ["cancel", "submit"], setup(e, o) { var P, j; const i = w(), s = w([]), t = w('<i class="f-icon f-icon-search"></i>'), c = e.useFormSchema.getFormMetadataBasicInfo(), y = w(""), b = w(), L = ((P = e.sourceCommunication) == null ? void 0 : P.unSupportedEventCodes) || [], O = w(!L.includes(e.event.label) && ((j = e.useFormSchema.externalFormSchema) == null ? void 0 : j.size) > 0), V = w(), N = w([]); mn(() => { if (e.getEventPath) { const F = e.getEventPath(); i.value = F.viewModelDisplay; const { actionWithPath: R } = F; R.forEach((D) => { D.sourceComponent.map.forEach((W) => { W.active = !1, W.hide = !1; }); }), s.value = X(R); } }); function d(F = "") { F = F.replace(/ /g, "").replace(/>/g, "").toLowerCase(), F === "" && (F = " "), s.value.forEach((R) => { const D = R.path; R.sourceComponent.map.forEach((W) => { const Z = W.command.name, ie = W.event.name, T = W.command.label; `${D}${Z}${ie}${T}`.toLowerCase().includes(F) ? W.hide = !1 : W.hide = !0; }); }); } function a(F = "") { F = F.replace(/ /g, "").replace(/>/g, "").toLowerCase(), N.value.forEach((R) => { if (!R.isCommandNode) return; const D = R.name || "", W = R.code || "", Z = R.viewmodelName || "", ie = `${D}${W}${Z}`.toLowerCase(); F && !ie.includes(F) ? R.hide = !0 : R.hide = !1; }); } function f(F = "") { !V.value || V.value.id === c.id ? d(F) : a(F); } function E() { const F = n("div", { class: "f-vm-search" }, [n("div", { class: "f-vm-searchBar" }, [n(jn, { updateOn: "change", groupText: t.value, modelValue: y.value, "onUpdate:modelValue": (R) => y.value = R, onChange: f, placeholder: "请输入名称/编号/路径搜索" }, null)])]); return O.value ? n("div", { class: "f-navSelector-header" }, [n("div", { class: "f-navSelector-recommand" }, [n("div", { class: "f-navSelector-recommand-text" }, [te("方法列表")])]), n("div", { class: "f-navSelector-remainder" }, [n("div", { class: "f-vm-search" }, [F])])]) : F; } function p(F) { return { "f-vm-item": !0, "f-vm-item-focus": F.active }; } function v(F, R) { let D = 0; s.value.forEach((W) => { W.sourceComponent.map.forEach((Z) => { !Z.command.isInvalid && F.controller.id === Z.controller.id && F.command.id === Z.command.id && F.event.label === Z.event.label && R.sourceComponent.id === W.sourceComponent.id ? (F.active = !F.active, b.value = X(F)) : (Z.command.isInvalid && F.controller.id === Z.controller.id && F.command.id === Z.command.id && F.event.label === Z.event.label && R.sourceComponent.id === W.sourceComponent.id && (D++, D === 1 && (new Pe().info({ position: "top-center", message: "该方法已失效" }), b.value = null)), Z.active = !1); }); }); } function g(F) { return { "f-event-func": !F.command.isInvalid, "f-event-func-invalid": F.command.isInvalid }; } function S(F) { return F.sourceComponent.map.filter((R) => !R.hide).map((R) => { if (!R.command.isInvalid) return n("div", { class: p(R), onClick: () => v(R, F) }, [n("div", { class: "f-event-commandItem" }, [n("div", { class: "f-icon-command" }, [n("div", { class: "f-icon f-icon-source-code", style: "font-size:10px;color:#30B471;" }, [te(" ")])]), n("div", { class: g(R) }, [R.command.name, te("("), R.command.label, te(")")])]), n("div", { class: "f-event-path" }, [F.path, R.event.name])]); }); } function r() { return s.value.length > 0 ? n("div", { class: "f-vm-viewModel flex-fill" }, [s.value.map((F) => S(F))]) : n("div", { class: "f-list-view-emptydata", style: "height: 360px;position: relative;" }, [n("div", { class: "f-datagrid-norecords" }, [n("div", { class: "f-datagrid-norecords-content" }, [te(" 暂无数据")])])]); } function _() { o.emit("cancel"); } function z() { if (!b.value) { e.notifyService.info({ position: "top-center", message: "请选择需要绑定的方法" }); return; } o.emit("submit", { selectedCommand: b.value, selectedForm: V.value }); } function U() { const F = e.useFormSchema.externalFormSchema, R = []; return R.push({ containerId: "", id: c.id, code: c.code, name: c.name }), Array.from(F.keys()).forEach((D) => { const W = F.get(D); R.push({ containerId: D, id: W.id, code: W.code, name: W.name }); }), R; } const I = J(() => ({ "f-vm-all": !0, " h-100": !0, "has-page-list": O.value })); function A(F) { var Z, ie; const { viewmodels: R, components: D } = F.module; if ((R == null ? void 0 : R.length) === 0 || (D == null ? void 0 : D.length) === 0) return []; N.value = []; const W = (ie = (Z = e.sourceCommunication) == null ? void 0 : Z.parameterData) == null ? void 0 : ie.getViewModelName; R.forEach((T) => { if (!T || !T.commands || T.commands.length === 0) return []; const ee = D.find((be) => be.viewModel === T.id), se = W && ee ? W(ee, T.name, F) : ""; N.value.push({ id: T.id, code: T.code, name: se || T.name }), T.commands.forEach((be) => { be.isInvalid || N.value.push({ ...be, viewmodelId: T.id, viewmodelName: se || T.name, isCommandNode: !0 }); }); }); } function u(F) { var R, D, W; if (!(F.id === V.value.id && F.containerId === V.value.containerId)) if (V.value = F, y.value = "", b.value = null, V.value.id !== c.id) { const Z = (D = e.useFormSchema.externalFormSchema) == null ? void 0 : D.get((R = V.value) == null ? void 0 : R.containerId); (W = Z == null ? void 0 : Z.content) != null && W.module && A(Z.content); } else s.value.map((Z) => { Z.sourceComponent.map.map((ie) => { ie.hide = !1, ie.active = !1; }); }); } function l() { const F = U(); V.value || (V.value = F[0]); const R = J(() => (D) => { var W; return { "f-list-view-group-item": !0, "f-listview-active": D.id === ((W = V.value) == null ? void 0 : W.id) && D.containerId === V.value.containerId }; }); return n("div", { class: "f-page-nav" }, [n("div", { class: "f-list-view" }, [n("div", { class: "f-list-view-content" }, [n("ul", { class: "f-list-view-group", style: "list-style: none;" }, [F.map((D) => { let W = D.name; return D.containerId && (W += `, 所属外部容器:${D.containerId}`), n("li", { class: R.value(D), onClick: () => u(D) }, [n("div", { class: "f-list-content" }, [n("div", { class: "f-navSelector-leftCategory", title: W }, [D.name])])]); })])])])]); } function m(F) { N.value.map((R) => R.active = !1), F.active = !0, b.value = F; } function C() { return n("div", { class: "f-vm-viewModel flex-fill" }, [N.value.filter((F) => !F.hide).map((F) => { if (F.isCommandNode) return n("div", { class: p(F), onClick: () => m(F) }, [n("div", { class: "f-event-commandItem" }, [n("div", { class: "f-icon-command" }, [n("div", { class: "f-icon f-icon-source-code", style: "font-size: 10px; color: rgb(48, 180, 113);" }, null)]), n("div", { class: "f-event-func" }, [F.name, te("("), F.code, te(")")])]), n("div", { class: "f-event-path" }, [F.viewmodelName])]); })]); } return () => n("div", { class: I.value }, [n("div", { class: "d-flex f-utils-fill-flex-row splitter" }, [O.value ? l() : "", n("div", { class: "f-utils-fill-flex-column" }, [E(), !V.value || V.value.id === c.id ? r() : C()])]), n("div", { class: "modal-footer" }, [n("button", { type: "button", class: "btn btn-secondary", onClick: _ }, [te("取消")]), n("button", { type: "button", class: "btn btn-primary", onClick: z }, [te("确定")])])]); } }), Qo = /* @__PURE__ */ ce({ name: "FCommandSource", props: Go, emits: ["addInternalComm