@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,521 lines • 370 kB
JavaScript
var ja = Object.defineProperty;
var Na = (e, t, n) => t in e ? ja(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
var ke = (e, t, n) => Na(e, typeof t != "symbol" ? t + "" : t, n);
import { ref as C, computed as N, defineComponent as ne, createVNode as m, Teleport as En, createApp as on, onUnmounted as St, Fragment as lt, watch as Z, nextTick as _e, onBeforeMount as Ia, onMounted as ve, Transition as Dn, shallowRef as Ra, render as Zt, h as La, cloneVNode as Va, mergeProps as pt, reactive as Ge, createTextVNode as ie, inject as Ce, withDirectives as Pn, vShow as $a, onUpdated as ln, onBeforeUnmount as jn, provide as Nn, vModelText as Aa } from "vue";
import { cloneDeep as Le, isPlainObject as bn, isUndefined as Ne, debounce as In } from "lodash-es";
import { resolveAppearance as Rn, createPropsResolver as rn, getSchemaByTypeForDesigner as Ha } from "../dynamic-resolver/index.esm.js";
import { useI18n as Ft } from "vue-i18n";
import { LocaleService as It } from "../locale/index.esm.js";
import "../accordion/index.esm.js";
import "../avatar/index.esm.js";
import za from "../../designer/button-edit/index.esm.js";
import "../button-group/index.esm.js";
import "../calendar/index.esm.js";
import "../capsule/index.esm.js";
import "../../designer/checkbox/index.esm.js";
import "../../designer/checkbox-group/index.esm.js";
import "../combo-list/index.esm.js";
import "../combo-tree/index.esm.js";
import "../component/index.esm.js";
import "../color-picker/index.esm.js";
import "../content-container/index.esm.js";
import "../date-picker/index.esm.js";
import "../../designer/data-grid/index.esm.js";
import "../dropdown/index.esm.js";
import "../dynamic-form/index.esm.js";
import "../events-editor/index.esm.js";
import "../filter-bar/index.esm.js";
import "../field-selector/index.esm.js";
import "../binding-selector/index.esm.js";
import "../image-cropper/index.esm.js";
import "../../designer/input-group/index.esm.js";
import "../layout/index.esm.js";
import "../list-nav/index.esm.js";
import "../../designer/list-view/index.esm.js";
import "../lookup/index.esm.js";
import "../mapping-editor/index.esm.js";
import "../nav/index.esm.js";
import "../number-range/index.esm.js";
import "../number-spinner/index.esm.js";
import "../order/index.esm.js";
import "../page-header/index.esm.js";
import "../page-footer/index.esm.js";
import "../pagination/index.esm.js";
import "../progress/index.esm.js";
import "../query-solution/index.esm.js";
import "../../designer/radio-group/index.esm.js";
import "../rate/index.esm.js";
import "../response-toolbar/index.esm.js";
import "../response-layout/index.esm.js";
import "../response-layout-editor/index.esm.js";
import "../search-box/index.esm.js";
import "../section/index.esm.js";
import "../smoke-detector/index.esm.js";
import "../splitter/index.esm.js";
import "../step/index.esm.js";
import "../switch/index.esm.js";
import "../tabs/index.esm.js";
import Wa from "../tags/index.esm.js";
import "../text/index.esm.js";
import "../time-picker/index.esm.js";
import "../transfer/index.esm.js";
import Ln from "../tree-view/index.esm.js";
import "../uploader/index.esm.js";
import "../verify-detail/index.esm.js";
import "../video/index.esm.js";
import "../textarea/index.esm.js";
import "../schema-selector/index.esm.js";
import "../../designer/tree-grid/index.esm.js";
import qa from "../event-parameter/index.esm.js";
import "../filter-condition-editor/index.esm.js";
import "../fieldset/index.esm.js";
import "../sort-condition-editor/index.esm.js";
import "../menu-lookup/index.esm.js";
import "../../designer/drawer/index.esm.js";
import "../json-editor/index.esm.js";
import "../property-editor/index.esm.js";
import "../expression-editor/index.esm.js";
import "../code-editor/index.esm.js";
import "../html-template/index.esm.js";
import "../collection-property-editor/index.esm.js";
import "../modal/index.esm.js";
import "../external-container/index.esm.js";
import "../language-textbox/index.esm.js";
import { useDesignerComponent as Ga } from "../designer-canvas/index.esm.js";
import { getCustomClass as Pt, withInstall as Rt, FormSchemaEntityField$Type as Cn, FormSchemaEntityFieldTypeName as wn, useGuid as _a, FormSchemaEntityFieldType$Type as Ua, getCustomStyle as Ya } from "../common/index.esm.js";
import { useResizeObserver as Xa } from "@vueuse/core";
import { getHierarchyRow as Ja, useIdentify as Qa, useGroupData as Za, useFilter as Ka, useHierarchy as eo, useLoading as to, useDataView as no, useSelection as ao, useSelectHierarchyItem as oo, usePagination as lo, useDataViewContainerStyle as io, useCommandColumn as ro, useSettingColumn as so, useColumn as uo, useSort as co, useGroupColumn as fo, useRow as po, useEdit as mo, useVisualDataBound as yo, useVisualDataCell as vo, useVisualDataRow as ho, useVisualData as go, useCellPosition as bo, useSidebar as Co, useVirtualScroll as wo, useFitColumn as ko, useFilterHistory as So, useColumnFilter as Fo, useDragColumn as xo, getColumnHeader as To, getSidebar as Oo, getDisableMask as Bo, getHorizontalScrollbar as Mo, getVerticalScrollbar as Eo, getEmpty as Do, getPagination as Po, getSummary as jo } from "../data-view/index.esm.js";
import { InputBaseProperty as No } from "../property-panel/index.esm.js";
import "../notify/index.esm.js";
import Io from "../popover/index.esm.js";
import Vn, { FButtonEdit as $n } from "../button-edit/index.esm.js";
import Ro from "../list-view/index.esm.js";
import { FInputGroup as Lo } from "../input-group/index.esm.js";
function An(e, t) {
let n;
function a(s) {
const { properties: r, title: f, ignore: v } = s, b = v && Array.isArray(v), y = Object.keys(r).reduce((w, k) => ((!b || !v.find((M) => M === k)) && (w[k] = r[k].type === "object" && r[k].properties ? a(r[k]) : Le(r[k].default)), w), {});
if (f && (!b || !v.find((w) => w === "id"))) {
const w = f.toLowerCase().replace(/-/g, "_");
y.id = `${w}_${Math.random().toString().slice(2, 6)}`;
}
return y;
}
function o(s) {
const { properties: r, title: f, required: v } = s;
if (v && Array.isArray(v)) {
const b = v.reduce((y, w) => (y[w] = r[w].type === "object" && r[w].properties ? a(r[w]) : Le(r[w].default), y), {});
if (f && v.find((y) => y === "id")) {
const y = f.toLowerCase().replace(/-/g, "_");
b.id = `${y}_${Math.random().toString().slice(2, 6)}`;
}
return b;
}
return {
type: f
};
}
function l(s, r = {}, f) {
const v = e[s];
if (v) {
let b = o(v);
const y = t[s];
return b = y ? y({ getSchemaByType: l }, b, r, f) : b, n != null && n.appendIdentifyForNewControl && n.appendIdentifyForNewControl(b), b;
}
return null;
}
function i(s, r) {
const f = a(r);
return Object.keys(f).reduce((v, b) => (Object.prototype.hasOwnProperty.call(s, b) && (v[b] && bn(v[b]) && bn(s[b] || !s[b]) ? Object.assign(v[b], s[b] || {}) : v[b] = s[b]), v), f), f;
}
function u(s, r) {
return Object.keys(s).filter((v) => s[v] != null).reduce((v, b) => {
if (r.has(b)) {
const y = r.get(b);
if (typeof y == "string")
v[y] = s[b];
else {
const w = y(b, s[b], s);
Object.assign(v, w);
}
} else
v[b] = s[b];
return v;
}, {});
}
function d(s, r, f = /* @__PURE__ */ new Map()) {
const v = i(s, r);
return u(v, f);
}
function c(s) {
var f;
const r = s.type;
if (r) {
const v = e[r];
if (!v)
return s;
const b = i(s, v), y = ((f = s.editor) == null ? void 0 : f.type) || "";
if (y) {
const w = e[y], k = i(s.editor, w);
b.editor = k;
}
return b;
}
return s;
}
function g(s) {
n = s;
}
return { getSchemaByType: l, resolveSchemaWithDefaultValue: c, resolveSchemaToProps: d, mappingSchemaToProps: u, setDesignerContext: g };
}
const Hn = {}, zn = {}, { getSchemaByType: jd, resolveSchemaWithDefaultValue: Vo, resolveSchemaToProps: $o, mappingSchemaToProps: Ao, setDesignerContext: Nd } = An(Hn, zn);
function Ho(e = {}) {
function t(c, g, s, r) {
if (typeof s == "number")
return r[c].length === s;
if (typeof s == "object") {
const f = Object.keys(s)[0], v = s[f];
if (f === "not")
return Number(r[c].length) !== Number(v);
if (f === "moreThan")
return Number(r[c].length) >= Number(v);
if (f === "lessThan")
return Number(r[c].length) <= Number(v);
}
return !1;
}
function n(c, g, s, r) {
return r[c] && r[c].propertyValue && String(r[c].propertyValue.value) === String(s);
}
const a = /* @__PURE__ */ new Map([
["length", t],
["getProperty", n]
]);
Object.keys(e).reduce((c, g) => (c.set(g, e[g]), c), a);
function o(c, g) {
const s = c;
return typeof g == "number" ? [{ target: s, operator: "length", param: null, value: Number(g) }] : typeof g == "boolean" ? [{ target: s, operator: "getProperty", param: c, value: !!g }] : typeof g == "object" ? Object.keys(g).map((r) => {
if (r === "length")
return { target: s, operator: "length", param: null, value: g[r] };
const f = r, v = g[r];
return { target: s, operator: "getProperty", param: f, value: v };
}) : [];
}
function l(c) {
return Object.keys(c).reduce((s, r) => {
const f = o(r, c[r]);
return s.push(...f), s;
}, []);
}
function i(c, g) {
if (a.has(c.operator)) {
const s = a.get(c.operator);
return s && s(c.target, c.param, c.value, g) || !1;
}
return !1;
}
function u(c, g) {
return l(c).reduce((f, v) => f && i(v, g), !0);
}
function d(c, g) {
const s = Object.keys(c), r = s.includes("allOf"), f = s.includes("anyOf"), v = r || f, w = (v ? c[v ? r ? "allOf" : "anyOf" : "allOf"] : [c]).map((M) => u(M, g));
return r ? !w.includes(!1) : w.includes(!0);
}
return { parseValueSchema: d };
}
const zo = {
convertTo: (e, t, n, a) => {
e.appearance || (e.appearance = {}), e.appearance[t] = n;
},
convertFrom: (e, t, n) => e.appearance ? e.appearance[t] : e[t]
}, Wo = {
convertFrom: (e, t, n) => e.buttons && e.buttons.length ? `共 ${e.buttons.length} 项` : "无"
}, qo = {
convertTo: (e, t, n, a) => {
e.editor && (e.editor[t] = n);
},
convertFrom: (e, t, n) => e.editor && Object.prototype.hasOwnProperty.call(e.editor, t) ? e.editor[t] : e[t]
}, V = {
button: { type: "button", name: "按钮" },
"response-toolbar": { type: "response-toolbar", name: "工具栏" },
"response-toolbar-item": { type: "response-toolbar-item", name: "按钮" },
"content-container": { type: "content-container", name: "容器" },
"input-group": { type: "input-group", name: "文本" },
textarea: { type: "textarea", name: "多行文本" },
lookup: { type: "lookup", name: "帮助" },
"number-spinner": { type: "number-spinner", name: "数值" },
"date-picker": { type: "date-picker", name: "日期" },
switch: { type: "switch", name: "开关" },
"radio-group": { type: "radio-group", name: "单选组" },
"check-box": { type: "check-box", name: "复选框" },
"check-group": { type: "check-group", name: "复选框组" },
"combo-list": { type: "combo-list", name: "下拉列表" },
"response-form": { type: "response-form", name: "卡片面板" },
"response-layout": { type: "response-layout", name: "布局容器", icon: "response-layout-3" },
"response-layout-item": { type: "response-layout-item", name: "布局", icon: "response-layout-1" },
"tree-grid": { type: "tree-grid", name: "树表格" },
"tree-grid-column": { type: "tree-grid-column", name: "树表格列" },
"data-grid": { type: "data-grid", name: "表格" },
"data-grid-column": { type: "data-grid-column", name: "表格列" },
module: { type: "Module", name: "模块" },
component: { type: "component", name: "组件" },
tabs: { type: "tabs", name: "标签页" },
"tab-page": { type: "tab-page", name: "标签页项", dependentParentControl: "Tab" },
"tab-toolbar-item": { type: "tab-toolbar-item", name: "标签页工具栏按钮" },
"html-template": { type: "html-template", name: "模板容器" },
"time-picker": { type: "time-picker", name: "时间选择" },
section: { type: "section", name: "分组面板" },
"section-toolbar": { type: "section-toolbar", name: "分组面板工具栏" },
"section-toolbar-item": { type: "section-toolbar-item", name: "分组面板按钮" },
splitter: { type: "splitter", name: "分栏面板" },
"splitter-pane": { type: "splitter-pane", name: "分栏面板项", dependentParentControl: "Splitter" },
"component-ref": { type: "component-ref", name: "组件引用节点" },
uploader: { type: "uploader", name: "附件上传" },
"page-header": { type: "page-header", name: "页头" },
"page-footer": { type: "page-footer", name: "页脚" },
"tab-toolbar": { type: "tab-toolbar", name: "标签页工具栏" },
fieldset: { type: "fieldset", name: "分组" },
"query-solution": { type: "query-solution", name: "筛选方案" },
drawer: { type: "drawer", name: "抽屉" },
"external-container": { type: "external-container", name: "外部容器", icon: "content-container" },
"list-nav": { type: "list-nav", name: "列表导航" },
"list-view": { type: "list-view", name: "列表" },
"filter-bar": { type: "filter-bar", name: "筛选条" },
"language-textbox": { type: "language-textbox", name: "多语输入框" }
}, Go = {
convertFrom: (e, t, n) => {
var o;
const a = e.editor && e.editor[t] ? e.editor[t] : e[t];
return ((o = V[a]) == null ? void 0 : o.name) || a;
}
}, _o = {
convertTo: (e, t, n, a) => {
e[t] = e[t];
},
convertFrom: (e, t, n) => e.editor ? n.getRealEditorType(e.editor.type) : ""
}, Uo = {
convertTo: (e, t, n, a) => {
(e.type === "data-grid-column" || e.type === "tree-grid-column") && (e.formatter ? e.formatter[t] = n : e.formatter = {
[t]: n
});
},
convertFrom: (e, t, n) => {
if (e.formatter) {
if (t === "trueText")
return e.formatter.trueText;
if (t === "falseText")
return e.formatter.falseText;
if (t === "prefix")
return e.formatter.prefix;
if (t === "suffix")
return e.formatter.suffix;
if (t === "precision")
return e.formatter.precision;
if (t === "decimal")
return e.formatter.decimal;
if (t === "thousand")
return e.formatter.thousand;
if (t === "tempDateFormat")
return e.formatter.dateFormat === "yyyy年MM月dd日" ? "yearMonthDay" : e.formatter.dateFormat === "yyyy-MM-dd HH:mm:ss" ? "yyyy-MM-ddTHH:mm:ss" : e.formatter.dateFormat === "yyyy/MM/dd HH:mm:ss" ? "yyyy/MM/ddTHH:mm:ss" : e.formatter.dateFormat === "yyyy年MM月dd日 HH时mm分ss秒" ? "yearMonthDayHourMinuteSecond" : e.formatter.tempDateFormat || e.formatter.dateFormat || "yyyy-MM-dd";
if (t === "customFormat")
return e.formatter.customFormat;
if (t === "type")
return e.formatter.type || "none";
}
return "none";
}
}, Yo = {
convertTo: (e, t, n, a) => {
e.command ? e.command[t] = n : e.command = {
[t]: n
}, t === "enable" && n && (e.command.commands || (e.command.commands = [
{
text: "编辑",
type: "primary",
command: "edit"
},
{
text: "删除",
type: "danger",
command: "remove"
}
]));
},
convertFrom: (e, t, n) => e.command && t === "enable" ? e.command.enable : ""
}, Xo = {
convertTo: (e, t, n, a) => {
e.column ? e.column[t] = n : e.column = {
[t]: n
}, t === "fitColumns" && n && (e.column.fitMode || (e.column.fitMode = "average"));
},
convertFrom: (e, t, n) => {
if (e.column) {
if (t === "fitColumns")
return e.column.fitColumns;
if (t === "fitMode")
return e.column.fitMode;
}
return "";
}
}, Jo = {
convertTo: (e, t, n, a) => {
e.summary ? e.summary[t] = n : e.summary = {
[t]: n
}, t === "enable" && n && (e.summary ? e.summary.groupFields || (e.summary.groupFields = []) : e.summary = {
enable: n,
groupFields: []
});
},
convertFrom: (e, t, n) => e.summary && t === "enable" ? e.summary.enable : e.type === "data-grid-column" ? e.enableSummary === void 0 ? !1 : e.enableSummary : ""
}, Qo = {
convertTo: (e, t, n, a) => {
e.group ? e.group[t] = n : e.group = {
[t]: n
}, t === "enable" && n && (e.group ? e.group.groupFields || (e.group.groupFields = []) : e.group = {
enable: n,
groupFields: [],
showSummary: !1
});
},
convertFrom: (e, t, n) => {
if (e.group) {
if (t === "enable")
return e.group.enable;
if (t === "showSummary")
return e.group.showSummary;
}
}
}, Zo = {
convertFrom: (e, t) => e.binding ? e.binding.path : "",
convertTo: (e, t, n) => {
if (n && n.length > 0) {
const a = n[0];
e.binding || (e.binding = {}), e.binding.type = "Form", e.binding.path = a.bindingField, e.binding.field = a.id, e.binding.fullPath = a.path, e.path = a.bindingPath;
}
}
}, Ko = {
convertTo: (e, t, n, a) => {
e.pagination || (e.pagination = {}), e.pagination[t] = n;
},
convertFrom: (e, t, n) => e.pagination ? e.pagination[t] : e[t]
}, el = {
convertTo: (e, t, n, a) => {
e.rowNumber || (e.rowNumber = {}), e.rowNumber[t] = n;
},
convertFrom: (e, t, n) => e.rowNumber ? e.rowNumber[t] : e[t]
}, tl = {
convertTo: (e, t, n, a) => {
e.selection || (e.selection = {}), e.selection[t] = n;
},
convertFrom: (e, t, n) => e.selection ? e.selection[t] : e[t]
}, nl = {
convertFrom: (e, t, n) => e[t] && e[t].length ? `共 ${e[t].length} 项` : ""
}, al = {
convertFrom: (e, t) => e[t] || "",
convertTo: (e, t, n) => {
e[t] = n;
}
}, ol = {
convertTo: (e, t, n, a) => {
e.size || (e.size = {}), e.size[t] = n;
},
convertFrom: (e, t, n) => e.size ? e.size[t] : e[t]
}, ll = {
convertFrom: (e, t, n) => {
var a, o;
return (a = e.formatter) != null && a.data && t === "formatterEnumData" && !e.formatterEnumData ? (o = e.formatter) == null ? void 0 : o.data : e.formatterEnumData;
}
}, il = {
convertTo: (e, t, n, a) => {
e.sort || (e.sort = {}), e.sort[t] = n;
},
convertFrom: (e, t, n) => {
var a, o;
if (t === "mode")
return ((a = e.sort) == null ? void 0 : a.mode) || "client";
if (t === "multiSort")
return !!((o = e.sort) != null && o.multiSort);
}
}, rl = {
convertTo: (e, t, n, a) => {
e.filter || (e.filter = {}), e.filter[t] = n;
},
convertFrom: (e, t, n) => {
var a;
if (t === "mode")
return ((a = e.filter) == null ? void 0 : a.mode) || "client";
}
}, sl = {
convertTo: (e, t, n, a) => {
e.rowOption ? e.rowOption[t] = n : e.rowOption = {
[t]: n
};
},
convertFrom: (e, t, n) => {
if (e.rowOption) {
if (t === "customRowStyle")
return e.rowOption.customRowStyle;
if (t === "customCellStyle")
return e.rowOption.customCellStyle;
}
return "";
}
};
function Wn(e, t, n) {
const a = /* @__PURE__ */ new Map([
["/converter/appearance.converter", zo],
["/converter/buttons.converter", Wo],
["/converter/property-editor.converter", qo],
["/converter/items-count.converter", nl],
["/converter/type.converter", Go],
["/converter/change-editor.converter", _o],
["/converter/change-formatter.converter", Uo],
["/converter/column-command.converter", Yo],
["/converter/column-option.converter", Xo],
["/converter/summary.converter", Jo],
["/converter/group.converter", Qo],
["/converter/form-group-label.converter", al],
["/converter/field-selector.converter", Zo],
["/converter/pagination.converter", Ko],
["/converter/row-number.converter", el],
["/converter/grid-selection.converter", tl],
["/converter/size.converter", ol],
["/converter/change-formatter-enum.converter", ll],
["/converter/grid-sort.converter", il],
["/converter/grid-filter.converter", rl],
["/converter/row-option.converter", sl]
]), o = /* @__PURE__ */ new Map([
["string", { type: "input-group", enableClear: !1 }],
["boolean", {
type: "combo-list",
textField: "name",
valueField: "value",
idField: "value",
enableClear: !1,
editable: !1,
data: [
{
value: !0,
name: "是"
},
{
value: !1,
name: "否"
}
]
}],
["enum", { type: "combo-list", maxHeight: 128, enableClear: !1, editable: !1 }],
["array", { type: "button-edit" }],
["number", { type: "number-spinner", placeholder: "" }],
["events-editor", { type: "events-editor", hide: !0 }]
]), l = Ho();
function i(v, b) {
return () => l.parseValueSchema(v, b);
}
function u(v, b, y) {
return v.includes("visible") && b.visible !== void 0 ? typeof b.visible == "boolean" ? () => !!b.visible : b.visible === void 0 ? !0 : i(b.visible, y) : () => !0;
}
function d(v, b, y) {
return v.includes("readonly") && b.readonly !== void 0 ? typeof b.readonly == "boolean" ? () => !!b.readonly : i(b.readonly, y) : () => !1;
}
function c(v, b) {
const y = v.$converter || b;
return typeof y == "string" && y && a.has(y) ? a.get(y) || null : y || null;
}
function g(v, b, y, w, k, M = "", F = "") {
return Object.keys(v).map((p) => {
const x = C(1), B = p, D = v[p], P = Object.keys(D), T = D.title, O = D.type, S = o.get(O) || { type: "input-group", enableClear: !1 }, E = D.editor ? Object.assign({}, S, D.editor) : Object.assign({}, S), I = u(P, D, b), W = d(P, D, b);
E.readonly = E.readonly === void 0 ? W() : E.readonly;
const J = D.type === "cascade" ? g(D.properties, b, y, w, k, M, F) : [], $ = !0;
let R = c(D, F);
const G = N({
get() {
if (x.value) {
if (["class", "style"].find((de) => de === B) && !R && (R = a.get("/converter/appearance.converter") || null), R && R.convertFrom)
return R.convertFrom(y, p, k, M);
const le = y[p];
return Object.prototype.hasOwnProperty.call(D, "defaultValue") && (le === void 0 || typeof le == "string" && le === "") ? D.type === "boolean" ? D.defaultValue : D.defaultValue || "" : le;
}
return null;
},
set(le) {
x.value += 1, R && R.convertTo ? (R.convertTo(w, p, le, k, M), R.convertTo(y, p, le, k, M)) : (w[p] = le, y[p] = le);
}
}), { refreshPanelAfterChanged: z, description: ee, isExpand: ce, parentPropertyID: he } = D, Y = { propertyID: B, propertyName: T, propertyType: O, propertyValue: G, editor: E, visible: I, readonly: W, cascadeConfig: J, hideCascadeTitle: $, refreshPanelAfterChanged: z, description: ee, isExpand: ce, parentPropertyID: he };
return b[B] = Y, Y;
});
}
function s(v, b, y = {}) {
const w = {}, k = e[v];
return k && k.categories ? Object.keys(k.categories).map((F) => {
const h = k.categories[F], p = h == null ? void 0 : h.title, x = g(h.properties || {}, w, {}, y, b);
return { categoryId: F, categoryName: p, properties: x };
}) : [];
}
function r(v, b, y, w, k = "") {
const M = b.$ref.schema, F = b.$ref.converter, h = y[M], p = h.type, x = n(h), B = {}, D = e[p];
if (D && D.categories) {
const P = D.categories[v], T = P == null ? void 0 : P.title;
F && Object.keys(P.properties).forEach((E) => {
P.properties[E].$converter = F;
});
const O = (P == null ? void 0 : P.properties) || {}, S = g(O, B, x, h, w, k);
return { categoryId: v, categoryName: T, properties: S };
}
return { categoryId: v, categoryName: "", properties: [] };
}
function f(v, b, y, w, k) {
const M = v.type, F = n(v), h = {};
let p = k || e[M];
if (p && Object.keys(p).length === 0 && y && y.getPropConfig && (p = y.getPropConfig(w)), p && p.categories) {
const x = [];
return Object.keys(p.categories).map((B) => {
const D = p.categories[B];
if (D.$ref) {
x.push(r(B, D, v, b, w));
return;
}
const P = D == null ? void 0 : D.title, T = D == null ? void 0 : D.tabId, O = D == null ? void 0 : D.tabName, S = D == null ? void 0 : D.hide, E = D == null ? void 0 : D.hideTitle, I = g(D.properties || {}, h, F, v, b, w, D.$converter), { setPropertyRelates: W } = D, J = D == null ? void 0 : D.parentPropertyID;
x.push({ categoryId: B, categoryName: P, tabId: T, tabName: O, hide: S, properties: I, hideTitle: E, setPropertyRelates: W, parentPropertyID: J });
}), x;
}
return [];
}
return {
getPropertyConfigBySchema: f,
getPropertyConfigByType: s,
propertyConverterMap: a
};
}
const qn = {}, Gn = {};
Wn(qn, Gn, Vo);
const _n = {}, Un = {}, { getSchemaByType: Id, resolveSchemaWithDefaultValue: ul, resolveSchemaToProps: Rd, mappingSchemaToProps: Ld, setDesignerContext: Vd } = An(_n, Un), Yn = {}, Xn = {};
Wn(Yn, Xn, ul);
function Pe(e, t, n = /* @__PURE__ */ new Map(), a = (i, u, d, c) => u, o = {}, l = (i) => i) {
return Hn[t.title] = t, zn[t.title] = a, qn[t.title] = o, Gn[t.title] = l, _n[t.title] = t, Un[t.title] = a, Yn[t.title] = o, Xn[t.title] = l, (i = {}, u = !0) => {
if (!u)
return Ao(i, n);
const d = $o(i, t, n), c = Object.keys(e).reduce((g, s) => (g[s] = e[s].default, g), {});
return Object.assign(c, d);
};
}
function Lt(e, t) {
return { customClass: t.class, customStyle: t.style };
}
const cl = "https://json-schema.org/draft/2020-12/schema", dl = "https://farris-design.gitee.io/field-selector.schema.json", fl = "field-selector", pl = "A Farris Input Component", ml = "object", yl = {
disabled: {
description: "",
type: "boolean",
default: !1
},
readonly: {
description: "",
type: "boolean",
default: !1
},
modelValue: {
description: "",
type: "string",
default: ""
},
repositoryToken: {
description: "",
type: "object",
default: null
},
fields: {
description: "",
type: "array",
default: null
},
editorParams: {
type: "object",
default: null
},
displayText: {
description: "",
type: "string",
default: ""
},
enableClear: {
description: "",
type: "boolean",
default: !0
},
beforeOpen: {
description: "",
type: "function",
default: null
},
onSubmitModal: {
description: "",
type: "function",
default: null
}
}, vl = {
$schema: cl,
$id: dl,
title: fl,
description: pl,
type: ml,
properties: yl
}, Jn = {
disabled: {
type: Boolean,
default: !1
},
readonly: {
type: Boolean,
default: !1
},
enableClear: {
type: Boolean,
default: !0
},
displayText: {
type: String,
default: ""
},
enableExpress: {
type: Boolean,
default: !1
},
modelValue: {
type: String,
default: ""
},
insertType: {
type: String,
default: "below"
// 'above'|'below'
},
fields: {
type: Array,
default: []
},
repositoryToken: {
type: Object,
default: null
},
editorParams: {
type: Object,
default: null
},
onSubmitModal: {
type: Function,
default: null
},
beforeOpen: {
type: Function,
default: null
}
}, hl = Pe(Jn, vl), gl = {
/**
* 组件标识
*/
id: { type: String, default: "" },
/**
* 扩展按钮显示内容,这是一段现在扩展按钮中的html标签
*/
buttonContent: { type: String, default: '<i class="f-icon f-icon-lookup"></i>' },
buttonBehavior: { type: String, default: "Popup" },
/**
* 启用输入框自动完成功能
*/
autoComplete: { type: Boolean, default: !1 },
/**
* 组件自定义样式
*/
customClass: { type: String, default: "" },
/**
* 禁用组件,既不允许在输入框中录入,也不允许点击扩展按钮。
*/
disable: { type: Boolean, default: !1 },
/**
* 允许在输入框中录入文本。
*/
editable: { type: Boolean, default: !0 },
/**
* 显示清空文本按钮
*/
enableClear: { type: Boolean, default: !1 },
/**
* 组件值
*/
modelValue: { type: String, default: "" },
/**
* 将组件设置为只读,既不允许在输入框中录入,也不允许点击扩展按钮,但是允许复制输入框中的内容。
*/
readonly: { type: Boolean, default: !1 },
/**
* 禁用组件时,是否显示扩展按钮
*/
showButtonWhenDisabled: { type: Boolean, default: !1 },
/**
* 鼠标悬停在组件上时显示文本框内容。
*/
enableTitle: { type: Boolean, default: !1 },
/**
* 输入框类型
*/
inputType: { type: String, default: "text" },
/**
* 显示输入框提示信息
*/
forcePlaceholder: { type: Boolean, default: !1 },
/**
* 输入框提示文本
*/
placeholder: { type: String, default: "" },
/**
* 输入框最小长度
*/
minLength: Number,
/**
* 输入框最大长度
*/
maxLength: { type: Number },
/**
* 输入框Tab键索引
*/
tabIndex: Number,
popupHost: { type: Object },
popupRightBoundary: { type: Object },
popupOffsetX: { type: Object },
popupOnInput: { type: Boolean, default: !1 },
popupOnFocus: { type: Boolean, default: !1 },
popupOnClick: { type: Boolean, default: !1 },
/**
* 样式追加到弹出窗口
*/
popupClass: { type: String, default: "" },
popupMinWidth: { type: Number, default: 160 },
modalOptions: { type: Object, default: {} },
wrapText: { type: Boolean, default: !1 },
/**
* 可选,是否支持多选
* 默认`false`
*/
multiSelect: { type: Boolean, default: !1 },
/**
* 可选,分隔符
* 默认`,`
*/
separator: { type: String, default: "," },
/** 对齐方式 */
textAlign: { type: String, default: "left" },
/**
* 废弃
*/
beforeClickButton: { type: Function, default: null },
/**
* 作为内嵌编辑器被创建后默认获得焦点
*/
focusOnCreated: { type: Boolean, default: !1 },
/**
* 作为内嵌编辑器被创建后默认选中文本
*/
selectOnCreated: { type: Boolean, default: !1 },
/**
* 打开前
*/
beforeOpen: { type: Function, default: null },
/** 更新方式 blur | change */
updateOn: { type: String, default: "change" },
keepWidthWithReference: { type: Boolean, default: !0 },
placement: { type: String, default: "bottom-left" },
/**
* 根据空间大小重新调整,原下拉面板内容指定的高度
*/
limitContentBySpace: { type: Boolean, default: !1 }
}, bl = {
popupContentPosition: { type: Object, default: { left: 0, top: 0 } },
host: { type: Object },
backgroundColor: { type: String, default: "" }
}, Cl = /* @__PURE__ */ ne({
name: "FOverlay",
props: bl,
emits: ["click"],
setup(e, t) {
const n = C(e.popupContentPosition), a = C(e.host), o = N(() => ({
backgroundColor: e.backgroundColor || "",
pointerEvents: "auto"
}));
function l(u) {
t.emit("click"), u.preventDefault(), u.stopPropagation();
}
N(() => {
const u = a.value;
if (u) {
const d = u.getBoundingClientRect(), {
left: c,
top: g,
height: s
} = d;
return {
left: c,
top: g + s
};
}
return n.value;
});
const i = N(() => ({
// position: 'relative',
// left: `${position.value.left}px`,
// top: `${position.value.top}px`
}));
return () => m(En, {
to: "body"
}, {
default: () => {
var u, d;
return [m("div", {
class: "overlay-container",
onClick: (c) => l(c),
style: o.value
}, [m("div", {
style: i.value
}, [(d = (u = t.slots).default) == null ? void 0 : d.call(u)])])];
}
});
}
});
function wl(e) {
if (e.content && e.content.render)
return e.content.render;
if (e.render && typeof e.render == "function")
return e.render;
}
function kl(e) {
const t = document.createElement("div");
t.style.display = "contents";
let n;
const a = e.onClickCallback || (() => {
}), o = () => {
a(), n && n.unmount();
};
return n = on({
setup() {
St(() => {
document.body.removeChild(t);
});
const l = wl(e);
return () => m(Cl, {
"popup-content-position": e.popupPosition,
host: e.host,
onClick: o,
backgroundColor: e.backgroundColor
}, {
default: () => [l && l()]
});
}
}), document.body.appendChild(t), n.mount(t), n;
}
class Sl {
static show(t) {
return kl(t);
}
}
const Fl = "https://json-schema.org/draft/2020-12/schema", xl = "https://farris-design.gitee.io/modal.schema.json", Tl = "modal", Ol = "弹窗组件", Bl = "object", Ml = {
id: {
description: "组件唯一标识",
type: "string"
},
type: {
description: "组件类型",
type: "string",
default: "modal"
},
appearance: {
description: "组件外观",
type: "object",
properties: {
class: {
type: "string"
},
style: {
type: "string"
}
},
default: {}
},
name: {
description: "名称",
type: "string",
default: null
},
title: {
description: "标题",
type: "string"
},
width: {
description: "窗口宽度",
type: "number",
default: 900
},
height: {
description: "窗口高度",
type: "number",
default: 600
},
contents: {
description: "弹窗子组件集合",
type: "array",
default: []
},
modelValue: {
description: "是否显示",
type: "boolean",
default: !1
},
showCloseButton: {
description: "显示关闭按钮",
type: "boolean",
default: !0
},
showMaxButton: {
description: "显示最大化按钮",
type: "boolean",
default: !0
},
enableEsc: {
description: "允许ESC关闭",
type: "boolean",
default: !0
},
resizeable: {
description: "允许调整窗口尺寸",
type: "boolean",
default: !0
},
fitContent: {
description: "是否自适应",
type: "boolean",
default: !1
},
showButtons: {
description: "是否显示底部按钮",
type: "boolean",
default: !0
},
mask: {
description: "是否模态",
type: "boolean",
default: !0
},
draggable: {
description: "是否允许拖拽调整位置",
type: "boolean",
default: !0
},
onAccept: {
description: "确定事件",
type: "object",
default: null
},
onCancel: {
description: "取消事件",
type: "object",
default: null
},
beforeClose: {
description: "关闭前回调",
type: "object",
default: null
}
}, El = [
"id",
"type"
], Dl = {
onAccept: "确定事件",
onCancel: "取消事件",
beforeClose: "关闭前回调"
}, Pl = {
$schema: Fl,
$id: xl,
title: Tl,
description: Ol,
type: Bl,
properties: Ml,
required: El,
events: Dl
}, jl = /* @__PURE__ */ new Map([
["appearance", Rn]
]);
function Nl(e, t, n) {
return t;
}
function Il() {
function e(t, n) {
const a = {};
return a.beforeClose = (o) => n.call("beforeClose", [o, t]), a;
}
return {
resolve: e
};
}
const Qn = {
/**
* 允许点击遮罩关闭对话框
*/
allowClickMaskToClose: { type: Boolean, default: !1 },
/**
* 关闭对话框前事件, 是个函数,返回true或者false
*/
beforeClose: { type: Function, default: () => !0 },
/**
* 自定义类
*/
class: { type: String, default: "" },
/**
* 自定义遮罩类
*/
maskClass: { type: String, default: "" },
/**
* 模态框标题
*/
title: { type: String, default: "" },
/**
* 模态框宽度
*/
width: { type: Number, default: 500 },
/**
* 模态框高度
*/
height: { type: Number, default: 320 },
/**
* 自定义按钮列表
*/
buttons: {
type: Array,
default: []
},
/**
* 是否展示模态框
*/
modelValue: { type: Boolean, default: !1 },
/**
* 是否模态
*/
mask: { type: Boolean, default: !0 },
/**
* 是否展示头部
*/
showHeader: { type: Boolean, default: !0 },
/**
* 是否展示默认按钮
*/
showButtons: { type: Boolean, default: !0 },
/**
* 是否启用自适应样式
*/
fitContent: { type: Boolean, default: !0 },
/**
* 是否展示右上角按钮
*/
showCloseButton: { type: Boolean, default: !0 },
showMaxButton: { type: Boolean, default: !1 },
minHeight: { type: Number },
maxHeight: { type: Number },
minWidth: { type: Number },
maxWidth: { type: Number },
containment: { type: Object, default: null },
resizeable: { type: Boolean, default: !1 },
draggable: { type: Boolean, default: !1 },
dragHandle: { type: Object, default: null },
closedCallback: { type: Function, default: null },
resizeHandle: { type: Function, default: null },
render: { type: Function, default: null },
acceptCallback: { type: Function, default: null },
rejectCallback: { type: Function, default: null },
enableEsc: { type: Boolean, default: !0 },
enableEnter: { type: Boolean, default: !1 },
dialogType: { type: String, default: "" },
src: { type: String, default: "" },
footerHeight: { type: Number, default: 60 },
host: { type: Object, default: "body" }
}, Rl = rn(Qn, Pl, jl, Nl), Ll = Il();
class re {
constructor(t, n) {
this.x = t, this.y = n;
}
static getTransformInfo(t) {
const a = window.getComputedStyle(t).getPropertyValue("transform").replace(/[^-\d,]/g, "").split(",");
if (a.length >= 6) {
const o = parseInt(a[4], 10), l = parseInt(a[5], 10);
return { x: o, y: l };
}
return { x: 0, y: 0 };
}
static fromEvent(t, n = null) {
if (this.isMouseEvent(t))
return new re(t.clientX, t.clientY);
if (n === null || t.changedTouches.length === 1)
return new re(t.changedTouches[0].clientX, t.changedTouches[0].clientY);
for (let a = 0; a < t.changedTouches.length; a++)
if (t.changedTouches[a].target === n)
return new re(t.changedTouches[a].clientX, t.changedTouches[a].clientY);
}
static isMouseEvent(t) {
return Object.prototype.toString.apply(t).indexOf("MouseEvent") === 8;
}
static isIPosition(t) {
return !!t && "x" in t && "y" in t;
}
static getCurrent(t) {
const n = new re(0, 0);
if (window) {
const a = window.getComputedStyle(t);
if (a) {
const o = parseInt(a.getPropertyValue("left"), 10), l = parseInt(a.getPropertyValue("top"), 10);
n.x = isNaN(o) ? 0 : o, n.y = isNaN(l) ? 0 : l;
}
return n;
}
return null;
}
static copy(t) {
return new re(0, 0).set(t);
}
get value() {
return { x: this.x, y: this.y };
}
add(t) {
return this.x += t.x, this.y += t.y, this;
}
subtract(t) {
return this.x -= t.x, this.y -= t.y, this;
}
multiply(t) {
this.x *= t, this.y *= t;
}
divide(t) {
this.x /= t, this.y /= t;
}
reset() {
return this.x = 0, this.y = 0, this;
}
set(t) {
return this.x = t.x, this.y = t.y, this;
}
}
class at {
constructor(t, n) {
this.width = t, this.height = n;
}
static getCurrent(t) {
const n = new at(0, 0);
if (window) {
const a = window.getComputedStyle(t);
return a && (n.width = parseInt(a.getPropertyValue("width"), 10), n.height = parseInt(a.getPropertyValue("height"), 10)), n;
}
return null;
}
static copy(t) {
return new at(0, 0).set(t);
}
set(t) {
return this.width = t.width, this.height = t.height, this;
}
}
function Vl(e, t) {
const n = C(), a = C(), o = C(), l = C(), i = C(), u = C(), d = C(), c = C(), g = C(), s = C(), r = C(), f = C(e.resizeable), v = C(), b = C(e.draggable), y = C(!1);
function w() {
const $ = a.value || document.body, R = window.getComputedStyle($);
if (!R || !n.value)
return;
const G = re.getTransformInfo(n.value), z = {};
d.value && (z.deltaL = n.value.offsetLeft - d.value.x, z.deltaT = n.value.offsetTop - d.value.y);
const ee = R.getPropertyValue("position");
z.width = $.clientWidth, z.height = $.clientHeight, z.pr = parseInt(R.getPropertyValue("padding-right"), 10), z.pb = parseInt(R.getPropertyValue("padding-bottom"), 10), z.position = R.getPropertyValue("position"), ee === "static" && ($.style.position = "relative"), z.translateX = G.x, z.translateY = G.y, s.value = z;
}
function k($) {
if (n.value) {
l.value = at.getCurrent(n.value), i.value = re.getCurrent(n.value), u.value = l.value ? at.copy(l.value) : null, d.value = i.value ? re.copy(i.value) : null, w();
const R = $.target.getAttribute("type") || "";
c.value = {
n: !!R.match(/n/),
s: !!R.match(/s/),
w: !!R.match(/w/),
e: !!R.match(/e/)
};
}
}
function M() {
var $, R, G, z;
if (n.value) {
const ee = n.value;
c.value && ((c.value.n || c.value.s) && (($ = u.value) != null && $.height) && (ee.style.height = u.value.height + "px"), (c.value.w || c.value.e) && ((R = u.value) != null && R.width) && (ee.style.width = u.value.width + "px"), d.value && ((G = d.value) != null && G.x && (ee.style.left = d.value.x + "px"), (z = d.value) != null && z.y && (ee.style.top = d.value.y + "px")));
}
}
function F() {
const $ = e.minHeight ? e.minHeight : 1, R = e.minWidth ? e.minWidth : 1;
u.value && d.value && c.value && l.value && (u.value.height < $ && (u.value.height = $, c.value.n && i.value && (d.value.y = i.value.y + (l.value.height - $))), u.value.width < R && (u.value.width = R, c.value.w && i.value && (d.value.x = i.value.x + (l.value.width - R))), e.maxHeight && u.value.height > e.maxHeight && (u.value.height = e.maxHeight, i.value && c.value.n && (d.value.y = i.value.y + (l.value.height - e.maxHeight))), e.maxWidth && u.value.width > e.maxWidth && (u.value.width = e.maxWidth, c.value.w && i.value && (d.value.x = i.value.x + (l.value.width - e.maxWidth))));
}
function h() {
if (a.value) {
const $ = s.value;
if (d.value && u.value && c.value && l.value) {
const R = $.width - $.pr - $.deltaL - $.translateX - d.value.x, G = $.height - $.pb - $.deltaT - $.translateY - d.value.y;
c.value.n && d.value.y + $.translateY < 0 && i.value && (d.value.y = -$.translateY, u.value.height = l.value.height + i.value.y + $.translateY), c.value.w && d.value.x + $.translateX < 0 && i.value && (d.value.x = -$.translateX, u.value.width = l.value.width + i.value.x + $.translateX), u.value.width > R && (u.value.width = R), u.value.height > G && (u.value.height = G);
}
}
}
function p($) {
if (!o.value || !l.value || !i.value || !c.value)
return;
$.subtract(o.value);
const R = $.x, G = $.y;
c.value.n ? (d.value.y = i.value.y + G, u.value.height = l.value.height - G) : c.value.s && (u.value.height = l.value.height + G), c.value.e ? u.value.width = l.value.width + R : c.value.w && (u.value.width = l.value.width - R, d.value.x = i.value.x + R), h(), F(), M();
}
function x($) {
if (!g.value)
return;
const R = re.fromEvent($);
R && p(R);
}
function B() {
if (n.value) {
const {
width: $,
height: R,
x: G,
y: z
} = n.value.getBoundingClientRect(), ee = re.getTransformInfo(n.value);
return {
size: {
width: $,
height: R
},
position: {
x: G - ee.x,
y: z - ee.y
}
};
}
return null;
}
function D($) {
if (n.value) {
const R = B();
r.value = R;
}
o.value = void 0, l.value = null, i.value = null, u.value = null, d.value = null, c.value = null, g.value = null, document.removeEventListener("mousemove", x), document.removeEventListener("mouseup", D);
}
function P() {
document.addEventListener("mousemove", x), document.addEventListener("mouseup", D);
}
function T($) {
$ instanceof MouseEvent && $.button === 2 || b.value && (document.body.click(), $.stopPropagation(), $.preventDefault(), o.value = re.fromEvent($), g.value = $.target, k($), P());
}
function O($) {
return n.value = $, f.value && m(lt, null, [m("div", {
class: "fv-resizable-handle fv-resizable-n",
type: "n",
onMousedown: (R) => T(R)
}, null), m("div", {
class: "fv-resizable-handle fv-resizable-e",
type: "e",
onMousedown: (R) => T(R)
}, null), m("div", {
class: "fv-resizable-handle fv-resizable-s",
type: "s",
onMousedown: (R) => T(R)
}, null), m("div", {
class: "fv-resizable-handle fv-resizable-w",
type: "w",
onMousedown: (R) => T(R)
}, null), m("div", {
class: "fv-resizable-handle fv-resizable-ne",
type: "ne",
onMousedown: (R) => T(R)
}, null), m("div", {
class: "fv-resizable-handle fv-resizable-se fv-resizable-diagonal",
type: "se",
onMousedown: (R) => T(R)
}, null), m("div", {
class: "fv-resizable-handle fv-resizable-sw",
type: "sw",
onMousedown: (R) => T(R)
}, null), m("div", {
class: "fv-resizable-handle fv-resizable-nw",
type: "nw",
onMousedown: (R) => T(R)
}, null)]);
}
function S($ = !0) {
document.body.click();
const R = a.value || document.body, G = at.getCurrent(R), z = n.value;
$ && z && (v.value = B(), v.value.transform = z.style.transform), G && z && (u.value = G, u.value.height -= 14, u.value.width -= 14, z.style.height = u.value.height + "px", z.style.width = u.value.width + "px", z.style.left = "7px", z.style.top = "7px", z.style.transform = "", r.value = {
size: u.value,
position: {
x: 0,
y: 0
}
}, b.value = !1, y.value = !0);
}
function E() {
var $, R;
if (document.body.click(), v.value) {
const G = {
width: v.value.size.width || 0,
height: v.value.size.height || 0
}, z = {
x: (window.innerWidth - G.width) / 2,
y: (window.innerHeight - G.height) / 2
};
($ = u.value) == null || $.set(G), (R = d.value) == null || R.set(z);
const ee = n.value;
ee.style.height = G.height + "px", ee.style.width = G.width + "px", ee.style.left = `${z.x}px`, ee.style.top = `${z.y}px`, ee.style.transform = "", r.value = {
size: G,
position: z
}, b.value = e.draggable, y.value = !1;
}
}
function I() {
if (n.value) {
const $ = at.getCurrent(n.value);
if ($) {
const {
width: R,
height: G
} = $;
n.value.style.left = `${(window.innerWidth - R) / 2}px`, n.value.style.top = `${(window.innerHeight - G) / 2}px`, n.value.style.transform = "";
}
}
}
function W() {
const $ = () => {
y.value ? S(!1) : I(), document.body.click();
};
return window.addEventListener("resize", $), () => {
window.removeEventListener("resize", $);
};
}
const J = W();
return {
renderResizeBar: O,
boundingElement: a,
resizedEventParam: r,
maximize: S,
restore: E,
allowDrag: b,
isMaximized: y,
unWindowResizeHandle: J,
moveToCenter: I
};
}
function $l(e, t, n) {
const a = C(), o = C(e.draggable), l = C(e.lockAxis), i = C(), u = C(), d = C(!1), c = C(new re(0, 0)), g = C(new re(0, 0)), s = C(new re(0, 0)), r = C(new re(0, 0));
Z(() => n.value, (x) => {
i.value.style.cursor = x ? "move" : "default";
});
function f(x, B) {
if (B.tagName === "BUTTON")
return !1;
if (B === x)
return !0;
for (const D in B.children)
if (Object.prototype.hasOwnProperty.call(B.children, D) && f(x, B.children[D]))
return !0;
return !1;
}
function v() {
var P, T;
let x = s.value.x + g.value.x, B = s.value.y + g.value.y;
l.value === "x" ? (x = ((P = c.value) == null ? void 0 : P.x) || 0, s.value.x = 0) : l.value === "y" && (B = ((T = c.value) == null ? void 0 : T.y) || 0, s.value.y = 0);
const D = `translate3d(${Math.round(x)}px, ${Math.round(B)}px, 0px)`;
a.value && (a.value.style.transform = D), r.value.x = x, r.value.y = B;
}
function b() {
if (!u.value || !a.value)
return null;
const x = u.value.getBoundingClientRect(), B = a.value.getBoundingClientRect(), D = {
top: x.top < B.top,
right: x.right > B.right,
bottom: x.bottom > B.bottom,
left: x.left < B.left
};
return D.top || (s.value.y -= B.top - x.top), D.bottom || (s.value.y -= B.bottom - x.bottom), D.right || (s.value.x -= B.right - x.right), D.left || (s.value.x -= B.left - x.left), v(), D;
}
function y(x) {
x && (c.value && x.subtract(c.value), s.value.set(x), v(), b());
}
function w(x) {
d.value && o.value && (x.stopPropagation(), x.preventDefault(), y(re.fromEvent(x, i.value)));
}
function k() {
var x;
d.value && (d.value = !1, g.value.add(s.value), s.value.reset(), (x = a.value) == null || x.classList.remove("ng-dragging"), t.emit("stopMove"), document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", k));
}
function M() {
!d.value && i.value && (d.value = !0, i.value.classList.add("ng-dragging"), document.addEventListener("mousemove", w), document.addEventListener("mouseup", k));
}
function F() {
if (a.value) {
const x = re.getTransformInfo(a.value);
g.value.set(x);
return;
}
g.value.reset();
}
function h(x) {
if (!n.value || x instanceof MouseEvent && x.button === 2)
return;
const B = x.target || x.srcElement;
i.value !== void 0 && B && !f(B, i.value) || o.value !== !1 && (document.body.click(), x.stopPropagation(), x.preventDefault(), c.value = re.fromEvent(x, a.value), F(), M());
}
function p(x, B, D) {
if (o.value && B) {
if (x)
i.value = x;
else if (e.dragHandle) {
if (e.dragHandle instanceof HTMLElement)
i.value = e.dragHandle;
else if (typeof e.dragHandle == "string") {
const P = B.querySelector(e.dragHandle);
P && (i.value = P);
}
}
a.value = B, u.value = D, i.value ? (i.value.classList.add("ng-draggable"), i.value.addEventListener("mousedown", h)) : o.value = !1;
}
}
return {
registerDraggle: p,
resetTranslate: F
};
}
function Zn(e, t) {
if (e) {
const n = (a) => {
a.key.toLowerCase() === e.toLowerCase() && t({ event: a, key: e });
};
return document.addEventListener("keydown", n), () => {
document.removeEventListener("keydown", n);
};
}
}
function Al(e, t) {
const n = C(e.enableEsc);
let a = null;
return n.value ? (a = Zn("Escape", (o) => {
t.emit("esc", { event: o.event, type: "esc" });
}), {
remove: a
}) : null;
}
function Hl(e, t) {
const n = C(e.enableEnter);
let a = null;
return n.value ? (a = Zn("Enter", (o) => {
t.emit("enter", { event: o.event, type: "enter" });
}), {
remove: a
}) : null;
}
const ot = /* @__PURE__ */ ne({
name: "FModal",
props: Qn,
emits: ["update:modelValue", "accept", "cancel", "closed", "resize", "esc", "enter", "stopMove"],
setup(e, t) {
const n = C(