UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,491 lines 459 kB
var jr = Object.defineProperty; var Ar = (t, n, e) => n in t ? jr(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e; var A = (t, n, e) => Ar(t, typeof n != "symbol" ? n + "" : n, e); import { ref as S, defineComponent as Le, createVNode as x, inject as ze, Fragment as Ot, createTextVNode as Ue, computed as $, onMounted as lt, reactive as ft, withDirectives as At, resolveDirective as wn, watch as Fe, vModelText as Fn, mergeProps as $t, createApp as to, onUnmounted as mn, Transition as no, onBeforeUnmount as oo, nextTick as Jt, provide as nn, triggerRef as zr, isVNode as qr, onBeforeMount as Gr, Teleport as Yr, shallowRef as Ur, render as pn, h as Xr, cloneVNode as Qr } from "vue"; import { isPlainObject as $n, cloneDeep as ke, isUndefined as gt, throttle as Kr } from "lodash-es"; import { useGuid as hn, ControllerSchemaRepositorySymbol as Jr, FormSchemaEntityFieldTypeName as Wn, resolveField as ut, useArrayProcessor as ro, useCommonUtils as ao, useDateFormat as Zr, useNumberFormat as ea, setFieldValue as Cn, getCustomClass as vn, withInstall as io } from "../common/index.esm.js"; import { FNotifyService as kn } from "../notify/index.esm.js"; import ta, { FSchemaSelector as na } from "../schema-selector/index.esm.js"; import { F_MODAL_SERVICE_TOKEN as oa } from "../modal/index.esm.js"; import sn from "../combo-list/index.esm.js"; import so from "../event-parameter/index.esm.js"; import { createPropsResolver as ra } from "../dynamic-resolver/index.esm.js"; import "../designer-canvas/index.esm.js"; import "../property-panel/index.esm.js"; import aa from "../accordion/index.esm.js"; import ia from "../avatar/index.esm.js"; import sa from "../../designer/button-edit/index.esm.js"; import la from "../button-group/index.esm.js"; import ua from "../calendar/index.esm.js"; import ca from "../capsule/index.esm.js"; import jn from "../../designer/checkbox/index.esm.js"; import An from "../../designer/checkbox-group/index.esm.js"; import da from "../combo-tree/index.esm.js"; import fa from "../component/index.esm.js"; import ma from "../color-picker/index.esm.js"; import ha from "../content-container/index.esm.js"; import pa from "../date-picker/index.esm.js"; import va from "../../designer/data-grid/index.esm.js"; import ga from "../dropdown/index.esm.js"; import ya, { FDynamicFormGroup as ba, FDynamicFormInput as wa } from "../dynamic-form/index.esm.js"; import Ca from "../events-editor/index.esm.js"; import _a from "../filter-bar/index.esm.js"; import xa from "../field-selector/index.esm.js"; import Sa from "../binding-selector/index.esm.js"; import Ea from "../image-cropper/index.esm.js"; import Ta from "../../designer/input-group/index.esm.js"; import Fa from "../layout/index.esm.js"; import ka from "../list-nav/index.esm.js"; import Ma from "../list-view/index.esm.js"; import Oa from "../lookup/index.esm.js"; import Ia from "../mapping-editor/index.esm.js"; import Na from "../nav/index.esm.js"; import Pa from "../number-range/index.esm.js"; import Da from "../number-spinner/index.esm.js"; import Va from "../order/index.esm.js"; import Ba from "../page-header/index.esm.js"; import Ra from "../page-footer/index.esm.js"; import La from "../pagination/index.esm.js"; import Ha from "../progress/index.esm.js"; import $a from "../query-solution/index.esm.js"; import Wa from "../../designer/radio-group/index.esm.js"; import ja from "../rate/index.esm.js"; import Aa from "../response-toolbar/index.esm.js"; import za from "../response-layout/index.esm.js"; import qa from "../response-layout-editor/index.esm.js"; import Ga from "../search-box/index.esm.js"; import Ya from "../section/index.esm.js"; import Ua from "../smoke-detector/index.esm.js"; import Xa from "../splitter/index.esm.js"; import Qa from "../step/index.esm.js"; import Ka from "../switch/index.esm.js"; import Ja from "../tabs/index.esm.js"; import Za from "../tags/index.esm.js"; import ei from "../text/index.esm.js"; import ti from "../time-picker/index.esm.js"; import ni from "../transfer/index.esm.js"; import oi from "../tree-view/index.esm.js"; import ri from "../uploader/index.esm.js"; import ai from "../verify-detail/index.esm.js"; import ii from "../video/index.esm.js"; import si from "../textarea/index.esm.js"; import li from "../tree-grid/index.esm.js"; import ui from "../filter-condition-editor/index.esm.js"; import ci from "../fieldset/index.esm.js"; import di from "../sort-condition-editor/index.esm.js"; import fi from "../menu-lookup/index.esm.js"; import mi from "../drawer/index.esm.js"; import hi from "../json-editor/index.esm.js"; import pi from "../property-editor/index.esm.js"; import vi from "../expression-editor/index.esm.js"; import gi from "../code-editor/index.esm.js"; import yi from "../html-template/index.esm.js"; import "../external-container/index.esm.js"; import { useResizeObserver as Mn } from "@vueuse/core"; import { useIdentify as lo, useGroupData as bi, useFilter as uo, useHierarchy as co, useLoading as wi, useDataView as fo, useSelection as mo, useSelectHierarchyItem as Ci, useDataViewContainerStyle as ho, useCommandColumn as _i, useColumn as po, useSort as xi, useGroupColumn as vo, useRow as go, useEdit as yo, useVisualDataBound as bo, useVisualDataCell as wo, useVisualDataRow as Co, useVisualData as _o, useCellPosition as xo, useSidebar as So, useVirtualScroll as Eo, useFitColumn as To, useFilterHistory as Si, useColumnFilter as Ei, useDragColumn as Ti, getColumnHeader as Fi, getSidebar as Fo, getDisableMask as ki, getHorizontalScrollbar as ko, getVerticalScrollbar as Mo, getEmpty as Oo } from "../data-view/index.esm.js"; import "../condition/index.esm.js"; import { FCheckbox as Mi } from "../checkbox/index.esm.js"; import zn from "../tooltip/index.esm.js"; import Oi from "../button/index.esm.js"; const Io = {}, No = {}; function On(t) { const { properties: n, title: e, ignore: o } = t, r = o && Array.isArray(o), a = Object.keys(n).reduce((i, s) => ((!r || !o.find((u) => u === s)) && (i[s] = n[s].type === "object" && n[s].properties ? On(n[s]) : ke(n[s].default)), i), {}); if (e && (!r || !o.find((i) => i === "id"))) { const i = e.toLowerCase().replace(/-/g, "_"); a.id = `${i}_${Math.random().toString().slice(2, 6)}`; } return a; } function Ii(t) { const { properties: n, title: e, required: o } = t; if (o && Array.isArray(o)) { const r = o.reduce((a, i) => (a[i] = n[i].type === "object" && n[i].properties ? On(n[i]) : ke(n[i].default), a), {}); if (e && o.find((a) => a === "id")) { const a = e.toLowerCase().replace(/-/g, "_"); r.id = `${a}_${Math.random().toString().slice(2, 6)}`; } return r; } return { type: e }; } function Po(t, n = {}, e) { const o = Io[t]; if (o) { let r = Ii(o); const a = No[t]; return r = a ? a({ getSchemaByType: Po }, r, n, e) : r, r; } return null; } function Ni(t, n) { const e = On(n); return Object.keys(e).reduce((o, r) => (Object.prototype.hasOwnProperty.call(t, r) && (o[r] && $n(o[r]) && $n(t[r] || !t[r]) ? Object.assign(o[r], t[r] || {}) : o[r] = t[r]), o), e), e; } function Do(t, n) { return Object.keys(t).filter((o) => t[o] != null).reduce((o, r) => { if (n.has(r)) { const a = n.get(r); if (typeof a == "string") o[a] = t[r]; else { const i = a(r, t[r], t); Object.assign(o, i); } } else o[r] = t[r]; return o; }, {}); } function Pi(t, n, e = /* @__PURE__ */ new Map()) { const o = Ni(t, n); return Do(o, e); } function Di(t = {}) { function n(l, m, c, f) { if (typeof c == "number") return f[l].length === c; if (typeof c == "object") { const h = Object.keys(c)[0], d = c[h]; if (h === "not") return Number(f[l].length) !== Number(d); if (h === "moreThan") return Number(f[l].length) >= Number(d); if (h === "lessThan") return Number(f[l].length) <= Number(d); } return !1; } function e(l, m, c, f) { return f[l] && f[l].propertyValue && String(f[l].propertyValue.value) === String(c); } const o = /* @__PURE__ */ new Map([ ["length", n], ["getProperty", e] ]); Object.keys(t).reduce((l, m) => (l.set(m, t[m]), l), o); function r(l, m) { const c = l; return typeof m == "number" ? [{ target: c, operator: "length", param: null, value: Number(m) }] : typeof m == "boolean" ? [{ target: c, operator: "getProperty", param: l, value: !!m }] : typeof m == "object" ? Object.keys(m).map((f) => { if (f === "length") return { target: c, operator: "length", param: null, value: m[f] }; const h = f, d = m[f]; return { target: c, operator: "getProperty", param: h, value: d }; }) : []; } function a(l) { return Object.keys(l).reduce((c, f) => { const h = r(f, l[f]); return c.push(...h), c; }, []); } function i(l, m) { if (o.has(l.operator)) { const c = o.get(l.operator); return c && c(l.target, l.param, l.value, m) || !1; } return !1; } function s(l, m) { return a(l).reduce((h, d) => h && i(d, m), !0); } function u(l, m) { const c = Object.keys(l), f = c.includes("allOf"), h = c.includes("anyOf"), d = f || h, y = (d ? l[d ? f ? "allOf" : "anyOf" : "allOf"] : [l]).map((g) => s(g, m)); return f ? !y.includes(!1) : y.includes(!0); } return { parseValueSchema: u }; } const fe = { button: { type: "button", name: "按钮" }, "response-toolbar": { type: "response-toolbar", name: "工具栏" }, "response-toolbar-item": { type: "response-toolbar-item", name: "按钮" }, "content-container": { type: "content-container", name: "容器" }, "input-group": { type: "input-group", name: "文本" }, textarea: { type: "textarea", name: "多行文本" }, lookup: { type: "lookup", name: "帮助" }, "number-spinner": { type: "number-spinner", name: "数值" }, "date-picker": { type: "date-picker", name: "日期" }, switch: { type: "switch", name: "开关" }, "radio-group": { type: "radio-group", name: "单选组" }, "check-box": { type: "check-box", name: "复选框" }, "check-group": { type: "check-group", name: "复选框组" }, "combo-list": { type: "combo-list", name: "下拉列表" }, "response-form": { type: "response-form", name: "卡片面板" }, "response-layout": { type: "response-layout", name: "布局容器", icon: "response-layout-3" }, "response-layout-item": { type: "response-layout-item", name: "布局", icon: "response-layout-1" }, "tree-grid": { type: "tree-grid", name: "树表格" }, "tree-grid-column": { type: "tree-grid-column", name: "树表格列" }, "data-grid": { type: "data-grid", name: "表格" }, "data-grid-column": { type: "data-grid-column", name: "表格列" }, module: { type: "Module", name: "模块" }, component: { type: "component", name: "组件" }, tabs: { type: "tabs", name: "标签页" }, "tab-page": { type: "tab-page", name: "标签页项", dependentParentControl: "Tab" }, "tab-toolbar-item": { type: "tab-toolbar-item", name: "标签页工具栏按钮" }, "html-template": { type: "html-template", name: "模板容器" }, "time-picker": { type: "time-picker", name: "时间选择" }, section: { type: "section", name: "分组面板" }, "section-toolbar": { type: "section-toolbar", name: "分组面板工具栏" }, "section-toolbar-item": { type: "section-toolbar-item", name: "分组面板按钮" }, splitter: { type: "splitter", name: "分栏面板" }, "splitter-pane": { type: "splitter-pane", name: "分栏面板项", dependentParentControl: "Splitter" }, "component-ref": { type: "component-ref", name: "组件引用节点" }, uploader: { type: "uploader", name: "附件上传" }, "page-header": { type: "page-header", name: "页头" }, "page-footer": { type: "page-footer", name: "页脚" }, "tab-toolbar": { type: "tab-toolbar", name: "标签页工具栏" }, fieldset: { type: "fieldset", name: "分组" }, "query-solution": { type: "query-solution", name: "筛选方案" }, drawer: { type: "drawer", name: "抽屉" }, "external-container": { type: "external-container", name: "外部容器", icon: "content-container" }, "list-nav": { type: "list-nav", name: "列表导航" }, "filter-bar": { type: "filter-bar", name: "筛选条" } }, Vi = {}, Bi = {}; Di(); function Nt(t, n, e = /* @__PURE__ */ new Map(), o = (i, s, u, l) => s, r = {}, a = (i) => i) { return Io[n.title] = n, No[n.title] = o, Vi[n.title] = r, Bi[n.title] = a, (i = {}, s = !0) => { if (!s) return Do(i, e); const u = Pi(i, n, e), l = Object.keys(t).reduce((m, c) => (m[c] = t[c].default, m), {}); return Object.assign(l, u); }; } function Zt(t, n) { return { customClass: n.class, customStyle: n.style }; } function Ri() { function t(n, e) { const { dataSource: o } = n || {}; return o === void 0 ? {} : {}; } return { resolve: t }; } function Li() { function t(n, e) { return n.selectItemById(e); } return { selectItemById: t }; } function Hi() { function t(n, e) { const { columns: o } = e; return n.updateColumns(o); } return { updateColumns: t }; } const $i = /* @__PURE__ */ new Map([ ["appearance", Zt] ]); function Wi(t, n, e) { return n; } const ji = "https://json-schema.org/draft/2020-12/schema", Ai = "https://farris-design.gitee.io/events-editor.schema.json", zi = "events-editor", qi = "A Farris Component", Gi = "object", Yi = { 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: {} } }, Ui = [ "id", "type" ], Xi = { $schema: ji, $id: Ai, title: zi, description: qi, type: Gi, properties: Yi, required: Ui }, Qi = "events-editor", Ki = "A Farris Component", Ji = "object", Zi = {}, es = { title: Qi, description: Ki, type: Ji, categories: Zi }, qn = [ { label: "pageChange", name: "MockMock切换页码" }, { label: "pageSizeChanged", name: "Mock分页条数变化事件" }, { label: "scrollYLoad", name: "Mock滚动加载事件" }, { label: "onEditClicked", name: "Mock操作列点击编辑" }, { label: "onDeleteClicked", name: "Mock操作列点击删除" } ], ts = { 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: qn, /** 已绑定的事件(拼接已有的参数值,拼接当前事件->待集成-从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: qn, boundEventsList: [] }) }, Vo = { initialData: { type: Object, default: ts } }, ns = Nt( Vo, Xi, $i, Wi, es ); function Bo() { function t(e, o) { const r = [ { 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" } ] }, { 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" } ] } ]; let a = -1; const i = r.findIndex((s) => e === s.controllerId); return i !== -1 && (a = r[i].commands.findIndex((s) => o === s.handlerName)), a !== -1; } function n(e, o, r) { const a = t(e.controllerName.id, o.handlerName); return r.componentLists.length !== 0 && a && (o.hasPath = !0, o.targetComponent = o.targetComponent || r.componentLists[0].componentId, o.componentLists = ke(r.componentLists)), o; } return { isContextDependent: t, setComponentLists: n }; } function In(t) { const n = S(); function e(a) { var u; let i; const { communications: s } = t.getFormSchema().module; return (u = a.communication) != null && u.id && (s != null && s.length) && (i = s.find((l) => l.id === a.communication.id)), !i && a.sourceCommunication && (i = { id: hn().guid(), source: { formId: a.sourceCommunication.formId, formCode: a.sourceCommunication.formCode, componentId: a.sourceCommunication.componentId, externalContainerId: a.sourceCommunication.externalContainerId, event: a.event }, target: { formId: "", formCode: "", externalContainerId: "", commandCode: "", commandViewmodelId: "" }, paramMappings: [] }), i; } function o(a) { const i = t.getFormSchema(), { communications: s } = i.module; s || (i.module.communications = []), i.module.communications.findIndex((l) => l.id === a.id) === -1 && i.module.communications.push(a); } function r(a) { if (a != null && a.communication) { const i = t.getFormSchema(); i.module.communications && (i.module.communications = i.module.communications.filter((s) => { var u; return s.id !== ((u = a.communication) == null ? void 0 : u.id); })), a.communication = null; } } return { communication: n, resolveCommunication: e, clearCommunication: r, saveCommunication: o }; } function os(t, n, e) { const o = S([]), { boundEvents: r, unBoundEvent: a } = n; function i(f) { var d, M; return { /** 当前事件名称及label */ event: { label: (d = f.boundEvents) == null ? void 0 : d.label, name: (M = f.boundEvents) == null ? void 0 : M.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: ke(f.command), /** 当前的控制器 */ controller: ke(f.controller), /** 通讯 */ communication: f.communication }; } function s() { var f; o.value = (f = r.value) == null ? void 0 : f.map((h) => i(h)); } function u(f) { var M; const d = i({ boundEvents: f, command: null, controller: { id: "", name: "", label: "" } }); (M = e.value.sourceCommunication) != null && M.needSelectSourceControl ? (d.showSwitch[0].showSwitchNumber = 2, d.showSwitch[0].showSection[2][2] = !1, d.showSwitch[0].showSection[2][3] = !1, o.value.unshift(d)) : (d.showSwitch[0].showSwitchNumber = 1, d.showSwitch[0].showSection[2][3] = !0, o.value.unshift(d)); } function l() { var f; (f = o.value) == null || f.forEach((h) => { h.showSwitch.forEach((d) => { d.showSection[2][3] = !1; }); }); } function m(f) { o.value[f].showSwitch.forEach((h) => { h.showSection[2][3] = !h.showSection[2][3]; }); } function c(f) { if (f >= 0 && f <= o.value.length - 1) { const h = o.value[f]; a(h.event), o.value.splice(f, 1); const { clearCommunication: d } = In(t); d(h); } } return { addNewInteraction: u, collapseInteractions: l, deleteInteracton: c, toggleMethodInInteraction: m, interactions: o, loadInteractions: s }; } function rs(t) { const n = S([]), e = S([]), o = S([]), { isContextDependent: r } = Bo(); function a() { const { allComponentList: f } = t.value; t.value.componentLists.length && t.value.viewModel && t.value.viewModel.forEach((h) => { h.controllerList.forEach((d) => { if (d.targetComponent) { const M = f.find((y) => y.componentId === d.targetComponent); if ((M ? M.viewModelId : void 0) === t.value.viewModelId) d.hasPath = !1; else { const y = r(h.controllerName.id, d.handlerName); d.hasPath = y ? !0 : d.hasPath, d.componentLists = y ? ke(t.value.componentLists) : d.componentLists; } } }); }), t.value.componentLists.length && t.value.boundEventsList && t.value.boundEventsList.forEach((h) => { var d; if ((d = h.command) != null && d.targetComponent) { const M = f.find( (y) => { var E; return y.componentId === (((E = h.command) == null ? void 0 : E.targetComponent) || ""); } ); if ((M ? M.viewModelId : void 0) === t.value.viewModelId) h.command.hasPath = !1; else { const y = r( h.controller.id, h.command.handlerName ); h.command.hasPath = y ? !0 : h.command.hasPath, h.command.componentLists = y ? ke(t.value.componentLists) : h.command.componentLists; } } }); } function i() { const f = e.value.reduce( (d, M) => (d.set(M.boundEvents.label, !0), d), /* @__PURE__ */ new Map() ); return n.value.filter((d) => !f.has(d.label)); } function s() { var h; const f = ((h = e.value) == null ? void 0 : h.length) > 0; o.value = f ? i() : n.value; } function u() { a(), n.value = t.value.events, e.value = t.value.boundEventsList, s(); } function l(f) { o.value = o.value.filter((h) => h.label !== f.label); } function m(f) { e.value = e.value.filter((h) => h.boundEvents.label !== f.label), s(); } function c() { var d; const f = (d = t.value) == null ? void 0 : d.getEventList(), { events: h } = f; f && (t.value.events = ke(h), t.value.boundEventsList = f.boundEventsList), t.value.boundEventsList && (t.value.boundEventsList = t.value.boundEventsList.filter(function(M) { return h.find((F) => F.label === M.boundEvents.label); })); } return { allEvents: n, boundEvents: e, candidateEvents: o, excludeFromCandidates: l, loadEvents: u, resetBoundEvents: c, unBoundEvent: m }; } const as = { sourceCommunication: { type: Object, default: {} } }, is = { events: { type: Array, default: [] } }, ss = /* @__PURE__ */ Le({ name: "FEventList", props: is, emits: ["click"], setup(t, n) { const e = S(t.events); function o(a) { n.emit("click", a); } function r(a) { return x("div", { class: "f-page-events-editor-first-bound-event" }, [x("div", { onClick: () => o(a), class: "f-page-events-editor-first-bound-event-name" }, [a.name])]); } return () => x("div", { class: "f-page-events-editor-events" }, [e.value.map((a) => r(a))]); } }), ls = /* @__PURE__ */ Le({ name: "FInteractionButton", props: as, emits: ["clickEventItem", "addSourceControl"], setup(t, n) { const e = new kn(), o = ze("useEventsComposition"), r = ze("useInteractionCompostion"), { candidateEvents: a } = o, { collapseInteractions: i } = r, s = S(!1); function u(f) { a.value = a.value.filter((h) => h.label !== f.label); } function l(f = !1) { s.value = f; } function m(f) { l(), u(f), n.emit("clickEventItem", f); } function c() { var f; if (a.value.length === 0) { e.info({ position: "top-center", message: "事件已全部绑定" }); return; } i(), (f = t.sourceCommunication) != null && f.needSelectSourceControl ? n.emit("addSourceControl") : l(!s.value); } return () => x(Ot, null, [x("div", { class: "f-page-events-editor-top-button" }, [x("button", { class: "f-page-events-editor-button", onClick: c }, [x("span", { class: "f-page-events-editor-text" }, [Ue("新建交互事件")])])]), s.value && x(ss, { events: a.value, onClick: m }, null)]); } }), us = { collapsed: { type: Boolean, default: !0 }, displayOrder: { type: Number, default: -1 }, interaction: { type: Object, default: {} }, controllers: { type: Array, default: [] }, sourceCommunication: { type: Object, default: {} } }, cs = { /** 判断是否为新引入的方法 */ 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: [] } }, ds = { controllers: { type: Array, default: [] } }, fs = /* @__PURE__ */ Le({ name: "FCommandList", props: ds, emits: ["selectMethod"], setup(t, n) { function e(s) { return s.controllerList.length !== 0; } function o(s) { return e(s) && x("div", { class: "f-page-internals-controller" }, [x("div", { class: "f-page-internals-controller-name", title: s.controllerName.name }, [s.controllerName.name])]); } function r(s, u) { n.emit("selectMethod", { method: s, controller: u }); } function a(s) { return s.controllerList.map((u) => x("div", { class: "f-page-internals-command", onClick: () => r(u, s) }, [x("div", { class: "f-page-internals-command-name", title: u.label }, [u.name])])); } function i(s) { return x("div", null, [o(s), a(s)]); } return () => x("div", { class: "f-page-internals" }, [t.controllers.map((s) => i(s))]); } }), ms = /* @__PURE__ */ Le({ name: "FCommandSource", props: cs, emits: ["addInternalCommandListChanged", "newImportChanged", "currentCommandChanged", "originalDataChanged", "click", "existChanged", "newFunctionChanged", "close", "selectMethod", "switchToCommunicationPanel"], setup(t, n) { const e = ze("useMethodsComposition"), o = ze("useFormCommand"), r = new kn(), { checkIfNewControllerExists: a, addNewController: i } = e, s = S(!1), u = S(t.canAddNewMethod), l = S(t.controllers), m = $(() => !u.value), c = $(() => s.value), f = $(() => ({ "font-size": "15px", margin: "5px", color: "#226eff", flex: "1 1 0" })), h = ze("useFormSchema"), d = ze(oa); let M; const F = S(!1); lt(() => { F.value = h.externalFormSchema.size > 0; }); function y(k, N, z) { if (i(k), k.Commands) { const H = o.getInternalControllerFromControllerMetadata(k, N, z); a(H) && r.info({ position: "top-center", message: "该控制器已存在" }); } } async function E(k) { o.getSupportedControllerMetadata(k).then((N) => { N && y(N.controller, N.code, N.nameSpace); }).finally(() => { M && M.destroy && M.destroy(); }); } function g(k) { M && M.destroy && M.destroy(); } function T() { const k = { formBasicInfo: h == null ? void 0 : h.getFormMetadataBasicInfo() }; return x(na, { injectSymbolToken: Jr, "view-type": "NavList", editorParams: k, showFooter: !0, onCancel: g, onSubmit: E }, null); } function w() { M = d.open({ title: "选择控制器", width: 950, render: T, showButtons: !1 }); } function v() { n.emit("newFunctionChanged"); } function p() { } function b() { n.emit("close", null); } function C() { return x("div", { class: "f-command-breakline" }, [Ue("------------------------------------------------------------")]); } function O() { n.emit("switchToCommunicationPanel"); } function _() { return x("div", { class: "f-page-internals-new-command" }, [x("div", { class: "f-page-internals-new-command-func1" }, [x("div", { class: "f-icon f-icon-panel-retraction", style: f.value }, null), x("div", { class: "f-function-class", onClick: () => w() }, [Ue("引入控制器")])]), m.value && x("div", { class: "f-page-internals-new-command-func2" }, [x("div", { class: "f-icon f-icon-new-edit", style: f.value }, null), x("div", { class: "f-function-class", onClick: () => v() }, [Ue("添加新方法")])]), c.value && void 0, F.value && x("div", { class: "f-page-internals-new-command-func2" }, [x("div", { class: "fd-i-Family fd_pc-extend-setting", style: f.value }, null), x("div", { class: "f-function-class", onClick: () => O() }, [Ue("配置组合表单通讯")])])]); } function V(k) { n.emit("selectMethod", k); } function D() { return x("div", { class: "f-page-command-source-choice" }, [x(fs, { controllers: l.value, onSelectMethod: V }, null)]); } return () => x("div", { class: "f-page-events-editor-command-source" }, [D(), C(), _(), C(), x("div", null, [x("div", { class: "f-page-internals-close", onClick: b }, [Ue("取消")])])]); } }), hs = { command: { type: Object, default: {} }, showParameter: { type: Boolean, default: !1 } }, ps = /* @__PURE__ */ Le({ name: "FParameterEditor", props: hs, emits: ["confirm", "change", "targetChange"], setup(t, n) { const e = new kn(), o = S(ke(t.command)), r = S(0), a = $(() => o.value.id === "abandoned"), i = $(() => o.value.id === "deleted"), s = $(() => o.value !== null), u = $(() => o.value.id !== "abandoned" && o.value.id !== "deleted"), l = S(t.showParameter); function m() { const { targetComponent: k } = o.value; let N = ""; return o.value.componentLists && o.value.componentLists.forEach((z) => { if (z.componentId === k) { N = z.viewModelId; return; } }), N; } const c = S(m()), f = $(() => o.value.targetComponent || ""); function h() { e.info({ position: "top-center", message: "方法已被移除,请重新绑定" }); } function d() { return x("div", null, [x("div", { title: "方法已被移除,请重新绑定", class: "f-icon f-icon-flowline-warning text-danger text-center ", style: "font-size: 13px;margin-right:10px;width: 30px;height: 20px;", onClick: () => h() }, null)]); } function M() { e.info({ position: "top-center", message: "方法已失效,请重新绑定" }); } function F() { return x("div", null, [x("div", { title: "'方法已被删除,请绑定其他方法'", class: "f-icon f-icon-flowline-warning text-danger text-center ", style: "font-size: 13px;margin-right:10px;width: 30px;height: 20px;", onClick: () => M() }, null)]); } function y(k) { l.value = !l.value; } function E() { return x("div", null, [x("div", { class: "f-icon f-icon-edit-button", style: "font-size: 13px;margin-right:10px;", onClick: () => y(r.value) }, null)]); } const g = $(() => o.value.componentLists && o.value.hasPath); function T(k, N) { o.value.targetComponent = k[0].componentId, n.emit("targetChange", o.value); } function w() { const k = ft({ content: "将此方法添加到指定的组件", placement: "top" }); return x("div", null, [x("div", { class: "f-page-parameter-editor-targetComponent" }, [x("div", { class: "f-page-parameter-editor-targetComponent-topic" }, [Ue("挂载到目标组件"), At(x("span", { class: "farris-label-tips ml-2" }, [x("i", { class: "f-icon f-icon-description-tips" }, null)]), [[wn("tooltip"), k]])]), x("div", { class: "f-page-parameter-editor-targetComponent-dropdown" }, [x(sn, { modelValue: c.value, "onUpdate:modelValue": (N) => c.value = N, enableClear: !1, idField: "viewModelId", valueField: "viewModelId", textField: "componentId", data: o.value.componentLists, editable: !1, onChange: T }, null)])])]); } function v(k, N) { N.value = k; } function p() { n.emit("change", o.value); } function b(k) { var j, P, I, U, W, L, Y, Q, K, Z, se, pe, be, Me, Oe, X, ie, G, te; const N = ft(k.context.data), { assembleSchemaFieldsByComponent: z, assembleOutline: H, assembleStateVariables: R, assembleSchemaFieldsUnderBoundEntity: B } = k.context.generalData; return x(so, { defaultValue: k == null ? void 0 : k.origin.defaultValue, modelValue: k.value, "onUpdate:modelValue": (ge) => k.value = ge, data: N, fieldData: z(), formData: H(), varData: R(), activeViewModelFieldData: B(f.value), editorType: ((P = (j = k == null ? void 0 : k.origin) == null ? void 0 : j.controlSource) == null ? void 0 : P.type) || "Default", editorControlSource: (I = k == null ? void 0 : k.origin) == null ? void 0 : I.controlSource, idField: ((Y = (L = (W = (U = k == null ? void 0 : k.origin) == null ? void 0 : U.controlSource) == null ? void 0 : W.context) == null ? void 0 : L.valueField) == null ? void 0 : Y.value) || ((se = (Z = (K = (Q = k == null ? void 0 : k.origin) == null ? void 0 : Q.controlSource) == null ? void 0 : K.context) == null ? void 0 : Z.idField) == null ? void 0 : se.value) || "id", textField: ((Oe = (Me = (be = (pe = k == null ? void 0 : k.origin) == null ? void 0 : pe.controlSource) == null ? void 0 : be.context) == null ? void 0 : Me.textField) == null ? void 0 : Oe.value) || "label", editable: (te = (G = (ie = (X = k == null ? void 0 : k.origin) == null ? void 0 : X.controlSource) == null ? void 0 : ie.context) == null ? void 0 : G.editable) == null ? void 0 : te.value, onConfirm: (ge) => { v(ge, k), p(); }, onValueChange: (ge) => { v(ge, k), p(); } }, null); } function C() { var k; return (k = o.value.property) == null ? void 0 : k.map((N, z) => { const H = ft({ content: N.description, placement: "top" }); return x("div", { key: N.name + z }, [x("div", { class: "f-page-parameter-editor-row1" }, [x("div", { class: "f-page-parameter-editor-parameter-name" }, [N.shownName, N.description && At(x("div", { class: "ml-2 farris-label-tips" }, [x("i", { class: "f-icon f-icon-description-tips" }, null)]), [[wn("tooltip"), H]])])]), x("div", { class: "f-page-parameter-editor-row2" }, [b(N)])]); }); } function O(k) { l.value = !1, n.emit("confirm"); } function _() { return x("div", null, [x("div", { class: "f-page-parameter-editor-btn" }, [x("div", { class: "btn-finish", onClick: () => O(r.value) }, [Ue("完成")])])]); } function V() { return x("div", { class: "f-page-parameter-editor-group" }, [g.value && w(), C()]); } function D() { return x("div", null, [x("div", { class: "f-page-parameter-editor-first-row" }, [x("span", { class: "f-page-parameter-editor-command-name", title: o.value.label }, [o.value.name]), x("div", { class: "f-page-parameter-editor-first-row-icon" }, [a.value && d(), i.value && F(), u.value && E()])]), l.value && V(), l.value && _()]); } return () => x("div", { class: "f-page-parameter-editor" }, [s.value && D()]); } }), en = { /** 通讯id */ communication: { type: Object }, /** 通讯来源 */ sourceCommunication: { type: Object, default: {} }, /** 当前事件编号 */ event: { type: String, default: "" } }, vs = /* @__PURE__ */ Le({ name: "FSelectTargetForm", props: en, emits: ["selectForm"], setup(t, n) { const e = S(t.communication), o = ze("useFormSchema"), r = o.getFormMetadataBasicInfo(), a = S([]), i = S(), s = S(!1), u = $(() => { var h; return (h = i.value) == null ? void 0 : h.name; }); Fe(() => t.communication, (h) => { e.value = h; }, { deep: !0 }); function l() { var d, M, F, y; const h = o.externalFormSchema; Array.from(h.keys()).forEach((E) => { var T, w; const g = h.get(E); ((w = (T = e.value) == null ? void 0 : T.source) == null ? void 0 : w.externalContainerId) !== E && a.value.push({ containerId: E, id: g.id, code: g.code, name: g.name }); }), ((M = (d = e.value) == null ? void 0 : d.source) == null ? void 0 : M.formId) !== r.id && a.value.unshift({ containerId: "", id: r.id, code: r.code, name: r.name }), (y = (F = e.value) == null ? void 0 : F.target) != null && y.formId && (i.value = a.value.find((E) => E.id === e.value.target.formId)); } lt(() => { l(); }); const m = $(() => (h) => { var d; return { item: !0, selected: ((d = i.value) == null ? void 0 : d.id) === h }; }); function c() { s.value = !s.value; } function f(h) { s.value = !1, i.value = h, n.emit("selectForm", h); } return () => x("div", { class: "form-container mt-2" }, [x("div", { class: "px-2 selected-item" }, [x("span", { class: "f-icon f-icon-file-txt" }, null), At(x("input", { placeholder: "目标页面", class: "form-control", "onUpdate:modelValue": (h) => u.value = h, readonly: !0, onClick: c }, null), [[Fn, u.value]])]), s.value ? x("div", { class: "item-list" }, [x("span", { class: "tip" }, [Ue("请选择目标页面")]), a.value.map((h) => x("span", { class: m.value(h.id), onClick: () => f(h) }, [h.name]))]) : ""]); } }), Nn = /* @__PURE__ */ new Map([ ["appearance", Zt] ]), gs = /* @__PURE__ */ new Map([]), ys = "root-viewmodel"; class bs { constructor(n, e) { A(this, "formSchemaUtils"); A(this, "controlCreatorUtils"); A(this, "designViewModelUtils"); this.resolver = n, this.designerHostService = e, this.formSchemaUtils = this.designerHostService.formSchemaUtils, this.controlCreatorUtils = this.designerHostService.controlCreatorUtils, this.designViewModelUtils = this.designerHostService.designViewModelUtils; } createComponent(n) { const e = this.createComponentRefNode(n), o = this.createComponentNode(n), r = this.createViewModeNode(n), a = this.formSchemaUtils.getFormSchema(); return a.module.viewmodels.push(r), a.module.components.push(o), this.designViewModelUtils.assembleDesignViewModel(), e; } createComponentRefNode(n) { const e = this.resolver.getSchemaByType("component-ref"); return Object.assign(e, { id: `${n.componentId}-component-ref`, component: `${n.componentId}-component` }), e; } createComponentNode(n) { const e = this.resolver.getSchemaByType("component"), o = this.createFormComponentContents(n); return Object.assign(e, { id: `${n.componentId}-component`, viewModel: `${n.componentId}-component-viewmodel`, componentType: n.componentType, appearance: { class: this.getFormComponentClass() }, formColumns: n.formColumns, contents: o }), e; } /** * 获取卡片组件层级的class样式 */ getFormComponentClass() { const { templateId: n } = this.formSchemaUtils.getFormSchema().module; return n === "double-list-in-tab-template" ? "f-struct-wrapper f-utils-fill-flex-column" : "f-struct-wrapper"; } createFormComponentContents(n) { const e = this.resolver.getSchemaByType("section"); Object.assign(e, { id: n.componentId + "-form-section", appearance: { class: "f-section-form f-section-in-mainsubcard" }, mainTitle: n.componentName }); const o = this.resolver.getSchemaByType("response-form"), r = []; Object.assign(o, { id: n.componentId + "-form", appearance: { class: "f-form-layout farris-form farris-form-controls-inline" }, contents: r }), e.contents = [o]; const { selectedFields: a } = n; a == null || a.forEach((s) => { const u = ke(s), l = this.resolveControlClassByFormColumns(n), m = this.controlCreatorUtils.setFormFieldProperty(u, "", l); m && r.push(m); }); const { templateId: i } = this.formSchemaUtils.getFormSchema().module; return i === "double-list-in-tab-template" && (e.appearance.class = "f-section-grid f-section-in-main px-0 pt-0", e.fill = !0), [e]; } resolveControlClassByFormColumns(n) { let e = ""; switch (n.formColumns) { case 1: { e = "col-12"; break; } case 2: { e = "col-12 col-md-6 col-xl-6 col-el-6"; break; } case 3: { e = "col-12 col-md-6 col-xl-4 col-el-4"; break; } case 4: { e = "col-12 col-md-6 col-xl-3 col-el-2"; break; } } return e; } /** * 添加viewModel节点 */ createViewModeNode(n) { return { id: `${n.componentId}-component-viewmodel`, code: `${n.componentId}-component-viewmodel`, name: n.componentName, bindTo: n.bindTo, parent: ys, fields: this.assembleViewModelFields(n), commands: [], states: [], enableValidation: !0 }; } /** * 组装viewModel fields 节点 */ assembleViewModelFields(n) { const e = [], { selectedFields: o } = n; return o == null || o.forEach((r) => { let a = "blur"; const i = r.type.name; (i === Wn.Enum || i === Wn.Boolean) && (a = "change"), e.push({ type: "Form", id: r.id, fieldName: r.bindingField, groupId: null, groupName: null, updateOn: a, fieldSchema: {} }); }), e; } } function ws(t, n, e, o) { var a, i, s, u, l, m; const r = e.parentComponentInstance; if (r && o) { const c = (a = r.schema) == null ? void 0 : a.type, h = { componentId: `form-${Math.random().toString(36).slice(2, 6)}`, componentName: ((i = e.bindingSourceContext) == null ? void 0 : i.entityTitle) || ((u = (s = e.bindingSourceContext) == null ? void 0 : s.bindingEntity) == null ? void 0 : u.name) || "标题", componentType: "form", formColumns: c === "splitter-pane" ? 1 : 4, parentContainerId: r.schema.id, bindTo: ((l = e.bindingSourceContext) == null ? void 0 : l.bindTo) || "/", selectedFields: (m = e.bindingSourceContext) == null ? void 0 : m.