@teselagen/ui 0.7.33-beta.6 → 0.7.34

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 (114) hide show
  1. package/AdvancedOptions.js +33 -0
  2. package/AssignDefaultsModeContext.js +22 -0
  3. package/CellDragHandle.js +132 -0
  4. package/ColumnFilterMenu.js +62 -0
  5. package/Columns.js +979 -0
  6. package/DataTable/utils/queryParams.d.ts +14 -7
  7. package/DisabledLoadingComponent.js +15 -0
  8. package/DisplayOptions.js +199 -0
  9. package/DropdownButton.js +36 -0
  10. package/DropdownCell.js +61 -0
  11. package/EditableCell.js +44 -0
  12. package/FillWindow.css +6 -0
  13. package/FillWindow.js +69 -0
  14. package/FilterAndSortMenu.js +391 -0
  15. package/FormSeparator.js +9 -0
  16. package/LoadingDots.js +14 -0
  17. package/MatchHeaders.js +234 -0
  18. package/PagingTool.js +225 -0
  19. package/RenderCell.js +191 -0
  20. package/SearchBar.js +69 -0
  21. package/SimpleStepViz.js +22 -0
  22. package/SortableColumns.js +100 -0
  23. package/TableFormTrackerContext.js +10 -0
  24. package/Tag.js +112 -0
  25. package/ThComponent.js +44 -0
  26. package/TimelineEvent.js +31 -0
  27. package/UploadCsvWizard.css +4 -0
  28. package/UploadCsvWizard.js +719 -0
  29. package/Uploader.js +1278 -0
  30. package/adHoc.js +10 -0
  31. package/autoTooltip.js +201 -0
  32. package/basicHandleActionsWithFullState.js +14 -0
  33. package/browserUtils.js +3 -0
  34. package/combineReducersWithFullState.js +14 -0
  35. package/commandControls.js +82 -0
  36. package/commandUtils.js +112 -0
  37. package/constants.js +1 -0
  38. package/convertSchema.js +69 -0
  39. package/customIcons.js +361 -0
  40. package/dataTableEnhancer.js +41 -0
  41. package/defaultFormatters.js +32 -0
  42. package/defaultValidators.js +40 -0
  43. package/determineBlackOrWhiteTextColor.js +4 -0
  44. package/editCellHelper.js +44 -0
  45. package/formatPasteData.js +16 -0
  46. package/getAllRows.js +11 -0
  47. package/getCellCopyText.js +7 -0
  48. package/getCellInfo.js +36 -0
  49. package/getCellVal.js +20 -0
  50. package/getDayjsFormatter.js +35 -0
  51. package/getFieldPathToField.js +7 -0
  52. package/getIdOrCodeOrIndex.js +9 -0
  53. package/getLastSelectedEntity.js +11 -0
  54. package/getNewEntToSelect.js +25 -0
  55. package/getNewName.js +31 -0
  56. package/getRowCopyText.js +28 -0
  57. package/getTableConfigFromStorage.js +5 -0
  58. package/getTextFromEl.js +28 -0
  59. package/getVals.js +8 -0
  60. package/handleCopyColumn.js +21 -0
  61. package/handleCopyHelper.js +15 -0
  62. package/handleCopyRows.js +23 -0
  63. package/handleCopyTable.js +16 -0
  64. package/handlerHelpers.js +24 -0
  65. package/hotkeyUtils.js +131 -0
  66. package/index.cjs.js +972 -837
  67. package/index.d.ts +0 -1
  68. package/index.es.js +972 -837
  69. package/index.js +1 -0
  70. package/isBeingCalledExcessively.js +31 -0
  71. package/isBottomRightCornerOfRectangle.js +20 -0
  72. package/isEntityClean.js +15 -0
  73. package/isTruthy.js +12 -0
  74. package/isValueEmpty.js +3 -0
  75. package/itemUpload.js +84 -0
  76. package/menuUtils.js +433 -0
  77. package/package.json +1 -2
  78. package/popoverOverflowModifiers.js +11 -0
  79. package/primarySelectedValue.js +1 -0
  80. package/pureNoFunc.js +31 -0
  81. package/queryParams.js +1058 -0
  82. package/removeCleanRows.js +22 -0
  83. package/renderOnDoc.js +32 -0
  84. package/rerenderOnWindowResize.js +26 -0
  85. package/rowClick.js +181 -0
  86. package/selection.js +8 -0
  87. package/showAppSpinner.js +12 -0
  88. package/showDialogOnDocBody.js +33 -0
  89. package/showProgressToast.js +22 -0
  90. package/sortify.js +73 -0
  91. package/style.css +13 -0
  92. package/tagUtils.js +45 -0
  93. package/tgFormValues.js +35 -0
  94. package/tg_modalState.js +47 -0
  95. package/throwFormError.js +16 -0
  96. package/toastr.js +148 -0
  97. package/tryToMatchSchemas.js +264 -0
  98. package/typeToCommonType.js +6 -0
  99. package/useDeepEqualMemo.js +15 -0
  100. package/useDialog.js +63 -0
  101. package/useStableReference.js +9 -0
  102. package/useTableEntities.js +38 -0
  103. package/useTraceUpdate.js +19 -0
  104. package/utils.js +37 -0
  105. package/validateTableWideErrors.js +160 -0
  106. package/viewColumn.js +97 -0
  107. package/withField.js +20 -0
  108. package/withFields.js +11 -0
  109. package/withLocalStorage.js +11 -0
  110. package/withSelectTableRecords.js +43 -0
  111. package/withSelectedEntities.js +65 -0
  112. package/withStore.js +10 -0
  113. package/withTableParams.js +301 -0
  114. package/wrapDialog.js +116 -0
