@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,097 lines (1,096 loc) • 36.4 kB
JavaScript
var me = Object.defineProperty;
var de = (e, t, n) => t in e ? me(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
var G = (e, t, n) => de(e, typeof t != "symbol" ? t + "" : t, n);
import { ref as R, computed as _, defineComponent as Z, watch as J, createVNode as v, onBeforeMount as x, createApp as ye, onUnmounted as ge, inject as be, onMounted as he } from "vue";
import { cloneDeep as Q, isPlainObject as X } from "lodash-es";
import { getSchemaByTypeForDesigner as Te } from "../dynamic-resolver/index.esm.js";
function K(e, t) {
let n;
function a(s) {
const { properties: l, title: d, ignore: o } = s, i = o && Array.isArray(o), f = Object.keys(l).reduce((g, r) => ((!i || !o.find((b) => b === r)) && (g[r] = l[r].type === "object" && l[r].properties ? a(l[r]) : Q(l[r].default)), g), {});
if (d && (!i || !o.find((g) => g === "id"))) {
const g = d.toLowerCase().replace(/-/g, "_");
f.id = `${g}_${Math.random().toString().slice(2, 6)}`;
}
return f;
}
function S(s) {
const { properties: l, title: d, required: o } = s;
if (o && Array.isArray(o)) {
const i = o.reduce((f, g) => (f[g] = l[g].type === "object" && l[g].properties ? a(l[g]) : Q(l[g].default), f), {});
if (d && o.find((f) => f === "id")) {
const f = d.toLowerCase().replace(/-/g, "_");
i.id = `${f}_${Math.random().toString().slice(2, 6)}`;
}
return i;
}
return {
type: d
};
}
function j(s, l = {}, d) {
const o = e[s];
if (o) {
let i = S(o);
const f = t[s];
return i = f ? f({ getSchemaByType: j }, i, l, d) : i, n != null && n.appendIdentifyForNewControl && n.appendIdentifyForNewControl(i), i;
}
return null;
}
function w(s, l) {
const d = a(l);
return Object.keys(d).reduce((o, i) => (Object.prototype.hasOwnProperty.call(s, i) && (o[i] && X(o[i]) && X(s[i] || !s[i]) ? Object.assign(o[i], s[i] || {}) : o[i] = s[i]), o), d), d;
}
function k(s, l) {
return Object.keys(s).filter((o) => s[o] != null).reduce((o, i) => {
if (l.has(i)) {
const f = l.get(i);
if (typeof f == "string")
o[f] = s[i];
else {
const g = f(i, s[i], s);
Object.assign(o, g);
}
} else
o[i] = s[i];
return o;
}, {});
}
function N(s, l, d = /* @__PURE__ */ new Map()) {
const o = w(s, l);
return k(o, d);
}
function m(s) {
var d;
const l = s.type;
if (l) {
const o = e[l];
if (!o)
return s;
const i = w(s, o), f = ((d = s.editor) == null ? void 0 : d.type) || "";
if (f) {
const g = e[f], r = w(s.editor, g);
i.editor = r;
}
return i;
}
return s;
}
function y(s) {
n = s;
}
return { getSchemaByType: j, resolveSchemaWithDefaultValue: m, resolveSchemaToProps: N, mappingSchemaToProps: k, setDesignerContext: y };
}
const I = {}, ee = {}, { getSchemaByType: gt, resolveSchemaWithDefaultValue: Se, resolveSchemaToProps: we, mappingSchemaToProps: Fe, setDesignerContext: bt } = K(I, ee);
function De(e = {}) {
function t(m, y, s, l) {
if (typeof s == "number")
return l[m].length === s;
if (typeof s == "object") {
const d = Object.keys(s)[0], o = s[d];
if (d === "not")
return Number(l[m].length) !== Number(o);
if (d === "moreThan")
return Number(l[m].length) >= Number(o);
if (d === "lessThan")
return Number(l[m].length) <= Number(o);
}
return !1;
}
function n(m, y, s, l) {
return l[m] && l[m].propertyValue && String(l[m].propertyValue.value) === String(s);
}
const a = /* @__PURE__ */ new Map([
["length", t],
["getProperty", n]
]);
Object.keys(e).reduce((m, y) => (m.set(y, e[y]), m), a);
function S(m, y) {
const s = m;
return typeof y == "number" ? [{ target: s, operator: "length", param: null, value: Number(y) }] : typeof y == "boolean" ? [{ target: s, operator: "getProperty", param: m, value: !!y }] : typeof y == "object" ? Object.keys(y).map((l) => {
if (l === "length")
return { target: s, operator: "length", param: null, value: y[l] };
const d = l, o = y[l];
return { target: s, operator: "getProperty", param: d, value: o };
}) : [];
}
function j(m) {
return Object.keys(m).reduce((s, l) => {
const d = S(l, m[l]);
return s.push(...d), s;
}, []);
}
function w(m, y) {
if (a.has(m.operator)) {
const s = a.get(m.operator);
return s && s(m.target, m.param, m.value, y) || !1;
}
return !1;
}
function k(m, y) {
return j(m).reduce((d, o) => d && w(o, y), !0);
}
function N(m, y) {
const s = Object.keys(m), l = s.includes("allOf"), d = s.includes("anyOf"), o = l || d, g = (o ? m[o ? l ? "allOf" : "anyOf" : "allOf"] : [m]).map((b) => k(b, y));
return l ? !g.includes(!1) : g.includes(!0);
}
return { parseValueSchema: N };
}
const Me = {
convertTo: (e, t, n, a) => {
e.appearance || (e.appearance = {}), e.appearance[t] = n;
},
convertFrom: (e, t, n) => e.appearance ? e.appearance[t] : e[t]
}, Pe = {
convertFrom: (e, t, n) => e.buttons && e.buttons.length ? `共 ${e.buttons.length} 项` : "无"
}, Oe = {
convertTo: (e, t, n, a) => {
e.editor && (e.editor[t] = n);
},
convertFrom: (e, t, n) => e.editor && Object.prototype.hasOwnProperty.call(e.editor, t) ? e.editor[t] : e[t]
}, te = {
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: "多语输入框" }
}, ke = {
convertFrom: (e, t, n) => {
var S;
const a = e.editor && e.editor[t] ? e.editor[t] : e[t];
return ((S = te[a]) == null ? void 0 : S.name) || a;
}
}, Ee = {
convertTo: (e, t, n, a) => {
e[t] = e[t];
},
convertFrom: (e, t, n) => e.editor ? n.getRealEditorType(e.editor.type) : ""
}, je = {
convertTo: (e, t, n, a) => {
(e.type === "data-grid-column" || e.type === "tree-grid-column") && (e.formatter ? e.formatter[t] = n : e.formatter = {
[t]: n
});
},
convertFrom: (e, t, n) => {
if (e.formatter) {
if (t === "trueText")
return e.formatter.trueText;
if (t === "falseText")
return e.formatter.falseText;
if (t === "prefix")
return e.formatter.prefix;
if (t === "suffix")
return e.formatter.suffix;
if (t === "precision")
return e.formatter.precision;
if (t === "decimal")
return e.formatter.decimal;
if (t === "thousand")
return e.formatter.thousand;
if (t === "tempDateFormat")
return e.formatter.dateFormat === "yyyy年MM月dd日" ? "yearMonthDay" : e.formatter.dateFormat === "yyyy-MM-dd HH:mm:ss" ? "yyyy-MM-ddTHH:mm:ss" : e.formatter.dateFormat === "yyyy/MM/dd HH:mm:ss" ? "yyyy/MM/ddTHH:mm:ss" : e.formatter.dateFormat === "yyyy年MM月dd日 HH时mm分ss秒" ? "yearMonthDayHourMinuteSecond" : e.formatter.tempDateFormat || e.formatter.dateFormat || "yyyy-MM-dd";
if (t === "customFormat")
return e.formatter.customFormat;
if (t === "type")
return e.formatter.type || "none";
}
return "none";
}
}, Ne = {
convertTo: (e, t, n, a) => {
e.command ? e.command[t] = n : e.command = {
[t]: n
}, t === "enable" && n && (e.command.commands || (e.command.commands = [
{
text: "编辑",
type: "primary",
command: "edit"
},
{
text: "删除",
type: "danger",
command: "remove"
}
]));
},
convertFrom: (e, t, n) => e.command && t === "enable" ? e.command.enable : ""
}, Le = {
convertTo: (e, t, n, a) => {
e.column ? e.column[t] = n : e.column = {
[t]: n
}, t === "fitColumns" && n && (e.column.fitMode || (e.column.fitMode = "average"));
},
convertFrom: (e, t, n) => {
if (e.column) {
if (t === "fitColumns")
return e.column.fitColumns;
if (t === "fitMode")
return e.column.fitMode;
}
return "";
}
}, $e = {
convertTo: (e, t, n, a) => {
e.summary ? e.summary[t] = n : e.summary = {
[t]: n
}, t === "enable" && n && (e.summary ? e.summary.groupFields || (e.summary.groupFields = []) : e.summary = {
enable: n,
groupFields: []
});
},
convertFrom: (e, t, n) => e.summary && t === "enable" ? e.summary.enable : e.type === "data-grid-column" ? e.enableSummary === void 0 ? !1 : e.enableSummary : ""
}, Be = {
convertTo: (e, t, n, a) => {
e.group ? e.group[t] = n : e.group = {
[t]: n
}, t === "enable" && n && (e.group ? e.group.groupFields || (e.group.groupFields = []) : e.group = {
enable: n,
groupFields: [],
showSummary: !1
});
},
convertFrom: (e, t, n) => {
if (e.group) {
if (t === "enable")
return e.group.enable;
if (t === "showSummary")
return e.group.showSummary;
}
}
}, Ce = {
convertFrom: (e, t) => e.binding ? e.binding.path : "",
convertTo: (e, t, n) => {
if (n && n.length > 0) {
const a = n[0];
e.binding || (e.binding = {}), e.binding.type = "Form", e.binding.path = a.bindingField, e.binding.field = a.id, e.binding.fullPath = a.path, e.path = a.bindingPath;
}
}
}, Re = {
convertTo: (e, t, n, a) => {
e.pagination || (e.pagination = {}), e.pagination[t] = n;
},
convertFrom: (e, t, n) => e.pagination ? e.pagination[t] : e[t]
}, He = {
convertTo: (e, t, n, a) => {
e.rowNumber || (e.rowNumber = {}), e.rowNumber[t] = n;
},
convertFrom: (e, t, n) => e.rowNumber ? e.rowNumber[t] : e[t]
}, Ae = {
convertTo: (e, t, n, a) => {
e.selection || (e.selection = {}), e.selection[t] = n;
},
convertFrom: (e, t, n) => e.selection ? e.selection[t] : e[t]
}, qe = {
convertFrom: (e, t, n) => e[t] && e[t].length ? `共 ${e[t].length} 项` : ""
}, _e = {
convertFrom: (e, t) => e[t] || "",
convertTo: (e, t, n) => {
e[t] = n;
}
}, ze = {
convertTo: (e, t, n, a) => {
e.size || (e.size = {}), e.size[t] = n;
},
convertFrom: (e, t, n) => e.size ? e.size[t] : e[t]
}, Ve = {
convertFrom: (e, t, n) => {
var a, S;
return (a = e.formatter) != null && a.data && t === "formatterEnumData" && !e.formatterEnumData ? (S = e.formatter) == null ? void 0 : S.data : e.formatterEnumData;
}
}, We = {
convertTo: (e, t, n, a) => {
e.sort || (e.sort = {}), e.sort[t] = n;
},
convertFrom: (e, t, n) => {
var a, S;
if (t === "mode")
return ((a = e.sort) == null ? void 0 : a.mode) || "client";
if (t === "multiSort")
return !!((S = e.sort) != null && S.multiSort);
}
}, Ue = {
convertTo: (e, t, n, a) => {
e.filter || (e.filter = {}), e.filter[t] = n;
},
convertFrom: (e, t, n) => {
var a;
if (t === "mode")
return ((a = e.filter) == null ? void 0 : a.mode) || "client";
}
}, Ge = {
convertTo: (e, t, n, a) => {
e.rowOption ? e.rowOption[t] = n : e.rowOption = {
[t]: n
};
},
convertFrom: (e, t, n) => {
if (e.rowOption) {
if (t === "customRowStyle")
return e.rowOption.customRowStyle;
if (t === "customCellStyle")
return e.rowOption.customCellStyle;
}
return "";
}
};
function ne(e, t, n) {
const a = /* @__PURE__ */ new Map([
["/converter/appearance.converter", Me],
["/converter/buttons.converter", Pe],
["/converter/property-editor.converter", Oe],
["/converter/items-count.converter", qe],
["/converter/type.converter", ke],
["/converter/change-editor.converter", Ee],
["/converter/change-formatter.converter", je],
["/converter/column-command.converter", Ne],
["/converter/column-option.converter", Le],
["/converter/summary.converter", $e],
["/converter/group.converter", Be],
["/converter/form-group-label.converter", _e],
["/converter/field-selector.converter", Ce],
["/converter/pagination.converter", Re],
["/converter/row-number.converter", He],
["/converter/grid-selection.converter", Ae],
["/converter/size.converter", ze],
["/converter/change-formatter-enum.converter", Ve],
["/converter/grid-sort.converter", We],
["/converter/grid-filter.converter", Ue],
["/converter/row-option.converter", Ge]
]), S = /* @__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 }]
]), j = De();
function w(o, i) {
return () => j.parseValueSchema(o, i);
}
function k(o, i, f) {
return o.includes("visible") && i.visible !== void 0 ? typeof i.visible == "boolean" ? () => !!i.visible : i.visible === void 0 ? !0 : w(i.visible, f) : () => !0;
}
function N(o, i, f) {
return o.includes("readonly") && i.readonly !== void 0 ? typeof i.readonly == "boolean" ? () => !!i.readonly : w(i.readonly, f) : () => !1;
}
function m(o, i) {
const f = o.$converter || i;
return typeof f == "string" && f && a.has(f) ? a.get(f) || null : f || null;
}
function y(o, i, f, g, r, b = "", P = "") {
return Object.keys(o).map((F) => {
const L = R(1), u = F, c = o[F], M = Object.keys(c), $ = c.title, p = c.type, h = S.get(p) || { type: "input-group", enableClear: !1 }, T = c.editor ? Object.assign({}, h, c.editor) : Object.assign({}, h), D = k(M, c, i), E = N(M, c, i);
T.readonly = T.readonly === void 0 ? E() : T.readonly;
const C = c.type === "cascade" ? y(c.properties, i, f, g, r, b, P) : [], q = !0;
let B = m(c, P);
const H = _({
get() {
if (L.value) {
if (["class", "style"].find((ve) => ve === u) && !B && (B = a.get("/converter/appearance.converter") || null), B && B.convertFrom)
return B.convertFrom(f, F, r, b);
const A = f[F];
return Object.prototype.hasOwnProperty.call(c, "defaultValue") && (A === void 0 || typeof A == "string" && A === "") ? c.type === "boolean" ? c.defaultValue : c.defaultValue || "" : A;
}
return null;
},
set(A) {
L.value += 1, B && B.convertTo ? (B.convertTo(g, F, A, r, b), B.convertTo(f, F, A, r, b)) : (g[F] = A, f[F] = A);
}
}), { refreshPanelAfterChanged: z, description: ue, isExpand: fe, parentPropertyID: pe } = c, U = { propertyID: u, propertyName: $, propertyType: p, propertyValue: H, editor: T, visible: D, readonly: E, cascadeConfig: C, hideCascadeTitle: q, refreshPanelAfterChanged: z, description: ue, isExpand: fe, parentPropertyID: pe };
return i[u] = U, U;
});
}
function s(o, i, f = {}) {
const g = {}, r = e[o];
return r && r.categories ? Object.keys(r.categories).map((P) => {
const O = r.categories[P], F = O == null ? void 0 : O.title, L = y(O.properties || {}, g, {}, f, i);
return { categoryId: P, categoryName: F, properties: L };
}) : [];
}
function l(o, i, f, g, r = "") {
const b = i.$ref.schema, P = i.$ref.converter, O = f[b], F = O.type, L = n(O), u = {}, c = e[F];
if (c && c.categories) {
const M = c.categories[o], $ = M == null ? void 0 : M.title;
P && Object.keys(M.properties).forEach((T) => {
M.properties[T].$converter = P;
});
const p = (M == null ? void 0 : M.properties) || {}, h = y(p, u, L, O, g, r);
return { categoryId: o, categoryName: $, properties: h };
}
return { categoryId: o, categoryName: "", properties: [] };
}
function d(o, i, f, g, r) {
const b = o.type, P = n(o), O = {};
let F = r || e[b];
if (F && Object.keys(F).length === 0 && f && f.getPropConfig && (F = f.getPropConfig(g)), F && F.categories) {
const L = [];
return Object.keys(F.categories).map((u) => {
const c = F.categories[u];
if (c.$ref) {
L.push(l(u, c, o, i, g));
return;
}
const M = c == null ? void 0 : c.title, $ = c == null ? void 0 : c.tabId, p = c == null ? void 0 : c.tabName, h = c == null ? void 0 : c.hide, T = c == null ? void 0 : c.hideTitle, D = y(c.properties || {}, O, P, o, i, g, c.$converter), { setPropertyRelates: E } = c, C = c == null ? void 0 : c.parentPropertyID;
L.push({ categoryId: u, categoryName: M, tabId: $, tabName: p, hide: h, properties: D, hideTitle: T, setPropertyRelates: E, parentPropertyID: C });
}), L;
}
return [];
}
return {
getPropertyConfigBySchema: d,
getPropertyConfigByType: s,
propertyConverterMap: a
};
}
const re = {}, oe = {};
ne(re, oe, Se);
const ie = {}, ae = {}, { getSchemaByType: ht, resolveSchemaWithDefaultValue: Je, resolveSchemaToProps: Tt, mappingSchemaToProps: St, setDesignerContext: wt } = K(ie, ae), se = {}, ce = {};
ne(se, ce, Je);
function Qe(e, t, n = /* @__PURE__ */ new Map(), a = (w, k, N, m) => k, S = {}, j = (w) => w) {
return I[t.title] = t, ee[t.title] = a, re[t.title] = S, oe[t.title] = j, ie[t.title] = t, ae[t.title] = a, se[t.title] = S, ce[t.title] = j, (w = {}, k = !0) => {
if (!k)
return Fe(w, n);
const N = we(w, t, n), m = Object.keys(e).reduce((y, s) => (y[s] = e[s].default, y), {});
return Object.assign(m, N);
};
}
function Xe(e, t) {
return { customClass: t.class, customStyle: t.style };
}
const Ye = /* @__PURE__ */ new Map([
["appearance", Xe]
]);
function Ze(e, t, n) {
return t;
}
const xe = "https://json-schema.org/draft/2020-12/schema", Ke = "https://farris-design.gitee.io/verify-detail.schema.json", Ie = "verify-detail", et = "A Farris Component", tt = "object", nt = {
id: {
description: "The unique identifier for verify-detail",
type: "string"
},
type: {
description: "The type string of verify-detail",
type: "string",
default: "verify-detail"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string"
},
style: {
type: "string"
}
},
default: {}
},
binding: {
description: "",
type: "object",
default: {}
},
disable: {
type: "string",
default: !1
},
editable: {
description: "",
type: "boolean",
default: !0
},
placeholder: {
description: "",
type: "string",
default: ""
},
readonly: {
description: "",
type: "boolean",
default: !1
},
require: {
description: "",
type: "boolean",
default: !1
},
tabindex: {
description: "",
type: "number",
default: -1
},
visible: {
description: "",
type: "boolean",
default: !0
}
}, rt = [
"id",
"type"
], ot = {
$schema: xe,
$id: Ke,
title: Ie,
description: et,
type: tt,
properties: nt,
required: rt
}, it = "verify-detail", at = "A Farris Component", st = "object", ct = {
basic: {
description: "Basic Infomation",
title: "基本信息",
properties: {
id: {
description: "组件标识",
title: "标识",
type: "string",
readonly: !0
},
type: {
description: "组件类型",
title: "控件类型",
type: "select",
editor: {
type: "waiting for modification",
enum: []
}
}
}
}
}, lt = {
title: it,
description: at,
type: st,
categories: ct
}, W = {
/** 表单验证默认显示的分组信息 */
showType: { type: String, default: "" },
/** 是否默认显示验证信息列表 */
showList: { type: Boolean, default: !1 },
/** 表单验证列表 */
verifyList: { type: Array, default: [] },
verifyType: { type: Array, default: [] },
/** 自定义样式 */
customClass: { type: String, default: "" },
/** 验证信息列表的最大高度 */
maxHeight: { type: Number, default: 200 },
/** 验证信息条目点击事件回调 */
onValidatorClick: { type: Function }
}, Y = Qe(W, ot, Ye, Ze, lt), V = /* @__PURE__ */ Z({
name: "FVerifyDetail",
props: W,
emits: ["validatorClick", "listshow"],
setup(e, t) {
let n = [];
const a = R(e.showList);
J(() => e.showList, () => {
a.value = e.showList;
});
const S = R(e.verifyType);
J(() => e.verifyType, () => {
S.value = e.verifyType;
});
function j() {
a.value = !a.value, t.emit("listshow", a.value);
}
function w(r) {
var b;
!r && S.value && S.value.length > 0 && (r = S.value[0].type), (b = S.value) == null || b.forEach((P) => {
P.active = P.type === r;
});
}
function k(r) {
r = r || n[0].type, n.forEach((b) => {
b.show = b.type === r;
});
}
function N(r) {
r.length <= 0 || (w(r.type), k(r.type));
}
function m() {
a.value = !1, t.emit("listshow", !1);
}
function y(r) {
var b;
(b = e.onValidatorClick) == null || b.call(e, r);
}
function s(r) {
return v("li", {
class: "f-verify-list",
onClick: () => y(r)
}, [v("span", {
class: ["f-icon f-icon-close-outline list-icon list-error", {
"list-warning": r.type === "warn"
}]
}, null), v("div", {
class: "list-con"
}, [v("div", {
class: "list-title",
title: r.title
}, [r.title]), v("div", {
class: "list-msg",
title: r.msg
}, [r.msg])])]);
}
function l() {
return n.map((r) => v("ul", {
class: ["f-verify-list-content", {
active: r.show
}]
}, [r.list && r.list.map((b) => s(b))]));
}
const d = _(() => {
var r;
return ((r = e.verifyList) == null ? void 0 : r.length) > 0;
});
function o(r) {
return {
btn: !0,
"verify-title-btn": !0,
"f-state-selected": r.active,
disabled: r.length <= 0
};
}
const i = _(() => {
var r;
return (r = S.value) == null ? void 0 : r.map((b) => v("button", {
class: o(b),
onClick: () => N(b)
}, [b.title, v("span", null, [b.length])]));
}), f = _(() => {
var r;
return v("div", {
class: "f-verify-nums",
onClick: j
}, [v("span", {
class: "nums-icon f-icon f-icon-warning"
}, null), v("span", {
class: "nums-count"
}, [(r = e.verifyList) == null ? void 0 : r.length])]);
});
function g() {
var b;
const r = [];
S.value && ((b = S.value) != null && b.length) && (S.value.map((P) => {
const O = {
list: P.type === "all" ? e.verifyList : [],
show: !1,
type: P.type
};
r.push(O);
}), r.map((P, O) => {
const F = e.verifyList.filter((L) => L.type === P.type);
r[O].list = O !== 0 ? F : r[O].list;
}), S.value.map((P, O) => {
P.length = r[O].list.length;
})), n = r;
}
return x(() => {
g(), k(e.showType), w(e.showType);
}), () => v("div", {
class: d.value ? `f-verify-detail ${e.customClass}` : ""
}, [d.value ? v("div", {
class: "f-verify-detail-content"
}, [f.value, v("div", {
class: "f-verify-form-main",
hidden: !a.value
}, [v("div", {
class: "f-verify-form-content"
}, [v("div", {
class: "f-verify-form-content-arrow"
}, null), v("div", {
class: "f-verify-form-content-list"
}, [v("div", {
class: "f-verify-forms-title"
}, [v("div", {
class: "btn-group"
}, [i.value]), v("div", {
class: "f-verify-close",
onClick: m
}, [v("span", {
class: "f-icon f-icon-close"
}, null)])]), v("div", {
class: "f-verify-forms-list",
style: {
maxHeight: e.maxHeight + "px"
}
}, [l()])])])])]) : null]);
}
});
function ut(e, t, n) {
ye({
setup() {
return ge(() => {
t && t();
}), () => v(V, e, null);
}
}).mount(n);
}
class le {
static show(t, n) {
this.clear();
let a = 0;
this.verifyContainer = document.createElement("div"), n && n.offsetHeight > 0 ? (a = n.offsetHeight - 120, n.appendChild(this.verifyContainer)) : (a = document.documentElement.clientHeight - 120, document.body.appendChild(this.verifyContainer)), t.maxHeight = t.maxHeight ? t.maxHeight : a, ut(t, this.clear, this.verifyContainer);
}
static clear() {
let t = this.verifyContainer;
t && (t.parentNode && t.parentNode.removeChild(t), t = null);
}
}
G(le, "verifyContainer", null);
function ft(e, t, n) {
var $;
const a = "", S = "", j = R();
let w;
function k() {
return (t == null ? void 0 : t.schema.componentType) !== "frame";
}
function N() {
return !1;
}
function m() {
return (t == null ? void 0 : t.schema.componentType) !== "frame";
}
function y() {
return (t == null ? void 0 : t.schema.componentType) === "frame";
}
function s(p) {
if (!p || !p.value)
return null;
if (p.value.schema && p.value.schema.type === "component")
return p.value;
const h = R(p == null ? void 0 : p.value.parent), T = s(h);
return T || null;
}
function l(p = t) {
var E;
const { componentInstance: h, designerItemElementRef: T } = p;
if (!h || !h.value)
return null;
const { getCustomButtons: D } = h.value;
return h.value.canMove || D && ((E = D()) != null && E.length) ? T : l(p.parent);
}
function d(p) {
return !!n;
}
function o() {
return (t == null ? void 0 : t.schema.label) || (t == null ? void 0 : t.schema.title) || (t == null ? void 0 : t.schema.name);
}
function i() {
}
function f(p, h) {
var T;
!p || !h || (T = t == null ? void 0 : t.setupContext) == null || T.emit("dragEnd");
}
function g(p, h) {
const { componentType: T } = p;
let D = Te(T, p, h);
const E = T.toLowerCase().replace(/-/g, "_");
return D && !D.id && D.type === T && (D.id = `${E}_${Math.random().toString().slice(2, 6)}`), D;
}
function r(p) {
}
function b(...p) {
}
function P(p) {
if (!p)
return;
const h = t == null ? void 0 : t.schema, { formSchemaUtils: T } = p;
if (h && T.getExpressions().length) {
const D = T.getExpressions().findIndex((E) => E.target === h.id);
D > -1 && T.getExpressions().splice(D, 1);
}
}
function O(p) {
if (!p || !(t != null && t.schema))
return;
const h = t.schema, { formSchemaUtils: T } = p;
T.removeCommunicationInComponent(h);
}
function F(p) {
P(p), O(p), t != null && t.schema.contents && t.schema.contents.map((h) => {
let T = h.id;
h.type === "component-ref" && (T = h.component);
const D = e.value.querySelectorAll(`#${T}-design-item`);
D != null && D.length && Array.from(D).map((E) => {
var C;
(C = E == null ? void 0 : E.componentInstance) != null && C.value.onRemoveComponent && E.componentInstance.value.onRemoveComponent(p);
});
});
}
function L() {
}
function u(p) {
var T, D;
if (!((T = t == null ? void 0 : t.schema) != null && T.id))
return;
!w && p && (w = p.formSchemaUtils);
let h = "";
{
const { text: E, title: C, label: q, mainTitle: B, name: H, type: z } = t.schema;
h = E || C || q || B || H || ((D = te[z]) == null ? void 0 : D.name);
}
h && w.getControlBasicInfoMap().set(t.schema.id, {
componentTitle: h,
parentPathName: h
});
}
function c(p) {
var E;
const { changeObject: h } = p, { propertyID: T, propertyValue: D } = h;
if (["text", "title", "label", "name", "mainTitle"].includes((E = p == null ? void 0 : p.changeObject) == null ? void 0 : E.propertyID) && T && D && (u(), w)) {
const C = w.getControlBasicInfoMap(), q = C.keys().toArray().filter((B) => {
var H, z;
return ((H = C.get(B)) == null ? void 0 : H.reliedComponentId) === ((z = t == null ? void 0 : t.schema) == null ? void 0 : z.id);
});
q != null && q.length && q.forEach((B) => {
const H = C.get(B).parentPathName.split(" > ");
H[0] = D, C.get(B).parentPathName = H.join(" > ");
});
}
}
function M(p) {
c(p);
}
return j.value = {
canMove: k(),
canSelectParent: N(),
canDelete: m(),
canNested: !y(),
contents: t == null ? void 0 : t.schema.contents,
elementRef: e,
parent: ($ = t == null ? void 0 : t.parent) == null ? void 0 : $.componentInstance,
schema: t == null ? void 0 : t.schema,
styles: a,
designerClass: S,
canAccepts: d,
getBelongedComponentInstance: s,
getDraggableDesignItemElement: l,
getDraggingDisplayText: o,
getPropConfig: b,
getDragScopeElement: i,
onAcceptMovedChildElement: f,
onChildElementMovedOut: r,
addNewChildComponentSchema: g,
triggerBelongedComponentToMoveWhenMoved: R(!1),
triggerBelongedComponentToDeleteWhenDeleted: R(!1),
onRemoveComponent: F,
getCustomButtons: L,
onPropertyChanged: M,
setComponentBasicInfoMap: u,
updateContextSchema: t == null ? void 0 : t.updateContextSchema
}, j;
}
const pt = /* @__PURE__ */ Z({
name: "FVerifyDetailDesign",
props: W,
emits: ["validatorClick", "listshow"],
setup(e, t) {
let n = [];
const a = R(e.showList), S = R(e.maxHeight), j = R(e.verifyList), w = R(e.showType), k = R(e.verifyType), N = R(), m = be("design-item-context"), y = ft(N, m);
he(() => {
N.value.componentInstance = y;
}), t.expose(y.value);
function s() {
a.value = !a.value, t.emit("listshow", a.value);
}
function l(u) {
var c;
(c = k.value) == null || c.forEach((M) => {
M.active = M.type === u;
});
}
function d(u) {
n.forEach((c) => {
c.show = c.type === u;
});
}
function o(u) {
u.length <= 0 || (l(u.type), d(u.type));
}
function i() {
a.value = !1, t.emit("listshow", !1);
}
function f(u) {
t.emit("validatorClick", u);
}
function g(u) {
return v("li", {
class: "f-verify-list",
onClick: () => f(u)
}, [v("span", {
class: ["f-icon f-icon-close-outline list-icon list-error", {
"list-warning": u.type === "warn"
}]
}, null), v("div", {
class: "list-con"
}, [v("p", {
class: "list-title",
title: u.title
}, [u.title]), v("p", {
class: "list-msg",
title: u.msg
}, [u.msg])])]);
}
function r() {
return n.map((u) => v("ul", {
class: ["f-verify-list-content", {
active: u.show
}]
}, [u.list && u.list.map((c) => g(c))]));
}
const b = _(() => {
var u;
return ((u = j.value) == null ? void 0 : u.length) > 0;
});
function P(u) {
return {
"btn btn-secondary": !0,
active: u.active,
disabled: u.length <= 0
};
}
const O = _(() => {
var u;
return (u = k.value) == null ? void 0 : u.map((c) => v("button", {
class: P(c),
onClick: () => o(c)
}, [c.title, v("span", null, [c.length])]));
}), F = _(() => {
var u;
return v("div", {
class: "f-verify-nums",
onClick: s
}, [v("span", {
class: "nums-icon f-icon f-icon-warning"
}, null), v("span", {
class: "nums-count"
}, [(u = j.value) == null ? void 0 : u.length])]);
});
function L() {
var c;
const u = [];
k.value && ((c = k.value) != null && c.length) && (k.value.map((M) => {
const $ = {
list: M.type === "all" ? j.value : [],
show: !1,
type: M.type
};
u.push($);
}), u.map((M, $) => {
const p = j.value.filter((h) => h.type === M.type);
u[$].list = $ !== 0 ? p : u[$].list;
}), k.value.map((M, $) => {
M.length = u[$].list.length;
})), n = u;
}
return x(() => {
L(), d(w.value), l(w.value);
}), () => v("div", {
ref: N
}, [b.value ? v("div", {
class: "f-verify-detail"
}, [v("div", {
class: "f-verify-detail-content"
}, [F.value, v("div", {
class: "f-verify-form-main",
hidden: !a.value
}, [v("div", {
class: "f-verify-form-content"
}, [v("div", {
class: "f-verify-form-content-arrow"
}, null), v("div", {
class: "f-verify-form-content-list"
}, [v("div", {
class: "f-verify-forms-title"
}, [v("div", {
class: "btn-group"
}, [O.value]), v("div", {
class: "f-verify-close",
onClick: i
}, [v("span", {
class: "f-icon f-icon-close"
}, null)])]), v("div", {
class: "f-verify-forms-list",
style: {
maxHeight: S.value + "px"
}
}, [r()])])])])])]) : null]);
}
}), Ft = {
install(e) {
e.component(V.name, V), e.provide("FVerifyDetailService", le);
},
register(e, t, n, a) {
e["verify-detail"] = V, t["verify-detail"] = Y;
},
registerDesigner(e, t, n) {
e["verify-detail"] = pt, t["verify-detail"] = Y;
}
};
export {
V as FVerifyDetail,
le as FVerifyDetailService,
Ft as default,
Y as propsResolver,
W as verifyDetailProps
};