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.cjs CHANGED
@@ -1951,7 +1951,8 @@ var DataTableCell = function DataTableCell(_ref4) {
1951
1951
  _onChange = column.onChange,
1952
1952
  format = column.format,
1953
1953
  options = column.options,
1954
- action = column.action;
1954
+ action = column.action,
1955
+ maxDecimals = column.maxDecimals;
1955
1956
 
1956
1957
  if (id === "checked") {
1957
1958
  return /*#__PURE__*/React__default["default"].createElement(CheckBox, {
@@ -2083,7 +2084,8 @@ var DataTableCell = function DataTableCell(_ref4) {
2083
2084
  return /*#__PURE__*/React__default["default"].createElement(NumberCellViewer, {
2084
2085
  id: id,
2085
2086
  value: cell,
2086
- format: format
2087
+ format: format,
2088
+ maxDecimals: maxDecimals
2087
2089
  });
2088
2090
 
2089
2091
  default:
@@ -2190,11 +2192,27 @@ var NumberCellViewer = function NumberCellViewer(_ref7) {
2190
2192
  format = _ref7.format,
2191
2193
  maxDecimals = _ref7.maxDecimals;
2192
2194
 
2193
- function formatNumber(number) {
2194
- // convert number to numeric
2195
+ /*
2196
+ function formatNumber(number) {
2197
+ // convert number to numeric
2198
+ if (number === null) return "null"
2199
+ const number2 = Number(number)
2200
+ let result = number2.toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
2201
+ // thousands separator is a dot
2202
+ var parts = result.toString().split(",");
2203
+ const numberPart = parts[0];
2204
+ const decimalPart = parts[1];
2205
+ const thousands = /\B(?=(\d{3})+(?!\d))/g;
2206
+ return numberPart.replace(thousands, ".") + (decimalPart ? "," + decimalPart : "");
2207
+ }
2208
+ */
2209
+ function formatNumber(number, maxDecimals) {
2210
+ if (maxDecimals === void 0) {
2211
+ maxDecimals = 0;
2212
+ }
2213
+
2195
2214
  if (number === null) return "null";
2196
- var number2 = Number(number);
2197
- var result = number2.toLocaleString('es-ES', {
2215
+ var result = number.toLocaleString('es-ES', {
2198
2216
  minimumFractionDigits: 2,
2199
2217
  maximumFractionDigits: 2
2200
2218
  }); // thousands separator is a dot
@@ -2202,8 +2220,10 @@ var NumberCellViewer = function NumberCellViewer(_ref7) {
2202
2220
  var parts = result.toString().split(",");
2203
2221
  var numberPart = parts[0];
2204
2222
  var decimalPart = parts[1];
2205
- var thousands = /\B(?=(\d{3})+(?!\d))/g;
2206
- return numberPart.replace(thousands, ".") + (decimalPart ? "," + decimalPart : "");
2223
+ var thousands = /\B(?=(\d{3})+(?!\d))/g; // limit decimal part to maxdecimals
2224
+
2225
+ var decimal = decimalPart ? decimalPart.substring(0, maxDecimals) : null;
2226
+ return numberPart.replace(thousands, ".") + (decimal ? "," + decimal : "");
2207
2227
  }
2208
2228
 
2209
2229
  if (format) {
@@ -2224,11 +2244,9 @@ var NumberCellViewer = function NumberCellViewer(_ref7) {
2224
2244
  // convert value to number
2225
2245
  var number = Number(value); // if value is not a number, return value
2226
2246
 
2227
- if (isNaN(number)) return value; // if maxDecimals is defined, round number
2228
-
2229
- if (maxDecimals) number = number.toFixed(maxDecimals); // format number
2247
+ if (isNaN(number)) return value; // format number
2230
2248
 
2231
- return /*#__PURE__*/React__default["default"].createElement("span", null, formatNumber(number));
2249
+ return /*#__PURE__*/React__default["default"].createElement("span", null, formatNumber(number, maxDecimals));
2232
2250
 
2233
2251
  default:
2234
2252
  return /*#__PURE__*/React__default["default"].createElement("span", null, value);
@@ -2356,7 +2374,6 @@ var StringCellEditor = function StringCellEditor(_ref9) {
2356
2374
  var SortIcon = function SortIcon(props) {
2357
2375
  var sortDir = props.sortDir,
2358
2376
  onChange = props.onChange;
2359
- console.log("sortDir", sortDir);
2360
2377
  var icon = sortDir ? sortDir > 0 ? "arrow_upward" : "arrow_downward" : "swap_vert";
2361
2378
  return /*#__PURE__*/React__default["default"].createElement(Icon, {
2362
2379
  icon: icon,
@@ -11162,7 +11179,6 @@ var TaskProgress = function TaskProgress(props) {
11162
11179
  var TaskMonitor = function TaskMonitor(props) {
11163
11180
  var remove = function remove(task) {
11164
11181
  try {
11165
- console.log("remove", task);
11166
11182
  return Promise.resolve(context.removeTask(task)).then(function () {
11167
11183
  refresh();
11168
11184
  });
@@ -11205,15 +11221,6 @@ var TaskMonitor = function TaskMonitor(props) {
11205
11221
  columns: [{
11206
11222
  id: "state",
11207
11223
  label: "Estado"
11208
- }, {
11209
- id: "description",
11210
- label: "Descripcion"
11211
- }, {
11212
- id: "progress",
11213
- label: "%"
11214
- }, {
11215
- id: "percentage",
11216
- label: ""
11217
11224
  }, {
11218
11225
  id: "init",
11219
11226
  label: "Inicio",
@@ -11225,16 +11232,26 @@ var TaskMonitor = function TaskMonitor(props) {
11225
11232
  type: TYPES.STRING,
11226
11233
  format: FORMATS$1.DATE
11227
11234
  }, {
11228
- id: "resourceID",
11229
- label: "Recurso"
11235
+ id: "description",
11236
+ label: "Descripcion"
11230
11237
  }, {
11231
- id: "owner",
11232
- label: "Propietario"
11238
+ id: "progress",
11239
+ label: "%"
11233
11240
  }, {
11241
+ id: "percentage",
11242
+ label: ""
11243
+ }, // { id: "resourceID", label: "Recurso" },
11244
+ // { id: "owner", label: "Propietario" },
11245
+ {
11234
11246
  id: "actions",
11235
11247
  label: ""
11236
11248
  }],
11237
- rows: tasks.map(function (task) {
11249
+ rows: tasks // sort by init date from recent to old
11250
+ .sort(function (a, b) {
11251
+ if (a.init > b.init) return -1;
11252
+ if (a.init < b.init) return 1;
11253
+ return 0;
11254
+ }).map(function (task) {
11238
11255
  return {
11239
11256
  id: task.id,
11240
11257
  state: task.state,