cloud-web-corejs 1.0.54-dev.660 → 1.0.54-dev.662

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.
@@ -0,0 +1,112 @@
1
+ function buildColumnConfigMap(tableColumns, map = {}) {
2
+ if (!tableColumns || !tableColumns.length) {
3
+ return map;
4
+ }
5
+ tableColumns.forEach((col) => {
6
+ if (col.prop) {
7
+ map[col.prop] = col;
8
+ }
9
+ if (col.columnId) {
10
+ map[`__id__${col.columnId}`] = col;
11
+ }
12
+ if (col.children && col.children.length) {
13
+ buildColumnConfigMap(col.children, map);
14
+ }
15
+ });
16
+ return map;
17
+ }
18
+
19
+ function enrichColumnList(columns, configMap) {
20
+ if (!columns || !columns.length) {
21
+ return columns;
22
+ }
23
+ return columns.map((col) => {
24
+ const newCol = Object.assign({}, col);
25
+ if (col.slots) {
26
+ newCol.slots = Object.assign({}, col.slots);
27
+ }
28
+ const field = col.field;
29
+ const columnId = col.params && col.params.columnId;
30
+ const config =
31
+ (field && configMap[field]) ||
32
+ (columnId && configMap[`__id__${columnId}`]);
33
+ if (config) {
34
+ applyColumnLabelIcon(newCol, config);
35
+ }
36
+ if (col.children && col.children.length) {
37
+ newCol.children = enrichColumnList(col.children, configMap);
38
+ }
39
+ return newCol;
40
+ });
41
+ }
42
+
43
+ /**
44
+ * Apply data-table column header icon config to vxe-table column definition.
45
+ */
46
+ export function applyColumnLabelIcon(col, columnConfig) {
47
+ if (!col || !columnConfig) {
48
+ return col;
49
+ }
50
+
51
+ const iconClass = columnConfig.labelIconClass;
52
+ const position = columnConfig.labelIconPosition || "front";
53
+ const tooltip = columnConfig.labelTooltip;
54
+ const required = !!columnConfig.required;
55
+ const title = col.title;
56
+
57
+ if (!iconClass && !required) {
58
+ return col;
59
+ }
60
+
61
+ const buildIcon = (h) => {
62
+ const icon = h("i", { class: ["vxe-cell-help-icon", iconClass] });
63
+ if (!tooltip) {
64
+ return icon;
65
+ }
66
+ return h(
67
+ "el-tooltip",
68
+ {
69
+ props: { content: tooltip, effect: "dark", placement: "top" },
70
+ },
71
+ [icon]
72
+ );
73
+ };
74
+
75
+ if (iconClass && position === "front" && !required) {
76
+ col.titlePrefix = {
77
+ icon: iconClass,
78
+ ...(tooltip ? { content: tooltip } : {}),
79
+ };
80
+ return col;
81
+ }
82
+
83
+ if (required && !iconClass) {
84
+ col.titlePrefix = { icon: "vxe-cell--required-icon" };
85
+ return col;
86
+ }
87
+
88
+ col.slots = col.slots || {};
89
+ delete col.titlePrefix;
90
+
91
+ col.slots.header = (params, h) => {
92
+ const nodes = [];
93
+ if (required) {
94
+ nodes.push(h("i", { class: "vxe-cell--required-icon" }));
95
+ }
96
+ if (iconClass && position === "front") {
97
+ nodes.push(buildIcon(h));
98
+ }
99
+ nodes.push(h("span", { class: "vxe-cell--title" }, title));
100
+ if (iconClass && position === "rear") {
101
+ nodes.push(buildIcon(h));
102
+ }
103
+ return nodes;
104
+ };
105
+
106
+ return col;
107
+ }
108
+
109
+ export function enrichTableColumnsWithLabelIcon(columns, tableColumns) {
110
+ const configMap = buildColumnConfigMap(tableColumns || []);
111
+ return enrichColumnList(columns, configMap);
112
+ }
@@ -105,6 +105,12 @@ export default {
105
105
  width: calc((100% - 160px) / 2);
106
106
  color: #303133;
107
107
 
108
+ .version-blue,
109
+ .version-green {
110
+ margin-top: 2px;
111
+ margin-bottom: 0;
112
+ }
113
+
108
114
  .compare-revert-btn {
109
115
  float: right;
110
116
  }
@@ -5,10 +5,10 @@
5
5
  >
6
6
  <div class="compare-code-header">
7
7
  <div class="compare-header-main">
8
- <div class="title"><b>{{ $t1(sectionTitle) }}</b></div>
8
+ <div class="title">
9
+ <b>{{ $t1(sectionTitle) }}</b>
10
+ </div>
9
11
  <div v-if="enableDiff" class="compare-diff-legend">
10
- <span class="legend-item legend-old">{{ $t1("变更/删除") }}</span>
11
- <span class="legend-item legend-new">{{ $t1("变更/新增") }}</span>
12
12
  <span class="compare-diff-nav">
13
13
  <span
14
14
  class="diff-nav-btn"
@@ -28,12 +28,18 @@
28
28
  <i class="el-icon-caret-top"></i>{{ $t1("返回顶部") }}
29
29
  </span>
30
30
  <span v-if="diffNavList.length" class="diff-nav-count">
31
- {{ currentDiffIndex < 0 ? "-" : currentDiffIndex + 1 }} / {{ diffNavList.length }}
31
+ {{ currentDiffIndex < 0 ? "-" : currentDiffIndex + 1 }} /
32
+ {{ diffNavList.length }}
32
33
  </span>
33
34
  </span>
34
35
  </div>
35
36
  </div>
36
- <el-tooltip class="item" effect="dark" :content="$t1('全屏')" placement="top">
37
+ <el-tooltip
38
+ class="item"
39
+ effect="dark"
40
+ :content="$t1('全屏')"
41
+ placement="top"
42
+ >
37
43
  <el-link class="is-full" :underline="false" @click="toggleFullscreen">
38
44
  <i class="iconfont icon-quanping"></i>
39
45
  </el-link>
@@ -237,7 +243,10 @@ export default {
237
243
 
238
244
  const leftText = leftEditor.getValue();
239
245
  const rightText = rightEditor.getValue();
240
- const { oldMarks, newMarks, diffNavList } = diffLines(leftText, rightText);
246
+ const { oldMarks, newMarks, diffNavList } = diffLines(
247
+ leftText,
248
+ rightText
249
+ );
241
250
  this.diffNavList = diffNavList || [];
242
251
  this.currentDiffIndex = -1;
243
252
  const Range = ace.require("ace/range").Range;
@@ -262,12 +271,14 @@ export default {
262
271
  gotoPrevDiff() {
263
272
  if (!this.diffNavList.length) return;
264
273
  this.currentDiffIndex =
265
- (this.currentDiffIndex - 1 + this.diffNavList.length) % this.diffNavList.length;
274
+ (this.currentDiffIndex - 1 + this.diffNavList.length) %
275
+ this.diffNavList.length;
266
276
  this.locateCurrentDiff();
267
277
  },
268
278
  gotoNextDiff() {
269
279
  if (!this.diffNavList.length) return;
270
- this.currentDiffIndex = (this.currentDiffIndex + 1) % this.diffNavList.length;
280
+ this.currentDiffIndex =
281
+ (this.currentDiffIndex + 1) % this.diffNavList.length;
271
282
  this.locateCurrentDiff();
272
283
  },
273
284
  gotoTop() {
@@ -308,10 +319,7 @@ export default {
308
319
  const targetRow = Math.max(0, Math.min(row, maxRow));
309
320
  editor.scrollToLine(targetRow, true, true, () => {});
310
321
  editor.gotoLine(targetRow + 1, 0, true);
311
- editor.renderer.scrollCursorIntoView(
312
- { row: targetRow, column: 0 },
313
- 0.5
314
- );
322
+ editor.renderer.scrollCursorIntoView({ row: targetRow, column: 0 }, 0.5);
315
323
  },
316
324
  locateCurrentDiff() {
317
325
  const diffItem = this.diffNavList[this.currentDiffIndex];
@@ -352,6 +360,15 @@ export default {
352
360
  @include compare-flex-row;
353
361
 
354
362
  .compare-code-flex {
363
+ margin-top: 0;
364
+
365
+ .compare-code-col {
366
+ .version-blue,
367
+ .version-green {
368
+ margin-bottom: 8px;
369
+ }
370
+ }
371
+
355
372
  ::v-deep .ace-container {
356
373
  border: 1px solid #ebeef5;
357
374
  }
@@ -449,25 +466,25 @@ export default {
449
466
  ::v-deep .ace_marker-layer {
450
467
  .compare-diff-old {
451
468
  position: absolute;
452
- background: rgba(245, 108, 108, 0.28);
469
+ background: rgba(245, 108, 108, 0.2);
453
470
  z-index: 3;
454
471
  }
455
472
 
456
473
  .compare-diff-new {
457
474
  position: absolute;
458
- background: rgba(103, 194, 58, 0.28);
475
+ background: rgba(103, 194, 58, 0.2);
459
476
  z-index: 3;
460
477
  }
461
478
 
462
479
  .compare-diff-active-old {
463
480
  position: absolute;
464
- background: rgba(245, 108, 108, 0.55);
481
+ background: rgba(245, 108, 108, 0.35);
465
482
  z-index: 4;
466
483
  }
467
484
 
468
485
  .compare-diff-active-new {
469
486
  position: absolute;
470
- background: rgba(103, 194, 58, 0.55);
487
+ background: rgba(103, 194, 58, 0.35);
471
488
  z-index: 4;
472
489
  }
473
490
  }
@@ -1,14 +1,19 @@
1
1
  @mixin compare-cont-shell {
2
2
  position: relative;
3
- margin: 12px 16px;
4
- padding: 12px 16px 16px;
3
+ margin-bottom: 8px;
4
+ padding: 8px;
5
5
  background: #fff;
6
- border-radius: 4px;
6
+ border-radius: 2px;
7
+
8
+ ~ .compare-cont {
9
+ margin-bottom: 0;
10
+ }
7
11
  }
8
12
 
9
13
  @mixin compare-cont-title {
10
- .title {
11
- margin-bottom: 12px;
14
+ > .title {
15
+ padding: 0 4px;
16
+ margin-bottom: 8px;
12
17
  font-size: 14px;
13
18
  color: #303133;
14
19
  }
@@ -17,10 +22,17 @@
17
22
  @mixin compare-cont-full-link {
18
23
  .is-full {
19
24
  position: absolute;
20
- top: 12px;
21
- right: 16px;
25
+ top: 8px;
26
+ right: 8px;
27
+ padding: 2px 3px;
22
28
  font-size: 16px;
23
- color: #409eff;
29
+ color: #4595e6;
30
+ background: #f2f6fc;
31
+ border-radius: 4px;
32
+
33
+ i {
34
+ font-size: 16px;
35
+ }
24
36
  }
25
37
  }
26
38
 
@@ -28,28 +40,32 @@
28
40
  .version-blue,
29
41
  .version-green {
30
42
  display: inline-block;
43
+ height: 22px;
31
44
  margin-bottom: 8px;
32
- font-size: 13px;
33
- font-weight: 600;
45
+ padding: 0 4px;
46
+ font-size: 12px;
47
+ line-height: 22px;
48
+ color: #fff;
49
+ vertical-align: middle;
34
50
  }
35
51
 
36
52
  .version-blue {
37
- color: #409eff;
53
+ background: #2c7eeb;
38
54
  }
39
55
 
40
56
  .version-green {
41
- color: #67c23a;
57
+ background: #6dc442;
42
58
  }
43
59
  }
44
60
 
45
61
  @mixin compare-flex-row {
46
62
  .flex {
47
63
  display: flex;
48
- gap: 12px;
49
64
 
50
65
  .flex-1 {
51
66
  flex: 1;
52
67
  min-width: 0;
68
+ margin: 0 8px;
53
69
  }
54
70
  }
55
71
  }
@@ -54,22 +54,22 @@ export function buildDetailDiffMaps(preRows = [], curRows = []) {
54
54
 
55
55
  if (!preRow) {
56
56
  DETAIL_COMPARE_FIELDS.forEach((field) => {
57
- curCellDiff[`${key}__${field}`] = true;
57
+ curCellDiff[`${key}__${field}`] = "add";
58
58
  });
59
59
  return;
60
60
  }
61
61
 
62
62
  if (!curRow) {
63
63
  DETAIL_COMPARE_FIELDS.forEach((field) => {
64
- preCellDiff[`${key}__${field}`] = true;
64
+ preCellDiff[`${key}__${field}`] = "delete";
65
65
  });
66
66
  return;
67
67
  }
68
68
 
69
69
  DETAIL_COMPARE_FIELDS.forEach((field) => {
70
70
  if (!isSameValue(preRow[field], curRow[field])) {
71
- preCellDiff[`${key}__${field}`] = true;
72
- curCellDiff[`${key}__${field}`] = true;
71
+ preCellDiff[`${key}__${field}`] = "change";
72
+ curCellDiff[`${key}__${field}`] = "change";
73
73
  }
74
74
  });
75
75
  });
@@ -12,30 +12,46 @@
12
12
  :fields="basicFields"
13
13
  @reverCallback="$emit('reverCallback')"
14
14
  />
15
- <div class="compare-cont compare-detail-section" :class="{ 'is-section-fullscreen': detailFullscreen }">
15
+ <div
16
+ class="compare-cont compare-detail-section"
17
+ :class="{ 'is-section-fullscreen': detailFullscreen }"
18
+ >
16
19
  <div class="compare-detail-header">
17
20
  <div class="compare-header-main">
18
- <div class="title"><b>{{ $t1("明细") }}</b></div>
19
- <div class="compare-diff-legend">
20
- <span class="legend-item legend-old">{{ $t1("变更/删除") }}</span>
21
- <span class="legend-item legend-new">{{ $t1("变更/新增") }}</span>
21
+ <div class="title">
22
+ <b>{{ $t1("明细") }}</b>
22
23
  </div>
23
24
  </div>
24
- <el-tooltip class="item" effect="dark" :content="$t1('全屏')" placement="top">
25
- <el-link class="is-full" :underline="false" @click="detailFullscreen = !detailFullscreen">
25
+ <el-tooltip
26
+ class="item"
27
+ effect="dark"
28
+ :content="$t1('全屏')"
29
+ placement="top"
30
+ >
31
+ <el-link
32
+ class="is-full"
33
+ :underline="false"
34
+ @click="detailFullscreen = !detailFullscreen"
35
+ >
26
36
  <i class="iconfont icon-quanping"></i>
27
37
  </el-link>
28
38
  </el-tooltip>
29
39
  </div>
30
40
  <div class="compare-detail-grid">
31
41
  <span class="version-blue">{{ $t1("版本号") }}:{{ preVersion }}</span>
32
- <div class="grid-height" :class="{ 'is-fullscreen-grid': detailFullscreen }">
42
+ <div
43
+ class="grid-height"
44
+ :class="{ 'is-fullscreen-grid': detailFullscreen }"
45
+ >
33
46
  <vxe-grid ref="table-pre" v-bind="preGridOption" />
34
47
  </div>
35
48
  </div>
36
49
  <div class="compare-detail-grid">
37
50
  <span class="version-green">{{ $t1("版本号") }}:{{ curVersion }}</span>
38
- <div class="grid-height" :class="{ 'is-fullscreen-grid': detailFullscreen }">
51
+ <div
52
+ class="grid-height"
53
+ :class="{ 'is-fullscreen-grid': detailFullscreen }"
54
+ >
39
55
  <vxe-grid ref="table-cur" v-bind="curGridOption" />
40
56
  </div>
41
57
  </div>
@@ -321,8 +337,15 @@ export default {
321
337
  if (!field || !row) return "";
322
338
  const diffKey = `${getDetailRowKey(row, rowIndex)}__${field}`;
323
339
  const diffMap =
324
- side === "pre" ? this.detailDiff.preCellDiff : this.detailDiff.curCellDiff;
325
- return diffMap[diffKey] ? `compare-diff-${side === "pre" ? "old" : "new"}` : "";
340
+ side === "pre"
341
+ ? this.detailDiff.preCellDiff
342
+ : this.detailDiff.curCellDiff;
343
+ const diffType = diffMap[diffKey];
344
+ if (!diffType) return "";
345
+ if (diffType === "add") {
346
+ return "compare-diff-new";
347
+ }
348
+ return "compare-diff-old";
326
349
  },
327
350
  },
328
351
  };
@@ -342,6 +365,11 @@ export default {
342
365
  .grid-height {
343
366
  height: 320px !important;
344
367
  }
368
+
369
+ .version-blue,
370
+ .version-green {
371
+ margin-bottom: 8px;
372
+ }
345
373
  }
346
374
 
347
375
  .compare-detail-header {
@@ -386,12 +414,12 @@ export default {
386
414
  }
387
415
 
388
416
  ::v-deep .compare-diff-old {
389
- background-color: rgba(245, 108, 108, 0.28) !important;
417
+ background-color: rgba(245, 108, 108, 0.2) !important;
390
418
  color: #f56c6c;
391
419
  }
392
420
 
393
421
  ::v-deep .compare-diff-new {
394
- background-color: rgba(103, 194, 58, 0.28) !important;
422
+ background-color: rgba(103, 194, 58, 0.2) !important;
395
423
  color: #67c23a;
396
424
  }
397
425