@farris/ui-vue 1.8.0-alpha.0 → 1.8.0-beta.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.
Files changed (193) hide show
  1. package/components/avatar/index.esm.js +138 -1526
  2. package/components/avatar/index.umd.cjs +1 -6
  3. package/components/button/index.css +1 -1
  4. package/components/button/index.esm.js +15951 -15410
  5. package/components/button/index.umd.cjs +27 -27
  6. package/components/calendar/index.esm.js +269 -255
  7. package/components/calendar/index.umd.cjs +3 -3
  8. package/components/collection-property-editor/index.esm.js +243 -229
  9. package/components/collection-property-editor/index.umd.cjs +2 -2
  10. package/components/combo-list/index.esm.js +32 -32
  11. package/components/combo-list/index.umd.cjs +1 -1
  12. package/components/comment/index.esm.js +473 -456
  13. package/components/comment/index.umd.cjs +6 -6
  14. package/components/component/index.css +1 -1
  15. package/components/component/index.esm.js +2503 -2239
  16. package/components/component/index.umd.cjs +2 -2
  17. package/components/condition/index.esm.js +1064 -954
  18. package/components/condition/index.umd.cjs +2 -2
  19. package/components/data-grid/index.esm.js +1 -1
  20. package/components/data-grid/index.umd.cjs +1 -1
  21. package/components/designer-canvas/index.css +1 -1
  22. package/components/designer-canvas/index.esm.js +3894 -3058
  23. package/components/designer-canvas/index.umd.cjs +1 -1
  24. package/components/drawer/index.esm.js +91 -77
  25. package/components/drawer/index.umd.cjs +2 -2
  26. package/components/dynamic-form/index.esm.js +220 -215
  27. package/components/dynamic-form/index.umd.cjs +1 -1
  28. package/components/dynamic-resolver/index.esm.js +145 -131
  29. package/components/dynamic-resolver/index.umd.cjs +2 -2
  30. package/components/dynamic-view/index.esm.js +336 -329
  31. package/components/dynamic-view/index.umd.cjs +1 -1
  32. package/components/events-editor/index.esm.js +1611 -1536
  33. package/components/events-editor/index.umd.cjs +3 -3
  34. package/components/expression-editor/index.esm.js +219 -219
  35. package/components/expression-editor/index.umd.cjs +2 -2
  36. package/components/external-container/index.esm.js +179 -178
  37. package/components/external-container/index.umd.cjs +1 -1
  38. package/components/fieldset/index.esm.js +285 -221
  39. package/components/fieldset/index.umd.cjs +1 -1
  40. package/components/filter-bar/index.css +1 -0
  41. package/components/filter-bar/index.esm.js +1512 -1290
  42. package/components/filter-bar/index.umd.cjs +7 -7
  43. package/components/filter-condition-editor/index.esm.js +851 -831
  44. package/components/filter-condition-editor/index.umd.cjs +3 -3
  45. package/components/flow-canvas/index.esm.js +520 -501
  46. package/components/flow-canvas/index.umd.cjs +8 -8
  47. package/components/image/index.esm.js +101 -79
  48. package/components/image/index.umd.cjs +3 -3
  49. package/components/language-textbox/index.esm.js +330 -251
  50. package/components/language-textbox/index.umd.cjs +2 -2
  51. package/components/list-nav/index.esm.js +399 -313
  52. package/components/list-nav/index.umd.cjs +1 -1
  53. package/components/locale/index.esm.js +3 -0
  54. package/components/locale/index.umd.cjs +1 -1
  55. package/components/lookup/index.esm.js +997 -976
  56. package/components/lookup/index.umd.cjs +2 -2
  57. package/components/mapping-editor/index.esm.js +725 -705
  58. package/components/mapping-editor/index.umd.cjs +1 -1
  59. package/components/message-box/index.esm.js +542 -522
  60. package/components/message-box/index.umd.cjs +1 -1
  61. package/components/nav/index.esm.js +95 -308
  62. package/components/nav/index.umd.cjs +1 -1
  63. package/components/number-range/index.esm.js +115 -107
  64. package/components/number-range/index.umd.cjs +2 -2
  65. package/components/order/index.esm.js +56 -54
  66. package/components/order/index.umd.cjs +1 -1
  67. package/components/page-footer/index.esm.js +135 -123
  68. package/components/page-footer/index.umd.cjs +1 -1
  69. package/components/page-header/index.esm.js +266 -222
  70. package/components/page-header/index.umd.cjs +1 -1
  71. package/components/property-panel/index.esm.js +402 -375
  72. package/components/property-panel/index.umd.cjs +4 -4
  73. package/components/query-solution/index.esm.js +3171 -3061
  74. package/components/query-solution/index.umd.cjs +7 -7
  75. package/components/response-toolbar/index.esm.js +1 -1
  76. package/components/response-toolbar/index.umd.cjs +1 -1
  77. package/components/schema-selector/index.esm.js +1620 -1608
  78. package/components/schema-selector/index.umd.cjs +5 -5
  79. package/components/scroll-navbar/index.esm.js +150 -136
  80. package/components/scroll-navbar/index.umd.cjs +2 -2
  81. package/components/section/index.esm.js +323 -311
  82. package/components/section/index.umd.cjs +2 -2
  83. package/components/sort-condition-editor/index.esm.js +850 -830
  84. package/components/sort-condition-editor/index.umd.cjs +3 -3
  85. package/components/step/index.esm.js +991 -224
  86. package/components/step/index.umd.cjs +1 -1
  87. package/components/tabs/index.esm.js +356 -334
  88. package/components/tabs/index.umd.cjs +1 -1
  89. package/components/wizard/index.esm.js +159 -162
  90. package/components/wizard/index.umd.cjs +1 -1
  91. package/designer/avatar/index.esm.js +1721 -0
  92. package/designer/avatar/index.umd.cjs +6 -0
  93. package/designer/button-edit/index.esm.js +2 -1
  94. package/designer/button-edit/index.umd.cjs +1 -1
  95. package/designer/data-grid/index.esm.js +693 -659
  96. package/designer/data-grid/index.umd.cjs +6 -6
  97. package/designer/data-view/index.esm.js +90 -78
  98. package/designer/data-view/index.umd.cjs +2 -2
  99. package/designer/date-picker/index.esm.js +203 -203
  100. package/designer/date-picker/index.umd.cjs +1 -1
  101. package/designer/drawer/index.esm.js +181 -167
  102. package/designer/drawer/index.umd.cjs +2 -2
  103. package/designer/dynamic-form/index.esm.js +228 -206
  104. package/designer/dynamic-form/index.umd.cjs +2 -2
  105. package/designer/farris-designer.all.esm.js +10014 -9692
  106. package/designer/farris-designer.all.umd.cjs +18 -18
  107. package/designer/index.css +1 -1
  108. package/designer/input-group/index.esm.js +15 -15
  109. package/designer/input-group/index.umd.cjs +1 -1
  110. package/designer/nav/index.esm.js +1719 -0
  111. package/designer/nav/index.umd.cjs +6 -0
  112. package/designer/number-spinner/index.esm.js +8 -7
  113. package/designer/number-spinner/index.umd.cjs +1 -1
  114. package/designer/radio-group/index.esm.js +133 -125
  115. package/designer/radio-group/index.umd.cjs +2 -2
  116. package/designer/response-toolbar/index.esm.js +864 -863
  117. package/designer/response-toolbar/index.umd.cjs +1 -1
  118. package/designer/section/index.esm.js +245 -183
  119. package/designer/section/index.umd.cjs +1 -1
  120. package/designer/tabs/index.css +1 -1
  121. package/designer/tabs/index.esm.js +3667 -2810
  122. package/designer/tabs/index.umd.cjs +2 -2
  123. package/designer/time-picker/index.esm.js +26 -17
  124. package/designer/time-picker/index.umd.cjs +2 -2
  125. package/designer/tree-grid/index.esm.js +69 -37
  126. package/designer/tree-grid/index.umd.cjs +1 -1
  127. package/designer/wizard/index.esm.js +110 -110
  128. package/designer/wizard/index.umd.cjs +3 -3
  129. package/farris.all.esm.js +39993 -39089
  130. package/farris.all.umd.cjs +36 -36
  131. package/index.css +1 -1
  132. package/locales/filter-bar/ui/en.json +1 -0
  133. package/locales/filter-bar/ui/zh-CHS.json +1 -0
  134. package/locales/filter-bar/ui/zh-CHT.json +1 -0
  135. package/locales/ui/en.json +1 -0
  136. package/locales/ui/zh-CHS.json +1 -0
  137. package/locales/ui/zh-CHT.json +1 -0
  138. package/package.json +1 -1
  139. package/types/avatar/designer.d.ts +28 -0
  140. package/types/avatar/index.d.ts +0 -15
  141. package/types/avatar/src/composition/types.d.ts +3 -0
  142. package/types/avatar/src/composition/use-file.d.ts +19 -0
  143. package/types/avatar/src/composition/use-image.d.ts +1 -1
  144. package/types/avatar/src/designer/avatar.design.props.d.ts +24 -0
  145. package/types/avatar/src/property-config/avatar.property-config.d.ts +11 -13
  146. package/types/avatar/src/schema/schema-mapper.d.ts +2 -0
  147. package/types/components.d.ts +3 -0
  148. package/types/condition/index.d.ts +18 -6
  149. package/types/condition/src/condition-fields.component.d.ts +9 -3
  150. package/types/condition/src/condition-fields.design.component.d.ts +9 -3
  151. package/types/condition/src/condition-list.component.d.ts +9 -3
  152. package/types/condition/src/condition.props.d.ts +11 -0
  153. package/types/data-view/designer/property-config/use-appearance.d.ts +17 -10
  154. package/types/data-view/designer/property-config/use-pagination.d.ts +0 -6
  155. package/types/designer-canvas/src/composition/dg-control.d.ts +13 -0
  156. package/types/dynamic-form/src/component/dynamic-form-label/dynamic-form-label.component.d.ts +3 -0
  157. package/types/dynamic-form/src/component/dynamic-form-label/dynamic-form-label.props.d.ts +4 -0
  158. package/types/dynamic-resolver/src/converter/tree-auto-check.converter.d.ts +3 -0
  159. package/types/dynamic-view/src/components/maps.d.ts +130 -4
  160. package/types/filter-bar/src/composition/types.d.ts +2 -0
  161. package/types/filter-bar/src/filter-bar.props.d.ts +0 -1
  162. package/types/filter-bar/src/locale/locale.d.ts +2 -1
  163. package/types/filter-bar/src/property-config/filter-bar.property-config.d.ts +0 -1
  164. package/types/language-textbox/index.d.ts +65 -2
  165. package/types/language-textbox/src/designer/language-textbox.design.component.d.ts +36 -0
  166. package/types/language-textbox/src/language-textbox.component.d.ts +38 -1
  167. package/types/language-textbox/src/language-textbox.props.d.ts +20 -0
  168. package/types/lookup/src/components/popup-container.component.d.ts +3 -3
  169. package/types/lookup/src/composition/use-compat.d.ts +28 -0
  170. package/types/lookup/src/composition/use-state.d.ts +1 -0
  171. package/types/message-box/src/message-box.service.d.ts +2 -1
  172. package/types/nav/designer.d.ts +28 -0
  173. package/types/nav/index.d.ts +24 -20
  174. package/types/nav/src/designer/nav.design.props.d.ts +29 -0
  175. package/types/nav/src/designer/use-design-rules.d.ts +3 -0
  176. package/types/nav/src/property-config/nav.property-config.d.ts +9 -0
  177. package/types/nav/src/schema/schema-mapper.d.ts +4 -0
  178. package/types/page-footer/src/designer/use-designer-rules.d.ts +2 -2
  179. package/types/page-header/src/designer/use-designer-rules.d.ts +2 -2
  180. package/types/property-panel/src/composition/entity/input-base-property.d.ts +1 -0
  181. package/types/query-solution/src/designer/query-solution-config/composition/use-util.d.ts +1 -1
  182. package/types/query-solution/src/designer/query-solution-config/query-solution-config.props.d.ts +1 -1
  183. package/types/section/src/designer/section.design.props.d.ts +4 -0
  184. package/types/section/src/property-config/section.property-config.d.ts +39 -0
  185. package/types/section/src/schema/toolbar-resolver.d.ts +0 -1
  186. package/types/step/src/designer/use-designer-rules.d.ts +3 -0
  187. package/types/step/src/designer/use-step-creator.d.ts +6 -0
  188. package/types/step/src/property-config/step.property-config.d.ts +15 -0
  189. package/types/step/src/schema/schema-resolver.d.ts +2 -1
  190. package/types/tabs/src/composition/types.d.ts +4 -0
  191. package/types/tabs/src/tabs.props.d.ts +6 -0
  192. package/types/tooltip/index.d.ts +3 -3
  193. package/types/tooltip/src/tooltip.component.d.ts +2 -2
