@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.
Files changed (254) hide show
  1. package/AdvancedOptions.js +33 -0
  2. package/AssignDefaultsModeContext.js +22 -0
  3. package/DataTable/utils/filterLocalEntitiesToHasura.d.ts +5 -0
  4. package/DataTable/utils/initializeHasuraWhereAndFilter.d.ts +2 -0
  5. package/DataTable/utils/queryParams.d.ts +8 -12
  6. package/DataTable/utils/simplifyHasuraWhere.d.ts +1 -0
  7. package/DataTable/utils/tableQueryParamsToHasuraClauses.d.ts +14 -0
  8. package/DropdownButton.js +36 -0
  9. package/FillWindow.css +6 -0
  10. package/FillWindow.js +69 -0
  11. package/{src/DataTable/FilterAndSortMenu.js → FilterAndSortMenu.js} +27 -30
  12. package/MatchHeaders.js +234 -0
  13. package/SimpleStepViz.js +22 -0
  14. package/Tag.js +112 -0
  15. package/UploadCsvWizard.css +4 -0
  16. package/UploadCsvWizard.js +719 -0
  17. package/autoTooltip.js +201 -0
  18. package/constants.js +1 -0
  19. package/customIcons.js +361 -0
  20. package/filterLocalEntitiesToHasura.js +216 -0
  21. package/index.cjs.js +695 -967
  22. package/index.d.ts +1 -0
  23. package/index.es.js +695 -967
  24. package/initializeHasuraWhereAndFilter.js +27 -0
  25. package/{src/utils/isBeingCalledExcessively.js → isBeingCalledExcessively.js} +0 -1
  26. package/package.json +1 -1
  27. package/queryParams.js +336 -0
  28. package/rerenderOnWindowResize.js +26 -0
  29. package/showAppSpinner.js +12 -0
  30. package/showDialogOnDocBody.js +33 -0
  31. package/simplifyHasuraWhere.js +80 -0
  32. package/src/CellDragHandle.js +132 -0
  33. package/src/ColumnFilterMenu.js +62 -0
  34. package/src/Columns.js +979 -0
  35. package/src/DisabledLoadingComponent.js +15 -0
  36. package/src/DisplayOptions.js +199 -0
  37. package/src/DropdownCell.js +61 -0
  38. package/src/EditableCell.js +44 -0
  39. package/src/FilterAndSortMenu.js +388 -0
  40. package/src/FormSeparator.js +9 -0
  41. package/src/LoadingDots.js +14 -0
  42. package/src/PagingTool.js +225 -0
  43. package/src/RenderCell.js +191 -0
  44. package/src/SearchBar.js +69 -0
  45. package/src/SortableColumns.js +100 -0
  46. package/src/TableFormTrackerContext.js +10 -0
  47. package/src/ThComponent.js +44 -0
  48. package/src/TimelineEvent.js +31 -0
  49. package/src/Uploader.js +1278 -0
  50. package/src/adHoc.js +10 -0
  51. package/src/basicHandleActionsWithFullState.js +14 -0
  52. package/src/browserUtils.js +3 -0
  53. package/src/combineReducersWithFullState.js +14 -0
  54. package/src/commandControls.js +82 -0
  55. package/src/commandUtils.js +112 -0
  56. package/src/convertSchema.js +69 -0
  57. package/src/dataTableEnhancer.js +41 -0
  58. package/src/defaultFormatters.js +32 -0
  59. package/src/defaultValidators.js +40 -0
  60. package/src/determineBlackOrWhiteTextColor.js +4 -0
  61. package/src/editCellHelper.js +44 -0
  62. package/src/filterLocalEntitiesToHasura.js +216 -0
  63. package/src/formatPasteData.js +16 -0
  64. package/src/getAllRows.js +11 -0
  65. package/src/getCellCopyText.js +7 -0
  66. package/src/getCellInfo.js +36 -0
  67. package/src/getCellVal.js +20 -0
  68. package/src/getDayjsFormatter.js +35 -0
  69. package/src/getFieldPathToField.js +7 -0
  70. package/src/getIdOrCodeOrIndex.js +9 -0
  71. package/src/getLastSelectedEntity.js +11 -0
  72. package/src/getNewEntToSelect.js +25 -0
  73. package/src/getNewName.js +31 -0
  74. package/src/getRowCopyText.js +28 -0
  75. package/src/getTableConfigFromStorage.js +5 -0
  76. package/src/getTextFromEl.js +28 -0
  77. package/src/getVals.js +8 -0
  78. package/src/handleCopyColumn.js +21 -0
  79. package/src/handleCopyHelper.js +15 -0
  80. package/src/handleCopyRows.js +23 -0
  81. package/src/handleCopyTable.js +16 -0
  82. package/src/handlerHelpers.js +24 -0
  83. package/src/hotkeyUtils.js +131 -0
  84. package/src/index.js +1 -87
  85. package/src/initializeHasuraWhereAndFilter.js +27 -0
  86. package/src/isBeingCalledExcessively.js +24 -0
  87. package/src/isBottomRightCornerOfRectangle.js +20 -0
  88. package/src/isEntityClean.js +15 -0
  89. package/src/isTruthy.js +12 -0
  90. package/src/isValueEmpty.js +3 -0
  91. package/src/itemUpload.js +84 -0
  92. package/src/menuUtils.js +433 -0
  93. package/src/popoverOverflowModifiers.js +11 -0
  94. package/src/primarySelectedValue.js +1 -0
  95. package/src/pureNoFunc.js +31 -0
  96. package/src/queryParams.js +336 -0
  97. package/src/removeCleanRows.js +22 -0
  98. package/src/renderOnDoc.js +32 -0
  99. package/src/rowClick.js +181 -0
  100. package/src/selection.js +8 -0
  101. package/src/showProgressToast.js +22 -0
  102. package/src/simplifyHasuraWhere.js +80 -0
  103. package/src/sortify.js +73 -0
  104. package/src/style.css +24 -260
  105. package/src/tableQueryParamsToHasuraClauses.js +113 -0
  106. package/src/{DataTable/utils/withTableParams.js → withTableParams.js} +1 -14
  107. package/tableQueryParamsToHasuraClauses.js +113 -0
  108. package/tagUtils.js +45 -0
  109. package/tgFormValues.js +35 -0
  110. package/tg_modalState.js +47 -0
  111. package/throwFormError.js +16 -0
  112. package/toastr.js +148 -0
  113. package/tryToMatchSchemas.js +264 -0
  114. package/typeToCommonType.js +6 -0
  115. package/useDeepEqualMemo.js +15 -0
  116. package/useDialog.js +63 -0
  117. package/useStableReference.js +9 -0
  118. package/useTableEntities.js +38 -0
  119. package/useTraceUpdate.js +19 -0
  120. package/utils.js +37 -0
  121. package/validateTableWideErrors.js +160 -0
  122. package/viewColumn.js +97 -0
  123. package/withField.js +20 -0
  124. package/withFields.js +11 -0
  125. package/withLocalStorage.js +11 -0
  126. package/withSelectTableRecords.js +43 -0
  127. package/withSelectedEntities.js +65 -0
  128. package/withStore.js +10 -0
  129. package/withTableParams.js +288 -0
  130. package/wrapDialog.js +116 -0
  131. package/src/AdvancedOptions.spec.js +0 -26
  132. package/src/AsyncValidateFieldSpinner/index.js +0 -12
  133. package/src/BlueprintError/index.js +0 -14
  134. package/src/BounceLoader/index.js +0 -16
  135. package/src/BounceLoader/style.css +0 -45
  136. package/src/CollapsibleCard/index.js +0 -68
  137. package/src/CollapsibleCard/style.css +0 -23
  138. package/src/DNALoader/index.js +0 -20
  139. package/src/DNALoader/style.css +0 -251
  140. package/src/DataTable/index.js +0 -3213
  141. package/src/DataTable/style.css +0 -608
  142. package/src/DataTable/utils/index.js +0 -55
  143. package/src/DataTable/utils/queryParams.js +0 -1058
  144. package/src/DialogFooter/index.js +0 -86
  145. package/src/DialogFooter/style.css +0 -9
  146. package/src/FormComponents/index.js +0 -1266
  147. package/src/FormComponents/style.css +0 -275
  148. package/src/FormComponents/utils.js +0 -6
  149. package/src/HotkeysDialog/index.js +0 -79
  150. package/src/HotkeysDialog/style.css +0 -54
  151. package/src/InfoHelper/index.js +0 -78
  152. package/src/InfoHelper/style.css +0 -7
  153. package/src/IntentText/index.js +0 -18
  154. package/src/Loading/index.js +0 -70
  155. package/src/Loading/style.css +0 -4
  156. package/src/MenuBar/index.js +0 -423
  157. package/src/MenuBar/style.css +0 -45
  158. package/src/PromptUnsavedChanges/index.js +0 -38
  159. package/src/ResizableDraggableDialog/index.js +0 -141
  160. package/src/ResizableDraggableDialog/style.css +0 -42
  161. package/src/ScrollToTop/index.js +0 -72
  162. package/src/TagSelect/index.js +0 -69
  163. package/src/TagSelect/style.css +0 -13
  164. package/src/TgHtmlSelect/index.js +0 -20
  165. package/src/TgSelect/index.js +0 -537
  166. package/src/TgSelect/style.css +0 -61
  167. package/src/TgSuggest/index.js +0 -124
  168. package/src/Timeline/index.js +0 -15
  169. package/src/enhancers/withDialog/index.js +0 -196
  170. package/src/showConfirmationDialog/index.js +0 -148
  171. /package/{src/DataTable/CellDragHandle.js → CellDragHandle.js} +0 -0
  172. /package/{src/DataTable/ColumnFilterMenu.js → ColumnFilterMenu.js} +0 -0
  173. /package/{src/DataTable/Columns.js → Columns.js} +0 -0
  174. /package/{src/DataTable/DisabledLoadingComponent.js → DisabledLoadingComponent.js} +0 -0
  175. /package/{src/DataTable/DisplayOptions.js → DisplayOptions.js} +0 -0
  176. /package/{src/DataTable/DropdownCell.js → DropdownCell.js} +0 -0
  177. /package/{src/DataTable/EditableCell.js → EditableCell.js} +0 -0
  178. /package/{src/FormComponents/FormSeparator.js → FormSeparator.js} +0 -0
  179. /package/{src/FormComponents/LoadingDots.js → LoadingDots.js} +0 -0
  180. /package/{src/DataTable/PagingTool.js → PagingTool.js} +0 -0
  181. /package/{src/DataTable/RenderCell.js → RenderCell.js} +0 -0
  182. /package/{src/DataTable/SearchBar.js → SearchBar.js} +0 -0
  183. /package/{src/DataTable/SortableColumns.js → SortableColumns.js} +0 -0
  184. /package/{src/DataTable/TableFormTrackerContext.js → TableFormTrackerContext.js} +0 -0
  185. /package/{src/DataTable/ThComponent.js → ThComponent.js} +0 -0
  186. /package/{src/Timeline/TimelineEvent.js → TimelineEvent.js} +0 -0
  187. /package/{src/FormComponents/Uploader.js → Uploader.js} +0 -0
  188. /package/{src/utils/adHoc.js → adHoc.js} +0 -0
  189. /package/{src/utils/basicHandleActionsWithFullState.js → basicHandleActionsWithFullState.js} +0 -0
  190. /package/{src/utils/browserUtils.js → browserUtils.js} +0 -0
  191. /package/{src/utils/combineReducersWithFullState.js → combineReducersWithFullState.js} +0 -0
  192. /package/{src/utils/commandControls.js → commandControls.js} +0 -0
  193. /package/{src/utils/commandUtils.js → commandUtils.js} +0 -0
  194. /package/{src/DataTable/utils/convertSchema.js → convertSchema.js} +0 -0
  195. /package/{src/DataTable/dataTableEnhancer.js → dataTableEnhancer.js} +0 -0
  196. /package/{src/DataTable/defaultFormatters.js → defaultFormatters.js} +0 -0
  197. /package/{src/DataTable/defaultValidators.js → defaultValidators.js} +0 -0
  198. /package/{src/utils/determineBlackOrWhiteTextColor.js → determineBlackOrWhiteTextColor.js} +0 -0
  199. /package/{src/DataTable/editCellHelper.js → editCellHelper.js} +0 -0
  200. /package/{src/DataTable/utils/formatPasteData.js → formatPasteData.js} +0 -0
  201. /package/{src/DataTable/utils/getAllRows.js → getAllRows.js} +0 -0
  202. /package/{src/DataTable/utils/getCellCopyText.js → getCellCopyText.js} +0 -0
  203. /package/{src/DataTable/utils/getCellInfo.js → getCellInfo.js} +0 -0
  204. /package/{src/DataTable/getCellVal.js → getCellVal.js} +0 -0
  205. /package/{src/utils/getDayjsFormatter.js → getDayjsFormatter.js} +0 -0
  206. /package/{src/DataTable/utils/getFieldPathToField.js → getFieldPathToField.js} +0 -0
  207. /package/{src/DataTable/utils/getIdOrCodeOrIndex.js → getIdOrCodeOrIndex.js} +0 -0
  208. /package/{src/DataTable/utils/getLastSelectedEntity.js → getLastSelectedEntity.js} +0 -0
  209. /package/{src/DataTable/utils/getNewEntToSelect.js → getNewEntToSelect.js} +0 -0
  210. /package/{src/FormComponents/getNewName.js → getNewName.js} +0 -0
  211. /package/{src/DataTable/utils/getRowCopyText.js → getRowCopyText.js} +0 -0
  212. /package/{src/DataTable/utils/getTableConfigFromStorage.js → getTableConfigFromStorage.js} +0 -0
  213. /package/{src/utils/getTextFromEl.js → getTextFromEl.js} +0 -0
  214. /package/{src/DataTable/getVals.js → getVals.js} +0 -0
  215. /package/{src/DataTable/utils/handleCopyColumn.js → handleCopyColumn.js} +0 -0
  216. /package/{src/DataTable/utils/handleCopyHelper.js → handleCopyHelper.js} +0 -0
  217. /package/{src/DataTable/utils/handleCopyRows.js → handleCopyRows.js} +0 -0
  218. /package/{src/DataTable/utils/handleCopyTable.js → handleCopyTable.js} +0 -0
  219. /package/{src/utils/handlerHelpers.js → handlerHelpers.js} +0 -0
  220. /package/{src/utils/hotkeyUtils.js → hotkeyUtils.js} +0 -0
  221. /package/{src/utils/hooks/index.js → index.js} +0 -0
  222. /package/{src/DataTable/utils/isBottomRightCornerOfRectangle.js → isBottomRightCornerOfRectangle.js} +0 -0
  223. /package/{src/DataTable/utils/isEntityClean.js → isEntityClean.js} +0 -0
  224. /package/{src/DataTable/isTruthy.js → isTruthy.js} +0 -0
  225. /package/{src/DataTable/isValueEmpty.js → isValueEmpty.js} +0 -0
  226. /package/{src/FormComponents/itemUpload.js → itemUpload.js} +0 -0
  227. /package/{src/utils/menuUtils.js → menuUtils.js} +0 -0
  228. /package/{src/utils/popoverOverflowModifiers.js → popoverOverflowModifiers.js} +0 -0
  229. /package/{src/DataTable/utils/primarySelectedValue.js → primarySelectedValue.js} +0 -0
  230. /package/{src/utils/pureNoFunc.js → pureNoFunc.js} +0 -0
  231. /package/{src/DataTable/utils/removeCleanRows.js → removeCleanRows.js} +0 -0
  232. /package/{src/utils/renderOnDoc.js → renderOnDoc.js} +0 -0
  233. /package/{src/DataTable/utils/rowClick.js → rowClick.js} +0 -0
  234. /package/{src/DataTable/utils/selection.js → selection.js} +0 -0
  235. /package/{src/utils/showProgressToast.js → showProgressToast.js} +0 -0
  236. /package/{src/FormComponents/sortify.js → sortify.js} +0 -0
  237. /package/src/{utils/tagUtils.js → tagUtils.js} +0 -0
  238. /package/src/{utils/tgFormValues.js → tgFormValues.js} +0 -0
  239. /package/src/{enhancers/withDialog/tg_modalState.js → tg_modalState.js} +0 -0
  240. /package/src/{FormComponents/tryToMatchSchemas.js → tryToMatchSchemas.js} +0 -0
  241. /package/src/{utils/hooks/useDeepEqualMemo.js → useDeepEqualMemo.js} +0 -0
  242. /package/src/{utils/hooks/useStableReference.js → useStableReference.js} +0 -0
  243. /package/src/{DataTable/utils/useTableEntities.js → useTableEntities.js} +0 -0
  244. /package/src/{utils/useTraceUpdate.js → useTraceUpdate.js} +0 -0
  245. /package/src/{DataTable/utils/utils.js → utils.js} +0 -0
  246. /package/src/{DataTable/validateTableWideErrors.js → validateTableWideErrors.js} +0 -0
  247. /package/src/{DataTable/viewColumn.js → viewColumn.js} +0 -0
  248. /package/src/{enhancers/withField.js → withField.js} +0 -0
  249. /package/src/{enhancers/withFields.js → withFields.js} +0 -0
  250. /package/src/{enhancers/withLocalStorage.js → withLocalStorage.js} +0 -0
  251. /package/src/{utils/withSelectTableRecords.js → withSelectTableRecords.js} +0 -0
  252. /package/src/{DataTable/utils/withSelectedEntities.js → withSelectedEntities.js} +0 -0
  253. /package/src/{utils/withStore.js → withStore.js} +0 -0
  254. /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
