jtui3.0 1.0.13 → 1.0.14

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.
@@ -85055,11 +85055,15 @@ function useFilterData() {
85055
85055
  /*
85056
85056
  * @Author: leevan
85057
85057
  * @Date: 2022-07-12 16:59:44
85058
- * @LastEditTime: 2022-07-12 17:50:49
85058
+ * @LastEditTime: 2022-11-14 17:07:52
85059
85059
  * @LastEditors: leevan
85060
85060
  * @FilePath: /jtui3.0/packages/tables/hooks/useFormatter.js
85061
85061
  */
85062
85062
  function useFormatter() {
85063
+ function objectTxt(cellValue) {
85064
+ return typeof cellValue == 'object' ? JSON.stringify(cellValue) : cellValue;
85065
+ }
85066
+
85063
85067
  function formatEnum(column, cellValue, row, data) {
85064
85068
  try {
85065
85069
  if (data && "html" in data && "htmlType" in data) {
@@ -85081,14 +85085,14 @@ function useFormatter() {
85081
85085
  ></span>`;
85082
85086
  }
85083
85087
  });
85084
- return str ? str : cellValue;
85088
+ return str ? str : objectTxt(cellValue);
85085
85089
  } else {
85086
85090
  let item = data.html.find(item => item.value == cellValue);
85087
- return item ? `<span class="jtIcon ${item.icon}" style="color:${item.color};font-size:${item.size}px"></span>` : cellValue;
85091
+ return item ? `<span class="jtIcon ${item.icon}" style="color:${item.color};font-size:${item.size}px"></span>` : objectTxt(cellValue);
85088
85092
  }
85089
85093
  } else if (data.htmlType == "a") {
85090
85094
  let item = data.html.find(item => item.value == cellValue);
85091
- return item ? `<a href="javascript:">${item.label}</a>` : cellValue;
85095
+ return item ? `<a href="javascript:">${item.label}</a>` : objectTxt(cellValue);
85092
85096
  } else if (data.htmlType == 'tag') {
85093
85097
  let item = data.html.find(item => item.value == cellValue);
85094
85098
  return item ? `<span style="
@@ -85103,17 +85107,17 @@ function useFormatter() {
85103
85107
  border-radius: 4px;
85104
85108
  box-sizing: border-box;
85105
85109
  white-space: nowrap;
85106
- ">${item.label}</span>` : cellValue;
85110
+ ">${item.label}</span>` : objectTxt(cellValue);
85107
85111
  }
85108
85112
  } else if (data && "enum" in data) {
85109
85113
  let item = data.enum.find(item => item.value == cellValue);
85110
- return item ? item.label : cellValue;
85114
+ return item ? item.label : objectTxt(cellValue);
85111
85115
  } else {
85112
- return cellValue;
85116
+ return objectTxt(cellValue);
85113
85117
  }
85114
85118
  } catch (error) {
85115
85119
  console.log(error);
85116
- return cellValue;
85120
+ return objectTxt(cellValue);
85117
85121
  }
85118
85122
  }
85119
85123
 
@@ -85065,11 +85065,15 @@ function useFilterData() {
85065
85065
  /*
85066
85066
  * @Author: leevan
85067
85067
  * @Date: 2022-07-12 16:59:44
85068
- * @LastEditTime: 2022-07-12 17:50:49
85068
+ * @LastEditTime: 2022-11-14 17:07:52
85069
85069
  * @LastEditors: leevan
85070
85070
  * @FilePath: /jtui3.0/packages/tables/hooks/useFormatter.js
85071
85071
  */
85072
85072
  function useFormatter() {
85073
+ function objectTxt(cellValue) {
85074
+ return typeof cellValue == 'object' ? JSON.stringify(cellValue) : cellValue;
85075
+ }
85076
+
85073
85077
  function formatEnum(column, cellValue, row, data) {
85074
85078
  try {
85075
85079
  if (data && "html" in data && "htmlType" in data) {
@@ -85091,14 +85095,14 @@ function useFormatter() {
85091
85095
  ></span>`;
85092
85096
  }
85093
85097
  });
85094
- return str ? str : cellValue;
85098
+ return str ? str : objectTxt(cellValue);
85095
85099
  } else {
85096
85100
  let item = data.html.find(item => item.value == cellValue);
85097
- return item ? `<span class="jtIcon ${item.icon}" style="color:${item.color};font-size:${item.size}px"></span>` : cellValue;
85101
+ return item ? `<span class="jtIcon ${item.icon}" style="color:${item.color};font-size:${item.size}px"></span>` : objectTxt(cellValue);
85098
85102
  }
85099
85103
  } else if (data.htmlType == "a") {
85100
85104
  let item = data.html.find(item => item.value == cellValue);
85101
- return item ? `<a href="javascript:">${item.label}</a>` : cellValue;
85105
+ return item ? `<a href="javascript:">${item.label}</a>` : objectTxt(cellValue);
85102
85106
  } else if (data.htmlType == 'tag') {
85103
85107
  let item = data.html.find(item => item.value == cellValue);
85104
85108
  return item ? `<span style="
@@ -85113,17 +85117,17 @@ function useFormatter() {
85113
85117
  border-radius: 4px;
85114
85118
  box-sizing: border-box;
85115
85119
  white-space: nowrap;
85116
- ">${item.label}</span>` : cellValue;
85120
+ ">${item.label}</span>` : objectTxt(cellValue);
85117
85121
  }
85118
85122
  } else if (data && "enum" in data) {
85119
85123
  let item = data.enum.find(item => item.value == cellValue);
85120
- return item ? item.label : cellValue;
85124
+ return item ? item.label : objectTxt(cellValue);
85121
85125
  } else {
85122
- return cellValue;
85126
+ return objectTxt(cellValue);
85123
85127
  }
85124
85128
  } catch (error) {
85125
85129
  console.log(error);
85126
- return cellValue;
85130
+ return objectTxt(cellValue);
85127
85131
  }
85128
85132
  }
85129
85133