dce-reactkit 3.4.1 → 3.5.2
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/.vscode/settings.json +1 -0
- package/dist/cjs/index.js +36477 -247
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/client/initClient.d.ts +1 -1
- package/dist/cjs/types/components/AppWrapper.d.ts +6 -6
- package/dist/cjs/types/components/ButtonInputGroup.d.ts +1 -1
- package/dist/cjs/types/components/CSVDownloadButton.d.ts +1 -1
- package/dist/cjs/types/components/CheckboxButton.d.ts +1 -1
- package/dist/cjs/types/components/CopiableBox.d.ts +1 -1
- package/dist/cjs/types/components/DBEntryManagerPanel/AddOrEditDBEntry/CreatableMultiselect.d.ts +16 -0
- package/dist/cjs/types/components/DBEntryManagerPanel/AddOrEditDBEntry/index.d.ts +35 -0
- package/dist/cjs/types/components/DBEntryManagerPanel/helpers/generateEndpointPath.d.ts +9 -0
- package/dist/cjs/types/components/DBEntryManagerPanel/index.d.ts +36 -0
- package/dist/cjs/types/components/DBEntryManagerPanel/types/DBEntry.d.ts +8 -0
- package/dist/cjs/types/components/DBEntryManagerPanel/types/DBEntryField.d.ts +49 -0
- package/dist/cjs/types/components/DBEntryManagerPanel/types/DBEntryFieldType.d.ts +12 -0
- package/dist/cjs/types/components/Drawer.d.ts +1 -1
- package/dist/cjs/types/components/ErrorBox.d.ts +1 -1
- package/dist/cjs/types/components/IntelliTable.d.ts +1 -1
- package/dist/cjs/types/components/ItemPicker/NestableItemList.d.ts +1 -1
- package/dist/cjs/types/components/ItemPicker/index.d.ts +1 -1
- package/dist/cjs/types/components/ItemPicker/types/PickableItem.d.ts +1 -1
- package/dist/cjs/types/components/LogReviewer.d.ts +1 -1
- package/dist/cjs/types/components/Modal.d.ts +1 -1
- package/dist/cjs/types/components/PopFailureMark.d.ts +1 -1
- package/dist/cjs/types/components/PopPendingMark.d.ts +1 -1
- package/dist/cjs/types/components/PopSuccessMark.d.ts +1 -1
- package/dist/cjs/types/components/RadioButton.d.ts +1 -1
- package/dist/cjs/types/components/SimpleDateChooser.d.ts +1 -1
- package/dist/cjs/types/components/TabBox.d.ts +1 -1
- package/dist/cjs/types/helpers/addDBEditorEndpoints.d.ts +41 -0
- package/dist/cjs/types/helpers/compareArraysByProp.d.ts +3 -2
- package/dist/cjs/types/helpers/genRouteHandler.d.ts +7 -7
- package/dist/cjs/types/helpers/getHumanReadableDate.d.ts +1 -1
- package/dist/cjs/types/helpers/getLocalTimeInfo.d.ts +1 -1
- package/dist/cjs/types/helpers/getTimeInfoInET.d.ts +1 -1
- package/dist/cjs/types/helpers/parallelLimit.d.ts +1 -1
- package/dist/cjs/types/helpers/validators/shared/types/ValidationResult.d.ts +1 -1
- package/dist/cjs/types/index.d.ts +7 -2
- package/dist/cjs/types/server/initServer.d.ts +1 -1
- package/dist/cjs/types/types/IntelliTableColumn.d.ts +1 -1
- package/dist/cjs/types/types/Log/LogMainInfo.d.ts +1 -1
- package/dist/cjs/types/types/Log/LogSourceSpecificInfo.d.ts +1 -1
- package/dist/cjs/types/types/Log/LogTypeSpecificInfo.d.ts +1 -1
- package/dist/cjs/types/types/Log/index.d.ts +1 -1
- package/dist/cjs/types/types/LogFunction.d.ts +1 -1
- package/dist/cjs/types/types/LogMetadataContextMap.d.ts +1 -1
- package/dist/cjs/types/types/LogMetadataTagMap.d.ts +1 -1
- package/dist/cjs/types/types/LogMetadataTargetMap.d.ts +1 -1
- package/dist/cjs/types/types/LogMetadataType.d.ts +1 -1
- package/dist/esm/index.js +36692 -483
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/client/initClient.d.ts +1 -1
- package/dist/esm/types/components/AppWrapper.d.ts +6 -6
- package/dist/esm/types/components/ButtonInputGroup.d.ts +1 -1
- package/dist/esm/types/components/CSVDownloadButton.d.ts +1 -1
- package/dist/esm/types/components/CheckboxButton.d.ts +1 -1
- package/dist/esm/types/components/CopiableBox.d.ts +1 -1
- package/dist/esm/types/components/DBEntryManagerPanel/AddOrEditDBEntry/CreatableMultiselect.d.ts +16 -0
- package/dist/esm/types/components/DBEntryManagerPanel/AddOrEditDBEntry/index.d.ts +35 -0
- package/dist/esm/types/components/DBEntryManagerPanel/helpers/generateEndpointPath.d.ts +9 -0
- package/dist/esm/types/components/DBEntryManagerPanel/index.d.ts +36 -0
- package/dist/esm/types/components/DBEntryManagerPanel/types/DBEntry.d.ts +8 -0
- package/dist/esm/types/components/DBEntryManagerPanel/types/DBEntryField.d.ts +49 -0
- package/dist/esm/types/components/DBEntryManagerPanel/types/DBEntryFieldType.d.ts +12 -0
- package/dist/esm/types/components/Drawer.d.ts +1 -1
- package/dist/esm/types/components/ErrorBox.d.ts +1 -1
- package/dist/esm/types/components/IntelliTable.d.ts +1 -1
- package/dist/esm/types/components/ItemPicker/NestableItemList.d.ts +1 -1
- package/dist/esm/types/components/ItemPicker/index.d.ts +1 -1
- package/dist/esm/types/components/ItemPicker/types/PickableItem.d.ts +1 -1
- package/dist/esm/types/components/LogReviewer.d.ts +1 -1
- package/dist/esm/types/components/Modal.d.ts +1 -1
- package/dist/esm/types/components/PopFailureMark.d.ts +1 -1
- package/dist/esm/types/components/PopPendingMark.d.ts +1 -1
- package/dist/esm/types/components/PopSuccessMark.d.ts +1 -1
- package/dist/esm/types/components/RadioButton.d.ts +1 -1
- package/dist/esm/types/components/SimpleDateChooser.d.ts +1 -1
- package/dist/esm/types/components/TabBox.d.ts +1 -1
- package/dist/esm/types/helpers/addDBEditorEndpoints.d.ts +41 -0
- package/dist/esm/types/helpers/compareArraysByProp.d.ts +3 -2
- package/dist/esm/types/helpers/genRouteHandler.d.ts +7 -7
- package/dist/esm/types/helpers/getHumanReadableDate.d.ts +1 -1
- package/dist/esm/types/helpers/getLocalTimeInfo.d.ts +1 -1
- package/dist/esm/types/helpers/getTimeInfoInET.d.ts +1 -1
- package/dist/esm/types/helpers/parallelLimit.d.ts +1 -1
- package/dist/esm/types/helpers/validators/shared/types/ValidationResult.d.ts +1 -1
- package/dist/esm/types/index.d.ts +7 -2
- package/dist/esm/types/server/initServer.d.ts +1 -1
- package/dist/esm/types/types/IntelliTableColumn.d.ts +1 -1
- package/dist/esm/types/types/Log/LogMainInfo.d.ts +1 -1
- package/dist/esm/types/types/Log/LogSourceSpecificInfo.d.ts +1 -1
- package/dist/esm/types/types/Log/LogTypeSpecificInfo.d.ts +1 -1
- package/dist/esm/types/types/Log/index.d.ts +1 -1
- package/dist/esm/types/types/LogFunction.d.ts +1 -1
- package/dist/esm/types/types/LogMetadataContextMap.d.ts +1 -1
- package/dist/esm/types/types/LogMetadataTagMap.d.ts +1 -1
- package/dist/esm/types/types/LogMetadataTargetMap.d.ts +1 -1
- package/dist/esm/types/types/LogMetadataType.d.ts +1 -1
- package/dist/index.d.ts +229 -85
- package/package.json +7 -2
- package/src/client/initClient.tsx +23 -31
- package/src/components/AppWrapper.tsx +1 -1
- package/src/components/DBEntryManagerPanel/AddOrEditDBEntry/CreatableMultiselect.tsx +303 -0
- package/src/components/DBEntryManagerPanel/AddOrEditDBEntry/index.tsx +737 -0
- package/src/components/DBEntryManagerPanel/helpers/generateEndpointPath.ts +16 -0
- package/src/components/DBEntryManagerPanel/index.tsx +522 -0
- package/src/components/DBEntryManagerPanel/types/DBEntry.ts +7 -0
- package/src/components/DBEntryManagerPanel/types/DBEntryField.ts +94 -0
- package/src/components/DBEntryManagerPanel/types/DBEntryFieldType.ts +18 -0
- package/src/helpers/addDBEditorEndpoints.ts +128 -0
- package/src/helpers/compareArraysByProp.ts +41 -19
- package/src/index.ts +11 -1
|
@@ -5,7 +5,7 @@ import LogMetadataTargetMap from './LogMetadataTargetMap';
|
|
|
5
5
|
* Type of a LogMetadata file
|
|
6
6
|
* @author Gabe Abrams
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
type LogMetadataType = {
|
|
9
9
|
Context?: LogMetadataContextMap;
|
|
10
10
|
Tag?: LogMetadataTagMap;
|
|
11
11
|
Target?: LogMetadataTargetMap;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import express from 'express';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Bootstrap variants
|
|
@@ -22,7 +23,7 @@ declare enum Variant {
|
|
|
22
23
|
* @author Gabe Abrams
|
|
23
24
|
*/
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
type Props$h = {
|
|
26
27
|
children: React.ReactNode;
|
|
27
28
|
dark?: boolean;
|
|
28
29
|
};
|
|
@@ -49,11 +50,11 @@ declare const alert: (title: string, text: string) => Promise<undefined>;
|
|
|
49
50
|
* @returns true if the user confirmed
|
|
50
51
|
*/
|
|
51
52
|
declare const confirm: (title: string, text: string, opts?: {
|
|
52
|
-
confirmButtonText?: string
|
|
53
|
-
confirmButtonVariant?: Variant
|
|
54
|
-
cancelButtonText?: string
|
|
55
|
-
cancelButtonVariant?: Variant
|
|
56
|
-
}
|
|
53
|
+
confirmButtonText?: string;
|
|
54
|
+
confirmButtonVariant?: Variant;
|
|
55
|
+
cancelButtonText?: string;
|
|
56
|
+
cancelButtonVariant?: Variant;
|
|
57
|
+
}) => Promise<boolean>;
|
|
57
58
|
/**
|
|
58
59
|
* Show a fatal error message
|
|
59
60
|
* @author Gabe Abrams
|
|
@@ -61,7 +62,7 @@ declare const confirm: (title: string, text: string, opts?: {
|
|
|
61
62
|
* @param [errorTitle] title of the error box
|
|
62
63
|
*/
|
|
63
64
|
declare const showFatalError: (error: any, errorTitle?: string) => undefined;
|
|
64
|
-
declare const AppWrapper: React.FC<Props$
|
|
65
|
+
declare const AppWrapper: React.FC<Props$h>;
|
|
65
66
|
|
|
66
67
|
/**
|
|
67
68
|
* Loading spinner/indicator
|
|
@@ -74,12 +75,12 @@ declare const LoadingSpinner: () => JSX.Element;
|
|
|
74
75
|
* @author Gabe Abrams
|
|
75
76
|
*/
|
|
76
77
|
|
|
77
|
-
|
|
78
|
+
type Props$g = {
|
|
78
79
|
error: any;
|
|
79
80
|
title?: string;
|
|
80
81
|
onClose?: () => void;
|
|
81
82
|
};
|
|
82
|
-
declare const ErrorBox: React.FC<Props$
|
|
83
|
+
declare const ErrorBox: React.FC<Props$g>;
|
|
83
84
|
|
|
84
85
|
/**
|
|
85
86
|
* Types of buttons in the modal
|
|
@@ -130,7 +131,7 @@ declare enum ModalType {
|
|
|
130
131
|
* @author Gabe Abrams
|
|
131
132
|
*/
|
|
132
133
|
|
|
133
|
-
|
|
134
|
+
type Props$f = {
|
|
134
135
|
type?: ModalType;
|
|
135
136
|
size?: ModalSize;
|
|
136
137
|
title?: React.ReactNode;
|
|
@@ -159,27 +160,27 @@ declare type Props$e = {
|
|
|
159
160
|
confirmVariant?: Variant;
|
|
160
161
|
onTopOfOtherModals?: boolean;
|
|
161
162
|
};
|
|
162
|
-
declare const Modal: React.FC<Props$
|
|
163
|
+
declare const Modal: React.FC<Props$f>;
|
|
163
164
|
|
|
164
165
|
/**
|
|
165
166
|
* A box with a tab on the top that holds buttons and other content
|
|
166
167
|
* @author Gabe Abrams
|
|
167
168
|
*/
|
|
168
169
|
|
|
169
|
-
|
|
170
|
+
type Props$e = {
|
|
170
171
|
title: React.ReactNode;
|
|
171
172
|
children: React.ReactNode;
|
|
172
173
|
noBottomMargin?: boolean;
|
|
173
174
|
noBottomPadding?: boolean;
|
|
174
175
|
};
|
|
175
|
-
declare const TabBox: React.FC<Props$
|
|
176
|
+
declare const TabBox: React.FC<Props$e>;
|
|
176
177
|
|
|
177
178
|
/**
|
|
178
179
|
* A radio selection button
|
|
179
180
|
* @author Gabe Abrams
|
|
180
181
|
*/
|
|
181
182
|
|
|
182
|
-
|
|
183
|
+
type Props$d = {
|
|
183
184
|
text: string;
|
|
184
185
|
onSelected: () => void;
|
|
185
186
|
ariaLabel: string;
|
|
@@ -191,14 +192,14 @@ declare type Props$c = {
|
|
|
191
192
|
unselectedVariant?: Variant;
|
|
192
193
|
small?: boolean;
|
|
193
194
|
};
|
|
194
|
-
declare const RadioButton: React.FC<Props$
|
|
195
|
+
declare const RadioButton: React.FC<Props$d>;
|
|
195
196
|
|
|
196
197
|
/**
|
|
197
198
|
* A checkbox button
|
|
198
199
|
* @author Gabe Abrams
|
|
199
200
|
*/
|
|
200
201
|
|
|
201
|
-
|
|
202
|
+
type Props$c = {
|
|
202
203
|
text: string;
|
|
203
204
|
onChanged: (checked: boolean) => void;
|
|
204
205
|
ariaLabel: string;
|
|
@@ -212,28 +213,28 @@ declare type Props$b = {
|
|
|
212
213
|
small?: boolean;
|
|
213
214
|
dashed?: boolean;
|
|
214
215
|
};
|
|
215
|
-
declare const CheckboxButton: React.FC<Props$
|
|
216
|
+
declare const CheckboxButton: React.FC<Props$c>;
|
|
216
217
|
|
|
217
218
|
/**
|
|
218
219
|
* Input group with a title and space for buttons
|
|
219
220
|
* @author Gabe Abrams
|
|
220
221
|
*/
|
|
221
222
|
|
|
222
|
-
|
|
223
|
+
type Props$b = {
|
|
223
224
|
label: string;
|
|
224
225
|
minLabelWidth?: string;
|
|
225
226
|
children: React.ReactNode;
|
|
226
227
|
className?: string;
|
|
227
228
|
wrapButtonsAndAddGaps?: boolean;
|
|
228
229
|
};
|
|
229
|
-
declare const ButtonInputGroup: React.FC<Props$
|
|
230
|
+
declare const ButtonInputGroup: React.FC<Props$b>;
|
|
230
231
|
|
|
231
232
|
/**
|
|
232
233
|
* A very simple, lightweight date chooser
|
|
233
234
|
* @author Gabe Abrams
|
|
234
235
|
*/
|
|
235
236
|
|
|
236
|
-
|
|
237
|
+
type Props$a = {
|
|
237
238
|
ariaLabel: string;
|
|
238
239
|
name: string;
|
|
239
240
|
month: number;
|
|
@@ -249,61 +250,61 @@ declare type Props$9 = {
|
|
|
249
250
|
numMonthsToShow?: number;
|
|
250
251
|
chooseFromPast?: boolean;
|
|
251
252
|
};
|
|
252
|
-
declare const SimpleDateChooser: React.FC<Props$
|
|
253
|
+
declare const SimpleDateChooser: React.FC<Props$a>;
|
|
253
254
|
|
|
254
255
|
/**
|
|
255
256
|
* Drawer container
|
|
256
257
|
* @author Gabe Abrams
|
|
257
258
|
*/
|
|
258
259
|
|
|
259
|
-
|
|
260
|
+
type Props$9 = {
|
|
260
261
|
customBackgroundColor?: string;
|
|
261
262
|
children: React.ReactNode;
|
|
262
263
|
};
|
|
263
|
-
declare const Drawer: React.FC<Props$
|
|
264
|
+
declare const Drawer: React.FC<Props$9>;
|
|
264
265
|
|
|
265
266
|
/**
|
|
266
267
|
* Success checkmark that pops into view
|
|
267
268
|
* @author Gabe Abrams
|
|
268
269
|
*/
|
|
269
270
|
|
|
270
|
-
|
|
271
|
+
type Props$8 = {
|
|
271
272
|
sizeRem?: number;
|
|
272
273
|
circleVariant?: string;
|
|
273
274
|
checkVariant?: string;
|
|
274
275
|
};
|
|
275
|
-
declare const PopSuccessMark: React.FC<Props$
|
|
276
|
+
declare const PopSuccessMark: React.FC<Props$8>;
|
|
276
277
|
|
|
277
278
|
/**
|
|
278
279
|
* Failure x mark that pops into view
|
|
279
280
|
* @author Gabe Abrams
|
|
280
281
|
*/
|
|
281
282
|
|
|
282
|
-
|
|
283
|
+
type Props$7 = {
|
|
283
284
|
sizeRem?: number;
|
|
284
285
|
circleVariant?: string;
|
|
285
286
|
xVariant?: string;
|
|
286
287
|
};
|
|
287
|
-
declare const PopFailureMark: React.FC<Props$
|
|
288
|
+
declare const PopFailureMark: React.FC<Props$7>;
|
|
288
289
|
|
|
289
290
|
/**
|
|
290
291
|
* Failure pending that pops into view
|
|
291
292
|
* @author Gabe Abrams
|
|
292
293
|
*/
|
|
293
294
|
|
|
294
|
-
|
|
295
|
+
type Props$6 = {
|
|
295
296
|
sizeRem?: number;
|
|
296
297
|
circleVariant?: string;
|
|
297
298
|
hourglassVariant?: string;
|
|
298
299
|
};
|
|
299
|
-
declare const PopPendingMark: React.FC<Props$
|
|
300
|
+
declare const PopPendingMark: React.FC<Props$6>;
|
|
300
301
|
|
|
301
302
|
/**
|
|
302
303
|
* Copiable text box
|
|
303
304
|
* @author Gabe Abrams
|
|
304
305
|
*/
|
|
305
306
|
|
|
306
|
-
|
|
307
|
+
type Props$5 = {
|
|
307
308
|
text: string;
|
|
308
309
|
maxTextWidthRem?: number;
|
|
309
310
|
label?: string;
|
|
@@ -315,13 +316,13 @@ declare type Props$4 = {
|
|
|
315
316
|
textAreaId?: string;
|
|
316
317
|
copyButtonId?: string;
|
|
317
318
|
};
|
|
318
|
-
declare const CopiableBox: React.FC<Props$
|
|
319
|
+
declare const CopiableBox: React.FC<Props$5>;
|
|
319
320
|
|
|
320
321
|
/**
|
|
321
322
|
* An item that can be chosen (for use within ItemPicker)
|
|
322
323
|
* @author Gabe Abrams
|
|
323
324
|
*/
|
|
324
|
-
|
|
325
|
+
type PickableItem = ({
|
|
325
326
|
id: number | string;
|
|
326
327
|
name: string;
|
|
327
328
|
link?: string;
|
|
@@ -338,7 +339,7 @@ declare type PickableItem = ({
|
|
|
338
339
|
* @author Yuen Ler Chow
|
|
339
340
|
*/
|
|
340
341
|
|
|
341
|
-
|
|
342
|
+
type Props$4 = {
|
|
342
343
|
title: string;
|
|
343
344
|
items: PickableItem[];
|
|
344
345
|
/**
|
|
@@ -349,13 +350,13 @@ declare type Props$3 = {
|
|
|
349
350
|
onChanged: (updatedItems: PickableItem[]) => void;
|
|
350
351
|
noBottomMargin?: boolean;
|
|
351
352
|
};
|
|
352
|
-
declare const ItemPicker: React.FC<Props$
|
|
353
|
+
declare const ItemPicker: React.FC<Props$4>;
|
|
353
354
|
|
|
354
355
|
/**
|
|
355
356
|
* Type of the context map in a LogMetadata file
|
|
356
357
|
* @author Gabe Abrams
|
|
357
358
|
*/
|
|
358
|
-
|
|
359
|
+
type LogMetadataContextMap = {
|
|
359
360
|
[k: string]: (string | {
|
|
360
361
|
_: string;
|
|
361
362
|
[k: string]: string;
|
|
@@ -366,7 +367,7 @@ declare type LogMetadataContextMap = {
|
|
|
366
367
|
* Type of the tag map inside a LogMetadata file
|
|
367
368
|
* @author Gabe Abrams
|
|
368
369
|
*/
|
|
369
|
-
|
|
370
|
+
type LogMetadataTagMap = {
|
|
370
371
|
[k: string]: string;
|
|
371
372
|
};
|
|
372
373
|
|
|
@@ -374,7 +375,7 @@ declare type LogMetadataTagMap = {
|
|
|
374
375
|
* Type of the target map inside a LogMetadata file
|
|
375
376
|
* @author Gabe Abrams
|
|
376
377
|
*/
|
|
377
|
-
|
|
378
|
+
type LogMetadataTargetMap = {
|
|
378
379
|
[k: string]: string;
|
|
379
380
|
};
|
|
380
381
|
|
|
@@ -382,7 +383,7 @@ declare type LogMetadataTargetMap = {
|
|
|
382
383
|
* Type of a LogMetadata file
|
|
383
384
|
* @author Gabe Abrams
|
|
384
385
|
*/
|
|
385
|
-
|
|
386
|
+
type LogMetadataType = {
|
|
386
387
|
Context?: LogMetadataContextMap;
|
|
387
388
|
Tag?: LogMetadataTagMap;
|
|
388
389
|
Target?: LogMetadataTargetMap;
|
|
@@ -394,11 +395,11 @@ declare type LogMetadataType = {
|
|
|
394
395
|
* @author Gabe Abrams
|
|
395
396
|
*/
|
|
396
397
|
|
|
397
|
-
|
|
398
|
+
type Props$3 = {
|
|
398
399
|
LogMetadata: LogMetadataType;
|
|
399
400
|
onClose: () => void;
|
|
400
401
|
};
|
|
401
|
-
declare const LogReviewer: React.FC<Props$
|
|
402
|
+
declare const LogReviewer: React.FC<Props$3>;
|
|
402
403
|
|
|
403
404
|
/**
|
|
404
405
|
* Server-side API param types
|
|
@@ -421,7 +422,7 @@ declare enum ParamType {
|
|
|
421
422
|
* Column description for a column in the IntelliTable
|
|
422
423
|
* @author Gabe Abrams
|
|
423
424
|
*/
|
|
424
|
-
|
|
425
|
+
type IntelliTableColumn = {
|
|
425
426
|
title: string;
|
|
426
427
|
param: string;
|
|
427
428
|
type: (ParamType.Boolean | ParamType.Float | ParamType.Int | ParamType.String | ParamType.JSON);
|
|
@@ -433,7 +434,7 @@ declare type IntelliTableColumn = {
|
|
|
433
434
|
* @author Gabe Abrams
|
|
434
435
|
*/
|
|
435
436
|
|
|
436
|
-
|
|
437
|
+
type Props$2 = {
|
|
437
438
|
title: string;
|
|
438
439
|
id: string;
|
|
439
440
|
data: {
|
|
@@ -443,14 +444,14 @@ declare type Props$1 = {
|
|
|
443
444
|
columns: IntelliTableColumn[];
|
|
444
445
|
csvName?: string;
|
|
445
446
|
};
|
|
446
|
-
declare const IntelliTable: React.FC<Props$
|
|
447
|
+
declare const IntelliTable: React.FC<Props$2>;
|
|
447
448
|
|
|
448
449
|
/**
|
|
449
450
|
* Button for downloading a csv file
|
|
450
451
|
* @author Gabe Abrams
|
|
451
452
|
*/
|
|
452
453
|
|
|
453
|
-
|
|
454
|
+
type Props$1 = {
|
|
454
455
|
filename: string;
|
|
455
456
|
csv: string;
|
|
456
457
|
id?: string;
|
|
@@ -462,7 +463,109 @@ declare type Props = {
|
|
|
462
463
|
onClick?: () => void;
|
|
463
464
|
children?: React.ReactNode;
|
|
464
465
|
};
|
|
465
|
-
declare const CSVDownloadButton: React.FC<Props>;
|
|
466
|
+
declare const CSVDownloadButton: React.FC<Props$1>;
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Generic type for an object
|
|
470
|
+
* @author Yuen Ler Chow
|
|
471
|
+
*/
|
|
472
|
+
type DBEntry = {
|
|
473
|
+
[k: string]: any;
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Options for field types
|
|
478
|
+
* @author Yuen Ler Chow
|
|
479
|
+
*/
|
|
480
|
+
declare enum DBEntryFieldType {
|
|
481
|
+
String = "String",
|
|
482
|
+
Number = "Number",
|
|
483
|
+
Object = "Object",
|
|
484
|
+
StringArray = "StringArray",
|
|
485
|
+
NumberArray = "NumberArray"
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* A database entry input field
|
|
490
|
+
* @author Yuen Ler Chow
|
|
491
|
+
*/
|
|
492
|
+
type DBEntryField = ({
|
|
493
|
+
label: string;
|
|
494
|
+
objectKey: string;
|
|
495
|
+
placeholder: string;
|
|
496
|
+
lockAfterCreation?: boolean;
|
|
497
|
+
required?: boolean;
|
|
498
|
+
} & ({
|
|
499
|
+
type: DBEntryFieldType.String;
|
|
500
|
+
minNumChars?: number;
|
|
501
|
+
maxNumChars?: number;
|
|
502
|
+
defaultValue?: string;
|
|
503
|
+
choices?: {
|
|
504
|
+
title: string;
|
|
505
|
+
value: string;
|
|
506
|
+
}[];
|
|
507
|
+
} | {
|
|
508
|
+
type: DBEntryFieldType.Number;
|
|
509
|
+
minNumber?: number;
|
|
510
|
+
maxNumber?: number;
|
|
511
|
+
defaultValue?: number;
|
|
512
|
+
} | {
|
|
513
|
+
type: DBEntryFieldType.StringArray;
|
|
514
|
+
minNumElements?: number;
|
|
515
|
+
maxNumElements?: number;
|
|
516
|
+
defaultValue?: string[];
|
|
517
|
+
choices?: {
|
|
518
|
+
title: string;
|
|
519
|
+
value: string;
|
|
520
|
+
}[];
|
|
521
|
+
} | {
|
|
522
|
+
type: DBEntryFieldType.NumberArray;
|
|
523
|
+
minNumElements?: number;
|
|
524
|
+
maxNumElements?: number;
|
|
525
|
+
minNumber?: number;
|
|
526
|
+
maxNumber?: number;
|
|
527
|
+
defaultValue?: number[];
|
|
528
|
+
} | {
|
|
529
|
+
type: DBEntryFieldType.Object;
|
|
530
|
+
defaultValue?: {
|
|
531
|
+
[k: string]: any;
|
|
532
|
+
};
|
|
533
|
+
subfields: DBEntryField[];
|
|
534
|
+
}));
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* DB Entry Manager Panel
|
|
538
|
+
* @author Yuen Ler Chow
|
|
539
|
+
* @author Gabe Abrams
|
|
540
|
+
*/
|
|
541
|
+
|
|
542
|
+
type Props = {
|
|
543
|
+
entryFields: DBEntryField[];
|
|
544
|
+
idPropName: string;
|
|
545
|
+
titlePropName: string;
|
|
546
|
+
descriptionPropName: string;
|
|
547
|
+
itemListTitle: string;
|
|
548
|
+
itemName: string;
|
|
549
|
+
/**
|
|
550
|
+
* Function to validate the db entry before sending to the server
|
|
551
|
+
* (throws an error if not validate)
|
|
552
|
+
* @param dbEntry the db entry to validate
|
|
553
|
+
*/
|
|
554
|
+
validateEntry?: (dbEntry: DBEntry) => Promise<void>;
|
|
555
|
+
/**
|
|
556
|
+
* Function to modify the db entry before sending to the server
|
|
557
|
+
* @param dbEntry the db entry to modify
|
|
558
|
+
* @returns the modified db entry
|
|
559
|
+
*/
|
|
560
|
+
modifyEntry?: (dbEntry: DBEntry) => Promise<DBEntry> | DBEntry;
|
|
561
|
+
disableEdit?: boolean;
|
|
562
|
+
collectionName: string;
|
|
563
|
+
adminsOnly?: boolean;
|
|
564
|
+
filterQuery?: {
|
|
565
|
+
[k: string]: any;
|
|
566
|
+
};
|
|
567
|
+
};
|
|
568
|
+
declare const DBEntryManagerPanel: React.FC<Props>;
|
|
466
569
|
|
|
467
570
|
/**
|
|
468
571
|
* An error with a code
|
|
@@ -508,7 +611,7 @@ declare const DynamicWord: {
|
|
|
508
611
|
* Type of CACCL's send request function
|
|
509
612
|
* @author Gabe Abrams
|
|
510
613
|
*/
|
|
511
|
-
|
|
614
|
+
type SendRequestFunction = (opts: {
|
|
512
615
|
path: string;
|
|
513
616
|
method: ('GET' | 'POST' | 'DELETE' | 'PUT');
|
|
514
617
|
params?: {
|
|
@@ -657,7 +760,7 @@ declare enum LogLevel {
|
|
|
657
760
|
* Main information in a log event
|
|
658
761
|
* @author Gabe Abrams
|
|
659
762
|
*/
|
|
660
|
-
|
|
763
|
+
type LogMainInfo = {
|
|
661
764
|
id: string;
|
|
662
765
|
userFirstName: string;
|
|
663
766
|
userLastName: string;
|
|
@@ -704,7 +807,7 @@ declare enum LogSource {
|
|
|
704
807
|
* Log info that is specific to the type of source
|
|
705
808
|
* @author Gabe Abrams
|
|
706
809
|
*/
|
|
707
|
-
|
|
810
|
+
type LogSourceSpecificInfo = ({
|
|
708
811
|
source: LogSource.Client;
|
|
709
812
|
} | {
|
|
710
813
|
source: LogSource.Server;
|
|
@@ -748,7 +851,7 @@ declare enum LogType {
|
|
|
748
851
|
* Log info that is specific to the type of log
|
|
749
852
|
* @author Gabe Abrams
|
|
750
853
|
*/
|
|
751
|
-
|
|
854
|
+
type LogTypeSpecificInfo = ({
|
|
752
855
|
type: LogType.Error;
|
|
753
856
|
errorMessage: string;
|
|
754
857
|
errorCode: string;
|
|
@@ -764,13 +867,13 @@ declare type LogTypeSpecificInfo = ({
|
|
|
764
867
|
* error encountered by a user
|
|
765
868
|
* @author Gabe Abrams
|
|
766
869
|
*/
|
|
767
|
-
|
|
870
|
+
type Log = (LogMainInfo & LogSourceSpecificInfo & LogTypeSpecificInfo);
|
|
768
871
|
|
|
769
872
|
/**
|
|
770
873
|
* Type of a log action function
|
|
771
874
|
* @author Gabe Abrams
|
|
772
875
|
*/
|
|
773
|
-
|
|
876
|
+
type LogFunction = (opts: ({
|
|
774
877
|
context: string | {
|
|
775
878
|
_: string;
|
|
776
879
|
};
|
|
@@ -820,14 +923,14 @@ declare const genRouteHandler: (opts: {
|
|
|
820
923
|
req: any;
|
|
821
924
|
next: () => void;
|
|
822
925
|
redirect: (pathOrURL: string) => void;
|
|
823
|
-
send: (text: string, status?: number
|
|
926
|
+
send: (text: string, status?: number) => void;
|
|
824
927
|
renderErrorPage: (opts?: {
|
|
825
|
-
title?: string
|
|
826
|
-
description?: string
|
|
827
|
-
code?: string
|
|
828
|
-
pageTitle?: string
|
|
829
|
-
status?: number
|
|
830
|
-
}
|
|
928
|
+
title?: string;
|
|
929
|
+
description?: string;
|
|
930
|
+
code?: string;
|
|
931
|
+
pageTitle?: string;
|
|
932
|
+
status?: number;
|
|
933
|
+
}) => void;
|
|
831
934
|
logServerEvent: LogFunction;
|
|
832
935
|
}) => any;
|
|
833
936
|
skipSessionCheck?: boolean | undefined;
|
|
@@ -859,7 +962,7 @@ declare const handleError: (res: any, error: ({
|
|
|
859
962
|
*/
|
|
860
963
|
declare const handleSuccess: (res: any, body: any) => undefined;
|
|
861
964
|
|
|
862
|
-
|
|
965
|
+
type GetLaunchInfoFunction = (req: any) => {
|
|
863
966
|
launched: boolean;
|
|
864
967
|
launchInfo?: any;
|
|
865
968
|
};
|
|
@@ -904,7 +1007,7 @@ declare const getOrdinal: (num: number) => string;
|
|
|
904
1007
|
* corresponding to ET time values for year, month, day, hour, hour12, minute, isPM
|
|
905
1008
|
* where hour is in 24hr time and hour12 is in 12hr time.
|
|
906
1009
|
*/
|
|
907
|
-
declare const getTimeInfoInET: (dateOrTimestamp?:
|
|
1010
|
+
declare const getTimeInfoInET: (dateOrTimestamp?: Date | number) => {
|
|
908
1011
|
timestamp: number;
|
|
909
1012
|
year: number;
|
|
910
1013
|
month: number;
|
|
@@ -948,7 +1051,7 @@ declare const startMinWait: (minWaitMs: number) => () => Promise<void>;
|
|
|
948
1051
|
* @param [dateOrTimestamp=today] the date or timestamp for the date to describe
|
|
949
1052
|
* @returns human-readable description of the date
|
|
950
1053
|
*/
|
|
951
|
-
declare const getHumanReadableDate: (dateOrTimestamp?:
|
|
1054
|
+
declare const getHumanReadableDate: (dateOrTimestamp?: Date | number) => string;
|
|
952
1055
|
|
|
953
1056
|
/**
|
|
954
1057
|
* Get the current part of day (morning, evening, etc.)
|
|
@@ -984,7 +1087,7 @@ declare const onlyKeepLetters: (str: string) => string;
|
|
|
984
1087
|
* once
|
|
985
1088
|
* @returns array of resolved values in the same order as the task functions
|
|
986
1089
|
*/
|
|
987
|
-
declare const parallelLimit: (taskFunctions: (() => Promise<any>)[], limit?: number
|
|
1090
|
+
declare const parallelLimit: (taskFunctions: (() => Promise<any>)[], limit?: number) => Promise<any[]>;
|
|
988
1091
|
|
|
989
1092
|
/**
|
|
990
1093
|
* Log a user action on the client (cannot be used on the server)
|
|
@@ -1060,11 +1163,71 @@ declare const extractProp: (arr: any[], prop: string) => any[];
|
|
|
1060
1163
|
* @author Gabe Abrams
|
|
1061
1164
|
* @param a the first array
|
|
1062
1165
|
* @param b the second array
|
|
1063
|
-
* @param prop the property to compare with
|
|
1166
|
+
* @param prop the property to compare with, or an array of props to compare
|
|
1167
|
+
* with (if array, all values associated with those props must match)
|
|
1064
1168
|
* @returns true if the arrays contain the same objects as determined by
|
|
1065
1169
|
* the values associated with each object's prop
|
|
1066
1170
|
*/
|
|
1067
|
-
declare const compareArraysByProp: (a: any[], b: any[], prop: string) => boolean;
|
|
1171
|
+
declare const compareArraysByProp: (a: any[], b: any[], prop: string | string[]) => boolean;
|
|
1172
|
+
|
|
1173
|
+
/**
|
|
1174
|
+
* Get current time info in local time
|
|
1175
|
+
* @author Gabe Abrams
|
|
1176
|
+
* @param [dateOrTimestamp=now] the date to get info on or a ms since epoch timestamp
|
|
1177
|
+
* @returns object with timestamp (ms since epoch) and numbers
|
|
1178
|
+
* corresponding to time values for year, month, day, hour, hour12, minute, isPM
|
|
1179
|
+
* where hour is in 24hr time and hour12 is in 12hr time.
|
|
1180
|
+
*/
|
|
1181
|
+
declare const getLocalTimeInfo: (dateOrTimestamp?: Date | number) => {
|
|
1182
|
+
timestamp: number;
|
|
1183
|
+
year: number;
|
|
1184
|
+
month: number;
|
|
1185
|
+
day: number;
|
|
1186
|
+
hour: number;
|
|
1187
|
+
hour12: number;
|
|
1188
|
+
minute: number;
|
|
1189
|
+
isPM: boolean;
|
|
1190
|
+
};
|
|
1191
|
+
|
|
1192
|
+
/**
|
|
1193
|
+
* Interface for a collection in the database
|
|
1194
|
+
* @author Yuen Ler Chow
|
|
1195
|
+
*/
|
|
1196
|
+
type DCEMangoCollection = {
|
|
1197
|
+
/**
|
|
1198
|
+
* Find all items in the collection that match the filter query
|
|
1199
|
+
* @param filterQuery
|
|
1200
|
+
* @returns list of items that match the filter query
|
|
1201
|
+
*/
|
|
1202
|
+
find: (filterQuery: any) => Promise<any[]>;
|
|
1203
|
+
/**
|
|
1204
|
+
* Insert an item into the collection
|
|
1205
|
+
* @param item the item to insert
|
|
1206
|
+
*/
|
|
1207
|
+
insert: (item: any) => Promise<void>;
|
|
1208
|
+
/**
|
|
1209
|
+
* Delete an item in the collection
|
|
1210
|
+
* @param id the id of the item to delete
|
|
1211
|
+
*/
|
|
1212
|
+
delete: (filterQuery: {
|
|
1213
|
+
id: string;
|
|
1214
|
+
}) => Promise<void>;
|
|
1215
|
+
};
|
|
1216
|
+
/**
|
|
1217
|
+
* Add all routes for the DBEditor
|
|
1218
|
+
* @author Yuen Ler Chow
|
|
1219
|
+
* @param opts object containing all arguments
|
|
1220
|
+
* @param opts.app express app to add routes too
|
|
1221
|
+
* @param opts.collectionName the name of the collection
|
|
1222
|
+
* @param opts.adminsOnly true if the endpoint is for admins only
|
|
1223
|
+
* @param opts.collection dce-mango db collection
|
|
1224
|
+
*/
|
|
1225
|
+
declare const addDBEditorEndpoints: (opts: {
|
|
1226
|
+
app: express.Application;
|
|
1227
|
+
collectionName: string;
|
|
1228
|
+
adminsOnly: boolean;
|
|
1229
|
+
collection: DCEMangoCollection;
|
|
1230
|
+
}) => void;
|
|
1068
1231
|
|
|
1069
1232
|
/**
|
|
1070
1233
|
* Given an array of strings, create a single comma-separated string that includes
|
|
@@ -1082,7 +1245,7 @@ declare const genCommaList: (list: string[]) => string;
|
|
|
1082
1245
|
* Result of a validation function.
|
|
1083
1246
|
* @author Austen Money
|
|
1084
1247
|
*/
|
|
1085
|
-
|
|
1248
|
+
type ValidationResult<CleanedValueType> = ({
|
|
1086
1249
|
isValid: true;
|
|
1087
1250
|
cleanedValue: CleanedValueType;
|
|
1088
1251
|
} | {
|
|
@@ -1131,25 +1294,6 @@ declare const validateString: (input: string, opts: {
|
|
|
1131
1294
|
regexDescription?: string;
|
|
1132
1295
|
}) => ValidationResult<string>;
|
|
1133
1296
|
|
|
1134
|
-
/**
|
|
1135
|
-
* Get current time info in local time
|
|
1136
|
-
* @author Gabe Abrams
|
|
1137
|
-
* @param [dateOrTimestamp=now] the date to get info on or a ms since epoch timestamp
|
|
1138
|
-
* @returns object with timestamp (ms since epoch) and numbers
|
|
1139
|
-
* corresponding to time values for year, month, day, hour, hour12, minute, isPM
|
|
1140
|
-
* where hour is in 24hr time and hour12 is in 12hr time.
|
|
1141
|
-
*/
|
|
1142
|
-
declare const getLocalTimeInfo: (dateOrTimestamp?: number | Date | undefined) => {
|
|
1143
|
-
timestamp: number;
|
|
1144
|
-
year: number;
|
|
1145
|
-
month: number;
|
|
1146
|
-
day: number;
|
|
1147
|
-
hour: number;
|
|
1148
|
-
hour12: number;
|
|
1149
|
-
minute: number;
|
|
1150
|
-
isPM: boolean;
|
|
1151
|
-
};
|
|
1152
|
-
|
|
1153
1297
|
/**
|
|
1154
1298
|
* List of error codes built into the react kit
|
|
1155
1299
|
* @author Gabe Abrams
|
|
@@ -1200,4 +1344,4 @@ declare const LogBuiltInMetadata: {
|
|
|
1200
1344
|
};
|
|
1201
1345
|
};
|
|
1202
1346
|
|
|
1203
|
-
export { AppWrapper, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DayOfWeek, Drawer, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, IntelliTableColumn, ItemPicker, LoadingSpinner, Log, LogAction, LogBuiltInMetadata, LogMetadataType, LogReviewer, LogSource, LogType, MINUTE_IN_MS, Modal, ModalButtonType, ModalSize, ModalType, ParamType, PickableItem, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode, SimpleDateChooser, TabBox, Variant, abbreviate, alert, avg, canReviewLogs, ceilToNumDecimals, compareArraysByProp, confirm, extractProp, floorToNumDecimals, forceNumIntoBounds, genCSV, genCommaList, genRouteHandler, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, handleError, handleSuccess, initClient, initLogCollection, initServer, isMobileOrTablet, logClientEvent, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, roundToNumDecimals, showFatalError, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, validateEmail, validatePhoneNumber, validateString, visitServerEndpoint, waitMs };
|
|
1347
|
+
export { AppWrapper, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DBEntry, DBEntryField, DBEntryFieldType, DBEntryManagerPanel, DayOfWeek, Drawer, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, IntelliTableColumn, ItemPicker, LoadingSpinner, Log, LogAction, LogBuiltInMetadata, LogMetadataType, LogReviewer, LogSource, LogType, MINUTE_IN_MS, Modal, ModalButtonType, ModalSize, ModalType, ParamType, PickableItem, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode, SimpleDateChooser, TabBox, Variant, abbreviate, addDBEditorEndpoints, alert, avg, canReviewLogs, ceilToNumDecimals, compareArraysByProp, confirm, extractProp, floorToNumDecimals, forceNumIntoBounds, genCSV, genCommaList, genRouteHandler, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, handleError, handleSuccess, initClient, initLogCollection, initServer, isMobileOrTablet, logClientEvent, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, roundToNumDecimals, showFatalError, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, validateEmail, validatePhoneNumber, validateString, visitServerEndpoint, waitMs };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dce-reactkit",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.2",
|
|
4
4
|
"description": "Shared components for Harvard DCE apps",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -23,18 +23,23 @@
|
|
|
23
23
|
"url": "https://github.com/harvard-edtech/dce-reactkit/issues"
|
|
24
24
|
},
|
|
25
25
|
"homepage": "https://github.com/harvard-edtech/dce-reactkit#readme",
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"react-select": "^5.7.3"
|
|
28
|
+
},
|
|
26
29
|
"peerDependencies": {
|
|
27
30
|
"@fortawesome/free-regular-svg-icons": "^x.x.x",
|
|
28
31
|
"@fortawesome/free-solid-svg-icons": "^x.x.x",
|
|
29
32
|
"@fortawesome/react-fontawesome": "^x.x.x",
|
|
30
33
|
"bootstrap": "^5.x.x",
|
|
31
|
-
"react": "^x.x.x"
|
|
34
|
+
"react": "^x.x.x",
|
|
35
|
+
"express": "^x.x.x"
|
|
32
36
|
},
|
|
33
37
|
"devDependencies": {
|
|
34
38
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
35
39
|
"@rollup/plugin-json": "^4.1.0",
|
|
36
40
|
"@rollup/plugin-node-resolve": "^13.2.1",
|
|
37
41
|
"@rollup/plugin-typescript": "^8.3.2",
|
|
42
|
+
"@types/express": "^4.17.17",
|
|
38
43
|
"@types/jest": "^28.1.7",
|
|
39
44
|
"@types/node": "^20.2.5",
|
|
40
45
|
"@types/react": "^17.0.7",
|