ywana-core8 0.0.759 → 0.0.761
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.cjs +53 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +53 -12
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +53 -12
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/table.js +23 -1
- package/src/html/table.test.js +2 -1
package/dist/index.modern.js
CHANGED
@@ -2019,6 +2019,7 @@ var DataTableCell = function DataTableCell(_ref4) {
|
|
2019
2019
|
value: cell,
|
2020
2020
|
min: min,
|
2021
2021
|
max: max,
|
2022
|
+
maxDecimals: column.maxDecimals,
|
2022
2023
|
onChange: function onChange(id, value) {
|
2023
2024
|
return _onChange(row.id, id, value);
|
2024
2025
|
}
|
@@ -2052,6 +2053,13 @@ var DataTableCell = function DataTableCell(_ref4) {
|
|
2052
2053
|
action: action
|
2053
2054
|
});
|
2054
2055
|
|
2056
|
+
case "Number":
|
2057
|
+
return /*#__PURE__*/React.createElement(NumberCellViewer, {
|
2058
|
+
id: id,
|
2059
|
+
value: cell,
|
2060
|
+
format: format
|
2061
|
+
});
|
2062
|
+
|
2055
2063
|
default:
|
2056
2064
|
return cell;
|
2057
2065
|
}
|
@@ -2147,16 +2155,49 @@ var BooleanCellViewer = function BooleanCellViewer(_ref6) {
|
|
2147
2155
|
});
|
2148
2156
|
};
|
2149
2157
|
/**
|
2150
|
-
*
|
2158
|
+
* NumberCellViewer
|
2151
2159
|
*/
|
2152
2160
|
|
2153
2161
|
|
2154
|
-
var
|
2155
|
-
var
|
2156
|
-
value = _ref7.value,
|
2162
|
+
var NumberCellViewer = function NumberCellViewer(_ref7) {
|
2163
|
+
var value = _ref7.value,
|
2157
2164
|
format = _ref7.format,
|
2158
|
-
|
2159
|
-
|
2165
|
+
maxDecimals = _ref7.maxDecimals;
|
2166
|
+
|
2167
|
+
if (format) {
|
2168
|
+
switch (format) {
|
2169
|
+
case FORMATS$1.CURRENCY:
|
2170
|
+
return /*#__PURE__*/React.createElement("span", null, value.toLocaleString('es-ES', {
|
2171
|
+
style: 'currency',
|
2172
|
+
currency: 'EUR'
|
2173
|
+
}));
|
2174
|
+
|
2175
|
+
case FORMATS$1.PERCENT:
|
2176
|
+
return /*#__PURE__*/React.createElement("span", null, value.toLocaleString('es-ES', {
|
2177
|
+
style: 'percent',
|
2178
|
+
minimumFractionDigits: 2
|
2179
|
+
}));
|
2180
|
+
|
2181
|
+
default:
|
2182
|
+
return /*#__PURE__*/React.createElement("span", null, value);
|
2183
|
+
}
|
2184
|
+
} else {
|
2185
|
+
var decimals = maxDecimals ? maxDecimals : 2; // check value is a number
|
2186
|
+
|
2187
|
+
return value && !isNaN(value) ? /*#__PURE__*/React.createElement("span", null, value.toFixed(decimals)) : "";
|
2188
|
+
}
|
2189
|
+
};
|
2190
|
+
/**
|
2191
|
+
* String Cell Viewer
|
2192
|
+
*/
|
2193
|
+
|
2194
|
+
|
2195
|
+
var StringCellViewer = function StringCellViewer(_ref8) {
|
2196
|
+
var id = _ref8.id,
|
2197
|
+
value = _ref8.value,
|
2198
|
+
format = _ref8.format,
|
2199
|
+
options = _ref8.options,
|
2200
|
+
action = _ref8.action;
|
2160
2201
|
|
2161
2202
|
function buildOptions() {
|
2162
2203
|
var opts = typeof options === 'function' ? options() : options;
|
@@ -2226,12 +2267,12 @@ var StringCellViewer = function StringCellViewer(_ref7) {
|
|
2226
2267
|
*/
|
2227
2268
|
|
2228
2269
|
|
2229
|
-
var StringCellEditor = function StringCellEditor(
|
2230
|
-
var id =
|
2231
|
-
|
2232
|
-
value =
|
2233
|
-
options =
|
2234
|
-
onChange =
|
2270
|
+
var StringCellEditor = function StringCellEditor(_ref9) {
|
2271
|
+
var id = _ref9.id,
|
2272
|
+
_ref9$value = _ref9.value,
|
2273
|
+
value = _ref9$value === void 0 ? '' : _ref9$value,
|
2274
|
+
options = _ref9.options,
|
2275
|
+
onChange = _ref9.onChange;
|
2235
2276
|
|
2236
2277
|
function change(id, value) {
|
2237
2278
|
if (onChange) onChange(id, value);
|