cloud-web-corejs 1.1.0-dev.61 → 1.1.0-dev.63

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,228 +1,232 @@
1
- {
2
- "name": "cloud-web-corejs",
3
- "private": false,
4
- "version": "1.1.0-dev.61",
5
- "scripts": {
6
- "build:ace-resources": "node build/build-ace-resources.js",
7
- "build:tinymce-resources": "node build/build-tinymce-resources.js",
8
- "build:luckysheet-resources": "node build/build-luckysheet-resources.js",
9
- "build:activiti-resources": "node build/build-activiti-resources.js",
10
- "check:resource-tools": "node --test tests/resources/*.test.js",
11
- "check:package-size": "node build/check-package-size.js",
12
- "create:child": "node bin/create-child-app.js",
13
- "check:child-app": "node build/check-child-app.js",
14
- "check:child-browser": "node build/check-child-browser.js",
15
- "dev": "vue-cli-service serve",
16
- "dev:micro": "vue-cli-service serve --port 17527",
17
- "check:package-resources": "node build/check-package-resources.js",
18
- "check:minimal-consumer": "node build/check-minimal-consumer-build.js",
19
- "lint": "eslint --ext .js,.vue src",
20
- "build:prod": "vue-cli-service build",
21
- "build:stage": "vue-cli-service build --mode staging",
22
- "analyze": "vue-cli-service build --report",
23
- "preview": "node build/index.js --preview",
24
- "new": "plop",
25
- "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml",
26
- "test:unit": "jest --clearCache && vue-cli-service test:unit",
27
- "test:ci": "npm run check:resource-tools && npm run check:package-resources && npm run check:package-size && npm run check:minimal-consumer && npm run lint && npm run test:unit",
28
- "updateCorejs": "npm install cloud-web-corejs --registry https://registry.npmjs.org",
29
- "publishDev": "npm publish --tag dev"
30
- },
31
- "dependencies": {
32
- "@claviska/jquery-minicolors": "2.3.6",
33
- "@codemirror/lang-javascript": "^6.1.9",
34
- "@codemirror/state": "^6.5.4",
35
- "@codemirror/view": "^6.39.13",
36
- "@formulajs/formulajs": "^4.3.1",
37
- "@vue/composition-api": "1.0.5",
38
- "ace-builds": "1.11.0",
39
- "axios": "0.18.1",
40
- "canvg": "3.0.10",
41
- "clipboard": "2.0.8",
42
- "codemirror": "^6.0.1",
43
- "concurrent-tasks": "1.0.7",
44
- "core-js": "^3.8.3",
45
- "crypto-js": "^4.2.0",
46
- "dhtmlx-gantt": "^9.1.1",
47
- "dompurify": "^3.3.1",
48
- "echarts": "5.1.2",
49
- "element-ui": "^2.15.14",
50
- "esdk-obs-browserjs": "^3.25.6",
51
- "exceljs": "^4.4.0",
52
- "file-saver": "2.0.5",
53
- "html2canvas": "^1.4.1",
54
- "jquery": "3.6.0",
55
- "js-base64": "^3.7.7",
56
- "js-cookie": "2.2.0",
57
- "jsbarcode": "3.11.5",
58
- "jspdf": "^3.0.1",
59
- "jsqr": "^1.4.0",
60
- "lodash": "4.17.21",
61
- "luckyexcel": "^1.0.1",
62
- "moment": "2.29.4",
63
- "normalize.css": "7.0.0",
64
- "nprogress": "0.2.0",
65
- "nzh": "1.0.8",
66
- "qiankun": "^2.10.16",
67
- "qrcode": "^1.5.1",
68
- "qs": "6.10.3",
69
- "socket.io-client": "4.5.1",
70
- "sortablejs": "^1.8.4",
71
- "spark-md5": "^3.0.1",
72
- "swiper": "4.0.7",
73
- "vue": "2.6.12",
74
- "vue-echarts": "6.0.0",
75
- "vue-i18n": "^8.22.2",
76
- "vue-ls": "^4.2.0",
77
- "vue-router": "3.0.2",
78
- "vuedraggable": "2.24.3",
79
- "vuex": "3.1.0",
80
- "vxe-table": "3.5.9",
81
- "xe-utils": "3.5.2",
82
- "xlsx": "^0.14.1"
83
- },
84
- "devDependencies": {
85
- "@babel/core": "^7.12.16",
86
- "@babel/eslint-parser": "^7.12.16",
87
- "@babel/plugin-syntax-dynamic-import": "^7.8.3",
88
- "@vue/cli-plugin-babel": "~5.0.0",
89
- "@vue/cli-plugin-eslint": "~5.0.0",
90
- "@vue/cli-plugin-unit-jest": "~5.0.9",
91
- "@vue/cli-service": "~5.0.0",
92
- "@vue/test-utils": "^1.3.6",
93
- "@vue/vue2-jest": "^27.0.0",
94
- "autoprefixer": "9.5.1",
95
- "babel-plugin-dynamic-import-node": "2.3.3",
96
- "chalk": "2.4.2",
97
- "compression-webpack-plugin": "5.0.2",
98
- "connect": "3.6.6",
99
- "eslint": "^7.32.0",
100
- "eslint-plugin-vue": "^8.0.3",
101
- "html-webpack-plugin": "~5.0.0",
102
- "husky": "1.3.1",
103
- "lint-staged": "8.1.5",
104
- "node-polyfill-webpack-plugin": "^4.0.0",
105
- "plop": "2.3.0",
106
- "postcss": "^8.2.8",
107
- "postcss-loader": "^4.0.4",
108
- "runjs": "4.4.2",
109
- "sass": "^1.32.7",
110
- "sass-loader": "^12.0.0",
111
- "serve-static": "1.13.2",
112
- "speed-measure-webpack-plugin": "^1.5.0",
113
- "svg-sprite-loader": "^6.0.11",
114
- "svgo": "1.2.0",
115
- "vue-template-compiler": "2.6.12",
116
- "webpack-bundle-analyzer": "^4.9.1"
117
- },
118
- "eslintConfig": {
119
- "root": true,
120
- "env": {
121
- "node": true
122
- },
123
- "extends": [
124
- "plugin:vue/essential",
125
- "eslint:recommended"
126
- ],
127
- "parserOptions": {
128
- "parser": "@babel/eslint-parser"
129
- },
130
- "rules": {}
131
- },
132
- "engines": {
133
- "node": ">=8.9",
134
- "npm": ">= 3.0.0"
135
- },
136
- "files": [
137
- "bin/core-resources.js",
138
- "resource-tools",
139
- "bin/create-child-app.js",
140
- "templates/child-app",
141
- "docs/child-app",
142
- "docs/qiankun接入协议.md",
143
- "docs/qiankun详情承载子应用对接清单.md",
144
- "src/components/advancedSearchDialog",
145
- "src/components/baseAlert",
146
- "src/components/baseAttachment",
147
- "src/components/baseArea",
148
- "src/components/baseInputBatch",
149
- "src/components/baseInputExport",
150
- "src/components/baseInputNumber",
151
- "src/components/baseInputPrint",
152
- "src/components/baseTabs",
153
- "src/components/base-textarea",
154
- "src/components/cnPrint",
155
- "src/components/code-editor",
156
- "src/components/confirmDialog",
157
- "src/components/errorMsg",
158
- "src/components/excelExport",
159
- "src/components/excelImport",
160
- "src/components/extendedProperties",
161
- "src/components/fileLibrary",
162
- "src/components/formOplog",
163
- "src/components/hiprint",
164
- "src/components/jdPrint",
165
- "src/components/jsonImport",
166
- "src/components/langImport",
167
- "src/components/micro-view-host",
168
- "src/components/mobile",
169
- "src/components/onlineTalk",
170
- "src/components/oplogTable",
171
- "src/components/pddPrint",
172
- "src/components/projectTag",
173
- "src/components/Qrcode",
174
- "src/components/scriptDescription",
175
- "src/components/scriptTest",
176
- "src/components/statusTag",
177
- "src/components/SvgIcon",
178
- "src/components/table",
179
- "src/components/tempStorage",
180
- "src/components/Tinymce",
181
- "src/components/luckysheet",
182
- "src/components/obsUpload",
183
- "src/components/VabUpload",
184
- "src/components/vb-tabs",
185
- "src/components/video",
186
- "src/components/vipPrint",
187
- "src/components/wf",
188
- "src/components/xform",
189
- "src/components/xhsPrint",
190
- "src/components/langTag",
191
- "src/components/formDialog",
192
- "src/components/formDrawer",
193
- "src/components/bizTab",
194
- "src/api",
195
- "src/views/bd",
196
- "src/views/support",
197
- "src/views/user",
198
- "src/views/mobile/user",
199
- "src/utils",
200
- "src/mixins",
201
- "src/directive",
202
- "src/store",
203
- "src/core-resources",
204
- "src/styles",
205
- "src/icons",
206
- "src/lang/index.js",
207
- "src/lang/locale/en/login.js",
208
- "src/lang/locale/zh/login.js",
209
- "src/layout",
210
- "src/filters",
211
- "src/router",
212
- "src/permission.js",
213
- "src/index.js",
214
- "src/index.next.js",
215
- "src/index.sync.js",
216
- "src/boot-assets.legacy.js",
217
- "src/boot-assets.next.js",
218
- "src/app-bootstrap.js",
219
- "src/app-bootstrap.sync.js",
220
- "src/public-path.js",
221
- "src/microRouter",
222
- "src/App.vue"
223
- ],
224
- "publishConfig": {
225
- "access": "public",
226
- "registry": "https://registry.npmjs.org/"
227
- }
228
- }
1
+ {
2
+ "name": "cloud-web-corejs",
3
+ "private": false,
4
+ "version": "1.1.0-dev.63",
5
+ "scripts": {
6
+ "build:ace-resources": "node build/build-ace-resources.js",
7
+ "build:tinymce-resources": "node build/build-tinymce-resources.js",
8
+ "build:luckysheet-resources": "node build/build-luckysheet-resources.js",
9
+ "build:activiti-resources": "node build/build-activiti-resources.js",
10
+ "check:resource-tools": "node --test tests/resources/*.test.js",
11
+ "check:package-size": "node build/check-package-size.js",
12
+ "create:child": "node bin/create-child-app.js",
13
+ "check:child-app": "node build/check-child-app.js",
14
+ "check:child-browser": "node build/check-child-browser.js",
15
+ "dev": "vue-cli-service serve",
16
+ "dev:micro": "vue-cli-service serve --port 17527",
17
+ "check:package-resources": "node build/check-package-resources.js",
18
+ "check:minimal-consumer": "node build/check-minimal-consumer-build.js",
19
+ "lint": "eslint --ext .js,.vue src",
20
+ "lint:haier": "eslint --no-ignore --ext .js,.vue src/views/haier",
21
+ "build:prod": "vue-cli-service build",
22
+ "build:stage": "vue-cli-service build --mode staging",
23
+ "analyze": "vue-cli-service build --report",
24
+ "preview": "node build/index.js --preview",
25
+ "new": "plop",
26
+ "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml",
27
+ "test:unit": "jest --clearCache && vue-cli-service test:unit",
28
+ "test:haier": "jest --runInBand --testPathPattern=haier",
29
+ "haier:capabilities": "node build/haier-migration-capabilities.js",
30
+ "check:haier-capabilities": "node tests/haier-migration/capabilities.test.js",
31
+ "test:ci": "npm run check:resource-tools && npm run check:package-resources && npm run check:package-size && npm run check:minimal-consumer && npm run lint && npm run lint:haier && npm run test:unit",
32
+ "updateCorejs": "npm install cloud-web-corejs --registry https://registry.npmjs.org",
33
+ "publishDev": "npm publish --tag dev"
34
+ },
35
+ "dependencies": {
36
+ "@claviska/jquery-minicolors": "2.3.6",
37
+ "@codemirror/lang-javascript": "^6.1.9",
38
+ "@codemirror/state": "^6.5.4",
39
+ "@codemirror/view": "^6.39.13",
40
+ "@formulajs/formulajs": "^4.3.1",
41
+ "@vue/composition-api": "1.0.5",
42
+ "ace-builds": "1.11.0",
43
+ "axios": "0.18.1",
44
+ "canvg": "3.0.10",
45
+ "clipboard": "2.0.8",
46
+ "codemirror": "^6.0.1",
47
+ "concurrent-tasks": "1.0.7",
48
+ "core-js": "^3.8.3",
49
+ "crypto-js": "^4.2.0",
50
+ "dhtmlx-gantt": "^9.1.1",
51
+ "dompurify": "^3.3.1",
52
+ "echarts": "5.1.2",
53
+ "element-ui": "^2.15.14",
54
+ "esdk-obs-browserjs": "^3.25.6",
55
+ "exceljs": "^4.4.0",
56
+ "file-saver": "2.0.5",
57
+ "html2canvas": "^1.4.1",
58
+ "jquery": "3.6.0",
59
+ "js-base64": "^3.7.7",
60
+ "js-cookie": "2.2.0",
61
+ "jsbarcode": "3.11.5",
62
+ "jspdf": "^3.0.1",
63
+ "jsqr": "^1.4.0",
64
+ "lodash": "4.17.21",
65
+ "luckyexcel": "^1.0.1",
66
+ "moment": "2.29.4",
67
+ "normalize.css": "7.0.0",
68
+ "nprogress": "0.2.0",
69
+ "nzh": "1.0.8",
70
+ "qiankun": "^2.10.16",
71
+ "qrcode": "^1.5.1",
72
+ "qs": "6.10.3",
73
+ "socket.io-client": "4.5.1",
74
+ "sortablejs": "^1.8.4",
75
+ "spark-md5": "^3.0.1",
76
+ "swiper": "4.0.7",
77
+ "vue": "2.6.12",
78
+ "vue-echarts": "6.0.0",
79
+ "vue-i18n": "^8.22.2",
80
+ "vue-ls": "^4.2.0",
81
+ "vue-router": "3.0.2",
82
+ "vuedraggable": "2.24.3",
83
+ "vuex": "3.1.0",
84
+ "vxe-table": "3.5.9",
85
+ "xe-utils": "3.5.2",
86
+ "xlsx": "^0.14.1"
87
+ },
88
+ "devDependencies": {
89
+ "@babel/core": "^7.12.16",
90
+ "@babel/eslint-parser": "^7.12.16",
91
+ "@babel/plugin-syntax-dynamic-import": "^7.8.3",
92
+ "@vue/cli-plugin-babel": "~5.0.0",
93
+ "@vue/cli-plugin-eslint": "~5.0.0",
94
+ "@vue/cli-plugin-unit-jest": "~5.0.9",
95
+ "@vue/cli-service": "~5.0.0",
96
+ "@vue/test-utils": "^1.3.6",
97
+ "@vue/vue2-jest": "^27.0.0",
98
+ "autoprefixer": "9.5.1",
99
+ "babel-plugin-dynamic-import-node": "2.3.3",
100
+ "chalk": "2.4.2",
101
+ "compression-webpack-plugin": "5.0.2",
102
+ "connect": "3.6.6",
103
+ "eslint": "^7.32.0",
104
+ "eslint-plugin-vue": "^8.0.3",
105
+ "html-webpack-plugin": "~5.0.0",
106
+ "husky": "1.3.1",
107
+ "lint-staged": "8.1.5",
108
+ "node-polyfill-webpack-plugin": "^4.0.0",
109
+ "plop": "2.3.0",
110
+ "postcss": "^8.2.8",
111
+ "postcss-loader": "^4.0.4",
112
+ "runjs": "4.4.2",
113
+ "sass": "^1.32.7",
114
+ "sass-loader": "^12.0.0",
115
+ "serve-static": "1.13.2",
116
+ "speed-measure-webpack-plugin": "^1.5.0",
117
+ "svg-sprite-loader": "^6.0.11",
118
+ "svgo": "1.2.0",
119
+ "vue-template-compiler": "2.6.12",
120
+ "webpack-bundle-analyzer": "^4.9.1"
121
+ },
122
+ "eslintConfig": {
123
+ "root": true,
124
+ "env": {
125
+ "node": true
126
+ },
127
+ "extends": [
128
+ "plugin:vue/essential",
129
+ "eslint:recommended"
130
+ ],
131
+ "parserOptions": {
132
+ "parser": "@babel/eslint-parser"
133
+ },
134
+ "rules": {}
135
+ },
136
+ "engines": {
137
+ "node": ">=8.9",
138
+ "npm": ">= 3.0.0"
139
+ },
140
+ "files": [
141
+ "bin/core-resources.js",
142
+ "resource-tools",
143
+ "bin/create-child-app.js",
144
+ "templates/child-app",
145
+ "docs/child-app",
146
+ "docs/qiankun接入协议.md",
147
+ "docs/qiankun详情承载子应用对接清单.md",
148
+ "src/components/advancedSearchDialog",
149
+ "src/components/baseAlert",
150
+ "src/components/baseAttachment",
151
+ "src/components/baseArea",
152
+ "src/components/baseInputBatch",
153
+ "src/components/baseInputExport",
154
+ "src/components/baseInputNumber",
155
+ "src/components/baseInputPrint",
156
+ "src/components/baseTabs",
157
+ "src/components/base-textarea",
158
+ "src/components/cnPrint",
159
+ "src/components/code-editor",
160
+ "src/components/confirmDialog",
161
+ "src/components/errorMsg",
162
+ "src/components/excelExport",
163
+ "src/components/excelImport",
164
+ "src/components/extendedProperties",
165
+ "src/components/fileLibrary",
166
+ "src/components/formOplog",
167
+ "src/components/hiprint",
168
+ "src/components/jdPrint",
169
+ "src/components/jsonImport",
170
+ "src/components/langImport",
171
+ "src/components/micro-view-host",
172
+ "src/components/mobile",
173
+ "src/components/onlineTalk",
174
+ "src/components/oplogTable",
175
+ "src/components/pddPrint",
176
+ "src/components/projectTag",
177
+ "src/components/Qrcode",
178
+ "src/components/scriptDescription",
179
+ "src/components/scriptTest",
180
+ "src/components/statusTag",
181
+ "src/components/SvgIcon",
182
+ "src/components/table",
183
+ "src/components/tempStorage",
184
+ "src/components/Tinymce",
185
+ "src/components/luckysheet",
186
+ "src/components/obsUpload",
187
+ "src/components/VabUpload",
188
+ "src/components/vb-tabs",
189
+ "src/components/video",
190
+ "src/components/vipPrint",
191
+ "src/components/wf",
192
+ "src/components/xform",
193
+ "src/components/xhsPrint",
194
+ "src/components/langTag",
195
+ "src/components/formDialog",
196
+ "src/components/formDrawer",
197
+ "src/components/bizTab",
198
+ "src/api",
199
+ "src/views/bd",
200
+ "src/views/support",
201
+ "src/views/user",
202
+ "src/views/mobile/user",
203
+ "src/utils",
204
+ "src/mixins",
205
+ "src/directive",
206
+ "src/store",
207
+ "src/core-resources",
208
+ "src/styles",
209
+ "src/icons",
210
+ "src/lang/index.js",
211
+ "src/lang/locale/en/login.js",
212
+ "src/lang/locale/zh/login.js",
213
+ "src/layout",
214
+ "src/filters",
215
+ "src/router",
216
+ "src/permission.js",
217
+ "src/index.js",
218
+ "src/index.next.js",
219
+ "src/index.sync.js",
220
+ "src/boot-assets.legacy.js",
221
+ "src/boot-assets.next.js",
222
+ "src/app-bootstrap.js",
223
+ "src/app-bootstrap.sync.js",
224
+ "src/public-path.js",
225
+ "src/microRouter",
226
+ "src/App.vue"
227
+ ],
228
+ "publishConfig": {
229
+ "access": "public",
230
+ "registry": "https://registry.npmjs.org/"
231
+ }
232
+ }
@@ -43,6 +43,24 @@ import plugins from "./plugins";
43
43
  import toolbar from "./toolbar";
