@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
|
@@ -14,13 +14,8 @@ const getSchema = data => ({
|
|
|
14
14
|
return { path, type: "string" };
|
|
15
15
|
}),
|
|
16
16
|
userData: data
|
|
17
|
-
// userData: data.map((d) => {
|
|
18
|
-
// if (!d.id) {
|
|
19
|
-
// d.id = nanoid();
|
|
20
|
-
// }
|
|
21
|
-
// return d
|
|
22
|
-
// })
|
|
23
17
|
});
|
|
18
|
+
|
|
24
19
|
export default async function tryToMatchSchemas({
|
|
25
20
|
incomingData,
|
|
26
21
|
validateAgainstSchema
|
package/src/MatchHeaders.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
2
|
import { Callout, Card, Intent } from "@blueprintjs/core";
|
|
3
3
|
import immer, { setAutoFreeze } from "immer";
|
|
4
4
|
import { flatMap, forEach } from "lodash-es";
|
|
@@ -7,30 +7,35 @@ import showConfirmationDialog from "./showConfirmationDialog";
|
|
|
7
7
|
import { startCase } from "lodash-es";
|
|
8
8
|
import { typeToCommonType } from "./typeToCommonType";
|
|
9
9
|
import { camelCase } from "lodash-es";
|
|
10
|
+
import { change } from "redux-form";
|
|
11
|
+
import { useDispatch } from "react-redux";
|
|
10
12
|
|
|
11
13
|
setAutoFreeze(false);
|
|
12
|
-
export
|
|
13
|
-
onMultiFileUploadSubmit,
|
|
14
|
-
doAllFilesHaveSameHeaders,
|
|
14
|
+
export const MatchHeaders = ({
|
|
15
15
|
csvValidationIssue,
|
|
16
|
+
datatableFormName,
|
|
17
|
+
datatableFormNames: _datatableFormNames,
|
|
18
|
+
doAllFilesHaveSameHeaders,
|
|
19
|
+
fileIndex,
|
|
20
|
+
filesWIssues,
|
|
16
21
|
ignoredHeadersMsg,
|
|
17
|
-
searchResults,
|
|
18
22
|
matchedHeaders,
|
|
19
|
-
|
|
23
|
+
onMultiFileUploadSubmit,
|
|
20
24
|
reduxFormEntitiesArray,
|
|
21
|
-
|
|
22
|
-
datatableFormName,
|
|
23
|
-
datatableFormNames: _datatableFormNames,
|
|
25
|
+
searchResults,
|
|
24
26
|
setFilesWIssues,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}) {
|
|
27
|
+
userSchema
|
|
28
|
+
}) => {
|
|
28
29
|
const datatableFormNames = _datatableFormNames || [datatableFormName];
|
|
29
|
-
const
|
|
30
|
+
const dispatch = useDispatch();
|
|
31
|
+
const flippedMatchedHeaders = useMemo(() => {
|
|
32
|
+
const _flippedMatchedHeaders = {};
|
|
33
|
+
forEach(matchedHeaders, (v, k) => {
|
|
34
|
+
if (v) _flippedMatchedHeaders[v] = k;
|
|
35
|
+
});
|
|
36
|
+
return _flippedMatchedHeaders;
|
|
37
|
+
}, [matchedHeaders]);
|
|
30
38
|
|
|
31
|
-
forEach(matchedHeaders, (v, k) => {
|
|
32
|
-
if (v) flippedMatchedHeaders[v] = k;
|
|
33
|
-
});
|
|
34
39
|
return (
|
|
35
40
|
<div style={{ maxWidth: 500 }}>
|
|
36
41
|
{!onMultiFileUploadSubmit && (
|
|
@@ -43,7 +48,7 @@ export function MatchHeaders({
|
|
|
43
48
|
{ignoredHeadersMsg}
|
|
44
49
|
</Callout>
|
|
45
50
|
)}
|
|
46
|
-
<br
|
|
51
|
+
<br />
|
|
47
52
|
<tr
|
|
48
53
|
style={{
|
|
49
54
|
display: "flex",
|
|
@@ -106,7 +111,7 @@ export function MatchHeaders({
|
|
|
106
111
|
return rb - ra;
|
|
107
112
|
});
|
|
108
113
|
return (
|
|
109
|
-
<Card style={{ padding: 2 }} key={i}>
|
|
114
|
+
<Card style={{ padding: 2 }} key={`field-${i}`}>
|
|
110
115
|
<table>
|
|
111
116
|
<tbody>
|
|
112
117
|
<tr
|
|
@@ -146,7 +151,7 @@ export function MatchHeaders({
|
|
|
146
151
|
beforeOnChange={async () => {
|
|
147
152
|
const clearEntities = () => {
|
|
148
153
|
datatableFormNames.forEach(name => {
|
|
149
|
-
|
|
154
|
+
dispatch(change(name, "reduxFormEntities", null));
|
|
150
155
|
});
|
|
151
156
|
};
|
|
152
157
|
if (reduxFormEntitiesArray.some(r => r?.isDirty)) {
|
|
@@ -184,7 +189,7 @@ export function MatchHeaders({
|
|
|
184
189
|
// isRequired={!allowEmpty && defaultValue === undefined}
|
|
185
190
|
defaultValue={userMatchedHeader}
|
|
186
191
|
options={opts}
|
|
187
|
-
|
|
192
|
+
/>
|
|
188
193
|
</td>
|
|
189
194
|
<td
|
|
190
195
|
style={{
|
|
@@ -208,7 +213,7 @@ export function MatchHeaders({
|
|
|
208
213
|
textOverflow: "ellipsis",
|
|
209
214
|
whiteSpace: "nowrap"
|
|
210
215
|
}}
|
|
211
|
-
key={i}
|
|
216
|
+
key={`userMatchedHeader-${i}`}
|
|
212
217
|
>
|
|
213
218
|
{row?.[userMatchedHeader] || ""}
|
|
214
219
|
</div>
|
|
@@ -226,4 +231,4 @@ export function MatchHeaders({
|
|
|
226
231
|
})}
|
|
227
232
|
</div>
|
|
228
233
|
);
|
|
229
|
-
}
|
|
234
|
+
};
|
package/src/SimpleStepViz.js
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { Icon } from "@blueprintjs/core";
|
|
2
3
|
import classNames from "classnames";
|
|
3
|
-
import React from "react";
|
|
4
4
|
|
|
5
|
-
export default
|
|
6
|
-
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
{
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
</ul>
|
|
24
|
-
</div>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
5
|
+
export default ({ steps, ...rest }) => (
|
|
6
|
+
<div style={{ display: "flex", justifyContent: "center" }}>
|
|
7
|
+
<ul className="bp3-breadcrumbs" {...rest}>
|
|
8
|
+
{steps.map(({ completed, active, text }, i) => (
|
|
9
|
+
<li key={i}>
|
|
10
|
+
<div
|
|
11
|
+
className={classNames("bp3-breadcrumb", {
|
|
12
|
+
"bp3-breadcrumb-current": active
|
|
13
|
+
})}
|
|
14
|
+
>
|
|
15
|
+
<Icon icon={completed ? "tick-circle" : undefined} />
|
|
16
|
+
{text}
|
|
17
|
+
</div>
|
|
18
|
+
</li>
|
|
19
|
+
))}
|
|
20
|
+
</ul>
|
|
21
|
+
</div>
|
|
22
|
+
);
|
package/src/TgSuggest/index.js
CHANGED
|
@@ -1,121 +1,109 @@
|
|
|
1
1
|
import { Suggest } from "@blueprintjs/select";
|
|
2
2
|
import { Keys } from "@blueprintjs/core";
|
|
3
|
-
import React from "react";
|
|
3
|
+
import React, { useRef } from "react";
|
|
4
4
|
import classNames from "classnames";
|
|
5
5
|
import { itemListPredicate } from "../TgSelect";
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const itemRenderer = (i = "", { index, handleClick, modifiers }) => (
|
|
8
|
+
<div //we specifically don't use a BP MenuItem component here because the menu item is too slow when 100s are loaded and will cause the component to lag
|
|
9
|
+
onClick={handleClick}
|
|
10
|
+
key={index}
|
|
11
|
+
className={classNames(
|
|
12
|
+
"tg-select-option bp3-menu-item bp3-fill bp3-text-overflow-ellipsis",
|
|
13
|
+
{
|
|
14
|
+
"bp3-active": modifiers.active
|
|
15
|
+
}
|
|
16
|
+
)}
|
|
17
|
+
>
|
|
18
|
+
{i}
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const TgSuggest = props => {
|
|
23
|
+
const {
|
|
24
|
+
disabled,
|
|
25
|
+
inputProps,
|
|
26
|
+
intent,
|
|
27
|
+
isLoading,
|
|
28
|
+
isSimpleSearch,
|
|
29
|
+
multi,
|
|
30
|
+
noResultsText,
|
|
31
|
+
notCreateable,
|
|
32
|
+
onBlur,
|
|
9
33
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
10
|
-
onChange
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"tg-select-option bp3-menu-item bp3-fill bp3-text-overflow-ellipsis",
|
|
21
|
-
{
|
|
22
|
-
"bp3-active": modifiers.active
|
|
23
|
-
}
|
|
24
|
-
)}
|
|
25
|
-
>
|
|
26
|
-
{i}
|
|
27
|
-
</div>
|
|
28
|
-
);
|
|
29
|
-
};
|
|
34
|
+
onChange = () => {},
|
|
35
|
+
optionRenderer, //pull this one out here so it doesn't get passsed along
|
|
36
|
+
options = [],
|
|
37
|
+
placeholder,
|
|
38
|
+
popoverProps,
|
|
39
|
+
value = undefined,
|
|
40
|
+
...rest
|
|
41
|
+
} = props;
|
|
42
|
+
|
|
43
|
+
const inputRef = useRef(null);
|
|
30
44
|
|
|
31
|
-
handleItemSelect = item => {
|
|
32
|
-
|
|
33
|
-
this.input && this.input.blur();
|
|
45
|
+
const handleItemSelect = item => {
|
|
46
|
+
inputRef.current && inputRef.current.blur();
|
|
34
47
|
return onChange(item);
|
|
35
48
|
};
|
|
36
49
|
|
|
37
|
-
|
|
38
|
-
const { isSimpleSearch } = this.props;
|
|
50
|
+
const _itemListPredicate = (queryString, item) => {
|
|
39
51
|
return itemListPredicate(queryString, item, isSimpleSearch);
|
|
40
52
|
};
|
|
41
53
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
closeOnSelect
|
|
69
|
-
items={options || []}
|
|
70
|
-
query={value}
|
|
71
|
-
popoverProps={{
|
|
72
|
-
minimal: true,
|
|
73
|
-
className: classNames("tg-select", {
|
|
74
|
-
"tg-single-select": !multi
|
|
75
|
-
}),
|
|
76
|
-
wrapperTagName: "div",
|
|
77
|
-
usePortal: false,
|
|
78
|
-
canEscapeKeyClose: true,
|
|
79
|
-
...popoverProps
|
|
80
|
-
}}
|
|
81
|
-
onKeyDown={e => {
|
|
82
|
-
const { which } = e;
|
|
83
|
-
if (which === Keys.ENTER) {
|
|
84
|
-
e.preventDefault();
|
|
85
|
-
e.stopPropagation(); //this prevents the dialog it is in from closing
|
|
54
|
+
return (
|
|
55
|
+
<Suggest
|
|
56
|
+
closeOnSelect
|
|
57
|
+
items={options || []}
|
|
58
|
+
query={value}
|
|
59
|
+
popoverProps={{
|
|
60
|
+
minimal: true,
|
|
61
|
+
className: classNames("tg-select", {
|
|
62
|
+
"tg-single-select": !multi
|
|
63
|
+
}),
|
|
64
|
+
wrapperTagName: "div",
|
|
65
|
+
usePortal: false,
|
|
66
|
+
canEscapeKeyClose: true,
|
|
67
|
+
...popoverProps
|
|
68
|
+
}}
|
|
69
|
+
onKeyDown={e => {
|
|
70
|
+
const { which } = e;
|
|
71
|
+
if (which === Keys.ENTER) {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
e.stopPropagation(); //this prevents the dialog it is in from closing
|
|
74
|
+
}
|
|
75
|
+
if (which === Keys.ESCAPE || which === Keys.TAB) {
|
|
76
|
+
// By default the escape key will not trigger a blur on the
|
|
77
|
+
// input element. It must be done explicitly.
|
|
78
|
+
if (inputRef.current != null) {
|
|
79
|
+
inputRef.current.blur();
|
|
86
80
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
...rest
|
|
116
|
-
}}
|
|
117
|
-
/>
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
81
|
+
e.preventDefault();
|
|
82
|
+
e.stopPropagation(); //this prevents dialog's it is in from closing
|
|
83
|
+
}
|
|
84
|
+
}}
|
|
85
|
+
onItemSelect={handleItemSelect}
|
|
86
|
+
noResults={null}
|
|
87
|
+
resetOnSelect={false}
|
|
88
|
+
onQueryChange={onChange}
|
|
89
|
+
itemRenderer={itemRenderer}
|
|
90
|
+
itemListPredicate={_itemListPredicate}
|
|
91
|
+
selectedItem={value}
|
|
92
|
+
inputValueRenderer={item => item}
|
|
93
|
+
inputProps={{
|
|
94
|
+
inputRef: n => {
|
|
95
|
+
if (n) inputRef.current = n;
|
|
96
|
+
},
|
|
97
|
+
placeholder: placeholder || "Type here...",
|
|
98
|
+
disabled: disabled, // tg: adding isLoading will cause the input to be blurred when using generic select asReactSelect (don't do it),
|
|
99
|
+
intent: intent,
|
|
100
|
+
...inputProps
|
|
101
|
+
}}
|
|
102
|
+
isSimpleSearch={isSimpleSearch}
|
|
103
|
+
onChange={onChange}
|
|
104
|
+
{...rest}
|
|
105
|
+
/>
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
|
|
121
109
|
export default TgSuggest;
|