@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
856 lines (855 loc) • 27.1 kB
JavaScript
var J = Object.defineProperty;
var Q = (o, e, t) => e in o ? J(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
var V = (o, e, t) => Q(o, typeof e != "symbol" ? e + "" : e, t);
import { defineComponent as S, ref as C, onUnmounted as q, createVNode as k, createTextVNode as _, watch as X, inject as F, onMounted as Z } from "vue";
import { isPlainObject as $, cloneDeep as U } from "lodash-es";
const W = {}, z = {};
function O(o) {
const { properties: e, title: t, ignore: n } = o, r = n && Array.isArray(n), i = Object.keys(e).reduce((a, m) => ((!r || !n.find((h) => h === m)) && (a[m] = e[m].type === "object" && e[m].properties ? O(e[m]) : U(e[m].default)), a), {});
if (t && (!r || !n.find((a) => a === "id"))) {
const a = t.toLowerCase().replace(/-/g, "_");
i.id = `${a}_${Math.random().toString().slice(2, 6)}`;
}
return i;
}
function R(o) {
const { properties: e, title: t, required: n } = o;
if (n && Array.isArray(n)) {
const r = n.reduce((i, a) => (i[a] = e[a].type === "object" && e[a].properties ? O(e[a]) : U(e[a].default), i), {});
if (t && n.find((i) => i === "id")) {
const i = t.toLowerCase().replace(/-/g, "_");
r.id = `${i}_${Math.random().toString().slice(2, 6)}`;
}
return r;
}
return {
type: t
};
}
function Y(o, e = {}, t) {
const n = W[o];
if (n) {
let r = R(n);
const i = z[o];
return r = i ? i({ getSchemaByType: Y }, r, e, t) : r, r;
}
return null;
}
function K(o, e) {
const t = O(e);
return Object.keys(t).reduce((n, r) => (Object.prototype.hasOwnProperty.call(o, r) && (n[r] && $(n[r]) && $(o[r] || !o[r]) ? Object.assign(n[r], o[r] || {}) : n[r] = o[r]), n), t), t;
}
function G(o, e) {
return Object.keys(o).filter((n) => o[n] != null).reduce((n, r) => {
if (e.has(r)) {
const i = e.get(r);
if (typeof i == "string")
n[i] = o[r];
else {
const a = i(r, o[r], o);
Object.assign(n, a);
}
} else
n[r] = o[r];
return n;
}, {});
}
function I(o, e, t = /* @__PURE__ */ new Map()) {
const n = K(o, e);
return G(n, t);
}
function H(o = {}) {
function e(c, p, u, d) {
if (typeof u == "number")
return d[c].length === u;
if (typeof u == "object") {
const y = Object.keys(u)[0], v = u[y];
if (y === "not")
return Number(d[c].length) !== Number(v);
if (y === "moreThan")
return Number(d[c].length) >= Number(v);
if (y === "lessThan")
return Number(d[c].length) <= Number(v);
}
return !1;
}
function t(c, p, u, d) {
return d[c] && d[c].propertyValue && String(d[c].propertyValue.value) === String(u);
}
const n = /* @__PURE__ */ new Map([
["length", e],
["getProperty", t]
]);
Object.keys(o).reduce((c, p) => (c.set(p, o[p]), c), n);
function r(c, p) {
const u = c;
return typeof p == "number" ? [{ target: u, operator: "length", param: null, value: Number(p) }] : typeof p == "boolean" ? [{ target: u, operator: "getProperty", param: c, value: !!p }] : typeof p == "object" ? Object.keys(p).map((d) => {
if (d === "length")
return { target: u, operator: "length", param: null, value: p[d] };
const y = d, v = p[d];
return { target: u, operator: "getProperty", param: y, value: v };
}) : [];
}
function i(c) {
return Object.keys(c).reduce((u, d) => {
const y = r(d, c[d]);
return u.push(...y), u;
}, []);
}
function a(c, p) {
if (n.has(c.operator)) {
const u = n.get(c.operator);
return u && u(c.target, c.param, c.value, p) || !1;
}
return !1;
}
function m(c, p) {
return i(c).reduce((y, v) => y && a(v, p), !0);
}
function h(c, p) {
const u = Object.keys(c), d = u.includes("allOf"), y = u.includes("anyOf"), v = d || y, l = (v ? c[v ? d ? "allOf" : "anyOf" : "allOf"] : [c]).map((D) => m(D, p));
return d ? !l.includes(!1) : l.includes(!0);
}
return { parseValueSchema: h };
}
const x = {
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: "抽屉" }
}, ee = {}, te = {};
H();
function oe(o, e, t = /* @__PURE__ */ new Map(), n = (a, m, h, c) => m, r = {}, i = (a) => a) {
return W[e.title] = e, z[e.title] = n, ee[e.title] = r, te[e.title] = i, (a = {}, m = !0) => {
if (!m)
return G(a, t);
const h = I(a, e, t), c = Object.keys(o).reduce((p, u) => (p[u] = o[u].default, p), {});
return Object.assign(c, h);
};
}
function ne(o, e) {
return { customClass: e.class, customStyle: e.style };
}
const ae = "https://json-schema.org/draft/2020-12/schema", re = "https://farris-design.gitee.io/video.schema.json", ie = "video", ce = "A Farris Video Component", se = "object", le = {
id: {
description: "The unique identifier for a Video",
type: "string"
},
type: {
description: "The type string of Video component",
type: "string",
default: "video"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string"
},
style: {
type: "string"
}
},
default: {}
},
visible: {
description: "",
type: "boolean",
default: !0
}
}, pe = [
"id",
"type"
], ue = {
$schema: ae,
$id: re,
title: ie,
description: ce,
type: se,
properties: le,
required: pe
}, fe = /* @__PURE__ */ new Map([
["appearance", ne]
]);
function de(o, e, t) {
return e;
}
const me = "verify-detail", he = "A Farris Component", ye = "object", ge = {
basic: {
description: "Basic Infomation",
title: "基本信息",
properties: {
id: {
description: "组件标识",
title: "标识",
type: "string",
readonly: !0
},
type: {
description: "组件类型",
title: "控件类型",
type: "select",
editor: {
type: "waiting for modification",
enum: []
}
}
}
}
}, ve = {
title: me,
description: he,
type: ye,
categories: ge
}, N = {
src: {
type: String,
required: !0,
default: ""
},
autoplay: {
type: Boolean,
default: !0
},
controls: {
type: Boolean,
default: !0
},
loop: {
type: Boolean,
default: !1
},
muted: {
type: Boolean,
default: !1
},
preload: {
type: String,
default: "none"
},
poster: {
type: String
},
width: {
type: [String, Number],
default: 300
},
height: {
type: [String, Number],
default: 168
}
}, j = oe(N, ue, fe, de, ve);
function be(o, e) {
function t(s) {
s.stopPropagation(), e.emit("abort");
}
function n(s) {
s.stopPropagation(), e.emit("play");
}
function r(s) {
s.stopPropagation(), e.emit("pause");
}
function i(s) {
s.stopPropagation(), e.emit("ended");
}
function a(s) {
s.stopPropagation(), e.emit("durationchange");
}
function m(s) {
s.stopPropagation(), e.emit("error");
}
function h(s) {
s.stopPropagation(), e.emit("loadeddata");
}
function c(s) {
s.stopPropagation(), e.emit("loadedmetadata");
}
function p(s) {
s.stopPropagation(), e.emit("loadstart");
}
function u(s) {
s.stopPropagation(), e.emit("playing");
}
function d(s) {
s.stopPropagation(), e.emit("progress");
}
function y(s) {
s.stopPropagation(), e.emit("timeupdate");
}
function v(s) {
s.stopPropagation(), e.emit("volumechange");
}
function g(s) {
s.stopPropagation(), e.emit("canplay");
}
return {
onAbort: t,
onPlay: n,
onPause: r,
onEnded: i,
onDurationchange: a,
onError: m,
onLoadeddata: h,
onLoadedmetadata: c,
onLoadstart: p,
onPlaying: u,
onProgress: d,
onTimeupdate: y,
onVolumechange: v,
onCanplay: g
};
}
const A = /* @__PURE__ */ S({
name: "FVideo",
props: N,
emits: ["abort", "play", "pause", "ended", "durationchange", "canplay", "error", "loadeddata", "loadedmetadata", "loadstart", "playing", "progress", "timeupdate", "volumechange"],
setup(o, e) {
const t = C(), {
onAbort: n,
onPlay: r,
onPause: i,
onEnded: a,
onDurationchange: m,
onError: h,
onLoadeddata: c,
onLoadedmetadata: p,
onLoadstart: u,
onPlaying: d,
onProgress: y,
onTimeupdate: v,
onVolumechange: g,
onCanplay: s
} = be(o, e);
return q(() => {
}), () => k("video", {
ref: t,
src: o.src,
autoplay: o.autoplay,
controls: o.controls,
loop: o.loop,
muted: o.muted,
width: o.width,
height: o.height,
poster: o.poster,
onAbort: (l) => n(l),
onPlay: (l) => r(l),
onPause: (l) => i(l),
onEnded: (l) => a(l),
onDurationchange: (l) => m(l),
onError: (l) => h(l),
onLoadeddata: (l) => c(l),
onLoadedmetadata: (l) => p(l),
onLoadstart: (l) => u(l),
onPlaying: (l) => d(l),
onProgress: (l) => y(l),
onTimeupdate: (l) => v(l),
onVolumechange: (l) => g(l),
onCanplay: (l) => s(l)
}, [_("Your browser does not support the video tag.")]);
}
});
function Me(o, e, t) {
var B;
const n = t && t.getStyles && t.getStyles() || "", r = t && t.getDesignerClass && t.getDesignerClass() || "", i = C();
function a() {
return (e == null ? void 0 : e.schema.componentType) === "frame" ? !1 : t && t.checkCanMoveComponent ? t.checkCanMoveComponent() : !0;
}
function m() {
return !1;
}
function h() {
return (e == null ? void 0 : e.schema.componentType) === "frame" ? !1 : t && t.checkCanDeleteComponent ? t.checkCanDeleteComponent() : !0;
}
function c() {
return (e == null ? void 0 : e.schema.componentType) === "frame" ? !0 : t && t.hideNestedPaddingInDesginerView ? t.hideNestedPaddingInDesginerView() : !1;
}
function p(f) {
if (!f || !f.value)
return null;
if (f.value.schema && f.value.schema.type === "component")
return f.value;
const M = C(f == null ? void 0 : f.value.parent), P = p(M);
return P || null;
}
function u(f = e) {
var E;
if (t != null && t.getDraggableDesignItemElement)
return t.getDraggableDesignItemElement(f);
const { componentInstance: M, designerItemElementRef: P } = f;
if (!M || !M.value)
return null;
const { getCustomButtons: b } = M.value;
return M.value.canMove || b && ((E = b()) != null && E.length) ? P : u(f.parent);
}
function d(f) {
return !!t && t.canAccepts(f);
}
function y() {
return (e == null ? void 0 : e.schema.label) || (e == null ? void 0 : e.schema.title) || (e == null ? void 0 : e.schema.name);
}
function v() {
}
function g(f, M) {
var P;
!f || !M || (t != null && t.onAcceptMovedChildElement && t.onAcceptMovedChildElement(f, M), (P = e == null ? void 0 : e.setupContext) == null || P.emit("dragEnd"));
}
function s(f, M) {
const { componentType: P } = f;
let b = Y(P, f, M);
t && t.onResolveNewComponentSchema && (b = t.onResolveNewComponentSchema(f, b));
const E = P.toLowerCase().replace(/-/g, "_");
return b && !b.id && b.type === P && (b.id = `${E}_${Math.random().toString().slice(2, 6)}`), b;
}
function l(f) {
f && t != null && t.onChildElementMovedOut && t.onChildElementMovedOut(f);
}
function w(...f) {
if (t && t.getPropsConfig)
return t.getPropsConfig(...f);
}
function D() {
t && t.onRemoveComponent && t.onRemoveComponent(), e != null && e.schema.contents && e.schema.contents.map((f) => {
let M = f.id;
f.type === "component-ref" && (M = f.component);
const P = o.value.querySelectorAll(`#${M}-design-item`);
P != null && P.length && Array.from(P).map((b) => {
var E;
(E = b == null ? void 0 : b.componentInstance) != null && E.value.onRemoveComponent && b.componentInstance.value.onRemoveComponent();
});
});
}
function L() {
if (t && t.getCustomButtons)
return t.getCustomButtons();
}
function T(f) {
if (t && t.onPropertyChanged)
return t.onPropertyChanged(f);
}
return i.value = {
canMove: a(),
canSelectParent: m(),
canDelete: h(),
canNested: !c(),
contents: e == null ? void 0 : e.schema.contents,
elementRef: o,
parent: (B = e == null ? void 0 : e.parent) == null ? void 0 : B.componentInstance,
schema: e == null ? void 0 : e.schema,
styles: n,
designerClass: r,
canAccepts: d,
getBelongedComponentInstance: p,
getDraggableDesignItemElement: u,
getDraggingDisplayText: y,
getPropConfig: w,
getDragScopeElement: v,
onAcceptMovedChildElement: g,
onChildElementMovedOut: l,
addNewChildComponentSchema: s,
triggerBelongedComponentToMoveWhenMoved: !!t && t.triggerBelongedComponentToMoveWhenMoved || C(!1),
triggerBelongedComponentToDeleteWhenDeleted: !!t && t.triggerBelongedComponentToDeleteWhenDeleted || C(!1),
onRemoveComponent: D,
getCustomButtons: L,
onPropertyChanged: T
}, i;
}
class Pe {
getTemplateRule(e, t) {
const n = t == null ? void 0 : t.formSchemaUtils, r = n == null ? void 0 : n.getFormTemplateRule(), i = { canAccept: !0, canDelete: !0, canMove: !0 };
if (!r)
return i;
const a = this.getComponentContext(e), { componentClassList: m } = a;
return m.forEach((h) => {
if (!h || !r[h])
return;
const { canMove: c, canDelete: p, canAccept: u } = r[h];
i.canMove = i.canMove && this.resolveRuleValue(c, a), i.canDelete = i.canDelete && this.resolveRuleValue(p, a), i.canAccept = i.canAccept && this.resolveRuleValue(u, a);
}), i;
}
resolveRuleValue(e, t) {
return typeof e == "boolean" ? e : this.parseRuleValueSchema(e, t);
}
parseRuleValueSchema(e, t) {
const n = e.invalidContext || [];
let r = !0;
for (const i of n) {
if (i.firstLevelChild) {
if (i.firstLevelChild.class) {
const { firstLevelChildClassList: a } = t;
if (a && !a.includes(i.firstLevelChild.class)) {
r = !1;
continue;
}
}
if (i.firstLevelChild.type) {
const { firstLevelChildSchema: a } = t;
if (!a || a.type !== i.firstLevelChild.type) {
r = !1;
continue;
}
}
}
if (i.secondLevelChild) {
if (i.secondLevelChild.class) {
const { secondLevelChildClassList: a } = t;
if (a && !a.includes(i.secondLevelChild.class)) {
r = !1;
continue;
}
}
if (i.secondLevelChild.type) {
const { secondLevelChildSchema: a } = t;
if (!a || a.type !== i.secondLevelChild.type) {
r = !1;
continue;
}
}
}
if (i.parent) {
if (i.parent.class) {
const { parentClassList: a } = t;
if (a && !a.includes(i.parent.class)) {
r = !1;
continue;
}
}
if (i.parent.type) {
const { parentSchema: a } = t;
if (a && a.type !== i.parent.type) {
r = !1;
continue;
}
}
}
r = !0;
break;
}
return !r;
}
getComponentContext(e) {
var g, s, l, w;
const t = e.schema, n = t.appearance && t.appearance.class || "", r = n.split(" ") || [], i = t.contents || [], a = i.length ? i[0] : null, m = a && a.appearance ? a.appearance.class : "", h = m ? m.split(" ") : [], c = (g = a == null ? void 0 : a.contents) != null && g.length ? a == null ? void 0 : a.contents[0] : null, p = c && c.appearance ? c.appearance.class : "", u = p ? p.split(" ") : [], d = t.type === "component" ? (l = (s = e.parent) == null ? void 0 : s.parent) == null ? void 0 : l.schema : (w = e.parent) == null ? void 0 : w.schema, y = d && d.appearance && d.appearance.class || "", v = y ? y.split(" ") : [];
return {
componentClass: n,
componentClassList: r,
childContents: i,
firstLevelChildSchema: a,
firstLevelChildClass: m,
firstLevelChildClassList: h,
secondLevelChildSchema: c,
secondLevelChildClass: p,
secondLevelChildClassList: u,
parentSchema: d,
parentClass: y,
parentClassList: v
};
}
}
const we = C(0);
function Ve() {
we.value++;
}
const Ce = C(0);
class De {
constructor(e, t) {
V(this, "componentId");
V(this, "viewModelId");
V(this, "eventsEditorUtils");
V(this, "formSchemaUtils");
V(this, "formMetadataConverter");
V(this, "designViewModelUtils");
V(this, "designViewModelField");
V(this, "controlCreatorUtils");
V(this, "designerHostService");
V(this, "schemaService", null);
V(this, "metadataService", null);
V(this, "propertyConfig", {
type: "object",
categories: {}
});
var n;
this.componentId = e, this.designerHostService = t, this.eventsEditorUtils = t.eventsEditorUtils, this.formSchemaUtils = t.formSchemaUtils, this.formMetadataConverter = t.formMetadataConverter, this.viewModelId = ((n = this.formSchemaUtils) == null ? void 0 : n.getViewModelIdByComponentId(e)) || "", this.designViewModelUtils = t.designViewModelUtils, this.controlCreatorUtils = t.controlCreatorUtils, this.metadataService = t.metadataService, this.schemaService = t.schemaService;
}
getTableInfo() {
var e;
return (e = this.schemaService) == null ? void 0 : e.getTableInfoByViewModelId(this.viewModelId);
}
setDesignViewModelField(e) {
var n;
const t = e.binding && e.binding.type === "Form" && e.binding.field;
if (t) {
if (!this.designViewModelField) {
const r = this.designViewModelUtils.getDgViewModel(this.viewModelId);
this.designViewModelField = r.fields.find((i) => i.id === t);
}
e.updateOn = (n = this.designViewModelField) == null ? void 0 : n.updateOn;
}
}
getBasicPropConfig(e) {
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",
editable: !1,
data: [{ value: e.type, name: x[e.type].name }]
}
}
}
};
}
getAppearanceConfig(e = null) {
return {
title: "外观",
description: "Appearance",
properties: {
class: {
title: "class样式",
type: "string",
description: "组件的CSS样式",
$converter: "/converter/appearance.converter"
},
style: {
title: "style样式",
type: "string",
description: "组件的样式",
$converter: "/converter/appearance.converter"
}
},
setPropertyRelates(t, n) {
if (t)
switch (t && t.propertyID) {
case "class":
case "style": {
Ce.value++;
break;
}
}
}
};
}
/**
*
* @param propertyId
* @param componentInstance
* @returns
*/
updateElementByParentContainer(e, t) {
const n = t && t.parent && t.parent.schema;
if (!n)
return;
const r = n.contents.findIndex((a) => a.id === e), i = U(n.contents[r]);
n.contents.splice(r, 1), n.contents.splice(r, 0, i), Ve();
}
}
class Ee extends De {
constructor(e, t) {
super(e, t);
}
getPropertyConfig(e) {
return this.propertyConfig.categories.basic = this.getBasicPropConfig(e), this.propertyConfig.categories.appearance = this.getAppearanceConfig(e), this.getEventPropConfig(e), this.propertyConfig;
}
getEventPropConfig(e) {
const t = [
{
label: "onInit",
name: "初始化事件"
},
{
label: "onAfterViewInit",
name: "视图初始化后事件"
}
], n = this, r = n.eventsEditorUtils.formProperties(e, n.viewModelId, t), i = {};
i[n.viewModelId] = {
type: "events-editor",
editor: {
initialData: r
}
}, this.propertyConfig.categories.eventsEditor = {
title: "事件",
hideTitle: !0,
properties: i,
// 这个属性,标记当属性变更得时候触发重新更新属性
refreshPanelAfterChanged: !0,
tabId: "commands",
tabName: "交互",
setPropertyRelates(a, m) {
const h = a.propertyValue;
delete e[n.viewModelId], h && (h.setPropertyRelates = this.setPropertyRelates, n.eventsEditorUtils.saveRelatedParameters(e, n.viewModelId, h.events, h));
}
};
}
}
function Le(o, e) {
const t = new Pe(), { canMove: n, canDelete: r } = t.getTemplateRule(o, e);
function i() {
return !1;
}
function a() {
return r;
}
function m() {
return n;
}
function h() {
return !1;
}
function c() {
return " display: inherit;flex-direction: inherit;margin-bottom:10px";
}
function p(g) {
const s = new Ee(g, e), { schema: l } = o;
return s.getPropertyConfig(l);
}
function u() {
var D, L, T, B;
const g = o == null ? void 0 : o.schema, l = (e == null ? void 0 : e.formSchemaUtils).getViewModelIdByComponentId(g.id);
if (g.componentType !== "data-grid" && g.componentType !== "form" || !((D = o.componentInstance) != null && D.value.parent))
return;
const w = (L = o.componentInstance) == null ? void 0 : L.value.parent.schema;
if ((T = w == null ? void 0 : w.toolbar) != null && T.buttons && w.toolbar.buttons.length) {
w.toolbar.buttons.forEach((M) => {
const P = M.onClick, b = P && P.split(".");
if (!b || b.length < 3)
return;
b[b.length - 2] === l && (M.needRemove = !0);
}), w.toolbar.buttons = w.toolbar.buttons.filter((M) => !M.needRemove);
const f = (B = o.componentInstance) == null ? void 0 : B.value.parent;
f.parent && f.parent.updateToolbarItems && f.parent.updateToolbarItems();
}
}
function d() {
const g = e == null ? void 0 : e.designViewModelUtils, s = e == null ? void 0 : e.formSchemaUtils, l = o == null ? void 0 : o.schema;
if (g && s) {
const w = s.getViewModelIdByComponentId(l.id);
g.deleteViewModelById(w), s.deleteComponent(l.id);
}
}
function y() {
const g = e == null ? void 0 : e.designViewModelUtils, s = e == null ? void 0 : e.formSchemaUtils, l = o == null ? void 0 : o.schema, w = s.getViewModelIdByComponentId(l.id);
g.getDgViewModel(w).fields.forEach((D) => {
if (s.getExpressions() && s.getExpressions().length) {
const L = s.getExpressions().findIndex((T) => T.fieldId === D.id);
L > -1 && s.getExpressions().splice(L, 1);
}
});
}
function v() {
u(), y(), d();
}
return { canAccepts: i, checkCanDeleteComponent: a, checkCanMoveComponent: m, hideNestedPaddingInDesginerView: h, getStyles: c, getPropsConfig: p, onRemoveComponent: v };
}
function Te(o, e) {
const t = C(o.width), n = C(o.height);
let r;
X(e, (a) => {
a && (t.value = a.clientWidth, r = new ResizeObserver((m) => {
if (!m || m.length < 1)
return;
const c = m[0].contentRect;
c && (t.value = c.width);
}), r.observe(a));
});
function i() {
r && r.disconnect();
}
return {
destory: i,
width: t,
height: n
};
}
const Be = /* @__PURE__ */ S({
name: "FVideoDesign",
props: N,
setup(o, e) {
const t = C(), n = F("design-item-context"), r = F("designer-host-service"), i = Le(n, r), a = Me(t, n, i), {
width: m,
height: h,
destory: c
} = Te(o, t);
return Z(() => {
t.value.componentInstance = a;
}), q(() => {
c();
}), e.expose(a.value), () => k("div", {
ref: t,
class: "drag-container",
"data-dragref": `${n.schema.id}-container`
}, [k("video", {
src: o.src,
autoplay: o.autoplay,
controls: o.controls,
loop: o.loop,
muted: o.muted,
width: m.value,
height: h.value
}, [_("Your browser does not support the video tag.")])]);
}
}), Oe = {
install(o) {
o.component(A.name, A);
},
register(o, e, t, n) {
o.video = A, e.video = j;
},
registerDesigner(o, e, t) {
o.video = Be, e.video = j;
}
};
export {
A as FVideo,
Oe as default,
j as propsResolver,
N as videoProps
};