@teselagen/ui 0.7.35 → 0.8.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.
Files changed (128) hide show
  1. package/index.cjs.js +1 -2
  2. package/index.es.js +1 -2
  3. package/package.json +1 -1
  4. package/src/DataTable/Columns.js +1 -1
  5. package/src/DataTable/DisplayOptions.js +1 -1
  6. package/src/DataTable/FilterAndSortMenu.js +30 -27
  7. package/src/DataTable/index.js +14 -3
  8. package/src/DataTable/utils/queryParams.js +771 -64
  9. package/src/DataTable/utils/withTableParams.js +16 -3
  10. package/src/index.js +0 -1
  11. package/src/utils/isBeingCalledExcessively.js +14 -7
  12. package/AdvancedOptions.js +0 -33
  13. package/AssignDefaultsModeContext.js +0 -22
  14. package/CellDragHandle.js +0 -132
  15. package/ColumnFilterMenu.js +0 -62
  16. package/Columns.js +0 -979
  17. package/DataTable/utils/filterLocalEntitiesToHasura.d.ts +0 -5
  18. package/DataTable/utils/initializeHasuraWhereAndFilter.d.ts +0 -2
  19. package/DataTable/utils/tableQueryParamsToHasuraClauses.d.ts +0 -26
  20. package/DisabledLoadingComponent.js +0 -15
  21. package/DisplayOptions.js +0 -199
  22. package/DropdownButton.js +0 -36
  23. package/DropdownCell.js +0 -61
  24. package/EditableCell.js +0 -44
  25. package/FillWindow.css +0 -6
  26. package/FillWindow.js +0 -69
  27. package/FilterAndSortMenu.js +0 -391
  28. package/FormSeparator.js +0 -9
  29. package/LoadingDots.js +0 -14
  30. package/MatchHeaders.js +0 -234
  31. package/PagingTool.js +0 -225
  32. package/RenderCell.js +0 -191
  33. package/SearchBar.js +0 -69
  34. package/SimpleStepViz.js +0 -22
  35. package/SortableColumns.js +0 -100
  36. package/TableFormTrackerContext.js +0 -10
  37. package/Tag.js +0 -112
  38. package/ThComponent.js +0 -44
  39. package/TimelineEvent.js +0 -31
  40. package/UploadCsvWizard.css +0 -4
  41. package/UploadCsvWizard.js +0 -719
  42. package/Uploader.js +0 -1278
  43. package/adHoc.js +0 -10
  44. package/autoTooltip.js +0 -201
  45. package/basicHandleActionsWithFullState.js +0 -14
  46. package/browserUtils.js +0 -3
  47. package/combineReducersWithFullState.js +0 -14
  48. package/commandControls.js +0 -82
  49. package/commandUtils.js +0 -112
  50. package/constants.js +0 -1
  51. package/convertSchema.js +0 -69
  52. package/customIcons.js +0 -361
  53. package/dataTableEnhancer.js +0 -41
  54. package/defaultFormatters.js +0 -32
  55. package/defaultValidators.js +0 -40
  56. package/determineBlackOrWhiteTextColor.js +0 -4
  57. package/editCellHelper.js +0 -44
  58. package/formatPasteData.js +0 -16
  59. package/getAllRows.js +0 -11
  60. package/getCellCopyText.js +0 -7
  61. package/getCellInfo.js +0 -36
  62. package/getCellVal.js +0 -20
  63. package/getDayjsFormatter.js +0 -35
  64. package/getFieldPathToField.js +0 -7
  65. package/getIdOrCodeOrIndex.js +0 -9
  66. package/getLastSelectedEntity.js +0 -11
  67. package/getNewEntToSelect.js +0 -25
  68. package/getNewName.js +0 -31
  69. package/getRowCopyText.js +0 -28
  70. package/getTableConfigFromStorage.js +0 -5
  71. package/getTextFromEl.js +0 -28
  72. package/getVals.js +0 -8
  73. package/handleCopyColumn.js +0 -21
  74. package/handleCopyHelper.js +0 -15
  75. package/handleCopyRows.js +0 -23
  76. package/handleCopyTable.js +0 -16
  77. package/handlerHelpers.js +0 -24
  78. package/hotkeyUtils.js +0 -131
  79. package/index.js +0 -1
  80. package/isBeingCalledExcessively.js +0 -32
  81. package/isBottomRightCornerOfRectangle.js +0 -20
  82. package/isEntityClean.js +0 -15
  83. package/isTruthy.js +0 -12
  84. package/isValueEmpty.js +0 -3
  85. package/itemUpload.js +0 -84
  86. package/menuUtils.js +0 -433
  87. package/popoverOverflowModifiers.js +0 -11
  88. package/primarySelectedValue.js +0 -1
  89. package/pureNoFunc.js +0 -31
  90. package/queryParams.js +0 -1058
  91. package/removeCleanRows.js +0 -22
  92. package/renderOnDoc.js +0 -32
  93. package/rerenderOnWindowResize.js +0 -26
  94. package/rowClick.js +0 -181
  95. package/selection.js +0 -8
  96. package/showAppSpinner.js +0 -12
  97. package/showDialogOnDocBody.js +0 -33
  98. package/showProgressToast.js +0 -22
  99. package/sortify.js +0 -73
  100. package/src/DataTable/utils/filterLocalEntitiesToHasura.js +0 -236
  101. package/src/DataTable/utils/filterLocalEntitiesToHasura.test.js +0 -587
  102. package/src/DataTable/utils/initializeHasuraWhereAndFilter.js +0 -26
  103. package/src/DataTable/utils/tableQueryParamsToHasuraClauses.js +0 -253
  104. package/src/DataTable/utils/tableQueryParamsToHasuraClauses.test.js +0 -206
  105. package/style.css +0 -29
  106. package/tagUtils.js +0 -45
  107. package/tgFormValues.js +0 -35
  108. package/tg_modalState.js +0 -47
  109. package/throwFormError.js +0 -16
  110. package/toastr.js +0 -148
  111. package/tryToMatchSchemas.js +0 -264
  112. package/typeToCommonType.js +0 -6
  113. package/useDeepEqualMemo.js +0 -15
  114. package/useDialog.js +0 -63
  115. package/useStableReference.js +0 -9
  116. package/useTableEntities.js +0 -38
  117. package/useTraceUpdate.js +0 -19
  118. package/utils.js +0 -37
  119. package/validateTableWideErrors.js +0 -160
  120. package/viewColumn.js +0 -97
  121. package/withField.js +0 -20
  122. package/withFields.js +0 -11
  123. package/withLocalStorage.js +0 -11
  124. package/withSelectTableRecords.js +0 -43
  125. package/withSelectedEntities.js +0 -65
  126. package/withStore.js +0 -10
  127. package/withTableParams.js +0 -301
  128. package/wrapDialog.js +0 -116
