@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,435 lines • 273 kB
JavaScript
var Un = Object.defineProperty;
var zn = (t, e, n) => e in t ? Un(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
var X = (t, e, n) => zn(t, typeof e != "symbol" ? e + "" : e, n);
import { ref as S, computed as V, createVNode as C, createTextVNode as Te, defineComponent as Ce, Fragment as Oe, watch as re, onMounted as Ve, reactive as Ue, createApp as Wt, onUnmounted as pt, Transition as an, mergeProps as Bt, nextTick as Ze, inject as St, onBeforeMount as qn, Teleport as ln, shallowRef as Wn, render as Ut, h as _n, cloneVNode as Gn, withDirectives as Xn, vShow as Yn, onUpdated as Qn, onBeforeUnmount as Jn } from "vue";
import { cloneDeep as me, isPlainObject as tn, isUndefined as He, debounce as Zn } from "lodash-es";
import { getSchemaByType as nn, getSchemaByTypeForDesigner as Kn, createPropsResolver as sn, resolveAppearance as eo } from "../dynamic-resolver/index.esm.js";
import { DgControl as xt, useDesignerComponent as to } from "../designer-canvas/index.esm.js";
import { useGuid as Ft, getCustomClass as zt, withInstall as no, FormSchemaEntityField$Type as Tt, FormSchemaEntityFieldTypeName as on, FormSchemaEntityFieldType$Type as oo } from "../common/index.esm.js";
import { useConditionValue as io, FConditionFields as ro } from "../condition/index.esm.js";
import { useCondition as ao } from "../query-solution/index.esm.js";
import { FDrawer as lo } from "../drawer/index.esm.js";
import { FDynamicFormGroup as so } from "../dynamic-form/index.esm.js";
import { useI18n as _t } from "vue-i18n";
import { LocaleService as Et } from "../locale/index.esm.js";
import { useResizeObserver as uo } from "@vueuse/core";
import { getHierarchyRow as co, useIdentify as fo, useGroupData as po, useFilter as mo, useHierarchy as vo, useLoading as go, useDataView as ho, useSelection as yo, useSelectHierarchyItem as bo, usePagination as Co, useDataViewContainerStyle as wo, useCommandColumn as So, useSettingColumn as xo, useColumn as Fo, useSort as To, useGroupColumn as ko, useRow as Mo, useEdit as Bo, useVisualDataBound as Eo, useVisualDataCell as Io, useVisualDataRow as Po, useVisualData as Oo, useCellPosition as Vo, useSidebar as Ro, useVirtualScroll as No, useFitColumn as jo, useFilterHistory as $o, useColumnFilter as Lo, useDragColumn as Ao, getColumnHeader as Ho, getSidebar as Do, getDisableMask as Uo, getHorizontalScrollbar as zo, getVerticalScrollbar as qo, getEmpty as Wo, getPagination as _o, getSummary as Go } from "../data-view/index.esm.js";
import { FPropertyPanel as Xo } from "../property-panel/index.esm.js";
import "../accordion/index.esm.js";
import "../avatar/index.esm.js";
import "../../designer/button-edit/index.esm.js";
import "../button-group/index.esm.js";
import "../calendar/index.esm.js";
import "../capsule/index.esm.js";
import "../../designer/checkbox/index.esm.js";
import "../../designer/checkbox-group/index.esm.js";
import "../combo-list/index.esm.js";
import "../combo-tree/index.esm.js";
import "../component/index.esm.js";
import "../color-picker/index.esm.js";
import "../content-container/index.esm.js";
import { DATE_FORMATS as Yo } from "../date-picker/index.esm.js";
import "../../designer/data-grid/index.esm.js";
import "../dropdown/index.esm.js";
import "../events-editor/index.esm.js";
import "../filter-bar/index.esm.js";
import "../field-selector/index.esm.js";
import "../binding-selector/index.esm.js";
import "../image-cropper/index.esm.js";
import "../../designer/input-group/index.esm.js";
import "../layout/index.esm.js";
import "../list-nav/index.esm.js";
import "../../designer/list-view/index.esm.js";
import { getLookupEditorCommonProperties as Qo, getLookupDialogCommonProperties as Jo, getLookupPaginationProperties as Zo } from "../lookup/index.esm.js";
import "../mapping-editor/index.esm.js";
import "../nav/index.esm.js";
import "../number-range/index.esm.js";
import "../number-spinner/index.esm.js";
import "../order/index.esm.js";
import "../page-header/index.esm.js";
import "../page-footer/index.esm.js";
import "../pagination/index.esm.js";
import "../progress/index.esm.js";
import "../../designer/radio-group/index.esm.js";
import "../rate/index.esm.js";
import "../response-toolbar/index.esm.js";
import "../response-layout/index.esm.js";
import "../response-layout-editor/index.esm.js";
import "../search-box/index.esm.js";
import "../section/index.esm.js";
import "../smoke-detector/index.esm.js";
import "../splitter/index.esm.js";
import "../step/index.esm.js";
import "../switch/index.esm.js";
import "../tabs/index.esm.js";
import Ko from "../tags/index.esm.js";
import "../text/index.esm.js";
import "../time-picker/index.esm.js";
import ei from "../transfer/index.esm.js";
import "../tree-view/index.esm.js";
import "../uploader/index.esm.js";
import "../verify-detail/index.esm.js";
import "../video/index.esm.js";
import "../textarea/index.esm.js";
import "../schema-selector/index.esm.js";
import "../../designer/tree-grid/index.esm.js";
import "../event-parameter/index.esm.js";
import "../filter-condition-editor/index.esm.js";
import "../fieldset/index.esm.js";
import "../sort-condition-editor/index.esm.js";
import "../menu-lookup/index.esm.js";
import "../../designer/drawer/index.esm.js";
import "../json-editor/index.esm.js";
import "../property-editor/index.esm.js";
import "../expression-editor/index.esm.js";
import "../code-editor/index.esm.js";
import "../html-template/index.esm.js";
import "../collection-property-editor/index.esm.js";
import "../modal/index.esm.js";
import "../external-container/index.esm.js";
import "../language-textbox/index.esm.js";
import "../notify/index.esm.js";
import ti from "../popover/index.esm.js";
function un(t, e) {
let n;
function o(c) {
const { properties: p, title: l, ignore: d } = c, v = d && Array.isArray(d), b = Object.keys(p).reduce((T, M) => ((!v || !d.find((N) => N === M)) && (T[M] = p[M].type === "object" && p[M].properties ? o(p[M]) : me(p[M].default)), T), {});
if (l && (!v || !d.find((T) => T === "id"))) {
const T = l.toLowerCase().replace(/-/g, "_");
b.id = `${T}_${Math.random().toString().slice(2, 6)}`;
}
return b;
}
function i(c) {
const { properties: p, title: l, required: d } = c;
if (d && Array.isArray(d)) {
const v = d.reduce((b, T) => (b[T] = p[T].type === "object" && p[T].properties ? o(p[T]) : me(p[T].default), b), {});
if (l && d.find((b) => b === "id")) {
const b = l.toLowerCase().replace(/-/g, "_");
v.id = `${b}_${Math.random().toString().slice(2, 6)}`;
}
return v;
}
return {
type: l
};
}
function r(c, p = {}, l) {
const d = t[c];
if (d) {
let v = i(d);
const b = e[c];
return v = b ? b({ getSchemaByType: r }, v, p, l) : v, n != null && n.appendIdentifyForNewControl && n.appendIdentifyForNewControl(v), v;
}
return null;
}
function a(c, p) {
const l = o(p);
return Object.keys(l).reduce((d, v) => (Object.prototype.hasOwnProperty.call(c, v) && (d[v] && tn(d[v]) && tn(c[v] || !c[v]) ? Object.assign(d[v], c[v] || {}) : d[v] = c[v]), d), l), l;
}
function f(c, p) {
return Object.keys(c).filter((d) => c[d] != null).reduce((d, v) => {
if (p.has(v)) {
const b = p.get(v);
if (typeof b == "string")
d[b] = c[v];
else {
const T = b(v, c[v], c);
Object.assign(d, T);
}
} else
d[v] = c[v];
return d;
}, {});
}
function s(c, p, l = /* @__PURE__ */ new Map()) {
const d = a(c, p);
return f(d, l);
}
function u(c) {
var l;
const p = c.type;
if (p) {
const d = t[p];
if (!d)
return c;
const v = a(c, d), b = ((l = c.editor) == null ? void 0 : l.type) || "";
if (b) {
const T = t[b], M = a(c.editor, T);
v.editor = M;
}
return v;
}
return c;
}
function m(c) {
n = c;
}
return { getSchemaByType: r, resolveSchemaWithDefaultValue: u, resolveSchemaToProps: s, mappingSchemaToProps: f, setDesignerContext: m };
}
const cn = {}, dn = {}, { getSchemaByType: lu, resolveSchemaWithDefaultValue: ni, resolveSchemaToProps: oi, mappingSchemaToProps: ii, setDesignerContext: su } = un(cn, dn);
function ri(t = {}) {
function e(u, m, c, p) {
if (typeof c == "number")
return p[u].length === c;
if (typeof c == "object") {
const l = Object.keys(c)[0], d = c[l];
if (l === "not")
return Number(p[u].length) !== Number(d);
if (l === "moreThan")
return Number(p[u].length) >= Number(d);
if (l === "lessThan")
return Number(p[u].length) <= Number(d);
}
return !1;
}
function n(u, m, c, p) {
return p[u] && p[u].propertyValue && String(p[u].propertyValue.value) === String(c);
}
const o = /* @__PURE__ */ new Map([
["length", e],
["getProperty", n]
]);
Object.keys(t).reduce((u, m) => (u.set(m, t[m]), u), o);
function i(u, m) {
const c = u;
return typeof m == "number" ? [{ target: c, operator: "length", param: null, value: Number(m) }] : typeof m == "boolean" ? [{ target: c, operator: "getProperty", param: u, value: !!m }] : typeof m == "object" ? Object.keys(m).map((p) => {
if (p === "length")
return { target: c, operator: "length", param: null, value: m[p] };
const l = p, d = m[p];
return { target: c, operator: "getProperty", param: l, value: d };
}) : [];
}
function r(u) {
return Object.keys(u).reduce((c, p) => {
const l = i(p, u[p]);
return c.push(...l), c;
}, []);
}
function a(u, m) {
if (o.has(u.operator)) {
const c = o.get(u.operator);
return c && c(u.target, u.param, u.value, m) || !1;
}
return !1;
}
function f(u, m) {
return r(u).reduce((l, d) => l && a(d, m), !0);
}
function s(u, m) {
const c = Object.keys(u), p = c.includes("allOf"), l = c.includes("anyOf"), d = p || l, T = (d ? u[d ? p ? "allOf" : "anyOf" : "allOf"] : [u]).map((N) => f(N, m));
return p ? !T.includes(!1) : T.includes(!0);
}
return { parseValueSchema: s };
}
const ai = {
convertTo: (t, e, n, o) => {
t.appearance || (t.appearance = {}), t.appearance[e] = n;
},
convertFrom: (t, e, n) => t.appearance ? t.appearance[e] : t[e]
}, li = {
convertFrom: (t, e, n) => t.buttons && t.buttons.length ? `共 ${t.buttons.length} 项` : "无"
}, si = {
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]
}, H = {
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: "多语输入框" }
}, ui = {
convertFrom: (t, e, n) => {
var i;
const o = t.editor && t.editor[e] ? t.editor[e] : t[e];
return ((i = H[o]) == null ? void 0 : i.name) || o;
}
}, ci = {
convertTo: (t, e, n, o) => {
t[e] = t[e];
},
convertFrom: (t, e, n) => t.editor ? n.getRealEditorType(t.editor.type) : ""
}, di = {
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";
}
}, fi = {
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 : ""
}, pi = {
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 "";
}
}, mi = {
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 : ""
}, vi = {
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;
}
}
}, gi = {
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;
}
}
}, hi = {
convertTo: (t, e, n, o) => {
t.pagination || (t.pagination = {}), t.pagination[e] = n;
},
convertFrom: (t, e, n) => t.pagination ? t.pagination[e] : t[e]
}, yi = {
convertTo: (t, e, n, o) => {
t.rowNumber || (t.rowNumber = {}), t.rowNumber[e] = n;
},
convertFrom: (t, e, n) => t.rowNumber ? t.rowNumber[e] : t[e]
}, bi = {
convertTo: (t, e, n, o) => {
t.selection || (t.selection = {}), t.selection[e] = n;
},
convertFrom: (t, e, n) => t.selection ? t.selection[e] : t[e]
}, Ci = {
convertFrom: (t, e, n) => t[e] && t[e].length ? `共 ${t[e].length} 项` : ""
}, wi = {
convertFrom: (t, e) => t[e] || "",
convertTo: (t, e, n) => {
t[e] = n;
}
}, Si = {
convertTo: (t, e, n, o) => {
t.size || (t.size = {}), t.size[e] = n;
},
convertFrom: (t, e, n) => t.size ? t.size[e] : t[e]
}, xi = {
convertFrom: (t, e, n) => {
var o, i;
return (o = t.formatter) != null && o.data && e === "formatterEnumData" && !t.formatterEnumData ? (i = t.formatter) == null ? void 0 : i.data : t.formatterEnumData;
}
}, Fi = {
convertTo: (t, e, n, o) => {
t.sort || (t.sort = {}), t.sort[e] = n;
},
convertFrom: (t, e, n) => {
var o, i;
if (e === "mode")
return ((o = t.sort) == null ? void 0 : o.mode) || "client";
if (e === "multiSort")
return !!((i = t.sort) != null && i.multiSort);
}
}, Ti = {
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";
}
}, ki = {
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 fn(t, e, n) {
const o = /* @__PURE__ */ new Map([
["/converter/appearance.converter", ai],
["/converter/buttons.converter", li],
["/converter/property-editor.converter", si],
["/converter/items-count.converter", Ci],
["/converter/type.converter", ui],
["/converter/change-editor.converter", ci],
["/converter/change-formatter.converter", di],
["/converter/column-command.converter", fi],
["/converter/column-option.converter", pi],
["/converter/summary.converter", mi],
["/converter/group.converter", vi],
["/converter/form-group-label.converter", wi],
["/converter/field-selector.converter", gi],
["/converter/pagination.converter", hi],
["/converter/row-number.converter", yi],
["/converter/grid-selection.converter", bi],
["/converter/size.converter", Si],
["/converter/change-formatter-enum.converter", xi],
["/converter/grid-sort.converter", Fi],
["/converter/grid-filter.converter", Ti],
["/converter/row-option.converter", ki]
]), i = /* @__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 }]
]), r = ri();
function a(d, v) {
return () => r.parseValueSchema(d, v);
}
function f(d, v, b) {
return d.includes("visible") && v.visible !== void 0 ? typeof v.visible == "boolean" ? () => !!v.visible : v.visible === void 0 ? !0 : a(v.visible, b) : () => !0;
}
function s(d, v, b) {
return d.includes("readonly") && v.readonly !== void 0 ? typeof v.readonly == "boolean" ? () => !!v.readonly : a(v.readonly, b) : () => !1;
}
function u(d, v) {
const b = d.$converter || v;
return typeof b == "string" && b && o.has(b) ? o.get(b) || null : b || null;
}
function m(d, v, b, T, M, N = "", g = "") {
return Object.keys(d).map((y) => {
const w = S(1), k = y, F = d[y], B = Object.keys(F), x = F.title, E = F.type, O = i.get(E) || { type: "input-group", enableClear: !1 }, P = F.editor ? Object.assign({}, O, F.editor) : Object.assign({}, O), L = f(B, F, v), q = s(B, F, v);
P.readonly = P.readonly === void 0 ? q() : P.readonly;
const Q = F.type === "cascade" ? m(F.properties, v, b, T, M, N, g) : [], $ = !0;
let j = u(F, g);
const G = V({
get() {
if (w.value) {
if (["class", "style"].find((ue) => ue === k) && !j && (j = o.get("/converter/appearance.converter") || null), j && j.convertFrom)
return j.convertFrom(b, y, M, N);
const ie = b[y];
return Object.prototype.hasOwnProperty.call(F, "defaultValue") && (ie === void 0 || typeof ie == "string" && ie === "") ? F.type === "boolean" ? F.defaultValue : F.defaultValue || "" : ie;
}
return null;
},
set(ie) {
w.value += 1, j && j.convertTo ? (j.convertTo(T, y, ie, M, N), j.convertTo(b, y, ie, M, N)) : (T[y] = ie, b[y] = ie);
}
}), { refreshPanelAfterChanged: U, description: te, isExpand: he, parentPropertyID: ye } = F, J = { propertyID: k, propertyName: x, propertyType: E, propertyValue: G, editor: P, visible: L, readonly: q, cascadeConfig: Q, hideCascadeTitle: $, refreshPanelAfterChanged: U, description: te, isExpand: he, parentPropertyID: ye };
return v[k] = J, J;
});
}
function c(d, v, b = {}) {
const T = {}, M = t[d];
return M && M.categories ? Object.keys(M.categories).map((g) => {
const h = M.categories[g], y = h == null ? void 0 : h.title, w = m(h.properties || {}, T, {}, b, v);
return { categoryId: g, categoryName: y, properties: w };
}) : [];
}
function p(d, v, b, T, M = "") {
const N = v.$ref.schema, g = v.$ref.converter, h = b[N], y = h.type, w = n(h), k = {}, F = t[y];
if (F && F.categories) {
const B = F.categories[d], x = B == null ? void 0 : B.title;
g && Object.keys(B.properties).forEach((P) => {
B.properties[P].$converter = g;
});
const E = (B == null ? void 0 : B.properties) || {}, O = m(E, k, w, h, T, M);
return { categoryId: d, categoryName: x, properties: O };
}
return { categoryId: d, categoryName: "", properties: [] };
}
function l(d, v, b, T, M) {
const N = d.type, g = n(d), h = {};
let y = M || t[N];
if (y && Object.keys(y).length === 0 && b && b.getPropConfig && (y = b.getPropConfig(T)), y && y.categories) {
const w = [];
return Object.keys(y.categories).map((k) => {
const F = y.categories[k];
if (F.$ref) {
w.push(p(k, F, d, v, T));
return;
}
const B = F == null ? void 0 : F.title, x = F == null ? void 0 : F.tabId, E = F == null ? void 0 : F.tabName, O = F == null ? void 0 : F.hide, P = F == null ? void 0 : F.hideTitle, L = m(F.properties || {}, h, g, d, v, T, F.$converter), { setPropertyRelates: q } = F, Q = F == null ? void 0 : F.parentPropertyID;
w.push({ categoryId: k, categoryName: B, tabId: x, tabName: E, hide: O, properties: L, hideTitle: P, setPropertyRelates: q, parentPropertyID: Q });
}), w;
}
return [];
}
return {
getPropertyConfigBySchema: l,
getPropertyConfigByType: c,
propertyConverterMap: o
};
}
const pn = {}, mn = {};
fn(pn, mn, ni);
const vn = {}, gn = {}, { getSchemaByType: uu, resolveSchemaWithDefaultValue: Mi, resolveSchemaToProps: cu, mappingSchemaToProps: du, setDesignerContext: fu } = un(vn, gn), hn = {}, yn = {};
fn(hn, yn, Mi);
function et(t, e, n = /* @__PURE__ */ new Map(), o = (a, f, s, u) => f, i = {}, r = (a) => a) {
return cn[e.title] = e, dn[e.title] = o, pn[e.title] = i, mn[e.title] = r, vn[e.title] = e, gn[e.title] = o, hn[e.title] = i, yn[e.title] = r, (a = {}, f = !0) => {
if (!f)
return ii(a, n);
const s = oi(a, e, n), u = Object.keys(t).reduce((m, c) => (m[c] = t[c].default, m), {});
return Object.assign(u, s);
};
}
function mt(t, e) {
return { customClass: e.class, customStyle: e.style };
}
const Bi = /* @__PURE__ */ new Map([
["appearance", mt]
]);
function Ei(t, e) {
const n = e == null ? void 0 : e.formSchemaUtils, o = t.parentComponentInstance, i = "54bddc89-5f7e-4b91-9c45-80dd6606cfe9", r = "70b4abd4-9f2c-4b7c-90e9-6ac6f4b74c72";
function a() {
const m = nn(xt["content-container"].type), c = nn(xt["filter-bar"].type);
if (!m || !c)
return;
const p = Math.random().toString(36).substr(2, 4);
return Object.assign(m, {
id: "filter-container-" + p,
appearance: {
class: "f-filter-container"
},
contents: [c]
}), Object.assign(c, {
id: "filter-" + p,
fields: []
}), { filterBar: c, filterBarContainer: m };
}
function f() {
const m = n.getViewModelById("root-viewmodel");
let c;
if (m && m.commands) {
const v = m.commands.find((b) => b.handlerName === "Filter" && b.cmpId === i);
if (v) {
if (c = v, v.params && v.params.length) {
const b = v.params.find((T) => T.name === "filter");
b && (b.value = "");
}
} else
c = {
id: Ft().guid(),
code: `${m.id.replace(/-/g, "").replace("component", "").replace("viewmodel", "")}Filter1`,
name: "过滤并加载数据1",
params: [
{
name: "filter",
shownName: "过滤条件",
value: "",
defaultValue: null
},
{
name: "sort",
shownName: "排序条件",
value: "",
defaultValue: null
}
],
handlerName: "Filter",
cmpId: i
}, m.commands.push(c);
}
const p = n.getViewModelIdByComponentId(o.belongedComponentId), l = n.getViewModelById(p);
let d;
if (l && l.commands) {
const v = l.commands.find((b) => b.handlerName === "Filter" && b.cmpId === r);
if (v) {
if (d = v, v.params && v.params.length && c) {
const b = v.params.find((M) => M.name === "commandName");
b && (b.value = c.code);
const T = v.params.find((M) => M.name === "frameId");
T && (T.value = "#{root-component}");
}
} else
d = {
id: Ft().guid(),
code: `${l.id.replace(/-/g, "").replace("component", "").replace("viewmodel", "")}Filter1`,
name: "过滤列表数据1",
params: [
{
name: "commandName",
shownName: "过滤回调方法",
value: c.code
},
{
name: "frameId",
shownName: "目标组件",
value: "#{root-component}"
}
],
handlerName: "Filter",
cmpId: r
}, l.commands.push(d);
}
return { filterInGridViewModel: d, filterInRootViewModel: c };
}
function s(m, c) {
const p = n.getCommands();
if (!p)
return;
let l = p.find((v) => v.id === r);
l || (l = {
id: r,
path: "Gsp/Web/webcmp/bo-webcmp/metadata/webcmd",
name: "ListController.webcmd",
refedHandlers: []
}, n.getCommands().push(l)), c && !l.refedHandlers.find((v) => v.host === c.id) && l.refedHandlers.push(
{
host: c.id,
handler: "Filter"
}
);
let d = p.find((v) => v.id === i);
d || (d = {
id: i,
path: "Gsp/Web/WebCmp/bo-webcmp/metadata/webcmd/data-commands",
name: "LoadCommands.webcmd",
refedHandlers: []
}, n.getCommands().push(d)), m && !d.refedHandlers.find((v) => v.host === m.id) && d.refedHandlers.push(
{
host: m.id,
handler: "Filter"
}
);
}
function u() {
const { filterBar: m, filterBarContainer: c } = a(), { filterInRootViewModel: p, filterInGridViewModel: l } = f();
m && l && (m.onQuery = l.code), s(p, l);
const d = e == null ? void 0 : e.useFormCommand;
return d && d.checkCommands(), c;
}
return { createFilterBar: u };
}
function Ii(t, e, n, o) {
if (n.parentComponentInstance && o) {
const a = Ei(n, o).createFilterBar();
if (a)
return a;
}
return e;
}
const Pi = "https://json-schema.org/draft/2020-12/schema", Oi = "https://farris-design.gitee.io/filter-bar.schema.json", Vi = "filter-bar", Ri = "A Farris Component", Ni = "object", ji = {
id: {
description: "The unique identifier for filter-bar",
type: "string"
},
type: {
description: "The type string of filter-bar",
type: "string",
default: "filter-bar"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string"
},
style: {
type: "string"
}
},
default: {}
},
defaultValues: {
description: "",
type: "array"
},
disable: {
type: "string",
default: !1
},
visible: {
description: "",
type: "boolean",
default: !0
},
fields: {
description: "",
type: "array"
}
}, $i = [
"id",
"type"
], Li = {
$schema: Pi,
$id: Oi,
title: Vi,
description: Ri,
type: Ni,
properties: ji,
required: $i
}, Gt = {
/** 被绑定数据 */
data: {
type: Array,
default: []
},
/** 筛选分类 */
fields: { type: Array, default: [] },
/** 是否可选择 */
mode: { type: String, default: "editable" },
/** 是否可见 */
visible: { type: Boolean, default: !0 },
/** 是否禁用 */
disable: { type: Boolean, default: !1 },
/** 清空值文字 */
resetText: { type: String, default: "清空" },
/** 是否显示重置 */
showReset: { type: Boolean, default: !1 }
}, bn = et(Gt, Li, Bi, Ii);
function Cn(t, e) {
const n = S([]), o = S([]), i = S([]), r = S("");
S(!1), S(t.mode);
const a = /* @__PURE__ */ new Map(), { createConditionValue: f } = io(), s = ao(t, e), { getFilterConditions: u } = s;
function m(g) {
return !g.value.isEmpty() && !!g.value.getDisplayText();
}
function c(g) {
const h = {
id: g.id,
fieldCode: g.labelCode,
fieldName: g.name,
required: g.editor.required,
editor: g.editor,
value: f(g.controlType || "text")
};
return g.controlType === "lookup" ? (h.value.valueField = g.editor.valueField, h.value.helpId = g.editor.helpId) : g.controlType === "date-picker" ? (h.value.displayFormat = g.editor.displayFormat || "yyyy-MM-dd", h.value.valueFormat = g.editor.valueFormat || "yyyy-MM-dd") : g.controlType === "datetime-picker" && (h.value.displayFormat = g.editor.displayFormat || "yyyy-MM-dd HH:mm:ss", h.value.valueFormat = g.editor.valueFormat || "yyyy-MM-dd HH:mm:ss"), h;
}
function p(g) {
o.value = t.fields.map((h) => {
const y = me(h);
return y.editor.type || (y.editor.type = h.controlType), y.editor.type === "number-spinner" || y.editor.type === "number-range" ? (y.editor.showZero = !0, y.editor.nullable = !0) : y.editor.type === "combo-list" ? y.editor.enableClear = !0 : y.editor.type === "datetime-picker" && (y.editor.type = "date-picker", y.editor.showTime = !0), y;
}), o.value.reduce((h, y) => h, a);
}
function l(g) {
i.value = o.value.map((h) => c(h));
}
function d(g, h) {
p(t.fields), l(t.data);
}
function v(g) {
i.value = i.value.filter((h) => h.id !== g.id), n.value = n.value.filter((h) => h.fieldCode !== g.fieldCode), o.value = o.value.filter((h) => h.id !== g.id), e.emit("remove", g.fieldCode);
}
function b(g) {
g.value.clear(), n.value = n.value.filter((h) => h.fieldCode !== g.fieldCode), e.emit("clear", g.fieldCode);
}
function T() {
i.value.forEach((g) => g.value.clear());
}
function M() {
i.value.forEach((g) => {
g.value.clear();
}), e.emit("reset");
}
d(t.fields, t.data);
function N() {
var y;
const g = (y = i.value) == null ? void 0 : y.filter((w) => {
var k;
return !((k = w.value) != null && k.isEmpty());
});
return u(g, o.value);
}
return {
clearAll: T,
clearFilterItem: b,
currentFilterId: r,
filterFields: o,
filterItems: i,
loadFilterItems: d,
removeFilterItem: v,
reset: M,
shouldShowClearButtonInFilterItem: m,
handleQuery: N
};
}
function Ai(t, e) {
function n() {
}
return () => C("div", {
class: "f-filter-list-ellipsis",
onClick: (o) => void 0
}, [Te("...")]);
}
function Hi(t, e, n, o, i) {
const {
filterFields: r,
handleQuery: a
} = i, f = S(me(o.value)), s = S("更多筛选");
function u() {
n.value = !1, f.value = me(o.value);
}
function m() {
n.value = !1, o.value.forEach((l) => {
const d = f.value.find((v) => v.id === l.id);
d != null && d.value && (l.value = d.value);
});
const p = a();
e.emit("conditionChange", p);
}
function c() {
return C("div", null, [C(ro, {
fields: r.value,
conditions: f.value
}, null), C("div", null, [C("button", {
class: "btn btn-secondary",
onClick: u
}, [Te("取消")]), C("button", {
class: "btn btn-primary",
onClick: m
}, [Te("确定")])])]);
}
return () => C(lo, {
modelValue: n.value,
"onUpdate:modelValue": (p) => n.value = p,
showClose: !1,
width: 480,
closeByMask: !1,
title: s.value
}, {
content: c
});
}
function wn(t, e, n) {
const o = S([]), i = S("更多"), r = S(t.resetText), a = S(t.showReset), f = S(!1), {
clearAll: s,
reset: u,
filterItems: m,
filterFields: c
} = n;
function p() {
o.value = m.value.filter((M) => M.editor.isExtend);
}
p();
const l = V(() => o.value && o.value.length > 0), d = V(() => a.value);
function v(M) {
f.value = !0;
}
function b(M) {
t.mode === "display-only" ? s() : u();
}
const T = Hi(t, e, f, o, n);
return () => C("div", {
class: "f-filter-toolbars"
}, [l.value && C("button", {
class: "btn btn-link",
onClick: (M) => v()
}, [i.value]), d.value && C("button", {
class: "btn btn-link",
onClick: (M) => b()
}, [r.value]), T()]);
}
const Di = {
filterItem: { type: Object, default: null },
position: { type: Object, default: null }
}, Ui = /* @__PURE__ */ Ce({
name: "FFilterBarItem",
props: Di,
emits: ["cancel", "confirm"],
setup(t, e) {
const n = S(me(t.filterItem)), o = S(t.position), i = {
left: o.value.left,
top: o.value.top
};
function r(u, m, c) {
u.value.editorType === "combo-list" && c.newValue ? u.value.valueList = c.newValue.map((p) => ({
name: p[u.editor.textField || "name"],
value: p[u.editor.valueField || "value"]
})) : u.value.editorType === "radio-group" && (u.value.valueList = [u.editor.data.find((p) => p.value === m)]);
}
function a() {
var c, p, l;
const {
editor: u
} = n.value, m = n.value;
return ((c = m.value) == null ? void 0 : c.editorType) === "lookup" && u ? (u.idValue = (p = m.value.mapFields) == null ? void 0 : p.map((d) => d.id).join(","), u.onClear = () => {
m.value.mapFields = [], r(m, "");
}, u["onUpdate:dataMapping"] = (d) => {
m.value.mapFields = d.items, r(m, m.value.getValue());
}) : ((l = m.value) == null ? void 0 : l.editorType) === "number-range" && u && (u.beginValue = m.value.begin, u.onBeginValueChange = (d) => {
m.value.begin = d, r(m, d);
}, u.endValue = m.value.end, u.onEndValueChange = (d) => {
m.value.end = d, r(m, d);
}), C(so, {
label: "",
editor: u,
required: u == null ? void 0 : u.required,
modelValue: m.value.value,
"onUpdate:modelValue": (d) => m.value.value = d,
onChange: (d, v) => r(m, d, v)
}, null);
}
function f(u) {
e.emit("cancel");
}
function s(u) {
u.stopPropagation(), e.emit("confirm", n.value);
}
return () => C("div", {
class: "f-filter-panel-wrapper can-close",
onClick: f
}, [C("div", {
class: "f-filter-panel",
style: i
}, [C("div", {
class: "f-filter-panel-inner",
onClick: (u) => u.stopPropagation()
}, [C("div", {
class: "f-filter-panel-arrow",
style: {
left: o.value.arrowLeft,
right: o.value.arrowRight
}
}, null), a(), C("div", {
class: "f-filter-panel-footer ng-star-inserted"
}, [C("div", {
class: "filer-panel-clear"
}, [C("button", {
class: "btn btn-link",
disabled: ""
}, [Te("清空筛选")])]), C("div", {
class: "filter-panel-btns"
}, [C("button", {
class: "btn btn-secondary can-close",
onClick: f
}, [Te("取消")]), C("button", {
class: "filter-panel-submit btn btn-primary",
onClick: s
}, [Te("确定")])])])])])]);
}
}), zi = {
filterItem: { type: Object, default: null },
useFilterItemsComposition: { type: Object, default: null },
disabled: { type: Boolean, default: !1 }
}, Sn = /* @__PURE__ */ Ce({
name: "FFilterBarItem",
props: zi,
emits: ["confirm"],
setup(t, e) {
const n = S(t.filterItem), {
clearFilterItem: o,
currentFilterId: i,
removeFilterItem: r,
shouldShowClearButtonInFilterItem: a
} = t.useFilterItemsComposition, f = S(t.disabled), s = S(), u = S(!1), m = function() {
return {
"f-filter-item": !0,
"f-filter-item-actived": !n.value.value.isEmpty(),
// 'f-filter-item-last': index === filterItems.value.length - 1,
"f-filter-item-edit": n.value.id === i.value
};
};
V(() => !f.value && t.mode === "editable");
function c(v) {
t.mode === "display-only" ? r(n.value) : o(n.value);
}
function p(v) {
var M;
const b = (M = v.currentTarget) == null ? void 0 : M.getBoundingClientRect(), T = 380;
b.left > document.body.clientWidth - T - 20 ? s.value = {
left: b.left + b.width - T + "px",
top: b.top + b.height + "px",
arrowLeft: "auto",
arrowRight: "26px"
} : s.value = {
left: b.left + "px",
top: b.top + b.height + "px",
arrowLeft: "26px",
arrowRight: "auto"
}, u.value = !0;
}
function l() {
u.value = !1;
}
function d(v) {
u.value = !1, n.value.value = v.value, e.emit("confirm", v);
}
return () => C("div", {
key: n.value.id,
id: n.value.id,
class: m()
}, [C("div", {
class: "f-filter-item-inner",
onClick: (v) => p(v)
}, [n.value.editor.required && C("span", {
class: "f-filter-item-required text-danger"
}, [Te("*")]), C("span", {
class: "f-filter-item-text"
}, [n.value.fieldName]), n.value.value.getDisplayText() && C(Oe, null, [C("span", {
class: "f-filter-item-tip"
}, [Te(":")]), C("span", {
class: "f-filter-item-content"
}, [n.value.value.getDisplayText()])]), !f.value && C("span", {
class: "f-filter-item-arrow f-icon f-icon-arrow-chevron-down"
}, null)]), a(n.value) && C("span", {
class: "mr-3 f-filter-item-clear",
onClick: (v) => c()
}, [C("span", {
class: "f-icon f-icon-close-circle"
}, null)]), u.value && C(Ui, {
position: s.value,
filterItem: n.value,
onConfirm: d,
onCancel: l
}, null)]);
}
});
function qi(t, e, n) {
const o = S(null);
function i() {
var l, d;
let f = !1;
const s = (l = e.value) == null ? void 0 : l.children;
if (!e.value || !t.value || !s || s.length === 0)
return;
const u = (d = t.value.children[1]) == null ? void 0 : d.clientWidth, m = t.value.clientWidth;
let c = 0, p = 0;
Array.from(s).forEach((v) => {
v.style.display = "block";
});
for (let v = 0; v < s.length; v++) {
const b = s[v], T = b.offsetWidth;
c + T <= m - 30 - u ? (c += T, p++) : (b.style.display = "none", f = !0);
}
return n.value = f, p;
}
function r() {
var s;
if (!t.value || !e.value)
return;
(s = o.value) == null || s.unobserve(t.value);
const f = e.value.children;
Array.from(f).forEach((u) => {
u.style.display = "block";
});
}
function a() {
if (!e.value || !t.value)
return;
const f = new ResizeObserver((s) => {
i();
});
return f.observe(t.value), o.value = f, f;
}
return {
setupWidthObserver: a,
cancelWidthObserver: r
};
}
const it = /* @__PURE__ */ Ce({
name: "FFilterBar",
props: Gt,
emits: ["clear", "remove", "reset", "conditionChange", "change"],
setup(t, e) {
const n = S(!0), o = S(!1), i = S(!1), r = S(!1), a = S(null), f = S(null), s = Cn(t, e), u = qi(f, a, r), {
cancelWidthObserver: m,
setupWidthObserver: c
} = u, {
filterFields: p,
filterItems: l,
loadFilterItems: d,
handleQuery: v
} = s, b = V(() => ({
display: p.value && p.value.length ? "" : "none"
}));
re([() => t.data, () => t.fields], ([F, B]) => {
d(B, F);
}), Ve(() => {
c();
});
const T = V(() => o.value && n.value), M = V(() => ({
"f-filter-list": !0,
"f-filter-list-extend": T.value
// 'f-utils-overflow-hidden': true
})), N = V(() => ({
'"extend-btn-arrow': !0,
"f-icon": !0,
"f-icon-arrow-chevron-up": o.value,
"f-icon-arrow-chevron-down": !o.value
})), g = V(() => l.value.length > 0);
V(() => i.value && !o.value && r.value);
const h = wn(t, e, s);
function y(F) {
e.emit("change", F);
const B = v();
e.emit("conditionChange", B);
}
function w() {
return C("div", {
class: M.value,
ref: a
}, [l.value.map((F, B) => !F.editor.isExtend && C(Sn, {
filterItem: F,
useFilterItemsComposition: s,
onConfirm: y
}, null)), o.value && h()]);
}
function k() {
o.value = !o.value, o.value ? m() : c();
}
return () => C("div", {
class: "f-filter-wrapper",
style: b.value
}, [C("div", {
class: "f-filter-wrapper-inner f-utils-fill"
}, [C("div", {
class: "f-filter-main f-utils-fill",
ref: f
}, [C("div", {
class: "f-filter-list-wrapper d-flex w-100"
}, [g.value && w()]), !o.value && h()]), r.value && C("div", {
class: "f-filter-extend-btn"
}, [C("button", {
class: "btn btn-link",
onClick: k
}, [C("span", {
class: "extend-btn-text"
}, [o.value ? "收折" : "展开"]), C("span", {
class: N.value
}, null)])])])]);
}
}), Wi = S(0);
function _i() {
Wi.value++;
}
const yt = S(0);
function Gi(t) {
const { formSchemaUtils: e, formStateMachineUtils: n } = t;
function o(s, u = "") {
return {
path: u + s.code,
field: s.id,
fullPath: s.code
};
}
function i(s, u = "") {
return e.getViewModelById(s).states.map((c) => o(c, u));
}
function r(s) {
const u = e.getRootViewModelId(), m = i(s);
if (s === u)
return m;
const c = i(u, "root-component.");
return [...m, ...c];
}
function a(s) {
return s.binding && s.binding.path || s.id || "";
}
function f() {
return n && n.getRenderStates() || [];
}
return { getVariables: r, getControlName: a, getStateMachines: f };
}
class xn {
constructor(e) {
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", (e, n) => ({
convertFrom: (o, i, r, a) => {
const f = r.getExpressionRuleValue(e, n || i);
return f && f.value || "";
},
convertTo: (o, i, r, a, f) => {
var s;
if (i === "dataPicking" && (r != null && r.target)) {
const u = `${r.target}_dataPicking`;
((s = r.rules) == null ? void 0 : s.some(
(c) => c.id === u && c.value
)) ? o.dictPickingExpressionId = u : delete o.dictPickingExpressionId;
}
a.updateExpression(r);
}
}));
this.formSchemaService = e;
}
getExpressionRule(e, n) {
const o = this.formSchemaService.getExpressions();
if (!o)
return "";
const i = o.find((a) => a.target === e);
if (!i)
return "";
const r = i.rules.find((a) => a.type === n);
return r || "";
}
// 获取上下文表单变量
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 i = [];
return o.states.forEach((r) => {
i.push({
key: r.code,
name: r.name,
description: r.name,
category: r.category
});
}), i;
}
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((i) => {
var f;
const r = this.createTreeNode(i, n);
let a = [];
(f = i.type) != null && f.fields && (a = this.buildEntityFieldsTreeData(i.type.fields, [...n, i.label])), o.push({
data: r,
children: a,
expanded: !0
});
}), o;
}
buildChildEntityTreeData(e = null, n) {
const o = [];
return e == null || e.forEach((i) => {
var s, u;
const r = this.createTreeNode(i, n);
r.type = "entity";
const a = this.buildEntityFieldsTreeData((s = i.type) == null ? void 0 : s.fields, [...n, i.label]), f = this.buildChildEntityTreeData((u = i.type) == null ? void 0 : u.entities, [...n, i.label]);
f != null && f.length && (a == null || a.push(...f)), o.push({
data: r,
children: a || [],
// 空值回退
expanded: !0
});
}), o;
}
getEntitiesTreeData() {
const e = this.formSchemaService.getSchemaEntities();
if (!(e != null && e.length))
return [];
const n = e[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(e, n, o) {
const i = o === "Field" ? e.binding.field : e.id, r = this.getExpressionRule(i, n), a = this.getEntitiesAndVariables(), f = {
message: ["validate", "required", "dataPicking"].includes(n) && r ? r.message : "",
...a
};
return r.messageType != null && (f.messageType = r.messageType), f;
}
buildRule(e, n, o, i) {
const { expression: r, message: a, messageType: f } = n, s = {
id: `${e}_${o}`,
type: o,
value: r
};
return (o === "validate" || o === "dataPicking" || o === "required") && (s.message = a), o === "dataPicking" && (s.messageType = f), o === "validate" && i && (s.elementId = i), s;
}
getExpressionData() {
const { expressions: e } = this.formSchemaService.getFormSchema().module;
return e || [];
}
updateExpression(e, n, o, i) {
const r = n === "Field" ? e.binding.field : e.id, a = this.buildRule(r, o, i, e.type === "form-group" ? e.id : "");
let s = this.getExpressionD