arengibook 2.0.3-table → 2.0.4-table

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.
Files changed (2) hide show
  1. package/dist/index.js +17 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -44014,6 +44014,20 @@ var Table = function Table(_ref) {
44014
44014
  return (_rowData$col$field = rowData[col.field]) !== null && _rowData$col$field !== void 0 ? _rowData$col$field : '';
44015
44015
  };
44016
44016
  }, []);
44017
+ var colorTextTemplate = useCallback(function (col) {
44018
+ return function (rowData) {
44019
+ var text = rowData[col.field];
44020
+ var color = rowData[col.field + 'Color'];
44021
+ if (!color) return text !== null && text !== void 0 ? text : '';
44022
+ return /*#__PURE__*/React__default.createElement("span", {
44023
+ className: "tab_label",
44024
+ style: {
44025
+ backgroundColor: color,
44026
+ color: textColorForBg(color)
44027
+ }
44028
+ }, text);
44029
+ };
44030
+ }, []);
44017
44031
  var selectMultipleTemplate = useCallback(function (col) {
44018
44032
  return function (rowData) {
44019
44033
  var vals = rowData[col.field];
@@ -44122,11 +44136,13 @@ var Table = function Table(_ref) {
44122
44136
  return selectTemplate(col);
44123
44137
  case 'selectMultiple':
44124
44138
  return selectMultipleTemplate(col);
44139
+ case 'colorText':
44140
+ return colorTextTemplate(col);
44125
44141
  case 'text':
44126
44142
  default:
44127
44143
  return col.textTemplate ? textTemplate(col) : undefined;
44128
44144
  }
44129
- }, [linkTemplate, dateTemplate, selectTemplate, selectMultipleTemplate, textTemplate]);
44145
+ }, [linkTemplate, dateTemplate, selectTemplate, selectMultipleTemplate, colorTextTemplate, textTemplate]);
44130
44146
  var getSortField = useCallback(function (col) {
44131
44147
  return col.field;
44132
44148
  }, []);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "arengibook",
3
3
  "private": false,
4
- "version": "2.0.3-table",
4
+ "version": "2.0.4-table",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
7
7
  "exports": {