centaline-data-driven-v3 0.1.21 → 0.1.23

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,6 +1,6 @@
1
1
  {
2
2
  "name": "centaline-data-driven-v3",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "private": false,
5
5
  "description": "centaline-data-driven-v3",
6
6
  "main": "dist/centaline-data-driven-v3.umd.js",
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div ref="refForm" v-loading="loading" :style="{ 'min-height': minHeight }">
2
+ <div ref="refForm" v-loading="loading" :style="{width:pageWidth?pageWidth+'px':'100%',margin:'auto','min-height': minHeight}">
3
3
  <div style="display: flex; width: 100%;">
4
4
  <div style="flex: 1; min-width: 0;">
5
5
  <div v-if="model !== null && !loading" class="ct-form">
@@ -241,14 +241,23 @@ config.value = {
241
241
  ] /* 列出的文件类型 */
242
242
  }/* 前后端通信相关的配置,注释只允许使用多行方式 */
243
243
 
244
- if (!model.value.moreActionRouter && !model.value.locked) {
245
- ElMessage({
246
- message: "请配置富文本Action!",
247
- type: 'warning',
248
- showClose: true,
249
- });
244
+ // if (!model.value.moreActionRouter && !model.value.locked) {
245
+ // ElMessage({
246
+ // message: "请配置富文本Action!",
247
+ // type: 'warning',
248
+ // showClose: true,
249
+ // });
250
+ // config.value.toolbars = [['help']];
251
+ // }
252
+
253
+ if (!model.value.paramName1 && !model.value.locked) {
250
254
  config.value.toolbars = [['help']];
251
255
  }
256
+ if (model.value.paramName1 && !model.value.locked) {
257
+ if (model.value.paramName1 !== "*") {
258
+ config.value.toolbars = [ensureArray(model.value.paramName1)];
259
+ }
260
+ }
252
261
  else if (!model.value.locked) {
253
262
  config.value.maximumWords = model.value && model.value.maxValue1 ? parseFloat(model.value.maxValue1) : 5000;
254
263
  config.value.serverUrl = model.value.moreActionRouter.action;
@@ -256,6 +265,54 @@ else if (!model.value.locked) {
256
265
  }
257
266
 
258
267
 
268
+ const ensureArray = (value) => {
269
+ // 1. 直接判断是否为数组(推荐方法)
270
+ if (Array.isArray(value)) return value;
271
+
272
+ // 2. 处理 null/undefined
273
+ if (value == null) return [];
274
+
275
+ // 3. 处理类数组对象(如NodeList、arguments)
276
+ if (typeof value === 'object' && 'length' in value) {
277
+ try {
278
+ return Array.from(value);
279
+ } catch {
280
+ return [value];
281
+ }
282
+ }
283
+
284
+ // 4. 其他类型包装为数组
285
+ return [value];
286
+ };
287
+
288
+ const detectionResult = hasUploadButtons(config.value.toolbars);
289
+
290
+ function hasUploadButtons(toolbarConfig) {
291
+ // 确保toolbarConfig是有效的数组
292
+ if (!Array.isArray(toolbarConfig)) {
293
+ return false;
294
+ }
295
+
296
+ // 定义要检测的上传按钮
297
+ const uploadButtons = ['simpleupload', 'insertimage', 'insertvideo', 'snapscreen'];
298
+
299
+ // 扁平化二维数组,便于搜索
300
+ const flattened = toolbarConfig.flat(2);
301
+
302
+ // 使用some方法检查是否存在任意一个上传按钮
303
+ return uploadButtons.some(button => flattened.includes(button));
304
+ }
305
+
306
+
307
+ if (detectionResult) {
308
+ if (!model.value.moreActionRouter && !model.value.locked) {
309
+ ElMessage({
310
+ message: "请配置富文本Action!",
311
+ type: 'warning',
312
+ showClose: true,
313
+ });
314
+ }
315
+ }
259
316
  defineExpose({
260
317
  model
261
318
  })