@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,059 lines (1,058 loc) • 32.5 kB
JavaScript
var te = Object.defineProperty;
var se = (a, e, t) => e in a ? te(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
var h = (a, e, t) => se(a, typeof e != "symbol" ? e + "" : e, t);
import { defineComponent as z, ref as b, computed as y, watch as D, createVNode as f, Fragment as _, inject as H, onMounted as oe } from "vue";
import { resolveAppearance as ne, resolveToolbar as re, createPropsResolver as G, createPageHeaderEventHandlerResolver as ie } from "../dynamic-resolver/index.esm.js";
import ae from "../response-toolbar/index.esm.js";
import { DgControl as $, canvasChanged as le, refreshCanvas as de, UseTemplateDragAndDropRules as ce, useDesignerComponent as ue, FDesignerInnerItem as pe } from "../designer-canvas/index.esm.js";
import fe, { responseToolbarResolver as q } from "../../designer/response-toolbar/index.esm.js";
import { cloneDeep as ge } from "lodash-es";
const L = /* @__PURE__ */ new Map([
["appearance", ne],
["toolbar", re]
]), me = "https://json-schema.org/draft/2020-12/schema", he = "https://farris-design.gitee.io/page-footer.schema.json", be = "page-footer", Ce = "A Farris Input Component", ve = "object", ye = {
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: {}
},
visible: {
description: "",
type: "boolean",
default: !0
},
toolbar: {
description: "",
type: "object",
properties: {
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string",
default: "col-6"
}
}
},
id: {
description: "",
type: "string"
},
type: {
description: "",
type: "string",
default: "response-toolbar"
},
alignment: {
description: "The alignment of Response Toolbar Button.",
type: "string",
default: "right"
},
buttons: {
description: "The items of Response Toolbar.",
type: "array",
default: []
},
visible: {
description: "",
type: "boolean",
default: !0
}
}
}
}, xe = [
"id",
"type"
], K = {
$schema: me,
$id: he,
title: be,
description: Ce,
type: ve,
properties: ye,
required: xe
};
function J(a, e, t) {
return e.appearance = {
class: "f-page-is-footer"
}, e.toolbar = {
id: `${e.id}-toolbar`,
type: "response-toolbar",
buttons: []
}, e;
}
const j = {
/**
* 组件自定义样式
*/
customClass: { type: String, default: "" },
/**
* 是否启用内容区收折
* @default false
*/
enableCollapse: { type: Boolean, default: !1 },
/**
* 是否默认收折内容区
* @default true
*/
collapsed: { type: Boolean, default: !0 },
/**
* 收折按钮文本
* @default 'More'
*/
collapsedText: { type: String, default: "More" },
/**
* 展开按钮文本
* @default 'More'
*/
expandedText: { type: String, default: "More" },
/**
* 内容区域样式
* @default ''
*/
contentClass: { type: String, default: "" },
/**
* 页脚组件样式
* @default ''
*/
headerClass: { type: String, default: "" },
/**
* 上方扩展区域左侧内容区样式
* @default ''
*/
headerContentClass: { type: String, default: "" },
/**
* 上方扩展区域右侧按钮区样式
* @default ''
*/
headerToolbarClass: { type: String, default: "" },
/**
* 是否显示上方扩展区域
* @default false
*/
showHeader: { type: String, default: !1 },
/**
* 按钮组的样式
*/
buttonClass: { type: String, default: "col-6" },
/**
* 按钮组的标识
*/
toolbarId: { type: String, default: "" },
/**
* 按钮组
*/
buttons: { type: Array, default: [] },
/**
* 按钮大小
*/
buttonSize: { type: String, default: "" },
/**
* 控制是否可见
*/
visible: { type: Boolean, default: !0 }
}, Ee = G(j, K, L, J), we = ie(), Q = Object.assign({}, j, {
componentId: { type: String, default: "" }
}), Ie = G(Q, K, L, J), N = /* @__PURE__ */ z({
name: "FPageFooter",
props: j,
emits: ["click"],
setup(a, e) {
const t = b(a.collapsed), s = y(() => a.collapsedText), r = b(a.contentClass), o = y(() => a.enableCollapse), n = y(() => a.expandedText), l = b(a.headerClass), i = b(a.headerContentClass), d = b(a.headerToolbarClass), c = y(() => a.showHeader), g = b(a.customClass), m = b(a.buttons), T = (p, M) => {
e.emit("click", p, M);
};
function w(p) {
p && p.stopImmediatePropagation(), t.value = !t.value;
}
function V() {
return o.value && f("div", {
class: "toolbar--collapse",
onClick: (p) => w(p)
}, [f("span", {
class: "toobar--collapse-text"
}, [t.value ? n.value : s.value]), f("i", {
class: "f-icon toolbar--collapse-icon"
}, null)]);
}
const x = y(() => {
const p = {
"f-toolbar": !0
};
return d.value.split(" ").reduce((v, I) => (v[I] = !0, v), p), p;
});
function P() {
return f("div", {
class: x.value
}, [e.slots.headerToolbar && e.slots.headerToolbar(), !e.slots.headerToolbar && V()]);
}
const R = y(() => {
const p = {
"f-content": !0
};
return i.value.split(" ").reduce((v, I) => (v[I] = !0, v), p), p;
});
function F() {
return f(_, null, [e.slots.headerContent && f("div", {
class: R.value
}, [e.slots.headerContent()]), P()]);
}
const A = y(() => {
const p = {
"f-cmp-footer-header": !0
};
return l.value.split(" ").reduce((v, I) => (v[I] = !0, v), p), p;
});
function k() {
if (a.buttons && a.buttons.length > 0)
return f("div", {
style: " display: flex; align-items: center; justify-content: flex-end; flex-shrink: 0; background: #fff;box-shadow: none;"
}, [f(ae, {
id: a.toolbarId,
customClass: a.buttonClass,
visible: a.buttonsVisible,
items: m.value,
onClick: T,
buttonSize: a.buttonSize
}, null)]);
}
function U() {
return f("header", {
class: A.value
}, [e.slots.header && e.slots.header(), !e.slots.header && F()]);
}
const O = y(() => {
const p = {
"f-cmp-footer": !0,
"f-state-collapse": o.value && t.value,
"f-cmp-footer-accordion": o.value
};
return g.value.split(" ").reduce((v, I) => (v[I] = !0, v), p), p;
}), B = y(() => {
const p = {
"f-cmp-footer-content": !0
};
return r.value.split(" ").reduce((v, I) => (v[I] = !0, v), p), p;
});
return D(() => a.buttons, (p) => {
m.value = p;
}, {
deep: !0
}), () => a.visible ? f("div", {
class: O.value
}, [f("footer", {
class: "f-cmp-footer-container"
}, [c.value && U(), k(), f("div", {
class: B.value
}, [e.slots.default && e.slots.default()])])]) : null;
}
});
function Ve(a) {
const { formSchemaUtils: e, formStateMachineUtils: t } = a;
function s(i, d = "") {
return {
path: d + i.code,
field: i.id,
fullPath: i.code
};
}
function r(i, d = "") {
const c = e.getViewModelById(i);
return c ? c.states.map((g) => s(g, d)) : [];
}
function o(i) {
const d = e.getRootViewModelId(), c = r(i);
if (i === d)
return c;
const g = r(d, "root-component.");
return [...c, ...g];
}
function n(i) {
return i.binding && i.binding.path || i.id || "";
}
function l() {
return t && t.getRenderStates() || [];
}
return { getVariables: o, getControlName: n, getStateMachines: l };
}
class Se {
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, t) => ({
convertFrom: (s, r, o, n) => {
const l = o.getExpressionRuleValue(e, t || r);
return l && l.value || "";
},
convertTo: (s, r, o, n, l) => {
var i;
if (r === "dataPicking" && (o != null && o.target)) {
const d = `${o.target}_dataPicking`;
((i = o.rules) == null ? void 0 : i.some(
(g) => g.id === d && g.value
)) ? s.dictPickingExpressionId = d : delete s.dictPickingExpressionId;
}
n.updateExpression(o);
}
}));
this.formSchemaService = e;
}
getExpressionRule(e, t) {
const s = this.getExpressionData();
if (!s)
return "";
const r = s.find((n) => n.target === e);
if (!r)
return "";
const o = r.rules.find((n) => n.type === t);
return o || "";
}
// 获取上下文表单变量
getContextFormVariables() {
const { module: e } = this.formSchemaService.getFormSchema();
if (!e.viewmodels || e.viewmodels.length === 0)
return [];
const t = this.formSchemaService.getRootViewModelId(), s = this.formSchemaService.getViewModelById(t);
if (!s || !s.states || s.states.length === 0)
return [];
const r = [];
return s.states.filter((o) => o.category === "remote").forEach((o) => {
r.push({
key: o.code,
name: o.name,
description: o.name,
category: o.category
});
}), r;
}
createTreeNode(e, t, s = "label") {
return {
id: e.id,
name: e.name,
bindingPath: e[s],
parents: t,
type: "field"
};
}
buildEntityFieldsTreeData(e = null, t) {
const s = [];
return e == null || e.forEach((r) => {
var l;
const o = this.createTreeNode(r, t);
let n = [];
(l = r.type) != null && l.fields && (n = this.buildEntityFieldsTreeData(r.type.fields, [...t, r.label])), s.push({
data: o,
children: n,
expanded: !0
});
}), s;
}
buildChildEntityTreeData(e = null, t) {
const s = [];
return e == null || e.forEach((r) => {
var i, d;
const o = this.createTreeNode(r, t);
o.type = "entity";
const n = this.buildEntityFieldsTreeData((i = r.type) == null ? void 0 : i.fields, [...t, r.label]), l = this.buildChildEntityTreeData((d = r.type) == null ? void 0 : d.entities, [...t, r.label]);
l != null && l.length && (n == null || n.push(...l)), s.push({
data: o,
children: n || [],
// 空值回退
expanded: !0
});
}), s;
}
getEntitiesTreeData() {
const e = this.formSchemaService.getSchemaEntities();
if (!(e != null && e.length))
return [];
const t = e[0];
if (!(t != null && t.type))
return [];
const s = this.buildEntityFieldsTreeData(t.type.fields, [t.code]), r = this.buildChildEntityTreeData(t.type.entities, [t.code]);
return r != null && r.length && (s == null || s.push(...r)), {
entityCode: t.code,
fields: [{
data: this.createTreeNode(t, [], "code"),
children: s || []
}]
};
}
getEntitiesAndVariables() {
return {
entities: this.getEntitiesTreeData(),
variables: {
session: {
name: "系统变量",
items: this.sessionVariables,
visible: !1
},
forms: {
name: "表单变量",
items: this.getContextFormVariables(),
visible: !0
}
}
};
}
onBeforeOpenExpression(e, t, s) {
const r = s === "Field" ? e.binding.field : e.id, o = this.getExpressionRule(r, t), n = this.getEntitiesAndVariables(), l = {
message: ["validate", "required", "dataPicking"].includes(t) && o ? o.message : "",
...n
};
return o.messageType != null && (l.messageType = o.messageType), l;
}
buildRule(e, t, s, r) {
const { expression: o, message: n, messageType: l } = t, i = {
id: `${e}_${s}`,
type: s,
value: o
};
return (s === "validate" || s === "dataPicking" || s === "required") && (i.message = n), s === "dataPicking" && (i.messageType = l), s === "validate" && r && (i.elementId = r), i;
}
getExpressionData() {
const { expressions: e } = this.formSchemaService.getFormSchema().module;
return e || [];
}
updateExpression(e, t, s, r) {
const o = t === "Field" ? e.binding.field : e.id, n = this.buildRule(o, s, r, e.type === "form-group" ? e.id : "");
let i = this.getExpressionData().find((c) => c.targetType === t && c.target === o);
const d = (c) => c.value.trim() === "";
if (i) {
const c = i.rules.find((g) => g.id === n.id);
if (c)
d(n) ? i.rules = i.rules.filter((g) => g.id !== n.id) : (Object.assign(c, n), r === "validate" && e.type === "form-group" && (c.elementId = e.id));
else {
if (d(n))
return null;
i.rules = i.rules || [], i.rules.push(n);
}
} else {
if (d(n))
return null;
i = {
target: `${o}`,
rules: [n],
targetType: t
};
}
return i;
}
getExpressionEditorOptions(e, t, s, r) {
return s.reduce((o, n) => {
var i, d;
const l = t === "Field" ? (i = e == null ? void 0 : e.binding) == null ? void 0 : i.field : e.id;
return o[n] = {
hide: t === "Field" ? !!((d = e == null ? void 0 : e.binding) != null && d.field) : !1,
description: "",
title: this.expressionNames[n],
type: "string",
$converter: this.getExpressionConverter(l),
refreshPanelAfterChanged: !0,
editor: {
type: "expression-editor",
singleExpand: !1,
dialogTitle: `${this.expressionNames[n]}编辑器`,
showMessage: n === "validate" || n === "dataPicking" || n === "required",
showMessageType: n === "dataPicking",
beforeOpen: () => this.onBeforeOpenExpression(e, n, t),
onSubmitModal: (c) => {
const g = this.updateExpression(e, t, c, n);
if (r) {
const m = this.buildRule(l, c, n);
r(m);
}
return g;
}
}
}, o;
}, {});
}
getExpressionInfo(e, t, s) {
const r = t === "Field" ? e.binding.field : e.id, o = this.getExpressionRule(r, s), n = {
value: o && o.value,
targetId: r,
targetType: t,
expressionType: s
};
return o && o.message && (n.message = o.message), n;
}
getExpressionConfig(e, t, s = ["compute", "dependency", "validate"], r) {
var o;
return {
description: "表达式",
title: "表达式",
hide: !(e.binding && ((o = e.binding) == null ? void 0 : o.type) === "Form"),
properties: {
...this.getExpressionEditorOptions(e, t, s, r)
}
};
}
getExpressionOptions(e, t, s) {
const r = this.getExpressionInfo(e, t, s);
return {
dialogTitle: `${this.expressionNames[s] || "表达式"}编辑器`,
singleExpand: !1,
showMessage: s === "required",
beforeOpen: () => this.onBeforeOpenExpression(e, s, t),
expressionInfo: r
};
}
}
class Te {
constructor(e, t) {
h(this, "componentId");
h(this, "viewModelId");
h(this, "eventsEditorUtils");
h(this, "formSchemaUtils");
h(this, "formMetadataConverter");
h(this, "designViewModelUtils");
h(this, "designViewModelField");
h(this, "controlCreatorUtils");
h(this, "designerHostService");
h(this, "designerContext");
h(this, "modalService", null);
/** 表单规则 */
h(this, "formRule", null);
h(this, "schemaService", null);
h(this, "metadataService", null);
h(this, "propertyConfig", {
type: "object",
categories: {}
});
h(this, "expressionProperty");
var s;
this.componentId = e, this.designerHostService = t, this.eventsEditorUtils = t.eventsEditorUtils, this.formSchemaUtils = t.formSchemaUtils, this.formMetadataConverter = t.formMetadataConverter, this.viewModelId = ((s = this.formSchemaUtils) == null ? void 0 : s.getViewModelIdByComponentId(e)) || "", this.designViewModelUtils = t.designViewModelUtils, this.controlCreatorUtils = t.controlCreatorUtils, this.metadataService = t.metadataService, this.schemaService = t.schemaService, this.designerContext = t.designerContext, this.modalService = t.modalService, this.expressionProperty = new Se(this.formSchemaUtils);
}
/**
* 是否在响应式表单中
*/
inResponsiveForm() {
var e;
return !!((e = this.designerContext) != null && e.responsiveForm);
}
getFormDesignerInstance() {
var e, t;
return (t = (e = this.designerContext) == null ? void 0 : e.instances) == null ? void 0 : t.formDesigner.value;
}
getTableInfo() {
var e;
return (e = this.schemaService) == null ? void 0 : e.getTableInfoByViewModelId(this.viewModelId);
}
setDesignViewModelField(e) {
var s;
const t = e.binding && e.binding.type === "Form" && e.binding.field;
if (t) {
if (!this.designViewModelField) {
const r = this.designViewModelUtils.getDgViewModel(this.viewModelId);
this.designViewModelField = r.fields.find((o) => o.id === t);
}
e.updateOn = (s = this.designViewModelField) == null ? void 0 : s.updateOn;
}
}
getBasicPropConfig(e) {
return {
description: "Basic Information",
title: "基本信息",
properties: {
id: {
description: "组件标识",
title: "标识",
type: "string",
readonly: !0
},
type: {
description: "组件类型",
title: "控件类型",
type: "select",
editor: {
type: "combo-list",
textField: "name",
valueField: "value",
idField: "value",
editable: !1,
data: [{ value: e.type, name: $[e.type] && $[e.type].name }]
}
}
}
};
}
getAppearanceConfig(e = null, t = {}, s) {
const r = {
title: "外观",
description: "Appearance"
}, o = {
class: {
title: "class样式",
type: "string",
description: "组件的CSS样式",
$converter: "/converter/appearance.converter",
parentPropertyID: "appearance"
},
style: {
title: "style样式",
type: "string",
description: "组件的样式",
$converter: "/converter/appearance.converter",
parentPropertyID: "appearance"
}
};
for (const n in t)
o[n] = Object.assign(o[n] || {}, t[n]);
return {
...r,
properties: { ...o },
setPropertyRelates(n, l) {
if (n) {
switch (n && n.propertyID) {
case "class":
case "style": {
le.value++;
break;
}
}
s && s(n, e, l);
}
}
};
}
/**
*
* @param propertyData
* @param propertyTypes
* @param propertyName
* @param constInfos
* @param variableInfos
* @param expressionType 指定表达式类型,存在属性和表达式类型不一致的情况
* @returns
*/
getPropertyEditorParams(e, t = [], s = "visible", r = {}, o = {}, n = "") {
const { getVariables: l, getControlName: i, getStateMachines: d } = Ve(this.designerHostService), c = this.getRealTargetType(e), g = t && t.length > 0 ? t : ["Const", "Variable", "StateMachine", "Expression"], m = {
type: "property-editor",
propertyTypes: g
};
return g.map((T) => {
switch (T) {
case "Const":
Object.assign(m, {
constType: "enum",
constEnums: [{ id: !0, name: "是" }, { id: !1, name: "否" }]
}, r);
break;
case "Expression":
m.expressionConfig = this.getExpressionOptions(e, c, n || s);
break;
case "StateMachine":
m.stateMachines = d();
break;
case "Variable":
Object.assign(m, {
controlName: i(e),
newVariablePrefix: "is",
newVariableType: "Boolean",
variables: l(this.viewModelId),
parentComponentId: this.componentId === "root-component" ? "" : "root-component",
onBeforeOpenVariables: (w) => {
w.value = l(this.viewModelId);
}
}, o), this.designerContext.designerMode === "PC_RTC" && (m.newVariablePrefix = "ext_" + m.newVariablePrefix);
break;
}
}), m;
}
getVisibleProperty(e, t = "") {
var o;
let s = ["Const", "Variable", "StateMachine", "Expression"];
return t === "gridFieldEditor" ? s = ["Const", "Expression"] : t === "form-group" && !((o = e.binding) != null && o.field) ? s = ["Const", "Variable", "StateMachine", "Custom"] : t === "dataGrid" || t === "treeGrid" || t === "wizard" ? s = ["Const", "Variable", "Expression"] : (e.type.indexOf("toolbar-item") > -1 || t === "form-group") && (s = ["Const", "Variable", "StateMachine", "Custom", "Expression"]), {
visible: {
title: "是否可见",
type: "boolean",
description: "运行时组件是否可见",
editor: this.getPropertyEditorParams(e, s, "visible")
}
};
}
/**
* 获取行为
* @param propertyData
* @param viewModelId
* @returns
*/
getBehaviorConfig(e, t = "", s = {}, r) {
const o = {
title: "行为",
description: ""
}, n = this.getVisibleProperty(e, t);
for (const i in s)
n[i] = Object.assign(n[i] || {}, s[i]);
const l = this;
return {
...o,
properties: { ...n },
setPropertyRelates(i, d) {
if (i) {
switch (i.propertyID) {
case "disabled":
case "readonly":
case "visible":
l.afterMutilEditorChanged(e, i);
break;
}
r && r(i, d);
}
}
};
}
/**
* 当多值编辑器变更时
* @param propertyData
* @param changeObject
*/
afterMutilEditorChanged(e, t) {
this.addNewVariableToViewModel(t, this.viewModelId), this.updateExpressionValue(t, e), this.clearExpression(t, e);
}
/**
*
* @param propertyId
* @param componentInstance
* @returns
*/
updateElementByParentContainer(e, t) {
const s = t && t.parent && t.parent.schema;
if (!s)
return;
const r = s.contents.findIndex((n) => n.id === e), o = ge(s.contents[r]);
s.contents.splice(r, 1), s.contents.splice(r, 0, o), de();
}
/**
* 属性编辑器,在编辑过程中会新增变量,此处需要将新增的变量追加到ViewModel中
* @param changeObject
* @param viewModelId
* @returns
*/
addNewVariableToViewModel(e, t) {
const s = e.propertyValue;
if (!(s && typeof s == "object") || !(s.type === "Variable" && s.isNewVariable))
return;
const n = {
id: s.field,
category: "locale",
code: s.fullPath,
name: s.fullPath,
type: s.newVariableType || "String",
isRtcVariable: this.designerContext.designerMode === "PC_RTC" ? !0 : void 0
};
delete s.newVariableType, delete s.isNewVariable, this.formSchemaUtils.getVariableByCode(n.code) || this.formSchemaUtils.getViewModelById("root-viewmodel").states.push(n);
}
getExpressions() {
let e = [];
return this.formRule ? (this.formRule.expressions = this.formRule.expressions || [], e = this.formRule.expressions || []) : e = this.formSchemaUtils.getExpressions(), e;
}
/**
* 更新表达式到expressions节点
* @param changeObject
*/
updateExpressionValue(e, t) {
const s = e.propertyValue;
if (!((s && s.type) === "Expression" && s.expressionInfo))
return;
const { expressionId: n, expressionInfo: l } = s, { targetId: i, targetType: d, expressionType: c, value: g, message: m } = l, T = this.getExpressions();
let w = T.find((x) => x.target === i);
w || (w = { target: i, rules: [], targetType: d }, T.push(w));
const V = w.rules.find((x) => x.type === c);
if (V)
V.id = n, V.value = g, V.message = m, (c === "minDate" || c === "maxDate" || c === "defaultTime") && (V.elementId = t.id);
else {
const x = { id: n, type: c, value: g, message: m, elementId: t.id };
w.rules.push(x);
}
delete s.expressionInfo;
}
/**
* 属性类型切换为非表达式后,清除原表达式
* @param changeObject
* @param propertyData
* @returns
*/
clearExpression(e, t) {
const s = e.propertyValue;
if (s && s.type === "Expression")
return;
const o = e.propertyID, n = this.getExpressions(), l = t.binding ? t.binding.field : t.id, i = n.find((d) => d.target === l);
!i || !i.rules || (i.rules = i.rules.filter((d) => d.type !== o));
}
getExpressionOptions(e, t, s) {
return this.expressionProperty.getExpressionOptions(e, t, s);
}
getRealTargetType(e) {
return ["response-toolbar-item", "tab-toolbar-item", "section-toolbar-item", "drawer-toolbar-item"].indexOf(e.type) > -1 ? "Button" : e.binding && e.binding.field ? "Field" : "Container";
}
createBaseEventProperty(e) {
const t = {};
return t[this.viewModelId] = {
type: "events-editor",
editor: {
initialData: e,
viewSourceHandle: (s) => {
var r;
((r = s.controller) == null ? void 0 : r.label.indexOf(this.formSchemaUtils.getModule().code)) > -1 && this.eventsEditorUtils.jumpToMethod(s);
}
}
}, t;
}
}
class Me extends Te {
constructor(e, t) {
super(e, t);
}
getPropertyConfig(e) {
return this.propertyConfig.categories.basic = this.getBasicPropConfig(e), this.propertyConfig.categories.appearance = this.getAppearanceProperties(e), this.propertyConfig.categories.behavior = this.getBehaviorConfig(e), this.propertyConfig;
}
getAppearanceProperties(e) {
return {
title: "外观",
description: "",
properties: {
class: {
title: "class样式",
type: "string",
description: "组件的CSS样式"
}
}
};
}
}
function Pe(a, e) {
const t = new ce();
function s(i) {
return !1;
}
function r() {
const { canMove: i } = t.getTemplateRule(a, e);
return i;
}
function o() {
const { canDelete: i } = t.getTemplateRule(a, e);
return i;
}
function n() {
return !0;
}
function l(i) {
const d = new Me(i, e), { schema: c } = a;
return d.getPropertyConfig(c);
}
return {
canAccepts: s,
hideNestedPaddingInDesginerView: n,
getPropsConfig: l,
checkCanDeleteComponent: o,
checkCanMoveComponent: r
};
}
const Re = /* @__PURE__ */ z({
name: "FPageFooterDesign",
props: Q,
emits: [],
setup(a, e) {
const t = b(a.collapsed), s = b(a.collapsedText), r = b(a.contentClass), o = b(a.enableCollapse), n = b(a.expandedText), l = b(a.headerClass), i = b(a.headerContentClass), d = b(a.headerToolbarClass), c = b(a.showHeader), g = b(), m = H("design-item-context"), T = H("designer-host-service"), w = Pe(m, T), V = ue(g, m, w), x = b(m.schema.toolbar || {
type: "response-toolbar",
buttons: []
}), P = b(q(x.value));
oe(() => {
g.value.componentInstance = V;
}), e.expose(V.value), D(() => m.schema.toolbar, () => {
x.value = m.schema.toolbar || {
type: "response-toolbar",
buttons: []
}, P.value = q(x.value);
}, {
deep: !0
});
const R = y(() => [...P.value.items]);
function F(u) {
u && u.stopImmediatePropagation(), t.value = !t.value;
}
function A() {
return o.value && f("div", {
class: "toolbar--collapse",
onClick: (u) => F(u)
}, [f("span", {
class: "toobar--collapse-text"
}, [t.value ? n.value : s.value]), f("i", {
class: "f-icon toolbar--collapse-icon"
}, null)]);
}
const k = y(() => {
const u = {
"f-toolbar": !0
};
return d.value.split(" ").reduce((C, E) => (C[E] = !0, C), u), u;
});
function U() {
return f("div", {
class: k.value
}, [e.slots.headerToolbar && e.slots.headerToolbar(), !e.slots.headerToolbar && A()]);
}
const O = y(() => {
const u = {
"f-content": !0
};
return i.value.split(" ").reduce((C, E) => (C[E] = !0, C), u), u;
});
function B() {
return f(_, null, [e.slots.headerContent && f("div", {
class: O.value
}, [e.slots.headerContent()]), U()]);
}
const p = y(() => {
const u = {
"f-cmp-footer-header": !0
};
return l.value.split(" ").reduce((C, E) => (C[E] = !0, C), u), u;
});
function M(u, S) {
u && S && S.split(" ").reduce((E, ee) => (E[ee] = !0, E), u);
}
const v = y(() => {
const u = {
"text-right": !0,
"col-6": !0
};
return M(u, a.buttonClass || ""), u;
});
function I(u, S, C, E) {
m && m.setupContext && m.setupContext.emit("selectionChange", u, S, C, E);
}
function W() {
return f("header", {
class: p.value
}, [e.slots.header && e.slots.header(), !e.slots.header && B()]);
}
const X = y(() => {
const u = {
"f-cmp-footer": !0,
"f-state-collapse": o.value && t.value,
"f-cmp-footer-accordion": o.value
};
return l.value.split(" ").reduce((C, E) => (C[E] = !0, C), u), u;
}), Y = y(() => {
const u = {
"f-cmp-footer-content": !0
};
return r.value.split(" ").reduce((C, E) => (C[E] = !0, C), u), u;
});
function Z() {
return f("div", {
style: " display: flex; align-items: center; justify-content: flex-end; flex-shrink: 0; background: #fff;box-shadow: none;"
}, [f(pe, {
class: v.value,
modelValue: x.value,
"onUpdate:modelValue": (u) => x.value = u,
canAdd: !1,
childType: "response-toolbar-item",
childLabel: "按钮",
contentKey: "buttons",
id: x.value.id,
componentId: a.componentId,
onSelectionChange: I
}, {
default: () => [f(fe, {
id: x.value.id,
customClass: "w-100",
items: R.value,
componentId: a.componentId,
buttonSize: a.buttonSize
}, null)]
})]);
}
return () => f("div", {
ref: g,
class: X.value
}, [f("footer", {
class: "f-cmp-footer-container"
}, [c.value && W(), Z(), f("div", {
class: Y.value
}, [e.slots.default && e.slots.default()])])]);
}
}), je = {
install(a) {
a.component(N.name, N);
},
register(a, e, t, s) {
a["page-footer"] = N, e["page-footer"] = Ee, s["page-footer"] = { eventHandlerResolver: we };
},
registerDesigner(a, e, t) {
a["page-footer"] = Re, e["page-footer"] = Ie;
}
};
export {
N as FPageFooter,
je as default,
we as eventHandlerResolver,
Q as pageFooterDesignerProps,
j as pageFooterProps,
Ie as propsDesignResolver,
Ee as propsResolver
};