@larisarozin/dodone-shared 1.0.0
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/README.md +116 -0
- package/dist/api/routes.d.ts +66 -0
- package/dist/api/routes.js +87 -0
- package/dist/config/ConfigContext.d.ts +4 -0
- package/dist/config/ConfigContext.js +10 -0
- package/dist/config/ConfigProvider.d.ts +8 -0
- package/dist/config/ConfigProvider.js +8 -0
- package/dist/config/useConfig.d.ts +1 -0
- package/dist/config/useConfig.js +17 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.js +6 -0
- package/dist/hooks/auth/AuthContext.d.ts +6 -0
- package/dist/hooks/auth/AuthContext.js +10 -0
- package/dist/hooks/auth/AuthProvider.d.ts +6 -0
- package/dist/hooks/auth/AuthProvider.js +83 -0
- package/dist/hooks/auth/AuthState.d.ts +20 -0
- package/dist/hooks/auth/AuthState.js +7 -0
- package/dist/hooks/auth/useAuth.d.ts +3 -0
- package/dist/hooks/auth/useAuth.js +17 -0
- package/dist/hooks/useAllowanceHistories.d.ts +9 -0
- package/dist/hooks/useAllowanceHistories.js +87 -0
- package/dist/hooks/useAllowanceHistoryTaskItems.d.ts +7 -0
- package/dist/hooks/useAllowanceHistoryTaskItems.js +69 -0
- package/dist/hooks/useGrades.d.ts +5 -0
- package/dist/hooks/useGrades.js +50 -0
- package/dist/hooks/useNotificationPreferences.d.ts +9 -0
- package/dist/hooks/useNotificationPreferences.js +107 -0
- package/dist/hooks/useTaskCategories.d.ts +7 -0
- package/dist/hooks/useTaskCategories.js +70 -0
- package/dist/hooks/useTaskComments.d.ts +7 -0
- package/dist/hooks/useTaskComments.js +69 -0
- package/dist/hooks/useTaskGroups.d.ts +7 -0
- package/dist/hooks/useTaskGroups.js +70 -0
- package/dist/hooks/useTaskItems.d.ts +7 -0
- package/dist/hooks/useTaskItems.js +70 -0
- package/dist/hooks/useTaskKinds.d.ts +7 -0
- package/dist/hooks/useTaskKinds.js +70 -0
- package/dist/hooks/useTeam.d.ts +24 -0
- package/dist/hooks/useTeam.js +255 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +50 -0
- package/dist/types/AllowanceHistory.d.ts +66 -0
- package/dist/types/AllowanceHistory.js +7 -0
- package/dist/types/AllowanceInterval.d.ts +29 -0
- package/dist/types/AllowanceInterval.js +40 -0
- package/dist/types/ApiResponse.d.ts +7 -0
- package/dist/types/ApiResponse.js +7 -0
- package/dist/types/DeviceRegistration.d.ts +6 -0
- package/dist/types/DeviceRegistration.js +7 -0
- package/dist/types/TaskItem.d.ts +174 -0
- package/dist/types/TaskItem.js +16 -0
- package/dist/types/Team.d.ts +76 -0
- package/dist/types/Team.js +7 -0
- package/dist/types/User.d.ts +91 -0
- package/dist/types/User.js +7 -0
- package/dist/types/UserNotificationPreferences.d.ts +81 -0
- package/dist/types/UserNotificationPreferences.js +68 -0
- package/dist/utils/ApiClient.d.ts +204 -0
- package/dist/utils/ApiClient.js +608 -0
- package/dist/utils/paging.d.ts +305 -0
- package/dist/utils/paging.js +428 -0
- package/dist/utils/storage.d.ts +7 -0
- package/dist/utils/storage.js +37 -0
- package/dist/utils/utils.d.ts +0 -0
- package/dist/utils/utils.js +6 -0
- package/package.json +29 -0
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2025 Larisa Rozin
|
|
4
|
+
* dodone-shared - Task Management, Allowance & Bonus Tracking Application Package
|
|
5
|
+
* All rights reserved.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.TaskCommentPagingUtils = exports.PagedTaskCommentListRequestBuilder = exports.TaskItemPagingUtils = exports.PagedTaskItemListRequestBuilder = exports.TaskItemBonusStatusFilter = exports.TaskItemPriorityFilter = exports.TaskItemAllowanceAccreditedStatusFilter = exports.TaskItemNeedReviewStatusFilter = exports.TaskItemEndedStatusFilter = exports.TaskItemStartedStatusFilter = exports.TaskItemDueStatusFilter = exports.TaskItemArchivedStatusFilter = exports.TaskItemActiveStatusFilter = exports.TaskItemCompletionStatusFilter = exports.TaskItemAssignmentStatusFilter = exports.PagingUtils = exports.PagedListRequestBuilder = exports.SortDirection = exports.FilterOperation = void 0;
|
|
9
|
+
// Frontend TypeScript utilities for the new paging system
|
|
10
|
+
var FilterOperation;
|
|
11
|
+
(function (FilterOperation) {
|
|
12
|
+
FilterOperation[FilterOperation["Equals"] = 0] = "Equals";
|
|
13
|
+
FilterOperation[FilterOperation["NotEquals"] = 1] = "NotEquals";
|
|
14
|
+
FilterOperation[FilterOperation["Contains"] = 2] = "Contains";
|
|
15
|
+
FilterOperation[FilterOperation["NotContains"] = 3] = "NotContains";
|
|
16
|
+
FilterOperation[FilterOperation["StartsWith"] = 4] = "StartsWith";
|
|
17
|
+
FilterOperation[FilterOperation["EndsWith"] = 5] = "EndsWith";
|
|
18
|
+
FilterOperation[FilterOperation["GreaterThan"] = 6] = "GreaterThan";
|
|
19
|
+
FilterOperation[FilterOperation["GreaterThanOrEqual"] = 7] = "GreaterThanOrEqual";
|
|
20
|
+
FilterOperation[FilterOperation["LessThan"] = 8] = "LessThan";
|
|
21
|
+
FilterOperation[FilterOperation["LessThanOrEqual"] = 9] = "LessThanOrEqual";
|
|
22
|
+
FilterOperation[FilterOperation["In"] = 10] = "In";
|
|
23
|
+
FilterOperation[FilterOperation["NotIn"] = 11] = "NotIn";
|
|
24
|
+
FilterOperation[FilterOperation["IsNull"] = 12] = "IsNull";
|
|
25
|
+
FilterOperation[FilterOperation["IsNotNull"] = 13] = "IsNotNull";
|
|
26
|
+
FilterOperation[FilterOperation["Between"] = 14] = "Between";
|
|
27
|
+
})(FilterOperation || (exports.FilterOperation = FilterOperation = {}));
|
|
28
|
+
var SortDirection;
|
|
29
|
+
(function (SortDirection) {
|
|
30
|
+
SortDirection[SortDirection["Ascending"] = 0] = "Ascending";
|
|
31
|
+
SortDirection[SortDirection["Descending"] = 1] = "Descending";
|
|
32
|
+
})(SortDirection || (exports.SortDirection = SortDirection = {}));
|
|
33
|
+
class PagedListRequestBuilder {
|
|
34
|
+
constructor(request) {
|
|
35
|
+
if (request) {
|
|
36
|
+
this.request = request;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
this.request = {
|
|
40
|
+
paging: { page: 1, pageSize: 10 },
|
|
41
|
+
filtering: { filters: [] },
|
|
42
|
+
sorting: { sortDirection: SortDirection.Ascending }
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Set the parent ID for hierarchical queries
|
|
48
|
+
*/
|
|
49
|
+
setParentId(parentId) {
|
|
50
|
+
this.request.parentId = parentId;
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Set paging parameters
|
|
55
|
+
*/
|
|
56
|
+
setPaging(page, pageSize = 10) {
|
|
57
|
+
this.request.paging = { page: Math.max(1, page), pageSize: Math.min(100, Math.max(1, pageSize)) };
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Add a filter criteria
|
|
62
|
+
*/
|
|
63
|
+
addFilter(field, operation, value, values) {
|
|
64
|
+
this.request.filtering.filters.push({
|
|
65
|
+
field,
|
|
66
|
+
operation,
|
|
67
|
+
value,
|
|
68
|
+
values,
|
|
69
|
+
logicalOperator: 'AND'
|
|
70
|
+
});
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
clearFilter(field) {
|
|
74
|
+
this.request.filtering.filters = this.request.filtering.filters.filter(f => f.field !== field);
|
|
75
|
+
return this;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Set search term and fields
|
|
79
|
+
*/
|
|
80
|
+
setSearch(searchTerm, searchFields) {
|
|
81
|
+
this.request.filtering.searchTerm = searchTerm;
|
|
82
|
+
this.request.filtering.searchFields = searchFields;
|
|
83
|
+
return this;
|
|
84
|
+
}
|
|
85
|
+
clearSearch() {
|
|
86
|
+
this.request.filtering.searchTerm = undefined;
|
|
87
|
+
this.request.filtering.searchFields = undefined;
|
|
88
|
+
return this;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Set simple sorting
|
|
92
|
+
*/
|
|
93
|
+
setSorting(sortBy, direction = SortDirection.Ascending) {
|
|
94
|
+
this.request.sorting.sortBy = sortBy;
|
|
95
|
+
this.request.sorting.sortDirection = direction;
|
|
96
|
+
return this;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Add multi-column sorting criteria
|
|
100
|
+
*/
|
|
101
|
+
addSortCriteria(field, direction, priority) {
|
|
102
|
+
if (!this.request.sorting.sortCriteria) {
|
|
103
|
+
this.request.sorting.sortCriteria = [];
|
|
104
|
+
}
|
|
105
|
+
this.request.sorting.sortCriteria.push({ field, direction, priority });
|
|
106
|
+
return this;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Clear all filters
|
|
110
|
+
*/
|
|
111
|
+
clearFilters() {
|
|
112
|
+
this.request.filtering.filters = [];
|
|
113
|
+
this.request.filtering.searchTerm = undefined;
|
|
114
|
+
this.request.filtering.searchFields = undefined;
|
|
115
|
+
return this;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Clear sorting
|
|
119
|
+
*/
|
|
120
|
+
clearSorting() {
|
|
121
|
+
this.request.sorting = { sortDirection: SortDirection.Ascending };
|
|
122
|
+
return this;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Build the final request
|
|
126
|
+
*/
|
|
127
|
+
build() {
|
|
128
|
+
return Object.assign({}, this.request);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
exports.PagedListRequestBuilder = PagedListRequestBuilder;
|
|
132
|
+
class PagingUtils {
|
|
133
|
+
static getPaginationText(paging) {
|
|
134
|
+
if (paging.totalItems === 0) {
|
|
135
|
+
return 'No items found';
|
|
136
|
+
}
|
|
137
|
+
return `Showing ${paging.firstItemIndex}-${paging.lastItemIndex} of ${paging.totalItems} items`;
|
|
138
|
+
}
|
|
139
|
+
static getPageNumbers(paging, maxVisiblePages = 5) {
|
|
140
|
+
const { currentPage, totalPages } = paging;
|
|
141
|
+
const half = Math.floor(maxVisiblePages / 2);
|
|
142
|
+
let start = Math.max(1, currentPage - half);
|
|
143
|
+
const end = Math.min(totalPages, start + maxVisiblePages - 1);
|
|
144
|
+
if (end - start + 1 < maxVisiblePages) {
|
|
145
|
+
start = Math.max(1, end - maxVisiblePages + 1);
|
|
146
|
+
}
|
|
147
|
+
const pages = [];
|
|
148
|
+
for (let i = start; i <= end; i++) {
|
|
149
|
+
pages.push(i);
|
|
150
|
+
}
|
|
151
|
+
return pages;
|
|
152
|
+
}
|
|
153
|
+
static getNextPageRequest(currentRequest, paging) {
|
|
154
|
+
if (!paging.hasNext)
|
|
155
|
+
return null;
|
|
156
|
+
return Object.assign(Object.assign({}, currentRequest), { paging: Object.assign(Object.assign({}, currentRequest.paging), { page: paging.currentPage + 1 }) });
|
|
157
|
+
}
|
|
158
|
+
static getPreviousPageRequest(currentRequest, paging) {
|
|
159
|
+
if (!paging.hasPrevious)
|
|
160
|
+
return null;
|
|
161
|
+
return Object.assign(Object.assign({}, currentRequest), { paging: Object.assign(Object.assign({}, currentRequest.paging), { page: paging.currentPage - 1 }) });
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
exports.PagingUtils = PagingUtils;
|
|
165
|
+
/**
|
|
166
|
+
* Task Item Specific
|
|
167
|
+
*/
|
|
168
|
+
var TaskItemAssignmentStatusFilter;
|
|
169
|
+
(function (TaskItemAssignmentStatusFilter) {
|
|
170
|
+
TaskItemAssignmentStatusFilter[TaskItemAssignmentStatusFilter["Any"] = 0] = "Any";
|
|
171
|
+
TaskItemAssignmentStatusFilter[TaskItemAssignmentStatusFilter["Mine"] = 1] = "Mine";
|
|
172
|
+
TaskItemAssignmentStatusFilter[TaskItemAssignmentStatusFilter["Private"] = 2] = "Private";
|
|
173
|
+
TaskItemAssignmentStatusFilter[TaskItemAssignmentStatusFilter["Team"] = 3] = "Team";
|
|
174
|
+
TaskItemAssignmentStatusFilter[TaskItemAssignmentStatusFilter["Unassigned"] = 4] = "Unassigned";
|
|
175
|
+
})(TaskItemAssignmentStatusFilter || (exports.TaskItemAssignmentStatusFilter = TaskItemAssignmentStatusFilter = {}));
|
|
176
|
+
var TaskItemCompletionStatusFilter;
|
|
177
|
+
(function (TaskItemCompletionStatusFilter) {
|
|
178
|
+
TaskItemCompletionStatusFilter[TaskItemCompletionStatusFilter["Any"] = 0] = "Any";
|
|
179
|
+
TaskItemCompletionStatusFilter[TaskItemCompletionStatusFilter["Completed"] = 1] = "Completed";
|
|
180
|
+
TaskItemCompletionStatusFilter[TaskItemCompletionStatusFilter["InProgress"] = 2] = "InProgress";
|
|
181
|
+
})(TaskItemCompletionStatusFilter || (exports.TaskItemCompletionStatusFilter = TaskItemCompletionStatusFilter = {}));
|
|
182
|
+
var TaskItemActiveStatusFilter;
|
|
183
|
+
(function (TaskItemActiveStatusFilter) {
|
|
184
|
+
TaskItemActiveStatusFilter[TaskItemActiveStatusFilter["Any"] = 0] = "Any";
|
|
185
|
+
TaskItemActiveStatusFilter[TaskItemActiveStatusFilter["Active"] = 1] = "Active";
|
|
186
|
+
TaskItemActiveStatusFilter[TaskItemActiveStatusFilter["Inactive"] = 2] = "Inactive";
|
|
187
|
+
})(TaskItemActiveStatusFilter || (exports.TaskItemActiveStatusFilter = TaskItemActiveStatusFilter = {}));
|
|
188
|
+
var TaskItemArchivedStatusFilter;
|
|
189
|
+
(function (TaskItemArchivedStatusFilter) {
|
|
190
|
+
TaskItemArchivedStatusFilter[TaskItemArchivedStatusFilter["Any"] = 0] = "Any";
|
|
191
|
+
TaskItemArchivedStatusFilter[TaskItemArchivedStatusFilter["Archived"] = 1] = "Archived";
|
|
192
|
+
TaskItemArchivedStatusFilter[TaskItemArchivedStatusFilter["Unarchived"] = 2] = "Unarchived";
|
|
193
|
+
})(TaskItemArchivedStatusFilter || (exports.TaskItemArchivedStatusFilter = TaskItemArchivedStatusFilter = {}));
|
|
194
|
+
var TaskItemDueStatusFilter;
|
|
195
|
+
(function (TaskItemDueStatusFilter) {
|
|
196
|
+
TaskItemDueStatusFilter[TaskItemDueStatusFilter["Any"] = 0] = "Any";
|
|
197
|
+
TaskItemDueStatusFilter[TaskItemDueStatusFilter["Due"] = 1] = "Due";
|
|
198
|
+
TaskItemDueStatusFilter[TaskItemDueStatusFilter["NotDue"] = 2] = "NotDue";
|
|
199
|
+
})(TaskItemDueStatusFilter || (exports.TaskItemDueStatusFilter = TaskItemDueStatusFilter = {}));
|
|
200
|
+
var TaskItemStartedStatusFilter;
|
|
201
|
+
(function (TaskItemStartedStatusFilter) {
|
|
202
|
+
TaskItemStartedStatusFilter[TaskItemStartedStatusFilter["Any"] = 0] = "Any";
|
|
203
|
+
TaskItemStartedStatusFilter[TaskItemStartedStatusFilter["Started"] = 1] = "Started";
|
|
204
|
+
TaskItemStartedStatusFilter[TaskItemStartedStatusFilter["NotStarted"] = 2] = "NotStarted";
|
|
205
|
+
})(TaskItemStartedStatusFilter || (exports.TaskItemStartedStatusFilter = TaskItemStartedStatusFilter = {}));
|
|
206
|
+
var TaskItemEndedStatusFilter;
|
|
207
|
+
(function (TaskItemEndedStatusFilter) {
|
|
208
|
+
TaskItemEndedStatusFilter[TaskItemEndedStatusFilter["Any"] = 0] = "Any";
|
|
209
|
+
TaskItemEndedStatusFilter[TaskItemEndedStatusFilter["Ended"] = 1] = "Ended";
|
|
210
|
+
TaskItemEndedStatusFilter[TaskItemEndedStatusFilter["NotEnded"] = 2] = "NotEnded";
|
|
211
|
+
})(TaskItemEndedStatusFilter || (exports.TaskItemEndedStatusFilter = TaskItemEndedStatusFilter = {}));
|
|
212
|
+
var TaskItemNeedReviewStatusFilter;
|
|
213
|
+
(function (TaskItemNeedReviewStatusFilter) {
|
|
214
|
+
TaskItemNeedReviewStatusFilter[TaskItemNeedReviewStatusFilter["Any"] = 0] = "Any";
|
|
215
|
+
TaskItemNeedReviewStatusFilter[TaskItemNeedReviewStatusFilter["NeedsReview"] = 1] = "NeedsReview";
|
|
216
|
+
})(TaskItemNeedReviewStatusFilter || (exports.TaskItemNeedReviewStatusFilter = TaskItemNeedReviewStatusFilter = {}));
|
|
217
|
+
var TaskItemAllowanceAccreditedStatusFilter;
|
|
218
|
+
(function (TaskItemAllowanceAccreditedStatusFilter) {
|
|
219
|
+
TaskItemAllowanceAccreditedStatusFilter[TaskItemAllowanceAccreditedStatusFilter["Any"] = 0] = "Any";
|
|
220
|
+
TaskItemAllowanceAccreditedStatusFilter[TaskItemAllowanceAccreditedStatusFilter["Accredited"] = 1] = "Accredited";
|
|
221
|
+
})(TaskItemAllowanceAccreditedStatusFilter || (exports.TaskItemAllowanceAccreditedStatusFilter = TaskItemAllowanceAccreditedStatusFilter = {}));
|
|
222
|
+
var TaskItemPriorityFilter;
|
|
223
|
+
(function (TaskItemPriorityFilter) {
|
|
224
|
+
TaskItemPriorityFilter[TaskItemPriorityFilter["Any"] = 0] = "Any";
|
|
225
|
+
TaskItemPriorityFilter[TaskItemPriorityFilter["None"] = 1] = "None";
|
|
226
|
+
TaskItemPriorityFilter[TaskItemPriorityFilter["Low"] = 2] = "Low";
|
|
227
|
+
TaskItemPriorityFilter[TaskItemPriorityFilter["Medium"] = 3] = "Medium";
|
|
228
|
+
TaskItemPriorityFilter[TaskItemPriorityFilter["High"] = 4] = "High";
|
|
229
|
+
TaskItemPriorityFilter[TaskItemPriorityFilter["Critical"] = 5] = "Critical";
|
|
230
|
+
})(TaskItemPriorityFilter || (exports.TaskItemPriorityFilter = TaskItemPriorityFilter = {}));
|
|
231
|
+
var TaskItemBonusStatusFilter;
|
|
232
|
+
(function (TaskItemBonusStatusFilter) {
|
|
233
|
+
TaskItemBonusStatusFilter[TaskItemBonusStatusFilter["Any"] = 0] = "Any";
|
|
234
|
+
TaskItemBonusStatusFilter[TaskItemBonusStatusFilter["Current"] = 1] = "Current";
|
|
235
|
+
TaskItemBonusStatusFilter[TaskItemBonusStatusFilter["NeedsReview"] = 2] = "NeedsReview";
|
|
236
|
+
TaskItemBonusStatusFilter[TaskItemBonusStatusFilter["Approved"] = 3] = "Approved";
|
|
237
|
+
TaskItemBonusStatusFilter[TaskItemBonusStatusFilter["Rejected"] = 4] = "Rejected";
|
|
238
|
+
TaskItemBonusStatusFilter[TaskItemBonusStatusFilter["Claimed"] = 5] = "Claimed";
|
|
239
|
+
TaskItemBonusStatusFilter[TaskItemBonusStatusFilter["NotClaimed"] = 6] = "NotClaimed";
|
|
240
|
+
TaskItemBonusStatusFilter[TaskItemBonusStatusFilter["WithBonus"] = 7] = "WithBonus";
|
|
241
|
+
TaskItemBonusStatusFilter[TaskItemBonusStatusFilter["WithoutBonus"] = 8] = "WithoutBonus";
|
|
242
|
+
})(TaskItemBonusStatusFilter || (exports.TaskItemBonusStatusFilter = TaskItemBonusStatusFilter = {}));
|
|
243
|
+
class PagedTaskItemListRequestBuilder {
|
|
244
|
+
constructor(request) {
|
|
245
|
+
this.teamAllowanceIntervalId = (request === null || request === void 0 ? void 0 : request.teamAllowanceIntervalId) || 0;
|
|
246
|
+
this.paging = (request === null || request === void 0 ? void 0 : request.paging) || { page: 1, pageSize: 10 };
|
|
247
|
+
this.taskItemFiltering = (request === null || request === void 0 ? void 0 : request.taskItemFiltering) ||
|
|
248
|
+
{ assignmentFilter: TaskItemAssignmentStatusFilter.Any,
|
|
249
|
+
completionFilter: TaskItemCompletionStatusFilter.Any,
|
|
250
|
+
activeFilter: TaskItemActiveStatusFilter.Any,
|
|
251
|
+
priorityFilter: TaskItemPriorityFilter.Any,
|
|
252
|
+
archivedFilter: TaskItemArchivedStatusFilter.Any,
|
|
253
|
+
dueFilter: TaskItemDueStatusFilter.Any,
|
|
254
|
+
startedFilter: TaskItemStartedStatusFilter.Any,
|
|
255
|
+
endedFilter: TaskItemEndedStatusFilter.Any,
|
|
256
|
+
allowanceNeedReviewFilter: TaskItemNeedReviewStatusFilter.Any,
|
|
257
|
+
allowanceAccreditedFilter: TaskItemAllowanceAccreditedStatusFilter.Any,
|
|
258
|
+
bonusStatusFilter: TaskItemBonusStatusFilter.Any,
|
|
259
|
+
groupId: undefined,
|
|
260
|
+
kindId: undefined,
|
|
261
|
+
categoryId: undefined,
|
|
262
|
+
assignedTo: undefined,
|
|
263
|
+
gradeId: undefined,
|
|
264
|
+
credits: undefined,
|
|
265
|
+
searchTerm: undefined
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
setTeamAllowanceIntervalId(teamAllowanceIntervalId) {
|
|
269
|
+
this.teamAllowanceIntervalId = teamAllowanceIntervalId;
|
|
270
|
+
return this;
|
|
271
|
+
}
|
|
272
|
+
setAssignmentFilter(filter) {
|
|
273
|
+
this.taskItemFiltering.assignmentFilter = filter;
|
|
274
|
+
return this;
|
|
275
|
+
}
|
|
276
|
+
setCompletionFilter(filter) {
|
|
277
|
+
this.taskItemFiltering.completionFilter = filter;
|
|
278
|
+
return this;
|
|
279
|
+
}
|
|
280
|
+
setActiveFilter(filter) {
|
|
281
|
+
this.taskItemFiltering.activeFilter = filter;
|
|
282
|
+
return this;
|
|
283
|
+
}
|
|
284
|
+
setPriorityFilter(filter) {
|
|
285
|
+
this.taskItemFiltering.priorityFilter = filter;
|
|
286
|
+
return this;
|
|
287
|
+
}
|
|
288
|
+
setArchivedFilter(filter) {
|
|
289
|
+
this.taskItemFiltering.archivedFilter = filter;
|
|
290
|
+
return this;
|
|
291
|
+
}
|
|
292
|
+
setDueFilter(filter) {
|
|
293
|
+
this.taskItemFiltering.dueFilter = filter;
|
|
294
|
+
return this;
|
|
295
|
+
}
|
|
296
|
+
setStartedFilter(filter) {
|
|
297
|
+
this.taskItemFiltering.startedFilter = filter;
|
|
298
|
+
return this;
|
|
299
|
+
}
|
|
300
|
+
setEndedFilter(filter) {
|
|
301
|
+
this.taskItemFiltering.endedFilter = filter;
|
|
302
|
+
return this;
|
|
303
|
+
}
|
|
304
|
+
setAllowanceNeedReviewFilter(filter) {
|
|
305
|
+
this.taskItemFiltering.allowanceNeedReviewFilter = filter;
|
|
306
|
+
return this;
|
|
307
|
+
}
|
|
308
|
+
setAllowanceAccreditedFilter(filter) {
|
|
309
|
+
this.taskItemFiltering.allowanceAccreditedFilter = filter;
|
|
310
|
+
return this;
|
|
311
|
+
}
|
|
312
|
+
setBonusStatusFilter(filter) {
|
|
313
|
+
this.taskItemFiltering.bonusStatusFilter = filter;
|
|
314
|
+
return this;
|
|
315
|
+
}
|
|
316
|
+
setTeamMemberFilter(userId) {
|
|
317
|
+
this.taskItemFiltering.assignedTo = userId;
|
|
318
|
+
return this;
|
|
319
|
+
}
|
|
320
|
+
setSearchTerm(searchTerm) {
|
|
321
|
+
this.taskItemFiltering.searchTerm = searchTerm;
|
|
322
|
+
return this;
|
|
323
|
+
}
|
|
324
|
+
clearTaskItemFilters() {
|
|
325
|
+
this.teamAllowanceIntervalId = 0;
|
|
326
|
+
this.taskItemFiltering.activeFilter = TaskItemActiveStatusFilter.Any;
|
|
327
|
+
this.taskItemFiltering.priorityFilter = TaskItemPriorityFilter.Any;
|
|
328
|
+
this.taskItemFiltering.archivedFilter = TaskItemArchivedStatusFilter.Any;
|
|
329
|
+
this.taskItemFiltering.completionFilter = TaskItemCompletionStatusFilter.Any;
|
|
330
|
+
this.taskItemFiltering.dueFilter = TaskItemDueStatusFilter.Any;
|
|
331
|
+
this.taskItemFiltering.startedFilter = TaskItemStartedStatusFilter.Any;
|
|
332
|
+
this.taskItemFiltering.endedFilter = TaskItemEndedStatusFilter.Any;
|
|
333
|
+
this.taskItemFiltering.allowanceNeedReviewFilter = TaskItemNeedReviewStatusFilter.Any;
|
|
334
|
+
this.taskItemFiltering.allowanceAccreditedFilter = TaskItemAllowanceAccreditedStatusFilter.Any;
|
|
335
|
+
this.taskItemFiltering.bonusStatusFilter = TaskItemBonusStatusFilter.Any;
|
|
336
|
+
this.taskItemFiltering.assignmentFilter = TaskItemAssignmentStatusFilter.Any;
|
|
337
|
+
this.taskItemFiltering.groupId = undefined;
|
|
338
|
+
this.taskItemFiltering.kindId = undefined;
|
|
339
|
+
this.taskItemFiltering.categoryId = undefined;
|
|
340
|
+
this.taskItemFiltering.gradeId = undefined;
|
|
341
|
+
this.taskItemFiltering.credits = undefined;
|
|
342
|
+
this.taskItemFiltering.assignedTo = undefined;
|
|
343
|
+
this.taskItemFiltering.searchTerm = undefined;
|
|
344
|
+
return this;
|
|
345
|
+
}
|
|
346
|
+
setGroupId(groupId) {
|
|
347
|
+
this.taskItemFiltering.groupId = groupId;
|
|
348
|
+
return this;
|
|
349
|
+
}
|
|
350
|
+
setKindId(kindId) {
|
|
351
|
+
this.taskItemFiltering.kindId = kindId;
|
|
352
|
+
return this;
|
|
353
|
+
}
|
|
354
|
+
setCategoryId(categoryId) {
|
|
355
|
+
this.taskItemFiltering.categoryId = categoryId;
|
|
356
|
+
return this;
|
|
357
|
+
}
|
|
358
|
+
setGradeId(gradeId) {
|
|
359
|
+
this.taskItemFiltering.gradeId = gradeId;
|
|
360
|
+
return this;
|
|
361
|
+
}
|
|
362
|
+
setCredits(credits) {
|
|
363
|
+
this.taskItemFiltering.credits = credits;
|
|
364
|
+
return this;
|
|
365
|
+
}
|
|
366
|
+
setPaging(page, pageSize = 10) {
|
|
367
|
+
this.paging = { page: Math.max(1, page), pageSize: Math.min(100, Math.max(1, pageSize)) };
|
|
368
|
+
return this;
|
|
369
|
+
}
|
|
370
|
+
build() {
|
|
371
|
+
return {
|
|
372
|
+
teamAllowanceIntervalId: this.teamAllowanceIntervalId,
|
|
373
|
+
taskItemFiltering: this.taskItemFiltering,
|
|
374
|
+
paging: this.paging
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
exports.PagedTaskItemListRequestBuilder = PagedTaskItemListRequestBuilder;
|
|
379
|
+
class TaskItemPagingUtils {
|
|
380
|
+
static getNextPageRequest(currentRequest, paging) {
|
|
381
|
+
if (!paging.hasNext)
|
|
382
|
+
return null;
|
|
383
|
+
return Object.assign(Object.assign({}, currentRequest), { paging: Object.assign(Object.assign({}, currentRequest.paging), { page: paging.currentPage + 1 }) });
|
|
384
|
+
}
|
|
385
|
+
static getPreviousPageRequest(currentRequest, paging) {
|
|
386
|
+
if (!paging.hasPrevious)
|
|
387
|
+
return null;
|
|
388
|
+
return Object.assign(Object.assign({}, currentRequest), { paging: Object.assign(Object.assign({}, currentRequest.paging), { page: paging.currentPage - 1 }) });
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
exports.TaskItemPagingUtils = TaskItemPagingUtils;
|
|
392
|
+
class PagedTaskCommentListRequestBuilder {
|
|
393
|
+
constructor(taskId) {
|
|
394
|
+
this.request = {
|
|
395
|
+
taskId,
|
|
396
|
+
searchTerm: undefined,
|
|
397
|
+
paging: {
|
|
398
|
+
page: 1,
|
|
399
|
+
pageSize: 10
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
setSearchTerm(searchTerm) {
|
|
404
|
+
this.request.searchTerm = searchTerm;
|
|
405
|
+
return this;
|
|
406
|
+
}
|
|
407
|
+
setPaging(page, pageSize = 10) {
|
|
408
|
+
this.request.paging = { page: Math.max(1, page), pageSize: Math.min(100, Math.max(1, pageSize)) };
|
|
409
|
+
return this;
|
|
410
|
+
}
|
|
411
|
+
build() {
|
|
412
|
+
return this.request;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
exports.PagedTaskCommentListRequestBuilder = PagedTaskCommentListRequestBuilder;
|
|
416
|
+
class TaskCommentPagingUtils {
|
|
417
|
+
static getNextPageRequest(currentRequest, paging) {
|
|
418
|
+
if (!paging.hasNext)
|
|
419
|
+
return null;
|
|
420
|
+
return Object.assign(Object.assign({}, currentRequest), { paging: Object.assign(Object.assign({}, currentRequest.paging), { page: paging.currentPage + 1 }) });
|
|
421
|
+
}
|
|
422
|
+
static getPreviousPageRequest(currentRequest, paging) {
|
|
423
|
+
if (!paging.hasPrevious)
|
|
424
|
+
return null;
|
|
425
|
+
return Object.assign(Object.assign({}, currentRequest), { paging: Object.assign(Object.assign({}, currentRequest.paging), { page: paging.currentPage - 1 }) });
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
exports.TaskCommentPagingUtils = TaskCommentPagingUtils;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2025 Larisa Rozin
|
|
4
|
+
* dodone-shared - Task Management, Allowance & Bonus Tracking Application Package
|
|
5
|
+
* All rights reserved.
|
|
6
|
+
*/
|
|
7
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// Cross-platform storage utility
|
|
18
|
+
let storage;
|
|
19
|
+
if (typeof window !== 'undefined' && window.localStorage) {
|
|
20
|
+
// Web
|
|
21
|
+
storage = {
|
|
22
|
+
getItem: (key) => __awaiter(void 0, void 0, void 0, function* () { return window.localStorage.getItem(key); }),
|
|
23
|
+
setItem: (key, value) => __awaiter(void 0, void 0, void 0, function* () { return window.localStorage.setItem(key, value); }),
|
|
24
|
+
removeItem: (key) => __awaiter(void 0, void 0, void 0, function* () { return window.localStorage.removeItem(key); }),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
// React Native
|
|
29
|
+
// Dynamically require to avoid breaking web build
|
|
30
|
+
const AsyncStorage = require('@react-native-async-storage/async-storage').default;
|
|
31
|
+
storage = {
|
|
32
|
+
getItem: AsyncStorage.getItem,
|
|
33
|
+
setItem: AsyncStorage.setItem,
|
|
34
|
+
removeItem: AsyncStorage.removeItem,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
exports.default = storage;
|
|
File without changes
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@larisarozin/dodone-shared",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Shared utilities and components for DoDone",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
+
"build": "tsc"
|
|
10
|
+
},
|
|
11
|
+
"keywords": ["dodone", "shared", "utilities"],
|
|
12
|
+
"author": "Larisa Rozin",
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/LarisaRozin/dodone-shared.git"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"react": "^19.1.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "^24.0.3",
|
|
26
|
+
"@types/react": "^19.1.8",
|
|
27
|
+
"typescript": "^5.8.3"
|
|
28
|
+
}
|
|
29
|
+
}
|