cloud-web-corejs 1.0.54-dev.704 → 1.0.54-dev.706

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.54-dev.704",
4
+ "version": "1.0.54-dev.706",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -1,25 +1,3 @@
1
- function isNull(val) {
2
- return val == null || val === "" || val === undefined;
3
- }
4
-
5
- export function formatJsonContent(content) {
6
- if (isNull(content)) return "";
7
- if (typeof content === "object") {
8
- try {
9
- return JSON.stringify(content, null, 2);
10
- } catch (e) {
11
- return String(content);
12
- }
13
- }
14
- const text = String(content).trim();
15
- if (!text) return "";
16
- try {
17
- return JSON.stringify(JSON.parse(text), null, 2);
18
- } catch (e) {
19
- return text;
20
- }
21
- }
22
-
23
1
  function parseExportContent(content) {
24
2
  if (!content) {
25
3
  return { list: [], isArray: true };
@@ -62,129 +40,59 @@ export function getExportArchiveType(url) {
62
40
  return config ? config.type : null;
63
41
  }
64
42
 
65
- function getFormScriptPrefix(item) {
66
- const scriptCode = item.scriptCode || "script";
67
- const formCode = item.formCode;
68
- return formCode ? `S-${scriptCode}-${formCode}` : `S-${scriptCode}`;
43
+ function getFormScriptFileName(scriptCode, formCode) {
44
+ const code = scriptCode || "script";
45
+ return formCode ? `S&${code}&${formCode}` : `S&${code}`;
69
46
  }
70
47
 
71
- function appendFormTemplateExtraFiles(item, extraFiles, usedNames) {
48
+ function buildFormTemplateScriptExtras(item) {
72
49
  const formCode = item.formCode || "form";
50
+ const usedNames = {};
73
51
 
74
- if (!isNull(item.formViewContent)) {
75
- const formatted = formatJsonContent(item.formViewContent);
76
- item.formViewContent = formatted;
77
- extraFiles.push({
78
- fileName: uniqueFileName(`F-${formCode}-Item`, usedNames),
79
- content: formatted,
80
- });
81
- }
82
-
83
- (item.formScriptDTOs || []).forEach((scriptItem) => {
84
- if (!scriptItem || isNull(scriptItem.script)) return;
85
- const scriptCode = scriptItem.scriptCode || "script";
86
- const scriptFormCode = scriptItem.formCode || formCode;
87
- const formatted = formatJsonContent(scriptItem.script);
88
- scriptItem.script = formatted;
89
- extraFiles.push({
52
+ return (item.formScriptDTOs || []).reduce((files, scriptItem) => {
53
+ if (!scriptItem) return files;
54
+ files.push({
90
55
  fileName: uniqueFileName(
91
- `FS-${scriptCode}-${scriptFormCode}-Item`,
56
+ getFormScriptFileName(scriptItem.scriptCode, scriptItem.formCode || formCode),
92
57
  usedNames
93
58
  ),
94
- content: formatted,
95
- });
96
- });
97
- }
98
-
99
- function formatExportFields(item, archiveType) {
100
- if (archiveType === ARCHIVE_TYPE.FORM_SCRIPT && !isNull(item.script)) {
101
- item.script = formatJsonContent(item.script);
102
- return;
103
- }
104
- if (archiveType === ARCHIVE_TYPE.FORM_TEMPLATE) {
105
- if (!isNull(item.formViewContent)) {
106
- item.formViewContent = formatJsonContent(item.formViewContent);
107
- }
108
- (item.formScriptDTOs || []).forEach((scriptItem) => {
109
- if (scriptItem && !isNull(scriptItem.script)) {
110
- scriptItem.script = formatJsonContent(scriptItem.script);
111
- }
112
- });
113
- }
114
- }
115
-
116
- function processFormScriptArchive(item) {
117
- const prefix = getFormScriptPrefix(item);
118
- formatExportFields(item, ARCHIVE_TYPE.FORM_SCRIPT);
119
- const extraFiles = [];
120
-
121
- if (!isNull(item.script)) {
122
- extraFiles.push({
123
- fileName: `${prefix}-Item`,
124
- content: item.script,
59
+ content: JSON.stringify(scriptItem, null, 2),
125
60
  });
126
- }
127
-
128
- return {
129
- mainContent: JSON.stringify(item, null, 2),
130
- mainFileName: `${prefix}-Source`,
131
- extraFiles,
132
- };
133
- }
134
-
135
- function processFormTemplateArchive(item) {
136
- const formCode = item.formCode || "form";
137
- const extraFiles = [];
138
- const usedNames = {};
139
-
140
- appendFormTemplateExtraFiles(item, extraFiles, usedNames);
141
-
142
- return {
143
- mainContent: JSON.stringify(item, null, 2),
144
- mainFileName: `F-${formCode}-Source`,
145
- extraFiles,
146
- };
147
- }
148
-
149
- function processTableArchive(item) {
150
- return {
151
- mainContent: JSON.stringify(item, null, 2),
152
- mainFileName: `T-${item.taBm || "table"}`,
153
- extraFiles: [],
154
- };
61
+ return files;
62
+ }, []);
155
63
  }
156
64
 
157
- export function processArchiveExport(content, archiveType) {
158
- const { list, invalid } = parseExportContent(content);
159
- if (invalid || !list.length) {
160
- return { mainContent: content, mainFileName: null, extraFiles: [] };
161
- }
65
+ function buildArchiveResult(item, archiveType) {
66
+ const mainContent = JSON.stringify(item, null, 2);
162
67
 
163
- const item = list[0];
164
68
  switch (archiveType) {
165
69
  case ARCHIVE_TYPE.FORM_SCRIPT:
166
- return processFormScriptArchive(item);
70
+ return {
71
+ mainContent,
72
+ mainFileName: getFormScriptFileName(item.scriptCode, item.formCode),
73
+ extraFiles: [],
74
+ };
167
75
  case ARCHIVE_TYPE.FORM_TEMPLATE:
168
- return processFormTemplateArchive(item);
76
+ return {
77
+ mainContent,
78
+ mainFileName: `F&${item.formCode || "form"}`,
79
+ extraFiles: buildFormTemplateScriptExtras(item),
80
+ };
169
81
  case ARCHIVE_TYPE.TABLE:
170
- return processTableArchive(item);
82
+ return {
83
+ mainContent,
84
+ mainFileName: `T&${item.taBm || "table"}`,
85
+ extraFiles: [],
86
+ };
171
87
  default:
172
- return { mainContent: content, mainFileName: null, extraFiles: [] };
88
+ return { mainContent, mainFileName: null, extraFiles: [] };
173
89
  }
174
90
  }
175
91
 
176
- /** 批量导出:仅格式化主 JSON 中的大字段,不额外拆文件 */
177
- export function formatBatchExportContent(content, url) {
178
- const archiveType = getExportArchiveType(url);
179
- if (!archiveType || archiveType === ARCHIVE_TYPE.TABLE) {
180
- return content;
181
- }
182
-
183
- const { list, isArray, invalid } = parseExportContent(content);
92
+ export function processArchiveExport(content, archiveType) {
93
+ const { list, invalid } = parseExportContent(content);
184
94
  if (invalid || !list.length) {
185
- return content;
95
+ return { mainContent: content, mainFileName: null, extraFiles: [] };
186
96
  }
187
-
188
- list.forEach((item) => formatExportFields(item, archiveType));
189
- return JSON.stringify(isArray ? list : list[0], null, 2);
97
+ return buildArchiveResult(list[0], archiveType);
190
98
  }
@@ -5,7 +5,6 @@ import exportDialog from "./exportDialog.vue";
5
5
  import { getBdEnv } from "@base/api/user";
6
6
  import { encrypt } from "@base/utils/aes";
7
7
  import {
8
- formatBatchExportContent,
9
8
  getExportArchiveType,
10
9
  processArchiveExport,
11
10
  } from "./exportUtil";
@@ -107,9 +106,12 @@ moudule.install = function (Vue) {
107
106
  if (archiveType) {
108
107
  const processed = processArchiveExport(content, archiveType);
109
108
  downloadTxt(processed.mainFileName, processed.mainContent);
110
- downloadExtraFiles(processed.extraFiles);
109
+ (processed.extraFiles || []).forEach((file, index) => {
110
+ setTimeout(() => {
111
+ downloadTxt(file.fileName, file.content);
112
+ }, (index + 1) * 300);
113
+ });
111
114
  } else {
112
- content = formatBatchExportContent(content, options.url);
113
115
  let fileName = options.fileName;
114
116
  if (!fileName) {
115
117
  const timeStr = res.time
@@ -157,15 +159,6 @@ moudule.install = function (Vue) {
157
159
  };
158
160
  };
159
161
 
160
- function downloadExtraFiles(extraFiles) {
161
- if (!extraFiles || !extraFiles.length) return;
162
- extraFiles.forEach((file, index) => {
163
- setTimeout(() => {
164
- downloadTxt(file.fileName, file.content);
165
- }, (index + 1) * 300);
166
- });
167
- }
168
-
169
162
  function downloadTxt(fileName, content) {
170
163
  // 创建Blob对象
171
164
  const blob = new Blob([content], { type: "text/plain;charset=utf-8" });
@@ -84,7 +84,11 @@
84
84
  >
85
85
  <template v-if="field.options.labelIconPosition === 'front'">
86
86
  <template v-if="!!field.options.labelTooltip">
87
- <el-tooltip :content="field.options.labelTooltip" effect="dark">
87
+ <el-tooltip
88
+ :content="field.options.labelTooltip"
89
+ effect="dark"
90
+ popper-class="label-tooltip-pre-line"
91
+ >
88
92
  <i :class="field.options.labelIconClass"></i></el-tooltip
89
93
  ><span :style="{ color: field.options.labelColor }">{{
90
94
  label
@@ -105,6 +109,7 @@
105
109
  ><el-tooltip
106
110
  :content="field.options.labelTooltip"
107
111
  effect="dark"
112
+ popper-class="label-tooltip-pre-line"
108
113
  >
109
114
  <i :class="field.options.labelIconClass"></i></el-tooltip
110
115
  ></template>
@@ -647,14 +647,56 @@
647
647
  :label="i18nt('designer.setting.labelTooltip')"
648
648
  class="form-item-full"
649
649
  >
650
- <el-input
651
- type="text"
652
- v-model="rowData.labelTooltip"
653
- clearable
654
- ></el-input>
650
+ <a
651
+ href="javascript:void(0);"
652
+ class="a-link link-oneLind"
653
+ @click="openLabelTooltipDialog"
654
+ >
655
+ <span>{{ rowData.labelTooltip }}</span>
656
+ <i class="el-icon-edit"></i>
657
+ </a>
655
658
  </el-form-item>
656
659
  </el-form>
657
660
  </div>
661
+ <el-dialog
662
+ v-if="labelTooltipDialogVisible"
663
+ custom-class="dialog-style"
664
+ :title="i18nt('designer.setting.labelTooltip')"
665
+ :visible.sync="labelTooltipDialogVisible"
666
+ :show-close="true"
667
+ :append-to-body="true"
668
+ :modal="false"
669
+ :close-on-click-modal="false"
670
+ :close-on-press-escape="false"
671
+ :destroy-on-close="true"
672
+ width="520px"
673
+ v-dialog-drag
674
+ >
675
+ <el-input
676
+ type="textarea"
677
+ :rows="14"
678
+ class="label-tooltip-textarea"
679
+ v-model="labelTooltipValue"
680
+ clearable
681
+ ></el-input>
682
+ <div class="dialog-footer" slot="footer">
683
+ <el-button
684
+ @click="labelTooltipDialogVisible = false"
685
+ class="button-sty"
686
+ icon="el-icon-close"
687
+ >
688
+ {{ i18nt("designer.hint.cancel") }}
689
+ </el-button>
690
+ <el-button
691
+ type="primary"
692
+ @click="submitLabelTooltipDialog"
693
+ class="button-sty"
694
+ icon="el-icon-check"
695
+ >
696
+ {{ i18nt("designer.hint.confirm") }}
697
+ </el-button>
698
+ </div>
699
+ </el-dialog>
658
700
  <div class="dialog-footer" slot="footer">
659
701
  <el-button
660
702
  @click="closeRowEditDialog"
@@ -985,6 +1027,8 @@ export default {
985
1027
  rowData: null,
986
1028
  rowDataIndex: 0,
987
1029
  showRowEditDialog: false,
1030
+ labelTooltipDialogVisible: false,
1031
+ labelTooltipValue: "",
988
1032
  sourceTableColumnsSnapshot: null,
989
1033
  };
990
1034
  },
@@ -1964,9 +2008,20 @@ export default {
1964
2008
  this.editRowData.widgetList = this.rowData.widgetList;
1965
2009
  }
1966
2010
  this.showRowEditDialog = false;
2011
+ this.labelTooltipDialogVisible = false;
1967
2012
  },
1968
2013
  closeRowEditDialog() {
1969
2014
  this.showRowEditDialog = false;
2015
+ this.labelTooltipDialogVisible = false;
2016
+ },
2017
+ openLabelTooltipDialog() {
2018
+ this.labelTooltipValue = this.rowData.labelTooltip || "";
2019
+ this.labelTooltipDialogVisible = true;
2020
+ },
2021
+ submitLabelTooltipDialog() {
2022
+ const value = (this.labelTooltipValue || "").trim();
2023
+ this.rowData.labelTooltip = value || null;
2024
+ this.labelTooltipDialogVisible = false;
1970
2025
  },
1971
2026
  },
1972
2027
  };
@@ -2037,4 +2092,8 @@ export default {
2037
2092
  margin: 10px 0;
2038
2093
  }
2039
2094
  }
2095
+
2096
+ ::v-deep .label-tooltip-textarea textarea {
2097
+ min-height: 320px;
2098
+ }
2040
2099
  </style>
@@ -1,7 +1,42 @@
1
1
  <template>
2
- <el-form-item :label="i18nt('designer.setting.labelTooltip')">
3
- <el-input type="text" v-model="optionModel.labelTooltip"></el-input>
4
- </el-form-item>
2
+ <div>
3
+ <el-form-item :label="i18nt('designer.setting.labelTooltip')">
4
+ <a href="javascript:void(0);" class="a-link link-oneLind" @click="openDialog">
5
+ <span>{{ optionModel.labelTooltip }}</span>
6
+ <i class="el-icon-edit"></i>
7
+ </a>
8
+ </el-form-item>
9
+ <el-dialog
10
+ v-if="dialogVisible"
11
+ custom-class="dialog-style"
12
+ :title="i18nt('designer.setting.labelTooltip')"
13
+ :visible.sync="dialogVisible"
14
+ :show-close="true"
15
+ :append-to-body="true"
16
+ :modal="false"
17
+ :close-on-click-modal="false"
18
+ :close-on-press-escape="false"
19
+ :destroy-on-close="true"
20
+ width="520px"
21
+ v-dialog-drag
22
+ >
23
+ <el-input
24
+ type="textarea"
25
+ :rows="14"
26
+ class="label-tooltip-textarea"
27
+ v-model="labelTooltipValue"
28
+ clearable
29
+ ></el-input>
30
+ <div class="dialog-footer" slot="footer">
31
+ <el-button @click="dialogVisible = false" class="button-sty" icon="el-icon-close">
32
+ {{ i18nt("designer.hint.cancel") }}
33
+ </el-button>
34
+ <el-button type="primary" @click="submitDialog" class="button-sty" icon="el-icon-check">
35
+ {{ i18nt("designer.hint.confirm") }}
36
+ </el-button>
37
+ </div>
38
+ </el-dialog>
39
+ </div>
5
40
  </template>
6
41
 
7
42
  <script>
@@ -15,7 +50,28 @@ export default {
15
50
  selectedWidget: Object,
16
51
  optionModel: Object,
17
52
  },
53
+ data() {
54
+ return {
55
+ dialogVisible: false,
56
+ labelTooltipValue: "",
57
+ };
58
+ },
59
+ methods: {
60
+ openDialog() {
61
+ this.labelTooltipValue = this.optionModel.labelTooltip || "";
62
+ this.dialogVisible = true;
63
+ },
64
+ submitDialog() {
65
+ const value = (this.labelTooltipValue || "").trim();
66
+ this.optionModel.labelTooltip = value || null;
67
+ this.dialogVisible = false;
68
+ },
69
+ },
18
70
  };
19
71
  </script>
20
72
 
21
- <style scoped></style>
73
+ <style scoped>
74
+ ::v-deep .label-tooltip-textarea textarea {
75
+ min-height: 320px;
76
+ }
77
+ </style>
@@ -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>
@@ -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
  }