@@ -0,0 +1,33 @@
1
+ import React, { useState } from "react";
2
+ import { Icon } from "@blueprintjs/core";
3
+
4
+ export default function AdvancedOptions({
5
+ children,
6
+ content,
7
+ label,
8
+ style,
9
+ isOpenByDefault
10
+ }) {
11
+ const [isOpen, setOpen] = useState(isOpenByDefault);
12
+ if (!(content || children)) {
13
+ return null;
14
+ }
15
+ return (
16
+ <div style={{ marginTop: 5, ...style }}>
17
+ <div
18
+ onClick={() => {
19
+ setOpen(!isOpen);
20
+ }}
21
+ style={{ cursor: "pointer", display: "flex", alignItems: "flex-end" }}
22
+ className="tg-toggle-advanced-options"
23
+ >
24
+ {label || "Advanced"}{" "}
25
+ <Icon
26
+ icon={isOpen ? "caret-down" : "caret-right"}
27
+ style={{ marginLeft: 5 }}
28
+ ></Icon>
29
+ </div>
30
+ {isOpen && <div style={{ marginTop: 10 }}>{content || children}</div>}
31
+ </div>
32
+ );
33
+ }
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+
3
+ export const AssignDefaultsModeContext = React.createContext({
4
+ inAssignDefaultsMode: false,
5
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
6
+ setAssignDefaultsMode: () => {}
7
+ });
8
+
9
+ export const workflowDefaultParamsObj = {
10
+ taskNumber: undefined,
11
+ workflowDefinitionName: undefined,
12
+ workflowDefinitionId: undefined,
13
+ workflowRunName: undefined,
14
+ workflowRunId: undefined,
15
+ toolName: undefined,
16
+ workflowToolTitle: undefined,
17
+ workflowToolDefinitionId: undefined,
18
+ workflowTaskCode: undefined
19
+ };
20
+ export const WorkflowDefaultParamsContext = React.createContext(
21
+ workflowDefaultParamsObj
22
+ );
@@ -0,0 +1,132 @@
1
+ import { flatMap } from "lodash-es";
2
+ import { forEach } from "lodash-es";
3
+ import React, { useCallback, useRef } from "react";
4
+
5
+ export const CellDragHandle = ({
6
+ thisTable,
7
+ onDragEnd,
8
+ cellId,
9
+ isSelectionARectangle
10
+ }) => {
11
+ const xStart = useRef(0);
12
+ const timeoutkey = useRef();
13
+ const rowsToSelect = useRef();
14
+ const rectangleCellPaths = useRef();
15
+
16
+ const handleDrag = useCallback(
17
+ e => {
18
+ const table = thisTable.querySelector(".rt-table");
19
+ const trs = table.querySelectorAll(`.rt-tr-group.with-row-data`);
20
+ const [rowId, path] = cellId.split(":");
21
+ const selectedTr = table.querySelector(
22
+ `.rt-tr-group.with-row-data[data-test-id="${rowId}"]`
23
+ );
24
+ if (!selectedTr) return;
25
+ const selectedIndex = selectedTr.dataset.index;
26
+
27
+ if (selectedTr && trs.length) {
28
+ const selectedY = selectedTr.getBoundingClientRect().y;
29
+ const cursorY = e.clientY;
30
+ clearTimeout(timeoutkey.current);
31
+ const updateScrollIfNecessary = () => {
32
+ const { y, height } = table.getBoundingClientRect();
33
+ if (cursorY < y) {
34
+ table.scrollBy(0, -5);
35
+ } else if (cursorY > y + height) {
36
+ table.scrollBy(0, 5);
37
+ }
38
+ };
39
+ updateScrollIfNecessary();
40
+ timeoutkey.current = setInterval(() => {
41
+ updateScrollIfNecessary();
42
+ }, 10);
43
+
44
+ const isCursorBelow = cursorY > selectedY;
45
+ rowsToSelect.current = [];
46
+ forEach(trs, (tr, index) => {
47
+ let isSelectedForUpdate;
48
+ const rowId = tr.dataset.testId;
49
+ const changeDashedBorder = (path, on) => {
50
+ tr.querySelector(
51
+ `[data-test="tgCell_${path}"]`
52
+ ).parentNode.classList[on ? "add" : "remove"]("selectedForUpdate");
53
+ };
54
+ if (isCursorBelow ? index > selectedIndex : index < selectedIndex) {
55
+ const { y, height } = tr.getBoundingClientRect();
56
+ if (isCursorBelow ? y < cursorY : y + height > cursorY) {
57
+ rowsToSelect.current.push(rowId);
58
+ isSelectedForUpdate = true;
59
+ //add dashed borders
60
+
61
+ if (rectangleCellPaths.current) {
62
+ rectangleCellPaths.current.forEach(path => {
63
+ changeDashedBorder(path, true);
64
+ });
65
+ } else {
66
+ changeDashedBorder(path, true);
67
+ }
68
+ }
69
+ }
70
+ if (!isSelectedForUpdate) {
71
+ if (rectangleCellPaths.current) {
72
+ rectangleCellPaths.current.forEach(path => {
73
+ changeDashedBorder(path, false);
74
+ });
75
+ } else {
76
+ changeDashedBorder(path, false);
77
+ }
78
+ }
79
+ });
80
+ }
81
+ },
82
+ [cellId, thisTable]
83
+ );
84
+
85
+ const onMouseUp = useCallback(() => {
86
+ clearTimeout(timeoutkey.current);
87
+ const table = thisTable;
88
+ const trs = table.querySelectorAll(`.rt-tr-group.with-row-data`);
89
+ const [, path] = cellId.split(":");
90
+ //remove the dashed borders
91
+ forEach(trs, tr => {
92
+ if (rectangleCellPaths.current) {
93
+ rectangleCellPaths.current.forEach(path => {
94
+ const el = tr.querySelector(`[data-test="tgCell_${path}"]`);
95
+ el.parentNode.classList.remove("selectedForUpdate");
96
+ });
97
+ } else {
98
+ const el = tr.querySelector(`[data-test="tgCell_${path}"]`);
99
+ el.parentNode.classList.remove("selectedForUpdate");
100
+ }
101
+ });
102
+ document.removeEventListener("mousemove", handleDrag, false);
103
+ document.removeEventListener("mouseup", onMouseUp, false);
104
+ onDragEnd(
105
+ flatMap(rowsToSelect.current, id => {
106
+ if (rectangleCellPaths.current) {
107
+ return rectangleCellPaths.current.map(path => {
108
+ return `${id}:${path}`;
109
+ });
110
+ } else {
111
+ return `${id}:${path}`;
112
+ }
113
+ })
114
+ );
115
+ }, [cellId, handleDrag, onDragEnd, thisTable]);
116
+
117
+ return (
118
+ <div
119
+ onMouseDown={e => {
120
+ rowsToSelect.current = [];
121
+ xStart.current = e.clientX;
122
+ const { isRect, selectedPaths } = isSelectionARectangle();
123
+ if (isRect) {
124
+ rectangleCellPaths.current = selectedPaths;
125
+ }
126
+ document.addEventListener("mousemove", handleDrag, false);
127
+ document.addEventListener("mouseup", onMouseUp, false);
128
+ }}
129
+ className="cellDragHandle"
130
+ />
131
+ );
132
+ };
@@ -0,0 +1,62 @@
1
+ import React, { useState } from "react";
2
+ import classNames from "classnames";
3
+ import { Icon, Popover } from "@blueprintjs/core";
4
+
5
+ export const ColumnFilterMenu = ({
6
+ addFilters,
7
+ compact,
8
+ currentFilter,
9
+ currentParams,
10
+ dataType,
11
+ extraCompact,
12
+ filterActiveForColumn,
13
+ FilterMenu,
14
+ filterOn,
15
+ removeSingleFilter,
16
+ schemaForField,
17
+ setNewParams,
18
+ formName
19
+ }) => {
20
+ const [columnFilterMenuOpen, setColumnFilterMenuOpen] = useState(false);
21
+ return (
22
+ <Popover
23
+ position="bottom"
24
+ onClose={() => setColumnFilterMenuOpen(false)}
25
+ isOpen={columnFilterMenuOpen}
26
+ modifiers={{
27
+ preventOverflow: { enabled: true },
28
+ hide: { enabled: false },
29
+ flip: { enabled: false }
30
+ }}
31
+ content={
32
+ <FilterMenu
33
+ formName={formName}
34
+ addFilters={addFilters}
35
+ compact={compact}
36
+ currentFilter={currentFilter}
37
+ currentParams={currentParams}
38
+ dataType={dataType}
39
+ filterOn={filterOn}
40
+ removeSingleFilter={removeSingleFilter}
41
+ schemaForField={schemaForField}
42
+ setNewParams={setNewParams}
43
+ togglePopover={() => setColumnFilterMenuOpen(false)}
44
+ />
45
+ }
46
+ >
47
+ <Icon
48
+ style={{ marginLeft: 5 }}
49
+ icon="filter"
50
+ size={extraCompact ? 14 : undefined}
51
+ onClick={e => {
52
+ e.preventDefault();
53
+ e.stopPropagation();
54
+ setColumnFilterMenuOpen(prev => !prev);
55
+ }}
56
+ className={classNames("tg-filter-menu-button", {
57
+ "tg-active-filter": !!filterActiveForColumn
58
+ })}
59
+ />
60
+ </Popover>
61
+ );
62
+ };