@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,236 +0,0 @@
1
- import {
2
- isEmpty,
3
- every,
4
- some,
5
- isEqual,
6
- isString,
7
- isNull,
8
- isArray,
9
- includes,
10
- isObject,
11
- has,
12
- orderBy
13
- } from "lodash-es";
14
-
15
- export function filterLocalEntitiesToHasura(
16
- records,
17
- { where, order_by, limit, offset, isInfinite } = {}
18
- ) {
19
- let filteredRecords = [...records];
20
-
21
- // Apply where clause if it exists
22
- if (where) {
23
- filteredRecords = applyWhereClause(filteredRecords, where);
24
- }
25
-
26
- // Apply order_by if it exists
27
- if (order_by) {
28
- filteredRecords = applyOrderBy(filteredRecords, order_by);
29
- }
30
-
31
- // Store the complete filtered and ordered records for pagination info
32
- const allFilteredRecords = [...filteredRecords];
33
-
34
- // Apply limit and offset
35
- if (!isInfinite && offset !== undefined) {
36
- filteredRecords = filteredRecords.slice(offset);
37
- }
38
-
39
- if (!isInfinite && limit !== undefined) {
40
- filteredRecords = filteredRecords.slice(0, limit);
41
- }
42
-
43
- // For consistency, always return an object with entities, entitiesAcrossPages, and entityCount
44
- return {
45
- entities: filteredRecords,
46
- entitiesAcrossPages: allFilteredRecords,
47
- entityCount: allFilteredRecords.length
48
- };
49
- }
50
-
51
- function applyWhereClause(records, where) {
52
- function applyFilter(record, filter) {
53
- if (isEmpty(filter)) {
54
- return true; // No filter, all records pass
55
- }
56
-
57
- for (const key in filter) {
58
- if (key === "_and") {
59
- if (isEmpty(filter[key])) {
60
- continue;
61
- }
62
- if (!every(filter[key], subFilter => applyFilter(record, subFilter))) {
63
- return false;
64
- }
65
- } else if (key === "_or") {
66
- if (isEmpty(filter[key])) {
67
- continue;
68
- }
69
- if (!some(filter[key], subFilter => applyFilter(record, subFilter))) {
70
- return false;
71
- }
72
- } else if (key === "_not") {
73
- if (applyFilter(record, filter[key])) {
74
- return false;
75
- }
76
- } else {
77
- const value = record[key];
78
- const conditions = filter[key];
79
-
80
- // Handle nested object properties
81
- if (
82
- isObject(value) &&
83
- isObject(conditions) &&
84
- !hasOperator(conditions)
85
- ) {
86
- return applyFilter(value, conditions);
87
- }
88
-
89
- for (const operator in conditions) {
90
- const conditionValue = conditions[operator];
91
-
92
- // Handle range conditions (_gt/_lt or _gte/_lte combinations)
93
- if (operator === "_gt" && conditions._lt) {
94
- if (!(value > conditionValue && value < conditions._lt))
95
- return false;
96
- continue;
97
- }
98
- if (operator === "_gte" && conditions._lte) {
99
- if (!(value >= conditionValue && value <= conditions._lte))
100
- return false;
101
- continue;
102
- }
103
-
104
- switch (operator) {
105
- case "_eq":
106
- if (!isEqual(value, conditionValue)) return false;
107
- break;
108
- case "_neq":
109
- if (isEqual(value, conditionValue)) return false;
110
- break;
111
- case "_gt":
112
- if (!(value > conditionValue)) return false;
113
- break;
114
- case "_gte":
115
- if (!(value >= conditionValue)) return false;
116
- break;
117
- case "_lt":
118
- if (!(value < conditionValue)) return false;
119
- break;
120
- case "_lte":
121
- if (!(value <= conditionValue)) return false;
122
- break;
123
- case "_like":
124
- if (
125
- !isString(value) ||
126
- !new RegExp(conditionValue.replace(/%/g, ".*")).test(value)
127
- )
128
- return false;
129
- break;
130
- case "_ilike":
131
- if (
132
- !isString(value) ||
133
- !new RegExp(conditionValue.replace(/%/g, ".*"), "i").test(value)
134
- )
135
- return false;
136
- break;
137
- case "_nlike":
138
- if (
139
- !isString(value) ||
140
- new RegExp(conditionValue.replace(/%/g, ".*")).test(value)
141
- )
142
- return false;
143
- break;
144
- case "_nilike":
145
- if (
146
- !isString(value) ||
147
- new RegExp(conditionValue.replace(/%/g, ".*"), "i").test(value)
148
- )
149
- return false;
150
- break;
151
- case "_starts_with":
152
- if (!isString(value) || !value.startsWith(conditionValue))
153
- return false;
154
- break;
155
- case "_ends_with":
156
- if (!isString(value) || !value.endsWith(conditionValue))
157
- return false;
158
- break;
159
- case "_is_null":
160
- if (
161
- (conditionValue && !isNull(value)) ||
162
- (!conditionValue && isNull(value))
163
- )
164
- return false;
165
- break;
166
- case "_contains":
167
- if (
168
- !isArray(value) ||
169
- !every(conditionValue, item => includes(value, item))
170
- )
171
- return false;
172
- break;
173
- case "_contained_in":
174
- if (
175
- !isArray(value) ||
176
- !every(value, item => includes(conditionValue, item))
177
- )
178
- return false;
179
- break;
180
- case "_has_key":
181
- if (!isObject(value) || !has(value, conditionValue)) return false;
182
- break;
183
- case "_has_keys_any":
184
- if (
185
- !isObject(value) ||
186
- !some(conditionValue, item => has(value, item))
187
- )
188
- return false;
189
- break;
190
- case "_has_keys_all":
191
- if (
192
- !isObject(value) ||
193
- !every(conditionValue, item => has(value, item))
194
- )
195
- return false;
196
- break;
197
- case "_similar":
198
- if (
199
- !isString(value) ||
200
- !new RegExp(conditionValue.replace(/%/g, ".*")).test(value)
201
- )
202
- return false;
203
- break;
204
- default:
205
- if (operator.startsWith("_")) {
206
- console.warn(`Unsupported operator: ${operator}`);
207
- return false;
208
- } else {
209
- console.warn(`Unsupported operator: ${operator}`);
210
- return false;
211
- }
212
- }
213
- }
214
- }
215
- }
216
-
217
- return true;
218
- }
219
-
220
- // Helper to check if an object contains any Hasura operators
221
- function hasOperator(obj) {
222
- return Object.keys(obj).some(key => key.startsWith("_"));
223
- }
224
-
225
- return records.filter(record => applyFilter(record, where));
226
- }
227
-
228
- function applyOrderBy(records, order_by) {
229
- const keys = Object.keys(order_by);
230
- if (keys.length > 0) {
231
- const field = keys[0];
232
- const direction = order_by[field] === "asc" ? "asc" : "desc";
233
- return orderBy(records, [field], [direction]);
234
- }
235
- return records;
236
- }