@teselagen/ui 0.7.35 → 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 (160) hide show
  1. package/isBeingCalledExcessively.js +1 -0
  2. package/package.json +1 -1
  3. package/DataTable/utils/filterLocalEntitiesToHasura.d.ts +0 -5
  4. package/DataTable/utils/initializeHasuraWhereAndFilter.d.ts +0 -2
  5. package/DataTable/utils/tableQueryParamsToHasuraClauses.d.ts +0 -26
  6. package/src/AdvancedOptions.js +0 -33
  7. package/src/AdvancedOptions.spec.js +0 -26
  8. package/src/AssignDefaultsModeContext.js +0 -22
  9. package/src/AsyncValidateFieldSpinner/index.js +0 -12
  10. package/src/BlueprintError/index.js +0 -14
  11. package/src/BounceLoader/index.js +0 -16
  12. package/src/BounceLoader/style.css +0 -45
  13. package/src/CollapsibleCard/index.js +0 -68
  14. package/src/CollapsibleCard/style.css +0 -23
  15. package/src/DNALoader/index.js +0 -20
  16. package/src/DNALoader/style.css +0 -251
  17. package/src/DataTable/CellDragHandle.js +0 -132
  18. package/src/DataTable/ColumnFilterMenu.js +0 -62
  19. package/src/DataTable/Columns.js +0 -979
  20. package/src/DataTable/DisabledLoadingComponent.js +0 -15
  21. package/src/DataTable/DisplayOptions.js +0 -199
  22. package/src/DataTable/DropdownCell.js +0 -61
  23. package/src/DataTable/EditableCell.js +0 -44
  24. package/src/DataTable/FilterAndSortMenu.js +0 -388
  25. package/src/DataTable/PagingTool.js +0 -225
  26. package/src/DataTable/RenderCell.js +0 -191
  27. package/src/DataTable/SearchBar.js +0 -69
  28. package/src/DataTable/SortableColumns.js +0 -100
  29. package/src/DataTable/TableFormTrackerContext.js +0 -10
  30. package/src/DataTable/ThComponent.js +0 -44
  31. package/src/DataTable/dataTableEnhancer.js +0 -41
  32. package/src/DataTable/defaultFormatters.js +0 -32
  33. package/src/DataTable/defaultValidators.js +0 -40
  34. package/src/DataTable/editCellHelper.js +0 -44
  35. package/src/DataTable/getCellVal.js +0 -20
  36. package/src/DataTable/getVals.js +0 -8
  37. package/src/DataTable/index.js +0 -3209
  38. package/src/DataTable/isTruthy.js +0 -12
  39. package/src/DataTable/isValueEmpty.js +0 -3
  40. package/src/DataTable/style.css +0 -608
  41. package/src/DataTable/utils/convertSchema.js +0 -69
  42. package/src/DataTable/utils/filterLocalEntitiesToHasura.js +0 -236
  43. package/src/DataTable/utils/filterLocalEntitiesToHasura.test.js +0 -587
  44. package/src/DataTable/utils/formatPasteData.js +0 -16
  45. package/src/DataTable/utils/getAllRows.js +0 -11
  46. package/src/DataTable/utils/getCellCopyText.js +0 -7
  47. package/src/DataTable/utils/getCellInfo.js +0 -36
  48. package/src/DataTable/utils/getFieldPathToField.js +0 -7
  49. package/src/DataTable/utils/getIdOrCodeOrIndex.js +0 -9
  50. package/src/DataTable/utils/getLastSelectedEntity.js +0 -11
  51. package/src/DataTable/utils/getNewEntToSelect.js +0 -25
  52. package/src/DataTable/utils/getRowCopyText.js +0 -28
  53. package/src/DataTable/utils/getTableConfigFromStorage.js +0 -5
  54. package/src/DataTable/utils/handleCopyColumn.js +0 -21
  55. package/src/DataTable/utils/handleCopyHelper.js +0 -15
  56. package/src/DataTable/utils/handleCopyRows.js +0 -23
  57. package/src/DataTable/utils/handleCopyTable.js +0 -16
  58. package/src/DataTable/utils/index.js +0 -55
  59. package/src/DataTable/utils/initializeHasuraWhereAndFilter.js +0 -26
  60. package/src/DataTable/utils/isBottomRightCornerOfRectangle.js +0 -20
  61. package/src/DataTable/utils/isEntityClean.js +0 -15
  62. package/src/DataTable/utils/primarySelectedValue.js +0 -1
  63. package/src/DataTable/utils/queryParams.js +0 -350
  64. package/src/DataTable/utils/removeCleanRows.js +0 -22
  65. package/src/DataTable/utils/rowClick.js +0 -181
  66. package/src/DataTable/utils/selection.js +0 -8
  67. package/src/DataTable/utils/tableQueryParamsToHasuraClauses.js +0 -253
  68. package/src/DataTable/utils/tableQueryParamsToHasuraClauses.test.js +0 -206
  69. package/src/DataTable/utils/useTableEntities.js +0 -38
  70. package/src/DataTable/utils/utils.js +0 -37
  71. package/src/DataTable/utils/withSelectedEntities.js +0 -65
  72. package/src/DataTable/utils/withTableParams.js +0 -288
  73. package/src/DataTable/validateTableWideErrors.js +0 -160
  74. package/src/DataTable/viewColumn.js +0 -97
  75. package/src/DialogFooter/index.js +0 -86
  76. package/src/DialogFooter/style.css +0 -9
  77. package/src/DropdownButton.js +0 -36
  78. package/src/FillWindow.css +0 -6
  79. package/src/FillWindow.js +0 -69
  80. package/src/FormComponents/FormSeparator.js +0 -9
  81. package/src/FormComponents/LoadingDots.js +0 -14
  82. package/src/FormComponents/Uploader.js +0 -1278
  83. package/src/FormComponents/getNewName.js +0 -31
  84. package/src/FormComponents/index.js +0 -1266
  85. package/src/FormComponents/itemUpload.js +0 -84
  86. package/src/FormComponents/sortify.js +0 -73
  87. package/src/FormComponents/style.css +0 -275
  88. package/src/FormComponents/tryToMatchSchemas.js +0 -264
  89. package/src/FormComponents/utils.js +0 -6
  90. package/src/HotkeysDialog/index.js +0 -79
  91. package/src/HotkeysDialog/style.css +0 -54
  92. package/src/InfoHelper/index.js +0 -78
  93. package/src/InfoHelper/style.css +0 -7
  94. package/src/IntentText/index.js +0 -18
  95. package/src/Loading/index.js +0 -70
  96. package/src/Loading/style.css +0 -4
  97. package/src/MatchHeaders.js +0 -234
  98. package/src/MenuBar/index.js +0 -423
  99. package/src/MenuBar/style.css +0 -45
  100. package/src/PromptUnsavedChanges/index.js +0 -38
  101. package/src/ResizableDraggableDialog/index.js +0 -141
  102. package/src/ResizableDraggableDialog/style.css +0 -42
  103. package/src/ScrollToTop/index.js +0 -72
  104. package/src/SimpleStepViz.js +0 -22
  105. package/src/Tag.js +0 -112
  106. package/src/TagSelect/index.js +0 -69
  107. package/src/TagSelect/style.css +0 -13
  108. package/src/TgHtmlSelect/index.js +0 -20
  109. package/src/TgSelect/index.js +0 -537
  110. package/src/TgSelect/style.css +0 -61
  111. package/src/TgSuggest/index.js +0 -124
  112. package/src/Timeline/TimelineEvent.js +0 -31
  113. package/src/Timeline/index.js +0 -15
  114. package/src/Timeline/style.css +0 -29
  115. package/src/UploadCsvWizard.css +0 -4
  116. package/src/UploadCsvWizard.js +0 -719
  117. package/src/autoTooltip.js +0 -201
  118. package/src/constants.js +0 -1
  119. package/src/customIcons.js +0 -361
  120. package/src/enhancers/withDialog/index.js +0 -196
  121. package/src/enhancers/withDialog/tg_modalState.js +0 -47
  122. package/src/enhancers/withField.js +0 -20
  123. package/src/enhancers/withFields.js +0 -11
  124. package/src/enhancers/withLocalStorage.js +0 -11
  125. package/src/index.js +0 -88
  126. package/src/rerenderOnWindowResize.js +0 -26
  127. package/src/showAppSpinner.js +0 -12
  128. package/src/showConfirmationDialog/index.js +0 -148
  129. package/src/showDialogOnDocBody.js +0 -33
  130. package/src/style.css +0 -265
  131. package/src/throwFormError.js +0 -16
  132. package/src/toastr.js +0 -148
  133. package/src/typeToCommonType.js +0 -6
  134. package/src/useDialog.js +0 -63
  135. package/src/utils/adHoc.js +0 -10
  136. package/src/utils/basicHandleActionsWithFullState.js +0 -14
  137. package/src/utils/browserUtils.js +0 -3
  138. package/src/utils/combineReducersWithFullState.js +0 -14
  139. package/src/utils/commandControls.js +0 -82
  140. package/src/utils/commandUtils.js +0 -112
  141. package/src/utils/determineBlackOrWhiteTextColor.js +0 -4
  142. package/src/utils/getDayjsFormatter.js +0 -35
  143. package/src/utils/getTextFromEl.js +0 -28
  144. package/src/utils/handlerHelpers.js +0 -24
  145. package/src/utils/hooks/index.js +0 -1
  146. package/src/utils/hooks/useDeepEqualMemo.js +0 -15
  147. package/src/utils/hooks/useStableReference.js +0 -9
  148. package/src/utils/hotkeyUtils.js +0 -131
  149. package/src/utils/isBeingCalledExcessively.js +0 -24
  150. package/src/utils/menuUtils.js +0 -433
  151. package/src/utils/popoverOverflowModifiers.js +0 -11
  152. package/src/utils/pureNoFunc.js +0 -31
  153. package/src/utils/renderOnDoc.js +0 -32
  154. package/src/utils/showProgressToast.js +0 -22
  155. package/src/utils/tagUtils.js +0 -45
  156. package/src/utils/tgFormValues.js +0 -35
  157. package/src/utils/useTraceUpdate.js +0 -19
  158. package/src/utils/withSelectTableRecords.js +0 -43
  159. package/src/utils/withStore.js +0 -10
  160. package/src/wrapDialog.js +0 -116
