@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,711 lines • 136 kB
JavaScript
var nn = Object.defineProperty;
var on = (n, t, e) => t in n ? nn(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
var U = (n, t, e) => on(n, typeof t != "symbol" ? t + "" : t, e);
import { defineComponent as me, computed as ee, createVNode as T, Teleport as gt, Transition as Se, withModifiers as be, Fragment as rn, createTextVNode as qe, ref as W, getCurrentInstance as mt, reactive as Ee, withDirectives as Pe, resolveDirective as ke, onMounted as Ce, onUnmounted as vt, watch as pe, nextTick as ye, inject as ae, provide as bt, onBeforeUnmount as sn } from "vue";
import lt from "../button/index.esm.js";
import { isPlainObject as ct, cloneDeep as ge } from "lodash-es";
import "bignumber.js";
import { getCustomClass as he, withInstall as yt } from "../common/index.esm.js";
import { useDesignerInnerComponent as an, useDesignerComponent as ln } from "../designer-canvas/index.esm.js";
const wt = {}, Ct = {};
function He(n) {
const { properties: t, title: e, ignore: o } = n, r = o && Array.isArray(o), i = Object.keys(t).reduce((s, d) => ((!r || !o.find((u) => u === d)) && (s[d] = t[d].type === "object" && t[d].properties ? He(t[d]) : ge(t[d].default)), s), {});
if (e && (!r || !o.find((s) => s === "id"))) {
const s = e.toLowerCase().replace(/-/g, "_");
i.id = `${s}_${Math.random().toString().slice(2, 6)}`;
}
return i;
}
function cn(n) {
const { properties: t, title: e, required: o } = n;
if (o && Array.isArray(o)) {
const r = o.reduce((i, s) => (i[s] = t[s].type === "object" && t[s].properties ? He(t[s]) : ge(t[s].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 ve(n, t = {}, e) {
const o = wt[n];
if (o) {
let r = cn(o);
const i = Ct[n];
return r = i ? i({ getSchemaByType: ve }, r, t, e) : r, r;
}
return null;
}
function un(n, t) {
const e = He(t);
return Object.keys(e).reduce((o, r) => (Object.prototype.hasOwnProperty.call(n, r) && (o[r] && ct(o[r]) && ct(n[r] || !n[r]) ? Object.assign(o[r], n[r] || {}) : o[r] = n[r]), o), e), e;
}
function xt(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 s = i(r, n[r], n);
Object.assign(o, s);
}
} else
o[r] = n[r];
return o;
}, {});
}
function dn(n, t, e = /* @__PURE__ */ new Map()) {
const o = un(n, t);
return xt(o, e);
}
function fn(n = {}) {
function t(l, h, c, g) {
if (typeof c == "number")
return g[l].length === c;
if (typeof c == "object") {
const p = Object.keys(c)[0], m = c[p];
if (p === "not")
return Number(g[l].length) !== Number(m);
if (p === "moreThan")
return Number(g[l].length) >= Number(m);
if (p === "lessThan")
return Number(g[l].length) <= Number(m);
}
return !1;
}
function e(l, h, c, g) {
return g[l] && g[l].propertyValue && String(g[l].propertyValue.value) === String(c);
}
const o = /* @__PURE__ */ new Map([
["length", t],
["getProperty", e]
]);
Object.keys(n).reduce((l, h) => (l.set(h, n[h]), l), o);
function r(l, h) {
const c = l;
return typeof h == "number" ? [{ target: c, operator: "length", param: null, value: Number(h) }] : typeof h == "boolean" ? [{ target: c, operator: "getProperty", param: l, value: !!h }] : typeof h == "object" ? Object.keys(h).map((g) => {
if (g === "length")
return { target: c, operator: "length", param: null, value: h[g] };
const p = g, m = h[g];
return { target: c, operator: "getProperty", param: p, value: m };
}) : [];
}
function i(l) {
return Object.keys(l).reduce((c, g) => {
const p = r(g, l[g]);
return c.push(...p), c;
}, []);
}
function s(l, h) {
if (o.has(l.operator)) {
const c = o.get(l.operator);
return c && c(l.target, l.param, l.value, h) || !1;
}
return !1;
}
function d(l, h) {
return i(l).reduce((p, m) => p && s(m, h), !0);
}
function u(l, h) {
const c = Object.keys(l), g = c.includes("allOf"), p = c.includes("anyOf"), m = g || p, b = (m ? l[m ? g ? "allOf" : "anyOf" : "allOf"] : [l]).map((P) => d(P, h));
return g ? !b.includes(!1) : b.includes(!0);
}
return { parseValueSchema: u };
}
const pn = {
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: "筛选条" }
}, hn = {}, gn = {};
fn();
function ze(n, t, e = /* @__PURE__ */ new Map(), o = (s, d, u, l) => d, r = {}, i = (s) => s) {
return wt[t.title] = t, Ct[t.title] = o, hn[t.title] = r, gn[t.title] = i, (s = {}, d = !0) => {
if (!d)
return xt(s, e);
const u = dn(s, t, e), l = Object.keys(n).reduce((h, c) => (h[c] = n[c].default, h), {});
return Object.assign(l, u);
};
}
function Tt(n, t) {
return { customClass: t.class, customStyle: t.style };
}
function mn(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 vn() {
function n(t, e) {
const o = t.buttons;
if (!o || o.length < 1)
return null;
const [r, i] = e.payloads, s = mn(o, i);
return s ? s.onClick || s.click : null;
}
return {
resolve: n
};
}
function bn(n, t, e) {
return t;
}
const yn = /* @__PURE__ */ new Map([
["appearance", Tt]
]), wn = "https://json-schema.org/draft/2020-12/schema", Cn = "https://farris-design.gitee.io/drawer.schema.json", xn = "drawer", Tn = "A Farris Component", Sn = "object", En = {
id: {
description: "The unique identifier for drawer",
type: "string"
},
type: {
description: "The type string of drawer",
type: "string",
default: "drawer"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string"
},
style: {
type: "string"
}
},
default: {}
},
visible: {
description: "",
type: "boolean",
default: !0
},
title: {
description: "",
type: "string",
default: "标题"
},
position: {
description: "",
type: "string",
default: "right"
},
width: {
description: "",
type: "number"
},
showMask: {
description: "",
type: "boolean",
default: !0
},
toolbar: {
description: "",
type: "object",
properties: {
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string",
default: "col-3"
}
}
},
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: []
}
}
}
}, Pn = [
"id",
"type",
"contents"
], kn = {
$schema: wn,
$id: Cn,
title: xn,
description: Tn,
type: Sn,
properties: En,
required: Pn
}, St = {
/** 背景色 */
backgroundColor: { type: String, default: "#fff" },
/**
* 关闭对话框前事件, 是个函数,返回true或者false
*/
beforeClose: { type: Function, default: () => !0 },
/**
* 自定义抽屉样式
*/
class: { type: String, default: "" },
/**
* 自定义抽屉蒙层样式
*/
modalClass: { type: String, default: "" },
/** 高度 */
height: { type: String, default: 300 },
/** 打开关闭抽屉 */
modelValue: { type: Boolean, default: !1 },
/** 从哪个位置呼出 */
position: { type: String, default: "right" },
/** 抽屉插入位置 */
appendTo: { type: String, default: "body" },
/** 是否展示打开抽屉入口 */
showEntry: { type: Boolean, default: !1 },
/** 是否展示关闭按钮 */
showClose: { type: Boolean, default: !0 },
/** 是否展示遮罩层 */
// mask: { type: Boolean, default: true },
/** 点击遮罩是否关闭抽屉 */
allowClickMaskToClose: { type: Boolean, default: !0 },
/** 标题 */
title: { type: String, default: "" },
/** 宽度 */
width: { type: String, default: 300 }
}, Et = Object.assign({}, St, {
componentId: { type: String, default: "" }
}), Pt = ze(Et, kn, yn, bn), Me = /* @__PURE__ */ me({
name: "FDrawer",
props: St,
emits: ["afterClose", "update:modelValue"],
setup(n, t) {
ee(() => ({}));
const e = ee(() => {
const l = {};
return n.maskClass && n.maskClass.split(" ").forEach((h) => {
l[h] = !0;
}), {
"f-drawer-mask": !0,
...l
};
}), o = ee(() => {
const l = {};
return n.maskClass && n.class.split(" ").forEach((h) => {
l[h] = !0;
}), {
"f-drawer-wrapper": !0,
[`f-drawer-wrapper-${n.position}`]: !0,
...l
};
}), r = ee(() => {
const l = n.width;
return typeof l == "string" ? l : typeof l == "number" ? `${l}px` : "20%";
}), i = ee(() => {
const l = n.height;
return typeof l == "string" ? l : typeof l == "number" ? `${l}px` : "20%";
}), s = ee(() => `f-drawer-${n.position}`), d = (l) => {
Promise.resolve().then(() => {
var h;
return (h = n.beforeClose) == null ? void 0 : h.call(n);
}).then((h) => {
h && (t.emit("update:modelValue", !1), t.emit("afterClose"));
});
}, u = (l) => {
d();
};
return () => T(gt, {
to: "body"
}, {
default: () => [T("div", {
class: "f-drawer"
}, [T(Se, {
name: "f-drawer-mask",
appear: !0
}, {
default: () => [n.modelValue && T("div", {
class: e.value,
onClick: be((l) => {
n.allowClickMaskToClose && d();
}, ["stop"])
}, null)]
}), T(Se, {
name: s.value,
appear: !0
}, {
default: () => {
var l, h;
return [n.modelValue && T("div", {
class: o.value,
style: {
width: r.value,
height: i.value,
backgroundColor: n.backgroundColor
}
}, [T("div", {
class: "f-drawer-container"
}, [T("div", {
class: "f-drawer-header"
}, [T("div", {
class: "f-drawer-title"
}, [t.slots.headerTemplate ? t.slots.headerTemplate() : n.title]), n.showClose && T("div", {
class: "f-drawer-close"
}, [T("span", {
class: "f-icon f-icon-close",
onClick: be((c) => {
d();
}, ["stop"])
}, null)])]), T("div", {
class: "f-drawer-body"
}, [(h = (l = t.slots).content) == null ? void 0 : h.call(l)]), T("div", {
class: "f-drawer-footer"
}, [t.slots.footerTemplate ? t.slots.footerTemplate() : T(rn, null, [T(lt, {
class: "mr-2",
onClick: d
}, {
default: () => [qe("取消")]
}), T(lt, {
onClick: u
}, {
default: () => [qe("确定")]
})])])])])];
}
})])]
});
}
});
function Mn(n, t, e) {
var R;
const o = e && e.getStyles && e.getStyles() || "", r = e && e.getDesignerClass && e.getDesignerClass() || "", i = W();
function s() {
return (t == null ? void 0 : t.schema.componentType) === "frame" ? !1 : e && e.checkCanMoveComponent ? e.checkCanMoveComponent() : !0;
}
function d() {
return !1;
}
function u() {
return (t == null ? void 0 : t.schema.componentType) === "frame" ? !1 : e && e.checkCanDeleteComponent ? e.checkCanDeleteComponent() : !0;
}
function l() {
return (t == null ? void 0 : t.schema.componentType) === "frame" ? !0 : e && e.hideNestedPaddingInDesginerView ? e.hideNestedPaddingInDesginerView() : !1;
}
function h(E) {
if (!E || !E.value)
return null;
if (E.value.schema && E.value.schema.type === "component")
return E.value;
const F = W(E == null ? void 0 : E.value.parent), v = h(F);
return v || null;
}
function c(E = t) {
var x;
if (e != null && e.getDraggableDesignItemElement)
return e.getDraggableDesignItemElement(E);
const { componentInstance: F, designerItemElementRef: v } = E;
if (!F || !F.value)
return null;
const { getCustomButtons: a } = F.value;
return F.value.canMove || a && ((x = a()) != null && x.length) ? v : c(E.parent);
}
function g(E) {
return !!e && e.canAccepts(E);
}
function p() {
return (t == null ? void 0 : t.schema.label) || (t == null ? void 0 : t.schema.title) || (t == null ? void 0 : t.schema.name);
}
function m() {
}
function C(E, F) {
var v;
!E || !F || (e != null && e.onAcceptMovedChildElement && e.onAcceptMovedChildElement(E, F), (v = t == null ? void 0 : t.setupContext) == null || v.emit("dragEnd"));
}
function M(E, F) {
const { componentType: v } = E;
let a = ve(v, E, F);
e && e.onResolveNewComponentSchema && (a = e.onResolveNewComponentSchema(E, a));
const x = v.toLowerCase().replace(/-/g, "_");
return a && !a.id && a.type === v && (a.id = `${x}_${Math.random().toString().slice(2, 6)}`), a;
}
function b(E) {
E && e != null && e.onChildElementMovedOut && e.onChildElementMovedOut(E);
}
function f(...E) {
if (e && e.getPropsConfig)
return e.getPropsConfig(...E);
}
function P(E) {
if (!E)
return;
const F = t == null ? void 0 : t.schema, { formSchemaUtils: v } = E;
if (F && v.getExpressions().length) {
const a = v.getExpressions().findIndex((x) => x.target === F.id);
a > -1 && v.getExpressions().splice(a, 1);
}
}
function A(E) {
e && e.onRemoveComponent && e.onRemoveComponent(), P(E), t != null && t.schema.contents && t.schema.contents.map((F) => {
let v = F.id;
F.type === "component-ref" && (v = F.component);
const a = n.value.querySelectorAll(`#${v}-design-item`);
a != null && a.length && Array.from(a).map((x) => {
var D;
(D = x == null ? void 0 : x.componentInstance) != null && D.value.onRemoveComponent && x.componentInstance.value.onRemoveComponent(E);
});
});
}
function B() {
if (e && e.getCustomButtons)
return e.getCustomButtons();
}
function $(E) {
if (e && e.onPropertyChanged)
return e.onPropertyChanged(E);
}
return i.value = {
canMove: s(),
canSelectParent: d(),
canDelete: u(),
canNested: !l(),
contents: t == null ? void 0 : t.schema.contents,
elementRef: n,
parent: (R = t == null ? void 0 : t.parent) == null ? void 0 : R.componentInstance,
schema: t == null ? void 0 : t.schema,
styles: o,
designerClass: r,
canAccepts: g,
getBelongedComponentInstance: h,
getDraggableDesignItemElement: c,
getDraggingDisplayText: p,
getPropConfig: f,
getDragScopeElement: m,
onAcceptMovedChildElement: C,
onChildElementMovedOut: b,
addNewChildComponentSchema: M,
triggerBelongedComponentToMoveWhenMoved: !!e && e.triggerBelongedComponentToMoveWhenMoved || W(!1),
triggerBelongedComponentToDeleteWhenDeleted: !!e && e.triggerBelongedComponentToDeleteWhenDeleted || W(!1),
onRemoveComponent: A,
getCustomButtons: B,
onPropertyChanged: $
}, i;
}
const Dn = W(0);
function In() {
Dn.value++;
}
const we = W(0);
function Bn(n, t) {
const e = t.getBoundingClientRect(), o = n.getBoundingClientRect(), r = o.top >= e.top, i = o.top <= e.bottom;
return r && i;
}
function kt(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 s = document.querySelector(".editorDiv");
if (s) {
const d = s.getBoundingClientRect();
i < d.left && ({ left: i } = n.getBoundingClientRect());
}
o.style.left = i + "px";
}
}
}
function An(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 Mt(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 = An(n);
if (r && (o = Bn(n, r)), !o) {
e.style.display = "none";
return;
}
kt(n);
}
}
function On(n) {
if (!n)
return;
let t;
n.className.includes("dgComponentSelected") ? t = n : t = n.querySelector(".dgComponentSelected"), t && Mt(t);
}
function Vn(n) {
const { formSchemaUtils: t, formStateMachineUtils: e } = n;
function o(u, l = "") {
return {
path: l + u.code,
field: u.id,
fullPath: u.code
};
}
function r(u, l = "") {
return t.getViewModelById(u).states.map((c) => o(c, l));
}
function i(u) {
const l = t.getRootViewModelId(), h = r(u);
if (u === l)
return h;
const c = r(l, "root-component.");
return [...h, ...c];
}
function s(u) {
return u.binding && u.binding.path || u.id || "";
}
function d() {
return e && e.getRenderStates() || [];
}
return { getVariables: i, getControlName: s, getStateMachines: d };
}
class $n {
constructor(t) {
U(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'"
}
]);
U(this, "expressionNames", {
compute: "计算表达式",
dependency: "依赖表达式",
validate: "验证表达式",
dataPicking: "帮助前表达式",
visible: "可见表达式",
readonly: "只读表达式",
required: "必填表达式"
});
U(this, "getExpressionConverter", (t, e) => ({
convertFrom: (o, r, i, s) => {
const d = i.getExpressionRuleValue(t, e || r);
return d && d.value || "";
},
convertTo: (o, r, i, s, d) => {
var u;
if (r === "dataPicking" && (i != null && i.target)) {
const l = `${i.target}_dataPicking`;
((u = i.rules) == null ? void 0 : u.some(
(c) => c.id === l && c.value
)) ? o.dictPickingExpressionId = l : delete o.dictPickingExpressionId;
}
s.updateExpression(i);
}
}));
this.formSchemaService = t;
}
getExpressionRule(t, e) {
const o = this.formSchemaService.getExpressions();
if (!o)
return "";
const r = o.find((s) => s.target === t);
if (!r)
return "";
const i = r.rules.find((s) => s.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 d;
const i = this.createTreeNode(r, e);
let s = [];
(d = r.type) != null && d.fields && (s = this.buildEntityFieldsTreeData(r.type.fields, [...e, r.label])), o.push({
data: i,
children: s,
expanded: !0
});
}), o;
}
buildChildEntityTreeData(t = null, e) {
const o = [];
return t == null || t.forEach((r) => {
var u, l;
const i = this.createTreeNode(r, e), s = this.buildEntityFieldsTreeData((u = r.type) == null ? void 0 : u.fields, [...e, r.label]), d = this.buildChildEntityTreeData((l = r.type) == null ? void 0 : l.entities, [...e, r.label]);
d != null && d.length && (s == null || s.push(...d)), o.push({
data: i,
children: s || [],
// 空值回退
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), s = this.getEntitiesAndVariables(), d = {
message: ["validate", "required", "dataPicking"].includes(e) && i ? i.message : "",
...s
};
return i.messageType != null && (d.messageType = i.messageType), d;
}
buildRule(t, e, o, r) {
const { expression: i, message: s, messageType: d } = e, u = {
id: `${t}_${o}`,
type: o,
value: i
};
return (o === "validate" || o === "dataPicking" || o === "required") && (u.message = s), o === "dataPicking" && (u.messageType = d), o === "validate" && r && (u.elementId = r), u;
}
getExpressionData() {
const { expressions: t } = this.formSchemaService.getFormSchema().module;
return t || [];
}
updateExpression(t, e, o, r) {
const i = e === "Field" ? t.binding.field : t.id, s = this.buildRule(i, o, r, t.type === "form-group" ? t.id : "");
let u = this.getExpressionData().find((h) => h.targetType === e && h.target === i);
const l = (h) => h.value.trim() === "";
if (u) {
const h = u.rules.find((c) => c.id === s.id);
if (h)
l(s) ? u.rules = u.rules.filter((c) => c.id !== s.id) : (Object.assign(h, s), r === "validate" && t.type === "form-group" && (h.elementId = t.id));
else {
if (l(s))
return null;
u.rules = u.rules || [], u.rules.push(s);
}
} else {
if (l(s))
return null;
u = {
target: `${i}`,
rules: [s],
targetType: e
};
}
return u;
}
getExpressionEditorOptions(t, e, o, r) {
return o.reduce((i, s) => {
var u, l;
const d = e === "Field" ? (u = t == null ? void 0 : t.binding) == null ? void 0 : u.field : t.id;
return i[s] = {
hide: e === "Field" ? !!((l = t == null ? void 0 : t.binding) != null && l.field) : !1,
description: "",
title: this.expressionNames[s],
type: "string",
$converter: this.getExpressionConverter(d),
editor: {
type: "expression-editor",
singleExpand: !1,
dialogTitle: `${this.expressionNames[s]}编辑器`,
showMessage: s === "validate" || s === "dataPicking" || s === "required",
showMessageType: s === "dataPicking",
beforeOpen: () => this.onBeforeOpenExpression(t, s, e),
onSubmitModal: (h) => {
const c = this.updateExpression(t, e, h, s);
if (r) {
const g = this.buildRule(d, h, s);
r(g);
}
return c;
}
}
}, i;
}, {});
}
getExpressionInfo(t, e, o) {
const r = e === "Field" ? t.binding.field : t.id, i = this.getExpressionRule(r, o), s = {
value: i && i.value,
targetId: r,
targetType: e,
expressionType: o
};
return i && i.message && (s.message = i.message), s;
}
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 Ie {
constructor(t, e) {
U(this, "componentId");
U(this, "viewModelId");
U(this, "eventsEditorUtils");
U(this, "formSchemaUtils");
U(this, "formMetadataConverter");
U(this, "designViewModelUtils");
U(this, "designViewModelField");
U(this, "controlCreatorUtils");
U(this, "designerHostService");
U(this, "schemaService", null);
U(this, "metadataService", null);
U(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: pn[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 s in e)
i[s] = Object.assign(i[s] || {}, e[s]);
return {
...r,
properties: { ...i },
setPropertyRelates(s, d) {
if (s) {
switch (s && s.propertyID) {
case "class":
case "style": {
we.value++;
break;
}
}
o && o(s, t, d);
}
}
};
}
getPropertyEditorParams(t, e = [], o = "visible", r = {}, i = {}) {
const { getVariables: s, getControlName: d, getStateMachines: u } = Vn(this.designerHostService), l = this.getRealTargetType(t), h = e && e.length > 0 ? e : ["Const", "Variable", "StateMachine", "Expression"], c = {
type: "property-editor",
propertyTypes: h
};
return h.map((g) => {
switch (g) {
case "Const":
Object.assign(c, {
constType: "enum",
constEnums: [{ id: !0, name: "是" }, { id: !1, name: "否" }]
}, r);
break;
case "Expression":
c.expressionConfig = this.getExpressionOptions(t, l, o);
break;
case "StateMachine":
c.stateMachines = u();
break;
case "Variable":
Object.assign(c, {
controlName: d(t),
newVariablePrefix: "is",
newVariableType: "Boolean",
variables: s(this.viewModelId),
onBeforeOpenVariables: (p) => {
p.value = s(this.viewModelId);
}
}, i);
break;
}
}), c;
}
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: ""
}, s = this.getVisibleProperty(t, e);
for (const u in o)
s[u] = Object.assign(s[u] || {}, o[u]);
const d = this;
return {
...i,
properties: { ...s },
setPropertyRelates(u, l) {
if (u) {
switch (u.propertyID) {
case "disabled":
case "readonly":
case "visible":
d.afterMutilEditorChanged(t, u);
break;
}
r && r(u, l);
}
}
};
}
/**
* 当多值编辑器变更时
* @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((s) => s.id === t), i = ge(o.contents[r]);
o.contents.splice(r, 1), o.contents.splice(r, 0, i), In();
}
/**
* 属性编辑器,在编辑过程中会新增变量,此处需要将新增的变量追加到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 s = {
id: o.field,
category: "locale",
code: o.fullPath,
name: o.fullPath,
type: o.newVariableType || "String"
};
delete o.newVariableType, delete o.isNewVariable, this.formSchemaUtils.getVariableByCode(s.code) || this.formSchemaUtils.getViewModelById(e).states.push(s);
}
/**
* 更新表达式到expressions节点
* @param changeObject
*/
updateExpressionValue(t) {
const e = t.propertyValue;
if (!((e && e.type) === "Expression" && e.expressionInfo))
return;
const { expressionId: i, expressionInfo: s } = e, { targetId: d, targetType: u, expressionType: l, value: h, message: c } = s, g = this.formSchemaUtils.getModule();
g.expressions ?? (g.expressions = []);
const { expressions: p } = g;
let m = p.find((M) => M.target === d);
m || (m = { target: d, rules: [], targetType: u }, p.push(m));
const C = m.rules.find((M) => M.type === l);
if (C)
C.value = h, C.message = c;
else {
const M = { id: i, type: l, value: h, message: c };
m.rules.push(M);
}
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, s = this.formSchemaUtils.getExpressions(), d = e.binding ? e.binding.field : e.id, u = s.find((l) => l.target === d);
!u || !u.rules || (u.rules = u.rules.filter((l) => l.type !== i));
}
getExpressionOptions(t, e, o) {
return new $n(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 Rn extends Ie {
constructor(t, e) {
super(t, e);
}
getPropertyConfig(t) {
return this.propertyConfig.categories.basic = this.getBasicPropConfig(t), this.propertyConfig.categories.appearance = this.getAppearanceConfig(t), this.getBehaviorConfig(), this.propertyConfig;
}
getBehaviorConfig() {
this.propertyConfig.categories.behavior = {
title: "行为",
description: "Behavior",
properties: {
title: {
title: "标题",
description: "标题",
type: "string"
},
position: {
title: "显示位置",
description: "抽屉显示位置",
type: "select",
default: "right",
editor: {
type: "combo-list",
textField: "name",
valueField: "value",
editable: !1,
data: [
{ value: "left", name: "左侧" },
{ value: "right", name: "右侧" }
]
}
},
width: {
title: "宽度",
description: "抽屉宽度",
type: "number"
},
showMask: {
title: "显示遮罩",
description: "是否显示遮罩",
type: "boolean",
default: !0
}
},
setPropertyRelates(t, e) {
if (t)
switch (t && t.propertyID) {
case "title": {
t.needRefreshControlTree = !0;
break;
}
}
}
};
}
}
function Nn(n, t) {
function e() {
return !1;
}
function o() {
return !1;
}
function r() {
return !1;
}
function i() {
return !0;
}
function s() {
return "position: absolute !important;border: none !important;left: 0;right: 0;padding: 0;";
}
function d(u) {
const l = new Rn(u, t), { schema: h } = n;
return l.getPropertyConfig(h);
}
return { canAccepts: e, checkCanDeleteComponent: o, checkCanMoveComponent: r, hideNestedPaddingInDesginerView: i, getStyles: s, getPropsConfig: d };
}
class Dt {
constructor(t) {
/** 工具栏项标识 */
U(this, "id", "");
/** 工具栏项自定义样式 */
U(this, "class", "btn-secondary");
/** 图标 */
U(this, "icon", "");
/** 所属分组 */
U(this, "groupId", "");
/** 收藏顺序 */
U(this, "order", -1);
/** 是否作为下拉菜单的顶层按钮 */
U(this, "asDropDownTop", !1);
/** 文本 */
U(this, "text", "");
/** 是否可见原值 */
U(this, "visible", !0);
/** 控制界面是否显示 */
U(this, "shown", !0);
U(this, "responsed", !1);
/** 是否启用提示消息 */
U(this, "tipsEnable", !1);
/** 提示消息内容 */
U(this, "tipsText", "");
/** 记录宽度 */
U(this, "width", 0);
/** 下拉时的样式名 */
U(this, "dropdownClass", "");
U(this, "onClick", () => {
});
U(this, "options");
var o, r;
this.options = t;
const e = [
"id",
"class",
"icon",
"groupId",
"order",
"asDropDownTop",
"text",
"isDP",
"visible",
"responsed",
"width",
"tipsEnable",
"tipsText",
"dropdownClass",
"onClick"
];
Object.keys(t).filter((i) => e.indexOf(i) > -1).forEach((i) => {
i === "visible" ? this[i] = t[i] === void 0 ? !0 : t[i] : this[i] = t[i];
}), this.shown = this.visible, (o = t.appearance) != null && o.class && (this.class = (r = t.appearance) == null ? void 0 : r.class);
}
/** 是否可用 */
get enable() {
return Object.keys(this.options).indexOf("disabled") > -1 ? !this.options.disabled : ee(() => !0);
}
/** 设置宽度 */
setWidth(t) {
this.width = parseInt(t, 10);
}
/** 获取宽度 */
getWidth() {
return this.visible ? this.width : !1;
}
}
class _n extends Dt {
constructor(t) {
super(t);
}
}
function It() {
function n(t) {
const e = [];
return t.reduce((o, r) => (r.children && r.children.length > 0 ? o.push(new Te(r)) : o.push(new _n(r)), o), e), e;
}
return { buildResponseToolbarItems: n };
}
const { buildResponseToolbarItems: Fn } = It();
class Te extends Dt {
constructor(e) {
super(e);
U(this, "placement", "");
// 下拉位置
/** 是否可见 */
U(this, "visible", !0);
/** 下拉class */
U(this, "dropdownClass", "");
/** 下拉菜单class */
U(this, "menuClass", "");
/** 是否用分开的下拉按钮 */
U(this, "split", !1);
U(this, "children", []);
U(this, "expanded", !1);
U(this, "shown", !0);
const o = ["visible", "icon", "isDP", "class", "dropdownClass", "menuClass", "placement", "split", "expanded"];
Object.keys(e).filter((r) => o.indexOf(r) > -1).forEach((r) => {
r === "visible" ? this[r] = e[r] === void 0 ? !0 : e[r] : this[r] = e[r];
}), this.shown = this.visible, e.children && e.children.length && (this.children = Fn(e.children));
}
}
const jn = /* @__PURE__ */ new Map([
["buttons", "items"],
["appearance", Tt]
]);
function Bt(n, t, e) {
return t;
}
const Ln = "https://json-schema.org/draft/2020-12/schema", qn = "https://farris-design.gitee.io/response-toolbar.schema.json", Un = "response-toolbar", Wn = "A Farris Toolbar Component", Hn = "object", zn = {
id: {
description: "The unique identifier for a Response Toolbar",
type: "string"
},
type: {
description: "The type string of Response Toolbar",
type: "string",
default: "response-toolbar"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string",
default: ""
}
}
},
alignment: {
description: "The alignment of Response Toolbar Button.",
type: "string",
default: "right"
},
buttons: {
description: "The items of Response Toolbar.",
type: "array",
default: []
},
buttonSize: {
type: "string",
default: ""
},
visible: {
description: "",
type: "boolean",
default: !0
}
}, Xn = [
"id",
"type",
"buttons"
], Yn = {
onClick: "点击事件"
}, Gn = {
$schema: Ln,
$id: qn,
title: Un,
description: Wn,
type: Hn,
properties: zn,
required: Xn,
events: Yn
}, Qn = "https://json-schema.org/draft/2020-12/schema", Jn = "https://farris-design.gitee.io/response-toolbar-item.schema.json", Zn = "response-toolbar-item", Kn = "A Farris Toolbar Item Component", eo = "object", to = {
id: {
description: "The unique identifier for a Response Toolbar",
type: "string"
},
type: {
description: "The type string of Response Toolbar",
type: "string",
default: "response-toolbar-item"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string",
default: ""
}
}
},
alignment: {
description: "对齐",
type: "string",
default: "right"
},
text: {
description: "文本",
type: "string",
default: "按钮"
},
icon: {
description: "图标",
type: "string",
default: ""
},
disabled: {
description: "禁用",
type: "boolean",
default: !1
},
visible: {
description: "是否可见",
type: "boolean",
default: !0
},
onClick: {
description: "点击事件",
type: "string",
default: ""
},
tipsEnable: {
description: "",
type: "boolean",
default: !1
},
tipsText: {
description: "",
type: "string",
default: ""
},
dropdownClass: {
description: "处于下拉菜单时的样式",
type: "string",
default: ""
},
split: {
description: "",
type: "boolean",
default: !1
}
}, no = [
"id",
"type",
"text"
], oo = {
$schema: Qn,
$id: Jn,
title: Zn,
description: Kn,
type: eo,
properties: to,
required: no
}, Xe = {
id: { type: String, default: "" },
/** 组件自定义样式 */
customClass: { type: String, default: "" },
alignment: { Type: String, default: "right" },
items: {
Type: Array,
default: []
},
/** 控制是否可见 */
visible: { type: Boolean, default: !0 }
}, ro = Object.assign({}, Xe, {
componentId: { type: String, default: "" }
}), Ye = ze(
Xe,
Gn,
jn,
Bt
), At = {
id: { type: String, default: "" },
item: { type: Object, default: {} },
items: { type: Object, default: {} },
class: { type: String, default: "btn-secondary" },
text: { type: String, default: "" },
disabled: { type: Boolean, default: !1 },
icon: { type: String, default: "" },
componentId: { type: String, default: "" },
// 是否展开子级
expanded: { type: Boolean, default: !1 },
alignment: { Type: String, default: "right" },
split: { type: Boolean, default: !1 },
// 是否下拉
isDP: { type: Boolean, default: !1 },
// 是否下拉项
isDPItem: { type: Boolean, default: !1 }
}, io = ze(
At,
oo,
void 0,
Bt
), so = vn();
function Ge() {
function n(e) {
const o = {
"f-icon": !0
};
if (e.icon) {
const r = e.icon.trim().split(" ");
r && r.length && r.reduce((i, s) => (i[s] = !0, i), o);
}
return o;
}
function t(e) {
return !!(e.icon && e.icon.trim());
}
return { iconClass: n, shouldShowIcon: t };
}
const ao = ["moz", "ms", "webkit"];
function lo() {
let n = 0;
return (t) => {
const e = (/* @__PURE__ */ new Date()).getTime(), o = Math.max(0, 16 - (e - n)), r = setTimeout(() => {
t(e + o);
}, o);
return n = e + o, r;
};
}
function co() {
if (typeof window > "u")
return () => 0;
if (window.requestAnimationFrame)
return window.requestAnimationFrame.bind(window);
const n = ao.filter((t) => `${t}RequestAnimationFrame` in window)[0];
return n ? window[`${n}RequestAnimationFrame`] : lo();
}
co();
function Le(n, t) {
return ((t == null ? void 0 : t.split(" ")) || []).reduce((o, r) => (r && (o[r] = !0), o), n), n;
}
function uo(n, t) {
function e(b) {
const f = {
"dropdown-menu": !0
};
if (b.class) {
const P = b.menuClass.split(" ");
P && P.length && P.reduce((A, B) => (A[B] = !0, A), f);
}
return f;
}
function o(b) {
const f = {
disabled: !b.enable,
"dropdown-submenu": !0,
"f-rt-dropdown": !0,
"text-truncate": !0
};
return Le(f, b.dropdownClass);
}
function r(b) {
const f = {
disabled: !b.enable,
"dropdown-item": !0,
"f-rt-btn": !0,
"text-truncate": !0
};
return Le(f, b.dropdownClass);
}
function i(b) {
const f = {
disabled: !b.enable,
"dropdown-item": !0,
"f-rt-btn": !0,
"text-truncate": !0,
"f-rt-toggle": !0
};
return Le(f, b.dropdownClass);
}
let s;
const d = /* @__PURE__ */ new Map();
function u(b, f, P) {
b.stopPropagation();
const A = P ? P.id : "__top_item__";
if (f.children && f.children.length && (f.expanded = !f.expanded, f.expanded)) {
if (d.has(A) && d.get(A) !== f) {
const B = d.get(A);
B && (B.expanded = !1, d.delete(A));
}
d.set(A, f);
}
}
function l(b, f) {
document.body.click(), f.enable && (b.stopPropagation(), typeof f.onClick == "function" && f.onClick(b, f.id), n.emit("click", b, f.id));
}
function h(b, f) {
const P = b.target;
P.className.indexOf("dropdown-item") < 0 || (P.title = P.scrollWidth > P.clientWidth ? f : "");
}
function c(b, f) {
if (f.tipsEnable && f.tipsText) {
const P = Ee({
content: f.tipsText,
enable: f.tipsEnable
});
return Pe(T("li", {
class: r(f),
id: f.id,
onClick: (A) => l(A, f)
}, [T("span", {
class: "f-rt-btn text-truncate"
}, [t.shouldShowIcon(f) && T("i", {
class: t.iconClass(f)
}, null), f.text])]), [[ke("tooltip"), P]]);
}
return T("li", {
class: r(f),
id: f.id,
onClick: (P) => l(P, f)
}, [T("span", {
class: "f-rt-btn text-truncate",
onMouseenter: (P) => h(P, f.text)
}, [t.shouldShowIcon(f) && T("i", {
class: t.iconClass(f)
}, null), f.text])]);
}
function g(b, f, P) {
f.enable && (typeof f.onClick == "function" && P.onClick(b, f.id), n.emit("click", b, f.id), u(b, f, P));
}
function p(b, f) {
if (f.tipsEnable && f.tipsText) {
const P = Ee({
content: f.tipsText,
enable: f.tipsEnable
});
return T("li", {
class: o(f),
id: f.id,
onClick: (A) => g(A, f, b)
}, [Pe(T("span", {
class: i(f)
}, [t.shouldShowIcon(f) && T("i", {
class: t.iconClass(f)
}, null), f.text]), [[ke("tooltip"), P]]), s(f, f)]);
}
return T("li", {
class: o(f),
id: f.id,
onClick: (P) => g(P, f, b),
onMouseenter: (P) => h(P, f.text)
}, [T("span", {
class: i(f)
}, [t.shouldShowIcon(f) && T("i", {
class: t.iconClass(f)
}, null), f.text]), s(f, f)]);
}
function m(b) {
return b.children.filter((f) => f.visible).map((f) => f.children && f.children.length ? p(b, f) : c(b, f));
}
function C(b, f, P) {
var E;
const A = {
display: b.expanded ? "block" : "none",
position: "fixed",
maxWidth: "300px",
minWidth: "120px",
zIndex: 1040
}, B = (E = document.getElementsByTagName("body")[0].getClientRects()[0]) == null ? void 0 : E.width, $ = f, R = $ == null ? void 0 : $.getClientRects();
if ($ && R && R.length) {
const {
top: F,
width: v,
left: a,
right: x,
height: D
} = R[0], w = Math.ceil(D + F);
A.top = `${w}px`, A.left = `${a}px`;
const I = b.id + "_menu", V = f ? f.querySelector("#" + I) : null;
if (V) {
V.style.visibility = "hidden", V.style.display = "block";
const S = V.offsetHeight;
A.display === "block" && (V.style.display = "block");
const k = V.getBoundingClientRect();
if (P) {
A.top = `${F - 6}px`;
const _ = Math.ceil(v + a);
A.left = `${_}px`;
}
B - a - v < k.width && (A.left = `${(P ? a : x) - k.width}px`), window.innerHeight - F - D < S && (F > S ? A.top = `${F - S - 6}px` : (A.maxHeight = `${F - 16}px`,