@@ -1,5 +0,0 @@
1
- export function filterLocalEntitiesToHasura(records: any, { where, order_by, limit, offset, isInfinite }?: {}): {
2
- entities: any[];
3
- entitiesAcrossPages: any[];
4
- entityCount: number;
5
- };
@@ -1,2 +0,0 @@
1
- export function initializeHasuraWhereAndFilter(additionalFilter: any, where: {} | undefined, currentParams: any): void;
2
- export function addCustomColumnFilters(where: any, fields: any, currentParams: any): void;
@@ -1,26 +0,0 @@
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
- };
15
- /**
16
- * Takes a schema and returns an object with the fields mapped by their camelCased display name.
17
- * If the displayName is not set or is a jsx element, the path is used instead.
18
- * The same conversion must be done when using the result of this method
19
- */
20
- export function getFieldsMappedByCCDisplayName(schema: any): any;
21
- /**
22
- *
23
- * @param {object} field
24
- * @returns the camelCase display name of the field, to be used for filters, sorting, etc
25
- */
26
- export function getCCDisplayName(field: object): string;
@@ -1,15 +0,0 @@
1
- import React from "react";
2
- import { ReactTableDefaults } from "@teselagen/react-table";
3
- const { LoadingComponent } = ReactTableDefaults;
4
-
5
- function DisabledLoadingComponent({ disabled, loading, loadingText }) {
6
- return (
7
- <LoadingComponent
8
- className={disabled ? "disabled" : ""}
9
- loading={loading}
10
- loadingText={disabled ? "" : loadingText}
11
- />
12
- );
13
- }
14
-
15
- export default DisabledLoadingComponent;
package/DisplayOptions.js DELETED
@@ -1,199 +0,0 @@
1
- import React, { useState } from "react";
2
- import { map, isEmpty, noop, startCase } from "lodash-es";
3
- import {
4
- Button,
5
- Checkbox,
6
- Menu,
7
- MenuItem,
8
- Classes,
9
- InputGroup,
10
- Popover,
11
- Switch
12
- } from "@blueprintjs/core";
13
- import { getCCDisplayName } from "./utils/queryParams";
14
-
15
- const DisplayOptions = ({
16
- compact,
17
- extraCompact,
18
- disabled,
19
- hideDisplayOptionsIcon,
20
- resetDefaultVisibility = noop,
21
- updateColumnVisibility = noop,
22
- updateTableDisplayDensity,
23
- showForcedHiddenColumns,
24
- setShowForcedHidden,
25
- hasOptionForForcedHidden,
26
- schema
27
- }) => {
28
- const [isOpen, setIsOpen] = useState(false);
29
- const [searchTerms, setSearchTerms] = useState({});
30
-
31
- const changeTableDensity = e => {
32
- updateTableDisplayDensity(e.target.value);
33
- setIsOpen(false);
34
- };
35
-
36
- const toggleForcedHidden = e => setShowForcedHidden(e.target.checked);
37
-
38
- if (hideDisplayOptionsIcon) {
39
- return null; //don't show antyhing!
40
- }
41
- const { fields } = schema;
42
- const fieldGroups = {};
43
- const mainFields = [];
44
-
45
- fields.forEach(field => {
46
- if (field.hideInMenu) return;
47
- if (!field.fieldGroup) return mainFields.push(field);
48
- if (!fieldGroups[field.fieldGroup]) fieldGroups[field.fieldGroup] = [];
49
- fieldGroups[field.fieldGroup].push(field);
50
- });
51
-
52
- let numVisible = 0;
53
-
54
- const getFieldCheckbox = (field, i) => {
55
- const { displayName, isHidden, isForcedHidden, path } = field;
56
- if (isForcedHidden) return;
57
- if (!isHidden) numVisible++;
58
- return (
59
- <Checkbox
60
- name={`${path}-${i}`}
61
- key={path || i}
62
- onChange={() => {
63
- if (numVisible <= 1 && !isHidden) {
64
- return window.toastr.warning(
65
- "We have to display at least one column :)"
66
- );
67
- }
68
- updateColumnVisibility({ shouldShow: isHidden, path });
69
- }}
70
- checked={!isHidden}
71
- label={displayName}
72
- />
73
- );
74
- };
75
-
76
- let fieldGroupMenu;
77
- if (!isEmpty(fieldGroups)) {
78
- fieldGroupMenu = map(fieldGroups, (groupFields, groupName) => {
79
- const searchTerm = searchTerms[groupName] || "";
80
- const anyVisible = groupFields.some(
81
- field => !field.isHidden && !field.isForcedHidden
82
- );
83
- const anyNotForcedHidden = groupFields.some(
84
- field => !field.isForcedHidden
85
- );
86
- if (!anyNotForcedHidden) return;
87
- return (
88
- <MenuItem key={groupName} text={groupName}>
89
- <InputGroup
90
- leftIcon="search"
91
- value={searchTerm}
92
- onChange={e => {
93
- setSearchTerms(prev => ({
94
- ...prev,
95
- [groupName]: e.target.value
96
- }));
97
- }}
98
- />
99
- <Button
100
- className={Classes.MINIMAL}
101
- text={(anyVisible ? "Hide" : "Show") + " All"}
102
- style={{ margin: "10px 0" }}
103
- onClick={() => {
104
- updateColumnVisibility({
105
- shouldShow: !anyVisible,
106
- paths: groupFields.map(field => field.path)
107
- });
108
- }}
109
- />
110
- {groupFields
111
- .filter(
112
- field =>
113
- startCase(getCCDisplayName(field)) // We have to use startCase with the camelCase here because the displayName is not always a string
114
- .toLowerCase()
115
- .indexOf(searchTerm.toLowerCase()) > -1
116
- )
117
- .map(getFieldCheckbox)}
118
- </MenuItem>
119
- );
120
- });
121
- }
122
-
123
- return (
124
- <Popover
125
- isOpen={isOpen}
126
- onClose={() => setIsOpen(false)}
127
- content={
128
- <Menu>
129
- <div style={{ padding: 10, paddingLeft: 20, paddingRight: 20 }}>
130
- <h5 style={{ marginBottom: 10 }}>Display Density:</h5>
131
- <div className={Classes.SELECT + " tg-table-display-density"}>
132
- <select
133
- onChange={changeTableDensity}
134
- value={
135
- extraCompact ? "extraCompact" : compact ? "compact" : "normal"
136
- }
137
- >
138
- <option className={Classes.POPOVER_DISMISS} value="normal">
139
- Comfortable
140
- </option>
141
- {/* tnr: as you can see we're calling what was "compact" Normal now in response to https://github.com/TeselaGen/lims/issues/4713 */}
142
- <option className={Classes.POPOVER_DISMISS} value="compact">
143
- Normal
144
- </option>
145
- <option
146
- className={Classes.POPOVER_DISMISS}
147
- value="extraCompact"
148
- >
149
- Compact
150
- </option>
151
- </select>
152
- </div>
153
- <h5 style={{ marginBottom: 10, marginTop: 10 }}>
154
- Displayed Columns:
155
- </h5>
156
- <div style={{ maxHeight: 260, overflowY: "auto", padding: 2 }}>
157
- {mainFields.map(getFieldCheckbox)}
158
- </div>
159
- <div>{fieldGroupMenu}</div>
160
- {hasOptionForForcedHidden && (
161
- <div style={{ marginTop: 15 }}>
162
- <Switch
163
- label="Show Empty Columns"
164
- checked={showForcedHiddenColumns}
165
- onChange={toggleForcedHidden}
166
- />
167
- </div>
168
- )}
169
- <div
170
- style={{
171
- width: "100%",
172
- display: "flex",
173
- justifyContent: "flex-end"
174
- }}
175
- >
176
- <Button
177
- onClick={resetDefaultVisibility}
178
- title="Display Options"
179
- minimal
180
- >
181
- Reset
182
- </Button>
183
- </div>
184
- </div>
185
- </Menu>
186
- }
187
- >
188
- <Button
189
- className="tg-table-display-options"
190
- onClick={() => setIsOpen(true)}
191
- disabled={disabled}
192
- minimal
193
- icon="cog"
194
- />
195
- </Popover>
196
- );
197
- };
198
-
199
- export default DisplayOptions;
package/DropdownButton.js DELETED
@@ -1,36 +0,0 @@
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/DropdownCell.js DELETED
@@ -1,61 +0,0 @@
1
- import React, { useState } from "react";
2
- import classNames from "classnames";
3
- import TgSelect from "../TgSelect";
4
-
5
- export const DropdownCell = ({
6
- options,
7
- isMulti,
8
- initialValue,
9
- finishEdit,
10
- cancelEdit,
11
- dataTest
12
- }) => {
13
- const [v, setV] = useState(
14
- isMulti
15
- ? initialValue.split(",").map(v => ({ value: v, label: v }))
16
- : initialValue
17
- );
18
- return (
19
- <div
20
- className={classNames("tg-dropdown-cell-edit-container", {
21
- "tg-dropdown-cell-edit-container-multi": isMulti
22
- })}
23
- >
24
- <TgSelect
25
- small
26
- multi={isMulti}
27
- autoOpen
28
- value={v}
29
- onChange={val => {
30
- if (isMulti) {
31
- setV(val);
32
- return;
33
- }
34
- finishEdit(val ? val.value : null);
35
- }}
36
- {...dataTest}
37
- popoverProps={{
38
- onClose: e => {
39
- if (isMulti) {
40
- if (e && e.key === "Escape") {
41
- cancelEdit();
42
- } else {
43
- finishEdit(
44
- v && v.map
45
- ? v
46
- .map(v => v.value)
47
- .filter(v => v)
48
- .join(",")
49
- : v
50
- );
51
- }
52
- } else {
53
- cancelEdit();
54
- }
55
- }
56
- }}
57
- options={options.map(value => ({ label: value, value }))}
58
- />
59
- </div>
60
- );
61
- };
package/EditableCell.js DELETED
@@ -1,44 +0,0 @@
1
- import React, { useEffect, useRef, useState } from "react";
2
-
3
- export const EditableCell = ({
4
- cancelEdit,
5
- dataTest,
6
- finishEdit,
7
- isNumeric,
8
- initialValue
9
- }) => {
10
- const [value, setValue] = useState(initialValue);
11
- const inputRef = useRef(null);
12
-
13
- useEffect(() => {
14
- if (inputRef.current) {
15
- inputRef.current.focus();
16
- }
17
- }, [isNumeric]);
18
-
19
- return (
20
- <input
21
- style={{
22
- border: 0,
23
- width: "95%",
24
- fontSize: 12,
25
- background: "none"
26
- }}
27
- ref={inputRef}
28
- {...dataTest}
29
- autoFocus
30
- onKeyDown={e => {
31
- e.stopPropagation();
32
- if (e.key === "Enter") {
33
- e.target.blur();
34
- } else if (e.key === "Escape") {
35
- cancelEdit();
36
- }
37
- }}
38
- onBlur={() => finishEdit(value)}
39
- onChange={e => setValue(e.target.value)}
40
- type={isNumeric ? "number" : undefined}
41
- value={value}
42
- />
43
- );
44
- };
package/FillWindow.css DELETED
@@ -1,6 +0,0 @@
1
- .tg-fillWindow {
2
- background: white;
3
- }
4
- .bp3-dark .tg-fillWindow {
5
- background: #293742;
6
- }
package/FillWindow.js DELETED
@@ -1,69 +0,0 @@
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
- }