@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,554 lines • 448 kB
JavaScript
var ir = Object.defineProperty;
var ar = (n, t, e) => t in n ? ir(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
var A = (n, t, e) => ar(n, typeof t != "symbol" ? t + "" : t, e);
import { ref as S, computed as L, createVNode as I, defineComponent as Xe, watch as Te, onMounted as pt, Fragment as zt, reactive as _t, createApp as Jn, onUnmounted as Zt, Transition as Zn, mergeProps as At, createTextVNode as Ot, onBeforeUnmount as _n, withDirectives as sr, resolveDirective as lr, nextTick as Pt, onBeforeMount as ur, Teleport as cr, shallowRef as dr, render as fn, h as fr, cloneVNode as pr, inject as Ke, provide as Sn, triggerRef as mr, isVNode as hr, getCurrentInstance as vr, withModifiers as gr } from "vue";
import { isPlainObject as Nn, cloneDeep as ft, isUndefined as dt, throttle as yr } from "lodash-es";
import eo from "../response-toolbar/index.esm.js";
import { getCustomClass as rt, useGuid as br, resolveField as at, FormSchemaEntityFieldTypeName as Vn, useCommonUtils as wr, useDateFormat as Cr, useNumberFormat as xr, setFieldValue as hn, withInstall as to } from "../common/index.esm.js";
import { useResizeObserver as no } from "@vueuse/core";
import { useIdentify as _r, useGroupData as Sr, useFilter as Tr, useHierarchy as kr, useLoading as Mr, useDataView as Er, useSelection as Ir, useSelectHierarchyItem as Fr, useDataViewContainerStyle as Or, useCommandColumn as Dr, useColumn as Pr, useSort as Rr, useGroupColumn as Br, useRow as Nr, useEdit as Vr, useVisualDataBound as $r, useVisualDataCell as Lr, useVisualDataRow as jr, useVisualData as Ar, useCellPosition as Hr, useSidebar as Wr, useVirtualScroll as qr, useFitColumn as zr, useFilterHistory as Gr, useColumnFilter as Yr, useDragColumn as Ur, getColumnHeader as Xr, getSidebar as Qr, getDisableMask as Kr, getHorizontalScrollbar as Jr, getVerticalScrollbar as Zr, getEmpty as ei } from "../data-view/index.esm.js";
import "../modal/index.esm.js";
import ti from "../transfer/index.esm.js";
import ni from "../tabs/index.esm.js";
import oi from "../order/index.esm.js";
import "../condition/index.esm.js";
import { FCheckbox as ri } from "../checkbox/index.esm.js";
import ii from "../filter-bar/index.esm.js";
import $n from "../tooltip/index.esm.js";
import ai from "../pagination/index.esm.js";
import si from "../button/index.esm.js";
import li from "../search-box/index.esm.js";
import ui from "../tags/index.esm.js";
import ci, { FDynamicFormGroup as di, FDynamicFormInput as fi } from "../dynamic-form/index.esm.js";
import { createPropsResolver as pi } from "../dynamic-resolver/index.esm.js";
import { useDesignerInnerComponent as mi, useDesignerComponent as hi } from "../designer-canvas/index.esm.js";
import "../property-panel/index.esm.js";
import vi from "../accordion/index.esm.js";
import gi from "../avatar/index.esm.js";
import yi from "../../designer/button-edit/index.esm.js";
import bi from "../button-group/index.esm.js";
import wi from "../calendar/index.esm.js";
import Ci from "../capsule/index.esm.js";
import Ln from "../../designer/checkbox/index.esm.js";
import jn from "../../designer/checkbox-group/index.esm.js";
import vn from "../combo-list/index.esm.js";
import xi from "../combo-tree/index.esm.js";
import _i from "../component/index.esm.js";
import Si from "../color-picker/index.esm.js";
import Ti from "../content-container/index.esm.js";
import ki from "../date-picker/index.esm.js";
import Mi from "../../designer/data-grid/index.esm.js";
import Ei from "../dropdown/index.esm.js";
import Ii from "../events-editor/index.esm.js";
import Fi from "../field-selector/index.esm.js";
import Oi from "../binding-selector/index.esm.js";
import Di from "../image-cropper/index.esm.js";
import Pi from "../../designer/input-group/index.esm.js";
import Ri from "../layout/index.esm.js";
import Bi from "../list-nav/index.esm.js";
import Ni from "../list-view/index.esm.js";
import Vi from "../lookup/index.esm.js";
import $i from "../mapping-editor/index.esm.js";
import Li from "../nav/index.esm.js";
import ji from "../number-range/index.esm.js";
import Ai from "../number-spinner/index.esm.js";
import Hi from "../page-header/index.esm.js";
import Wi from "../page-footer/index.esm.js";
import qi from "../progress/index.esm.js";
import zi from "../query-solution/index.esm.js";
import Gi from "../../designer/radio-group/index.esm.js";
import Yi from "../rate/index.esm.js";
import Ui from "../response-layout/index.esm.js";
import Xi from "../response-layout-editor/index.esm.js";
import Qi from "../section/index.esm.js";
import Ki from "../smoke-detector/index.esm.js";
import Ji from "../splitter/index.esm.js";
import Zi from "../step/index.esm.js";
import ea from "../switch/index.esm.js";
import ta from "../text/index.esm.js";
import na from "../time-picker/index.esm.js";
import oa from "../tree-view/index.esm.js";
import ra from "../uploader/index.esm.js";
import ia from "../verify-detail/index.esm.js";
import aa from "../video/index.esm.js";
import sa from "../textarea/index.esm.js";
import la from "../schema-selector/index.esm.js";
import ua from "../tree-grid/index.esm.js";
import ca from "../event-parameter/index.esm.js";
import da from "../filter-condition-editor/index.esm.js";
import fa from "../fieldset/index.esm.js";
import pa from "../sort-condition-editor/index.esm.js";
import ma from "../menu-lookup/index.esm.js";
import ha from "../drawer/index.esm.js";
import va from "../json-editor/index.esm.js";
import ga from "../property-editor/index.esm.js";
import ya from "../expression-editor/index.esm.js";
import ba from "../code-editor/index.esm.js";
import wa from "../html-template/index.esm.js";
import "../external-container/index.esm.js";
import "../notify/index.esm.js";
const oo = {}, ro = {};
function Tn(n) {
const { properties: t, title: e, ignore: o } = n, r = o && Array.isArray(o), i = Object.keys(t).reduce((a, s) => ((!r || !o.find((l) => l === s)) && (a[s] = t[s].type === "object" && t[s].properties ? Tn(t[s]) : ft(t[s].default)), a), {});
if (e && (!r || !o.find((a) => a === "id"))) {
const a = e.toLowerCase().replace(/-/g, "_");
i.id = `${a}_${Math.random().toString().slice(2, 6)}`;
}
return i;
}
function Ca(n) {
const { properties: t, title: e, required: o } = n;
if (o && Array.isArray(o)) {
const r = o.reduce((i, a) => (i[a] = t[a].type === "object" && t[a].properties ? Tn(t[a]) : ft(t[a].default), i), {});
if (e && o.find((i) => i === "id")) {
const i = e.toLowerCase().replace(/-/g, "_");
r.id = `${i}_${Math.random().toString().slice(2, 6)}`;
}
return r;
}
return {
type: e
};
}
function Ht(n, t = {}, e) {
const o = oo[n];
if (o) {
let r = Ca(o);
const i = ro[n];
return r = i ? i({ getSchemaByType: Ht }, r, t, e) : r, r;
}
return null;
}
function xa(n, t) {
const e = Tn(t);
return Object.keys(e).reduce((o, r) => (Object.prototype.hasOwnProperty.call(n, r) && (o[r] && Nn(o[r]) && Nn(n[r] || !n[r]) ? Object.assign(o[r], n[r] || {}) : o[r] = n[r]), o), e), e;
}
function io(n, t) {
return Object.keys(n).filter((o) => n[o] != null).reduce((o, r) => {
if (t.has(r)) {
const i = t.get(r);
if (typeof i == "string")
o[i] = n[r];
else {
const a = i(r, n[r], n);
Object.assign(o, a);
}
} else
o[r] = n[r];
return o;
}, {});
}
function _a(n, t, e = /* @__PURE__ */ new Map()) {
const o = xa(n, t);
return io(o, e);
}
function Sa(n = {}) {
function t(u, c, d, h) {
if (typeof d == "number")
return h[u].length === d;
if (typeof d == "object") {
const f = Object.keys(d)[0], p = d[f];
if (f === "not")
return Number(h[u].length) !== Number(p);
if (f === "moreThan")
return Number(h[u].length) >= Number(p);
if (f === "lessThan")
return Number(h[u].length) <= Number(p);
}
return !1;
}
function e(u, c, d, h) {
return h[u] && h[u].propertyValue && String(h[u].propertyValue.value) === String(d);
}
const o = /* @__PURE__ */ new Map([
["length", t],
["getProperty", e]
]);
Object.keys(n).reduce((u, c) => (u.set(c, n[c]), u), o);
function r(u, c) {
const d = u;
return typeof c == "number" ? [{ target: d, operator: "length", param: null, value: Number(c) }] : typeof c == "boolean" ? [{ target: d, operator: "getProperty", param: u, value: !!c }] : typeof c == "object" ? Object.keys(c).map((h) => {
if (h === "length")
return { target: d, operator: "length", param: null, value: c[h] };
const f = h, p = c[h];
return { target: d, operator: "getProperty", param: f, value: p };
}) : [];
}
function i(u) {
return Object.keys(u).reduce((d, h) => {
const f = r(h, u[h]);
return d.push(...f), d;
}, []);
}
function a(u, c) {
if (o.has(u.operator)) {
const d = o.get(u.operator);
return d && d(u.target, u.param, u.value, c) || !1;
}
return !1;
}
function s(u, c) {
return i(u).reduce((f, p) => f && a(p, c), !0);
}
function l(u, c) {
const d = Object.keys(u), h = d.includes("allOf"), f = d.includes("anyOf"), p = h || f, v = (p ? u[p ? h ? "allOf" : "anyOf" : "allOf"] : [u]).map((b) => s(b, c));
return h ? !v.includes(!1) : v.includes(!0);
}
return { parseValueSchema: l };
}
const ie = {
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: "列表导航" },
"filter-bar": { type: "filter-bar", name: "筛选条" }
}, Ta = {}, ka = {};
Sa();
function bt(n, t, e = /* @__PURE__ */ new Map(), o = (a, s, l, u) => s, r = {}, i = (a) => a) {
return oo[t.title] = t, ro[t.title] = o, Ta[t.title] = r, ka[t.title] = i, (a = {}, s = !0) => {
if (!s)
return io(a, e);
const l = _a(a, t, e), u = Object.keys(n).reduce((c, d) => (c[d] = n[d].default, c), {});
return Object.assign(u, l);
};
}
function en(n, t) {
return { customClass: t.class, customStyle: t.style };
}
function Ma() {
function n(t, e) {
const { dataSource: o } = t || {};
return o === void 0 ? {} : {};
}
return {
resolve: n
};
}
function Ea() {
function n(t, e) {
return t.selectItemById(e);
}
return {
selectItemById: n
};
}
function Ia(n, t) {
if (!n || n.length < 1)
return null;
for (const e of n) {
if (e.id === t)
return e;
if (e.children) {
const o = e.children.find((r) => r.id === t);
if (o)
return o;
}
}
return null;
}
function Fa() {
function n(t, e) {
var s;
const o = (s = t.toolbar) == null ? void 0 : s.buttons;
if (!o || o.length < 1)
return null;
const [r, i] = e.payloads, a = Ia(o, i);
return a ? a.onClick || a.click : null;
}
return {
resolve: n
};
}
function Oa() {
function n(t, e) {
const { columns: o } = e;
return t.updateColumns(o);
}
return {
updateColumns: n
};
}
function Da(n, t, e) {
return t ? { enableAccordion: e.accordionMode } : { enableAccordion: "" };
}
function Pa(n, t) {
return {
buttons: t.buttons,
buttonPosition: t.position
};
}
const Ra = /* @__PURE__ */ new Map([
["appearance", en],
["expanded", "expandStatus"],
["enableAccordion", Da],
["toolbar", Pa]
]);
function Ba(n, t, e) {
const o = Math.random().toString().slice(2, 6), r = e.parentComponentInstance;
Object.assign(t, {
id: `section-${o}`,
appearance: {
class: "f-section-in-mainsubcard"
},
mainTitle: e.mainTitle || t.mainTitle || "标题"
});
const i = n.getSchemaByType("content-container");
Object.assign(i, {
id: `container-${o}`,
appearance: {
class: "f-struct-wrapper"
},
contents: [t]
});
const a = r.schema;
switch (a && a.type) {
case ie["splitter-pane"].type: {
t.appearance.class = "f-section-in-main";
break;
}
}
const s = r.elementRef, l = window.getComputedStyle(s);
return l && l.display === "flex" && (i.appearance.class += " d-block"), i;
}
function Na(n, t, e) {
return e.parentComponentInstance ? Ba(n, t, e) : t;
}
const Va = "https://json-schema.org/draft/2020-12/schema", $a = "https://farris-design.gitee.io/section.schema.json", La = "section", ja = "A Farris Container Component", Aa = "object", Ha = {
id: {
description: "The unique identifier for a Section",
type: "string"
},
type: {
description: "The type string of Section component",
type: "string",
default: "section"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string"
},
style: {
type: "string"
}
},
default: {}
},
contentClass: {
description: "",
type: "string",
default: ""
},
contents: {
description: "",
type: "array",
default: []
},
enableAccordion: {
description: "",
type: "string",
default: ""
},
accordionMode: {
description: "",
type: "string",
default: "default"
},
enableMaximize: {
description: "",
type: "boolean",
default: !1
},
expanded: {
description: "",
type: "boolean",
default: !0
},
fill: {
description: "",
type: "boolean",
default: !1
},
headerClass: {
description: "",
type: "string",
default: ""
},
size: {
description: "",
type: "object",
properties: {
width: {
type: "number"
},
height: {
type: "number"
}
},
default: null
},
showHeader: {
description: "",
type: "string",
default: !0
},
mainTitle: {
description: "",
type: "string",
default: ""
},
subTitle: {
description: "",
type: "string",
default: ""
},
headerContentClass: {
description: "",
type: "string",
default: ""
},
extendClass: {
description: "",
type: "string",
default: ""
},
visible: {
description: "",
type: "boolean",
default: !0
},
expandStatus: {
description: "",
type: "boolean",
default: !0
},
toolbar: {
description: "",
type: "object",
properties: {
type: {
type: "string",
default: "section-toolbar"
},
position: {
type: "string",
default: "inHead"
},
buttons: {
type: "array",
default: []
}
},
default: null
}
}, Wa = [
"id",
"type",
"contents"
], qa = {
$schema: Va,
$id: $a,
title: La,
description: ja,
type: Aa,
properties: Ha,
required: Wa
}, kn = {
/** 设置内容区域样式 */
contentClass: { type: String, default: "" },
/** 自定义样式 */
customClass: { type: String, default: "" },
customStyle: { type: String, default: "" },
/** 设置是否启用収折功能。支持:空字符串,不启用収折 | default 默认収折方式 || custom自定义収折方式 */
enableAccordion: { type: String, default: "" },
/** 设置初始是否处于展开状态,支持:true 内容区域被展开|false 内容区域被収折 */
expandStatus: { type: Boolean, default: !0 },
/** 设置Section的主标题 */
mainTitle: { type: String, default: "" },
/** 设置是否显示头部区域 */
showHeader: { type: Boolean, default: !0 },
/** 设置Section的副标题 */
subTitle: { type: String, default: "" },
/** 展开文本 */
expandLabel: { type: String, default: "展开" },
/** 收起文本 */
collapseLabel: { type: String, default: "收起" },
/** 头部区域的自定义样式。配置头部自定义模板后,此属性有效。 */
headerClass: { type: String, default: "" },
/** 设置是否启用最大化 */
enableMaximize: { type: Boolean, default: !1 },
/** 头部扩展区域的自定义样式。配置头部扩展区域模板后,此属性有效。 */
headerContentClass: { type: String, default: "" },
/** 扩展区域的自定义样式。配置扩展区域模板后,此属性有效。 */
extendClass: { type: String, default: "" },
/** 按钮组 */
buttons: { type: Array, default: [] },
/** 按钮组的位置,inHead:头部区域| inContent:内容区域 */
buttonPosition: { type: String, default: "inHead" },
/** 设置是否铺满剩余空间,支持:false按照内容自动高度|true 铺满剩余空间 */
fill: { type: Boolean, default: !1 },
/** 控制是否可见 */
visible: { type: Boolean, default: !0 }
// 暂未使用该属性
// clickThrottleTime: { type: Number, default: 350 },
// context: { type: Object },
// 暂未使用该属性
// index: { type: Number },
// maxStatus: { type: Boolean, default: false },
// showToolbarMoreButton: { type: Boolean, default: true },
// 暂未使用该属性
// toolbarPosition: { type: String, default: '' },
// toolbarButtons: { type: Array<object>, default: [] },
// toolbar: { type: Object as PropType<ToolbarConfig>, default: {} }
}, ao = bt(kn, qa, Ra, Na), za = Fa(), Ga = Object.assign({}, kn, { componentId: { type: String, default: "" } });
function so(n, t, e) {
let o;
function r(l = 1) {
const u = [
"body>.f-datagrid-settings-simple-host",
"body>div",
"body>farris-dialog>.farris-modal.show",
"body>.farris-modal.show",
"body>farris-filter-panel>.f-filter-panel-wrapper",
"body .f-sidebar-show>.f-sidebar-main",
"body>.popover.show",
"body>filter-row-panel>.f-datagrid-filter-panel",
"body>.f-section-maximize"
], c = Array.from(document.body.querySelectorAll(u.join(","))).filter((h) => h).map((h) => {
const { display: f, zIndex: p } = window.getComputedStyle(h);
return f === "none" ? 0 : parseInt(p, 10);
}).filter((h) => h);
let d = Math.max(...c);
return d < 1040 && (d = 1040), d + l;
}
function i() {
o = n.value.nextElementSibling;
const l = document && document.querySelector("body");
l && (l.appendChild(n.value), n.value.style.zIndex = r());
}
function a() {
o ? t.value.insertBefore(
n.value,
o
) : t.value.appendChild(n.value), n.value.style.zIndex = null;
}
function s() {
!n || !t.value || (e.value = !e.value, e.value ? i() : a());
}
return { onClickMaxMinIcon: s };
}
function lo(n, t) {
const e = S(n.buttons), o = L(() => n.buttonPosition === "inHead" ? "right" : "left"), r = L(() => "f-section-toolbar" + (n.buttonPosition === "inHead" ? " f-section-header--toolbar" : " f-section-content--toolbar")), i = L(() => n.buttons && n.buttons.length > 0 && n.buttonPosition === "inHead");
function a(s, l) {
t.emit("click", s, l);
}
return () => i.value && I(eo, {
customClass: r.value,
items: e.value,
onClick: a,
alignment: o.value
}, null);
}
function Ya(n, t, e, o, r, i) {
const a = L(() => n.buttonPosition), s = lo(n, t), {
onClickMaxMinIcon: l
} = so(o, r, i), u = L(() => n.enableMaximize), c = L(() => n.enableAccordion !== ""), d = L(() => {
const g = {
"f-section-header": !0
};
return t.slots.header && n.headerClass.split(" ").reduce((_, E) => (_[E] = !0, _), g), g;
});
function h(g) {
g.stopPropagation(), n.enableAccordion !== "" && (e.value = !e.value);
}
function f() {
const g = L(() => ({
btn: !0,
"f-btn-collapse-expand": !0,
"f-btn-mx": !0,
"f-state-expand": e.value
})), b = L(() => ({
"f-icon": !0,
"f-icon-maximize": !i.value,
"f-icon-minimize": i.value
}));
return I("div", {
class: "f-max-accordion"
}, [u.value ? I("span", {
class: b.value,
onClick: l
}, null) : "", c.value ? I("button", {
class: g.value,
onClick: h
}, [I("span", null, [e.value ? n.collapseLabel : n.expandLabel])]) : ""]);
}
function p() {
return t.slots.header ? I("div", {
class: d.value
}, [t.slots.header()]) : "";
}
function T() {
return I("div", {
class: "f-title"
}, [I("h4", {
class: "f-title-text"
}, [n.mainTitle]), n.subTitle && I("span", null, [n.subTitle])]);
}
function w() {
const g = L(() => {
const b = {
"f-content": !0
};
return n.headerContentClass && n.headerContentClass.split(" ").reduce((E, F) => (E[F] = !0, E), b), b;
});
return t.slots.headerContent ? I("div", {
class: g.value
}, [t.slots.headerContent()]) : "";
}
function v() {
return I("div", {
class: d.value
}, [t.slots.headerTitle ? t.slots.headerTitle() : T(), w(), a.value === "inHead" && s(), (u.value || c.value) && f()]);
}
return () => n.showHeader && (t.slots.header ? p() : v());
}
const an = /* @__PURE__ */ Xe({
name: "FSection",
props: kn,
emits: ["click"],
setup(n, t) {
const e = S(), o = S(), r = S(n.customClass), i = L(() => n.enableAccordion), a = S(n.expandStatus), s = L(() => n.buttonPosition), l = S(!1), u = Ya(n, t, a, e, o, l), c = lo(n, t), d = L(() => {
const w = {
"f-section": !0,
"f-section-accordion": i.value === "default",
"f-state-collapse": (i.value === "default" || i.value === "custom") && !a.value,
"f-section-custom-accordion": i.value === "custom",
"f-section-fill": n.fill,
"f-section-maximize": l.value
};
return rt(w, r.value);
}), h = L(() => rt({
"f-section-content": !0
}, n.contentClass)), f = L(() => rt({
"f-section-extend": !0
}, f.value));
function p() {
return t.slots.extend && I("div", {
class: f.value
}, [t.slots.extend()]);
}
function T() {
return I("div", {
class: h.value
}, [s.value === "inContent" && c(), t.slots.default && t.slots.default()]);
}
return Te(() => n.expandStatus, (w, v) => {
w !== v && (a.value = w);
}), pt(() => {
e.value && e.value && (o.value = e.value.parentElement);
}), () => n.visible ? I("div", {
class: d.value,
ref: e,
style: n.customStyle
}, [u(), p(), T()]) : null;
}
});
function Ua() {
function n(t, e) {
var a;
if (!t)
return !1;
const o = ((a = t.targetContainer) == null ? void 0 : a.componentInstance) && t.targetContainer.componentInstance.value;
if (!o)
return !1;
const r = o.schema.type, i = e == null ? void 0 : e.formSchemaUtils.getComponentById(o.belongedComponentId);
return !((t.componentCategory === "input" || t.componentType === "form-group") && ![ie["response-layout-item"].type, ie["response-form"].type, ie.fieldset.type].includes(r) || (t.componentType === ie.tabs.type || t.componentType === ie.section.type) && ((i == null ? void 0 : i.componentType) !== "frame" || ![ie["content-container"].type, ie["splitter-pane"].type, ie["response-layout-item"].type].includes(r)) || t.componentType === ie["query-solution"].type || t.componentType === ie.fieldset.type && r !== ie["response-form"].type);
}
return {
basalDragulaRuleForContainer: n
};
}
const St = S(0);
function Xa(n, t) {
const e = t.getBoundingClientRect(), o = n.getBoundingClientRect(), r = o.top >= e.top, i = o.top <= e.bottom;
return r && i;
}
function Mn(n) {
const t = n.querySelector(".component-btn-group");
if (!t)
return;
t.style.display = "";
const e = t.getBoundingClientRect();
if (!(e.top === 0 && e.left === 0)) {
const o = t.querySelector("div");
if (o) {
const r = o.getBoundingClientRect();
o.style.top = e.top + "px";
let i = e.left - r.width;
const a = document.querySelector(".editorDiv");
if (a) {
const s = a.getBoundingClientRect();
i < s.left && ({ left: i } = n.getBoundingClientRect());
}
o.style.left = i + "px";
}
}
}
function Qa(n) {
if (!window.scrollContainerList)
return;
const t = Array.from(window.scrollContainerList);
if (t.length && t.length === 1) {
const e = t[0], o = document.querySelector(`[id=${e}]`);
if (o && o.contains(n))
return o;
}
}
function En(n) {
if (!n)
return;
const t = n.getBoundingClientRect();
if (t.width === 0 && t.height === 0)
return;
const e = n.querySelector(".component-btn-group");
if (e) {
let o = !0;
const r = Qa(n);
if (r && (o = Xa(n, r)), !o) {
e.style.display = "none";
return;
}
Mn(n);
}
}
function uo(n) {
if (!n)
return;
let t;
n.className.includes("dgComponentSelected") ? t = n : t = n.querySelector(".dgComponentSelected"), t && En(t);
}
function Ka(n) {
const t = document.querySelector(".dgComponentSelected");
if (!t)
return;
const e = t.getBoundingClientRect(), o = n.getBoundingClientRect(), r = t.querySelector(".component-btn-group");
if (r) {
const i = r.getBoundingClientRect(), a = o.top < e.top;
i.top !== 0 && a && Mn(t);
}
}
const Ja = S(0);
function Za() {
Ja.value++;
}
function es(n) {
const { formSchemaUtils: t, formStateMachineUtils: e } = n;
function o(l, u = "") {
return {
path: u + l.code,
field: l.id,
fullPath: l.code
};
}
function r(l, u = "") {
return t.getViewModelById(l).states.map((d) => o(d, u));
}
function i(l) {
const u = t.getRootViewModelId(), c = r(l);
if (l === u)
return c;
const d = r(u, "root-component.");
return [...c, ...d];
}
function a(l) {
return l.binding && l.binding.path || l.id || "";
}
function s() {
return e && e.getRenderStates() || [];
}
return { getVariables: i, getControlName: a, getStateMachines: s };
}
class ts {
constructor(t) {
A(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'"
}
]);
A(this, "expressionNames", {
compute: "计算表达式",
dependency: "依赖表达式",
validate: "验证表达式",
dataPicking: "帮助前表达式",
visible: "可见表达式",
readonly: "只读表达式",
required: "必填表达式"
});
A(this, "getExpressionConverter", (t, e) => ({
convertFrom: (o, r, i, a) => {
const s = i.getExpressionRuleValue(t, e || r);
return s && s.value || "";
},
convertTo: (o, r, i, a, s) => {
var l;
if (r === "dataPicking" && (i != null && i.target)) {
const u = `${i.target}_dataPicking`;
((l = i.rules) == null ? void 0 : l.some(
(d) => d.id === u && d.value
)) ? o.dictPickingExpressionId = u : delete o.dictPickingExpressionId;
}
a.updateExpression(i);
}
}));
this.formSchemaService = t;
}
getExpressionRule(t, e) {
const o = this.formSchemaService.getExpressions();
if (!o)
return "";
const r = o.find((a) => a.target === t);
if (!r)
return "";
const i = r.rules.find((a) => a.type === e);
return i || "";
}
// 获取上下文表单变量
getContextFormVariables() {
const { module: t } = this.formSchemaService.getFormSchema();
if (!t.viewmodels || t.viewmodels.length === 0)
return [];
const e = this.formSchemaService.getRootViewModelId(), o = this.formSchemaService.getViewModelById(e);
if (!o || !o.states || o.states.length === 0)
return [];
const r = [];
return o.states.forEach((i) => {
r.push({
key: i.code,
name: i.name,
description: i.name,
category: i.category
});
}), r;
}
createTreeNode(t, e, o = "label") {
return {
id: t.id,
name: t.name,
bindingPath: t[o],
parents: e
};
}
buildEntityFieldsTreeData(t = null, e) {
const o = [];
return t == null || t.forEach((r) => {
var s;
const i = this.createTreeNode(r, e);
let a = [];
(s = r.type) != null && s.fields && (a = this.buildEntityFieldsTreeData(r.type.fields, [...e, r.label])), o.push({
data: i,
children: a,
expanded: !0
});
}), o;
}
buildChildEntityTreeData(t = null, e) {
const o = [];
return t == null || t.forEach((r) => {
var l, u;
const i = this.createTreeNode(r, e), a = this.buildEntityFieldsTreeData((l = r.type) == null ? void 0 : l.fields, [...e, r.label]), s = this.buildChildEntityTreeData((u = r.type) == null ? void 0 : u.entities, [...e, r.label]);
s != null && s.length && (a == null || a.push(...s)), o.push({
data: i,
children: a || [],
// 空值回退
expanded: !0
});
}), o;
}
getEntitiesTreeData() {
const t = this.formSchemaService.getSchemaEntities();
if (!(t != null && t.length))
return [];
const e = t[0];
if (!(e != null && e.type))
return [];
const o = this.buildEntityFieldsTreeData(e.type.fields, [e.code]), r = this.buildChildEntityTreeData(e.type.entities, [e.code]);
return r != null && r.length && (o == null || o.push(...r)), {
entityCode: e.code,
fields: [{
data: this.createTreeNode(e, [], "code"),
children: o || []
}]
};
}
getEntitiesAndVariables() {
return {
entities: this.getEntitiesTreeData(),
variables: {
session: {
name: "系统变量",
items: this.sessionVariables,
visible: !1
},
forms: {
name: "表单变量",
items: this.getContextFormVariables(),
visible: !0
}
}
};
}
onBeforeOpenExpression(t, e, o) {
const r = o === "Field" ? t.binding.field : t.id, i = this.getExpressionRule(r, e), a = this.getEntitiesAndVariables(), s = {
message: ["validate", "required", "dataPicking"].includes(e) && i ? i.message : "",
...a
};
return i.messageType != null && (s.messageType = i.messageType), s;
}
buildRule(t, e, o, r) {
const { expression: i, message: a, messageType: s } = e, l = {
id: `${t}_${o}`,
type: o,
value: i
};
return (o === "validate" || o === "dataPicking" || o === "required") && (l.message = a), o === "dataPicking" && (l.messageType = s), o === "validate" && r && (l.elementId = r), l;
}
getExpressionData() {
const { expressions: t } = this.formSchemaService.getFormSchema().module;
return t || [];
}
updateExpression(t, e, o, r) {
const i = e === "Field" ? t.binding.field : t.id, a = this.buildRule(i, o, r, t.type === "form-group" ? t.id : "");
let l = this.getExpressionData().find((c) => c.targetType === e && c.target === i);
const u = (c) => c.value.trim() === "";
if (l) {
const c = l.rules.find((d) => d.id === a.id);
if (c)
u(a) ? l.rules = l.rules.filter((d) => d.id !== a.id) : (Object.assign(c, a), r === "validate" && t.type === "form-group" && (c.elementId = t.id));
else {
if (u(a))
return null;
l.rules = l.rules || [], l.rules.push(a);
}
} else {
if (u(a))
return null;
l = {
target: `${i}`,
rules: [a],
targetType: e
};
}
return l;
}
getExpressionEditorOptions(t, e, o, r) {
return o.reduce((i, a) => {
var l, u;
const s = e === "Field" ? (l = t == null ? void 0 : t.binding) == null ? void 0 : l.field : t.id;
return i[a] = {
hide: e === "Field" ? !!((u = t == null ? void 0 : t.binding) != null && u.field) : !1,
description: "",
title: this.expressionNames[a],
type: "string",
$converter: this.getExpressionConverter(s),
editor: {
type: "expression-editor",
singleExpand: !1,
dialogTitle: `${this.expressionNames[a]}编辑器`,
showMessage: a === "validate" || a === "dataPicking" || a === "required",
showMessageType: a === "dataPicking",
beforeOpen: () => this.onBeforeOpenExpression(t, a, e),
onSubmitModal: (c) => {
const d = this.updateExpression(t, e, c, a);
if (r) {
const h = this.buildRule(s, c, a);
r(h);
}
return d;
}
}
}, i;
}, {});
}
getExpressionInfo(t, e, o) {
const r = e === "Field" ? t.binding.field : t.id, i = this.getExpressionRule(r, o), a = {
value: i && i.value,
targetId: r,
targetType: e,
expressionType: o
};
return i && i.message && (a.message = i.message), a;
}
getExpressionConfig(t, e, o = ["compute", "dependency", "validate"], r) {
return {
description: "表达式",
title: "表达式",
properties: {
...this.getExpressionEditorOptions(t, e, o, r)
}
};
}
getExpressionOptions(t, e, o) {
const r = this.getExpressionInfo(t, e, o);
return {
dialogTitle: `${this.expressionNames[o]}编辑器`,
singleExpand: !1,
showMessage: o === "required",
beforeOpen: () => this.onBeforeOpenExpression(t, o, e),
expressionInfo: r
};
}
}
class tn {
constructor(t, e) {
A(this, "componentId");
A(this, "viewModelId");
A(this, "eventsEditorUtils");
A(this, "formSchemaUtils");
A(this, "formMetadataConverter");
A(this, "designViewModelUtils");
A(this, "designViewModelField");
A(this, "controlCreatorUtils");
A(this, "designerHostService");
A(this, "schemaService", null);
A(this, "metadataService", null);
A(this, "propertyConfig", {
type: "object",
categories: {}
});
var o;
this.componentId = t, this.designerHostService = e, this.eventsEditorUtils = e.eventsEditorUtils, this.formSchemaUtils = e.formSchemaUtils, this.formMetadataConverter = e.formMetadataConverter, this.viewModelId = ((o = this.formSchemaUtils) == null ? void 0 : o.getViewModelIdByComponentId(t)) || "", this.designViewModelUtils = e.designViewModelUtils, this.controlCreatorUtils = e.controlCreatorUtils, this.metadataService = e.metadataService, this.schemaService = e.schemaService;
}
getTableInfo() {
var t;
return (t = this.schemaService) == null ? void 0 : t.getTableInfoByViewModelId(this.viewModelId);
}
setDesignViewModelField(t) {
var o;
const e = t.binding && t.binding.type === "Form" && t.binding.field;
if (e) {
if (!this.designViewModelField) {
const r = this.designViewModelUtils.getDgViewModel(this.viewModelId);
this.designViewModelField = r.fields.find((i) => i.id === e);
}
t.updateOn = (o = this.designViewModelField) == null ? void 0 : o.updateOn;
}
}
getBasicPropConfig(t) {
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: t.type, name: ie[t.type].name }]
}
}
}
};
}
getAppearanceConfig(t = null, e = {}, o) {
const r = {
title: "外观",
description: "Appearance"
}, i = {
class: {
title: "class样式",
type: "string",
description: "组件的CSS样式",
$converter: "/converter/appearance.converter"
},
style: {
title: "style样式",
type: "string",
description: "组件的样式",
$converter: "/converter/appearance.converter"
}
};
for (const a in e)
i[a] = Object.assign(i[a] || {}, e[a]);
return {
...r,
properties: { ...i },
setPropertyRelates(a, s) {
if (a) {
switch (a && a.propertyID) {
case "class":
case "style": {
St.value++;
break;
}
}
o && o(a, t, s);
}
}
};
}
getPropertyEditorParams(t, e = [], o = "visible", r = {}, i = {}) {
const { getVariables: a, getControlName: s, getStateMachines: l } = es(this.designerHostService), u = this.getRealTargetType(t), c = e && e.length > 0 ? e : ["Const", "Variable", "StateMachine", "Expression"], d = {
type: "property-editor",
propertyTypes: c
};
return c.map((h) => {
switch (h) {
case "Const":
Object.assign(d, {
constType: "enum",
constEnums: [{ id: !0, name: "是" }, { id: !1, name: "否" }]
}, r);
break;
case "Expression":
d.expressionConfig = this.getExpressionOptions(t, u, o);
break;
case "StateMachine":
d.stateMachines = l();
break;
case "Variable":
Object.assign(d, {
controlName: s(t),
newVariablePrefix: "is",
newVariableType: "Boolean",
variables: a(this.viewModelId),
onBeforeOpenVariables: (f) => {
f.value = a(this.viewModelId);
}
}, i);
break;
}
}), d;
}
getVisibleProperty(t, e = "") {
return {
visible: {
title: "是否可见",
type: "boolean",
description: "运行时组件是否可见",
editor: this.getPropertyEditorParams(t, e === "gridFieldEditor" ? ["Const", "Expression"] : ["Const", "Variable", "StateMachine", "Expression"], "visible")
}
};
}
/**
* 获取行为
* @param propertyData
* @param viewModelId
* @returns
*/
getBehaviorConfig(t, e = "", o = {}, r) {
const i = {
title: "行为",
description: ""
}, a = this.getVisibleProperty(t, e);
for (const l in o)
a[l] = Object.assign(a[l] || {}, o[l]);
const s = this;
return {
...i,
properties: { ...a },
setPropertyRelates(l, u) {
if (l) {
switch (l.propertyID) {
case "disabled":
case "readonly":
case "visible":
s.afterMutilEditorChanged(t, l);
break;
}
r && r(l, u);
}
}
};
}
/**
* 当多值编辑器变更时
* @param propertyData
* @param changeObject
*/
afterMutilEditorChanged(t, e) {
this.addNewVariableToViewModel(e, this.viewModelId), this.updateExpressionValue(e), this.clearExpression(e, t);
}
/**
*
* @param propertyId
* @param componentInstance
* @returns
*/
updateElementByParentContainer(t, e) {
const o = e && e.parent && e.parent.schema;
if (!o)
return;
const r = o.contents.findIndex((a) => a.id === t), i = ft(o.contents[r]);
o.contents.splice(r, 1), o.contents.splice(r, 0, i), Za();
}
/**
* 属性编辑器,在编辑过程中会新增变量,此处需要将新增的变量追加到ViewModel中
* @param changeObject
* @param viewModelId
* @returns
*/
addNewVariableToViewModel(t, e) {
const o = t.propertyValue;
if (!(o && typeof o == "object") || !(o.type === "Variable" && o.isNewVariable))
return;
const a = {
id: o.field,
category: "locale",
code: o.fullPath,
name: o.fullPath,
type: o.newVariableType || "String"
};
delete o.newVariableType, delete o.isNewVariable, this.formSchemaUtils.getVariableByCode(a.code) || this.formSchemaUtils.getViewModelById(e).states.push(a);
}
/**
* 更新表达式到expressions节点
* @param changeObject
*/
updateExpressionValue(t) {
const e = t.propertyValue;
if (!((e && e.type) === "Expression" && e.expressionInfo))
return;
const { expressionId: i, expressionInfo: a } = e, { targetId: s, targetType: l, expressionType: u, value: c, message: d } = a, h = this.formSchemaUtils.getModule();
h.expressions ?? (h.expressions = []);
const { expressions: f } = h;
let p = f.find((w) => w.target === s);
p || (p = { target: s, rules: [], targetType: l }, f.push(p));
const T = p.rules.find((w) => w.type === u);
if (T)
T.value = c, T.message = d;
else {
const w = { id: i, type: u, value: c, message: d };
p.rules.push(w);
}
delete e.expressionInfo;
}
/**
* 属性类型切换为非表达式后,清除原表达式
* @param changeObject
* @param propertyData
* @returns
*/
clearExpression(t, e) {
const o = t.propertyValue;
if (o && o.type === "Expression")
return;
const i = t.propertyID, a = this.formSchemaUtils.getExpressions(), s = e.binding ? e.binding.field : e.id, l = a.find((u) => u.target === s);
!l || !l.rules || (l.rules = l.rules.filter((u) => u.type !== i));
}
getExpressionOptions(t, e, o) {
return new ts(this.formSchemaUtils).getExpressionOptions(t, e, o);
}
getRealTargetType(t) {
return ["response-toolbar-item", "tab-toolbar-item", "section-toolbar-item"].indexOf(t.type) > -1 ? "Button" : t.binding && t.binding.field ? "Field" : "Container";
}
}
class ns extends tn {
constructor(t, e) {
super(t, e);
}
getPropertyConfig(t) {
const e = this.getBasicPropConfig(t), o = this.getAppearanceProperties(t), r = this.getBehaviorConfig(t, ""), i = this.getExtendConfig(t);
return this.propertyConfig.categories = {
basic: e,
appearance: o,
behavior: r,
extend: i
}, this.propertyConfig;
}
getAppearanceProperties(t) {
return {
title: "外观",
description: "Appearance",
properties: {
class: {
description: "组件的CSS样式",
title: "class样式"
},
style: {
description: "组件的内容样式",
title: "style样式"
},
fill: {
title: "填充内容区域",
type: "boolean",
description: ""
},
showHeader: {
title: "显示标题区域",
type: "boolean",
description: ""
},
mainTitle: {
title: "主标题",
type: "string",
description: "",
visible: {
showHeader: !0
}
},
subTitle: {
title: "副标题",
type: "string",
description: "",
visible: {
showHeader: !0
}
},
enableAccordion: {
title: "面板收折",
type: "enum",
description: "是否启用分组面板的收折特性",
editor: {
type: "combo-list",
textField: "value",
valueField: "key",
idField: "key",
editable: !1,
data: [
{
key: "",
value: "不启用"
},
{
key: "default",
value: "启用默认收折"
}
]
},
// visible: {
// showHeader: true // 属性面板上此属性不受showHeader限制,是因为expandStatus不受showHeader限制
// },
refreshPanelAfterChanged: !0
},
expandStatus: {
title: "默认状态",
type: "boolean",
description: "默认面板是展开还是收起",
editor: {
type: "combo-list",
textField: "name",
valueField: "value",
data: [{
name: "展开",
value: !0
}, {
name: "收起",
value: !1
}],
enableClear: !1
},
visible: t.enableAccordion === "default"
}
},
setPropertyRelates(e, o) {
if (e)
switch (e && e.propertyID) {
case "mainTitle": {
e.needRefreshControlTree = !0;
break;
}
case "showHeader": {
const r = document.getElementsByClassName("dgComponentFocused");
Array.from(r).forEach((i) => i.classList.remove("dgComponentFocused")), St.value++;
break;
}
}
}
};
}
getExtendConfig(t) {
return {
title: "扩展",
description: "",
properties: {
contentClass: {
title: "内容区域样式",
type: "string",
description: ""
}
}
};
}
}
class os {
getTemplateRule(t, e) {
const o = e == null ? void 0 : e.formSchemaUtils, r = o == null ? void 0 : o.getFormTemplateRule(), i = { canAccept: !0, canDelete: !0, canMove: !0 };
if (!r)
return i;
const a = this.getComponentContext(t), { componentClassList: s } = a;
return s.forEach((l) => {
if (!l || !r[l])
return;
const { canMove: u, canDelete: c, canAccept: d } = r[l];
i.canMove = i.canMove && this.resolveRuleValue(u, a), i.canDelete = i.canDelete && this.resolveRuleValue(c, a), i.canAccept = i.canAccept && this.resolveRuleValue(d, a);
}), i;
}
resolveRuleValue(t, e) {
return typeof t == "boolean" ? t : this.parseRuleValueSchema(t, e);
}
parseRuleValueSchema(t, e) {
const o = t.invalidContext || [];
let r = !0;
for (const i of o) {
if (i.firstLevelChild) {
if (i.firstLevelChild.class) {
const { firstLevelChildClassList: a } = e;
if (a && !a.includes(i.firstLevelChild.class)) {
r = !1;
continue;
}
}
if (i.firstLevelChild.type) {
const { firstLevelChildSchema: a } = e;
if (!a || a.type !== i.firstLevelChild.type) {
r = !1;
continue;
}
}
}
if (i.secondLevelChild) {
if (i.secondLevelChild.class) {
const { secondLevelChildClassList: a } = e;
if (a && !a.includes(i.secondLevelChild.class)) {
r = !1;
continue;
}
}
if (i.secondLevelChild.type) {
const { secondLevelChildSchema: a } = e;
if (!a || a.type !== i.secondLevelChild.type) {
r = !1;
continue;
}
}
}
if (i.parent) {
if (i.parent.class) {
const { parentClassList: a } = e;
if (a && !a.includes(i.parent.class)) {
r = !1;
continue;
}
}
if (i.parent.type) {
const { parentSchema: a } = e;
if (a && a.type !== i.parent.type) {
r = !1;
continue;
}
}
}
r = !0;
break;
}
return !r;
}
getComponentContext(t) {
var T, w, v, g;
const e = t.schema, o = e.appearance && e.appearance.class || "", r = o.split(" ") || [], i = e.contents || [], a = i.length ? i[0] : null, s = a && a.appearance ? a.appearance.class : "", l = s ? s.split(" ") : [], u = (T = a == null ? void 0 : a.contents) != null && T.length ? a == null ? void 0 : a.contents[0] : null, c = u && u.appearance ? u.appearance.class : "", d = c ? c.split(" ") : [], h = e.type === "component" ? (v = (w = t.parent) == null ? void 0 : w.parent) == null ? void 0 : v.schema : (g = t.parent) == null ? void 0 : g.schema, f = h && h.appearance && h.appearance.class || "", p = f ? f.split(" ") : [];
return {
componentClass: o,
componentClassList: r,
childContents: i,
firstLevelChildSchema: a,
firstLevelChildClass: s,
firstLevelChildClassList: l,
secondLevelChildSchema: u,
secondLevelChildClass: c,
secondLevelChildClassList: d,
parentSchema: h,
parentClass: f,
parentClassList: p
};
}
}
var Et = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function rs(n) {
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
}
function nn(n) {
throw new Error('Could not dynamically require "' + n + '". Please configure the dynamicRequireTargets or/and ignoreDynamicR