gantt-task-react-powern 0.4.42 → 0.4.43

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.
@@ -7,6 +7,7 @@ export declare const TaskListTableDefault: React.FC<{
7
7
  fontSize: string;
8
8
  locale: string;
9
9
  tasks: Task[];
10
+ leafTasks: Task[];
10
11
  selectedTaskId: string;
11
12
  setSelectedTask: (taskId: string) => void;
12
13
  onExpanderClick: (task: Task) => void;
@@ -12,6 +12,7 @@ export declare type TaskListProps = {
12
12
  scrollY: number;
13
13
  locale: string;
14
14
  tasks: Task[];
15
+ leafTasks: Task[];
15
16
  taskListRef: React.RefObject<HTMLDivElement>;
16
17
  horizontalContainerClass?: string;
17
18
  selectedTask: BarTask | undefined;
@@ -31,6 +32,7 @@ export declare type TaskListProps = {
31
32
  fontSize: string;
32
33
  locale: string;
33
34
  tasks: Task[];
35
+ leafTasks: Task[];
34
36
  selectedTaskId: string;
35
37
  setSelectedTask: (taskId: string) => void;
36
38
  onExpanderClick: (task: Task) => void;
package/dist/index.js CHANGED
@@ -355,6 +355,7 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
355
355
  var rowHeight = _ref.rowHeight,
356
356
  rowWidth = _ref.rowWidth,
357
357
  tasks = _ref.tasks,
358
+ leafTasks = _ref.leafTasks,
358
359
  fontFamily = _ref.fontFamily,
359
360
  fontSize = _ref.fontSize,
360
361
  locale = _ref.locale,
@@ -366,6 +367,11 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
366
367
  var toLocaleDateString = React.useMemo(function () {
367
368
  return toLocaleDateStringFactory(locale);
368
369
  }, [locale]);
370
+ var leafTaskIds = React.useMemo(function () {
371
+ return new Set(leafTasks.map(function (t) {
372
+ return t.id;
373
+ }));
374
+ }, [leafTasks]);
369
375
  return React__default.createElement("div", {
370
376
  className: styles$1.taskListWrapper,
371
377
  style: {
@@ -375,7 +381,7 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
375
381
  }, tasks.map(function (t) {
376
382
  var expanderSymbol = "";
377
383
 
378
- if (t.childrenCount && t.childrenCount > 0) {
384
+ if (!leafTaskIds.has(t.id)) {
379
385
  if (t.hideChildren === false) {
380
386
  expanderSymbol = "▼";
381
387
  } else if (t.hideChildren === true) {
@@ -602,6 +608,7 @@ var TaskList = function TaskList(_ref) {
602
608
  rowHeight = _ref.rowHeight,
603
609
  scrollY = _ref.scrollY,
604
610
  tasks = _ref.tasks,
611
+ leafTasks = _ref.leafTasks,
605
612
  selectedTask = _ref.selectedTask,
606
613
  setSelectedTask = _ref.setSelectedTask,
607
614
  onExpanderClick = _ref.onExpanderClick,
@@ -631,6 +638,7 @@ var TaskList = function TaskList(_ref) {
631
638
  fontFamily: fontFamily,
632
639
  fontSize: fontSize,
633
640
  tasks: tasks,
641
+ leafTasks: leafTasks,
634
642
  locale: locale,
635
643
  selectedTaskId: selectedTaskId,
636
644
  setSelectedTask: setSelectedTask,
@@ -2805,6 +2813,7 @@ var Gantt = function Gantt(_ref) {
2805
2813
  fontFamily: fontFamily,
2806
2814
  fontSize: fontSize,
2807
2815
  tasks: barTasks,
2816
+ leafTasks: barTasks,
2808
2817
  locale: locale,
2809
2818
  headerHeight: headerHeight,
2810
2819
  scrollY: scrollY,