cloud-web-corejs 1.0.54-dev.703 → 1.0.54-dev.705

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 (17) hide show
  1. package/package.json +1 -1
  2. package/src/components/xform/docs//345/220/216/345/217/260/345/255/227/346/256/265/357/274/210/345/212/250/346/200/201/347/224/237/346/210/220/357/274/211JSON /350/257/264/346/230/216.md" +41 -16
  3. package/src/components/xform/docs//346/225/260/346/215/256/350/241/250/346/240/274/345/212/250/346/200/201/345/210/227 JSON /350/257/264/346/230/216.md" +2 -2
  4. package/src/components/xform/form-designer/form-widget/field-widget/cascader-widget.vue +1 -0
  5. package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +6 -1
  6. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +64 -5
  7. package/src/components/xform/form-designer/setting-panel/property-editor/container-table/table-dynamicField-editor.vue +207 -215
  8. package/src/components/xform/form-designer/setting-panel/property-editor/field-cascader/cascader-multiple-editor.vue +8 -3
  9. package/src/components/xform/form-designer/setting-panel/property-editor/labelTooltip-editor.vue +60 -4
  10. package/src/components/xform/form-designer/setting-panel/propertyRegister.js +1 -1
  11. package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +7 -2
  12. package/src/components/xform/form-render/container-item/dynamicFieldMixin.js +90 -10
  13. package/src/components/xform/form-render/container-item/sub-form-item.vue +10 -2
  14. package/src/components/xform/utils/dynamicSchemaUtil.js +3 -0
  15. package/src/components/xform/utils/sfc-generator.js +2 -2
  16. package/src/components/xform/utils/tableColumnHelper.js +25 -2
  17. package/src/views/user/home/default2.vue +1148 -0
@@ -1,6 +1,7 @@
1
1
  import { generateId } from "../../../../components/xform/utils/util";
