@farris/ui-vue 1.7.0 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,40 +1,1273 @@
1
- import Q, { avatarProps as H } from "../../components/avatar/index.esm.js";
2
- import { resolveAppearance as P, createPropsResolver as b } from "../../components/dynamic-resolver/index.esm.js";
3
- import { withInstall as T } from "../../components/common/index.esm.js";
4
- import { ref as u, computed as l, defineComponent as q, inject as C, onMounted as I, createVNode as c } from "vue";
5
- import { useDesignerComponent as x } from "../../components/designer-canvas/index.esm.js";
6
- import { InputBaseProperty as D } from "../../components/property-panel/index.esm.js";
7
- function E(e, t, a, r) {
8
- const n = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAZABkAAD/2wBDAAwICQoJBwwKCQoNDAwOER0TERAQESMZGxUdKiUsKyklKCguNEI4LjE/MigoOk46P0RHSktKLTdRV1FIVkJJSkf/2wBDAQwNDREPESITEyJHMCgwR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0f/wAARCAEsASwDASIAAhEBAxEB/8QAGgABAQEBAQEBAAAAAAAAAAAAAAECAwQFB//EADMQAQEAAQEECAQGAgMBAAAAAAABAhEDITFBBBRRUmFxgaESkcHwEyIysdHhM3IjQvE0/8QAFQEBAQAAAAAAAAAAAAAAAAAAAAH/xAAXEQEBAQEAAAAAAAAAAAAAAAAAEQEh/9oADAMBAAIRAxEAPwD9BBYqCiyAGhougIqyGgEhIui6AyuixdATQ0WQA0BdA4houhoCaGgugMrouhoCaJoum80BNDRdDQGTRbEBNCxdDQGTRUBE0asQGRTQGTT71WxNPP5AugqyACyAC6dpIsgGgshoBISKAiroQDQ0OSyAgoBoaABoaABomigJTRQGV0XRATRGizUGRSwGdEsaqAljLQDOiNWJQZNJ4KffEFIRYAsFkAkFkAJFFkAkNCLIAAAC6AguhoCCl3TW2TzugIHx4S788Z6wmWN4ZY3ys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zSdoOqWlEBmhaBamt+6J6AnmqaqDQy0CxYyoNCKC6m/VAGhPJdQBOSgKi6+QGu41QBRAF1LUABbUABNdAVOYUC0tE13gIWloCcTXeloFQLQTmffMtT74gixOa6gqysrzBVSVQVdWdQGpRNV1BV10SUlBYIvIF1E1Ne0F5iAKIAohaCmqWgBaapqC2ohqC6pqWoC2paa70tAqCACACa+F+RanyAWJ/a8vkAuqT6fVf7AVOz0X+AXVYh2egNSifx9T+wVWefyX+PqCyrqn807PQFEn0+p/YKH9H37gAc/kC6onL0P5BRP6OV8vqC2of2l/gAOSAuqan9J/AKmon9AUtL9PqnP1oCWl5ehfv5gh635nP1qWg//Z", o = u(e.readonly);
9
- function i(A) {
10
- return A.match(/\.(jpeg|jpg|gif|png|svg|bmp|webp)$/) != null;
11
- }
12
- function g(A) {
13
- return A.indexOf("data:image/") > -1;
14
- }
15
- function f(A) {
16
- return "data:image/jpeg;base64," + A;
17
- }
18
- const v = l(() => {
19
- var d;
20
- if (!e.imageType || !e.imageType.length)
1
+ var W = Object.defineProperty;
2
+ var O = (f, n, e) => n in f ? W(f, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : f[n] = e;
3
+ var y = (f, n, e) => O(f, typeof n != "symbol" ? n + "" : n, e);
4
+ import K, { avatarProps as N } from "../../components/avatar/index.esm.js";
5
+ import { resolveAppearance as j, createPropsResolver as Z } from "../../components/dynamic-resolver/index.esm.js";
6
+ import { FormSchemaEntityField$Type as k, FormSchemaEntityFieldType$Type as z, withInstall as D } from "../../components/common/index.esm.js";
7
+ import { ref as V, computed as F, nextTick as $, defineComponent as J, inject as B, onMounted as X, createVNode as E } from "vue";
8
+ import { DgControl as a, canvasChanged as M, refreshCanvas as Y, useDesignerComponent as _ } from "../../components/designer-canvas/index.esm.js";
9
+ import { cloneDeep as ee } from "lodash-es";
10
+ function te(f, n, e, t) {
11
+ const i = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAZABkAAD/2wBDAAwICQoJBwwKCQoND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UB9DDa7PP9OeNvZrpfdu8OD5mkvGNY55Y/pzyx8ruIPePJj0nazj8OU8ZpfZ1w6Ts8rJlrhfHfPmg7FKgAF4AgVARPW/NanoAsZaBVlZUFVF4g57fbfhY7pLld0l/e+EeO23K5ZW5ZXjb97o1tcvj22WXHS/DPKMqAAAAAAAAAAAAAAAAAAAAAAOux212d0ttwvGdnjHr3ceMfPevo2XxbLTu3T0B1TmHJAZVOYF4p98xPviBFScQGlRZxBdS3TG3slvsibS/8WX+t/YHhx/TPGaqk4TyVQAAAAAAAAAAAAAAAAAAAAAAd+iX82c7ZL9/Nwdui/5b/rfoD00vARAQqAhfvcVNfL3A1WMqDSxmVQVNr/iz4/pv7LDOXLDLGcbNPDeDxTh6DtOjZaafFju816tlf+2Puo4Dv1bPvY+51bLvY+5RwHfq2Xex9zquXex9yjgO/Vcu9j7nVc+9j7lHAd+q597H3Oq597H3BwHfqufex9zqufex9yjgO/Vc+9j7nVc+9j7lHAd+q597H3Oq597H3KOA79Vz72PudVz72PuUcB36rl3sfc6rn3sfco4DvejZd7H3OrZd7H3KOA79Wy72PudWz72PuDg7dG/y3/W/Q6tl3sfdvY7K7PO25S6yzSdoOqWlEBmhaBamt+6J6AnmqaqDQy0CxYyoNCKC6m/VAGhPJdQBOSgKi6+QGu41QBRAF1LUABbUABNdAVOYUC0tE13gIWloCcTXeloFQLQTmffMtT74gixOa6gqysrzBVSVQVdWdQGpRNV1BV10SUlBYIvIF1E1Ne0F5iAKIAohaCmqWgBaapqC2ohqC6pqWoC2paa70tAqCACACa+F+RanyAWJ/a8vkAuqT6fVf7AVOz0X+AXVYh2egNSifx9T+wVWefyX+PqCyrqn807PQFEn0+p/YKH9H37gAc/kC6onL0P5BRP6OV8vqC2of2l/gAOSAuqan9J/AKmon9AUtL9PqnP1oCWl5ehfv5gh635nP1qWg//Z", s = V(f.readonly);
12
+ function r(g) {
13
+ return g.match(/\.(jpeg|jpg|gif|png|svg|bmp|webp)$/) != null;
14
+ }
15
+ function d(g) {
16
+ return g.indexOf("data:image/") > -1;
17
+ }
18
+ function o(g) {
19
+ return "data:image/jpeg;base64," + g;
20
+ }
21
+ const u = F(() => {
22
+ var p;
23
+ if (!f.imageType || !f.imageType.length)
21
24
  return "";
22
- const A = (d = e.imageType) == null ? void 0 : d.map((s) => (s === "jpg" && (s = "jpeg"), `image/${s}`));
23
- return !A || !A.length ? "image/*" : A.join(",");
24
- }), y = l(() => {
25
- const A = r.value || e.cover || n;
26
- return i(A) || g(A) ? A : f(A);
27
- }), m = l(() => o.value ? "" : e.title);
28
- function B() {
29
- o.value || a && a.value && a.value.click();
30
- }
31
- return { acceptTypes: v, imageSource: y, imageTitle: m, onClickImage: B };
25
+ const g = (p = f.imageType) == null ? void 0 : p.map((h) => (h === "jpg" && (h = "jpeg"), `image/${h}`));
26
+ return !g || !g.length ? "image/*" : g.join(",");
27
+ }), c = F(() => {
28
+ const g = t.value || f.cover || i;
29
+ return r(g) || d(g) ? g : o(g);
30
+ }), l = F(() => s.value ? "" : f.title);
31
+ function m() {
32
+ s.value || e && e.value && e.value.click();
33
+ }
34
+ return { acceptTypes: u, imageSource: c, imageTitle: l, onClickImage: m };
32
35
  }
33
- class S extends D {
34
- constructor(t, a) {
35
- super(t, a);
36
+ function ie(f) {
37
+ const { formSchemaUtils: n, formStateMachineUtils: e } = f;
38
+ function t(o, u = "") {
39
+ return {
40
+ path: u + o.code,
41
+ field: o.id,
42
+ fullPath: o.code
43
+ };
44
+ }
45
+ function i(o, u = "") {
46
+ const c = n.getViewModelById(o);
47
+ return c ? c.states.map((l) => t(l, u)) : [];
48
+ }
49
+ function s(o) {
50
+ const u = n.getRootViewModelId(), c = i(o);
51
+ if (o === u)
52
+ return c;
53
+ const l = i(u, "root-component.");
54
+ return [...c, ...l];
55
+ }
56
+ function r(o) {
57
+ return o.binding && o.binding.path || o.id || "";
58
+ }
59
+ function d() {
60
+ return e && e.getRenderStates() || [];
61
+ }
62
+ return { getVariables: s, getControlName: r, getStateMachines: d };
63
+ }
64
+ class U {
65
+ constructor(n) {
66
+ y(this, "sessionVariables", [
67
+ {
68
+ key: "CurrentSysOrgName",
69
+ name: "当前组织Name",
70
+ description: "当前组织Name"
71
+ },
72
+ // {
73
+ // key: "CurrentSysOrgCode",
74
+ // name: "当前组织Code",
75
+ // description: "当前组织Code"
76
+ // },
77
+ {
78
+ key: "CurrentSysOrgId",
79
+ name: "当前组织Id",
80
+ description: "当前组织Id"
81
+ },
82
+ {
83
+ key: "CurrentUserName",
84
+ name: "当前用户Name",
85
+ description: "当前用户Name"
86
+ },
87
+ {
88
+ key: "CurrentUserCode",
89
+ name: "当前用户Code",
90
+ description: "当前用户Code"
91
+ },
92
+ {
93
+ key: "CurrentUserId",
94
+ name: "当前用户Id",
95
+ description: "当前用户Id"
96
+ },
97
+ {
98
+ key: "CurrentLanguage",
99
+ name: "当前语言编号",
100
+ description: "当前登录的语言编号,例如简体中文返回'zh-CHS',英文返回'en',繁体中文'zh-CHT'"
101
+ }
102
+ ]);
103
+ y(this, "expressionNames", {
104
+ compute: "计算表达式",
105
+ dependency: "依赖表达式",
106
+ validate: "验证表达式",
107
+ dataPicking: "帮助前表达式",
108
+ visible: "可见表达式",
109
+ readonly: "只读表达式",
110
+ required: "必填表达式"
111
+ });
112
+ y(this, "getExpressionConverter", (n, e) => ({
113
+ convertFrom: (t, i, s, r) => {
114
+ const d = s.getExpressionRuleValue(n, e || i);
115
+ return d && d.value || "";
116
+ },
117
+ convertTo: (t, i, s, r, d) => {
118
+ var o;
119
+ if (i === "dataPicking" && (s != null && s.target)) {
120
+ const u = `${s.target}_dataPicking`;
121
+ ((o = s.rules) == null ? void 0 : o.some(
122
+ (l) => l.id === u && l.value
123
+ )) ? t.dictPickingExpressionId = u : delete t.dictPickingExpressionId;
124
+ }
125
+ r.updateExpression(s);
126
+ }
127
+ }));
128
+ this.formSchemaService = n;
129
+ }
130
+ getExpressionRule(n, e) {
131
+ const t = this.formSchemaService.getExpressions();
132
+ if (!t)
133
+ return "";
134
+ const i = t.find((r) => r.target === n);
135
+ if (!i)
136
+ return "";
137
+ const s = i.rules.find((r) => r.type === e);
138
+ return s || "";
139
+ }
140
+ // 获取上下文表单变量
141
+ getContextFormVariables() {
142
+ const { module: n } = this.formSchemaService.getFormSchema();
143
+ if (!n.viewmodels || n.viewmodels.length === 0)
144
+ return [];
145
+ const e = this.formSchemaService.getRootViewModelId(), t = this.formSchemaService.getViewModelById(e);
146
+ if (!t || !t.states || t.states.length === 0)
147
+ return [];
148
+ const i = [];
149
+ return t.states.filter((s) => s.category === "remote").forEach((s) => {
150
+ i.push({
151
+ key: s.code,
152
+ name: s.name,
153
+ description: s.name,
154
+ category: s.category
155
+ });
156
+ }), i;
36
157
  }
37
- getEditorProperties(t) {
158
+ createTreeNode(n, e, t = "label") {
159
+ return {
160
+ id: n.id,
161
+ name: n.name,
162
+ bindingPath: n[t],
163
+ parents: e,
164
+ type: "field"
165
+ };
166
+ }
167
+ buildEntityFieldsTreeData(n = null, e) {
168
+ const t = [];
169
+ return n == null || n.forEach((i) => {
170
+ var d;
171
+ const s = this.createTreeNode(i, e);
172
+ let r = [];
173
+ (d = i.type) != null && d.fields && (r = this.buildEntityFieldsTreeData(i.type.fields, [...e, i.label])), t.push({
174
+ data: s,
175
+ children: r,
176
+ expanded: !0
177
+ });
178
+ }), t;
179
+ }
180
+ buildChildEntityTreeData(n = null, e) {
181
+ const t = [];
182
+ return n == null || n.forEach((i) => {
183
+ var o, u;
184
+ const s = this.createTreeNode(i, e);
185
+ s.type = "entity";
186
+ const r = this.buildEntityFieldsTreeData((o = i.type) == null ? void 0 : o.fields, [...e, i.label]), d = this.buildChildEntityTreeData((u = i.type) == null ? void 0 : u.entities, [...e, i.label]);
187
+ d != null && d.length && (r == null || r.push(...d)), t.push({
188
+ data: s,
189
+ children: r || [],
190
+ // 空值回退
191
+ expanded: !0
192
+ });
193
+ }), t;
194
+ }
195
+ getEntitiesTreeData() {
196
+ const n = this.formSchemaService.getSchemaEntities();
197
+ if (!(n != null && n.length))
198
+ return [];
199
+ const e = n[0];
200
+ if (!(e != null && e.type))
201
+ return [];
202
+ const t = this.buildEntityFieldsTreeData(e.type.fields, [e.code]), i = this.buildChildEntityTreeData(e.type.entities, [e.code]);
203
+ return i != null && i.length && (t == null || t.push(...i)), {
204
+ entityCode: e.code,
205
+ fields: [{
206
+ data: this.createTreeNode(e, [], "code"),
207
+ children: t || []
208
+ }]
209
+ };
210
+ }
211
+ getEntitiesAndVariables() {
212
+ return {
213
+ entities: this.getEntitiesTreeData(),
214
+ variables: {
215
+ session: {
216
+ name: "系统变量",
217
+ items: this.sessionVariables,
218
+ visible: !1
219
+ },
220
+ forms: {
221
+ name: "表单变量",
222
+ items: this.getContextFormVariables(),
223
+ visible: !0
224
+ }
225
+ }
226
+ };
227
+ }
228
+ onBeforeOpenExpression(n, e, t) {
229
+ const i = t === "Field" ? n.binding.field : n.id, s = this.getExpressionRule(i, e), r = this.getEntitiesAndVariables(), d = {
230
+ message: ["validate", "required", "dataPicking"].includes(e) && s ? s.message : "",
231
+ ...r
232
+ };
233
+ return s.messageType != null && (d.messageType = s.messageType), d;
234
+ }
235
+ buildRule(n, e, t, i) {
236
+ const { expression: s, message: r, messageType: d } = e, o = {
237
+ id: `${n}_${t}`,
238
+ type: t,
239
+ value: s
240
+ };
241
+ return (t === "validate" || t === "dataPicking" || t === "required") && (o.message = r), t === "dataPicking" && (o.messageType = d), t === "validate" && i && (o.elementId = i), o;
242
+ }
243
+ getExpressionData() {
244
+ const { expressions: n } = this.formSchemaService.getFormSchema().module;
245
+ return n || [];
246
+ }
247
+ updateExpression(n, e, t, i) {
248
+ const s = e === "Field" ? n.binding.field : n.id, r = this.buildRule(s, t, i, n.type === "form-group" ? n.id : "");
249
+ let o = this.getExpressionData().find((c) => c.targetType === e && c.target === s);
250
+ const u = (c) => c.value.trim() === "";
251
+ if (o) {
252
+ const c = o.rules.find((l) => l.id === r.id);
253
+ if (c)
254
+ u(r) ? o.rules = o.rules.filter((l) => l.id !== r.id) : (Object.assign(c, r), i === "validate" && n.type === "form-group" && (c.elementId = n.id));
255
+ else {
256
+ if (u(r))
257
+ return null;
258
+ o.rules = o.rules || [], o.rules.push(r);
259
+ }
260
+ } else {
261
+ if (u(r))
262
+ return null;
263
+ o = {
264
+ target: `${s}`,
265
+ rules: [r],
266
+ targetType: e
267
+ };
268
+ }
269
+ return o;
270
+ }
271
+ getExpressionEditorOptions(n, e, t, i) {
272
+ return t.reduce((s, r) => {
273
+ var o, u;
274
+ const d = e === "Field" ? (o = n == null ? void 0 : n.binding) == null ? void 0 : o.field : n.id;
275
+ return s[r] = {
276
+ hide: e === "Field" ? !!((u = n == null ? void 0 : n.binding) != null && u.field) : !1,
277
+ description: "",
278
+ title: this.expressionNames[r],
279
+ type: "string",
280
+ $converter: this.getExpressionConverter(d),
281
+ refreshPanelAfterChanged: !0,
282
+ editor: {
283
+ type: "expression-editor",
284
+ singleExpand: !1,
285
+ dialogTitle: `${this.expressionNames[r]}编辑器`,
286
+ showMessage: r === "validate" || r === "dataPicking" || r === "required",
287
+ showMessageType: r === "dataPicking",
288
+ beforeOpen: () => this.onBeforeOpenExpression(n, r, e),
289
+ onSubmitModal: (c) => {
290
+ const l = this.updateExpression(n, e, c, r);
291
+ if (i) {
292
+ const m = this.buildRule(d, c, r);
293
+ i(m);
294
+ }
295
+ return l;
296
+ }
297
+ }
298
+ }, s;
299
+ }, {});
300
+ }
301
+ getExpressionInfo(n, e, t) {
302
+ const i = e === "Field" ? n.binding.field : n.id, s = this.getExpressionRule(i, t), r = {
303
+ value: s && s.value,
304
+ targetId: i,
305
+ targetType: e,
306
+ expressionType: t
307
+ };
308
+ return s && s.message && (r.message = s.message), r;
309
+ }
310
+ getExpressionConfig(n, e, t = ["compute", "dependency", "validate"], i) {
311
+ return {
312
+ description: "表达式",
313
+ title: "表达式",
314
+ hide: !n.binding,
315
+ properties: {
316
+ ...this.getExpressionEditorOptions(n, e, t, i)
317
+ }
318
+ };
319
+ }
320
+ getExpressionOptions(n, e, t) {
321
+ const i = this.getExpressionInfo(n, e, t);
322
+ return {
323
+ dialogTitle: `${this.expressionNames[t]}编辑器`,
324
+ singleExpand: !1,
325
+ showMessage: t === "required",
326
+ beforeOpen: () => this.onBeforeOpenExpression(n, t, e),
327
+ expressionInfo: i
328
+ };
329
+ }
330
+ }
331
+ class ne {
332
+ constructor(n, e) {
333
+ y(this, "componentId");
334
+ y(this, "viewModelId");
335
+ y(this, "eventsEditorUtils");
336
+ y(this, "formSchemaUtils");
337
+ y(this, "formMetadataConverter");
338
+ y(this, "designViewModelUtils");
339
+ y(this, "designViewModelField");
340
+ y(this, "controlCreatorUtils");
341
+ y(this, "designerHostService");
342
+ y(this, "designerContext");
343
+ y(this, "schemaService", null);
344
+ y(this, "metadataService", null);
345
+ y(this, "propertyConfig", {
346
+ type: "object",
347
+ categories: {}
348
+ });
349
+ var t;
350
+ this.componentId = n, this.designerHostService = e, this.eventsEditorUtils = e.eventsEditorUtils, this.formSchemaUtils = e.formSchemaUtils, this.formMetadataConverter = e.formMetadataConverter, this.viewModelId = ((t = this.formSchemaUtils) == null ? void 0 : t.getViewModelIdByComponentId(n)) || "", this.designViewModelUtils = e.designViewModelUtils, this.controlCreatorUtils = e.controlCreatorUtils, this.metadataService = e.metadataService, this.schemaService = e.schemaService, this.designerContext = e.designerContext;
351
+ }
352
+ getFormDesignerInstance() {
353
+ var n, e;
354
+ return (e = (n = this.designerContext) == null ? void 0 : n.instances) == null ? void 0 : e.formDesigner.value;
355
+ }
356
+ getTableInfo() {
357
+ var n;
358
+ return (n = this.schemaService) == null ? void 0 : n.getTableInfoByViewModelId(this.viewModelId);
359
+ }
360
+ setDesignViewModelField(n) {
361
+ var t;
362
+ const e = n.binding && n.binding.type === "Form" && n.binding.field;
363
+ if (e) {
364
+ if (!this.designViewModelField) {
365
+ const i = this.designViewModelUtils.getDgViewModel(this.viewModelId);
366
+ this.designViewModelField = i.fields.find((s) => s.id === e);
367
+ }
368
+ n.updateOn = (t = this.designViewModelField) == null ? void 0 : t.updateOn;
369
+ }
370
+ }
371
+ getBasicPropConfig(n) {
372
+ return {
373
+ description: "Basic Information",
374
+ title: "基本信息",
375
+ properties: {
376
+ id: {
377
+ description: "组件标识",
378
+ title: "标识",
379
+ type: "string",
380
+ readonly: !0
381
+ },
382
+ type: {
383
+ description: "组件类型",
384
+ title: "控件类型",
385
+ type: "select",
386
+ editor: {
387
+ type: "combo-list",
388
+ textField: "name",
389
+ valueField: "value",
390
+ idField: "value",
391
+ editable: !1,
392
+ data: [{ value: n.type, name: a[n.type] && a[n.type].name }]
393
+ }
394
+ }
395
+ }
396
+ };
397
+ }
398
+ getAppearanceConfig(n = null, e = {}, t) {
399
+ const i = {
400
+ title: "外观",
401
+ description: "Appearance"
402
+ }, s = {
403
+ class: {
404
+ title: "class样式",
405
+ type: "string",
406
+ description: "组件的CSS样式",
407
+ $converter: "/converter/appearance.converter",
408
+ parentPropertyID: "appearance"
409
+ },
410
+ style: {
411
+ title: "style样式",
412
+ type: "string",
413
+ description: "组件的样式",
414
+ $converter: "/converter/appearance.converter",
415
+ parentPropertyID: "appearance"
416
+ }
417
+ };
418
+ for (const r in e)
419
+ s[r] = Object.assign(s[r] || {}, e[r]);
420
+ return {
421
+ ...i,
422
+ properties: { ...s },
423
+ setPropertyRelates(r, d) {
424
+ if (r) {
425
+ switch (r && r.propertyID) {
426
+ case "class":
427
+ case "style": {
428
+ M.value++;
429
+ break;
430
+ }
431
+ }
432
+ t && t(r, n, d);
433
+ }
434
+ }
435
+ };
436
+ }
437
+ /**
438
+ *
439
+ * @param propertyData
440
+ * @param propertyTypes
441
+ * @param propertyName
442
+ * @param constInfos
443
+ * @param variableInfos
444
+ * @param expressionType 指定表达式类型,存在属性和表达式类型不一致的情况
445
+ * @returns
446
+ */
447
+ getPropertyEditorParams(n, e = [], t = "visible", i = {}, s = {}, r = "") {
448
+ const { getVariables: d, getControlName: o, getStateMachines: u } = ie(this.designerHostService), c = this.getRealTargetType(n), l = e && e.length > 0 ? e : ["Const", "Variable", "StateMachine", "Expression"], m = {
449
+ type: "property-editor",
450
+ propertyTypes: l
451
+ };
452
+ return l.map((g) => {
453
+ switch (g) {
454
+ case "Const":
455
+ Object.assign(m, {
456
+ constType: "enum",
457
+ constEnums: [{ id: !0, name: "是" }, { id: !1, name: "否" }]
458
+ }, i);
459
+ break;
460
+ case "Expression":
461
+ m.expressionConfig = this.getExpressionOptions(n, c, r || t);
462
+ break;
463
+ case "StateMachine":
464
+ m.stateMachines = u();
465
+ break;
466
+ case "Variable":
467
+ Object.assign(m, {
468
+ controlName: o(n),
469
+ newVariablePrefix: "is",
470
+ newVariableType: "Boolean",
471
+ variables: d(this.viewModelId),
472
+ parentComponentId: this.componentId === "root-component" ? "" : "root-component",
473
+ onBeforeOpenVariables: (p) => {
474
+ p.value = d(this.viewModelId);
475
+ }
476
+ }, s), this.designerContext.designerMode === "PC_RTC" && (m.newVariablePrefix = "ext_" + m.newVariablePrefix);
477
+ break;
478
+ }
479
+ }), m;
480
+ }
481
+ getVisibleProperty(n, e = "") {
482
+ var s;
483
+ let t = ["Const", "Variable", "StateMachine", "Expression"];
484
+ return e === "gridFieldEditor" ? t = ["Const", "Expression"] : e === "form-group" && !((s = n.binding) != null && s.field) && (t = ["Const", "Variable", "StateMachine"]), {
485
+ visible: {
486
+ title: "是否可见",
487
+ type: "boolean",
488
+ description: "运行时组件是否可见",
489
+ editor: this.getPropertyEditorParams(n, t, "visible")
490
+ }
491
+ };
492
+ }
493
+ /**
494
+ * 获取行为
495
+ * @param propertyData
496
+ * @param viewModelId
497
+ * @returns
498
+ */
499
+ getBehaviorConfig(n, e = "", t = {}, i) {
500
+ const s = {
501
+ title: "行为",
502
+ description: ""
503
+ }, r = this.getVisibleProperty(n, e);
504
+ for (const o in t)
505
+ r[o] = Object.assign(r[o] || {}, t[o]);
506
+ const d = this;
507
+ return {
508
+ ...s,
509
+ properties: { ...r },
510
+ setPropertyRelates(o, u) {
511
+ if (o) {
512
+ switch (o.propertyID) {
513
+ case "disabled":
514
+ case "readonly":
515
+ case "visible":
516
+ d.afterMutilEditorChanged(n, o);
517
+ break;
518
+ }
519
+ i && i(o, u);
520
+ }
521
+ }
522
+ };
523
+ }
524
+ /**
525
+ * 当多值编辑器变更时
526
+ * @param propertyData
527
+ * @param changeObject
528
+ */
529
+ afterMutilEditorChanged(n, e) {
530
+ this.addNewVariableToViewModel(e, this.viewModelId), this.updateExpressionValue(e), this.clearExpression(e, n);
531
+ }
532
+ /**
533
+ *
534
+ * @param propertyId
535
+ * @param componentInstance
536
+ * @returns
537
+ */
538
+ updateElementByParentContainer(n, e) {
539
+ const t = e && e.parent && e.parent.schema;
540
+ if (!t)
541
+ return;
542
+ const i = t.contents.findIndex((r) => r.id === n), s = ee(t.contents[i]);
543
+ t.contents.splice(i, 1), t.contents.splice(i, 0, s), Y();
544
+ }
545
+ /**
546
+ * 属性编辑器,在编辑过程中会新增变量,此处需要将新增的变量追加到ViewModel中
547
+ * @param changeObject
548
+ * @param viewModelId
549
+ * @returns
550
+ */
551
+ addNewVariableToViewModel(n, e) {
552
+ const t = n.propertyValue;
553
+ if (!(t && typeof t == "object") || !(t.type === "Variable" && t.isNewVariable))
554
+ return;
555
+ const r = {
556
+ id: t.field,
557
+ category: "locale",
558
+ code: t.fullPath,
559
+ name: t.fullPath,
560
+ type: t.newVariableType || "String",
561
+ isRtcVariable: this.designerContext.designerMode === "PC_RTC" ? !0 : void 0
562
+ };
563
+ delete t.newVariableType, delete t.isNewVariable, this.formSchemaUtils.getVariableByCode(r.code) || this.formSchemaUtils.getViewModelById("root-viewmodel").states.push(r);
564
+ }
565
+ /**
566
+ * 更新表达式到expressions节点
567
+ * @param changeObject
568
+ */
569
+ updateExpressionValue(n) {
570
+ const e = n.propertyValue;
571
+ if (!((e && e.type) === "Expression" && e.expressionInfo))
572
+ return;
573
+ const { expressionId: s, expressionInfo: r } = e, { targetId: d, targetType: o, expressionType: u, value: c, message: l } = r, m = this.formSchemaUtils.getModule();
574
+ m.expressions = m.expressions || [];
575
+ const { expressions: g } = m;
576
+ let p = g.find((A) => A.target === d);
577
+ p || (p = { target: d, rules: [], targetType: o }, g.push(p));
578
+ const h = p.rules.find((A) => A.type === u);
579
+ if (h)
580
+ h.value = c, h.message = l;
581
+ else {
582
+ const A = { id: s, type: u, value: c, message: l };
583
+ p.rules.push(A);
584
+ }
585
+ delete e.expressionInfo;
586
+ }
587
+ /**
588
+ * 属性类型切换为非表达式后,清除原表达式
589
+ * @param changeObject
590
+ * @param propertyData
591
+ * @returns
592
+ */
593
+ clearExpression(n, e) {
594
+ const t = n.propertyValue;
595
+ if (t && t.type === "Expression")
596
+ return;
597
+ const s = n.propertyID, r = this.formSchemaUtils.getExpressions(), d = e.binding ? e.binding.field : e.id, o = r.find((u) => u.target === d);
598
+ !o || !o.rules || (o.rules = o.rules.filter((u) => u.type !== s));
599
+ }
600
+ getExpressionOptions(n, e, t) {
601
+ return new U(this.formSchemaUtils).getExpressionOptions(n, e, t);
602
+ }
603
+ getRealTargetType(n) {
604
+ return ["response-toolbar-item", "tab-toolbar-item", "section-toolbar-item", "drawer-toolbar-item"].indexOf(n.type) > -1 ? "Button" : n.binding && n.binding.field ? "Field" : "Container";
605
+ }
606
+ createBaseEventProperty(n) {
607
+ const e = {};
608
+ return e[this.viewModelId] = {
609
+ type: "events-editor",
610
+ editor: {
611
+ initialData: n,
612
+ viewSourceHandle: (t) => {
613
+ var i;
614
+ ((i = t.controller) == null ? void 0 : i.label.indexOf(this.formSchemaUtils.getModule().code)) > -1 && this.eventsEditorUtils.jumpToMethod(t);
615
+ }
616
+ }
617
+ }, e;
618
+ }
619
+ }
620
+ const C = class C {
621
+ /**
622
+ * 根据绑定字段类型获取可用的输入类控件
623
+ */
624
+ static getEditorTypesByMDataType(n, e = !1, t = "") {
625
+ if (e)
626
+ return [{ key: a["language-textbox"].type, value: a["language-textbox"].name }];
627
+ let i = C.fieldControlTypeMapping[n];
628
+ if (t === "data-grid-column" && (i != null && i.length)) {
629
+ const s = [a["check-group"].type, a["radio-group"].type, a.image.type, a["rich-text-editor"].type];
630
+ i = i.filter((r) => !s.includes(r.key));
631
+ }
632
+ return i;
633
+ }
634
+ /**
635
+ * 获取所有输入类控件
636
+ */
637
+ static getAllInputTypes() {
638
+ const n = [];
639
+ for (const e in C.fieldControlTypeMapping)
640
+ C.fieldControlTypeMapping[e].forEach((t) => {
641
+ n.find((i) => i.key === t.key && i.value === t.value) || n.push({ key: t.key, value: t.value });
642
+ });
643
+ return n;
644
+ }
645
+ /**
646
+ * 提供schema字段基础属性和DOM控件属性的映射
647
+ * @param control 控件元数据
648
+ */
649
+ static mappingDomPropAndSchemaProp(n, e) {
650
+ var s;
651
+ const t = (s = n.editor) == null ? void 0 : s.type, i = [];
652
+ return (n.type === a["data-grid-column"].type || n.type === a["tree-grid-column"].type) && e && e.categoryId && e.categoryId.indexOf("gridFieldEditor") < 0 && i.push({ domField: "title", schemaField: "name" }), i.push({ domField: "label", schemaField: "name" }), i.push({ domField: "editor.required", schemaField: "require" }), i.push({ domField: "editor.readonly", schemaField: "readonly" }), (t === a["input-group"].type || t === a.textarea.type || t === a["number-spinner"].type) && i.push({ domField: "editor.maxLength", schemaField: "type.length" }), t === a["number-spinner"].type && i.push({ domField: "editor.precision", schemaField: "type.precision" }), (n.type === a["data-grid-column"].type || n.type === a["tree-grid-column"].type) && i.push({ domField: "formatter.precision", schemaField: "type.precision" }), (t === a["combo-list"].type || t === a["radio-group"].type) && i.push({ domField: "editor.data", schemaField: "type.enumValues" }), (n.type === a["data-grid-column"].type || n.type === a["tree-grid-column"].type) && i.push({ domField: "formatter.data", schemaField: "type.enumValues" }), t === a["date-picker"].type && (i.push({ domField: "editor.displayFormat", schemaField: "editor.format" }), i.push({ domField: "editor.fieldType", schemaField: "type.name" })), t === a["number-spinner"].type && (i.push({ domField: "editor.max", schemaField: "editor.maxValue" }), i.push({ domField: "editor.min", schemaField: "editor.minValue" })), t === a.lookup.type && (i.push({ domField: "editor.dataSource", schemaField: "editor.dataSource" }), i.push({ domField: "editor.valueField", schemaField: "editor.valueField" }), i.push({ domField: "editor.textField", schemaField: "editor.textField" }), i.push({ domField: "editor.displayType", schemaField: "editor.displayType" }), i.push({ domField: "editor.mapFields", schemaField: "editor.mapFields" }), i.push({ domField: "editor.helpId", schemaField: "editor.helpId" })), i.push({ domField: "path", schemaField: "bindingPath" }), i.push({ domField: "binding.path", schemaField: "bindingField" }), i.push({ domField: "binding.fullPath", schemaField: "path" }), (n.type === a["data-grid-column"].type || n.type === a["tree-grid-column"].type) && i.push({ domField: "field", schemaField: "bindingPath" }), i;
653
+ }
654
+ };
655
+ /**
656
+ * <字段类型,可配置的控件类型列表>的映射
657
+ */
658
+ y(C, "fieldControlTypeMapping", {
659
+ String: [
660
+ { key: a["input-group"].type, value: a["input-group"].name },
661
+ { key: a.lookup.type, value: a.lookup.name },
662
+ { key: a.image.type, value: a.image.name },
663
+ { key: a["date-picker"].type, value: a["date-picker"].name },
664
+ { key: a.switch.type, value: a.switch.name },
665
+ { key: a["check-box"].type, value: a["check-box"].name },
666
+ { key: a["check-group"].type, value: a["check-group"].name },
667
+ { key: a["radio-group"].type, value: a["radio-group"].name },
668
+ { key: a["combo-list"].type, value: a["combo-list"].name },
669
+ { key: a.textarea.type, value: a.textarea.name },
670
+ { key: a["time-picker"].type, value: a["time-picker"].name }
671
+ ],
672
+ Text: [
673
+ { key: a.textarea.type, value: a.textarea.name },
674
+ { key: a.lookup.type, value: a.lookup.name },
675
+ { key: a.image.type, value: a.image.name },
676
+ { key: a["rich-text-editor"].type, value: a["rich-text-editor"].name }
677
+ ],
678
+ Decimal: [
679
+ { key: a["number-spinner"].type, value: a["number-spinner"].name }
680
+ ],
681
+ Integer: [
682
+ { key: a["number-spinner"].type, value: a["number-spinner"].name }
683
+ ],
684
+ Number: [
685
+ { key: a["number-spinner"].type, value: a["number-spinner"].name },
686
+ { key: a.switch.type, value: a.switch.name },
687
+ { key: a["check-box"].type, value: a["check-box"].name }
688
+ ],
689
+ BigNumber: [
690
+ { key: a["number-spinner"].type, value: a["number-spinner"].name }
691
+ ],
692
+ Date: [
693
+ { key: a["date-picker"].type, value: a["date-picker"].name }
694
+ ],
695
+ DateTime: [
696
+ { key: a["date-picker"].type, value: a["date-picker"].name }
697
+ ],
698
+ Boolean: [
699
+ { key: a.switch.type, value: a.switch.name },
700
+ { key: a["check-box"].type, value: a["check-box"].name }
701
+ ],
702
+ Enum: [
703
+ { key: a["combo-list"].type, value: a["combo-list"].name },
704
+ { key: a["radio-group"].type, value: a["radio-group"].name }
705
+ ],
706
+ Object: [
707
+ { key: a.lookup.type, value: a.lookup.name },
708
+ { key: a["combo-list"].type, value: a["combo-list"].name },
709
+ { key: a["radio-group"].type, value: a["radio-group"].name }
710
+ ]
711
+ });
712
+ let P = C;
713
+ var x = /* @__PURE__ */ ((f) => (f.Form = "Form", f.Variable = "Variable", f))(x || {});
714
+ class se {
715
+ constructor() {
716
+ /** 控件标题 */
717
+ y(this, "label", "");
718
+ /** 控件id */
719
+ y(this, "id", "");
720
+ /** 每个控件占用的栅格数 */
721
+ y(this, "columnInSM", 12);
722
+ y(this, "columnInMD", 6);
723
+ y(this, "columnInLG", 3);
724
+ y(this, "columnInEL", 2);
725
+ /** 每个控件占用的列数 */
726
+ y(this, "displayWidthInSM", 1);
727
+ y(this, "displayWidthInMD", 1);
728
+ y(this, "displayWidthInLG", 1);
729
+ y(this, "displayWidthInEL", 1);
730
+ /** 编辑器内部默认显示的屏幕大小-----可以去掉 */
731
+ y(this, "displayColumnCountAtBreakPoint", "md");
732
+ /** 控件所在行,传0即可-----编辑器内部使用 */
733
+ y(this, "tagRow", 0);
734
+ /** 控件是否显示上方空白:传0即可-----编辑器内部使用 */
735
+ y(this, "showTopBorder", 0);
736
+ /** 区域,从1开始。卡片内的控件从上往下,从左往右划分区域,遇到分组fieldSet时group+1,分组结束后group+1 */
737
+ y(this, "group", 1);
738
+ /** 控件是否符合标准的class配置(设计器用的) */
739
+ y(this, "isSupportedClass", !0);
740
+ /** 控件所在分组id(设计器用的) */
741
+ y(this, "fieldSetId", "");
742
+ }
743
+ }
744
+ function re(f) {
745
+ let n, e;
746
+ const t = /* @__PURE__ */ new Map();
747
+ let i = [];
748
+ function s(c, l) {
749
+ const g = c.split(" ").filter((b) => b.startsWith("col-"));
750
+ if (g.length === 0) {
751
+ l.isSupportedClass = !1;
752
+ return;
753
+ }
754
+ let p = g.find((b) => /^col-([1-9]|10|11|12)$/.test(b)), h = g.find((b) => /^col-md-([1-9]|10|11|12)$/.test(b)), A = g.find((b) => /^col-xl-([1-9]|10|11|12)$/.test(b)), v = g.find((b) => /^col-el-([1-9]|10|11|12)$/.test(b));
755
+ p = p || "col-12", l.columnInSM = parseInt(p.replace("col-", ""), 10), l.displayWidthInSM = l.columnInSM / 12, l.displayWidthInSM !== 1 && (l.isSupportedClass = !1), h = h || "col-md-" + l.columnInSM, l.columnInMD = parseInt(h.replace("col-md-", ""), 10), l.displayWidthInMD = l.columnInMD / 6, [1, 2].includes(l.displayWidthInMD) || (l.isSupportedClass = !1), A = A || "col-xl-" + l.columnInMD, l.columnInLG = parseInt(A.replace("col-xl-", ""), 10), l.displayWidthInLG = l.columnInLG / 3, [1, 2, 3, 4].includes(l.displayWidthInLG) || (l.isSupportedClass = !1), v = v || "col-el-" + l.columnInLG, l.columnInEL = parseInt(v.replace("col-el-", ""), 10), l.displayWidthInEL = l.columnInEL / 2, [1, 2, 3, 4, 5, 6].includes(l.displayWidthInEL) || (l.isSupportedClass = !1);
756
+ }
757
+ function r(c, l, m, g = !1) {
758
+ let p = !1;
759
+ c.contents.forEach((h) => {
760
+ if (h.type === "fieldset") {
761
+ m += 1, r(h, l, m, !0), p = !0;
762
+ return;
763
+ }
764
+ p && (m += 1, p = !1);
765
+ const A = h.appearance && h.appearance.class, v = new se();
766
+ A ? s(A, v) : v.isSupportedClass = !1, v.label = h.label || h.id, v.id = h.id, v.group = m, g && (v.fieldSetId = c.id), e === h.id && (n = m), t.set(h.id, h), l.push(v);
767
+ });
768
+ }
769
+ function d(c) {
770
+ const l = f.getComponentById(c);
771
+ if (!l || !l.componentType || !l.componentType.startsWith("form"))
772
+ return { result: !1, message: "只可以在响应式表单组件中调整响应式布局配置" };
773
+ const m = f.selectNode(l, (g) => g.type === a["response-form"].type);
774
+ return !m || !m.contents || m.contents.length === 0 ? { result: !1, message: "Form区域内没有控件,请先添加控件" } : { result: !0, message: "", formNode: m };
775
+ }
776
+ function o(c, l) {
777
+ l = l || c.id;
778
+ const { result: m, message: g, formNode: p } = d(l);
779
+ if (!m)
780
+ return { result: m, message: g };
781
+ e = c.id, i = [], t.clear();
782
+ const h = p.contents[0].type === a.fieldset.type ? 0 : 1;
783
+ r(p, i, h);
784
+ const A = i.find((b) => !b.isSupportedClass);
785
+ return {
786
+ defaultState: {
787
+ defaultGroupNumber: n || 1,
788
+ model: A ? "customize" : "standard"
789
+ },
790
+ importData: i
791
+ };
792
+ }
793
+ function u(c, l) {
794
+ l = l;
795
+ const { result: m, formNode: g } = d(l);
796
+ if (!m)
797
+ return "";
798
+ const p = [];
799
+ return c.forEach((h) => {
800
+ var b;
801
+ const A = t.get(h.id), v = A.appearance && A.appearance.class;
802
+ if (v) {
803
+ const w = v.split(" ").filter((G) => !G.startsWith("col-")), I = "col-" + h.columnInSM, L = "col-md-" + h.columnInMD, q = "col-xl-" + h.columnInLG, H = "col-el-" + h.columnInEL, Q = [I, L, q, H].concat(w);
804
+ A.appearance.class = Q.join(" ");
805
+ }
806
+ if (h.fieldSetId) {
807
+ const T = g.contents.find((I) => I.id === h.fieldSetId), w = p.find((I) => I.id === h.fieldSetId);
808
+ w ? (b = w.contents) == null || b.push(A) : (p.push(T), T.contents = [A]);
809
+ } else
810
+ p.push(A);
811
+ }), g.contents = p, g.id;
812
+ }
813
+ return {
814
+ checkCanFindFormNode: d,
815
+ checkCanOpenLayoutEditor: o,
816
+ changeFormControlsByResponseLayoutConfig: u,
817
+ getResonseFormLayoutConfig: r
818
+ };
819
+ }
820
+ class oe extends ne {
821
+ constructor(e, t) {
822
+ super(e, t);
823
+ y(this, "responseLayoutEditorFunction");
824
+ /** 控件绑定的变量 */
825
+ y(this, "bindingVarible");
826
+ y(this, "numberEditorOptions", {
827
+ type: "number-spinner",
828
+ useThousands: !1,
829
+ keyboard: !1,
830
+ showButton: !1
831
+ });
832
+ this.responseLayoutEditorFunction = re(this.formSchemaUtils);
833
+ }
834
+ getCommonPropertyConfig(e, t, i = "Card") {
835
+ this.propertyConfig.categories.basic = this.getBasicProperties(e, t, i), this.propertyConfig.categories.appearance = this.getAppearanceProperties(e, t), this.propertyConfig.categories.behavior = this.getBehaviorConfig(e, "form-group");
836
+ }
837
+ getPropertyConfig(e, t) {
838
+ return this.getCommonPropertyConfig(e, t, "Card"), this.propertyConfig.categories.editor = this.getEditorProperties(e), this.propertyConfig.categories.expressions = this.getExpressionConfig(e, "Field"), this.propertyConfig.categories.eventsEditor = this.getEventPropertyConfig(e), this.propertyConfig;
839
+ }
840
+ getGridFieldEdtiorPropConfig(e, t) {
841
+ return this.propertyConfig.categories = {}, this.getCommonPropertyConfig(e, t, "Grid"), this.getGridFieldEdtiorProperties ? this.propertyConfig.categories.editor = this.getGridFieldEdtiorProperties(e) : this.propertyConfig.categories.editor = this.getEditorProperties(e), this.propertyConfig.categories.expressons = this.getExpressionConfig(e, "Field"), this.propertyConfig.categories;
842
+ }
843
+ getBasicProperties(e, t, i = "Card") {
844
+ var u;
845
+ const s = this;
846
+ this.setDesignViewModelField(e);
847
+ const { canChangeControlType: r, editorTypeList: d } = this.getAvailableEditorType(e), o = {
848
+ description: "Basic Information",
849
+ title: "基本信息",
850
+ properties: {
851
+ id: {
852
+ description: "组件标识",
853
+ title: "标识",
854
+ type: "string",
855
+ readonly: !0
856
+ },
857
+ type: {
858
+ description: "编辑器类型",
859
+ title: "编辑器类型",
860
+ type: "string",
861
+ $converter: "/converter/change-editor.converter",
862
+ parentPropertyID: "editor",
863
+ editor: {
864
+ type: "combo-list",
865
+ textField: "value",
866
+ valueField: "key",
867
+ idField: "key",
868
+ editable: !1,
869
+ data: d,
870
+ readonly: !r
871
+ }
872
+ },
873
+ label: {
874
+ title: "标签",
875
+ type: "string",
876
+ $converter: "/converter/form-group-label.converter"
877
+ },
878
+ showLabelType: {
879
+ description: "标签显示方式:1、显示:显示标签 2、占位:保留标签空间,但不显示文本 3、不显示:不显示标签",
880
+ title: "标签显示",
881
+ type: "enum",
882
+ editor: {
883
+ data: [{ id: "visible", name: "显示" }, { id: "reserve-space", name: "占位" }, { id: "none", name: "不显示" }]
884
+ },
885
+ defaultValue: ((u = e.editor) == null ? void 0 : u.type) === "image" ? "none" : "visible"
886
+ },
887
+ binding: {
888
+ description: "绑定的表单字段",
889
+ title: "绑定",
890
+ editor: {
891
+ type: "binding-selector",
892
+ bindingType: { enable: !1 },
893
+ editorParams: {
894
+ componentSchema: e,
895
+ needSyncToViewModel: !0,
896
+ viewModelId: this.viewModelId,
897
+ designerHostService: this.designerHostService,
898
+ disableOccupiedFields: !0
899
+ },
900
+ textField: "bindingField"
901
+ },
902
+ refreshPanelAfterChanged: !0,
903
+ readonly: this.formSchemaUtils.designerMode === "PC_RTC" && !e.isRtcControl
904
+ }
905
+ },
906
+ setPropertyRelates(c, l, m) {
907
+ if (c)
908
+ switch (c && c.propertyID) {
909
+ case "type": {
910
+ s.changeControlType(e, c, t);
911
+ break;
912
+ }
913
+ case "label": {
914
+ c.needRefreshControlTree = !0;
915
+ break;
916
+ }
917
+ case "binding": {
918
+ s.changeBindingField(e, c, m);
919
+ break;
920
+ }
921
+ }
922
+ }
923
+ };
924
+ return i.toLocaleLowerCase() !== "card" && delete o.properties.showLabelType, o;
925
+ }
926
+ /**
927
+ * 校验控件是否支持切换类型
928
+ * @param control 控件
929
+ */
930
+ checkCanChangeControlType(e, t) {
931
+ if (!e.binding)
932
+ return !1;
933
+ if (e.binding.type === "Variable") {
934
+ if (this.bindingVarible = this.formSchemaUtils.getVariableById(e.binding.field), !this.bindingVarible)
935
+ return !1;
936
+ } else if (!this.designViewModelField || this.designViewModelField.$type !== k.SimpleField)
937
+ return !1;
938
+ return !0;
939
+ }
940
+ /**
941
+ * 获取可选的编辑器类型
942
+ */
943
+ getAvailableEditorType(e) {
944
+ var s;
945
+ const t = this.checkCanChangeControlType(e, this.viewModelId);
946
+ if (!t)
947
+ return {
948
+ canChangeControlType: !1,
949
+ editorTypeList: [{
950
+ key: e.editor.type,
951
+ value: ((s = a[e.editor.type]) == null ? void 0 : s.name) || e.editor.type
952
+ }]
953
+ };
954
+ let i = [];
955
+ return this.designViewModelField && this.designViewModelField.$type === k.SimpleField ? i = P.getEditorTypesByMDataType(this.designViewModelField.type.name, this.designViewModelField.multiLanguage) : this.bindingVarible && (i = P.getEditorTypesByMDataType(this.bindingVarible.type, this.designViewModelField.multiLanguage)), { canChangeControlType: t, editorTypeList: i };
956
+ }
957
+ changeBindingField(e, t, i) {
958
+ t.needRefreshEntityTree = !0;
959
+ }
960
+ getAppearanceProperties(e, t) {
961
+ const i = this;
962
+ return {
963
+ title: "外观",
964
+ description: "Appearance",
965
+ properties: {
966
+ class: {
967
+ title: "class样式",
968
+ type: "string",
969
+ description: "组件的CSS样式",
970
+ $converter: "/converter/appearance.converter",
971
+ parentPropertyID: "appearance"
972
+ },
973
+ style: {
974
+ title: "style样式",
975
+ type: "string",
976
+ description: "组件的内联样式",
977
+ $converter: "/converter/appearance.converter",
978
+ parentPropertyID: "appearance"
979
+ },
980
+ fill: {
981
+ title: "填充宽度",
982
+ description: "启用后,控件占满父容器宽度",
983
+ type: "boolean",
984
+ parentPropertyID: "appearance"
985
+ },
986
+ responseLayout: {
987
+ description: "响应式列宽",
988
+ title: "响应式列宽",
989
+ type: "boolean",
990
+ visible: !0,
991
+ // 这个属性,标记当属性变更得时候触发重新更新属性
992
+ refreshPanelAfterChanged: !0,
993
+ editor: {
994
+ type: "response-layout-editor-setting",
995
+ beforeOpen: () => i.responseLayoutEditorFunction.checkCanOpenLayoutEditor(e, i.componentId)
996
+ }
997
+ }
998
+ },
999
+ setPropertyRelates(s, r) {
1000
+ if (s)
1001
+ switch (s && s.propertyID) {
1002
+ case "responseLayout":
1003
+ i.responseLayoutEditorFunction.changeFormControlsByResponseLayoutConfig(s.propertyValue, i.componentId || e.id), i.updateUnifiedLayoutAfterResponseLayoutChanged(i.componentId), i.updateElementByParentContainer(e.id, t), delete e.responseLayout;
1004
+ break;
1005
+ case "class":
1006
+ i.updateUnifiedLayoutAfterControlChanged(s.propertyValue, e.id, this.componentId), M.value++;
1007
+ break;
1008
+ case "style": {
1009
+ M.value++;
1010
+ break;
1011
+ }
1012
+ }
1013
+ }
1014
+ };
1015
+ }
1016
+ getEditorProperties(e) {
1017
+ return this.getComponentConfig(e);
1018
+ }
1019
+ /**
1020
+ * 卡片控件:切换控件类型后事件
1021
+ * @param propertyData 控件DOM属性
1022
+ * @param newControlType 新控件类型
1023
+ */
1024
+ changeControlType(e, t, i) {
1025
+ const s = t.propertyValue, r = i && i.parent && i.parent.schema;
1026
+ if (!r)
1027
+ return;
1028
+ const d = r.contents.findIndex((c) => c.id === e.id);
1029
+ if (d === -1)
1030
+ return;
1031
+ const o = r.contents[d];
1032
+ let u;
1033
+ if (this.designViewModelField) {
1034
+ const m = this.formSchemaUtils.getViewModelById(this.viewModelId).fields.find((p) => p.id === this.designViewModelField.id).fieldSchema || {};
1035
+ m.editor || (m.editor = {}), m.editor.$type = s, this.designViewModelUtils.getDgViewModel(this.viewModelId).changeField(this.designViewModelField.id, m, !1), u = this.controlCreatorUtils.setFormFieldProperty(this.designViewModelField, s);
1036
+ }
1037
+ u || (u = this.controlCreatorUtils.createFormGroupWithoutField(s)), Object.assign(u, {
1038
+ id: o.id,
1039
+ appearance: o.appearance,
1040
+ size: o.size,
1041
+ label: o.label,
1042
+ binding: o.binding
1043
+ }), Object.prototype.hasOwnProperty.call(o, "visible") && Object.assign(u, { visible: o.visible }), o.editor && ["readonly", "required", "placeholder"].map((c) => {
1044
+ Object.prototype.hasOwnProperty.call(o.editor, c) && (u.editor[c] = o.editor[c]);
1045
+ }), i != null && i.updateContextSchema ? i.updateContextSchema(u) : (i.schema = Object.assign(o, u), Object.assign(e, u)), Array.from(document.getElementsByClassName("dgComponentSelected")).forEach(
1046
+ (c) => c.classList.remove("dgComponentSelected")
1047
+ ), Array.from(document.getElementsByClassName("dgComponentFocused")).forEach(
1048
+ (c) => c.classList.remove("dgComponentFocused")
1049
+ ), M.value++, $(() => {
1050
+ this.getFormDesignerInstance().reloadPropertyPanel();
1051
+ });
1052
+ }
1053
+ getComponentConfig(e, t = {}, i = {}, s) {
1054
+ var m, g;
1055
+ const r = Object.assign({
1056
+ description: "编辑器",
1057
+ title: "编辑器",
1058
+ type: "input-group",
1059
+ $converter: "/converter/property-editor.converter",
1060
+ parentPropertyID: "editor"
1061
+ }, t), d = (m = e.binding) != null && m.field ? [] : ["Const", "Variable", "StateMachine"], o = this.getPropertyEditorParams(e, d, "readonly"), u = this.getPropertyEditorParams(e, d, "required"), c = {
1062
+ readonly: {
1063
+ description: "",
1064
+ title: "只读",
1065
+ editor: o
1066
+ },
1067
+ required: {
1068
+ description: "",
1069
+ title: "必填",
1070
+ type: "boolean",
1071
+ editor: u,
1072
+ visible: !!((g = e.binding) != null && g.field)
1073
+ },
1074
+ placeholder: {
1075
+ description: "当控件没有值时在输入框中显示的文本",
1076
+ title: "提示文本",
1077
+ type: "string"
1078
+ }
1079
+ };
1080
+ for (const p in i)
1081
+ c[p] = Object.assign(c[p] || {}, i[p]);
1082
+ const l = this;
1083
+ return {
1084
+ ...r,
1085
+ properties: { ...c },
1086
+ setPropertyRelates(p, h) {
1087
+ if (p) {
1088
+ switch (p.propertyID) {
1089
+ case "readonly":
1090
+ case "required":
1091
+ l.afterMutilEditorChanged(e, p);
1092
+ break;
1093
+ }
1094
+ s && s.bind(l)(p, e, h);
1095
+ }
1096
+ }
1097
+ };
1098
+ }
1099
+ /**
1100
+ * 修改某一输入控件的样式后更新Form的统一布局配置
1101
+ * @param controlClass 控件样式
1102
+ * @param controlId 控件Id
1103
+ * @param componentId 控件所在组件id
1104
+ */
1105
+ updateUnifiedLayoutAfterControlChanged(e, t, i) {
1106
+ const s = e.split(" ");
1107
+ let r = s.find((l) => /^col-([1-9]|10|11|12)$/.test(l)), d = s.find((l) => /^col-md-([1-9]|10|11|12)$/.test(l)), o = s.find((l) => /^col-xl-([1-9]|10|11|12)$/.test(l)), u = s.find((l) => /^col-el-([1-9]|10|11|12)$/.test(l));
1108
+ r = r || "col-12", d = d || "col-md-" + r.replace("col-", ""), o = o || "col-xl-" + d.replace("col-md-", ""), u = u || "col-el-" + o.replace("col-xl-", "");
1109
+ const c = {
1110
+ id: t,
1111
+ columnInSM: parseInt(r.replace("col-", ""), 10),
1112
+ columnInMD: parseInt(d.replace("col-md-", ""), 10),
1113
+ columnInLG: parseInt(o.replace("col-xl-", ""), 10),
1114
+ columnInEL: parseInt(u.replace("col-el-", ""), 10)
1115
+ };
1116
+ this.updateUnifiedLayoutAfterResponseLayoutChanged(i, c);
1117
+ }
1118
+ /**
1119
+ * 修改控件布局配置后更新Form统一布局配置
1120
+ * @param componentId 组件Id
1121
+ * @param controlLayoutConfig 某单独变动的控件配置项,FormResponseLayoutContext类型
1122
+ */
1123
+ updateUnifiedLayoutAfterResponseLayoutChanged(e, t) {
1124
+ const { formNode: i } = this.responseLayoutEditorFunction.checkCanFindFormNode(e);
1125
+ if (!i || !i.unifiedLayout)
1126
+ return;
1127
+ const s = [];
1128
+ if (this.responseLayoutEditorFunction.getResonseFormLayoutConfig(i, s, 1), t) {
1129
+ const p = s.find((h) => h.id === t.id);
1130
+ Object.assign(p || {}, t);
1131
+ }
1132
+ const r = s.map((p) => p.columnInSM), d = s.map((p) => p.columnInMD), o = s.map((p) => p.columnInLG), u = s.map((p) => p.columnInEL), c = this.checkIsUniqueColumn(r) ? r[0] : null, l = this.checkIsUniqueColumn(d) ? d[0] : null, m = this.checkIsUniqueColumn(o) ? o[0] : null, g = this.checkIsUniqueColumn(u) ? u[0] : null;
1133
+ Object.assign(i.unifiedLayout, {
1134
+ uniqueColClassInSM: c,
1135
+ uniqueColClassInMD: l,
1136
+ uniqueColClassInLG: m,
1137
+ uniqueColClassInEL: g
1138
+ });
1139
+ }
1140
+ /**
1141
+ * 校验宽度样式值是否一致
1142
+ */
1143
+ checkIsUniqueColumn(e) {
1144
+ const t = new Set(e);
1145
+ return Array.from(t).length === 1;
1146
+ }
1147
+ /**
1148
+ * 枚举项编辑器
1149
+ * @param propertyData
1150
+ * @param valueField
1151
+ * @param textField
1152
+ * @returns
1153
+ */
1154
+ getItemCollectionEditor(e, t, i) {
1155
+ return t = t || "value", i = i || "name", {
1156
+ editor: {
1157
+ columns: [
1158
+ { field: t, title: "值", dataType: "string" },
1159
+ { field: i, title: "名称", dataType: "string" }
1160
+ // { field: 'disabled', title: '禁用', dataType: 'boolean', editor: { type: 'switch' } },
1161
+ ],
1162
+ type: "item-collection-editor",
1163
+ valueField: t,
1164
+ nameField: i,
1165
+ requiredFields: [t, i],
1166
+ uniqueFields: [t, i],
1167
+ readonly: this.checkEnumDataReadonly(e)
1168
+ }
1169
+ };
1170
+ }
1171
+ /**
1172
+ * 判断枚举数据是否只读
1173
+ * 1、没有绑定信息或者绑定变量,可以新增、删除、修改
1174
+ * 2、绑定类型为字段,且字段为枚举字段,则不可新增、删除、修改枚举值。只能从be修改然后同步到表单上。
1175
+ * @param propertyData 下拉框控件属性值
1176
+ */
1177
+ checkEnumDataReadonly(e) {
1178
+ return !e.binding || e.binding.type !== "Form" ? !1 : !!(this.designViewModelField && this.designViewModelField.type && this.designViewModelField.type.$type === z.EnumType);
1179
+ }
1180
+ /**
1181
+ * 将字段值变化前事件、变化后事件追加到交互面板
1182
+ * 注意:因为绑定字段值变化后事件与下拉框的值变化事件(valueChanged)重名,所以这里将事件label都重命名下
1183
+ */
1184
+ appendFieldValueChangeEvents(e, t) {
1185
+ e.binding && e.binding.type === x.Form && e.binding.field ? (t.find((i) => i.label === "fieldValueChanging"), t.find((i) => i.label === "fieldValueChanged"), this.designViewModelField && (e.fieldValueChanging = this.designViewModelField.valueChanging, e.fieldValueChanged = this.designViewModelField.valueChanged)) : t = t.filter((i) => i.label !== "fieldValueChanging" && i.label !== "fieldValueChanged");
1186
+ }
1187
+ getControlMethodType(e) {
1188
+ if (!e.binding)
1189
+ return e.type;
1190
+ switch (e.binding.type) {
1191
+ case x.Form:
1192
+ return e.binding.path || e.type;
1193
+ case x.Variable:
1194
+ return e.binding.fullPath || e.type;
1195
+ }
1196
+ return e.type;
1197
+ }
1198
+ /**
1199
+ * 组装输入类控件的交互面板:包含标签超链、绑定字段值变化前后事件等。
1200
+ * @param propertyData 属性值
1201
+ * @param viewModelId 视图模型id
1202
+ * @param showPosition 面板展示位置
1203
+ * @param customEvent 输入控件特有的事件配置
1204
+ */
1205
+ getEventPropertyConfig(e, t = "card", i, s) {
1206
+ const r = this;
1207
+ let d = [];
1208
+ if (i && (d = d.concat(i)), d.length === 0)
1209
+ return {
1210
+ title: "事件",
1211
+ hideTitle: !0,
1212
+ properties: {},
1213
+ tabId: "commands",
1214
+ tabName: "交互",
1215
+ hide: !0
1216
+ };
1217
+ this.appendFieldValueChangeEvents(e, d);
1218
+ const o = r.eventsEditorUtils.formProperties(e, r.viewModelId, d);
1219
+ return {
1220
+ title: "事件",
1221
+ hideTitle: !0,
1222
+ properties: r.createBaseEventProperty(o),
1223
+ tabId: "commands",
1224
+ tabName: "交互",
1225
+ setPropertyRelates(l, m) {
1226
+ const g = l.propertyValue;
1227
+ delete e[r.viewModelId], g && (g.setPropertyRelates = this.setPropertyRelates, g.controlInfo = { type: r.getControlMethodType(e), name: e.title }, r.eventsEditorUtils.saveRelatedParameters(e, r.viewModelId, g.events, g)), s && s(l, m, g);
1228
+ const p = r.designViewModelUtils.getDgViewModel(r.viewModelId);
1229
+ p && r.designViewModelField && p.changeField(r.designViewModelField.id, { valueChanging: e.fieldValueChanging, valueChanged: e.fieldValueChanged });
1230
+ }
1231
+ };
1232
+ }
1233
+ getExpressionConfig(e, t, i = ["compute", "dependency", "validate"], s) {
1234
+ return new U(this.formSchemaUtils).getExpressionConfig(
1235
+ e,
1236
+ t,
1237
+ i,
1238
+ s
1239
+ );
1240
+ }
1241
+ getBindingDataType() {
1242
+ return this.designViewModelField ? this.designViewModelField.type.name === "Number" ? "number" : this.designViewModelField.type.name === "String" ? "string" : "boolean" : "boolean";
1243
+ }
1244
+ getEditor() {
1245
+ return this.getBindingDataType() === "number" ? this.numberEditorOptions : {};
1246
+ }
1247
+ updatePropertyValue(e, t, i) {
1248
+ var s;
1249
+ e.editor[t] !== i ? e.editor[t] = i : (s = this.getFormDesignerInstance()) == null || s.reloadPropertyPanel();
1250
+ }
1251
+ setBooleanValue(e, t, i) {
1252
+ let s = i;
1253
+ this.getBindingDataType() === "string" && (s = (s || "").trim() || (t === "trueValue" ? "true" : "false"));
1254
+ const d = t === "trueValue" ? "falseValue" : "trueValue";
1255
+ e.editor[d] === s && (s = s + 1), this.updatePropertyValue(e, t, s);
1256
+ }
1257
+ getBooleanValueConverter() {
1258
+ return {
1259
+ convertFrom: (e, t) => e.editor[t],
1260
+ convertTo: (e, t, i) => {
1261
+ this.setBooleanValue(e, t, i);
1262
+ }
1263
+ };
1264
+ }
1265
+ }
1266
+ class ae extends oe {
1267
+ constructor(n, e) {
1268
+ super(n, e);
1269
+ }
1270
+ getEditorProperties(n) {
38
1271
  return {
39
1272
  description: "编辑器",
40
1273
  title: "编辑器",
@@ -66,74 +1299,74 @@ class S extends D {
66
1299
  };
67
1300
  }
68
1301
  }
69
- function j(e, t) {
70
- const a = e.schema;
71
- function r(n, o) {
72
- return new S(n, t).getPropertyConfig(a, o);
1302
+ function le(f, n) {
1303
+ const e = f.schema;
1304
+ function t(i, s) {
1305
+ return new ae(i, n).getPropertyConfig(e, s);
73
1306
  }
74
1307
  return {
75
- getPropsConfig: r
1308
+ getPropsConfig: t
76
1309
  };
77
1310
  }
78
- const p = /* @__PURE__ */ q({
1311
+ const S = /* @__PURE__ */ J({
79
1312
  name: "FAvatarDesign",
80
- props: H,
1313
+ props: N,
81
1314
  emits: ["change", "update:modelValue"],
82
- setup(e, t) {
83
- const a = u(), r = C("designer-host-service"), n = C("design-item-context"), o = j(n, r), i = x(a, n, o);
84
- I(() => {
85
- a.value.componentInstance = i;
86
- }), t.expose(i.value);
87
- const g = l(() => ({
1315
+ setup(f, n) {
1316
+ const e = V(), t = B("designer-host-service"), i = B("design-item-context"), s = le(i, t), r = _(e, i, s);
1317
+ X(() => {
1318
+ e.value.componentInstance = r;
1319
+ }), n.expose(r.value);
1320
+ const d = F(() => ({
88
1321
  "f-avatar": !0,
89
- "f-avatar-readonly": e.readonly,
90
- "f-avatar-circle": e.shape === "circle",
91
- "f-avatar-square": e.shape === "square"
92
- })), f = u(e.modelValue), v = l(() => ({
93
- width: e.avatarWidth + "px",
94
- height: e.avatarHeight + "px"
95
- })), y = !1;
96
- function m() {
1322
+ "f-avatar-readonly": f.readonly,
1323
+ "f-avatar-circle": f.shape === "circle",
1324
+ "f-avatar-square": f.shape === "square"
1325
+ })), o = V(f.modelValue), u = F(() => ({
1326
+ width: f.avatarWidth + "px",
1327
+ height: f.avatarHeight + "px"
1328
+ })), c = !1;
1329
+ function l() {
97
1330
  return "";
98
1331
  }
99
- function B() {
1332
+ function m() {
100
1333
  }
101
- const A = u(null), {
102
- acceptTypes: d,
103
- imageSource: s,
104
- onClickImage: R
105
- } = E(e, t, A, f);
106
- return () => c("div", {
107
- ref: a,
108
- class: g.value,
109
- style: v.value,
110
- onClick: R
111
- }, [y, c("img", {
112
- title: e.title,
1334
+ const g = V(null), {
1335
+ acceptTypes: p,
1336
+ imageSource: h,
1337
+ onClickImage: A
1338
+ } = te(f, n, g, o);
1339
+ return () => E("div", {
1340
+ ref: e,
1341
+ class: d.value,
1342
+ style: u.value,
1343
+ onClick: A
1344
+ }, [c, E("img", {
1345
+ title: f.title,
113
1346
  class: "f-avatar-image",
114
- src: s.value,
115
- onError: m
116
- }, null), !e.readonly && c("div", {
1347
+ src: h.value,
1348
+ onError: l
1349
+ }, null), !f.readonly && E("div", {
117
1350
  class: "f-avatar-icon"
118
- }, [c("span", {
1351
+ }, [E("span", {
119
1352
  class: "f-icon f-icon-camera"
120
- }, null)]), c("input", {
1353
+ }, null)]), E("input", {
121
1354
  ref: "file",
122
1355
  name: "file-input",
123
1356
  type: "file",
124
1357
  class: "f-avatar-upload",
125
- accept: d.value,
126
- onChange: B,
1358
+ accept: p.value,
1359
+ onChange: m,
127
1360
  style: "display: none;"
128
1361
  }, null)]);
129
1362
  }
130
1363
  });
131
- function N(e, t, a) {
132
- return t;
1364
+ function de(f, n, e) {
1365
+ return n;
133
1366
  }
134
- const F = /* @__PURE__ */ new Map([
135
- ["appearance", P]
136
- ]), K = "https://json-schema.org/draft/2020-12/schema", W = "https://farris-design.gitee.io/avatar.schema.json", w = "avatar", V = "A Farris Component", G = "object", Z = {
1367
+ const ce = /* @__PURE__ */ new Map([
1368
+ ["appearance", j]
1369
+ ]), ue = "https://json-schema.org/draft/2020-12/schema", pe = "https://farris-design.gitee.io/avatar.schema.json", ge = "avatar", me = "A Farris Component", fe = "object", he = {
137
1370
  id: {
138
1371
  description: "The unique identifier for avatar",
139
1372
  type: "string"
@@ -195,33 +1428,33 @@ const F = /* @__PURE__ */ new Map([
195
1428
  type: "boolean",
196
1429
  default: !0
197
1430
  }
198
- }, O = [
1431
+ }, ye = [
199
1432
  "id",
200
1433
  "type"
201
- ], U = [
1434
+ ], Ae = [
202
1435
  "id",
203
1436
  "appearance",
204
1437
  "binding",
205
1438
  "visible"
206
- ], L = {
207
- $schema: K,
208
- $id: W,
209
- title: w,
210
- description: V,
211
- type: G,
212
- properties: Z,
213
- required: O,
214
- ignore: U
215
- }, h = b(H, L, F, N);
216
- p.register = (e, t, a, r) => {
217
- e.avatar = Q, t.avatar = h;
1439
+ ], ve = {
1440
+ $schema: ue,
1441
+ $id: pe,
1442
+ title: ge,
1443
+ description: me,
1444
+ type: fe,
1445
+ properties: he,
1446
+ required: ye,
1447
+ ignore: Ae
1448
+ }, R = Z(N, ve, ce, de);
1449
+ S.register = (f, n, e, t) => {
1450
+ f.avatar = K, n.avatar = R;
218
1451
  };
219
- p.registerDesigner = (e, t, a) => {
220
- e.avatar = p, t.avatar = h;
1452
+ S.registerDesigner = (f, n, e) => {
1453
+ f.avatar = S, n.avatar = R;
221
1454
  };
222
- const $ = T(p);
1455
+ const Me = D(S);
223
1456
  export {
224
- p as FAvatarDesign,
225
- $ as default,
226
- h as propsResolver
1457
+ S as FAvatarDesign,
1458
+ Me as default,
1459
+ R as propsResolver
227
1460
  };