@@ -0,0 +1,1719 @@
1
+ var Z = Object.defineProperty;
2
+ var K = (p, n, e) => n in p ? Z(p, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : p[n] = e;
3
+ var h = (p, n, e) => K(p, typeof n != "symbol" ? n + "" : n, e);
4
+ import { FormSchemaEntityField$Type as L, FormSchemaEntityFieldType$Type as D, getCustomClass as A, getCustomStyle as $, withInstall as ee } from "../../components/common/index.esm.js";
5
+ import { createVNode as b, Fragment as te, createTextVNode as N, nextTick as ie, defineComponent as R, ref as x, inject as U, onMounted as ne, watch as q, computed as M } from "vue";
6
+ import { DgControl as l, canvasChanged as V, refreshCanvas as se, useDesignerComponent as re } from "../../components/designer-canvas/index.esm.js";
7
+ import { cloneDeep as oe } from "lodash-es";
8
+ import { resolveAppearance as G, createPropsResolver as O } from "../../components/dynamic-resolver/index.esm.js";
9
+ function ae(p) {
10
+ const { formSchemaUtils: n, formStateMachineUtils: e } = p;
11
+ function t(o, g = "") {
12
+ return {
13
+ path: g + o.code,
14
+ field: o.id,
15
+ fullPath: o.code
16
+ };
17
+ }
18
+ function i(o, g = "") {
19
+ const d = n.getViewModelById(o);
20
+ return d ? d.states.map((a) => t(a, g)) : [];
21
+ }
22
+ function s(o) {
23
+ const g = n.getRootViewModelId(), d = i(o);
24
+ if (o === g)
25
+ return d;
26
+ const a = i(g, "root-component.");
27
+ return [...d, ...a];
28
+ }
29
+ function r(o) {
30
+ return o.binding && o.binding.path || o.id || "";
31
+ }
32
+ function c() {
33
+ return e && e.getRenderStates() || [];
34
+ }
35
+ return { getVariables: s, getControlName: r, getStateMachines: c };
36
+ }
37
+ class W {
38
+ constructor(n) {
39
+ h(this, "sessionVariables", [
40
+ {
41
+ key: "CurrentSysOrgName",
42
+ name: "当前组织Name",
43
+ description: "当前组织Name"
44
+ },
45
+ // {
46
+ // key: "CurrentSysOrgCode",
47
+ // name: "当前组织Code",
48
+ // description: "当前组织Code"
49
+ // },
50
+ {
51
+ key: "CurrentSysOrgId",
52
+ name: "当前组织Id",
53
+ description: "当前组织Id"
54
+ },
55
+ {
56
+ key: "CurrentUserName",
57
+ name: "当前用户Name",
58
+ description: "当前用户Name"
59
+ },
60
+ {
61
+ key: "CurrentUserCode",
62
+ name: "当前用户Code",
63
+ description: "当前用户Code"
64
+ },
65
+ {
66
+ key: "CurrentUserId",
67
+ name: "当前用户Id",
68
+ description: "当前用户Id"
69
+ },
70
+ {
71
+ key: "CurrentLanguage",
72
+ name: "当前语言编号",
73
+ description: "当前登录的语言编号,例如简体中文返回'zh-CHS',英文返回'en',繁体中文'zh-CHT'"
74
+ }
75
+ ]);
76
+ h(this, "expressionNames", {
77
+ compute: "计算表达式",
78
+ dependency: "依赖表达式",
79
+ validate: "验证表达式",
80
+ dataPicking: "帮助前表达式",
81
+ visible: "可见表达式",
82
+ readonly: "只读表达式",
83
+ required: "必填表达式"
84
+ });
85
+ h(this, "getExpressionConverter", (n, e) => ({
86
+ convertFrom: (t, i, s, r) => {
87
+ const c = s.getExpressionRuleValue(n, e || i);
88
+ return c && c.value || "";
89
+ },
90
+ convertTo: (t, i, s, r, c) => {
91
+ var o;
92
+ if (i === "dataPicking" && (s != null && s.target)) {
93
+ const g = `${s.target}_dataPicking`;
94
+ ((o = s.rules) == null ? void 0 : o.some(
95
+ (a) => a.id === g && a.value
96
+ )) ? t.dictPickingExpressionId = g : delete t.dictPickingExpressionId;
97
+ }
98
+ r.updateExpression(s);
99
+ }
100
+ }));
101
+ this.formSchemaService = n;
102
+ }
103
+ getExpressionRule(n, e) {
104
+ const t = this.formSchemaService.getExpressions();
105
+ if (!t)
106
+ return "";
107
+ const i = t.find((r) => r.target === n);
108
+ if (!i)
109
+ return "";
110
+ const s = i.rules.find((r) => r.type === e);
111
+ return s || "";
112
+ }
113
+ // 获取上下文表单变量
114
+ getContextFormVariables() {
115
+ const { module: n } = this.formSchemaService.getFormSchema();
116
+ if (!n.viewmodels || n.viewmodels.length === 0)
117
+ return [];
118
+ const e = this.formSchemaService.getRootViewModelId(), t = this.formSchemaService.getViewModelById(e);
119
+ if (!t || !t.states || t.states.length === 0)
120
+ return [];
121
+ const i = [];
122
+ return t.states.filter((s) => s.category === "remote").forEach((s) => {
123
+ i.push({
124
+ key: s.code,
125
+ name: s.name,
126
+ description: s.name,
127
+ category: s.category
128
+ });
129
+ }), i;
130
+ }
131
+ createTreeNode(n, e, t = "label") {
132
+ return {
133
+ id: n.id,
134
+ name: n.name,
135
+ bindingPath: n[t],
136
+ parents: e,
137
+ type: "field"
138
+ };
139
+ }
140
+ buildEntityFieldsTreeData(n = null, e) {
141
+ const t = [];
142
+ return n == null || n.forEach((i) => {
143
+ var c;
144
+ const s = this.createTreeNode(i, e);
145
+ let r = [];
146
+ (c = i.type) != null && c.fields && (r = this.buildEntityFieldsTreeData(i.type.fields, [...e, i.label])), t.push({
147
+ data: s,
148
+ children: r,
149
+ expanded: !0
150
+ });
151
+ }), t;
152
+ }
153
+ buildChildEntityTreeData(n = null, e) {
154
+ const t = [];
155
+ return n == null || n.forEach((i) => {
156
+ var o, g;
157
+ const s = this.createTreeNode(i, e);
158
+ s.type = "entity";
159
+ const r = this.buildEntityFieldsTreeData((o = i.type) == null ? void 0 : o.fields, [...e, i.label]), c = this.buildChildEntityTreeData((g = i.type) == null ? void 0 : g.entities, [...e, i.label]);
160
+ c != null && c.length && (r == null || r.push(...c)), t.push({
161
+ data: s,
162
+ children: r || [],
163
+ // 空值回退
164
+ expanded: !0
165
+ });
166
+ }), t;
167
+ }
168
+ getEntitiesTreeData() {
169
+ const n = this.formSchemaService.getSchemaEntities();
170
+ if (!(n != null && n.length))
171
+ return [];
172
+ const e = n[0];
173
+ if (!(e != null && e.type))
174
+ return [];
175
+ const t = this.buildEntityFieldsTreeData(e.type.fields, [e.code]), i = this.buildChildEntityTreeData(e.type.entities, [e.code]);
176
+ return i != null && i.length && (t == null || t.push(...i)), {
177
+ entityCode: e.code,
178
+ fields: [{
179
+ data: this.createTreeNode(e, [], "code"),
180
+ children: t || []
181
+ }]
182
+ };
183
+ }
184
+ getEntitiesAndVariables() {
185
+ return {
186
+ entities: this.getEntitiesTreeData(),
187
+ variables: {
188
+ session: {
189
+ name: "系统变量",
190
+ items: this.sessionVariables,
191
+ visible: !1
192
+ },
193
+ forms: {
194
+ name: "表单变量",
195
+ items: this.getContextFormVariables(),
196
+ visible: !0
197
+ }
198
+ }
199
+ };
200
+ }
201
+ onBeforeOpenExpression(n, e, t) {
202
+ const i = t === "Field" ? n.binding.field : n.id, s = this.getExpressionRule(i, e), r = this.getEntitiesAndVariables(), c = {
203
+ message: ["validate", "required", "dataPicking"].includes(e) && s ? s.message : "",
204
+ ...r
205
+ };
206
+ return s.messageType != null && (c.messageType = s.messageType), c;
207
+ }
208
+ buildRule(n, e, t, i) {
209
+ const { expression: s, message: r, messageType: c } = e, o = {
210
+ id: `${n}_${t}`,
211
+ type: t,
212
+ value: s
213
+ };
214
+ return (t === "validate" || t === "dataPicking" || t === "required") && (o.message = r), t === "dataPicking" && (o.messageType = c), t === "validate" && i && (o.elementId = i), o;
215
+ }
216
+ getExpressionData() {
217
+ const { expressions: n } = this.formSchemaService.getFormSchema().module;
218
+ return n || [];
219
+ }
220
+ updateExpression(n, e, t, i) {
221
+ const s = e === "Field" ? n.binding.field : n.id, r = this.buildRule(s, t, i, n.type === "form-group" ? n.id : "");
222
+ let o = this.getExpressionData().find((d) => d.targetType === e && d.target === s);
223
+ const g = (d) => d.value.trim() === "";
224
+ if (o) {
225
+ const d = o.rules.find((a) => a.id === r.id);
226
+ if (d)
227
+ g(r) ? o.rules = o.rules.filter((a) => a.id !== r.id) : (Object.assign(d, r), i === "validate" && n.type === "form-group" && (d.elementId = n.id));
228
+ else {
229
+ if (g(r))
230
+ return null;
231
+ o.rules = o.rules || [], o.rules.push(r);
232
+ }
233
+ } else {
234
+ if (g(r))
235
+ return null;
236
+ o = {
237
+ target: `${s}`,
238
+ rules: [r],
239
+ targetType: e
240
+ };
241
+ }
242
+ return o;
243
+ }
244
+ getExpressionEditorOptions(n, e, t, i) {
245
+ return t.reduce((s, r) => {
246
+ var o, g;
247
+ const c = e === "Field" ? (o = n == null ? void 0 : n.binding) == null ? void 0 : o.field : n.id;
248
+ return s[r] = {
249
+ hide: e === "Field" ? !!((g = n == null ? void 0 : n.binding) != null && g.field) : !1,
250
+ description: "",
251
+ title: this.expressionNames[r],
252
+ type: "string",
253
+ $converter: this.getExpressionConverter(c),
254
+ refreshPanelAfterChanged: !0,
255
+ editor: {
256
+ type: "expression-editor",
257
+ singleExpand: !1,
258
+ dialogTitle: `${this.expressionNames[r]}编辑器`,
259
+ showMessage: r === "validate" || r === "dataPicking" || r === "required",
260
+ showMessageType: r === "dataPicking",
261
+ beforeOpen: () => this.onBeforeOpenExpression(n, r, e),
262
+ onSubmitModal: (d) => {
263
+ const a = this.updateExpression(n, e, d, r);
264
+ if (i) {
265
+ const m = this.buildRule(c, d, r);
266
+ i(m);
267
+ }
268
+ return a;
269
+ }
270
+ }
271
+ }, s;
272
+ }, {});
273
+ }
274
+ getExpressionInfo(n, e, t) {
275
+ const i = e === "Field" ? n.binding.field : n.id, s = this.getExpressionRule(i, t), r = {
276
+ value: s && s.value,
277
+ targetId: i,
278
+ targetType: e,
279
+ expressionType: t
280
+ };
281
+ return s && s.message && (r.message = s.message), r;
282
+ }
283
+ getExpressionConfig(n, e, t = ["compute", "dependency", "validate"], i) {
284
+ return {
285
+ description: "表达式",
286
+ title: "表达式",
287
+ hide: !n.binding,
288
+ properties: {
289
+ ...this.getExpressionEditorOptions(n, e, t, i)
290
+ }
291
+ };
292
+ }
293
+ getExpressionOptions(n, e, t) {
294
+ const i = this.getExpressionInfo(n, e, t);
295
+ return {
296
+ dialogTitle: `${this.expressionNames[t]}编辑器`,
297
+ singleExpand: !1,
298
+ showMessage: t === "required",
299
+ beforeOpen: () => this.onBeforeOpenExpression(n, t, e),
300
+ expressionInfo: i
301
+ };
302
+ }
303
+ }
304
+ class le {
305
+ constructor(n, e) {
306
+ h(this, "componentId");
307
+ h(this, "viewModelId");
308
+ h(this, "eventsEditorUtils");
309
+ h(this, "formSchemaUtils");
310
+ h(this, "formMetadataConverter");
311
+ h(this, "designViewModelUtils");
312
+ h(this, "designViewModelField");
313
+ h(this, "controlCreatorUtils");
314
+ h(this, "designerHostService");
315
+ h(this, "designerContext");
316
+ h(this, "schemaService", null);
317
+ h(this, "metadataService", null);
318
+ h(this, "propertyConfig", {
319
+ type: "object",
320
+ categories: {}
321
+ });
322
+ var t;
323
+ 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;
324
+ }
325
+ getFormDesignerInstance() {
326
+ var n, e;
327
+ return (e = (n = this.designerContext) == null ? void 0 : n.instances) == null ? void 0 : e.formDesigner.value;
328
+ }
329
+ getTableInfo() {
330
+ var n;
331
+ return (n = this.schemaService) == null ? void 0 : n.getTableInfoByViewModelId(this.viewModelId);
332
+ }
333
+ setDesignViewModelField(n) {
334
+ var t;
335
+ const e = n.binding && n.binding.type === "Form" && n.binding.field;
336
+ if (e) {
337
+ if (!this.designViewModelField) {
338
+ const i = this.designViewModelUtils.getDgViewModel(this.viewModelId);
339
+ this.designViewModelField = i.fields.find((s) => s.id === e);
340
+ }
341
+ n.updateOn = (t = this.designViewModelField) == null ? void 0 : t.updateOn;
342
+ }
343
+ }
344
+ getBasicPropConfig(n) {
345
+ return {
346
+ description: "Basic Information",
347
+ title: "基本信息",
348
+ properties: {
349
+ id: {
350
+ description: "组件标识",
351
+ title: "标识",
352
+ type: "string",
353
+ readonly: !0
354
+ },
355
+ type: {
356
+ description: "组件类型",
357
+ title: "控件类型",
358
+ type: "select",
359
+ editor: {
360
+ type: "combo-list",
361
+ textField: "name",
362
+ valueField: "value",
363
+ idField: "value",
364
+ editable: !1,
365
+ data: [{ value: n.type, name: l[n.type] && l[n.type].name }]
366
+ }
367
+ }
368
+ }
369
+ };
370
+ }
371
+ getAppearanceConfig(n = null, e = {}, t) {
372
+ const i = {
373
+ title: "外观",
374
+ description: "Appearance"
375
+ }, s = {
376
+ class: {
377
+ title: "class样式",
378
+ type: "string",
379
+ description: "组件的CSS样式",
380
+ $converter: "/converter/appearance.converter",
381
+ parentPropertyID: "appearance"
382
+ },
383
+ style: {
384
+ title: "style样式",
385
+ type: "string",
386
+ description: "组件的样式",
387
+ $converter: "/converter/appearance.converter",
388
+ parentPropertyID: "appearance"
389
+ }
390
+ };
391
+ for (const r in e)
392
+ s[r] = Object.assign(s[r] || {}, e[r]);
393
+ return {
394
+ ...i,
395
+ properties: { ...s },
396
+ setPropertyRelates(r, c) {
397
+ if (r) {
398
+ switch (r && r.propertyID) {
399
+ case "class":
400
+ case "style": {
401
+ V.value++;
402
+ break;
403
+ }
404
+ }
405
+ t && t(r, n, c);
406
+ }
407
+ }
408
+ };
409
+ }
410
+ /**
411
+ *
412
+ * @param propertyData
413
+ * @param propertyTypes
414
+ * @param propertyName
415
+ * @param constInfos
416
+ * @param variableInfos
417
+ * @param expressionType 指定表达式类型,存在属性和表达式类型不一致的情况
418
+ * @returns
419
+ */
420
+ getPropertyEditorParams(n, e = [], t = "visible", i = {}, s = {}, r = "") {
421
+ const { getVariables: c, getControlName: o, getStateMachines: g } = ae(this.designerHostService), d = this.getRealTargetType(n), a = e && e.length > 0 ? e : ["Const", "Variable", "StateMachine", "Expression"], m = {
422
+ type: "property-editor",
423
+ propertyTypes: a
424
+ };
425
+ return a.map((y) => {
426
+ switch (y) {
427
+ case "Const":
428
+ Object.assign(m, {
429
+ constType: "enum",
430
+ constEnums: [{ id: !0, name: "是" }, { id: !1, name: "否" }]
431
+ }, i);
432
+ break;
433
+ case "Expression":
434
+ m.expressionConfig = this.getExpressionOptions(n, d, r || t);
435
+ break;
436
+ case "StateMachine":
437
+ m.stateMachines = g();
438
+ break;
439
+ case "Variable":
440
+ Object.assign(m, {
441
+ controlName: o(n),
442
+ newVariablePrefix: "is",
443
+ newVariableType: "Boolean",
444
+ variables: c(this.viewModelId),
445
+ parentComponentId: this.componentId === "root-component" ? "" : "root-component",
446
+ onBeforeOpenVariables: (u) => {
447
+ u.value = c(this.viewModelId);
448
+ }
449
+ }, s), this.designerContext.designerMode === "PC_RTC" && (m.newVariablePrefix = "ext_" + m.newVariablePrefix);
450
+ break;
451
+ }
452
+ }), m;
453
+ }
454
+ getVisibleProperty(n, e = "") {
455
+ var s;
456
+ let t = ["Const", "Variable", "StateMachine", "Expression"];
457
+ return e === "gridFieldEditor" ? t = ["Const", "Expression"] : e === "form-group" && !((s = n.binding) != null && s.field) ? t = ["Const", "Variable", "StateMachine"] : (e === "dataGrid" || e === "treeGrid" || e === "wizard") && (t = ["Const", "Variable", "Expression"]), {
458
+ visible: {
459
+ title: "是否可见",
460
+ type: "boolean",
461
+ description: "运行时组件是否可见",
462
+ editor: this.getPropertyEditorParams(n, t, "visible")
463
+ }
464
+ };
465
+ }
466
+ /**
467
+ * 获取行为
468
+ * @param propertyData
469
+ * @param viewModelId
470
+ * @returns
471
+ */
472
+ getBehaviorConfig(n, e = "", t = {}, i) {
473
+ const s = {
474
+ title: "行为",
475
+ description: ""
476
+ }, r = this.getVisibleProperty(n, e);
477
+ for (const o in t)
478
+ r[o] = Object.assign(r[o] || {}, t[o]);
479
+ const c = this;
480
+ return {
481
+ ...s,
482
+ properties: { ...r },
483
+ setPropertyRelates(o, g) {
484
+ if (o) {
485
+ switch (o.propertyID) {
486
+ case "disabled":
487
+ case "readonly":
488
+ case "visible":
489
+ c.afterMutilEditorChanged(n, o);
490
+ break;
491
+ }
492
+ i && i(o, g);
493
+ }
494
+ }
495
+ };
496
+ }
497
+ /**
498
+ * 当多值编辑器变更时
499
+ * @param propertyData
500
+ * @param changeObject
501
+ */
502
+ afterMutilEditorChanged(n, e) {
503
+ this.addNewVariableToViewModel(e, this.viewModelId), this.updateExpressionValue(e), this.clearExpression(e, n);
504
+ }
505
+ /**
506
+ *
507
+ * @param propertyId
508
+ * @param componentInstance
509
+ * @returns
510
+ */
511
+ updateElementByParentContainer(n, e) {
512
+ const t = e && e.parent && e.parent.schema;
513
+ if (!t)
514
+ return;
515
+ const i = t.contents.findIndex((r) => r.id === n), s = oe(t.contents[i]);
516
+ t.contents.splice(i, 1), t.contents.splice(i, 0, s), se();
517
+ }
518
+ /**
519
+ * 属性编辑器,在编辑过程中会新增变量,此处需要将新增的变量追加到ViewModel中
520
+ * @param changeObject
521
+ * @param viewModelId
522
+ * @returns
523
+ */
524
+ addNewVariableToViewModel(n, e) {
525
+ const t = n.propertyValue;
526
+ if (!(t && typeof t == "object") || !(t.type === "Variable" && t.isNewVariable))
527
+ return;
528
+ const r = {
529
+ id: t.field,
530
+ category: "locale",
531
+ code: t.fullPath,
532
+ name: t.fullPath,
533
+ type: t.newVariableType || "String",
534
+ isRtcVariable: this.designerContext.designerMode === "PC_RTC" ? !0 : void 0
535
+ };
536
+ delete t.newVariableType, delete t.isNewVariable, this.formSchemaUtils.getVariableByCode(r.code) || this.formSchemaUtils.getViewModelById("root-viewmodel").states.push(r);
537
+ }
538
+ /**
539
+ * 更新表达式到expressions节点
540
+ * @param changeObject
541
+ */
542
+ updateExpressionValue(n) {
543
+ const e = n.propertyValue;
544
+ if (!((e && e.type) === "Expression" && e.expressionInfo))
545
+ return;
546
+ const { expressionId: s, expressionInfo: r } = e, { targetId: c, targetType: o, expressionType: g, value: d, message: a } = r, m = this.formSchemaUtils.getModule();
547
+ m.expressions = m.expressions || [];
548
+ const { expressions: y } = m;
549
+ let u = y.find((v) => v.target === c);
550
+ u || (u = { target: c, rules: [], targetType: o }, y.push(u));
551
+ const f = u.rules.find((v) => v.type === g);
552
+ if (f)
553
+ f.value = d, f.message = a;
554
+ else {
555
+ const v = { id: s, type: g, value: d, message: a };
556
+ u.rules.push(v);
557
+ }
558
+ delete e.expressionInfo;
559
+ }
560
+ /**
561
+ * 属性类型切换为非表达式后,清除原表达式
562
+ * @param changeObject
563
+ * @param propertyData
564
+ * @returns
565
+ */
566
+ clearExpression(n, e) {
567
+ const t = n.propertyValue;
568
+ if (t && t.type === "Expression")
569
+ return;
570
+ const s = n.propertyID, r = this.formSchemaUtils.getExpressions(), c = e.binding ? e.binding.field : e.id, o = r.find((g) => g.target === c);
571
+ !o || !o.rules || (o.rules = o.rules.filter((g) => g.type !== s));
572
+ }
573
+ getExpressionOptions(n, e, t) {
574
+ return new W(this.formSchemaUtils).getExpressionOptions(n, e, t);
575
+ }
576
+ getRealTargetType(n) {
577
+ 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";
578
+ }
579
+ createBaseEventProperty(n) {
580
+ const e = {};
581
+ return e[this.viewModelId] = {
582
+ type: "events-editor",
583
+ editor: {
584
+ initialData: n,
585
+ viewSourceHandle: (t) => {
586
+ var i;
587
+ ((i = t.controller) == null ? void 0 : i.label.indexOf(this.formSchemaUtils.getModule().code)) > -1 && this.eventsEditorUtils.jumpToMethod(t);
588
+ }
589
+ }
590
+ }, e;
591
+ }
592
+ }
593
+ const E = class E {
594
+ /**
595
+ * 根据绑定字段类型获取可用的输入类控件
596
+ */
597
+ static getEditorTypesByMDataType(n, e = !1, t = "") {
598
+ if (e)
599
+ return [{ key: l["language-textbox"].type, value: l["language-textbox"].name }];
600
+ let i = E.fieldControlTypeMapping[n];
601
+ if (t === "data-grid-column" && (i != null && i.length)) {
602
+ const s = [l["check-group"].type, l["radio-group"].type, l.image.type, l["rich-text-editor"].type];
603
+ i = i.filter((r) => !s.includes(r.key));
604
+ }
605
+ return i;
606
+ }
607
+ /**
608
+ * 获取所有输入类控件
609
+ */
610
+ static getAllInputTypes() {
611
+ const n = [];
612
+ for (const e in E.fieldControlTypeMapping)
613
+ E.fieldControlTypeMapping[e].forEach((t) => {
614
+ n.find((i) => i.key === t.key && i.value === t.value) || n.push({ key: t.key, value: t.value });
615
+ });
616
+ return n;
617
+ }
618
+ /**
619
+ * 提供schema字段基础属性和DOM控件属性的映射
620
+ * @param control 控件元数据
621
+ */
622
+ static mappingDomPropAndSchemaProp(n, e) {
623
+ var s;
624
+ const t = (s = n.editor) == null ? void 0 : s.type, i = [];
625
+ return (n.type === l["data-grid-column"].type || n.type === l["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 === l["input-group"].type || t === l.textarea.type || t === l["number-spinner"].type) && i.push({ domField: "editor.maxLength", schemaField: "type.length" }), t === l["number-spinner"].type && i.push({ domField: "editor.precision", schemaField: "type.precision" }), (n.type === l["data-grid-column"].type || n.type === l["tree-grid-column"].type) && i.push({ domField: "formatter.precision", schemaField: "type.precision" }), (t === l["combo-list"].type || t === l["radio-group"].type) && i.push({ domField: "editor.data", schemaField: "type.enumValues" }), (n.type === l["data-grid-column"].type || n.type === l["tree-grid-column"].type) && i.push({ domField: "formatter.data", schemaField: "type.enumValues" }), t === l["date-picker"].type && (i.push({ domField: "editor.displayFormat", schemaField: "editor.format" }), i.push({ domField: "editor.fieldType", schemaField: "type.name" })), t === l["number-spinner"].type && (i.push({ domField: "editor.max", schemaField: "editor.maxValue" }), i.push({ domField: "editor.min", schemaField: "editor.minValue" })), t === l.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 === l["data-grid-column"].type || n.type === l["tree-grid-column"].type) && i.push({ domField: "field", schemaField: "bindingPath" }), i;
626
+ }
627
+ };
628
+ /**
629
+ * <字段类型,可配置的控件类型列表>的映射
630
+ */
631
+ h(E, "fieldControlTypeMapping", {
632
+ String: [
633
+ { key: l["input-group"].type, value: l["input-group"].name },
634
+ { key: l.lookup.type, value: l.lookup.name },
635
+ { key: l.image.type, value: l.image.name },
636
+ { key: l["date-picker"].type, value: l["date-picker"].name },
637
+ { key: l.switch.type, value: l.switch.name },
638
+ { key: l["check-box"].type, value: l["check-box"].name },
639
+ { key: l["check-group"].type, value: l["check-group"].name },
640
+ { key: l["radio-group"].type, value: l["radio-group"].name },
641
+ { key: l["combo-list"].type, value: l["combo-list"].name },
642
+ { key: l.textarea.type, value: l.textarea.name },
643
+ { key: l["time-picker"].type, value: l["time-picker"].name }
644
+ ],
645
+ Text: [
646
+ { key: l.textarea.type, value: l.textarea.name },
647
+ { key: l.lookup.type, value: l.lookup.name },
648
+ { key: l.image.type, value: l.image.name },
649
+ { key: l.avatar.type, value: l.avatar.name },
650
+ { key: l["rich-text-editor"].type, value: l["rich-text-editor"].name }
651
+ ],
652
+ Decimal: [
653
+ { key: l["number-spinner"].type, value: l["number-spinner"].name }
654
+ ],
655
+ Integer: [
656
+ { key: l["number-spinner"].type, value: l["number-spinner"].name }
657
+ ],
658
+ Number: [
659
+ { key: l["number-spinner"].type, value: l["number-spinner"].name },
660
+ { key: l.switch.type, value: l.switch.name },
661
+ { key: l["check-box"].type, value: l["check-box"].name }
662
+ ],
663
+ BigNumber: [
664
+ { key: l["number-spinner"].type, value: l["number-spinner"].name }
665
+ ],
666
+ Date: [
667
+ { key: l["date-picker"].type, value: l["date-picker"].name }
668
+ ],
669
+ DateTime: [
670
+ { key: l["date-picker"].type, value: l["date-picker"].name }
671
+ ],
672
+ Boolean: [
673
+ { key: l.switch.type, value: l.switch.name },
674
+ { key: l["check-box"].type, value: l["check-box"].name }
675
+ ],
676
+ Enum: [
677
+ { key: l["combo-list"].type, value: l["combo-list"].name },
678
+ { key: l["radio-group"].type, value: l["radio-group"].name }
679
+ ],
680
+ Object: [
681
+ { key: l.lookup.type, value: l.lookup.name },
682
+ { key: l["combo-list"].type, value: l["combo-list"].name },
683
+ { key: l["radio-group"].type, value: l["radio-group"].name }
684
+ ]
685
+ });
686
+ let P = E;
687
+ var k = /* @__PURE__ */ ((p) => (p.Form = "Form", p.Variable = "Variable", p))(k || {});
688
+ class de {
689
+ constructor() {
690
+ /** 控件标题 */
691
+ h(this, "label", "");
692
+ /** 控件id */
693
+ h(this, "id", "");
694
+ /** 每个控件占用的栅格数 */
695
+ h(this, "columnInSM", 12);
696
+ h(this, "columnInMD", 6);
697
+ h(this, "columnInLG", 3);
698
+ h(this, "columnInEL", 2);
699
+ /** 每个控件占用的列数 */
700
+ h(this, "displayWidthInSM", 1);
701
+ h(this, "displayWidthInMD", 1);
702
+ h(this, "displayWidthInLG", 1);
703
+ h(this, "displayWidthInEL", 1);
704
+ /** 编辑器内部默认显示的屏幕大小-----可以去掉 */
705
+ h(this, "displayColumnCountAtBreakPoint", "md");
706
+ /** 控件所在行,传0即可-----编辑器内部使用 */
707
+ h(this, "tagRow", 0);
708
+ /** 控件是否显示上方空白:传0即可-----编辑器内部使用 */
709
+ h(this, "showTopBorder", 0);
710
+ /** 区域,从1开始。卡片内的控件从上往下,从左往右划分区域,遇到分组fieldSet时group+1,分组结束后group+1 */
711
+ h(this, "group", 1);
712
+ /** 控件是否符合标准的class配置(设计器用的) */
713
+ h(this, "isSupportedClass", !0);
714
+ /** 控件所在分组id(设计器用的) */
715
+ h(this, "fieldSetId", "");
716
+ }
717
+ }
718
+ function ce(p) {
719
+ let n, e;
720
+ const t = /* @__PURE__ */ new Map();
721
+ let i = [];
722
+ function s(d, a) {
723
+ const y = d.split(" ").filter((F) => F.startsWith("col-"));
724
+ if (y.length === 0) {
725
+ a.isSupportedClass = !1;
726
+ return;
727
+ }
728
+ let u = y.find((F) => /^col-([1-9]|10|11|12)$/.test(F)), f = y.find((F) => /^col-md-([1-9]|10|11|12)$/.test(F)), v = y.find((F) => /^col-xl-([1-9]|10|11|12)$/.test(F)), C = y.find((F) => /^col-el-([1-9]|10|11|12)$/.test(F));
729
+ u = u || "col-12", a.columnInSM = parseInt(u.replace("col-", ""), 10), a.displayWidthInSM = a.columnInSM / 12, a.displayWidthInSM !== 1 && (a.isSupportedClass = !1), f = f || "col-md-" + a.columnInSM, a.columnInMD = parseInt(f.replace("col-md-", ""), 10), a.displayWidthInMD = a.columnInMD / 6, [1, 2].includes(a.displayWidthInMD) || (a.isSupportedClass = !1), v = v || "col-xl-" + a.columnInMD, a.columnInLG = parseInt(v.replace("col-xl-", ""), 10), a.displayWidthInLG = a.columnInLG / 3, [1, 2, 3, 4].includes(a.displayWidthInLG) || (a.isSupportedClass = !1), C = C || "col-el-" + a.columnInLG, a.columnInEL = parseInt(C.replace("col-el-", ""), 10), a.displayWidthInEL = a.columnInEL / 2, [1, 2, 3, 4, 5, 6].includes(a.displayWidthInEL) || (a.isSupportedClass = !1);
730
+ }
731
+ function r(d, a, m, y = !1) {
732
+ let u = !1;
733
+ d.contents.forEach((f) => {
734
+ if (f.type === "fieldset") {
735
+ m += 1, r(f, a, m, !0), u = !0;
736
+ return;
737
+ }
738
+ u && (m += 1, u = !1);
739
+ const v = f.appearance && f.appearance.class, C = new de();
740
+ v ? s(v, C) : C.isSupportedClass = !1, C.label = f.label || f.id, C.id = f.id, C.group = m, y && (C.fieldSetId = d.id), e === f.id && (n = m), t.set(f.id, f), a.push(C);
741
+ });
742
+ }
743
+ function c(d) {
744
+ const a = p.getComponentById(d);
745
+ if (!a || !a.componentType || !a.componentType.startsWith("form"))
746
+ return { result: !1, message: "只可以在响应式表单组件中调整响应式布局配置" };
747
+ const m = p.selectNode(a, (y) => y.type === l["response-form"].type);
748
+ return !m || !m.contents || m.contents.length === 0 ? { result: !1, message: "Form区域内没有控件,请先添加控件" } : { result: !0, message: "", formNode: m };
749
+ }
750
+ function o(d, a) {
751
+ a = a || d.id;
752
+ const { result: m, message: y, formNode: u } = c(a);
753
+ if (!m)
754
+ return { result: m, message: y };
755
+ e = d.id, i = [], t.clear();
756
+ const f = u.contents[0].type === l.fieldset.type ? 0 : 1;
757
+ r(u, i, f);
758
+ const v = i.find((F) => !F.isSupportedClass);
759
+ return {
760
+ defaultState: {
761
+ defaultGroupNumber: n || 1,
762
+ model: v ? "customize" : "standard"
763
+ },
764
+ importData: i
765
+ };
766
+ }
767
+ function g(d, a) {
768
+ a = a;
769
+ const { result: m, formNode: y } = c(a);
770
+ if (!m)
771
+ return "";
772
+ const u = [];
773
+ return d.forEach((f) => {
774
+ var F;
775
+ const v = t.get(f.id), C = v.appearance && v.appearance.class;
776
+ if (C) {
777
+ const w = C.split(" ").filter((Y) => !Y.startsWith("col-")), I = "col-" + f.columnInSM, _ = "col-md-" + f.columnInMD, H = "col-xl-" + f.columnInLG, J = "col-el-" + f.columnInEL, Q = [I, _, H, J].concat(w);
778
+ v.appearance.class = Q.join(" ");
779
+ }
780
+ if (f.fieldSetId) {
781
+ const T = y.contents.find((I) => I.id === f.fieldSetId), w = u.find((I) => I.id === f.fieldSetId);
782
+ w ? (F = w.contents) == null || F.push(v) : (u.push(T), T.contents = [v]);
783
+ } else
784
+ u.push(v);
785
+ }), y.contents = u, y.id;
786
+ }
787
+ return {
788
+ checkCanFindFormNode: c,
789
+ checkCanOpenLayoutEditor: o,
790
+ changeFormControlsByResponseLayoutConfig: g,
791
+ getResonseFormLayoutConfig: r
792
+ };
793
+ }
794
+ const ue = (p) => b(te, null, [b("h5", null, [N("代码示例")]), b("pre", {
795
+ style: "background-color: #f5f5f5; padding: 10px; border-radius: 5px;"
796
+ }, [b("code", null, [`
797
+ <h3>Tips:</h3>
798
+ <span style="color: blue;">
799
+ 自定义提示内容
800
+ </span>
801
+ `])])]);
802
+ class pe extends le {
803
+ constructor(e, t) {
804
+ super(e, t);
805
+ h(this, "responseLayoutEditorFunction");
806
+ /** 控件绑定的变量 */
807
+ h(this, "bindingVarible");
808
+ h(this, "formGroupEvents", [
809
+ {
810
+ label: "fieldValueChanging",
811
+ name: "绑定字段值变化前事件"
812
+ },
813
+ {
814
+ label: "fieldValueChanged",
815
+ name: "绑定字段值变化后事件"
816
+ },
817
+ {
818
+ label: "onClickLabel",
819
+ name: "标签点击事件"
820
+ }
821
+ ]);
822
+ h(this, "numberEditorOptions", {
823
+ type: "number-spinner",
824
+ useThousands: !1,
825
+ keyboard: !1,
826
+ showButton: !1
827
+ });
828
+ this.responseLayoutEditorFunction = ce(this.formSchemaUtils);
829
+ }
830
+ getCommonPropertyConfig(e, t, i = "Card") {
831
+ if (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"), i === "Card") {
832
+ const s = this.getTipsConfig(e);
833
+ this.propertyConfig.categories.behavior.properties = { ...this.propertyConfig.categories.behavior.properties, ...s }, ["time-picker", "date-picker", "lookup", "combo-list", "number-spinner", "input-group", "language-textbox"].includes(e.editor.type) && (this.propertyConfig.categories.expansion = this.getExpandProperties(e));
834
+ }
835
+ }
836
+ getPropertyConfig(e, t) {
837
+ 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;
838
+ }
839
+ getGridFieldEdtiorPropConfig(e, t) {
840
+ 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;
841
+ }
842
+ getBasicProperties(e, t, i = "Card") {
843
+ var g;
844
+ const s = this;
845
+ this.setDesignViewModelField(e);
846
+ const { canChangeControlType: r, editorTypeList: c } = this.getAvailableEditorType(e), o = {
847
+ description: "Basic Information",
848
+ title: "基本信息",
849
+ properties: {
850
+ id: {
851
+ description: "组件标识",
852
+ title: "标识",
853
+ type: "string",
854
+ readonly: !0
855
+ },
856
+ type: {
857
+ description: "编辑器类型",
858
+ title: "编辑器类型",
859
+ type: "string",
860
+ $converter: "/converter/change-editor.converter",
861
+ parentPropertyID: "editor",
862
+ editor: {
863
+ type: "combo-list",
864
+ textField: "value",
865
+ valueField: "key",
866
+ idField: "key",
867
+ editable: !1,
868
+ data: c,
869
+ readonly: !r
870
+ }
871
+ },
872
+ label: {
873
+ title: "标签",
874
+ type: "string",
875
+ $converter: "/converter/form-group-label.converter"
876
+ },
877
+ showLabelType: {
878
+ description: "标签显示方式:1、显示:显示标签 2、占位:保留标签空间,但不显示文本 3、不显示:不显示标签",
879
+ title: "标签显示",
880
+ type: "enum",
881
+ editor: {
882
+ data: [{ id: "visible", name: "显示" }, { id: "reserve-space", name: "占位" }, { id: "none", name: "不显示" }]
883
+ },
884
+ defaultValue: ((g = e.editor) == null ? void 0 : g.type) === "image" ? "none" : "visible"
885
+ },
886
+ binding: {
887
+ description: "绑定的表单字段",
888
+ title: "绑定",
889
+ editor: {
890
+ type: "binding-selector",
891
+ bindingType: { enable: !0 },
892
+ editorParams: {
893
+ componentSchema: e,
894
+ needSyncToViewModel: !0,
895
+ viewModelId: this.viewModelId,
896
+ designerHostService: this.designerHostService,
897
+ disableOccupiedFields: !0
898
+ },
899
+ textField: "bindingField"
900
+ },
901
+ refreshPanelAfterChanged: !0,
902
+ readonly: this.formSchemaUtils.designerMode === "PC_RTC" && !e.isRtcControl
903
+ }
904
+ },
905
+ setPropertyRelates(d, a, m) {
906
+ if (d)
907
+ switch (d && d.propertyID) {
908
+ case "type": {
909
+ s.changeControlType(e, d, t);
910
+ break;
911
+ }
912
+ case "label": {
913
+ d.needRefreshControlTree = !0;
914
+ break;
915
+ }
916
+ case "binding": {
917
+ s.changeBindingField(e, d, m);
918
+ break;
919
+ }
920
+ }
921
+ }
922
+ };
923
+ return i.toLocaleLowerCase() !== "card" && delete o.properties.showLabelType, o;
924
+ }
925
+ getExpandProperties(e) {
926
+ const t = this, i = ["Const", "Variable"], s = this.getPropertyEditorParams(e, i, "expandable"), r = this.getPropertyEditorParams(e, i, "expandDisabled");
927
+ return {
928
+ description: "Expand Information",
929
+ title: "扩展区域",
930
+ properties: {
931
+ expandable: {
932
+ description: "是否启用扩展区域",
933
+ title: "启用扩展区域",
934
+ refreshPanelAfterChanged: !0,
935
+ $converter: "/converter/property-editor.converter",
936
+ editor: s
937
+ },
938
+ expandMode: {
939
+ description: "扩展模式 text | button",
940
+ title: "扩展模式",
941
+ type: "enum",
942
+ refreshPanelAfterChanged: !0,
943
+ $converter: "/converter/property-editor.converter",
944
+ editor: {
945
+ data: [{ id: "text", name: "静态文本" }, { id: "button", name: "交互按钮" }]
946
+ },
947
+ defaultValue: "text",
948
+ visible: !!e.editor.expandable
949
+ },
950
+ expandContent: {
951
+ $converter: "/converter/property-editor.converter",
952
+ description: "扩展内容",
953
+ title: "扩展内容",
954
+ type: "string",
955
+ visible: !!e.editor.expandable
956
+ },
957
+ expandDisabled: {
958
+ $converter: "/converter/property-editor.converter",
959
+ description: "是否隐藏扩展区域",
960
+ title: "隐藏扩展区域",
961
+ editor: r,
962
+ visible: !!e.editor.expandable
963
+ }
964
+ },
965
+ setPropertyRelates(o, g) {
966
+ if (o)
967
+ switch (o.propertyID) {
968
+ case "expandable":
969
+ case "expandDisabled":
970
+ t.afterMutilEditorChanged(e, o);
971
+ break;
972
+ }
973
+ }
974
+ };
975
+ }
976
+ /**
977
+ * 校验控件是否支持切换类型
978
+ * @param control 控件
979
+ */
980
+ checkCanChangeControlType(e, t) {
981
+ if (!e.binding)
982
+ return !1;
983
+ if (e.binding.type === "Variable") {
984
+ if (this.bindingVarible = this.formSchemaUtils.getVariableById(e.binding.field), !this.bindingVarible)
985
+ return !1;
986
+ } else if (!this.designViewModelField || this.designViewModelField.$type !== L.SimpleField)
987
+ return !1;
988
+ return !0;
989
+ }
990
+ /**
991
+ * 获取可选的编辑器类型
992
+ */
993
+ getAvailableEditorType(e) {
994
+ var s;
995
+ const t = this.checkCanChangeControlType(e, this.viewModelId);
996
+ if (!t)
997
+ return {
998
+ canChangeControlType: !1,
999
+ editorTypeList: [{
1000
+ key: e.editor.type,
1001
+ value: ((s = l[e.editor.type]) == null ? void 0 : s.name) || e.editor.type
1002
+ }]
1003
+ };
1004
+ let i = [];
1005
+ return this.designViewModelField && this.designViewModelField.$type === L.SimpleField ? i = P.getEditorTypesByMDataType(this.designViewModelField.type.name, this.designViewModelField.multiLanguage) : this.bindingVarible && (i = P.getEditorTypesByMDataType(this.bindingVarible.type, !1)), { canChangeControlType: t, editorTypeList: i };
1006
+ }
1007
+ changeBindingField(e, t, i) {
1008
+ t.needRefreshEntityTree = !0;
1009
+ }
1010
+ getAppearanceProperties(e, t) {
1011
+ const i = this;
1012
+ return {
1013
+ title: "外观",
1014
+ description: "Appearance",
1015
+ properties: {
1016
+ class: {
1017
+ title: "class样式",
1018
+ type: "string",
1019
+ description: "组件的CSS样式",
1020
+ $converter: "/converter/appearance.converter",
1021
+ parentPropertyID: "appearance"
1022
+ },
1023
+ style: {
1024
+ title: "style样式",
1025
+ type: "string",
1026
+ description: "组件的内联样式",
1027
+ $converter: "/converter/appearance.converter",
1028
+ parentPropertyID: "appearance"
1029
+ },
1030
+ fill: {
1031
+ title: "填充宽度",
1032
+ description: "启用后,控件占满父容器宽度",
1033
+ type: "boolean",
1034
+ parentPropertyID: "appearance"
1035
+ },
1036
+ responseLayout: {
1037
+ description: "响应式列宽",
1038
+ title: "响应式列宽",
1039
+ type: "boolean",
1040
+ visible: !0,
1041
+ // 这个属性,标记当属性变更得时候触发重新更新属性
1042
+ refreshPanelAfterChanged: !0,
1043
+ editor: {
1044
+ type: "response-layout-editor-setting",
1045
+ beforeOpen: () => i.responseLayoutEditorFunction.checkCanOpenLayoutEditor(e, i.componentId)
1046
+ }
1047
+ }
1048
+ },
1049
+ setPropertyRelates(s, r) {
1050
+ if (s)
1051
+ switch (s && s.propertyID) {
1052
+ case "responseLayout":
1053
+ i.responseLayoutEditorFunction.changeFormControlsByResponseLayoutConfig(s.propertyValue, i.componentId || e.id), i.updateUnifiedLayoutAfterResponseLayoutChanged(i.componentId), i.updateElementByParentContainer(e.id, t), delete e.responseLayout;
1054
+ break;
1055
+ case "class":
1056
+ i.updateUnifiedLayoutAfterControlChanged(s.propertyValue, e.id, this.componentId), V.value++;
1057
+ break;
1058
+ case "style": {
1059
+ V.value++;
1060
+ break;
1061
+ }
1062
+ }
1063
+ }
1064
+ };
1065
+ }
1066
+ getEditorProperties(e) {
1067
+ return this.getComponentConfig(e);
1068
+ }
1069
+ /**
1070
+ * 卡片控件:切换控件类型后事件
1071
+ * @param propertyData 控件DOM属性
1072
+ * @param newControlType 新控件类型
1073
+ */
1074
+ changeControlType(e, t, i) {
1075
+ const s = t.propertyValue, r = i && i.parent && i.parent.schema;
1076
+ if (!r)
1077
+ return;
1078
+ const c = r.contents.findIndex((d) => d.id === e.id);
1079
+ if (c === -1)
1080
+ return;
1081
+ const o = r.contents[c];
1082
+ let g;
1083
+ if (this.designViewModelField) {
1084
+ const m = this.formSchemaUtils.getViewModelById(this.viewModelId).fields.find((u) => u.id === this.designViewModelField.id).fieldSchema || {};
1085
+ m.editor || (m.editor = {}), m.editor.$type = s, this.designViewModelUtils.getDgViewModel(this.viewModelId).changeField(this.designViewModelField.id, m, !1), g = this.controlCreatorUtils.setFormFieldProperty(this.designViewModelField, s);
1086
+ }
1087
+ g || (g = this.controlCreatorUtils.createFormGroupWithoutField(s)), Object.assign(g, {
1088
+ id: o.id,
1089
+ appearance: o.appearance,
1090
+ size: o.size,
1091
+ label: o.label,
1092
+ binding: o.binding
1093
+ }), Object.prototype.hasOwnProperty.call(o, "visible") && Object.assign(g, { visible: o.visible }), o.editor && ["readonly", "required", "placeholder"].map((d) => {
1094
+ Object.prototype.hasOwnProperty.call(o.editor, d) && (g.editor[d] = o.editor[d]);
1095
+ }), i != null && i.updateContextSchema ? i.updateContextSchema(g) : (i.schema = Object.assign(o, g), Object.assign(e, g)), Array.from(document.getElementsByClassName("dgComponentSelected")).forEach(
1096
+ (d) => d.classList.remove("dgComponentSelected")
1097
+ ), Array.from(document.getElementsByClassName("dgComponentFocused")).forEach(
1098
+ (d) => d.classList.remove("dgComponentFocused")
1099
+ ), V.value++, ie(() => {
1100
+ this.getFormDesignerInstance().reloadPropertyPanel();
1101
+ });
1102
+ }
1103
+ getTipsConfig(e) {
1104
+ return ["time-picker", "date-picker", "lookup", "combo-list", "number-spinner", "input-group", "textarea", "rich-text-editor", "language-textbox"].includes(e.editor.type) ? {
1105
+ enableTips: {
1106
+ refreshPanelAfterChanged: !0,
1107
+ description: "",
1108
+ title: "启用提示",
1109
+ type: "boolean",
1110
+ default: !1
1111
+ },
1112
+ tipsContent: {
1113
+ description: "提示内容",
1114
+ title: "提示内容",
1115
+ type: "string",
1116
+ editor: {
1117
+ type: "code-editor",
1118
+ language: "html",
1119
+ leftTemplate: ue
1120
+ },
1121
+ visible: !!e.enableTips
1122
+ }
1123
+ } : {};
1124
+ }
1125
+ getComponentConfig(e, t = {}, i = {}, s) {
1126
+ var m, y;
1127
+ const r = Object.assign({
1128
+ description: "编辑器",
1129
+ title: "编辑器",
1130
+ type: "input-group",
1131
+ $converter: "/converter/property-editor.converter",
1132
+ parentPropertyID: "editor"
1133
+ }, t), c = (m = e.binding) != null && m.field ? [] : ["Const", "Variable", "StateMachine"], o = this.getPropertyEditorParams(e, c, "readonly"), g = this.getPropertyEditorParams(e, c, "required"), d = {
1134
+ readonly: {
1135
+ description: "",
1136
+ title: "只读",
1137
+ editor: o
1138
+ },
1139
+ required: {
1140
+ description: "",
1141
+ title: "必填",
1142
+ type: "boolean",
1143
+ editor: g,
1144
+ visible: !!((y = e.binding) != null && y.field)
1145
+ },
1146
+ placeholder: {
1147
+ description: "当控件没有值时在输入框中显示的文本",
1148
+ title: "提示文本",
1149
+ type: "string"
1150
+ }
1151
+ };
1152
+ for (const u in i)
1153
+ d[u] = Object.assign(d[u] || {}, i[u]);
1154
+ const a = this;
1155
+ return {
1156
+ ...r,
1157
+ properties: { ...d },
1158
+ setPropertyRelates(u, f) {
1159
+ if (u) {
1160
+ switch (u.propertyID) {
1161
+ case "readonly":
1162
+ case "required":
1163
+ a.afterMutilEditorChanged(e, u);
1164
+ break;
1165
+ }
1166
+ s && s.bind(a)(u, e, f);
1167
+ }
1168
+ }
1169
+ };
1170
+ }
1171
+ /**
1172
+ * 修改某一输入控件的样式后更新Form的统一布局配置
1173
+ * @param controlClass 控件样式
1174
+ * @param controlId 控件Id
1175
+ * @param componentId 控件所在组件id
1176
+ */
1177
+ updateUnifiedLayoutAfterControlChanged(e, t, i) {
1178
+ const s = e.split(" ");
1179
+ let r = s.find((a) => /^col-([1-9]|10|11|12)$/.test(a)), c = s.find((a) => /^col-md-([1-9]|10|11|12)$/.test(a)), o = s.find((a) => /^col-xl-([1-9]|10|11|12)$/.test(a)), g = s.find((a) => /^col-el-([1-9]|10|11|12)$/.test(a));
1180
+ r = r || "col-12", c = c || "col-md-" + r.replace("col-", ""), o = o || "col-xl-" + c.replace("col-md-", ""), g = g || "col-el-" + o.replace("col-xl-", "");
1181
+ const d = {
1182
+ id: t,
1183
+ columnInSM: parseInt(r.replace("col-", ""), 10),
1184
+ columnInMD: parseInt(c.replace("col-md-", ""), 10),
1185
+ columnInLG: parseInt(o.replace("col-xl-", ""), 10),
1186
+ columnInEL: parseInt(g.replace("col-el-", ""), 10)
1187
+ };
1188
+ this.updateUnifiedLayoutAfterResponseLayoutChanged(i, d);
1189
+ }
1190
+ /**
1191
+ * 修改控件布局配置后更新Form统一布局配置
1192
+ * @param componentId 组件Id
1193
+ * @param controlLayoutConfig 某单独变动的控件配置项,FormResponseLayoutContext类型
1194
+ */
1195
+ updateUnifiedLayoutAfterResponseLayoutChanged(e, t) {
1196
+ const { formNode: i } = this.responseLayoutEditorFunction.checkCanFindFormNode(e);
1197
+ if (!i || !i.unifiedLayout)
1198
+ return;
1199
+ const s = [];
1200
+ if (this.responseLayoutEditorFunction.getResonseFormLayoutConfig(i, s, 1), t) {
1201
+ const u = s.find((f) => f.id === t.id);
1202
+ Object.assign(u || {}, t);
1203
+ }
1204
+ const r = s.map((u) => u.columnInSM), c = s.map((u) => u.columnInMD), o = s.map((u) => u.columnInLG), g = s.map((u) => u.columnInEL), d = this.checkIsUniqueColumn(r) ? r[0] : null, a = this.checkIsUniqueColumn(c) ? c[0] : null, m = this.checkIsUniqueColumn(o) ? o[0] : null, y = this.checkIsUniqueColumn(g) ? g[0] : null;
1205
+ Object.assign(i.unifiedLayout, {
1206
+ uniqueColClassInSM: d,
1207
+ uniqueColClassInMD: a,
1208
+ uniqueColClassInLG: m,
1209
+ uniqueColClassInEL: y
1210
+ });
1211
+ }
1212
+ /**
1213
+ * 校验宽度样式值是否一致
1214
+ */
1215
+ checkIsUniqueColumn(e) {
1216
+ const t = new Set(e);
1217
+ return Array.from(t).length === 1;
1218
+ }
1219
+ /**
1220
+ * 枚举项编辑器
1221
+ * @param propertyData
1222
+ * @param valueField
1223
+ * @param textField
1224
+ * @returns
1225
+ */
1226
+ getItemCollectionEditor(e, t, i) {
1227
+ return t = t || "value", i = i || "name", {
1228
+ editor: {
1229
+ columns: [
1230
+ { field: t, title: "值", dataType: "string" },
1231
+ { field: i, title: "名称", dataType: "string" }
1232
+ // { field: 'disabled', title: '禁用', dataType: 'boolean', editor: { type: 'switch' } },
1233
+ ],
1234
+ type: "item-collection-editor",
1235
+ valueField: t,
1236
+ nameField: i,
1237
+ requiredFields: [t, i],
1238
+ uniqueFields: [t, i],
1239
+ readonly: this.checkEnumDataReadonly(e)
1240
+ }
1241
+ };
1242
+ }
1243
+ /**
1244
+ * 判断枚举数据是否只读
1245
+ * 1、没有绑定信息或者绑定变量,可以新增、删除、修改
1246
+ * 2、绑定类型为字段,且字段为枚举字段,则不可新增、删除、修改枚举值。只能从be修改然后同步到表单上。
1247
+ * @param propertyData 下拉框控件属性值
1248
+ */
1249
+ checkEnumDataReadonly(e) {
1250
+ return !e.binding || e.binding.type !== "Form" ? !1 : !!(this.designViewModelField && this.designViewModelField.type && this.designViewModelField.type.$type === D.EnumType);
1251
+ }
1252
+ /**
1253
+ * 将字段值变化前事件、变化后事件追加到交互面板
1254
+ * 注意:因为绑定字段值变化后事件与下拉框的值变化事件(valueChanged)重名,所以这里将事件label都重命名下
1255
+ */
1256
+ appendFieldValueChangeEvents(e, t) {
1257
+ e.binding && e.binding.type === k.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");
1258
+ }
1259
+ getControlMethodType(e) {
1260
+ if (!e.binding)
1261
+ return e.type;
1262
+ switch (e.binding.type) {
1263
+ case k.Form:
1264
+ return e.binding.path || e.type;
1265
+ case k.Variable:
1266
+ return e.binding.fullPath || e.type;
1267
+ }
1268
+ return e.type;
1269
+ }
1270
+ updateLinkedLabel(e, t) {
1271
+ if (e.boundEventsList && e.boundEventsList.length > 0) {
1272
+ const i = e.boundEventsList.find((s) => s.boundEvents && s.boundEvents.label === "onClickLabel");
1273
+ t.linkLabel = !!i;
1274
+ } else
1275
+ t.linkLabel = !1;
1276
+ }
1277
+ /**
1278
+ * 组装输入类控件的交互面板:包含标签超链、绑定字段值变化前后事件等。
1279
+ * @param propertyData 属性值
1280
+ * @param viewModelId 视图模型id
1281
+ * @param showPosition 面板展示位置
1282
+ * @param customEvent 输入控件特有的事件配置
1283
+ */
1284
+ getEventPropertyConfig(e, t = "card", i, s) {
1285
+ const r = this;
1286
+ let c = [...this.formGroupEvents];
1287
+ if (["time-picker", "date-picker", "lookup", "combo-list", "number-spinner", "input-group"].includes(e.editor.type) && c.push({
1288
+ lable: "onClear",
1289
+ name: "清空事件"
1290
+ }), i && (c = c.concat(i)), c.length === 0)
1291
+ return {
1292
+ title: "事件",
1293
+ hideTitle: !0,
1294
+ properties: {},
1295
+ tabId: "commands",
1296
+ tabName: "交互",
1297
+ hide: !0
1298
+ };
1299
+ this.appendFieldValueChangeEvents(e, c);
1300
+ const g = r.eventsEditorUtils.formProperties(e, r.viewModelId, c);
1301
+ return {
1302
+ title: "事件",
1303
+ hideTitle: !0,
1304
+ properties: r.createBaseEventProperty(g),
1305
+ tabId: "commands",
1306
+ tabName: "交互",
1307
+ setPropertyRelates(m, y) {
1308
+ const u = m.propertyValue;
1309
+ delete e[r.viewModelId], u && (u.setPropertyRelates = this.setPropertyRelates, u.controlInfo = { type: r.getControlMethodType(e), name: e.title }, r.eventsEditorUtils.saveRelatedParameters(e, r.viewModelId, u.events, u), r.updateLinkedLabel(u, y)), s && s(m, y, u);
1310
+ const f = r.designViewModelUtils.getDgViewModel(r.viewModelId);
1311
+ f && r.designViewModelField && f.changeField(r.designViewModelField.id, { valueChanging: e.fieldValueChanging, valueChanged: e.fieldValueChanged });
1312
+ }
1313
+ };
1314
+ }
1315
+ getExpressionConfig(e, t, i = ["compute", "dependency", "validate"], s) {
1316
+ return new W(this.formSchemaUtils).getExpressionConfig(
1317
+ e,
1318
+ t,
1319
+ i,
1320
+ s
1321
+ );
1322
+ }
1323
+ getBindingDataType() {
1324
+ return this.designViewModelField ? this.designViewModelField.type.name === "Number" ? "number" : this.designViewModelField.type.name === "String" ? "string" : "boolean" : "boolean";
1325
+ }
1326
+ getEditor() {
1327
+ return this.getBindingDataType() === "number" ? this.numberEditorOptions : {};
1328
+ }
1329
+ updatePropertyValue(e, t, i) {
1330
+ var s;
1331
+ e.editor[t] !== i ? e.editor[t] = i : (s = this.getFormDesignerInstance()) == null || s.reloadPropertyPanel();
1332
+ }
1333
+ setBooleanValue(e, t, i) {
1334
+ let s = i;
1335
+ this.getBindingDataType() === "string" && (s = (s || "").trim() || (t === "trueValue" ? "true" : "false"));
1336
+ const c = t === "trueValue" ? "falseValue" : "trueValue";
1337
+ e.editor[c] === s && (s = s + 1), this.updatePropertyValue(e, t, s);
1338
+ }
1339
+ getBooleanValueConverter() {
1340
+ return {
1341
+ convertFrom: (e, t) => e.editor[t],
1342
+ convertTo: (e, t, i) => {
1343
+ this.setBooleanValue(e, t, i);
1344
+ }
1345
+ };
1346
+ }
1347
+ }
1348
+ class ge extends pe {
1349
+ getPropertyConfig(n, e) {
1350
+ this.propertyConfig.categories.basic = this.getBasicPropConfig(n), this.propertyConfig.categories.appearance = this.getAppearanceConfig(n, {
1351
+ horizontal: {
1352
+ description: "布局方向",
1353
+ title: "布局方向",
1354
+ type: "enum",
1355
+ editor: {
1356
+ type: "combo-list",
1357
+ data: [{ id: !0, name: "水平" }, { id: !1, name: "垂直" }]
1358
+ }
1359
+ }
1360
+ });
1361
+ const t = this, i = this.getPropertyEditorParams(n, ["Variable"], "", {}, { newVariablePrefix: "", newVariableType: "Object" });
1362
+ return this.propertyConfig.categories.behavior = this.getBehaviorConfig(n, "", {
1363
+ dataSourceType: {
1364
+ description: "若要配置标签数值,请使用动态数据源。",
1365
+ title: "数据源类型",
1366
+ type: "enum",
1367
+ visible: !0,
1368
+ editor: {
1369
+ default: "static",
1370
+ data: [
1371
+ { id: "static", name: "静态" },
1372
+ { id: "dynamic", name: "动态" }
1373
+ ]
1374
+ },
1375
+ refreshPanelAfterChanged: !0
1376
+ },
1377
+ bindDataSource: {
1378
+ description: "动态类型绑定数据源选择",
1379
+ title: "绑定数据源",
1380
+ visible: (n == null ? void 0 : n.dataSourceType) === "dynamic",
1381
+ type: "object",
1382
+ editor: i
1383
+ },
1384
+ navData: {
1385
+ description: "静态类型数据源选择",
1386
+ title: "数据源",
1387
+ type: "array",
1388
+ visible: !(n != null && n.dataSourceType) || n.dataSourceType === "static",
1389
+ ...t.getItemCollectionEditor(n, n.idField || "id", n.displayField || "text"),
1390
+ // 这个属性,标记当属性变更得时候触发重新更新属性
1391
+ refreshPanelAfterChanged: !0
1392
+ },
1393
+ maxNum: {
1394
+ description: "超过最大值后以【maxNum+】显示,仅支持动态数据源场景。",
1395
+ title: "显示数字最大值",
1396
+ min: 0,
1397
+ useThousands: !1,
1398
+ needValid: !0,
1399
+ visible: n.dataSourceType === "dynamic"
1400
+ }
1401
+ }, (s, r) => {
1402
+ switch (s.propertyID) {
1403
+ case "bindDataSource":
1404
+ t.afterMutilEditorChanged(n, s);
1405
+ break;
1406
+ }
1407
+ }), this.getEventPropConfig(n), this.propertyConfig;
1408
+ }
1409
+ getEventPropConfig(n) {
1410
+ const e = [
1411
+ {
1412
+ label: "onNav",
1413
+ name: "切换事件"
1414
+ }
1415
+ ], t = this, i = t.eventsEditorUtils.formProperties(n, t.viewModelId, e), s = t.createBaseEventProperty(i);
1416
+ this.propertyConfig.categories.eventsEditor = {
1417
+ title: "事件",
1418
+ hideTitle: !0,
1419
+ properties: s,
1420
+ // 这个属性,标记当属性变更得时候触发重新更新属性
1421
+ refreshPanelAfterChanged: !0,
1422
+ tabId: "commands",
1423
+ tabName: "交互",
1424
+ setPropertyRelates(r, c) {
1425
+ const o = r.propertyValue;
1426
+ delete n[t.viewModelId], o && (o.setPropertyRelates = this.setPropertyRelates, t.eventsEditorUtils.saveRelatedParameters(n, t.viewModelId, o.events, o)), n.remoteSort = !!n.columnSorted;
1427
+ }
1428
+ };
1429
+ }
1430
+ }
1431
+ function me(p, n) {
1432
+ function e(r, c) {
1433
+ const o = p.schema;
1434
+ return new ge(r, n).getPropertyConfig(o, c);
1435
+ }
1436
+ function t() {
1437
+ return !1;
1438
+ }
1439
+ function i() {
1440
+ return !1;
1441
+ }
1442
+ function s() {
1443
+ return !1;
1444
+ }
1445
+ return {
1446
+ getPropsConfig: e,
1447
+ canAccepts: t,
1448
+ checkCanDeleteComponent: i,
1449
+ checkCanMoveComponent: s
1450
+ };
1451
+ }
1452
+ function fe(p, n, e) {
1453
+ return n === "dynamic" ? { navData: Array.isArray(e.bindDataSource) ? e.bindDataSource || [] : [] } : { navData: e.navData };
1454
+ }
1455
+ const he = /* @__PURE__ */ new Map([
1456
+ ["appearance", G],
1457
+ ["dataSourceType", fe]
1458
+ ]), ye = /* @__PURE__ */ new Map([
1459
+ ["appearance", G]
1460
+ ]);
1461
+ function j(p, n, e) {
1462
+ return n;
1463
+ }
1464
+ const ve = "https://json-schema.org/draft/2020-12/schema", be = "https://farris-design.gitee.io/nav.schema.json", Ce = "nav", Fe = "A Farris Component", Ee = "object", xe = {
1465
+ id: {
1466
+ description: "The unique identifier for a nav",
1467
+ type: "string"
1468
+ },
1469
+ type: {
1470
+ description: "The type string of nav component",
1471
+ type: "string",
1472
+ default: "nav"
1473
+ },
1474
+ appearance: {
1475
+ description: "",
1476
+ type: "object",
1477
+ properties: {
1478
+ class: {
1479
+ type: "string"
1480
+ },
1481
+ style: {
1482
+ type: "string"
1483
+ }
1484
+ },
1485
+ default: {}
1486
+ },
1487
+ binding: {
1488
+ description: "",
1489
+ type: "object",
1490
+ default: {}
1491
+ },
1492
+ activeNavId: {
1493
+ description: "",
1494
+ type: "string",
1495
+ default: ""
1496
+ },
1497
+ displayField: {
1498
+ description: "",
1499
+ type: "string",
1500
+ default: "text"
1501
+ },
1502
+ disableField: {
1503
+ description: "",
1504
+ type: "string",
1505
+ default: "disable"
1506
+ },
1507
+ horizontal: {
1508
+ description: "",
1509
+ type: "boolean",
1510
+ default: !0
1511
+ },
1512
+ idField: {
1513
+ description: "",
1514
+ type: "string",
1515
+ default: "id"
1516
+ },
1517
+ valueField: {
1518
+ description: "",
1519
+ type: "string",
1520
+ default: "num"
1521
+ },
1522
+ maxNum: {
1523
+ description: "",
1524
+ type: "number"
1525
+ },
1526
+ navData: {
1527
+ description: "",
1528
+ type: "array",
1529
+ default: []
1530
+ },
1531
+ dataSourceType: {
1532
+ description: "",
1533
+ type: "string",
1534
+ default: "static"
1535
+ },
1536
+ bindDataSource: {
1537
+ description: "",
1538
+ type: "object"
1539
+ },
1540
+ navPicking: {
1541
+ description: "",
1542
+ type: "function"
1543
+ }
1544
+ }, Ie = [
1545
+ "id",
1546
+ "type"
1547
+ ], z = {
1548
+ $schema: ve,
1549
+ $id: be,
1550
+ title: Ce,
1551
+ description: Fe,
1552
+ type: Ee,
1553
+ properties: xe,
1554
+ required: Ie
1555
+ }, B = {
1556
+ /** 当前激活的id */
1557
+ activeNavId: { Type: String, default: "" },
1558
+ /** 导航文本字段 */
1559
+ displayField: { Type: String, default: "text" },
1560
+ /** 控制禁用字段 */
1561
+ disableField: { Type: String, default: "disable" },
1562
+ /** 水平或垂直方向 */
1563
+ horizontal: { Type: Boolean, default: !0 },
1564
+ /** 标识字段 */
1565
+ idField: { Type: String, default: "id" },
1566
+ /** 最大数值 */
1567
+ maxNum: { Type: Number, default: 99 },
1568
+ /** 导航数据 */
1569
+ navData: {
1570
+ Type: Array,
1571
+ default: []
1572
+ },
1573
+ /** 切换前事件 */
1574
+ navPicking: {
1575
+ type: Function,
1576
+ default: () => (p) => !0
1577
+ },
1578
+ /** 徽标值字段 */
1579
+ valueField: { Type: String, default: "num" },
1580
+ visible: { Type: Boolean, default: !0 },
1581
+ customClass: { Type: String, default: "" },
1582
+ customStyle: { Type: String, default: "" }
1583
+ }, Me = O(B, z, he, j), X = Object.assign({}, B, {
1584
+ componentId: { type: String, default: "" },
1585
+ dataSourceType: { Type: String, default: "static" }
1586
+ }), we = O(X, z, ye, j), S = /* @__PURE__ */ R({
1587
+ name: "FNavDesign",
1588
+ props: X,
1589
+ emits: ["nav"],
1590
+ setup(p, n) {
1591
+ const e = x(p.activeNavId), t = [{
1592
+ id: "1",
1593
+ text: "全部"
1594
+ }, {
1595
+ id: "2",
1596
+ text: "已回复"
1597
+ }, {
1598
+ id: "3",
1599
+ text: "待回复",
1600
+ num: 200
1601
+ }, {
1602
+ id: "4",
1603
+ text: "@我",
1604
+ num: 33
1605
+ }], i = x(p.navData && p.navData.length === 0 ? t : p.navData), s = x(), r = U("design-item-context"), c = U("designer-host-service"), o = me(r, c), g = re(s, r, o);
1606
+ ne(() => {
1607
+ s.value.componentInstance = g;
1608
+ }), n.expose(g.value), q(() => p.navData, (u) => {
1609
+ i.value = u && u.length === 0 ? t : u, d();
1610
+ });
1611
+ function d() {
1612
+ if (i.value && i.value.length && !e.value) {
1613
+ const u = i.value.find((f) => !f.disable);
1614
+ u && (e.value = u.id);
1615
+ }
1616
+ }
1617
+ function a(u) {
1618
+ u.id !== e.value && (e.value = u.id);
1619
+ }
1620
+ const m = M(() => {
1621
+ const u = {
1622
+ "farris-nav": !0,
1623
+ "farris-nav-vertical": !p.horizontal
1624
+ };
1625
+ return A(u, p.customClass);
1626
+ }), y = M(() => $({}, p.customStyle));
1627
+ return () => {
1628
+ var u;
1629
+ return b("div", {
1630
+ ref: s,
1631
+ class: m.value,
1632
+ style: y.value
1633
+ }, [(u = i.value) == null ? void 0 : u.map((f) => b("div", {
1634
+ class: ["farris-nav-item", {
1635
+ active: f.id === e.value
1636
+ }],
1637
+ onClick: () => a(f)
1638
+ }, [b("div", {
1639
+ class: "farris-nav-item-link"
1640
+ }, [b("span", {
1641
+ class: "farris-nav-item-link-text"
1642
+ }, [f.text, p.dataSourceType === "dynamic" && f.num && b("div", {
1643
+ class: "farris-nav-item-tag"
1644
+ }, [f.num <= p.maxNum && b("span", {
1645
+ class: "tag-text"
1646
+ }, [f.num]), f.num > p.maxNum && b("span", {
1647
+ class: "tag-text"
1648
+ }, [p.maxNum, N("+")])])])])]))]);
1649
+ };
1650
+ }
1651
+ }), Ve = /* @__PURE__ */ R({
1652
+ name: "FNav",
1653
+ props: B,
1654
+ emits: ["nav", "update:activeNavId"],
1655
+ setup(p, n) {
1656
+ const e = x(p.activeNavId), t = x(p.navData), i = x(p.navPicking), s = M(() => ({
1657
+ paddingTop: "1rem"
1658
+ }));
1659
+ function r(d) {
1660
+ if (t.value && t.value.length) {
1661
+ let a = t.value.find((m) => m[p.idField] === d && m[p.disableField] !== !0);
1662
+ a || (a = t.value.find((m) => m[p.disableField] !== !0)), a && e.value !== a.id && (e.value = d, n.emit("nav", a));
1663
+ }
1664
+ }
1665
+ q([p.activeNavId, p.navData], ([d, a]) => {
1666
+ t.value = a, r(d);
1667
+ });
1668
+ function c(d) {
1669
+ d.disable || d.id === e.value || Promise.resolve().then(() => i.value(d)).then((a) => {
1670
+ a && (e.value = d.id, n.emit("update:activeNavId", d.id), n.emit("nav", d));
1671
+ });
1672
+ }
1673
+ const o = M(() => {
1674
+ const d = {
1675
+ "farris-nav": !0,
1676
+ "farris-nav-vertical": !p.horizontal
1677
+ };
1678
+ return A(d, p.customClass);
1679
+ }), g = M(() => $({}, p.customStyle));
1680
+ return () => {
1681
+ var d;
1682
+ return b("div", {
1683
+ class: o.value,
1684
+ style: g.value
1685
+ }, [(d = t.value) == null ? void 0 : d.map((a) => b("div", {
1686
+ class: ["farris-nav-item", {
1687
+ active: a[p.idField] === e.value
1688
+ }, {
1689
+ disabled: a[p.disableField]
1690
+ }],
1691
+ onClick: () => c(a)
1692
+ }, [b("div", {
1693
+ class: "farris-nav-item-link",
1694
+ style: s.value
1695
+ }, [b("span", {
1696
+ class: "farris-nav-item-link-text"
1697
+ }, [typeof a[p.displayField] == "function" ? a[p.displayField]() : a[p.displayField], a[p.valueField] && b("div", {
1698
+ class: "farris-nav-item-tag"
1699
+ }, [a[p.valueField] <= p.maxNum && b("span", {
1700
+ class: "tag-text"
1701
+ }, [a[p.valueField]]), a[p.valueField] > p.maxNum && b("span", {
1702
+ class: "tag-text"
1703
+ }, [p.maxNum, N("+")])])]), b("div", {
1704
+ class: "farris-nav-item-bottom-line"
1705
+ }, null)])]))]);
1706
+ };
1707
+ }
1708
+ });
1709
+ S.registerDesigner = (p, n, e, t) => {
1710
+ p.nav = S, n.nav = we;
1711
+ };
1712
+ S.register = (p, n, e) => {
1713
+ p.nav = Ve, n.nav = Me;
1714
+ };
1715
+ const Le = ee(S);
1716
+ export {
1717
+ S as FNavDesign,
1718
+ Le as default
1719
+ };