@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
920 lines (919 loc) • 30.2 kB
JavaScript
import { ref as P, computed as w, defineComponent as J, createVNode as T, Fragment as Q, inject as I, onMounted as de } from "vue";
import { cloneDeep as W, isPlainObject as _ } from "lodash-es";
import { useDesignerComponent as fe } from "../designer-canvas/index.esm.js";
import { useDesignerRules as pe } from "../dynamic-form/index.esm.js";
function U(e, t) {
let r;
function i(s) {
const { properties: l, title: f, ignore: n } = s, o = n && Array.isArray(n), c = Object.keys(l).reduce((p, g) => ((!o || !n.find((h) => h === g)) && (p[g] = l[g].type === "object" && l[g].properties ? i(l[g]) : W(l[g].default)), p), {});
if (f && (!o || !n.find((p) => p === "id"))) {
const p = f.toLowerCase().replace(/-/g, "_");
c.id = `${p}_${Math.random().toString().slice(2, 6)}`;
}
return c;
}
function y(s) {
const { properties: l, title: f, required: n } = s;
if (n && Array.isArray(n)) {
const o = n.reduce((c, p) => (c[p] = l[p].type === "object" && l[p].properties ? i(l[p]) : W(l[p].default), c), {});
if (f && n.find((c) => c === "id")) {
const c = f.toLowerCase().replace(/-/g, "_");
o.id = `${c}_${Math.random().toString().slice(2, 6)}`;
}
return o;
}
return {
type: f
};
}
function F(s, l = {}, f) {
const n = e[s];
if (n) {
let o = y(n);
const c = t[s];
return o = c ? c({ getSchemaByType: F }, o, l, f) : o, r != null && r.appendIdentifyForNewControl && r.appendIdentifyForNewControl(o), o;
}
return null;
}
function S(s, l) {
const f = i(l);
return Object.keys(f).reduce((n, o) => (Object.prototype.hasOwnProperty.call(s, o) && (n[o] && _(n[o]) && _(s[o] || !s[o]) ? Object.assign(n[o], s[o] || {}) : n[o] = s[o]), n), f), f;
}
function x(s, l) {
return Object.keys(s).filter((n) => s[n] != null).reduce((n, o) => {
if (l.has(o)) {
const c = l.get(o);
if (typeof c == "string")
n[c] = s[o];
else {
const p = c(o, s[o], s);
Object.assign(n, p);
}
} else
n[o] = s[o];
return n;
}, {});
}
function H(s, l, f = /* @__PURE__ */ new Map()) {
const n = S(s, l);
return x(n, f);
}
function d(s) {
var f;
const l = s.type;
if (l) {
const n = e[l];
if (!n)
return s;
const o = S(s, n), c = ((f = s.editor) == null ? void 0 : f.type) || "";
if (c) {
const p = e[c], g = S(s.editor, p);
o.editor = g;
}
return o;
}
return s;
}
function m(s) {
r = s;
}
return { getSchemaByType: F, resolveSchemaWithDefaultValue: d, resolveSchemaToProps: H, mappingSchemaToProps: x, setDesignerContext: m };
}
const X = {}, Y = {}, { getSchemaByType: ct, resolveSchemaWithDefaultValue: me, resolveSchemaToProps: ve, mappingSchemaToProps: ge, setDesignerContext: ut } = U(X, Y);
function be(e = {}) {
function t(d, m, s, l) {
if (typeof s == "number")
return l[d].length === s;
if (typeof s == "object") {
const f = Object.keys(s)[0], n = s[f];
if (f === "not")
return Number(l[d].length) !== Number(n);
if (f === "moreThan")
return Number(l[d].length) >= Number(n);
if (f === "lessThan")
return Number(l[d].length) <= Number(n);
}
return !1;
}
function r(d, m, s, l) {
return l[d] && l[d].propertyValue && String(l[d].propertyValue.value) === String(s);
}
const i = /* @__PURE__ */ new Map([
["length", t],
["getProperty", r]
]);
Object.keys(e).reduce((d, m) => (d.set(m, e[m]), d), i);
function y(d, m) {
const s = d;
return typeof m == "number" ? [{ target: s, operator: "length", param: null, value: Number(m) }] : typeof m == "boolean" ? [{ target: s, operator: "getProperty", param: d, value: !!m }] : typeof m == "object" ? Object.keys(m).map((l) => {
if (l === "length")
return { target: s, operator: "length", param: null, value: m[l] };
const f = l, n = m[l];
return { target: s, operator: "getProperty", param: f, value: n };
}) : [];
}
function F(d) {
return Object.keys(d).reduce((s, l) => {
const f = y(l, d[l]);
return s.push(...f), s;
}, []);
}
function S(d, m) {
if (i.has(d.operator)) {
const s = i.get(d.operator);
return s && s(d.target, d.param, d.value, m) || !1;
}
return !1;
}
function x(d, m) {
return F(d).reduce((f, n) => f && S(n, m), !0);
}
function H(d, m) {
const s = Object.keys(d), l = s.includes("allOf"), f = s.includes("anyOf"), n = l || f, p = (n ? d[n ? l ? "allOf" : "anyOf" : "allOf"] : [d]).map((h) => x(h, m));
return l ? !p.includes(!1) : p.includes(!0);
}
return { parseValueSchema: H };
}
const ye = {
convertTo: (e, t, r, i) => {
e.appearance || (e.appearance = {}), e.appearance[t] = r;
},
convertFrom: (e, t, r) => e.appearance ? e.appearance[t] : e[t]
}, Ce = {
convertFrom: (e, t, r) => e.buttons && e.buttons.length ? `共 ${e.buttons.length} 项` : "无"
}, Te = {
convertTo: (e, t, r, i) => {
e.editor && (e.editor[t] = r);
},
convertFrom: (e, t, r) => e.editor && Object.prototype.hasOwnProperty.call(e.editor, t) ? e.editor[t] : e[t]
}, Se = {
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: "多语输入框" }
}, Fe = {
convertFrom: (e, t, r) => {
var y;
const i = e.editor && e.editor[t] ? e.editor[t] : e[t];
return ((y = Se[i]) == null ? void 0 : y.name) || i;
}
}, he = {
convertTo: (e, t, r, i) => {
e[t] = e[t];
},
convertFrom: (e, t, r) => e.editor ? r.getRealEditorType(e.editor.type) : ""
}, Oe = {
convertTo: (e, t, r, i) => {
(e.type === "data-grid-column" || e.type === "tree-grid-column") && (e.formatter ? e.formatter[t] = r : e.formatter = {
[t]: r
});
},
convertFrom: (e, t, r) => {
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";
}
}, Pe = {
convertTo: (e, t, r, i) => {
e.command ? e.command[t] = r : e.command = {
[t]: r
}, t === "enable" && r && (e.command.commands || (e.command.commands = [
{
text: "编辑",
type: "primary",
command: "edit"
},
{
text: "删除",
type: "danger",
command: "remove"
}
]));
},
convertFrom: (e, t, r) => e.command && t === "enable" ? e.command.enable : ""
}, Me = {
convertTo: (e, t, r, i) => {
e.column ? e.column[t] = r : e.column = {
[t]: r
}, t === "fitColumns" && r && (e.column.fitMode || (e.column.fitMode = "average"));
},
convertFrom: (e, t, r) => {
if (e.column) {
if (t === "fitColumns")
return e.column.fitColumns;
if (t === "fitMode")
return e.column.fitMode;
}
return "";
}
}, xe = {
convertTo: (e, t, r, i) => {
e.summary ? e.summary[t] = r : e.summary = {
[t]: r
}, t === "enable" && r && (e.summary ? e.summary.groupFields || (e.summary.groupFields = []) : e.summary = {
enable: r,
groupFields: []
});
},
convertFrom: (e, t, r) => e.summary && t === "enable" ? e.summary.enable : e.type === "data-grid-column" ? e.enableSummary === void 0 ? !1 : e.enableSummary : ""
}, je = {
convertTo: (e, t, r, i) => {
e.group ? e.group[t] = r : e.group = {
[t]: r
}, t === "enable" && r && (e.group ? e.group.groupFields || (e.group.groupFields = []) : e.group = {
enable: r,
groupFields: [],
showSummary: !1
});
},
convertFrom: (e, t, r) => {
if (e.group) {
if (t === "enable")
return e.group.enable;
if (t === "showSummary")
return e.group.showSummary;
}
}
}, we = {
convertFrom: (e, t) => e.binding ? e.binding.path : "",
convertTo: (e, t, r) => {
if (r && r.length > 0) {
const i = r[0];
e.binding || (e.binding = {}), e.binding.type = "Form", e.binding.path = i.bindingField, e.binding.field = i.id, e.binding.fullPath = i.path, e.path = i.bindingPath;
}
}
}, De = {
convertTo: (e, t, r, i) => {
e.pagination || (e.pagination = {}), e.pagination[t] = r;
},
convertFrom: (e, t, r) => e.pagination ? e.pagination[t] : e[t]
}, He = {
convertTo: (e, t, r, i) => {
e.rowNumber || (e.rowNumber = {}), e.rowNumber[t] = r;
},
convertFrom: (e, t, r) => e.rowNumber ? e.rowNumber[t] : e[t]
}, Ae = {
convertTo: (e, t, r, i) => {
e.selection || (e.selection = {}), e.selection[t] = r;
},
convertFrom: (e, t, r) => e.selection ? e.selection[t] : e[t]
}, Ee = {
convertFrom: (e, t, r) => e[t] && e[t].length ? `共 ${e[t].length} 项` : ""
}, ke = {
convertFrom: (e, t) => e[t] || "",
convertTo: (e, t, r) => {
e[t] = r;
}
}, $e = {
convertTo: (e, t, r, i) => {
e.size || (e.size = {}), e.size[t] = r;
},
convertFrom: (e, t, r) => e.size ? e.size[t] : e[t]
}, Ne = {
convertFrom: (e, t, r) => {
var i, y;
return (i = e.formatter) != null && i.data && t === "formatterEnumData" && !e.formatterEnumData ? (y = e.formatter) == null ? void 0 : y.data : e.formatterEnumData;
}
}, Re = {
convertTo: (e, t, r, i) => {
e.sort || (e.sort = {}), e.sort[t] = r;
},
convertFrom: (e, t, r) => {
var i, y;
if (t === "mode")
return ((i = e.sort) == null ? void 0 : i.mode) || "client";
if (t === "multiSort")
return !!((y = e.sort) != null && y.multiSort);
}
}, Be = {
convertTo: (e, t, r, i) => {
e.filter || (e.filter = {}), e.filter[t] = r;
},
convertFrom: (e, t, r) => {
var i;
if (t === "mode")
return ((i = e.filter) == null ? void 0 : i.mode) || "client";
}
}, qe = {
convertTo: (e, t, r, i) => {
e.rowOption ? e.rowOption[t] = r : e.rowOption = {
[t]: r
};
},
convertFrom: (e, t, r) => {
if (e.rowOption) {
if (t === "customRowStyle")
return e.rowOption.customRowStyle;
if (t === "customCellStyle")
return e.rowOption.customCellStyle;
}
return "";
}
};
function Z(e, t, r) {
const i = /* @__PURE__ */ new Map([
["/converter/appearance.converter", ye],
["/converter/buttons.converter", Ce],
["/converter/property-editor.converter", Te],
["/converter/items-count.converter", Ee],
["/converter/type.converter", Fe],
["/converter/change-editor.converter", he],
["/converter/change-formatter.converter", Oe],
["/converter/column-command.converter", Pe],
["/converter/column-option.converter", Me],
["/converter/summary.converter", xe],
["/converter/group.converter", je],
["/converter/form-group-label.converter", ke],
["/converter/field-selector.converter", we],
["/converter/pagination.converter", De],
["/converter/row-number.converter", He],
["/converter/grid-selection.converter", Ae],
["/converter/size.converter", $e],
["/converter/change-formatter-enum.converter", Ne],
["/converter/grid-sort.converter", Re],
["/converter/grid-filter.converter", Be],
["/converter/row-option.converter", qe]
]), y = /* @__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 }]
]), F = be();
function S(n, o) {
return () => F.parseValueSchema(n, o);
}
function x(n, o, c) {
return n.includes("visible") && o.visible !== void 0 ? typeof o.visible == "boolean" ? () => !!o.visible : o.visible === void 0 ? !0 : S(o.visible, c) : () => !0;
}
function H(n, o, c) {
return n.includes("readonly") && o.readonly !== void 0 ? typeof o.readonly == "boolean" ? () => !!o.readonly : S(o.readonly, c) : () => !1;
}
function d(n, o) {
const c = n.$converter || o;
return typeof c == "string" && c && i.has(c) ? i.get(c) || null : c || null;
}
function m(n, o, c, p, g, h = "", D = "") {
return Object.keys(n).map((u) => {
const O = P(1), b = u, a = n[u], v = Object.keys(a), A = a.title, C = a.type, M = y.get(C) || { type: "input-group", enableClear: !1 }, $ = a.editor ? Object.assign({}, M, a.editor) : Object.assign({}, M), R = x(v, a, o), N = H(v, a, o);
$.readonly = $.readonly === void 0 ? N() : $.readonly;
const B = a.type === "cascade" ? m(a.properties, o, c, p, g, h, D) : [], ne = !0;
let E = d(a, D);
const se = w({
get() {
if (O.value) {
if (["class", "style"].find((ue) => ue === b) && !E && (E = i.get("/converter/appearance.converter") || null), E && E.convertFrom)
return E.convertFrom(c, u, g, h);
const k = c[u];
return Object.prototype.hasOwnProperty.call(a, "defaultValue") && (k === void 0 || typeof k == "string" && k === "") ? a.type === "boolean" ? a.defaultValue : a.defaultValue || "" : k;
}
return null;
},
set(k) {
O.value += 1, E && E.convertTo ? (E.convertTo(p, u, k, g, h), E.convertTo(c, u, k, g, h)) : (p[u] = k, c[u] = k);
}
}), { refreshPanelAfterChanged: ae, description: ie, isExpand: le, parentPropertyID: ce } = a, z = { propertyID: b, propertyName: A, propertyType: C, propertyValue: se, editor: $, visible: R, readonly: N, cascadeConfig: B, hideCascadeTitle: ne, refreshPanelAfterChanged: ae, description: ie, isExpand: le, parentPropertyID: ce };
return o[b] = z, z;
});
}
function s(n, o, c = {}) {
const p = {}, g = e[n];
return g && g.categories ? Object.keys(g.categories).map((D) => {
const j = g.categories[D], u = j == null ? void 0 : j.title, O = m(j.properties || {}, p, {}, c, o);
return { categoryId: D, categoryName: u, properties: O };
}) : [];
}
function l(n, o, c, p, g = "") {
const h = o.$ref.schema, D = o.$ref.converter, j = c[h], u = j.type, O = r(j), b = {}, a = e[u];
if (a && a.categories) {
const v = a.categories[n], A = v == null ? void 0 : v.title;
D && Object.keys(v.properties).forEach(($) => {
v.properties[$].$converter = D;
});
const C = (v == null ? void 0 : v.properties) || {}, M = m(C, b, O, j, p, g);
return { categoryId: n, categoryName: A, properties: M };
}
return { categoryId: n, categoryName: "", properties: [] };
}
function f(n, o, c, p, g) {
const h = n.type, D = r(n), j = {};
let u = g || e[h];
if (u && Object.keys(u).length === 0 && c && c.getPropConfig && (u = c.getPropConfig(p)), u && u.categories) {
const O = [];
return Object.keys(u.categories).map((b) => {
const a = u.categories[b];
if (a.$ref) {
O.push(l(b, a, n, o, p));
return;
}
const v = a == null ? void 0 : a.title, A = a == null ? void 0 : a.tabId, C = a == null ? void 0 : a.tabName, M = a == null ? void 0 : a.hide, $ = a == null ? void 0 : a.hideTitle, R = m(a.properties || {}, j, D, n, o, p, a.$converter), { setPropertyRelates: N } = a, B = a == null ? void 0 : a.parentPropertyID;
O.push({ categoryId: b, categoryName: v, tabId: A, tabName: C, hide: M, properties: R, hideTitle: $, setPropertyRelates: N, parentPropertyID: B });
}), O;
}
return [];
}
return {
getPropertyConfigBySchema: f,
getPropertyConfigByType: s,
propertyConverterMap: i
};
}
const V = {}, K = {};
Z(V, K, me);
const ee = {}, te = {}, { getSchemaByType: dt, resolveSchemaWithDefaultValue: Le, resolveSchemaToProps: ft, mappingSchemaToProps: pt, setDesignerContext: mt } = U(ee, te), re = {}, oe = {};
Z(re, oe, Le);
function ze(e, t, r = /* @__PURE__ */ new Map(), i = (S, x, H, d) => x, y = {}, F = (S) => S) {
return X[t.title] = t, Y[t.title] = i, V[t.title] = y, K[t.title] = F, ee[t.title] = t, te[t.title] = i, re[t.title] = y, oe[t.title] = F, (S = {}, x = !0) => {
if (!x)
return ge(S, r);
const H = ve(S, t, r), d = Object.keys(e).reduce((m, s) => (m[s] = e[s].default, m), {});
return Object.assign(d, H);
};
}
function Ie(e, t) {
return { customClass: t.class, customStyle: t.style };
}
const We = /* @__PURE__ */ new Map([
["appearance", Ie]
]), _e = "https://json-schema.org/draft/2020-12/schema", Ge = "https://farris-design.gitee.io/page-footer.schema.json", Je = "page-footer", Qe = "A Farris Input Component", Ue = "object", Xe = {
id: {
description: "The unique identifier for a page-footer",
type: "string"
},
type: {
description: "The type string of page-footer component",
type: "string",
default: "page-footer"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string"
},
style: {
type: "string"
}
},
default: {}
},
binding: {
description: "",
type: "object",
default: {}
},
editable: {
description: "",
type: "boolean",
default: !0
},
enableLinkLabel: {
description: "",
type: "boolean",
default: !1
},
label: {
description: "",
type: "string",
default: ""
},
lableWidth: {
description: "",
type: "number"
},
placeholder: {
description: "",
type: "string",
default: ""
},
readonly: {
description: "",
type: "boolean",
default: !1
},
required: {
description: "",
type: "boolean",
default: !1
},
tabindex: {
description: "",
type: "number",
default: -1
},
textAlign: {
description: "",
type: "string",
enum: [
"left",
"middle",
"right"
],
default: "left"
},
visible: {
description: "",
type: "boolean",
default: !0
},
onBlur: {
description: "",
type: "string",
default: ""
},
onClickLinkLabel: {
description: "",
type: "sting",
default: ""
}
}, Ye = [
"id",
"type"
], Ze = {
$schema: _e,
$id: Ge,
title: Je,
description: Qe,
type: Ue,
properties: Xe,
required: Ye
};
function Ve(e, t, r) {
return t;
}
const Ke = "page-footer", et = "A Farris Component", tt = "object", rt = {
basic: {
description: "Basic Infomation",
title: "基本信息",
properties: {
id: {
description: "组件标识",
title: "标识",
type: "string",
readonly: !0
},
type: {
description: "组件类型",
title: "控件类型",
type: "select",
editor: {
type: "waiting for modification",
enum: []
}
}
}
},
behavior: {
description: "Basic Infomation",
title: "行为",
properties: {
editable: {
description: "",
title: "允许编辑",
type: "boolean"
},
readonly: {
description: "",
title: "只读",
type: "string"
},
required: {
description: "",
title: "必填",
type: "boolean"
},
visible: {
description: "",
title: "可见",
type: "boolean"
},
placeholder: {
description: "",
title: "提示文本",
type: "string"
},
tabindex: {
description: "",
title: "tab索引",
type: "number"
},
textAlign: {
description: "",
title: "对齐方式",
type: "enum",
editor: {
type: "combo-list",
textField: "name",
valueField: "value",
data: [
{
value: "left",
name: "左对齐"
},
{
value: "center",
name: "居中"
},
{
value: "right",
name: "右对齐"
}
]
}
}
}
}
}, ot = {
title: Ke,
description: et,
type: tt,
categories: rt
}, L = {
/**
* 组件自定义样式
*/
customClass: { type: String, default: "" },
/**
* 是否启用内容区收折
*/
enableCollapse: { type: Boolean, default: !1 },
/**
* 是否默认收折内容区
*/
collapsed: { type: Boolean, default: !0 },
/**
* 收折按钮文本
*/
collapsedText: { type: String, default: "More" },
/**
* 展开按钮文本
*/
expandedText: { type: String, default: "More" },
/**
* 内容区域样式
*/
contentClass: { type: String, default: "" },
/**
* 页脚组件样式
*/
headerClass: { type: String, default: "" },
/**
* 上方扩展区域左侧内容区样式
*/
headerContentClass: { type: String, default: "" },
/**
* 上方扩展区域右侧按钮区样式
*/
headerToolbarClass: { type: String, default: "" },
/**
* 是否显示上方扩展区域
*/
showHeader: { type: String, default: !1 }
}, G = ze(L, Ze, We, Ve, ot), q = /* @__PURE__ */ J({
name: "FPageFooter",
props: L,
emits: [],
setup(e, t) {
const r = P(e.collapsed), i = w(() => e.collapsedText), y = P(e.contentClass), F = w(() => e.enableCollapse), S = w(() => e.expandedText), x = P(e.headerClass), H = P(e.headerContentClass), d = P(e.headerToolbarClass), m = w(() => e.showHeader), s = P(e.customClass);
function l(u) {
u && u.stopImmediatePropagation(), r.value = !r.value;
}
function f() {
return F.value && T("div", {
class: "toolbar--collapse",
onClick: (u) => l(u)
}, [T("span", {
class: "toobar--collapse-text"
}, [r.value ? S.value : i.value]), T("i", {
class: "f-icon toolbar--collapse-icon"
}, null)]);
}
const n = w(() => {
const u = {
"f-toolbar": !0
};
return d.value.split(" ").reduce((b, a) => (b[a] = !0, b), u), u;
});
function o() {
return T("div", {
class: n.value
}, [t.slots.headerToolbar && t.slots.headerToolbar(), !t.slots.headerToolbar && f()]);
}
const c = w(() => {
const u = {
"f-content": !0
};
return H.value.split(" ").reduce((b, a) => (b[a] = !0, b), u), u;
});
function p() {
return T(Q, null, [t.slots.headerContent && T("div", {
class: c.value
}, [t.slots.headerContent()]), o()]);
}
const g = w(() => {
const u = {
"f-cmp-footer-header": !0
};
return x.value.split(" ").reduce((b, a) => (b[a] = !0, b), u), u;
});
function h() {
return T("header", {
class: g.value
}, [t.slots.header && t.slots.header(), !t.slots.header && p()]);
}
const D = w(() => {
const u = {
"f-cmp-footer": !0,
"f-state-collapse": F.value && r.value,
"f-cmp-footer-accordion": F.value
};
return s.value.split(" ").reduce((b, a) => (b[a] = !0, b), u), u;
}), j = w(() => {
const u = {
"f-cmp-footer-content": !0
};
return y.value.split(" ").reduce((b, a) => (b[a] = !0, b), u), u;
});
return () => T("div", {
class: D.value
}, [T("footer", {
class: "f-cmp-footer-container"
}, [m.value && h(), T("div", {
class: j.value
}, [t.slots.default && t.slots.default()])])]);
}
}), nt = /* @__PURE__ */ J({
name: "FPageFooterDesign",
props: L,
emits: [],
setup(e, t) {
const r = P(e.collapsed), i = P(e.collapsedText), y = P(e.contentClass), F = P(e.enableCollapse), S = P(e.expandedText), x = P(e.headerClass), H = P(e.headerContentClass), d = P(e.headerToolbarClass), m = P(e.showHeader), s = P(), l = I("design-item-context"), f = I("designer-host-service"), n = pe(l, f), o = fe(s, l, n);
de(() => {
s.value.componentInstance = o;
}), t.expose(o.value);
function c(v) {
v && v.stopImmediatePropagation(), r.value = !r.value;
}
function p() {
return F.value && T("div", {
class: "toolbar--collapse",
onClick: (v) => c(v)
}, [T("span", {
class: "toobar--collapse-text"
}, [r.value ? S.value : i.value]), T("i", {
class: "f-icon toolbar--collapse-icon"
}, null)]);
}
const g = w(() => {
const v = {
"f-toolbar": !0
};
return d.value.split(" ").reduce((C, M) => (C[M] = !0, C), v), v;
});
function h() {
return T("div", {
class: g.value
}, [t.slots.headerToolbar && t.slots.headerToolbar(), !t.slots.headerToolbar && p()]);
}
const D = w(() => {
const v = {
"f-content": !0
};
return H.value.split(" ").reduce((C, M) => (C[M] = !0, C), v), v;
});
function j() {
return T(Q, null, [t.slots.headerContent && T("div", {
class: D.value
}, [t.slots.headerContent()]), h()]);
}
const u = w(() => {
const v = {
"f-cmp-footer-header": !0
};
return x.value.split(" ").reduce((C, M) => (C[M] = !0, C), v), v;
});
function O() {
return T("header", {
class: u.value
}, [t.slots.header && t.slots.header(), !t.slots.header && j()]);
}
const b = w(() => {
const v = {
"f-cmp-footer": !0,
"f-state-collapse": F.value && r.value,
"f-cmp-footer-accordion": F.value
};
return x.value.split(" ").reduce((C, M) => (C[M] = !0, C), v), v;
}), a = w(() => {
const v = {
"f-cmp-footer-content": !0
};
return y.value.split(" ").reduce((C, M) => (C[M] = !0, C), v), v;
});
return () => T("div", {
ref: s,
class: b.value
}, [T("footer", {
class: "f-cmp-footer-container"
}, [m.value && O(), T("div", {
class: a.value
}, [t.slots.default && t.slots.default()])])]);
}
}), vt = {
install(e) {
e.component(q.name, q);
},
register(e, t, r, i) {
e["page-footer"] = q, t["page-footer"] = G;
},
registerDesigner(e, t, r) {
e["page-footer"] = nt, t["page-footer"] = G;
}
};
export {
q as FPageFooter,
vt as default,
L as pageFooterProps,
G as propsResolver
};