dce-reactkit 3.4.0-beta.9 → 3.4.1
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/.eslintrc.js +0 -2
- package/dist/cjs/index.js +434 -36371
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/helpers/abbreviate.test.d.ts +5 -0
- package/dist/cjs/types/helpers/avg.test.d.ts +5 -0
- package/dist/cjs/types/helpers/canReviewLogs.d.ts +5 -0
- package/dist/cjs/types/helpers/canReviewLogs.test.d.ts +5 -0
- package/dist/cjs/types/helpers/ceilToNumDecimals.test.d.ts +5 -0
- package/dist/cjs/types/helpers/compareArraysByProp.test.d.ts +5 -0
- package/dist/cjs/types/helpers/extractProp.test.d.ts +5 -0
- package/dist/cjs/types/helpers/floorToNumDecimals.test.d.ts +5 -0
- package/dist/cjs/types/helpers/forceNumIntoBounds.test.d.ts +5 -0
- package/dist/cjs/types/helpers/genCSV.test.d.ts +5 -0
- package/dist/cjs/types/helpers/genCommaList.d.ts +12 -0
- package/dist/cjs/types/helpers/genCommaList.test.d.ts +1 -0
- package/dist/cjs/types/helpers/getHumanReadableDate.test.d.ts +5 -0
- package/dist/cjs/types/helpers/getLocalTimeInfo.test.d.ts +6 -0
- package/dist/cjs/types/helpers/getMonthName.test.d.ts +5 -0
- package/dist/cjs/types/helpers/getOrdinal.test.d.ts +5 -0
- package/dist/cjs/types/helpers/getPartOfDay.test.d.ts +5 -0
- package/dist/cjs/types/helpers/getTimeInfoInET.test.d.ts +5 -0
- package/dist/cjs/types/helpers/validators/shared/constants/ERROR_MESSAGES.d.ts +10 -0
- package/dist/cjs/types/helpers/validators/shared/helpers/validateRegex.d.ts +19 -0
- package/dist/cjs/types/helpers/validators/shared/types/ValidationResult.d.ts +12 -0
- package/dist/cjs/types/helpers/validators/validateEmail.d.ts +11 -0
- package/dist/cjs/types/helpers/validators/validateEmail.test.d.ts +1 -0
- package/dist/cjs/types/helpers/validators/validatePhoneNumber.d.ts +11 -0
- package/dist/cjs/types/helpers/validators/validatePhoneNumber.test.d.ts +1 -0
- package/dist/cjs/types/helpers/validators/validateString.d.ts +22 -0
- package/dist/cjs/types/helpers/validators/validateString.test.d.ts +1 -0
- package/dist/cjs/types/index.d.ts +5 -6
- package/dist/esm/index.js +659 -36579
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/helpers/abbreviate.test.d.ts +5 -0
- package/dist/esm/types/helpers/avg.test.d.ts +5 -0
- package/dist/esm/types/helpers/canReviewLogs.d.ts +5 -0
- package/dist/esm/types/helpers/canReviewLogs.test.d.ts +5 -0
- package/dist/esm/types/helpers/ceilToNumDecimals.test.d.ts +5 -0
- package/dist/esm/types/helpers/compareArraysByProp.test.d.ts +5 -0
- package/dist/esm/types/helpers/extractProp.test.d.ts +5 -0
- package/dist/esm/types/helpers/floorToNumDecimals.test.d.ts +5 -0
- package/dist/esm/types/helpers/forceNumIntoBounds.test.d.ts +5 -0
- package/dist/esm/types/helpers/genCSV.test.d.ts +5 -0
- package/dist/esm/types/helpers/genCommaList.d.ts +12 -0
- package/dist/esm/types/helpers/genCommaList.test.d.ts +1 -0
- package/dist/esm/types/helpers/getHumanReadableDate.test.d.ts +5 -0
- package/dist/esm/types/helpers/getLocalTimeInfo.test.d.ts +6 -0
- package/dist/esm/types/helpers/getMonthName.test.d.ts +5 -0
- package/dist/esm/types/helpers/getOrdinal.test.d.ts +5 -0
- package/dist/esm/types/helpers/getPartOfDay.test.d.ts +5 -0
- package/dist/esm/types/helpers/getTimeInfoInET.test.d.ts +5 -0
- package/dist/esm/types/helpers/validators/shared/constants/ERROR_MESSAGES.d.ts +10 -0
- package/dist/esm/types/helpers/validators/shared/helpers/validateRegex.d.ts +19 -0
- package/dist/esm/types/helpers/validators/shared/types/ValidationResult.d.ts +12 -0
- package/dist/esm/types/helpers/validators/validateEmail.d.ts +11 -0
- package/dist/esm/types/helpers/validators/validateEmail.test.d.ts +1 -0
- package/dist/esm/types/helpers/validators/validatePhoneNumber.d.ts +11 -0
- package/dist/esm/types/helpers/validators/validatePhoneNumber.test.d.ts +1 -0
- package/dist/esm/types/helpers/validators/validateString.d.ts +22 -0
- package/dist/esm/types/helpers/validators/validateString.test.d.ts +1 -0
- package/dist/esm/types/index.d.ts +5 -6
- package/dist/index.d.ts +100 -166
- package/package.json +13 -17
- package/src/client/initClient.tsx +20 -12
- package/src/components/AppWrapper.tsx +1 -1
- package/src/components/ItemPicker/index.test.tsx +10 -10
- package/src/helpers/abbreviate.test.ts +26 -0
- package/src/helpers/avg.test.ts +24 -0
- package/src/helpers/canReviewLogs.test.ts +67 -0
- package/src/helpers/canReviewLogs.ts +20 -0
- package/src/helpers/ceilToNumDecimals.test.ts +39 -0
- package/src/helpers/compareArraysByProp.test.ts +102 -0
- package/src/helpers/extractProp.test.ts +34 -0
- package/src/helpers/floorToNumDecimals.test.ts +39 -0
- package/src/helpers/forceNumIntoBounds.test.ts +34 -0
- package/src/helpers/genCSV.test.ts +61 -0
- package/src/helpers/genCSV.ts +5 -2
- package/src/helpers/genCommaList.test.ts +57 -0
- package/src/helpers/genCommaList.ts +21 -0
- package/src/helpers/getHumanReadableDate.test.ts +29 -0
- package/src/helpers/getLocalTimeInfo.test.ts +48 -0
- package/src/helpers/getMonthName.test.ts +79 -0
- package/src/helpers/getOrdinal.test.ts +84 -0
- package/src/helpers/{getOrdinal.tsx → getOrdinal.ts} +1 -0
- package/src/helpers/getPartOfDay.test.ts +56 -0
- package/src/helpers/getTimeInfoInET.test.ts +72 -0
- package/src/helpers/validators/shared/constants/ERROR_MESSAGES.ts +18 -0
- package/src/helpers/validators/shared/helpers/validateRegex.ts +47 -0
- package/src/helpers/validators/shared/types/ValidationResult.ts +20 -0
- package/src/helpers/validators/validateEmail.test.ts +110 -0
- package/src/helpers/validators/validateEmail.ts +47 -0
- package/src/helpers/validators/validatePhoneNumber.test.ts +94 -0
- package/src/helpers/validators/validatePhoneNumber.ts +49 -0
- package/src/helpers/validators/validateString.test.ts +175 -0
- package/src/helpers/validators/validateString.ts +171 -0
- package/src/index.ts +10 -12
- package/tsconfig.json +6 -2
- package/dist/cjs/types/components/DBEntryManagerPanel/AddOrEditDBEntry/CreatableMultiselect.d.ts +0 -10
- package/dist/cjs/types/components/DBEntryManagerPanel/AddOrEditDBEntry/index.d.ts +0 -34
- package/dist/cjs/types/components/DBEntryManagerPanel/helpers/generateEndpointPath.d.ts +0 -9
- package/dist/cjs/types/components/DBEntryManagerPanel/index.d.ts +0 -25
- package/dist/cjs/types/components/DBEntryManagerPanel/types/DBEntry.d.ts +0 -8
- package/dist/cjs/types/components/DBEntryManagerPanel/types/DBEntryField.d.ts +0 -49
- package/dist/cjs/types/components/DBEntryManagerPanel/types/DBEntryFieldType.d.ts +0 -12
- package/dist/cjs/types/helpers/addDBEditorEndpoints.d.ts +0 -40
- package/dist/esm/types/components/DBEntryManagerPanel/AddOrEditDBEntry/CreatableMultiselect.d.ts +0 -10
- package/dist/esm/types/components/DBEntryManagerPanel/AddOrEditDBEntry/index.d.ts +0 -34
- package/dist/esm/types/components/DBEntryManagerPanel/helpers/generateEndpointPath.d.ts +0 -9
- package/dist/esm/types/components/DBEntryManagerPanel/index.d.ts +0 -25
- package/dist/esm/types/components/DBEntryManagerPanel/types/DBEntry.d.ts +0 -8
- package/dist/esm/types/components/DBEntryManagerPanel/types/DBEntryField.d.ts +0 -49
- package/dist/esm/types/components/DBEntryManagerPanel/types/DBEntryFieldType.d.ts +0 -12
- package/dist/esm/types/helpers/addDBEditorEndpoints.d.ts +0 -40
- package/src/components/DBEntryManagerPanel/AddOrEditDBEntry/CreatableMultiselect.tsx +0 -286
- package/src/components/DBEntryManagerPanel/AddOrEditDBEntry/index.tsx +0 -722
- package/src/components/DBEntryManagerPanel/helpers/generateEndpointPath.ts +0 -15
- package/src/components/DBEntryManagerPanel/index.tsx +0 -511
- package/src/components/DBEntryManagerPanel/types/DBEntry.ts +0 -7
- package/src/components/DBEntryManagerPanel/types/DBEntryField.ts +0 -94
- package/src/components/DBEntryManagerPanel/types/DBEntryFieldType.ts +0 -18
- package/src/helpers/addDBEditorEndpoints.ts +0 -124
- /package/src/helpers/{abbreviate.tsx → abbreviate.ts} +0 -0
- /package/src/helpers/{avg.tsx → avg.ts} +0 -0
- /package/src/helpers/{ceilToNumDecimals.tsx → ceilToNumDecimals.ts} +0 -0
- /package/src/helpers/{floorToNumDecimals.tsx → floorToNumDecimals.ts} +0 -0
- /package/src/helpers/{forceNumIntoBounds.tsx → forceNumIntoBounds.ts} +0 -0
- /package/src/helpers/{getLocalTimeInfo.tsx → getLocalTimeInfo.ts} +0 -0
- /package/src/helpers/{getTimeInfoInET.tsx → getTimeInfoInET.ts} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import express from 'express';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Bootstrap variants
|
|
@@ -23,7 +22,7 @@ declare enum Variant {
|
|
|
23
22
|
* @author Gabe Abrams
|
|
24
23
|
*/
|
|
25
24
|
|
|
26
|
-
declare type Props$
|
|
25
|
+
declare type Props$g = {
|
|
27
26
|
children: React.ReactNode;
|
|
28
27
|
dark?: boolean;
|
|
29
28
|
};
|
|
@@ -62,7 +61,7 @@ declare const confirm: (title: string, text: string, opts?: {
|
|
|
62
61
|
* @param [errorTitle] title of the error box
|
|
63
62
|
*/
|
|
64
63
|
declare const showFatalError: (error: any, errorTitle?: string) => undefined;
|
|
65
|
-
declare const AppWrapper: React.FC<Props$
|
|
64
|
+
declare const AppWrapper: React.FC<Props$g>;
|
|
66
65
|
|
|
67
66
|
/**
|
|
68
67
|
* Loading spinner/indicator
|
|
@@ -75,12 +74,12 @@ declare const LoadingSpinner: () => JSX.Element;
|
|
|
75
74
|
* @author Gabe Abrams
|
|
76
75
|
*/
|
|
77
76
|
|
|
78
|
-
declare type Props$
|
|
77
|
+
declare type Props$f = {
|
|
79
78
|
error: any;
|
|
80
79
|
title?: string;
|
|
81
80
|
onClose?: () => void;
|
|
82
81
|
};
|
|
83
|
-
declare const ErrorBox: React.FC<Props$
|
|
82
|
+
declare const ErrorBox: React.FC<Props$f>;
|
|
84
83
|
|
|
85
84
|
/**
|
|
86
85
|
* Types of buttons in the modal
|
|
@@ -131,7 +130,7 @@ declare enum ModalType {
|
|
|
131
130
|
* @author Gabe Abrams
|
|
132
131
|
*/
|
|
133
132
|
|
|
134
|
-
declare type Props$
|
|
133
|
+
declare type Props$e = {
|
|
135
134
|
type?: ModalType;
|
|
136
135
|
size?: ModalSize;
|
|
137
136
|
title?: React.ReactNode;
|
|
@@ -160,27 +159,27 @@ declare type Props$f = {
|
|
|
160
159
|
confirmVariant?: Variant;
|
|
161
160
|
onTopOfOtherModals?: boolean;
|
|
162
161
|
};
|
|
163
|
-
declare const Modal: React.FC<Props$
|
|
162
|
+
declare const Modal: React.FC<Props$e>;
|
|
164
163
|
|
|
165
164
|
/**
|
|
166
165
|
* A box with a tab on the top that holds buttons and other content
|
|
167
166
|
* @author Gabe Abrams
|
|
168
167
|
*/
|
|
169
168
|
|
|
170
|
-
declare type Props$
|
|
169
|
+
declare type Props$d = {
|
|
171
170
|
title: React.ReactNode;
|
|
172
171
|
children: React.ReactNode;
|
|
173
172
|
noBottomMargin?: boolean;
|
|
174
173
|
noBottomPadding?: boolean;
|
|
175
174
|
};
|
|
176
|
-
declare const TabBox: React.FC<Props$
|
|
175
|
+
declare const TabBox: React.FC<Props$d>;
|
|
177
176
|
|
|
178
177
|
/**
|
|
179
178
|
* A radio selection button
|
|
180
179
|
* @author Gabe Abrams
|
|
181
180
|
*/
|
|
182
181
|
|
|
183
|
-
declare type Props$
|
|
182
|
+
declare type Props$c = {
|
|
184
183
|
text: string;
|
|
185
184
|
onSelected: () => void;
|
|
186
185
|
ariaLabel: string;
|
|
@@ -192,14 +191,14 @@ declare type Props$d = {
|
|
|
192
191
|
unselectedVariant?: Variant;
|
|
193
192
|
small?: boolean;
|
|
194
193
|
};
|
|
195
|
-
declare const RadioButton: React.FC<Props$
|
|
194
|
+
declare const RadioButton: React.FC<Props$c>;
|
|
196
195
|
|
|
197
196
|
/**
|
|
198
197
|
* A checkbox button
|
|
199
198
|
* @author Gabe Abrams
|
|
200
199
|
*/
|
|
201
200
|
|
|
202
|
-
declare type Props$
|
|
201
|
+
declare type Props$b = {
|
|
203
202
|
text: string;
|
|
204
203
|
onChanged: (checked: boolean) => void;
|
|
205
204
|
ariaLabel: string;
|
|
@@ -213,28 +212,28 @@ declare type Props$c = {
|
|
|
213
212
|
small?: boolean;
|
|
214
213
|
dashed?: boolean;
|
|
215
214
|
};
|
|
216
|
-
declare const CheckboxButton: React.FC<Props$
|
|
215
|
+
declare const CheckboxButton: React.FC<Props$b>;
|
|
217
216
|
|
|
218
217
|
/**
|
|
219
218
|
* Input group with a title and space for buttons
|
|
220
219
|
* @author Gabe Abrams
|
|
221
220
|
*/
|
|
222
221
|
|
|
223
|
-
declare type Props$
|
|
222
|
+
declare type Props$a = {
|
|
224
223
|
label: string;
|
|
225
224
|
minLabelWidth?: string;
|
|
226
225
|
children: React.ReactNode;
|
|
227
226
|
className?: string;
|
|
228
227
|
wrapButtonsAndAddGaps?: boolean;
|
|
229
228
|
};
|
|
230
|
-
declare const ButtonInputGroup: React.FC<Props$
|
|
229
|
+
declare const ButtonInputGroup: React.FC<Props$a>;
|
|
231
230
|
|
|
232
231
|
/**
|
|
233
232
|
* A very simple, lightweight date chooser
|
|
234
233
|
* @author Gabe Abrams
|
|
235
234
|
*/
|
|
236
235
|
|
|
237
|
-
declare type Props$
|
|
236
|
+
declare type Props$9 = {
|
|
238
237
|
ariaLabel: string;
|
|
239
238
|
name: string;
|
|
240
239
|
month: number;
|
|
@@ -250,61 +249,61 @@ declare type Props$a = {
|
|
|
250
249
|
numMonthsToShow?: number;
|
|
251
250
|
chooseFromPast?: boolean;
|
|
252
251
|
};
|
|
253
|
-
declare const SimpleDateChooser: React.FC<Props$
|
|
252
|
+
declare const SimpleDateChooser: React.FC<Props$9>;
|
|
254
253
|
|
|
255
254
|
/**
|
|
256
255
|
* Drawer container
|
|
257
256
|
* @author Gabe Abrams
|
|
258
257
|
*/
|
|
259
258
|
|
|
260
|
-
declare type Props$
|
|
259
|
+
declare type Props$8 = {
|
|
261
260
|
customBackgroundColor?: string;
|
|
262
261
|
children: React.ReactNode;
|
|
263
262
|
};
|
|
264
|
-
declare const Drawer: React.FC<Props$
|
|
263
|
+
declare const Drawer: React.FC<Props$8>;
|
|
265
264
|
|
|
266
265
|
/**
|
|
267
266
|
* Success checkmark that pops into view
|
|
268
267
|
* @author Gabe Abrams
|
|
269
268
|
*/
|
|
270
269
|
|
|
271
|
-
declare type Props$
|
|
270
|
+
declare type Props$7 = {
|
|
272
271
|
sizeRem?: number;
|
|
273
272
|
circleVariant?: string;
|
|
274
273
|
checkVariant?: string;
|
|
275
274
|
};
|
|
276
|
-
declare const PopSuccessMark: React.FC<Props$
|
|
275
|
+
declare const PopSuccessMark: React.FC<Props$7>;
|
|
277
276
|
|
|
278
277
|
/**
|
|
279
278
|
* Failure x mark that pops into view
|
|
280
279
|
* @author Gabe Abrams
|
|
281
280
|
*/
|
|
282
281
|
|
|
283
|
-
declare type Props$
|
|
282
|
+
declare type Props$6 = {
|
|
284
283
|
sizeRem?: number;
|
|
285
284
|
circleVariant?: string;
|
|
286
285
|
xVariant?: string;
|
|
287
286
|
};
|
|
288
|
-
declare const PopFailureMark: React.FC<Props$
|
|
287
|
+
declare const PopFailureMark: React.FC<Props$6>;
|
|
289
288
|
|
|
290
289
|
/**
|
|
291
290
|
* Failure pending that pops into view
|
|
292
291
|
* @author Gabe Abrams
|
|
293
292
|
*/
|
|
294
293
|
|
|
295
|
-
declare type Props$
|
|
294
|
+
declare type Props$5 = {
|
|
296
295
|
sizeRem?: number;
|
|
297
296
|
circleVariant?: string;
|
|
298
297
|
hourglassVariant?: string;
|
|
299
298
|
};
|
|
300
|
-
declare const PopPendingMark: React.FC<Props$
|
|
299
|
+
declare const PopPendingMark: React.FC<Props$5>;
|
|
301
300
|
|
|
302
301
|
/**
|
|
303
302
|
* Copiable text box
|
|
304
303
|
* @author Gabe Abrams
|
|
305
304
|
*/
|
|
306
305
|
|
|
307
|
-
declare type Props$
|
|
306
|
+
declare type Props$4 = {
|
|
308
307
|
text: string;
|
|
309
308
|
maxTextWidthRem?: number;
|
|
310
309
|
label?: string;
|
|
@@ -316,7 +315,7 @@ declare type Props$5 = {
|
|
|
316
315
|
textAreaId?: string;
|
|
317
316
|
copyButtonId?: string;
|
|
318
317
|
};
|
|
319
|
-
declare const CopiableBox: React.FC<Props$
|
|
318
|
+
declare const CopiableBox: React.FC<Props$4>;
|
|
320
319
|
|
|
321
320
|
/**
|
|
322
321
|
* An item that can be chosen (for use within ItemPicker)
|
|
@@ -339,7 +338,7 @@ declare type PickableItem = ({
|
|
|
339
338
|
* @author Yuen Ler Chow
|
|
340
339
|
*/
|
|
341
340
|
|
|
342
|
-
declare type Props$
|
|
341
|
+
declare type Props$3 = {
|
|
343
342
|
title: string;
|
|
344
343
|
items: PickableItem[];
|
|
345
344
|
/**
|
|
@@ -350,7 +349,7 @@ declare type Props$4 = {
|
|
|
350
349
|
onChanged: (updatedItems: PickableItem[]) => void;
|
|
351
350
|
noBottomMargin?: boolean;
|
|
352
351
|
};
|
|
353
|
-
declare const ItemPicker: React.FC<Props$
|
|
352
|
+
declare const ItemPicker: React.FC<Props$3>;
|
|
354
353
|
|
|
355
354
|
/**
|
|
356
355
|
* Type of the context map in a LogMetadata file
|
|
@@ -395,11 +394,11 @@ declare type LogMetadataType = {
|
|
|
395
394
|
* @author Gabe Abrams
|
|
396
395
|
*/
|
|
397
396
|
|
|
398
|
-
declare type Props$
|
|
397
|
+
declare type Props$2 = {
|
|
399
398
|
LogMetadata: LogMetadataType;
|
|
400
399
|
onClose: () => void;
|
|
401
400
|
};
|
|
402
|
-
declare const LogReviewer: React.FC<Props$
|
|
401
|
+
declare const LogReviewer: React.FC<Props$2>;
|
|
403
402
|
|
|
404
403
|
/**
|
|
405
404
|
* Server-side API param types
|
|
@@ -434,7 +433,7 @@ declare type IntelliTableColumn = {
|
|
|
434
433
|
* @author Gabe Abrams
|
|
435
434
|
*/
|
|
436
435
|
|
|
437
|
-
declare type Props$
|
|
436
|
+
declare type Props$1 = {
|
|
438
437
|
title: string;
|
|
439
438
|
id: string;
|
|
440
439
|
data: {
|
|
@@ -444,14 +443,14 @@ declare type Props$2 = {
|
|
|
444
443
|
columns: IntelliTableColumn[];
|
|
445
444
|
csvName?: string;
|
|
446
445
|
};
|
|
447
|
-
declare const IntelliTable: React.FC<Props$
|
|
446
|
+
declare const IntelliTable: React.FC<Props$1>;
|
|
448
447
|
|
|
449
448
|
/**
|
|
450
449
|
* Button for downloading a csv file
|
|
451
450
|
* @author Gabe Abrams
|
|
452
451
|
*/
|
|
453
452
|
|
|
454
|
-
declare type Props
|
|
453
|
+
declare type Props = {
|
|
455
454
|
filename: string;
|
|
456
455
|
csv: string;
|
|
457
456
|
id?: string;
|
|
@@ -463,98 +462,7 @@ declare type Props$1 = {
|
|
|
463
462
|
onClick?: () => void;
|
|
464
463
|
children?: React.ReactNode;
|
|
465
464
|
};
|
|
466
|
-
declare const CSVDownloadButton: React.FC<Props
|
|
467
|
-
|
|
468
|
-
/**
|
|
469
|
-
* Generic type for an object
|
|
470
|
-
* @author Yuen Ler Chow
|
|
471
|
-
*/
|
|
472
|
-
declare 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
|
-
declare 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
|
-
*/
|
|
540
|
-
|
|
541
|
-
declare type Props = {
|
|
542
|
-
entryFields: DBEntryField[];
|
|
543
|
-
idPropName: string;
|
|
544
|
-
titlePropName: string;
|
|
545
|
-
descriptionPropName: string;
|
|
546
|
-
itemListTitle: string;
|
|
547
|
-
itemName: string;
|
|
548
|
-
validateEntry?: (dbEntry: DBEntry) => Promise<void>;
|
|
549
|
-
modifyEntry?: (dbEntry: DBEntry) => Promise<DBEntry>;
|
|
550
|
-
disableEdit?: boolean;
|
|
551
|
-
collectionName: string;
|
|
552
|
-
adminsOnly?: boolean;
|
|
553
|
-
filterQuery?: {
|
|
554
|
-
[k: string]: any;
|
|
555
|
-
};
|
|
556
|
-
};
|
|
557
|
-
declare const DBEntryManagerPanel: React.FC<Props>;
|
|
465
|
+
declare const CSVDownloadButton: React.FC<Props>;
|
|
558
466
|
|
|
559
467
|
/**
|
|
560
468
|
* An error with a code
|
|
@@ -1158,6 +1066,71 @@ declare const extractProp: (arr: any[], prop: string) => any[];
|
|
|
1158
1066
|
*/
|
|
1159
1067
|
declare const compareArraysByProp: (a: any[], b: any[], prop: string) => boolean;
|
|
1160
1068
|
|
|
1069
|
+
/**
|
|
1070
|
+
* Given an array of strings, create a single comma-separated string that includes
|
|
1071
|
+
* 'and' as well as an oxford comma.
|
|
1072
|
+
* Ex: ['apples'] => 'apples'
|
|
1073
|
+
* Ex: ['apples', 'bananas'] => 'apples and bananas'
|
|
1074
|
+
* Ex: ['apples', 'bananas', 'grapes'] => 'apples, bananas, and grapes'
|
|
1075
|
+
* @author Austen Money
|
|
1076
|
+
* @param list an array of elements to be made into a single comma-separated string.
|
|
1077
|
+
* @returns a comma-separated string.
|
|
1078
|
+
*/
|
|
1079
|
+
declare const genCommaList: (list: string[]) => string;
|
|
1080
|
+
|
|
1081
|
+
/**
|
|
1082
|
+
* Result of a validation function.
|
|
1083
|
+
* @author Austen Money
|
|
1084
|
+
*/
|
|
1085
|
+
declare type ValidationResult<CleanedValueType> = ({
|
|
1086
|
+
isValid: true;
|
|
1087
|
+
cleanedValue: CleanedValueType;
|
|
1088
|
+
} | {
|
|
1089
|
+
isValid: false;
|
|
1090
|
+
errorMessage: string;
|
|
1091
|
+
});
|
|
1092
|
+
|
|
1093
|
+
/**
|
|
1094
|
+
* Determines whether a given email address is valid.
|
|
1095
|
+
* @author Austen Money
|
|
1096
|
+
* @param email email address to validate
|
|
1097
|
+
* @returns whether email fulfills proper formatting requirements, includes a
|
|
1098
|
+
* cleaned version of the address without leading or trailing
|
|
1099
|
+
* whitespace if valid or an error message if invalid.
|
|
1100
|
+
*/
|
|
1101
|
+
declare const validateEmail: (email: string) => ValidationResult<string>;
|
|
1102
|
+
|
|
1103
|
+
/**
|
|
1104
|
+
* Determines whether a given phone number is valid.
|
|
1105
|
+
* @author Austen Money
|
|
1106
|
+
* @param phoneNumber phone number to validate
|
|
1107
|
+
* @returns whether phone number is considered valid - if valid, also returns
|
|
1108
|
+
* a cleaned version of the number without any formatting. If invalid,
|
|
1109
|
+
* returns an error message.
|
|
1110
|
+
*/
|
|
1111
|
+
declare const validatePhoneNumber: (phoneNumber: string) => ValidationResult<string>;
|
|
1112
|
+
|
|
1113
|
+
/**
|
|
1114
|
+
* Determines whether a given input string is considered valid based on
|
|
1115
|
+
* the provided requirements.
|
|
1116
|
+
* @author Austen Money
|
|
1117
|
+
* @param input input string
|
|
1118
|
+
* @param opts options for validation
|
|
1119
|
+
* @returns whether input is considered valid according to reqs - if
|
|
1120
|
+
* valid, returns a cleaned version of input; if invalid, returns
|
|
1121
|
+
* a string containing error messages describing which requirements
|
|
1122
|
+
* were not met.
|
|
1123
|
+
*/
|
|
1124
|
+
declare const validateString: (input: string, opts: {
|
|
1125
|
+
ignoreWhitespace?: boolean;
|
|
1126
|
+
minLen?: number;
|
|
1127
|
+
maxLen?: number;
|
|
1128
|
+
lettersOnly?: boolean;
|
|
1129
|
+
numbersOnly?: boolean;
|
|
1130
|
+
regexTest?: RegExp;
|
|
1131
|
+
regexDescription?: string;
|
|
1132
|
+
}) => ValidationResult<string>;
|
|
1133
|
+
|
|
1161
1134
|
/**
|
|
1162
1135
|
* Get current time info in local time
|
|
1163
1136
|
* @author Gabe Abrams
|
|
@@ -1177,45 +1150,6 @@ declare const getLocalTimeInfo: (dateOrTimestamp?: number | Date | undefined) =>
|
|
|
1177
1150
|
isPM: boolean;
|
|
1178
1151
|
};
|
|
1179
1152
|
|
|
1180
|
-
/**
|
|
1181
|
-
* Interface for a collection in the database
|
|
1182
|
-
* @author Yuen Ler Chow
|
|
1183
|
-
*/
|
|
1184
|
-
interface Collection {
|
|
1185
|
-
/**
|
|
1186
|
-
* Find all items in the collection that match the filter query
|
|
1187
|
-
* @param filterQuery
|
|
1188
|
-
* @returns list of items that match the filter query
|
|
1189
|
-
*/
|
|
1190
|
-
find: (filterQuery: any) => Promise<any[]>;
|
|
1191
|
-
/**
|
|
1192
|
-
* Insert an item into the collection
|
|
1193
|
-
* @param item the item to insert
|
|
1194
|
-
*/
|
|
1195
|
-
insert: (item: any) => Promise<void>;
|
|
1196
|
-
/**
|
|
1197
|
-
* Delete an item in the collection
|
|
1198
|
-
* @param id the id of the item to delete
|
|
1199
|
-
*/
|
|
1200
|
-
delete: (filterQuery: {
|
|
1201
|
-
id: string;
|
|
1202
|
-
}) => Promise<void>;
|
|
1203
|
-
}
|
|
1204
|
-
/**
|
|
1205
|
-
* Add all routes for the DBEditor
|
|
1206
|
-
* @author Yuen Ler Chow
|
|
1207
|
-
* @param opts object containing all arguments
|
|
1208
|
-
* @param opts.app express app to add routes too
|
|
1209
|
-
* @param opts.collectionName the name of the collection
|
|
1210
|
-
* @param opts.adminsOnly true if the endpoint is for admins only
|
|
1211
|
-
*/
|
|
1212
|
-
declare const addDBEditorEndpoints: (opts: {
|
|
1213
|
-
app: express.Application;
|
|
1214
|
-
collectionName: string;
|
|
1215
|
-
adminsOnly: boolean;
|
|
1216
|
-
collection: Collection;
|
|
1217
|
-
}) => void;
|
|
1218
|
-
|
|
1219
1153
|
/**
|
|
1220
1154
|
* List of error codes built into the react kit
|
|
1221
1155
|
* @author Gabe Abrams
|
|
@@ -1266,4 +1200,4 @@ declare const LogBuiltInMetadata: {
|
|
|
1266
1200
|
};
|
|
1267
1201
|
};
|
|
1268
1202
|
|
|
1269
|
-
export { AppWrapper, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS,
|
|
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 };
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dce-reactkit",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.1",
|
|
4
4
|
"description": "Shared components for Harvard DCE apps",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "rm -rf dist && rollup -c",
|
|
10
|
-
"test": "jest"
|
|
10
|
+
"test": "jest --runInBand"
|
|
11
11
|
},
|
|
12
12
|
"jest": {
|
|
13
13
|
"preset": "ts-jest",
|
|
@@ -28,26 +28,25 @@
|
|
|
28
28
|
"@fortawesome/free-solid-svg-icons": "^x.x.x",
|
|
29
29
|
"@fortawesome/react-fontawesome": "^x.x.x",
|
|
30
30
|
"bootstrap": "^5.x.x",
|
|
31
|
-
"react": "^x.x.x"
|
|
32
|
-
"express": "^x.x.x"
|
|
31
|
+
"react": "^x.x.x"
|
|
33
32
|
},
|
|
34
33
|
"devDependencies": {
|
|
35
34
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
36
35
|
"@rollup/plugin-json": "^4.1.0",
|
|
37
36
|
"@rollup/plugin-node-resolve": "^13.2.1",
|
|
38
37
|
"@rollup/plugin-typescript": "^8.3.2",
|
|
39
|
-
"@types/express": "^4.17.17",
|
|
40
38
|
"@types/jest": "^28.1.7",
|
|
39
|
+
"@types/node": "^20.2.5",
|
|
41
40
|
"@types/react": "^17.0.7",
|
|
42
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
43
|
-
"@typescript-eslint/parser": "^5.
|
|
44
|
-
"eslint": "^8.
|
|
41
|
+
"@typescript-eslint/eslint-plugin": "^5.59.9",
|
|
42
|
+
"@typescript-eslint/parser": "^5.59.9",
|
|
43
|
+
"eslint": "^8.42.0",
|
|
45
44
|
"eslint-config-airbnb": "^19.0.4",
|
|
46
45
|
"eslint-config-airbnb-typescript": "^17.0.0",
|
|
47
|
-
"eslint-plugin-import": "^2.
|
|
48
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
49
|
-
"eslint-plugin-react": "^7.
|
|
50
|
-
"eslint-plugin-react-hooks": "^4.
|
|
46
|
+
"eslint-plugin-import": "^2.27.5",
|
|
47
|
+
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
48
|
+
"eslint-plugin-react": "^7.32.2",
|
|
49
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
51
50
|
"jest": "^28.1.3",
|
|
52
51
|
"jest-environment-jsdom": "^28.1.3",
|
|
53
52
|
"raixa": "^1.0.19",
|
|
@@ -55,9 +54,6 @@
|
|
|
55
54
|
"rollup-plugin-dts": "^4.2.1",
|
|
56
55
|
"rollup-plugin-sourcemaps": "^0.6.3",
|
|
57
56
|
"ts-jest": "^28.0.8",
|
|
58
|
-
"typescript": "^4.
|
|
59
|
-
},
|
|
60
|
-
"dependencies": {
|
|
61
|
-
"react-select": "^5.7.3"
|
|
57
|
+
"typescript": "^4.9.5"
|
|
62
58
|
}
|
|
63
|
-
}
|
|
59
|
+
}
|
|
@@ -56,24 +56,32 @@ let storedSendRequest: SendRequestFunction;
|
|
|
56
56
|
* @returns sendRequest function
|
|
57
57
|
*/
|
|
58
58
|
export const getSendRequest = async () => {
|
|
59
|
-
//
|
|
60
|
-
let
|
|
59
|
+
// Track timeout
|
|
60
|
+
let timedOut = false;
|
|
61
61
|
(async () => {
|
|
62
62
|
await waitMs(5000);
|
|
63
|
-
|
|
64
|
-
if (!successful) {
|
|
65
|
-
showFatalError(
|
|
66
|
-
new ErrorWithCode(
|
|
67
|
-
'Could not send a request because the request needed to be sent before dce-reactkit was properly initialized. Perhaps dce-reactkit was not initialized with initClient.',
|
|
68
|
-
ReactKitErrorCode.NoCACCLSendRequestFunction,
|
|
69
|
-
),
|
|
70
|
-
);
|
|
71
|
-
}
|
|
63
|
+
timedOut = true;
|
|
72
64
|
})(),
|
|
73
65
|
|
|
74
66
|
// Wait for initialization
|
|
75
67
|
await initialized;
|
|
76
|
-
|
|
68
|
+
|
|
69
|
+
// Error if no send request function
|
|
70
|
+
if (timedOut) {
|
|
71
|
+
showFatalError(
|
|
72
|
+
new ErrorWithCode(
|
|
73
|
+
'Could not send a request because the request needed to be sent before dce-reactkit was properly initialized. Perhaps dce-reactkit was not initialized with initClient.',
|
|
74
|
+
ReactKitErrorCode.NoCACCLSendRequestFunction,
|
|
75
|
+
),
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
// Return dummy function that never resolves
|
|
79
|
+
return (
|
|
80
|
+
() => {
|
|
81
|
+
return new Promise(() => {});
|
|
82
|
+
}
|
|
83
|
+
) as SendRequestFunction;
|
|
84
|
+
}
|
|
77
85
|
|
|
78
86
|
// Return
|
|
79
87
|
return storedSendRequest;
|
|
@@ -512,7 +512,7 @@ const assertExpectedItemsAreChecked = (
|
|
|
512
512
|
}
|
|
513
513
|
};
|
|
514
514
|
|
|
515
|
-
test(
|
|
515
|
+
test.skip(
|
|
516
516
|
'All Checkboxes appear when initially rendered',
|
|
517
517
|
async () => {
|
|
518
518
|
Raixa.render(
|
|
@@ -530,7 +530,7 @@ test(
|
|
|
530
530
|
},
|
|
531
531
|
);
|
|
532
532
|
|
|
533
|
-
test(
|
|
533
|
+
test.skip(
|
|
534
534
|
'Collapsing item 3 results in only the first 3 items and item 24 showing',
|
|
535
535
|
async () => {
|
|
536
536
|
Raixa.render(
|
|
@@ -555,7 +555,7 @@ test(
|
|
|
555
555
|
},
|
|
556
556
|
);
|
|
557
557
|
|
|
558
|
-
test(
|
|
558
|
+
test.skip(
|
|
559
559
|
'Collapsing item 15 results hides items 16 through 21',
|
|
560
560
|
async () => {
|
|
561
561
|
Raixa.render(
|
|
@@ -580,7 +580,7 @@ test(
|
|
|
580
580
|
},
|
|
581
581
|
);
|
|
582
582
|
|
|
583
|
-
test(
|
|
583
|
+
test.skip(
|
|
584
584
|
'Collapsing item 10 results hides items 11 through 21',
|
|
585
585
|
async () => {
|
|
586
586
|
Raixa.render(
|
|
@@ -605,7 +605,7 @@ test(
|
|
|
605
605
|
},
|
|
606
606
|
);
|
|
607
607
|
|
|
608
|
-
test(
|
|
608
|
+
test.skip(
|
|
609
609
|
'All Checkboxes are unchecked when initially rendered',
|
|
610
610
|
async () => {
|
|
611
611
|
Raixa.render(
|
|
@@ -626,7 +626,7 @@ test(
|
|
|
626
626
|
},
|
|
627
627
|
);
|
|
628
628
|
|
|
629
|
-
test(
|
|
629
|
+
test.skip(
|
|
630
630
|
'Checking item 1 checks items 1',
|
|
631
631
|
async () => {
|
|
632
632
|
let updatedItems: PickableItem[] = [];
|
|
@@ -654,7 +654,7 @@ test(
|
|
|
654
654
|
},
|
|
655
655
|
);
|
|
656
656
|
|
|
657
|
-
test(
|
|
657
|
+
test.skip(
|
|
658
658
|
'Clicking item 1 unchecks items 1',
|
|
659
659
|
async () => {
|
|
660
660
|
let updatedItems: PickableItem[] = [];
|
|
@@ -686,7 +686,7 @@ test(
|
|
|
686
686
|
},
|
|
687
687
|
);
|
|
688
688
|
|
|
689
|
-
test(
|
|
689
|
+
test.skip(
|
|
690
690
|
'Checking item 3 checks items 3 through 23',
|
|
691
691
|
async () => {
|
|
692
692
|
let updatedItems: PickableItem[] = [];
|
|
@@ -720,7 +720,7 @@ test(
|
|
|
720
720
|
},
|
|
721
721
|
);
|
|
722
722
|
|
|
723
|
-
test(
|
|
723
|
+
test.skip(
|
|
724
724
|
'Clicking folder 3 checks unchecks 3 through 23',
|
|
725
725
|
async () => {
|
|
726
726
|
let updatedItems: PickableItem[] = [];
|
|
@@ -750,7 +750,7 @@ test(
|
|
|
750
750
|
},
|
|
751
751
|
);
|
|
752
752
|
|
|
753
|
-
test(
|
|
753
|
+
test.skip(
|
|
754
754
|
'Clicking dashed folder 3 checks 3 through 23',
|
|
755
755
|
async () => {
|
|
756
756
|
let updatedItems: PickableItem[] = [];
|