@teselagen/ui 0.7.31 → 0.7.33-beta.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/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/{src/DataTable/FilterAndSortMenu.js → FilterAndSortMenu.js} +27 -30
- package/filterLocalEntitiesToHasura.js +216 -0
- package/index.cjs.js +695 -968
- package/index.d.ts +1 -0
- package/index.es.js +695 -968
- 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/simplifyHasuraWhere.js +80 -0
- package/tableQueryParamsToHasuraClauses.js +113 -0
- package/{src/DataTable/utils/withTableParams.js → withTableParams.js} +1 -14
- 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 -3214
- 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/index.js +0 -87
- package/src/showConfirmationDialog/index.js +0 -148
- package/src/style.css +0 -265
- /package/{src/AdvancedOptions.js → AdvancedOptions.js} +0 -0
- /package/{src/AssignDefaultsModeContext.js → AssignDefaultsModeContext.js} +0 -0
- /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/DropdownButton.js → DropdownButton.js} +0 -0
- /package/{src/DataTable/DropdownCell.js → DropdownCell.js} +0 -0
- /package/{src/DataTable/EditableCell.js → EditableCell.js} +0 -0
- /package/{src/FillWindow.css → FillWindow.css} +0 -0
- /package/{src/FillWindow.js → FillWindow.js} +0 -0
- /package/{src/FormComponents/FormSeparator.js → FormSeparator.js} +0 -0
- /package/{src/FormComponents/LoadingDots.js → LoadingDots.js} +0 -0
- /package/{src/MatchHeaders.js → MatchHeaders.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/SimpleStepViz.js → SimpleStepViz.js} +0 -0
- /package/{src/DataTable/SortableColumns.js → SortableColumns.js} +0 -0
- /package/{src/DataTable/TableFormTrackerContext.js → TableFormTrackerContext.js} +0 -0
- /package/{src/Tag.js → Tag.js} +0 -0
- /package/{src/DataTable/ThComponent.js → ThComponent.js} +0 -0
- /package/{src/Timeline/TimelineEvent.js → TimelineEvent.js} +0 -0
- /package/{src/UploadCsvWizard.css → UploadCsvWizard.css} +0 -0
- /package/{src/UploadCsvWizard.js → UploadCsvWizard.js} +0 -0
- /package/{src/FormComponents/Uploader.js → Uploader.js} +0 -0
- /package/{src/utils/adHoc.js → adHoc.js} +0 -0
- /package/{src/autoTooltip.js → autoTooltip.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/constants.js → constants.js} +0 -0
- /package/{src/DataTable/utils/convertSchema.js → convertSchema.js} +0 -0
- /package/{src/customIcons.js → customIcons.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/rerenderOnWindowResize.js → rerenderOnWindowResize.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/showAppSpinner.js → showAppSpinner.js} +0 -0
- /package/{src/showDialogOnDocBody.js → showDialogOnDocBody.js} +0 -0
- /package/{src/utils/showProgressToast.js → showProgressToast.js} +0 -0
- /package/{src/FormComponents/sortify.js → sortify.js} +0 -0
- /package/{src/Timeline/style.css → style.css} +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/throwFormError.js → throwFormError.js} +0 -0
- /package/{src/toastr.js → toastr.js} +0 -0
- /package/{src/FormComponents/tryToMatchSchemas.js → tryToMatchSchemas.js} +0 -0
- /package/{src/typeToCommonType.js → typeToCommonType.js} +0 -0
- /package/{src/utils/hooks/useDeepEqualMemo.js → useDeepEqualMemo.js} +0 -0
- /package/{src/useDialog.js → useDialog.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/wrapDialog.js → wrapDialog.js} +0 -0
package/src/TgSelect/style.css
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
.tg-select {
|
|
2
|
-
width: 100%;
|
|
3
|
-
min-width: 170px;
|
|
4
|
-
}
|
|
5
|
-
.tg-select.tg-select-as-tag {
|
|
6
|
-
/* background-color: red; */
|
|
7
|
-
border-radius: 4px;
|
|
8
|
-
width: fit-content;
|
|
9
|
-
color: white;
|
|
10
|
-
border: 2px solid white;
|
|
11
|
-
}
|
|
12
|
-
.tg-select.tg-select-as-tag .bp3-tag.bp3-minimal.bp3-intent-primary {
|
|
13
|
-
color: white !important;
|
|
14
|
-
}
|
|
15
|
-
.tg-select.do-not-fill-width {
|
|
16
|
-
width: auto;
|
|
17
|
-
min-width: 50px;
|
|
18
|
-
}
|
|
19
|
-
.tg-select.tg-small .bp3-input {
|
|
20
|
-
min-height: 25px;
|
|
21
|
-
height: 25px;
|
|
22
|
-
}
|
|
23
|
-
.tg-select.tg-small input {
|
|
24
|
-
line-height: 10.5px;
|
|
25
|
-
}
|
|
26
|
-
.tg-select.tg-small .bp3-tag-input .bp3-input-ghost {
|
|
27
|
-
line-height: 10.5px;
|
|
28
|
-
}
|
|
29
|
-
.tg-select.tg-small .bp3-tag-input .bp3-tag-input-values {
|
|
30
|
-
margin-top: 2px;
|
|
31
|
-
}
|
|
32
|
-
.tg-select input {
|
|
33
|
-
font-size: 14px;
|
|
34
|
-
}
|
|
35
|
-
.tg-select-option {
|
|
36
|
-
width: fit-content;
|
|
37
|
-
min-width: 100%;
|
|
38
|
-
}
|
|
39
|
-
/* Fix cutoff placeholder */
|
|
40
|
-
.tg-select .bp3-input-ghost[placeholder] {
|
|
41
|
-
width: 80%;
|
|
42
|
-
text-overflow: ellipsis;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.tg-single-select input {
|
|
46
|
-
position: absolute;
|
|
47
|
-
top: 5px;
|
|
48
|
-
}
|
|
49
|
-
.tg-single-select .bp3-tag {
|
|
50
|
-
background-color: initial !important;
|
|
51
|
-
font-size: 14px;
|
|
52
|
-
}
|
|
53
|
-
.tg-single-select .bp3-popover-open .bp3-tag {
|
|
54
|
-
opacity: 0.6;
|
|
55
|
-
}
|
|
56
|
-
.bp3-multi-select-popover .bp3-menu,
|
|
57
|
-
.bp3-select-popover .bp3-menu {
|
|
58
|
-
max-width: 400px;
|
|
59
|
-
max-height: 300px;
|
|
60
|
-
overflow: auto;
|
|
61
|
-
}
|
package/src/TgSuggest/index.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { Suggest } from "@blueprintjs/select";
|
|
2
|
-
import { Keys } from "@blueprintjs/core";
|
|
3
|
-
import React, { useCallback, useMemo, useRef } from "react";
|
|
4
|
-
import classNames from "classnames";
|
|
5
|
-
import { itemListPredicate } from "../TgSelect";
|
|
6
|
-
|
|
7
|
-
const itemRenderer = (i = "", { index, handleClick, modifiers }) => (
|
|
8
|
-
<div //we specifically don't use a BP MenuItem component here because the menu item is too slow when 100s are loaded and will cause the component to lag
|
|
9
|
-
onClick={handleClick}
|
|
10
|
-
key={index}
|
|
11
|
-
className={classNames(
|
|
12
|
-
"tg-select-option bp3-menu-item bp3-fill bp3-text-overflow-ellipsis",
|
|
13
|
-
{
|
|
14
|
-
"bp3-active": modifiers.active
|
|
15
|
-
}
|
|
16
|
-
)}
|
|
17
|
-
>
|
|
18
|
-
{i}
|
|
19
|
-
</div>
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
const TgSuggest = ({
|
|
23
|
-
disabled,
|
|
24
|
-
inputProps: _inputProps,
|
|
25
|
-
intent,
|
|
26
|
-
isLoading,
|
|
27
|
-
isSimpleSearch,
|
|
28
|
-
multi,
|
|
29
|
-
noResultsText,
|
|
30
|
-
notCreateable,
|
|
31
|
-
onBlur,
|
|
32
|
-
onChange,
|
|
33
|
-
optionRenderer, //pull this one out here so it doesn't get passsed along
|
|
34
|
-
options,
|
|
35
|
-
placeholder,
|
|
36
|
-
popoverProps: _popoverProps,
|
|
37
|
-
value,
|
|
38
|
-
...rest
|
|
39
|
-
}) => {
|
|
40
|
-
const inputRef = useRef(null);
|
|
41
|
-
|
|
42
|
-
const handleItemSelect = useCallback(
|
|
43
|
-
item => {
|
|
44
|
-
inputRef.current && inputRef.current.blur();
|
|
45
|
-
return onChange?.(item);
|
|
46
|
-
},
|
|
47
|
-
[onChange]
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
const _itemListPredicate = useCallback(
|
|
51
|
-
(queryString, item) => {
|
|
52
|
-
return itemListPredicate(queryString, item, isSimpleSearch);
|
|
53
|
-
},
|
|
54
|
-
[isSimpleSearch]
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
const popoverProps = useMemo(
|
|
58
|
-
() => ({
|
|
59
|
-
minimal: true,
|
|
60
|
-
className: classNames("tg-select", {
|
|
61
|
-
"tg-single-select": !multi
|
|
62
|
-
}),
|
|
63
|
-
wrapperTagName: "div",
|
|
64
|
-
usePortal: false,
|
|
65
|
-
canEscapeKeyClose: true,
|
|
66
|
-
..._popoverProps
|
|
67
|
-
}),
|
|
68
|
-
[multi, _popoverProps]
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
const onKeyDown = useCallback(e => {
|
|
72
|
-
const { which } = e;
|
|
73
|
-
if (which === Keys.ENTER) {
|
|
74
|
-
e.preventDefault();
|
|
75
|
-
e.stopPropagation(); //this prevents the dialog it is in from closing
|
|
76
|
-
}
|
|
77
|
-
if (which === Keys.ESCAPE || which === Keys.TAB) {
|
|
78
|
-
// By default the escape key will not trigger a blur on the
|
|
79
|
-
// input element. It must be done explicitly.
|
|
80
|
-
if (inputRef.current != null) {
|
|
81
|
-
inputRef.current.blur();
|
|
82
|
-
}
|
|
83
|
-
e.preventDefault();
|
|
84
|
-
e.stopPropagation(); //this prevents dialog's it is in from closing
|
|
85
|
-
}
|
|
86
|
-
}, []);
|
|
87
|
-
|
|
88
|
-
const inputProps = useMemo(
|
|
89
|
-
() => ({
|
|
90
|
-
inputRef: n => {
|
|
91
|
-
if (n) inputRef.current = n;
|
|
92
|
-
},
|
|
93
|
-
placeholder: placeholder || "Type here...",
|
|
94
|
-
disabled: disabled, // tg: adding isLoading will cause the input to be blurred when using generic select asReactSelect (don't do it),
|
|
95
|
-
intent: intent,
|
|
96
|
-
..._inputProps
|
|
97
|
-
}),
|
|
98
|
-
[disabled, _inputProps, intent, placeholder]
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
return (
|
|
102
|
-
<Suggest
|
|
103
|
-
closeOnSelect
|
|
104
|
-
items={options}
|
|
105
|
-
query={value}
|
|
106
|
-
popoverProps={popoverProps}
|
|
107
|
-
onKeyDown={onKeyDown}
|
|
108
|
-
onItemSelect={handleItemSelect}
|
|
109
|
-
noResults={null}
|
|
110
|
-
resetOnSelect={false}
|
|
111
|
-
onQueryChange={onChange}
|
|
112
|
-
itemRenderer={itemRenderer}
|
|
113
|
-
itemListPredicate={_itemListPredicate}
|
|
114
|
-
selectedItem={value}
|
|
115
|
-
inputValueRenderer={item => item}
|
|
116
|
-
inputProps={inputProps}
|
|
117
|
-
isSimpleSearch={isSimpleSearch}
|
|
118
|
-
onChange={onChange}
|
|
119
|
-
{...rest}
|
|
120
|
-
/>
|
|
121
|
-
);
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
export default TgSuggest;
|
package/src/Timeline/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import "./style.css";
|
|
3
|
-
|
|
4
|
-
function Timeline(props) {
|
|
5
|
-
return (
|
|
6
|
-
<div className="tg-timeline">
|
|
7
|
-
{props.children.length > 1 && <div className="tg-timeline-line" />}
|
|
8
|
-
{props.children}
|
|
9
|
-
</div>
|
|
10
|
-
);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export { default as TimelineEvent } from "./TimelineEvent";
|
|
14
|
-
|
|
15
|
-
export default Timeline;
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Dialog } from "@blueprintjs/core";
|
|
3
|
-
import { connect } from "react-redux";
|
|
4
|
-
import { lifecycle, compose } from "recompose";
|
|
5
|
-
import { camelCase } from "lodash-es";
|
|
6
|
-
import { nanoid } from "nanoid";
|
|
7
|
-
import ResizableDraggableDialog from "../../ResizableDraggableDialog";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* usage:
|
|
11
|
-
* in container:
|
|
12
|
-
* compose(
|
|
13
|
-
* withDialog({ title: "Select Aliquot(s) From", other bp dialog props here })
|
|
14
|
-
* )
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* in react component
|
|
18
|
-
* import MyDialogEnhancedComponent from "./MyDialogEnhancedComponent"
|
|
19
|
-
*
|
|
20
|
-
* render() {
|
|
21
|
-
* return <div>
|
|
22
|
-
* <MyDialogEnhancedComponent
|
|
23
|
-
* dialogProps={} //bp dialog overrides can go here
|
|
24
|
-
* target={<button>Open Dialog</button> } //target can also be passed as a child component
|
|
25
|
-
* myRandomProp={'yuppp'} //pass any other props like normal to the component
|
|
26
|
-
*
|
|
27
|
-
* />
|
|
28
|
-
* </div>
|
|
29
|
-
* }
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
// or programatically:
|
|
33
|
-
// const ProgramaticDialog = withDialog({
|
|
34
|
-
// dialogName: "programaticDialog", //giving it a unique dialogName means you can
|
|
35
|
-
// title: "Programatic Dialog Demo"
|
|
36
|
-
// })(DialogInner);
|
|
37
|
-
//
|
|
38
|
-
// add the no target dialog somewhere on the page
|
|
39
|
-
// <ProgramaticDialog></ProgramaticDialog> //this just renders without any target
|
|
40
|
-
//
|
|
41
|
-
// somewhere else on the page:
|
|
42
|
-
// <Button>Click To Open Dialog</Button>
|
|
43
|
-
|
|
44
|
-
export default function withDialog(topLevelDialogProps) {
|
|
45
|
-
function dialogHoc(WrappedComponent) {
|
|
46
|
-
return class DialogWrapper extends React.Component {
|
|
47
|
-
componentWillUnmount() {
|
|
48
|
-
const { dispatch, dialogName, uniqueName } = this.props;
|
|
49
|
-
if (dialogName) {
|
|
50
|
-
dispatch({
|
|
51
|
-
type: "TG_UNREGISTER_MODAL",
|
|
52
|
-
name: dialogName,
|
|
53
|
-
uniqueName
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
render() {
|
|
58
|
-
const {
|
|
59
|
-
target,
|
|
60
|
-
noTarget,
|
|
61
|
-
isDialogOpen,
|
|
62
|
-
showModal,
|
|
63
|
-
dialogName,
|
|
64
|
-
onClickRename,
|
|
65
|
-
hideModal,
|
|
66
|
-
fetchPolicy = "network-only",
|
|
67
|
-
children,
|
|
68
|
-
onCloseHook,
|
|
69
|
-
dialogProps,
|
|
70
|
-
title,
|
|
71
|
-
isDraggable,
|
|
72
|
-
alreadyRendering,
|
|
73
|
-
...rest
|
|
74
|
-
} = this.props;
|
|
75
|
-
const extraDialogProps = {
|
|
76
|
-
...topLevelDialogProps,
|
|
77
|
-
...dialogProps
|
|
78
|
-
};
|
|
79
|
-
const _onCloseHook = onCloseHook || extraDialogProps.onCloseHook;
|
|
80
|
-
const { noButtonClickPropagate } = {
|
|
81
|
-
...this.props,
|
|
82
|
-
...extraDialogProps
|
|
83
|
-
};
|
|
84
|
-
const isOpen = isDialogOpen || extraDialogProps.isOpen;
|
|
85
|
-
const targetEl = target || children;
|
|
86
|
-
// if (!targetEl && !dialogName)
|
|
87
|
-
// throw new Error(
|
|
88
|
-
// "withDialog error: Please provide a target or child element to the withDialog() enhanced component. If you really don't want a target, please pass a 'noTarget=true' prop"
|
|
89
|
-
// );
|
|
90
|
-
const DialogToUse =
|
|
91
|
-
isDraggable || extraDialogProps.isDraggable
|
|
92
|
-
? ResizableDraggableDialog
|
|
93
|
-
: Dialog;
|
|
94
|
-
return (
|
|
95
|
-
<React.Fragment>
|
|
96
|
-
{isOpen && (
|
|
97
|
-
<DialogToUse
|
|
98
|
-
onClose={function () {
|
|
99
|
-
hideModal();
|
|
100
|
-
_onCloseHook && _onCloseHook();
|
|
101
|
-
}}
|
|
102
|
-
className={dialogName || camelCase()}
|
|
103
|
-
title={title}
|
|
104
|
-
isOpen={isOpen}
|
|
105
|
-
canEscapeKeyClose={false}
|
|
106
|
-
canOutsideClickClose={false}
|
|
107
|
-
{...extraDialogProps}
|
|
108
|
-
>
|
|
109
|
-
<WrappedComponent
|
|
110
|
-
{...{
|
|
111
|
-
...rest,
|
|
112
|
-
fetchPolicy,
|
|
113
|
-
ssr: false,
|
|
114
|
-
hideModal
|
|
115
|
-
}}
|
|
116
|
-
/>
|
|
117
|
-
</DialogToUse>
|
|
118
|
-
)}
|
|
119
|
-
{targetEl &&
|
|
120
|
-
React.cloneElement(targetEl, {
|
|
121
|
-
[onClickRename || "onClick"]: e => {
|
|
122
|
-
showModal();
|
|
123
|
-
if (noButtonClickPropagate) {
|
|
124
|
-
e.preventDefault();
|
|
125
|
-
e.stopPropagation();
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
})}
|
|
129
|
-
</React.Fragment>
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return compose(
|
|
136
|
-
connect(({ tg_modalState }) => {
|
|
137
|
-
return { ...topLevelDialogProps, tg_modalState };
|
|
138
|
-
}),
|
|
139
|
-
lifecycle({
|
|
140
|
-
componentWillMount: function () {
|
|
141
|
-
const { dispatch, dialogName } = this.props;
|
|
142
|
-
const uniqueName = nanoid();
|
|
143
|
-
const nameToUse = dialogName || uniqueName;
|
|
144
|
-
this.setState({
|
|
145
|
-
nameToUse,
|
|
146
|
-
uniqueName
|
|
147
|
-
});
|
|
148
|
-
if (dialogName) {
|
|
149
|
-
dispatch({
|
|
150
|
-
type: "TG_REGISTER_MODAL",
|
|
151
|
-
name: dialogName,
|
|
152
|
-
uniqueName
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}),
|
|
157
|
-
connect(
|
|
158
|
-
function ({ tg_modalState }, { nameToUse, uniqueName }) {
|
|
159
|
-
const dialogState = tg_modalState[nameToUse] || {};
|
|
160
|
-
const { open, __registeredAs, ...rest } = dialogState;
|
|
161
|
-
const newProps = {
|
|
162
|
-
...rest,
|
|
163
|
-
isDialogOpen:
|
|
164
|
-
open &&
|
|
165
|
-
(__registeredAs
|
|
166
|
-
? Object.keys(__registeredAs)[
|
|
167
|
-
Object.keys(__registeredAs).length - 1
|
|
168
|
-
] === uniqueName
|
|
169
|
-
: true)
|
|
170
|
-
};
|
|
171
|
-
return newProps;
|
|
172
|
-
},
|
|
173
|
-
function (dispatch, { nameToUse, hideModal, showModal }) {
|
|
174
|
-
return {
|
|
175
|
-
showModal:
|
|
176
|
-
showModal ||
|
|
177
|
-
function () {
|
|
178
|
-
dispatch({
|
|
179
|
-
type: "TG_SHOW_MODAL",
|
|
180
|
-
name: nameToUse
|
|
181
|
-
});
|
|
182
|
-
},
|
|
183
|
-
hideModal:
|
|
184
|
-
hideModal ||
|
|
185
|
-
function () {
|
|
186
|
-
dispatch({
|
|
187
|
-
type: "TG_HIDE_MODAL",
|
|
188
|
-
name: nameToUse
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
),
|
|
194
|
-
dialogHoc
|
|
195
|
-
);
|
|
196
|
-
}
|
package/src/index.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import "@blueprintjs/core/lib/css/blueprint.css";
|
|
2
|
-
import "@blueprintjs/datetime/lib/css/blueprint-datetime.css";
|
|
3
|
-
import "@blueprintjs/icons/lib/css/blueprint-icons.css";
|
|
4
|
-
import "./style.css";
|
|
5
|
-
import "./autoTooltip";
|
|
6
|
-
export { LoadingDots } from "./FormComponents/LoadingDots";
|
|
7
|
-
export { FormSeparator } from "./FormComponents/FormSeparator";
|
|
8
|
-
export * from "./AssignDefaultsModeContext";
|
|
9
|
-
export { default as Uploader } from "./FormComponents/Uploader";
|
|
10
|
-
export { mergeSchemas } from "./DataTable/utils/convertSchema";
|
|
11
|
-
export {
|
|
12
|
-
getCurrentParamsFromUrl,
|
|
13
|
-
setCurrentParamsOnUrl
|
|
14
|
-
} from "./DataTable/utils/queryParams";
|
|
15
|
-
export {
|
|
16
|
-
default as withSelectedEntities,
|
|
17
|
-
getSelectedEntities
|
|
18
|
-
} from "./DataTable/utils/withSelectedEntities";
|
|
19
|
-
export {
|
|
20
|
-
default as DataTable,
|
|
21
|
-
ConnectedPagingTool as PagingTool
|
|
22
|
-
} from "./DataTable";
|
|
23
|
-
export { removeCleanRows, useTableEntities } from "./DataTable/utils";
|
|
24
|
-
|
|
25
|
-
export { useDeepEqualMemo } from "./utils/hooks";
|
|
26
|
-
export { getIdOrCodeOrIndex } from "./DataTable/utils";
|
|
27
|
-
export { default as convertSchema } from "./DataTable/utils/convertSchema";
|
|
28
|
-
export { default as Loading } from "./Loading";
|
|
29
|
-
export { throwFormError } from "./throwFormError";
|
|
30
|
-
export { default as AdvancedOptions } from "./AdvancedOptions";
|
|
31
|
-
export { default as TgSelect } from "./TgSelect";
|
|
32
|
-
export { default as TgHTMLSelect } from "./TgHtmlSelect";
|
|
33
|
-
export { default as wrapDialog } from "./wrapDialog";
|
|
34
|
-
export { default as PromptUnsavedChanges } from "./PromptUnsavedChanges";
|
|
35
|
-
export { default as BlueprintError } from "./BlueprintError";
|
|
36
|
-
export { default as DropdownButton } from "./DropdownButton";
|
|
37
|
-
export { default as DialogFooter } from "./DialogFooter";
|
|
38
|
-
export { default as adHoc } from "./utils/adHoc";
|
|
39
|
-
export { default as IntentText } from "./IntentText";
|
|
40
|
-
export { default as popoverOverflowModifiers } from "./utils/popoverOverflowModifiers";
|
|
41
|
-
export * from "./utils/tgFormValues";
|
|
42
|
-
export { default as tgFormValues } from "./utils/tgFormValues";
|
|
43
|
-
export { default as withStore } from "./utils/withStore";
|
|
44
|
-
export {
|
|
45
|
-
default as withTableParams,
|
|
46
|
-
useTableParams
|
|
47
|
-
} from "./DataTable/utils/withTableParams";
|
|
48
|
-
export { default as InfoHelper } from "./InfoHelper";
|
|
49
|
-
export { default as showConfirmationDialog } from "./showConfirmationDialog";
|
|
50
|
-
export { default as showAppSpinner } from "./showAppSpinner";
|
|
51
|
-
export { default as CollapsibleCard } from "./CollapsibleCard";
|
|
52
|
-
export { default as ResizableDraggableDialog } from "./ResizableDraggableDialog";
|
|
53
|
-
export { default as MenuBar } from "./MenuBar";
|
|
54
|
-
export { default as rerenderOnWindowResize } from "./rerenderOnWindowResize";
|
|
55
|
-
export { default as HotkeysDialog } from "./HotkeysDialog";
|
|
56
|
-
export { default as FillWindow } from "./FillWindow";
|
|
57
|
-
export { default as withFields } from "./enhancers/withFields";
|
|
58
|
-
export { default as withField } from "./enhancers/withField";
|
|
59
|
-
export { default as withDialog } from "./enhancers/withDialog";
|
|
60
|
-
export { default as tg_modalState } from "./enhancers/withDialog/tg_modalState";
|
|
61
|
-
export { default as Timeline, TimelineEvent } from "./Timeline";
|
|
62
|
-
export * from "./FormComponents";
|
|
63
|
-
export * from "./useDialog";
|
|
64
|
-
export * from "./toastr";
|
|
65
|
-
export * from "./showConfirmationDialog";
|
|
66
|
-
export * from "./utils/handlerHelpers";
|
|
67
|
-
export * from "./customIcons";
|
|
68
|
-
export { default as basicHandleActionsWithFullState } from "./utils/basicHandleActionsWithFullState";
|
|
69
|
-
export { default as combineReducersWithFullState } from "./utils/combineReducersWithFullState";
|
|
70
|
-
export { default as withSelectTableRecords } from "./utils/withSelectTableRecords";
|
|
71
|
-
export { default as pureNoFunc } from "./utils/pureNoFunc";
|
|
72
|
-
export * from "./utils/tagUtils";
|
|
73
|
-
export * from "./utils/hotkeyUtils";
|
|
74
|
-
export * from "./utils/menuUtils";
|
|
75
|
-
export * from "./utils/browserUtils";
|
|
76
|
-
export * from "./utils/commandUtils";
|
|
77
|
-
export * from "./utils/commandControls";
|
|
78
|
-
export * from "./utils/useTraceUpdate";
|
|
79
|
-
export * from "./utils/hooks/useStableReference";
|
|
80
|
-
export { default as AsyncValidateFieldSpinner } from "./AsyncValidateFieldSpinner";
|
|
81
|
-
export { default as showProgressToast } from "./utils/showProgressToast";
|
|
82
|
-
export { default as getTextFromEl } from "./utils/getTextFromEl";
|
|
83
|
-
export { default as ScrollToTop } from "./ScrollToTop";
|
|
84
|
-
const noop = () => undefined;
|
|
85
|
-
export { noop };
|
|
86
|
-
export { default as showDialogOnDocBody } from "./showDialogOnDocBody";
|
|
87
|
-
export { default as TableFormTrackerContext } from "./DataTable/TableFormTrackerContext";
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import React, { Component } from "react";
|
|
2
|
-
import { Button, Classes, Dialog, Intent } from "@blueprintjs/core";
|
|
3
|
-
import { renderOnDoc } from "../utils/renderOnDoc";
|
|
4
|
-
import DialogFooter from "../DialogFooter";
|
|
5
|
-
|
|
6
|
-
// usage
|
|
7
|
-
// const doAction = await showConfirmationDialog({
|
|
8
|
-
// text:
|
|
9
|
-
// "Are you sure you want to re-run this tool? Downstream tools with linked outputs will need to be re-run as well!",
|
|
10
|
-
// intent: Intent.DANGER, //applied to the right most confirm button
|
|
11
|
-
// confirmButtonText: "Yep!",
|
|
12
|
-
// cancelButtonText: "Nope",
|
|
13
|
-
// canEscapeKeyCancel: true //this is false by default
|
|
14
|
-
// });
|
|
15
|
-
// console.info("doAction:", doAction);
|
|
16
|
-
|
|
17
|
-
// const doAction = await showConfirmationDialog({
|
|
18
|
-
// thirdButtonText: 'Click me'
|
|
19
|
-
// thirdButtonIntent: 'primary'
|
|
20
|
-
// });
|
|
21
|
-
// console.info("doAction:", doAction); //logs thirdButtonClicked
|
|
22
|
-
//returns a promise that resolves with true or false depending on if the user cancels or not!
|
|
23
|
-
export default function showConfirmationDialog(opts) {
|
|
24
|
-
return new Promise(resolve => {
|
|
25
|
-
renderOnDoc(handleClose => {
|
|
26
|
-
return <AlertWrapper {...{ ...opts, handleClose, resolve }} />;
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export class AlertWrapper extends Component {
|
|
32
|
-
state = { isOpen: true };
|
|
33
|
-
render() {
|
|
34
|
-
const {
|
|
35
|
-
title,
|
|
36
|
-
handleClose,
|
|
37
|
-
text,
|
|
38
|
-
resolve,
|
|
39
|
-
noCancelButton,
|
|
40
|
-
content,
|
|
41
|
-
className,
|
|
42
|
-
thirdButtonNotMinimal,
|
|
43
|
-
thirdButtonClassName,
|
|
44
|
-
thirdButtonText,
|
|
45
|
-
thirdButtonIntent,
|
|
46
|
-
fourthButtonNotMinimal,
|
|
47
|
-
fourthButtonClassName,
|
|
48
|
-
fourthButtonText,
|
|
49
|
-
fourthButtonIntent,
|
|
50
|
-
handleSubmit,
|
|
51
|
-
canEscapeKeyCancel,
|
|
52
|
-
confirmButtonText = "OK",
|
|
53
|
-
cancelButtonText = "Cancel",
|
|
54
|
-
intent = Intent.PRIMARY,
|
|
55
|
-
...rest
|
|
56
|
-
} = this.props;
|
|
57
|
-
const doClose = confirm => {
|
|
58
|
-
handleClose();
|
|
59
|
-
this.setState({ isOpen: false });
|
|
60
|
-
resolve(confirm);
|
|
61
|
-
};
|
|
62
|
-
return (
|
|
63
|
-
<Dialog
|
|
64
|
-
title={title}
|
|
65
|
-
className={(title ? "" : "bp3-alert") + ` ${className || ""}`}
|
|
66
|
-
isOpen={this.state.isOpen}
|
|
67
|
-
intent={intent}
|
|
68
|
-
cancelButtonText={cancelButtonText}
|
|
69
|
-
onCancel={cancelButtonText ? () => doClose(false) : undefined}
|
|
70
|
-
onConfirm={
|
|
71
|
-
handleSubmit ? handleSubmit(v => doClose(v)) : () => doClose(true)
|
|
72
|
-
}
|
|
73
|
-
{...rest}
|
|
74
|
-
{...(noCancelButton && {
|
|
75
|
-
onCancel: undefined,
|
|
76
|
-
cancelButtonText: undefined
|
|
77
|
-
})}
|
|
78
|
-
>
|
|
79
|
-
<div
|
|
80
|
-
className={title ? "bp3-dialog-body" : "bp3-alert-contents"}
|
|
81
|
-
style={{ padding: 5 }}
|
|
82
|
-
>
|
|
83
|
-
{content}
|
|
84
|
-
{text && <div style={{ marginBottom: 10 }}>{text}</div>}
|
|
85
|
-
</div>
|
|
86
|
-
<DialogFooter
|
|
87
|
-
{...{
|
|
88
|
-
onBackClick:
|
|
89
|
-
cancelButtonText && !noCancelButton
|
|
90
|
-
? () => doClose(false)
|
|
91
|
-
: undefined,
|
|
92
|
-
onClick: handleSubmit
|
|
93
|
-
? handleSubmit(v => doClose(v))
|
|
94
|
-
: () => doClose(true),
|
|
95
|
-
noCancel: true,
|
|
96
|
-
additionalButtons:
|
|
97
|
-
thirdButtonText || fourthButtonText ? (
|
|
98
|
-
<React.Fragment>
|
|
99
|
-
{!!fourthButtonText && (
|
|
100
|
-
<Button
|
|
101
|
-
className={
|
|
102
|
-
(!fourthButtonNotMinimal ? Classes.MINIMAL : "") +
|
|
103
|
-
" " +
|
|
104
|
-
fourthButtonClassName
|
|
105
|
-
}
|
|
106
|
-
intent={fourthButtonIntent}
|
|
107
|
-
text={fourthButtonText}
|
|
108
|
-
onClick={
|
|
109
|
-
handleSubmit
|
|
110
|
-
? handleSubmit(v =>
|
|
111
|
-
doClose({ ...v, fourthButtonClicked: true })
|
|
112
|
-
)
|
|
113
|
-
: () => doClose("fourthButtonClicked")
|
|
114
|
-
}
|
|
115
|
-
></Button>
|
|
116
|
-
)}
|
|
117
|
-
{!!thirdButtonText && (
|
|
118
|
-
<Button
|
|
119
|
-
className={
|
|
120
|
-
(!thirdButtonNotMinimal ? Classes.MINIMAL : "") +
|
|
121
|
-
" " +
|
|
122
|
-
thirdButtonClassName
|
|
123
|
-
}
|
|
124
|
-
intent={thirdButtonIntent}
|
|
125
|
-
text={thirdButtonText}
|
|
126
|
-
onClick={
|
|
127
|
-
handleSubmit
|
|
128
|
-
? handleSubmit(v =>
|
|
129
|
-
doClose({ ...v, thirdButtonClicked: true })
|
|
130
|
-
)
|
|
131
|
-
: () => {
|
|
132
|
-
doClose("thirdButtonClicked");
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
></Button>
|
|
136
|
-
)}
|
|
137
|
-
</React.Fragment>
|
|
138
|
-
) : undefined,
|
|
139
|
-
containerClassname: title ? "" : "bp3-alert-footer",
|
|
140
|
-
backText: noCancelButton ? "" : cancelButtonText,
|
|
141
|
-
text: confirmButtonText,
|
|
142
|
-
intent
|
|
143
|
-
}}
|
|
144
|
-
></DialogFooter>
|
|
145
|
-
</Dialog>
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
}
|