@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,623 lines • 319 kB
JavaScript
var qn = Object.defineProperty;
var Un = (e, t, n) => t in e ? qn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
var te = (e, t, n) => Un(e, typeof t != "symbol" ? t + "" : t, n);
import { defineComponent as Ne, ref as w, computed as P, createVNode as k, Teleport as an, createApp as qt, onUnmounted as Tt, Fragment as Ct, watch as we, onBeforeMount as Yn, onMounted as vt, Transition as rn, shallowRef as Xn, nextTick as bt, render as Nt, h as Kn, cloneVNode as Qn, mergeProps as ft, inject as pt, withDirectives as ln, vShow as Jn, createTextVNode as gt, reactive as rt, onBeforeUnmount as sn, resolveDirective as Zn, provide as eo, triggerRef as to, isVNode as no } from "vue";
import { isPlainObject as Jt, cloneDeep as mt, isUndefined as Zt } from "lodash-es";
import { resolveAppearance as oo, createPropsResolver as ao } from "../dynamic-resolver/index.esm.js";
import un from "../tags/index.esm.js";
import io from "../popover/index.esm.js";
import { useResizeObserver as cn } from "@vueuse/core";
import { useIdentify as ro, useGroupData as lo, useFilter as so, useHierarchy as uo, useLoading as co, useDataView as fo, useSelection as po, useSelectHierarchyItem as mo, useDataViewContainerStyle as vo, useCommandColumn as ho, useColumn as go, useSort as yo, useGroupColumn as bo, useRow as Co, useEdit as wo, useVisualDataBound as _o, useVisualDataCell as So, useVisualDataRow as xo, useVisualData as To, useCellPosition as Fo, useSidebar as ko, useVirtualScroll as Oo, useFitColumn as Eo, useFilterHistory as Bo, useColumnFilter as Mo, useDragColumn as Io, getColumnHeader as Vo, getSidebar as Do, getDisableMask as Ro, getHorizontalScrollbar as No, getVerticalScrollbar as $o, getEmpty as Po } from "../data-view/index.esm.js";
import "../modal/index.esm.js";
import jo from "../transfer/index.esm.js";
import Lo from "../tabs/index.esm.js";
import Wo from "../order/index.esm.js";
import "../condition/index.esm.js";
import Ho, { FCheckbox as Ao } from "../checkbox/index.esm.js";
import zo from "../filter-bar/index.esm.js";
import en from "../tooltip/index.esm.js";
import Go from "../pagination/index.esm.js";
import qo from "../button/index.esm.js";
import Uo from "../search-box/index.esm.js";
import Yo, { FDynamicFormGroup as Xo, FDynamicFormInput as Ko } from "../dynamic-form/index.esm.js";
import "../designer-canvas/index.esm.js";
import Qo from "../binding-selector/index.esm.js";
import "../notify/index.esm.js";
import Jo from "../accordion/index.esm.js";
import Zo from "../avatar/index.esm.js";
import ea from "../button-edit/index.esm.js";
import ta from "../button-group/index.esm.js";
import na from "../calendar/index.esm.js";
import oa from "../capsule/index.esm.js";
import aa from "../color-picker/index.esm.js";
import Lt from "../combo-list/index.esm.js";
import ia from "../content-container/index.esm.js";
import ra from "../data-grid/index.esm.js";
import la from "../date-picker/index.esm.js";
import sa from "../dropdown/index.esm.js";
import "../external-container/index.esm.js";
import ua from "../events-editor/index.esm.js";
import ca from "../image-cropper/index.esm.js";
import da from "../input-group/index.esm.js";
import fa from "../layout/index.esm.js";
import pa from "../list-nav/index.esm.js";
import ma from "../list-view/index.esm.js";
import va from "../lookup/index.esm.js";
import ha from "../nav/index.esm.js";
import ga from "../number-spinner/index.esm.js";
import ya from "../number-range/index.esm.js";
import ba from "../page-header/index.esm.js";
import Ca from "../page-footer/index.esm.js";
import wa from "../progress/index.esm.js";
import _a from "../query-solution/index.esm.js";
import Sa from "../radio-group/index.esm.js";
import xa from "../rate/index.esm.js";
import Ta from "../response-toolbar/index.esm.js";
import Fa from "../response-layout/index.esm.js";
import ka from "../response-layout-editor/index.esm.js";
import Oa from "../section/index.esm.js";
import Ea from "../smoke-detector/index.esm.js";
import Ba from "../splitter/index.esm.js";
import Ma from "../step/index.esm.js";
import Ia from "../switch/index.esm.js";
import Va from "../text/index.esm.js";
import Da from "../time-picker/index.esm.js";
import Ra from "../tree-view/index.esm.js";
import Na from "../uploader/index.esm.js";
import $a from "../verify-detail/index.esm.js";
import Pa from "../component/index.esm.js";
import ja from "../video/index.esm.js";
import La from "../textarea/index.esm.js";
import Wa from "../tree-grid/index.esm.js";
import Ha from "../fieldset/index.esm.js";
import Aa from "../drawer/index.esm.js";
import { getCustomClass as $t, useDateFormat as za, useNumberFormat as Ga, resolveField as Ye, setFieldValue as Wt, withInstall as qa } from "../common/index.esm.js";
import Ua from "../combo-tree/index.esm.js";
import Ya from "../field-selector/index.esm.js";
import Xa from "../mapping-editor/index.esm.js";
import Ka from "../schema-selector/index.esm.js";
import Qa from "../event-parameter/index.esm.js";
import Ja from "../filter-condition-editor/index.esm.js";
import Za from "../sort-condition-editor/index.esm.js";
import ei from "../menu-lookup/index.esm.js";
const dn = {}, fn = {};
function Ut(e) {
const { properties: t, title: n, ignore: o } = e, a = o && Array.isArray(o), r = Object.keys(t).reduce((i, l) => ((!a || !o.find((s) => s === l)) && (i[l] = t[l].type === "object" && t[l].properties ? Ut(t[l]) : mt(t[l].default)), i), {});
if (n && (!a || !o.find((i) => i === "id"))) {
const i = n.toLowerCase().replace(/-/g, "_");
r.id = `${i}_${Math.random().toString().slice(2, 6)}`;
}
return r;
}
function ti(e) {
const { properties: t, title: n, required: o } = e;
if (o && Array.isArray(o)) {
const a = o.reduce((r, i) => (r[i] = t[i].type === "object" && t[i].properties ? Ut(t[i]) : mt(t[i].default), r), {});
if (n && o.find((r) => r === "id")) {
const r = n.toLowerCase().replace(/-/g, "_");
a.id = `${r}_${Math.random().toString().slice(2, 6)}`;
}
return a;
}
return {
type: n
};
}
function pn(e, t = {}, n) {
const o = dn[e];
if (o) {
let a = ti(o);
const r = fn[e];
return a = r ? r({ getSchemaByType: pn }, a, t, n) : a, a;
}
return null;
}
function ni(e, t) {
const n = Ut(t);
return Object.keys(n).reduce((o, a) => (Object.prototype.hasOwnProperty.call(e, a) && (o[a] && Jt(o[a]) && Jt(e[a] || !e[a]) ? Object.assign(o[a], e[a] || {}) : o[a] = e[a]), o), n), n;
}
function mn(e, t) {
return Object.keys(e).filter((o) => e[o] != null).reduce((o, a) => {
if (t.has(a)) {
const r = t.get(a);
if (typeof r == "string")
o[r] = e[a];
else {
const i = r(a, e[a], e);
Object.assign(o, i);
}
} else
o[a] = e[a];
return o;
}, {});
}
function oi(e, t, n = /* @__PURE__ */ new Map()) {
const o = ni(e, t);
return mn(o, n);
}
function ai(e = {}) {
function t(p, c, u, f) {
if (typeof u == "number")
return f[p].length === u;
if (typeof u == "object") {
const g = Object.keys(u)[0], b = u[g];
if (g === "not")
return Number(f[p].length) !== Number(b);
if (g === "moreThan")
return Number(f[p].length) >= Number(b);
if (g === "lessThan")
return Number(f[p].length) <= Number(b);
}
return !1;
}
function n(p, c, u, f) {
return f[p] && f[p].propertyValue && String(f[p].propertyValue.value) === String(u);
}
const o = /* @__PURE__ */ new Map([
["length", t],
["getProperty", n]
]);
Object.keys(e).reduce((p, c) => (p.set(c, e[c]), p), o);
function a(p, c) {
const u = p;
return typeof c == "number" ? [{ target: u, operator: "length", param: null, value: Number(c) }] : typeof c == "boolean" ? [{ target: u, operator: "getProperty", param: p, value: !!c }] : typeof c == "object" ? Object.keys(c).map((f) => {
if (f === "length")
return { target: u, operator: "length", param: null, value: c[f] };
const g = f, b = c[f];
return { target: u, operator: "getProperty", param: g, value: b };
}) : [];
}
function r(p) {
return Object.keys(p).reduce((u, f) => {
const g = a(f, p[f]);
return u.push(...g), u;
}, []);
}
function i(p, c) {
if (o.has(p.operator)) {
const u = o.get(p.operator);
return u && u(p.target, p.param, p.value, c) || !1;
}
return !1;
}
function l(p, c) {
return r(p).reduce((g, b) => g && i(b, c), !0);
}
function s(p, c) {
const u = Object.keys(p), f = u.includes("allOf"), g = u.includes("anyOf"), b = f || g, m = (b ? p[b ? f ? "allOf" : "anyOf" : "allOf"] : [p]).map((F) => l(F, c));
return f ? !m.includes(!1) : m.includes(!0);
}
return { parseValueSchema: s };
}
const le = {
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: "标签页工具栏按钮" },
"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: "抽屉" }
}, ii = {}, ri = {};
ai();
function lt(e, t, n = /* @__PURE__ */ new Map(), o = (i, l, s, p) => l, a = {}, r = (i) => i) {
return dn[t.title] = t, fn[t.title] = o, ii[t.title] = a, ri[t.title] = r, (i = {}, l = !0) => {
if (!l)
return mn(i, n);
const s = oi(i, t, n), p = Object.keys(e).reduce((c, u) => (c[u] = e[u].default, c), {});
return Object.assign(p, s);
};
}
function It(e, t) {
return { customClass: t.class, customStyle: t.style };
}
function li() {
function e(t, n) {
const { dataSource: o } = t || {};
return o === void 0 ? {} : {};
}
return {
resolve: e
};
}
function si() {
function e(t, n) {
return t.selectItemById(n);
}
return {
selectItemById: e
};
}
function ui() {
function e(t, n) {
const { columns: o } = n;
return t.updateColumns(o);
}
return {
updateColumns: e
};
}
const ci = /* @__PURE__ */ new Map([
["appearance", oo]
]);
function di(e, t, n) {
return t;
}
const fi = "https://json-schema.org/draft/2020-12/schema", pi = "https://farris-design.gitee.io/button-edit.schema.json", mi = "button-edit", vi = "A Farris Input Component", hi = "object", gi = {
id: {
description: "The unique identifier for a Input Group",
type: "string"
},
type: {
description: "The type string of Input Group component",
type: "string",
default: "button-edit"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string"
},
style: {
type: "string"
}
},
default: {}
},
binding: {
description: "",
type: "object",
default: {}
},
disable: {
type: "string",
default: !1
},
editable: {
description: "",
type: "boolean",
default: !0
},
enableLinkLabel: {
description: "",
type: "boolean",
default: !1
},
label: {
description: "",
type: "string",
default: ""
},
lableWidth: {
description: "",
type: "number"
},
placeholder: {
description: "",
type: "string",
default: ""
},
forcePlaceholder: {
description: "",
type: "boolean",
default: !1
},
readonly: {
description: "",
type: "boolean",
default: !1
},
require: {
description: "",
type: "boolean",
default: !1
},
tabindex: {
description: "",
type: "number",
default: -1
},
textAlign: {
description: "",
type: "string",
enum: [
"left",
"middle",
"right"
],
default: "left"
},
visible: {
description: "",
type: "boolean",
default: !0
},
onBlur: {
description: "",
type: "string",
default: ""
},
onClickLinkLabel: {
description: "",
type: "sting",
default: ""
},
autoComplete: {
description: "",
type: "boolean",
default: !1
},
buttonContent: {
description: "",
type: "string",
default: ""
},
enableClear: {
description: "",
type: "boolean",
default: !0
},
inputType: {
description: "",
type: "string",
enum: [
"text",
"tag"
],
default: "text"
},
multiSelect: {
description: "",
type: "boolean",
default: !1
},
popup: {
description: "",
type: "object",
properties: {
footerButtons: {
type: "array",
default: []
},
height: {
type: "number",
default: 600
},
dataMapping: {
type: "object"
},
contents: {
type: "array",
default: []
},
showMaxButton: {
type: "boolean",
default: !0
},
showCloseButton: {
type: "boolean",
default: !0
},
showFooter: {
type: "boolean",
default: !0
},
title: {
type: "string",
default: ""
},
width: {
type: "number",
default: 800
}
}
},
popupClass: {
description: "",
type: "sting",
default: ""
},
separator: {
type: "string",
default: ","
},
showButtonWhenDisabled: {
description: "",
type: "boolean",
default: !1
},
wrapText: {
type: "boolean",
default: !1
},
onClear: {
description: "",
type: "string",
default: ""
}
}, yi = [
"id",
"type"
], bi = {
$schema: fi,
$id: pi,
title: mi,
description: vi,
type: hi,
properties: gi,
required: yi
}, Ci = "buttonEdit", wi = "A Farris Component", _i = "object", Si = {
basic: {
description: "Basic Infomation",
title: "基本信息",
properties: {
id: {
description: "组件标识",
title: "标识",
type: "string",
readonly: !0
},
type: {
description: "组件类型",
title: "控件类型",
type: "select",
editor: {
type: "waiting for modification",
enum: []
}
}
}
},
behavior: {
description: "Basic Infomation",
title: "行为",
properties: {
editable: {
description: "",
title: "允许编辑",
type: "boolean"
},
readonly: {
description: "",
title: "只读",
type: "string"
},
required: {
description: "",
title: "必填",
type: "boolean"
},
visible: {
description: "",
title: "可见",
type: "boolean"
},
placeholder: {
description: "",
title: "提示文本",
type: "string"
},
tabindex: {
description: "",
title: "tab索引",
type: "number"
},
textAlign: {
description: "",
title: "对齐方式",
type: "enum",
editor: {
type: "combo-list",
textField: "name",
valueField: "value",
data: [
{
value: "left",
name: "左对齐"
},
{
value: "center",
name: "居中"
},
{
value: "right",
name: "右对齐"
}
]
}
}
}
}
}, xi = {
title: Ci,
description: wi,
type: _i,
categories: Si
}, vn = {
/**
* 组件标识
*/
id: String,
/**
* 扩展按钮显示内容,这是一段现在扩展按钮中的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: 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" },
preventScroll: { type: Boolean, default: !1 }
};
lt(vn, bi, ci, di, xi);
const Ti = {
popupContentPosition: { type: Object, default: { left: 0, top: 0 } },
host: { type: Object },
backgroundColor: { type: String, default: "" }
}, Fi = /* @__PURE__ */ Ne({
name: "FOverlay",
props: Ti,
emits: ["click"],
setup(e, t) {
const n = w(e.popupContentPosition), o = w(e.host), a = P(() => ({
backgroundColor: e.backgroundColor || "",
pointerEvents: "auto"
}));
function r(l) {
t.emit("click"), l.preventDefault(), l.stopPropagation();
}
P(() => {
const l = o.value;
if (l) {
const s = l.getBoundingClientRect(), {
left: p,
top: c,
height: u
} = s;
return {
left: p,
top: c + u
};
}
return n.value;
});
const i = P(() => ({
// position: 'relative',
// left: `${position.value.left}px`,
// top: `${position.value.top}px`
}));
return () => k(an, {
to: "body"
}, {
default: () => {
var l, s;
return [k("div", {
class: "overlay-container",
onClick: (p) => r(p),
style: a.value
}, [k("div", {
style: i.value
}, [(s = (l = t.slots).default) == null ? void 0 : s.call(l)])])];
}
});
}
});
function ki(e) {
if (e.content && e.content.render)
return e.content.render;
if (e.render && typeof e.render == "function")
return e.render;
}
function Oi(e) {
const t = document.createElement("div");
t.style.display = "contents";
let n;
const o = e.onClickCallback || (() => {
}), a = () => {
o(), n && n.unmount();
};
return n = qt({
setup() {
Tt(() => {
document.body.removeChild(t);
});
const r = ki(e);
return () => k(Fi, {
"popup-content-position": e.popupPosition,
host: e.host,
onClick: a,
backgroundColor: e.backgroundColor
}, {
default: () => [r && r()]
});
}
}), document.body.appendChild(t), n.mount(t), n;
}
class Ei {
static show(t) {
return Oi(t);
}
}
const Bi = {
/**
* 自定义类
*/
class: { 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 },
/**
* 是否展示头部
*/
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 }
};
class Me {
constructor(t, n) {
this.x = t, this.y = n;
}
static getTransformInfo(t) {
const o = window.getComputedStyle(t).getPropertyValue("transform").replace(/[^-\d,]/g, "").split(",");
if (o.length >= 6) {
const a = parseInt(o[4], 10), r = parseInt(o[5], 10);
return { x: a, y: r };
}
return { x: 0, y: 0 };
}
static fromEvent(t, n = null) {
if (this.isMouseEvent(t))
return new Me(t.clientX, t.clientY);
if (n === null || t.changedTouches.length === 1)
return new Me(t.changedTouches[0].clientX, t.changedTouches[0].clientY);
for (let o = 0; o < t.changedTouches.length; o++)
if (t.changedTouches[o].target === n)
return new Me(t.changedTouches[o].clientX, t.changedTouches[o].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 Me(0, 0);
if (window) {
const o = window.getComputedStyle(t);
if (o) {
const a = parseInt(o.getPropertyValue("left"), 10), r = parseInt(o.getPropertyValue("top"), 10);
n.x = isNaN(a) ? 0 : a, n.y = isNaN(r) ? 0 : r;
}
return n;
}
return null;
}
static copy(t) {
return new Me(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 ht {
constructor(t, n) {
this.width = t, this.height = n;
}
static getCurrent(t) {
const n = new ht(0, 0);
if (window) {
const o = window.getComputedStyle(t);
return o && (n.width = parseInt(o.getPropertyValue("width"), 10), n.height = parseInt(o.getPropertyValue("height"), 10)), n;
}
return null;
}
static copy(t) {
return new ht(0, 0).set(t);
}
set(t) {
return this.width = t.width, this.height = t.height, this;
}
}
function Mi(e, t) {
const n = w(), o = w(), a = w(), r = w(), i = w(), l = w(), s = w(), p = w(), c = w(), u = w(), f = w(), g = w(), b = w(e.draggable), R = w(!1);
function S() {
const E = o.value || document.body, N = window.getComputedStyle(E);
if (!N || !n.value)
return;
const H = Me.getTransformInfo(n.value), X = {};
s.value && (X.deltaL = n.value.offsetLeft - s.value.x, X.deltaT = n.value.offsetTop - s.value.y);
const oe = N.getPropertyValue("position");
X.width = E.clientWidth, X.height = E.clientHeight, X.pr = parseInt(N.getPropertyValue("padding-right"), 10), X.pb = parseInt(N.getPropertyValue("padding-bottom"), 10), X.position = N.getPropertyValue("position"), oe === "static" && (E.style.position = "relative"), X.translateX = H.x, X.translateY = H.y, u.value = X;
}
function m(E) {
if (n.value) {
r.value = ht.getCurrent(n.value), i.value = Me.getCurrent(n.value), l.value = r.value ? ht.copy(r.value) : null, s.value = i.value ? Me.copy(i.value) : null, S();
const N = E.target.getAttribute("type") || "";
p.value = {
n: !!N.match(/n/),
s: !!N.match(/s/),
w: !!N.match(/w/),
e: !!N.match(/e/)
};
}
}
function h() {
var E, N, H, X;
if (n.value) {
const oe = n.value;
p.value && ((p.value.n || p.value.s) && ((E = l.value) != null && E.height) && (oe.style.height = l.value.height + "px"), (p.value.w || p.value.e) && ((N = l.value) != null && N.width) && (oe.style.width = l.value.width + "px"), s.value && ((H = s.value) != null && H.x && (oe.style.left = s.value.x + "px"), (X = s.value) != null && X.y && (oe.style.top = s.value.y + "px")));
}
}
function F() {
const E = e.minHeight ? e.minHeight : 1, N = e.minWidth ? e.minWidth : 1;
l.value && s.value && p.value && r.value && (l.value.height < E && (l.value.height = E, p.value.n && i.value && (s.value.y = i.value.y + (r.value.height - E))), l.value.width < N && (l.value.width = N, p.value.w && i.value && (s.value.x = i.value.x + (r.value.width - N))), e.maxHeight && l.value.height > e.maxHeight && (l.value.height = e.maxHeight, i.value && p.value.n && (s.value.y = i.value.y + (r.value.height - e.maxHeight))), e.maxWidth && l.value.width > e.maxWidth && (l.value.width = e.maxWidth, p.value.w && i.value && (s.value.x = i.value.x + (r.value.width - e.maxWidth))));
}
function v() {
if (o.value) {
const E = u.value;
if (s.value && l.value && p.value && r.value) {
const N = E.width - E.pr - E.deltaL - E.translateX - s.value.x, H = E.height - E.pb - E.deltaT - E.translateY - s.value.y;
p.value.n && s.value.y + E.translateY < 0 && i.value && (s.value.y = -E.translateY, l.value.height = r.value.height + i.value.y + E.translateY), p.value.w && s.value.x + E.translateX < 0 && i.value && (s.value.x = -E.translateX, l.value.width = r.value.width + i.value.x + E.translateX), l.value.width > N && (l.value.width = N), l.value.height > H && (l.value.height = H);
}
}
}
function T(E) {
if (!a.value || !r.value || !i.value || !p.value)
return;
E.subtract(a.value);
const N = E.x, H = E.y;
p.value.n ? (s.value.y = i.value.y + H, l.value.height = r.value.height - H) : p.value.s && (l.value.height = r.value.height + H), p.value.e ? l.value.width = r.value.width + N : p.value.w && (l.value.width = r.value.width - N, s.value.x = i.value.x + N), v(), F(), h();
}
function B(E) {
if (!c.value)
return;
const N = Me.fromEvent(E);
N && T(N);
}
function d() {
if (n.value) {
const {
width: E,
height: N,
x: H,
y: X
} = n.value.getBoundingClientRect(), oe = Me.getTransformInfo(n.value);
return {
size: {
width: E,
height: N
},
position: {
x: H - oe.x,
y: X - oe.y
}
};
}
return null;
}
function _(E) {
if (n.value) {
const N = d();
f.value = N;
}
a.value = void 0, r.value = null, i.value = null, l.value = null, s.value = null, p.value = null, c.value = null, document.removeEventListener("mousemove", B), document.removeEventListener("mouseup", _);
}
function x() {
document.addEventListener("mousemove", B), document.addEventListener("mouseup", _);
}
function C(E) {
E instanceof MouseEvent && E.button === 2 || b.value && (document.body.click(), E.stopPropagation(), E.preventDefault(), a.value = Me.fromEvent(E), c.value = E.target, m(E), x());
}
function y(E) {
return n.value = E, k(Ct, null, [k("div", {
class: "fv-resizable-handle fv-resizable-n",
type: "n",
onMousedown: (N) => C(N)
}, null), k("div", {
class: "fv-resizable-handle fv-resizable-e",
type: "e",
onMousedown: (N) => C(N)
}, null), k("div", {
class: "fv-resizable-handle fv-resizable-s",
type: "s",
onMousedown: (N) => C(N)
}, null), k("div", {
class: "fv-resizable-handle fv-resizable-w",
type: "w",
onMousedown: (N) => C(N)
}, null), k("div", {
class: "fv-resizable-handle fv-resizable-ne",
type: "ne",
onMousedown: (N) => C(N)
}, null), k("div", {
class: "fv-resizable-handle fv-resizable-se fv-resizable-diagonal",
type: "se",
onMousedown: (N) => C(N)
}, null), k("div", {
class: "fv-resizable-handle fv-resizable-sw",
type: "sw",
onMousedown: (N) => C(N)
}, null), k("div", {
class: "fv-resizable-handle fv-resizable-nw",
type: "nw",
onMousedown: (N) => C(N)
}, null)]);
}
function D(E = !0) {
document.body.click();
const N = o.value || document.body, H = ht.getCurrent(N), X = n.value;
E && X && (g.value = d(), g.value.transform = X.style.transform), H && X && (l.value = H, X.style.height = l.value.height - 14 + "px", X.style.width = l.value.width - 14 + "px", X.style.left = "7px", X.style.top = "7px", X.style.transform = "", f.value = {
size: l.value,
position: {
x: 0,
y: 0
}
}, b.value = !1, R.value = !0);
}
function I() {
var E, N;
if (document.body.click(), g.value) {
const H = {
width: g.value.size.width || 0,
height: g.value.size.height || 0
}, X = {
x: (window.innerWidth - H.width) / 2,
y: (window.innerHeight - H.height) / 2
};
(E = l.value) == null || E.set(H), (N = s.value) == null || N.set(X);
const oe = n.value;
oe.style.height = H.height + "px", oe.style.width = H.width + "px", oe.style.left = `${X.x}px`, oe.style.top = `${X.y}px`, oe.style.transform = "", f.value = {
size: H,
position: X
}, b.value = e.draggable, R.value = !1;
}
}
function V() {
if (n.value) {
const E = ht.getCurrent(n.value);
if (E) {
const {
width: N,
height: H
} = E;
n.value.style.left = `${(window.innerWidth - N) / 2}px`, n.value.style.top = `${(window.innerHeight - H) / 2}px`, n.value.style.transform = "";
}
}
}
function O() {
const E = () => {
R.value ? D(!1) : V(), document.body.click();
};
return window.addEventListener("resize", E), () => {
window.removeEventListener("resize", E);
};
}
const M = O();
return {
renderResizeBar: y,
boundingElement: o,
resizedEventParam: f,
maximize: D,
restore: I,
allowDrag: b,
isMaximized: R,
unWindowResizeHandle: M
};
}
function Ii(e, t, n) {
const o = w(), a = w(e.draggable), r = w(e.lockAxis), i = w(), l = w(), s = w(!1), p = w(new Me(0, 0)), c = w(new Me(0, 0)), u = w(new Me(0, 0)), f = w(new Me(0, 0));
we(() => n.value, (d) => {
i.value.style.cursor = d ? "move" : "default";
});
function g(d, _) {
if (_.tagName === "BUTTON")
return !1;
if (_ === d)
return !0;
for (const x in _.children)
if (Object.prototype.hasOwnProperty.call(_.children, x) && g(d, _.children[x]))
return !0;
return !1;
}
function b() {
var C, y;
let d = u.value.x + c.value.x, _ = u.value.y + c.value.y;
r.value === "x" ? (d = ((C = p.value) == null ? void 0 : C.x) || 0, u.value.x = 0) : r.value === "y" && (_ = ((y = p.value) == null ? void 0 : y.y) || 0, u.value.y = 0);
const x = `translate3d(${Math.round(d)}px, ${Math.round(_)}px, 0px)`;
o.value && (o.value.style.transform = x), f.value.x = d, f.value.y = _;
}
function R() {
if (!l.value || !o.value)
return null;
const d = l.value.getBoundingClientRect(), _ = o.value.getBoundingClientRect(), x = {
top: d.top < _.top,
right: d.right > _.right,
bottom: d.bottom > _.bottom,
left: d.left < _.left
};
return x.top || (u.value.y -= _.top - d.top), x.bottom || (u.value.y -= _.bottom - d.bottom), x.right || (u.value.x -= _.right - d.right), x.left || (u.value.x -= _.left - d.left), b(), x;
}
function S(d) {
d && (p.value && d.subtract(p.value), u.value.set(d), b(), R());
}
function m(d) {
s.value && a.value && (d.stopPropagation(), d.preventDefault(), S(Me.fromEvent(d, i.value)));
}
function h() {
var d;
s.value && (s.value = !1, c.value.add(u.value), u.value.reset(), (d = o.value) == null || d.classList.remove("ng-dragging"), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", h));
}
function F() {
!s.value && i.value && (s.value = !0, i.value.classList.add("ng-dragging"), document.addEventListener("mousemove", m), document.addEventListener("mouseup", h));
}
function v() {
if (o.value) {
const d = Me.getTransformInfo(o.value);
c.value.set(d);
return;
}
c.value.reset();
}
function T(d) {
if (!n.value || d instanceof MouseEvent && d.button === 2)
return;
const _ = d.target || d.srcElement;
i.value !== void 0 && _ && !g(_, i.value) || a.value !== !1 && (document.body.click(), d.stopPropagation(), d.preventDefault(), p.value = Me.fromEvent(d, o.value), v(), F());
}
function B(d, _, x) {
if (a.value && _) {
if (d)
i.value = d;
else if (e.dragHandle) {
if (e.dragHandle instanceof HTMLElement)
i.value = e.dragHandle;
else if (typeof e.dragHandle == "string") {
const C = _.querySelector(e.dragHandle);
C && (i.value = C);
}
}
o.value = _, l.value = x, i.value ? (i.value.classList.add("ng-draggable"), i.value.addEventListener("mousedown", T)) : a.value = !1;
}
}
return {
registerDraggle: B,
resetTranslate: v
};
}
function hn(e, t) {
if (e) {
const n = (o) => {
o.key.toLowerCase() === e.toLowerCase() && t({ event: o, key: e });
};
return document.addEventListener("keydown", n), () => {
document.removeEventListener("keydown", n);
};
}
}
function Vi(e, t) {
const n = w(e.enableEsc);
let o = null;
return n.value ? (o = hn("Escape", (a) => {
t.emit("esc", { event: a.event, type: "esc" });
}), {
remove: o
}) : null;
}
function Di(e, t) {
const n = w(e.enableEnter);
let o = null;
return n.value ? (o = hn("Enter", (a) => {
t.emit("enter", { event: a.event, type: "enter" });
}), {
remove: o
}) : null;
}
const wt = /* @__PURE__ */ Ne({
name: "FModal",
props: Bi,
emits: ["update:modelValue", "accept", "cancel", "closed", "resize", "esc", "enter"],
setup(e, t) {
const n = w(e.width || 300), o = w(e.height || 200), a = w(e.modelValue), r = w(""), i = w(e.class), l = w(e.fitContent), s = w(e.showHeader), p = w(""), c = w(e.showCloseButton), u = w(e.showMaxButton), f = w(!1), g = w(e.dialogType), b = w(e.src), R = w(""), S = w(e.showButtons), m = w(e.title), h = w(e.resizeable), F = w(e.containment || null), v = w(), T = w(!1);
function B(ne, be) {
a.value = !1, t.emit("update:modelValue", !1), be != null && t.emit(be ? "accept" : "cancel"), t.emit("closed", ne);
}
const d = [{
name: "cancel",
text: "取消",
class: "btn btn-secondary",
handle: (ne) => {
B(ne, !1);
}
}, {
name: "accept",
text: "确定",
class: "btn btn-primary",
handle: (ne) => {
B(ne, !0);
}
}], _ = w(e.buttons && e.buttons.length ? e.buttons : d), x = P(() => !!p.value), C = P(() => !!S.value && !!_.value), y = w(), D = w(), I = w(!1), {
renderResizeBar: V,
maximize: O,
restore: M,
boundingElement: E,
resizedEventParam: N,
allowDrag: H,
unWindowResizeHandle: X
} = Mi(e), {
registerDraggle: oe
} = Ii(e, t, H);
function ee() {
return !!document.querySelectorAll(".farris-modal").length && document.body.classList.contains("modal-open");
}
function pe() {
const ne = document.querySelectorAll(".farris-modal").length;
(!ne || ne - 1 <= 0) && document.body.classList.remove("modal-open"), v.value && v.value.classList.remove("show");
}
we(() => e.title, (ne, be) => {
ne !== be && (m.value = ne);
}), we(() => e.modelValue, (ne, be) => {
ne !== be && (a.value = ne, ne || pe()), a.value && (T.value = ee());
}), we(() => e.showHeader, (ne, be) => {
ne !== be && (s.value = ne);
}), we(() => e.showButtons, (ne, be) => {
ne !== be && (S.value = ne);
}), we(() => N.value, (ne, be) => {
const Oe = ne || {}, Ve = be || {};
JSON.stringify(Oe) !== JSON.stringify(Ve) && t.emit("resize", {
newSize: ne,
oldSize: be
});
});
const W = P(() => (a.value && document.body.classList.add("modal-open"), a.value)), L = P(() => {
const ne = {
modal: !0,
"farris-modal": !0,
fade: !0
};
return ne["f-modal-fitContent"] = !!l.value, ne.show = !!W.value, ne;
}), A = P(() => {
var Oe;
const ne = {
"modal-dialog": !0
}, be = (Oe = i.value) == null ? void 0 : Oe.split(" ");
return be == null || be.reduce((Ve, ke) => (Ve[ke] = !0, Ve), ne), ne;
}), U = P(() => ({
position: "absolute",
top: `${(window.innerHeight - o.value) / 2}px`,
left: `${(window.innerWidth - n.value) / 2}px`,
width: `${n.value}px`,
height: l.value ? "auto" : `${o.value}px`
})), Q = P(() => ({
"modal-content": !0,
"modal-content-has-header": s.value
})), Y = P(() => {
const ne = {
display: s.value ? "" : "none"
};
return ne["pointer-events"] = H.value ? "auto" : "none", ne;
}), $ = P(() => ({
"f-icon": !0,
modal_maximize: !0,
modalrevert: I.value
})), G = P(() => ({
"modal-body": !0,
"f-utils-flex-column": g.value === "iframe",
"f-utils-fill": !0
}));
function ie() {
return {
height: `${e.footerHeight || 60}px`
};
}
const J = P(() => {
const ne = {
textAlgin: R.value
}, be = ie();
return Object.assign(ne, be);
});
function Z(ne) {
if (ne.stopPropagation(), I.value) {
I.value = !1, M();
return;
}
O(), I.value = !0;
}
async function xe(ne, be) {
ne.handle && await ne.handle(be, ne) && t.emit("closed", be);
}
function Fe(ne) {
ne.width && (n.value = ne.width), ne.height && (o.value = ne.height), ne.buttons && (_.value = ne.buttons), ne.title && (m.value = ne.title);
}
const Te = P(() => {
const ne = {
display: "inline-block"
};
return T.value && (ne["background-color"] = "transparent"), ne;
});
let We = null, Re = null;
Yn(() => {
T.value = ee();
}), vt(() => {
D.value && !F.value && (F.value = D.value.parentElement, E.value = F.value, oe(y.value, D.value, E.value)), W.value && document.body.classList.add("modal-open"), We = Vi(e, t), Re = Di(e, t);
}), Tt(() => {
X && X(), We && We.remove(), Re && Re.remove();
}), t.expose({
modalElementRef: D,
updateModalOptions: Fe,
close: B,
maxDialog: Z
});
function Be() {
return k("ul", null, [f.value && k("li", {
class: "f-btn-icon f-bare"
}, [k("span", {
class: "f-icon modal_minimize"
}, null)]), u.value && k("li", {
onClick: Z,
class: "f-btn-icon f-bare",
style: "pointer-events: auto;"
}, [k("span", {
class: $.value
}, null)]), c.value && k("li", {
class: "f-btn-icon f-bare",
onClick: (ne) => B(ne, !1),
style: "pointer-events: auto;"
}, [k("span", {
class: "f-icon modal_close"
}, null)])]);
}
function Ge() {
return k("div", {
class: "modal-footer",
style: J.value
}, [_.value && _.value.map((ne) => k("button", {
name: ne.name,
type: "button",
class: ne.class + (ne.iconClass ? " btn-icontext" : ""),
onClick: (be) => {
xe(ne, be);
}
}, [!!ne.iconClass && k("i", {
class: ne.iconClass
}, null), ne.text]))]);
}
function Ae() {
return k("div", {
ref: y,
class: "modal-header",
style: Y.value
}, [k("div", {
class: "modal-title"
}, [x.value && k("span", {
class: p.value,
style: "margin-right: 8px"
}, null), k("span", {
class: "modal-title-label"
}, [m.value])]), k("div", {
class: "actions"
}, [Be()])]);
}
function at(ne) {
ne.stopPropagation();
}
return () => k(an, {
to: "body"
}, {
default: () => [W.value && k(rn, {
name: "fade",
appear: !0
}, {
default: () => {
var ne, be;
return [k("div", {
class: L.value,
style: Te.value,
ref: v,
onClick: at
}, [k("div", {
id: r.value,
class: A.value,
style: U.value,
ref: D
}, [k("div", {
class: Q.value
}, [s.value && Ae(), k("div", {
class: G.value
}, [(be = (ne = t.slots).default) == null ? void 0 : be.call(ne), g.value === "iframe" && k("iframe", {
title: r.value,
class: "f-utils-fill",
width: "100%",
frameborder: "0",
src: b.value
}, null)]), C.value && Ge()]), !l.value && h.value && D.value && !I.value && V(D.value)])])];
}
})]
});
}
});
function gn(e) {
if (e.content && e.content.render)
return e.content.render;
if (e.render && typeof e.render == "function")
return e.render;
}
function Ri(e) {
const t = document.createElement("div");
t.style.display = "contents";
const n = qt({
setup(o, a) {
Tt(() => {
document.body.removeChild(t);
});
const r = w(), i = w(e.class || ""), l = w(!!e.showButtons), s = w(!!e.showHeader), p = w(e.showCloseButton == null ? !0 : e.showCloseButton), c = w(!0), u = w(e.title || ""), f = e.acceptCallback || (() => {
}), g = e.rejectCallback || (() => {
}), b = e.closedCallback || ((h) => {
}), R = e.resizeHandle || ((h) => {
}), S = gn(e), m = (h) => {
c.value = !1, n.unmount(), b(h);
};
return vt(() => {
}), a.expose({
modalRef: r
}), () => k(wt, {
ref: r,
class: i.value,
modelValue: c.value,
"onUpdate:modelValue": (h) => c.value = h,
title: u.value,
width: e.width,
height: e.height,
buttons: e.buttons,
"show-header": s.value,
"show-buttons": l.value,
"show-close-button": p.value,
"show-max-button": !1,
onAccept: f,
onCancel: g,
fitContent: e.fitContent == null ? !0 : e.fitContent,
onClosed: m,
onResize: R
}, {
default: () => [S && S(n)]
});
}
});
return document.body.appendChild(t), n.mount(t), n;
}
class yn {
constructor(t) {
te(this, "appContext", null);
te(this, "modalRef", w());
te(this, "activeModalIndex", w(0));
te(this, "modalRefs", {});
te(this, "isUseEscCloseModal", w(!1));
te(this, "activeModalInstance", P(() => this.modalRefs[this.activeModalIndex.value]));
this.app = t, this.appContext = t ? t._context : null;
}
getCurrentModal() {
return this.activeModalInstance.value;
}
adaptToWindow(t, n) {
const {
width: o,
height: a
} = {
width: window.innerWidth,
height: window.innerHeight
};
return o < t && (t = o), a < n && (n = a), {
width: t,
height: n
};
}
static show(t) {
const n = Object.assign({
title: "",
showButtons: !0,
showHeader: !0
}, t);
return Ri(n);
}
close(t) {
var n, o;
t ? (o = t.value) == null || o.close() : (n = this.getCurrentModal()) == null || n.close();
}
open(t) {
const n = document.createDocumentFragment();
t.showMaxButton && t.fitContent && (t.showMaxButton = !1);
const o = Xn(Object.assign({
title: "",
showButtons: !0,
showHeader: !0
}, t)), a = w(!0), r = o.value.acceptCallback || (() => {
}), i = o.value.rejectCallback || (() => {
}), l = o.value.closedCallback || ((v, T) => {
}), s = o.value.resizeHandle || ((v) => {
});
let p;
const c = gn(o.value), u = (v) => {
var B;
a.value = !1;
const T = (B = v == null ? void 0 : v.target) == null ? void 0 : B.classList.contains("modal_close");
l(v, this.isUseEscCloseModal.value ? "esc" : T ? "icon" : "button");
}, f = (v) => {
u(v), p && bt(() => {
if (this.modalRefs[this.activeModalIndex.value] && delete this.modalRefs[this.activeModalIndex.value], Nt(null, n), p = null, this.modalRef.value = null, this.modalRefs) {
const T = Object.keys(this.modalRefs).map((B) => Number(B));
T.length > 0 ? this.activeModalIndex.value = Math.max(...T) : this.activeModalIndex.value = 0;
}
this.isUseEscCloseModal.value = !1;
});
}, g = (v) => {
var T;
this.isUseEscCloseModal.value = !0, this.activeModalInstance && ((T = this.activeModalInstance.value) == null || T.close(v == null ? void 0 : v.event));
}, {
width: b,
height: R
} = o.value, S = this.adaptToWindow(b || 500, R || 320);
Object.assign(o.value, S);
const m = () => k(wt, ft({
ref: this.modalRef,
modelValue: a.value,
"onUpdate:modelValue": (v) => a.value = v
}, o.value, {
onAccept: r,
onCancel: i,
onClosed: f,
onResize: s,
onEsc: g
}), {
default: () => [c && c(this.app)]
});
return p = ((v) => {
const T = Kn(m, v);
return T.appContext = this.appContext, Nt(T, n), T;
})({
...o.value
// 'onUpdate:modelValue': onUpdateModelValue,
}), this.activeModalIndex.value++, this.modalRefs[this.activeModalIndex.value] = this.modalRef.value, {
update: (v) => {
o.value = {
...o.value,
...v
}, p && Nt(Qn(p, {
...o
}), n);
},
destroy: f,
modalRef: this.activeModalInstance,
close: this.close
};
}
}
const bn = Symbol("FModalService");
wt.install = (e) => {
e.component(wt.name, wt);
const t = new yn(e);
e.provide(bn, t), e.provide("FModalService", t);
};
function Cn(e, t) {
function n() {
const o = e.beforeOpen || e.beforeClickButton || null;
let a = Promise.resolve(!0);
if (o) {
const r = o(t.value);
if (typeof r > "u")
return a;
typeof r == "boolean" ? a = Promise.resolve(r) : a = r;
}
return a;
}
return { judgeCanOpen: n };
}
function Ni(e, t, n, o, a) {
const r = w(e.buttonBehavior), i = w(e.popupOnInput), l = P(() => ({
"input-group-append": !0,
"append-force-show": e.showButtonWhenDisabled && (e.readonly || e.disable)
})), { judgeCanOpen: s } = Cn(e, a), p = P(() => e.showButtonWhenDisabled || (!e.editable || !e.readonly) && !e.disable), c = pt(bn, null), u = w();
async function f(R) {
if (await s() && p.value) {
const S = !!t.slots.default;
if (r.value === "Mod