@teselagen/ui 0.7.34 → 0.7.36

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.
Files changed (161) hide show
  1. package/isBeingCalledExcessively.js +2 -0
  2. package/package.json +1 -1
  3. package/style.css +26 -10
  4. package/DataTable/utils/filterLocalEntitiesToHasura.d.ts +0 -5
  5. package/DataTable/utils/initializeHasuraWhereAndFilter.d.ts +0 -2
  6. package/DataTable/utils/tableQueryParamsToHasuraClauses.d.ts +0 -26
  7. package/src/AdvancedOptions.js +0 -33
  8. package/src/AdvancedOptions.spec.js +0 -26
  9. package/src/AssignDefaultsModeContext.js +0 -22
  10. package/src/AsyncValidateFieldSpinner/index.js +0 -12
  11. package/src/BlueprintError/index.js +0 -14
  12. package/src/BounceLoader/index.js +0 -16
  13. package/src/BounceLoader/style.css +0 -45
  14. package/src/CollapsibleCard/index.js +0 -68
  15. package/src/CollapsibleCard/style.css +0 -23
  16. package/src/DNALoader/index.js +0 -20
  17. package/src/DNALoader/style.css +0 -251
  18. package/src/DataTable/CellDragHandle.js +0 -132
  19. package/src/DataTable/ColumnFilterMenu.js +0 -62
  20. package/src/DataTable/Columns.js +0 -979
  21. package/src/DataTable/DisabledLoadingComponent.js +0 -15
  22. package/src/DataTable/DisplayOptions.js +0 -199
  23. package/src/DataTable/DropdownCell.js +0 -61
  24. package/src/DataTable/EditableCell.js +0 -44
  25. package/src/DataTable/FilterAndSortMenu.js +0 -388
  26. package/src/DataTable/PagingTool.js +0 -225
  27. package/src/DataTable/RenderCell.js +0 -191
  28. package/src/DataTable/SearchBar.js +0 -69
  29. package/src/DataTable/SortableColumns.js +0 -100
  30. package/src/DataTable/TableFormTrackerContext.js +0 -10
  31. package/src/DataTable/ThComponent.js +0 -44
  32. package/src/DataTable/dataTableEnhancer.js +0 -41
  33. package/src/DataTable/defaultFormatters.js +0 -32
  34. package/src/DataTable/defaultValidators.js +0 -40
  35. package/src/DataTable/editCellHelper.js +0 -44
  36. package/src/DataTable/getCellVal.js +0 -20
  37. package/src/DataTable/getVals.js +0 -8
  38. package/src/DataTable/index.js +0 -3209
  39. package/src/DataTable/isTruthy.js +0 -12
  40. package/src/DataTable/isValueEmpty.js +0 -3
  41. package/src/DataTable/style.css +0 -608
  42. package/src/DataTable/utils/convertSchema.js +0 -69
  43. package/src/DataTable/utils/filterLocalEntitiesToHasura.js +0 -236
  44. package/src/DataTable/utils/filterLocalEntitiesToHasura.test.js +0 -587
  45. package/src/DataTable/utils/formatPasteData.js +0 -16
  46. package/src/DataTable/utils/getAllRows.js +0 -11
  47. package/src/DataTable/utils/getCellCopyText.js +0 -7
  48. package/src/DataTable/utils/getCellInfo.js +0 -36
  49. package/src/DataTable/utils/getFieldPathToField.js +0 -7
  50. package/src/DataTable/utils/getIdOrCodeOrIndex.js +0 -9
  51. package/src/DataTable/utils/getLastSelectedEntity.js +0 -11
  52. package/src/DataTable/utils/getNewEntToSelect.js +0 -25
  53. package/src/DataTable/utils/getRowCopyText.js +0 -28
  54. package/src/DataTable/utils/getTableConfigFromStorage.js +0 -5
  55. package/src/DataTable/utils/handleCopyColumn.js +0 -21
  56. package/src/DataTable/utils/handleCopyHelper.js +0 -15
  57. package/src/DataTable/utils/handleCopyRows.js +0 -23
  58. package/src/DataTable/utils/handleCopyTable.js +0 -16
  59. package/src/DataTable/utils/index.js +0 -55
  60. package/src/DataTable/utils/initializeHasuraWhereAndFilter.js +0 -26
  61. package/src/DataTable/utils/isBottomRightCornerOfRectangle.js +0 -20
  62. package/src/DataTable/utils/isEntityClean.js +0 -15
  63. package/src/DataTable/utils/primarySelectedValue.js +0 -1
  64. package/src/DataTable/utils/queryParams.js +0 -350
  65. package/src/DataTable/utils/removeCleanRows.js +0 -22
  66. package/src/DataTable/utils/rowClick.js +0 -181
  67. package/src/DataTable/utils/selection.js +0 -8
  68. package/src/DataTable/utils/tableQueryParamsToHasuraClauses.js +0 -253
  69. package/src/DataTable/utils/tableQueryParamsToHasuraClauses.test.js +0 -206
  70. package/src/DataTable/utils/useTableEntities.js +0 -38
  71. package/src/DataTable/utils/utils.js +0 -37
  72. package/src/DataTable/utils/withSelectedEntities.js +0 -65
  73. package/src/DataTable/utils/withTableParams.js +0 -288
  74. package/src/DataTable/validateTableWideErrors.js +0 -160
  75. package/src/DataTable/viewColumn.js +0 -97
  76. package/src/DialogFooter/index.js +0 -86
  77. package/src/DialogFooter/style.css +0 -9
  78. package/src/DropdownButton.js +0 -36
  79. package/src/FillWindow.css +0 -6
  80. package/src/FillWindow.js +0 -69
  81. package/src/FormComponents/FormSeparator.js +0 -9
  82. package/src/FormComponents/LoadingDots.js +0 -14
  83. package/src/FormComponents/Uploader.js +0 -1278
  84. package/src/FormComponents/getNewName.js +0 -31
  85. package/src/FormComponents/index.js +0 -1266
  86. package/src/FormComponents/itemUpload.js +0 -84
  87. package/src/FormComponents/sortify.js +0 -73
  88. package/src/FormComponents/style.css +0 -275
  89. package/src/FormComponents/tryToMatchSchemas.js +0 -264
  90. package/src/FormComponents/utils.js +0 -6
  91. package/src/HotkeysDialog/index.js +0 -79
  92. package/src/HotkeysDialog/style.css +0 -54
  93. package/src/InfoHelper/index.js +0 -78
  94. package/src/InfoHelper/style.css +0 -7
  95. package/src/IntentText/index.js +0 -18
  96. package/src/Loading/index.js +0 -70
  97. package/src/Loading/style.css +0 -4
  98. package/src/MatchHeaders.js +0 -234
  99. package/src/MenuBar/index.js +0 -423
  100. package/src/MenuBar/style.css +0 -45
  101. package/src/PromptUnsavedChanges/index.js +0 -38
  102. package/src/ResizableDraggableDialog/index.js +0 -141
  103. package/src/ResizableDraggableDialog/style.css +0 -42
  104. package/src/ScrollToTop/index.js +0 -72
  105. package/src/SimpleStepViz.js +0 -22
  106. package/src/Tag.js +0 -112
  107. package/src/TagSelect/index.js +0 -69
  108. package/src/TagSelect/style.css +0 -13
  109. package/src/TgHtmlSelect/index.js +0 -20
  110. package/src/TgSelect/index.js +0 -537
  111. package/src/TgSelect/style.css +0 -61
  112. package/src/TgSuggest/index.js +0 -124
  113. package/src/Timeline/TimelineEvent.js +0 -31
  114. package/src/Timeline/index.js +0 -15
  115. package/src/Timeline/style.css +0 -29
  116. package/src/UploadCsvWizard.css +0 -4
  117. package/src/UploadCsvWizard.js +0 -719
  118. package/src/autoTooltip.js +0 -201
  119. package/src/constants.js +0 -1
  120. package/src/customIcons.js +0 -361
  121. package/src/enhancers/withDialog/index.js +0 -196
  122. package/src/enhancers/withDialog/tg_modalState.js +0 -47
  123. package/src/enhancers/withField.js +0 -20
  124. package/src/enhancers/withFields.js +0 -11
  125. package/src/enhancers/withLocalStorage.js +0 -11
  126. package/src/index.js +0 -88
  127. package/src/rerenderOnWindowResize.js +0 -26
  128. package/src/showAppSpinner.js +0 -12
  129. package/src/showConfirmationDialog/index.js +0 -148
  130. package/src/showDialogOnDocBody.js +0 -33
  131. package/src/style.css +0 -265
  132. package/src/throwFormError.js +0 -16
  133. package/src/toastr.js +0 -148
  134. package/src/typeToCommonType.js +0 -6
  135. package/src/useDialog.js +0 -63
  136. package/src/utils/adHoc.js +0 -10
  137. package/src/utils/basicHandleActionsWithFullState.js +0 -14
  138. package/src/utils/browserUtils.js +0 -3
  139. package/src/utils/combineReducersWithFullState.js +0 -14
  140. package/src/utils/commandControls.js +0 -82
  141. package/src/utils/commandUtils.js +0 -112
  142. package/src/utils/determineBlackOrWhiteTextColor.js +0 -4
  143. package/src/utils/getDayjsFormatter.js +0 -35
  144. package/src/utils/getTextFromEl.js +0 -28
  145. package/src/utils/handlerHelpers.js +0 -24
  146. package/src/utils/hooks/index.js +0 -1
  147. package/src/utils/hooks/useDeepEqualMemo.js +0 -15
  148. package/src/utils/hooks/useStableReference.js +0 -9
  149. package/src/utils/hotkeyUtils.js +0 -131
  150. package/src/utils/isBeingCalledExcessively.js +0 -24
  151. package/src/utils/menuUtils.js +0 -433
  152. package/src/utils/popoverOverflowModifiers.js +0 -11
  153. package/src/utils/pureNoFunc.js +0 -31
  154. package/src/utils/renderOnDoc.js +0 -32
  155. package/src/utils/showProgressToast.js +0 -22
  156. package/src/utils/tagUtils.js +0 -45
  157. package/src/utils/tgFormValues.js +0 -35
  158. package/src/utils/useTraceUpdate.js +0 -19
  159. package/src/utils/withSelectTableRecords.js +0 -43
  160. package/src/utils/withStore.js +0 -10
  161. package/src/wrapDialog.js +0 -116
