@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.
- package/AdvancedOptions.js +33 -0
- package/AssignDefaultsModeContext.js +22 -0
- package/CellDragHandle.js +132 -0
- package/ColumnFilterMenu.js +62 -0
- package/Columns.js +979 -0
- package/DataTable/utils/queryParams.d.ts +14 -7
- package/DisabledLoadingComponent.js +15 -0
- package/DisplayOptions.js +199 -0
- package/DropdownButton.js +36 -0
- package/DropdownCell.js +61 -0
- package/EditableCell.js +44 -0
- package/FillWindow.css +6 -0
- package/FillWindow.js +69 -0
- package/FilterAndSortMenu.js +391 -0
- package/FormSeparator.js +9 -0
- package/LoadingDots.js +14 -0
- package/MatchHeaders.js +234 -0
- package/PagingTool.js +225 -0
- package/RenderCell.js +191 -0
- package/SearchBar.js +69 -0
- package/SimpleStepViz.js +22 -0
- package/SortableColumns.js +100 -0
- package/TableFormTrackerContext.js +10 -0
- package/Tag.js +112 -0
- package/ThComponent.js +44 -0
- package/TimelineEvent.js +31 -0
- package/UploadCsvWizard.css +4 -0
- package/UploadCsvWizard.js +719 -0
- package/Uploader.js +1278 -0
- package/adHoc.js +10 -0
- package/autoTooltip.js +201 -0
- package/basicHandleActionsWithFullState.js +14 -0
- package/browserUtils.js +3 -0
- package/combineReducersWithFullState.js +14 -0
- package/commandControls.js +82 -0
- package/commandUtils.js +112 -0
- package/constants.js +1 -0
- package/convertSchema.js +69 -0
- package/customIcons.js +361 -0
- package/dataTableEnhancer.js +41 -0
- package/defaultFormatters.js +32 -0
- package/defaultValidators.js +40 -0
- package/determineBlackOrWhiteTextColor.js +4 -0
- package/editCellHelper.js +44 -0
- package/formatPasteData.js +16 -0
- package/getAllRows.js +11 -0
- package/getCellCopyText.js +7 -0
- package/getCellInfo.js +36 -0
- package/getCellVal.js +20 -0
- package/getDayjsFormatter.js +35 -0
- package/getFieldPathToField.js +7 -0
- package/getIdOrCodeOrIndex.js +9 -0
- package/getLastSelectedEntity.js +11 -0
- package/getNewEntToSelect.js +25 -0
- package/getNewName.js +31 -0
- package/getRowCopyText.js +28 -0
- package/getTableConfigFromStorage.js +5 -0
- package/getTextFromEl.js +28 -0
- package/getVals.js +8 -0
- package/handleCopyColumn.js +21 -0
- package/handleCopyHelper.js +15 -0
- package/handleCopyRows.js +23 -0
- package/handleCopyTable.js +16 -0
- package/handlerHelpers.js +24 -0
- package/hotkeyUtils.js +131 -0
- package/index.cjs.js +972 -837
- package/index.d.ts +0 -1
- package/index.es.js +972 -837
- package/index.js +1 -0
- package/isBeingCalledExcessively.js +31 -0
- package/isBottomRightCornerOfRectangle.js +20 -0
- package/isEntityClean.js +15 -0
- package/isTruthy.js +12 -0
- package/isValueEmpty.js +3 -0
- package/itemUpload.js +84 -0
- package/menuUtils.js +433 -0
- package/package.json +1 -2
- package/popoverOverflowModifiers.js +11 -0
- package/primarySelectedValue.js +1 -0
- package/pureNoFunc.js +31 -0
- package/queryParams.js +1058 -0
- package/removeCleanRows.js +22 -0
- package/renderOnDoc.js +32 -0
- package/rerenderOnWindowResize.js +26 -0
- package/rowClick.js +181 -0
- package/selection.js +8 -0
- package/showAppSpinner.js +12 -0
- package/showDialogOnDocBody.js +33 -0
- package/showProgressToast.js +22 -0
- package/sortify.js +73 -0
- package/style.css +13 -0
- package/tagUtils.js +45 -0
- package/tgFormValues.js +35 -0
- package/tg_modalState.js +47 -0
- package/throwFormError.js +16 -0
- package/toastr.js +148 -0
- package/tryToMatchSchemas.js +264 -0
- package/typeToCommonType.js +6 -0
- package/useDeepEqualMemo.js +15 -0
- package/useDialog.js +63 -0
- package/useStableReference.js +9 -0
- package/useTableEntities.js +38 -0
- package/useTraceUpdate.js +19 -0
- package/utils.js +37 -0
- package/validateTableWideErrors.js +160 -0
- package/viewColumn.js +97 -0
- package/withField.js +20 -0
- package/withFields.js +11 -0
- package/withLocalStorage.js +11 -0
- package/withSelectTableRecords.js +43 -0
- package/withSelectedEntities.js +65 -0
- package/withStore.js +10 -0
- package/withTableParams.js +301 -0
- 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
|
+
};
|