UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

185 lines (184 loc) 3.84 kB
import p, { modalProps as d } from "../../components/modal/index.esm.js"; import { resolveAppearance as u, createPropsResolver as f } from "../../components/dynamic-resolver/index.esm.js"; const y = "https://json-schema.org/draft/2020-12/schema", b = "https://farris-design.gitee.io/modal.schema.json", m = "modal", g = "弹窗组件", h = "object", C = { 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 }, showHeader: { description: "是否展示头部", type: "boolean", default: !0 }, mapFields: { description: "映射字段", type: "object", default: null }, buttons: { description: "底部按钮", type: "array", default: [] } }, v = [ "id", "type" ], j = { onAccept: "确定事件", onCancel: "取消事件", beforeClose: "关闭前回调" }, R = { $schema: y, $id: b, title: m, description: g, type: h, properties: C, required: v, events: j }, M = /* @__PURE__ */ new Map([ ["appearance", u] ]); function k(n, e, t) { return e; } function w() { function n(e, t, o) { const r = {}; return r.beforeClose = (l) => t.call("beforeClose", e, [l, e], o), r; } return { resolve: n }; } function A() { function n(e, t) { const { buttons: o, onAccept: r, onCancel: l } = e; if (!o || !o.length) return t.name === "accept" || t.name === "cancel" ? t.name === "accept" ? r : l : null; const [s] = t.payloads; if (!s) return null; const a = o.find((i) => { var c; return i.id === ((c = s == null ? void 0 : s.button) == null ? void 0 : c.id); }); return a ? a.onClick || a.click : null; } return { resolve: n }; } const $ = f(d, R, M, k), x = w(), B = A(), q = { register: (n, e, t, o) => { n.modal = p, e.modal = $, o.modal = { callbackResolver: x, eventHandlerResolver: B }; } }; export { x as callbackResolver, q as default, B as eventHandlerResolver, $ as propsResolver };