+ );
@@ -0,0 +1,5 @@
1
+ export function filterLocalEntitiesToHasura(records: any, { where, order_by, limit, offset, isInfinite }?: {}): {
2
+ entities: any[];
3
+ entitiesAcrossPages: any[];
4
+ entityCount: number;
5
+ };
@@ -0,0 +1,2 @@
1
+ export function initializeHasuraWhereAndFilter(additionalFilter: any, where: {} | undefined, currentParams: any): void;
2
+ export function addCustomColumnFilters(where: any, fields: any, currentParams: any): void;
@@ -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, urlConnected, defaults, schema, isInfinite, entities, isLocalCall, additionalFilter, additionalOrFilter, doNotCoercePageSize, noOrderError, isCodeModel, ownProps }: {
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
- page: any;
44
- pageSize: any;
45
- order: any;
46
- filters: any;
47
- searchTerm: any;
39
+ entities: any[];
40
+ entitiesAcrossPages: any[];
41
+ entityCount: number;
48
42
  } | {
49
43
  variables: {
50
- sort: never[];
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
@@ -0,0 +1,6 @@
1
+ .tg-fillWindow {
2
+ background: white;
3
+ }
4
+ .bp3-dark .tg-fillWindow {
5
+ background: #293742;
6
+ }
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
- "Contains",
353
- "Not Contains",
354
- "Starts With",
355
- "Ends With",
356
- "Is Exactly",
357
- "Regex",
358
- "In List",
359
- "Not In List",
360
- "Is Empty",
361
- "Not Empty"
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
- "Contains",
366
- "Not Contains",
367
- "Starts With",
368
- "Ends With",
369
- "Is Exactly",
370
- "Regex"
365
+ "contains",
366
+ "notContains",
367
+ "startsWith",
368
+ "endsWith",
369
+ "isExactly",
370
+ "regex"
371
371
  ];
372
372
  } else if (dataType === "boolean") {
373
- filterMenuItems = ["True", "False"];
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
- "Greater Than",
380
- "Less Than",
381
- "In Range",
382
- "Outside Range",
383
- "Equal To",
384
- "In List",
385
- "Not In List"
376
+ "greaterThan",
377
+ "lessThan",
378
+ "inRange",
379
+ "outsideRange",
380
+ "equalTo",
381
+ "inList",
382
+ "notInList"
386
383
  ];
387
384
  } else if (dataType === "timestamp") {
388
- filterMenuItems = ["Is Between", "Not Between", "Is Before", "Is After"];
385
+ filterMenuItems = ["isBetween", "notBetween", "isBefore", "isAfter"];
389
386
  }
390
- return filterMenuItems;
387
+ return filterMenuItems.map(item => startCase(item));
391
388
  }
@@ -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
+ };
@@ -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
+ &#10005;
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;