44
44
  import load from "./dynamicLoadScript";
45
45
  import { richTextResourcePath } from "../../utils/featureResources";
46
+
47
+ function isBlankRichText(val) {
48
+ if (val == null) return true;
49
+ const html = String(val);
50
+ if (!html.trim()) return true;
51
+ const text = html
52
+ .replace(/<br\s*\/?>/gi, "")
53
+ .replace(/&nbsp;/gi, " ")
54
+ .replace(/<[^>]+>/g, "")
55
+ .trim();
56
+ if (text) return false;
57
+ return !/<(img|video|audio|iframe|table|hr)\b/i.test(html);
58
+ }
59
+
60
+ function sameRichText(a, b) {
61
+ if ((a || "") === (b || "")) return true;
62
+ return isBlankRichText(a) && isBlankRichText(b);
63
+ }
46
64
  // import EditorImage from './components/EditorImage.vue'
47
65
 
48
66
  // why use this cdn, detail see https://github.com/PanJiaChen/tinymce-all-in-one
@@ -98,6 +116,7 @@ export default {
98
116
  initializing: false,
99
117
  initGeneration: 0,
100
118
  hasChange: false,
119
+ applyingExternal: false,
101
120
  hasInit: false,
102
121
  isActivated: true,
103
122
  tinymceId: this.id,
@@ -122,12 +141,13 @@ export default {
122
141
  },
123
142
  watch: {
124
143
  value(val) {
125
- if (!this.hasChange && this.hasInit) {
126
- this.$nextTick(() => {
127
- const editor = window.tinymce && window.tinymce.get(this.tinymceId);
128
- if (editor) editor.setContent(val || "");
129
- });
130
- }
144
+ this.syncEditorContent(val);
145
+ },
146
+ readonly() {
147
+ this.applyReadonly();
148
+ },
149
+ height() {
150
+ this.applyHeight();
131
151
  },
132
152
  },
133
153
  mounted() {
@@ -222,10 +242,19 @@ export default {
222
242
  }
223
243
  _this.hasInit = true;
224
244
  _this.initializing = false;
245
+ _this.applyReadonly();
246
+ _this.applyHeight();
225
247
  editor.on("NodeChange Change KeyUp SetContent", () => {
248
+ if (this.applyingExternal) return;
226
249
  this.hasChange = true;
227
250
  this.$emit("input", editor.getContent());
228
251
  });
252
+ editor.on("focus", (event) => {
253
+ this.$emit("focus", event);
254
+ });
255
+ editor.on("blur", (event) => {
256
+ this.$emit("blur", event);
257
+ });
229
258
  },
230
259
  setup(editor) {
231
260
  editor.on("FullscreenStateChanged", (e) => {
@@ -309,6 +338,30 @@ export default {
309
338
  }
310
339
  }
311
340
  },
341
+ syncEditorContent(val) {
342
+ if (!this.hasInit || this.applyingExternal) return;
343
+ this.$nextTick(() => {
344
+ const editor = window.tinymce && window.tinymce.get(this.tinymceId);
345
+ if (!editor || this.applyingExternal) return;
346
+ const incoming = val == null ? "" : String(val);
347
+ if (sameRichText(incoming, editor.getContent())) return;
348
+ this.applyingExternal = true;
349
+ editor.setContent(incoming);
350
+ this.applyingExternal = false;
351
+ });
352
+ },
353
+ applyReadonly() {
354
+ const editor = window.tinymce && window.tinymce.get(this.tinymceId);
355
+ if (editor && typeof editor.setMode === "function") {
356
+ editor.setMode(this.readonly ? "readonly" : "design");
357
+ }
358
+ },
359
+ applyHeight() {
360
+ const editor = window.tinymce && window.tinymce.get(this.tinymceId);
361
+ const height = parseInt(this.height, 10);
362
+ if (!editor || !editor.iframeElement || !height) return;
363
+ editor.iframeElement.style.height = height + "px";
364
+ },
312
365
  setContent(value) {
313
366
  const editor = window.tinymce && window.tinymce.get(this.tinymceId);
314
367
  if (editor) editor.setContent(value);
@@ -1,23 +1,37 @@
1
1
  <template>
2
- <!-- <form-item-wrapper :designer="designer" :field="field" :rules="rules" :design-state="designState"
2
+ <form-item-wrapper :designer="designer" :field="field" :rules="rules" :design-state="designState"
3
3
  :parent-widget="parentWidget" :parent-list="parentList" :index-of-parent-list="indexOfParentList"
4
4
  :sub-form-row-index="subFormRowIndex" :sub-form-col-index="subFormColIndex" :sub-form-row-id="subFormRowId">
5
- <vue-editor ref="fieldEditor" v-model="fieldModel" :editor-toolbar="customToolbar"
6
- :disabled="field.options.disabled" :placeholder="getI18nLabel(field.options.placeholder)"
7
- @text-change="handleRichEditorChangeEvent"
8
- @focus="handleRichEditorFocusEvent" @blur="handleRichEditorBlurEvent">
9
- </vue-editor>
10
- </form-item-wrapper> -->
5
+ <div class="rich-editor-host">
6
+ <tinymce ref="fieldEditor" :value="designState ? '' : (fieldModel || '')" :readonly="!designState && isReadonly"
7
+ :height="editorHeight" @input="handleRichEditorInput" @focus="handleRichEditorFocus"
8
+ @blur="handleRichEditorBlur">
9
+ </tinymce>
10
+ <div v-if="designState" class="rich-editor-mask"></div>
11
+ </div>
12
+ </form-item-wrapper>
11
13
  </template>
12
14
 
13
15
  <script>
14
16
  import FormItemWrapper from './form-item-wrapper'
15
- /* import {VueEditor} from 'vue2-editor'//vue2-editor */
16
17
  import emitter from '../../../../../components/xform/utils/emitter'
17
18
  import i18n from "../../../../../components/xform/utils/i18n"
18
19
  import {deepClone} from "../../../../../components/xform/utils/util"
19
20
  import fieldMixin from "../../../../../components/xform/form-designer/form-widget/field-widget/fieldMixin"
20
21
 
22
+ function isBlankRichText(val) {
23
+ if (val == null) return true
24
+ const html = String(val)
25
+ if (!html.trim()) return true
26
+ const text = html
27
+ .replace(/<br\s*\/?>/gi, "")
28
+ .replace(/&nbsp;/gi, " ")
29
+ .replace(/<[^>]+>/g, "")
30
+ .trim()
31
+ if (text) return false
32
+ return !/<(img|video|audio|iframe|table|hr)\b/i.test(html)
33
+ }
34
+
21
35
  export default {
22
36
  name: "rich-editor-widget",
23
37
  componentName: 'FieldWidget', //必须固定为FieldWidget,用于接收父级组件的broadcast事件
@@ -50,10 +64,7 @@
50
64
  },
51
65
  components: {
52
66
  FormItemWrapper,
53
- // VueEditor
54
- // VueEditor: resolve => { //懒加载!!
55
- // require(['vue2-editor'], ({VueEditor}) => resolve(VueEditor))
56
- // }
67
+ Tinymce: () => import('@base/components/Tinymce'),
57
68
  },
58
69
  inject: ['refList', 'globalOptionData', 'globalModel'],
59
70
  data() {
@@ -61,13 +72,17 @@
61
72
  oldFieldValue: null, //field组件change之前的值
62
73
  fieldModel: null,
63
74
  rules: [],
64
-
65
- customToolbar: [], //富文本编辑器自定义工具栏
66
- valueChangedFlag: false, //vue2-editor数据值是否改变标志
75
+ changeTimer: null,
67
76
  }
68
77
  },
69
78
  computed: {
70
-
79
+ isReadonly() {
80
+ return !!(this.field.options.readonly || this.field.options.disabled)
81
+ },
82
+ editorHeight() {
83
+ const height = Number(this.field.options.contentHeight)
84
+ return height > 0 ? height : 300
85
+ },
71
86
  },
72
87
  beforeCreate() {
73
88
  /* 这里不能访问方法和属性!! */
@@ -89,24 +104,40 @@
89
104
  },
90
105
 
91
106
  beforeDestroy() {
107
+ clearTimeout(this.changeTimer)
92
108
  this.unregisterFromRefList()
93
109
  },
94
110
 
95
111
  methods: {
96
- handleRichEditorChangeEvent() {
97
- this.valueChangedFlag = true
98
- this.syncUpdateFormModel(this.fieldModel)
112
+ handleRichEditorInput(val) {
113
+ if (this.designState) return
114
+ const next = isBlankRichText(val) ? "" : (val || "")
115
+ if (this.fieldModel === next) return
116
+ this.fieldModel = next
117
+ this.syncUpdateFormModel(next)
118
+ clearTimeout(this.changeTimer)
119
+ this.changeTimer = setTimeout(() => {
120
+ this.flushRichEditorChange()
121
+ }, 200)
99
122
  },
100
123
 
101
- handleRichEditorFocusEvent() {
124
+ flushRichEditorChange() {
125
+ this.changeTimer = null
126
+ this.emitFieldDataChange(this.fieldModel, this.oldFieldValue)
102
127
  this.oldFieldValue = deepClone(this.fieldModel)
128
+ this.dispatch("VFormRender", "fieldValidation", [this.getPropName()])
129
+ },
130
+
131
+ handleRichEditorFocus(event) {
132
+ this.handleFocusCustomEvent(event)
103
133
  },
104
134
 
105
- handleRichEditorBlurEvent() {
106
- if (this.valueChangedFlag) {
107
- this.emitFieldDataChange(this.fieldModel, this.oldFieldValue)
108
- this.valueChangedFlag = false
135
+ handleRichEditorBlur(event) {
136
+ if (this.changeTimer) {
137
+ clearTimeout(this.changeTimer)
138
+ this.flushRichEditorChange()
109
139
  }
140
+ this.handleBlurCustomEvent(event)
110
141
  },
111
142
 
112
143
  }
@@ -116,8 +147,18 @@
116
147
  <style lang="scss" scoped>
117
148
  @import "~@base/styles/theme-variables.scss"; //* form-item-wrapper已引入,还需要重复引入吗? *//
118
149
 
119
- .full-width-input {
120
- width: 100% !important;
150
+ .rich-editor-host {
151
+ position: relative;
152
+ width: 100%;
153
+ }
154
+
155
+ .rich-editor-mask {
156
+ position: absolute;
157
+ top: 0;
158
+ right: 0;
159
+ bottom: 0;
160
+ left: 0;
161
+ z-index: 3;
121
162
  }
122
163
 
123
164
  </style>
@@ -0,0 +1,23 @@
1
+ <template>
2
+ <el-form-item :label="i18nt('designer.setting.contentHeight')" class="form-item-label-top">
3
+ <el-input-number v-model="optionModel.contentHeight" :min="120" :step="20" style="width: 100%"></el-input-number>
4
+ </el-form-item>
5
+ </template>
6
+
7
+ <script>
8
+ import i18n from "../../../../../components/xform/utils/i18n"
9
+
10
+ export default {
11
+ name: "contentHeight-editor",
12
+ mixins: [i18n],
13
+ props: {
14
+ designer: Object,
15
+ selectedWidget: Object,
16
+ optionModel: Object,
17
+ },
18
+ }
19
+ </script>
20
+
21
+ <style scoped>
22
+
23
+ </style>
@@ -37,6 +37,7 @@ const COMMON_PROPERTIES = {
37
37
  不走这张表,不受影响。 */
38
38
  // h5Span: "h5Span-editor",
39
39
  rows: "rows-editor",
40
+ contentHeight: "contentHeight-editor",
40
41
  required: "required-editor",
41
42
  // 'requiredHint': 'requiredHint-editor',
42
43
  validation: "validation-editor",
@@ -1342,6 +1342,51 @@ export const basicFields = [
1342
1342
  ...defaultTextFlagConfig,
1343
1343
  },
1344
1344
  },
1345
+ {
1346
+ type: "rich-editor",
1347
+ icon: "rich-editor-field",
1348
+ commonFlag: !0,
1349
+ formItemFlag: !0,
1350
+ columnFlag: false,
1351
+ tableField: null,
1352
+ options: {
1353
+ name: "",
1354
+ keyNameEnabled: !1,
1355
+ keyName: "",
1356
+ label: "",
1357
+ labelColor: "",
1358
+ submitFlag: true,
1359
+ labelAlign: "",
1360
+ defaultValue: "",
1361
+ contentHeight: 300,
1362
+ columnWidth: "200px",
1363
+ labelWidth: null,
1364
+ labelHidden: !1,
1365
+ readonly: !1,
1366
+ disabled: !1,
1367
+ hidden: !1,
1368
+ required: !1,
1369
+ requiredHint: "",
1370
+ validation: "",
1371
+ validationHint: "",
1372
+ customClass: "",
1373
+ labelIconClass: null,
1374
+ labelIconPosition: "rear",
1375
+ labelTooltip: null,
1376
+ onCreated: "",
1377
+ onMounted: "",
1378
+ onChange: "",
1379
+ onFocus: "",
1380
+ onBlur: "",
1381
+ onValidate: "",
1382
+ accessType: "1",
1383
+ ...defaultWfConfig,
1384
+
1385
+ showRuleFlag: 1,
1386
+ showRuleEnabled: 1,
1387
+ showRules: [],
1388
+ },
1389
+ },
1345
1390
  {
1346
1391
  type: "script-input",
1347
1392
  icon: "component",
@@ -4734,6 +4779,7 @@ export const widgetPanelOrder = {
4734
4779
  "a-link2",
4735
4780
  "button",
4736
4781
  "divider",
4782
+ "rich-editor",
4737
4783
  ],
4738
4784
  /* 图表 → 展示 → 按钮 */
4739
4785
  advancedFields: [
@@ -294,6 +294,7 @@ modules = {
294
294
  "vabUpload",
295
295
  "vabUpload2",
296
296
  "singleUpload",
297
+ "rich-editor",
297
298
  ],
298
299
  // 主表黑名单:按「字段名(keyName)」不参与对比。只作用于主表字段,不下渗明细
299
300
  compareExcludeFields: [],
@@ -272,6 +272,7 @@ export default {
272
272
  headers: "Request Headers",
273
273
  cellWidth: "Width",
274
274
  cellHeight: "Height",
275
+ contentHeight: "Editor Height",
275
276
  gridColHeight: "Height Of Col(px)",
276
277
  gutter: "Gutter(px)",
277
278
  columnSetting: "Cols Setting",
@@ -433,6 +433,7 @@ export default {
433
433
  formula: "计算公式",
434
434
  cellWidth: "宽度",
435
435
  cellHeight: "高度",
436
+ contentHeight: "编辑器高度",
436
437
  // gridColHeight: "外层栅格高度(px/%)",
437
438
  gutter: "栅格间隔(px)",
438
439
  columnSetting: "栅格属性设置",
@@ -331,9 +331,11 @@ const elTemplates = { //字段组件属性
331
331
  },
332
332
 
333
333
  'rich-editor': (widget, formConfig) => {
334
- const {vModel, disabled, placeholder
335
- } = getElAttrs(widget, formConfig)
336
- return `<vue-editor ${vModel} ${disabled} ${placeholder}></vue-editor>`
334
+ const {vModel} = getElAttrs(widget, formConfig)
335
+ const wop = widget.options
336
+ const readonly = (wop.readonly || wop.disabled) ? `:readonly="true"` : ''
337
+ const height = isNotNull(wop.contentHeight) ? `:height="${wop.contentHeight}"` : ':height="300"'
338
+ return `<tinymce ${vModel} ${readonly} ${height}></tinymce>`
337
339
  },
338
340
 
339
341
  'cascader': (widget, formConfig) => {
@@ -1,88 +1,160 @@
1
- export const constantRoutes = [
2
- /*{
3
- // 呼叫中心(CC)专用入口:只带 appid/appkey/account/callNo,
4
- // 先换取 tp 再 replace 到 /form_outLinkView
5
- path: "/cc_form_outLinkView",
6
- component: () => import("@base/views/user/outLink/cc_form_view"),
7
- meta: {
8
- checkToken: false,
9
- },
10
- hidden: true,
11
- },
12
- {
13
- path: "",
14
- component: () => import("@/layout/index"),
15
- children: [
16
- {
17
- path: "/basic/wf/wf_manage/list2",
18
- component: () => import("@base/views/user/wf/wf_manage/list2"),
19
- name: "wf_manage:list2",
20
- meta: {
21
- title: "流程待办",
22
- icon: "dashboard",
23
- },
24
- },
25
- {
26
- // bizTab 示例 A:手写接口版(前端 mock,无流程,不吃后台前置条件)
27
- path: "/demo/bizTab/simple",
28
- component: () => import("@base/views/demo/bizTab/simple/list"),
29
- name: "demoBizTabSimple",
30
- meta: {
31
- title: "bizTab 示例(手写接口)",
32
- icon: "dashboard",
33
- },
34
- },
35
- {
36
- // bizTab 示例 B:formCode + 通用 bd_api(照 stdxx 的产品变更申请页)
37
- path: "/demo/bizTab/bill",
38
- component: () => import("@base/views/demo/bizTab/bill/list"),
39
- name: "demoBizTabBill",
40
- meta: {
41
- title: "bizTab 示例(formCode+流程)",
42
- icon: "dashboard",
43
- },
44
- },
45
- {
46
- // bizTab 示例 C:自定义控制器 + 流程(照 std / 本仓库 pmd/price/ladderPrice 页)
47
- path: "/demo/bizTab/wf",
48
- component: () => import("@base/views/demo/bizTab/wf/list"),
49
- name: "demoBizTabWf",
50
- meta: {
51
- title: "bizTab 示例(自定义接口+流程)",
52
- icon: "dashboard",
53
- },
54
- },
55
- {
56
- // bizTab 示例 D:独立模式(不在页签里,待办直开走的路径),复用示例 C 的详情
57
- path: "/demo/bizTab/standalone",
58
- component: () => import("@base/views/demo/bizTab/standalone/index.vue"),
59
- name: "demoBizTabStandalone",
60
- meta: {
61
- title: "bizTab 示例(独立模式)",
62
- icon: "dashboard",
63
- },
64
- },
65
- {
66
- path: "/support/form-dialog-demo",
67
- component: () => import("@/views/support/form-dialog-demo/index.vue"),
68
- name: "formDialogDemo",
69
- meta: {
70
- title: "formDialog 示例",
71
- icon: "dashboard",
72
- },
73
- },
74
- ],
75
- },*/
76
- {
77
- path: "",
78
- component: () => import("@/layout/index"),
79
- children: [
80
- {
81
- path: "/haier/system/salesman/list",
82
- component: () => import("@/views/haier/system/salesman/list.vue"),
83
- name: "haierSalesmanPilot",
84
- meta: { title: "业务员", icon: "user" },
85
- },
86
- ],
87
- },
88
- ];
1
+ export const constantRoutes = [
2
+ /*{
3
+ // 呼叫中心(CC)专用入口:只带 appid/appkey/account/callNo,
4
+ // 先换取 tp 再 replace 到 /form_outLinkView
5
+ path: "/cc_form_outLinkView",
6
+ component: () => import("@base/views/user/outLink/cc_form_view"),
7
+ meta: {
8
+ checkToken: false,
9
+ },
10
+ hidden: true,
11
+ },
12
+ {
13
+ path: "",
14
+ component: () => import("@/layout/index"),
15
+ children: [
16
+ {
17
+ path: "/basic/wf/wf_manage/list2",
18
+ component: () => import("@base/views/user/wf/wf_manage/list2"),
19
+ name: "wf_manage:list2",
20
+ meta: {
21
+ title: "流程待办",
22
+ icon: "dashboard",
23
+ },
24
+ },
25
+ {
26
+ // bizTab 示例 A:手写接口版(前端 mock,无流程,不吃后台前置条件)
27
+ path: "/demo/bizTab/simple",
28
+ component: () => import("@base/views/demo/bizTab/simple/list"),
29
+ name: "demoBizTabSimple",
30
+ meta: {
31
+ title: "bizTab 示例(手写接口)",
32
+ icon: "dashboard",
33
+ },
34
+ },
35
+ {
36
+ // bizTab 示例 B:formCode + 通用 bd_api(照 stdxx 的产品变更申请页)
37
+ path: "/demo/bizTab/bill",
38
+ component: () => import("@base/views/demo/bizTab/bill/list"),
39
+ name: "demoBizTabBill",
40
+ meta: {
41
+ title: "bizTab 示例(formCode+流程)",
42
+ icon: "dashboard",
43
+ },
44
+ },
45
+ {
46
+ // bizTab 示例 C:自定义控制器 + 流程(照 std / 本仓库 pmd/price/ladderPrice 页)
47
+ path: "/demo/bizTab/wf",
48
+ component: () => import("@base/views/demo/bizTab/wf/list"),
49
+ name: "demoBizTabWf",
50
+ meta: {
51
+ title: "bizTab 示例(自定义接口+流程)",
52
+ icon: "dashboard",
53
+ },
54
+ },
55
+ {
56
+ // bizTab 示例 D:独立模式(不在页签里,待办直开走的路径),复用示例 C 的详情
57
+ path: "/demo/bizTab/standalone",
58
+ component: () => import("@base/views/demo/bizTab/standalone/index.vue"),
59
+ name: "demoBizTabStandalone",
60
+ meta: {
61
+ title: "bizTab 示例(独立模式)",
62
+ icon: "dashboard",
63
+ },
64
+ },
65
+ {
66
+ path: "/support/form-dialog-demo",
67
+ component: () => import("@/views/support/form-dialog-demo/index.vue"),
68
+ name: "formDialogDemo",
69
+ meta: {
70
+ title: "formDialog 示例",
71
+ icon: "dashboard",
72
+ },
73
+ },
74
+ ],
75
+ },*/
76
+ ...(process.env.NODE_ENV === "development" ? [{
77
+ path: "",
78
+ component: () => import("@/layout/index"),
79
+ children: [
80
+ {
81
+ path: "/haier/system/salesman/list",
82
+ component: () => import("@/views/haier/system/salesman/list.vue"),
83
+ name: "haierSalesmanPilot",
84
+ meta: { title: "业务员", icon: "user" },
85
+ },
86
+ {
87
+ path: "/haier/base/currency/list",
88
+ component: () => import("@/views/haier/base/currency/list.vue"),
89
+ name: "haierCurrencyPilot",
90
+ meta: { title: "币种", icon: "user" },
91
+ },
92
+ {
93
+ path: "/haier/system/user-industry/list",
94
+ component: () => import("@/views/haier/system/user-industry/list.vue"),
95
+ name: "haierUserIndustryPilot",
96
+ meta: { title: "用户产业", icon: "user" },
97
+ },
98
+ {
99
+ path: "/haier/system/user-app-operation-log/list",
100
+ component: () => import("@/views/haier/system/user-app-operation-log/list.vue"),
101
+ name: "haierUserAppOperationLogPilot",
102
+ meta: { title: "用户APP操作记录", icon: "user" },
103
+ },
104
+ {
105
+ path: "/haier/system/user-category/list",
106
+ component: () => import("@/views/haier/system/user-category/list.vue"),
107
+ name: "haierUserCategoryPilot",
108
+ meta: { title: "用户分类", icon: "user" },
109
+ },
110
+ {
111
+ path: "/haier/base/cabinet-type/list",
112
+ component: () => import("@/views/haier/base/cabinet-type/list.vue"),
113
+ name: "haierCabinetTypePilot",
114
+ meta: { title: "柜型", icon: "user" },
115
+ },
116
+ {
117
+ path: "/haier/base/bank-rate/list",
118
+ component: () => import("@/views/haier/base/bank-rate/list.vue"),
119
+ name: "haierBankRatePilot",
120
+ meta: { title: "银行利率", icon: "user" },
121
+ },
122
+ {
123
+ path: "/haier/base/credit-premium-rate/list",
124
+ component: () => import("@/views/haier/base/credit-premium-rate/list.vue"),
125
+ name: "haierCreditPremiumRatePilot",
126
+ meta: { title: "信保费率", icon: "user" },
127
+ },
128
+ {
129
+ path: "/haier/base/company/list",
130
+ component: () => import("@/views/haier/base/company/list.vue"),
131
+ name: "haierCompanyPilot",
132
+ meta: { title: "公司", icon: "user" },
133
+ },
134
+ {
135
+ path: "/haier/base/payment-term/list",
136
+ component: () => import("@/views/haier/base/payment-term/list.vue"),
137
+ name: "haierPaymentTermPilot",
138
+ meta: { title: "付款条件", icon: "user" },
139
+ },
140
+ {
141
+ path: "/haier/base/country/list",
142
+ component: () => import("@/views/haier/base/country/list.vue"),
143
+ name: "haierCountryPilot",
144
+ meta: { title: "国家/地区", icon: "user" },
145
+ },
146
+ {
147
+ path: "/haier/product/category/list",
148
+ component: () => import("@/views/haier/product/category/list.vue"),
149
+ name: "haierCategoryPilot",
150
+ meta: { title: "产品分类", icon: "user" },
151
+ },
152
+ {
153
+ path: "/haier/product/series/list",
154
+ component: () => import("@/views/haier/product/series/list.vue"),
155
+ name: "haierSeriesPilot",
156
+ meta: { title: "产品系列", icon: "user" },
157
+ },
158
+ ],
159
+ }] : []),
160
+ ];
@@ -35,6 +35,37 @@ service = axios.create({
35
35
  //timeout: 5000 // request timeout
36
36
  });
37
37
 
38
+ function isBinaryRequestBody(data) {
39
+ if (typeof FormData !== "undefined" && data instanceof FormData) return true;
40
+ if (typeof Blob !== "undefined" && data instanceof Blob) return true;
41
+ if (typeof ArrayBuffer !== "undefined" && data instanceof ArrayBuffer) return true;
42
+ return typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView(data);
43
+ }
44
+
45
+ // 调用方已经 stringify 成对象或数组文本时直接加密,避免再包一层字符串。
46
+ function aesPlainText(data, useEmptyObject) {
47
+ if (typeof data === "string") {
48
+ try {
49
+ const parsed = JSON.parse(data);
50
+ if (parsed !== null && typeof parsed === "object") {
51
+ return data;
52
+ }
53
+ } catch (e) {
54
+ // 普通字符串继续序列化
55
+ }
56
+ }
57
+ if (data === undefined && useEmptyObject) {
58
+ return JSON.stringify({});
59
+ }
60
+ return JSON.stringify(data);
61
+ }
62
+
63
+ function wrapAesBody(data, useEmptyObject) {
64
+ return {
65
+ _aeenboda: encrypt(aesPlainText(data, useEmptyObject)),
66
+ };
67
+ }
68
+
38
69
  // request interceptor
39
70
  service.interceptors.request.use(
40
71
  (config) => {
@@ -57,13 +88,12 @@ service.interceptors.request.use(
57
88
  config.filterConfig
58
89
  );
59
90
  }
60
- if (settingConfig.requestAesEnabled === true) {
61
- config.data = {
62
- _aeenboda: encrypt(JSON.stringify(config.data === undefined ? {} : config.data)),
63
- };
64
- config.headers["Content-Type"] = "application/json;charset=UTF-8";
65
- } else if (
66
- (config.headers["Content-Type"] === "application/x-www-form-urlencoded" ||
91
+ const canEncryptBody = !isBinaryRequestBody(config.data);
92
+ if (settingConfig.requestAesEnabled === true && canEncryptBody) {
93
+ config.data = wrapAesBody(config.data, true);
94
+ config.headers["Content-Type"] = "application/json;charset=UTF-8";
95
+ } else if (
96
+ (config.headers["Content-Type"] === "application/x-www-form-urlencoded" ||
67
97
  config.headers["Content-Type"] ===
68
98
  "application/x-www-form-urlencoded;charset=UTF-8") &&
69
99
  typeof config.data !== "string" &&
@@ -71,13 +101,14 @@ service.interceptors.request.use(
71
101
  ) {
72
102
  config.data = qs.stringify(config.data);
73
103
  } else if (
104
+ canEncryptBody &&
74
105
  settingConfig.base64Urls &&
75
106
  settingConfig.base64Urls.includes(config.url)
76
107
  ) {
77
108
  // config.data = {"_baenboda": encode(JSON.stringify(config.data))};
78
- config.data = { _aeenboda: encrypt(JSON.stringify(config.data)) };
79
- } else if (config.aes) {
80
- config.data = { _aeenboda: encrypt(JSON.stringify(config.data)) };
109
+ config.data = wrapAesBody(config.data);
110
+ } else if (canEncryptBody && config.aes) {
111
+ config.data = wrapAesBody(config.data);
81
112
  }
82
113
 
83
114
  if (config.modal !== false && config.loadingTarget) {