UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,345 lines 343 kB
var fo = Object.defineProperty; var po = (t, e, n) => e in t ? fo(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n; var Y = (t, e, n) => po(t, typeof e != "symbol" ? e + "" : e, n); import { defineComponent as Be, ref as C, computed as $, withDirectives as Qt, createVNode as k, resolveDirective as Jt, watch as we, Fragment as Tt, reactive as ct, createApp as yn, onUnmounted as Nt, onMounted as lt, Transition as bn, mergeProps as rt, createTextVNode as Le, onBeforeUnmount as Cn, nextTick as Zt, inject as qe, provide as mo, triggerRef as ho, isVNode as vo, onBeforeMount as go, Teleport as yo, shallowRef as bo, render as Wt, h as Co, cloneVNode as wo } from "vue"; import { isPlainObject as sn, cloneDeep as vt, isUndefined as un } from "lodash-es"; import { DgControl as Vt, useDesignerComponent as _o } from "../designer-canvas/index.esm.js"; import { useResizeObserver as wn } from "@vueuse/core"; import { useIdentify as So, useGroupData as Fo, useFilter as To, useHierarchy as Io, useLoading as xo, useDataView as Mo, useSelection as Eo, useSelectHierarchyItem as ko, useDataViewContainerStyle as Vo, useCommandColumn as Bo, useColumn as Oo, useSort as Do, useGroupColumn as Ro, useRow as No, useEdit as Lo, useVisualDataBound as Po, useVisualDataCell as $o, useVisualDataRow as jo, useVisualData as Wo, useCellPosition as Ao, useSidebar as Go, useVirtualScroll as zo, useFitColumn as Ho, useFilterHistory as qo, useColumnFilter as Uo, useDragColumn as Yo, getColumnHeader as Xo, getSidebar as Ko, getDisableMask as Qo, getHorizontalScrollbar as Jo, getVerticalScrollbar as Zo, getEmpty as ei } from "../data-view/index.esm.js"; import "../modal/index.esm.js"; import ti from "../transfer/index.esm.js"; import ni from "../tabs/index.esm.js"; import oi from "../order/index.esm.js"; import "../condition/index.esm.js"; import ii, { FCheckbox as ai } from "../checkbox/index.esm.js"; import ri from "../filter-bar/index.esm.js"; import cn from "../tooltip/index.esm.js"; import li from "../pagination/index.esm.js"; import si from "../button/index.esm.js"; import ui from "../search-box/index.esm.js"; import ci from "../tags/index.esm.js"; import di, { FDynamicFormGroup as fi, FDynamicFormInput as pi } from "../dynamic-form/index.esm.js"; import mi from "../binding-selector/index.esm.js"; import "../notify/index.esm.js"; import hi from "../accordion/index.esm.js"; import vi from "../avatar/index.esm.js"; import gi from "../button-edit/index.esm.js"; import yi from "../button-group/index.esm.js"; import bi from "../calendar/index.esm.js"; import Ci from "../capsule/index.esm.js"; import wi from "../color-picker/index.esm.js"; import gt from "../combo-list/index.esm.js"; import _i from "../content-container/index.esm.js"; import Si from "../data-grid/index.esm.js"; import Fi from "../date-picker/index.esm.js"; import Ti from "../dropdown/index.esm.js"; import "../external-container/index.esm.js"; import Ii from "../events-editor/index.esm.js"; import xi from "../image-cropper/index.esm.js"; import Mi from "../input-group/index.esm.js"; import Ei from "../layout/index.esm.js"; import ki from "../list-nav/index.esm.js"; import Vi from "../list-view/index.esm.js"; import Bi from "../lookup/index.esm.js"; import Oi from "../nav/index.esm.js"; import Di from "../number-spinner/index.esm.js"; import Ri from "../number-range/index.esm.js"; import Ni from "../page-header/index.esm.js"; import Li from "../page-footer/index.esm.js"; import Pi from "../progress/index.esm.js"; import $i from "../query-solution/index.esm.js"; import ji from "../radio-group/index.esm.js"; import Wi from "../rate/index.esm.js"; import Ai from "../response-toolbar/index.esm.js"; import Gi from "../response-layout/index.esm.js"; import zi from "../response-layout-editor/index.esm.js"; import Hi from "../section/index.esm.js"; import qi from "../smoke-detector/index.esm.js"; import Ui from "../splitter/index.esm.js"; import Yi from "../step/index.esm.js"; import Xi from "../switch/index.esm.js"; import Ki from "../text/index.esm.js"; import Qi from "../time-picker/index.esm.js"; import Ji from "../tree-view/index.esm.js"; import Zi from "../uploader/index.esm.js"; import ea from "../verify-detail/index.esm.js"; import ta from "../component/index.esm.js"; import na from "../video/index.esm.js"; import oa from "../textarea/index.esm.js"; import ia from "../tree-grid/index.esm.js"; import aa from "../fieldset/index.esm.js"; import ra from "../drawer/index.esm.js"; import { useDateFormat as la, useNumberFormat as sa, resolveField as Ke, setFieldValue as qt, getCustomClass as At, withInstall as ua, FormSchemaEntityField$Type as dn, FormSchemaEntityFieldType$Type as ca, useTextBoxDesign as da, useClear as fa } from "../common/index.esm.js"; import pa from "../combo-tree/index.esm.js"; import ma from "../field-selector/index.esm.js"; import ha from "../mapping-editor/index.esm.js"; import va from "../schema-selector/index.esm.js"; import ga from "../event-parameter/index.esm.js"; import ya from "../filter-condition-editor/index.esm.js"; import ba from "../sort-condition-editor/index.esm.js"; import Ca from "../menu-lookup/index.esm.js"; import { createPropsResolver as wa } from "../dynamic-resolver/index.esm.js"; const _n = {}, Sn = {}; function en(t) { const { properties: e, title: n, ignore: o } = t, i = o && Array.isArray(o), r = Object.keys(e).reduce((a, u) => ((!i || !o.find((s) => s === u)) && (a[u] = e[u].type === "object" && e[u].properties ? en(e[u]) : vt(e[u].default)), a), {}); if (n && (!i || !o.find((a) => a === "id"))) { const a = n.toLowerCase().replace(/-/g, "_"); r.id = `${a}_${Math.random().toString().slice(2, 6)}`; } return r; } function _a(t) { const { properties: e, title: n, required: o } = t; if (o && Array.isArray(o)) { const i = o.reduce((r, a) => (r[a] = e[a].type === "object" && e[a].properties ? en(e[a]) : vt(e[a].default), r), {}); if (n && o.find((r) => r === "id")) { const r = n.toLowerCase().replace(/-/g, "_"); i.id = `${r}_${Math.random().toString().slice(2, 6)}`; } return i; } return { type: n }; } function tn(t, e = {}, n) { const o = _n[t]; if (o) { let i = _a(o); const r = Sn[t]; return i = r ? r({ getSchemaByType: tn }, i, e, n) : i, i; } return null; } function Sa(t, e) { const n = en(e); return Object.keys(n).reduce((o, i) => (Object.prototype.hasOwnProperty.call(t, i) && (o[i] && sn(o[i]) && sn(t[i] || !t[i]) ? Object.assign(o[i], t[i] || {}) : o[i] = t[i]), o), n), n; } function Fn(t, e) { return Object.keys(t).filter((o) => t[o] != null).reduce((o, i) => { if (e.has(i)) { const r = e.get(i); if (typeof r == "string") o[r] = t[i]; else { const a = r(i, t[i], t); Object.assign(o, a); } } else o[i] = t[i]; return o; }, {}); } function Fa(t, e, n = /* @__PURE__ */ new Map()) { const o = Sa(t, e); return Fn(o, n); } function Ta(t = {}) { function e(d, c, l, f) { if (typeof l == "number") return f[d].length === l; if (typeof l == "object") { const y = Object.keys(l)[0], v = l[y]; if (y === "not") return Number(f[d].length) !== Number(v); if (y === "moreThan") return Number(f[d].length) >= Number(v); if (y === "lessThan") return Number(f[d].length) <= Number(v); } return !1; } function n(d, c, l, f) { return f[d] && f[d].propertyValue && String(f[d].propertyValue.value) === String(l); } const o = /* @__PURE__ */ new Map([ ["length", e], ["getProperty", n] ]); Object.keys(t).reduce((d, c) => (d.set(c, t[c]), d), o); function i(d, c) { const l = d; return typeof c == "number" ? [{ target: l, operator: "length", param: null, value: Number(c) }] : typeof c == "boolean" ? [{ target: l, operator: "getProperty", param: d, value: !!c }] : typeof c == "object" ? Object.keys(c).map((f) => { if (f === "length") return { target: l, operator: "length", param: null, value: c[f] }; const y = f, v = c[f]; return { target: l, operator: "getProperty", param: y, value: v }; }) : []; } function r(d) { return Object.keys(d).reduce((l, f) => { const y = i(f, d[f]); return l.push(...y), l; }, []); } function a(d, c) { if (o.has(d.operator)) { const l = o.get(d.operator); return l && l(d.target, d.param, d.value, c) || !1; } return !1; } function u(d, c) { return r(d).reduce((y, v) => y && a(v, c), !0); } function s(d, c) { const l = Object.keys(d), f = l.includes("allOf"), y = l.includes("anyOf"), v = f || y, h = (v ? d[v ? f ? "allOf" : "anyOf" : "allOf"] : [d]).map((T) => u(T, c)); return f ? !h.includes(!1) : h.includes(!0); } return { parseValueSchema: s }; } const ie = { 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: "抽屉" } }, Tn = {}, Ia = {}; Ta(); function Ct(t, e, n = /* @__PURE__ */ new Map(), o = (a, u, s, d) => u, i = {}, r = (a) => a) { return _n[e.title] = e, Sn[e.title] = o, Tn[e.title] = i, Ia[e.title] = r, (a = {}, u = !0) => { if (!u) return Fn(a, n); const s = Fa(a, e, n), d = Object.keys(t).reduce((c, l) => (c[l] = t[l].default, c), {}); return Object.assign(d, s); }; } function Lt(t, e) { return { customClass: e.class, customStyle: e.style }; } function xa() { function t(e, n) { const { dataSource: o } = e || {}; return o === void 0 ? {} : {}; } return { resolve: t }; } function Ma() { function t(e, n) { return e.selectItemById(n); } return { selectItemById: t }; } function Ea() { function t(e) { return e.editor; } return { resolve: t }; } function ka() { function t(e, n) { const { columns: o } = n; return e.updateColumns(o); } return { updateColumns: t }; } const nn = /* @__PURE__ */ new Map([ ["appearance", Lt] ]), Va = /* @__PURE__ */ new Map([]); var In = /* @__PURE__ */ ((t) => (t.SimpleField = "SimpleField", t.ComplexField = "ComplexField", t))(In || {}), Ut = /* @__PURE__ */ ((t) => (t.String = "String", t.DateTime = "DateTime", t.Date = "Date", t.Enum = "Enum", t.Boolean = "Boolean", t.Number = "Number", t.Text = "Text", t.BigNumber = "BigNumber", t))(Ut || {}); const Ba = "root-viewmodel"; class Oa { constructor(e, n) { Y(this, "formSchemaUtils"); Y(this, "controlCreatorUtils"); Y(this, "designViewModelUtils"); this.resolver = e, this.designerHostService = n, this.formSchemaUtils = this.designerHostService.formSchemaUtils, this.controlCreatorUtils = this.designerHostService.controlCreatorUtils, this.designViewModelUtils = this.designerHostService.designViewModelUtils; } createComponent(e) { const n = this.createComponentRefNode(e), o = this.createComponentNode(e), i = this.createViewModeNode(e), r = this.formSchemaUtils.getFormSchema(); return r.module.viewmodels.push(i), r.module.components.push(o), this.designViewModelUtils.assembleDesignViewModel(), n; } createComponentRefNode(e) { const n = this.resolver.getSchemaByType("component-ref"); return Object.assign(n, { id: `${e.componentId}-component-ref`, component: `${e.componentId}-component` }), n; } createComponentNode(e) { const n = this.resolver.getSchemaByType("component"), o = this.createFormComponentContents(e); return Object.assign(n, { id: `${e.componentId}-component`, viewModel: `${e.componentId}-component-viewmodel`, componentType: e.componentType, appearance: { class: this.getFormComponentClass() }, formColumns: e.formColumns, contents: o }), n; } /** * 获取卡片组件层级的class样式 */ getFormComponentClass() { const { templateId: e } = this.formSchemaUtils.getFormSchema().module; return e === "double-list-in-tab-template" ? "f-struct-wrapper f-utils-fill-flex-column" : "f-struct-wrapper"; } createFormComponentContents(e) { const n = this.resolver.getSchemaByType("section"); Object.assign(n, { id: e.componentId + "-form-section", appearance: { class: "f-section-form f-section-in-mainsubcard" }, mainTitle: e.componentName }); const o = this.resolver.getSchemaByType("response-form"), i = []; Object.assign(o, { id: e.componentId + "-form", appearance: { class: "f-form-layout farris-form farris-form-controls-inline" }, contents: i }), n.contents = [o]; const { selectedFields: r } = e; r == null || r.forEach((u) => { const s = vt(u), d = this.resolveControlClassByFormColumns(e), c = this.controlCreatorUtils.setFormFieldProperty(s, "", d); c && i.push(c); }); const { templateId: a } = this.formSchemaUtils.getFormSchema().module; return a === "double-list-in-tab-template" && (n.appearance.class = "f-section-grid f-section-in-main px-0 pt-0", n.fill = !0), [n]; } resolveControlClassByFormColumns(e) { let n = ""; switch (e.formColumns) { case 1: { n = "col-12"; break; } case 2: { n = "col-12 col-md-6 col-xl-6 col-el-6"; break; } case 3: { n = "col-12 col-md-6 col-xl-4 col-el-4"; break; } case 4: { n = "col-12 col-md-6 col-xl-3 col-el-2"; break; } } return n; } /** * 添加viewModel节点 */ createViewModeNode(e) { return { id: `${e.componentId}-component-viewmodel`, code: `${e.componentId}-component-viewmodel`, name: e.componentName, bindTo: e.bindTo, parent: Ba, fields: this.assembleViewModelFields(e), commands: [], states: [], enableValidation: !0 }; } /** * 组装viewModel fields 节点 */ assembleViewModelFields(e) { const n = [], { selectedFields: o } = e; return o == null || o.forEach((i) => { let r = "blur"; const a = i.type.name; (a === Ut.Enum || a === Ut.Boolean) && (r = "change"), n.push({ type: "Form", id: i.id, fieldName: i.bindingField, groupId: null, groupName: null, updateOn: r, fieldSchema: {} }); }), n; } } function Da(t, e, n, o) { var r, a, u, s, d, c; const i = n.parentComponentInstance; if (i && o) { const l = (r = i.schema) == null ? void 0 : r.type, y = { componentId: `form-${Math.random().toString(36).slice(2, 6)}`, componentName: ((a = n.bindingSourceContext) == null ? void 0 : a.entityTitle) || ((s = (u = n.bindingSourceContext) == null ? void 0 : u.bindingEntity) == null ? void 0 : s.name) || "标题", componentType: "form", formColumns: l === "splitter-pane" ? 1 : 4, parentContainerId: i.schema.id, bindTo: ((d = n.bindingSourceContext) == null ? void 0 : d.bindTo) || "/", selectedFields: (c = n.bindingSourceContext) == null ? void 0 : c.bindingEntityFields }; return new Oa(t, o).createComponent(y); } else return e; } function Ra(t, e, n) { return e; } const Na = "https://json-schema.org/draft/2020-12/schema", La = "https://farris-design.gitee.io/response-form.schema.json", Pa = "response-form", $a = "A Farris Data Collection Component", ja = "object", Wa = { id: { description: "The unique identifier for a form group", type: "string" }, type: { description: "The type string of form group component", type: "string", default: "response-form" }, appearance: { description: "", type: "object", properties: { class: { type: "string" }, style: { type: "string" } }, default: {} }, contents: { description: "", type: "array", default: [] } }, Aa = [ "id", "type", "contents" ], Ga = { $schema: Na, $id: La, title: Pa, description: $a, type: ja, properties: Wa, required: Aa }, xn = { customClass: { type: String, default: "" }, customStyle: { type: String, defaut: "" } }, fn = Ct(xn, Ga, nn, Da), Gt = /* @__PURE__ */ Be({ name: "FResponseForm", props: xn, emits: [], setup(t, e) { const n = C(), o = $(() => { const i = t.customClass.split(" "), r = { "drag-container": !0 }; return i.reduce((a, u) => (a[u] = !0, a), r), r; }); return () => Qt(k("div", { ref: n, class: o.value, style: t.customStyle }, [e.slots.default && e.slots.default()]), [[Jt("area-response")]]); } }), za = "https://json-schema.org/draft/2020-12/schema", Ha = "https://farris-design.gitee.io/form-group.schema.json", qa = "form-group", Ua = "A Farris Input Component", Ya = "object", Xa = { id: { description: "The unique identifier for a form group", type: "string" }, type: { description: "The type string of form group component", type: "string", default: "form-group" }, appearance: { description: "", type: "object", properties: { class: { type: "string" }, style: { type: "string" } }, default: {} }, enableLinkLabel: { description: "", type: "boolean", default: !1 }, editor: { description: "", type: "obejct", default: null }, label: { description: "", type: "string", default: "" }, lableWidth: { description: "", type: "number" }, binding: { description: "", type: "object", default: {} } }, Ka = [ "id", "type", "editor" ], Mn = { $schema: za, $id: Ha, title: qa, description: Ua, type: Ya, properties: Xa, required: Ka }, It = { id: { type: String, default: "" }, customClass: { type: String, default: "" }, customStyle: { type: String, default: "" }, /** 筛选组件配置器,具体配置项可查看各组件文档 */ editor: { type: Object, default: {} }, label: { type: String, default: "" }, /** 组件值 */ modelValue: { type: [String, Boolean, Array, Number], default: "" }, // readonly: { type: Boolean, default: false }, visible: { type: Boolean, default: !0 }, required: { type: Boolean, default: !1 }, showLabel: { type: Boolean, default: !0 }, type: { type: String, default: "input-group" }, componentId: { type: String, default: "" } }, pn = Ct( It, Mn, nn, void 0 ), Qa = Ea(); function on(t, e, n) { var R; const o = n && n.getStyles && n.getStyles() || "", i = n && n.getDesignerClass && n.getDesignerClass() || "", r = C(); function a() { return (e == null ? void 0 : e.schema.componentType) === "frame" ? !1 : n && n.checkCanMoveComponent ? n.checkCanMoveComponent() : !0; } function u() { return !1; } function s() { return (e == null ? void 0 : e.schema.componentType) === "frame" ? !1 : n && n.checkCanDeleteComponent ? n.checkCanDeleteComponent() : !0; } function d() { return (e == null ? void 0 : e.schema.componentType) === "frame" ? !0 : n && n.hideNestedPaddingInDesginerView ? n.hideNestedPaddingInDesginerView() : !1; } function c(p) { if (!p || !p.value) return null; if (p.value.schema && p.value.schema.type === "component") return p.value; const _ = C(p == null ? void 0 : p.value.parent), S = c(_); return S || null; } function l(p = e) { var F; if (n != null && n.getDraggableDesignItemElement) return n.getDraggableDesignItemElement(p); const { componentInstance: _, designerItemElementRef: S } = p; if (!_ || !_.value) return null; const { getCustomButtons: E } = _.value; return _.value.canMove || E && ((F = E()) != null && F.length) ? S : l(p.parent); } function f(p) { return !!n && n.canAccepts(p); } 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 O(p, _) { var S; !p || !_ || (n != null && n.onAcceptMovedChildElement && n.onAcceptMovedChildElement(p, _), (S = e == null ? void 0 : e.setupContext) == null || S.emit("dragEnd")); } function b(p, _) { const { componentType: S } = p; let E = tn(S, p, _); n && n.onResolveNewComponentSchema && (E = n.onResolveNewComponentSchema(p, E)); const F = S.toLowerCase().replace(/-/g, "_"); return E && !E.id && E.type === S && (E.id = `${F}_${Math.random().toString().slice(2, 6)}`), E; } function h(p) { p && n != null && n.onChildElementMovedOut && n.onChildElementMovedOut(p); } function m(...p) { if (n && n.getPropsConfig) return n.getPropsConfig(...p); } function T() { n && n.onRemoveComponent && n.onRemoveComponent(), e != null && e.schema.contents && e.schema.contents.map((p) => { let _ = p.id; p.type === "component-ref" && (_ = p.component); const S = t.value.querySelectorAll(`#${_}-design-item`); S != null && S.length && Array.from(S).map((E) => { var F; (F = E == null ? void 0 : E.componentInstance) != null && F.value.onRemoveComponent && E.componentInstance.value.onRemoveComponent(); }); }); } function g() { if (n && n.getCustomButtons) return n.getCustomButtons(); } function w(p) { if (n && n.onPropertyChanged) return n.onPropertyChanged(p); } return r.value = { canMove: a(), canSelectParent: u(), canDelete: s(), canNested: !d(), contents: e == null ? void 0 : e.schema.contents, elementRef: t, parent: (R = e == null ? void 0 : e.parent) == null ? void 0 : R.componentInstance, schema: e == null ? void 0 : e.schema, styles: o, designerClass: i, canAccepts: f, getBelongedComponentInstance: c, getDraggableDesignItemElement: l, getDraggingDisplayText: y, getPropConfig: m, getDragScopeElement: v, onAcceptMovedChildElement: O, onChildElementMovedOut: h, addNewChildComponentSchema: b, triggerBelongedComponentToMoveWhenMoved: !!n && n.triggerBelongedComponentToMoveWhenMoved || C(!1), triggerBelongedComponentToDeleteWhenDeleted: !!n && n.triggerBelongedComponentToDeleteWhenDeleted || C(!1), onRemoveComponent: T, getCustomButtons: g, onPropertyChanged: w }, r; } function Ja() { function t(e, n) { var a; if (!e) return !1; const o = ((a = e.targetContainer) == null ? void 0 : a.componentInstance) && e.targetContainer.componentInstance.value; if (!o) return !1; const i = o.schema.type, r = n == null ? void 0 : n.formSchemaUtils.getComponentById(o.belongedComponentId); return !((e.componentCategory === "input" || e.componentType === "form-group") && ![ie["response-layout-item"].type, ie["response-form"].type, ie.fieldset.type].includes(i) || (e.componentType === ie.tabs.type || e.componentType === ie.section.type) && ((r == null ? void 0 : r.componentType) !== "frame" || ![ie["content-container"].type, ie["splitter-pane"].type, ie["response-layout-item"].type].includes(i)) || e.componentType === ie["query-solution"].type || e.componentType === ie.fieldset.type && i !== ie["response-form"].type); } return { basalDragulaRuleForContainer: t }; } class Za { getTemplateRule(e, n) { const o = n == null ? void 0 : n.formSchemaUtils, i = o == null ? void 0 : o.getFormTemplateRule(), r = { canAccept: !0, canDelete: !0, canMove: !0 }; if (!i) return r; const a = this.getComponentContext(e), { componentClassList: u } = a; return u.forEach((s) => { if (!s || !i[s]) return; const { canMove: d, canDelete: c, canAccept: l } = i[s]; r.canMove = r.canMove && this.resolveRuleValue(d, a), r.canDelete = r.canDelete && this.resolveRuleValue(c, a), r.canAccept = r.canAccept && this.resolveRuleValue(l, a); }), r; } resolveRuleValue(e, n) { return typeof e == "boolean" ? e : this.parseRuleValueSchema(e, n); } parseRuleValueSchema(e, n) { const o = e.invalidContext || []; let i = !0; for (const r of o) { if (r.firstLevelChild) { if (r.firstLevelChild.class) { const { firstLevelChildClassList: a } = n; if (a && !a.includes(r.firstLevelChild.class)) { i = !1; continue; } } if (r.firstLevelChild.type) { const { firstLevelChildSchema: a } = n; if (!a || a.type !== r.firstLevelChild.type) { i = !1; continue; } } } if (r.secondLevelChild) { if (r.secondLevelChild.class) { const { secondLevelChildClassList: a } = n; if (a && !a.includes(r.secondLevelChild.class)) { i = !1; continue; } } if (r.secondLevelChild.type) { const { secondLevelChildSchema: a } = n; if (!a || a.type !== r.secondLevelChild.type) { i = !1; continue; } } } if (r.parent) { if (r.parent.class) { const { parentClassList: a } = n; if (a && !a.includes(r.parent.class)) { i = !1; continue; } } if (r.parent.type) { const { parentSchema: a } = n; if (a && a.type !== r.parent.type) { i = !1; continue; } } } i = !0; break; } return !i; } getComponentContext(e) { var O, b, h, m; const n = e.schema, o = n.appearance && n.appearance.class || "", i = o.split(" ") || [], r = n.contents || [], a = r.length ? r[0] : null, u = a && a.appearance ? a.appearance.class : "", s = u ? u.split(" ") : [], d = (O = a == null ? void 0 : a.contents) != null && O.length ? a == null ? void 0 : a.contents[0] : null, c = d && d.appearance ? d.appearance.class : "", l = c ? c.split(" ") : [], f = n.type === "component" ? (h = (b = e.parent) == null ? void 0 : b.parent) == null ? void 0 : h.schema : (m = e.parent) == null ? void 0 : m.schema, y = f && f.appearance && f.appearance.class || "", v = y ? y.split(" ") : []; return { componentClass: o, componentClassList: i, childContents: r, firstLevelChildSchema: a, firstLevelChildClass: u, firstLevelChildClassList: s, secondLevelChildSchema: d, secondLevelChildClass: c, secondLevelChildClassList: l, parentSchema: f, parentClass: y, parentClassList: v }; } } const er = C(0); function tr() { er.value++; } const bt = C(0); function nr(t, e) { const n = e.getBoundingClientRect(), o = t.getBoundingClientRect(), i = o.top >= n.top, r = o.top <= n.bottom; return i && r; } function or(t) { const e = t.querySelector(".component-btn-group"); if (!e) return; e.style.display = ""; const n = e.getBoundingClientRect(); if (!(n.top === 0 && n.left === 0)) { const o = e.querySelector("div"); if (o) { const i = o.getBoundingClientRect(); o.style.top = n.top + "px"; let r = n.left - i.width; const a = document.querySelector(".editorDiv"); if (a) { const u = a.getBoundingClientRect(); r < u.left && ({ left: r } = t.getBoundingClientRect()); } o.style.left = r + "px"; } } } function ir(t) { if (!window.scrollContainerList) return; const e = Array.from(window.scrollContainerList); if (e.length && e.length === 1) { const n = e[0], o = document.querySelector(`[id=${n}]`); if (o && o.contains(t)) return o; } } function En(t) { if (!t) return; const e = t.getBoundingClientRect(); if (e.width === 0 && e.height === 0) return; const n = t.querySelector(".component-btn-group"); if (n) { let o = !0; const i = ir(t); if (i && (o = nr(t, i)), !o) { n.style.display = "none"; return; } or(t); } } function ar(t) { if (!t) return; let e; t.className.includes("dgComponentSelected") ? e = t : e = t.querySelector(".dgComponentSelected"), e && En(e); } class an { constructor(e, n) { Y(this, "componentId"); Y(this, "viewModelId"); Y(this, "eventsEditorUtils"); Y(this, "formSchemaUtils"); Y(this, "formMetadataConverter"); Y(this, "designViewModelUtils"); Y(this, "designViewModelField"); Y(this, "controlCreatorUtils"); Y(this, "designerHostService"); Y(this, "schemaService", null); Y(this, "metadataService", null); Y(this, "propertyConfig", { type: "object", categories: {} }); var o; this.componentId = e, this.designerHostService = n, this.eventsEditorUtils = n.eventsEditorUtils, this.formSchemaUtils = n.formSchemaUtils, this.formMetadataConverter = n.formMetadataConverter, this.viewModelId = ((o = this.formSchemaUtils) == null ? void 0 : o.getViewModelIdByComponentId(e)) || "", this.designViewModelUtils = n.designViewModelUtils, this.controlCreatorUtils = n.controlCreatorUtils, this.metadataService = n.metadataService, this.schemaService = n.schemaService; } getTableInfo() { var e; return (e = this.schemaService) == null ? void 0 : e.getTableInfoByViewModelId(this.viewModelId); } setDesignViewModelField(e) { var o; const n = e.binding && e.binding.type === "Form" && e.binding.field; if (n) { if (!this.designViewModelField) { const i = this.designViewModelUtils.getDgViewModel(this.viewModelId); this.designViewModelField = i.fields.find((r) => r.id === n); } e.updateOn = (o = this.designViewModelField) == null ? void 0 : o.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: ie[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(n, o) { if (n) switch (n && n.propertyID) { case "class": case "style": { bt.value++; break; } } } }; } /** * * @param propertyId * @param componentInstance * @returns */ updateElementByParentContainer(e, n) { const o = n && n.parent && n.parent.schema; if (!o) return; const i = o.contents.findIndex((a) => a.id === e), r = vt(o.contents[i]); o.contents.splice(i, 1), o.contents.splice(i, 0, r), tr(); } } class rr { constructor() { /** 控件标题 */ Y(this, "label", ""); /** 控件id */ Y(this, "id", ""); /** 每个控件占用的栅格数 */ Y(this, "columnInSM", 12); Y(this, "columnInMD", 6); Y(this, "columnInLG", 3); Y(this, "columnInEL", 2); /** 每个控件占用的列数 */ Y(this, "displayWidthInSM", 1); Y(this, "displayWidthInMD", 1); Y(this, "displayWidthInLG", 1); Y(this, "displayWidthInEL", 1); /** 编辑器内部默认显示的屏幕大小-----可以去掉 */ Y(this, "displayColumnCountAtBreakPoint", "md"); /** 控件所在行,传0即可-----编辑器内部使用 */ Y(this, "tagRow", 0); /** 控件是否显示上方空白:传0即可-----编辑器内部使用 */ Y(this, "showTopBorder", 0); /** 区域,从1开始。卡片内的控件从上往下,从左往右划分区域,遇到分组fieldSet时group+1,分组结束后group+1 */ Y(this, "group", 1); /** 控件是否符合标准的class配置(设计器用的) */ Y(this, "isSupportedClass", !0); /** 控件所在分组id(设计器用的) */ Y(this, "fieldSetId", ""); } } function kn(t) { let e, n; const o = /* @__PURE__ */ new Map(); let i = []; function r(c, l) { const y = c.split(" ").filter((m) => m.startsWith("col-")); if (y.length === 0) { l.isSupportedClass = !1; return; } let v = y.find((m) => /^col-([1-9]|10|11|12)$/.test(m)), O = y.find((m) => /^col-md-([1-9]|10|11|12)$/.test(m)), b = y.find((m) => /^col-xl-([1-9]|10|11|12)$/.test(m)), h = y.find((m) => /^col-el-([1-9]|10|11|12)$/.test(m)); v = v || "col-12", l.columnInSM = parseInt(v.replace("col-", ""), 10), l.displayWidthInSM = l.columnInSM / 12, l.displayWidthInSM !== 1 && (l.isSupportedClass = !1), O = O || "col-md-" + l.columnInSM, l.columnInMD = parseInt(O.replace("col-md-", ""), 10), l.displayWidthInMD = l.columnInMD / 6, [1, 2].includes(l.displayWidthInMD) || (l.isSupportedClass = !1), b = b || "col-xl-" + l.columnInMD, l.columnInLG = parseInt(b.replace("col-xl-", ""), 10), l.displayWidthInLG = l.columnInLG / 3, [1, 2, 3, 4].includes(l.displayWidthInLG) || (l.isSupportedClass = !1), h = h || "col-el-" + l.columnInLG, l.columnInEL = parseInt(h.replace("col-el-", ""), 10), l.displayWidthInEL = l.columnInEL / 2, [1, 2, 3, 4, 5, 6].includes(l.displayWidthInEL) || (l.isSupportedClass = !1); } function a(c, l, f, y = !1) { let v = !1; c.contents.forEach((O) => { if (O.type === "fieldset") { f += 1, a(O, l, f, !0), v = !0; return; } v && (f += 1, v = !1); const b = O.appearance && O.appearance.class, h = new rr(); b ? r(b, h) : h.isSupportedClass = !1, h.label = O.label || O.id, h.id = O.id, h.group = f, y && (h.fieldSetId = c.id), n === O.id && (e = f), o.set(O.id, O), l.push(h); }); } function u(c) { const l = t.getComponentById(c); if (!l || !l.componentType || !l.componentType.startsWith("form")) return { result: !1, message: "只可以在响应式表单组件中调整响应式布局配置" }; const f = t.selectNode(l, (y) => y.type === Vt["response-form"].type); return !f || !f.contents || f.contents.length === 0 ? { result: !1, message: "Form区域内没有控件,请先添加控件" } : { result: !0, message: "", formNode: f }; } function s(c, l) { l = l || c.id; const { result: f, message: y, formNode: v } = u(l); if (!f) return { result: f, message: y }; n = c.id, i = [], o.clear(); const O = v.contents[0].type === Vt.fieldset.type ? 0 : 1; a(v, i, O); const b = i.find((m) => !m.isSupportedClass); return { defaultState: { defaultGroupNumber: e || 1, model: b ? "customize" : "standard" }, importData: i }; } function d(c, l) { l = l; const { result: f, formNode: y } = u(l); if (!f) return ""; const v = []; return c.forEach((O) => { var m; const b = o.get(O.id), h = b.appearance && b.appearance.class; if (h) { const g = h.split(" ").filter((E) => !E.startsWith("col-")), w = "col-" + O.columnInSM, R = "col-md-" + O.columnInMD, p = "col-xl-" + O.columnInLG, _ = "col-el-" + O.columnInEL, S = [w, R, p, _].concat(g); b.appearance.class = S.join(" "); } if (O.fieldSetId) { const T = y.contents.find((w) => w.id === O.fieldSetId), g = v.find((w) => w.id === O.fieldSetId); g ? (m = g.contents) == null || m.push(b) : (v.push(T), T.contents = [b]); } else v.push(b); }), y.contents = v, y.id; } return { checkCanFindFormNode: u, checkCanOpenLayoutEditor: s, changeFormControlsByResponseLayoutConfig: d, getResonseFormLayoutConfig: a }; } function lr(t, e) { function n(s, d = null) { if (d) return d; const c = t.getComponentById(e); return t.selectNode(c, (l) => l.id === s); } function o(s) { const d = t.getComponentById(s); return !(!d || !d.componentType || !d.componentType.startsWith("form")); } function i(s) { const d = new Set(s); return Array.from(d).length === 1; } function r(s) { const d = n(s.id), c = kn(t), l = []; c.getResonseFormLayoutConfig(d, l, 1); const f = l.map((g) => g.columnInSM), y = l.map((g) => g.columnInMD), v = l.map((g) => g.columnInLG), O = l.map((g) => g.columnInEL), b = i(f) ? f[0] : 0, h = i(y) ? y[0] : 0, m = i(v) ? v[0] : 0, T = i(O) ? O[0] : 0; return { uniqueColClassInSM: b, uniqueColClassInMD: h, uniqueColClassInLG: m, uniqueColClassInEL: T }; } function a(s, d) { let c, l, f, y, v = []; if (s) { const g = s.split(" "), w = g.filter((R) => R.startsWith("col-")); c = w.find((R) => /^col-([1-9]|10|11|12)$/.test(R)), l = w.find((R) => /^col-md-([1-9]|10|11|12)$/.test(R)), f = w.find((R) => /^col-xl-([1-9]|10|11|12)$/.test(R)), y = w.find((R) => /^col-el-([1-9]|10|11|12)$/.test(R)), v = g.filter((R) => !R.startsWith("col-")); } const O = d.uniqueColClassInSM ? "col-" + d.uniqueColClassInSM : c, b = d.uniqueColClassInMD ? "col-md-" + d.uniqueColClassInMD : l, h = d.uniqueColClassInLG ? "col-xl-" + d.uniqueColClassInLG : f, m = d.uniqueColClassInEL ? "col-el-" + d.uniqueColClassInEL : y; return [O, b, h, m].concat(v).join(" "); } function u(s, d, c) { s = n(c, s), s.contents.forEach((l) => { if (l.type === Vt.fieldset.type) { u(l, d, l.id); return; } l.appearance || (l.appearance = {}); const f = l.appearance.class; l.appearance.class = a(f, d); }); } return { checkIsInFormComponent: o, assembleUnifiedLayoutContext: r, changeFormControlsByUnifiedLayoutConfig: u }; } class sr extends an { constructor(e, n) { super(e, n); } getPropertyConfig(e, n) { const o = this; this.propertyConfig.categories.basic = this.getBasicPropConfig(e); const { checkIsInFormComponent: i, assembleUnifiedLayoutContext: r, changeFormControlsByUnifiedLayoutConfig: a } = lr(this.formSchemaUtils, this.componentId), u = this.getAppearanceConfig(e); return u.properties.unifiedLayout = { title: "统一布局配置", description: "统一配置卡片区域内所有控件的宽度,只支持标准模式", visible: i(this.componentId), refreshPanelAfterChanged: !0, editor: { type: "response-form-layout-setting", initialState: r(e) } }, u.setPropertyRelates = function(s, d) { if (s) switch (s && s.propertyID) { case "unifiedLayout": { a(null, s.propertyValue, e.id), o.updateElementByParentContainer(e.id, n); break; } } }, this.propertyConfig.categories.appearance = u, this.propertyConfig; } } var ht = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function xt(t) { throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); } var ur = { exports: {} }; (function(t, e) { (function(n) { t.exports = n(); })(function() { return (/* @__PURE__ */ function() { function n(o, i, r) { function a(d, c) { if (!i[d]) { if (!o[d]) { var l = typeof xt == "function" && xt; if (!c && l) return l(d, !0); if (u) return u(d, !0); var f = new Error("Cannot find module '" + d + "'"); throw f.code = "MODULE_NOT_FOUND", f; } var y = i[d] = { exports: {} }; o[d][0].call(y.exports, function(v) { var O = o[d][1][v]; return a(O || v); }, y, y.exports, n, o, i, r); } return i[d].exports; } for (var u = typeof xt == "function" && xt, s = 0; s < r.length; s++) a(r[s]); return a; } return n; }())({ 1: [function(n, o, i) { var r = {}, a = "(?:^|\\s)", u = "(?:\\s|$)"; function s(l) { var f = r[l]; return f ? f.lastIndex = 0 : r[l] = f = new RegExp(a + l + u, "g"), f; } function d(l, f) { var y = l.className; y.length ? s(f).test(y) || (l.className += " " + f) : l.className = f; } function c(l, f) { l.className = l.className.replace(s(f), " ").trim(); } o.exports = { add: d, rm: c }; }, {}], 2: [function(n, o, i) { (function(r) { var a = n("contra/emitter"), u = n("crossvent"), s = n("./classes"), d = document, c = d.documentElement; function l(F, I) { var x = arguments.length; x === 1 && Array.isArray(F) === !1 && (I = F, F = []); var D, M, V, B, N, L, G, q, X, pe = null, A, W, z = !1, Q = 0, ee, J = I || {}; J.moves === void 0 && (J.moves = m), J.accepts === void 0 && (J.accepts = m), J.invalid === void 0 && (J.invalid = st), J.containers === void 0 && (J.containers = F || []), J.isContainer === void 0 && (J.isContainer = h), J.copy === void 0 && (J.copy = !1), J.copySortSource === void 0 && (J.copySortSource = !1), J.revertOnSpill === void 0 && (J.revertOnSpill = !1), J.removeOnSpill === void 0 && (J.removeOnSpill = !1), J.direction === void 0 && (J.direction = "vertical"), J.ignoreInputTextSelection === void 0 && (J.ignoreInputTextSelection = !0), J.mirrorContainer === void 0 && (J.mirrorContainer = d.body); var P = a({ containers: J.containers, start: Ue, end: oe, cancel: ut, remove: xe, destroy: Fe, canMove: ke, dragging: !1 }); return J.removeOnSpill === !0 && P.on("over", me).on("out", ve), re(), P; function U(j) { return P.containers.indexOf(j) !== -1 || J.isContainer(j); } function re(j) { var Z = j ? "remove" : "add"; v(c, Z, "mousedown", Te), v(c, Z, "mouseup", Me); } function te(j) { var Z = j ? "remove" : "add"; v(c, Z, "mousemove", Ae); } function ne(j) { var Z = j ? "remove" : "add"; u[Z](c, "selectstart", Ie), u[Z](c, "click", Ie); } function Fe() { re(!0), Me({}); } function Ie(j) { A && j.preventDefault(); } function Te(j) { B = j.clientX, N = j.clientY; var Z = O(j) !== 1 || j.metaKey || j.ctrlKey; if (!Z) { var K = j.target, ce = Ne(K); ce && (A = ce, te(), j.type === "mousedown" && (R(K) ? K.focus() : j.preventDefault())); } } function Ae(j) { if (A) { if (O(j) === 0) { Me({}); return; } if (!(j.clientX !== void 0 && Math.abs(j.clientX - B) <= (J.slideFactorX || 0) && j.clientY !== void 0 && Math.abs(j.clientY - N) <= (J.slideFactorY || 0))) { if (J.ignoreInputTextSelection) { var Z = E("clientX", j) || 0, K = E("clientY", j) || 0, ce = d.elementFromPoint(Z, K); if (R(ce)) return; } var ge = A; te(!0), ne(), oe(), ze(ge), s.add(q || V, "gu-transit"), Ee(), Se(), Q = 0, Ye(j); } } } function Ne(j) { if (!(P.dragging && D) && !U(j)) { for (var Z = j; w(j) && U(w(j)) === !1; ) if (J.invalid(j, Z) || (j = w(j), !j)) return; var K = w(j); if (K && !J.invalid(j, Z)) { var ce = J.moves(j, K, Z, _(j)); if (ce) return { item: j, source: K }; } } } function ke(j) { return !!Ne(j); } function Ue(j) { var Z = Ne(j); Z && ze(Z); } function ze(j) { $e(j.item, j.source) && (q = j.item.cloneNode(!0), P.emit("cloned", q, j.item, "copy")), M = j.source, V = j.item, L = G = _(j.item), P.dragging = !0, P.emit("drag", V, M); } function st() { return !1; } function oe() { if (P.dragging) { var j = q || V; De(j, w(j)); } } function be() { A = !1, te(!0), ne(!0); } function Me(j) { if (be(), !!P.dragging) { var Z = q || V, K = E("clientX", j) || 0, ce = E("clientY", j) || 0, ge = b(D, K, ce), ye = pt(ge, K, ce); ye && (q && J.copySortSource || !q || ye !== M) ? De(Z, ye) : J.removeOnSpill ? xe() : ut(); } } function De(j, Z) { var K = w(j); q && J.copySortSource && Z === M && K.removeChild(V), nt(Z) ? P.emit("cancel", j, M) : P.emit("drop", j, Z, M, G), tt(); } function xe() { if (P.dragging) { var j = q || V, Z = w(j); Z && Z.removeChild(j), P.emit(q ? "cancel" : "remove", j, Z, M), tt(); } } function ut(j) { if (P.dragging) { var Z = arguments.length > 0 ? j : J.revertOnSpill, K = q || V, ce = w(K), ge = nt(ce); ge === !1 && Z && (q ? ce && ce.removeChild(q) : M.insertBefore(K, L)), ge || Z ? P.emit("cancel", K, M, M) : P.emit("drop", K, ce, M, G), tt(); } } function tt() { var j = q || V; be(), Pe(), He(), j && s.rm(j, "gu-transit"), X && clearTimeout(X), P.dragging = !1, pe && P.emit("out", j, pe, M), P.emit("dragend", j, Q), M = V = q = L = G = X = pe = null; } function nt(j, Z) { var K; return Z !== void 0 ? K = Z : D ? K = G : K = _(q || V), j === M && K === L; } function pt(j, Z, K) { for (var ce = j; ce && !ge(); ) ce = w(ce); return ce; function ge() { var ye = U(ce); if (ye === !1) return !1; var le = ot(ce, j), _e = Oe(ce, le, Z, K), Re = nt(ce, _e); return Re ? !0 : J.accepts(V, ce, M, _e); } } function Ye(j) { if (!D) return; j.preventDefault(); var Z = E("clientX", j) || 0, K = E("clientY", j) || 0; D.style.left = Z - 2 + "px", D.style.top = K - 2 + "px"; var ce = q || V, ge = b(D, Z, K), ye = pt(ge, Z, K), le = ye !== null && ye !== pe; (le || ye === null) && (Je(), pe = ye, mt()), Ce(ge, K); var _e = w(ce); if (ye === M && q && !J.copySortSource) { _e && _e.removeChild(ce); return; } var Re, Qe = ot(ye, ge); if (z = it(Qe, ye), Qe !== null) Re = Oe(ye, Qe, Z, K); else if (J.revertOnSpill === !0 && !q) Re = L, ye = M; else { q && _e && _e.removeChild(ce), q && W && (W.style.display = "none"); return; } W.style.display = "block", ae(Re