ocpview-pro 0.1.28 → 0.1.29

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": "ocpview-pro",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "title": "ocpviewPlus",
5
5
  "description": "A high quality Service UI components Library with Vue.js",
6
6
  "homepage": "",
@@ -57,19 +57,35 @@ export default {
57
57
  },
58
58
  computed: {
59
59
  labeltext() {
60
- return this.label;
60
+ // ==============================================
61
+ // return this.label;
62
+ // ==============================================
63
+ return this.translateComboBoxText(this.label);
61
64
  },
62
65
  textLink() {
63
66
  return !!(this.config && this.config.textLink);
64
67
  },
65
68
  displayText() {
69
+ // ==============================================
70
+ // 备份 还原点
71
+ // if (this.resetText) {
72
+ // return this.resetText(
73
+ // this.doSpecialSymbols(this.label),
74
+ // this.label
75
+ // );
76
+ // }
77
+ // return this.doSpecialSymbols(this.label);
78
+ // ==============================================
79
+ let text = "";
66
80
  if (this.resetText) {
67
- return this.resetText(
81
+ text = this.resetText(
68
82
  this.doSpecialSymbols(this.label),
69
83
  this.label
70
84
  );
85
+ }else{
86
+ text = this.doSpecialSymbols(this.label);
71
87
  }
72
- return this.doSpecialSymbols(this.label);
88
+ return this.translateComboBoxText(text);
73
89
  },
74
90
  },
75
91
  mounted() {
@@ -93,6 +109,16 @@ export default {
93
109
  }
94
110
  },
95
111
  methods: {
112
+ translateComboBoxText(text) {
113
+ if (typeof text !== "string") {
114
+ return text;
115
+ }
116
+ const match = text.match(/^(\[[^\]]*\])([\s\S]*)$/);
117
+ if (match) {
118
+ return match[1] + this.$t(match[2]);
119
+ }
120
+ return this.$t(text);
121
+ },
96
122
  checkOverflow() {
97
123
  const content = this.$refs.content;
98
124
  this.hasOverflow = !!(
@@ -349,7 +349,7 @@ export default {
349
349
  row,
350
350
  item
351
351
  );
352
- return valueFormat;
352
+ return this.translateComboBoxText(valueFormat);
353
353
  },
354
354
  editRender: {
355
355
  enabled: false,
@@ -431,6 +431,16 @@ export default {
431
431
  },
432
432
  },
433
433
  methods: {
434
+ translateComboBoxText(text) {
435
+ if (typeof text !== "string") {
436
+ return text;
437
+ }
438
+ const match = text.match(/^(\[[^\]]*\])([\s\S]*)$/);
439
+ if (match) {
440
+ return match[1] + this.$t(match[2]);
441
+ }
442
+ return this.$t(text);
443
+ },
434
444
  // ==================================================================
435
445
 
436
446
  /**
@@ -306,7 +306,7 @@ export default {
306
306
  row,
307
307
  item
308
308
  );
309
- return valueFormat;
309
+ return this.translateComboBoxText(valueFormat);
310
310
  },
311
311
  ...(item._colorMap && {
312
312
  type: "html",