@teselagen/ui 0.7.32 → 0.7.33-beta.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/AdvancedOptions.js +33 -0
- package/AssignDefaultsModeContext.js +22 -0
- package/DataTable/utils/filterLocalEntitiesToHasura.d.ts +5 -0
- package/DataTable/utils/initializeHasuraWhereAndFilter.d.ts +2 -0
- package/DataTable/utils/queryParams.d.ts +8 -12
- package/DataTable/utils/simplifyHasuraWhere.d.ts +1 -0
- package/DataTable/utils/tableQueryParamsToHasuraClauses.d.ts +14 -0
- package/DropdownButton.js +36 -0
- package/FillWindow.css +6 -0
- package/FillWindow.js +69 -0
- package/{src/DataTable/FilterAndSortMenu.js → FilterAndSortMenu.js} +27 -30
- package/MatchHeaders.js +234 -0
- package/SimpleStepViz.js +22 -0
- package/Tag.js +112 -0
- package/UploadCsvWizard.css +4 -0
- package/UploadCsvWizard.js +719 -0
- package/autoTooltip.js +201 -0
- package/constants.js +1 -0
- package/customIcons.js +361 -0
- package/filterLocalEntitiesToHasura.js +216 -0
- package/index.cjs.js +695 -967
- package/index.d.ts +1 -0
- package/index.es.js +695 -967
- package/initializeHasuraWhereAndFilter.js +27 -0
- package/{src/utils/isBeingCalledExcessively.js → isBeingCalledExcessively.js} +0 -1
- package/package.json +1 -1
- package/queryParams.js +336 -0
- package/rerenderOnWindowResize.js +26 -0
- package/showAppSpinner.js +12 -0
- package/showDialogOnDocBody.js +33 -0
- package/simplifyHasuraWhere.js +80 -0
- package/src/CellDragHandle.js +132 -0
- package/src/ColumnFilterMenu.js +62 -0
- package/src/Columns.js +979 -0
- package/src/DisabledLoadingComponent.js +15 -0
- package/src/DisplayOptions.js +199 -0
- package/src/DropdownCell.js +61 -0
- package/src/EditableCell.js +44 -0
- package/src/FilterAndSortMenu.js +388 -0
- package/src/FormSeparator.js +9 -0
- package/src/LoadingDots.js +14 -0
- package/src/PagingTool.js +225 -0
- package/src/RenderCell.js +191 -0
- package/src/SearchBar.js +69 -0
- package/src/SortableColumns.js +100 -0
- package/src/TableFormTrackerContext.js +10 -0
- package/src/ThComponent.js +44 -0
- package/src/TimelineEvent.js +31 -0
- package/src/Uploader.js +1278 -0
- package/src/adHoc.js +10 -0
- package/src/basicHandleActionsWithFullState.js +14 -0
- package/src/browserUtils.js +3 -0
- package/src/combineReducersWithFullState.js +14 -0
- package/src/commandControls.js +82 -0
- package/src/commandUtils.js +112 -0
- package/src/convertSchema.js +69 -0
- package/src/dataTableEnhancer.js +41 -0
- package/src/defaultFormatters.js +32 -0
- package/src/defaultValidators.js +40 -0
- package/src/determineBlackOrWhiteTextColor.js +4 -0
- package/src/editCellHelper.js +44 -0
- package/src/filterLocalEntitiesToHasura.js +216 -0
- package/src/formatPasteData.js +16 -0
- package/src/getAllRows.js +11 -0
- package/src/getCellCopyText.js +7 -0
- package/src/getCellInfo.js +36 -0
- package/src/getCellVal.js +20 -0
- package/src/getDayjsFormatter.js +35 -0
- package/src/getFieldPathToField.js +7 -0
- package/src/getIdOrCodeOrIndex.js +9 -0
- package/src/getLastSelectedEntity.js +11 -0
- package/src/getNewEntToSelect.js +25 -0
- package/src/getNewName.js +31 -0
- package/src/getRowCopyText.js +28 -0
- package/src/getTableConfigFromStorage.js +5 -0
- package/src/getTextFromEl.js +28 -0
- package/src/getVals.js +8 -0
- package/src/handleCopyColumn.js +21 -0
- package/src/handleCopyHelper.js +15 -0
- package/src/handleCopyRows.js +23 -0
- package/src/handleCopyTable.js +16 -0
- package/src/handlerHelpers.js +24 -0
- package/src/hotkeyUtils.js +131 -0
- package/src/index.js +1 -87
- package/src/initializeHasuraWhereAndFilter.js +27 -0
- package/src/isBeingCalledExcessively.js +24 -0
- package/src/isBottomRightCornerOfRectangle.js +20 -0
- package/src/isEntityClean.js +15 -0
- package/src/isTruthy.js +12 -0
- package/src/isValueEmpty.js +3 -0
- package/src/itemUpload.js +84 -0
- package/src/menuUtils.js +433 -0
- package/src/popoverOverflowModifiers.js +11 -0
- package/src/primarySelectedValue.js +1 -0
- package/src/pureNoFunc.js +31 -0
- package/src/queryParams.js +336 -0
- package/src/removeCleanRows.js +22 -0
- package/src/renderOnDoc.js +32 -0
- package/src/rowClick.js +181 -0
- package/src/selection.js +8 -0
- package/src/showProgressToast.js +22 -0
- package/src/simplifyHasuraWhere.js +80 -0
- package/src/sortify.js +73 -0
- package/src/style.css +24 -260
- package/src/tableQueryParamsToHasuraClauses.js +113 -0
- package/src/{DataTable/utils/withTableParams.js → withTableParams.js} +1 -14
- package/tableQueryParamsToHasuraClauses.js +113 -0
- package/tagUtils.js +45 -0
- package/tgFormValues.js +35 -0
- package/tg_modalState.js +47 -0
- package/throwFormError.js +16 -0
- package/toastr.js +148 -0
- package/tryToMatchSchemas.js +264 -0
- package/typeToCommonType.js +6 -0
- package/useDeepEqualMemo.js +15 -0
- package/useDialog.js +63 -0
- package/useStableReference.js +9 -0
- package/useTableEntities.js +38 -0
- package/useTraceUpdate.js +19 -0
- package/utils.js +37 -0
- package/validateTableWideErrors.js +160 -0
- package/viewColumn.js +97 -0
- package/withField.js +20 -0
- package/withFields.js +11 -0
- package/withLocalStorage.js +11 -0
- package/withSelectTableRecords.js +43 -0
- package/withSelectedEntities.js +65 -0
- package/withStore.js +10 -0
- package/withTableParams.js +288 -0
- package/wrapDialog.js +116 -0
- package/src/AdvancedOptions.spec.js +0 -26
- package/src/AsyncValidateFieldSpinner/index.js +0 -12
- package/src/BlueprintError/index.js +0 -14
- package/src/BounceLoader/index.js +0 -16
- package/src/BounceLoader/style.css +0 -45
- package/src/CollapsibleCard/index.js +0 -68
- package/src/CollapsibleCard/style.css +0 -23
- package/src/DNALoader/index.js +0 -20
- package/src/DNALoader/style.css +0 -251
- package/src/DataTable/index.js +0 -3213
- package/src/DataTable/style.css +0 -608
- package/src/DataTable/utils/index.js +0 -55
- package/src/DataTable/utils/queryParams.js +0 -1058
- package/src/DialogFooter/index.js +0 -86
- package/src/DialogFooter/style.css +0 -9
- package/src/FormComponents/index.js +0 -1266
- package/src/FormComponents/style.css +0 -275
- package/src/FormComponents/utils.js +0 -6
- package/src/HotkeysDialog/index.js +0 -79
- package/src/HotkeysDialog/style.css +0 -54
- package/src/InfoHelper/index.js +0 -78
- package/src/InfoHelper/style.css +0 -7
- package/src/IntentText/index.js +0 -18
- package/src/Loading/index.js +0 -70
- package/src/Loading/style.css +0 -4
- package/src/MenuBar/index.js +0 -423
- package/src/MenuBar/style.css +0 -45
- package/src/PromptUnsavedChanges/index.js +0 -38
- package/src/ResizableDraggableDialog/index.js +0 -141
- package/src/ResizableDraggableDialog/style.css +0 -42
- package/src/ScrollToTop/index.js +0 -72
- package/src/TagSelect/index.js +0 -69
- package/src/TagSelect/style.css +0 -13
- package/src/TgHtmlSelect/index.js +0 -20
- package/src/TgSelect/index.js +0 -537
- package/src/TgSelect/style.css +0 -61
- package/src/TgSuggest/index.js +0 -124
- package/src/Timeline/index.js +0 -15
- package/src/enhancers/withDialog/index.js +0 -196
- package/src/showConfirmationDialog/index.js +0 -148
- /package/{src/DataTable/CellDragHandle.js → CellDragHandle.js} +0 -0
- /package/{src/DataTable/ColumnFilterMenu.js → ColumnFilterMenu.js} +0 -0
- /package/{src/DataTable/Columns.js → Columns.js} +0 -0
- /package/{src/DataTable/DisabledLoadingComponent.js → DisabledLoadingComponent.js} +0 -0
- /package/{src/DataTable/DisplayOptions.js → DisplayOptions.js} +0 -0
- /package/{src/DataTable/DropdownCell.js → DropdownCell.js} +0 -0
- /package/{src/DataTable/EditableCell.js → EditableCell.js} +0 -0
- /package/{src/FormComponents/FormSeparator.js → FormSeparator.js} +0 -0
- /package/{src/FormComponents/LoadingDots.js → LoadingDots.js} +0 -0
- /package/{src/DataTable/PagingTool.js → PagingTool.js} +0 -0
- /package/{src/DataTable/RenderCell.js → RenderCell.js} +0 -0
- /package/{src/DataTable/SearchBar.js → SearchBar.js} +0 -0
- /package/{src/DataTable/SortableColumns.js → SortableColumns.js} +0 -0
- /package/{src/DataTable/TableFormTrackerContext.js → TableFormTrackerContext.js} +0 -0
- /package/{src/DataTable/ThComponent.js → ThComponent.js} +0 -0
- /package/{src/Timeline/TimelineEvent.js → TimelineEvent.js} +0 -0
- /package/{src/FormComponents/Uploader.js → Uploader.js} +0 -0
- /package/{src/utils/adHoc.js → adHoc.js} +0 -0
- /package/{src/utils/basicHandleActionsWithFullState.js → basicHandleActionsWithFullState.js} +0 -0
- /package/{src/utils/browserUtils.js → browserUtils.js} +0 -0
- /package/{src/utils/combineReducersWithFullState.js → combineReducersWithFullState.js} +0 -0
- /package/{src/utils/commandControls.js → commandControls.js} +0 -0
- /package/{src/utils/commandUtils.js → commandUtils.js} +0 -0
- /package/{src/DataTable/utils/convertSchema.js → convertSchema.js} +0 -0
- /package/{src/DataTable/dataTableEnhancer.js → dataTableEnhancer.js} +0 -0
- /package/{src/DataTable/defaultFormatters.js → defaultFormatters.js} +0 -0
- /package/{src/DataTable/defaultValidators.js → defaultValidators.js} +0 -0
- /package/{src/utils/determineBlackOrWhiteTextColor.js → determineBlackOrWhiteTextColor.js} +0 -0
- /package/{src/DataTable/editCellHelper.js → editCellHelper.js} +0 -0
- /package/{src/DataTable/utils/formatPasteData.js → formatPasteData.js} +0 -0
- /package/{src/DataTable/utils/getAllRows.js → getAllRows.js} +0 -0
- /package/{src/DataTable/utils/getCellCopyText.js → getCellCopyText.js} +0 -0
- /package/{src/DataTable/utils/getCellInfo.js → getCellInfo.js} +0 -0
- /package/{src/DataTable/getCellVal.js → getCellVal.js} +0 -0
- /package/{src/utils/getDayjsFormatter.js → getDayjsFormatter.js} +0 -0
- /package/{src/DataTable/utils/getFieldPathToField.js → getFieldPathToField.js} +0 -0
- /package/{src/DataTable/utils/getIdOrCodeOrIndex.js → getIdOrCodeOrIndex.js} +0 -0
- /package/{src/DataTable/utils/getLastSelectedEntity.js → getLastSelectedEntity.js} +0 -0
- /package/{src/DataTable/utils/getNewEntToSelect.js → getNewEntToSelect.js} +0 -0
- /package/{src/FormComponents/getNewName.js → getNewName.js} +0 -0
- /package/{src/DataTable/utils/getRowCopyText.js → getRowCopyText.js} +0 -0
- /package/{src/DataTable/utils/getTableConfigFromStorage.js → getTableConfigFromStorage.js} +0 -0
- /package/{src/utils/getTextFromEl.js → getTextFromEl.js} +0 -0
- /package/{src/DataTable/getVals.js → getVals.js} +0 -0
- /package/{src/DataTable/utils/handleCopyColumn.js → handleCopyColumn.js} +0 -0
- /package/{src/DataTable/utils/handleCopyHelper.js → handleCopyHelper.js} +0 -0
- /package/{src/DataTable/utils/handleCopyRows.js → handleCopyRows.js} +0 -0
- /package/{src/DataTable/utils/handleCopyTable.js → handleCopyTable.js} +0 -0
- /package/{src/utils/handlerHelpers.js → handlerHelpers.js} +0 -0
- /package/{src/utils/hotkeyUtils.js → hotkeyUtils.js} +0 -0
- /package/{src/utils/hooks/index.js → index.js} +0 -0
- /package/{src/DataTable/utils/isBottomRightCornerOfRectangle.js → isBottomRightCornerOfRectangle.js} +0 -0
- /package/{src/DataTable/utils/isEntityClean.js → isEntityClean.js} +0 -0
- /package/{src/DataTable/isTruthy.js → isTruthy.js} +0 -0
- /package/{src/DataTable/isValueEmpty.js → isValueEmpty.js} +0 -0
- /package/{src/FormComponents/itemUpload.js → itemUpload.js} +0 -0
- /package/{src/utils/menuUtils.js → menuUtils.js} +0 -0
- /package/{src/utils/popoverOverflowModifiers.js → popoverOverflowModifiers.js} +0 -0
- /package/{src/DataTable/utils/primarySelectedValue.js → primarySelectedValue.js} +0 -0
- /package/{src/utils/pureNoFunc.js → pureNoFunc.js} +0 -0
- /package/{src/DataTable/utils/removeCleanRows.js → removeCleanRows.js} +0 -0
- /package/{src/utils/renderOnDoc.js → renderOnDoc.js} +0 -0
- /package/{src/DataTable/utils/rowClick.js → rowClick.js} +0 -0
- /package/{src/DataTable/utils/selection.js → selection.js} +0 -0
- /package/{src/utils/showProgressToast.js → showProgressToast.js} +0 -0
- /package/{src/FormComponents/sortify.js → sortify.js} +0 -0
- /package/src/{utils/tagUtils.js → tagUtils.js} +0 -0
- /package/src/{utils/tgFormValues.js → tgFormValues.js} +0 -0
- /package/src/{enhancers/withDialog/tg_modalState.js → tg_modalState.js} +0 -0
- /package/src/{FormComponents/tryToMatchSchemas.js → tryToMatchSchemas.js} +0 -0
- /package/src/{utils/hooks/useDeepEqualMemo.js → useDeepEqualMemo.js} +0 -0
- /package/src/{utils/hooks/useStableReference.js → useStableReference.js} +0 -0
- /package/src/{DataTable/utils/useTableEntities.js → useTableEntities.js} +0 -0
- /package/src/{utils/useTraceUpdate.js → useTraceUpdate.js} +0 -0
- /package/src/{DataTable/utils/utils.js → utils.js} +0 -0
- /package/src/{DataTable/validateTableWideErrors.js → validateTableWideErrors.js} +0 -0
- /package/src/{DataTable/viewColumn.js → viewColumn.js} +0 -0
- /package/src/{enhancers/withField.js → withField.js} +0 -0
- /package/src/{enhancers/withFields.js → withFields.js} +0 -0
- /package/src/{enhancers/withLocalStorage.js → withLocalStorage.js} +0 -0
- /package/src/{utils/withSelectTableRecords.js → withSelectTableRecords.js} +0 -0
- /package/src/{DataTable/utils/withSelectedEntities.js → withSelectedEntities.js} +0 -0
- /package/src/{utils/withStore.js → withStore.js} +0 -0
- /package/{src/Timeline/style.css → style.css} +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { Icon } from "@blueprintjs/core";
|
|
3
|
+
|
|
4
|
+
export default function AdvancedOptions({
|
|
5
|
+
children,
|
|
6
|
+
content,
|
|
7
|
+
label,
|
|
8
|
+
style,
|
|
9
|
+
isOpenByDefault
|
|
10
|
+
}) {
|
|
11
|
+
const [isOpen, setOpen] = useState(isOpenByDefault);
|
|
12
|
+
if (!(content || children)) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return (
|
|
16
|
+
<div style={{ marginTop: 5, ...style }}>
|
|
17
|
+
<div
|
|
18
|
+
onClick={() => {
|
|
19
|
+
setOpen(!isOpen);
|
|
20
|
+
}}
|
|
21
|
+
style={{ cursor: "pointer", display: "flex", alignItems: "flex-end" }}
|
|
22
|
+
className="tg-toggle-advanced-options"
|
|
23
|
+
>
|
|
24
|
+
{label || "Advanced"}{" "}
|
|
25
|
+
<Icon
|
|
26
|
+
icon={isOpen ? "caret-down" : "caret-right"}
|
|
27
|
+
style={{ marginLeft: 5 }}
|
|
28
|
+
></Icon>
|
|
29
|
+
</div>
|
|
30
|
+
{isOpen && <div style={{ marginTop: 10 }}>{content || children}</div>}
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export const AssignDefaultsModeContext = React.createContext({
|
|
4
|
+
inAssignDefaultsMode: false,
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
6
|
+
setAssignDefaultsMode: () => {}
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const workflowDefaultParamsObj = {
|
|
10
|
+
taskNumber: undefined,
|
|
11
|
+
workflowDefinitionName: undefined,
|
|
12
|
+
workflowDefinitionId: undefined,
|
|
13
|
+
workflowRunName: undefined,
|
|
14
|
+
workflowRunId: undefined,
|
|
15
|
+
toolName: undefined,
|
|
16
|
+
workflowToolTitle: undefined,
|
|
17
|
+
workflowToolDefinitionId: undefined,
|
|
18
|
+
workflowTaskCode: undefined
|
|
19
|
+
};
|
|
20
|
+
export const WorkflowDefaultParamsContext = React.createContext(
|
|
21
|
+
workflowDefaultParamsObj
|
|
22
|
+
);
|
|
@@ -25,31 +25,27 @@ export function makeDataTableHandlers({ setNewParams, defaults, onlyOneFilter }:
|
|
|
25
25
|
setOrder: (order: any, isRemove: any, shiftHeld: any) => any;
|
|
26
26
|
setNewParams: any;
|
|
27
27
|
};
|
|
28
|
-
export function getQueryParams({ currentParams,
|
|
28
|
+
export function getQueryParams({ currentParams, defaults, schema, isInfinite, entities, isLocalCall, additionalFilter, doNotCoercePageSize, ownProps }: {
|
|
29
29
|
currentParams: any;
|
|
30
|
-
urlConnected: any;
|
|
31
30
|
defaults: any;
|
|
32
31
|
schema: any;
|
|
33
32
|
isInfinite: any;
|
|
34
33
|
entities: any;
|
|
35
34
|
isLocalCall: any;
|
|
36
35
|
additionalFilter: any;
|
|
37
|
-
additionalOrFilter: any;
|
|
38
36
|
doNotCoercePageSize: any;
|
|
39
|
-
noOrderError: any;
|
|
40
|
-
isCodeModel: any;
|
|
41
37
|
ownProps: any;
|
|
42
38
|
}): {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
filters: any;
|
|
47
|
-
searchTerm: any;
|
|
39
|
+
entities: any[];
|
|
40
|
+
entitiesAcrossPages: any[];
|
|
41
|
+
entityCount: number;
|
|
48
42
|
} | {
|
|
49
43
|
variables: {
|
|
50
|
-
|
|
44
|
+
where: {};
|
|
45
|
+
order_by: {};
|
|
46
|
+
limit: any;
|
|
47
|
+
offset: number;
|
|
51
48
|
};
|
|
52
|
-
errorParsingUrlString: unknown;
|
|
53
49
|
page: any;
|
|
54
50
|
pageSize: any;
|
|
55
51
|
order: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function simplifyHasuraWhere(whereClause: any): {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function tableQueryParamsToHasuraClauses({ page, pageSize, searchTerm, filters, order, schema, additionalFilter }: {
|
|
2
|
+
page: any;
|
|
3
|
+
pageSize: any;
|
|
4
|
+
searchTerm: any;
|
|
5
|
+
filters: any;
|
|
6
|
+
order: any;
|
|
7
|
+
schema: any;
|
|
8
|
+
additionalFilter: any;
|
|
9
|
+
}): {
|
|
10
|
+
where: {};
|
|
11
|
+
order_by: {};
|
|
12
|
+
limit: any;
|
|
13
|
+
offset: number;
|
|
14
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* Copyright (C) 2018 TeselaGen Biotechnology, Inc. */
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Button, Popover, Position } from "@blueprintjs/core";
|
|
5
|
+
import classnames from "classnames";
|
|
6
|
+
import popoverOverflowModifiers from "./utils/popoverOverflowModifiers";
|
|
7
|
+
|
|
8
|
+
function DropdownButton({
|
|
9
|
+
disabled,
|
|
10
|
+
menu,
|
|
11
|
+
noRightIcon,
|
|
12
|
+
popoverProps,
|
|
13
|
+
className,
|
|
14
|
+
...rest
|
|
15
|
+
}) {
|
|
16
|
+
return (
|
|
17
|
+
<Popover
|
|
18
|
+
minimal
|
|
19
|
+
modifiers={popoverOverflowModifiers}
|
|
20
|
+
disabled={disabled}
|
|
21
|
+
autoFocus={false}
|
|
22
|
+
content={menu}
|
|
23
|
+
position={Position.BOTTOM_LEFT}
|
|
24
|
+
{...popoverProps}
|
|
25
|
+
>
|
|
26
|
+
<Button
|
|
27
|
+
disabled={disabled}
|
|
28
|
+
className={classnames(className, "dropdown-button")}
|
|
29
|
+
rightIcon={noRightIcon ? undefined : "caret-down"}
|
|
30
|
+
{...rest}
|
|
31
|
+
/>
|
|
32
|
+
</Popover>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default DropdownButton;
|
package/FillWindow.css
ADDED
package/FillWindow.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { createPortal } from "react-dom";
|
|
3
|
+
import { isFunction } from "lodash-es";
|
|
4
|
+
import rerenderOnWindowResize from "./rerenderOnWindowResize";
|
|
5
|
+
import "./FillWindow.css";
|
|
6
|
+
|
|
7
|
+
// use like:
|
|
8
|
+
// <FillWindow>
|
|
9
|
+
// {({ width, height }) => {
|
|
10
|
+
// return <div style={{width, height}}></div>
|
|
11
|
+
// }
|
|
12
|
+
// <FillWindow/>
|
|
13
|
+
|
|
14
|
+
export default class FillWindow extends React.Component {
|
|
15
|
+
constructor(props) {
|
|
16
|
+
super(props);
|
|
17
|
+
rerenderOnWindowResize(this);
|
|
18
|
+
}
|
|
19
|
+
// this is left here for posterity. componentDidMount didn't work before commit ee1853a5ae2e6e27b720dd225650cc2154076db5 "fixing rerenderOnWindowResize to bind this keyword correctly"
|
|
20
|
+
// componentDidMount(){
|
|
21
|
+
// this.setState({thomas: "realCool"})
|
|
22
|
+
// }
|
|
23
|
+
|
|
24
|
+
render() {
|
|
25
|
+
const w = window,
|
|
26
|
+
d = document,
|
|
27
|
+
e = d.documentElement,
|
|
28
|
+
g = d.getElementsByTagName("body")[0],
|
|
29
|
+
width = w.innerWidth || e.clientWidth || g.clientWidth,
|
|
30
|
+
height = w.innerHeight || e.clientHeight || g.clientHeight;
|
|
31
|
+
const windowDimensions = {
|
|
32
|
+
width,
|
|
33
|
+
height
|
|
34
|
+
};
|
|
35
|
+
const {
|
|
36
|
+
containerStyle = {},
|
|
37
|
+
style,
|
|
38
|
+
styleOverrides,
|
|
39
|
+
className,
|
|
40
|
+
asPortal,
|
|
41
|
+
...rest
|
|
42
|
+
} = this.props;
|
|
43
|
+
if (this.props.disabled) return this.props.children(windowDimensions);
|
|
44
|
+
const inner = (
|
|
45
|
+
<div
|
|
46
|
+
className={
|
|
47
|
+
"tg-fillWindow " + (asPortal ? "bp3-portal " : "") + (className || "")
|
|
48
|
+
}
|
|
49
|
+
style={{
|
|
50
|
+
...style,
|
|
51
|
+
width,
|
|
52
|
+
height,
|
|
53
|
+
position: "fixed",
|
|
54
|
+
top: 0,
|
|
55
|
+
left: 0,
|
|
56
|
+
...containerStyle,
|
|
57
|
+
...styleOverrides
|
|
58
|
+
}}
|
|
59
|
+
{...rest}
|
|
60
|
+
>
|
|
61
|
+
{this.props.children && isFunction(this.props.children)
|
|
62
|
+
? this.props.children(windowDimensions)
|
|
63
|
+
: this.props.children}
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
if (asPortal) return createPortal(inner, window.document.body);
|
|
67
|
+
return inner;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { DateInput, DateRangeInput } from "@blueprintjs/datetime";
|
|
3
|
-
import { camelCase } from "lodash-es";
|
|
3
|
+
import { camelCase, startCase } from "lodash-es";
|
|
4
4
|
import classNames from "classnames";
|
|
5
5
|
import {
|
|
6
6
|
Menu,
|
|
@@ -349,43 +349,40 @@ function getFilterMenuItems(dataType) {
|
|
|
349
349
|
let filterMenuItems = [];
|
|
350
350
|
if (dataType === "string") {
|
|
351
351
|
filterMenuItems = [
|
|
352
|
-
"
|
|
353
|
-
"
|
|
354
|
-
"
|
|
355
|
-
"
|
|
356
|
-
"
|
|
357
|
-
"
|
|
358
|
-
"
|
|
359
|
-
"
|
|
360
|
-
"
|
|
361
|
-
"
|
|
352
|
+
"contains",
|
|
353
|
+
"notContains",
|
|
354
|
+
"startsWith",
|
|
355
|
+
"endsWith",
|
|
356
|
+
"isExactly",
|
|
357
|
+
"regex",
|
|
358
|
+
"inList",
|
|
359
|
+
"notInList",
|
|
360
|
+
"isEmpty",
|
|
361
|
+
"notEmpty"
|
|
362
362
|
];
|
|
363
363
|
} else if (dataType === "lookup") {
|
|
364
364
|
filterMenuItems = [
|
|
365
|
-
"
|
|
366
|
-
"
|
|
367
|
-
"
|
|
368
|
-
"
|
|
369
|
-
"
|
|
370
|
-
"
|
|
365
|
+
"contains",
|
|
366
|
+
"notContains",
|
|
367
|
+
"startsWith",
|
|
368
|
+
"endsWith",
|
|
369
|
+
"isExactly",
|
|
370
|
+
"regex"
|
|
371
371
|
];
|
|
372
372
|
} else if (dataType === "boolean") {
|
|
373
|
-
filterMenuItems = ["
|
|
373
|
+
filterMenuItems = ["true", "false"];
|
|
374
374
|
} else if (dataType === "number" || dataType === "integer") {
|
|
375
|
-
// else if (dataType === "lookup") {
|
|
376
|
-
// filterMenuItems = ["None"];
|
|
377
|
-
// }
|
|
378
375
|
filterMenuItems = [
|
|
379
|
-
"
|
|
380
|
-
"
|
|
381
|
-
"
|
|
382
|
-
"
|
|
383
|
-
"
|
|
384
|
-
"
|
|
385
|
-
"
|
|
376
|
+
"greaterThan",
|
|
377
|
+
"lessThan",
|
|
378
|
+
"inRange",
|
|
379
|
+
"outsideRange",
|
|
380
|
+
"equalTo",
|
|
381
|
+
"inList",
|
|
382
|
+
"notInList"
|
|
386
383
|
];
|
|
387
384
|
} else if (dataType === "timestamp") {
|
|
388
|
-
filterMenuItems = ["
|
|
385
|
+
filterMenuItems = ["isBetween", "notBetween", "isBefore", "isAfter"];
|
|
389
386
|
}
|
|
390
|
-
return filterMenuItems;
|
|
387
|
+
return filterMenuItems.map(item => startCase(item));
|
|
391
388
|
}
|
package/MatchHeaders.js
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { Callout, Card, Intent } from "@blueprintjs/core";
|
|
3
|
+
import immer, { setAutoFreeze } from "immer";
|
|
4
|
+
import { flatMap, forEach } from "lodash-es";
|
|
5
|
+
import { ReactSelectField } from "./FormComponents";
|
|
6
|
+
import showConfirmationDialog from "./showConfirmationDialog";
|
|
7
|
+
import { startCase } from "lodash-es";
|
|
8
|
+
import { typeToCommonType } from "./typeToCommonType";
|
|
9
|
+
import { camelCase } from "lodash-es";
|
|
10
|
+
import { change } from "redux-form";
|
|
11
|
+
import { useDispatch } from "react-redux";
|
|
12
|
+
|
|
13
|
+
setAutoFreeze(false);
|
|
14
|
+
export const MatchHeaders = ({
|
|
15
|
+
csvValidationIssue,
|
|
16
|
+
datatableFormName,
|
|
17
|
+
datatableFormNames: _datatableFormNames,
|
|
18
|
+
doAllFilesHaveSameHeaders,
|
|
19
|
+
fileIndex,
|
|
20
|
+
filesWIssues,
|
|
21
|
+
ignoredHeadersMsg,
|
|
22
|
+
matchedHeaders,
|
|
23
|
+
onMultiFileUploadSubmit,
|
|
24
|
+
reduxFormEntitiesArray,
|
|
25
|
+
searchResults,
|
|
26
|
+
setFilesWIssues,
|
|
27
|
+
userSchema
|
|
28
|
+
}) => {
|
|
29
|
+
const datatableFormNames = _datatableFormNames || [datatableFormName];
|
|
30
|
+
const dispatch = useDispatch();
|
|
31
|
+
const flippedMatchedHeaders = useMemo(() => {
|
|
32
|
+
const _flippedMatchedHeaders = {};
|
|
33
|
+
forEach(matchedHeaders, (v, k) => {
|
|
34
|
+
if (v) _flippedMatchedHeaders[v] = k;
|
|
35
|
+
});
|
|
36
|
+
return _flippedMatchedHeaders;
|
|
37
|
+
}, [matchedHeaders]);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div style={{ maxWidth: 500 }}>
|
|
41
|
+
{!onMultiFileUploadSubmit && (
|
|
42
|
+
<Callout style={{ width: "fit-content" }} intent="warning">
|
|
43
|
+
{csvValidationIssue}
|
|
44
|
+
</Callout>
|
|
45
|
+
)}
|
|
46
|
+
{!onMultiFileUploadSubmit && ignoredHeadersMsg && (
|
|
47
|
+
<Callout style={{ width: "fit-content" }} intent="warning">
|
|
48
|
+
{ignoredHeadersMsg}
|
|
49
|
+
</Callout>
|
|
50
|
+
)}
|
|
51
|
+
<br />
|
|
52
|
+
<tr
|
|
53
|
+
style={{
|
|
54
|
+
display: "flex",
|
|
55
|
+
minHeight: 50,
|
|
56
|
+
alignItems: "center",
|
|
57
|
+
justifyContent: "space-between"
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
<td
|
|
61
|
+
style={{
|
|
62
|
+
width: 200,
|
|
63
|
+
marginLeft: 20,
|
|
64
|
+
display: "flex",
|
|
65
|
+
fontWeight: "bold"
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
Accepted Headers
|
|
69
|
+
</td>
|
|
70
|
+
<td
|
|
71
|
+
style={{
|
|
72
|
+
width: 200,
|
|
73
|
+
marginLeft: 20,
|
|
74
|
+
display: "flex",
|
|
75
|
+
fontWeight: "bold"
|
|
76
|
+
}}
|
|
77
|
+
>
|
|
78
|
+
Your Headers
|
|
79
|
+
</td>
|
|
80
|
+
<td
|
|
81
|
+
style={{
|
|
82
|
+
fontWeight: "bold",
|
|
83
|
+
marginLeft: 30
|
|
84
|
+
}}
|
|
85
|
+
>
|
|
86
|
+
Data Preview
|
|
87
|
+
</td>
|
|
88
|
+
</tr>
|
|
89
|
+
{searchResults.map(({ path, displayName, type }, i) => {
|
|
90
|
+
const userMatchedHeader = matchedHeaders[path];
|
|
91
|
+
const opts = flatMap(userSchema.fields, ({ path: pathInner }) => {
|
|
92
|
+
if (
|
|
93
|
+
pathInner !== userMatchedHeader &&
|
|
94
|
+
flippedMatchedHeaders[pathInner]
|
|
95
|
+
) {
|
|
96
|
+
return [];
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
value: pathInner,
|
|
100
|
+
label: pathInner
|
|
101
|
+
};
|
|
102
|
+
}).sort((a, b) => {
|
|
103
|
+
const ra = searchResults[i].matches
|
|
104
|
+
.map(m => m.item.path)
|
|
105
|
+
.indexOf(a.value);
|
|
106
|
+
const rb = searchResults[i].matches
|
|
107
|
+
.map(m => m.item.path)
|
|
108
|
+
.indexOf(b.value);
|
|
109
|
+
if (!ra) return -1;
|
|
110
|
+
if (!rb) return 1;
|
|
111
|
+
return rb - ra;
|
|
112
|
+
});
|
|
113
|
+
return (
|
|
114
|
+
<Card style={{ padding: 2 }} key={`field-${i}`}>
|
|
115
|
+
<table>
|
|
116
|
+
<tbody>
|
|
117
|
+
<tr
|
|
118
|
+
style={{
|
|
119
|
+
display: "flex",
|
|
120
|
+
minHeight: 50,
|
|
121
|
+
alignItems: "center",
|
|
122
|
+
justifyContent: "space-between"
|
|
123
|
+
}}
|
|
124
|
+
>
|
|
125
|
+
<td
|
|
126
|
+
style={{
|
|
127
|
+
width: 200,
|
|
128
|
+
display: "flex"
|
|
129
|
+
}}
|
|
130
|
+
>
|
|
131
|
+
<div
|
|
132
|
+
style={{
|
|
133
|
+
paddingTop: 2,
|
|
134
|
+
marginLeft: 15,
|
|
135
|
+
fontSize: 15
|
|
136
|
+
}}
|
|
137
|
+
>
|
|
138
|
+
<span
|
|
139
|
+
data-tip={`Column Type: ${
|
|
140
|
+
typeToCommonType[type || "string"] || type
|
|
141
|
+
}`}
|
|
142
|
+
>
|
|
143
|
+
{displayName || startCase(camelCase(path))}
|
|
144
|
+
</span>
|
|
145
|
+
</div>
|
|
146
|
+
</td>
|
|
147
|
+
<td style={{ width: 200 }}>
|
|
148
|
+
<ReactSelectField
|
|
149
|
+
noMarginBottom
|
|
150
|
+
tooltipError
|
|
151
|
+
beforeOnChange={async () => {
|
|
152
|
+
const clearEntities = () => {
|
|
153
|
+
datatableFormNames.forEach(name => {
|
|
154
|
+
dispatch(change(name, "reduxFormEntities", null));
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
if (reduxFormEntitiesArray.some(r => r?.isDirty)) {
|
|
158
|
+
//when the column mapping changes, update the column in reduxFormEntities (if reduxFormEntities exists)
|
|
159
|
+
const doAction = await showConfirmationDialog({
|
|
160
|
+
text: "Are you sure you want to edit the columm mapping? This will clear any changes you've already made to the table data",
|
|
161
|
+
intent: Intent.DANGER,
|
|
162
|
+
confirmButtonText: "Yes",
|
|
163
|
+
cancelButtonText: "No"
|
|
164
|
+
// canEscapeKeyCancel: true //this is false by default
|
|
165
|
+
});
|
|
166
|
+
if (doAction) {
|
|
167
|
+
clearEntities();
|
|
168
|
+
} else {
|
|
169
|
+
return { stopEarly: true };
|
|
170
|
+
}
|
|
171
|
+
} else {
|
|
172
|
+
clearEntities();
|
|
173
|
+
return { stopEarly: false };
|
|
174
|
+
}
|
|
175
|
+
}}
|
|
176
|
+
onChange={val => {
|
|
177
|
+
setFilesWIssues(
|
|
178
|
+
immer(filesWIssues, files => {
|
|
179
|
+
files.forEach((f, i) => {
|
|
180
|
+
const isCurrentFile = fileIndex === i;
|
|
181
|
+
if (isCurrentFile || doAllFilesHaveSameHeaders) {
|
|
182
|
+
f.matchedHeaders[path] = val;
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
})
|
|
186
|
+
);
|
|
187
|
+
}}
|
|
188
|
+
name={path}
|
|
189
|
+
// isRequired={!allowEmpty && defaultValue === undefined}
|
|
190
|
+
defaultValue={userMatchedHeader}
|
|
191
|
+
options={opts}
|
|
192
|
+
/>
|
|
193
|
+
</td>
|
|
194
|
+
<td
|
|
195
|
+
style={{
|
|
196
|
+
marginTop: 10,
|
|
197
|
+
marginBottom: 10,
|
|
198
|
+
marginLeft: 20,
|
|
199
|
+
fontSize: 10 /* color: Colors.RED1 */
|
|
200
|
+
}}
|
|
201
|
+
>
|
|
202
|
+
{userMatchedHeader &&
|
|
203
|
+
[
|
|
204
|
+
// { [userMatchedHeader]: "Preview:" },
|
|
205
|
+
...(userSchema.userData?.slice(0, 3) || [])
|
|
206
|
+
// { [userMatchedHeader]: "..." }
|
|
207
|
+
].map((row, i) => {
|
|
208
|
+
return (
|
|
209
|
+
<div
|
|
210
|
+
style={{
|
|
211
|
+
maxWidth: 70,
|
|
212
|
+
overflow: "hidden",
|
|
213
|
+
textOverflow: "ellipsis",
|
|
214
|
+
whiteSpace: "nowrap"
|
|
215
|
+
}}
|
|
216
|
+
key={`userMatchedHeader-${i}`}
|
|
217
|
+
>
|
|
218
|
+
{row?.[userMatchedHeader] || ""}
|
|
219
|
+
</div>
|
|
220
|
+
);
|
|
221
|
+
})}
|
|
222
|
+
{/* {!allowEmpty &&
|
|
223
|
+
defaultValue === undefined &&
|
|
224
|
+
"(Required)"} */}
|
|
225
|
+
</td>
|
|
226
|
+
</tr>
|
|
227
|
+
</tbody>
|
|
228
|
+
</table>
|
|
229
|
+
</Card>
|
|
230
|
+
);
|
|
231
|
+
})}
|
|
232
|
+
</div>
|
|
233
|
+
);
|
|
234
|
+
};
|
package/SimpleStepViz.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Icon } from "@blueprintjs/core";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
|
|
5
|
+
export default ({ steps, ...rest }) => (
|
|
6
|
+
<div style={{ display: "flex", justifyContent: "center" }}>
|
|
7
|
+
<ul className="bp3-breadcrumbs" {...rest}>
|
|
8
|
+
{steps.map(({ completed, active, text }, i) => (
|
|
9
|
+
<li key={i}>
|
|
10
|
+
<div
|
|
11
|
+
className={classNames("bp3-breadcrumb", {
|
|
12
|
+
"bp3-breadcrumb-current": active
|
|
13
|
+
})}
|
|
14
|
+
>
|
|
15
|
+
<Icon icon={completed ? "tick-circle" : undefined} />
|
|
16
|
+
{text}
|
|
17
|
+
</div>
|
|
18
|
+
</li>
|
|
19
|
+
))}
|
|
20
|
+
</ul>
|
|
21
|
+
</div>
|
|
22
|
+
);
|
package/Tag.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/* Copyright (C) 2018 TeselaGen Biotechnology, Inc. */
|
|
2
|
+
import React from "react";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import "./style.css";
|
|
5
|
+
import { Tooltip } from "@blueprintjs/core";
|
|
6
|
+
import { getTagColorStyle } from "./utils/tagUtils";
|
|
7
|
+
import popoverOverflowModifiers from "./utils/popoverOverflowModifiers";
|
|
8
|
+
|
|
9
|
+
function Tag({
|
|
10
|
+
name,
|
|
11
|
+
color,
|
|
12
|
+
tooltip,
|
|
13
|
+
selected,
|
|
14
|
+
secondarySelected,
|
|
15
|
+
hasSelection,
|
|
16
|
+
onDelete,
|
|
17
|
+
onClick,
|
|
18
|
+
clickable,
|
|
19
|
+
doNotFillWidth,
|
|
20
|
+
style = {}
|
|
21
|
+
}) {
|
|
22
|
+
const sharedStyles = {
|
|
23
|
+
...getTagColorStyle(color).style,
|
|
24
|
+
padding: "2px 5px"
|
|
25
|
+
};
|
|
26
|
+
const deleteButton = onDelete && (
|
|
27
|
+
<span
|
|
28
|
+
style={{
|
|
29
|
+
...sharedStyles,
|
|
30
|
+
cursor: "pointer",
|
|
31
|
+
borderTopRightRadius: 3,
|
|
32
|
+
borderBottomRightRadius: 3
|
|
33
|
+
}}
|
|
34
|
+
className="delete-tag-button"
|
|
35
|
+
onClick={onDelete}
|
|
36
|
+
>
|
|
37
|
+
✕
|
|
38
|
+
</span>
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
let nameToUse = name;
|
|
42
|
+
const nameTooLong = name.length > 40;
|
|
43
|
+
if (nameTooLong) {
|
|
44
|
+
nameToUse = name.slice(0, 40) + "...";
|
|
45
|
+
}
|
|
46
|
+
if (tooltip || nameTooLong) {
|
|
47
|
+
const content = (
|
|
48
|
+
<div>
|
|
49
|
+
{nameTooLong ? (
|
|
50
|
+
<div>
|
|
51
|
+
{name}
|
|
52
|
+
{tooltip ? ":" : null}
|
|
53
|
+
</div>
|
|
54
|
+
) : null}
|
|
55
|
+
{tooltip ? <div>{tooltip}</div> : null}
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
nameToUse = (
|
|
59
|
+
<Tooltip content={content} modifiers={popoverOverflowModifiers}>
|
|
60
|
+
{nameToUse}
|
|
61
|
+
</Tooltip>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const tag = (
|
|
66
|
+
<React.Fragment>
|
|
67
|
+
<span
|
|
68
|
+
onClick={onClick}
|
|
69
|
+
className="tg-tag"
|
|
70
|
+
style={{
|
|
71
|
+
...sharedStyles,
|
|
72
|
+
// will stop tags from growing tall
|
|
73
|
+
marginBottom: "auto",
|
|
74
|
+
borderRadius: 3,
|
|
75
|
+
whiteSpace: "nowrap",
|
|
76
|
+
wordBreak: "normal",
|
|
77
|
+
overflow: "hidden",
|
|
78
|
+
textOverflow: "ellipsis",
|
|
79
|
+
|
|
80
|
+
...(onClick && { cursor: "pointer" }),
|
|
81
|
+
...(onDelete && {
|
|
82
|
+
borderTopRightRadius: 0,
|
|
83
|
+
borderBottomRightRadius: 0
|
|
84
|
+
}),
|
|
85
|
+
...(doNotFillWidth && { width: "fit-content" }),
|
|
86
|
+
...(clickable && { cursor: "pointer" }),
|
|
87
|
+
...style
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
{nameToUse}
|
|
91
|
+
</span>
|
|
92
|
+
{deleteButton}
|
|
93
|
+
</React.Fragment>
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
if (hasSelection) {
|
|
97
|
+
return (
|
|
98
|
+
<div
|
|
99
|
+
className={classNames("tag-selection", {
|
|
100
|
+
selected,
|
|
101
|
+
"secondary-selected": secondarySelected
|
|
102
|
+
})}
|
|
103
|
+
>
|
|
104
|
+
{tag}
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
|
+
} else {
|
|
108
|
+
return tag;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export default Tag;
|