@@ -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
- }
@@ -1,47 +0,0 @@
1
- import { omit } from "lodash-es";
2
-
3
- export default function tg_modalState(
4
- state = {},
5
- { type, name, uniqueName, props = {} }
6
- ) {
7
- const existingModalState = state[name] || {};
8
- const { __registeredAs = {} } = existingModalState;
9
- if (type === "TG_REGISTER_MODAL") {
10
- return {
11
- ...state,
12
- [name]: {
13
- ...existingModalState,
14
- __registeredAs: { ...__registeredAs, [uniqueName]: true }
15
- }
16
- };
17
- }
18
- if (type === "TG_UNREGISTER_MODAL") {
19
- return {
20
- ...state,
21
- [name]: {
22
- ...existingModalState,
23
- __registeredAs: omit(__registeredAs, uniqueName)
24
- }
25
- };
26
- }
27
- if (type === "TG_SHOW_MODAL") {
28
- return {
29
- ...state,
30
- [name]: {
31
- ...existingModalState,
32
- ...props,
33
- open: true
34
- }
35
- };
36
- }
37
- if (type === "TG_HIDE_MODAL") {
38
- return {
39
- ...state,
40
- [name]: {
41
- __registeredAs: existingModalState.__registeredAs,
42
- open: false
43
- }
44
- };
45
- }
46
- return state;
47
- }
@@ -1,20 +0,0 @@
1
- import React from "react";
2
- import { Field } from "redux-form";
3
- import { fieldRequired } from "../FormComponents/utils";
4
-
5
- //simple enhancer that wraps a component in a redux <Field/> component
6
- //all options are passed as props to <Field/>
7
- export default function WithField(fieldProps) {
8
- return function AddFieldHOC(Component) {
9
- return function AddField({ isRequired, ...rest }) {
10
- return (
11
- <Field
12
- {...(isRequired && { validate: fieldRequired })}
13
- {...fieldProps}
14
- {...rest}
15
- component={Component}
16
- />
17
- );
18
- };
19
- };
20
- }
@@ -1,11 +0,0 @@
1
- import React from "react";
2
- import { Fields } from "redux-form";
3
- //simple enhancer that wraps a component in a redux <Fields/> component
4
- //all options are passed as props to <Fields/>
5
- export default function WithFields(fieldsProps) {
6
- return function AddFieldsHOC(Component) {
7
- return function AddFields(props) {
8
- return <Fields {...fieldsProps} {...props} component={Component} />;
9
- };
10
- };
11
- }
@@ -1,11 +0,0 @@
1
- import React from "react";
2
- import { Field } from "redux-form";
3
- //simple enhancer that wraps a component in a redux <Field/> component
4
- //all options are passed as props to <Field/>
5
- export default function WithField(fieldProps) {
6
- return function AddFieldHOC(Component) {
7
- return function AddField(props) {
8
- return <Field {...fieldProps} {...props} component={Component} />;
9
- };
10
- };
11
- }
package/src/index.js DELETED
@@ -1,88 +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";
88
- export { initializeHasuraWhereAndFilter } from "./DataTable/utils/initializeHasuraWhereAndFilter";
@@ -1,26 +0,0 @@
1
- import { throttle } from "lodash-es";
2
- // use like this within a react component:
3
-
4
- // constructor(props){
5
- // super(props)
6
- // rerenderOnWindowResize(this)
7
- // }
8
-
9
- export default function rerenderOnWindowResize(that) {
10
- that.updateDimensions = throttle(() => {
11
- if (that.props.disabled) return;
12
- that.forceUpdate();
13
- }, 250);
14
- const componentDidMount = that.componentDidMount;
15
- const componentWillUnmount = that.componentWillUnmount;
16
-
17
- that.componentDidMount = (...args) => {
18
- componentDidMount && componentDidMount.bind(that)(...args);
19
- window.addEventListener("resize", that.updateDimensions);
20
- };
21
-
22
- that.componentWillUnmount = (...args) => {
23
- componentWillUnmount && componentWillUnmount.bind(that)(...args);
24
- window.removeEventListener("resize", that.updateDimensions);
25
- };
26
- }
@@ -1,12 +0,0 @@
1
- import React from "react";
2
- import { Overlay } from "@blueprintjs/core";
3
- import { renderOnDocSimple } from "./utils/renderOnDoc";
4
- import Loading from "./Loading";
5
-
6
- export default function showAppSpinner() {
7
- return renderOnDocSimple(
8
- <Overlay isOpen={true}>
9
- <Loading centeredInPage loading></Loading>
10
- </Overlay>
11
- );
12
- }
@@ -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
- }
@@ -1,33 +0,0 @@
1
- import { createRoot } from "react-dom/client";
2
- import React from "react";
3
- // import withDialog from "./enhancers/withDialog";
4
- import { Dialog } from "@blueprintjs/core";
5
- import { nanoid } from "nanoid";
6
-
7
- //this is only really useful for unconnected standalone simple dialogs
8
- //remember to pass usePortal={false} to the <Dialog/> component so it will close properly
9
- export default function showDialogOnDocBody(DialogComp, options = {}) {
10
- const dialogHolder = document.createElement("div");
11
- const className = "myDialog" + nanoid();
12
- dialogHolder.className = className;
13
- document.body.appendChild(dialogHolder);
14
- const onClose = () => {
15
- document.querySelector("." + className).remove();
16
- };
17
- let DialogCompToUse;
18
- if (options.addDialogContainer) {
19
- DialogCompToUse = props => {
20
- return (
21
- <Dialog usePortal={false} title="pass a {title} prop" isOpen {...props}>
22
- <DialogComp {...props} hideModal={onClose} onClose={onClose} />
23
- </Dialog>
24
- );
25
- };
26
- } else {
27
- DialogCompToUse = DialogComp;
28
- }
29
- const root = createRoot(dialogHolder);
30
- root.render(
31
- <DialogCompToUse hideModal={onClose} onClose={onClose} {...options} />
32
- );
33
- }