@zeniai/client-epic-state 5.1.42 → 5.1.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.
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/entity/task/taskPayload.d.ts +2 -1
- package/lib/entity/task/taskPayload.js +8 -1
- package/lib/entity/task/taskReducer.d.ts +8 -1
- package/lib/entity/task/taskReducer.js +29 -4
- package/lib/entity/task/taskState.d.ts +1 -0
- package/lib/epic.d.ts +5 -3
- package/lib/epic.js +5 -3
- package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/esm/entity/task/taskPayload.js +8 -1
- package/lib/esm/entity/task/taskReducer.js +28 -3
- package/lib/esm/epic.js +5 -3
- package/lib/esm/index.js +3 -3
- package/lib/esm/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.js +3 -0
- package/lib/esm/view/companyTaskManagerView/epics/fetchTaskManagerMetricsEpic.js +7 -1
- package/lib/esm/view/taskManager/taskDetailView/epics/createSubTaskEpic.js +96 -0
- package/lib/esm/view/taskManager/taskDetailView/epics/fetchSubTasksEpic.js +53 -0
- package/lib/esm/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +1 -0
- package/lib/esm/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +70 -9
- package/lib/esm/view/taskManager/taskDetailView/taskDetailReducer.js +56 -2
- package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +32 -9
- package/lib/esm/view/taskManager/taskListView/epics/fetchTaskListEpic.js +3 -1
- package/lib/esm/view/taskManager/taskListView/taskList.js +1 -0
- package/lib/esm/view/taskManager/taskListView/taskListReducer.js +240 -12
- package/lib/esm/view/taskManager/taskListView/taskListSelector.js +1 -0
- package/lib/esm/view/taskManager/taskListView/taskListViewHelpers.js +58 -0
- package/lib/index.d.ts +6 -6
- package/lib/index.js +13 -9
- package/lib/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.js +3 -0
- package/lib/view/companyTaskManagerView/epics/fetchTaskManagerMetricsEpic.js +7 -1
- package/lib/view/companyView/types/cockpitTypes.d.ts +3 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/taskManager/taskDetailView/epics/createSubTaskEpic.d.ts +9 -0
- package/lib/view/taskManager/taskDetailView/epics/createSubTaskEpic.js +100 -0
- package/lib/view/taskManager/taskDetailView/epics/fetchSubTasksEpic.d.ts +8 -0
- package/lib/view/taskManager/taskDetailView/epics/fetchSubTasksEpic.js +57 -0
- package/lib/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +1 -0
- package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.d.ts +2 -2
- package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +69 -8
- package/lib/view/taskManager/taskDetailView/taskDetail.d.ts +15 -0
- package/lib/view/taskManager/taskDetailView/taskDetailReducer.d.ts +14 -2
- package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +57 -3
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.d.ts +2 -1
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +30 -7
- package/lib/view/taskManager/taskListView/epics/fetchTaskListEpic.js +3 -1
- package/lib/view/taskManager/taskListView/taskList.d.ts +1 -1
- package/lib/view/taskManager/taskListView/taskList.js +1 -0
- package/lib/view/taskManager/taskListView/taskListPayload.d.ts +4 -0
- package/lib/view/taskManager/taskListView/taskListReducer.d.ts +6 -2
- package/lib/view/taskManager/taskListView/taskListReducer.js +241 -13
- package/lib/view/taskManager/taskListView/taskListSelector.js +1 -0
- package/lib/view/taskManager/taskListView/taskListViewHelpers.d.ts +11 -0
- package/lib/view/taskManager/taskListView/taskListViewHelpers.js +60 -1
- package/package.json +1 -1
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
import { Tag } from '../../../entity/tag/tagState';
|
|
1
2
|
import { Task } from '../../../entity/task/taskState';
|
|
3
|
+
import { User } from '../../../entity/user/userState';
|
|
2
4
|
import { ZeniDate } from '../../../zeniDayJS';
|
|
3
5
|
import { TaskGroupKey } from './taskList';
|
|
6
|
+
export type SubtaskSortKey = 'name' | 'status' | 'assignee' | 'tag';
|
|
7
|
+
export type SubtaskSortOrder = 'asc' | 'desc';
|
|
4
8
|
export declare const getDueDateValueFromDueDateGroupId: (groupId: string) => ZeniDate;
|
|
5
9
|
export declare const getTaskUpdates: (groupByKey: TaskGroupKey, groupId: string) => Partial<Task>;
|
|
10
|
+
/**
|
|
11
|
+
* Sort a subtask list by one of the sortable columns. Pure — no state
|
|
12
|
+
* dependency. `statusOrder` is derived from `allTaskStatus` so any new
|
|
13
|
+
* status added upstream slots in by its enum position instead of
|
|
14
|
+
* falling into a catch-all bucket.
|
|
15
|
+
*/
|
|
16
|
+
export declare const sortSubtasks: (subtasks: Task[], sortKey: SubtaskSortKey | null, sortOrder: SubtaskSortOrder, userList: User[], tagList: Tag[]) => Task[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTaskUpdates = exports.getDueDateValueFromDueDateGroupId = void 0;
|
|
3
|
+
exports.sortSubtasks = exports.getTaskUpdates = exports.getDueDateValueFromDueDateGroupId = void 0;
|
|
4
4
|
const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
5
5
|
const taskDetailSelector_1 = require("../taskDetailView/taskDetailSelector");
|
|
6
6
|
const taskList_1 = require("./taskList");
|
|
@@ -53,3 +53,62 @@ const getTaskUpdates = (groupByKey, groupId) => {
|
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
55
|
exports.getTaskUpdates = getTaskUpdates;
|
|
56
|
+
/**
|
|
57
|
+
* Sort a subtask list by one of the sortable columns. Pure — no state
|
|
58
|
+
* dependency. `statusOrder` is derived from `allTaskStatus` so any new
|
|
59
|
+
* status added upstream slots in by its enum position instead of
|
|
60
|
+
* falling into a catch-all bucket.
|
|
61
|
+
*/
|
|
62
|
+
const sortSubtasks = (subtasks, sortKey, sortOrder, userList, tagList) => {
|
|
63
|
+
if (sortKey == null) {
|
|
64
|
+
return subtasks;
|
|
65
|
+
}
|
|
66
|
+
const statusOrder = taskDetailSelector_1.allTaskStatus.reduce((acc, status, index) => {
|
|
67
|
+
acc[status.code] = index;
|
|
68
|
+
return acc;
|
|
69
|
+
}, {});
|
|
70
|
+
const unknownStatusRank = taskDetailSelector_1.allTaskStatus.length;
|
|
71
|
+
const cmpStr = (a, b) => a.localeCompare(b, undefined, { sensitivity: 'base' });
|
|
72
|
+
const keyFn = (task) => {
|
|
73
|
+
if (sortKey === 'name') {
|
|
74
|
+
return task.name ?? '';
|
|
75
|
+
}
|
|
76
|
+
if (sortKey === 'status') {
|
|
77
|
+
return statusOrder[task.status.code] ?? unknownStatusRank;
|
|
78
|
+
}
|
|
79
|
+
if (sortKey === 'assignee') {
|
|
80
|
+
const firstId = task.assignees?.[0];
|
|
81
|
+
if (firstId == null) {
|
|
82
|
+
return '';
|
|
83
|
+
}
|
|
84
|
+
const user = userList.find((candidate) => candidate.userId === firstId);
|
|
85
|
+
return user
|
|
86
|
+
? `${user.firstName ?? ''} ${user.lastName ?? ''}`.trim()
|
|
87
|
+
: '';
|
|
88
|
+
}
|
|
89
|
+
if (sortKey === 'tag') {
|
|
90
|
+
const firstTagId = task.tagIds?.[0];
|
|
91
|
+
if (firstTagId == null) {
|
|
92
|
+
return '';
|
|
93
|
+
}
|
|
94
|
+
const tag = tagList.find((candidate) => candidate.tagId === firstTagId);
|
|
95
|
+
return tag?.name ?? '';
|
|
96
|
+
}
|
|
97
|
+
return '';
|
|
98
|
+
};
|
|
99
|
+
const copy = [...subtasks];
|
|
100
|
+
copy.sort((a, b) => {
|
|
101
|
+
const av = keyFn(a);
|
|
102
|
+
const bv = keyFn(b);
|
|
103
|
+
let cmp;
|
|
104
|
+
if (typeof av === 'number' && typeof bv === 'number') {
|
|
105
|
+
cmp = av - bv;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
cmp = cmpStr(String(av), String(bv));
|
|
109
|
+
}
|
|
110
|
+
return sortOrder === 'asc' ? cmp : -cmp;
|
|
111
|
+
});
|
|
112
|
+
return copy;
|
|
113
|
+
};
|
|
114
|
+
exports.sortSubtasks = sortSubtasks;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.43",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|