@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,634 lines (1,633 loc) • 143 kB
JavaScript
var Ht = Object.defineProperty;
var Yt = (t, e, n) => e in t ? Ht(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
var H = (t, e, n) => Yt(t, typeof e != "symbol" ? e + "" : e, n);
import { computed as ue, ref as Q, createVNode as $, Teleport as Xt, getCurrentInstance as Qt, reactive as De, withDirectives as ke, resolveDirective as Be, defineComponent as Fe, watch as Ee, onMounted as Ae, onUnmounted as ct, nextTick as Ie, inject as pe, provide as ut, onBeforeUnmount as Zt, withModifiers as Jt, createTextVNode as Kt } from "vue";
import { cloneDeep as we, isPlainObject as rt } from "lodash-es";
import { getCustomClass as se, useGuid as en, withInstall as tn } from "../common/index.esm.js";
import { useI18n as nn } from "vue-i18n";
import { useDesignerInnerComponent as on, useDesignerComponent as rn } from "../designer-canvas/index.esm.js";
import { getSchemaByTypeForDesigner as sn } from "../dynamic-resolver/index.esm.js";
class dt {
constructor(e) {
/** 工具栏项标识 */
H(this, "id", "");
/** 工具栏项自定义样式 */
H(this, "class", "btn-secondary");
/** 图标 */
H(this, "icon", "");
/** 所属分组 */
H(this, "groupId", "");
/** 收藏顺序 */
H(this, "order", -1);
/** 是否作为下拉菜单的顶层按钮 */
H(this, "asDropDownTop", !1);
/** 文本 */
H(this, "text", "");
/** 是否可见原值 */
H(this, "visible", !0);
/** 控制界面是否显示 */
H(this, "shown", !0);
H(this, "responsed", !1);
/** 是否启用提示消息 */
H(this, "tipsEnable", !1);
/** 提示消息内容 */
H(this, "tipsText", "");
/** 记录宽度 */
H(this, "width", 0);
/** 下拉时的样式名 */
H(this, "dropdownClass", "");
H(this, "onClick", () => {
});
H(this, "options");
var o, i;
this.options = e;
const n = [
"id",
"class",
"icon",
"groupId",
"order",
"asDropDownTop",
"text",
"isDP",
"visible",
"responsed",
"width",
"tipsEnable",
"tipsText",
"dropdownClass",
"onClick"
];
Object.keys(e).filter((r) => n.indexOf(r) > -1).forEach((r) => {
r === "visible" ? this[r] = e[r] === void 0 ? !0 : e[r] : this[r] = e[r];
}), this.shown = this.visible, (o = e.appearance) != null && o.class && (this.class = (i = e.appearance) == null ? void 0 : i.class);
}
/** 是否可用 */
get enable() {
return Object.keys(this.options).indexOf("disabled") > -1 ? !this.options.disabled : ue(() => !0);
}
/** 设置宽度 */
setWidth(e) {
this.width = parseInt(e, 10);
}
/** 获取宽度 */
getWidth() {
return this.visible ? this.width : !1;
}
}
class ln extends dt {
constructor(e) {
super(e);
}
}
function ft() {
function t(e) {
const n = [];
return e.reduce((o, i) => (i.children && i.children.length > 0 ? o.push(new Me(i)) : o.push(new ln(i)), o), n), n;
}
return { buildResponseToolbarItems: t };
}
const { buildResponseToolbarItems: an } = ft();
class Me extends dt {
constructor(n) {
super(n);
H(this, "placement", "");
// 下拉位置
/** 是否可见 */
H(this, "visible", !0);
/** 下拉class */
H(this, "dropdownClass", "");
/** 下拉菜单class */
H(this, "menuClass", "");
/** 是否用分开的下拉按钮 */
H(this, "split", !1);
H(this, "children", []);
H(this, "expanded", !1);
H(this, "shown", !0);
const o = ["visible", "icon", "isDP", "class", "dropdownClass", "menuClass", "placement", "split", "expanded"];
Object.keys(n).filter((i) => o.indexOf(i) > -1).forEach((i) => {
i === "visible" ? this[i] = n[i] === void 0 ? !0 : n[i] : this[i] = n[i];
}), this.shown = this.visible, n.children && n.children.length && (this.children = an(n.children));
}
}
class Vo {
constructor(e, n) {
H(this, "id");
H(this, "name");
/** 记录元素的Id */
H(this, "presetId", []);
/** 记录转变为下拉时元素的位置 */
H(this, "responsedIndex", []);
/** 记录宽度 */
H(this, "width");
this.id = e, this.name = n, this.width = 0;
}
// 设置宽度
setWidth(e) {
this.width = parseInt(e + "", 10);
}
// 获取宽度
getWidth() {
return this.width;
}
// 更新presetIndex
setPreset(e) {
Array.isArray(e) ? this.presetId = this.presetId.concat(e) : this.presetId.push(e);
}
// 清除preset
delPreset() {
this.presetId = [];
}
// 删除
removeResponsed(e) {
this.responsedIndex.splice(e, 1);
}
// 更新responsedIndex
setResponsed(e) {
Array.isArray(e) ? this.responsedIndex = this.responsedIndex.concat(e) : this.responsedIndex.push(e);
}
// 是否已经开始处理响应式
isResponsing() {
return this.responsedIndex.length > 0;
}
// 是否已经处理完响应式
isResponsed() {
return this.presetId.length === this.responsedIndex.length;
}
}
function pt(t, e) {
let n;
function o(a) {
const { properties: d, title: p, ignore: u } = a, s = u && Array.isArray(u), T = Object.keys(d).reduce((R, D) => ((!s || !u.find((A) => A === D)) && (R[D] = d[D].type === "object" && d[D].properties ? o(d[D]) : we(d[D].default)), R), {});
if (p && (!s || !u.find((R) => R === "id"))) {
const R = p.toLowerCase().replace(/-/g, "_");
T.id = `${R}_${Math.random().toString().slice(2, 6)}`;
}
return T;
}
function i(a) {
const { properties: d, title: p, required: u } = a;
if (u && Array.isArray(u)) {
const s = u.reduce((T, R) => (T[R] = d[R].type === "object" && d[R].properties ? o(d[R]) : we(d[R].default), T), {});
if (p && u.find((T) => T === "id")) {
const T = p.toLowerCase().replace(/-/g, "_");
s.id = `${T}_${Math.random().toString().slice(2, 6)}`;
}
return s;
}
return {
type: p
};
}
function r(a, d = {}, p) {
const u = t[a];
if (u) {
let s = i(u);
const T = e[a];
return s = T ? T({ getSchemaByType: r }, s, d, p) : s, n != null && n.appendIdentifyForNewControl && n.appendIdentifyForNewControl(s), s;
}
return null;
}
function l(a, d) {
const p = o(d);
return Object.keys(p).reduce((u, s) => (Object.prototype.hasOwnProperty.call(a, s) && (u[s] && rt(u[s]) && rt(a[s] || !a[s]) ? Object.assign(u[s], a[s] || {}) : u[s] = a[s]), u), p), p;
}
function h(a, d) {
return Object.keys(a).filter((u) => a[u] != null).reduce((u, s) => {
if (d.has(s)) {
const T = d.get(s);
if (typeof T == "string")
u[T] = a[s];
else {
const R = T(s, a[s], a);
Object.assign(u, R);
}
} else
u[s] = a[s];
return u;
}, {});
}
function c(a, d, p = /* @__PURE__ */ new Map()) {
const u = l(a, d);
return h(u, p);
}
function g(a) {
var p;
const d = a.type;
if (d) {
const u = t[d];
if (!u)
return a;
const s = l(a, u), T = ((p = a.editor) == null ? void 0 : p.type) || "";
if (T) {
const R = t[T], D = l(a.editor, R);
s.editor = D;
}
return s;
}
return a;
}
function b(a) {
n = a;
}
return { getSchemaByType: r, resolveSchemaWithDefaultValue: g, resolveSchemaToProps: c, mappingSchemaToProps: h, setDesignerContext: b };
}
const gt = {}, mt = {}, { getSchemaByType: ht, resolveSchemaWithDefaultValue: cn, resolveSchemaToProps: un, mappingSchemaToProps: dn, setDesignerContext: _o } = pt(gt, mt);
function fn(t = {}) {
function e(g, b, a, d) {
if (typeof a == "number")
return d[g].length === a;
if (typeof a == "object") {
const p = Object.keys(a)[0], u = a[p];
if (p === "not")
return Number(d[g].length) !== Number(u);
if (p === "moreThan")
return Number(d[g].length) >= Number(u);
if (p === "lessThan")
return Number(d[g].length) <= Number(u);
}
return !1;
}
function n(g, b, a, d) {
return d[g] && d[g].propertyValue && String(d[g].propertyValue.value) === String(a);
}
const o = /* @__PURE__ */ new Map([
["length", e],
["getProperty", n]
]);
Object.keys(t).reduce((g, b) => (g.set(b, t[b]), g), o);
function i(g, b) {
const a = g;
return typeof b == "number" ? [{ target: a, operator: "length", param: null, value: Number(b) }] : typeof b == "boolean" ? [{ target: a, operator: "getProperty", param: g, value: !!b }] : typeof b == "object" ? Object.keys(b).map((d) => {
if (d === "length")
return { target: a, operator: "length", param: null, value: b[d] };
const p = d, u = b[d];
return { target: a, operator: "getProperty", param: p, value: u };
}) : [];
}
function r(g) {
return Object.keys(g).reduce((a, d) => {
const p = i(d, g[d]);
return a.push(...p), a;
}, []);
}
function l(g, b) {
if (o.has(g.operator)) {
const a = o.get(g.operator);
return a && a(g.target, g.param, g.value, b) || !1;
}
return !1;
}
function h(g, b) {
return r(g).reduce((p, u) => p && l(u, b), !0);
}
function c(g, b) {
const a = Object.keys(g), d = a.includes("allOf"), p = a.includes("anyOf"), u = d || p, R = (u ? g[u ? d ? "allOf" : "anyOf" : "allOf"] : [g]).map((A) => h(A, b));
return d ? !R.includes(!1) : R.includes(!0);
}
return { parseValueSchema: c };
}
const pn = {
convertTo: (t, e, n, o) => {
t.appearance || (t.appearance = {}), t.appearance[e] = n;
},
convertFrom: (t, e, n) => t.appearance ? t.appearance[e] : t[e]
}, gn = {
convertFrom: (t, e, n) => t.buttons && t.buttons.length ? `共 ${t.buttons.length} 项` : "无"
}, mn = {
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]
}, Re = {
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: "多语输入框" }
}, hn = {
convertFrom: (t, e, n) => {
var i;
const o = t.editor && t.editor[e] ? t.editor[e] : t[e];
return ((i = Re[o]) == null ? void 0 : i.name) || o;
}
}, vn = {
convertTo: (t, e, n, o) => {
t[e] = t[e];
},
convertFrom: (t, e, n) => t.editor ? n.getRealEditorType(t.editor.type) : ""
}, bn = {
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";
}
}, yn = {
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 : ""
}, Cn = {
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 "";
}
}, wn = {
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 : ""
}, xn = {
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;
}
}
}, Tn = {
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;
}
}
}, Sn = {
convertTo: (t, e, n, o) => {
t.pagination || (t.pagination = {}), t.pagination[e] = n;
},
convertFrom: (t, e, n) => t.pagination ? t.pagination[e] : t[e]
}, En = {
convertTo: (t, e, n, o) => {
t.rowNumber || (t.rowNumber = {}), t.rowNumber[e] = n;
},
convertFrom: (t, e, n) => t.rowNumber ? t.rowNumber[e] : t[e]
}, In = {
convertTo: (t, e, n, o) => {
t.selection || (t.selection = {}), t.selection[e] = n;
},
convertFrom: (t, e, n) => t.selection ? t.selection[e] : t[e]
}, Pn = {
convertFrom: (t, e, n) => t[e] && t[e].length ? `共 ${t[e].length} 项` : ""
}, Mn = {
convertFrom: (t, e) => t[e] || "",
convertTo: (t, e, n) => {
t[e] = n;
}
}, Dn = {
convertTo: (t, e, n, o) => {
t.size || (t.size = {}), t.size[e] = n;
},
convertFrom: (t, e, n) => t.size ? t.size[e] : t[e]
}, kn = {
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;
}
}, Bn = {
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);
}
}, Rn = {
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";
}
}, On = {
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 vt(t, e, n) {
const o = /* @__PURE__ */ new Map([
["/converter/appearance.converter", pn],
["/converter/buttons.converter", gn],
["/converter/property-editor.converter", mn],
["/converter/items-count.converter", Pn],
["/converter/type.converter", hn],
["/converter/change-editor.converter", vn],
["/converter/change-formatter.converter", bn],
["/converter/column-command.converter", yn],
["/converter/column-option.converter", Cn],
["/converter/summary.converter", wn],
["/converter/group.converter", xn],
["/converter/form-group-label.converter", Mn],
["/converter/field-selector.converter", Tn],
["/converter/pagination.converter", Sn],
["/converter/row-number.converter", En],
["/converter/grid-selection.converter", In],
["/converter/size.converter", Dn],
["/converter/change-formatter-enum.converter", kn],
["/converter/grid-sort.converter", Bn],
["/converter/grid-filter.converter", Rn],
["/converter/row-option.converter", On]
]), 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 = fn();
function l(u, s) {
return () => r.parseValueSchema(u, s);
}
function h(u, s, T) {
return u.includes("visible") && s.visible !== void 0 ? typeof s.visible == "boolean" ? () => !!s.visible : s.visible === void 0 ? !0 : l(s.visible, T) : () => !0;
}
function c(u, s, T) {
return u.includes("readonly") && s.readonly !== void 0 ? typeof s.readonly == "boolean" ? () => !!s.readonly : l(s.readonly, T) : () => !1;
}
function g(u, s) {
const T = u.$converter || s;
return typeof T == "string" && T && o.has(T) ? o.get(T) || null : T || null;
}
function b(u, s, T, R, D, A = "", P = "") {
return Object.keys(u).map((F) => {
const S = Q(1), f = F, M = u[F], y = Object.keys(M), v = M.title, E = M.type, m = i.get(E) || { type: "input-group", enableClear: !1 }, C = M.editor ? Object.assign({}, m, M.editor) : Object.assign({}, m), k = h(y, M, s), x = c(y, M, s);
C.readonly = C.readonly === void 0 ? x() : C.readonly;
const B = M.type === "cascade" ? b(M.properties, s, T, R, D, A, P) : [], L = !0;
let q = g(M, P);
const W = ue({
get() {
if (S.value) {
if (["class", "style"].find((O) => O === f) && !q && (q = o.get("/converter/appearance.converter") || null), q && q.convertFrom)
return q.convertFrom(T, F, D, A);
const te = T[F];
return Object.prototype.hasOwnProperty.call(M, "defaultValue") && (te === void 0 || typeof te == "string" && te === "") ? M.type === "boolean" ? M.defaultValue : M.defaultValue || "" : te;
}
return null;
},
set(te) {
S.value += 1, q && q.convertTo ? (q.convertTo(R, F, te, D, A), q.convertTo(T, F, te, D, A)) : (R[F] = te, T[F] = te);
}
}), { refreshPanelAfterChanged: _, description: Z, isExpand: Y, parentPropertyID: J } = M, z = { propertyID: f, propertyName: v, propertyType: E, propertyValue: W, editor: C, visible: k, readonly: x, cascadeConfig: B, hideCascadeTitle: L, refreshPanelAfterChanged: _, description: Z, isExpand: Y, parentPropertyID: J };
return s[f] = z, z;
});
}
function a(u, s, T = {}) {
const R = {}, D = t[u];
return D && D.categories ? Object.keys(D.categories).map((P) => {
const I = D.categories[P], F = I == null ? void 0 : I.title, S = b(I.properties || {}, R, {}, T, s);
return { categoryId: P, categoryName: F, properties: S };
}) : [];
}
function d(u, s, T, R, D = "") {
const A = s.$ref.schema, P = s.$ref.converter, I = T[A], F = I.type, S = n(I), f = {}, M = t[F];
if (M && M.categories) {
const y = M.categories[u], v = y == null ? void 0 : y.title;
P && Object.keys(y.properties).forEach((C) => {
y.properties[C].$converter = P;
});
const E = (y == null ? void 0 : y.properties) || {}, m = b(E, f, S, I, R, D);
return { categoryId: u, categoryName: v, properties: m };
}
return { categoryId: u, categoryName: "", properties: [] };
}
function p(u, s, T, R, D) {
const A = u.type, P = n(u), I = {};
let F = D || t[A];
if (F && Object.keys(F).length === 0 && T && T.getPropConfig && (F = T.getPropConfig(R)), F && F.categories) {
const S = [];
return Object.keys(F.categories).map((f) => {
const M = F.categories[f];
if (M.$ref) {
S.push(d(f, M, u, s, R));
return;
}
const y = M == null ? void 0 : M.title, v = M == null ? void 0 : M.tabId, E = M == null ? void 0 : M.tabName, m = M == null ? void 0 : M.hide, C = M == null ? void 0 : M.hideTitle, k = b(M.properties || {}, I, P, u, s, R, M.$converter), { setPropertyRelates: x } = M, B = M == null ? void 0 : M.parentPropertyID;
S.push({ categoryId: f, categoryName: y, tabId: v, tabName: E, hide: m, properties: k, hideTitle: C, setPropertyRelates: x, parentPropertyID: B });
}), S;
}
return [];
}
return {
getPropertyConfigBySchema: p,
getPropertyConfigByType: a,
propertyConverterMap: o
};
}
const bt = {}, yt = {};
vt(bt, yt, cn);
const Ct = {}, wt = {}, { getSchemaByType: Fn, resolveSchemaWithDefaultValue: An, resolveSchemaToProps: Lo, mappingSchemaToProps: qo, setDesignerContext: Wo } = pt(Ct, wt), xt = {}, Tt = {};
vt(xt, Tt, An);
function St(t, e, n = /* @__PURE__ */ new Map(), o = (l, h, c, g) => h, i = {}, r = (l) => l) {
return gt[e.title] = e, mt[e.title] = o, bt[e.title] = i, yt[e.title] = r, Ct[e.title] = e, wt[e.title] = o, xt[e.title] = i, Tt[e.title] = r, (l = {}, h = !0) => {
if (!h)
return dn(l, n);
const c = un(l, e, n), g = Object.keys(t).reduce((b, a) => (b[a] = t[a].default, b), {});
return Object.assign(g, c);
};
}
function Nn(t, e) {
return { customClass: e.class, customStyle: e.style };
}
function jn(t, e) {
if (!t || t.length < 1)
return null;
for (const n of t) {
if (n.id === e)
return n;
if (n.children) {
const o = n.children.find((i) => i.id === e);
if (o)
return o;
}
}
return null;
}
function $n() {
function t(e, n) {
const o = e.buttons;
if (!o || o.length < 1)
return null;
const [i, r] = n.payloads, l = jn(o, r);
return l ? l.onClick || l.click : null;
}
return {
resolve: t
};
}
const Vn = /* @__PURE__ */ new Map([
["buttons", "items"],
["appearance", Nn]
]);
function Et(t, e, n) {
return e;
}
const _n = "https://json-schema.org/draft/2020-12/schema", Ln = "https://farris-design.gitee.io/response-toolbar.schema.json", qn = "response-toolbar", Wn = "A Farris Toolbar Component", Un = "object", zn = {
id: {
description: "The unique identifier for a Response Toolbar",
type: "string"
},
type: {
description: "The type string of Response Toolbar",
type: "string",
default: "response-toolbar"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string",
default: ""
}
}
},
alignment: {
description: "The alignment of Response Toolbar Button.",
type: "string",
default: "right"
},
buttons: {
description: "The items of Response Toolbar.",
type: "array",
default: []
},
buttonSize: {
type: "string",
default: ""
},
visible: {
description: "",
type: "boolean",
default: !0
}
}, Gn = [
"id",
"type",
"buttons"
], Hn = {
onClick: "点击事件"
}, Yn = {
$schema: _n,
$id: Ln,
title: qn,
description: Wn,
type: Un,
properties: zn,
required: Gn,
events: Hn
}, Xn = "https://json-schema.org/draft/2020-12/schema", Qn = "https://farris-design.gitee.io/response-toolbar-item.schema.json", Zn = "response-toolbar-item", Jn = "A Farris Toolbar Item Component", Kn = "object", eo = {
id: {
description: "The unique identifier for a Response Toolbar",
type: "string"
},
type: {
description: "The type string of Response Toolbar",
type: "string",
default: "response-toolbar-item"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string",
default: ""
}
}
},
alignment: {
description: "对齐",
type: "string",
default: "right"
},
text: {
description: "文本",
type: "string",
default: "按钮"
},
icon: {
description: "图标",
type: "string",
default: ""
},
disabled: {
description: "禁用",
type: "boolean",
default: !1
},
visible: {
description: "是否可见",
type: "boolean",
default: !0
},
onClick: {
description: "点击事件",
type: "string",
default: ""
},
tipsEnable: {
description: "",
type: "boolean",
default: !1
},
tipsText: {
description: "",
type: "string",
default: ""
},
dropdownClass: {
description: "处于下拉菜单时的样式",
type: "string",
default: ""
},
split: {
description: "",
type: "boolean",
default: !1
}
}, to = [
"id",
"type",
"text"
], no = {
onClick: "点击事件"
}, oo = {
$schema: Xn,
$id: Qn,
title: Zn,
description: Jn,
type: Kn,
properties: eo,
required: to,
events: no
}, ze = {
id: { type: String, default: "" },
/** 组件自定义样式 */
customClass: { type: String, default: "" },
alignment: { Type: String, default: "right" },
items: {
Type: Array,
default: []
},
/** 控制是否可见 */
visible: { type: Boolean, default: !0 }
}, ro = Object.assign({}, ze, {
componentId: { type: String, default: "" }
}), Ge = St(
ze,
Yn,
Vn,
Et
), It = {
id: { type: String, default: "" },
item: { type: Object, default: {} },
items: { type: Object, default: {} },
class: { type: String, default: "btn-secondary" },
text: { type: String, default: "" },
disabled: { type: Boolean, default: !1 },
icon: { type: String, default: "" },
componentId: { type: String, default: "" },
// 是否展开子级
expanded: { type: Boolean, default: !1 },
alignment: { Type: String, default: "right" },
// 下拉按钮分离
split: { type: Boolean, default: !1 },
// 是否下拉
isDP: { type: Boolean, default: !1 },
// 是否下拉项
isDPItem: { type: Boolean, default: !1 }
}, io = St(
It,
oo,
void 0,
Et
), so = $n();
function He() {
function t(n) {
const o = {
"f-icon": !0
};
if (n.icon) {
const i = n.icon.trim().split(" ");
i && i.length && i.reduce((r, l) => (r[l] = !0, r), o);
}
return o;
}
function e(n) {
return !!(n.icon && n.icon.trim());
}
return { iconClass: t, shouldShowIcon: e };
}
function lo(t, e) {
function n(S) {
return se({
"dropdown-menu": !0
}, S.menuClass);
}
function o(S) {
const f = {
disabled: !S.enable,
"dropdown-submenu": !0,
"f-rt-dropdown": !0,
"text-truncate": !0
};
return se(f, S.dropdownClass);
}
function i(S) {
const f = {
disabled: !S.enable,
"dropdown-item": !0,
"f-rt-btn": !0,
"text-truncate": !0
};
return se(f, S.dropdownClass);
}
function r(S) {
const f = {
disabled: !S.enable,
"dropdown-item": !0,
"f-rt-btn": !0,
"text-truncate": !0,
"f-rt-toggle": !S.split,
"btn-icontext": !!(S.icon && S.icon.trim()),
"dropdown-toggle": !S.split
};
return se(f, S.dropdownClass);
}
function l(S) {
const f = {
"f-rt-btn": !0,
"text-truncate": !0,
"btn-icontext": !!(S.icon && S.icon.trim()),
"d-block": !0
};
return se(f, S.dropdownClass);
}
let h;
const c = /* @__PURE__ */ new Map();
let g = "";
function b(S) {
g = "#" + S;
}
function a(S, f, M) {
S.stopPropagation();
const y = M ? M.id : "__top_item__";
if (f.children && f.children.length && (f.expanded = !f.expanded, f.expanded)) {
if (c.has(y) && c.get(y) !== f) {
const v = c.get(y);
v && (v.expanded = !1, c.delete(y));
}
c.set(y, f);
}
}
function d(S, f) {
document.body.click(), f.enable && (S.stopPropagation(), typeof f.onClick == "function" && f.onClick(S, f.id), t.emit("click", S, f.id));
}
function p(S, f) {
const M = S.target;
M.className.indexOf("dropdown-item") < 0 || (M.title = M.scrollWidth > M.clientWidth ? f : "");
}
function u(S, f, M) {
if (f.tipsEnable && f.tipsText) {
const y = De({
content: f.tipsText,
enable: f.tipsEnable
});
return ke($("li", {
class: i(f),
id: f.id,
key: f.id + "_" + M,
onClick: (v) => d(v, f)
}, [$("span", {
class: l(f)
}, [e.shouldShowIcon(f) && $("i", {
class: e.iconClass(f)
}, null), f.text])]), [[Be("tooltip"), y]]);
}
return $("li", {
class: i(f),
id: f.id,
onClick: (y) => d(y, f)
}, [$("span", {
class: l(f),
onMouseenter: (y) => p(y, f.text)
}, [e.shouldShowIcon(f) && $("i", {
class: e.iconClass(f)
}, null), f.text])]);
}
function s(S, f, M) {
f.enable && (typeof f.onClick == "function" && M.onClick(S, f.id), t.emit("click", S, f.id), M.split || a(S, f, M));
}
function T(S, f, M) {
S && S.stopPropagation(), a(S, f, M);
}
function R(S, f) {
S.stopPropagation();
const M = f.id;
if (f.children && f.children.length && f.expanded && c.has(M)) {
const y = c.get(M);
y && (y.expanded = !1, c.delete(M));
}
}
function D(S, f, M) {
if (f.tipsEnable && f.tipsText) {
const y = De({
content: f.tipsText,
enable: f.tipsEnable
});
return $("li", {
class: o(f),
id: f.id,
key: f.id + "_" + M,
onClick: (v) => s(v, f, S)
}, [ke($("span", {
class: r(f)
}, [e.shouldShowIcon(f) && $("i", {
class: e.iconClass(f)
}, null), f.text]), [[Be("tooltip"), y]]), f.split && $("span", {
class: "dropdown-toggle dropdown-toggle-split f-rt-toggle",
onClick: (v) => T(v, f, S)
}, null), h(f, f)]);
}
return $("li", {
class: o(f),
id: f.id,
onClick: (y) => s(y, f, S),
onMouseenter: (y) => p(y, f.text)
}, [$("span", {
class: r(f)
}, [e.shouldShowIcon(f) && $("i", {
class: e.iconClass(f)
}, null), f.text]), f.split && $("span", {
class: "dropdown-toggle dropdown-toggle-split f-rt-toggle",
onClick: (y) => T(y, f, S)
}, null), h(f, f)]);
}
function A(S) {
return S.children.filter((f) => f.visible).map((f, M) => f.children && f.children.length ? D(S, f, M) : u(S, f, M));
}
function P(S, f) {
if (!S)
return 1080;
let M = -1;
const y = S.children.length;
for (let v = 0; v < y; v++)
if (S.children[v].id === f) {
M = v;
break;
}
return 1080 + y - M;
}
function I(S, f, M) {
var B, L;
const y = {
display: S.expanded ? "block" : "none",
position: "fixed",
maxWidth: "300px",
minWidth: "120px",
zIndex: 1080,
// 先用固定zIndex,后期会统一调用动态的zIndex
overflowY: "auto",
maxHeight: "none"
}, v = document.querySelector(g);
if (!v)
return y;
const E = Qt();
let m = (L = (B = E == null ? void 0 : E.exposed) == null ? void 0 : B.elementRef.value) == null ? void 0 : L.querySelector("#" + f);
if (m || (m = v == null ? void 0 : v.querySelector("#" + f)), !m)
return y;
const C = window.innerWidth, k = window.innerHeight, x = m == null ? void 0 : m.getClientRects();
if (m && x && x.length) {
const {
top: q,
width: W,
left: _,
right: Z,
height: Y
} = x[0], J = Math.ceil(Y + q);
y.top = `${J}px`, y.left = `${_}px`;
const z = S.id + "_menu", te = (m == null ? void 0 : m.querySelector("#" + z)) || (v == null ? void 0 : v.querySelector("#" + z)) || null;
if (te) {
te.style.visibility = "hidden", te.style.display = "block";
const O = te.offsetHeight;
y.zIndex = S.expanded ? P(v, z) : 1080, y.display === "block" && (te.style.display = "block");
const U = te.getBoundingClientRect();
if (M) {
y.top = `${q - 6}px`;
const N = Math.ceil(W + _);
y.left = `${N}px`;
}
C - _ - W < U.width && (y.left = `${(M ? _ : Z) - U.width}px`), k - q - Y < O ? q > O ? (y.top = `${q - O - 6}px`, y.maxHeight = `${q - 16}px`) : (y.maxHeight = `${k - J}px`, q > k - q - Y && (y.top = "10px", y.maxHeight = `${q - 16}px`)) : y.maxHeight = `${k - J}px`, te.style.visibility = "visible";
}
}
return y;
}
h = function(S, f) {
const M = f ? f.id : S.id;
return $(Xt, {
to: g,
disabled: !S.expanded
}, {
default: () => [$("ul", {
class: n(S),
style: I(S, M, f),
id: S.id + "_menu",
onWheel: (y) => R(y, S)
}, [A(S)])]
});
};
function F() {
c.forEach((S) => {
S.expanded = !1;
}), c.clear();
}
return {
renderDropdownMenu: h,
clearAllDropDownMenu: F,
updateContainerId: b
};
}
function ao(t, e, n) {
const o = Q(t.alignment), {
renderDropdownMenu: i,
clearAllDropDownMenu: r,
updateContainerId: l
} = lo(e, n);
function h(s) {
const T = {
"btn-group": !0,
"f-rt-dropdown": !0,
"f-btn-ml": o.value === "right" || o.value === "center",
"f-btn-mr": o.value === "left"
};
return se(T, s.dropdownClass);
}
function c(s) {
const T = {
btn: !0,
disabled: !s.enable,
"f-rt-btn": !0,
"btn-icontext": !!(s.icon && s.icon.trim()),
"f-rt-toggle": !s.split,
"dropdown-toggle": !s.split
};
return se(T, s.class);
}
function g(s) {
return se({
btn: !0,
"dropdown-toggle": !0,
"dropdown-toggle-split": !0
}, s.class);
}
function b(s) {
return s.split ? {
display: "flex"
} : {
display: "flex",
"border-radius": "6px"
};
}
function a(s, T) {
s.stopPropagation();
const R = T.expanded;
document.body.click(), typeof T.onClick == "function" && T.onClick(s, T.id), e.emit("click", s, T.id), T.split || (T.expanded = !R);
}
function d(s, T) {
s.stopPropagation();
const R = T.expanded;
document.body.click(), T.expanded = !R;
}
function p(s, T = !0) {
if (s.tipsEnable && s.tipsText) {
const R = De({
content: s.tipsText,
enable: s.tipsEnable
});
return $("div", {
id: s.id,
class: h(s)
}, [ke($("div", {
class: c(s),
style: b(s),
onClick: (D) => s.enable && a(D, s)
}, [n.shouldShowIcon(s) && $("i", {
class: n.iconClass(s)
}, null), $("span", null, [s.text])]), [[Be("tooltip"), R]]), s.split && $("button", {
class: g(s),
style: "border-radius:0 6px 6px 0;",
onClick: (D) => d(D, s)
}, null), T && i(s)]);
}
return $("div", {
id: s.id,
class: h(s)
}, [$("div", {
class: c(s),
style: b(s),
onClick: (R) => s.enable && a(R, s)
}, [n.shouldShowIcon(s) && $("i", {
class: n.iconClass(s)
}, null), $("span", null, [s.text])]), s.split && $("button", {
class: g(s),
style: "border-radius:0 6px 6px 0;",
onClick: (R) => d(R, s)
}, null), T && i(s)]);
}
function u() {
r();
}
return {
renderToolbarDropdown: p,
clearAllDropDown: u,
updateContainerId: l
};
}
const {
buildResponseToolbarItems: it
} = ft(), Oe = /* @__PURE__ */ Fe({
name: "FResponseToolbar",
props: ze,
emits: ["click"],
setup(t, e) {
const {
t: n
} = nn(), o = Q(it(t.items)), i = Q(), r = Q(), l = Q(), h = {
id: "__more_buttons__",
text: n("responseToolbar.more")
}, c = Q(new Me(h)), g = {
id: h.id + "width",
text: h.text
}, b = Q(-1), a = He();
let d = !1;
const {
guid: p,
uuid: u
} = en(), s = t.id ? t.id : "toolbar-" + p(), T = Q(), R = "dropdown-container-" + s + "-" + u(4), {
renderToolbarDropdown: D,
clearAllDropDown: A,
updateContainerId: P
} = ao(t, e, a);
P(R);
const I = ue(() => c.value.children.length > 0), F = ue(() => t.visible ? c.value.children.length > 0 ? !0 : o.value.findIndex((O) => O.shown && O.children && O.children.length > 0) > -1 : !1);
function S() {
t.visible && !T.value && document && (T.value = document.createElement("div"), T.value.id = R, document.body.appendChild(T.value));
}
S();
function f() {
T.value && document.body.contains(T.value) && (document.body.removeChild(T.value), T.value = null);
}
Ee(F, (O, U) => {
O ? S() : f();
});
const M = ue(() => {
const O = {
"f-toolbar": !0,
"f-response-toolbar": !0,
"position-relative": !0,
"f-response-toolbar-sm": t.buttonSize === "sm",
"f-response-toolbar-lg": t.buttonSize === "lg",
"d-none": !t.visible
};
return se(O, t.customClass);
}), y = ue(() => ({
"w-100": !0,
"d-flex": !0,
"flex-nowrap": !0,
"justify-content-end": t.alignment === "right",
"justify-content-start": t.alignment === "left",
"justify-content-center": t.alignment === "center"
}));
function v(O) {
O && O.target.closest("ul.dropdown-menu") && O.type === "wheel" || (o.value.filter((U) => U.children && U.children.length > 0).forEach((U) => {
U.expanded = !1;
}), c.value.expanded = !1, A());
}
function E(O, U) {
var ie;
const N = {
btn: !0,
"f-rt-btn": !0,
"f-btn-ml": t.alignment === "right" || U > 0 && t.alignment === "center",
"f-btn-mr": t.alignment === "left",
"btn-icontext": !!(O.icon && O.icon.trim())
}, X = ((ie = O == null ? void 0 : O.appearance) == null ? void 0 : ie.class) || O.class || "btn-secondary";
return se(N, X);
}
function m(O, U) {
document.body.click(), typeof U.onClick == "function" && U.onClick(O, U.id), e.emit("click", O, U.id);
}
function C(O, U) {
if (O.tipsEnable && O.tipsText) {
const N = De({
content: O.tipsText,
enable: O.tipsEnable
});
return ke($("button", {
type: "button",
class: E(O, U),
id: O.id,
disabled: !O.enable,
onClick: (X) => m(X, O)
}, [a.shouldShowIcon(O) && $("i", {
class: a.iconClass(O)
}, null), O.text]), [[Be("tooltip"), N]]);
}
return $("button", {
type: "button",
class: E(O, U),
id: O.id,
disabled: !O.enable,
onClick: (N) => m(N, O)
}, [a.shouldShowIcon(O) && $("i", {
class: a.iconClass(O)
}, null), O.text]);
}
let k = /* @__PURE__ */ new Map(), x = [];
function B(O) {
const U = Math.ceil(parseFloat(getComputedStyle(O).getPropertyValue("margin-left"))), N = Math.ceil(parseFloat(getComputedStyle(O).getPropertyValue("margin-right")));
return (U || 0) + O.getBoundingClientRect().width + (N || 0);
}
function L(O, U, N) {
if (U < b.value) {
let X = N - 1;
for (; X >= 0; X--) {
const ie = O[X], re = B(ie);
if (U += re, U >= b.value)
break;
}
N = X;
}
return U -= b.value, {
start: N,
space: U
};
}
function q(O) {
const U = l.value;
let N = O;
const ie = Array.from(U.children).filter((ae) => ae.id !== "__more_buttons__"), re = ie.length;
let oe = !1, ne = 0;
for (; ne < re; ne++) {
const ae = ie[ne], ye = B(ae);
if (ye <= N)
N -= ye;
else {
const Ce = L(ie, N, ne);
ne = Ce.start, N = Ce.space, oe = !0;
break;
}
}
if (!oe && x.length > 0) {
const ae = L(ie, N, ne);
ne = ae.start, N = ae.space;
}
const Te = x.length > 0;
for (; ne < re; ne++) {
const ae = ie[ne], ye = B(ae);
k.set(ae.id, !0);
const Ce = x.find((Se) => Se.id === ae.id);
Ce ? Ce.width = ye : x[Te ? "unshift" : "push"]({
id: ae.id,
width: ye
});
}
return N;
}
function W(O) {
let U = q(O);
if (x.length) {
let re = 0;
for (; re < x.length; re++) {
const oe = t.items.find((ne) => ne.id === x[re].id);
if (oe && oe.visible !== !1) {
const ne = x[re].width;
if (U >= ne || re === x.length - 1 && U + b.value >= ne)
U -= ne;
else
break;
}
}
for (let oe = 0; oe < re; oe++)
k.delete(x[oe].id);
x.splice(0, re - 1);
}
const N = Object.assign({}, c.value);
N.children = [];
const X = new Me(N), ie = o.value.reduce((re, oe) => {
const ne = t.items.find((Te) => Te.id === oe.id);
return k.has(oe.id) ? (X.children.push(oe), oe.shown = !1) : oe.shown = ne.visible !== !1, re.push(oe), re;
}, []);
c.value = X, o.value = ie;
}
function _(O = -1) {
if (O === 0 || !l.value || !r.value)
return;
O < 0 && (O = r.value.getBoundingClientRect().width);
const U = l.value.getBoundingClientRect().width;
(O >= 0 && O < U || x.length) && (W(O), v());
}
function Z() {
return b.value < 0 && $("div", {
style: "position:absolute;top:-30px;visibility:hidden;"
}, [D(new Me(g))]);
}
const Y = new ResizeObserver((O) => {
if (O.length) {
const N = O[0].contentRect.width;
_(N);
}
});
function J() {
k = /* @__PURE__ */ new Map(), x = [];
}
function z() {
r.value && !d && (Y.observe(r.value), d = !0);
}
function te() {
if (i.value && b.value < 0) {
const O = i.value.querySelector("#" + g.id);
O && (b.value = B(O));
}
}
return Ae(() => {
te(), _(), z(), document.body.addEventListener("click", v), document.body.addEventListener("wheel", v);
}), ct(() => {
Y.disconnect(), f(), document.body.removeEventListener("click", v), document.body.removeEventListener("wheel", v);
}), Ee(() => t.items, () => {
o.value = it(t.items), c.value.children = [], Ie(() => {
J(), _();
});
}, {
deep: !0
}), Ee(() => t.visible, (O) => {
O && Ie(() => {
te(), _(), z();
});
}), e.expose({
elementRef: i
}), () => $("div", {
class: M.value,
id: s,
ref: i,
style: {
"overflow-y": b.value < 0 ? "hidden" : "initial"
}
}, [t.visible && Z(), t.visible && $("div", {
ref: r,
class: y.value
}, [$("div", {
ref: l,
class: "d-inline-block f-response-content",
style: "white-space: nowrap;"
}, [o.value.filter((O) => O.shown).map((O, U) => O.children && O.children.length > 0 ? D(O) : C(O, U)), I.value && D(c.value)])])]);
}
}), co = Q(0);
function uo() {
co.value++;
}
const xe = Q(0);
function fo(t, e) {
const n = e.getBoundingClientRect(), o = t.getBoundingClientRect(), i = o.top >= n.top, r = o.top <= n.bottom;
return i && r;
}
function Pt(t) {
const e = t.querySelector(".component-btn-group");
if (!e)
return;
e.style.display = "";
const n = e.getBoundingClientRect();
if (!(n.top === 0 && n.left === 0)) {
const o = e.querySelector("div");
if (o) {
const i = o.getBoundingClientRect();
o.style.top = n.top + "px";
let r = n.left - i.width;
const l = document.querySelector(".editorDiv");
if (l) {
const h = l.getBoundingClientRect();
r < h.left && ({ left: r } = t.getBoundingClientRect());
}
o.style.left = r + "px";
}
}
}
function po(t) {
if (!window.scrollContainerList)
return;
const e = Array.from(window.scrollContainerList);
if (e.length && e.length === 1) {
const n = e[0], o = document.querySelector(`[id=${n}]`);
if (o && o.contains(t))
return o;
}
}
function Mt(t) {
if (!t)
return;
const e = t.getBoundingClientRect();
if (e.width === 0 && e.height === 0)
return;
const n = t.querySelector(".component-btn-group");
if (n) {
let o = !0;
const i = po(t);
if (i && (o = fo(t, i)), !o) {
n.style.display = "none";
return;
}
Pt(t);
}
}
function go(t) {
if (!t)
return;
let e;
t.className.includes("dgComponentSelected") ? e = t : e = t.querySelector(".dgComponentSelected"), e && Mt(e);
}
function mo(t) {
const { formSchemaUtils: e, formStateMachineUtils: n } = t;
function o(c, g = "") {
return {
path: g + c.code,
field: c.id,
fullPath: c.code
};
}
function i(c, g = "") {
return e.getViewModelById(c).states.map((a) => o(a, g));
}
function r(c) {
const g = e.getRootViewModelId(), b = i(c);
if (c === g)
return b;
const a = i(g, "root-component.");
return [...b, ...a];
}
function l(c) {
return c.binding && c.binding.path || c.id || "";
}
function h() {
return n && n.getRenderStates() || [];
}
return { getVariables: r, getControlName: l, getStateMachines: h };
}
class ho {
constructor(e) {
H(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'"
}
]);
H(this, "expressionNames", {
compute: "计算表达式",
dependency: "依赖表达式",
validate: "验证表达式",
dataPicking: "帮助前表达式",
visible: "可见表达式",
readonly: "只读表达式",
required: "必填表达式"
});
H(this, "getExpressionConverter", (e, n) => ({
convertFrom: (o, i, r, l) => {
const h = r.getExpressionRuleValue(e, n || i);
return h && h.value || "";
},
convertTo: (o, i, r, l, h) => {
var c;
if (i === "dataPicking" && (r != null && r.target)) {
const g = `${r.target}_dataPicking`;
((c = r.rules) == null ? void 0 : c.some(
(a) => a.id === g && a.value
)) ? o.dictPickingExpressionId = g : delete o.dictPickingExpressionId;
}
l.updateExpression(r);
}
}));
this.formSchemaService = e;
}
getExpressionRule(e, n) {
const o = this.formSchemaService.getExpressions();
if (!o)
return "";
const i = o.find((l) => l.target === e);
if (!i)
return "";
const r = i.rules.find((l) => l.type === n);
return r || "";
}
// 获取上下文表单变量
getContextFormVariables() {
const { module: e } = this.formSchemaService.getFormSchema();
if (!e.viewmodels || e.viewmodels.length === 0)
return [];