UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,499 lines 238 kB
var uo = Object.defineProperty; var co = (e, t, n) => t in e ? uo(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var le = (e, t, n) => co(e, typeof t != "symbol" ? t + "" : t, n); import { defineComponent as je, ref as F, onBeforeMount as kt, onMounted as Ze, createVNode as b, computed as Z, watch as Se, Fragment as Je, reactive as Jt, createApp as wn, onUnmounted as Mt, Transition as Fn, mergeProps as Bt, nextTick as lt, createTextVNode as Te, watchEffect as fo, Teleport as mo, shallowRef as po, render as Gt, h as vo, cloneVNode as go, inject as Zt, withDirectives as xt, resolveDirective as Kt, vModelText as ho } from "vue"; import { resolveAppearance as nn, createPropsResolver as mt, schemaResolverMap as yo, propertyEffectMap as bo, propertyConfigSchemaMap as Co, schemaMap as Tn, getSchemaByType as qt } from "../dynamic-resolver/index.esm.js"; import { DgControl as D, canvasChanged as Sn, refreshCanvas as xn, useDesignerComponent as En, UseTemplateDragAndDropRules as wo } from "../designer-canvas/index.esm.js"; import { cloneDeep as Qe, isUndefined as Ke, isPlainObject as cn, mergeWith as Fo, merge as To } from "lodash-es"; import { LocaleService as We } from "../locale/index.esm.js"; import { getCustomClass as ft, withInstall as So, useThirdComponent as In, isMobilePhone as kn, getMaxZIndex as dn, FormSchemaEntityField$Type as fn, FormSchemaEntityFieldTypeName as mn } from "../common/index.esm.js"; import { useResizeObserver as xo } from "@vueuse/core"; import { getHierarchyRow as Eo, useIdentify as Io, useGroupData as ko, useFilter as Mo, useHierarchy as Bo, useLoading as Vo, useDataView as Ro, useSelection as Oo, useSelectHierarchyItem as Po, usePagination as No, useDataViewContainerStyle as Do, useCommandColumn as jo, useSettingColumn as Lo, useColumn as $o, useSort as Ao, useGroupColumn as Uo, useRow as zo, useEdit as Ho, useVisualDataBound as _o, useVisualDataCell as Go, useVisualDataRow as qo, useVisualData as Wo, useCellPosition as Yo, useSidebar as Xo, useVirtualScroll as Qo, useFitColumn as Jo, useFilterHistory as Zo, useColumnFilter as Ko, useDragColumn as ei, getColumnHeader as ti, getSidebar as ni, getDisableMask as oi, getHorizontalScrollbar as ii, getVerticalScrollbar as ri, getEmpty as ai, getPagination as li, getSummary as si, ColumnSettingSolution as ui, COMMAND_COLUMN_DATA_TYPE as Wt, SETTING_COLUMN_DATA_TYPE as Yt } from "../data-view/index.esm.js"; import ci from "../input-group/index.esm.js"; import di from "../button/index.esm.js"; import { loadRegister as fi, useComponentManager as mi, useBindingData as pi, useEntityState as vi, useDynamicViewUtils as gi, componentMap as Xt, resolverMap as hi, componentPropsConverter as yi } from "../dynamic-view/index.esm.js"; import bi from "../section/index.esm.js"; import Ci from "../accordion/index.esm.js"; import wi from "../avatar/index.esm.js"; import Fi from "../../designer/button-edit/index.esm.js"; import Ti from "../button-group/index.esm.js"; import Si from "../calendar/index.esm.js"; import xi from "../../designer/capsule/index.esm.js"; import pn from "../../designer/checkbox/index.esm.js"; import vn from "../../designer/checkbox-group/index.esm.js"; import Ei from "../combo-list/index.esm.js"; import Ii from "../combo-tree/index.esm.js"; import ki from "../component/index.esm.js"; import Mi from "../color-picker/index.esm.js"; import Bi from "../content-container/index.esm.js"; import Vi from "../../designer/date-picker/index.esm.js"; import Ri from "../../designer/data-grid/index.esm.js"; import Oi from "../dropdown/index.esm.js"; import Pi from "../../designer/dynamic-form/index.esm.js"; import Ni from "../events-editor/index.esm.js"; import Di from "../filter-bar/index.esm.js"; import ji from "../field-selector/index.esm.js"; import Li from "../binding-selector/index.esm.js"; import $i from "../image-cropper/index.esm.js"; import Ai from "../../designer/input-group/index.esm.js"; import Ui from "../layout/index.esm.js"; import zi from "../list-nav/index.esm.js"; import Hi from "../../designer/list-view/index.esm.js"; import _i from "../lookup/index.esm.js"; import Gi from "../mapping-editor/index.esm.js"; import qi from "../nav/index.esm.js"; import Wi from "../number-range/index.esm.js"; import Yi from "../../designer/number-spinner/index.esm.js"; import Xi from "../order/index.esm.js"; import Qi from "../page-header/index.esm.js"; import Ji from "../page-footer/index.esm.js"; import Zi from "../pagination/index.esm.js"; import Ki from "../progress/index.esm.js"; import er from "../query-solution/index.esm.js"; import tr from "../../designer/radio-group/index.esm.js"; import nr from "../../designer/rate/index.esm.js"; import or from "../../designer/response-toolbar/index.esm.js"; import ir from "../response-layout/index.esm.js"; import rr from "../../designer/response-layout-editor/index.esm.js"; import ar from "../search-box/index.esm.js"; import lr from "../../designer/section/index.esm.js"; import sr from "../smoke-detector/index.esm.js"; import ur from "../splitter/index.esm.js"; import cr from "../step/index.esm.js"; import dr from "../../designer/switch/index.esm.js"; import fr from "../../designer/tabs/index.esm.js"; import mr from "../../designer/tags/index.esm.js"; import pr from "../text/index.esm.js"; import vr from "../../designer/time-picker/index.esm.js"; import gr from "../transfer/index.esm.js"; import hr from "../tree-view/index.esm.js"; import yr from "../uploader/index.esm.js"; import br from "../verify-detail/index.esm.js"; import Cr from "../video/index.esm.js"; import wr from "../../designer/textarea/index.esm.js"; import Fr from "../schema-selector/index.esm.js"; import Tr from "../../designer/tree-grid/index.esm.js"; import Sr from "../event-parameter/index.esm.js"; import xr from "../filter-condition-editor/index.esm.js"; import Er from "../fieldset/index.esm.js"; import Ir from "../sort-condition-editor/index.esm.js"; import kr from "../menu-lookup/index.esm.js"; import Mr from "../../designer/drawer/index.esm.js"; import Br from "../json-editor/index.esm.js"; import Vr from "../property-editor/index.esm.js"; import Rr from "../expression-editor/index.esm.js"; import Or from "../code-editor/index.esm.js"; import Pr from "../html-template/index.esm.js"; import Nr from "../collection-property-editor/index.esm.js"; import Dr from "../../designer/modal/index.esm.js"; import jr from "../external-container/index.esm.js"; import Lr from "../language-textbox/index.esm.js"; import $r from "../image/index.esm.js"; import Ar from "../comment/index.esm.js"; import { FormBindingType as Ur } from "../property-panel/index.esm.js"; import { FNotifyService as zr } from "../notify/index.esm.js"; import Hr from "../tree-grid/index.esm.js"; import "bignumber.js"; const Mn = /* @__PURE__ */ new Map([ ["appearance", nn] ]), _r = "https://json-schema.org/draft/2020-12/schema", Gr = "https://farris-design.gitee.io/component.schema.json", qr = "component", Wr = "A Farris Visual Component", Yr = "object", Xr = { id: { description: "The unique identifier for a component", type: "string" }, type: { description: "The type string of component", type: "string", default: "component" }, componentType: { description: "The type string of component", type: "string" }, viewModel: { description: "The viewModel string of component", type: "string" }, appearance: { description: "", type: "object", properties: { class: { type: "string" }, style: { type: "string" } }, default: {} }, contents: { description: "", type: "array", default: [] }, visible: { description: "", type: "boolean", default: !0 }, onInit: { description: "初始化事件", type: "string", default: "" }, onAfterViewInit: { description: "视图初始化后事件", type: "string", default: "" } }, Qr = [ "id", "type", "contents" ], Jr = { onInit: "初始化事件", onAfterViewInit: "视图初始化后事件" }, Zr = { $schema: _r, $id: Gr, title: qr, description: Wr, type: Yr, properties: Xr, required: Qr, events: Jr }; function Bn(e, t, n) { return t; } const Vt = { id: { type: String, default: "" }, customClass: { type: String, default: "" }, customStyle: { type: String, default: "" }, componentType: { type: String, default: "" }, formColumns: { type: Number, default: 4 }, code: { type: String, default: "" } }, gn = mt(Vt, Zr, Mn, Bn), Wu = Object.assign({}, Vt, { componentId: { type: String, default: "" } }), Qt = /* @__PURE__ */ je({ name: "FComponent", props: Vt, emits: ["init", "afterViewInit"], setup(e, t) { const n = F(); return kt(() => { t.emit("init", e.id); }), Ze(() => { n.value && e.code && n.value.setAttribute("scope-" + e.code.toLowerCase(), ""), t.emit("afterViewInit", e.id); }), () => b("div", { ref: n, class: e.id + " " + e.customClass, style: e.customStyle, id: e.id }, [t.slots.default && t.slots.default()]); } }); function Kr(e) { const { formSchemaUtils: t, formStateMachineUtils: n } = e; function o(l, s = "") { return { path: s + l.code, field: l.id, fullPath: l.code }; } function i(l, s = "") { const p = t.getViewModelById(l); return p ? p.states.map((d) => o(d, s)) : []; } function a(l) { const s = t.getRootViewModelId(), p = i(l); if (l === s) return p; const d = i(s, "root-component."); return [...p, ...d]; } function r(l) { return l.binding && l.binding.path || l.id || ""; } function u() { return n && n.getRenderStates() || []; } return { getVariables: a, getControlName: r, getStateMachines: u }; } class ea { constructor(t) { le(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'" } ]); le(this, "expressionNames", { compute: "计算表达式", dependency: "依赖表达式", validate: "验证表达式", dataPicking: "帮助前表达式", visible: "可见表达式", readonly: "只读表达式", required: "必填表达式" }); le(this, "getExpressionConverter", (t, n) => ({ convertFrom: (o, i, a, r) => { const u = a.getExpressionRuleValue(t, n || i); return u && u.value || ""; }, convertTo: (o, i, a, r, u) => { var l; if (i === "dataPicking" && (a != null && a.target)) { const s = `${a.target}_dataPicking`; ((l = a.rules) == null ? void 0 : l.some( (d) => d.id === s && d.value )) ? o.dictPickingExpressionId = s : delete o.dictPickingExpressionId; } r.updateExpression(a); } })); this.formSchemaService = t; } getExpressionRule(t, n) { const o = this.getExpressionData(); 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.filter((a) => a.category === "remote").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 u; const a = this.createTreeNode(i, n); let r = []; (u = i.type) != null && u.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, s; const a = this.createTreeNode(i, n); a.type = "entity"; const r = this.buildEntityFieldsTreeData((l = i.type) == null ? void 0 : l.fields, [...n, i.label]), u = this.buildChildEntityTreeData((s = i.type) == null ? void 0 : s.entities, [...n, i.label]); u != null && u.length && (r == null || r.push(...u)), 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(), u = { message: ["validate", "required", "dataPicking"].includes(n) && a ? a.message : "", ...r }; return a.messageType != null && (u.messageType = a.messageType), u; } buildRule(t, n, o, i) { const { expression: a, message: r, messageType: u } = n, l = { id: `${t}_${o}`, type: o, value: a }; return (o === "validate" || o === "dataPicking" || o === "required") && (l.message = r), o === "dataPicking" && (l.messageType = u), 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 s = (p) => p.value.trim() === ""; if (l) { const p = l.rules.find((d) => d.id === r.id); if (p) s(r) ? l.rules = l.rules.filter((d) => d.id !== r.id) : (Object.assign(p, r), i === "validate" && t.type === "form-group" && (p.elementId = t.id)); else { if (s(r)) return null; l.rules = l.rules || [], l.rules.push(r); } } else { if (s(r)) return null; l = { target: `${a}`, rules: [r], targetType: n }; } return l; } getExpressionEditorOptions(t, n, o, i) { return o.reduce((a, r) => { var l, s; const u = n === "Field" ? (l = t == null ? void 0 : t.binding) == null ? void 0 : l.field : t.id; return a[r] = { hide: n === "Field" ? !!((s = t == null ? void 0 : t.binding) != null && s.field) : !1, description: "", title: this.expressionNames[r], type: "string", $converter: this.getExpressionConverter(u), 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 d = this.updateExpression(t, n, p, r); if (i) { const m = this.buildRule(u, p, r); i(m); } return d; } } }, 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 ta { constructor(t, n) { le(this, "componentId"); le(this, "viewModelId"); le(this, "eventsEditorUtils"); le(this, "formSchemaUtils"); le(this, "formMetadataConverter"); le(this, "designViewModelUtils"); le(this, "designViewModelField"); le(this, "controlCreatorUtils"); le(this, "designerHostService"); le(this, "designerContext"); le(this, "modalService", null); /** 表单规则 */ le(this, "formRule", null); le(this, "schemaService", null); le(this, "metadataService", null); le(this, "propertyConfig", { type: "object", categories: {} }); le(this, "expressionProperty"); 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, this.modalService = n.modalService, this.expressionProperty = new ea(this.formSchemaUtils); } 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: D[t.type] && D[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, u) { if (r) { switch (r && r.propertyID) { case "class": case "style": { Sn.value++; break; } } o && o(r, t, u); } } }; } /** * * @param propertyData * @param propertyTypes * @param propertyName * @param constInfos * @param variableInfos * @param expressionType 指定表达式类型,存在属性和表达式类型不一致的情况 * @returns */ getPropertyEditorParams(t, n = [], o = "visible", i = {}, a = {}, r = "") { const { getVariables: u, getControlName: l, getStateMachines: s } = Kr(this.designerHostService), p = this.getRealTargetType(t), d = n && n.length > 0 ? n : ["Const", "Variable", "StateMachine", "Expression"], m = { type: "property-editor", propertyTypes: d }; return d.map((g) => { switch (g) { case "Const": Object.assign(m, { constType: "enum", constEnums: [{ id: !0, name: "是" }, { id: !1, name: "否" }] }, i); break; case "Expression": m.expressionConfig = this.getExpressionOptions(t, p, r || o); break; case "StateMachine": m.stateMachines = s(); break; case "Variable": Object.assign(m, { controlName: l(t), newVariablePrefix: "is", newVariableType: "Boolean", variables: u(this.viewModelId), parentComponentId: this.componentId === "root-component" ? "" : "root-component", onBeforeOpenVariables: (f) => { f.value = u(this.viewModelId); } }, a), this.designerContext.designerMode === "PC_RTC" && (m.newVariablePrefix = "ext_" + m.newVariablePrefix); break; } }), m; } 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 u = this; return { ...a, properties: { ...r }, setPropertyRelates(l, s) { if (l) { switch (l.propertyID) { case "disabled": case "readonly": case "visible": u.afterMutilEditorChanged(t, l); break; } i && i(l, s); } } }; } /** * 当多值编辑器变更时 * @param propertyData * @param changeObject */ afterMutilEditorChanged(t, n) { this.addNewVariableToViewModel(n, this.viewModelId), this.updateExpressionValue(n, t), 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 = Qe(o.contents[i]); o.contents.splice(i, 1), o.contents.splice(i, 0, a), xn(); } /** * 属性编辑器,在编辑过程中会新增变量,此处需要将新增的变量追加到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", isRtcVariable: this.designerContext.designerMode === "PC_RTC" ? !0 : void 0 }; delete o.newVariableType, delete o.isNewVariable, this.formSchemaUtils.getVariableByCode(r.code) || this.formSchemaUtils.getViewModelById("root-viewmodel").states.push(r); } getExpressions() { let t = []; return this.formRule ? (this.formRule.expressions = this.formRule.expressions || [], t = this.formRule.expressions || []) : t = this.formSchemaUtils.getExpressions(), t; } /** * 更新表达式到expressions节点 * @param changeObject */ updateExpressionValue(t, n) { const o = t.propertyValue; if (!((o && o.type) === "Expression" && o.expressionInfo)) return; const { expressionId: r, expressionInfo: u } = o, { targetId: l, targetType: s, expressionType: p, value: d, message: m } = u, g = this.getExpressions(); let f = g.find((S) => S.target === l); f || (f = { target: l, rules: [], targetType: s }, g.push(f)); const w = f.rules.find((S) => S.type === p); if (w) w.value = d, w.message = m, (p === "minDate" || p === "maxDate" || p === "defaultTime") && (w.elementId = n.id); else { const S = { id: r, type: p, value: d, message: m, elementId: n.id }; f.rules.push(S); } delete o.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.getExpressions(), u = n.binding ? n.binding.field : n.id, l = r.find((s) => s.target === u); !l || !l.rules || (l.rules = l.rules.filter((s) => s.type !== a)); } getExpressionOptions(t, n, o) { return this.expressionProperty.getExpressionOptions(t, n, o); } getRealTargetType(t) { return ["response-toolbar-item", "tab-toolbar-item", "section-toolbar-item", "drawer-toolbar-item"].indexOf(t.type) > -1 ? "Button" : t.binding && t.binding.field ? "Field" : "Container"; } createBaseEventProperty(t) { const 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; } } class na extends ta { constructor(t, n) { super(t, n); } getPropertyConfig(t) { return this.propertyConfig.categories.basic = this.getBasicPropConfig(t), this.propertyConfig.categories.appearance = this.getAppearancePropConfig(t), this.getBehaviorConfig(t), this.getEventPropConfig(t), this.propertyConfig; } getAppearancePropConfig(t) { const n = this.formSchemaUtils.getViewModelById(this.viewModelId); t.name = n ? n.name : null; const o = this; return this.getAppearanceConfig(t, { name: { title: "组件名称", type: "string", description: "组件名称", defaultValue: t.name } }, (a, r, u) => { switch (a.propertyID) { case "name": o.syncChangesToViewModel({ name: a.propertyValue }), delete r.name; break; } }); } getEventPropConfig(t) { const n = [ { label: "onInit", name: "初始化事件" }, { label: "onAfterViewInit", name: "视图初始化后事件" } ]; this.designerContext && this.designerContext.responsiveForm && t.componentType === "frame" && n.push({ label: "goBack", name: "原生返回事件" }); const o = this, i = o.eventsEditorUtils.formProperties(t, o.viewModelId, n), a = o.createBaseEventProperty(i); this.propertyConfig.categories.eventsEditor = { title: "事件", hideTitle: !0, properties: a, // 这个属性,标记当属性变更得时候触发重新更新属性 refreshPanelAfterChanged: !0, tabId: "commands", tabName: "交互", setPropertyRelates(r, u) { const l = r.propertyValue; delete t[o.viewModelId], l && (l.setPropertyRelates = this.setPropertyRelates, o.eventsEditorUtils.saveRelatedParameters(t, o.viewModelId, l.events, l)); } }; } getBehaviorConfig(t) { const n = this.formSchemaUtils.getViewModelById(this.viewModelId), o = n ? n.enableValidation : null, i = this; this.propertyConfig.categories.behavior = { title: "行为", description: "", properties: { enableValidation: { title: "启用校验", type: "boolean", description: "运行时组件是否启用校验", defaultValue: o } }, setPropertyRelates: (a) => { if (a) switch (a.propertyID) { case "enableValidation": { i.syncChangesToViewModel({ enableValidation: a.propertyValue }), delete t.enableValidation; break; } } } }; } /** * 将变更的属性值同步到ViewModel上 */ syncChangesToViewModel(t) { const n = this.formSchemaUtils.getViewModelById(this.viewModelId); n && Object.assign(n, t); } } const oa = { showCloseButton: { type: Boolean, default: !0 }, position: { type: String, default: "top-center" }, timeout: { type: Number, default: 3e3 }, theme: { type: String, default: "bootstrap" }, left: { type: Number }, right: { type: Number }, top: { type: Number }, bottom: { type: Number }, id: { type: String }, animate: { type: String, default: "fadeIn" }, options: { type: Object }, safeHtml: { type: Boolean, default: !0 } }, ia = { showCloseButton: { type: Boolean, default: !0 }, animate: { type: String, default: "fadeIn" }, options: { type: Object } }, en = /* @__PURE__ */ je({ name: "Toast", props: ia, emits: ["close", "click"], setup: (e, t) => { const n = F(e.animate), o = "fadeOut", i = Z(() => e.options), a = F(!1), r = Z(() => i.value.title && i.value.message), u = Z(() => !i.value.title && i.value.message), l = Z(() => { const x = { animated: a.value, toast: !0, "toast--only-content": !r.value }; return x[e.animate] = !1, x[o] = a.value, x["toasty-type-" + i.value.type] = !0, i.value.theme && (x[i.value.theme] = !0), x; }), s = Z(() => { const I = `f-icon-${i.value && i.value.type ? i.value.type.replace("toasty-type-", "") : "default"}`, C = { "f-icon": !0 }; return C[I] = !0, C; }), p = Z(() => i.value.title || i.value.message), d = Z(() => e.showCloseButton), m = Z(() => !!i.value.buttons || !!t.slots.default), g = Z(() => We.getLocale() === "en" ? { wordBreak: "keep-all", overflowWrap: "break-word" } : {}); function f(x) { x.stopPropagation(), x.preventDefault(), a.value = !1, setTimeout(() => { t.emit("close", i.value); }, 200); } function w(x, V) { } function S(x) { return `f-preten-link ${x.customClass ? x.customClass : ""}`; } Se(n, () => { n.value; }); const E = () => { var x; return b(Je, null, [b("div", { class: "after-toast-msg text-right" }, [!t.slots.default && ((x = i.value.buttons) == null ? void 0 : x.map((V) => b("span", { class: S(V), onClick: (I) => void 0 }, [V.text]))), t.slots.default && t.slots.default()])]); }; return () => b("div", { class: l.value, style: "min-height:44px" }, [d.value && b("button", { title: We.getLocaleValue("messageBox.close"), class: "toast-close f-btn-icon f-bare", onClick: f }, [b("span", { class: "f-icon modal_close" }, null)]), p.value && b("section", { class: "modal-tips" }, [!r.value && b("div", { class: "float-left modal-tips-iconwrap" }, [b("span", { class: s.value }, null)]), b("div", { class: "modal-tips-content" }, [r.value && b(Je, null, [b("h5", { class: "toast-title modal-tips-title", innerHTML: i.value.title }, null), b("p", { class: "toast-msg", innerHTML: i.value.message, style: g.value }, null), m.value && E()]), u.value && (i.value.buttons ? b("div", { class: "toast-title-btns-wrapper d-flex" }, [b("h5", { class: "toast-title modal-tips-title only-toast-msg", style: g.value, innerHTML: i.value.message }, null), b("div", { class: "after-toast-title text-right ml-auto" }, [E()])]) : b("h5", { class: "toast-title modal-tips-title only-toast-msg", style: g.value, innerHTML: i.value.message }, null))])])]); } }), Ft = /* @__PURE__ */ je({ name: "Notify", props: oa, emits: ["close", "empty"], setup(e, t) { const n = Z(() => ({ "farris-notify": !0 })), o = { left: 12, right: 12, top: 20, bottom: 12 }, i = F(), a = F(e.options), r = F(e.showCloseButton), u = Z(() => e.position || "bottom-right"), l = Z(() => e.timeout != null ? e.timeout : 3e3), s = Z(() => { const m = e.bottom ? e.bottom : o.bottom, g = e.top ? e.top : o.top, f = { transition: "all 0.2s ease", left: u.value.indexOf("left") > -1 ? `${e.left ? e.left : o.left}px` : "", right: u.value.indexOf("right") > -1 ? `${e.right ? e.right : o.right}px` : "", top: u.value.indexOf("top") > -1 ? `${g}px` : "", bottom: u.value.indexOf("bottom") > -1 ? `${m}px` : "" }; return u.value.indexOf("center") > -1 && (f.left = "50%", f.marginLeft = "calc(-24rem / 2)", u.value === "center-center" && (f.top = "50%", f.transform = "translate(-50%, -50%)")), f; }); function p(m) { t.emit("close"); } l.value && setTimeout(() => { p(); }, l.value), t.expose({ closeToast: p, container: i, notifyPosition: u }); function d(m, g) { p(); } return () => b("div", { class: n.value, style: s.value, ref: i }, [b(en, { options: a.value, showCloseButton: r.value, animate: e.animate, onClose: (m) => d(m, a.value) }, null)]); } }); class on { constructor() { le(this, "notifyRefs", []); le(this, "globalConfig", Jt({})); } escapeAllHtml(t) { if (typeof t != "string" || !t) return ""; const n = document.createElement("div"); return n.textContent = t || "", n.innerHTML.replace(/\\n/g, "<br>").replace(/\\t/g, "&nbsp;&nbsp;&nbsp;&nbsp;").replace(/\\r/g, ""); } createNotifyInstance(t) { const n = this, i = Object.assign({ timeout: 3e3, position: "bottom-right", showCloseButton: !0, safeHtml: !0 }, this.globalConfig, { ...t }), a = document.createElement("div"); a.style.display = "contents"; const r = wn({ setup() { var s; const u = F(); function l() { u.value.container.style.transform = "scale(0)", setTimeout(() => { n.updateNotifyPositionForClose(i, u), r.unmount(); }, 220); } if (i.position.indexOf("top") > -1) { const p = n.getNotifyInstances(i.position), d = p[p.length - 1]; if (d) { const m = d.value.container.getBoundingClientRect(); i.top = m.bottom; } } return i.safeHtml && ((s = i.options) != null && s.message) && (i.options.message = n.escapeAllHtml(i.options.message)), Mt(() => { document.body.removeChild(a); }), Ze(() => { n.updateNotifyPositionForCreate(i, u); }), () => b(Fn, { mode: "out-in", name: "fade", appear: !0 }, { default: () => [b(Ft, Bt({ ref: u }, i, { onClose: l }), null)] }); } }); return r.provide("NotifyService", this), document.body.appendChild(a), r.use(We.i18n), r.mount(a), r; } getNotifyInstances(t) { return this.notifyRefs.filter((n) => n.value.notifyPosition === t); } updateNotifyPositionForCreate(t, n) { if (this.notifyRefs && this.notifyRefs.length) { const o = window.innerHeight; t.position.indexOf("bottom") > -1 && this.getNotifyInstances(t.position).forEach((i) => { const a = i.value.container.getBoundingClientRect(); i.value.container.style.bottom = a.height + o - a.bottom + "px"; }); } this.notifyRefs = [...this.notifyRefs, n]; } updateNotifyPositionForClose(t, n) { const o = this.notifyRefs.indexOf(n); if (t.position.indexOf("top") > -1) { const i = this.getNotifyInstances(t.position), a = i.indexOf(n); i.slice(a + 1).forEach((r) => { r.value.container.style.top = r.value.container.offsetTop - r.value.container.offsetHeight + "px"; }); } o > -1 && this.notifyRefs.splice(o, 1); } show(t) { return this.createNotifyInstance(t); } buildNotifyProps(t, n) { let o = "", i = "", a, r, u; typeof n == "string" ? o = n : n && (o = n.message || "", i = n.title || "", r = n.position || null, u = n.showCloseButton != null ? n.showCloseButton : null, a = n.timeout != null ? n.timeout : null); const s = { options: { type: t, message: o, title: i } }; return r != null && (s.position = r), u != null && (s.showCloseButton = u), a != null && (s.timeout = a), s; } info(t) { const n = this.buildNotifyProps("info", t); return this.show(n); } success(t) { const n = this.buildNotifyProps("success", t); return this.show(n); } warning(t) { const n = this.buildNotifyProps("warning", t); return this.show(n); } error(t) { const n = this.buildNotifyProps("error", t); return this.show(n); } close(t) { t && t.unmount(); } closeAll() { this.notifyRefs.forEach((t) => { t == null || t.value.closeToast(); }), this.notifyRefs.length = 0; } } const ra = Symbol("NOTIFY_SERVICE_TOKEN"); Ft.install = (e) => { e.component(Ft.name, Ft), e.component(en.name, en); const t = new on(); e.provide(ra, t), e.provide("FNotifyService", t); }; const aa = { designerHostService: { type: Object, default: {} }, /** 预设的控件类型 */ componentType: { type: String, default: "" }, /** 预设绑定的实体id */ bindingEntityId: { type: String, default: "" }, /** 绑定步骤 */ steps: { type: Array, default: ["selectEntity", "selectFields"] }, /** 目标区域的控件实例 */ targetComponentInstance: { type: Object, default: {} } }; `${We.getLocaleValue("datagrid.loadingMessage")}`; const la = { /** 自定义样式 */ customClass: { type: String, default: "" }, /** 排序配置 */ sort: { type: Object }, /** 筛选配置 */ filter: { type: Object }, /** 自动勾选子节点 */ autoCheckChildren: { type: Boolean, default: !1 }, /** 列集合 */ columns: { type: Array, default: [] }, /** 列配置 */ columnOption: { type: Object }, /** 命令列配置选项 */ commandOption: { type: Object, default: { enable: !1, commands: [] } }, /** 被绑定数据 */ data: { type: Array, default: [] }, /** 禁用组件 */ disabled: { type: Boolean, default: !1 }, /** 用于控制节点禁用状态的字段 */ disabledField: { type: String, default: "disabled" }, /** 用于显示信息的字段 */ displayField: { type: String, default: "name" }, /** 允许编辑 */ editable: { type: Boolean, default: !1 }, /** 编辑配置 */ editOption: { type: Object, default: { selectOnEditing: !1, editMode: "cell" } }, /** 适配父组件尺寸 */ fit: { type: Boolean, default: !1 }, /** 列标题配置 */ header: { type: Object }, /** 高度 */ height: { type: Number, default: -1 }, /** 层级关系配置对象 */ hierarchy: { type: Object, default: { cascadeOption: { autoCancelParent: !0, autoCheckChildren: !1, autoCheckParent: !1, selectionRange: "All" }, parentIdField: "parent" } }, /** DataGrid组件唯一标识 */ id: { type: String, default: "" }, /** 被绑定数据的标识字段 */ idField: { type: String, default: "id", require: !0 }, /** async loading data */ loadData: { type: Function }, // 是否展示 loading loading: { type: Boolean, default: !1 }, /** 最小高度 */ minHeight: { type: Number, default: 300 }, /** 最小宽度 */ minWidth: { type: Number, default: 400 }, /** 新建数据 */ newDataItem: { type: Function, default: () => { } }, /** 分页配置 */ pagination: { type: Object, default: { enable: !1, size: -1 } }, /** 行号配置 */ rowNumber: { type: Object, default: { enable: !0, width: 36, heading: "序号" } }, /** 行配置 */ rowOption: { type: Object, default: { wrapContent: !1 } }, /** 选择配置 */ selection: { type: Object, default: { enableSelectRow: !0, multiSelect: !1, multiSelectMode: "DependOnCheck", showCheckbox: !1, showSelectAll: !1, showSelection: !1 } }, /** 已选数据标识 */ selectionValues: { type: Array, default: [] }, /** 显示边框 */ showBorder: { type: Boolean, default: !1 }, /** 显示列头 */ showHeader: { type: Boolean, default: !0 }, /** 显示横向行分割线 */ showHorizontalLines: { type: Boolean, default: !0 }, /** 显示节点连接线 */ showLines: { type: Boolean, default: !1 }, /** 显示配置按钮 */ showOptions: { type: Boolean, default: !1 }, /** 显示滚动条 */ showScrollBar: { type: String, default: "auto" }, /** 显示设置按钮 */ showSetting: { type: Boolean, default: !1 }, /** 显示条纹 */ showStripe: { type: Boolean, default: !0 }, /** 显示树节点图标 */ showTreeNodeIcons: { type: Boolean, default: !1 }, /** 显示纵向列分割线 */ showVerticallLines: { type: Boolean, default: !1 }, /** 树节点图标数据 */ treeNodeIconsData: { type: [Object, String], default: {} }, /** 宽度 */ width: { type: Number, default: -1 }, /** 启用虚拟渲染 */ virtualized: { type: Boolean, default: !1 }, /** 空数据模板 */ emptyTemplate: { type: Object }, /** 合计配置 */ summary: { type: Object, default: { // 默认合计行开启后,后面不展示值,所以默认不开启 enable: !1, groupFields: ["numericField1", "numericField2"] } }, /** 自动高度 **/ autoHeight: { type: Boolean, default: !1 }, /** 是否可见, 为了适配低代码表单,该属性不应该属于表格组件的行为 */ /** 复选框位置 */ checkboxPosition: { type: String, default: "after-expand" }, enableColumnSettingSolution: { type: Boolean, default: !1 }, /** 搜索配置 */ searchable: { type: Boolean, default: !1 }, customSearch: { type: Function } }; function sa(e, t, n, o, i, a, r, u, l, s, p, d, m, g, f, w, S, E, x) { const { calculateCellPositionInRow: V } = a, { columnContext: I, hasLeftFixedColumn: C, hasRightFixedColumn: k } = r, { gridDataStyle: O, leftFixedGridDataStyle: v, rightFixedGridDataStyle: y } = g, { renderDataRow: c } = Eo(e, t, I, S, u, l, s, p, d, m, g, f, w, E, x), h = [c]; function B(X, L) { const j = V(X); return S.value.filter((K) => K.visible !== !1).map((K, W) => h[K.type](K, j, L, W)); } function A() { return b("div", { ref: o, class: "fv-grid-content-left-fixed" }, [b("div", { class: "fv-grid-data", style: v.value }, [B(I.value.leftColumns.filter((X) => X.visible), "left")])]); } function M() { return b("div", { ref: n, class: "fv-grid-content-primary" }, [b("div", { class: "fv-grid-data", style: O.value }, [B(I.value.primaryColumns.filter((X) => X.visible), "primary")])]); } function $() { return b("div", { ref: i, class: "fv-grid-content-right-fixed" }, [b("div", { class: "fv-grid-data", style: y.value }, [B(I.value.rightColumns.filter((X) => X.visible), "right")])]); } function U() { const X = []; return C.value && X.push(A()), X.push(M()), k.value && X.push($()), X; } return { renderDataArea: U }; } const tn = /* @__PURE__ */ je({ name: "FTreeGrid", props: la, emits: ["selectionChange", "clickRow", "expandNode", "unSelectItem", "dblclickNode", "doubleClickRow", "unSelectItem", "selectItem", "filterChanged", "unSelectAll", "selectAll", "sortChanged", "selectionUpdate", "endEditCell"], setup(e, t) { var sn, un; const n = F(!1), o = F(!1), i = 0, a = F(((sn = e.rowOption) == null ? void 0 : sn.height) || 28); let r = [], u = []; const l = F(20), s = F(e.columns), p = Io(e), { idField: d } = p, m = F(), g = F(), f = F(), w = F(), S = F(), E = F([]), x = F(!1), V = F(((un = e.rowOption) == null ? void 0 : un.wrapContent) || !1), I = ko(e, p), C = Mo(e, t), k = Bo(e), { collapseField: O } = k, { showLoading: v, renderLoading: y } = Vo(e, m), c = Ro(e, /* @__PURE__ */ new Map(), C, k, p), { dataView: h } = c, B = Oo(e, c, p, E, t), { showSelection: A, selectedValues: M } = B, $ = Po(e, E, c, p, B, t), U = Z(() => e.disabled), X = Z(() => e.virtualized ? Math.min(c.dataView.value.length, l.value) : c.dataView.value.length), L = No(e, c), { shouldRenderPagination: j } = L, { containerStyleObject: K } = Do(e, E), W = F(""), ne = F([]), he = Z(() => e.searchable || !1), me = F(0), ie = jo(e), { applyCommands: Fe } = ie; Fe(s); const { applyColumnSetting: Oe, removeColumnSetting: be } = Lo(e); e.showSetting && Oe(s); const J = $o(e, t), T = Ao(e), { applyColumnSorter: te, columnContext: ee, updateColumnRenderContext: re } = J; te(c, T); const ue = Uo(e, ee), xe = zo(e, t, B, p), Ie = Ho(e, t, p, xe, E), Ve = _o(e, c, a), we = Go(e, Ie, Ve), ke = qo(e, c, Ie, k, p, Ve, we, a), Me = Wo(e, s, c, X, i, ke), { getVisualData: Re } = Me, Pe = Yo(e, ee, a, n), tt = Xo(e, B), { sidebarWidth: nt } = tt, Ee = Qo(e, c, E, ee, Me, X, i, nt, a, n), { onWheel: ot, dataGridWidth: it, viewPortHeight: rt, viewPortWidth: Ye, resetScroll: P, updateVisibleRowsOnLatestVisibleScope: ae } = Ee, Ce = Jo(e, ee, g, Ye, ue), { calculateColumnsSize: ye } = Ce, Le = Zo(), Ot = Ko(g, S, c, Le, Ee), Pt = ei(e, t, J, c, ue, I, Ee), Nt = Z(() => { const N = { "fv-grid": !0, "fv-grid-bordered": e.showBorder, "fv-grid-horizontal-bordered": e.showHorizontalLines, "fv-datagrid-strip": e.showStripe }; return ft(N, e.customClass); }), Dt = Z(() => ({ "fv-grid-content": !0, "fv-grid-content-hover": x.value, "fv-grid-wrap-content": V.value })), { renderDataArea: jt } = sa(e, t, f, w, S, Pe, J, c, Ie, k, xe, B, $, Ee, Me, Ve, E, a, n), { renderGridHeader: Lt, renderGridColumnResizeOverlay: bt, shouldShowHeader: $t } = ti(e, t, g, w, S, J, c, Pt, Ot, C, Le, Ce, ue, B, tt, T, Ee, Ye, E, o), { renderDataGridSidebar: At } = ni(e, xe, B, tt, Ee), { renderDisableMask: Ut } = oi(), { renderHorizontalScrollbar: zt } = ii(e, g, Ee), { renderVerticalScrollbar: Ht } = ri(e, g, Ee); function Ct() { var N, Q, fe; if (g.value && g.value.clientHeight > 0 && ((N = g.value) == null ? void 0 : N.clientWidth) > 0) { const ce = Math.ceil(g.value.clientHeight / a.value); ce > l.value && (l.value = ce, ae()), rt.value = ((Q = f.value) == null ? void 0 : Q.clientHeight) || 0, it.value = ((fe = g.value) == null ? void 0 : fe.clientWidth) || 0; } g.value && (g.value.clientHeight > 0 || g.value.clientWidth > 0) && ye(); } Ze(() => { g.value && (l.value = Math.max(Math.ceil(g.value.clientHeight / a.value), l.value), E.value = Re(0, X.value + i - 1), xo(g.value, Ct), ye(), lt(() => { g.value && (it.value = g.value.clientWidth), f.value && (Ye.value = f.value.clientWidth, rt.value = f.value.clientHeight); })), v.value && y(); }), Mt(() => { }), Se(Ye, () => { g.value && ye(); }); function _t(N) { c.collapseTo(N), c.reOrderVisibleIndex(), P(); } function R(N) { c.expandTo(N), c.reOrderVisibleIndex(), P(); } function _() { const N = B.getSelectionRow(); return N ? N.dataIndex - 1 : -1; } function Y(N) { const Q = N !== void 0 ? N : _(), fe = c.insertNewDataItem(Q === -1 ? 0 : Q); return E.value = Re(0, X.value + i - 1), fe; } function oe() { const N = _(); c.insertNewChildDataItem(N), E.value = Re(0, X.value + i - 1); } function de(N, Q) { const fe = E.value.find((ve) => ve.raw[d.value] === Q), ce = fe ? fe.dataIndex - 1 : -1; c.insertNewChildDataItems(N, ce); } function pe() { const N = _(), Q = $.getNextSelectableHierarchyItemId(N); c.removeHierarchyDataItem(N), E.value = Re(0, X.value + i - 1), Q && $.selectItemById(Q); } function Ge(N) { Ie.onEditingRow(N); } function $e(N) { Ie.acceptEditingRow(N); } function ze(N) { Ie.cancelEditingRow(N); } function