UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,302 lines 234 kB
var Hn = Object.defineProperty; var zn = (e, t, n) => t in e ? Hn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var X = (e, t, n) => zn(e, typeof t != "symbol" ? t + "" : t, n); import { radioCheckboxCommonProps as qn, getCustomClass as Ht, withInstall as an, FormSchemaEntityField$Type as Ct, FormSchemaEntityFieldTypeName as en, FormSchemaEntityFieldType$Type as rn, useGuid as Ut } from "../../components/common/index.esm.js"; import { getSchemaByTypeForDesigner as Un, createPropsResolver as Tt, resolveAppearance as Wn } from "../../components/dynamic-resolver/index.esm.js"; import Gn, { radioGroupProps as _n } from "../../components/radio-group/index.esm.js"; import { computed as j, ref as C, defineComponent as Se, watch as se, createVNode as b, Fragment as Ze, reactive as Le, createApp as Wt, onUnmounted as ft, onMounted as ke, Transition as ln, mergeProps as Ft, nextTick as Je, createTextVNode as Ae, inject as ct, onBeforeMount as Xn, Teleport as sn, shallowRef as Yn, render as At, h as Jn, cloneVNode as Qn, withDirectives as zt, vShow as Zn, onUpdated as Kn, onBeforeUnmount as eo, vModelText as tn } from "vue"; import { cloneDeep as dt, isUndefined as Re, isPlainObject as nn, debounce as to } from "lodash-es"; import { DgControl as on } from "../../components/designer-canvas/index.esm.js"; import { useI18n as Gt } from "vue-i18n"; import { LocaleService as Mt } from "../../components/locale/index.esm.js"; import { useResizeObserver as no } from "@vueuse/core"; import { getHierarchyRow as oo, useIdentify as io, useGroupData as ao, useFilter as ro, useHierarchy as lo, useLoading as so, useDataView as uo, useSelection as co, useSelectHierarchyItem as fo, usePagination as po, useDataViewContainerStyle as mo, useCommandColumn as vo, useSettingColumn as go, useColumn as ho, useSort as yo, useGroupColumn as bo, useRow as Co, useEdit as wo, useVisualDataBound as So, useVisualDataCell as xo, useVisualDataRow as To, useVisualData as Fo, useCellPosition as Mo, useSidebar as Eo, useVirtualScroll as Bo, useFitColumn as ko, useFilterHistory as Io, useColumnFilter as Po, useDragColumn as Oo, getColumnHeader as Vo, getSidebar as No, getDisableMask as jo, getHorizontalScrollbar as Do, getVerticalScrollbar as Ro, getEmpty as $o, getPagination as Lo, getSummary as Ao } from "../../components/data-view/index.esm.js"; import "../../components/property-panel/index.esm.js"; import "../../components/accordion/index.esm.js"; import "../../components/avatar/index.esm.js"; import "../button-edit/index.esm.js"; import "../../components/button-group/index.esm.js"; import "../../components/calendar/index.esm.js"; import "../../components/capsule/index.esm.js"; import "../checkbox/index.esm.js"; import "../checkbox-group/index.esm.js"; import "../../components/combo-list/index.esm.js"; import "../../components/combo-tree/index.esm.js"; import "../../components/component/index.esm.js"; import "../../components/color-picker/index.esm.js"; import "../../components/content-container/index.esm.js"; import "../../components/date-picker/index.esm.js"; import "../data-grid/index.esm.js"; import "../../components/dropdown/index.esm.js"; import "../../components/dynamic-form/index.esm.js"; import "../../components/events-editor/index.esm.js"; import "../../components/filter-bar/index.esm.js"; import "../../components/field-selector/index.esm.js"; import "../../components/binding-selector/index.esm.js"; import "../../components/image-cropper/index.esm.js"; import "../input-group/index.esm.js"; import "../../components/layout/index.esm.js"; import "../../components/list-nav/index.esm.js"; import "../list-view/index.esm.js"; import "../../components/lookup/index.esm.js"; import "../../components/mapping-editor/index.esm.js"; import "../../components/nav/index.esm.js"; import "../../components/number-range/index.esm.js"; import "../../components/number-spinner/index.esm.js"; import "../../components/order/index.esm.js"; import "../../components/page-header/index.esm.js"; import "../../components/page-footer/index.esm.js"; import "../../components/pagination/index.esm.js"; import "../../components/progress/index.esm.js"; import "../../components/query-solution/index.esm.js"; import "../radio-group/index.esm.js"; import "../../components/rate/index.esm.js"; import "../../components/response-toolbar/index.esm.js"; import "../../components/response-layout/index.esm.js"; import "../../components/response-layout-editor/index.esm.js"; import "../../components/search-box/index.esm.js"; import "../../components/section/index.esm.js"; import "../../components/smoke-detector/index.esm.js"; import "../../components/splitter/index.esm.js"; import "../../components/step/index.esm.js"; import "../../components/switch/index.esm.js"; import "../../components/tabs/index.esm.js"; import Ho from "../../components/tags/index.esm.js"; import "../../components/text/index.esm.js"; import "../../components/time-picker/index.esm.js"; import "../../components/transfer/index.esm.js"; import "../../components/tree-view/index.esm.js"; import "../../components/uploader/index.esm.js"; import "../../components/verify-detail/index.esm.js"; import "../../components/video/index.esm.js"; import "../../components/textarea/index.esm.js"; import "../../components/schema-selector/index.esm.js"; import "../tree-grid/index.esm.js"; import "../../components/event-parameter/index.esm.js"; import "../../components/filter-condition-editor/index.esm.js"; import "../../components/fieldset/index.esm.js"; import "../../components/sort-condition-editor/index.esm.js"; import "../../components/menu-lookup/index.esm.js"; import "../drawer/index.esm.js"; import "../../components/json-editor/index.esm.js"; import "../../components/property-editor/index.esm.js"; import "../../components/expression-editor/index.esm.js"; import "../../components/code-editor/index.esm.js"; import "../../components/html-template/index.esm.js"; import "../../components/collection-property-editor/index.esm.js"; import "../../components/modal/index.esm.js"; import "../../components/external-container/index.esm.js"; import "../../components/language-textbox/index.esm.js"; import { FNotifyService as zo } from "../../components/notify/index.esm.js"; import qo from "../../components/popover/index.esm.js"; import Uo from "../../components/data-grid/index.esm.js"; const Wo = { ...qn, /** * 组件标识 */ id: String, /** * 禁用组件,不允许切换单选值 */ disabled: { type: Boolean, default: !1 }, /** * 功能同disabled */ readonly: { type: Boolean, default: !1 }, /** * 单选组枚举数组----废弃 */ enumData: { type: Array }, /** * 单选组枚举数组 */ data: { type: Array }, /** * 组件值 */ modelValue: { type: String, default: "" }, /** * 组件名称 */ name: { type: String, default: "" }, /** * 输入框Tab键索引 */ tabIndex: { type: Number, default: -1 }, /** * 枚举数组中展示文本的key值。 */ textField: { type: String, default: "name" }, /** * 枚举数组中枚举值的key值。 */ valueField: { type: String, default: "value" } }; function Go(e, t, n) { const o = j(() => !e.disabled), i = j(() => e.data || e.enumData || e.options || []); function a(l) { return l[e.valueField]; } function r(l) { return l[e.textField]; } function c(l, u) { if (o.value) { const p = a(l); n.value !== p && (n.value = p, t.emit("changeValue", p), t.emit("update:modelValue", p)); } u.stopPropagation(); } return { enumData: i, getValue: a, getText: r, onClickRadio: c }; } const L = { button: { type: "button", name: "按钮" }, "response-toolbar": { type: "response-toolbar", name: "工具栏" }, "response-toolbar-item": { type: "response-toolbar-item", name: "按钮" }, "content-container": { type: "content-container", name: "容器" }, "input-group": { type: "input-group", name: "文本" }, textarea: { type: "textarea", name: "多行文本" }, lookup: { type: "lookup", name: "帮助" }, "number-spinner": { type: "number-spinner", name: "数值" }, "date-picker": { type: "date-picker", name: "日期" }, switch: { type: "switch", name: "开关" }, "radio-group": { type: "radio-group", name: "单选组" }, "check-box": { type: "check-box", name: "复选框" }, "check-group": { type: "check-group", name: "复选框组" }, "combo-list": { type: "combo-list", name: "下拉列表" }, "response-form": { type: "response-form", name: "卡片面板" }, "response-layout": { type: "response-layout", name: "布局容器", icon: "response-layout-3" }, "response-layout-item": { type: "response-layout-item", name: "布局", icon: "response-layout-1" }, "tree-grid": { type: "tree-grid", name: "树表格" }, "tree-grid-column": { type: "tree-grid-column", name: "树表格列" }, "data-grid": { type: "data-grid", name: "表格" }, "data-grid-column": { type: "data-grid-column", name: "表格列" }, module: { type: "Module", name: "模块" }, component: { type: "component", name: "组件" }, tabs: { type: "tabs", name: "标签页" }, "tab-page": { type: "tab-page", name: "标签页项", dependentParentControl: "Tab" }, "tab-toolbar-item": { type: "tab-toolbar-item", name: "标签页工具栏按钮" }, "html-template": { type: "html-template", name: "模板容器" }, "time-picker": { type: "time-picker", name: "时间选择" }, section: { type: "section", name: "分组面板" }, "section-toolbar": { type: "section-toolbar", name: "分组面板工具栏" }, "section-toolbar-item": { type: "section-toolbar-item", name: "分组面板按钮" }, splitter: { type: "splitter", name: "分栏面板" }, "splitter-pane": { type: "splitter-pane", name: "分栏面板项", dependentParentControl: "Splitter" }, "component-ref": { type: "component-ref", name: "组件引用节点" }, uploader: { type: "uploader", name: "附件上传" }, "page-header": { type: "page-header", name: "页头" }, "page-footer": { type: "page-footer", name: "页脚" }, "tab-toolbar": { type: "tab-toolbar", name: "标签页工具栏" }, fieldset: { type: "fieldset", name: "分组" }, "query-solution": { type: "query-solution", name: "筛选方案" }, drawer: { type: "drawer", name: "抽屉" }, "external-container": { type: "external-container", name: "外部容器", icon: "content-container" }, "list-nav": { type: "list-nav", name: "列表导航" }, "list-view": { type: "list-view", name: "列表" }, "filter-bar": { type: "filter-bar", name: "筛选条" }, "language-textbox": { type: "language-textbox", name: "多语输入框" } }; function un(e, t, n) { var h; const o = n && n.getStyles && n.getStyles() || "", i = n && n.getDesignerClass && n.getDesignerClass() || "", a = C(); let r; function c() { return (t == null ? void 0 : t.schema.componentType) === "frame" ? !1 : n && n.checkCanMoveComponent ? n.checkCanMoveComponent() : !0; } function l() { return !1; } function u() { return (t == null ? void 0 : t.schema.componentType) === "frame" ? !1 : n && n.checkCanDeleteComponent ? n.checkCanDeleteComponent() : !0; } function p() { return (t == null ? void 0 : t.schema.componentType) === "frame" ? !0 : n && n.hideNestedPaddingInDesginerView ? n.hideNestedPaddingInDesginerView() : !1; } function s(F) { if (!F || !F.value) return null; if (F.value.schema && F.value.schema.type === "component") return F.value; const P = C(F == null ? void 0 : F.value.parent), O = s(P); return O || null; } function m(F = t) { var G; if (n != null && n.getDraggableDesignItemElement) return n.getDraggableDesignItemElement(F); const { componentInstance: P, designerItemElementRef: O } = F; if (!P || !P.value) return null; const { getCustomButtons: D } = P.value; return P.value.canMove || D && ((G = D()) != null && G.length) ? O : m(F.parent); } function d(F) { return !!n && n.canAccepts(F); } function f() { return (t == null ? void 0 : t.schema.label) || (t == null ? void 0 : t.schema.title) || (t == null ? void 0 : t.schema.name); } function v() { } function S(F, P) { var O; !F || !P || (n != null && n.onAcceptMovedChildElement && n.onAcceptMovedChildElement(F, P), (O = t == null ? void 0 : t.setupContext) == null || O.emit("dragEnd")); } function M(F, P) { const { componentType: O } = F; let D = Un(O, F, P); n && n.onResolveNewComponentSchema && (D = n.onResolveNewComponentSchema(F, D)); const G = O.toLowerCase().replace(/-/g, "_"); return D && !D.id && D.type === O && (D.id = `${G}_${Math.random().toString().slice(2, 6)}`), D; } function E(F) { F && n != null && n.onChildElementMovedOut && n.onChildElementMovedOut(F); } function A(...F) { if (n && n.getPropsConfig) return n.getPropsConfig(...F); } function w(F) { if (!F) return; const P = t == null ? void 0 : t.schema, { formSchemaUtils: O } = F; if (P && O.getExpressions().length) { const D = O.getExpressions().findIndex((G) => G.target === P.id); D > -1 && O.getExpressions().splice(D, 1); } } function g(F) { if (!F || !(t != null && t.schema)) return; const P = t.schema, { formSchemaUtils: O } = F; O.removeCommunicationInComponent(P); } function y(F) { n && n.onRemoveComponent && n.onRemoveComponent(), w(F), g(F), t != null && t.schema.contents && t.schema.contents.map((P) => { let O = P.id; P.type === "component-ref" && (O = P.component); const D = e.value.querySelectorAll(`#${O}-design-item`); D != null && D.length && Array.from(D).map((G) => { var ee; (ee = G == null ? void 0 : G.componentInstance) != null && ee.value.onRemoveComponent && G.componentInstance.value.onRemoveComponent(F); }); }); } function k() { if (n && n.getCustomButtons) return n.getCustomButtons(); } function B(F) { var O, D; if (!((O = t == null ? void 0 : t.schema) != null && O.id)) return; if (!r && F && (r = F.formSchemaUtils), n != null && n.setComponentBasicInfoMap) { n.setComponentBasicInfoMap(); return; } let P = ""; if (n != null && n.getComponentTitle) P = n.getComponentTitle(); else { const { text: G, title: ee, label: R, mainTitle: N, name: _, type: z } = t.schema; P = G || ee || R || N || _ || ((D = L[z]) == null ? void 0 : D.name); } P && r.getControlBasicInfoMap().set(t.schema.id, { componentTitle: P, parentPathName: P }); } function x(F) { var G; const { changeObject: P } = F, { propertyID: O, propertyValue: D } = P; if (["text", "title", "label", "name", "mainTitle"].includes((G = F == null ? void 0 : F.changeObject) == null ? void 0 : G.propertyID) && O && D && (B(), r)) { const ee = r.getControlBasicInfoMap(), R = ee.keys().toArray().filter((N) => { var _, z; return ((_ = ee.get(N)) == null ? void 0 : _.reliedComponentId) === ((z = t == null ? void 0 : t.schema) == null ? void 0 : z.id); }); R != null && R.length && R.forEach((N) => { const _ = ee.get(N).parentPathName.split(" > "); _[0] = D, ee.get(N).parentPathName = _.join(" > "); }); } } function I(F) { if (x(F), n && n.onPropertyChanged) return n.onPropertyChanged(F); } return a.value = { canMove: c(), canSelectParent: l(), canDelete: u(), canNested: !p(), contents: t == null ? void 0 : t.schema.contents, elementRef: e, parent: (h = t == null ? void 0 : t.parent) == null ? void 0 : h.componentInstance, schema: t == null ? void 0 : t.schema, styles: o, designerClass: i, canAccepts: d, getBelongedComponentInstance: s, getDraggableDesignItemElement: m, getDraggingDisplayText: f, getPropConfig: A, getDragScopeElement: v, onAcceptMovedChildElement: S, onChildElementMovedOut: E, addNewChildComponentSchema: M, triggerBelongedComponentToMoveWhenMoved: !!n && n.triggerBelongedComponentToMoveWhenMoved || C(!1), triggerBelongedComponentToDeleteWhenDeleted: !!n && n.triggerBelongedComponentToDeleteWhenDeleted || C(!1), onRemoveComponent: y, getCustomButtons: k, onPropertyChanged: I, setComponentBasicInfoMap: B, updateContextSchema: t == null ? void 0 : t.updateContextSchema }, a; } const _o = C(0); function Xo() { _o.value++; } const gt = C(0); function Yo(e) { const { formSchemaUtils: t, formStateMachineUtils: n } = e; function o(l, u = "") { return { path: u + l.code, field: l.id, fullPath: l.code }; } function i(l, u = "") { return t.getViewModelById(l).states.map((s) => o(s, u)); } function a(l) { const u = t.getRootViewModelId(), p = i(l); if (l === u) return p; const s = i(u, "root-component."); return [...p, ...s]; } function r(l) { return l.binding && l.binding.path || l.id || ""; } function c() { return n && n.getRenderStates() || []; } return { getVariables: a, getControlName: r, getStateMachines: c }; } class cn { constructor(t) { X(this, "sessionVariables", [ { key: "CurrentSysOrgName", name: "当前组织Name", description: "当前组织Name" }, // { // key: "CurrentSysOrgCode", // name: "当前组织Code", // description: "当前组织Code" // }, { key: "CurrentSysOrgId", name: "当前组织Id", description: "当前组织Id" }, { key: "CurrentUserName", name: "当前用户Name", description: "当前用户Name" }, { key: "CurrentUserCode", name: "当前用户Code", description: "当前用户Code" }, { key: "CurrentUserId", name: "当前用户Id", description: "当前用户Id" }, { key: "CurrentLanguage", name: "当前语言编号", description: "当前登录的语言编号,例如简体中文返回'zh-CHS',英文返回'en',繁体中文'zh-CHT'" } ]); X(this, "expressionNames", { compute: "计算表达式", dependency: "依赖表达式", validate: "验证表达式", dataPicking: "帮助前表达式", visible: "可见表达式", readonly: "只读表达式", required: "必填表达式" }); X(this, "getExpressionConverter", (t, n) => ({ convertFrom: (o, i, a, r) => { const c = a.getExpressionRuleValue(t, n || i); return c && c.value || ""; }, convertTo: (o, i, a, r, c) => { var l; if (i === "dataPicking" && (a != null && a.target)) { const u = `${a.target}_dataPicking`; ((l = a.rules) == null ? void 0 : l.some( (s) => s.id === u && s.value )) ? o.dictPickingExpressionId = u : delete o.dictPickingExpressionId; } r.updateExpression(a); } })); this.formSchemaService = t; } getExpressionRule(t, n) { const o = this.formSchemaService.getExpressions(); if (!o) return ""; const i = o.find((r) => r.target === t); if (!i) return ""; const a = i.rules.find((r) => r.type === n); return a || ""; } // 获取上下文表单变量 getContextFormVariables() { const { module: t } = this.formSchemaService.getFormSchema(); if (!t.viewmodels || t.viewmodels.length === 0) return []; const n = this.formSchemaService.getRootViewModelId(), o = this.formSchemaService.getViewModelById(n); if (!o || !o.states || o.states.length === 0) return []; const i = []; return o.states.forEach((a) => { i.push({ key: a.code, name: a.name, description: a.name, category: a.category }); }), i; } createTreeNode(t, n, o = "label") { return { id: t.id, name: t.name, bindingPath: t[o], parents: n, type: "field" }; } buildEntityFieldsTreeData(t = null, n) { const o = []; return t == null || t.forEach((i) => { var c; const a = this.createTreeNode(i, n); let r = []; (c = i.type) != null && c.fields && (r = this.buildEntityFieldsTreeData(i.type.fields, [...n, i.label])), o.push({ data: a, children: r, expanded: !0 }); }), o; } buildChildEntityTreeData(t = null, n) { const o = []; return t == null || t.forEach((i) => { var l, u; const a = this.createTreeNode(i, n); a.type = "entity"; const r = this.buildEntityFieldsTreeData((l = i.type) == null ? void 0 : l.fields, [...n, i.label]), c = this.buildChildEntityTreeData((u = i.type) == null ? void 0 : u.entities, [...n, i.label]); c != null && c.length && (r == null || r.push(...c)), o.push({ data: a, children: r || [], // 空值回退 expanded: !0 }); }), o; } getEntitiesTreeData() { const t = this.formSchemaService.getSchemaEntities(); if (!(t != null && t.length)) return []; const n = t[0]; if (!(n != null && n.type)) return []; const o = this.buildEntityFieldsTreeData(n.type.fields, [n.code]), i = this.buildChildEntityTreeData(n.type.entities, [n.code]); return i != null && i.length && (o == null || o.push(...i)), { entityCode: n.code, fields: [{ data: this.createTreeNode(n, [], "code"), children: o || [] }] }; } getEntitiesAndVariables() { return { entities: this.getEntitiesTreeData(), variables: { session: { name: "系统变量", items: this.sessionVariables, visible: !1 }, forms: { name: "表单变量", items: this.getContextFormVariables(), visible: !0 } } }; } onBeforeOpenExpression(t, n, o) { const i = o === "Field" ? t.binding.field : t.id, a = this.getExpressionRule(i, n), r = this.getEntitiesAndVariables(), c = { message: ["validate", "required", "dataPicking"].includes(n) && a ? a.message : "", ...r }; return a.messageType != null && (c.messageType = a.messageType), c; } buildRule(t, n, o, i) { const { expression: a, message: r, messageType: c } = n, l = { id: `${t}_${o}`, type: o, value: a }; return (o === "validate" || o === "dataPicking" || o === "required") && (l.message = r), o === "dataPicking" && (l.messageType = c), o === "validate" && i && (l.elementId = i), l; } getExpressionData() { const { expressions: t } = this.formSchemaService.getFormSchema().module; return t || []; } updateExpression(t, n, o, i) { const a = n === "Field" ? t.binding.field : t.id, r = this.buildRule(a, o, i, t.type === "form-group" ? t.id : ""); let l = this.getExpressionData().find((p) => p.targetType === n && p.target === a); const u = (p) => p.value.trim() === ""; if (l) { const p = l.rules.find((s) => s.id === r.id); if (p) u(r) ? l.rules = l.rules.filter((s) => s.id !== r.id) : (Object.assign(p, r), i === "validate" && t.type === "form-group" && (p.elementId = t.id)); else { if (u(r)) return null; l.rules = l.rules || [], l.rules.push(r); } } else { if (u(r)) return null; l = { target: `${a}`, rules: [r], targetType: n }; } return l; } getExpressionEditorOptions(t, n, o, i) { return o.reduce((a, r) => { var l, u; const c = n === "Field" ? (l = t == null ? void 0 : t.binding) == null ? void 0 : l.field : t.id; return a[r] = { hide: n === "Field" ? !!((u = t == null ? void 0 : t.binding) != null && u.field) : !1, description: "", title: this.expressionNames[r], type: "string", $converter: this.getExpressionConverter(c), refreshPanelAfterChanged: !0, editor: { type: "expression-editor", singleExpand: !1, dialogTitle: `${this.expressionNames[r]}编辑器`, showMessage: r === "validate" || r === "dataPicking" || r === "required", showMessageType: r === "dataPicking", beforeOpen: () => this.onBeforeOpenExpression(t, r, n), onSubmitModal: (p) => { const s = this.updateExpression(t, n, p, r); if (i) { const m = this.buildRule(c, p, r); i(m); } return s; } } }, a; }, {}); } getExpressionInfo(t, n, o) { const i = n === "Field" ? t.binding.field : t.id, a = this.getExpressionRule(i, o), r = { value: a && a.value, targetId: i, targetType: n, expressionType: o }; return a && a.message && (r.message = a.message), r; } getExpressionConfig(t, n, o = ["compute", "dependency", "validate"], i) { return { description: "表达式", title: "表达式", hide: !t.binding, properties: { ...this.getExpressionEditorOptions(t, n, o, i) } }; } getExpressionOptions(t, n, o) { const i = this.getExpressionInfo(t, n, o); return { dialogTitle: `${this.expressionNames[o]}编辑器`, singleExpand: !1, showMessage: o === "required", beforeOpen: () => this.onBeforeOpenExpression(t, o, n), expressionInfo: i }; } } class Jo { constructor(t, n) { X(this, "componentId"); X(this, "viewModelId"); X(this, "eventsEditorUtils"); X(this, "formSchemaUtils"); X(this, "formMetadataConverter"); X(this, "designViewModelUtils"); X(this, "designViewModelField"); X(this, "controlCreatorUtils"); X(this, "designerHostService"); X(this, "designerContext"); X(this, "schemaService", null); X(this, "metadataService", null); X(this, "propertyConfig", { type: "object", categories: {} }); var o; this.componentId = t, this.designerHostService = n, this.eventsEditorUtils = n.eventsEditorUtils, this.formSchemaUtils = n.formSchemaUtils, this.formMetadataConverter = n.formMetadataConverter, this.viewModelId = ((o = this.formSchemaUtils) == null ? void 0 : o.getViewModelIdByComponentId(t)) || "", this.designViewModelUtils = n.designViewModelUtils, this.controlCreatorUtils = n.controlCreatorUtils, this.metadataService = n.metadataService, this.schemaService = n.schemaService, this.designerContext = n.designerContext; } getFormDesignerInstance() { var t, n; return (n = (t = this.designerContext) == null ? void 0 : t.instances) == null ? void 0 : n.formDesigner.value; } getTableInfo() { var t; return (t = this.schemaService) == null ? void 0 : t.getTableInfoByViewModelId(this.viewModelId); } setDesignViewModelField(t) { var o; const n = t.binding && t.binding.type === "Form" && t.binding.field; if (n) { if (!this.designViewModelField) { const i = this.designViewModelUtils.getDgViewModel(this.viewModelId); this.designViewModelField = i.fields.find((a) => a.id === n); } t.updateOn = (o = this.designViewModelField) == null ? void 0 : o.updateOn; } } getBasicPropConfig(t) { return { description: "Basic Information", title: "基本信息", properties: { id: { description: "组件标识", title: "标识", type: "string", readonly: !0 }, type: { description: "组件类型", title: "控件类型", type: "select", editor: { type: "combo-list", textField: "name", valueField: "value", idField: "value", editable: !1, data: [{ value: t.type, name: L[t.type] && L[t.type].name }] } } } }; } getAppearanceConfig(t = null, n = {}, o) { const i = { title: "外观", description: "Appearance" }, a = { class: { title: "class样式", type: "string", description: "组件的CSS样式", $converter: "/converter/appearance.converter", parentPropertyID: "appearance" }, style: { title: "style样式", type: "string", description: "组件的样式", $converter: "/converter/appearance.converter", parentPropertyID: "appearance" } }; for (const r in n) a[r] = Object.assign(a[r] || {}, n[r]); return { ...i, properties: { ...a }, setPropertyRelates(r, c) { if (r) { switch (r && r.propertyID) { case "class": case "style": { gt.value++; break; } } o && o(r, t, c); } } }; } getPropertyEditorParams(t, n = [], o = "visible", i = {}, a = {}) { const { getVariables: r, getControlName: c, getStateMachines: l } = Yo(this.designerHostService), u = this.getRealTargetType(t), p = n && n.length > 0 ? n : ["Const", "Variable", "StateMachine", "Expression"], s = { type: "property-editor", propertyTypes: p }; return p.map((m) => { switch (m) { case "Const": Object.assign(s, { constType: "enum", constEnums: [{ id: !0, name: "是" }, { id: !1, name: "否" }] }, i); break; case "Expression": s.expressionConfig = this.getExpressionOptions(t, u, o); break; case "StateMachine": s.stateMachines = l(); break; case "Variable": Object.assign(s, { controlName: c(t), newVariablePrefix: "is", newVariableType: "Boolean", variables: r(this.viewModelId), onBeforeOpenVariables: (d) => { d.value = r(this.viewModelId); } }, a); break; } }), s; } getVisibleProperty(t, n = "") { var a; let o = ["Const", "Variable", "StateMachine", "Expression"]; return n === "gridFieldEditor" ? o = ["Const", "Expression"] : n === "form-group" && !((a = t.binding) != null && a.field) && (o = ["Const", "Variable", "StateMachine"]), { visible: { title: "是否可见", type: "boolean", description: "运行时组件是否可见", editor: this.getPropertyEditorParams(t, o, "visible") } }; } /** * 获取行为 * @param propertyData * @param viewModelId * @returns */ getBehaviorConfig(t, n = "", o = {}, i) { const a = { title: "行为", description: "" }, r = this.getVisibleProperty(t, n); for (const l in o) r[l] = Object.assign(r[l] || {}, o[l]); const c = this; return { ...a, properties: { ...r }, setPropertyRelates(l, u) { if (l) { switch (l.propertyID) { case "disabled": case "readonly": case "visible": c.afterMutilEditorChanged(t, l); break; } i && i(l, u); } } }; } /** * 当多值编辑器变更时 * @param propertyData * @param changeObject */ afterMutilEditorChanged(t, n) { this.addNewVariableToViewModel(n, this.viewModelId), this.updateExpressionValue(n), this.clearExpression(n, t); } /** * * @param propertyId * @param componentInstance * @returns */ updateElementByParentContainer(t, n) { const o = n && n.parent && n.parent.schema; if (!o) return; const i = o.contents.findIndex((r) => r.id === t), a = dt(o.contents[i]); o.contents.splice(i, 1), o.contents.splice(i, 0, a), Xo(); } /** * 属性编辑器,在编辑过程中会新增变量,此处需要将新增的变量追加到ViewModel中 * @param changeObject * @param viewModelId * @returns */ addNewVariableToViewModel(t, n) { const o = t.propertyValue; if (!(o && typeof o == "object") || !(o.type === "Variable" && o.isNewVariable)) return; const r = { id: o.field, category: "locale", code: o.fullPath, name: o.fullPath, type: o.newVariableType || "String" }; delete o.newVariableType, delete o.isNewVariable, this.formSchemaUtils.getVariableByCode(r.code) || this.formSchemaUtils.getViewModelById(n).states.push(r); } /** * 更新表达式到expressions节点 * @param changeObject */ updateExpressionValue(t) { const n = t.propertyValue; if (!((n && n.type) === "Expression" && n.expressionInfo)) return; const { expressionId: a, expressionInfo: r } = n, { targetId: c, targetType: l, expressionType: u, value: p, message: s } = r, m = this.formSchemaUtils.getModule(); m.expressions = m.expressions || []; const { expressions: d } = m; let f = d.find((S) => S.target === c); f || (f = { target: c, rules: [], targetType: l }, d.push(f)); const v = f.rules.find((S) => S.type === u); if (v) v.value = p, v.message = s; else { const S = { id: a, type: u, value: p, message: s }; f.rules.push(S); } delete n.expressionInfo; } /** * 属性类型切换为非表达式后,清除原表达式 * @param changeObject * @param propertyData * @returns */ clearExpression(t, n) { const o = t.propertyValue; if (o && o.type === "Expression") return; const a = t.propertyID, r = this.formSchemaUtils.getExpressions(), c = n.binding ? n.binding.field : n.id, l = r.find((u) => u.target === c); !l || !l.rules || (l.rules = l.rules.filter((u) => u.type !== a)); } getExpressionOptions(t, n, o) { return new cn(this.formSchemaUtils).getExpressionOptions(t, n, o); } getRealTargetType(t) { return ["response-toolbar-item", "tab-toolbar-item", "section-toolbar-item"].indexOf(t.type) > -1 ? "Button" : t.binding && t.binding.field ? "Field" : "Container"; } createBaseEventProperty(t) { const n = {}; return n[this.viewModelId] = { type: "events-editor", editor: { initialData: t, viewSourceHandle: (o) => { var i; ((i = o.controller) == null ? void 0 : i.label.indexOf(this.formSchemaUtils.getModule().code)) > -1 && this.eventsEditorUtils.jumpToMethod(o); } } }, n; } } const tt = class tt { /** * 根据绑定字段类型获取可用的输入类控件 */ static getEditorTypesByMDataType(t, n = !1, o = "") { if (n) return [{ key: L["language-textbox"].type, value: L["language-textbox"].name }]; let i = tt.fieldControlTypeMapping[t]; if (o === "data-grid-column" && (i != null && i.length)) { const a = [L["check-group"].type, L["radio-group"].type]; i = i.filter((r) => !a.includes(r.key)); } return i; } /** * 获取所有输入类控件 */ static getAllInputTypes() { const t = []; for (const n in tt.fieldControlTypeMapping) tt.fieldControlTypeMapping[n].forEach((o) => { t.find((i) => i.key === o.key && i.value === o.value) || t.push({ key: o.key, value: o.value }); }); return t; } /** * 提供schema字段基础属性和DOM控件属性的映射 * @param control 控件元数据 */ static mappingDomPropAndSchemaProp(t, n) { var a; const o = (a = t.editor) == null ? void 0 : a.type, i = []; return (t.type === L["data-grid-column"].type || t.type === L["tree-grid-column"].type) && n && n.categoryId && n.categoryId.indexOf("gridFieldEditor") < 0 && i.push({ domField: "title", schemaField: "name" }), i.push({ domField: "label", schemaField: "name" }), i.push({ domField: "editor.required", schemaField: "require" }), i.push({ domField: "editor.readonly", schemaField: "readonly" }), (o === L["input-group"].type || o === L.textarea.type || o === L["number-spinner"].type) && i.push({ domField: "editor.maxLength", schemaField: "type.length" }), o === L["number-spinner"].type && i.push({ domField: "editor.precision", schemaField: "type.precision" }), (t.type === L["data-grid-column"].type || t.type === L["tree-grid-column"].type) && i.push({ domField: "formatter.precision", schemaField: "type.precision" }), (o === L["combo-list"].type || o === L["radio-group"].type) && i.push({ domField: "editor.data", schemaField: "type.enumValues" }), (t.type === L["data-grid-column"].type || t.type === L["tree-grid-column"].type) && i.push({ domField: "formatter.data", schemaField: "type.enumValues" }), o === L["date-picker"].type && (i.push({ domField: "editor.displayFormat", schemaField: "editor.format" }), i.push({ domField: "editor.fieldType", schemaField: "type.name" })), o === L["number-spinner"].type && (i.push({ domField: "editor.max", schemaField: "editor.maxValue" }), i.push({ domField: "editor.min", schemaField: "editor.minValue" })), o === L.lookup.type && (i.push({ domField: "editor.dataSource", schemaField: "editor.dataSource" }), i.push({ domField: "editor.valueField", schemaField: "editor.valueField" }), i.push({ domField: "editor.textField", schemaField: "editor.textField" }), i.push({ domField: "editor.displayType", schemaField: "editor.displayType" }), i.push({ domField: "editor.mapFields", schemaField: "editor.mapFields" }), i.push({ domField: "editor.helpId", schemaField: "editor.helpId" })), i.push({ domField: "path", schemaField: "bindingPath" }), i.push({ domField: "binding.path", schemaField: "bindingField" }), i.push({ domField: "binding.fullPath", schemaField: "path" }), (t.type === L["data-grid-column"].type || t.type === L["tree-grid-column"].type) && i.push({ domField: "field", schemaField: "bindingPath" }), i; } }; /** * <字段类型,可配置的控件类型列表>的映射 */ X(tt, "fieldControlTypeMapping", { String: [ { key: L["input-group"].type, value: L["input-group"].name }, { key: L.lookup.type, value: L.lookup.name }, { key: L["date-picker"].type, value: L["date-picker"].name }, { key: L.switch.type, value: L.switch.name }, { key: L["check-box"].type, value: L["check-box"].name }, { key: L["check-group"].type, value: L["check-group"].name }, { key: L["radio-group"].type, value: L["radio-group"].name }, { key: L["combo-list"].type, value: L["combo-list"].name }, { key: L.textarea.type, value: L.textarea.name }, { key: L["time-picker"].type, value: L["time-picker"].name } ], Text: [ { key: L.textarea.type, value: L.textarea.name }, { key: L.lookup.type, value: L.lookup.name } ], Decimal: [ { key: L["number-spinner"].type, value: L["number-spinner"].name } ], Integer: [ { key: L["number-spinner"].type, value: L["number-spinner"].name } ], Number: [ { key: L["number-spinner"].type, value: L["number-spinner"].name }, { key: L.switch.type, value: L.switch.name }, { key: L["check-box"].type, value: L["check-box"].name } ], BigNumber: [ { key: L["number-spinner"].type, value: L["number-spinner"].name } ], Date: [ { key: L["date-picker"].type, value: L["date-picker"].name } ], DateTime: [ { key: L["date-picker"].type, value: L["date-picker"].name } ], Boolean: [ { key: L.switch.type, value: L.switch.name }, { key: L["check-box"].type, value: L["check-box"].name } ], Enum: [ { key: L["combo-list"].type, value: L["combo-list"].name }, { key: L["radio-group"].type, value: L["radio-group"].name } ], Object: [ { key: L.lookup.type, value: L.lookup.name }, { key: L["combo-list"].type, value: L["combo-list"].name }, { key: L["radio-group"].type, value: L["radio-group"].name } ] }); let wt = tt; var ht = /* @__PURE__ */ ((e) => (e.Form = "Form", e.Variable = "Variable", e))(ht || {}); class Qo { constructor() { /** 控件标题 */ X(this, "label", ""); /** 控件id */ X(this, "id", ""); /** 每个控件占用的栅格数 */ X(this, "columnInSM", 12); X(this, "columnInMD", 6); X(this, "columnInLG", 3); X(this, "columnInEL", 2); /** 每个控件占用的列数 */ X(this, "displayWidthInSM", 1); X(this, "displayWidthInMD", 1); X(this, "displayWidthInLG", 1); X(this, "displayWidthInEL", 1); /** 编辑器内部默认显示的屏幕大小-----可以去掉 */ X(this, "displayColumnCountAtBreakPoint", "md"); /** 控件所在行,传0即可-----编辑器内部使用 */ X(this, "tagRow", 0); /** 控件是否显示上方空白:传0即可-----编辑器内部使用 */ X(this, "showTopBorder", 0); /** 区域,从1开始。卡片内的控件从上往下,从左往右划分区域,遇到分组fieldSet时group+1,分组结束后group+1 */ X(this, "group", 1); /** 控件是否符合标准的class配置(设计器用的) */ X(this, "isSupportedClass", !0); /** 控件所在分组id(设计器用的) */ X(this, "fieldSetId", ""); } } function Zo(e) { let t, n; const o = /* @__PURE__ */ new Map(); let i = []; function a(p, s) { const d = p.split(" ").filter((E) => E.startsWith("col-")); if (d.length === 0) { s.isSupportedClass = !1; return; } let f = d.find((E) => /^col-([1-9]|10|11|12)$/.test(E)), v = d.find((E) => /^col-md-([1-9]|10|11|12)$/.test(E)), S = d.find((E) => /^col-xl-([1-9]|10|11|12)$/.test(E)), M = d.find((E) => /^col-el-([1-9]|10|11|12)$/.test(E)); f = f || "col-12", s.columnInSM = parseInt(f.replace("col-", ""), 10), s.displayWidthInSM = s.columnInSM / 12, s.displayWidthInSM !== 1 && (s.isSupportedClass = !1), v = v || "col-md-" + s.columnInSM, s.columnInMD = parseInt(v.replace("col-md-", ""), 10), s.displayWidthInMD = s.columnInMD / 6, [1, 2].includes(s.displayWidthInMD) || (s.isSupportedClass = !1), S = S || "col-xl-" + s.columnInMD, s.columnInLG = parseInt(S.replace("col-xl-", ""), 10), s.displayWidthInLG = s.columnInLG / 3, [1, 2, 3, 4].includes(s.displayWidthInLG) || (s.isSupportedClass = !1), M = M || "col-el-" + s.columnInLG, s.columnInEL = parseInt(M.replace("col-el-", ""), 10), s.displayWidthInEL = s.columnInEL / 2, [1, 2, 3, 4, 5, 6].includes(s.displayWidthInEL) || (s.isSupportedClass = !1); } function r(p, s, m, d = !1) { let f = !1; p.contents.forEach((v) => { if (v.type === "fieldset") { m += 1, r(v, s, m, !0), f = !0; return; } f && (m += 1, f = !1); const S = v.appearance && v.appearance.class, M = new Qo(); S ? a(S, M) : M.isSupportedClass = !1, M.label = v.label || v.id, M.id = v.id, M.group = m, d && (M.fieldSetId = p.id), n === v.id && (t = m), o.set(v.id, v), s.push(M); }); } function c(p) { const s = e.getComponentById(p); if (!s || !s.componentType || !s.componentType.startsWith("form")) return { result: !1, message: "只可以在响应式表单组件中调整响应式布局配置" }; const m = e.selectNode(s, (d) => d.type === on["response-form"].type); return !m || !m.contents || m.contents.length === 0 ? { result: !1, message: "Form区域内没有控件,请先添加控件" } : { result: !0, message: "", formNode: m }; } function l(p, s) { s = s || p.id; const { result: m, message: d, formNode: f } = c(s); if (!m) return { result: m, message: d }; n = p.id, i = [], o.clear(); const v = f.contents[0].type === on.fieldset.type ? 0 : 1; r(f, i, v); const S = i.find((E) => !E.isSupportedClass); return { defaultState: { defaultGroupNumber: t || 1, model: S ? "customize" : "standard" }, importData: i }; } function u(p, s) { s = s; const { result: m, formNode: d } = c(s); if (!m) return ""; const f = []; return p.forEach((v) => { var E; const S = o.get(v.id), M = S.appearance && S.appearance.class; if (M) { const w = M.split(" ").filter((I) => !I.startsWith("col-")), g = "col-" + v.columnInSM, y = "col-md-" + v.columnInMD, k = "col-xl-" + v.columnInLG, B = "col-el-" + v.columnInEL, x = [g, y, k, B].concat(w); S.appearance.class = x.join(" "); } if (v.fieldSetId) { const A = d.contents.find((g) => g.id === v.fieldSetId), w = f.find((g) => g.id === v.fieldSetId); w ? (E = w.contents) == null || E.push(S) : (f.push(A), A.contents = [S]); } else f.push(S); }), d.contents = f, d.id; } return { checkCanFindFormNode: c, checkCanOpenLayoutEditor: l, changeFormControlsByResponseLayoutConfig: u, getResonseFormLayoutConfig: r }; } var $e = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function vt(e) { throw new Error('Could not dynamically require "' + e + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); } var Ko = { exports: {} }; (function(e, t) { (function(n) { e.exports = n(); })(function() { return (/* @__PURE__ */ function() { function n(o, i, a) { function r(u, p) { if (!i[u]) { if (!o[u]) { var s = typeof vt == "function" && vt; if (!p && s) return s(u, !0); if (c) return c(u, !0); var m = new Error("Cannot find module '" + u + "'"); throw m.code = "MODULE_NOT_FOUND", m; } var d = i[u] = { exports: {} }; o[u][0].call(d.exports, function(f) { var v = o[u][1][f]; return r(v || f); }, d, d.exports, n, o, i, a); } return i[u].exports; } for (var c = typeof vt == "function" && vt, l = 0; l < a.length; l++) r(a[l]); return r; } return n; }())({ 1: [function(n, o, i) { var a = {}, r = "(?:^|\\s)", c = "(?:\\s|$)"; function l(s) { var m = a[s]; return m ? m.lastIndex = 0 : a[s] = m = new RegExp(r + s + c, "g"), m; } function u(s, m) { var d = s.className; d.length ? l(m).test(d) || (s.className += " " + m) : s.className = m; } function p(s, m) { s.className = s.className.replace(l(m), " ").trim(); } o.exports = { add: u, rm: p }; }, {}], 2: [function(n, o, i) { (function(a) { var r = n("contra/emitter"), c = n("crossvent"), l = n("./classes"), u = document, p = u.documentElement; function s(h, F) { var P = arguments.length; P === 1 && Array.isArray(h) === !1 && (F = h, h = []); var O, D, G, ee, R, N, _, z, te, ge = null, he, J, ie = !1, ue = 0, ne, U = F || {}; U.moves === void 0 && (U.moves = E), U.accepts === void 0 && (U.accepts = E), U.invalid === void 0 && (U.invalid = it), U.containers === void 0 && (U.containers = h || []), U.isContainer === void 0 && (U.isContainer = M), U.copy === void 0 && (U.copy = !1), U.copySortSource === void 0 && (U.copySortSource = !1), U.revertOnSpill === void 0 && (U.revertOnSpill = !1), U.removeOnSpill === void 0 && (U.removeOnSpill = !1), U.direction === void 0 && (U.direction = "vertical"), U.ignoreInputTextSelection === void 0 && (U.ignoreInputTextSelection = !0), U.mirrorContainer === void 0 && (U.mirrorContainer = u.body); var oe = r({ containers: U.containers, start: Ve, end: Ue, cancel: Q, remove: V, destroy: ze, canMove: Oe, dragging: !1 }); return U.removeOnSpill === !0 && oe.on("over", kt).on("out", It), Pe(), oe; function He(T) { return oe.containers.indexOf(T) !== -1 || U.isContainer(T); } function Pe(T) { var $ = T ? "remove" : "add"; f(p, $, "mousedown", ce), f(p, $, "mouseup", je); } function Te(T) { var $ = T ? "remove" : "add"; f(p, $, "mousemove", ot); } function Ke(T) { var $ = T ? "remove" : "add"; c[$](p, "selectstart", qe), c[$](p, "click", qe); } function ze() { Pe(!0), je({}); } function qe(T) { he && T.preventDefault(); } function ce(T) { ee = T.clientX, R = T.clientY; var $ = v(T) !== 1 || T.metaKey || T.ctrlKey; if (!$) { var H = T.target, W = Fe(H); W && (he = W, Te(), T.type === "mousedown" && (y(H) ? H.focus() : T.preventDefault())); } } function ot(T) { if (he) { if (v(T) === 0) { je({}); return; } if (!(T.clientX !== void 0 && Math.abs(T.clientX - ee) <= (U.slideFactorX || 0) && T.clientY !== void 0 && Math.abs(T.clientY - R) <= (U.slideFactorY || 0))) { if (U.ignoreInputTextSelection) { var $ = I("clientX", T) || 0, H = I("clientY", T) || 0, W = u.elementFromPoint($, H); if (y(W)) return; } var Z = he; Te(!0), Ke(), Ue(), Ne(Z), l.add(z || G, "gu-transit"), Ot(), Pt(), ue = 0, at(T); } } } function Fe(T) { if (!(oe.dragging && O) && !He(T)) { for (var $ = T; g(T) && He(g(T)) === !1; ) if (U.invalid(T, $) || (T = g(T), !T)) return; var H = g(T); if (H && !U.invalid(T, $)) { var W = U.moves(T, H, $, B(T)); if (W) return { item: T, source: H }; } } } function Oe(T) { return !!Fe(T); } function Ve(T) { var $ = Fe(T); $ && Ne($); } function Ne(T) { Lt(T.item, T.source) && (z = T.item.cloneNode(!0), oe.emit("cloned", z, T.item, "copy")), D = T.source, G = T.item, N = _ = B(T.item), oe.dragging = !0, oe.emit("drag", G, D); } function it() { return !1; } function Ue() { if (oe.dragging) { var T = z || G; et(T, g(T)); } } function Ie() { he = !1, Te(!0), Ke(!0); } function je(T) { if (Ie(), !!oe.dragging) { var $ = z || G, H = I("clientX", T) || 0, W = I("clientY", T) || 0, Z = S(O, H, W), K = De(Z, H, W); K && (z && U.copySortSource || !z || K !== D) ? et($, K) : U.removeOnSpill ? V() : Q(); } } function et(T, $) { var H = g(T); z && U.copySo