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