@@ -1,112 +0,0 @@
1
- import { startCase } from "lodash-es";
2
-
3
- // Generic factory function to create command objects.
4
- // TODO add documentation
5
- export function genericCommandFactory(config) {
6
- const out = {};
7
- // eslint-disable-next-line no-unused-vars
8
- for (const cmdId in config.commandDefs) {
9
- const def = config.commandDefs[cmdId];
10
- const command = { id: cmdId };
11
- command.execute = (...execArgs) => {
12
- config.handleReturn(
13
- cmdId,
14
- def.handler &&
15
- def.handler.apply(command, config.getArguments(cmdId, execArgs))
16
- );
17
- };
18
-
19
- const properties = [
20
- "icon",
21
- "name",
22
- "component",
23
- "shortName",
24
- "description",
25
- "hotkey",
26
- "hotkeyProps",
27
- "isDisabled",
28
- "submenu",
29
- "isActive",
30
- "isHidden",
31
- "tooltip",
32
- "inactiveIcon",
33
- "inactiveName"
34
- ];
35
-
36
- properties.forEach(prop => {
37
- if (def[prop] !== undefined) {
38
- if (typeof def[prop] === "function") {
39
- Object.defineProperty(command, prop, {
40
- get: () => {
41
- return def[prop].apply(command, config.getArguments(cmdId, []));
42
- }
43
- });
44
- } else {
45
- command[prop] = def[prop];
46
- }
47
- }
48
- });
49
-
50
- // If no name was specified in the definition, let's try to give some
51
- // auto-generated names
52
- if (!def.name) {
53
- command.name = startCase(cmdId);
54
- if (def.toggle && cmdId.startsWith("toggle")) {
55
- command.name = startCase(cmdId.replace("toggle", def.toggle[0] || ""));
56
- command.inactiveName = startCase(
57
- cmdId.replace("toggle", def.toggle[1] || "")
58
- );
59
- command.shortName = startCase(cmdId.replace("toggle", ""));
60
- }
61
- }
62
-
63
- out[cmdId] = command;
64
- }
65
-
66
- return out;
67
- }
68
-
69
- // Extract hotkey props from the given commands or command defs, returning
70
- // a mapping of command ids to hotkey prop objects
71
- export function getCommandHotkeys(commandsOrDefs) {
72
- const hotkeyDefs = {};
73
- Object.keys(commandsOrDefs).forEach(cmdId => {
74
- if (commandsOrDefs[cmdId].hotkey) {
75
- hotkeyDefs[cmdId] = {
76
- combo: commandsOrDefs[cmdId].hotkey,
77
- label: commandsOrDefs[cmdId].name || startCase(cmdId),
78
- ...commandsOrDefs[cmdId].hotkeyProps
79
- };
80
- }
81
- });
82
-
83
- return hotkeyDefs;
84
- }
85
-
86
- // Extract handler functions from the given commands, returning a mapping of
87
- // command ids to handlers (directly - no checks added).
88
- export function getCommandHandlers(commands) {
89
- const handlers = {};
90
- Object.keys(commands).forEach(cmdId => {
91
- handlers[cmdId] = commands[cmdId].execute;
92
- });
93
-
94
- return handlers;
95
- }
96
-
97
- // Get hotkey handler functions for the given commands, returning a mapping of
98
- // command ids to hotkey handlers.
99
- export function getCommandHotkeyHandlers(commands) {
100
- const handlers = {};
101
- Object.keys(commands).forEach(cmdId => {
102
- if (commands[cmdId].hotkey) {
103
- handlers[cmdId] = event => {
104
- if (!commands[cmdId].isDisabled && !commands[cmdId].isHidden) {
105
- commands[cmdId].execute({ event, viaHotkey: true });
106
- }
107
- };
108
- }
109
- });
110
-
111
- return handlers;
112
- }
@@ -1,4 +0,0 @@
1
- /* Copyright (C) 2018 TeselaGen Biotechnology, Inc. */
2
- import Color from "color";
3
-
4
- export default c => (Color(c).isLight() ? "#000000" : "#FFFFFF");
@@ -1,35 +0,0 @@
1
- import dayjs from "dayjs";
2
- import LocalizedFormat from "dayjs/plugin/localizedFormat";
3
- import localeData from "dayjs/plugin/localeData";
4
-
5
- dayjs.extend(localeData);
6
- dayjs.extend(LocalizedFormat);
7
- const userLocale = Intl.DateTimeFormat().resolvedOptions().locale;
8
-
9
- if (userLocale) {
10
- const requireLocale = (newLocale, skipCall) => {
11
- if (dayjs.locale() !== newLocale) {
12
- try {
13
- require(`dayjs/locale/${newLocale}.js`);
14
- dayjs.locale(newLocale);
15
- } catch (error) {
16
- // error
17
- if (!skipCall && newLocale.includes("-")) {
18
- requireLocale(newLocale.split("-")[0], true);
19
- }
20
- }
21
- }
22
- };
23
- const localeToUse = userLocale.toLowerCase();
24
- requireLocale(localeToUse);
25
- }
26
-
27
- export default function getDayjsFormatter(format) {
28
- return {
29
- formatDate: date => dayjs(date).format(format),
30
- parseDate: str => dayjs(str, format).toDate(),
31
- placeholder: format?.toLowerCase().includes("l")
32
- ? dayjs.Ls[dayjs.locale()]?.formats[format.toUpperCase()]
33
- : format
34
- };
35
- }
@@ -1,28 +0,0 @@
1
- import React from "react";
2
-
3
- export default function getTextFromEl(el, options = {}) {
4
- const { lowerCase } = options;
5
- if (React.isValidElement(el)) {
6
- return el && el.props && el.props.children
7
- ? (el.props.children.reduce
8
- ? el.props.children
9
- : [el.props.children]
10
- ).reduce((acc, child) => {
11
- if (child && child.props && child.props.children) {
12
- acc += getTextFromEl(child);
13
- } else if (typeof child === "string") {
14
- if (lowerCase) {
15
- acc += child.toLowerCase();
16
- } else {
17
- acc += child;
18
- }
19
- } else if (typeof child === "number") {
20
- acc += child + "";
21
- }
22
- return acc;
23
- }, "")
24
- : "";
25
- } else {
26
- return el;
27
- }
28
- }
@@ -1,24 +0,0 @@
1
- export const onEnterHelper = callback => ({
2
- onKeyDown: event => {
3
- if (event.key === "Enter") {
4
- callback(event);
5
- }
6
- }
7
- });
8
-
9
- export const onBlurHelper = callback => ({
10
- onBlur: event => {
11
- callback(event);
12
- }
13
- });
14
-
15
- export const onEnterOrBlurHelper = callback => ({
16
- onKeyDown: function (event) {
17
- if (event.key === "Enter") {
18
- callback(event);
19
- }
20
- },
21
- onBlur: function (event) {
22
- callback(event);
23
- }
24
- });
@@ -1 +0,0 @@
1
- export { useDeepEqualMemo } from "./useDeepEqualMemo";
@@ -1,15 +0,0 @@
1
- import { isEqual } from "lodash-es";
2
- import { useEffect, useRef } from "react";
3
-
4
- export const useDeepEqualMemo = value => {
5
- const ref = useRef();
6
- if (!isEqual(value, ref.current)) {
7
- ref.current = value;
8
- }
9
- return ref.current;
10
- };
11
-
12
- export const useDeepEqualEffect = (effect, deps) => {
13
- // eslint-disable-next-line react-hooks/exhaustive-deps
14
- return useEffect(effect, useDeepEqualMemo(deps));
15
- };
@@ -1,9 +0,0 @@
1
- import { useEffect, useRef } from "react";
2
-
3
- export const useStableReference = value => {
4
- const ref = useRef();
5
- useEffect(() => {
6
- ref.current = value;
7
- }, [value]);
8
- return ref;
9
- };
@@ -1,131 +0,0 @@
1
- import React, { useMemo } from "react";
2
- import { useHotkeys } from "@blueprintjs/core";
3
- import { startCase } from "lodash-es";
4
-
5
- // This has been mostly superseded by blueprint's KeyCombo component, but may
6
- // still be useful for cases where we need plain text
7
- export function comboToLabel(def, useSymbols = true) {
8
- const combo = typeof def === "string" ? def : def.combo;
9
-
10
- if (useSymbols) {
11
- let parts = combo.replace("++", "+plus").split("+");
12
- parts = parts.map(p => symbols[p] || startCase(p) || p);
13
- return parts.join("");
14
- } else {
15
- return combo
16
- .split("+")
17
- .map(p => startCase(p) || p)
18
- .join(" + ")
19
- .replace("Meta", isMac ? "Cmd" : "Ctrl")
20
- .replace("Mod", isMac ? "Cmd" : "Ctrl")
21
- .replace("Alt", isMac ? "Option" : "Alt");
22
- }
23
- }
24
-
25
- // HOF to get hotkey combos by id
26
- export const hotkeysById =
27
- (hotkeys, mode = "raw") =>
28
- id => {
29
- const def = getHotkeyProps(hotkeys[id]);
30
- return (
31
- def &&
32
- (mode === "raw" ? def.combo : comboToLabel(def.combo, mode === "symbols"))
33
- );
34
- };
35
-
36
- // Translate shorthand array if needed
37
- export const getHotkeyProps = (def, id) => {
38
- let out;
39
- if (typeof def === "string") {
40
- out = { combo: def };
41
- } else if (def instanceof Array) {
42
- out = { combo: def[0], label: def[1], ...(def[2] || {}) };
43
- } else {
44
- out = def;
45
- }
46
- out.label = out.label || startCase(id);
47
- return out;
48
- };
49
-
50
- /*
51
- * HOC to add hotkey support to components. Use this instead of blueprint's one.
52
- *
53
- * Arguments:
54
- * - hotkeySpec: either a named hotkey section previously registered, or an
55
- * object mapping command ids to hotkey definitions, where each hotkey can
56
- * be either:
57
- * - a string consisting in the key combo (e.g. 'ctrl+shift+x')
58
- * - an array holding the combo, label, and an object with any other props
59
- * - an object holding all props
60
- * - handlers: an object mapping command ids to handler functions
61
- * - options: an object that may specify the follownig options:
62
- * - functional: boolean indicating if the wrapped component will be a
63
- * functional stateless component instead of a class-based one
64
- *
65
- * Returns a function that can be invoked with a component class, or a
66
- * stateless component function (if specified in the options) and returns
67
- * the decorated class. It may also be invoked without arguments to generate a
68
- * dummy ad-hoc component with no output.
69
- *
70
- */
71
- export const withHotkeys = (hotkeys, handlers) => {
72
- return ({ children } = {}) => {
73
- const memoedHotkeys = useMemo(
74
- () =>
75
- Object.keys(hotkeys).map(id => {
76
- const { ...props } = getHotkeyProps(hotkeys[id], id);
77
- return {
78
- key: id,
79
- global: props.global !== false,
80
- onKeyDown: function (e) {
81
- return handlers[id](e);
82
- },
83
- ...props
84
- };
85
- }),
86
- []
87
- );
88
-
89
- const { handleKeyDown, handleKeyUp } = useHotkeys(memoedHotkeys);
90
- const newProps = {
91
- tabIndex: 0,
92
- onKeyDown: handleKeyDown,
93
- onKeyUp: handleKeyUp
94
- };
95
- return children ? ( //tnr: if children are passed, we'll clone them with the new props
96
- React.cloneElement(children, newProps)
97
- ) : (
98
- //if not, then we'll return a div that can be used
99
- <div className="hotkeyHandler" {...newProps}></div>
100
- );
101
- };
102
- };
103
-
104
- const isMac = navigator.userAgent.includes("Mac OS X");
105
-
106
- // TODO maybe avoid using symbols by default when not on Mac?
107
- // Anyway, alternative 'Key + Key' description is provided as well
108
- const symbols = {
109
- cmd: "⌘",
110
- meta: "⌘",
111
- ctrl: "⌃",
112
- alt: "⌥",
113
- shift: "⇧",
114
- esc: "␛", //'⎋',
115
- enter: "⏎",
116
- backspace: "⌫",
117
- plus: "+",
118
- tab: "⇥",
119
- space: "␣",
120
- capslock: "⇪",
121
- pageup: "⇞",
122
- pagedown: "⇟",
123
- home: "↖",
124
- end: "↘",
125
- left: "←",
126
- right: "→",
127
- up: "↑",
128
- down: "↓"
129
- };
130
-
131
- symbols.mod = symbols[isMac ? "meta" : "ctrl"];
@@ -1,24 +0,0 @@
1
- const keyCount = {};
2
- export const isBeingCalledExcessively = ({ uniqName }) => {
3
- if (process.env.NODE_ENV !== "development") {
4
- return;
5
- }
6
- if (!uniqName) {
7
- throw new Error("uniqName is required");
8
- }
9
- // if this function is hit more than 10 times in a row in 2 seconds with the same uniqName then throw an error
10
- if (keyCount[uniqName + "_timeout"]) {
11
- clearTimeout(keyCount[uniqName + "_timeout"]);
12
- }
13
- keyCount[uniqName] = keyCount[uniqName] || 0;
14
- keyCount[uniqName]++;
15
-
16
- keyCount[uniqName + "_timeout"] = setTimeout(() => {
17
- keyCount[uniqName] = 0;
18
- }, 2000);
19
-
20
- if (keyCount[uniqName] > 20) {
21
- keyCount[uniqName] = 0;
22
- throw new Error(`isBeingCalledExcessively: ${uniqName}`);
23
- }
24
- };