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