UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,418 lines 234 kB
var Wn = Object.defineProperty; var Yn = (n, e, t) => e in n ? Wn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t; var oe = (n, e, t) => Yn(n, typeof e != "symbol" ? e + "" : e, t); import { ref as F, computed as _, defineComponent as Fe, onUnmounted as st, createVNode as h, createTextVNode as le, watch as we, Fragment as Re, reactive as Ge, createApp as vn, onMounted as nt, Transition as hn, mergeProps as Tt, nextTick as Ft, inject as Ut, onBeforeMount as _t, Teleport as Xn, shallowRef as Jn, render as Lt, h as Qn, cloneVNode as Zn, withDirectives as Kn, vModelText as eo } from "vue"; import { cloneDeep as De, isPlainObject as rn, isUndefined as qe } from "lodash-es"; import { getSchemaByTypeForDesigner as to, resolveAppearance as no, createPropsResolver as gn } from "../dynamic-resolver/index.esm.js"; import { useI18n as Wt } from "vue-i18n"; import { LocaleService as xt } from "../locale/index.esm.js"; import { getCustomClass as zt, withInstall as oo, FormSchemaEntityField$Type as an, FormSchemaEntityFieldTypeName as sn } from "../common/index.esm.js"; import { useResizeObserver as io } from "@vueuse/core"; import { getHierarchyRow as ro, useIdentify as ao, useGroupData as so, useFilter as lo, useHierarchy as co, useLoading as uo, useDataView as fo, useSelection as po, useSelectHierarchyItem as mo, usePagination as vo, useDataViewContainerStyle as ho, useCommandColumn as go, useSettingColumn as yo, useColumn as bo, useSort as wo, useGroupColumn as Co, useRow as So, useEdit as To, useVisualDataBound as Fo, useVisualDataCell as xo, useVisualDataRow as Mo, useVisualData as Eo, useCellPosition as Bo, useSidebar as ko, useVirtualScroll as Io, useFitColumn as Vo, useFilterHistory as Oo, useColumnFilter as Po, useDragColumn as No, getColumnHeader as Do, getSidebar as Ro, getDisableMask as jo, getHorizontalScrollbar as Lo, getVerticalScrollbar as $o, getEmpty as Ao, getPagination as Uo, getSummary as zo } from "../data-view/index.esm.js"; import { DgControl as rt } from "../designer-canvas/index.esm.js"; import { FormBindingType as qo } from "../property-panel/index.esm.js"; import Ho from "../accordion/index.esm.js"; import Go from "../avatar/index.esm.js"; import _o from "../../designer/button-edit/index.esm.js"; import Wo from "../button-group/index.esm.js"; import Yo from "../calendar/index.esm.js"; import Xo from "../capsule/index.esm.js"; import ln from "../../designer/checkbox/index.esm.js"; import cn from "../../designer/checkbox-group/index.esm.js"; import Jo from "../combo-list/index.esm.js"; import Qo from "../combo-tree/index.esm.js"; import Zo from "../component/index.esm.js"; import Ko from "../color-picker/index.esm.js"; import ei from "../content-container/index.esm.js"; import ti from "../date-picker/index.esm.js"; import ni from "../../designer/data-grid/index.esm.js"; import oi from "../dropdown/index.esm.js"; import ii from "../dynamic-form/index.esm.js"; import ri from "../events-editor/index.esm.js"; import ai from "../filter-bar/index.esm.js"; import si from "../field-selector/index.esm.js"; import li from "../binding-selector/index.esm.js"; import ci from "../image-cropper/index.esm.js"; import ui from "../../designer/input-group/index.esm.js"; import di from "../layout/index.esm.js"; import fi from "../list-nav/index.esm.js"; import pi from "../../designer/list-view/index.esm.js"; import mi from "../lookup/index.esm.js"; import vi from "../mapping-editor/index.esm.js"; import hi from "../nav/index.esm.js"; import gi from "../number-range/index.esm.js"; import yi from "../number-spinner/index.esm.js"; import bi from "../order/index.esm.js"; import wi from "../page-header/index.esm.js"; import Ci from "../page-footer/index.esm.js"; import Si from "../pagination/index.esm.js"; import Ti from "../progress/index.esm.js"; import Fi from "../query-solution/index.esm.js"; import xi from "../../designer/radio-group/index.esm.js"; import Mi from "../rate/index.esm.js"; import Ei from "../response-toolbar/index.esm.js"; import Bi from "../response-layout/index.esm.js"; import ki from "../response-layout-editor/index.esm.js"; import Ii from "../search-box/index.esm.js"; import Vi from "../section/index.esm.js"; import Oi from "../smoke-detector/index.esm.js"; import Pi from "../splitter/index.esm.js"; import Ni from "../step/index.esm.js"; import Di from "../switch/index.esm.js"; import Ri from "../tabs/index.esm.js"; import ji from "../tags/index.esm.js"; import Li from "../text/index.esm.js"; import $i from "../time-picker/index.esm.js"; import Ai from "../transfer/index.esm.js"; import Ui from "../tree-view/index.esm.js"; import zi from "../uploader/index.esm.js"; import qi from "../verify-detail/index.esm.js"; import Hi from "../video/index.esm.js"; import Gi from "../textarea/index.esm.js"; import _i from "../schema-selector/index.esm.js"; import Wi from "../../designer/tree-grid/index.esm.js"; import Yi from "../event-parameter/index.esm.js"; import Xi from "../filter-condition-editor/index.esm.js"; import Ji from "../fieldset/index.esm.js"; import Qi from "../sort-condition-editor/index.esm.js"; import Zi from "../menu-lookup/index.esm.js"; import Ki from "../../designer/drawer/index.esm.js"; import er from "../json-editor/index.esm.js"; import tr from "../property-editor/index.esm.js"; import nr from "../expression-editor/index.esm.js"; import or from "../code-editor/index.esm.js"; import ir from "../html-template/index.esm.js"; import rr from "../collection-property-editor/index.esm.js"; import ar from "../modal/index.esm.js"; import sr from "../external-container/index.esm.js"; import lr from "../language-textbox/index.esm.js"; import { FNotifyService as cr } from "../notify/index.esm.js"; import ur from "../tree-grid/index.esm.js"; import "bignumber.js"; function yn(n, e) { let t; function o(d) { const { properties: v, title: m, ignore: f } = d, p = f && Array.isArray(f), b = Object.keys(v).reduce((x, V) => ((!p || !f.find((N) => N === V)) && (x[V] = v[V].type === "object" && v[V].properties ? o(v[V]) : De(v[V].default)), x), {}); if (m && (!p || !f.find((x) => x === "id"))) { const x = m.toLowerCase().replace(/-/g, "_"); b.id = `${x}_${Math.random().toString().slice(2, 6)}`; } return b; } function i(d) { const { properties: v, title: m, required: f } = d; if (f && Array.isArray(f)) { const p = f.reduce((b, x) => (b[x] = v[x].type === "object" && v[x].properties ? o(v[x]) : De(v[x].default), b), {}); if (m && f.find((b) => b === "id")) { const b = m.toLowerCase().replace(/-/g, "_"); p.id = `${b}_${Math.random().toString().slice(2, 6)}`; } return p; } return { type: m }; } function a(d, v = {}, m) { const f = n[d]; if (f) { let p = i(f); const b = e[d]; return p = b ? b({ getSchemaByType: a }, p, v, m) : p, t != null && t.appendIdentifyForNewControl && t.appendIdentifyForNewControl(p), p; } return null; } function r(d, v) { const m = o(v); return Object.keys(m).reduce((f, p) => (Object.prototype.hasOwnProperty.call(d, p) && (f[p] && rn(f[p]) && rn(d[p] || !d[p]) ? Object.assign(f[p], d[p] || {}) : f[p] = d[p]), f), m), m; } function c(d, v) { return Object.keys(d).filter((f) => d[f] != null).reduce((f, p) => { if (v.has(p)) { const b = v.get(p); if (typeof b == "string") f[b] = d[p]; else { const x = b(p, d[p], d); Object.assign(f, x); } } else f[p] = d[p]; return f; }, {}); } function l(d, v, m = /* @__PURE__ */ new Map()) { const f = r(d, v); return c(f, m); } function s(d) { var m; const v = d.type; if (v) { const f = n[v]; if (!f) return d; const p = r(d, f), b = ((m = d.editor) == null ? void 0 : m.type) || ""; if (b) { const x = n[b], V = r(d.editor, x); p.editor = V; } return p; } return d; } function u(d) { t = d; } return { getSchemaByType: a, resolveSchemaWithDefaultValue: s, resolveSchemaToProps: l, mappingSchemaToProps: c, setDesignerContext: u }; } const Yt = {}, bn = {}, { getSchemaByType: $t, resolveSchemaWithDefaultValue: dr, resolveSchemaToProps: fr, mappingSchemaToProps: pr, setDesignerContext: Ac } = yn(Yt, bn); function mr(n = {}) { function e(s, u, d, v) { if (typeof d == "number") return v[s].length === d; if (typeof d == "object") { const m = Object.keys(d)[0], f = d[m]; if (m === "not") return Number(v[s].length) !== Number(f); if (m === "moreThan") return Number(v[s].length) >= Number(f); if (m === "lessThan") return Number(v[s].length) <= Number(f); } return !1; } function t(s, u, d, v) { return v[s] && v[s].propertyValue && String(v[s].propertyValue.value) === String(d); } const o = /* @__PURE__ */ new Map([ ["length", e], ["getProperty", t] ]); Object.keys(n).reduce((s, u) => (s.set(u, n[u]), s), o); function i(s, u) { const d = s; return typeof u == "number" ? [{ target: d, operator: "length", param: null, value: Number(u) }] : typeof u == "boolean" ? [{ target: d, operator: "getProperty", param: s, value: !!u }] : typeof u == "object" ? Object.keys(u).map((v) => { if (v === "length") return { target: d, operator: "length", param: null, value: u[v] }; const m = v, f = u[v]; return { target: d, operator: "getProperty", param: m, value: f }; }) : []; } function a(s) { return Object.keys(s).reduce((d, v) => { const m = i(v, s[v]); return d.push(...m), d; }, []); } function r(s, u) { if (o.has(s.operator)) { const d = o.get(s.operator); return d && d(s.target, s.param, s.value, u) || !1; } return !1; } function c(s, u) { return a(s).reduce((m, f) => m && r(f, u), !0); } function l(s, u) { const d = Object.keys(s), v = d.includes("allOf"), m = d.includes("anyOf"), f = v || m, x = (f ? s[f ? v ? "allOf" : "anyOf" : "allOf"] : [s]).map((N) => c(N, u)); return v ? !x.includes(!1) : x.includes(!0); } return { parseValueSchema: l }; } const vr = { convertTo: (n, e, t, o) => { n.appearance || (n.appearance = {}), n.appearance[e] = t; }, convertFrom: (n, e, t) => n.appearance ? n.appearance[e] : n[e] }, hr = { convertFrom: (n, e, t) => n.buttons && n.buttons.length ? `共 ${n.buttons.length} 项` : "无" }, gr = { convertTo: (n, e, t, o) => { n.editor && (n.editor[e] = t); }, convertFrom: (n, e, t) => n.editor && Object.prototype.hasOwnProperty.call(n.editor, e) ? n.editor[e] : n[e] }, L = { button: { type: "button", name: "按钮" }, "response-toolbar": { type: "response-toolbar", name: "工具栏" }, "response-toolbar-item": { type: "response-toolbar-item", name: "按钮" }, "content-container": { type: "content-container", name: "容器" }, "input-group": { type: "input-group", name: "文本" }, textarea: { type: "textarea", name: "多行文本" }, lookup: { type: "lookup", name: "帮助" }, "number-spinner": { type: "number-spinner", name: "数值" }, "date-picker": { type: "date-picker", name: "日期" }, switch: { type: "switch", name: "开关" }, "radio-group": { type: "radio-group", name: "单选组" }, "check-box": { type: "check-box", name: "复选框" }, "check-group": { type: "check-group", name: "复选框组" }, "combo-list": { type: "combo-list", name: "下拉列表" }, "response-form": { type: "response-form", name: "卡片面板" }, "response-layout": { type: "response-layout", name: "布局容器", icon: "response-layout-3" }, "response-layout-item": { type: "response-layout-item", name: "布局", icon: "response-layout-1" }, "tree-grid": { type: "tree-grid", name: "树表格" }, "tree-grid-column": { type: "tree-grid-column", name: "树表格列" }, "data-grid": { type: "data-grid", name: "表格" }, "data-grid-column": { type: "data-grid-column", name: "表格列" }, module: { type: "Module", name: "模块" }, component: { type: "component", name: "组件" }, tabs: { type: "tabs", name: "标签页" }, "tab-page": { type: "tab-page", name: "标签页项", dependentParentControl: "Tab" }, "tab-toolbar-item": { type: "tab-toolbar-item", name: "标签页工具栏按钮" }, "html-template": { type: "html-template", name: "模板容器" }, "time-picker": { type: "time-picker", name: "时间选择" }, section: { type: "section", name: "分组面板" }, "section-toolbar": { type: "section-toolbar", name: "分组面板工具栏" }, "section-toolbar-item": { type: "section-toolbar-item", name: "分组面板按钮" }, splitter: { type: "splitter", name: "分栏面板" }, "splitter-pane": { type: "splitter-pane", name: "分栏面板项", dependentParentControl: "Splitter" }, "component-ref": { type: "component-ref", name: "组件引用节点" }, uploader: { type: "uploader", name: "附件上传" }, "page-header": { type: "page-header", name: "页头" }, "page-footer": { type: "page-footer", name: "页脚" }, "tab-toolbar": { type: "tab-toolbar", name: "标签页工具栏" }, fieldset: { type: "fieldset", name: "分组" }, "query-solution": { type: "query-solution", name: "筛选方案" }, drawer: { type: "drawer", name: "抽屉" }, "external-container": { type: "external-container", name: "外部容器", icon: "content-container" }, "list-nav": { type: "list-nav", name: "列表导航" }, "list-view": { type: "list-view", name: "列表" }, "filter-bar": { type: "filter-bar", name: "筛选条" }, "language-textbox": { type: "language-textbox", name: "多语输入框" } }, yr = { convertFrom: (n, e, t) => { var i; const o = n.editor && n.editor[e] ? n.editor[e] : n[e]; return ((i = L[o]) == null ? void 0 : i.name) || o; } }, br = { convertTo: (n, e, t, o) => { n[e] = n[e]; }, convertFrom: (n, e, t) => n.editor ? t.getRealEditorType(n.editor.type) : "" }, wr = { convertTo: (n, e, t, o) => { (n.type === "data-grid-column" || n.type === "tree-grid-column") && (n.formatter ? n.formatter[e] = t : n.formatter = { [e]: t }); }, convertFrom: (n, e, t) => { if (n.formatter) { if (e === "trueText") return n.formatter.trueText; if (e === "falseText") return n.formatter.falseText; if (e === "prefix") return n.formatter.prefix; if (e === "suffix") return n.formatter.suffix; if (e === "precision") return n.formatter.precision; if (e === "decimal") return n.formatter.decimal; if (e === "thousand") return n.formatter.thousand; if (e === "tempDateFormat") return n.formatter.dateFormat === "yyyy年MM月dd日" ? "yearMonthDay" : n.formatter.dateFormat === "yyyy-MM-dd HH:mm:ss" ? "yyyy-MM-ddTHH:mm:ss" : n.formatter.dateFormat === "yyyy/MM/dd HH:mm:ss" ? "yyyy/MM/ddTHH:mm:ss" : n.formatter.dateFormat === "yyyy年MM月dd日 HH时mm分ss秒" ? "yearMonthDayHourMinuteSecond" : n.formatter.tempDateFormat || n.formatter.dateFormat || "yyyy-MM-dd"; if (e === "customFormat") return n.formatter.customFormat; if (e === "type") return n.formatter.type || "none"; } return "none"; } }, Cr = { convertTo: (n, e, t, o) => { n.command ? n.command[e] = t : n.command = { [e]: t }, e === "enable" && t && (n.command.commands || (n.command.commands = [ { text: "编辑", type: "primary", command: "edit" }, { text: "删除", type: "danger", command: "remove" } ])); }, convertFrom: (n, e, t) => n.command && e === "enable" ? n.command.enable : "" }, Sr = { convertTo: (n, e, t, o) => { n.column ? n.column[e] = t : n.column = { [e]: t }, e === "fitColumns" && t && (n.column.fitMode || (n.column.fitMode = "average")); }, convertFrom: (n, e, t) => { if (n.column) { if (e === "fitColumns") return n.column.fitColumns; if (e === "fitMode") return n.column.fitMode; } return ""; } }, Tr = { convertTo: (n, e, t, o) => { n.summary ? n.summary[e] = t : n.summary = { [e]: t }, e === "enable" && t && (n.summary ? n.summary.groupFields || (n.summary.groupFields = []) : n.summary = { enable: t, groupFields: [] }); }, convertFrom: (n, e, t) => n.summary && e === "enable" ? n.summary.enable : n.type === "data-grid-column" ? n.enableSummary === void 0 ? !1 : n.enableSummary : "" }, Fr = { convertTo: (n, e, t, o) => { n.group ? n.group[e] = t : n.group = { [e]: t }, e === "enable" && t && (n.group ? n.group.groupFields || (n.group.groupFields = []) : n.group = { enable: t, groupFields: [], showSummary: !1 }); }, convertFrom: (n, e, t) => { if (n.group) { if (e === "enable") return n.group.enable; if (e === "showSummary") return n.group.showSummary; } } }, xr = { convertFrom: (n, e) => n.binding ? n.binding.path : "", convertTo: (n, e, t) => { if (t && t.length > 0) { const o = t[0]; n.binding || (n.binding = {}), n.binding.type = "Form", n.binding.path = o.bindingField, n.binding.field = o.id, n.binding.fullPath = o.path, n.path = o.bindingPath; } } }, Mr = { convertTo: (n, e, t, o) => { n.pagination || (n.pagination = {}), n.pagination[e] = t; }, convertFrom: (n, e, t) => n.pagination ? n.pagination[e] : n[e] }, Er = { convertTo: (n, e, t, o) => { n.rowNumber || (n.rowNumber = {}), n.rowNumber[e] = t; }, convertFrom: (n, e, t) => n.rowNumber ? n.rowNumber[e] : n[e] }, Br = { convertTo: (n, e, t, o) => { n.selection || (n.selection = {}), n.selection[e] = t; }, convertFrom: (n, e, t) => n.selection ? n.selection[e] : n[e] }, kr = { convertFrom: (n, e, t) => n[e] && n[e].length ? `共 ${n[e].length} 项` : "" }, Ir = { convertFrom: (n, e) => n[e] || "", convertTo: (n, e, t) => { n[e] = t; } }, Vr = { convertTo: (n, e, t, o) => { n.size || (n.size = {}), n.size[e] = t; }, convertFrom: (n, e, t) => n.size ? n.size[e] : n[e] }, Or = { convertFrom: (n, e, t) => { var o, i; return (o = n.formatter) != null && o.data && e === "formatterEnumData" && !n.formatterEnumData ? (i = n.formatter) == null ? void 0 : i.data : n.formatterEnumData; } }, Pr = { convertTo: (n, e, t, o) => { n.sort || (n.sort = {}), n.sort[e] = t; }, convertFrom: (n, e, t) => { var o, i; if (e === "mode") return ((o = n.sort) == null ? void 0 : o.mode) || "client"; if (e === "multiSort") return !!((i = n.sort) != null && i.multiSort); } }, Nr = { convertTo: (n, e, t, o) => { n.filter || (n.filter = {}), n.filter[e] = t; }, convertFrom: (n, e, t) => { var o; if (e === "mode") return ((o = n.filter) == null ? void 0 : o.mode) || "client"; } }, Dr = { convertTo: (n, e, t, o) => { n.rowOption ? n.rowOption[e] = t : n.rowOption = { [e]: t }; }, convertFrom: (n, e, t) => { if (n.rowOption) { if (e === "customRowStyle") return n.rowOption.customRowStyle; if (e === "customCellStyle") return n.rowOption.customCellStyle; } return ""; } }; function wn(n, e, t) { const o = /* @__PURE__ */ new Map([ ["/converter/appearance.converter", vr], ["/converter/buttons.converter", hr], ["/converter/property-editor.converter", gr], ["/converter/items-count.converter", kr], ["/converter/type.converter", yr], ["/converter/change-editor.converter", br], ["/converter/change-formatter.converter", wr], ["/converter/column-command.converter", Cr], ["/converter/column-option.converter", Sr], ["/converter/summary.converter", Tr], ["/converter/group.converter", Fr], ["/converter/form-group-label.converter", Ir], ["/converter/field-selector.converter", xr], ["/converter/pagination.converter", Mr], ["/converter/row-number.converter", Er], ["/converter/grid-selection.converter", Br], ["/converter/size.converter", Vr], ["/converter/change-formatter-enum.converter", Or], ["/converter/grid-sort.converter", Pr], ["/converter/grid-filter.converter", Nr], ["/converter/row-option.converter", Dr] ]), i = /* @__PURE__ */ new Map([ ["string", { type: "input-group", enableClear: !1 }], ["boolean", { type: "combo-list", textField: "name", valueField: "value", idField: "value", enableClear: !1, editable: !1, data: [ { value: !0, name: "是" }, { value: !1, name: "否" } ] }], ["enum", { type: "combo-list", maxHeight: 128, enableClear: !1, editable: !1 }], ["array", { type: "button-edit" }], ["number", { type: "number-spinner", placeholder: "" }], ["events-editor", { type: "events-editor", hide: !0 }] ]), a = mr(); function r(f, p) { return () => a.parseValueSchema(f, p); } function c(f, p, b) { return f.includes("visible") && p.visible !== void 0 ? typeof p.visible == "boolean" ? () => !!p.visible : p.visible === void 0 ? !0 : r(p.visible, b) : () => !0; } function l(f, p, b) { return f.includes("readonly") && p.readonly !== void 0 ? typeof p.readonly == "boolean" ? () => !!p.readonly : r(p.readonly, b) : () => !1; } function s(f, p) { const b = f.$converter || p; return typeof b == "string" && b && o.has(b) ? o.get(b) || null : b || null; } function u(f, p, b, x, V, N = "", E = "") { return Object.keys(f).map((T) => { const O = F(1), g = T, y = f[T], S = Object.keys(y), w = y.title, M = y.type, I = i.get(M) || { type: "input-group", enableClear: !1 }, B = y.editor ? Object.assign({}, I, y.editor) : Object.assign({}, I), P = c(S, y, p), G = l(S, y, p); B.readonly = B.readonly === void 0 ? G() : B.readonly; const Q = y.type === "cascade" ? u(y.properties, p, b, x, V, N, E) : [], j = !0; let D = s(y, E); const X = _({ get() { if (O.value) { if (["class", "style"].find((ve) => ve === g) && !D && (D = o.get("/converter/appearance.converter") || null), D && D.convertFrom) return D.convertFrom(b, T, V, N); const ue = b[T]; return Object.prototype.hasOwnProperty.call(y, "defaultValue") && (ue === void 0 || typeof ue == "string" && ue === "") ? y.type === "boolean" ? y.defaultValue : y.defaultValue || "" : ue; } return null; }, set(ue) { O.value += 1, D && D.convertTo ? (D.convertTo(x, T, ue, V, N), D.convertTo(b, T, ue, V, N)) : (x[T] = ue, b[T] = ue); } }), { refreshPanelAfterChanged: q, description: K, isExpand: ce, parentPropertyID: de } = y, ee = { propertyID: g, propertyName: w, propertyType: M, propertyValue: X, editor: B, visible: P, readonly: G, cascadeConfig: Q, hideCascadeTitle: j, refreshPanelAfterChanged: q, description: K, isExpand: ce, parentPropertyID: de }; return p[g] = ee, ee; }); } function d(f, p, b = {}) { const x = {}, V = n[f]; return V && V.categories ? Object.keys(V.categories).map((E) => { const C = V.categories[E], T = C == null ? void 0 : C.title, O = u(C.properties || {}, x, {}, b, p); return { categoryId: E, categoryName: T, properties: O }; }) : []; } function v(f, p, b, x, V = "") { const N = p.$ref.schema, E = p.$ref.converter, C = b[N], T = C.type, O = t(C), g = {}, y = n[T]; if (y && y.categories) { const S = y.categories[f], w = S == null ? void 0 : S.title; E && Object.keys(S.properties).forEach((B) => { S.properties[B].$converter = E; }); const M = (S == null ? void 0 : S.properties) || {}, I = u(M, g, O, C, x, V); return { categoryId: f, categoryName: w, properties: I }; } return { categoryId: f, categoryName: "", properties: [] }; } function m(f, p, b, x, V) { const N = f.type, E = t(f), C = {}; let T = V || n[N]; if (T && Object.keys(T).length === 0 && b && b.getPropConfig && (T = b.getPropConfig(x)), T && T.categories) { const O = []; return Object.keys(T.categories).map((g) => { const y = T.categories[g]; if (y.$ref) { O.push(v(g, y, f, p, x)); return; } const S = y == null ? void 0 : y.title, w = y == null ? void 0 : y.tabId, M = y == null ? void 0 : y.tabName, I = y == null ? void 0 : y.hide, B = y == null ? void 0 : y.hideTitle, P = u(y.properties || {}, C, E, f, p, x, y.$converter), { setPropertyRelates: G } = y, Q = y == null ? void 0 : y.parentPropertyID; O.push({ categoryId: g, categoryName: S, tabId: w, tabName: M, hide: I, properties: P, hideTitle: B, setPropertyRelates: G, parentPropertyID: Q }); }), O; } return []; } return { getPropertyConfigBySchema: m, getPropertyConfigByType: d, propertyConverterMap: o }; } const Cn = {}, Sn = {}; wn(Cn, Sn, dr); const Tn = {}, Fn = {}, { getSchemaByType: Uc, resolveSchemaWithDefaultValue: Rr, resolveSchemaToProps: zc, mappingSchemaToProps: qc, setDesignerContext: Hc } = yn(Tn, Fn), xn = {}, Mn = {}; wn(xn, Mn, Rr); function ht(n, e, t = /* @__PURE__ */ new Map(), o = (r, c, l, s) => c, i = {}, a = (r) => r) { return Yt[e.title] = e, bn[e.title] = o, Cn[e.title] = i, Sn[e.title] = a, Tn[e.title] = e, Fn[e.title] = o, xn[e.title] = i, Mn[e.title] = a, (r = {}, c = !0) => { if (!c) return pr(r, t); const l = fr(r, e, t), s = Object.keys(n).reduce((u, d) => (u[d] = n[d].default, u), {}); return Object.assign(s, l); }; } function Xt(n, e) { return { customClass: e.class, customStyle: e.style }; } const jr = "https://json-schema.org/draft/2020-12/schema", Lr = "https://farris-design.gitee.io/video.schema.json", $r = "video", Ar = "A Farris Video Component", Ur = "object", zr = { 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 } }, qr = [ "id", "type" ], Hr = { $schema: jr, $id: Lr, title: $r, description: Ar, type: Ur, properties: zr, required: qr }, Gr = /* @__PURE__ */ new Map([ ["appearance", Xt] ]); function _r(n, e, t) { return e; } const Wr = "verify-detail", Yr = "A Farris Component", Xr = "object", Jr = { basic: { description: "Basic Infomation", title: "基本信息", properties: { id: { description: "组件标识", title: "标识", type: "string", readonly: !0 }, type: { description: "组件类型", title: "控件类型", type: "select", editor: { type: "waiting for modification", enum: [] } } } } }, Qr = { title: Wr, description: Yr, type: Xr, categories: Jr }, Jt = { 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 } }, un = ht(Jt, Hr, Gr, _r, Qr); function Zr(n, e) { function t(b) { b.stopPropagation(), e.emit("abort"); } function o(b) { b.stopPropagation(), e.emit("play"); } function i(b) { b.stopPropagation(), e.emit("pause"); } function a(b) { b.stopPropagation(), e.emit("ended"); } function r(b) { b.stopPropagation(), e.emit("durationchange"); } function c(b) { b.stopPropagation(), e.emit("error"); } function l(b) { b.stopPropagation(), e.emit("loadeddata"); } function s(b) { b.stopPropagation(), e.emit("loadedmetadata"); } function u(b) { b.stopPropagation(), e.emit("loadstart"); } function d(b) { b.stopPropagation(), e.emit("playing"); } function v(b) { b.stopPropagation(), e.emit("progress"); } function m(b) { b.stopPropagation(), e.emit("timeupdate"); } function f(b) { b.stopPropagation(), e.emit("volumechange"); } function p(b) { b.stopPropagation(), e.emit("canplay"); } return { onAbort: t, onPlay: o, onPause: i, onEnded: a, onDurationchange: r, onError: c, onLoadeddata: l, onLoadedmetadata: s, onLoadstart: u, onPlaying: d, onProgress: v, onTimeupdate: m, onVolumechange: f, onCanplay: p }; } const At = /* @__PURE__ */ Fe({ name: "FVideo", props: Jt, emits: ["abort", "play", "pause", "ended", "durationchange", "canplay", "error", "loadeddata", "loadedmetadata", "loadstart", "playing", "progress", "timeupdate", "volumechange"], setup(n, e) { const t = F(), { onAbort: o, onPlay: i, onPause: a, onEnded: r, onDurationchange: c, onError: l, onLoadeddata: s, onLoadedmetadata: u, onLoadstart: d, onPlaying: v, onProgress: m, onTimeupdate: f, onVolumechange: p, onCanplay: b } = Zr(n, e); return st(() => { }), () => h("video", { ref: t, src: n.src, autoplay: n.autoplay, controls: n.controls, loop: n.loop, muted: n.muted, width: n.width, height: n.height, poster: n.poster, onAbort: (x) => o(x), onPlay: (x) => i(x), onPause: (x) => a(x), onEnded: (x) => r(x), onDurationchange: (x) => c(x), onError: (x) => l(x), onLoadeddata: (x) => s(x), onLoadedmetadata: (x) => u(x), onLoadstart: (x) => d(x), onPlaying: (x) => v(x), onProgress: (x) => m(x), onTimeupdate: (x) => f(x), onVolumechange: (x) => p(x), onCanplay: (x) => b(x) }, [le("Your browser does not support the video tag.")]); } }); function En(n, e, t) { var w; const o = t && t.getStyles && t.getStyles() || "", i = t && t.getDesignerClass && t.getDesignerClass() || "", a = F(); let r; function c() { return (e == null ? void 0 : e.schema.componentType) === "frame" ? !1 : t && t.checkCanMoveComponent ? t.checkCanMoveComponent() : !0; } function l() { return !1; } function s() { return (e == null ? void 0 : e.schema.componentType) === "frame" ? !1 : t && t.checkCanDeleteComponent ? t.checkCanDeleteComponent() : !0; } function u() { return (e == null ? void 0 : e.schema.componentType) === "frame" ? !0 : t && t.hideNestedPaddingInDesginerView ? t.hideNestedPaddingInDesginerView() : !1; } function d(M) { if (!M || !M.value) return null; if (M.value.schema && M.value.schema.type === "component") return M.value; const I = F(M == null ? void 0 : M.value.parent), B = d(I); return B || null; } function v(M = e) { var G; if (t != null && t.getDraggableDesignItemElement) return t.getDraggableDesignItemElement(M); const { componentInstance: I, designerItemElementRef: B } = M; if (!I || !I.value) return null; const { getCustomButtons: P } = I.value; return I.value.canMove || P && ((G = P()) != null && G.length) ? B : v(M.parent); } function m(M) { return !!t && t.canAccepts(M); } function f() { return (e == null ? void 0 : e.schema.label) || (e == null ? void 0 : e.schema.title) || (e == null ? void 0 : e.schema.name); } function p() { } function b(M, I) { var B; !M || !I || (t != null && t.onAcceptMovedChildElement && t.onAcceptMovedChildElement(M, I), (B = e == null ? void 0 : e.setupContext) == null || B.emit("dragEnd")); } function x(M, I) { const { componentType: B } = M; let P = to(B, M, I); t && t.onResolveNewComponentSchema && (P = t.onResolveNewComponentSchema(M, P)); const G = B.toLowerCase().replace(/-/g, "_"); return P && !P.id && P.type === B && (P.id = `${G}_${Math.random().toString().slice(2, 6)}`), P; } function V(M) { M && t != null && t.onChildElementMovedOut && t.onChildElementMovedOut(M); } function N(...M) { if (t && t.getPropsConfig) return t.getPropsConfig(...M); } function E(M) { if (!M) return; const I = e == null ? void 0 : e.schema, { formSchemaUtils: B } = M; if (I && B.getExpressions().length) { const P = B.getExpressions().findIndex((G) => G.target === I.id); P > -1 && B.getExpressions().splice(P, 1); } } function C(M) { if (!M || !(e != null && e.schema)) return; const I = e.schema, { formSchemaUtils: B } = M; B.removeCommunicationInComponent(I); } function T(M) { t && t.onRemoveComponent && t.onRemoveComponent(), E(M), C(M), e != null && e.schema.contents && e.schema.contents.map((I) => { let B = I.id; I.type === "component-ref" && (B = I.component); const P = n.value.querySelectorAll(`#${B}-design-item`); P != null && P.length && Array.from(P).map((G) => { var Q; (Q = G == null ? void 0 : G.componentInstance) != null && Q.value.onRemoveComponent && G.componentInstance.value.onRemoveComponent(M); }); }); } function O() { if (t && t.getCustomButtons) return t.getCustomButtons(); } function g(M) { var B, P; if (!((B = e == null ? void 0 : e.schema) != null && B.id)) return; if (!r && M && (r = M.formSchemaUtils), t != null && t.setComponentBasicInfoMap) { t.setComponentBasicInfoMap(); return; } let I = ""; if (t != null && t.getComponentTitle) I = t.getComponentTitle(); else { const { text: G, title: Q, label: j, mainTitle: D, name: X, type: q } = e.schema; I = G || Q || j || D || X || ((P = L[q]) == null ? void 0 : P.name); } I && r.getControlBasicInfoMap().set(e.schema.id, { componentTitle: I, parentPathName: I }); } function y(M) { var G; const { changeObject: I } = M, { propertyID: B, propertyValue: P } = I; if (["text", "title", "label", "name", "mainTitle"].includes((G = M == null ? void 0 : M.changeObject) == null ? void 0 : G.propertyID) && B && P && (g(), r)) { const Q = r.getControlBasicInfoMap(), j = Q.keys().toArray().filter((D) => { var X, q; return ((X = Q.get(D)) == null ? void 0 : X.reliedComponentId) === ((q = e == null ? void 0 : e.schema) == null ? void 0 : q.id); }); j != null && j.length && j.forEach((D) => { const X = Q.get(D).parentPathName.split(" > "); X[0] = P, Q.get(D).parentPathName = X.join(" > "); }); } } function S(M) { if (y(M), t && t.onPropertyChanged) return t.onPropertyChanged(M); } return a.value = { canMove: c(), canSelectParent: l(), canDelete: s(), canNested: !u(), contents: e == null ? void 0 : e.schema.contents, elementRef: n, parent: (w = e == null ? void 0 : e.parent) == null ? void 0 : w.componentInstance, schema: e == null ? void 0 : e.schema, styles: o, designerClass: i, canAccepts: m, getBelongedComponentInstance: d, getDraggableDesignItemElement: v, getDraggingDisplayText: f, getPropConfig: N, getDragScopeElement: p, onAcceptMovedChildElement: b, onChildElementMovedOut: V, addNewChildComponentSchema: x, triggerBelongedComponentToMoveWhenMoved: !!t && t.triggerBelongedComponentToMoveWhenMoved || F(!1), triggerBelongedComponentToDeleteWhenDeleted: !!t && t.triggerBelongedComponentToDeleteWhenDeleted || F(!1), onRemoveComponent: T, getCustomButtons: O, onPropertyChanged: S, setComponentBasicInfoMap: g, updateContextSchema: e == null ? void 0 : e.updateContextSchema }, a; } class Kr { getTemplateRule(e, t) { const o = t == null ? void 0 : t.formSchemaUtils, i = o == null ? void 0 : o.getFormTemplateRule(), a = { canAccept: !0, canDelete: !0, canMove: !0 }; if (!i) return a; const r = this.getComponentContext(e), { componentClassList: c } = r; return c.forEach((l) => { if (!l || !i[l]) return; const { canMove: s, canDelete: u, canAccept: d } = i[l]; a.canMove = a.canMove && this.resolveRuleValue(s, r), a.canDelete = a.canDelete && this.resolveRuleValue(u, r), a.canAccept = a.canAccept && this.resolveRuleValue(d, r); }), a; } resolveRuleValue(e, t) { return typeof e == "boolean" ? e : this.parseRuleValueSchema(e, t); } parseRuleValueSchema(e, t) { const o = e.invalidContext || []; let i = !0; for (const a of o) { const { firstLevelChild: r, secondLevelChild: c, parent: l, ...s } = a; if (s && t.component) { let u = !0; for (const d of Object.keys(s)) if (s[d] !== t.component[d]) { u = !1; break; } if (!u) { i = !1; continue; } } if (a.firstLevelChild) { if (a.firstLevelChild.class) { const { firstLevelChildClassList: u } = t; if (u && !u.includes(a.firstLevelChild.class)) { i = !1; continue; } } if (a.firstLevelChild.type) { const { firstLevelChildSchema: u } = t; if (!u || u.type !== a.firstLevelChild.type) { i = !1; continue; } } } if (a.secondLevelChild) { if (a.secondLevelChild.class) { const { secondLevelChildClassList: u } = t; if (u && !u.includes(a.secondLevelChild.class)) { i = !1; continue; } } if (a.secondLevelChild.type) { const { secondLevelChildSchema: u } = t; if (!u || u.type !== a.secondLevelChild.type) { i = !1; continue; } } } if (a.parent) { if (a.parent.class) { const { parentClassList: u } = t; if (u && !u.includes(a.parent.class)) { i = !1; continue; } } if (a.parent.type) { const { parentSchema: u } = t; if (u && u.type !== a.parent.type) { i = !1; continue; } } } i = !0; break; } return !i; } getComponentContext(e) { var p, b, x, V; const t = e.schema, o = t.appearance && t.appearance.class || "", i = o.split(" ") || [], a = t.contents || [], r = a.length ? a[0] : null, c = r && r.appearance ? r.appearance.class : "", l = c ? c.split(" ") : [], s = (p = r == null ? void 0 : r.contents) != null && p.length ? r == null ? void 0 : r.contents[0] : null, u = s && s.appearance ? s.appearance.class : "", d = u ? u.split(" ") : [], v = t.type === "component" ? (x = (b = e.parent) == null ? void 0 : b.parent) == null ? void 0 : x.schema : (V = e.parent) == null ? void 0 : V.schema, m = v && v.appearance && v.appearance.class || "", f = m ? m.split(" ") : []; return { componentClass: o, componentClassList: i, childContents: a, firstLevelChildSchema: r, firstLevelChildClass: c, firstLevelChildClassList: l, secondLevelChildSchema: s, secondLevelChildClass: u, secondLevelChildClassList: d, parentSchema: v, parentClass: m, parentClassList: f, component: t }; } } const ea = F(0); function Bn() { ea.value++; } const kn = F(0); function ta(n) { const { formSchemaUtils: e, formStateMachineUtils: t } = n; function o(l, s = "") { return { path: s + l.code, field: l.id, fullPath: l.code }; } function i(l, s = "") { return e.getViewModelById(l).states.map((d) => o(d, s)); } function a(l) { const s = e.getRootViewModelId(), u = i(l); if (l === s) return u; const d = i(s, "root-component."); return [...u, ...d]; } function r(l) { return l.binding && l.binding.path || l.id || ""; } function c() { return t && t.getRenderStates() || []; } return { getVariables: a, getControlName: r, getStateMachines: c }; } class na { constructor(e) { oe(this, "sessionVariables", [ { key: "CurrentSysOrgName", name: "当前组织Name", description: "当前组织Name" }, // { // key: "CurrentSysOrgCode", // name: "当前组织Code", // description: "当前组织Code" // }, { key: "CurrentSysOrgId", name: "当前组织Id", description: "当前组织Id" }, { key: "CurrentUserName", name: "当前用户Name", description: "当前用户Name" }, { key: "CurrentUserCode", name: "当前用户Code", description: "当前用户Code" }, { key: "CurrentUserId", name: "当前用户Id", description: "当前用户Id" }, { key: "CurrentLanguage", name: "当前语言编号", description: "当前登录的语言编号,例如简体中文返回'zh-CHS',英文返回'en',繁体中文'zh-CHT'" } ]); oe(this, "expressionNames", { compute: "计算表达式", dependency: "依赖表达式", validate: "验证表达式", dataPicking: "帮助前表达式", visible: "可见表达式", readonly: "只读表达式", required: "必填表达式" }); oe(this, "getExpressionConverter", (e, t) => ({ convertFrom: (o, i, a, r) => { const c = a.getExpressionRuleValue(e, t || i); return c && c.value || ""; }, convertTo: (o, i, a, r, c) => { var l; if (i === "dataPicking" && (a != null && a.target)) { const s = `${a.target}_dataPicking`; ((l = a.rules) == null ? void 0 : l.some( (d) => d.id === s && d.value )) ? o.dictPickingExpressionId = s : delete o.dictPickingExpressionId; } r.updateExpression(a); } })); this.formSchemaService = e; } getExpressionRule(e, t) { const o = this.formSchemaService.getExpressions(); if (!o) return ""; const i = o.find((r) => r.target === e); if (!i) return ""; const a = i.rules.find((r) => r.type === t); return a || ""; } // 获取上下文表单变量 getContextFormVariables() { const { module: e } = this.formSchemaService.getFormSchema(); if (!e.viewmodels || e.viewmodels.length === 0) return []; const t = this.formSchemaService.getRootViewModelId(), o = this.formSchemaService.getViewModelById(t); if (!o || !o.states || o.states.length === 0) return []; const i = []; return o.states.forEach((a) => { i.push({ key: a.code, name: a.name, description: a.name, category: a.category }); }), i; } createTreeNode(e, t, o = "label") { return { id: e.id, name: e.name, bindingPath: e[o], parents: t, type: "field" }; } buildEntityFieldsTreeData(e = null, t) { const o = []; return e == null || e.forEach((i) => { var c; const a = this.createTreeNode(i, t); let r = []; (c = i.type) != null && c.fields && (r = this.buildEntityFieldsTreeData(i.type.fields, [...t, i.label])), o.push({ data: a, children: r, expanded: !0 }); }), o; } buildChildEntityTreeData(e = null, t) { const o = []; return e == null || e.forEach((i) => { var l, s; const a = this.createTreeNode(i, t); a.type = "entity"; const r = this.buildEntityFieldsTreeData((l = i.type) == null ? void 0 : l.fields, [...t, i.label]), c = this.buildChildEntityTreeData((s = i.type) == null ? void 0 : s.entities, [...t, i.label]); c != null && c.length && (r == null || r.push(...c)), o.push({ data: a, children: r || [], // 空值回退 expanded: !0 }); }), o; } getEntitiesTreeData() { const e = this.formSchemaService.getSchemaEntities(); if (!(e != null && e.length)) return []; const t = e[0]; if (!(t != null && t.type)) return []; const o = this.buildEntityFieldsTreeData(t.type.fields, [t.code]), i = this.buildChildEntityTreeData(t.type.entities, [t.code]); return i != null && i.length && (o == null || o.push(...i)), { entityCode: t.code, fields: [{ data: this.createTreeNode(t, [], "code"), children: o || [] }] }; } getEntitiesAndVariables() { return { entities: this.getEntitiesTreeData(), variables: { session: { name: "系统变量", items: this.sessionVariables, visible: !1 }, forms: { name: "表单变量", items: this.getContextFormVariables(), visible: !0 } } }; } onBeforeOpenExpression(e, t, o) { const i = o === "Field" ? e.binding.field : e.id, a = this.getExpressionRule(i, t), r = this.getEntitiesAndVariables(), c = { message: ["validate", "required", "dataPicking"].includes(t) && a ? a.message : "", ...r }; return a.messageType != null && (c.messageType = a.messageType), c; } buildRule(e, t, o, i) { const { expression: a, message: r, messageType: c } = t, l = { id: `${e}_${o}`, type: o, value: a }; return (o === "validate" || o === "dataPicking" || o === "required") && (l.message = r), o === "dataPicking" && (l.messageType = c), o === "validate" && i && (l.elementId = i), l; } getExpressionData() { const { expressions: e } = this.formSchemaService.getFormSchema().module; return e || []; } updateExpression(e, t, o, i) { const a = t === "Field" ? e.binding.field : e.id, r = this.buildRule(a, o, i, e.type === "form-group" ? e.id : ""); let l = this.getExpressionData().find((u) => u.targetType === t && u.target === a); const s = (u) => u.value.trim() === ""; if (l) { const u = l.rules.find((d) => d.id === r.id); if (u) s(r) ? l.rules = l.rules.filter((d) => d.id !== r.id) : (Object.assign(u, r), i === "validate" && e.type === "form-group" && (u.elementId = e.id)); else { if (s(r)) return null; l.rules = l.rules || [], l.rules.push(r); } } else { if (s(r)) return null; l = { target: `${a}`, rules: [r], targetType: t }; } return l; } getExpressionEditorOptions(e, t, o, i) { return o.reduce((a, r) => { var l, s; const c = t === "Field" ? (l = e == null ? void 0 : e.binding) == null ? void 0 : l.field : e.id; return a[r] = { hide: t === "Field" ? !!((s = e == null ? void 0 : e.binding) != null && s.field) : !1, description: "", title: this.expressionNames[r], type: "string", $converter: this.getExpressionConverter(c), refreshPanelAfterChanged: !0, editor: { type: "expression-editor", singleExpand: !1, dialogTitle: `${this.expressionNames[r]}编辑器`, showMessage: r === "validate" || r === "dataPicking" || r === "required", showMessageType: r === "dataPicking", beforeOpen: () => this.onBeforeOpenExpression(e, r, t), onSubmitModal: (u) => { const d = this.updateExpression(e, t, u, r); if (i) { const v = this.buildRule(c, u, r); i(v); } return d; } } }, a; }, {}); } getExpressionInfo(e, t, o) { const i = t === "Field" ? e.binding.field : e.id, a = this.getExpressionRule(i, o), r = { value: a && a.value, targetId: i, targetType: t, expressionType: o }; return a && a.message && (r.message = a.message), r; } getExpressionConfig(e, t, o = ["compute", "dependency", "validate"], i) { return { description: "表达式", title: "表达式", hide: !e.binding, properties: { ...this.getExpressionEditorOptions(e, t, o, i) } }; } getExpressionOptions(e, t, o) { const i = this.getExpressionInfo(e, t, o); return { dialogTitle: `${this.expressionNames[o]}编辑器`, singleExpand: !1, showMessage: o === "required", beforeOpen: () => this.onBeforeOpenExpression(e, o, t), expressionInfo: i }; } } class oa { constructor(e, t) { oe(this, "componentId"); oe(this, "viewModelId"); oe(this, "eventsEditorUtils"); oe(this, "formSchemaUtils"); oe(this, "formMetadataConverter"); oe(this, "designViewModelUtils"); oe(this, "designViewModelField"); oe(this, "controlCreatorUtils"); oe(this, "designerHostService"); oe(this, "designerContext"); oe(this, "schemaService", null); oe(this, "metadataService", null); oe(this, "propertyConfig", { type: "object", categories: {} }); var o; this.componentId = e, this.designerHostService = t, this.eventsEditorUtils = t.eventsEditorUtils, this.formSchemaUtils = t.formSchemaUtils, this.formMetadataConverter = t.formMetadataConverter, this.viewModelId = ((o = this.formSchemaUtils) == null ? void 0 : o.getViewModelIdByComponentId(e)) || "", this.designViewModelUtils = t.designViewModelUtils, this.controlCreatorUtils = t.controlCreatorUtils, this.metadataService = t.metadataService, this.schemaService = t.schemaService, this.designerContext = t.designerContext; } getFormDesignerInstance() { var e, t; return (t = (e = this.designerContext) == null ? void 0 : e.instances) == null ? void 0 : t.formDesigner.value; } getTableInfo() { var e; return (e = this.schemaService) == null ? void 0 : e.getTableInfoByViewModelId(this.viewModelId); } setDesignViewModelField(e) { var o; const t = e.binding && e.binding.type === "Form" && e.binding.field; if (t) { if (!this.designViewModelField) { const i = this.designViewModelUtils.getDgViewModel(this.viewModelId)