@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
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import React, { useContext, useEffect } from "react";
|
|
2
1
|
import { change, formValueSelector } from "redux-form";
|
|
3
2
|
import { connect } from "react-redux";
|
|
4
|
-
import {
|
|
3
|
+
import { isFunction, set } from "lodash-es";
|
|
5
4
|
import { withRouter } from "react-router-dom";
|
|
6
5
|
import { branch, compose } from "recompose";
|
|
7
6
|
|
|
8
7
|
import pureNoFunc from "../../utils/pureNoFunc";
|
|
9
|
-
import TableFormTrackerContext from "../TableFormTrackerContext";
|
|
10
8
|
import convertSchema from "./convertSchema";
|
|
11
9
|
import { getRecordsFromReduxForm } from "./withSelectedEntities";
|
|
12
10
|
import {
|
|
@@ -14,7 +12,8 @@ import {
|
|
|
14
12
|
getQueryParams,
|
|
15
13
|
setCurrentParamsOnUrl,
|
|
16
14
|
getMergedOpts,
|
|
17
|
-
getCurrentParamsFromUrl
|
|
15
|
+
getCurrentParamsFromUrl,
|
|
16
|
+
getCCDisplayName
|
|
18
17
|
} from "./queryParams";
|
|
19
18
|
import getTableConfigFromStorage from "./getTableConfigFromStorage";
|
|
20
19
|
|
|
@@ -42,54 +41,35 @@ export default function withTableParams(compOrOpts, pTopLevelOpts) {
|
|
|
42
41
|
topLevelOptions = pTopLevelOpts;
|
|
43
42
|
Component = compOrOpts;
|
|
44
43
|
}
|
|
45
|
-
const { isLocalCall } = topLevelOptions;
|
|
44
|
+
const { isLocalCall = false } = topLevelOptions;
|
|
46
45
|
const mapStateToProps = (state, ownProps) => {
|
|
47
46
|
const mergedOpts = getMergedOpts(topLevelOptions, ownProps);
|
|
48
47
|
const {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
formName,
|
|
53
|
-
formNameFromWithTPCall,
|
|
54
|
-
syncDisplayOptionsToDb,
|
|
48
|
+
additionalFilter = {},
|
|
49
|
+
additionalOrFilter = {},
|
|
50
|
+
cellRenderer,
|
|
55
51
|
defaults,
|
|
56
|
-
isInfinite,
|
|
57
|
-
isSimple,
|
|
58
|
-
withPaging,
|
|
59
52
|
doNotCoercePageSize,
|
|
53
|
+
formName,
|
|
54
|
+
history,
|
|
60
55
|
initialValues,
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
isCodeModel,
|
|
57
|
+
isInfinite,
|
|
58
|
+
isSimple,
|
|
59
|
+
model,
|
|
60
|
+
noForm,
|
|
63
61
|
noOrderError,
|
|
62
|
+
showEmptyColumnsByDefault,
|
|
63
|
+
syncDisplayOptionsToDb,
|
|
64
|
+
urlConnected,
|
|
64
65
|
withDisplayOptions,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
isCodeModel,
|
|
68
|
-
noForm
|
|
66
|
+
withPaging,
|
|
67
|
+
withSelectedEntities
|
|
69
68
|
} = mergedOpts;
|
|
70
69
|
|
|
71
70
|
const schema = getSchema(mergedOpts);
|
|
72
71
|
const convertedSchema = convertSchema(schema);
|
|
73
|
-
if (ownProps.isTableParamsConnected) {
|
|
74
|
-
if (
|
|
75
|
-
formName &&
|
|
76
|
-
formNameFromWithTPCall &&
|
|
77
|
-
formName !== formNameFromWithTPCall
|
|
78
|
-
) {
|
|
79
|
-
console.error(
|
|
80
|
-
`You passed a formName prop, ${formName} to a <DataTable/> component that is already withTableParams() connected, formNameFromWithTableParamsCall: ${formNameFromWithTPCall}`
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
if (ownProps.tableParams && !ownProps.tableParams.entities) {
|
|
84
|
-
console.error(
|
|
85
|
-
`No entities array detected in tableParams object (<DataTable {...tableParams}/>). You need to call withQuery() after withTableParams() like: compose(withTableParams(), withQuery(something)). formNameFromWithTableParamsCall: ${formNameFromWithTPCall}`
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
//short circuit because we've already run this logic
|
|
89
|
-
return {};
|
|
90
|
-
}
|
|
91
72
|
|
|
92
|
-
let formNameFromWithTableParamsCall;
|
|
93
73
|
if (isLocalCall) {
|
|
94
74
|
if (!noForm && (!formName || formName === "tgDataTable")) {
|
|
95
75
|
console.error(
|
|
@@ -101,12 +81,7 @@ export default function withTableParams(compOrOpts, pTopLevelOpts) {
|
|
|
101
81
|
mergedOpts.orderByFirstColumn &&
|
|
102
82
|
!mergedOpts.defaults?.order?.length
|
|
103
83
|
) {
|
|
104
|
-
const r = [
|
|
105
|
-
camelCase(
|
|
106
|
-
convertedSchema.fields[0].displayName ||
|
|
107
|
-
convertedSchema.fields[0].path
|
|
108
|
-
)
|
|
109
|
-
];
|
|
84
|
+
const r = [getCCDisplayName(convertedSchema.fields[0])];
|
|
110
85
|
set(mergedOpts, "defaults.order", r);
|
|
111
86
|
}
|
|
112
87
|
} else {
|
|
@@ -116,8 +91,6 @@ export default function withTableParams(compOrOpts, pTopLevelOpts) {
|
|
|
116
91
|
"Please pass a unique 'formName' prop to the withTableParams() with schema: ",
|
|
117
92
|
schema
|
|
118
93
|
);
|
|
119
|
-
} else {
|
|
120
|
-
formNameFromWithTableParamsCall = formName;
|
|
121
94
|
}
|
|
122
95
|
}
|
|
123
96
|
|
|
@@ -184,11 +157,6 @@ export default function withTableParams(compOrOpts, pTopLevelOpts) {
|
|
|
184
157
|
isCodeModel,
|
|
185
158
|
ownProps: mergedOpts
|
|
186
159
|
}),
|
|
187
|
-
formNameFromWithTPCall: formNameFromWithTableParamsCall,
|
|
188
|
-
randomVarToForceLocalStorageUpdate: formSelector(
|
|
189
|
-
state,
|
|
190
|
-
"localStorageForceUpdate"
|
|
191
|
-
),
|
|
192
160
|
currentParams,
|
|
193
161
|
selectedEntities,
|
|
194
162
|
...(withSelectedEntities &&
|
|
@@ -198,7 +166,8 @@ export default function withTableParams(compOrOpts, pTopLevelOpts) {
|
|
|
198
166
|
initialValues: {
|
|
199
167
|
...initialValues,
|
|
200
168
|
reduxFormSearchInput: currentParams.searchTerm
|
|
201
|
-
}
|
|
169
|
+
},
|
|
170
|
+
showEmptyColumnsByDefault
|
|
202
171
|
};
|
|
203
172
|
return mapStateProps;
|
|
204
173
|
// return { ...mergedOpts, ...mapStateProps };
|
|
@@ -213,22 +182,13 @@ export default function withTableParams(compOrOpts, pTopLevelOpts) {
|
|
|
213
182
|
mergedOpts;
|
|
214
183
|
|
|
215
184
|
function updateSearch(val) {
|
|
216
|
-
|
|
217
|
-
dispatch(change(formName, "reduxFormSearchInput", val || ""));
|
|
218
|
-
});
|
|
185
|
+
dispatch(change(formName, "reduxFormSearchInput", val || ""));
|
|
219
186
|
}
|
|
220
187
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
dispatch(change(formName, "reduxFormQueryParams", newParams)); //we always will update the redux params as a workaround for withRouter not always working if inside a redux-connected container https://github.com/ReactTraining/react-router/issues/5037
|
|
226
|
-
};
|
|
227
|
-
} else {
|
|
228
|
-
setNewParams = function (newParams) {
|
|
229
|
-
dispatch(change(formName, "reduxFormQueryParams", newParams));
|
|
230
|
-
};
|
|
231
|
-
}
|
|
188
|
+
const setNewParams = newParams => {
|
|
189
|
+
urlConnected && setCurrentParamsOnUrl(newParams, history.replace);
|
|
190
|
+
dispatch(change(formName, "reduxFormQueryParams", newParams)); //we always will update the redux params as a workaround for withRouter not always working if inside a redux-connected container https://github.com/ReactTraining/react-router/issues/5037
|
|
191
|
+
};
|
|
232
192
|
return {
|
|
233
193
|
bindThese: makeDataTableHandlers({
|
|
234
194
|
setNewParams,
|
|
@@ -280,20 +240,6 @@ export default function withTableParams(compOrOpts, pTopLevelOpts) {
|
|
|
280
240
|
return allMergedProps;
|
|
281
241
|
}
|
|
282
242
|
|
|
283
|
-
function addFormTracking(Component) {
|
|
284
|
-
return props => {
|
|
285
|
-
const formTracker = useContext(TableFormTrackerContext);
|
|
286
|
-
const { formName } = props;
|
|
287
|
-
useEffect(() => {
|
|
288
|
-
if (formTracker.isActive && !formTracker.formNames.includes(formName)) {
|
|
289
|
-
formTracker.pushFormName(formName);
|
|
290
|
-
}
|
|
291
|
-
}, [formTracker, formName]);
|
|
292
|
-
|
|
293
|
-
return <Component {...props} />;
|
|
294
|
-
};
|
|
295
|
-
}
|
|
296
|
-
|
|
297
243
|
const toReturn = compose(
|
|
298
244
|
connect((state, ownProps) => {
|
|
299
245
|
if (ownProps.isTableParamsConnected) {
|
|
@@ -305,13 +251,10 @@ export default function withTableParams(compOrOpts, pTopLevelOpts) {
|
|
|
305
251
|
formValueSelector(formName)(state, "reduxFormQueryParams") || {} //tnr: we need this to trigger withRouter and force it to update if it is nested in a redux-connected container.. very ugly but necessary
|
|
306
252
|
};
|
|
307
253
|
}),
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
return !props.noRouter;
|
|
311
|
-
}, withRouter),
|
|
254
|
+
//don't use withRouter if noRouter is passed!
|
|
255
|
+
branch(props => !props.noRouter, withRouter),
|
|
312
256
|
connect(mapStateToProps, mapDispatchToProps, mergeProps),
|
|
313
|
-
pureNoFunc
|
|
314
|
-
addFormTracking
|
|
257
|
+
pureNoFunc
|
|
315
258
|
);
|
|
316
259
|
if (Component) {
|
|
317
260
|
return toReturn(Component);
|
|
@@ -27,11 +27,11 @@ function DialogFooter({
|
|
|
27
27
|
containerClassname,
|
|
28
28
|
noCancel
|
|
29
29
|
}) {
|
|
30
|
-
const
|
|
30
|
+
const divRef = useRef();
|
|
31
31
|
return (
|
|
32
32
|
<div
|
|
33
33
|
style={style}
|
|
34
|
-
ref={
|
|
34
|
+
ref={divRef}
|
|
35
35
|
className={classNames(Classes.DIALOG_FOOTER, containerClassname)}
|
|
36
36
|
>
|
|
37
37
|
<div className={Classes.DIALOG_FOOTER_ACTIONS}>
|
|
@@ -57,7 +57,7 @@ function DialogFooter({
|
|
|
57
57
|
hideModal ||
|
|
58
58
|
function () {
|
|
59
59
|
try {
|
|
60
|
-
|
|
60
|
+
divRef.current
|
|
61
61
|
.closest(".bp3-dialog")
|
|
62
62
|
.querySelector(".bp3-dialog-close-button")
|
|
63
63
|
.click();
|
package/src/FillWindow.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { createPortal } from "react";
|
|
2
2
|
import { isFunction } from "lodash-es";
|
|
3
|
-
import reactDom from "react-dom";
|
|
4
3
|
import rerenderOnWindowResize from "./rerenderOnWindowResize";
|
|
5
4
|
import "./FillWindow.css";
|
|
6
5
|
|
|
@@ -63,7 +62,7 @@ export default class FillWindow extends React.Component {
|
|
|
63
62
|
: this.props.children}
|
|
64
63
|
</div>
|
|
65
64
|
);
|
|
66
|
-
if (asPortal) return
|
|
65
|
+
if (asPortal) return createPortal(inner, window.document.body);
|
|
67
66
|
return inner;
|
|
68
67
|
}
|
|
69
68
|
}
|