ywana-core8 0.0.781 → 0.0.783

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.umd.js CHANGED
@@ -1945,7 +1945,8 @@
1945
1945
  _onChange = column.onChange,
1946
1946
  format = column.format,
1947
1947
  options = column.options,
1948
- action = column.action;
1948
+ action = column.action,
1949
+ maxDecimals = column.maxDecimals;
1949
1950
 
1950
1951
  if (id === "checked") {
1951
1952
  return /*#__PURE__*/React__default["default"].createElement(CheckBox, {
@@ -2077,7 +2078,8 @@
2077
2078
  return /*#__PURE__*/React__default["default"].createElement(NumberCellViewer, {
2078
2079
  id: id,
2079
2080
  value: cell,
2080
- format: format
2081
+ format: format,
2082
+ maxDecimals: maxDecimals
2081
2083
  });
2082
2084
 
2083
2085
  default:
@@ -2184,11 +2186,27 @@
2184
2186
  format = _ref7.format,
2185
2187
  maxDecimals = _ref7.maxDecimals;
2186
2188
 
2187
- function formatNumber(number) {
2188
- // convert number to numeric
2189
+ /*
2190
+ function formatNumber(number) {
2191
+ // convert number to numeric
2192
+ if (number === null) return "null"
2193
+ const number2 = Number(number)
2194
+ let result = number2.toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
2195
+ // thousands separator is a dot
2196
+ var parts = result.toString().split(",");
2197
+ const numberPart = parts[0];
2198
+ const decimalPart = parts[1];
2199
+ const thousands = /\B(?=(\d{3})+(?!\d))/g;
2200
+ return numberPart.replace(thousands, ".") + (decimalPart ? "," + decimalPart : "");
2201
+ }
2202
+ */
2203
+ function formatNumber(number, maxDecimals) {
2204
+ if (maxDecimals === void 0) {
2205
+ maxDecimals = 0;
2206
+ }
2207
+
2189
2208
  if (number === null) return "null";
2190
- var number2 = Number(number);
2191
- var result = number2.toLocaleString('es-ES', {
2209
+ var result = number.toLocaleString('es-ES', {
2192
2210
  minimumFractionDigits: 2,
2193
2211
  maximumFractionDigits: 2
2194
2212
  }); // thousands separator is a dot
@@ -2196,8 +2214,10 @@
2196
2214
  var parts = result.toString().split(",");
2197
2215
  var numberPart = parts[0];
2198
2216
  var decimalPart = parts[1];
2199
- var thousands = /\B(?=(\d{3})+(?!\d))/g;
2200
- return numberPart.replace(thousands, ".") + (decimalPart ? "," + decimalPart : "");
2217
+ var thousands = /\B(?=(\d{3})+(?!\d))/g; // limit decimal part to maxdecimals
2218
+
2219
+ var decimal = decimalPart ? decimalPart.substring(0, maxDecimals) : null;
2220
+ return numberPart.replace(thousands, ".") + (decimal ? "," + decimal : "");
2201
2221
  }
2202
2222
 
2203
2223
  if (format) {
@@ -2218,11 +2238,9 @@
2218
2238
  // convert value to number
2219
2239
  var number = Number(value); // if value is not a number, return value
2220
2240
 
2221
- if (isNaN(number)) return value; // if maxDecimals is defined, round number
2222
-
2223
- if (maxDecimals) number = number.toFixed(maxDecimals); // format number
2241
+ if (isNaN(number)) return value; // format number
2224
2242
 
2225
- return /*#__PURE__*/React__default["default"].createElement("span", null, formatNumber(number));
2243
+ return /*#__PURE__*/React__default["default"].createElement("span", null, formatNumber(number, maxDecimals));
2226
2244
 
2227
2245
  default:
2228
2246
  return /*#__PURE__*/React__default["default"].createElement("span", null, value);
@@ -2350,7 +2368,6 @@
2350
2368
  var SortIcon = function SortIcon(props) {
2351
2369
  var sortDir = props.sortDir,
2352
2370
  onChange = props.onChange;
2353
- console.log("sortDir", sortDir);
2354
2371
  var icon = sortDir ? sortDir > 0 ? "arrow_upward" : "arrow_downward" : "swap_vert";
2355
2372
  return /*#__PURE__*/React__default["default"].createElement(Icon, {
2356
2373
  icon: icon,
@@ -11156,7 +11173,6 @@
11156
11173
  var TaskMonitor = function TaskMonitor(props) {
11157
11174
  var remove = function remove(task) {
11158
11175
  try {
11159
- console.log("remove", task);
11160
11176
  return Promise.resolve(context.removeTask(task)).then(function () {
11161
11177
  refresh();
11162
11178
  });
@@ -11199,15 +11215,6 @@
11199
11215
  columns: [{
11200
11216
  id: "state",
11201
11217
  label: "Estado"
11202
- }, {
11203
- id: "description",
11204
- label: "Descripcion"
11205
- }, {
11206
- id: "progress",
11207
- label: "%"
11208
- }, {
11209
- id: "percentage",
11210
- label: ""
11211
11218
  }, {
11212
11219
  id: "init",
11213
11220
  label: "Inicio",
@@ -11219,16 +11226,26 @@
11219
11226
  type: TYPES.STRING,
11220
11227
  format: FORMATS$1.DATE
11221
11228
  }, {
11222
- id: "resourceID",
11223
- label: "Recurso"
11229
+ id: "description",
11230
+ label: "Descripcion"
11224
11231
  }, {
11225
- id: "owner",
11226
- label: "Propietario"
11232
+ id: "progress",
11233
+ label: "%"
11227
11234
  }, {
11235
+ id: "percentage",
11236
+ label: ""
11237
+ }, // { id: "resourceID", label: "Recurso" },
11238
+ // { id: "owner", label: "Propietario" },
11239
+ {
11228
11240
  id: "actions",
11229
11241
  label: ""
11230
11242
  }],
11231
- rows: tasks.map(function (task) {
11243
+ rows: tasks // sort by init date from recent to old
11244
+ .sort(function (a, b) {
11245
+ if (a.init > b.init) return -1;
11246
+ if (a.init < b.init) return 1;
11247
+ return 0;
11248
+ }).map(function (task) {
11232
11249
  return {
11233
11250
  id: task.id,
11234
11251
  state: task.state,