gantt-task-react-v 1.6.17 → 1.6.18

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.
@@ -10283,10 +10283,33 @@ function formatForInput(value, editType) {
10283
10283
  return "";
10284
10284
  if (editType === "date") {
10285
10285
  if (value instanceof Date) {
10286
- return value.toISOString().slice(0, 10);
10286
+ return Number.isNaN(value.getTime()) ? "" : value.toISOString().slice(0, 10);
10287
10287
  }
10288
- if (typeof value === "string")
10288
+ if (typeof value === "number") {
10289
+ const d = new Date(value);
10290
+ return Number.isNaN(d.getTime()) ? "" : d.toISOString().slice(0, 10);
10291
+ }
10292
+ if (typeof value === "string") {
10293
+ const d = new Date(value);
10294
+ if (!Number.isNaN(d.getTime())) {
10295
+ return d.toISOString().slice(0, 10);
10296
+ }
10289
10297
  return value.slice(0, 10);
10298
+ }
10299
+ return "";
10300
+ }
10301
+ if (editType === "number") {
10302
+ if (typeof value === "number") {
10303
+ return Number.isNaN(value) ? "" : String(value);
10304
+ }
10305
+ if (typeof value === "string") {
10306
+ const n = Number(value);
10307
+ return Number.isNaN(n) ? value : String(n);
10308
+ }
10309
+ return String(value);
10310
+ }
10311
+ if (editType === "select") {
10312
+ return String(value);
10290
10313
  }
10291
10314
  return String(value);
10292
10315
  }
@@ -10498,9 +10521,26 @@ const TaskListTableRowInner = forwardRef(
10498
10521
  const t = columnData.task;
10499
10522
  if (c.getValueFromTask)
10500
10523
  return c.getValueFromTask(t);
10501
- if (t.type !== "empty" && t.payload && c.id in t.payload)
10502
- return t.payload[c.id];
10503
- return t[c.id];
10524
+ if (t.type !== "empty" && t.payload) {
10525
+ if (c.id in t.payload)
10526
+ return t.payload[c.id];
10527
+ }
10528
+ if (c.id in t)
10529
+ return t[c.id];
10530
+ if (t.type !== "empty") {
10531
+ const task2 = t;
10532
+ const aliasMap = {
10533
+ startDate: task2.start,
10534
+ finishDate: task2.end,
10535
+ endDate: task2.end,
10536
+ duration: task2.end && task2.start ? Math.round(
10537
+ (task2.end.getTime() - task2.start.getTime()) / (1e3 * 60 * 60 * 24)
10538
+ ) : void 0
10539
+ };
10540
+ if (c.id in aliasMap)
10541
+ return aliasMap[c.id];
10542
+ }
10543
+ return void 0;
10504
10544
  };
10505
10545
  const handleStartEdit = () => {
10506
10546
  if (col.editable && onTaskInlineEdit) {
@@ -10300,10 +10300,33 @@
10300
10300
  return "";
10301
10301
  if (editType === "date") {
10302
10302
  if (value instanceof Date) {
10303
- return value.toISOString().slice(0, 10);
10303
+ return Number.isNaN(value.getTime()) ? "" : value.toISOString().slice(0, 10);
10304
10304
  }
10305
- if (typeof value === "string")
10305
+ if (typeof value === "number") {
10306
+ const d = new Date(value);
10307
+ return Number.isNaN(d.getTime()) ? "" : d.toISOString().slice(0, 10);
10308
+ }
10309
+ if (typeof value === "string") {
10310
+ const d = new Date(value);
10311
+ if (!Number.isNaN(d.getTime())) {
10312
+ return d.toISOString().slice(0, 10);
10313
+ }
10306
10314
  return value.slice(0, 10);
10315
+ }
10316
+ return "";
10317
+ }
10318
+ if (editType === "number") {
10319
+ if (typeof value === "number") {
10320
+ return Number.isNaN(value) ? "" : String(value);
10321
+ }
10322
+ if (typeof value === "string") {
10323
+ const n = Number(value);
10324
+ return Number.isNaN(n) ? value : String(n);
10325
+ }
10326
+ return String(value);
10327
+ }
10328
+ if (editType === "select") {
10329
+ return String(value);
10307
10330
  }
10308
10331
  return String(value);
10309
10332
  }
@@ -10515,9 +10538,26 @@
10515
10538
  const t = columnData.task;
10516
10539
  if (c.getValueFromTask)
10517
10540
  return c.getValueFromTask(t);
10518
- if (t.type !== "empty" && t.payload && c.id in t.payload)
10519
- return t.payload[c.id];
10520
- return t[c.id];
10541
+ if (t.type !== "empty" && t.payload) {
10542
+ if (c.id in t.payload)
10543
+ return t.payload[c.id];
10544
+ }
10545
+ if (c.id in t)
10546
+ return t[c.id];
10547
+ if (t.type !== "empty") {
10548
+ const task2 = t;
10549
+ const aliasMap = {
10550
+ startDate: task2.start,
10551
+ finishDate: task2.end,
10552
+ endDate: task2.end,
10553
+ duration: task2.end && task2.start ? Math.round(
10554
+ (task2.end.getTime() - task2.start.getTime()) / (1e3 * 60 * 60 * 24)
10555
+ ) : void 0
10556
+ };
10557
+ if (c.id in aliasMap)
10558
+ return aliasMap[c.id];
10559
+ }
10560
+ return void 0;
10521
10561
  };
10522
10562
  const handleStartEdit = () => {
10523
10563
  if (col.editable && onTaskInlineEdit) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gantt-task-react-v",
3
- "version": "1.6.17",
3
+ "version": "1.6.18",
4
4
  "description": "Interactive Gantt Chart for React with TypeScript.",
5
5
  "author": "aguilanbon",
6
6
  "homepage": "https://github.com/aguilanbon/gantt-task-react-v",