@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
package/src/sortify.js ADDED
@@ -0,0 +1,73 @@
1
+ /*!
2
+ * Copyright 2015-2016 Thomas Rosenau
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ /**
18
+ * Create a “sorted” version of an object.
19
+ *
20
+ * JS engines internally keep track of an object's keys in the order of
21
+ * creation time, i.e. {a:1,b:2} is treated differently from {b:2,a:1}.
22
+ * That difference can be seen when JSON.stringify is called on that object.
23
+ * This function normalizes any kind of object by rearranging the keys in
24
+ * alphabetical order (numerical keys first, since v8 does so, and there's
25
+ * nothing we can do about it).
26
+ * @param {*} o The object to be sorted
27
+ */
28
+
29
+ /* eslint-disable */
30
+ const sortKeys = o => {
31
+ if (Array.isArray(o)) {
32
+ return o.map(sortKeys);
33
+ } else if (o instanceof Object) {
34
+ // put numeric keys first
35
+ let numeric = [];
36
+ let nonNumeric = [];
37
+ Object.keys(o).forEach(key => {
38
+ if (/^(0|[1-9][0-9]*)$/.test(key)) {
39
+ numeric.push(+key);
40
+ } else {
41
+ nonNumeric.push(key);
42
+ }
43
+ });
44
+ // do the rearrangement
45
+ return numeric
46
+ .sort(function (a, b) {
47
+ return a - b;
48
+ })
49
+ .concat(nonNumeric.sort())
50
+ .reduce((result, key) => {
51
+ result[key] = sortKeys(o[key]); // recurse!
52
+ return result;
53
+ }, {});
54
+ }
55
+ return o;
56
+ };
57
+
58
+ const jsonStringify = JSON.stringify.bind(JSON);
59
+
60
+ const sortify = (value, replacer, space) => {
61
+ // replacer, toJSON(), cyclic references and other stuff is better handled by native stringifier.
62
+ // So we do JSON.stringify(sortKeys( JSON.parse(JSON.stringify()) )).
63
+ // This approach is slightly slower but much safer than a manual stringification.
64
+ let nativeJson = jsonStringify(value, replacer, 0);
65
+ if (!nativeJson || (nativeJson[0] !== "{" && nativeJson[0] !== "[")) {
66
+ // if value is not an Object or Array
67
+ return nativeJson;
68
+ }
69
+ let cleanObj = JSON.parse(nativeJson);
70
+ return jsonStringify(sortKeys(cleanObj), null, space);
71
+ };
72
+
73
+ export default sortify;
package/src/style.css CHANGED
@@ -1,265 +1,29 @@
1
- :root {
2
- --base1: #ffffff;
3
- --base2: #cdcdcd;
4
- }
5
-
6
- body.bp3-dark {
7
- --base1: #393a3a;
8
- --base2: #293742;
9
- }
10
-
11
- .bp3-dark .tg-card {
12
- background: #394b59 !important;
13
- }
14
-
15
- .preserve-newline {
16
- white-space: pre-line;
17
- }
18
-
19
- .bp3-dialog {
20
- max-width: 100vw;
21
- }
22
-
23
- /* adding back in blueprint v2 default styling to all <h/> elements */
24
- h1 {
25
- line-height: 40px;
26
- font-size: 36px;
27
- }
28
-
29
- h2 {
30
- line-height: 32px;
31
- font-size: 28px;
32
- }
33
-
34
- h3 {
35
- line-height: 25px;
36
- font-size: 22px;
37
- }
38
-
39
- h4 {
40
- line-height: 21px;
41
- font-size: 18px;
42
- }
43
-
44
- h5 {
45
- line-height: 19px;
46
- font-size: 16px;
47
- }
48
-
49
- h6 {
50
- line-height: 16px;
51
- font-size: 14px;
52
- }
53
-
54
- h1,
55
- h2,
56
- h3,
57
- h4,
58
- h5,
59
- h6,
60
- h1.bp3-heading,
61
- h2.bp3-heading,
62
- h3.bp3-heading,
63
- h4.bp3-heading,
64
- h5.bp3-heading,
65
- h6.bp3-heading {
66
- color: #182026;
67
- font-weight: 300;
68
- margin: 0 0 10px;
69
- padding: 0;
70
- line-height: normal;
71
- }
72
-
73
- .bp3-dark h1,
74
- .bp3-dark h2,
75
- .bp3-dark h3,
76
- .bp3-dark h4,
77
- .bp3-dark h5,
78
- .bp3-dark h6 {
79
- color: #f5f8fa;
80
- }
81
- .bp3-dark textarea {
82
- background: #293742;
83
- color: #f5f8fa;
84
- }
85
-
86
- /* bp3 fix https://github.com/palantir/blueprint/issues/2807 */
87
- .bp3-popover-wrapper {
88
- display: inline-block;
1
+ /* Copyright (C) 2018 TeselaGen Biotechnology, Inc. */
2
+ .tg-timeline {
89
3
  position: relative;
90
- vertical-align: top;
91
- }
92
- /* this line is necessary otherwise the line above setting "position: relative;" caused nested long bp3 submenus to not appear correctly when using the fix below */
93
- .bp3-submenu .bp3-popover-wrapper {
94
- position: unset;
95
- }
96
- /* this fixes https://github.com/palantir/blueprint/issues/4791 but requires the "position: unset;" fix above */
97
- .bp3-submenu > * > .bp3-menu {
98
- max-height: 96vh;
99
- overflow: auto;
100
- }
101
-
102
- /* bp3 fix https://github.com/palantir/blueprint/issues/2807 */
103
- span.bp3-popover-target {
104
- display: block;
105
- }
106
-
107
- .bp3-portal {
108
- z-index: 100000;
109
- }
110
- .bp3-switch {
111
- width: fit-content;
112
- display: flex;
113
- align-items: center;
114
- }
115
-
116
- .Select {
117
- min-width: 170px;
118
- }
119
-
120
- /* override the default blueprint input focus to instead rely on an inset box shadow. This resolves any issues with overflow:hidden cutting off input box shadows */
121
- .bp3-dark .bp3-input:focus,
122
- .bp3-input:focus {
123
- box-shadow: inset 0 0 3px 1px #137cbd;
124
- }
125
-
126
- .notClickable {
127
- cursor: default !important;
128
- }
129
- .bp3-toast-container {
130
- z-index: 100001;
4
+ white-space: nowrap;
131
5
  }
132
6
 
133
- .link-button {
134
- background: none !important;
135
- border: none;
136
- padding: 0 !important;
137
- font-family: arial, sans-serif;
138
- color: rgb(0, 151, 227);
139
- /* text-decoration: underline; */
140
- cursor: pointer;
141
- }
142
- .link-button:hover {
143
- color: rgb(98, 198, 248);
144
- text-decoration: underline;
145
- }
146
-
147
- .above-dialog {
148
- z-index: 100001;
149
- }
150
-
151
- code {
152
- display: block;
153
- white-space: pre-wrap;
154
- }
155
-
156
- .bp3-toast.no-close-button [aria-label="Close"] {
157
- display: none;
158
- }
159
-
160
- .isDataTitle .tippy-box[data-theme~="teselagen"] .tippy-arrow {
161
- opacity: 0 !important;
162
- }
163
- .isDataTitle .tippy-box[data-theme~="teselagen"] {
164
- background-color: #4f4a50f4 !important;
165
- border-radius: 0 !important;
166
- color: #f3f3f3 !important;
167
- font-size: 11px !important;
168
- white-space: pre-wrap;
169
- padding: 0px 0px !important;
170
- }
171
-
172
- [data-tippy-root]:has(.tippy-box[data-theme~="teselagen"]) {
173
- z-index: 100000 !important;
174
- }
175
-
176
- [data-tippy-root] .tippy-box[data-theme~="teselagen"] {
177
- background-color: #394b59;
178
- color: #f5f8fa;
179
- padding: 4px 4px;
180
- word-break: break-word;
181
- }
182
- [data-tippy-root] .tippy-box[data-theme~="teselagen"] .tippy-arrow {
183
- color: #394b59;
184
- }
185
- .bp3-dark [data-tippy-root] .tippy-box[data-theme~="teselagen"] {
186
- background-color: #e1e8ed;
187
- color: #394b59;
188
- }
189
- .bp3-dark [data-tippy-root] .tippy-box[data-theme~="teselagen"] .tippy-arrow {
190
- /* background-color: #e1e8ed; */
191
- color: #e1e8ed;
192
- }
193
- .isCellEditable .rt-td {
194
- position: relative;
195
- }
196
-
197
- .ReactTable .tg-cell-edit-boolean-checkbox {
198
- margin-bottom: 0;
199
- }
200
-
201
- .cellDragHandle {
202
- height: 8px;
203
- width: 8px;
204
- cursor: crosshair;
205
- border: 1px solid rgb(255, 255, 255);
206
- background-color: rgb(76, 107, 171);
7
+ .tg-timeline-line {
207
8
  position: absolute;
208
- bottom: -4px;
209
- right: -4px;
210
- }
211
-
212
- /* make AnchorButton match Button */
213
- .bp3-button {
214
- font-family: Arial;
215
- }
216
-
217
- button {
218
- transition: all 0.2s ease-in-out;
219
- }
220
-
221
- button:not(:disabled):active {
222
- transform: translateY(1px);
223
- }
224
- .bp3-tabs.bp3-vertical > .bp3-tab-panel {
225
- min-width: 0px;
226
- }
227
- .bp3-toast[class*="bp3-intent-"] .bp3-button.tg-clear-all-toasts {
228
- border: 1px solid white !important;
229
- }
230
- .bp3-toast[class*="bp3-intent-"] .bp3-button.tg-clear-all-toasts:hover {
231
- /* background: blue !important; */
232
- /* background: unset !important; */
233
- background-color: #137cbd !important;
234
- }
235
-
236
- /* .bp3-toast .tg-clear-all-toasts {
237
- background: unset !important;
238
- color: unset !important;
239
- padding: unset !important;
240
- margin: unset !important;
241
- font-size: unset !important;
242
- line-height: unset !important;
243
- border: unset !important;
244
- box-shadow: unset !important;
245
- text-align: unset !important;
246
- cursor: pointer !important;
247
- } */
248
-
249
- .bp3-dialog-header .bp3-heading {
250
- width: 10px; /* tnw: this is a hack to prevent the dialog title from causing the dialog width to expand larger than the dialog content*/
251
- }
252
-
253
- /* to fix tooltip styling issue - https://github.com/palantir/blueprint/issues/3430 */
254
- .bp3-popover[style*="transform-origin"][style*="bottom"] .bp3-popover-arrow {
255
- transform: translate(0, -0.5px);
256
- }
257
- .bp3-popover[style*="transform-origin"][style*="left"] .bp3-popover-arrow {
258
- transform: translate(0.5px, 0);
259
- }
260
- .bp3-popover[style*="transform-origin"][style*="top"] .bp3-popover-arrow {
261
- transform: translate(0, 0.5px);
262
- }
263
- .bp3-popover[style*="transform-origin"][style*="right"] .bp3-popover-arrow {
264
- transform: translate(-0.5px, 0);
9
+ height: 90%;
10
+ border-left: 2px solid #bfccd6;
11
+ top: 3px;
12
+ left: 5px;
13
+ }
14
+
15
+ .tg-timeline-event {
16
+ margin-bottom: 15px;
17
+ }
18
+
19
+ .tg-timeline-circle {
20
+ width: 12px;
21
+ min-width: 12px;
22
+ height: 12px;
23
+ min-height: 12px;
24
+ z-index: 1;
25
+ margin-right: 10px;
26
+ border-radius: 100px;
27
+ background: #e1e8ed;
28
+ border: 2px solid #137cbd;
265
29
  }
@@ -0,0 +1,113 @@
1
+ export function tableQueryParamsToHasuraClauses({
2
+ page,
3
+ pageSize,
4
+ searchTerm,
5
+ filters,
6
+ order,
7
+ schema, // Add schema as a parameter
8
+ additionalFilter
9
+ }) {
10
+ let where = {};
11
+ const order_by = {};
12
+ const limit = pageSize || 25;
13
+ const offset = page && pageSize ? (page - 1) * pageSize : 0;
14
+
15
+ if (searchTerm) {
16
+ const searchTermFilters = [];
17
+ schema.fields.forEach(field => {
18
+ const { type, path, searchDisabled } = field;
19
+ if (searchDisabled || field.filterDisabled || type === "color") return;
20
+ const filterValue = searchTerm; // No cleaning needed here, we're using _ilike
21
+
22
+ if (type === "string" || type === "lookup") {
23
+ searchTermFilters.push({
24
+ [path]: { _ilike: `%${filterValue}%` }
25
+ });
26
+ } else if (type === "boolean") {
27
+ let regex;
28
+ try {
29
+ regex = new RegExp("^" + searchTerm, "ig");
30
+ } catch (error) {
31
+ //ignore
32
+ }
33
+ if (regex) {
34
+ if ("true".replace(regex, "") !== "true") {
35
+ searchTermFilters.push({
36
+ [path]: { _eq: true }
37
+ });
38
+ } else if ("false".replace(regex, "") !== "false") {
39
+ searchTermFilters.push({
40
+ [path]: { _eq: false }
41
+ });
42
+ }
43
+ }
44
+ } else if (
45
+ (type === "number" || type === "integer") &&
46
+ !isNaN(filterValue)
47
+ ) {
48
+ searchTermFilters.push({
49
+ [path]: { _eq: parseFloat(filterValue) }
50
+ });
51
+ }
52
+ });
53
+ if (searchTermFilters.length > 0) {
54
+ if (Object.keys(where).length > 0) {
55
+ where = { _and: [where, { _or: searchTermFilters }] };
56
+ } else {
57
+ where = { _or: searchTermFilters };
58
+ }
59
+ }
60
+ }
61
+
62
+ if (filters && filters.length > 0) {
63
+ const filterClauses = filters.map(filter => {
64
+ const { selectedFilter, filterOn, filterValue } = filter;
65
+ switch (selectedFilter) {
66
+ case "textContains":
67
+ return { [filterOn]: { _ilike: `%${filterValue}%` } };
68
+ case "textEquals":
69
+ return { [filterOn]: { _eq: filterValue } };
70
+ case "textNotEquals":
71
+ return { [filterOn]: { _neq: filterValue } };
72
+ case "numberEquals":
73
+ return { [filterOn]: { _eq: parseFloat(filterValue) } };
74
+ case "numberGreaterThan":
75
+ return { [filterOn]: { _gt: parseFloat(filterValue) } };
76
+ case "numberLessThan":
77
+ return { [filterOn]: { _lt: parseFloat(filterValue) } };
78
+ case "numberGreaterThanEquals":
79
+ return { [filterOn]: { _gte: parseFloat(filterValue) } };
80
+ case "numberLessThanEquals":
81
+ return { [filterOn]: { _lte: parseFloat(filterValue) } };
82
+ case "isNull":
83
+ return { [filterOn]: { _is_null: true } };
84
+ case "isNotNull":
85
+ return { [filterOn]: { _is_null: false } };
86
+ default:
87
+ console.warn(`Unsupported filter type: ${selectedFilter}`);
88
+ return {};
89
+ }
90
+ });
91
+
92
+ if (filterClauses.length > 0) {
93
+ if (Object.keys(where).length > 0) {
94
+ where = { _and: [where, ...filterClauses] };
95
+ } else {
96
+ where = { _and: filterClauses };
97
+ }
98
+ }
99
+ }
100
+
101
+ if (order && order.length > 0) {
102
+ order.forEach(item => {
103
+ const field = item.startsWith("-") ? item.substring(1) : item;
104
+ const direction = item.startsWith("-") ? "desc" : "asc";
105
+ order_by[field] = direction;
106
+ });
107
+ }
108
+
109
+ if (additionalFilter) {
110
+ where = { _and: [where, additionalFilter] };
111
+ }
112
+ return { where, order_by, limit, offset };
113
+ }
@@ -32,7 +32,6 @@ import { branch, compose } from "recompose";
32
32
  export const useTableParams = props => {
33
33
  const {
34
34
  additionalFilter,
35
- additionalOrFilter,
36
35
  controlled_pageSize,
37
36
  defaults: _defaults,
38
37
  doNotCoercePageSize,
@@ -166,16 +165,6 @@ export const useTableParams = props => {
166
165
  );
167
166
 
168
167
  const queryParams = useMemo(() => {
169
- const additionalFilterToUse =
170
- typeof additionalFilter === "function"
171
- ? additionalFilter
172
- : () => additionalFilter;
173
-
174
- const additionalOrFilterToUse =
175
- typeof additionalOrFilter === "function"
176
- ? additionalOrFilter
177
- : () => additionalOrFilter;
178
-
179
168
  return getQueryParams({
180
169
  doNotCoercePageSize,
181
170
  currentParams,
@@ -185,8 +174,7 @@ export const useTableParams = props => {
185
174
  schema: convertedSchema,
186
175
  isInfinite: isInfinite || (isSimple && !withPaging),
187
176
  isLocalCall,
188
- additionalFilter: additionalFilterToUse,
189
- additionalOrFilter: additionalOrFilterToUse,
177
+ additionalFilter,
190
178
  noOrderError,
191
179
  isCodeModel,
192
180
  ownProps: passingProps
@@ -194,7 +182,6 @@ export const useTableParams = props => {
194
182
  }, [
195
183
  additionalFilter,
196
184
  passingProps,
197
- additionalOrFilter,
198
185
  doNotCoercePageSize,
199
186
  currentParams,
200
187
  entities,
@@ -0,0 +1,113 @@
1
+ export function tableQueryParamsToHasuraClauses({
2
+ page,
3
+ pageSize,
4
+ searchTerm,
5
+ filters,
6
+ order,
7
+ schema, // Add schema as a parameter
8
+ additionalFilter
9
+ }) {
10
+ let where = {};
11
+ const order_by = {};
12
+ const limit = pageSize || 25;
13
+ const offset = page && pageSize ? (page - 1) * pageSize : 0;
14
+
15
+ if (searchTerm) {
16
+ const searchTermFilters = [];
17
+ schema.fields.forEach(field => {
18
+ const { type, path, searchDisabled } = field;
19
+ if (searchDisabled || field.filterDisabled || type === "color") return;
20
+ const filterValue = searchTerm; // No cleaning needed here, we're using _ilike
21
+
22
+ if (type === "string" || type === "lookup") {
23
+ searchTermFilters.push({
24
+ [path]: { _ilike: `%${filterValue}%` }
25
+ });
26
+ } else if (type === "boolean") {
27
+ let regex;
28
+ try {
29
+ regex = new RegExp("^" + searchTerm, "ig");
30
+ } catch (error) {
31
+ //ignore
32
+ }
33
+ if (regex) {
34
+ if ("true".replace(regex, "") !== "true") {
35
+ searchTermFilters.push({
36
+ [path]: { _eq: true }
37
+ });
38
+ } else if ("false".replace(regex, "") !== "false") {
39
+ searchTermFilters.push({
40
+ [path]: { _eq: false }
41
+ });
42
+ }
43
+ }
44
+ } else if (
45
+ (type === "number" || type === "integer") &&
46
+ !isNaN(filterValue)
47
+ ) {
48
+ searchTermFilters.push({
49
+ [path]: { _eq: parseFloat(filterValue) }
50
+ });
51
+ }
52
+ });
53
+ if (searchTermFilters.length > 0) {
54
+ if (Object.keys(where).length > 0) {
55
+ where = { _and: [where, { _or: searchTermFilters }] };
56
+ } else {
57
+ where = { _or: searchTermFilters };
58
+ }
59
+ }
60
+ }
61
+
62
+ if (filters && filters.length > 0) {
63
+ const filterClauses = filters.map(filter => {
64
+ const { selectedFilter, filterOn, filterValue } = filter;
65
+ switch (selectedFilter) {
66
+ case "textContains":
67
+ return { [filterOn]: { _ilike: `%${filterValue}%` } };
68
+ case "textEquals":
69
+ return { [filterOn]: { _eq: filterValue } };
70
+ case "textNotEquals":
71
+ return { [filterOn]: { _neq: filterValue } };
72
+ case "numberEquals":
73
+ return { [filterOn]: { _eq: parseFloat(filterValue) } };
74
+ case "numberGreaterThan":
75
+ return { [filterOn]: { _gt: parseFloat(filterValue) } };
76
+ case "numberLessThan":
77
+ return { [filterOn]: { _lt: parseFloat(filterValue) } };
78
+ case "numberGreaterThanEquals":
79
+ return { [filterOn]: { _gte: parseFloat(filterValue) } };
80
+ case "numberLessThanEquals":
81
+ return { [filterOn]: { _lte: parseFloat(filterValue) } };
82
+ case "isNull":
83
+ return { [filterOn]: { _is_null: true } };
84
+ case "isNotNull":
85
+ return { [filterOn]: { _is_null: false } };
86
+ default:
87
+ console.warn(`Unsupported filter type: ${selectedFilter}`);
88
+ return {};
89
+ }
90
+ });
91
+
92
+ if (filterClauses.length > 0) {
93
+ if (Object.keys(where).length > 0) {
94
+ where = { _and: [where, ...filterClauses] };
95
+ } else {
96
+ where = { _and: filterClauses };
97
+ }
98
+ }
99
+ }
100
+
101
+ if (order && order.length > 0) {
102
+ order.forEach(item => {
103
+ const field = item.startsWith("-") ? item.substring(1) : item;
104
+ const direction = item.startsWith("-") ? "desc" : "asc";
105
+ order_by[field] = direction;
106
+ });
107
+ }
108
+
109
+ if (additionalFilter) {
110
+ where = { _and: [where, additionalFilter] };
111
+ }
112
+ return { where, order_by, limit, offset };
113
+ }
package/tagUtils.js ADDED
@@ -0,0 +1,45 @@
1
+ import { flatMap, keyBy } from "lodash-es";
2
+ import determineBlackOrWhiteTextColor from "./determineBlackOrWhiteTextColor";
3
+
4
+ export function getTagsAndTagOptions(allTags) {
5
+ return flatMap(allTags, tag => {
6
+ if (tag.tagOptions && tag.tagOptions.length) {
7
+ return tag.tagOptions.map(tagO => {
8
+ const fullname = `${tag.name}: ${tagO.name}`;
9
+ const value = `${tag.id}:${tagO.id}`;
10
+ return {
11
+ ...tagO,
12
+ label: fullname,
13
+ value,
14
+ id: tagO.id
15
+ };
16
+ });
17
+ }
18
+ return {
19
+ ...tag,
20
+ label: tag.name,
21
+ value: tag.id
22
+ };
23
+ });
24
+ }
25
+
26
+ export function getKeyedTagsAndTagOptions(tags) {
27
+ return keyBy(getTagsAndTagOptions(tags), "value");
28
+ }
29
+
30
+ export function getTagColorStyle(color) {
31
+ return color
32
+ ? {
33
+ style: {
34
+ backgroundColor: color,
35
+ color: determineBlackOrWhiteTextColor(color)
36
+ }
37
+ }
38
+ : {};
39
+ }
40
+ export function getTagProps({ color, label, name }) {
41
+ return {
42
+ ...getTagColorStyle(color),
43
+ children: label || name
44
+ };
45
+ }
@@ -0,0 +1,35 @@
1
+ import React, { useMemo } from "react";
2
+ import { connect } from "react-redux";
3
+ import { FormName, formValueSelector } from "redux-form";
4
+
5
+ const tgFormValues =
6
+ (...fieldNames) =>
7
+ Component =>
8
+ props => {
9
+ return (
10
+ <FormName>
11
+ {formName => {
12
+ const name = formName.form;
13
+ const Wrapped = useMemo(() => {
14
+ const selector = formValueSelector(name || "");
15
+ const wrapper = connect(state => {
16
+ const vals = {};
17
+ fieldNames.forEach(name => {
18
+ vals[name] = selector(state, name);
19
+ });
20
+ return vals;
21
+ });
22
+ return wrapper(Component);
23
+ }, [name]);
24
+ return <Wrapped {...props} />;
25
+ }}
26
+ </FormName>
27
+ );
28
+ };
29
+ export default tgFormValues;
30
+
31
+ export const tgFormValueSelector = (formName, ...fields) => {
32
+ return connect(state => {
33
+ return formValueSelector(formName)(state, ...fields);
34
+ });
35
+ };