@teselagen/ui 0.8.8 → 0.9.3

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 (43) hide show
  1. package/DataTable/utils/filterLocalEntitiesToHasura.d.ts +5 -0
  2. package/DataTable/utils/getAllRows.d.ts +1 -1
  3. package/DataTable/utils/getRowCopyText.d.ts +1 -3
  4. package/DataTable/utils/handleCopyColumn.d.ts +1 -1
  5. package/DataTable/utils/handleCopyRows.d.ts +1 -5
  6. package/DataTable/utils/handleCopyTable.d.ts +1 -1
  7. package/DataTable/utils/index.d.ts +0 -1
  8. package/DataTable/utils/initializeHasuraWhereAndFilter.d.ts +1 -0
  9. package/DataTable/utils/queryParams.d.ts +16 -12
  10. package/DataTable/utils/rowClick.d.ts +1 -1
  11. package/DataTable/utils/tableQueryParamsToHasuraClauses.d.ts +26 -0
  12. package/FormComponents/Uploader.d.ts +1 -3
  13. package/FormComponents/tryToMatchSchemas.d.ts +1 -1
  14. package/MenuBar/index.d.ts +1 -3
  15. package/README.md +1 -1
  16. package/ResizableDraggableDialog/index.d.ts +1 -3
  17. package/TagSelect/index.d.ts +1 -1
  18. package/index.cjs.js +40098 -36878
  19. package/index.d.ts +2 -0
  20. package/index.es.js +39112 -35892
  21. package/package.json +2 -4
  22. package/src/DataTable/Columns.js +2 -2
  23. package/src/DataTable/DisplayOptions.js +1 -1
  24. package/src/DataTable/FilterAndSortMenu.js +27 -30
  25. package/src/DataTable/index.js +113 -90
  26. package/src/DataTable/style.css +1 -1
  27. package/src/DataTable/utils/filterLocalEntitiesToHasura.js +356 -0
  28. package/src/DataTable/utils/filterLocalEntitiesToHasura.test.js +1285 -0
  29. package/src/DataTable/utils/getAllRows.js +2 -6
  30. package/src/DataTable/utils/handleCopyColumn.js +2 -2
  31. package/src/DataTable/utils/handleCopyTable.js +2 -2
  32. package/src/DataTable/utils/initializeHasuraWhereAndFilter.js +15 -0
  33. package/src/DataTable/utils/queryParams.js +153 -770
  34. package/src/DataTable/utils/tableQueryParamsToHasuraClauses.js +277 -0
  35. package/src/DataTable/utils/tableQueryParamsToHasuraClauses.test.js +245 -0
  36. package/src/DataTable/utils/withTableParams.js +3 -16
  37. package/src/FormComponents/index.js +2 -2
  38. package/src/TgSelect/index.js +15 -0
  39. package/src/index.js +2 -0
  40. package/src/utils/determineBlackOrWhiteTextColor.js +8 -1
  41. package/ui.css +10537 -0
  42. package/utils/determineBlackOrWhiteTextColor.d.ts +1 -2
  43. package/utils/hotkeyUtils.d.ts +1 -3
@@ -1,9 +1,5 @@
1
- export const getAllRows = e => {
2
- const el = e.target.querySelector(".data-table-container")
3
- ? e.target.querySelector(".data-table-container")
4
- : e.target.closest(".data-table-container");
5
-
6
- const allRowEls = el.querySelectorAll(".rt-tr");
1
+ export const getAllRows = tableRef => {
2
+ const allRowEls = tableRef.current?.tableRef?.querySelectorAll(".rt-tr");
7
3
  if (!allRowEls || !allRowEls.length) {
8
4
  return;
9
5
  }
@@ -2,9 +2,9 @@ import { getAllRows } from "./getAllRows";
2
2
  import { getIdOrCodeOrIndex } from "./getIdOrCodeOrIndex";
3
3
  import { handleCopyRows } from "./handleCopyRows";
4
4
 
5
- export const handleCopyColumn = (e, cellWrapper, selectedRecords) => {
5
+ export const handleCopyColumn = (tableRef, cellWrapper, selectedRecords) => {
6
6
  const specificColumn = cellWrapper.getAttribute("data-test");
7
- let rowElsToCopy = getAllRows(e);
7
+ let rowElsToCopy = getAllRows(tableRef);
8
8
  if (!rowElsToCopy) return;
9
9
  if (selectedRecords) {
10
10
  const ids = selectedRecords.map(e => getIdOrCodeOrIndex(e)?.toString());
@@ -1,9 +1,9 @@
1
1
  import { getAllRows } from "./getAllRows";
2
2
  import { handleCopyRows } from "./handleCopyRows";
3
3
 
4
- export const handleCopyTable = (e, opts) => {
4
+ export const handleCopyTable = (tableRef, opts) => {
5
5
  try {
6
- const allRowEls = getAllRows(e);
6
+ const allRowEls = getAllRows(tableRef);
7
7
  if (!allRowEls) return;
8
8
  handleCopyRows(allRowEls, {
9
9
  ...opts,
@@ -0,0 +1,15 @@
1
+ export function initializeHasuraWhereAndFilter(
2
+ additionalFilter,
3
+ where = {},
4
+ currentParams
5
+ ) {
6
+ where._and = where._and || [];
7
+ where._or = where._or || [];
8
+ if (typeof additionalFilter === "function") {
9
+ const newWhere = additionalFilter(where, currentParams);
10
+ if (newWhere) {
11
+ Object.assign(where, newWhere);
12
+ }
13
+ } else if (typeof additionalFilter === "object")
14
+ where._and.push(additionalFilter);
15
+ }