arengibook 2.0.2-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.
- package/dist/index.js +26 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -44007,6 +44007,27 @@ var Table = function Table(_ref) {
|
|
|
44007
44007
|
}, opt.label);
|
|
44008
44008
|
};
|
|
44009
44009
|
}, []);
|
|
44010
|
+
var textTemplate = useCallback(function (col) {
|
|
44011
|
+
return function (rowData) {
|
|
44012
|
+
var _rowData$col$field;
|
|
44013
|
+
if (typeof col.textTemplate === 'function') return col.textTemplate(rowData);
|
|
44014
|
+
return (_rowData$col$field = rowData[col.field]) !== null && _rowData$col$field !== void 0 ? _rowData$col$field : '';
|
|
44015
|
+
};
|
|
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
|
+
}, []);
|
|
44010
44031
|
var selectMultipleTemplate = useCallback(function (col) {
|
|
44011
44032
|
return function (rowData) {
|
|
44012
44033
|
var vals = rowData[col.field];
|
|
@@ -44115,10 +44136,13 @@ var Table = function Table(_ref) {
|
|
|
44115
44136
|
return selectTemplate(col);
|
|
44116
44137
|
case 'selectMultiple':
|
|
44117
44138
|
return selectMultipleTemplate(col);
|
|
44139
|
+
case 'colorText':
|
|
44140
|
+
return colorTextTemplate(col);
|
|
44141
|
+
case 'text':
|
|
44118
44142
|
default:
|
|
44119
|
-
return undefined;
|
|
44143
|
+
return col.textTemplate ? textTemplate(col) : undefined;
|
|
44120
44144
|
}
|
|
44121
|
-
}, [linkTemplate, dateTemplate, selectTemplate, selectMultipleTemplate]);
|
|
44145
|
+
}, [linkTemplate, dateTemplate, selectTemplate, selectMultipleTemplate, colorTextTemplate, textTemplate]);
|
|
44122
44146
|
var getSortField = useCallback(function (col) {
|
|
44123
44147
|
return col.field;
|
|
44124
44148
|
}, []);
|