@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,393 lines • 235 kB
JavaScript
var Qn = Object.defineProperty;
var Kn = (t, e, n) => e in t ? Qn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
var te = (t, e, n) => Kn(t, typeof e != "symbol" ? e + "" : e, n);
import { ref as y, computed as z, defineComponent as Ce, withDirectives as pn, createVNode as g, resolveDirective as mn, inject as De, onMounted as Le, watch as pe, createTextVNode as Be, mergeProps as nt, Fragment as ht, reactive as We, createApp as vn, onUnmounted as xt, Transition as hn, nextTick as Ht, onBeforeMount as eo, Teleport as to, shallowRef as no, render as Ut, h as oo, cloneVNode as ao } from "vue";
import { cloneDeep as St, isPlainObject as tn, isUndefined as qe } from "lodash-es";
import { FormSchemaEntityField$Type as nn, FormSchemaEntityFieldTypeName as on, useGuid as an, areaResponseDirective as ro, useTextBoxDesign as io, useClear as so, getCustomClass as Gt, withInstall as lo } from "../common/index.esm.js";
import { useI18n as Mt } from "vue-i18n";
import { getSchemaByTypeForDesigner as uo, schemaMap as co, resolveAppearance as fo, createPropsResolver as gn, propertyConfigSchemaMapForDesigner as po } from "../dynamic-resolver/index.esm.js";
import { DgControl as st, useDesignerComponent as mo } from "../designer-canvas/index.esm.js";
import { FormBindingType as Ke, InputBaseProperty as vo } from "../property-panel/index.esm.js";
import ho from "../accordion/index.esm.js";
import go from "../avatar/index.esm.js";
import yo from "../../designer/button-edit/index.esm.js";
import bo from "../button-group/index.esm.js";
import Co from "../calendar/index.esm.js";
import wo from "../capsule/index.esm.js";
import rn from "../../designer/checkbox/index.esm.js";
import sn from "../../designer/checkbox-group/index.esm.js";
import vt from "../combo-list/index.esm.js";
import Fo from "../combo-tree/index.esm.js";
import To from "../component/index.esm.js";
import So from "../color-picker/index.esm.js";
import xo from "../content-container/index.esm.js";
import Mo from "../date-picker/index.esm.js";
import Eo from "../../designer/data-grid/index.esm.js";
import Bo from "../dropdown/index.esm.js";
import Io from "../dynamic-form/index.esm.js";
import ko from "../events-editor/index.esm.js";
import Vo from "../filter-bar/index.esm.js";
import Oo from "../field-selector/index.esm.js";
import Po from "../binding-selector/index.esm.js";
import Do from "../image-cropper/index.esm.js";
import No from "../../designer/input-group/index.esm.js";
import Lo from "../layout/index.esm.js";
import Ro from "../list-nav/index.esm.js";
import jo from "../../designer/list-view/index.esm.js";
import $o from "../lookup/index.esm.js";
import Ao from "../mapping-editor/index.esm.js";
import Uo from "../nav/index.esm.js";
import zo from "../number-range/index.esm.js";
import qo from "../number-spinner/index.esm.js";
import Go from "../order/index.esm.js";
import Wo from "../page-header/index.esm.js";
import _o from "../page-footer/index.esm.js";
import Ho from "../pagination/index.esm.js";
import Xo from "../progress/index.esm.js";
import Yo from "../query-solution/index.esm.js";
import Zo from "../../designer/radio-group/index.esm.js";
import Jo from "../rate/index.esm.js";
import Qo from "../response-toolbar/index.esm.js";
import Ko from "../response-layout/index.esm.js";
import ea from "../response-layout-editor/index.esm.js";
import ta from "../search-box/index.esm.js";
import na from "../section/index.esm.js";
import oa from "../smoke-detector/index.esm.js";
import aa from "../splitter/index.esm.js";
import ra from "../step/index.esm.js";
import ia from "../switch/index.esm.js";
import sa from "../tabs/index.esm.js";
import la from "../tags/index.esm.js";
import ua from "../text/index.esm.js";
import ca from "../time-picker/index.esm.js";
import da from "../transfer/index.esm.js";
import fa from "../tree-view/index.esm.js";
import pa from "../uploader/index.esm.js";
import ma from "../verify-detail/index.esm.js";
import va from "../video/index.esm.js";
import ha from "../textarea/index.esm.js";
import ga from "../schema-selector/index.esm.js";
import ya from "../../designer/tree-grid/index.esm.js";
import ba from "../event-parameter/index.esm.js";
import Ca from "../filter-condition-editor/index.esm.js";
import wa from "../fieldset/index.esm.js";
import Fa from "../sort-condition-editor/index.esm.js";
import Ta from "../menu-lookup/index.esm.js";
import Sa from "../../designer/drawer/index.esm.js";
import xa from "../json-editor/index.esm.js";
import Ma from "../property-editor/index.esm.js";
import Ea from "../expression-editor/index.esm.js";
import Ba from "../code-editor/index.esm.js";
import Ia from "../html-template/index.esm.js";
import ka from "../collection-property-editor/index.esm.js";
import Va from "../modal/index.esm.js";
import Oa from "../external-container/index.esm.js";
import Pa from "../language-textbox/index.esm.js";
import { LocaleService as Et } from "../locale/index.esm.js";
import { useResizeObserver as Da } from "@vueuse/core";
import { getHierarchyRow as Na, useIdentify as La, useGroupData as Ra, useFilter as ja, useHierarchy as $a, useLoading as Aa, useDataView as Ua, useSelection as za, useSelectHierarchyItem as qa, usePagination as Ga, useDataViewContainerStyle as Wa, useCommandColumn as _a, useSettingColumn as Ha, useColumn as Xa, useSort as Ya, useGroupColumn as Za, useRow as Ja, useEdit as Qa, useVisualDataBound as Ka, useVisualDataCell as er, useVisualDataRow as tr, useVisualData as nr, useCellPosition as or, useSidebar as ar, useVirtualScroll as rr, useFitColumn as ir, useFilterHistory as sr, useColumnFilter as lr, useDragColumn as ur, getColumnHeader as cr, getSidebar as dr, getDisableMask as fr, getHorizontalScrollbar as pr, getVerticalScrollbar as mr, getEmpty as vr, getPagination as hr, getSummary as gr } from "../data-view/index.esm.js";
import "../notify/index.esm.js";
function yn(t, e) {
let n;
function o(s) {
const { properties: f, title: p, ignore: m } = s, v = m && Array.isArray(m), w = Object.keys(f).reduce((S, F) => ((!v || !m.find((R) => R === F)) && (S[F] = f[F].type === "object" && f[F].properties ? o(f[F]) : St(f[F].default)), S), {});
if (p && (!v || !m.find((S) => S === "id"))) {
const S = p.toLowerCase().replace(/-/g, "_");
w.id = `${S}_${Math.random().toString().slice(2, 6)}`;
}
return w;
}
function a(s) {
const { properties: f, title: p, required: m } = s;
if (m && Array.isArray(m)) {
const v = m.reduce((w, S) => (w[S] = f[S].type === "object" && f[S].properties ? o(f[S]) : St(f[S].default), w), {});
if (p && m.find((w) => w === "id")) {
const w = p.toLowerCase().replace(/-/g, "_");
v.id = `${w}_${Math.random().toString().slice(2, 6)}`;
}
return v;
}
return {
type: p
};
}
function i(s, f = {}, p) {
const m = t[s];
if (m) {
let v = a(m);
const w = e[s];
return v = w ? w({ getSchemaByType: i }, v, f, p) : v, n != null && n.appendIdentifyForNewControl && n.appendIdentifyForNewControl(v), v;
}
return null;
}
function r(s, f) {
const p = o(f);
return Object.keys(p).reduce((m, v) => (Object.prototype.hasOwnProperty.call(s, v) && (m[v] && tn(m[v]) && tn(s[v] || !s[v]) ? Object.assign(m[v], s[v] || {}) : m[v] = s[v]), m), p), p;
}
function c(s, f) {
return Object.keys(s).filter((m) => s[m] != null).reduce((m, v) => {
if (f.has(v)) {
const w = f.get(v);
if (typeof w == "string")
m[w] = s[v];
else {
const S = w(v, s[v], s);
Object.assign(m, S);
}
} else
m[v] = s[v];
return m;
}, {});
}
function l(s, f, p = /* @__PURE__ */ new Map()) {
const m = r(s, f);
return c(m, p);
}
function u(s) {
var p;
const f = s.type;
if (f) {
const m = t[f];
if (!m)
return s;
const v = r(s, m), w = ((p = s.editor) == null ? void 0 : p.type) || "";
if (w) {
const S = t[w], F = r(s.editor, S);
v.editor = F;
}
return v;
}
return s;
}
function d(s) {
n = s;
}
return { getSchemaByType: i, resolveSchemaWithDefaultValue: u, resolveSchemaToProps: l, mappingSchemaToProps: c, setDesignerContext: d };
}
const bn = {}, Cn = {}, { getSchemaByType: zu, resolveSchemaWithDefaultValue: yr, resolveSchemaToProps: br, mappingSchemaToProps: Cr, setDesignerContext: qu } = yn(bn, Cn);
function wr(t = {}) {
function e(u, d, s, f) {
if (typeof s == "number")
return f[u].length === s;
if (typeof s == "object") {
const p = Object.keys(s)[0], m = s[p];
if (p === "not")
return Number(f[u].length) !== Number(m);
if (p === "moreThan")
return Number(f[u].length) >= Number(m);
if (p === "lessThan")
return Number(f[u].length) <= Number(m);
}
return !1;
}
function n(u, d, s, f) {
return f[u] && f[u].propertyValue && String(f[u].propertyValue.value) === String(s);
}
const o = /* @__PURE__ */ new Map([
["length", e],
["getProperty", n]
]);
Object.keys(t).reduce((u, d) => (u.set(d, t[d]), u), o);
function a(u, d) {
const s = u;
return typeof d == "number" ? [{ target: s, operator: "length", param: null, value: Number(d) }] : typeof d == "boolean" ? [{ target: s, operator: "getProperty", param: u, value: !!d }] : typeof d == "object" ? Object.keys(d).map((f) => {
if (f === "length")
return { target: s, operator: "length", param: null, value: d[f] };
const p = f, m = d[f];
return { target: s, operator: "getProperty", param: p, value: m };
}) : [];
}
function i(u) {
return Object.keys(u).reduce((s, f) => {
const p = a(f, u[f]);
return s.push(...p), s;
}, []);
}
function r(u, d) {
if (o.has(u.operator)) {
const s = o.get(u.operator);
return s && s(u.target, u.param, u.value, d) || !1;
}
return !1;
}
function c(u, d) {
return i(u).reduce((p, m) => p && r(m, d), !0);
}
function l(u, d) {
const s = Object.keys(u), f = s.includes("allOf"), p = s.includes("anyOf"), m = f || p, S = (m ? u[m ? f ? "allOf" : "anyOf" : "allOf"] : [u]).map((R) => c(R, d));
return f ? !S.includes(!1) : S.includes(!0);
}
return { parseValueSchema: l };
}
const Fr = {
convertTo: (t, e, n, o) => {
t.appearance || (t.appearance = {}), t.appearance[e] = n;
},
convertFrom: (t, e, n) => t.appearance ? t.appearance[e] : t[e]
}, Tr = {
convertFrom: (t, e, n) => t.buttons && t.buttons.length ? `共 ${t.buttons.length} 项` : "无"
}, Sr = {
convertTo: (t, e, n, o) => {
t.editor && (t.editor[e] = n);
},
convertFrom: (t, e, n) => t.editor && Object.prototype.hasOwnProperty.call(t.editor, e) ? t.editor[e] : t[e]
}, A = {
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: "多语输入框" }
}, xr = {
convertFrom: (t, e, n) => {
var a;
const o = t.editor && t.editor[e] ? t.editor[e] : t[e];
return ((a = A[o]) == null ? void 0 : a.name) || o;
}
}, Mr = {
convertTo: (t, e, n, o) => {
t[e] = t[e];
},
convertFrom: (t, e, n) => t.editor ? n.getRealEditorType(t.editor.type) : ""
}, Er = {
convertTo: (t, e, n, o) => {
(t.type === "data-grid-column" || t.type === "tree-grid-column") && (t.formatter ? t.formatter[e] = n : t.formatter = {
[e]: n
});
},
convertFrom: (t, e, n) => {
if (t.formatter) {
if (e === "trueText")
return t.formatter.trueText;
if (e === "falseText")
return t.formatter.falseText;
if (e === "prefix")
return t.formatter.prefix;
if (e === "suffix")
return t.formatter.suffix;
if (e === "precision")
return t.formatter.precision;
if (e === "decimal")
return t.formatter.decimal;
if (e === "thousand")
return t.formatter.thousand;
if (e === "tempDateFormat")
return t.formatter.dateFormat === "yyyy年MM月dd日" ? "yearMonthDay" : t.formatter.dateFormat === "yyyy-MM-dd HH:mm:ss" ? "yyyy-MM-ddTHH:mm:ss" : t.formatter.dateFormat === "yyyy/MM/dd HH:mm:ss" ? "yyyy/MM/ddTHH:mm:ss" : t.formatter.dateFormat === "yyyy年MM月dd日 HH时mm分ss秒" ? "yearMonthDayHourMinuteSecond" : t.formatter.tempDateFormat || t.formatter.dateFormat || "yyyy-MM-dd";
if (e === "customFormat")
return t.formatter.customFormat;
if (e === "type")
return t.formatter.type || "none";
}
return "none";
}
}, Br = {
convertTo: (t, e, n, o) => {
t.command ? t.command[e] = n : t.command = {
[e]: n
}, e === "enable" && n && (t.command.commands || (t.command.commands = [
{
text: "编辑",
type: "primary",
command: "edit"
},
{
text: "删除",
type: "danger",
command: "remove"
}
]));
},
convertFrom: (t, e, n) => t.command && e === "enable" ? t.command.enable : ""
}, Ir = {
convertTo: (t, e, n, o) => {
t.column ? t.column[e] = n : t.column = {
[e]: n
}, e === "fitColumns" && n && (t.column.fitMode || (t.column.fitMode = "average"));
},
convertFrom: (t, e, n) => {
if (t.column) {
if (e === "fitColumns")
return t.column.fitColumns;
if (e === "fitMode")
return t.column.fitMode;
}
return "";
}
}, kr = {
convertTo: (t, e, n, o) => {
t.summary ? t.summary[e] = n : t.summary = {
[e]: n
}, e === "enable" && n && (t.summary ? t.summary.groupFields || (t.summary.groupFields = []) : t.summary = {
enable: n,
groupFields: []
});
},
convertFrom: (t, e, n) => t.summary && e === "enable" ? t.summary.enable : t.type === "data-grid-column" ? t.enableSummary === void 0 ? !1 : t.enableSummary : ""
}, Vr = {
convertTo: (t, e, n, o) => {
t.group ? t.group[e] = n : t.group = {
[e]: n
}, e === "enable" && n && (t.group ? t.group.groupFields || (t.group.groupFields = []) : t.group = {
enable: n,
groupFields: [],
showSummary: !1
});
},
convertFrom: (t, e, n) => {
if (t.group) {
if (e === "enable")
return t.group.enable;
if (e === "showSummary")
return t.group.showSummary;
}
}
}, Or = {
convertFrom: (t, e) => t.binding ? t.binding.path : "",
convertTo: (t, e, n) => {
if (n && n.length > 0) {
const o = n[0];
t.binding || (t.binding = {}), t.binding.type = "Form", t.binding.path = o.bindingField, t.binding.field = o.id, t.binding.fullPath = o.path, t.path = o.bindingPath;
}
}
}, Pr = {
convertTo: (t, e, n, o) => {
t.pagination || (t.pagination = {}), t.pagination[e] = n;
},
convertFrom: (t, e, n) => t.pagination ? t.pagination[e] : t[e]
}, Dr = {
convertTo: (t, e, n, o) => {
t.rowNumber || (t.rowNumber = {}), t.rowNumber[e] = n;
},
convertFrom: (t, e, n) => t.rowNumber ? t.rowNumber[e] : t[e]
}, Nr = {
convertTo: (t, e, n, o) => {
t.selection || (t.selection = {}), t.selection[e] = n;
},
convertFrom: (t, e, n) => t.selection ? t.selection[e] : t[e]
}, Lr = {
convertFrom: (t, e, n) => t[e] && t[e].length ? `共 ${t[e].length} 项` : ""
}, Rr = {
convertFrom: (t, e) => t[e] || "",
convertTo: (t, e, n) => {
t[e] = n;
}
}, jr = {
convertTo: (t, e, n, o) => {
t.size || (t.size = {}), t.size[e] = n;
},
convertFrom: (t, e, n) => t.size ? t.size[e] : t[e]
}, $r = {
convertFrom: (t, e, n) => {
var o, a;
return (o = t.formatter) != null && o.data && e === "formatterEnumData" && !t.formatterEnumData ? (a = t.formatter) == null ? void 0 : a.data : t.formatterEnumData;
}
}, Ar = {
convertTo: (t, e, n, o) => {
t.sort || (t.sort = {}), t.sort[e] = n;
},
convertFrom: (t, e, n) => {
var o, a;
if (e === "mode")
return ((o = t.sort) == null ? void 0 : o.mode) || "client";
if (e === "multiSort")
return !!((a = t.sort) != null && a.multiSort);
}
}, Ur = {
convertTo: (t, e, n, o) => {
t.filter || (t.filter = {}), t.filter[e] = n;
},
convertFrom: (t, e, n) => {
var o;
if (e === "mode")
return ((o = t.filter) == null ? void 0 : o.mode) || "client";
}
}, zr = {
convertTo: (t, e, n, o) => {
t.rowOption ? t.rowOption[e] = n : t.rowOption = {
[e]: n
};
},
convertFrom: (t, e, n) => {
if (t.rowOption) {
if (e === "customRowStyle")
return t.rowOption.customRowStyle;
if (e === "customCellStyle")
return t.rowOption.customCellStyle;
}
return "";
}
};
function wn(t, e, n) {
const o = /* @__PURE__ */ new Map([
["/converter/appearance.converter", Fr],
["/converter/buttons.converter", Tr],
["/converter/property-editor.converter", Sr],
["/converter/items-count.converter", Lr],
["/converter/type.converter", xr],
["/converter/change-editor.converter", Mr],
["/converter/change-formatter.converter", Er],
["/converter/column-command.converter", Br],
["/converter/column-option.converter", Ir],
["/converter/summary.converter", kr],
["/converter/group.converter", Vr],
["/converter/form-group-label.converter", Rr],
["/converter/field-selector.converter", Or],
["/converter/pagination.converter", Pr],
["/converter/row-number.converter", Dr],
["/converter/grid-selection.converter", Nr],
["/converter/size.converter", jr],
["/converter/change-formatter-enum.converter", $r],
["/converter/grid-sort.converter", Ar],
["/converter/grid-filter.converter", Ur],
["/converter/row-option.converter", zr]
]), a = /* @__PURE__ */ new Map([
["string", { type: "input-group", enableClear: !1 }],
["boolean", {
type: "combo-list",
textField: "name",
valueField: "value",
idField: "value",
enableClear: !1,
editable: !1,
data: [
{
value: !0,
name: "是"
},
{
value: !1,
name: "否"
}
]
}],
["enum", { type: "combo-list", maxHeight: 128, enableClear: !1, editable: !1 }],
["array", { type: "button-edit" }],
["number", { type: "number-spinner", placeholder: "" }],
["events-editor", { type: "events-editor", hide: !0 }]
]), i = wr();
function r(m, v) {
return () => i.parseValueSchema(m, v);
}
function c(m, v, w) {
return m.includes("visible") && v.visible !== void 0 ? typeof v.visible == "boolean" ? () => !!v.visible : v.visible === void 0 ? !0 : r(v.visible, w) : () => !0;
}
function l(m, v, w) {
return m.includes("readonly") && v.readonly !== void 0 ? typeof v.readonly == "boolean" ? () => !!v.readonly : r(v.readonly, w) : () => !1;
}
function u(m, v) {
const w = m.$converter || v;
return typeof w == "string" && w && o.has(w) ? o.get(w) || null : w || null;
}
function d(m, v, w, S, F, R = "", x = "") {
return Object.keys(m).map((b) => {
const B = y(1), k = b, M = m[b], D = Object.keys(M), E = M.title, P = M.type, j = a.get(P) || { type: "input-group", enableClear: !1 }, h = M.editor ? Object.assign({}, j, M.editor) : Object.assign({}, j), T = c(D, M, v), N = l(D, M, v);
h.readonly = h.readonly === void 0 ? N() : h.readonly;
const J = M.type === "cascade" ? d(M.properties, v, w, S, F, R, x) : [], O = !0;
let V = u(M, x);
const U = z({
get() {
if (B.value) {
if (["class", "style"].find((ce) => ce === k) && !V && (V = o.get("/converter/appearance.converter") || null), V && V.convertFrom)
return V.convertFrom(w, b, F, R);
const le = w[b];
return Object.prototype.hasOwnProperty.call(M, "defaultValue") && (le === void 0 || typeof le == "string" && le === "") ? M.type === "boolean" ? M.defaultValue : M.defaultValue || "" : le;
}
return null;
},
set(le) {
B.value += 1, V && V.convertTo ? (V.convertTo(S, b, le, F, R), V.convertTo(w, b, le, F, R)) : (S[b] = le, w[b] = le);
}
}), { refreshPanelAfterChanged: L, description: q, isExpand: oe, parentPropertyID: re } = M, ee = { propertyID: k, propertyName: E, propertyType: P, propertyValue: U, editor: h, visible: T, readonly: N, cascadeConfig: J, hideCascadeTitle: O, refreshPanelAfterChanged: L, description: q, isExpand: oe, parentPropertyID: re };
return v[k] = ee, ee;
});
}
function s(m, v, w = {}) {
const S = {}, F = t[m];
return F && F.categories ? Object.keys(F.categories).map((x) => {
const C = F.categories[x], b = C == null ? void 0 : C.title, B = d(C.properties || {}, S, {}, w, v);
return { categoryId: x, categoryName: b, properties: B };
}) : [];
}
function f(m, v, w, S, F = "") {
const R = v.$ref.schema, x = v.$ref.converter, C = w[R], b = C.type, B = n(C), k = {}, M = t[b];
if (M && M.categories) {
const D = M.categories[m], E = D == null ? void 0 : D.title;
x && Object.keys(D.properties).forEach((h) => {
D.properties[h].$converter = x;
});
const P = (D == null ? void 0 : D.properties) || {}, j = d(P, k, B, C, S, F);
return { categoryId: m, categoryName: E, properties: j };
}
return { categoryId: m, categoryName: "", properties: [] };
}
function p(m, v, w, S, F) {
const R = m.type, x = n(m), C = {};
let b = F || t[R];
if (b && Object.keys(b).length === 0 && w && w.getPropConfig && (b = w.getPropConfig(S)), b && b.categories) {
const B = [];
return Object.keys(b.categories).map((k) => {
const M = b.categories[k];
if (M.$ref) {
B.push(f(k, M, m, v, S));
return;
}
const D = M == null ? void 0 : M.title, E = M == null ? void 0 : M.tabId, P = M == null ? void 0 : M.tabName, j = M == null ? void 0 : M.hide, h = M == null ? void 0 : M.hideTitle, T = d(M.properties || {}, C, x, m, v, S, M.$converter), { setPropertyRelates: N } = M, J = M == null ? void 0 : M.parentPropertyID;
B.push({ categoryId: k, categoryName: D, tabId: E, tabName: P, hide: j, properties: T, hideTitle: h, setPropertyRelates: N, parentPropertyID: J });
}), B;
}
return [];
}
return {
getPropertyConfigBySchema: p,
getPropertyConfigByType: s,
propertyConverterMap: o
};
}
const Fn = {}, Tn = {};
wn(Fn, Tn, yr);
const Sn = {}, xn = {}, { getSchemaByType: Gu, resolveSchemaWithDefaultValue: qr, resolveSchemaToProps: Wu, mappingSchemaToProps: _u, setDesignerContext: Hu } = yn(Sn, xn), Mn = {}, En = {};
wn(Mn, En, qr);
function Bt(t, e, n = /* @__PURE__ */ new Map(), o = (r, c, l, u) => c, a = {}, i = (r) => r) {
return bn[e.title] = e, Cn[e.title] = o, Fn[e.title] = a, Tn[e.title] = i, Sn[e.title] = e, xn[e.title] = o, Mn[e.title] = a, En[e.title] = i, (r = {}, c = !0) => {
if (!c)
return Cr(r, n);
const l = br(r, e, n), u = Object.keys(t).reduce((d, s) => (d[s] = t[s].default, d), {});
return Object.assign(u, l);
};
}
function Bn(t, e) {
return { customClass: e.class, customStyle: e.style };
}
function Gr() {
function t(e) {
return e.editor;
}
return {
resolve: t
};
}
const Xt = /* @__PURE__ */ new Map([
["appearance", Bn]
]), Wr = /* @__PURE__ */ new Map([]), _r = "root-viewmodel";
class Hr {
constructor(e, n) {
te(this, "formSchemaUtils");
te(this, "controlCreatorUtils");
te(this, "designViewModelUtils");
this.resolver = e, this.designerHostService = n, this.formSchemaUtils = this.designerHostService.formSchemaUtils, this.controlCreatorUtils = this.designerHostService.controlCreatorUtils, this.designViewModelUtils = this.designerHostService.designViewModelUtils;
}
createComponent(e) {
const n = this.createComponentRefNode(e), o = this.createComponentNode(e), a = this.createViewModeNode(e), i = this.formSchemaUtils.getFormSchema();
return i.module.viewmodels.push(a), i.module.components.push(o), this.designViewModelUtils.assembleDesignViewModel(), n;
}
createComponentRefNode(e) {
const n = this.resolver.getSchemaByType("component-ref");
return Object.assign(n, {
id: `${e.componentId}-component-ref`,
component: `${e.componentId}-component`
}), n;
}
createComponentNode(e) {
const n = this.resolver.getSchemaByType("component"), o = this.createFormComponentContents(e);
return Object.assign(n, {
id: `${e.componentId}-component`,
viewModel: `${e.componentId}-component-viewmodel`,
componentType: e.componentType,
appearance: {
class: this.getFormComponentClass()
},
formColumns: e.formColumns,
contents: o
}), n;
}
/**
* 获取卡片组件层级的class样式
*/
getFormComponentClass() {
const { templateId: e } = this.formSchemaUtils.getFormSchema().module;
return e === "double-list-in-tab-template" ? "f-struct-wrapper f-utils-fill-flex-column" : "f-struct-wrapper";
}
createFormComponentContents(e) {
const n = this.resolver.getSchemaByType("section");
Object.assign(n, {
id: e.componentId + "-form-section",
appearance: {
class: "f-section-form f-section-in-mainsubcard"
},
mainTitle: e.componentName
});
const o = this.resolver.getSchemaByType("response-form"), a = [];
Object.assign(o, {
id: e.componentId + "-form",
appearance: {
class: "f-form-layout farris-form farris-form-controls-inline"
},
contents: a
}), n.contents = [o];
const { selectedFields: i } = e;
i == null || i.forEach((c) => {
if (c.$type === nn.SimpleField) {
const l = St(c), u = this.resolveControlClassByFormColumns(e), d = this.controlCreatorUtils.setFormFieldProperty(l, "", u);
d && a.push(d);
}
});
const { templateId: r } = this.formSchemaUtils.getFormSchema().module;
return r === "double-list-in-tab-template" && (n.appearance.class = "f-section-grid f-section-in-main px-0 pt-0", n.fill = !0), [n];
}
resolveControlClassByFormColumns(e) {
let n = "";
switch (e.formColumns) {
case 1: {
n = "col-12";
break;
}
case 2: {
n = "col-12 col-md-6 col-xl-6 col-el-6";
break;
}
case 3: {
n = "col-12 col-md-6 col-xl-4 col-el-4";
break;
}
case 4: {
n = "col-12 col-md-6 col-xl-3 col-el-2";
break;
}
}
return n;
}
/**
* 添加viewModel节点
*/
createViewModeNode(e) {
return {
id: `${e.componentId}-component-viewmodel`,
code: `${e.componentId}-component-viewmodel`,
name: e.componentName,
bindTo: e.bindTo,
parent: _r,
fields: this.assembleViewModelFields(e),
commands: [],
states: [],
enableValidation: !0
};
}
/**
* 组装viewModel fields 节点
*/
assembleViewModelFields(e) {
const n = [], { selectedFields: o } = e;
return o == null || o.forEach((a) => {
if (a.$type === nn.SimpleField) {
let i = "blur";
const r = a.type.name;
(r === on.Enum || r === on.Boolean) && (i = "change"), n.push({
type: "Form",
id: a.id,
fieldName: a.bindingField,
groupId: null,
groupName: null,
updateOn: i,
fieldSchema: {}
});
}
}), n;
}
}
function Xr(t, e, n, o) {
var i, r, c, l, u, d;
const a = n.parentComponentInstance;
if (a && o) {
const s = (i = a.schema) == null ? void 0 : i.type, p = {
componentId: `form-${Math.random().toString(36).slice(2, 6)}`,
componentName: ((r = n.bindingSourceContext) == null ? void 0 : r.entityTitle) || ((l = (c = n.bindingSourceContext) == null ? void 0 : c.bindingEntity) == null ? void 0 : l.name) || "标题",
componentType: "form",
formColumns: s === "splitter-pane" ? 1 : 4,
parentContainerId: a.schema.id,
bindTo: ((u = n.bindingSourceContext) == null ? void 0 : u.bindTo) || "/",
selectedFields: (d = n.bindingSourceContext) == null ? void 0 : d.bindingEntityFields
};
return new Hr(t, o).createComponent(p);
} else
return e;
}
function Yr(t, e, n) {
return e;
}
const Zr = "https://json-schema.org/draft/2020-12/schema", Jr = "https://farris-design.gitee.io/response-form.schema.json", Qr = "response-form", Kr = "A Farris Data Collection Component", ei = "object", ti = {
id: {
description: "The unique identifier for a form group",
type: "string"
},
type: {
description: "The type string of form group component",
type: "string",
default: "response-form"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string"
},
style: {
type: "string"
}
},
default: {}
},
contents: {
description: "",
type: "array",
default: []
},
visible: {
description: "",
type: "boolean",
default: !0
},
labelAutoOverflow: {
description: "",
type: "boolean",
default: !1
},
adaptForLanguage: {
description: "",
type: "boolean",
default: !0
}
}, ni = [
"id",
"type",
"contents"
], oi = {
$schema: Zr,
$id: Jr,
title: Qr,
description: Kr,
type: ei,
properties: ti,
required: ni
}, In = {
customClass: { type: String, default: "" },
customStyle: { type: String, defaut: "" },
/** 控制是否可见 */
visible: { type: Boolean, default: !0 },
/** 内部控件布局是否响应国际化 */
adaptForLanguage: { type: Boolean, default: !0 }
}, ln = Bt(In, oi, Xt, Xr), zt = /* @__PURE__ */ Ce({
name: "FResponseForm",
props: In,
emits: [],
setup(t, e) {
const n = y(), {
locale: o
} = Mt(), a = z(() => {
const i = t.customClass.split(" "), r = {
"drag-container": !0
};
return i.reduce((c, l) => (c[l] = !0, c), r), t.adaptForLanguage && o.value && (r["farris-form-controls-inline"] = o.value !== "en"), r;
});
return () => t.visible && pn(g("div", {
ref: n,
class: a.value,
style: t.customStyle
}, [e.slots.default && e.slots.default()]), [[mn("area-response")]]);
}
}), ai = "https://json-schema.org/draft/2020-12/schema", ri = "https://farris-design.gitee.io/form-group.schema.json", ii = "form-group", si = "A Farris Input Component", li = "object", ui = {
id: {
description: "The unique identifier for a form group",
type: "string"
},
type: {
description: "The type string of form group component",
type: "string",
default: "form-group"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string"
},
style: {
type: "string"
}
},
default: {}
},
enableLinkLabel: {
description: "",
type: "boolean",
default: !1
},
editor: {
description: "",
type: "obejct",
default: null
},
label: {
description: "",
type: "string",
default: ""
},
lableWidth: {
description: "",
type: "number"
},
binding: {
description: "",
type: "object",
default: {}
},
visible: {
description: "",
type: "boolean",
default: !0
},
required: {
description: "",
type: "boolean",
default: !1
},
errors: {
description: "",
type: "object",
default: null
},
name: {
description: "The name string of form group component",
type: "string",
default: "form group"
},
showLabelType: {
description: "",
type: "string",
default: "visible"
}
}, ci = [
"id",
"type",
"editor"
], kn = {
$schema: ai,
$id: ri,
title: ii,
description: si,
type: li,
properties: ui,
required: ci
}, yt = {
id: { type: String, default: "" },
customClass: { type: String, default: "" },
customStyle: { type: String, default: "" },
/** 筛选组件配置器,具体配置项可查看各组件文档 */
editor: { type: Object, default: {} },
label: { type: String, default: "" },
/** value is uncertain because type is uncertain, default value should not be set */
modelValue: { type: Object },
// readonly: { type: Boolean, default: false },
visible: { type: Boolean, default: !0 },
required: { type: Boolean, default: !1 },
showLabel: { type: Boolean, default: !0 },
/**
* visible相当于showLabel为true,none相当于showLabel为false
*/
showLabelType: { type: String, default: "visible" },
type: { type: String, default: "input-group" },
componentId: { type: String, default: "" },
errors: { type: Object, default: null }
}, un = Bt(
yt,
kn,
Xt,
void 0
), di = Gr();
function Yt(t, e, n) {
var E;
const o = n && n.getStyles && n.getStyles() || "", a = n && n.getDesignerClass && n.getDesignerClass() || "", i = y();
let r;
function c() {
return (e == null ? void 0 : e.schema.componentType) === "frame" ? !1 : n && n.checkCanMoveComponent ? n.checkCanMoveComponent() : !0;
}
function l() {
return !1;
}
function u() {
return (e == null ? void 0 : e.schema.componentType) === "frame" ? !1 : n && n.checkCanDeleteComponent ? n.checkCanDeleteComponent() : !0;
}
function d() {
return (e == null ? void 0 : e.schema.componentType) === "frame" ? !0 : n && n.hideNestedPaddingInDesginerView ? n.hideNestedPaddingInDesginerView() : !1;
}
function s(P) {
if (!P || !P.value)
return null;
if (P.value.schema && P.value.schema.type === "component")
return P.value;
const j = y(P == null ? void 0 : P.value.parent), h = s(j);
return h || null;
}
function f(P = e) {
var N;
if (n != null && n.getDraggableDesignItemElement)
return n.getDraggableDesignItemElement(P);
const { componentInstance: j, designerItemElementRef: h } = P;
if (!j || !j.value)
return null;
const { getCustomButtons: T } = j.value;
return j.value.canMove || T && ((N = T()) != null && N.length) ? h : f(P.parent);
}
function p(P) {
return !!n && n.canAccepts(P);
}
function m() {
return (e == null ? void 0 : e.schema.label) || (e == null ? void 0 : e.schema.title) || (e == null ? void 0 : e.schema.name);
}
function v() {
}
function w(P, j) {
var h;
!P || !j || (n != null && n.onAcceptMovedChildElement && n.onAcceptMovedChildElement(P, j), (h = e == null ? void 0 : e.setupContext) == null || h.emit("dragEnd"));
}
function S(P, j) {
const { componentType: h } = P;
let T = uo(h, P, j);
n && n.onResolveNewComponentSchema && (T = n.onResolveNewComponentSchema(P, T));
const N = h.toLowerCase().replace(/-/g, "_");
return T && !T.id && T.type === h && (T.id = `${N}_${Math.random().toString().slice(2, 6)}`), T;
}
function F(P) {
P && n != null && n.onChildElementMovedOut && n.onChildElementMovedOut(P);
}
function R(...P) {
if (n && n.getPropsConfig)
return n.getPropsConfig(...P);
}
function x(P) {
if (!P)
return;
const j = e == null ? void 0 : e.schema, { formSchemaUtils: h } = P;
if (j && h.getExpressions().length) {
const T = h.getExpressions().findIndex((N) => N.target === j.id);
T > -1 && h.getExpressions().splice(T, 1);
}
}
function C(P) {
if (!P || !(e != null && e.schema))
return;
const j = e.schema, { formSchemaUtils: h } = P;
h.removeCommunicationInComponent(j);
}
function b(P) {
n && n.onRemoveComponent && n.onRemoveComponent(), x(P), C(P), e != null && e.schema.contents && e.schema.contents.map((j) => {
let h = j.id;
j.type === "component-ref" && (h = j.component);
const T = t.value.querySelectorAll(`#${h}-design-item`);
T != null && T.length && Array.from(T).map((N) => {
var J;
(J = N == null ? void 0 : N.componentInstance) != null && J.value.onRemoveComponent && N.componentInstance.value.onRemoveComponent(P);
});
});
}
function B() {
if (n && n.getCustomButtons)
return n.getCustomButtons();
}
function k(P) {
var h, T;
if (!((h = e == null ? void 0 : e.schema) != null && h.id))
return;
if (!r && P && (r = P.formSchemaUtils), n != null && n.setComponentBasicInfoMap) {
n.setComponentBasicInfoMap();
return;
}
let j = "";
if (n != null && n.getComponentTitle)
j = n.getComponentTitle();
else {
const { text: N, title: J, label: O, mainTitle: V, name: U, type: L } = e.schema;
j = N || J || O || V || U || ((T = A[L]) == null ? void 0 : T.name);
}
j && r.getControlBasicInfoMap().set(e.schema.id, {
componentTitle: j,
parentPathName: j
});
}
function M(P) {
var N;
const { changeObject: j } = P, { propertyID: h, propertyValue: T } = j;
if (["text", "title", "label", "name", "mainTitle"].includes((N = P == null ? void 0 : P.changeObject) == null ? void 0 : N.propertyID) && h && T && (k(), r)) {
const J = r.getControlBasicInfoMap(), O = J.keys().toArray().filter((V) => {
var U, L;
return ((U = J.get(V)) == null ? void 0 : U.reliedComponentId) === ((L = e == null ? void 0 : e.schema) == null ? void 0 : L.id);
});
O != null && O.length && O.forEach((V) => {
const U = J.get(V).parentPathName.split(" > ");
U[0] = T, J.get(V).parentPathName = U.join(" > ");
});
}
}
function D(P) {
if (M(P), n && n.onPropertyChanged)
return n.onPropertyChanged(P);
}
return i.value = {
canMove: c(),
canSelectParent: l(),
canDelete: u(),
canNested: !d(),
contents: e == null ? void 0 : e.schema.contents,
elementRef: t,
parent: (E = e == null ? void 0 : e.parent) == null ? void 0 : E.componentInstance,
schema: e == null ? void 0 : e.schema,
styles: o,
designerClass: a,
canAccepts: p,
getBelongedComponentInstance: s,
getDraggableDesignItemElement: f,
getDraggingDisplayText: m,
getPropConfig: R,
getDragScopeElement: v,
onAcceptMovedChildElement: w,
onChildElementMovedOut: F,
addNewChildComponentSchema: S,
triggerBelongedComponentToMoveWhenMoved: !!n && n.triggerBelongedComponentToMoveWhenMoved || y(!1),
triggerBelongedComponentToDeleteWhenDeleted: !!n && n.triggerBelongedComponentToDeleteWhenDeleted || y(!1),
onRemoveComponent: b,
getCustomButtons: B,
onPropertyChanged: D,
setComponentBasicInfoMap: k,
updateContextSchema: e == null ? void 0 : e.updateContextSchema
}, i;
}
function fi() {
function t(e, n) {
var r;
if (!e)
return !1;
const o = ((r = e.targetContainer) == null ? void 0 : r.componentInstance) && e.targetContainer.componentInstance.value;
if (!o)
return !1;
const a = o.schema.type, i = n == null ? void 0 : n.formSchemaUtils.getComponentById(o.belongedComponentId);
return !((e.componentCategory === "input" || e.componentType === "form-group") && ![A["response-layout-item"].type, A["response-form"].type, A.fieldset.type].includes(a) || (e.componentType === A.tabs.type || e.componentType === A.section.type) && ((i == null ? void 0 : i.componentType) !== "frame" || ![A["content-container"].type, A["splitter-pane"].type, A["response-layout-item"].type].includes(a)) || [A["query-solution"].type, A["filter-bar"].type].includes(e.componentType) || e.componentType === A.fieldset.type && a !== A["response-form"].type);
}
return {
basalDragulaRuleForContainer: t
};
}
class pi {
getTemplateRule(e, n) {
const o = n == null ? void 0 : n.formSchemaUtils, a = o == null ? void 0 : o.getFormTemplateRule(), i = { canAccept: !0, canDelete: !0, canMove: !0 };
if (!a)
return i;
const r = this.getComponentContext(e), { componentClassList: c } = r;
return c.forEach((l) => {
if (!l || !a[l])
return;
const { canMove: u, canDelete: d, canAccept: s } = a[l];
i.canMove = i.canMove && this.resolveRuleValue(u, r), i.canDelete = i.canDelete && this.resolveRuleValue(d, r), i.canAccept = i.canAccept && this.resolveRuleValue(s, r);
}), i;
}
resolveRuleValue(e, n) {
return typeof e == "boolean" ? e : this.parseRuleValueSchema(e, n);
}
parseRuleValueSchema(e, n) {
const o = e.invalidContext || [];
let a = !0;
for (const i of o) {
const { firstLevelChild: r, secondLevelChild: c, parent: l, ...u } = i;
if (u && n.component) {
let d = !0;
for (const s of Object.keys(u))
if (u[s] !== n.component[s]) {
d = !1;
break;
}
if (!d) {
a = !1;
continue;
}
}
if (i.firstLevelChild) {
if (i.firstLevelChild.class) {
const { firstLevelChildClassList: d } = n;
if (d && !d.includes(i.firstLevelChild.class)) {
a = !1;
continue;
}
}
if (i.firstLevelChild.type) {
const { firstLevelChildSchema: d } = n;
if (!d || d.type !== i.firstLevelChild.type) {
a = !1;
continue;
}
}
}
if (i.secondLevelChild) {
if (i.secondLevelChild.class) {
const { secondLevelChildClassList: d } = n;
if (d && !d.includes(i.secondLevelChild.class)) {
a = !1;
continue;
}
}
if (i.secondLevelChild.type) {
const { secondLevelChildSchema: d } = n;
if (!d || d.type !== i.secondLevelChild.type) {
a = !1;
continue;
}
}
}
if (i.parent) {
if (i.parent.class) {
const { parentClassList: d } = n;
if (d && !d.includes(i.parent.class)) {
a = !1;
continue;
}
}
if (i.parent.type) {
const { parentSchema: d } = n;
if (d && d.type !== i.parent.type) {
a = !1;
continue;
}
}
}
a = !0;
break;
}
return !a;
}
getComponentContext(e) {
var v, w, S, F;
const n = e.schema, o = n.appearance && n.appearance.class || "", a = o.split(" ") || [], i = n.contents || [], r = i.length ? i[0] : null, c = r && r.appearance ? r.appearance.class : "", l = c ? c.split(" ") : [], u = (v = r == null ? void 0 : r.contents) != null && v.length ? r == null ? void 0 : r.contents[0] : null, d = u && u.appearance ? u.appearance.class : "", s = d ? d.split(" ") : [], f = n.type === "component" ? (S = (w = e.parent) == null ? void 0 : w.parent) == null ? void 0 : S.schema : (F = e.parent) == null ? void 0 : F.schema, p = f && f.appearance && f.appearance.class || "", m = p ? p.split(" ") : [];
return {
componentClass: o,
componentClassList: a,
childContents: i,
firstLevelChildSchema: r,
firstLevelChildClass: c,
firstLevelChildClassList: l,
secondLevelChildSchema: u,
secondLevelChildClass: d,
secondLevelChildClassList: s,
parentSchema: f,
parentClass: p,
parentClassList: m,
component: n
};
}
}
const mi = y(0);
function Vn() {
mi.value++;
}
const vi = y(0);
function hi(t) {
const { formSchemaUtils: e, formStateMachineUtils: n } = t;
function o(l, u = "") {
return {
path: u + l.code,
field: l.id,
fullPath: l.code
};
}
function a(l, u = "") {
return e.getViewModelById(l).states.map((s) => o(s, u));
}
function i(l) {
const u = e.getRootViewModelId(), d = a(l);
if (l === u)
return d;
const s = a(u, "root-component.");
return [...d, ...s];
}
function r(l) {
return l.binding && l.binding.path || l.id || "";
}
function c() {
return n && n.getRenderStates() || [];
}
return { getVariables: i, getControlName: r, getStateMachines: c };
}
class gi {
constructor(e) {
te(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'"
}
]);
te(this, "expressionNames", {
compute: "计算表达式",
dependency: "依赖表达式",
validate: "验证表达式",
dataPicking: "帮助前表达式",
visible: "可见表达式",
readonly: "只读表达式",
required: "必填表达式"
});
te(this, "getExpressionConverter", (e, n) => ({
convertFrom: (o, a, i, r) => {
const c = i.getExpressionRuleValue(e, n || a);
return c && c.value || "";
},
convertTo: (o, a, i, r, c) => {
var l;
if (a === "dataPicking" && (i != null && i.target)) {
const u = `${i.target}_dataPicking`;
((l = i.rules) == null ? void 0 : l.some(
(s) => s.id === u && s.value
)) ? o.dictPickingExpressionId = u : delete o.dictPickingExpressionId;
}
r.updateExpression(i);
}
}));
this.formSchemaService = e;
}
getExpressionRule(e, n) {
const o = this.formSchemaService.getExpressions();
if (!o)
return "";
const a = o.find((r) => r.target === e);
if (!a)
return "";
const i = a.rules.find((r) => r.type === n);
return i || "";
}
// 获取上下文表单变量
getContextFormVariables() {
const { module: e } = this.formSchemaService.getFormSchema();
if (!e.viewmodels || e.viewmodels.length === 0)
return [];
const n = this.formSchemaService.getRootViewModelId(), o = this.formSchemaService.getViewModelById(n);
if (!o || !o.states || o.states.length === 0)
return [];
const a = [];
return o.states.forEach((i) => {
a.push({
key: i.code,
name: i.name,
description: i.name,
category: i.category
});
}), a;
}
createTreeNode(e, n, o = "label") {
return {
id: e.id,
name: e.name,
bindingPath: e[o],
parents: n,
type: "field"
};
}
buildEntityFieldsTreeData(e = null, n) {
const o = [];
return e == null || e.forEach((a) => {
var c;
const i = this.createTreeNode(a, n);
let r = [];
(c = a.type) != null && c.fields && (r = this.buildEntityFieldsTreeData(a.type.fields, [...n, a.label])), o.push({
data: i,
children: r,
expanded: !0
});
}), o;
}
buildChildEntityTreeData(e = null, n) {
const o = [];
return e == null || e.forEach((a) => {
var l, u;
const i = this.createTreeNode(a, n);
i.type = "entity";
const r = this.buildEntityFieldsTreeData((l = a.type) == null ? void 0 : l.fields, [...n, a.label]), c = this.buildChildEntityTreeData((u = a.type) == null ? void 0 : u.entities, [...n, a.label]);
c != null && c.length && (r == null || r.push(...c)), o.push({
data: i,
children: r || [],
// 空值回退
expanded: !0
});
}), o;
}
getEntitiesTreeData() {
const e = this.formSchemaService.getSchemaEntities();
if (!(e != null && e.length))
return [];
cons