dce-reactkit 3.2.2-beta.3 → 3.2.2-beta.31
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 +361 -208
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/ButtonInputGroup.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/server/initServer.d.ts +1 -1
- package/dist/cjs/types/types/LogBuiltInMetadata.d.ts +1 -1
- package/dist/esm/index.js +361 -208
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/ButtonInputGroup.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/server/initServer.d.ts +1 -1
- package/dist/esm/types/types/LogBuiltInMetadata.d.ts +1 -1
- package/dist/index.d.ts +4 -2
- package/package.json +1 -1
- package/src/components/ButtonInputGroup.tsx +4 -1
- package/src/components/IntelliTable.tsx +5 -5
- package/src/components/ItemPicker/NestableItemList.tsx +32 -14
- package/src/components/ItemPicker/index.tsx +4 -0
- package/src/components/LogReviewer.tsx +314 -143
- package/src/components/SimpleDateChooser.tsx +20 -7
- package/src/constants/LOG_REVIEW_STATUS_ROUTE.ts +1 -1
- package/src/helpers/genRouteHandler.ts +1 -1
- package/src/helpers/logClientEvent.tsx +6 -1
- package/src/server/initServer.ts +93 -73
- package/src/types/LogBuiltInMetadata.ts +5 -5
|
@@ -25,7 +25,7 @@ export declare const internalGetLogCollection: () => any;
|
|
|
25
25
|
* @param opts.getLaunchInfo CACCL LTI's get launch info function
|
|
26
26
|
* @param [opts.logCollection] mongo collection from dce-mango to use for
|
|
27
27
|
* storing logs. If none is included, logs are written to the console
|
|
28
|
-
* @param [opts.logReviewAdmins=all
|
|
28
|
+
* @param [opts.logReviewAdmins=all] info on which admins can review
|
|
29
29
|
* logs from the client. If not included, all Canvas admins are allowed to
|
|
30
30
|
* review logs. If null, no Canvas admins are allowed to review logs.
|
|
31
31
|
* If an array of Canvas userIds (numbers), only Canvas admins with those
|
package/dist/index.d.ts
CHANGED
|
@@ -242,6 +242,7 @@ declare type Props$a = {
|
|
|
242
242
|
label: string;
|
|
243
243
|
minLabelWidth?: string;
|
|
244
244
|
children: React.ReactNode;
|
|
245
|
+
className?: string;
|
|
245
246
|
};
|
|
246
247
|
declare const ButtonInputGroup: React.FC<Props$a>;
|
|
247
248
|
|
|
@@ -363,6 +364,7 @@ declare type Props$3 = {
|
|
|
363
364
|
* values updated
|
|
364
365
|
*/
|
|
365
366
|
onChanged: (updatedItems: PickableItem[]) => void;
|
|
367
|
+
noBottomMargin?: boolean;
|
|
366
368
|
};
|
|
367
369
|
declare const ItemPicker: React.FC<Props$3>;
|
|
368
370
|
|
|
@@ -822,7 +824,7 @@ declare type GetLaunchInfoFunction = (req: any) => {
|
|
|
822
824
|
* @param opts.getLaunchInfo CACCL LTI's get launch info function
|
|
823
825
|
* @param [opts.logCollection] mongo collection from dce-mango to use for
|
|
824
826
|
* storing logs. If none is included, logs are written to the console
|
|
825
|
-
* @param [opts.logReviewAdmins=all
|
|
827
|
+
* @param [opts.logReviewAdmins=all] info on which admins can review
|
|
826
828
|
* logs from the client. If not included, all Canvas admins are allowed to
|
|
827
829
|
* review logs. If null, no Canvas admins are allowed to review logs.
|
|
828
830
|
* If an array of Canvas userIds (numbers), only Canvas admins with those
|
|
@@ -1026,7 +1028,7 @@ declare const LogBuiltInMetadata: {
|
|
|
1026
1028
|
ClientFatalError: string;
|
|
1027
1029
|
};
|
|
1028
1030
|
Target: {
|
|
1029
|
-
|
|
1031
|
+
NoTarget: string;
|
|
1030
1032
|
};
|
|
1031
1033
|
};
|
|
1032
1034
|
|
package/package.json
CHANGED
|
@@ -18,6 +18,8 @@ type Props = {
|
|
|
18
18
|
minLabelWidth?: string,
|
|
19
19
|
// Buttons
|
|
20
20
|
children: React.ReactNode,
|
|
21
|
+
// Additional class names to add to the outer container
|
|
22
|
+
className?: string,
|
|
21
23
|
};
|
|
22
24
|
|
|
23
25
|
/*------------------------------------------------------------------------*/
|
|
@@ -36,6 +38,7 @@ const ButtonInputGroup: React.FC<Props> = (props) => {
|
|
|
36
38
|
label,
|
|
37
39
|
minLabelWidth,
|
|
38
40
|
children,
|
|
41
|
+
className,
|
|
39
42
|
} = props;
|
|
40
43
|
|
|
41
44
|
/*------------------------------------------------------------------------*/
|
|
@@ -47,7 +50,7 @@ const ButtonInputGroup: React.FC<Props> = (props) => {
|
|
|
47
50
|
/*----------------------------------------*/
|
|
48
51
|
|
|
49
52
|
return (
|
|
50
|
-
<div className=
|
|
53
|
+
<div className={`input-group ${className ?? ''}`}>
|
|
51
54
|
<div className="input-group-prepend d-flex w-100">
|
|
52
55
|
{/* Label */}
|
|
53
56
|
<span
|
|
@@ -302,14 +302,14 @@ const IntelliTable: React.FC<Props> = (props) => {
|
|
|
302
302
|
>
|
|
303
303
|
<div className="d-flex align-items-center justify-content-center flex-row h-100">
|
|
304
304
|
{/* Title */}
|
|
305
|
-
<
|
|
305
|
+
<span className="text-nowrap">
|
|
306
306
|
{column.title}
|
|
307
|
-
</
|
|
307
|
+
</span>
|
|
308
308
|
{/* Buttons */}
|
|
309
309
|
<div>
|
|
310
310
|
<button
|
|
311
311
|
type="button"
|
|
312
|
-
className="btn btn-light"
|
|
312
|
+
className="btn btn-light btn-sm ms-1"
|
|
313
313
|
aria-label={sortButtonAriaLabel}
|
|
314
314
|
onClick={() => {
|
|
315
315
|
dispatch({
|
|
@@ -469,7 +469,7 @@ const IntelliTable: React.FC<Props> = (props) => {
|
|
|
469
469
|
title = String(fullValue);
|
|
470
470
|
} else if (column.type === ParamType.String) {
|
|
471
471
|
fullValue = String(value).trim();
|
|
472
|
-
const noValue = (
|
|
472
|
+
const noValue = (String(fullValue).trim().length === 0);
|
|
473
473
|
visibleValue = (
|
|
474
474
|
noValue
|
|
475
475
|
? (
|
|
@@ -567,7 +567,7 @@ const IntelliTable: React.FC<Props> = (props) => {
|
|
|
567
567
|
{/* Show/Hide Columns */}
|
|
568
568
|
<button
|
|
569
569
|
type="button"
|
|
570
|
-
className="btn btn-secondary"
|
|
570
|
+
className="btn btn-secondary ms-2"
|
|
571
571
|
aria-label={`show panel for customizing which columns show in table ${title}`}
|
|
572
572
|
id={`IntelliTable-${id}-show-column-customization-modal`}
|
|
573
573
|
onClick={() => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Reusable nested item picker
|
|
3
3
|
* @author Yuen Ler Chow
|
|
4
|
+
* @author Gabe Abrams
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
7
|
// Import React
|
|
@@ -43,36 +44,46 @@ type Props = {
|
|
|
43
44
|
/* -------- State Definition -------- */
|
|
44
45
|
|
|
45
46
|
type State = {
|
|
46
|
-
//
|
|
47
|
-
|
|
47
|
+
// Map of children that are expanded
|
|
48
|
+
childExpanded: {
|
|
49
|
+
[k: string]: boolean
|
|
50
|
+
},
|
|
48
51
|
};
|
|
49
52
|
|
|
50
53
|
/* ------------- Actions ------------ */
|
|
51
54
|
|
|
52
55
|
// Types of actions
|
|
53
56
|
enum ActionType {
|
|
54
|
-
// Toggle whether
|
|
55
|
-
|
|
57
|
+
// Toggle whether a child are being shown
|
|
58
|
+
ToggleChild = 'toggle-child',
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
// Action definitions
|
|
59
62
|
type Action = (
|
|
60
63
|
| {
|
|
61
64
|
// Action type
|
|
62
|
-
type: ActionType.
|
|
65
|
+
type: ActionType.ToggleChild,
|
|
66
|
+
// Id of the child to show
|
|
67
|
+
id: (string | number),
|
|
63
68
|
}
|
|
64
69
|
);
|
|
65
70
|
|
|
66
71
|
/**
|
|
67
72
|
* Reducer that executes actions
|
|
68
|
-
* @author
|
|
73
|
+
* @author Gabe Abrams
|
|
69
74
|
* @param state current state
|
|
70
75
|
* @param action action to execute
|
|
71
76
|
*/
|
|
72
77
|
const reducer = (state: State, action: Action): State => {
|
|
73
78
|
switch (action.type) {
|
|
74
|
-
case ActionType.
|
|
75
|
-
return {
|
|
79
|
+
case ActionType.ToggleChild: {
|
|
80
|
+
return {
|
|
81
|
+
...state,
|
|
82
|
+
childExpanded: {
|
|
83
|
+
...state.childExpanded,
|
|
84
|
+
[String(action.id)]: !state.childExpanded[String(action.id)],
|
|
85
|
+
},
|
|
86
|
+
};
|
|
76
87
|
}
|
|
77
88
|
default: {
|
|
78
89
|
return state;
|
|
@@ -99,9 +110,15 @@ const NestableItemList: React.FC<Props> = (props) => {
|
|
|
99
110
|
|
|
100
111
|
/* -------------- State ------------- */
|
|
101
112
|
|
|
113
|
+
// Create initial map of child expanded booleans
|
|
114
|
+
const initChildExpanded: { [k: string]: boolean } = {};
|
|
115
|
+
items.forEach((item) => {
|
|
116
|
+
initChildExpanded[String(item.id)] = false;
|
|
117
|
+
});
|
|
118
|
+
|
|
102
119
|
// Initial state
|
|
103
120
|
const initialState: State = {
|
|
104
|
-
|
|
121
|
+
childExpanded: initChildExpanded,
|
|
105
122
|
};
|
|
106
123
|
|
|
107
124
|
// Initialize state
|
|
@@ -109,7 +126,7 @@ const NestableItemList: React.FC<Props> = (props) => {
|
|
|
109
126
|
|
|
110
127
|
// Destructure common state
|
|
111
128
|
const {
|
|
112
|
-
|
|
129
|
+
childExpanded,
|
|
113
130
|
} = state;
|
|
114
131
|
|
|
115
132
|
/*------------------------------------------------------------------------*/
|
|
@@ -231,13 +248,14 @@ const NestableItemList: React.FC<Props> = (props) => {
|
|
|
231
248
|
type="button"
|
|
232
249
|
onClick={() => {
|
|
233
250
|
dispatch({
|
|
234
|
-
type: ActionType.
|
|
251
|
+
type: ActionType.ToggleChild,
|
|
252
|
+
id: item.id,
|
|
235
253
|
});
|
|
236
254
|
}}
|
|
237
|
-
aria-label={`${
|
|
255
|
+
aria-label={`${childExpanded[item.id] ? 'Hide' : 'Show'} items in ${item.name}`}
|
|
238
256
|
>
|
|
239
257
|
<FontAwesomeIcon
|
|
240
|
-
icon={
|
|
258
|
+
icon={childExpanded[item.id] ? faChevronDown : faChevronRight}
|
|
241
259
|
/>
|
|
242
260
|
</button>
|
|
243
261
|
)}
|
|
@@ -257,7 +275,7 @@ const NestableItemList: React.FC<Props> = (props) => {
|
|
|
257
275
|
/>
|
|
258
276
|
|
|
259
277
|
{/* Children */}
|
|
260
|
-
{item.isGroup &&
|
|
278
|
+
{(item.isGroup && childExpanded[item.id]) && (
|
|
261
279
|
<div
|
|
262
280
|
className="NestableItemList-children-container"
|
|
263
281
|
style={{
|
|
@@ -31,6 +31,8 @@ type Props = {
|
|
|
31
31
|
* values updated
|
|
32
32
|
*/
|
|
33
33
|
onChanged: (updatedItems: PickableItem[]) => void,
|
|
34
|
+
// If true, don't add margin to bottom of item picker
|
|
35
|
+
noBottomMargin?: boolean,
|
|
34
36
|
};
|
|
35
37
|
|
|
36
38
|
/*------------------------------------------------------------------------*/
|
|
@@ -49,6 +51,7 @@ const ItemPicker: React.FC<Props> = (props) => {
|
|
|
49
51
|
title,
|
|
50
52
|
items,
|
|
51
53
|
onChanged,
|
|
54
|
+
noBottomMargin,
|
|
52
55
|
} = props;
|
|
53
56
|
|
|
54
57
|
/*------------------------------------------------------------------------*/
|
|
@@ -66,6 +69,7 @@ const ItemPicker: React.FC<Props> = (props) => {
|
|
|
66
69
|
return (
|
|
67
70
|
<TabBox
|
|
68
71
|
title={title}
|
|
72
|
+
noBottomMargin={noBottomMargin}
|
|
69
73
|
>
|
|
70
74
|
<div style={{ overflowX: 'auto' }}>
|
|
71
75
|
<NestableItemList
|