@teselagen/ui 0.5.21 → 0.5.23-beta.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.
- package/DataTable/Columns.d.ts +1 -0
- package/DataTable/DisplayOptions.d.ts +14 -14
- package/DataTable/EditabelCell.d.ts +3 -5
- package/DataTable/FilterAndSortMenu.d.ts +9 -9
- package/DataTable/PagingTool.d.ts +25 -2
- package/DataTable/SearchBar.d.ts +2 -2
- package/DataTable/SortableColumns.d.ts +6 -9
- package/DataTable/ThComponent.d.ts +9 -0
- package/DataTable/index.d.ts +0 -5
- package/DataTable/utils/getIdOrCodeOrIndex.d.ts +1 -2
- package/DataTable/utils/handleCopyTable.d.ts +1 -0
- package/DataTable/utils/index.d.ts +4 -2
- package/DataTable/utils/primarySelectedValue.d.ts +1 -0
- package/DataTable/utils/queryParams.d.ts +6 -0
- package/DataTable/utils/removeCleanRows.d.ts +1 -1
- package/DataTable/utils/rowClick.d.ts +24 -3
- package/DataTable/utils/useDeepEqualMemo.d.ts +1 -0
- package/DataTable/utils/useTableParams.d.ts +49 -0
- package/FormComponents/Uploader.d.ts +34 -1
- package/FormComponents/index.d.ts +111 -45
- package/MatchHeaders.d.ts +9 -10
- package/SimpleStepViz.d.ts +2 -1
- package/TgSuggest/index.d.ts +1 -21
- package/UploadCsvWizard.d.ts +1 -1
- package/index.cjs.js +41038 -45265
- package/index.d.ts +3 -2
- package/index.es.js +44524 -48751
- package/package.json +2 -8
- package/src/DataTable/CellDragHandle.js +70 -69
- package/src/DataTable/ColumnFilterMenu.js +18 -18
- package/src/DataTable/Columns.js +1066 -0
- package/src/DataTable/DisplayOptions.js +173 -192
- package/src/DataTable/EditabelCell.js +6 -16
- package/src/DataTable/FilterAndSortMenu.js +213 -234
- package/src/DataTable/PagingTool.js +47 -56
- package/src/DataTable/SearchBar.js +3 -3
- package/src/DataTable/SortableColumns.js +44 -39
- package/src/DataTable/ThComponent.js +44 -0
- package/src/DataTable/dataTableEnhancer.js +35 -294
- package/src/DataTable/index.js +2933 -3601
- package/src/DataTable/utils/getIdOrCodeOrIndex.js +1 -1
- package/src/DataTable/utils/handleCopyTable.js +16 -0
- package/src/DataTable/utils/index.js +7 -3
- package/src/DataTable/utils/primarySelectedValue.js +1 -0
- package/src/DataTable/utils/queryParams.js +42 -13
- package/src/DataTable/utils/removeCleanRows.js +3 -3
- package/src/DataTable/utils/rowClick.js +34 -9
- package/src/DataTable/utils/selection.js +1 -1
- package/src/DataTable/utils/useDeepEqualMemo.js +10 -0
- package/src/DataTable/utils/useTableParams.js +361 -0
- package/src/DataTable/utils/withTableParams.js +30 -87
- package/src/DataTable/validateTableWideErrors.js +1 -1
- package/src/DialogFooter/index.js +3 -3
- package/src/FillWindow.js +2 -3
- package/src/FormComponents/Uploader.js +825 -784
- package/src/FormComponents/index.js +441 -603
- package/src/FormComponents/tryToMatchSchemas.js +1 -6
- package/src/MatchHeaders.js +27 -22
- package/src/SimpleStepViz.js +19 -23
- package/src/TgSuggest/index.js +94 -106
- package/src/UploadCsvWizard.js +570 -577
- package/src/index.js +4 -3
- package/src/showDialogOnDocBody.js +5 -9
- package/src/useDialog.js +25 -26
- package/src/utils/commandControls.js +2 -2
- package/src/utils/handlerHelpers.js +19 -25
- package/src/utils/popoverOverflowModifiers.js +1 -1
- package/src/utils/renderOnDoc.js +8 -5
- package/src/utils/tagUtils.js +3 -3
- package/src/utils/useTraceUpdate.js +19 -0
- package/src/wrapDialog.js +0 -2
- package/style.css +251 -251
- package/useDialog.d.ts +2 -6
- package/utils/renderOnDoc.d.ts +1 -1
- package/utils/tagUtils.d.ts +5 -1
- package/utils/useTraceUpdate.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teselagen/ui",
|
|
3
|
-
"version": "0.5.
|
|
4
|
-
"main": "./index.js",
|
|
3
|
+
"version": "0.5.23-beta.1",
|
|
4
|
+
"main": "./src/index.js",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"import": "./index.es.js",
|
|
@@ -12,10 +12,6 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@teselagen/file-utils": "0.3.16",
|
|
14
14
|
"@teselagen/bounce-loader": "0.3.11",
|
|
15
|
-
"@blueprintjs/core": "3.52.0",
|
|
16
|
-
"@blueprintjs/datetime": "3.23.19",
|
|
17
|
-
"@blueprintjs/icons": "3.33.0",
|
|
18
|
-
"@blueprintjs/select": "3.18.11",
|
|
19
15
|
"@dnd-kit/core": "^6.1.0",
|
|
20
16
|
"@dnd-kit/modifiers": "^7.0.0",
|
|
21
17
|
"@dnd-kit/sortable": "^8.0.0",
|
|
@@ -36,8 +32,6 @@
|
|
|
36
32
|
"jszip": "^3.10.1",
|
|
37
33
|
"lodash-es": "^4.17.21",
|
|
38
34
|
"math-expression-evaluator": "^1.3.7",
|
|
39
|
-
"mobx": "^6.10.2",
|
|
40
|
-
"mobx-react": "^9.0.1",
|
|
41
35
|
"mock-fs": "5.2.0",
|
|
42
36
|
"nanoid": "^4.0.0",
|
|
43
37
|
"papaparse": "^5.3.2",
|
|
@@ -1,89 +1,90 @@
|
|
|
1
1
|
import { flatMap } from "lodash-es";
|
|
2
2
|
import { forEach } from "lodash-es";
|
|
3
|
-
import React, { useRef } from "react";
|
|
4
|
-
import ReactDOM from "react-dom";
|
|
3
|
+
import React, { useCallback, useRef } from "react";
|
|
5
4
|
|
|
6
|
-
export
|
|
5
|
+
export const CellDragHandle = ({
|
|
7
6
|
thisTable,
|
|
8
7
|
onDragEnd,
|
|
9
8
|
cellId,
|
|
10
9
|
isSelectionARectangle
|
|
11
|
-
}) {
|
|
10
|
+
}) => {
|
|
12
11
|
const xStart = useRef(0);
|
|
13
12
|
const timeoutkey = useRef();
|
|
14
13
|
const rowsToSelect = useRef();
|
|
15
14
|
const rectangleCellPaths = useRef();
|
|
16
15
|
|
|
17
|
-
const handleDrag =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
updateScrollIfNecessary();
|
|
41
|
-
timeoutkey.current = setInterval(() => {
|
|
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
|
+
};
|
|
42
39
|
updateScrollIfNecessary();
|
|
43
|
-
|
|
40
|
+
timeoutkey.current = setInterval(() => {
|
|
41
|
+
updateScrollIfNecessary();
|
|
42
|
+
}, 10);
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
|
61
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) {
|
|
62
71
|
if (rectangleCellPaths.current) {
|
|
63
72
|
rectangleCellPaths.current.forEach(path => {
|
|
64
|
-
changeDashedBorder(path,
|
|
73
|
+
changeDashedBorder(path, false);
|
|
65
74
|
});
|
|
66
75
|
} else {
|
|
67
|
-
changeDashedBorder(path, true);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (!isSelectedForUpdate) {
|
|
72
|
-
if (rectangleCellPaths.current) {
|
|
73
|
-
rectangleCellPaths.current.forEach(path => {
|
|
74
76
|
changeDashedBorder(path, false);
|
|
75
|
-
}
|
|
76
|
-
} else {
|
|
77
|
-
changeDashedBorder(path, false);
|
|
77
|
+
}
|
|
78
78
|
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
[cellId, thisTable]
|
|
83
|
+
);
|
|
83
84
|
|
|
84
|
-
const
|
|
85
|
+
const onMouseUp = useCallback(() => {
|
|
85
86
|
clearTimeout(timeoutkey.current);
|
|
86
|
-
const table =
|
|
87
|
+
const table = thisTable;
|
|
87
88
|
const trs = table.querySelectorAll(`.rt-tr-group.with-row-data`);
|
|
88
89
|
const [, path] = cellId.split(":");
|
|
89
90
|
//remove the dashed borders
|
|
@@ -98,8 +99,8 @@ export function CellDragHandle({
|
|
|
98
99
|
el.parentNode.classList.remove("selectedForUpdate");
|
|
99
100
|
}
|
|
100
101
|
});
|
|
101
|
-
document.removeEventListener("mousemove", handleDrag
|
|
102
|
-
document.removeEventListener("mouseup",
|
|
102
|
+
document.removeEventListener("mousemove", handleDrag, false);
|
|
103
|
+
document.removeEventListener("mouseup", onMouseUp, false);
|
|
103
104
|
onDragEnd(
|
|
104
105
|
flatMap(rowsToSelect.current, id => {
|
|
105
106
|
if (rectangleCellPaths.current) {
|
|
@@ -111,7 +112,7 @@ export function CellDragHandle({
|
|
|
111
112
|
}
|
|
112
113
|
})
|
|
113
114
|
);
|
|
114
|
-
});
|
|
115
|
+
}, [cellId, handleDrag, onDragEnd, thisTable]);
|
|
115
116
|
|
|
116
117
|
return (
|
|
117
118
|
<div
|
|
@@ -122,10 +123,10 @@ export function CellDragHandle({
|
|
|
122
123
|
if (isRect) {
|
|
123
124
|
rectangleCellPaths.current = selectedPaths;
|
|
124
125
|
}
|
|
125
|
-
document.addEventListener("mousemove", handleDrag
|
|
126
|
-
document.addEventListener("mouseup",
|
|
126
|
+
document.addEventListener("mousemove", handleDrag, false);
|
|
127
|
+
document.addEventListener("mouseup", onMouseUp, false);
|
|
127
128
|
}}
|
|
128
129
|
className="cellDragHandle"
|
|
129
|
-
|
|
130
|
+
/>
|
|
130
131
|
);
|
|
131
|
-
}
|
|
132
|
+
};
|
|
@@ -29,32 +29,32 @@ export const ColumnFilterMenu = ({
|
|
|
29
29
|
hide: { enabled: false },
|
|
30
30
|
flip: { enabled: false }
|
|
31
31
|
}}
|
|
32
|
+
content={
|
|
33
|
+
<FilterMenu
|
|
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={() => {
|
|
44
|
+
setColumnFilterMenuOpen(false);
|
|
45
|
+
}}
|
|
46
|
+
/>
|
|
47
|
+
}
|
|
32
48
|
>
|
|
33
49
|
<Icon
|
|
34
50
|
style={{ marginLeft: 5 }}
|
|
35
51
|
icon="filter"
|
|
36
|
-
|
|
37
|
-
onClick={() =>
|
|
38
|
-
setColumnFilterMenuOpen(!columnFilterMenuOpen);
|
|
39
|
-
}}
|
|
52
|
+
size={extraCompact ? 14 : undefined}
|
|
53
|
+
onClick={() => setColumnFilterMenuOpen(prev => !prev)}
|
|
40
54
|
className={classNames("tg-filter-menu-button", {
|
|
41
55
|
"tg-active-filter": !!filterActiveForColumn
|
|
42
56
|
})}
|
|
43
57
|
/>
|
|
44
|
-
<FilterMenu
|
|
45
|
-
addFilters={addFilters}
|
|
46
|
-
compact={compact}
|
|
47
|
-
currentFilter={currentFilter}
|
|
48
|
-
currentParams={currentParams}
|
|
49
|
-
dataType={dataType}
|
|
50
|
-
filterOn={filterOn}
|
|
51
|
-
removeSingleFilter={removeSingleFilter}
|
|
52
|
-
schemaForField={schemaForField}
|
|
53
|
-
setNewParams={setNewParams}
|
|
54
|
-
togglePopover={() => {
|
|
55
|
-
setColumnFilterMenuOpen(false);
|
|
56
|
-
}}
|
|
57
|
-
/>
|
|
58
58
|
</Popover>
|
|
59
59
|
);
|
|
60
60
|
};
|