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.cjs
CHANGED
@@ -2027,6 +2027,7 @@ var DataTableCell = function DataTableCell(_ref4) {
|
|
2027
2027
|
value: cell,
|
2028
2028
|
min: min,
|
2029
2029
|
max: max,
|
2030
|
+
maxDecimals: column.maxDecimals,
|
2030
2031
|
onChange: function onChange(id, value) {
|
2031
2032
|
return _onChange(row.id, id, value);
|
2032
2033
|
}
|
@@ -2060,6 +2061,13 @@ var DataTableCell = function DataTableCell(_ref4) {
|
|
2060
2061
|
action: action
|
2061
2062
|
});
|
2062
2063
|
|
2064
|
+
case "Number":
|
2065
|
+
return /*#__PURE__*/React__default["default"].createElement(NumberCellViewer, {
|
2066
|
+
id: id,
|
2067
|
+
value: cell,
|
2068
|
+
format: format
|
2069
|
+
});
|
2070
|
+
|
2063
2071
|
default:
|
2064
2072
|
return cell;
|
2065
2073
|
}
|
@@ -2155,16 +2163,49 @@ var BooleanCellViewer = function BooleanCellViewer(_ref6) {
|
|
2155
2163
|
});
|
2156
2164
|
};
|
2157
2165
|
/**
|
2158
|
-
*
|
2166
|
+
* NumberCellViewer
|
2159
2167
|
*/
|
2160
2168
|
|
2161
2169
|
|
2162
|
-
var
|
2163
|
-
var
|
2164
|
-
value = _ref7.value,
|
2170
|
+
var NumberCellViewer = function NumberCellViewer(_ref7) {
|
2171
|
+
var value = _ref7.value,
|
2165
2172
|
format = _ref7.format,
|
2166
|
-
|
2167
|
-
|
2173
|
+
maxDecimals = _ref7.maxDecimals;
|
2174
|
+
|
2175
|
+
if (format) {
|
2176
|
+
switch (format) {
|
2177
|
+
case FORMATS$1.CURRENCY:
|
2178
|
+
return /*#__PURE__*/React__default["default"].createElement("span", null, value.toLocaleString('es-ES', {
|
2179
|
+
style: 'currency',
|
2180
|
+
currency: 'EUR'
|
2181
|
+
}));
|
2182
|
+
|
2183
|
+
case FORMATS$1.PERCENT:
|
2184
|
+
return /*#__PURE__*/React__default["default"].createElement("span", null, value.toLocaleString('es-ES', {
|
2185
|
+
style: 'percent',
|
2186
|
+
minimumFractionDigits: 2
|
2187
|
+
}));
|
2188
|
+
|
2189
|
+
default:
|
2190
|
+
return /*#__PURE__*/React__default["default"].createElement("span", null, value);
|
2191
|
+
}
|
2192
|
+
} else {
|
2193
|
+
var decimals = maxDecimals ? maxDecimals : 2; // check value is a number
|
2194
|
+
|
2195
|
+
return value && !isNaN(value) ? /*#__PURE__*/React__default["default"].createElement("span", null, value.toFixed(decimals)) : "";
|
2196
|
+
}
|
2197
|
+
};
|
2198
|
+
/**
|
2199
|
+
* String Cell Viewer
|
2200
|
+
*/
|
2201
|
+
|
2202
|
+
|
2203
|
+
var StringCellViewer = function StringCellViewer(_ref8) {
|
2204
|
+
var id = _ref8.id,
|
2205
|
+
value = _ref8.value,
|
2206
|
+
format = _ref8.format,
|
2207
|
+
options = _ref8.options,
|
2208
|
+
action = _ref8.action;
|
2168
2209
|
|
2169
2210
|
function buildOptions() {
|
2170
2211
|
var opts = typeof options === 'function' ? options() : options;
|
@@ -2234,12 +2275,12 @@ var StringCellViewer = function StringCellViewer(_ref7) {
|
|
2234
2275
|
*/
|
2235
2276
|
|
2236
2277
|
|
2237
|
-
var StringCellEditor = function StringCellEditor(
|
2238
|
-
var id =
|
2239
|
-
|
2240
|
-
value =
|
2241
|
-
options =
|
2242
|
-
onChange =
|
2278
|
+
var StringCellEditor = function StringCellEditor(_ref9) {
|
2279
|
+
var id = _ref9.id,
|
2280
|
+
_ref9$value = _ref9.value,
|
2281
|
+
value = _ref9$value === void 0 ? '' : _ref9$value,
|
2282
|
+
options = _ref9.options,
|
2283
|
+
onChange = _ref9.onChange;
|
2243
2284
|
|
2244
2285
|
function change(id, value) {
|
2245
2286
|
if (onChange) onChange(id, value);
|