@teselagen/ui 0.7.33-beta.2 → 0.7.33-beta.4
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/package.json +1 -1
- package/src/AdvancedOptions.spec.js +26 -0
- package/src/AsyncValidateFieldSpinner/index.js +12 -0
- package/src/BlueprintError/index.js +14 -0
- package/src/BounceLoader/index.js +16 -0
- package/src/BounceLoader/style.css +45 -0
- package/src/CollapsibleCard/index.js +68 -0
- package/src/CollapsibleCard/style.css +23 -0
- package/src/DNALoader/index.js +20 -0
- package/src/DNALoader/style.css +251 -0
- package/src/DataTable/index.js +3209 -0
- package/src/DataTable/style.css +608 -0
- package/src/DataTable/utils/filterLocalEntitiesToHasura.test.js +515 -0
- package/src/DataTable/utils/index.js +55 -0
- package/src/DataTable/utils/simplifyHasuraWhere.test.js +73 -0
- package/src/DataTable/utils/tableQueryParamsToHasuraClauses.test.js +219 -0
- package/src/DialogFooter/index.js +86 -0
- package/src/DialogFooter/style.css +9 -0
- package/src/FormComponents/index.js +1266 -0
- package/src/FormComponents/style.css +275 -0
- package/src/FormComponents/utils.js +6 -0
- package/src/HotkeysDialog/index.js +79 -0
- package/src/HotkeysDialog/style.css +54 -0
- package/src/InfoHelper/index.js +78 -0
- package/src/InfoHelper/style.css +7 -0
- package/src/IntentText/index.js +18 -0
- package/src/Loading/index.js +70 -0
- package/src/Loading/style.css +4 -0
- package/src/MenuBar/index.js +423 -0
- package/src/MenuBar/style.css +45 -0
- package/src/PromptUnsavedChanges/index.js +38 -0
- package/src/ResizableDraggableDialog/index.js +141 -0
- package/src/ResizableDraggableDialog/style.css +42 -0
- package/src/ScrollToTop/index.js +72 -0
- package/src/TagSelect/index.js +69 -0
- package/src/TagSelect/style.css +13 -0
- package/src/TgHtmlSelect/index.js +20 -0
- package/src/TgSelect/index.js +537 -0
- package/src/TgSelect/style.css +61 -0
- package/src/TgSuggest/index.js +124 -0
- package/src/Timeline/index.js +15 -0
- package/src/enhancers/withDialog/index.js +196 -0
- package/src/index.js +88 -1
- package/src/showConfirmationDialog/index.js +148 -0
- package/src/style.css +260 -24
- package/AdvancedOptions.js +0 -33
- package/AssignDefaultsModeContext.js +0 -22
- package/DropdownButton.js +0 -36
- package/FillWindow.css +0 -6
- package/FillWindow.js +0 -69
- package/MatchHeaders.js +0 -234
- package/SimpleStepViz.js +0 -22
- package/Tag.js +0 -112
- package/UploadCsvWizard.css +0 -4
- package/UploadCsvWizard.js +0 -719
- package/autoTooltip.js +0 -201
- package/constants.js +0 -1
- package/customIcons.js +0 -361
- package/rerenderOnWindowResize.js +0 -26
- package/showAppSpinner.js +0 -12
- package/showDialogOnDocBody.js +0 -33
- package/src/CellDragHandle.js +0 -132
- package/src/ColumnFilterMenu.js +0 -62
- package/src/Columns.js +0 -979
- package/src/DisabledLoadingComponent.js +0 -15
- package/src/DisplayOptions.js +0 -199
- package/src/DropdownCell.js +0 -61
- package/src/EditableCell.js +0 -44
- package/src/FilterAndSortMenu.js +0 -388
- package/src/FormSeparator.js +0 -9
- package/src/LoadingDots.js +0 -14
- package/src/PagingTool.js +0 -225
- package/src/RenderCell.js +0 -191
- package/src/SearchBar.js +0 -69
- package/src/SortableColumns.js +0 -100
- package/src/TableFormTrackerContext.js +0 -10
- package/src/ThComponent.js +0 -44
- package/src/TimelineEvent.js +0 -31
- package/src/Uploader.js +0 -1278
- package/src/adHoc.js +0 -10
- package/src/basicHandleActionsWithFullState.js +0 -14
- package/src/browserUtils.js +0 -3
- package/src/combineReducersWithFullState.js +0 -14
- package/src/commandControls.js +0 -82
- package/src/commandUtils.js +0 -112
- package/src/convertSchema.js +0 -69
- package/src/dataTableEnhancer.js +0 -41
- package/src/defaultFormatters.js +0 -32
- package/src/defaultValidators.js +0 -40
- package/src/determineBlackOrWhiteTextColor.js +0 -4
- package/src/editCellHelper.js +0 -44
- package/src/filterLocalEntitiesToHasura.js +0 -216
- package/src/formatPasteData.js +0 -16
- package/src/getAllRows.js +0 -11
- package/src/getCellCopyText.js +0 -7
- package/src/getCellInfo.js +0 -36
- package/src/getCellVal.js +0 -20
- package/src/getDayjsFormatter.js +0 -35
- package/src/getFieldPathToField.js +0 -7
- package/src/getIdOrCodeOrIndex.js +0 -9
- package/src/getLastSelectedEntity.js +0 -11
- package/src/getNewEntToSelect.js +0 -25
- package/src/getNewName.js +0 -31
- package/src/getRowCopyText.js +0 -28
- package/src/getTableConfigFromStorage.js +0 -5
- package/src/getTextFromEl.js +0 -28
- package/src/getVals.js +0 -8
- package/src/handleCopyColumn.js +0 -21
- package/src/handleCopyHelper.js +0 -15
- package/src/handleCopyRows.js +0 -23
- package/src/handleCopyTable.js +0 -16
- package/src/handlerHelpers.js +0 -24
- package/src/hotkeyUtils.js +0 -131
- package/src/initializeHasuraWhereAndFilter.js +0 -27
- package/src/isBeingCalledExcessively.js +0 -24
- package/src/isBottomRightCornerOfRectangle.js +0 -20
- package/src/isEntityClean.js +0 -15
- package/src/isTruthy.js +0 -12
- package/src/isValueEmpty.js +0 -3
- package/src/itemUpload.js +0 -84
- package/src/menuUtils.js +0 -433
- package/src/popoverOverflowModifiers.js +0 -11
- package/src/primarySelectedValue.js +0 -1
- package/src/pureNoFunc.js +0 -31
- package/src/queryParams.js +0 -336
- package/src/removeCleanRows.js +0 -22
- package/src/renderOnDoc.js +0 -32
- package/src/rowClick.js +0 -181
- package/src/selection.js +0 -8
- package/src/showProgressToast.js +0 -22
- package/src/simplifyHasuraWhere.js +0 -80
- package/src/sortify.js +0 -73
- package/tableQueryParamsToHasuraClauses.js +0 -113
- package/tagUtils.js +0 -45
- package/tgFormValues.js +0 -35
- package/tg_modalState.js +0 -47
- package/throwFormError.js +0 -16
- package/toastr.js +0 -148
- package/tryToMatchSchemas.js +0 -264
- package/typeToCommonType.js +0 -6
- package/useDeepEqualMemo.js +0 -15
- package/useDialog.js +0 -63
- package/useStableReference.js +0 -9
- package/useTableEntities.js +0 -38
- package/useTraceUpdate.js +0 -19
- package/utils.js +0 -37
- package/validateTableWideErrors.js +0 -160
- package/viewColumn.js +0 -97
- package/withField.js +0 -20
- package/withFields.js +0 -11
- package/withLocalStorage.js +0 -11
- package/withSelectTableRecords.js +0 -43
- package/withSelectedEntities.js +0 -65
- package/withStore.js +0 -10
- package/withTableParams.js +0 -288
- package/wrapDialog.js +0 -116
- /package/{CellDragHandle.js → src/DataTable/CellDragHandle.js} +0 -0
- /package/{ColumnFilterMenu.js → src/DataTable/ColumnFilterMenu.js} +0 -0
- /package/{Columns.js → src/DataTable/Columns.js} +0 -0
- /package/{DisabledLoadingComponent.js → src/DataTable/DisabledLoadingComponent.js} +0 -0
- /package/{DisplayOptions.js → src/DataTable/DisplayOptions.js} +0 -0
- /package/{DropdownCell.js → src/DataTable/DropdownCell.js} +0 -0
- /package/{EditableCell.js → src/DataTable/EditableCell.js} +0 -0
- /package/{FilterAndSortMenu.js → src/DataTable/FilterAndSortMenu.js} +0 -0
- /package/{PagingTool.js → src/DataTable/PagingTool.js} +0 -0
- /package/{RenderCell.js → src/DataTable/RenderCell.js} +0 -0
- /package/{SearchBar.js → src/DataTable/SearchBar.js} +0 -0
- /package/{SortableColumns.js → src/DataTable/SortableColumns.js} +0 -0
- /package/{TableFormTrackerContext.js → src/DataTable/TableFormTrackerContext.js} +0 -0
- /package/{ThComponent.js → src/DataTable/ThComponent.js} +0 -0
- /package/{dataTableEnhancer.js → src/DataTable/dataTableEnhancer.js} +0 -0
- /package/{defaultFormatters.js → src/DataTable/defaultFormatters.js} +0 -0
- /package/{defaultValidators.js → src/DataTable/defaultValidators.js} +0 -0
- /package/{editCellHelper.js → src/DataTable/editCellHelper.js} +0 -0
- /package/{getCellVal.js → src/DataTable/getCellVal.js} +0 -0
- /package/{getVals.js → src/DataTable/getVals.js} +0 -0
- /package/{isTruthy.js → src/DataTable/isTruthy.js} +0 -0
- /package/{isValueEmpty.js → src/DataTable/isValueEmpty.js} +0 -0
- /package/{convertSchema.js → src/DataTable/utils/convertSchema.js} +0 -0
- /package/{filterLocalEntitiesToHasura.js → src/DataTable/utils/filterLocalEntitiesToHasura.js} +0 -0
- /package/{formatPasteData.js → src/DataTable/utils/formatPasteData.js} +0 -0
- /package/{getAllRows.js → src/DataTable/utils/getAllRows.js} +0 -0
- /package/{getCellCopyText.js → src/DataTable/utils/getCellCopyText.js} +0 -0
- /package/{getCellInfo.js → src/DataTable/utils/getCellInfo.js} +0 -0
- /package/{getFieldPathToField.js → src/DataTable/utils/getFieldPathToField.js} +0 -0
- /package/{getIdOrCodeOrIndex.js → src/DataTable/utils/getIdOrCodeOrIndex.js} +0 -0
- /package/{getLastSelectedEntity.js → src/DataTable/utils/getLastSelectedEntity.js} +0 -0
- /package/{getNewEntToSelect.js → src/DataTable/utils/getNewEntToSelect.js} +0 -0
- /package/{getRowCopyText.js → src/DataTable/utils/getRowCopyText.js} +0 -0
- /package/{getTableConfigFromStorage.js → src/DataTable/utils/getTableConfigFromStorage.js} +0 -0
- /package/{handleCopyColumn.js → src/DataTable/utils/handleCopyColumn.js} +0 -0
- /package/{handleCopyHelper.js → src/DataTable/utils/handleCopyHelper.js} +0 -0
- /package/{handleCopyRows.js → src/DataTable/utils/handleCopyRows.js} +0 -0
- /package/{handleCopyTable.js → src/DataTable/utils/handleCopyTable.js} +0 -0
- /package/{initializeHasuraWhereAndFilter.js → src/DataTable/utils/initializeHasuraWhereAndFilter.js} +0 -0
- /package/{isBottomRightCornerOfRectangle.js → src/DataTable/utils/isBottomRightCornerOfRectangle.js} +0 -0
- /package/{isEntityClean.js → src/DataTable/utils/isEntityClean.js} +0 -0
- /package/{primarySelectedValue.js → src/DataTable/utils/primarySelectedValue.js} +0 -0
- /package/{queryParams.js → src/DataTable/utils/queryParams.js} +0 -0
- /package/{removeCleanRows.js → src/DataTable/utils/removeCleanRows.js} +0 -0
- /package/{rowClick.js → src/DataTable/utils/rowClick.js} +0 -0
- /package/{selection.js → src/DataTable/utils/selection.js} +0 -0
- /package/{simplifyHasuraWhere.js → src/DataTable/utils/simplifyHasuraWhere.js} +0 -0
- /package/src/{tableQueryParamsToHasuraClauses.js → DataTable/utils/tableQueryParamsToHasuraClauses.js} +0 -0
- /package/src/{useTableEntities.js → DataTable/utils/useTableEntities.js} +0 -0
- /package/src/{utils.js → DataTable/utils/utils.js} +0 -0
- /package/src/{withSelectedEntities.js → DataTable/utils/withSelectedEntities.js} +0 -0
- /package/src/{withTableParams.js → DataTable/utils/withTableParams.js} +0 -0
- /package/src/{validateTableWideErrors.js → DataTable/validateTableWideErrors.js} +0 -0
- /package/src/{viewColumn.js → DataTable/viewColumn.js} +0 -0
- /package/{FormSeparator.js → src/FormComponents/FormSeparator.js} +0 -0
- /package/{LoadingDots.js → src/FormComponents/LoadingDots.js} +0 -0
- /package/{Uploader.js → src/FormComponents/Uploader.js} +0 -0
- /package/{getNewName.js → src/FormComponents/getNewName.js} +0 -0
- /package/{itemUpload.js → src/FormComponents/itemUpload.js} +0 -0
- /package/{sortify.js → src/FormComponents/sortify.js} +0 -0
- /package/src/{tryToMatchSchemas.js → FormComponents/tryToMatchSchemas.js} +0 -0
- /package/{TimelineEvent.js → src/Timeline/TimelineEvent.js} +0 -0
- /package/{style.css → src/Timeline/style.css} +0 -0
- /package/src/{tg_modalState.js → enhancers/withDialog/tg_modalState.js} +0 -0
- /package/src/{withField.js → enhancers/withField.js} +0 -0
- /package/src/{withFields.js → enhancers/withFields.js} +0 -0
- /package/src/{withLocalStorage.js → enhancers/withLocalStorage.js} +0 -0
- /package/{adHoc.js → src/utils/adHoc.js} +0 -0
- /package/{basicHandleActionsWithFullState.js → src/utils/basicHandleActionsWithFullState.js} +0 -0
- /package/{browserUtils.js → src/utils/browserUtils.js} +0 -0
- /package/{combineReducersWithFullState.js → src/utils/combineReducersWithFullState.js} +0 -0
- /package/{commandControls.js → src/utils/commandControls.js} +0 -0
- /package/{commandUtils.js → src/utils/commandUtils.js} +0 -0
- /package/{determineBlackOrWhiteTextColor.js → src/utils/determineBlackOrWhiteTextColor.js} +0 -0
- /package/{getDayjsFormatter.js → src/utils/getDayjsFormatter.js} +0 -0
- /package/{getTextFromEl.js → src/utils/getTextFromEl.js} +0 -0
- /package/{handlerHelpers.js → src/utils/handlerHelpers.js} +0 -0
- /package/{index.js → src/utils/hooks/index.js} +0 -0
- /package/src/{useDeepEqualMemo.js → utils/hooks/useDeepEqualMemo.js} +0 -0
- /package/src/{useStableReference.js → utils/hooks/useStableReference.js} +0 -0
- /package/{hotkeyUtils.js → src/utils/hotkeyUtils.js} +0 -0
- /package/{isBeingCalledExcessively.js → src/utils/isBeingCalledExcessively.js} +0 -0
- /package/{menuUtils.js → src/utils/menuUtils.js} +0 -0
- /package/{popoverOverflowModifiers.js → src/utils/popoverOverflowModifiers.js} +0 -0
- /package/{pureNoFunc.js → src/utils/pureNoFunc.js} +0 -0
- /package/{renderOnDoc.js → src/utils/renderOnDoc.js} +0 -0
- /package/{showProgressToast.js → src/utils/showProgressToast.js} +0 -0
- /package/src/{tagUtils.js → utils/tagUtils.js} +0 -0
- /package/src/{tgFormValues.js → utils/tgFormValues.js} +0 -0
- /package/src/{useTraceUpdate.js → utils/useTraceUpdate.js} +0 -0
- /package/src/{withSelectTableRecords.js → utils/withSelectTableRecords.js} +0 -0
- /package/src/{withStore.js → utils/withStore.js} +0 -0
package/src/FormSeparator.js
DELETED
package/src/LoadingDots.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
|
2
|
-
|
|
3
|
-
export const LoadingDots = () => {
|
|
4
|
-
const [dots, setDots] = useState("");
|
|
5
|
-
useEffect(() => {
|
|
6
|
-
const interval = setInterval(() => {
|
|
7
|
-
setDots(dots => {
|
|
8
|
-
return dots.length === 3 ? "" : dots + ".";
|
|
9
|
-
});
|
|
10
|
-
}, 500);
|
|
11
|
-
return () => clearInterval(interval);
|
|
12
|
-
}, []);
|
|
13
|
-
return <span>{dots}</span>;
|
|
14
|
-
};
|
package/src/PagingTool.js
DELETED
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect, useRef, useCallback } from "react";
|
|
2
|
-
import classNames from "classnames";
|
|
3
|
-
import { noop, get, toInteger } from "lodash-es";
|
|
4
|
-
import { Button, Classes } from "@blueprintjs/core";
|
|
5
|
-
import { onEnterOrBlurHelper } from "../utils/handlerHelpers";
|
|
6
|
-
import { defaultPageSizes } from "./utils/queryParams";
|
|
7
|
-
import { getIdOrCodeOrIndex } from "./utils";
|
|
8
|
-
|
|
9
|
-
function PagingInput({ disabled, onBlur, defaultPage }) {
|
|
10
|
-
const [page, setPage] = useState(defaultPage);
|
|
11
|
-
const defaultValue = useRef(defaultPage);
|
|
12
|
-
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
if (page !== defaultPage && defaultValue.current !== defaultPage) {
|
|
15
|
-
setPage(defaultPage);
|
|
16
|
-
}
|
|
17
|
-
defaultValue.current = defaultPage;
|
|
18
|
-
}, [page, defaultPage]);
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<input
|
|
22
|
-
name="page"
|
|
23
|
-
style={{
|
|
24
|
-
marginLeft: 5,
|
|
25
|
-
width: page > 999 ? 65 : page > 99 ? 45 : 35,
|
|
26
|
-
marginRight: 8
|
|
27
|
-
}}
|
|
28
|
-
value={page}
|
|
29
|
-
disabled={disabled}
|
|
30
|
-
onChange={e => {
|
|
31
|
-
setPage(e.target.value);
|
|
32
|
-
}}
|
|
33
|
-
{...onEnterOrBlurHelper(onBlur)}
|
|
34
|
-
className={Classes.INPUT}
|
|
35
|
-
/>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Define the functional component and its props
|
|
40
|
-
const PagingTool = ({
|
|
41
|
-
controlled_hasNextPage,
|
|
42
|
-
controlled_onRefresh,
|
|
43
|
-
controlled_page,
|
|
44
|
-
controlled_setPage,
|
|
45
|
-
controlled_setPageSize,
|
|
46
|
-
controlled_total,
|
|
47
|
-
disabled: _disabled,
|
|
48
|
-
disableSetPageSize,
|
|
49
|
-
entities,
|
|
50
|
-
entityCount,
|
|
51
|
-
hideSetPageSize,
|
|
52
|
-
hideTotalPages,
|
|
53
|
-
keepSelectionOnPageChange,
|
|
54
|
-
onRefresh: _onRefresh,
|
|
55
|
-
page: _page,
|
|
56
|
-
pageSize,
|
|
57
|
-
pagingDisabled,
|
|
58
|
-
persistPageSize = noop,
|
|
59
|
-
scrollToTop,
|
|
60
|
-
setPage: _setPage,
|
|
61
|
-
setPageSize: _setPageSize,
|
|
62
|
-
setSelectedEntityIdMap
|
|
63
|
-
}) => {
|
|
64
|
-
const page = controlled_page || _page;
|
|
65
|
-
const total = controlled_total || entityCount;
|
|
66
|
-
const disabled = _disabled || pagingDisabled;
|
|
67
|
-
const onRefresh = controlled_onRefresh || _onRefresh;
|
|
68
|
-
const setPage = controlled_setPage || _setPage;
|
|
69
|
-
const setPageSize = controlled_setPageSize || _setPageSize;
|
|
70
|
-
|
|
71
|
-
const onPageChange = useCallback(() => {
|
|
72
|
-
const record = get(entities, "[0]");
|
|
73
|
-
if (
|
|
74
|
-
!keepSelectionOnPageChange &&
|
|
75
|
-
(!record || !getIdOrCodeOrIndex(record))
|
|
76
|
-
) {
|
|
77
|
-
setSelectedEntityIdMap({});
|
|
78
|
-
}
|
|
79
|
-
scrollToTop();
|
|
80
|
-
}, [
|
|
81
|
-
entities,
|
|
82
|
-
keepSelectionOnPageChange,
|
|
83
|
-
scrollToTop,
|
|
84
|
-
setSelectedEntityIdMap
|
|
85
|
-
]);
|
|
86
|
-
// Define local state
|
|
87
|
-
const [refetching, setRefetching] = useState(false);
|
|
88
|
-
|
|
89
|
-
// Initialize additional page sizes
|
|
90
|
-
useEffect(() => {
|
|
91
|
-
const additionalPageSize =
|
|
92
|
-
window.frontEndConfig && window.frontEndConfig.additionalPageSize
|
|
93
|
-
? [toInteger(window.frontEndConfig.additionalPageSize)]
|
|
94
|
-
: [];
|
|
95
|
-
window.tgPageSizes = [...defaultPageSizes, ...additionalPageSize];
|
|
96
|
-
}, []);
|
|
97
|
-
|
|
98
|
-
// Define event handlers for the component
|
|
99
|
-
const onRefreshHandler = async () => {
|
|
100
|
-
setRefetching(true);
|
|
101
|
-
await onRefresh();
|
|
102
|
-
setRefetching(false);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const setPageHandler = page => {
|
|
106
|
-
setPage(page);
|
|
107
|
-
onPageChange(page);
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const setPageSizeHandler = e => {
|
|
111
|
-
const newPageSize = parseInt(e.target.value, 10);
|
|
112
|
-
setPageSize(newPageSize);
|
|
113
|
-
persistPageSize(newPageSize);
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
const pageBackHandler = () => {
|
|
117
|
-
setPageHandler(parseInt(page, 10) - 1);
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
const pageForwardHandler = () => {
|
|
121
|
-
setPageHandler(parseInt(page, 10) + 1);
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
const pageInputBlurHandler = e => {
|
|
125
|
-
const lastPage = Math.ceil(total / pageSize);
|
|
126
|
-
const pageValue = parseInt(e.target.value, 10);
|
|
127
|
-
const selectedPage =
|
|
128
|
-
pageValue > lastPage
|
|
129
|
-
? lastPage
|
|
130
|
-
: pageValue < 1 || isNaN(pageValue)
|
|
131
|
-
? 1
|
|
132
|
-
: pageValue;
|
|
133
|
-
setPageHandler(selectedPage);
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
// Define rendering logic
|
|
137
|
-
const pageStart = (page - 1) * pageSize + 1;
|
|
138
|
-
if (pageStart < 0) throw new Error("We should never have page be <0");
|
|
139
|
-
const backEnabled = page - 1 > 0;
|
|
140
|
-
const forwardEnabled = page * pageSize < total;
|
|
141
|
-
const lastPage = Math.ceil(total / pageSize);
|
|
142
|
-
const options = [...(window.tgPageSizes || defaultPageSizes)];
|
|
143
|
-
if (!options.includes(pageSize)) {
|
|
144
|
-
options.push(pageSize);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return (
|
|
148
|
-
<div className="paging-toolbar-container">
|
|
149
|
-
{onRefresh && (
|
|
150
|
-
<Button
|
|
151
|
-
minimal
|
|
152
|
-
loading={refetching}
|
|
153
|
-
icon="refresh"
|
|
154
|
-
disabled={disabled}
|
|
155
|
-
onClick={onRefreshHandler}
|
|
156
|
-
/>
|
|
157
|
-
)}
|
|
158
|
-
{!hideSetPageSize && (
|
|
159
|
-
<div
|
|
160
|
-
title="Set Page Size"
|
|
161
|
-
className={classNames(Classes.SELECT, Classes.MINIMAL)}
|
|
162
|
-
>
|
|
163
|
-
<select
|
|
164
|
-
name="page-size"
|
|
165
|
-
className="paging-page-size"
|
|
166
|
-
onChange={setPageSizeHandler}
|
|
167
|
-
disabled={disabled || disableSetPageSize}
|
|
168
|
-
value={pageSize}
|
|
169
|
-
>
|
|
170
|
-
{[
|
|
171
|
-
<option key="page-size-placeholder" disabled value="fake">
|
|
172
|
-
Size
|
|
173
|
-
</option>,
|
|
174
|
-
...options.map(size => {
|
|
175
|
-
return (
|
|
176
|
-
<option key={size} value={size}>
|
|
177
|
-
{size}
|
|
178
|
-
</option>
|
|
179
|
-
);
|
|
180
|
-
})
|
|
181
|
-
]}
|
|
182
|
-
</select>
|
|
183
|
-
</div>
|
|
184
|
-
)}
|
|
185
|
-
<Button
|
|
186
|
-
onClick={pageBackHandler}
|
|
187
|
-
disabled={!backEnabled || disabled}
|
|
188
|
-
minimal
|
|
189
|
-
className="paging-arrow-left"
|
|
190
|
-
icon="chevron-left"
|
|
191
|
-
/>
|
|
192
|
-
<div>
|
|
193
|
-
{hideTotalPages ? (
|
|
194
|
-
page
|
|
195
|
-
) : total ? (
|
|
196
|
-
<div>
|
|
197
|
-
<PagingInput
|
|
198
|
-
disabled={disabled}
|
|
199
|
-
onBlur={pageInputBlurHandler}
|
|
200
|
-
defaultPage={page}
|
|
201
|
-
lastPage={lastPage}
|
|
202
|
-
/>
|
|
203
|
-
of {lastPage}
|
|
204
|
-
</div>
|
|
205
|
-
) : (
|
|
206
|
-
"No Rows"
|
|
207
|
-
)}
|
|
208
|
-
</div>
|
|
209
|
-
<Button
|
|
210
|
-
style={{ marginLeft: 5 }}
|
|
211
|
-
disabled={
|
|
212
|
-
(controlled_hasNextPage === undefined
|
|
213
|
-
? !forwardEnabled
|
|
214
|
-
: !controlled_hasNextPage) || disabled
|
|
215
|
-
}
|
|
216
|
-
icon="chevron-right"
|
|
217
|
-
minimal
|
|
218
|
-
className="paging-arrow-right"
|
|
219
|
-
onClick={pageForwardHandler}
|
|
220
|
-
/>
|
|
221
|
-
</div>
|
|
222
|
-
);
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
export default PagingTool;
|
package/src/RenderCell.js
DELETED
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { useSelector } from "react-redux";
|
|
3
|
-
import { Checkbox, Icon } from "@blueprintjs/core";
|
|
4
|
-
import {
|
|
5
|
-
getIdOrCodeOrIndex,
|
|
6
|
-
isBottomRightCornerOfRectangle,
|
|
7
|
-
PRIMARY_SELECTED_VAL
|
|
8
|
-
} from "./utils";
|
|
9
|
-
import { DropdownCell } from "./DropdownCell";
|
|
10
|
-
import { EditableCell } from "./EditableCell";
|
|
11
|
-
import { getVals } from "./getVals";
|
|
12
|
-
import { CellDragHandle } from "./CellDragHandle";
|
|
13
|
-
|
|
14
|
-
export const RenderCell = ({
|
|
15
|
-
oldFunc,
|
|
16
|
-
getCopyTextForCell,
|
|
17
|
-
column,
|
|
18
|
-
isCellEditable,
|
|
19
|
-
isEntityDisabled,
|
|
20
|
-
finishCellEdit,
|
|
21
|
-
formName,
|
|
22
|
-
noEllipsis,
|
|
23
|
-
cancelCellEdit,
|
|
24
|
-
getCellHoverText,
|
|
25
|
-
selectedCells,
|
|
26
|
-
isSelectionARectangle,
|
|
27
|
-
startCellEdit,
|
|
28
|
-
tableRef,
|
|
29
|
-
onDragEnd,
|
|
30
|
-
args
|
|
31
|
-
}) => {
|
|
32
|
-
const editingCell = useSelector(
|
|
33
|
-
state => state.form?.[formName]?.values?.reduxFormEditingCell
|
|
34
|
-
);
|
|
35
|
-
const initialValue = useSelector(
|
|
36
|
-
state => state.form?.[formName]?.values?.reduxFormInitialValue
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
const [row] = args;
|
|
40
|
-
const rowId = getIdOrCodeOrIndex(row.original, row.index);
|
|
41
|
-
const cellId = `${rowId}:${row.column.path}`;
|
|
42
|
-
const isEditingCell = editingCell === cellId;
|
|
43
|
-
let val = oldFunc(...args);
|
|
44
|
-
const oldVal = val;
|
|
45
|
-
const text = getCopyTextForCell(val, row, column);
|
|
46
|
-
const dataTest = {
|
|
47
|
-
"data-test": "tgCell_" + column.path
|
|
48
|
-
};
|
|
49
|
-
const fullValue = row.original?.[row.column.path];
|
|
50
|
-
|
|
51
|
-
if (isEditingCell) {
|
|
52
|
-
if (column.type === "genericSelect") {
|
|
53
|
-
const GenericSelectComp = column.GenericSelectComp;
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
<GenericSelectComp
|
|
57
|
-
rowId={rowId}
|
|
58
|
-
fullValue={fullValue}
|
|
59
|
-
initialValue={text}
|
|
60
|
-
{...dataTest}
|
|
61
|
-
finishEdit={(newVal, doNotStopEditing) => {
|
|
62
|
-
finishCellEdit(cellId, newVal, doNotStopEditing);
|
|
63
|
-
}}
|
|
64
|
-
dataTest={dataTest}
|
|
65
|
-
cancelEdit={cancelCellEdit}
|
|
66
|
-
/>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
if (column.type === "dropdown" || column.type === "dropdownMulti") {
|
|
70
|
-
return (
|
|
71
|
-
<DropdownCell
|
|
72
|
-
isMulti={dataTest.isMulti || column.type === "dropdownMulti"}
|
|
73
|
-
initialValue={dataTest.initialValue || text}
|
|
74
|
-
options={getVals(column.values)}
|
|
75
|
-
finishEdit={(newVal, doNotStopEditing) => {
|
|
76
|
-
finishCellEdit(cellId, newVal, doNotStopEditing);
|
|
77
|
-
}}
|
|
78
|
-
dataTest={dataTest}
|
|
79
|
-
cancelEdit={cancelCellEdit}
|
|
80
|
-
/>
|
|
81
|
-
);
|
|
82
|
-
} else {
|
|
83
|
-
return (
|
|
84
|
-
<EditableCell
|
|
85
|
-
dataTest={dataTest}
|
|
86
|
-
cancelEdit={cancelCellEdit}
|
|
87
|
-
isNumeric={column.type === "number"}
|
|
88
|
-
initialValue={initialValue || text}
|
|
89
|
-
finishEdit={newVal => {
|
|
90
|
-
finishCellEdit(cellId, newVal);
|
|
91
|
-
}}
|
|
92
|
-
/>
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const isBool = column.type === "boolean";
|
|
98
|
-
if (isCellEditable && isBool) {
|
|
99
|
-
val = (
|
|
100
|
-
<Checkbox
|
|
101
|
-
disabled={isEntityDisabled(row.original)}
|
|
102
|
-
className="tg-cell-edit-boolean-checkbox"
|
|
103
|
-
checked={oldVal === "True"}
|
|
104
|
-
onChange={e => {
|
|
105
|
-
const checked = e.target.checked;
|
|
106
|
-
finishCellEdit(cellId, checked);
|
|
107
|
-
}}
|
|
108
|
-
/>
|
|
109
|
-
);
|
|
110
|
-
noEllipsis = true;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
//wrap the original tableColumn.Cell function in another div in order to add a title attribute
|
|
114
|
-
let title = text;
|
|
115
|
-
if (getCellHoverText) title = getCellHoverText(...args);
|
|
116
|
-
else if (column.getTitleAttr) title = column.getTitleAttr(...args);
|
|
117
|
-
const isSelectedCell = selectedCells?.[cellId];
|
|
118
|
-
const {
|
|
119
|
-
isRect,
|
|
120
|
-
selectionGrid,
|
|
121
|
-
lastRowIndex,
|
|
122
|
-
lastCellIndex,
|
|
123
|
-
entityMap,
|
|
124
|
-
pathToIndex
|
|
125
|
-
} = isSelectionARectangle();
|
|
126
|
-
|
|
127
|
-
return (
|
|
128
|
-
<>
|
|
129
|
-
<div
|
|
130
|
-
style={{
|
|
131
|
-
...(!noEllipsis && {
|
|
132
|
-
textOverflow: "ellipsis",
|
|
133
|
-
overflow: "hidden"
|
|
134
|
-
})
|
|
135
|
-
}}
|
|
136
|
-
{...dataTest}
|
|
137
|
-
className="tg-cell-wrapper"
|
|
138
|
-
data-copy-text={text}
|
|
139
|
-
data-copy-json={JSON.stringify(
|
|
140
|
-
//tnw: eventually we'll parse these back out and use either the fullValue (for the generic selects) or the regular text vals for everything else
|
|
141
|
-
column.type === "genericSelect"
|
|
142
|
-
? {
|
|
143
|
-
__strVal: fullValue,
|
|
144
|
-
__genSelCol: column.path
|
|
145
|
-
}
|
|
146
|
-
: { __strVal: text }
|
|
147
|
-
)}
|
|
148
|
-
title={title || undefined}
|
|
149
|
-
>
|
|
150
|
-
{val}
|
|
151
|
-
</div>
|
|
152
|
-
{isCellEditable &&
|
|
153
|
-
(column.type === "dropdown" ||
|
|
154
|
-
column.type === "dropdownMulti" ||
|
|
155
|
-
column.type === "genericSelect") && (
|
|
156
|
-
<Icon
|
|
157
|
-
icon="caret-down"
|
|
158
|
-
style={{
|
|
159
|
-
position: "absolute",
|
|
160
|
-
right: 5,
|
|
161
|
-
opacity: 0.3
|
|
162
|
-
}}
|
|
163
|
-
className="cell-edit-dropdown"
|
|
164
|
-
onClick={() => {
|
|
165
|
-
startCellEdit(cellId);
|
|
166
|
-
}}
|
|
167
|
-
/>
|
|
168
|
-
)}
|
|
169
|
-
|
|
170
|
-
{isSelectedCell &&
|
|
171
|
-
(isRect
|
|
172
|
-
? isBottomRightCornerOfRectangle({
|
|
173
|
-
cellId,
|
|
174
|
-
selectionGrid,
|
|
175
|
-
lastRowIndex,
|
|
176
|
-
lastCellIndex,
|
|
177
|
-
entityMap,
|
|
178
|
-
pathToIndex
|
|
179
|
-
})
|
|
180
|
-
: isSelectedCell === PRIMARY_SELECTED_VAL) && (
|
|
181
|
-
<CellDragHandle
|
|
182
|
-
key={cellId}
|
|
183
|
-
thisTable={tableRef.current.tableRef}
|
|
184
|
-
cellId={cellId}
|
|
185
|
-
isSelectionARectangle={isSelectionARectangle}
|
|
186
|
-
onDragEnd={onDragEnd}
|
|
187
|
-
/>
|
|
188
|
-
)}
|
|
189
|
-
</>
|
|
190
|
-
);
|
|
191
|
-
};
|
package/src/SearchBar.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import { Button, Classes, Spinner } from "@blueprintjs/core";
|
|
3
|
-
import classNames from "classnames";
|
|
4
|
-
import { onEnterHelper } from "../utils/handlerHelpers";
|
|
5
|
-
import { InputField } from "../FormComponents";
|
|
6
|
-
|
|
7
|
-
const SearchBar = ({
|
|
8
|
-
searchInput,
|
|
9
|
-
setSearchTerm,
|
|
10
|
-
loading,
|
|
11
|
-
searchMenuButton,
|
|
12
|
-
disabled,
|
|
13
|
-
autoFocusSearch,
|
|
14
|
-
noForm
|
|
15
|
-
}) => {
|
|
16
|
-
const [inputText, setInputText] = useState(searchInput);
|
|
17
|
-
if (noForm) {
|
|
18
|
-
console.error(
|
|
19
|
-
"The search bar requires the component to be wrapped in a form"
|
|
20
|
-
);
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
let rightElement;
|
|
24
|
-
// need to always render searchMenuButton so it doesn't close
|
|
25
|
-
if (searchMenuButton) {
|
|
26
|
-
rightElement = (
|
|
27
|
-
<div style={{ display: "flex" }}>
|
|
28
|
-
{loading && <Spinner size="18" />}
|
|
29
|
-
{searchMenuButton}
|
|
30
|
-
</div>
|
|
31
|
-
);
|
|
32
|
-
} else {
|
|
33
|
-
rightElement = loading ? (
|
|
34
|
-
<Spinner size="18" />
|
|
35
|
-
) : (
|
|
36
|
-
<Button
|
|
37
|
-
minimal
|
|
38
|
-
icon="search"
|
|
39
|
-
onClick={() => {
|
|
40
|
-
setSearchTerm(inputText);
|
|
41
|
-
}}
|
|
42
|
-
/>
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
return (
|
|
46
|
-
<InputField
|
|
47
|
-
autoFocus={autoFocusSearch}
|
|
48
|
-
disabled={disabled}
|
|
49
|
-
loading={loading}
|
|
50
|
-
type="search"
|
|
51
|
-
defaultValue={searchInput}
|
|
52
|
-
value={inputText}
|
|
53
|
-
onChange={e => {
|
|
54
|
-
setInputText(e.target.value);
|
|
55
|
-
}}
|
|
56
|
-
className={classNames("datatable-search-input", Classes.ROUND)}
|
|
57
|
-
placeholder="Search..."
|
|
58
|
-
{...onEnterHelper(e => {
|
|
59
|
-
e.preventDefault();
|
|
60
|
-
e.stopPropagation();
|
|
61
|
-
setSearchTerm(e.target.value);
|
|
62
|
-
e.nativeEvent.stopImmediatePropagation();
|
|
63
|
-
})}
|
|
64
|
-
rightElement={rightElement}
|
|
65
|
-
/>
|
|
66
|
-
);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export default SearchBar;
|
package/src/SortableColumns.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { MouseSensor, useSensor, useSensors, DndContext } from "@dnd-kit/core";
|
|
3
|
-
import {
|
|
4
|
-
SortableContext,
|
|
5
|
-
horizontalListSortingStrategy
|
|
6
|
-
} from "@dnd-kit/sortable";
|
|
7
|
-
import { restrictToHorizontalAxis } from "@dnd-kit/modifiers";
|
|
8
|
-
|
|
9
|
-
const CustomTheadComponent = ({
|
|
10
|
-
children: _children,
|
|
11
|
-
className,
|
|
12
|
-
onSortEnd,
|
|
13
|
-
onSortStart,
|
|
14
|
-
style
|
|
15
|
-
}) => {
|
|
16
|
-
// We need to do this because react table gives the children wrapped
|
|
17
|
-
// in another component
|
|
18
|
-
const children = _children.props.children;
|
|
19
|
-
const mouseSensor = useSensor(MouseSensor, {
|
|
20
|
-
activationConstraint: {
|
|
21
|
-
distance: 10
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const sensors = useSensors(mouseSensor);
|
|
26
|
-
const handleDragEnd = event => {
|
|
27
|
-
const { active, over } = event;
|
|
28
|
-
|
|
29
|
-
if (!over || !active) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (active.id === over.id) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
onSortEnd({
|
|
38
|
-
oldIndex: parseInt(active.id),
|
|
39
|
-
newIndex: parseInt(over.id)
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<DndContext
|
|
45
|
-
onDragStart={onSortStart}
|
|
46
|
-
onDragEnd={handleDragEnd}
|
|
47
|
-
modifiers={[restrictToHorizontalAxis]}
|
|
48
|
-
sensors={sensors}
|
|
49
|
-
>
|
|
50
|
-
<div className={"rt-thead " + className} style={style}>
|
|
51
|
-
<div className="rt-tr">
|
|
52
|
-
<SortableContext
|
|
53
|
-
items={children.map((_, index) => `${index}`)}
|
|
54
|
-
strategy={horizontalListSortingStrategy}
|
|
55
|
-
>
|
|
56
|
-
{children}
|
|
57
|
-
</SortableContext>
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
</DndContext>
|
|
61
|
-
);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const SortableColumns = ({ className, style, children, moveColumn }) => {
|
|
65
|
-
const shouldCancelStart = e => {
|
|
66
|
-
const className = e.target.className;
|
|
67
|
-
// if its an svg then it's a blueprint icon
|
|
68
|
-
return (
|
|
69
|
-
e.target instanceof SVGElement || className.indexOf("rt-resizer") > -1
|
|
70
|
-
);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const onSortEnd = (...args) => {
|
|
74
|
-
const { oldIndex, newIndex } = args[0];
|
|
75
|
-
document.body.classList.remove("drag-active");
|
|
76
|
-
moveColumn({
|
|
77
|
-
oldIndex,
|
|
78
|
-
newIndex
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const onSortStart = () => {
|
|
83
|
-
document.body.classList.add("drag-active");
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
return (
|
|
87
|
-
<CustomTheadComponent
|
|
88
|
-
className={className}
|
|
89
|
-
style={style}
|
|
90
|
-
onSortStart={onSortStart}
|
|
91
|
-
onSortEnd={onSortEnd}
|
|
92
|
-
helperClass="above-dialog"
|
|
93
|
-
shouldCancelStart={shouldCancelStart}
|
|
94
|
-
>
|
|
95
|
-
{children}
|
|
96
|
-
</CustomTheadComponent>
|
|
97
|
-
);
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export default SortableColumns;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
const TableFormTrackerContext = React.createContext({
|
|
4
|
-
formNames: [],
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
6
|
-
pushFormName: () => {},
|
|
7
|
-
isActive: false
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
export default TableFormTrackerContext;
|
package/src/ThComponent.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { useSortable } from "@dnd-kit/sortable";
|
|
3
|
-
import { CSS } from "@dnd-kit/utilities";
|
|
4
|
-
import classNames from "classnames";
|
|
5
|
-
|
|
6
|
-
export const ThComponent = ({
|
|
7
|
-
toggleSort,
|
|
8
|
-
immovable,
|
|
9
|
-
className,
|
|
10
|
-
children,
|
|
11
|
-
style,
|
|
12
|
-
columnindex,
|
|
13
|
-
...rest
|
|
14
|
-
}) => {
|
|
15
|
-
const index = columnindex ?? -1;
|
|
16
|
-
const { attributes, listeners, setNodeRef, transform, transition } =
|
|
17
|
-
useSortable({
|
|
18
|
-
id: `${index}`,
|
|
19
|
-
disabled: immovable === "true"
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const sortStyles = {
|
|
23
|
-
transform: CSS.Transform.toString(transform),
|
|
24
|
-
transition
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<div
|
|
29
|
-
style={{ ...sortStyles, ...style }}
|
|
30
|
-
ref={setNodeRef}
|
|
31
|
-
{...attributes}
|
|
32
|
-
{...listeners}
|
|
33
|
-
className={classNames("rt-th", className)}
|
|
34
|
-
onClick={e => toggleSort && toggleSort(e)}
|
|
35
|
-
role="columnheader"
|
|
36
|
-
tabIndex="-1" // Resolves eslint issues without implementing keyboard navigation incorrectly
|
|
37
|
-
columnindex={columnindex}
|
|
38
|
-
index={index}
|
|
39
|
-
{...rest}
|
|
40
|
-
>
|
|
41
|
-
{children}
|
|
42
|
-
</div>
|
|
43
|
-
);
|
|
44
|
-
};
|
package/src/TimelineEvent.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import dayjs from "dayjs";
|
|
3
|
-
import { Classes } from "@blueprintjs/core";
|
|
4
|
-
import classNames from "classnames";
|
|
5
|
-
import relativeTime from "dayjs/plugin/relativeTime";
|
|
6
|
-
|
|
7
|
-
dayjs.extend(relativeTime);
|
|
8
|
-
|
|
9
|
-
function TimelineEvent({ date, children }) {
|
|
10
|
-
return (
|
|
11
|
-
<div className="tg-timeline-event">
|
|
12
|
-
<div
|
|
13
|
-
style={{
|
|
14
|
-
display: "flex",
|
|
15
|
-
alignItems: "center"
|
|
16
|
-
}}
|
|
17
|
-
>
|
|
18
|
-
<div className="tg-timeline-circle" />
|
|
19
|
-
{children}
|
|
20
|
-
<div
|
|
21
|
-
style={{ marginLeft: 5 }}
|
|
22
|
-
className={classNames(Classes.TEXT_SMALL, Classes.TEXT_MUTED)}
|
|
23
|
-
>
|
|
24
|
-
({dayjs(date).fromNow()})
|
|
25
|
-
</div>
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export default TimelineEvent;
|