@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
1,454 lines • 1.65 MB
JavaScript
var $h = Object.defineProperty;
var Rh = (e, t, n) => t in e ? $h(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
var z = (e, t, n) => Rh(e, typeof t != "symbol" ? t + "" : t, n);
import { getCustomClass as st, FormSchemaEntityField$Type as to, FormSchemaEntityFieldType$Type as Do, withInstall as yt, isMobilePhone as Fn, getMaxZIndex as Wo, useGuid as pn, resolveField as Cn, useDateFormat as Xn, useResizeObserver as Mu, getCustomStyle as nn, CHECKBOX_CONTEXT as as, useCheck as os, radioCheckboxCommonProps as jc, useThirdComponent as Hc, FormSchemaEntityFieldTypeName as Ro, useCommonUtils as Ml, formatTime as Nh, useTextBox as zc, useClear as Wc, encrypt as jh, useDelayedRef as Hh, useNumberFormat as zh, RADIOGROUP_CONTEXT as qc, useReqAnimationFrame as Wh } from "../common/index.esm.js";
import { computed as A, defineComponent as fe, createVNode as s, provide as Yt, ref as g, inject as Te, onMounted as Be, nextTick as lt, watch as X, createTextVNode as Se, Fragment as it, Teleport as Ia, createApp as Qo, onUnmounted as Kt, onBeforeMount as Xo, watchEffect as is, Transition as Qi, shallowRef as Di, render as nr, h as qh, cloneVNode as Uh, mergeProps as Zt, withDirectives as Ot, vShow as la, onUpdated as Gh, onBeforeUnmount as Uc, withModifiers as Nt, vModelText as Ea, reactive as ht, resolveDirective as In, isVNode as Ba, Comment as Gc, getCurrentInstance as Il, resolveComponent as $n, toRefs as Jo, toRaw as Yh, vModelCheckbox as Yc } from "vue";
import { resolveAppearance as pt, createPropsResolver as Ge, getPropsResolverGenerator as vn, getSchemaByTypeForDesigner as _h, schemaResolverMap as Qh, propertyEffectMap as Xh, propertyConfigSchemaMap as Jh, schemaMap as Kh, getSchemaByType as qo, resolveToolbar as Zh, createPageHeaderEventHandlerResolver as ev, createEventsResolver as _c, createFormBindingResolver as tv } from "../dynamic-resolver/index.esm.js";
import { useDesignerComponent as Wt, DgControl as Fe, canvasChanged as Vi, refreshCanvas as nv, useDragulaCommonRule as Qc, UseTemplateDragAndDropRules as Xc, setPositionOfButtonGroup as av } from "../designer-canvas/index.esm.js";
import { LocaleService as Xe } from "../locale/index.esm.js";
import { cloneDeep as at, isPlainObject as Iu, debounce as Ko, isFunction as ar, isUndefined as Gn, mergeWith as ls, merge as Uo, isNil as ov, isNaN as iv, flatten as lv, throttle as rv, get as ba, isEmpty as sv } from "lodash-es";
import Jc from "../color-picker/index.esm.js";
import Xi, { useDataSource as uv, FComboListContainer as cv, FComboList as io } from "../combo-list/index.esm.js";
import Kc, { useNumber as dv, useFormat as fv, useSpinner as pv, useTextBox as mv, getSpinnerRender as hv, getNumberTextBoxRender as vv, useNumberLocales as gv, FNumberSpinner as yv } from "../number-spinner/index.esm.js";
import { FMessageBoxService as bv } from "../message-box/index.esm.js";
import Ji, { FButton as Cv } from "../button/index.esm.js";
import lo from "../popover/index.esm.js";
import { BaseControlProperty as Zc, InputBaseProperty as rs, ExpressionProperty as wv, FormBindingType as Pi, SchemaDOMMapping as Sv } from "../property-panel/index.esm.js";
import xv from "../tags/index.esm.js";
import { useFilter as Zo, useIdentify as ei, useHierarchy as ti, useGroupData as ss, useDataView as ni, useSelection as ai, usePagination as us, useRow as oi, useEdit as ii, useVisualDataBound as li, useVisualDataCell as ri, useVisualDataRow as si, useVisualGroupRow as ed, useVisualSummaryRow as td, useVisualData as ui, useSidebar as El, useColumn as ci, useVirtualScroll as di, getHierarchyRow as nd, useLoading as ad, useSelectHierarchyItem as cs, useDataViewContainerStyle as Bl, useCommandColumn as od, useSettingColumn as id, useSort as ld, useGroupColumn as ds, useCellPosition as Ol, useFitColumn as fs, useFilterHistory as rd, useColumnFilter as sd, useDragColumn as ud, getColumnHeader as cd, getSidebar as ps, getDisableMask as dd, getHorizontalScrollbar as ms, getVerticalScrollbar as hs, getEmpty as vs, getPagination as fd, getSummary as pd, ColumnSettingSolution as md, COMMAND_COLUMN_DATA_TYPE as Yn, SETTING_COLUMN_DATA_TYPE as _n, SETTING_COLUMN_FIELD as Tv, COMMAND_COLUMN_FIELD as kv, CellMode as hd, useMobile as Fv, useCellContentStyle as Pv, getFilterPanel as Mv, getGroupPanel as Iv, useNavigation as Ev } from "../data-view/index.esm.js";
import { FCheckbox as gs } from "../checkbox/index.esm.js";
import ua, { FButtonEdit as Dl } from "../button-edit/index.esm.js";
import vd from "../list-view/index.esm.js";
import ys from "../../designer/button-edit/index.esm.js";
import Sa from "../tree-view/index.esm.js";
import gd, { FInputGroup as Ki } from "../input-group/index.esm.js";
import { useResizeObserver as bs } from "@vueuse/core";
import Bv from "../binding-selector/index.esm.js";
import { FNotifyService as fi, F_NOTIFY_SERVICE_TOKEN as pi } from "../notify/index.esm.js";
import Ov from "../accordion/index.esm.js";
import Dv from "../avatar/index.esm.js";
import Vv from "../button-group/index.esm.js";
import Av from "../calendar/index.esm.js";
import Lv from "../../designer/capsule/index.esm.js";
import Eu from "../../designer/checkbox/index.esm.js";
import Bu from "../../designer/checkbox-group/index.esm.js";
import $v from "../content-container/index.esm.js";
import Rv from "../../designer/data-grid/index.esm.js";
import Nv from "../../designer/date-picker/index.esm.js";
import jv from "../dropdown/index.esm.js";
import Hv from "../../designer/dynamic-form/index.esm.js";
import zv from "../external-container/index.esm.js";
import Wv from "../filter-bar/index.esm.js";
import qv from "../image-cropper/index.esm.js";
import Uv from "../../designer/input-group/index.esm.js";
import Cs, { FLayout as Gv, FLayoutPane as no } from "../layout/index.esm.js";
import Yv from "../list-nav/index.esm.js";
import _v from "../../designer/list-view/index.esm.js";
import Qv from "../lookup/index.esm.js";
import Xv from "../language-textbox/index.esm.js";
import Jv from "../nav/index.esm.js";
import Kv from "../../designer/number-spinner/index.esm.js";
import Zv from "../number-range/index.esm.js";
import eg from "../order/index.esm.js";
import tg from "../page-header/index.esm.js";
import ng from "../page-footer/index.esm.js";
import yd from "../pagination/index.esm.js";
import ag from "../progress/index.esm.js";
import og, { useCondition as ig, useSolutionUtils as bd } from "../query-solution/index.esm.js";
import lg from "../../designer/radio-group/index.esm.js";
import rg from "../../designer/rate/index.esm.js";
import sg from "../../designer/response-toolbar/index.esm.js";
import ug from "../response-layout/index.esm.js";
import cg from "../../designer/response-layout-editor/index.esm.js";
import dg from "../search-box/index.esm.js";
import fg from "../../designer/section/index.esm.js";
import pg from "../smoke-detector/index.esm.js";
import mg from "../splitter/index.esm.js";
import hg from "../step/index.esm.js";
import vg from "../../designer/switch/index.esm.js";
import gg from "../../designer/tabs/index.esm.js";
import yg from "../../designer/tags/index.esm.js";
import bg from "../text/index.esm.js";
import Cg from "../../designer/time-picker/index.esm.js";
import wg from "../transfer/index.esm.js";
import Sg from "../uploader/index.esm.js";
import xg from "../verify-detail/index.esm.js";
import Tg from "../component/index.esm.js";
import kg from "../video/index.esm.js";
import Fg from "../../designer/textarea/index.esm.js";
import Pg from "../../designer/tree-grid/index.esm.js";
import Mg from "../fieldset/index.esm.js";
import Ig from "../../designer/drawer/index.esm.js";
import Eg from "../html-template/index.esm.js";
import Bg from "../image/index.esm.js";
import Og from "../comment/index.esm.js";
import { loadRegister as Dg, useComponentManager as Vg, useBindingData as Ag, useEntityState as Lg, useDynamicViewUtils as $g, componentMap as or, resolverMap as Rg, componentPropsConverter as Ng } from "../dynamic-view/index.esm.js";
import Cr from "../section/index.esm.js";
import jg from "../combo-tree/index.esm.js";
import Hg from "../events-editor/index.esm.js";
import zg, { FieldSelectorRepositoryToken as Ai } from "../field-selector/index.esm.js";
import Wg from "../mapping-editor/index.esm.js";
import qg from "../schema-selector/index.esm.js";
import Cd, { EditorType as Ug } from "../event-parameter/index.esm.js";
import Gg from "../filter-condition-editor/index.esm.js";
import Yg from "../sort-condition-editor/index.esm.js";
import _g from "../menu-lookup/index.esm.js";
import Qg from "../json-editor/index.esm.js";
import Xg from "../property-editor/index.esm.js";
import Jg, { FExpressionTextbox as Kg } from "../expression-editor/index.esm.js";
import Zg from "../code-editor/index.esm.js";
import ey from "../collection-property-editor/index.esm.js";
import ty from "../../designer/modal/index.esm.js";
import ny, { FTreeGrid as ws } from "../tree-grid/index.esm.js";
import Tt from "bignumber.js";
import ay, { FDynamicForm as oy, FDynamicFormLabel as iy, FDynamicFormGroup as Ss, useTypeResolver as wd } from "../dynamic-form/index.esm.js";
import ly from "../drawer/index.esm.js";
import ry, { FTimePickerTimeView as Ou, convertToDate as sy } from "../time-picker/index.esm.js";
import wr from "../date-picker/index.esm.js";
import { createI18n as uy, useI18n as cy } from "vue-i18n";
import { useConditionValue as dy, useConditionUtils as xs } from "../condition/index.esm.js";
import fy, { radioGroupProps as py } from "../radio-group/index.esm.js";
import { DgControl as my } from "../designer-canvas/index.esm.js/";
import { F_MODAL_SERVICE_TOKEN as Sd } from "../modal/index.esm.js";
import hy, { FDataGrid as Vl } from "../data-grid/index.esm.js";
import Ts from "../response-toolbar/index.esm.js";
import vy, { FLoadingService as gy } from "../loading/index.esm.js";
import yy from "../capsule/index.esm.js";
import "../tooltip/index.esm.js";
import "../checkbox-group/index.esm.js";
import by, { FTabPage as Cy } from "../tabs/index.esm.js";
import wy from "../textarea/index.esm.js";
import "../switch/index.esm.js";
const Sy = "https://json-schema.org/draft/2020-12/schema", xy = "https://farris-design.gitee.io/component.schema.json", Ty = "button", ky = "A Farris Visual Button", Fy = "object", Py = {
id: {
description: "The unique identifier for a component",
type: "string"
},
type: {
description: "The type string of component",
type: "string",
default: "button"
},
text: {
description: "The text string of component",
type: "string"
},
disabled: {
description: "",
type: "boolean",
default: !1
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string"
},
style: {
type: "string"
}
},
default: {}
},
visible: {
description: "",
type: "boolean",
default: !0
},
size: {
description: "大小",
type: "string",
default: "middle"
},
icon: {
description: "图标",
type: "string",
default: ""
},
onClick: {
description: "点击事件",
type: "string",
default: ""
}
}, My = [
"id",
"type",
"text"
], Iy = {
onClick: "点击事件"
}, Ey = {
$schema: Sy,
$id: xy,
title: Ty,
description: ky,
type: Fy,
properties: Py,
required: My,
events: Iy
}, By = /* @__PURE__ */ new Map([
["appearance", pt]
]);
function Oy(e, t, n) {
return Object.assign(t, {
text: "按钮",
appearance: {
class: "btn btn-secondary"
}
}), t;
}
const ks = {
/**
* 组件标识
*/
id: String,
/**
* 设置按钮类型
*/
type: { type: String, default: "primary" },
/**
* 是否禁用
*/
disabled: { type: Boolean, default: !1 },
/**
* 按钮尺寸
*/
size: { type: String, default: "middle" },
/**
* 按钮图标
*/
icon: { type: String, default: "" },
/**
* 按钮文本
*/
text: { type: String, default: "" },
/**
* 自定义class
*/
customClass: { type: String, default: "" },
customStyle: { type: String, default: "" },
/** 控制是否可见 */
visible: { type: Boolean, default: !0 }
}, xd = Ge(ks, Ey, By, Oy);
function Dy(e, t) {
function n(a) {
a.stopPropagation(), e.disabled || t.emit("click", a);
}
return {
onClickButton: n
};
}
function Td(e) {
const t = A(() => {
const a = {
"f-icon": !0
};
if (e.icon) {
const o = e.icon.trim().split(" ");
o && o.length && o.reduce((i, l) => (i[l] = !0, i), a);
}
return a;
}), n = A(() => !!(e.icon && e.icon.trim()));
return { iconClass: t, shouldShowIcon: n };
}
const Zi = /* @__PURE__ */ fe({
name: "FButton",
props: ks,
emits: ["click"],
setup(e, t) {
const {
onClickButton: n
} = Dy(e, t), {
iconClass: a,
shouldShowIcon: o
} = Td(e), i = A(() => {
const l = {
btn: !0,
"btn-lg": e.size === "large",
"btn-md": e.size !== "large" && e.size !== "small",
"btn-sm": e.size === "small",
"btn-icontext": o.value
};
return l[`btn-${e.type}`] = !0, e.customClass && (typeof e.customClass == "string" ? st(l, e.customClass) : Object.keys(e.customClass).reduce((r, d) => (r[d] = e.customClass[d], r), l)), l;
});
return () => e.visible ? s("button", {
class: i.value,
disabled: e.disabled,
style: e.customStyle,
onClick: (l) => n(l)
}, [o.value && s("i", {
class: a.value
}, null), e.text ? e.text : "", t.slots.default && t.slots.default()]) : null;
}
}), kd = /* @__PURE__ */ new Map([
["appearance", pt],
["size", (e, t) => {
const n = {};
return t.width && (n.width = Number(t.width)), t.height && (n.height = Number(t.height)), n;
}]
]), Vy = "https://json-schema.org/draft/2020-12/schema", Ay = "https://farris-design.gitee.io/accordion.schema.json", Ly = "accordion", $y = "A Farris Container Component", Ry = "object", Ny = {
id: {
description: "The unique identifier for a Accordion",
type: "string"
},
type: {
description: "The type string of Accordion component",
type: "string",
default: "accordion"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string"
},
style: {
type: "string"
}
},
default: {}
},
contents: {
description: "",
type: "array",
default: []
},
customClass: {
description: "",
type: "string",
default: ""
},
size: {
description: "",
type: "object",
properties: {
width: {
type: "number"
},
height: {
type: "number"
}
},
default: null
},
enableFold: {
description: "",
type: "boolean",
default: !0
},
expanded: {
description: "",
type: "boolean",
default: !1
}
}, jy = [
"id",
"type",
"contents"
], Hy = {
$schema: Vy,
$id: Ay,
title: Ly,
description: $y,
type: Ry,
properties: Ny,
required: jy
};
function zy(e, t, n) {
return t;
}
const Wy = "accordion", qy = "A Farris Component", Uy = "object", Gy = {
basic: {
description: "Basic Infomation",
title: "基本信息",
properties: {
id: {
description: "组件标识",
title: "标识",
type: "string",
readonly: !0
},
type: {
description: "组件类型",
title: "控件类型",
type: "select",
editor: {
type: "waiting for modification",
enum: []
}
}
}
}
}, Yy = {
title: Wy,
description: qy,
type: Uy,
categories: Gy
}, Fs = {
customClass: { type: String, default: "" },
enableFold: { type: Boolean, default: !0 },
expanded: { type: Boolean, default: !1 },
height: { type: Number },
width: { type: Number }
}, Fd = Ge(Fs, Hy, kd, zy, Yy), Ga = /* @__PURE__ */ fe({
name: "FAccordion",
props: Fs,
emits: [],
setup(e, t) {
const n = A(() => ({
height: e.height ? `${e.height}px` : "",
width: e.width ? `${e.width}px` : ""
}));
Yt("accordionContext", {
parentProps: e
});
const a = A(() => st({
"farris-panel": !0,
accordion: !0
}, e.customClass));
return () => s("div", {
class: a.value,
style: n.value
}, [t.slots.default && t.slots.default()]);
}
}), _y = "https://json-schema.org/draft/2020-12/schema", Qy = "https://farris-design.gitee.io/accordion-item.schema.json", Xy = "AccordionItem", Jy = "A Farris Container Component", Ky = "object", Zy = {
id: {
description: "The unique identifier for a Accordion Item",
type: "string"
},
type: {
description: "The type string of Accordion Item component",
type: "string"
},
contents: {
description: "",
type: "array",
default: []
},
size: {
description: "",
type: "object",
properties: {
width: {
type: "number"
},
height: {
type: "number"
}
},
default: null
},
title: {
description: "",
type: "string",
default: ""
},
disable: {
description: "",
type: "boolean",
default: !1
}
}, eb = [
"id",
"type",
"contents"
], tb = {
$schema: _y,
$id: Qy,
title: Xy,
description: Jy,
type: Ky,
properties: Zy,
required: eb
}, Ps = {
active: { type: Boolean, default: !1 },
customClass: { type: String, default: "" },
disabled: { type: Boolean, default: !1 },
height: { type: Number },
iconUri: { type: String, default: "" },
maxHeight: { type: Number },
title: { type: String, default: "" },
width: { type: Number }
}, Pd = Ge(Ps, tb, kd), Sr = /* @__PURE__ */ fe({
name: "FAccordionItem",
props: Ps,
emits: ["ClickHeader"],
setup(e, t) {
const n = g(), a = Te("accordionContext"), o = g(e.title), i = g(e.active);
function l() {
var h;
e.disabled || !((h = a == null ? void 0 : a.parentProps) != null && h.enableFold) || (i.value = !i.value);
}
function r(h) {
t.emit("ClickHeader"), l();
}
const d = A(() => {
const h = {
card: !0,
"farris-panel-item": !0,
"f-state-disabled": e.disabled,
"f-state-selected": i.value
};
return st(h, e.customClass);
}), f = A(() => !0), c = A(() => ({
"f-icon": !0,
"f-accordion-collapse": !i.value,
"f-accordion-expand": i.value
}));
function u() {
return n.value ? n.value.getBoundingClientRect().height : 0;
}
const p = A(() => {
const h = e.maxHeight ? {
transition: "maxHeight 0.36s ease 0s",
"max-height": i.value ? `${e.maxHeight}px` : 0
} : {
transition: "height 0.36s ease 0s",
height: i.value ? `${u()}px` : 0
};
return i.value || (h.overflow = "hidden"), h;
});
return Be(() => {
var h;
(h = a == null ? void 0 : a.parentProps) != null && h.expanded && (i.value = !0);
}), () => s("div", {
class: d.value
}, [s("div", {
class: "card-header",
onClick: r
}, [s("div", {
class: "panel-item-title"
}, [e.iconUri && s("img", {
class: "panel-item-title-image",
src: e.iconUri,
title: "title-icon"
}, null), f.value && s("span", null, [o.value]), t.slots.head && t.slots.head(), s("i", {
class: c.value
}, null)]), s("div", {
class: "panel-item-tool"
}, [t.slots.toolbar && t.slots.toolbar()]), s("div", {
class: "panel-item-clear"
}, null)]), s("div", {
style: p.value
}, [s("div", {
class: "card-body",
ref: n
}, [t.slots.default && t.slots.default()])])]);
}
}), nb = /* @__PURE__ */ fe({
name: "FAccordionDesign",
props: Fs,
emits: [],
setup(e, t) {
const n = A(() => ({
height: e.height ? `${e.height}px` : "",
width: e.width ? `${e.width}px` : ""
})), a = A(() => {
const r = e.customClass.split(" "), d = {
"farris-panel": !0,
accordion: !0
};
return r.reduce((f, c) => (f[c] = !0, f), d), d;
}), o = g(), i = Te("design-item-context"), l = Wt(o, i);
return Be(() => {
o.value.componentInstance = l;
}), t.expose(l.value), () => s("div", {
ref: o,
class: a.value,
style: n.value
}, [t.slots.default && t.slots.default()]);
}
}), ab = /* @__PURE__ */ fe({
name: "FAccordionItemDesign",
props: Ps,
emits: [],
setup(e, t) {
const n = g(e.title), a = g(!1), o = g(!1);
function i() {
a.value = !a.value;
}
function l(v) {
i();
}
const r = A(() => ({
"f-state-disabled": o.value,
card: !0,
"farris-panel-item": !0,
"f-state-selected": a.value
})), d = A(() => !0), f = A(() => !1), c = A(() => ({
"f-icon": !0,
"f-accordion-collapse": !a.value,
"f-accordion-expand": a.value
})), u = A(() => {
const v = e.maxHeight ? {
transition: "maxHeight 0.36s ease 0s",
"max-height": a.value ? `${e.maxHeight}px` : 0
} : {
transition: "height 0.36s ease 0s",
height: a.value ? `${e.height}px` : 0
};
return a.value || (v.overflow = "hidden"), v;
});
function p() {
return !0;
}
function h() {
return !1;
}
function m() {
return !0;
}
return t.expose({
canMove: p(),
canSelectParent: h(),
canDelete: m(),
canNested: !0
}), () => s("div", {
class: r.value
}, [s("div", {
class: "card-header",
onClick: l
}, [s("div", {
class: "panel-item-title"
}, [d.value && s("span", null, [n.value]), f.value && t.slots.head && t.slots.head(), s("span", {
class: c.value
}, null)]), s("div", {
class: "panel-item-tool"
}, [t.slots.toolbar && t.slots.toolbar()]), s("div", {
class: "panel-item-clear"
}, null)]), s("div", {
style: u.value
}, [s("div", {
class: "card-body drag-container"
}, [t.slots.default && t.slots.default()])])]);
}
});
Ga.install = (e) => {
e.component(Ga.name, Ga), e.component(Sr.name, Sr);
};
Ga.register = (e, t, n, a) => {
e.accordion = Ga, e["accordion-item"] = Sr, t.accordion = Fd, t["accordion-item"] = Pd;
};
Ga.registerDesigner = (e, t, n) => {
e.accordion = nb, e["accordion-item"] = ab, t.accordion = Fd, t["accordion-item"] = Pd;
};
function ob(e, t, n) {
return t;
}
const ib = /* @__PURE__ */ new Map([
["appearance", pt]
]), lb = "https://json-schema.org/draft/2020-12/schema", rb = "https://farris-design.gitee.io/avatar.schema.json", sb = "avatar", ub = "A Farris Component", cb = "object", db = {
id: {
description: "The unique identifier for avatar",
type: "string"
},
type: {
description: "The type string of avatar",
type: "string",
default: "avatar"
},
appearance: {
description: "",
type: "object",
properties: {
class: {
type: "string"
},
style: {
type: "string"
}
},
default: {}
},
binding: {
description: "",
type: "object",
default: {}
},
disabled: {
type: "boolean",
default: !1
},
avatarWidth: {
description: "",
type: "number",
default: 100
},
avatarHeight: {
description: "",
type: "number",
default: 100
},
readonly: {
description: "",
type: "boolean",
default: !1
},
cover: {
description: "",
type: "string",
default: ""
},
tabindex: {
description: "",
type: "number",
default: -1
},
visible: {
description: "",
type: "boolean",
default: !0
}
}, fb = [
"id",
"type"
], pb = [
"id",
"appearance",
"binding",
"visible"
], mb = {
$schema: lb,
$id: rb,
title: sb,
description: ub,
type: cb,
properties: db,
required: fb,
ignore: pb
}, Ms = {
/**
* 头像宽度
*/
avatarWidth: { type: Number, default: 100 },
/**
* 头像高度
*/
avatarHeight: { type: Number, default: 100 },
/**
* 组件标识
*/
cover: { type: String },
/**
* 只读
*/
readonly: { type: Boolean, default: !1 },
/**
* 头像形状
*/
shape: { type: String, default: "circle" },
/**
* 头像最大尺寸, 单位MB
*/
maxSize: { type: Number, default: 1 },
/**
* 组件值
*/
modelValue: { type: String, default: "" },
/**
* 头像标题
*/
title: { type: String, default: "" },
/**
* 支持的头像类型
*/
imageType: { type: Array, default: ["jpeg"] }
}, Md = Ge(Ms, mb, ib, ob);
function Id(e, t, n, a) {
const o = "data:image/jpeg;base64,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", i = g(e.readonly);
function l(h) {
return h.match(/\.(jpeg|jpg|gif|png|svg|bmp|webp)$/) != null;
}
function r(h) {
return h.indexOf("data:image/") > -1;
}
function d(h) {
return "data:image/jpeg;base64," + h;
}
const f = A(() => {
var m;
if (!e.imageType || !e.imageType.length)
return "";
const h = (m = e.imageType) == null ? void 0 : m.map((v) => (v === "jpg" && (v = "jpeg"), `image/${v}`));
return !h || !h.length ? "image/*" : h.join(",");
}), c = A(() => {
const h = a.value || e.cover || o;
return l(h) || r(h) ? h : d(h);
}), u = A(() => i.value ? "" : e.title);
function p() {
i.value || n && n.value && n.value.click();
}
return { acceptTypes: f, imageSource: c, imageTitle: u, onClickImage: p };
}
const el = /* @__PURE__ */ fe({
name: "FAvatar",
props: Ms,
emits: ["change", "update:modelValue"],
setup(e, t) {
const n = A(() => ({
"f-avatar": !0,
"f-avatar-readonly": e.readonly,
"f-avatar-circle": e.shape === "circle",
"f-avatar-square": e.shape === "square"
})), a = g(e.modelValue), o = A(() => ({
width: e.avatarWidth + "px",
height: e.avatarHeight + "px"
})), i = !1;
function l() {
return "";
}
function r() {
}
const d = g(null), {
acceptTypes: f,
imageSource: c,
onClickImage: u
} = Id(e, t, d, a);
return () => s("div", {
class: n.value,
style: o.value,
onClick: u
}, [i, s("img", {
title: e.title,
class: "f-avatar-image",
src: c.value,
onError: l
}, null), !e.readonly && s("div", {
class: "f-avatar-icon"
}, [s("span", {
class: "f-icon f-icon-camera"
}, null)]), s("input", {
ref: "file",
name: "file-input",
type: "file",
class: "f-avatar-upload",
accept: f.value,
onChange: r,
style: "display: none;"
}, null)]);
}
});
function hb(e) {
const { formSchemaUtils: t, formStateMachineUtils: n } = e;
function a(d, f = "") {
return {
path: f + d.code,
field: d.id,
fullPath: d.code
};
}
function o(d, f = "") {
const c = t.getViewModelById(d);
return c ? c.states.map((u) => a(u, f)) : [];
}
function i(d) {
const f = t.getRootViewModelId(), c = o(d);
if (d === f)
return c;
const u = o(f, "root-component.");
return [...c, ...u];
}
function l(d) {
return d.binding && d.binding.path || d.id || "";
}
function r() {
return n && n.getRenderStates() || [];
}
return { getVariables: i, getControlName: l, getStateMachines: r };
}
class vb {
constructor(t) {
z(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'"
}
]);
z(this, "expressionNames", {
compute: "计算表达式",
dependency: "依赖表达式",
validate: "验证表达式",
dataPicking: "帮助前表达式",
visible: "可见表达式",
readonly: "只读表达式",
required: "必填表达式"
});
z(this, "getExpressionConverter", (t, n) => ({
convertFrom: (a, o, i, l) => {
const r = i.getExpressionRuleValue(t, n || o);
return r && r.value || "";
},
convertTo: (a, o, i, l, r) => {
var d;
if (o === "dataPicking" && (i != null && i.target)) {
const f = `${i.target}_dataPicking`;
((d = i.rules) == null ? void 0 : d.some(
(u) => u.id === f && u.value
)) ? a.dictPickingExpressionId = f : delete a.dictPickingExpressionId;
}
l.updateExpression(i);
}
}));
this.formSchemaService = t;
}
getExpressionRule(t, n) {
const a = this.getExpressionData();
if (!a)
return "";
const o = a.find((l) => l.target === t);
if (!o)
return "";
const i = o.rules.find((l) => l.type === n);
return i || "";
}
// 获取上下文表单变量
getContextFormVariables() {
const { module: t } = this.formSchemaService.getFormSchema();
if (!t.viewmodels || t.viewmodels.length === 0)
return [];
const n = this.formSchemaService.getRootViewModelId(), a = this.formSchemaService.getViewModelById(n);
if (!a || !a.states || a.states.length === 0)
return [];
const o = [];
return a.states.filter((i) => i.category === "remote").forEach((i) => {
o.push({
key: i.code,
name: i.name,
description: i.name,
category: i.category
});
}), o;
}
createTreeNode(t, n, a = "label") {
return {
id: t.id,
name: t.name,
bindingPath: t[a],
parents: n,
type: "field"
};
}
buildEntityFieldsTreeData(t = null, n) {
const a = [];
return t == null || t.forEach((o) => {
var r;
const i = this.createTreeNode(o, n);
let l = [];
(r = o.type) != null && r.fields && (l = this.buildEntityFieldsTreeData(o.type.fields, [...n, o.label])), a.push({
data: i,
children: l,
expanded: !0
});
}), a;
}
buildChildEntityTreeData(t = null, n) {
const a = [];
return t == null || t.forEach((o) => {
var d, f;
const i = this.createTreeNode(o, n);
i.type = "entity";
const l = this.buildEntityFieldsTreeData((d = o.type) == null ? void 0 : d.fields, [...n, o.label]), r = this.buildChildEntityTreeData((f = o.type) == null ? void 0 : f.entities, [...n, o.label]);
r != null && r.length && (l == null || l.push(...r)), a.push({
data: i,
children: l || [],
// 空值回退
expanded: !0
});
}), a;
}
getEntitiesTreeData() {
const t = this.formSchemaService.getSchemaEntities();
if (!(t != null && t.length))
return [];
const n = t[0];
if (!(n != null && n.type))
return [];
const a = this.buildEntityFieldsTreeData(n.type.fields, [n.code]), o = this.buildChildEntityTreeData(n.type.entities, [n.code]);
return o != null && o.length && (a == null || a.push(...o)), {
entityCode: n.code,
fields: [{
data: this.createTreeNode(n, [], "code"),
children: a || []
}]
};
}
getEntitiesAndVariables() {
return {
entities: this.getEntitiesTreeData(),
variables: {
session: {
name: "系统变量",
items: this.sessionVariables,
visible: !1
},
forms: {
name: "表单变量",
items: this.getContextFormVariables(),
visible: !0
}
}
};
}
onBeforeOpenExpression(t, n, a) {
const o = a === "Field" ? t.binding.field : t.id, i = this.getExpressionRule(o, n), l = this.getEntitiesAndVariables(), r = {
message: ["validate", "required", "dataPicking"].includes(n) && i ? i.message : "",
...l
};
return i.messageType != null && (r.messageType = i.messageType), r;
}
buildRule(t, n, a, o) {
const { expression: i, message: l, messageType: r } = n, d = {
id: `${t}_${a}`,
type: a,
value: i
};
return (a === "validate" || a === "dataPicking" || a === "required") && (d.message = l), a === "dataPicking" && (d.messageType = r), a === "validate" && o && (d.elementId = o), d;
}
getExpressionData() {
const { expressions: t } = this.formSchemaService.getFormSchema().module;
return t || [];
}
updateExpression(t, n, a, o) {
const i = n === "Field" ? t.binding.field : t.id, l = this.buildRule(i, a, o, t.type === "form-group" ? t.id : "");
let d = this.getExpressionData().find((c) => c.targetType === n && c.target === i);
const f = (c) => c.value.trim() === "";
if (d) {
const c = d.rules.find((u) => u.id === l.id);
if (c)
f(l) ? d.rules = d.rules.filter((u) => u.id !== l.id) : (Object.assign(c, l), o === "validate" && t.type === "form-group" && (c.elementId = t.id));
else {
if (f(l))
return null;
d.rules = d.rules || [], d.rules.push(l);
}
} else {
if (f(l))
return null;
d = {
target: `${i}`,
rules: [l],
targetType: n
};
}
return d;
}
getExpressionEditorOptions(t, n, a, o) {
return a.reduce((i, l) => {
var d, f;
const r = n === "Field" ? (d = t == null ? void 0 : t.binding) == null ? void 0 : d.field : t.id;
return i[l] = {
hide: n === "Field" ? !!((f = t == null ? void 0 : t.binding) != null && f.field) : !1,
description: "",
title: this.expressionNames[l],
type: "string",
$converter: this.getExpressionConverter(r),
refreshPanelAfterChanged: !0,
editor: {
type: "expression-editor",
singleExpand: !1,
dialogTitle: `${this.expressionNames[l]}编辑器`,
showMessage: l === "validate" || l === "dataPicking" || l === "required",
showMessageType: l === "dataPicking",
beforeOpen: () => this.onBeforeOpenExpression(t, l, n),
onSubmitModal: (c) => {
const u = this.updateExpression(t, n, c, l);
if (o) {
const p = this.buildRule(r, c, l);
o(p);
}
return u;
}
}
}, i;
}, {});
}
getExpressionInfo(t, n, a) {
const o = n === "Field" ? t.binding.field : t.id, i = this.getExpressionRule(o, a), l = {
value: i && i.value,
targetId: o,
targetType: n,
expressionType: a
};
return i && i.message && (l.message = i.message), l;
}
getExpressionConfig(t, n, a = ["compute", "dependency", "validate"], o) {
return {
description: "表达式",
title: "表达式",
hide: !t.binding,
properties: {
...this.getExpressionEditorOptions(t, n, a, o)
}
};
}
getExpressionOptions(t, n, a) {
const o = this.getExpressionInfo(t, n, a);
return {
dialogTitle: `${this.expressionNames[a] || "表达式"}编辑器`,
singleExpand: !1,
showMessage: a === "required",
beforeOpen: () => this.onBeforeOpenExpression(t, a, n),
expressionInfo: o
};
}
}
class mi {
constructor(t, n) {
z(this, "componentId");
z(this, "viewModelId");
z(this, "eventsEditorUtils");
z(this, "formSchemaUtils");
z(this, "formMetadataConverter");
z(this, "designViewModelUtils");
z(this, "designViewModelField");
z(this, "controlCreatorUtils");
z(this, "designerHostService");
z(this, "designerContext");
z(this, "modalService", null);
/** 表单规则 */
z(this, "formRule", null);
z(this, "schemaService", null);
z(this, "metadataService", null);
z(this, "propertyConfig", {
type: "object",
categories: {}
});
z(this, "expressionProperty");
var a;
this.componentId = t, this.designerHostService = n, this.eventsEditorUtils = n.eventsEditorUtils, this.formSchemaUtils = n.formSchemaUtils, this.formMetadataConverter = n.formMetadataConverter, this.viewModelId = ((a = this.formSchemaUtils) == null ? void 0 : a.getViewModelIdByComponentId(t)) || "", this.designViewModelUtils = n.designViewModelUtils, this.controlCreatorUtils = n.controlCreatorUtils, this.metadataService = n.metadataService, this.schemaService = n.schemaService, this.designerContext = n.designerContext, this.modalService = n.modalService, this.expressionProperty = new vb(this.formSchemaUtils);
}
getFormDesignerInstance() {
var t, n;
return (n = (t = this.designerContext) == null ? void 0 : t.instances) == null ? void 0 : n.formDesigner.value;
}
getTableInfo() {
var t;
return (t = this.schemaService) == null ? void 0 : t.getTableInfoByViewModelId(this.viewModelId);
}
setDesignViewModelField(t) {
var a;
const n = t.binding && t.binding.type === "Form" && t.binding.field;
if (n) {
if (!this.designViewModelField) {
const o = this.designViewModelUtils.getDgViewModel(this.viewModelId);
this.designViewModelField = o.fields.find((i) => i.id === n);
}
t.updateOn = (a = this.designViewModelField) == null ? void 0 : a.updateOn;
}
}
getBasicPropConfig(t) {
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",
idField: "value",
editable: !1,
data: [{ value: t.type, name: Fe[t.type] && Fe[t.type].name }]
}
}
}
};
}
getAppearanceConfig(t = null, n = {}, a) {
const o = {
title: "外观",
description: "Appearance"
}, i = {
class: {
title: "class样式",
type: "string",
description: "组件的CSS样式",
$converter: "/converter/appearance.converter",
parentPropertyID: "appearance"
},
style: {
title: "style样式",
type: "string",
description: "组件的样式",
$converter: "/converter/appearance.converter",
parentPropertyID: "appearance"
}
};
for (const l in n)
i[l] = Object.assign(i[l] || {}, n[l]);
return {
...o,
properties: { ...i },
setPropertyRelates(l, r) {
if (l) {
switch (l && l.propertyID) {
case "class":
case "style": {
Vi.value++;
break;
}
}
a && a(l, t, r);
}
}
};
}
/**
*
* @param propertyData
* @param propertyTypes
* @param propertyName
* @param constInfos
* @param variableInfos
* @param expressionType 指定表达式类型,存在属性和表达式类型不一致的情况
* @returns
*/
getPropertyEditorParams(t, n = [], a = "visible", o = {}, i = {}, l = "") {
const { getVariables: r, getControlName: d, getStateMachines: f } = hb(this.designerHostService), c = this.getRealTargetType(t), u = n && n.length > 0 ? n : ["Const", "Variable", "StateMachine", "Expression"], p = {
type: "property-editor",
propertyTypes: u
};
return u.map((h) => {
switch (h) {
case "Const":
Object.assign(p, {
constType: "enum",
constEnums: [{ id: !0, name: "是" }, { id: !1, name: "否" }]
}, o);
break;
case "Expression":
p.expressionConfig = this.getExpressionOptions(t, c, l || a);
break;
case "StateMachine":
p.stateMachines = f();
break;
case "Variable":
Object.assign(p, {
controlName: d(t),
newVariablePrefix: "is",
newVariableType: "Boolean",
variables: r(this.viewModelId),
parentComponentId: this.componentId === "root-component" ? "" : "root-component",
onBeforeOpenVariables: (m) => {
m.value = r(this.viewModelId);
}
}, i), this.designerContext.designerMode === "PC_RTC" && (p.newVariablePrefix = "ext_" + p.newVariablePrefix);
break;
}
}), p;
}
getVisibleProperty(t, n = "") {
var i;
let a = ["Const", "Variable", "StateMachine", "Expression"];
return n === "gridFieldEditor" ? a = ["Const", "Expression"] : n === "form-group" && !((i = t.binding) != null && i.field) && (a = ["Const", "Variable", "StateMachine"]), {
visible: {
title: "是否可见",
type: "boolean",
description: "运行时组件是否可见",
editor: this.getPropertyEditorParams(t, a, "visible")
}
};
}
/**
* 获取行为
* @param propertyData
* @param viewModelId
* @returns
*/
getBehaviorConfig(t, n = "", a = {}, o) {
const i = {
title: "行为",
description: ""
}, l = this.getVisibleProperty(t, n);
for (const d in a)
l[d] = Object.assign(l[d] || {}, a[d]);
const r = this;
return {
...i,
properties: { ...l },
setPropertyRelates(d, f) {
if (d) {
switch (d.propertyID) {
case "disabled":
case "readonly":
case "visible":
r.afterMutilEditorChanged(t, d);
break;
}
o && o(d, f);
}
}
};
}
/**
* 当多值编辑器变更时
* @param propertyData
* @param changeObject
*/
afterMutilEditorChanged(t, n) {
this.addNewVariableToViewModel(n, this.viewModelId), this.updateExpressionValue(n, t), this.clearExpression(n, t);
}
/**
*
* @param propertyId
* @param componentInstance
* @returns
*/
updateElementByParentContainer(t, n) {
const a = n && n.parent && n.parent.schema;
if (!a)
return;
const o = a.contents.findIndex((l) => l.id === t), i = at(a.contents[o]);
a.contents.splice(o, 1), a.contents.splice(o, 0, i), nv();
}
/**
* 属性编辑器,在编辑过程中会新增变量,此处需要将新增的变量追加到ViewModel中
* @param changeObject
* @param viewModelId
* @returns
*/
addNewVariableToViewModel(t, n) {
const a = t.propertyValue;
if (!(a && typeof a == "object") || !(a.type === "Variable" && a.isNewVariable))
return;
const l = {
id: a.field,
category: "locale",
code: a.fullPath,
name: a.fullPath,
type: a.newVariableType || "String",
isRtcVariable: this.designerContext.designerMode === "PC_RTC" ? !0 : void 0
};
delete a.newVariableType, delete a.isNewVariable, this.formSchemaUtils.getVariableByCode(l.code) || this.formSchemaUtils.getViewModelById("root-viewmodel").states.push(l);
}
getExpressions() {
let t = [];
return this.formRule ? (this.formRule.expressions = this.formRule.expressions || [], t = this.formRule.expressions || []) : t = this.formSchemaUtils.getExpressions(), t;
}
/**
* 更新表达式到expressions节点
* @param changeObject
*/
updateExpressionValue(t, n) {
const a = t.propertyValue;
if (!((a && a.type) === "Expression" && a.expressionInfo))
return;
const { expressionId: l, expressionInfo: r } = a, { targetId: d, targetType: f, expressionType: c, value: u, message: p } = r, h = this.getExpressions();
let m = h.find((y) => y.target === d);
m || (m = { target: d, rules: [], targetType: f }, h.push(m));
const v = m.rules.find((y) => y.type === c);
if (v)
v.value = u, v.message = p, (c === "minDate" || c === "maxDate" || c === "defaultTime") && (v.elementId = n.id);
else {
const y = { id: l, type: c, value: u, message: p, elementId: n.id };
m.rules.push(y);
}
delete a.expressionInfo;
}
/**
* 属性类型切换为非表达式后,清除原表达式
* @param changeObject
* @param propertyData
* @returns
*/
clearExpression(t, n) {
const a = t.propertyValue;
if (a && a.type === "Expression")
return;
const i = t.propertyID, l = this.getExpressions(), r = n.binding ? n.binding.field : n.id, d = l.find((f) => f.target === r);
!d || !d.rules || (d.rules = d.rules.filter((f) => f.type !== i));
}
getExpressionOptions(t, n, a) {
return this.expressionProperty.getExpressionOptions(t, n, a);
}
getRealTargetType(t) {
return ["response-toolbar-item", "tab-toolbar-item", "section-toolbar-item", "drawer-toolbar-item"].indexOf(t.type) > -1 ? "Button" : t.binding && t.binding.field ? "Field" : "Container";
}
createBaseEventProperty(t) {
const n = {};
return n[this.viewModelId] = {
type: "events-editor",
editor: {
initialData: t,
viewSourceHandle: (a) => {
var o;
((o = a.controller) == null ? void 0 : o.label.indexOf(this.formSchemaUtils.getModule().code)) > -1 && this.eventsEditorUtils.jumpToMethod(a);
}
}
}, n;
}
}
const Ua = class Ua {
/**
* 根据绑定字段类型获取可用的输入类控件
*/
static getEditorTypesByMDataType(t, n = !1, a = "") {
if (n)
return [{ key: Fe["language-textbox"].type, value: Fe["language-textbox"].name }];
let o = Ua.fieldControlTypeMapping[t];
if (a === "data-grid-column" && (o != null && o.length)) {
const i = [Fe["check-group"].type, Fe["radio-group"].type, Fe.image.type, Fe["rich-text-editor"].type];
o = o.filter((l) => !i.includes(l.key));
}
return o;
}
/**
* 获取所有输入类控件
*/
static getAllInputTypes() {
const t = [];
for (const n in Ua.fieldControlTypeMapping)
Ua.fieldControlTypeMapping[n].forEach((a) => {
t.find((o) => o.key === a.key && o.value === a.value) || t.push({ key: a.key, value: a.value });
});
return t;
}
/**
* 提供schema字段基础属性和DOM控件属性的映射
* @param control 控件元数据
*/
static mappingDomPropAndSchemaProp(t, n) {
var i;
const a = (i = t.editor) == null ? void 0 : i.type, o = [];
return (t.type === Fe["data-grid-column"].type || t.type === Fe["tree-grid-column"].type) && n && n.categoryId && n.categoryId.indexOf("gridFieldEditor") < 0 && o.push({ domField: "title", schemaField: "name" }), o.push({ domField: "label", schemaField: "name" }), o.push({ domField: "editor.required", schemaField: "require" }), o.push({ domField: "editor.readonly", schemaField: "readonly" }), (a === Fe["input-group"].type || a === Fe.textarea.type || a === Fe["number-spinner"].type) && o.push({ domField: "editor.maxLength", schemaField: "type.length" }), a === Fe["number-spinner"].type && o.push({ domField: "editor.precision", schemaField: "type.precision" }), (t.type === Fe["data-grid-column"].type || t.type === Fe["tree-grid-column"].type) && o.push({ domField: "formatter.precision", sc