2
2
  import {
3
3
  buildDynamicSchemaRequestData,
4
+ extractDynamicSchemaItems,
4
5
  getDynamicSchemaOption,
5
6
  normalizeDynamicFieldKey,
6
7
  resolveDynamicSchemaResponse,
@@ -10,7 +11,7 @@ import {
10
11
  * 表格布局容器(table/h5-table)专用混入。
11
12
  *
12
13
  * 提供两类「布局表格」特有能力(动态字段状态控制已统一收敛到表单设置,见 formDynamicFieldMixin):
13
- * 1. 后台字段定义(dynamicSchemaEnabled):字段定义由后台查询下发,运行时生成并插入到行布局中。
14
+ * 1. 动态字段(dynamicSchemaSourceType):字段定义由脚本或接口下发,运行时生成并插入到行布局中。
14
15
  * 2. 行折叠(默认行为):整行字段均隐藏时折叠该行(响应式,随字段显隐自动更新)。
15
16
  *
16
17
  * 依赖宿主组件已混入:containerItemMixin(formModel/formHttp/handleCustomEvent/designState)
@@ -67,23 +68,102 @@ const dynamicFieldMixin = {
67
68
  },
68
69
 
69
70
  /* ------------------- 后台字段定义模式(行布局容器) ------------------- */
71
+ getDynamicSchemaSourceType() {
72
+ const options = this.widget.options || {};
73
+ const sourceType = getDynamicSchemaOption(options, "sourceType");
74
+ if (sourceType) {
75
+ return sourceType;
76
+ }
77
+ // 兼容旧配置:dynamicSchemaEnabled
78
+ if (options.dynamicSchemaEnabled) {
79
+ return "api";
80
+ }
81
+ return "none";
82
+ },
83
+
84
+ resolveShouldInitDynamicSchema() {
85
+ const source = this.getDynamicSchemaSourceType();
86
+ if (source === "none") {
87
+ return Promise.resolve(false);
88
+ }
89
+ const options = this.widget.options;
90
+ if (source === "api" && !getDynamicSchemaOption(options, "scriptCode")) {
91
+ return Promise.resolve(false);
92
+ }
93
+ if (source === "script" && !getDynamicSchemaOption(options, "frontendScript")) {
94
+ return Promise.resolve(false);
95
+ }
96
+ const script = getDynamicSchemaOption(options, "loadScript");
97
+ if (!script) {
98
+ return Promise.resolve(true);
99
+ }
100
+ const formRef = this.getFormRef();
101
+ if (!formRef || formRef.designState) {
102
+ return Promise.resolve(false);
103
+ }
104
+ try {
105
+ const result = this.handleCustomEvent(script);
106
+ if (result === false || result === null) {
107
+ return Promise.resolve(false);
108
+ }
109
+ return Promise.resolve(true);
110
+ } catch (e) {
111
+ return Promise.resolve(false);
112
+ }
113
+ },
114
+
70
115
  initDynamicSchema() {
71
116
  if (this.designState || !this.widget) return;
72
- const options = this.widget.options || {};
73
- if (!options.dynamicSchemaEnabled || !this.supportsRowLayout()) return;
117
+ if (!this.supportsRowLayout()) return;
118
+ if (this.getDynamicSchemaSourceType() === "none") return;
74
119
  this.$nextTick(() => {
75
- this.loadDynamicSchema();
120
+ this.resolveShouldInitDynamicSchema().then((shouldInit) => {
121
+ if (shouldInit) {
122
+ this.loadDynamicSchema();
123
+ }
124
+ });
76
125
  });
77
126
  },
78
127
 
79
128
  loadDynamicSchema() {
129
+ if (this.designState || !this.supportsRowLayout()) {
130
+ return Promise.resolve();
131
+ }
132
+ const source = this.getDynamicSchemaSourceType();
133
+ if (source === "script") {
134
+ return this.loadDynamicSchemaFromScript();
135
+ }
136
+ if (source === "api") {
137
+ return this.loadDynamicSchemaFromApi();
138
+ }
139
+ return Promise.resolve();
140
+ },
141
+
142
+ loadDynamicSchemaFromScript() {
143
+ const script = getDynamicSchemaOption(this.widget.options, "frontendScript");
144
+ if (!script) {
145
+ return Promise.resolve();
146
+ }
147
+ try {
148
+ const result = this.handleCustomEvent(script);
149
+ const defs = this.normalizeSchemaScriptResult(result);
150
+ this.buildDynamicRows(defs);
151
+ return Promise.resolve();
152
+ } catch (e) {
153
+ return Promise.resolve();
154
+ }
155
+ },
156
+
157
+ normalizeSchemaScriptResult(result) {
158
+ if (result === null || result === undefined) {
159
+ return [];
160
+ }
161
+ return extractDynamicSchemaItems(result);
162
+ },
163
+
164
+ loadDynamicSchemaFromApi() {
80
165
  const options = this.widget.options;
81
- if (
82
- this.designState
83
- || !options.dynamicSchemaEnabled
84
- || !getDynamicSchemaOption(options, "scriptCode")
85
- || !this.supportsRowLayout()
86
- ) {
166
+ if (!getDynamicSchemaOption(options, "scriptCode")) {
87
167
  return Promise.resolve();
88
168
  }
89
169
  const requestData = buildDynamicSchemaRequestData(
@@ -17,14 +17,22 @@
17
17
  <span v-if="!!subWidget.options.labelIconClass" class="custom-label">
18
18
  <template v-if="subWidget.options.labelIconPosition === 'front'">
19
19
  <template v-if="!!subWidget.options.labelTooltip">
20
- <el-tooltip :content="subWidget.options.labelTooltip" effect="light">
20
+ <el-tooltip
21
+ :content="subWidget.options.labelTooltip"
22
+ effect="light"
23
+ popper-class="label-tooltip-pre-line"
24
+ >
21
25
  <i :class="subWidget.options.labelIconClass"></i></el-tooltip>{{subWidget.options.label}}</template>
22
26
  <template v-else>
23
27
  <i :class="subWidget.options.labelIconClass"></i>{{subWidget.options.label}}</template>
24
28
  </template>
25
29
  <template v-else-if="subWidget.options.labelIconPosition === 'rear'">
26
30
  <template v-if="!!subWidget.options.labelTooltip">
27
- {{subWidget.options.label}}<el-tooltip :content="subWidget.options.labelTooltip" effect="light">
31
+ {{subWidget.options.label}}<el-tooltip
32
+ :content="subWidget.options.labelTooltip"
33
+ effect="light"
34
+ popper-class="label-tooltip-pre-line"
35
+ >
28
36
  <i :class="subWidget.options.labelIconClass"></i></el-tooltip></template>
29
37
  <template v-else>
30
38
  {{subWidget.options.label}}<i :class="subWidget.options.labelIconClass"></i></template>
@@ -50,6 +50,9 @@ export const DYNAMIC_SCHEMA_OPTION_KEYS = {
50
50
  scriptParam: ["dynamicSchemaScriptParam", "dynamicColumnScriptParam"],
51
51
  convert: ["dynamicSchemaConvert"],
52
52
  mode: ["dynamicSchemaMode", "dynamicColumnMode"],
53
+ sourceType: ["dynamicSchemaSourceType", "dynamicColumnSourceType"],
54
+ loadScript: ["dynamicSchemaLoadScript", "dynamicColumnLoadScript"],
55
+ frontendScript: ["dynamicSchemaScript", "dynamicColumnsScript"],
53
56
  };
54
57
 
55
58
  export const widgetTypeToEditFormatMap = {
@@ -389,12 +389,12 @@ export function buildFieldWidget(widget, formConfig) {
389
389
  let customLabelDom =
390
390
  `<template #label><span class="custom-label">${wop.labelIconPosition === 'front' ?
391
391
  (!!wop.labelTooltip ?
392
- `<el-tooltip content="${wop.labelTooltip}" effect="light"><i class="${wop.labelIconClass}"></i></el-tooltip>${wop.label}` :
392
+ `<el-tooltip content="${wop.labelTooltip}" effect="light" popper-class="label-tooltip-pre-line"><i class="${wop.labelIconClass}"></i></el-tooltip>${wop.label}` :
393
393
  `<i class="${wop.labelIconClass}"></i>${wop.label}`
394
394
  )
395
395
  :
396
396
  (!!wop.labelTooltip ?
397
- `${wop.label}<el-tooltip content="${wop.labelTooltip}" effect="light"><i class="${wop.labelIconClass}"></i></el-tooltip>` :
397
+ `${wop.label}<el-tooltip content="${wop.labelTooltip}" effect="light" popper-class="label-tooltip-pre-line"><i class="${wop.labelIconClass}"></i></el-tooltip>` :
398
398
  `${wop.label}<i class="${wop.labelIconClass}"></i>`
399
399
  )
400
400
  }
@@ -63,6 +63,24 @@ export function resolveColumnRequiredFlag(columnConfig) {
63
63
  return !!(widgetOptions?.required || editWidgetOptions?.required);
64
64
  }
65
65
 
66
+ function buildVxeTitlePrefixTooltip(tooltip) {
67
+ if (!tooltip) {
68
+ return {};
69
+ }
70
+ if (/\r?\n/.test(tooltip)) {
71
+ return {
72
+ content: tooltip
73
+ .replace(/&/g, "&amp;")
74
+ .replace(/</g, "&lt;")
75
+ .replace(/>/g, "&gt;")
76
+ .replace(/\r\n/g, "\n")
77
+ .replace(/\n/g, "<br/>"),
78
+ useHTML: true,
79
+ };
80
+ }
81
+ return { content: tooltip };
82
+ }
83
+
66
84
  export function applyColumnLabelIcon(col, columnConfig) {
67
85
  if (!col || !columnConfig) {
68
86
  return col;
@@ -86,7 +104,12 @@ export function applyColumnLabelIcon(col, columnConfig) {
86
104
  return h(
87
105
  "el-tooltip",
88
106
  {
89
- props: { content: tooltip, effect: "dark", placement: "top" },
107
+ props: {
108
+ content: tooltip,
109
+ effect: "dark",
110
+ placement: "top",
111
+ popperClass: "label-tooltip-pre-line",
112
+ },
90
113
  },
91
114
  [icon]
92
115
  );
@@ -95,7 +118,7 @@ export function applyColumnLabelIcon(col, columnConfig) {
95
118
  if (iconClass && position === "front" && !required) {
96
119
  col.titlePrefix = {
97
120
  icon: iconClass,
98
- ...(tooltip ? { content: tooltip } : {}),
121
+ ...buildVxeTitlePrefixTooltip(tooltip),
99
122
  };
100
123
  return col;
101
124
  }