@teselagen/ui 0.8.6 → 0.9.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 (42) hide show
  1. package/DataTable/EditabelCell.d.ts +10 -0
  2. package/DataTable/defaultProps.d.ts +43 -0
  3. package/DataTable/utils/computePresets.d.ts +1 -0
  4. package/DataTable/utils/getAllRows.d.ts +1 -1
  5. package/DataTable/utils/handleCopyColumn.d.ts +1 -1
  6. package/DataTable/utils/handleCopyTable.d.ts +1 -1
  7. package/DataTable/utils/initializeHasuraWhereAndFilter.d.ts +0 -1
  8. package/DataTable/utils/queryParams.d.ts +16 -12
  9. package/DataTable/utils/tableQueryParamsToHasuraClauses.d.ts +1 -1
  10. package/README.md +1 -1
  11. package/index.cjs.js +1139 -1040
  12. package/index.d.ts +2 -0
  13. package/index.es.js +1139 -1040
  14. package/package.json +2 -2
  15. package/src/DataTable/Columns.js +2 -2
  16. package/src/DataTable/DisplayOptions.js +1 -1
  17. package/src/DataTable/EditabelCell.js +55 -0
  18. package/src/DataTable/FilterAndSortMenu.js +27 -30
  19. package/src/DataTable/defaultProps.js +45 -0
  20. package/src/DataTable/index.js +101 -84
  21. package/src/DataTable/style.css +1 -1
  22. package/src/DataTable/utils/computePresets.js +42 -0
  23. package/src/DataTable/utils/filterLocalEntitiesToHasura.js +128 -8
  24. package/src/DataTable/utils/filterLocalEntitiesToHasura.test.js +719 -21
  25. package/src/DataTable/utils/getAllRows.js +2 -6
  26. package/src/DataTable/utils/handleCopyColumn.js +2 -2
  27. package/src/DataTable/utils/handleCopyTable.js +2 -2
  28. package/src/DataTable/utils/initializeHasuraWhereAndFilter.js +1 -12
  29. package/src/DataTable/utils/queryParams.js +153 -770
  30. package/src/DataTable/utils/tableQueryParamsToHasuraClauses.js +185 -168
  31. package/src/DataTable/utils/tableQueryParamsToHasuraClauses.test.js +50 -11
  32. package/src/DataTable/utils/withTableParams.js +3 -16
  33. package/src/ExcelCell.js +38 -0
  34. package/src/FormComponents/Uploader.js +5 -1
  35. package/src/FormComponents/index.js +2 -2
  36. package/src/TgSelect/index.js +15 -0
  37. package/src/autoTooltip.js +1 -0
  38. package/src/index.js +2 -0
  39. package/src/utils/determineBlackOrWhiteTextColor.js +8 -1
  40. package/style.css +10537 -0
  41. package/ui.css +1 -1
  42. package/utils/determineBlackOrWhiteTextColor.d.ts +1 -2
@@ -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,
@@ -8,19 +8,8 @@ export function initializeHasuraWhereAndFilter(
8
8
  if (typeof additionalFilter === "function") {
9
9
  const newWhere = additionalFilter(where, currentParams);
10
10
  if (newWhere) {
11
- where = {
12
- ...where,
13
- ...newWhere
14
- };
11
+ Object.assign(where, newWhere);
15
12
  }
16
13
  } else if (typeof additionalFilter === "object")
17
14
  where._and.push(additionalFilter);
18
15
  }
19
-
20
- export const addCustomColumnFilters = (where, fields, currentParams) => {
21
- fields.forEach(field => {
22
- const { customColumnFilter, filterDisabled } = field;
23
- if (filterDisabled || !customColumnFilter) return;
24
- customColumnFilter(where, currentParams);
25
- });
26
- };