UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,511 lines 143 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 ae, ref as F, defineComponent as se, createVNode as n, onMounted as Ne, computed as J, createTextVNode as oe, 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 Bn, FormSchemaEntityField$Type as an, FormSchemaEntityFieldTypeName as rn, getCustomClass as hn, useThirdComponent as kn, 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, useBindingData as Hn, useEntityState as Gn, useDynamicViewUtils as _n, componentMap as Xe, resolverMap as zn, componentPropsConverter as Wn } from "../dynamic-view/index.esm.js"; import Kn from "../section/index.esm.js"; import Qn from "../accordion/index.esm.js"; import Jn from "../avatar/index.esm.js"; import Yn from "../../designer/button-edit/index.esm.js"; import Xn from "../button-group/index.esm.js"; import Zn from "../calendar/index.esm.js"; import et from "../../designer/capsule/index.esm.js"; import ln from "../../designer/checkbox/index.esm.js"; import cn from "../../designer/checkbox-group/index.esm.js"; import nt from "../combo-tree/index.esm.js"; import tt from "../component/index.esm.js"; import ot from "../color-picker/index.esm.js"; import at from "../content-container/index.esm.js"; import rt from "../../designer/date-picker/index.esm.js"; import lt from "../../designer/data-grid/index.esm.js"; import it from "../dropdown/index.esm.js"; import ct from "../../designer/dynamic-form/index.esm.js"; import st from "../events-editor/index.esm.js"; import ut from "../filter-bar/index.esm.js"; import dt from "../field-selector/index.esm.js"; import mt from "../binding-selector/index.esm.js"; import ft from "../image-cropper/index.esm.js"; import vt from "../../designer/input-group/index.esm.js"; import ht from "../layout/index.esm.js"; import pt from "../list-nav/index.esm.js"; import gt from "../../designer/list-view/index.esm.js"; import Ct from "../lookup/index.esm.js"; import bt from "../mapping-editor/index.esm.js"; import yt from "../nav/index.esm.js"; import Ft from "../number-range/index.esm.js"; import wt from "../../designer/number-spinner/index.esm.js"; import St from "../order/index.esm.js"; import Et from "../page-header/index.esm.js"; import Nt from "../page-footer/index.esm.js"; import Pt from "../pagination/index.esm.js"; import Mt from "../progress/index.esm.js"; import Vt from "../query-solution/index.esm.js"; import Lt from "../../designer/radio-group/index.esm.js"; import Tt from "../../designer/rate/index.esm.js"; import Bt from "../../designer/response-toolbar/index.esm.js"; import kt from "../response-layout/index.esm.js"; import It from "../../designer/response-layout-editor/index.esm.js"; import xt from "../search-box/index.esm.js"; import $t from "../../designer/section/index.esm.js"; import Ot from "../smoke-detector/index.esm.js"; import At from "../splitter/index.esm.js"; import Rt from "../step/index.esm.js"; import Dt from "../../designer/switch/index.esm.js"; import jt from "../../designer/tabs/index.esm.js"; import Ut from "../../designer/tags/index.esm.js"; import qt from "../text/index.esm.js"; import Ht from "../../designer/time-picker/index.esm.js"; import Gt from "../transfer/index.esm.js"; import _t from "../uploader/index.esm.js"; import zt from "../verify-detail/index.esm.js"; import Wt from "../video/index.esm.js"; import Kt from "../../designer/textarea/index.esm.js"; import Qt from "../../designer/tree-grid/index.esm.js"; import Jt from "../filter-condition-editor/index.esm.js"; import Yt from "../fieldset/index.esm.js"; import Xt from "../sort-condition-editor/index.esm.js"; import Zt from "../menu-lookup/index.esm.js"; import eo from "../../designer/drawer/index.esm.js"; import no from "../json-editor/index.esm.js"; import to from "../property-editor/index.esm.js"; import oo from "../expression-editor/index.esm.js"; import ao from "../code-editor/index.esm.js"; import ro from "../html-template/index.esm.js"; import lo from "../collection-property-editor/index.esm.js"; import io from "../../designer/modal/index.esm.js"; import co from "../external-container/index.esm.js"; import so from "../language-textbox/index.esm.js"; import uo from "../image/index.esm.js"; import mo from "../comment/index.esm.js"; import "../property-panel/index.esm.js"; const fo = /* @__PURE__ */ new Map([ ["appearance", vn] ]); function vo(e, o, i) { return o; } const ho = "https://json-schema.org/draft/2020-12/schema", po = "https://farris-design.gitee.io/events-editor.schema.json", go = "events-editor", Co = "A Farris Component", bo = "object", yo = { 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 } }, Fo = [ "id", "type" ], wo = { $schema: ho, $id: po, title: go, description: Co, type: bo, properties: yo, required: Fo }, So = "events-editor", Eo = "A Farris Component", No = "object", Po = {}, Mo = { title: So, description: Eo, type: No, categories: Po }, sn = [ { label: "pageChange", name: "MockMock切换页码" }, { label: "pageSizeChanged", name: "Mock分页条数变化事件" }, { label: "scrollYLoad", name: "Mock滚动加载事件" }, { label: "onEditClicked", name: "Mock操作列点击编辑" }, { label: "onDeleteClicked", name: "Mock操作列点击删除" } ], Vo = { 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: sn, /** 已绑定的事件(拼接已有的参数值,拼接当前事件->待集成-从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: sn, boundEventsList: [] }) }, Cn = { initialData: { type: Object, default: Vo }, viewSourceHandle: { type: Function, default: () => { } } }, Lo = Je( Cn, wo, fo, vo, Mo ); 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 d = -1; const S = t.findIndex((b) => i === b.controllerId); return S !== -1 && (d = t[S].commands.findIndex((b) => s === b.handlerName)), d !== -1; } function o(i, s, t) { const d = e(i.controllerName.id, s.handlerName); return t.componentLists.length !== 0 && d && (s.hasPath = !0, s.targetComponent = s.targetComponent || t.componentLists[0].componentId, s.componentLists = X(t.componentLists)), s; } return { isContextDependent: e, setComponentLists: o }; } var Ee = /* @__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))(Ee || {}); function To(e, o) { const i = ae("designerContext"), s = i && i.dgControl ? i.dgControl : xn, t = F(""), d = F(""); function S(a) { var h, C, E, l; let f = "controlIcon fd-i-Family ", y = ""; switch (a == null ? void 0 : a.type) { case "form-group": { y = ((h = s[a.type]) == null ? void 0 : h.icon) || ((C = a.editor) == null ? void 0 : C.type) || "", (E = s[a.editor.type]) != null && E.icon && (y = s[a.editor.type].icon); break; } default: y = ((l = s[a.type]) == null ? void 0 : l.icon) || a.type; } const g = `fd_pc-${y}`; return f += g, f; } function b(a, f) { var h; let y = a.id; const g = f == null ? void 0 : f.contents; if ((f == null ? void 0 : f.type) === "splitter" && g && g.length === 2) { const C = f.direction !== "column"; a.id === ((h = g[0]) == null ? void 0 : h.id) ? y = C ? "左侧区域" : "上方区域" : y = C ? "右侧区域" : "下方区域"; } return y; } function I(a) { if (a.isLikeCardContainer) return "区块"; const f = a.appearance && a.appearance.class || "", y = f.split(" "); return a.id === "page-header" && f && f === "f-page-header" ? "页头" : y.includes("f-page-header-base") ? "页头容器" : y.includes("f-page-header-extend") ? "页头扩展容器" : y.includes("f-title") ? "标题容器" : y.includes("f-page") ? "根容器" : y.includes("f-page-main") ? "内容区域" : y.includes("f-scrollspy-content") && a.isScrollspyContainer ? "滚动监听容器" : y.includes("f-grid-is-sub") ? "表格容器" : y.includes("f-filter-container") ? "筛选条容器" : "容器"; } function A(a) { const { componentType: f } = a; switch (f) { case Ee.Frame: return "根组件"; case Ee.dataGrid: return (e == null ? void 0 : e.formSchemaUtils.selectNode(a, (g) => g.type === (s["tree-grid"] && s["tree-grid"].type))) ? "树表格组件" : "表格组件"; case Ee.uploader: return "附件组件"; case Ee.listView: return "列表视图组件"; case Ee.form: return "卡片组件"; case Ee.calendar: return "日历组件"; case Ee.page: return a.name || "页面"; default: return "组件"; } } function w(a, f) { const y = a.name || a.text || a.label || a.title || a.mainTitle; if (a.type !== "component" && y && typeof y == "string") return y.trim(); switch (a.type) { case "content-container": return I(a); case "splitter-pane": return b(a, f); case "component": return A(a); default: return s[a.type] && s[a.type].name || a.id; } } function P(a, f) { const y = a.length ? a[0] : null; if (!y) return; d.value = "", t.value = y.originalId; const g = y ? `${y.originalId}-design-item` : "", h = document.getElementById(g); h && h.click(), o.emit("selectionChanged", y); } function m(a) { if (!a) return; const f = `${a}-design-item`, y = document.getElementById(f); y && y.click(); } return { getIcon: S, getTitle: w, onChanged: P, currentSelectedNodeId: t, currentSelectedOutsideNodeId: d, triggerOutsideClick: m }; } function Bo(e, o) { const { getIcon: i, getTitle: s } = o; function t(w, P, m, a, f) { var g; const y = (g = e.data.module) == null ? void 0 : g.components.find((h) => h.id === w.component); y && d([y], P, m, a, f); } function d(w, P, m, a, f) { return w.forEach((y) => { if (y.type === "component" && (f = y.id), y.type === "component-ref") { t(y, P, m, a, f); return; } const g = { originalId: y.id, layer: m, originalParent: a == null ? void 0 : a.id, componentId: f, name: s(y, a), type: y.type, controlIcon: i(y), rawSchema: y }; P.push(X(g)), (y.contents || y.buttons) && d(y.contents || y.buttons, P, m + 1, y, f); }), P; } function S(w) { const P = [], m = w.find((g) => g.layer === 0); w = w.filter((g) => g.layer !== 0), P.push(m); let a = m.originalId, f = 0, y = 1e3; for (; w.length !== 0 || y === 0; ) { const g = w.find((h) => h.originalParent === a); g ? (P.push(g), a = g.originalId, w = w.filter((h) => h.originalId !== a), f = 0) : (f -= 1, a = P.slice(f)[0].originalId), y -= 1; } return P; } function b(w) { return w.forEach((P, m) => { P.id = (m + 1).toString(); }), w.forEach((P) => { var m; P.parent = ((m = w.find((a) => a.originalId === P.originalParent)) == null ? void 0 : m.id) || ""; }), w.forEach((P) => { P.hasChildren = w.findIndex((m) => m.parent === P.id) > 0; }), w; } function I(w) { const P = { originalId: e.data.module.id, layer: 0, originalParent: null, name: "页面", type: "module", controlIcon: "controlIcon fd-i-Family fd_pc-module", rawSchema: e.data.module }, m = []; return w.forEach((a) => { a[0].originalParent = P.originalId, m.push(...a); }), m.unshift(P), m; } function A() { const w = e.data.module ? F(e.data.module.components) : F([e.data]); if (!w.value) return; const P = []; w.value.forEach((y) => { if (y) { const g = []; g.push(y); const E = d(g, [], 1, null, y.id); P.push(E); } }); const m = I(P), a = S(m); return b(a); } return { getData: A }; } function Ae(e) { const o = ae("sourceOutlineData") || [], i = F(), s = F(!1), t = F([]), d = F(); function S(g, h, C, E) { var l, _, z, j; return { id: tn().guid(), source: E || { formId: (l = g.sourceCommunication) == null ? void 0 : l.formId, formCode: (_ = g.sourceCommunication) == null ? void 0 : _.formCode, componentId: (z = g.sourceCommunication) == null ? void 0 : z.componentId, externalContainerId: (j = g.sourceCommunication) == null ? void 0 : j.externalContainerId, event: h || "onCommunication" }, target: { formId: (C == null ? void 0 : C.formId) || "", formCode: (C == null ? void 0 : C.formCode) || "", externalContainerId: (C == null ? void 0 : C.externalContainerId) || "", commandCode: (C == null ? void 0 : C.commandCode) || "", commandViewmodelId: (C == null ? void 0 : C.commandViewmodelId) || "" }, paramMappings: [] }; } function b(g) { var h, C; (h = g == null ? void 0 : g.communication) != null && h.length && ((C = g == null ? void 0 : g.communication) == null || C.map((E) => { var l, _; if (E != null && E.id && !((l = E == null ? void 0 : E.source) != null && l.componentId)) { const z = (_ = e.getFormSchema().module.communications) == null ? void 0 : _.find((j) => j.id === (E == null ? void 0 : E.id)); z && Object.assign(E, z); } })); } function I(g) { const h = e.getFormSchema(), { communications: C } = h.module; C || (h.module.communications = []); const E = h.module.communications.findIndex((l) => l.id === g.id); E === -1 ? h.module.communications.push(g) : Object.assign(h.module.communications[E], g); } function A(g) { var h; if ((h = g == null ? void 0 : g.communication) != null && h.length) { const C = e.getFormSchema(); g.communication.map((E) => { C.module.communications && E && (C.module.communications = C.module.communications.filter((l) => l.id !== E.id)); }), g.communication = []; } } function w(g) { var C; const h = e.getFormSchema(); g && ((C = h.module.communications) != null && C.length) && (h.module.communications = h.module.communications.filter((E) => E.id !== g)); } function P(g, h, C) { const E = To(g, h), l = e.externalFormSchema.get(C); if (l != null && l.content) { const _ = { data: l.content }, { getData: z } = Bo(_, E); return z(); } return []; } function m(g) { var C; if (!((C = g == null ? void 0 : g.source) != null && C.componentId)) { s.value = !1; return; } const h = o.find((E) => E.originalId === g.source.componentId); h ? (s.value = !1, i.value = h) : (s.value = !0, i.value = { id: g.source.componentId }); } function a(g) { var l, _, z, j; t.value = []; const h = (l = i.value) == null ? void 0 : l.rawSchema; if (!h) { d.value = null; return; } const C = h.type === "form-group" && h.editor ? h.editor.type : h.type, E = (_ = nn[C]) == null ? void 0 : _.events; E && Object.keys(E).forEach((V) => { t.value.push({ eventCode: V, eventName: E[V] }); }), (z = g.source) != null && z.event && ((j = t.value) != null && j.length) && (d.value = t.value.find((V) => { var O; return V.eventCode === ((O = g.source) == null ? void 0 : O.event); })); } function f(g) { var E, l, _, z, j, V, O, c; if (!(g != null && g.length)) return; m(g[0]), a(g[0]); let h = "", C = ""; return s.value ? h = `${((E = g[0].source) == null ? void 0 : E.componentId) || ""}-${((l = g[0].source) == null ? void 0 : l.event) || ""}` : (h = (_ = i.value) == null ? void 0 : _.name, h && ((z = d.value) != null && z.eventName) && (h += `-${(j = d.value) == null ? void 0 : j.eventName}`), C = `${(V = i.value) == null ? void 0 : V.name} (${(O = i.value) == null ? void 0 : O.originalId})`, C = `${C} ${(c = d.value) == null ? void 0 : c.eventName} (${d.value.eventCode})`), { title: h, titleTip: C, isControlInvalid: s.value }; } function y(g) { var h; if ((h = g == null ? void 0 : g.communication) != null && h.length) { const C = g == null ? void 0 : g.communication[0]; return C == null ? void 0 : C.source; } } return { createNewCommunication: S, resolveCommunication: b, clearAllCommunication: A, clearCommunicationById: w, saveCommunication: I, assembleSourceOutline: P, resolveSourceControlEventTitle: f, resolveCommunicationSource: y }; } function ko(e, o, i) { const s = F([]), { boundEvents: t, unBoundEvent: d } = o; function S(m) { var f, y; return { /** 当前事件名称及label */ event: { label: (f = m.boundEvents) == null ? void 0 : f.label, name: (y = m.boundEvents) == null ? void 0 : y.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(m.command), /** 当前的控制器 */ controller: X(m.controller), /** 通讯 */ communication: m.communication }; } function b() { var m; s.value = (m = t.value) == null ? void 0 : m.map((a) => S(a)); } function I(m, a) { const y = S({ boundEvents: m, command: null, controller: { id: "", name: "", label: "" }, communication: a ? [a] : [] }); if (a) { y.showSwitch[0].showSwitchNumber = 2, y.showSwitch[0].showSection[2][2] = !1, y.showSwitch[0].showSection[2][3] = !1, y.needSelectCommunicationCommand = !0, s.value.unshift(y); return; } m && (y.showSwitch[0].showSwitchNumber = 1, y.showSwitch[0].showSection[2][3] = !0, s.value.unshift(y)); } function A() { var m; (m = s.value) == null || m.forEach((a) => { a.showSwitch.forEach((f) => { f.showSection[2][3] = !1; }), a.shouldShowCommunicationPanel = !1; }); } function w(m) { s.value[m].showSwitch.forEach((a) => { a.showSection[2][3] = !a.showSection[2][3]; }); } function P(m) { if (m >= 0 && m <= s.value.length - 1) { const a = s.value[m]; d(a.event), s.value.splice(m, 1); const { clearAllCommunication: f } = Ae(e); f(a); } } return { addNewInteraction: I, collapseInteractions: A, deleteInteracton: P, toggleMethodInInteraction: w, interactions: s, loadInteractions: b }; } function Io(e) { const o = F([]), i = F([]), s = F([]), { isContextDependent: t } = bn(); function d() { const { allComponentList: m } = e.value; e.value.componentLists.length && e.value.viewModel && e.value.viewModel.forEach((a) => { a.controllerList.forEach((f) => { if (f.targetComponent) { const y = m.find((h) => h.componentId === f.targetComponent); if ((y ? y.viewModelId : void 0) === e.value.viewModelId) f.hasPath = !1; else { const h = t(a.controllerName.id, f.handlerName); f.hasPath = h ? !0 : f.hasPath, f.componentLists = h ? 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 y = m.find( (h) => { var C; return h.componentId === (((C = a.command) == null ? void 0 : C.targetComponent) || ""); } ); if ((y ? y.viewModelId : void 0) === e.value.viewModelId) a.command.hasPath = !1; else { const h = t( a.controller.id, a.command.handlerName ); a.command.hasPath = h ? !0 : a.command.hasPath, a.command.componentLists = h ? X(e.value.componentLists) : a.command.componentLists; } } }); } function S() { const m = i.value.reduce( (f, y) => (f.set(y.boundEvents.label, !0), f), /* @__PURE__ */ new Map() ); return o.value.filter((f) => !m.has(f.label)); } function b() { var a; const m = ((a = i.value) == null ? void 0 : a.length) > 0; s.value = m ? S() : o.value; } function I() { d(), o.value = e.value.events, i.value = e.value.boundEventsList, b(); } function A(m) { s.value = s.value.filter((a) => a.label !== m.label); } function w(m) { i.value = i.value.filter((a) => a.boundEvents.label !== m.label), b(); } function P() { var f; const m = (f = e.value) == null ? void 0 : f.getEventList(), { events: a } = m; m && (e.value.events = X(a), e.value.boundEventsList = m.boundEventsList), e.value.boundEventsList && (e.value.boundEventsList = e.value.boundEventsList.filter(function(y) { return a.find((g) => g.label === y.boundEvents.label); })); } return { allEvents: o, boundEvents: i, candidateEvents: s, excludeFromCandidates: A, loadEvents: I, resetBoundEvents: P, unBoundEvent: w }; } const xo = { sourceCommunication: { type: Object, default: {} } }, $o = { events: { type: Array, default: [] } }, Oo = /* @__PURE__ */ se({ name: "FEventList", props: $o, emits: ["click"], setup(e, o) { const i = F(e.events); function s(d) { o.emit("click", d); } function t(d) { return n("div", { class: "f-page-events-editor-first-bound-event" }, [n("div", { onClick: () => s(d), class: "f-page-events-editor-first-bound-event-name" }, [d.name])]); } return () => n("div", { class: "f-page-events-editor-events" }, [i.value.map((d) => t(d))]); } }), Re = { /** 通讯id */ communication: { type: Object }, /** 通讯来源 */ sourceCommunication: { type: Object, default: {} }, /** 当前事件编号 */ event: { type: String, default: "" } }, Ao = /* @__PURE__ */ se({ name: "FSelectSourceControl", props: Re, emits: ["selectSourceEvent", "deleteControl"], setup(e, o) { const i = ae("useFormSchema"), { createNewCommunication: s } = Ae(i), t = F(); t.value = s(e); const d = F([{ field: "name", title: "", dataType: "string" }]), S = F([]), b = F(), I = F(), A = F(!0), w = F(!1), P = F([]), m = F(), a = F(!0), f = F(!1); function y() { const V = ae("sourceOutlineData"); S.value = V || [], I.value.updateDataSource(S.value); } function g() { var O, c, r; if (!((c = (O = t.value) == null ? void 0 : O.source) != null && c.componentId)) { f.value = !1; return; } const V = (r = S.value) == null ? void 0 : r.find((u) => u.originalId === t.value.source.componentId); V ? (I.value.selectItemById(V.id), f.value = !1) : (f.value = !0, b.value = { id: t.value.source.componentId }); } function h() { var V, O, c; (O = (V = t.value) == null ? void 0 : V.source) != null && O.event && ((c = P.value) != null && c.length) && (m.value = P.value.find((r) => { var u, M; return r.eventCode === ((M = (u = t.value) == null ? void 0 : u.source) == null ? void 0 : M.event); })); } Ne(() => { y(), g(), h(), a.value = !1; }); function C() { var r; P.value = []; const V = b.value.rawSchema, O = V.type === "form-group" && V.editor ? V.editor.type : V.type, c = (r = nn[O]) == null ? void 0 : r.events; c && Object.keys(c).forEach((u) => { P.value.push({ eventCode: u, eventName: c[u] }); }); } function E(V) { A.value = !1, f.value = !1; const O = b.value !== V[0]; O && (b.value = V[0], C()), a.value || (w.value = !0), !a.value && O && (m.value = null); } const l = J(() => ({ "item-list": !0, "d-none": !A.value })), _ = J(() => (V) => { var O; return { item: !0, selected: ((O = m.value) == null ? void 0 : O.eventCode) === V }; }); function z(V) { var O; A.value = !1, w.value = !1, m.value = V, t.value.source.componentId = b.value.rawSchema.id, t.value.source.event = (O = m.value) == null ? void 0 : O.eventCode, o.emit("selectSourceEvent", t.value); } const j = J(() => ({ "form-container": !0, "position-relative": !0, invalid: f.value })); return () => n("div", { class: j.value }, [n("div", { class: l.value, style: "min-height:220px;" }, [n("span", { class: "tip" }, [oe("请选择源控件")]), n(On, { ref: I, data: S.value, columns: d.value, columnOption: { fitColumns: !0, fitMode: "expand" }, showTreeNodeIcons: !0, fit: !0, iconField: "controlIcon", onSelectionChange: E }, null)]), w.value && n(Qe, null, [n("div", { class: "item-list" }, [n("span", { class: "tip" }, [oe("请选择事件")]), P.value.map((V) => n("span", { class: _.value(V.eventCode), onClick: () => z(V) }, [V.eventName]))])])]); } }), Ro = /* @__PURE__ */ se({ name: "FInteractionButton", props: xo, emits: ["clickEventItem", "selectSourceControl"], setup(e, o) { const i = new Pe(), s = ae("useEventsComposition"), t = ae("useInteractionCompostion"), { candidateEvents: d } = s, { collapseInteractions: S } = t, b = F(!1), I = F(!1); function A(f) { d.value = d.value.filter((y) => y.label !== f.label); } function w() { var f; (f = e.sourceCommunication) != null && f.needSelectSourceControl ? I.value = !I.value : b.value = !b.value; } function P(f) { w(), A(f), o.emit("clickEventItem", f); } function m() { var f; if (!((f = e.sourceCommunication) != null && f.needSelectSourceControl) && d.value.length === 0) { i.info({ position: "top-center", message: "事件已全部绑定" }); return; } S(), w(); } function a(f) { I.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: m }, [n("span", { class: "f-page-events-editor-text" }, [oe("新建交互事件")])])]), b.value && n(Oo, { events: d.value, onClick: P }, null), I.value && n(Ao, { sourceCommunication: e.sourceCommunication, onSelectSourceEvent: a }, null)]); } }), Do = { 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 } }, jo = { /** 判断是否为新引入的方法 */ 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: {} } }, Uo = { controllers: { type: Array, default: [] } }, qo = /* @__PURE__ */ se({ name: "FCommandList", props: Uo, 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, I) { o.emit("selectMethod", { method: b, controller: I }); } function d(b) { return b.controllerList.map((I) => n("div", { class: "f-page-internals-command", onClick: () => t(I, b) }, [n("div", { class: "f-page-internals-command-name", title: I.label }, [I.name])])); } function S(b) { return n("div", null, [s(b), d(b)]); } return () => n("div", { class: "f-page-internals" }, [e.controllers.map((b) => S(b))]); } }), Ho = { getEventPath: { type: Function, default: null }, notifyService: { type: Object }, useFormSchema: { type: Object }, /** 通讯来源 */ sourceCommunication: { type: Object, default: {} }, /** 当前编辑的事件编号、事件名称 */ event: { Type: Object } }, Go = /* @__PURE__ */ se({ name: "FBoundEventSelector", props: Ho, emits: ["cancel", "submit"], setup(e, o) { var N, U; const i = F(), s = F([]), t = F('<i class="f-icon f-icon-search"></i>'), d = e.useFormSchema.getFormMetadataBasicInfo(), S = F(""), b = F(), I = ((N = e.sourceCommunication) == null ? void 0 : N.unSupportedEventCodes) || [], A = F(!I.includes(e.event.label) && ((U = e.useFormSchema.externalFormSchema) == null ? void 0 : U.size) > 0), w = F(), P = F([]); mn(() => { if (e.getEventPath) { const p = e.getEventPath(); i.value = p.viewModelDisplay; const { actionWithPath: x } = p; x.forEach((D) => { D.sourceComponent.map.forEach((W) => { W.active = !1, W.hide = !1; }); }), s.value = X(x); } }); function m(p = "") { p = p.replace(/ /g, "").replace(/>/g, "").toLowerCase(), p === "" && (p = " "), s.value.forEach((x) => { const D = x.path; x.sourceComponent.map.forEach((W) => { const Z = W.command.name, ce = W.event.name, T = W.command.label; `${D}${Z}${ce}${T}`.toLowerCase().includes(p) ? W.hide = !1 : W.hide = !0; }); }); } function a(p = "") { p = p.replace(/ /g, "").replace(/>/g, "").toLowerCase(), P.value.forEach((x) => { if (!x.isCommandNode) return; const D = x.name || "", W = x.code || "", Z = x.viewmodelName || "", ce = `${D}${W}${Z}`.toLowerCase(); p && !ce.includes(p) ? x.hide = !0 : x.hide = !1; }); } function f(p = "") { !w.value || w.value.id === d.id ? m(p) : a(p); } function y() { const p = n("div", { class: "f-vm-search" }, [n("div", { class: "f-vm-searchBar" }, [n(jn, { updateOn: "change", groupText: t.value, modelValue: S.value, "onUpdate:modelValue": (x) => S.value = x, onChange: f, placeholder: "请输入名称/编号/路径搜索" }, null)])]); return A.value ? n("div", { class: "f-navSelector-header" }, [n("div", { class: "f-navSelector-recommand" }, [n("div", { class: "f-navSelector-recommand-text" }, [oe("方法列表")])]), n("div", { class: "f-navSelector-remainder" }, [n("div", { class: "f-vm-search" }, [p])])]) : p; } function g(p) { return { "f-vm-item": !0, "f-vm-item-focus": p.active }; } function h(p, x) { let D = 0; s.value.forEach((W) => { W.sourceComponent.map.forEach((Z) => { !Z.command.isInvalid && p.controller.id === Z.controller.id && p.command.id === Z.command.id && p.event.label === Z.event.label && x.sourceComponent.id === W.sourceComponent.id ? (p.active = !p.active, b.value = X(p)) : (Z.command.isInvalid && p.controller.id === Z.controller.id && p.command.id === Z.command.id && p.event.label === Z.event.label && x.sourceComponent.id === W.sourceComponent.id && (D++, D === 1 && (new Pe().info({ position: "top-center", message: "该方法已失效" }), b.value = null)), Z.active = !1); }); }); } function C(p) { return { "f-event-func": !p.command.isInvalid, "f-event-func-invalid": p.command.isInvalid }; } function E(p) { return p.sourceComponent.map.filter((x) => !x.hide).map((x) => { if (!x.command.isInvalid) return n("div", { class: g(x), onClick: () => h(x, p) }, [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;" }, [oe(" ")])]), n("div", { class: C(x) }, [x.command.name, oe("("), x.command.label, oe(")")])]), n("div", { class: "f-event-path" }, [p.path, x.event.name])]); }); } function l() { return s.value.length > 0 ? n("div", { class: "f-vm-viewModel flex-fill" }, [s.value.map((p) => E(p))]) : 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" }, [oe(" 暂无数据")])])]); } function _() { o.emit("cancel"); } function z() { if (!b.value) { e.notifyService.info({ position: "top-center", message: "请选择需要绑定的方法" }); return; } o.emit("submit", { selectedCommand: b.value, selectedForm: w.value }); } function j() { const p = e.useFormSchema.externalFormSchema, x = []; return x.push({ containerId: "", id: d.id, code: d.code, name: d.name }), Array.from(p.keys()).forEach((D) => { const W = p.get(D); x.push({ containerId: D, id: W.id, code: W.code, name: W.name }); }), x; } const V = J(() => ({ "f-vm-all": !0, " h-100": !0, "has-page-list": A.value })); function O(p) { var Z, ce; const { viewmodels: x, components: D } = p.module; if ((x == null ? void 0 : x.length) === 0 || (D == null ? void 0 : D.length) === 0) return []; P.value = []; const W = (ce = (Z = e.sourceCommunication) == null ? void 0 : Z.parameterData) == null ? void 0 : ce.getViewModelName; x.forEach((T) => { if (!T || !T.commands || T.commands.length === 0) return []; const ee = D.find((be) => be.viewModel === T.id), te = W && ee ? W(ee, T.name, p) : ""; P.value.push({ id: T.id, code: T.code, name: te || T.name }), T.commands.forEach((be) => { be.isInvalid || P.value.push({ ...be, viewmodelId: T.id, viewmodelName: te || T.name, isCommandNode: !0 }); }); }); } function c(p) { var x, D, W; if (!(p.id === w.value.id && p.containerId === w.value.containerId)) if (w.value = p, S.value = "", b.value = null, w.value.id !== d.id) { const Z = (D = e.useFormSchema.externalFormSchema) == null ? void 0 : D.get((x = w.value) == null ? void 0 : x.containerId); (W = Z == null ? void 0 : Z.content) != null && W.module && O(Z.content); } else s.value.map((Z) => { Z.sourceComponent.map.map((ce) => { ce.hide = !1, ce.active = !1; }); }); } function r() { const p = j(); w.value || (w.value = p[0]); const x = J(() => (D) => { var W; return { "f-list-view-group-item": !0, "f-listview-active": D.id === ((W = w.value) == null ? void 0 : W.id) && D.containerId === w.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;" }, [p.map((D) => { let W = D.name; return D.containerId && (W += `, 所属外部容器:${D.containerId}`), n("li", { class: x.value(D), onClick: () => c(D) }, [n("div", { class: "f-list-content" }, [n("div", { class: "f-navSelector-leftCategory", title: W }, [D.name])])]); })])])])]); } function u(p) { P.value.map((x) => x.active = !1), p.active = !0, b.value = p; } function M() { return n("div", { class: "f-vm-viewModel flex-fill" }, [P.value.filter((p) => !p.hide).map((p) => { if (p.isCommandNode) return n("div", { class: g(p), onClick: () => u(p) }, [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" }, [p.name, oe("("), p.code, oe(")")])]), n("div", { class: "f-event-path" }, [p.viewmodelName])]); })]); } return () => n("div", { class: V.value }, [n("div", { class: "d-flex f-utils-fill-flex-row splitter" }, [A.value ? r() : "", n("div", { class: "f-utils-fill-flex-column" }, [y(), !w.value || w.value.id === d.id ? l() : M()])]), n("div", { class: "modal-footer" }, [n("button", { type: "button", class: "btn btn-secondary", onClick: _ }, [oe("取消")]), n("button", { type: "button", class: "btn btn-primary", onClick: z }, [oe("确定")])])]); } }), _o = /* @__PURE__ */ se({ name: "FCommandSource", props: jo, emits: ["addInternalCommandListChanged", "newImportChanged", "selectBoundMethod", "click", "existChanged", "newFunctionChanged", "close", "selectMethod", "addCommunication"], setup(e, o) { const i = ae("useMethodsComposition"), s = ae("useFormCommand"), t = new Pe(), { checkIfNewControllerExists: d, addNewController: S } = i, b = F(e.controllers), I = ae("useFormSchema"), A = ae(Dn); let w, P; c