@teselagen/ui 0.5.21-beta.4 → 0.5.21-beta.6
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/index.cjs.js +96 -77
- package/index.es.js +97 -78
- package/package.json +1 -1
- package/src/DataTable/ColumnFilterMenu.js +1 -1
- package/src/DataTable/FilterAndSortMenu.js +16 -13
- package/src/DataTable/index.js +74 -48
- package/src/DataTable/utils/withTableParams.js +5 -14
- package/src/FormComponents/Uploader.js +8 -5
package/index.cjs.js
CHANGED
|
@@ -46742,12 +46742,14 @@ const FilterAndSortMenu = /* @__PURE__ */ __name(({
|
|
|
46742
46742
|
);
|
|
46743
46743
|
const [filterValue, setFilterValue] = React$1.useState("");
|
|
46744
46744
|
const handleFilterChange = /* @__PURE__ */ __name((selectedFilter2) => {
|
|
46745
|
-
|
|
46746
|
-
|
|
46747
|
-
|
|
46748
|
-
|
|
46749
|
-
|
|
46750
|
-
|
|
46745
|
+
require$$2$1.flushSync(() => {
|
|
46746
|
+
if (filterValue && !Array.isArray(filterValue) && filterTypesDictionary[selectedFilter2] === "list") {
|
|
46747
|
+
setFilterValue((filterValue == null ? void 0 : filterValue.split(" ")) || []);
|
|
46748
|
+
} else if (filterTypesDictionary[selectedFilter2] === "text" && Array.isArray(filterValue)) {
|
|
46749
|
+
setFilterValue(filterValue.join(" "));
|
|
46750
|
+
}
|
|
46751
|
+
setSelectedFilter(camelCase(selectedFilter2));
|
|
46752
|
+
});
|
|
46751
46753
|
}, "handleFilterChange");
|
|
46752
46754
|
const handleFilterValueChange = /* @__PURE__ */ __name((filterValue2) => setFilterValue(filterValue2), "handleFilterValueChange");
|
|
46753
46755
|
const handleFilterSubmit = /* @__PURE__ */ __name(() => {
|
|
@@ -47057,7 +47059,7 @@ const ColumnFilterMenu = /* @__PURE__ */ __name(({
|
|
|
47057
47059
|
{
|
|
47058
47060
|
style: { marginLeft: 5 },
|
|
47059
47061
|
icon: "filter",
|
|
47060
|
-
|
|
47062
|
+
size: extraCompact ? 14 : void 0,
|
|
47061
47063
|
onClick: () => setColumnFilterMenuOpen((prev) => !prev),
|
|
47062
47064
|
className: classNames("tg-filter-menu-button", {
|
|
47063
47065
|
"tg-active-filter": !!filterActiveForColumn
|
|
@@ -48395,57 +48397,81 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48395
48397
|
reduxFormSearchInput,
|
|
48396
48398
|
urlConnected
|
|
48397
48399
|
]);
|
|
48398
|
-
|
|
48399
|
-
|
|
48400
|
-
|
|
48401
|
-
|
|
48402
|
-
|
|
48403
|
-
|
|
48404
|
-
|
|
48405
|
-
|
|
48406
|
-
|
|
48407
|
-
|
|
48408
|
-
|
|
48409
|
-
|
|
48410
|
-
|
|
48411
|
-
|
|
48412
|
-
|
|
48413
|
-
|
|
48414
|
-
|
|
48415
|
-
|
|
48416
|
-
|
|
48417
|
-
|
|
48418
|
-
|
|
48419
|
-
|
|
48420
|
-
|
|
48421
|
-
|
|
48422
|
-
|
|
48423
|
-
|
|
48424
|
-
|
|
48425
|
-
|
|
48426
|
-
|
|
48427
|
-
|
|
48428
|
-
|
|
48429
|
-
|
|
48430
|
-
|
|
48431
|
-
|
|
48432
|
-
|
|
48433
|
-
|
|
48434
|
-
|
|
48435
|
-
|
|
48436
|
-
|
|
48437
|
-
|
|
48438
|
-
|
|
48439
|
-
|
|
48440
|
-
|
|
48441
|
-
|
|
48442
|
-
|
|
48443
|
-
|
|
48444
|
-
|
|
48445
|
-
|
|
48446
|
-
|
|
48447
|
-
|
|
48448
|
-
|
|
48400
|
+
const tableParams = React$1.useMemo(() => {
|
|
48401
|
+
if (!isTableParamsConnected) {
|
|
48402
|
+
const updateSearch = /* @__PURE__ */ __name((val) => {
|
|
48403
|
+
change("reduxFormSearchInput", val || "");
|
|
48404
|
+
}, "updateSearch");
|
|
48405
|
+
const setNewParams2 = /* @__PURE__ */ __name((newParams) => {
|
|
48406
|
+
urlConnected && setCurrentParamsOnUrl(newParams, history.replace);
|
|
48407
|
+
change("reduxFormQueryParams", newParams);
|
|
48408
|
+
}, "setNewParams2");
|
|
48409
|
+
const bindThese = makeDataTableHandlers({
|
|
48410
|
+
setNewParams: setNewParams2,
|
|
48411
|
+
updateSearch,
|
|
48412
|
+
defaults: props.defaults,
|
|
48413
|
+
onlyOneFilter: props.onlyOneFilter
|
|
48414
|
+
});
|
|
48415
|
+
const boundDispatchProps = {};
|
|
48416
|
+
Object.keys(bindThese).forEach(function(key) {
|
|
48417
|
+
const action = bindThese[key];
|
|
48418
|
+
boundDispatchProps[key] = function(...args) {
|
|
48419
|
+
action(...args, currentParams);
|
|
48420
|
+
};
|
|
48421
|
+
});
|
|
48422
|
+
const changeFormValue = /* @__PURE__ */ __name((...args) => change(...args), "changeFormValue");
|
|
48423
|
+
return __spreadProps(__spreadValues(__spreadValues(__spreadValues({
|
|
48424
|
+
changeFormValue,
|
|
48425
|
+
selectedEntities
|
|
48426
|
+
}, _tableParams), props), boundDispatchProps), {
|
|
48427
|
+
isTableParamsConnected: true
|
|
48428
|
+
//let the table know not to do local sorting/filtering etc.
|
|
48429
|
+
});
|
|
48430
|
+
}
|
|
48431
|
+
return _tableParams;
|
|
48432
|
+
}, [
|
|
48433
|
+
_tableParams,
|
|
48434
|
+
change,
|
|
48435
|
+
currentParams,
|
|
48436
|
+
history.replace,
|
|
48437
|
+
isTableParamsConnected,
|
|
48438
|
+
props,
|
|
48439
|
+
selectedEntities,
|
|
48440
|
+
urlConnected
|
|
48441
|
+
]);
|
|
48442
|
+
props = __spreadValues(__spreadValues({}, props), tableParams);
|
|
48443
|
+
const queryParams = React$1.useMemo(() => {
|
|
48444
|
+
if (!isTableParamsConnected) {
|
|
48445
|
+
const additionalFilterToUse = typeof props.additionalFilter === "function" ? props.additionalFilter.bind(void 0, ownProps) : () => props.additionalFilter;
|
|
48446
|
+
const additionalOrFilterToUse = typeof props.additionalOrFilter === "function" ? props.additionalOrFilter.bind(void 0, ownProps) : () => props.additionalOrFilter;
|
|
48447
|
+
return getQueryParams({
|
|
48448
|
+
doNotCoercePageSize,
|
|
48449
|
+
currentParams,
|
|
48450
|
+
entities: props.entities,
|
|
48451
|
+
// for local table
|
|
48452
|
+
urlConnected,
|
|
48453
|
+
defaults: props.defaults,
|
|
48454
|
+
schema: convertedSchema,
|
|
48455
|
+
isInfinite,
|
|
48456
|
+
isLocalCall,
|
|
48457
|
+
additionalFilter: additionalFilterToUse,
|
|
48458
|
+
additionalOrFilter: additionalOrFilterToUse,
|
|
48459
|
+
noOrderError: props.noOrderError,
|
|
48460
|
+
isCodeModel: props.isCodeModel,
|
|
48461
|
+
ownProps: props
|
|
48462
|
+
});
|
|
48463
|
+
}
|
|
48464
|
+
return {};
|
|
48465
|
+
}, [
|
|
48466
|
+
convertedSchema,
|
|
48467
|
+
currentParams,
|
|
48468
|
+
doNotCoercePageSize,
|
|
48469
|
+
isInfinite,
|
|
48470
|
+
isLocalCall,
|
|
48471
|
+
isTableParamsConnected,
|
|
48472
|
+
urlConnected
|
|
48473
|
+
]);
|
|
48474
|
+
props = __spreadValues(__spreadValues({}, props), queryParams);
|
|
48449
48475
|
const {
|
|
48450
48476
|
addFilters = noop$3,
|
|
48451
48477
|
additionalFilters,
|
|
@@ -63264,11 +63290,13 @@ const Uploader = /* @__PURE__ */ __name(({
|
|
|
63264
63290
|
const [loading, setLoading] = React$1.useState(false);
|
|
63265
63291
|
const filesToClean = React$1.useRef([]);
|
|
63266
63292
|
const onChange = /* @__PURE__ */ __name((val) => {
|
|
63267
|
-
|
|
63268
|
-
|
|
63269
|
-
|
|
63270
|
-
|
|
63271
|
-
|
|
63293
|
+
require$$2$1.flushSync(() => {
|
|
63294
|
+
if (noRedux) {
|
|
63295
|
+
return _onChange(val);
|
|
63296
|
+
}
|
|
63297
|
+
dispatch(reduxForm.touch(formName, name));
|
|
63298
|
+
dispatch(reduxForm.change(formName, name, val));
|
|
63299
|
+
});
|
|
63272
63300
|
}, "onChange");
|
|
63273
63301
|
const handleSecondHalfOfUpload = /* @__PURE__ */ __name((_0) => __async(exports, [_0], function* ({
|
|
63274
63302
|
acceptedFiles,
|
|
@@ -64431,22 +64459,13 @@ function withTableParams(compOrOpts, pTopLevelOpts) {
|
|
|
64431
64459
|
const mergedOpts = getMergedOpts(topLevelOptions, ownProps);
|
|
64432
64460
|
const { formName, urlConnected, history, defaults: defaults2, onlyOneFilter } = mergedOpts;
|
|
64433
64461
|
function updateSearch(val) {
|
|
64434
|
-
|
|
64435
|
-
dispatch(reduxForm.change(formName, "reduxFormSearchInput", val || ""));
|
|
64436
|
-
});
|
|
64462
|
+
dispatch(reduxForm.change(formName, "reduxFormSearchInput", val || ""));
|
|
64437
64463
|
}
|
|
64438
64464
|
__name(updateSearch, "updateSearch");
|
|
64439
|
-
|
|
64440
|
-
|
|
64441
|
-
|
|
64442
|
-
|
|
64443
|
-
dispatch(reduxForm.change(formName, "reduxFormQueryParams", newParams));
|
|
64444
|
-
}, "setNewParams");
|
|
64445
|
-
} else {
|
|
64446
|
-
setNewParams = /* @__PURE__ */ __name(function(newParams) {
|
|
64447
|
-
dispatch(reduxForm.change(formName, "reduxFormQueryParams", newParams));
|
|
64448
|
-
}, "setNewParams");
|
|
64449
|
-
}
|
|
64465
|
+
const setNewParams = /* @__PURE__ */ __name((newParams) => {
|
|
64466
|
+
urlConnected && setCurrentParamsOnUrl(newParams, history.replace);
|
|
64467
|
+
dispatch(reduxForm.change(formName, "reduxFormQueryParams", newParams));
|
|
64468
|
+
}, "setNewParams");
|
|
64450
64469
|
return {
|
|
64451
64470
|
bindThese: makeDataTableHandlers({
|
|
64452
64471
|
setNewParams,
|
package/index.es.js
CHANGED
|
@@ -60,7 +60,7 @@ import * as React$1 from "react";
|
|
|
60
60
|
import React__default, { useState, useEffect, forwardRef, useImperativeHandle, Fragment, useMemo, useRef, useReducer, useCallback, createElement, Component, useLayoutEffect, createContext, memo, useContext, isValidElement, PureComponent, createPortal as createPortal$1 } from "react";
|
|
61
61
|
import { Icon, Classes, Button, Intent, Keys, MenuItem, Tag, Popover, Tooltip, Spinner, InputGroup, Checkbox, Switch, TextArea, EditableText, NumericInput, RadioGroup, Position, FormGroup, Menu, Toaster, MenuDivider, useHotkeys, ContextMenu, Callout, Dialog, Card, Tabs, Tab, Colors, Overlay, KeyCombo, ProgressBar } from "@blueprintjs/core";
|
|
62
62
|
import { formValueSelector, Field, change, reduxForm, SubmissionError, destroy, initialize, touch, FormName, Fields } from "redux-form";
|
|
63
|
-
import require$$2$1, { unstable_batchedUpdates, createPortal } from "react-dom";
|
|
63
|
+
import require$$2$1, { unstable_batchedUpdates, createPortal, flushSync } from "react-dom";
|
|
64
64
|
import { connect, useDispatch, useSelector, useStore } from "react-redux";
|
|
65
65
|
import { DateInput, DateRangeInput } from "@blueprintjs/datetime";
|
|
66
66
|
import { getCreateNewItem, MultiSelect, Suggest } from "@blueprintjs/select";
|
|
@@ -46724,12 +46724,14 @@ const FilterAndSortMenu = /* @__PURE__ */ __name(({
|
|
|
46724
46724
|
);
|
|
46725
46725
|
const [filterValue, setFilterValue] = useState("");
|
|
46726
46726
|
const handleFilterChange = /* @__PURE__ */ __name((selectedFilter2) => {
|
|
46727
|
-
|
|
46728
|
-
|
|
46729
|
-
|
|
46730
|
-
|
|
46731
|
-
|
|
46732
|
-
|
|
46727
|
+
flushSync(() => {
|
|
46728
|
+
if (filterValue && !Array.isArray(filterValue) && filterTypesDictionary[selectedFilter2] === "list") {
|
|
46729
|
+
setFilterValue((filterValue == null ? void 0 : filterValue.split(" ")) || []);
|
|
46730
|
+
} else if (filterTypesDictionary[selectedFilter2] === "text" && Array.isArray(filterValue)) {
|
|
46731
|
+
setFilterValue(filterValue.join(" "));
|
|
46732
|
+
}
|
|
46733
|
+
setSelectedFilter(camelCase(selectedFilter2));
|
|
46734
|
+
});
|
|
46733
46735
|
}, "handleFilterChange");
|
|
46734
46736
|
const handleFilterValueChange = /* @__PURE__ */ __name((filterValue2) => setFilterValue(filterValue2), "handleFilterValueChange");
|
|
46735
46737
|
const handleFilterSubmit = /* @__PURE__ */ __name(() => {
|
|
@@ -47039,7 +47041,7 @@ const ColumnFilterMenu = /* @__PURE__ */ __name(({
|
|
|
47039
47041
|
{
|
|
47040
47042
|
style: { marginLeft: 5 },
|
|
47041
47043
|
icon: "filter",
|
|
47042
|
-
|
|
47044
|
+
size: extraCompact ? 14 : void 0,
|
|
47043
47045
|
onClick: () => setColumnFilterMenuOpen((prev) => !prev),
|
|
47044
47046
|
className: classNames("tg-filter-menu-button", {
|
|
47045
47047
|
"tg-active-filter": !!filterActiveForColumn
|
|
@@ -48377,57 +48379,81 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48377
48379
|
reduxFormSearchInput,
|
|
48378
48380
|
urlConnected
|
|
48379
48381
|
]);
|
|
48380
|
-
|
|
48381
|
-
|
|
48382
|
-
|
|
48383
|
-
|
|
48384
|
-
|
|
48385
|
-
|
|
48386
|
-
|
|
48387
|
-
|
|
48388
|
-
|
|
48389
|
-
|
|
48390
|
-
|
|
48391
|
-
|
|
48392
|
-
|
|
48393
|
-
|
|
48394
|
-
|
|
48395
|
-
|
|
48396
|
-
|
|
48397
|
-
|
|
48398
|
-
|
|
48399
|
-
|
|
48400
|
-
|
|
48401
|
-
|
|
48402
|
-
|
|
48403
|
-
|
|
48404
|
-
|
|
48405
|
-
|
|
48406
|
-
|
|
48407
|
-
|
|
48408
|
-
|
|
48409
|
-
|
|
48410
|
-
|
|
48411
|
-
|
|
48412
|
-
|
|
48413
|
-
|
|
48414
|
-
|
|
48415
|
-
|
|
48416
|
-
|
|
48417
|
-
|
|
48418
|
-
|
|
48419
|
-
|
|
48420
|
-
|
|
48421
|
-
|
|
48422
|
-
|
|
48423
|
-
|
|
48424
|
-
|
|
48425
|
-
|
|
48426
|
-
|
|
48427
|
-
|
|
48428
|
-
|
|
48429
|
-
|
|
48430
|
-
|
|
48382
|
+
const tableParams = useMemo(() => {
|
|
48383
|
+
if (!isTableParamsConnected) {
|
|
48384
|
+
const updateSearch = /* @__PURE__ */ __name((val) => {
|
|
48385
|
+
change2("reduxFormSearchInput", val || "");
|
|
48386
|
+
}, "updateSearch");
|
|
48387
|
+
const setNewParams2 = /* @__PURE__ */ __name((newParams) => {
|
|
48388
|
+
urlConnected && setCurrentParamsOnUrl(newParams, history.replace);
|
|
48389
|
+
change2("reduxFormQueryParams", newParams);
|
|
48390
|
+
}, "setNewParams2");
|
|
48391
|
+
const bindThese = makeDataTableHandlers({
|
|
48392
|
+
setNewParams: setNewParams2,
|
|
48393
|
+
updateSearch,
|
|
48394
|
+
defaults: props.defaults,
|
|
48395
|
+
onlyOneFilter: props.onlyOneFilter
|
|
48396
|
+
});
|
|
48397
|
+
const boundDispatchProps = {};
|
|
48398
|
+
Object.keys(bindThese).forEach(function(key) {
|
|
48399
|
+
const action = bindThese[key];
|
|
48400
|
+
boundDispatchProps[key] = function(...args) {
|
|
48401
|
+
action(...args, currentParams);
|
|
48402
|
+
};
|
|
48403
|
+
});
|
|
48404
|
+
const changeFormValue = /* @__PURE__ */ __name((...args) => change2(...args), "changeFormValue");
|
|
48405
|
+
return __spreadProps(__spreadValues(__spreadValues(__spreadValues({
|
|
48406
|
+
changeFormValue,
|
|
48407
|
+
selectedEntities
|
|
48408
|
+
}, _tableParams), props), boundDispatchProps), {
|
|
48409
|
+
isTableParamsConnected: true
|
|
48410
|
+
//let the table know not to do local sorting/filtering etc.
|
|
48411
|
+
});
|
|
48412
|
+
}
|
|
48413
|
+
return _tableParams;
|
|
48414
|
+
}, [
|
|
48415
|
+
_tableParams,
|
|
48416
|
+
change2,
|
|
48417
|
+
currentParams,
|
|
48418
|
+
history.replace,
|
|
48419
|
+
isTableParamsConnected,
|
|
48420
|
+
props,
|
|
48421
|
+
selectedEntities,
|
|
48422
|
+
urlConnected
|
|
48423
|
+
]);
|
|
48424
|
+
props = __spreadValues(__spreadValues({}, props), tableParams);
|
|
48425
|
+
const queryParams = useMemo(() => {
|
|
48426
|
+
if (!isTableParamsConnected) {
|
|
48427
|
+
const additionalFilterToUse = typeof props.additionalFilter === "function" ? props.additionalFilter.bind(void 0, ownProps) : () => props.additionalFilter;
|
|
48428
|
+
const additionalOrFilterToUse = typeof props.additionalOrFilter === "function" ? props.additionalOrFilter.bind(void 0, ownProps) : () => props.additionalOrFilter;
|
|
48429
|
+
return getQueryParams({
|
|
48430
|
+
doNotCoercePageSize,
|
|
48431
|
+
currentParams,
|
|
48432
|
+
entities: props.entities,
|
|
48433
|
+
// for local table
|
|
48434
|
+
urlConnected,
|
|
48435
|
+
defaults: props.defaults,
|
|
48436
|
+
schema: convertedSchema,
|
|
48437
|
+
isInfinite,
|
|
48438
|
+
isLocalCall,
|
|
48439
|
+
additionalFilter: additionalFilterToUse,
|
|
48440
|
+
additionalOrFilter: additionalOrFilterToUse,
|
|
48441
|
+
noOrderError: props.noOrderError,
|
|
48442
|
+
isCodeModel: props.isCodeModel,
|
|
48443
|
+
ownProps: props
|
|
48444
|
+
});
|
|
48445
|
+
}
|
|
48446
|
+
return {};
|
|
48447
|
+
}, [
|
|
48448
|
+
convertedSchema,
|
|
48449
|
+
currentParams,
|
|
48450
|
+
doNotCoercePageSize,
|
|
48451
|
+
isInfinite,
|
|
48452
|
+
isLocalCall,
|
|
48453
|
+
isTableParamsConnected,
|
|
48454
|
+
urlConnected
|
|
48455
|
+
]);
|
|
48456
|
+
props = __spreadValues(__spreadValues({}, props), queryParams);
|
|
48431
48457
|
const {
|
|
48432
48458
|
addFilters = noop$3,
|
|
48433
48459
|
additionalFilters,
|
|
@@ -63246,11 +63272,13 @@ const Uploader = /* @__PURE__ */ __name(({
|
|
|
63246
63272
|
const [loading, setLoading] = useState(false);
|
|
63247
63273
|
const filesToClean = useRef([]);
|
|
63248
63274
|
const onChange = /* @__PURE__ */ __name((val) => {
|
|
63249
|
-
|
|
63250
|
-
|
|
63251
|
-
|
|
63252
|
-
|
|
63253
|
-
|
|
63275
|
+
flushSync(() => {
|
|
63276
|
+
if (noRedux) {
|
|
63277
|
+
return _onChange(val);
|
|
63278
|
+
}
|
|
63279
|
+
dispatch(touch(formName, name));
|
|
63280
|
+
dispatch(change(formName, name, val));
|
|
63281
|
+
});
|
|
63254
63282
|
}, "onChange");
|
|
63255
63283
|
const handleSecondHalfOfUpload = /* @__PURE__ */ __name((_0) => __async(void 0, [_0], function* ({
|
|
63256
63284
|
acceptedFiles,
|
|
@@ -64413,22 +64441,13 @@ function withTableParams(compOrOpts, pTopLevelOpts) {
|
|
|
64413
64441
|
const mergedOpts = getMergedOpts(topLevelOptions, ownProps);
|
|
64414
64442
|
const { formName, urlConnected, history, defaults: defaults2, onlyOneFilter } = mergedOpts;
|
|
64415
64443
|
function updateSearch(val) {
|
|
64416
|
-
|
|
64417
|
-
dispatch(change(formName, "reduxFormSearchInput", val || ""));
|
|
64418
|
-
});
|
|
64444
|
+
dispatch(change(formName, "reduxFormSearchInput", val || ""));
|
|
64419
64445
|
}
|
|
64420
64446
|
__name(updateSearch, "updateSearch");
|
|
64421
|
-
|
|
64422
|
-
|
|
64423
|
-
|
|
64424
|
-
|
|
64425
|
-
dispatch(change(formName, "reduxFormQueryParams", newParams));
|
|
64426
|
-
}, "setNewParams");
|
|
64427
|
-
} else {
|
|
64428
|
-
setNewParams = /* @__PURE__ */ __name(function(newParams) {
|
|
64429
|
-
dispatch(change(formName, "reduxFormQueryParams", newParams));
|
|
64430
|
-
}, "setNewParams");
|
|
64431
|
-
}
|
|
64447
|
+
const setNewParams = /* @__PURE__ */ __name((newParams) => {
|
|
64448
|
+
urlConnected && setCurrentParamsOnUrl(newParams, history.replace);
|
|
64449
|
+
dispatch(change(formName, "reduxFormQueryParams", newParams));
|
|
64450
|
+
}, "setNewParams");
|
|
64432
64451
|
return {
|
|
64433
64452
|
bindThese: makeDataTableHandlers({
|
|
64434
64453
|
setNewParams,
|
package/package.json
CHANGED
|
@@ -49,7 +49,7 @@ export const ColumnFilterMenu = ({
|
|
|
49
49
|
<Icon
|
|
50
50
|
style={{ marginLeft: 5 }}
|
|
51
51
|
icon="filter"
|
|
52
|
-
|
|
52
|
+
size={extraCompact ? 14 : undefined}
|
|
53
53
|
onClick={() => setColumnFilterMenuOpen(prev => !prev)}
|
|
54
54
|
className={classNames("tg-filter-menu-button", {
|
|
55
55
|
"tg-active-filter": !!filterActiveForColumn
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
+
import { flushSync } from "react-dom";
|
|
2
3
|
import { DateInput, DateRangeInput } from "@blueprintjs/datetime";
|
|
3
4
|
import { camelCase } from "lodash-es";
|
|
4
5
|
import classNames from "classnames";
|
|
@@ -68,19 +69,21 @@ const FilterAndSortMenu = ({
|
|
|
68
69
|
const [filterValue, setFilterValue] = useState("");
|
|
69
70
|
|
|
70
71
|
const handleFilterChange = selectedFilter => {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
72
|
+
flushSync(() => {
|
|
73
|
+
if (
|
|
74
|
+
filterValue &&
|
|
75
|
+
!Array.isArray(filterValue) &&
|
|
76
|
+
filterTypesDictionary[selectedFilter] === "list"
|
|
77
|
+
) {
|
|
78
|
+
setFilterValue(filterValue?.split(" ") || []);
|
|
79
|
+
} else if (
|
|
80
|
+
filterTypesDictionary[selectedFilter] === "text" &&
|
|
81
|
+
Array.isArray(filterValue)
|
|
82
|
+
) {
|
|
83
|
+
setFilterValue(filterValue.join(" "));
|
|
84
|
+
}
|
|
85
|
+
setSelectedFilter(camelCase(selectedFilter));
|
|
86
|
+
});
|
|
84
87
|
};
|
|
85
88
|
|
|
86
89
|
const handleFilterValueChange = filterValue => setFilterValue(filterValue);
|
package/src/DataTable/index.js
CHANGED
|
@@ -278,63 +278,74 @@ const DataTable = ({
|
|
|
278
278
|
urlConnected
|
|
279
279
|
]);
|
|
280
280
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
281
|
+
const tableParams = useMemo(() => {
|
|
282
|
+
if (!isTableParamsConnected) {
|
|
283
|
+
const updateSearch = val => {
|
|
284
|
+
change("reduxFormSearchInput", val || "");
|
|
285
|
+
};
|
|
285
286
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
287
|
+
const setNewParams = newParams => {
|
|
288
|
+
urlConnected && setCurrentParamsOnUrl(newParams, history.replace);
|
|
289
|
+
change("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
|
|
290
|
+
};
|
|
290
291
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
292
|
+
const bindThese = makeDataTableHandlers({
|
|
293
|
+
setNewParams,
|
|
294
|
+
updateSearch,
|
|
295
|
+
defaults: props.defaults,
|
|
296
|
+
onlyOneFilter: props.onlyOneFilter
|
|
297
|
+
});
|
|
297
298
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
299
|
+
const boundDispatchProps = {};
|
|
300
|
+
//bind currentParams to actions
|
|
301
|
+
Object.keys(bindThese).forEach(function (key) {
|
|
302
|
+
const action = bindThese[key];
|
|
303
|
+
boundDispatchProps[key] = function (...args) {
|
|
304
|
+
action(...args, currentParams);
|
|
305
|
+
};
|
|
306
|
+
});
|
|
306
307
|
|
|
307
|
-
|
|
308
|
+
const changeFormValue = (...args) => change(...args);
|
|
308
309
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
310
|
+
return {
|
|
311
|
+
changeFormValue,
|
|
312
|
+
selectedEntities,
|
|
313
|
+
..._tableParams,
|
|
314
|
+
...props,
|
|
315
|
+
...boundDispatchProps,
|
|
316
|
+
isTableParamsConnected: true //let the table know not to do local sorting/filtering etc.
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
return _tableParams;
|
|
320
|
+
}, [
|
|
321
|
+
_tableParams,
|
|
322
|
+
change,
|
|
323
|
+
currentParams,
|
|
324
|
+
history.replace,
|
|
325
|
+
isTableParamsConnected,
|
|
326
|
+
props,
|
|
327
|
+
selectedEntities,
|
|
328
|
+
urlConnected
|
|
329
|
+
]);
|
|
318
330
|
|
|
319
331
|
props = {
|
|
320
332
|
...props,
|
|
321
|
-
...
|
|
333
|
+
...tableParams
|
|
322
334
|
};
|
|
323
335
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
336
|
+
const queryParams = useMemo(() => {
|
|
337
|
+
if (!isTableParamsConnected) {
|
|
338
|
+
const additionalFilterToUse =
|
|
339
|
+
typeof props.additionalFilter === "function"
|
|
340
|
+
? props.additionalFilter.bind(this, ownProps)
|
|
341
|
+
: () => props.additionalFilter;
|
|
329
342
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
343
|
+
const additionalOrFilterToUse =
|
|
344
|
+
typeof props.additionalOrFilter === "function"
|
|
345
|
+
? props.additionalOrFilter.bind(this, ownProps)
|
|
346
|
+
: () => props.additionalOrFilter;
|
|
334
347
|
|
|
335
|
-
|
|
336
|
-
...props,
|
|
337
|
-
...getQueryParams({
|
|
348
|
+
return getQueryParams({
|
|
338
349
|
doNotCoercePageSize,
|
|
339
350
|
currentParams,
|
|
340
351
|
entities: props.entities, // for local table
|
|
@@ -348,9 +359,24 @@ const DataTable = ({
|
|
|
348
359
|
noOrderError: props.noOrderError,
|
|
349
360
|
isCodeModel: props.isCodeModel,
|
|
350
361
|
ownProps: props
|
|
351
|
-
})
|
|
352
|
-
}
|
|
353
|
-
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
return {};
|
|
365
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
366
|
+
}, [
|
|
367
|
+
convertedSchema,
|
|
368
|
+
currentParams,
|
|
369
|
+
doNotCoercePageSize,
|
|
370
|
+
isInfinite,
|
|
371
|
+
isLocalCall,
|
|
372
|
+
isTableParamsConnected,
|
|
373
|
+
urlConnected
|
|
374
|
+
]);
|
|
375
|
+
|
|
376
|
+
props = {
|
|
377
|
+
...props,
|
|
378
|
+
...queryParams
|
|
379
|
+
};
|
|
354
380
|
|
|
355
381
|
const {
|
|
356
382
|
addFilters = noop,
|
|
@@ -182,22 +182,13 @@ export default function withTableParams(compOrOpts, pTopLevelOpts) {
|
|
|
182
182
|
mergedOpts;
|
|
183
183
|
|
|
184
184
|
function updateSearch(val) {
|
|
185
|
-
|
|
186
|
-
dispatch(change(formName, "reduxFormSearchInput", val || ""));
|
|
187
|
-
});
|
|
185
|
+
dispatch(change(formName, "reduxFormSearchInput", val || ""));
|
|
188
186
|
}
|
|
189
187
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
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
|
|
195
|
-
};
|
|
196
|
-
} else {
|
|
197
|
-
setNewParams = function (newParams) {
|
|
198
|
-
dispatch(change(formName, "reduxFormQueryParams", newParams));
|
|
199
|
-
};
|
|
200
|
-
}
|
|
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
|
+
};
|
|
201
192
|
return {
|
|
202
193
|
bindThese: makeDataTableHandlers({
|
|
203
194
|
setNewParams,
|
|
@@ -41,6 +41,7 @@ import classNames from "classnames";
|
|
|
41
41
|
import convertSchema from "../DataTable/utils/convertSchema";
|
|
42
42
|
import { LoadingDots } from "./LoadingDots";
|
|
43
43
|
import { useDispatch } from "react-redux";
|
|
44
|
+
import { flushSync } from "react-dom";
|
|
44
45
|
|
|
45
46
|
const manualEnterMessage = "Build CSV File";
|
|
46
47
|
const manualEnterSubMessage = "Paste or type data to build a CSV file";
|
|
@@ -249,11 +250,13 @@ const Uploader = ({
|
|
|
249
250
|
// onChange received from redux-form is not working anymore,
|
|
250
251
|
// so we need to overwrite it for redux to works.
|
|
251
252
|
const onChange = val => {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
253
|
+
flushSync(() => {
|
|
254
|
+
if (noRedux) {
|
|
255
|
+
return _onChange(val);
|
|
256
|
+
}
|
|
257
|
+
dispatch(touch(formName, name));
|
|
258
|
+
dispatch(change(formName, name, val));
|
|
259
|
+
});
|
|
257
260
|
};
|
|
258
261
|
|
|
259
262
|
const handleSecondHalfOfUpload = async ({
|