dce-reactkit 3.2.2-beta.5 → 3.2.2-beta.51
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/dist/cjs/index.js +741 -446
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/ButtonInputGroup.d.ts +1 -0
- package/dist/cjs/types/components/Drawer.d.ts +1 -0
- package/dist/cjs/types/components/IntelliTable.d.ts +1 -0
- package/dist/cjs/types/components/ItemPicker/NestableItemList.d.ts +1 -0
- package/dist/cjs/types/components/ItemPicker/index.d.ts +1 -0
- package/dist/cjs/types/types/LogAction.d.ts +16 -16
- package/dist/cjs/types/types/LogBuiltInMetadata.d.ts +1 -1
- package/dist/cjs/types/types/LogMetadataContextMap.d.ts +11 -0
- package/dist/cjs/types/types/LogMetadataTagMap.d.ts +8 -0
- package/dist/cjs/types/types/LogMetadataTargetMap.d.ts +8 -0
- package/dist/cjs/types/types/LogMetadataType.d.ts +6 -12
- package/dist/esm/index.js +742 -447
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/ButtonInputGroup.d.ts +1 -0
- package/dist/esm/types/components/Drawer.d.ts +1 -0
- package/dist/esm/types/components/IntelliTable.d.ts +1 -0
- package/dist/esm/types/components/ItemPicker/NestableItemList.d.ts +1 -0
- package/dist/esm/types/components/ItemPicker/index.d.ts +1 -0
- package/dist/esm/types/types/LogAction.d.ts +16 -16
- package/dist/esm/types/types/LogBuiltInMetadata.d.ts +1 -1
- package/dist/esm/types/types/LogMetadataContextMap.d.ts +11 -0
- package/dist/esm/types/types/LogMetadataTagMap.d.ts +8 -0
- package/dist/esm/types/types/LogMetadataTargetMap.d.ts +8 -0
- package/dist/esm/types/types/LogMetadataType.d.ts +6 -12
- package/dist/index.d.ts +51 -29
- package/package.json +1 -1
- package/src/components/ButtonInputGroup.tsx +5 -2
- package/src/components/CSVDownloadButton.tsx +2 -2
- package/src/components/Drawer.tsx +9 -1
- package/src/components/IntelliTable.tsx +181 -26
- package/src/components/ItemPicker/NestableItemList.tsx +32 -14
- package/src/components/ItemPicker/index.tsx +4 -0
- package/src/components/LogReviewer.tsx +635 -406
- package/src/components/SimpleDateChooser.tsx +28 -23
- package/src/helpers/genCSV.ts +22 -4
- package/src/helpers/genRouteHandler.ts +2 -2
- package/src/helpers/logClientEvent.tsx +1 -1
- package/src/server/initServer.ts +10 -3
- package/src/types/LogAction.ts +16 -16
- package/src/types/LogBuiltInMetadata.ts +5 -5
- package/src/types/LogMetadataContextMap.ts +15 -0
- package/src/types/LogMetadataTagMap.ts +9 -0
- package/src/types/LogMetadataTargetMap.ts +9 -0
- package/src/types/LogMetadataType.ts +8 -15
|
@@ -62,11 +62,7 @@ const SimpleDateChooser: React.FC<Props> = (props) => {
|
|
|
62
62
|
onChange,
|
|
63
63
|
chooseFromPast,
|
|
64
64
|
} = props;
|
|
65
|
-
|
|
66
|
-
(props.numMonthsToShow ?? 6),
|
|
67
|
-
1,
|
|
68
|
-
12,
|
|
69
|
-
);
|
|
65
|
+
const numMonthsToShow = (props.numMonthsToShow ?? 6);
|
|
70
66
|
|
|
71
67
|
/*------------------------------------------------------------------------*/
|
|
72
68
|
/* Render */
|
|
@@ -88,7 +84,7 @@ const SimpleDateChooser: React.FC<Props> = (props) => {
|
|
|
88
84
|
let startMonth = today.month;
|
|
89
85
|
if (chooseFromPast) {
|
|
90
86
|
startMonth -= Math.max(0, numMonthsToShow - 1);
|
|
91
|
-
|
|
87
|
+
while (startMonth <= 0) {
|
|
92
88
|
startMonth += 12;
|
|
93
89
|
startYear -= 1;
|
|
94
90
|
}
|
|
@@ -96,28 +92,37 @@ const SimpleDateChooser: React.FC<Props> = (props) => {
|
|
|
96
92
|
for (let i = 0; i < numMonthsToShow; i++) {
|
|
97
93
|
// Get month and year info
|
|
98
94
|
const unmoddedMonth = (startMonth + i);
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
);
|
|
95
|
+
let month = unmoddedMonth;
|
|
96
|
+
while (month > 12) {
|
|
97
|
+
month -= 12;
|
|
98
|
+
}
|
|
104
99
|
const monthName = getMonthName(month).full;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
? startYear + 1
|
|
108
|
-
: startYear
|
|
109
|
-
);
|
|
100
|
+
// Year is start year +1 for each 12 months
|
|
101
|
+
const year = (startYear + (Math.floor(unmoddedMonth / 12)));
|
|
110
102
|
|
|
111
103
|
// Figure out which days are allowed
|
|
112
104
|
const days = [];
|
|
113
105
|
const numDaysInMonth = (new Date(year, month, 0)).getDate();
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
106
|
+
if (chooseFromPast) {
|
|
107
|
+
// Past selection
|
|
108
|
+
const numDaysToAdd = (
|
|
109
|
+
(month === today.month)
|
|
110
|
+
? today.day // Current month, only add up to today
|
|
111
|
+
: numDaysInMonth // Past month, add all days
|
|
112
|
+
);
|
|
113
|
+
for (let day = 1; day <= numDaysToAdd; day++) {
|
|
114
|
+
days.push(day);
|
|
115
|
+
}
|
|
116
|
+
} else {
|
|
117
|
+
// Future selection: add all remaining days of the month
|
|
118
|
+
const firstDay = (
|
|
119
|
+
month === today.month
|
|
120
|
+
? today.day // Current month: start at current date
|
|
121
|
+
: 1 // Future month: start at beginning of month
|
|
122
|
+
);
|
|
123
|
+
for (let day = firstDay; day <= numDaysInMonth; day++) {
|
|
124
|
+
days.push(day);
|
|
125
|
+
}
|
|
121
126
|
}
|
|
122
127
|
|
|
123
128
|
choices.push({
|
package/src/helpers/genCSV.ts
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
* @returns escaped cell text
|
|
6
6
|
*/
|
|
7
7
|
const escapeCellText = (text: string): string => {
|
|
8
|
-
if (!text.includes(',')) {
|
|
8
|
+
if (!String(text).includes(',')) {
|
|
9
9
|
// No need to escape
|
|
10
|
-
return text;
|
|
10
|
+
return String(text);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
// Perform escape
|
|
14
|
-
return `"${text.replace(/"/g, '""')}`;
|
|
14
|
+
return `"${String(text).replace(/"/g, '""')}`;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -43,10 +43,28 @@ const genCSV = (
|
|
|
43
43
|
|
|
44
44
|
// Add each row
|
|
45
45
|
data.forEach((datum) => {
|
|
46
|
+
csv += '\n';
|
|
46
47
|
csv += (
|
|
47
48
|
columns
|
|
48
49
|
.map((column) => {
|
|
49
|
-
|
|
50
|
+
let contents: string;
|
|
51
|
+
const cell = datum[column.param];
|
|
52
|
+
if (
|
|
53
|
+
typeof cell === 'string'
|
|
54
|
+
|| typeof cell === 'number'
|
|
55
|
+
) {
|
|
56
|
+
contents = String(cell);
|
|
57
|
+
} else if (
|
|
58
|
+
typeof cell === 'undefined'
|
|
59
|
+
|| cell === null
|
|
60
|
+
) {
|
|
61
|
+
contents = '';
|
|
62
|
+
} else if (typeof cell === 'object') {
|
|
63
|
+
contents = JSON.stringify(cell);
|
|
64
|
+
} else {
|
|
65
|
+
contents = '';
|
|
66
|
+
}
|
|
67
|
+
return escapeCellText(contents);
|
|
50
68
|
})
|
|
51
69
|
.join(',')
|
|
52
70
|
);
|
|
@@ -500,7 +500,7 @@ const genRouteHandler = (
|
|
|
500
500
|
isAdmin: !!launchInfo.isAdmin,
|
|
501
501
|
isTTM: !!launchInfo.isTTM,
|
|
502
502
|
courseId: launchInfo.courseId,
|
|
503
|
-
courseName: launchInfo.
|
|
503
|
+
courseName: launchInfo.contextLabel,
|
|
504
504
|
browser,
|
|
505
505
|
device,
|
|
506
506
|
year,
|
|
@@ -539,7 +539,7 @@ const genRouteHandler = (
|
|
|
539
539
|
type: LogType.Action,
|
|
540
540
|
target: (
|
|
541
541
|
(opts as any).target
|
|
542
|
-
?? LogBuiltInMetadata.Target.
|
|
542
|
+
?? LogBuiltInMetadata.Target.NoTarget
|
|
543
543
|
),
|
|
544
544
|
action: (
|
|
545
545
|
(opts as any).action
|
package/src/server/initServer.ts
CHANGED
|
@@ -249,10 +249,14 @@ const initServer = (
|
|
|
249
249
|
},
|
|
250
250
|
handler: async ({ params }) => {
|
|
251
251
|
// Get user info
|
|
252
|
-
const {
|
|
252
|
+
const {
|
|
253
|
+
year,
|
|
254
|
+
month,
|
|
255
|
+
userId,
|
|
256
|
+
isAdmin,
|
|
257
|
+
} = params;
|
|
253
258
|
|
|
254
259
|
// Validate user
|
|
255
|
-
// isAdmin is already checked because path starts with '/admin'
|
|
256
260
|
const canReview = await canReviewLogs(userId, isAdmin);
|
|
257
261
|
if (!canReview) {
|
|
258
262
|
throw new ErrorWithCode(
|
|
@@ -262,7 +266,10 @@ const initServer = (
|
|
|
262
266
|
}
|
|
263
267
|
|
|
264
268
|
// Query for logs
|
|
265
|
-
const logs: Log[] = await _logCollection.find({
|
|
269
|
+
const logs: Log[] = await _logCollection.find({
|
|
270
|
+
year,
|
|
271
|
+
month,
|
|
272
|
+
});
|
|
266
273
|
|
|
267
274
|
// Return logs
|
|
268
275
|
return logs;
|
package/src/types/LogAction.ts
CHANGED
|
@@ -4,37 +4,37 @@
|
|
|
4
4
|
*/
|
|
5
5
|
enum LogAction {
|
|
6
6
|
// Target was opened by the user (it was not on screen, but now it is)
|
|
7
|
-
Open = '
|
|
7
|
+
Open = 'Open',
|
|
8
8
|
// Target was closed by the user (it was on screen, but now it is not)
|
|
9
|
-
Close = '
|
|
9
|
+
Close = 'Close',
|
|
10
10
|
// Target was cancelled by the user (it was on closed without saving)
|
|
11
|
-
Cancel = '
|
|
11
|
+
Cancel = 'Cancel',
|
|
12
12
|
// Target was expanded by the user (it always remains on screen, but size was changed)
|
|
13
|
-
Expand = '
|
|
13
|
+
Expand = 'Expand',
|
|
14
14
|
// Target was collapsed by the user (it always remains on screen, but size was changed)
|
|
15
|
-
Collapse = '
|
|
15
|
+
Collapse = 'Collapse',
|
|
16
16
|
// Target was viewed by the user (only for items that are not opened or closed, those must use Open/Close actions)
|
|
17
|
-
View = '
|
|
17
|
+
View = 'View',
|
|
18
18
|
// Target interrupted the user (popup, dialog, validation message, etc. appeared without user prompting)
|
|
19
|
-
Interrupt = '
|
|
19
|
+
Interrupt = 'Interrupt',
|
|
20
20
|
// Target was created by the user (it did not exist before)
|
|
21
|
-
Create = '
|
|
21
|
+
Create = 'Create',
|
|
22
22
|
// Target was edited by the user (it existed and was changed)
|
|
23
|
-
Edit = '
|
|
23
|
+
Edit = 'Edit',
|
|
24
24
|
// Target was deleted by the user (it existed and now it doesn't)
|
|
25
|
-
Delete = '
|
|
25
|
+
Delete = 'Delete',
|
|
26
26
|
// Target was added by the user (it already existed and was added to another place)
|
|
27
|
-
Add = '
|
|
27
|
+
Add = 'Add',
|
|
28
28
|
// Target was removed by the user (it was removed from something but still exists)
|
|
29
|
-
Remove = '
|
|
29
|
+
Remove = 'Remove',
|
|
30
30
|
// Target was activated by the user (click, check, tap, keypress, etc.)
|
|
31
|
-
Activate = '
|
|
31
|
+
Activate = 'Activate',
|
|
32
32
|
// Target was deactivated by the user (click away, uncheck, tap outside of, tab away, etc.)
|
|
33
|
-
Deactivate = '
|
|
33
|
+
Deactivate = 'Deactivate',
|
|
34
34
|
// User showed interest in a target (hover, peek, etc.)
|
|
35
|
-
Peek = '
|
|
35
|
+
Peek = 'Peek',
|
|
36
36
|
// Unknown action
|
|
37
|
-
Unknown = '
|
|
37
|
+
Unknown = 'Unknown',
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
export default LogAction;
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
const LogBuiltInMetadata = {
|
|
6
6
|
// Contexts
|
|
7
7
|
Context: {
|
|
8
|
-
Uncategorized: '
|
|
9
|
-
ServerRenderedErrorPage: '
|
|
10
|
-
ServerEndpointError: '
|
|
11
|
-
ClientFatalError: '
|
|
8
|
+
Uncategorized: 'Uncategorized',
|
|
9
|
+
ServerRenderedErrorPage: 'ServerRenderedErrorPage',
|
|
10
|
+
ServerEndpointError: 'ServerEndpointError',
|
|
11
|
+
ClientFatalError: 'ClientFatalError',
|
|
12
12
|
},
|
|
13
13
|
// Targets
|
|
14
14
|
Target: {
|
|
15
|
-
|
|
15
|
+
NoTarget: 'NoTarget',
|
|
16
16
|
},
|
|
17
17
|
};
|
|
18
18
|
|
|
@@ -1,23 +1,16 @@
|
|
|
1
|
+
// Import shared types
|
|
2
|
+
import LogMetadataContextMap from './LogMetadataContextMap';
|
|
3
|
+
import LogMetadataTagMap from './LogMetadataTagMap';
|
|
4
|
+
import LogMetadataTargetMap from './LogMetadataTargetMap';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* Type of a LogMetadata file
|
|
3
8
|
* @author Gabe Abrams
|
|
4
9
|
*/
|
|
5
10
|
type LogMetadataType = {
|
|
6
|
-
Context?:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
| {
|
|
10
|
-
_: string,
|
|
11
|
-
[k: string]: string
|
|
12
|
-
}
|
|
13
|
-
)
|
|
14
|
-
},
|
|
15
|
-
Tag?: {
|
|
16
|
-
[k: string]: string
|
|
17
|
-
},
|
|
18
|
-
Target?: {
|
|
19
|
-
[k: string]: string
|
|
20
|
-
},
|
|
11
|
+
Context?: LogMetadataContextMap,
|
|
12
|
+
Tag?: LogMetadataTagMap,
|
|
13
|
+
Target?: LogMetadataTargetMap,
|
|
21
14
|
};
|
|
22
15
|
|
|
23
16
|
export default LogMetadataType;
|