@teselagen/ui 0.3.10 → 0.3.12

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.
Files changed (35) hide show
  1. package/index.js +27 -40
  2. package/index.mjs +27 -40
  3. package/package.json +1 -1
  4. package/src/AdvancedOptions.spec.js +3 -1
  5. package/src/DataTable/CellDragHandle.js +8 -8
  6. package/src/DataTable/FilterAndSortMenu.js +13 -13
  7. package/src/DataTable/PagingTool.js +10 -8
  8. package/src/DataTable/dataTableEnhancer.js +9 -9
  9. package/src/DataTable/index.js +115 -116
  10. package/src/DataTable/utils/queryParams.js +48 -48
  11. package/src/DataTable/utils/withTableParams.js +9 -18
  12. package/src/DialogFooter/index.js +1 -1
  13. package/src/FormComponents/Uploader.js +36 -37
  14. package/src/FormComponents/index.js +58 -58
  15. package/src/FormComponents/sortify.js +1 -1
  16. package/src/FormComponents/tryToMatchSchemas.js +4 -5
  17. package/src/MatchHeaders.js +19 -19
  18. package/src/MenuBar/index.js +10 -3
  19. package/src/PromptUnsavedChanges/index.js +1 -3
  20. package/src/UploadCsvWizard.js +12 -12
  21. package/src/autoTooltip.js +2 -2
  22. package/src/enhancers/withDialog/index.js +6 -6
  23. package/src/rerenderOnWindowResize.js +14 -15
  24. package/src/showConfirmationDialog/index.js +1 -3
  25. package/src/utils/basicHandleActionsWithFullState.js +5 -5
  26. package/src/utils/combineReducersWithFullState.js +9 -9
  27. package/src/utils/commandControls.js +21 -22
  28. package/src/utils/handlerHelpers.js +4 -4
  29. package/src/utils/hotkeyUtils.js +10 -8
  30. package/src/utils/menuUtils.js +79 -66
  31. package/src/utils/pureNoFunc.js +1 -1
  32. package/src/utils/renderOnDoc.js +2 -2
  33. package/src/utils/tgFormValues.js +23 -20
  34. package/src/utils/withSelectTableRecords.js +25 -23
  35. package/src/wrapDialog.js +98 -92
package/index.js CHANGED
@@ -30475,20 +30475,12 @@ var _cof = function (it) {
30475
30475
  return toString$6.call(it).slice(8, -1);
30476
30476
  };
30477
30477
 
30478
- var _iobject;
30479
- var hasRequired_iobject;
30480
-
30481
- function require_iobject () {
30482
- if (hasRequired_iobject) return _iobject;
30483
- hasRequired_iobject = 1;
30484
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
30485
- var cof = _cof;
30486
- // eslint-disable-next-line no-prototype-builtins
30487
- _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
30488
- return cof(it) == 'String' ? it.split('') : Object(it);
30489
- };
30490
- return _iobject;
30491
- }
30478
+ // fallback for non-array-like ES3 and non-enumerable old V8 strings
30479
+ var cof$2 = _cof;
30480
+ // eslint-disable-next-line no-prototype-builtins
30481
+ var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
30482
+ return cof$2(it) == 'String' ? it.split('') : Object(it);
30483
+ };
30492
30484
 
30493
30485
  // 7.2.1 RequireObjectCoercible(argument)
30494
30486
  var _defined = function (it) {
@@ -30497,7 +30489,7 @@ var _defined = function (it) {
30497
30489
  };
30498
30490
 
30499
30491
  // to indexed object, toObject with fallback for non-array-like ES3 strings
30500
- var IObject = require_iobject();
30492
+ var IObject = _iobject;
30501
30493
  var defined$2 = _defined;
30502
30494
  var _toIobject = function (it) {
30503
30495
  return IObject(defined$2(it));
@@ -30644,7 +30636,7 @@ function require_objectAssign () {
30644
30636
  var gOPS = _objectGops;
30645
30637
  var pIE = require_objectPie();
30646
30638
  var toObject = _toObject;
30647
- var IObject = require_iobject();
30639
+ var IObject = _iobject;
30648
30640
  var $assign = Object.assign;
30649
30641
 
30650
30642
  // should work with symbols and should have deterministic property order (V8 bug)
@@ -85604,13 +85596,7 @@ function withTableParams(compOrOpts, pTopLevelOpts) {
85604
85596
  return {};
85605
85597
  }
85606
85598
  const mergedOpts = getMergedOpts(topLevelOptions, ownProps);
85607
- const {
85608
- formName,
85609
- urlConnected,
85610
- history,
85611
- defaults,
85612
- onlyOneFilter
85613
- } = mergedOpts;
85599
+ const { formName, urlConnected, history, defaults, onlyOneFilter } = mergedOpts;
85614
85600
  function updateSearch(val) {
85615
85601
  setTimeout(function() {
85616
85602
  dispatch(reduxForm.change(formName, "reduxFormSearchInput", val || ""));
@@ -85649,12 +85635,7 @@ function withTableParams(compOrOpts, pTopLevelOpts) {
85649
85635
  action(...args, currentParams);
85650
85636
  };
85651
85637
  });
85652
- const {
85653
- variables,
85654
- selectedEntities,
85655
- mergedOpts,
85656
- ...restStateProps
85657
- } = stateProps;
85638
+ const { variables, selectedEntities, mergedOpts, ...restStateProps } = stateProps;
85658
85639
  const changeFormValue = (...args) => dispatchProps.dispatch(reduxForm.change(formName, ...args));
85659
85640
  const tableParams = {
85660
85641
  changeFormValue,
@@ -89550,7 +89531,9 @@ const wrapDialog = (topLevelDialogProps = {}) => (Component) => (props) => {
89550
89531
  return doNotTriggerClick();
89551
89532
  }
89552
89533
  const parentEl = r.current?.closest(".bp3-dialog-container");
89553
- const dialogs = document.querySelectorAll(".bp3-dialog-container");
89534
+ const dialogs = document.querySelectorAll(
89535
+ ".bp3-dialog-container"
89536
+ );
89554
89537
  const numDialogs = dialogs?.length;
89555
89538
  if (numDialogs > 1) {
89556
89539
  const topMostDialog = dialogs[numDialogs - 1];
@@ -89902,6 +89885,7 @@ function MatchHeaders({
89902
89885
  marginBottom: 10,
89903
89886
  marginLeft: 20,
89904
89887
  fontSize: 10
89888
+ /* color: Colors.RED1 */
89905
89889
  }
89906
89890
  },
89907
89891
  userMatchedHeader && [
@@ -91890,10 +91874,7 @@ const UploadCsvWizardDialog = compose(
91890
91874
  if (props.filesWIssues.length > 0) {
91891
91875
  const reduxFormEntitiesArray = [];
91892
91876
  const finishedFiles = props.filesWIssues.map((f, i) => {
91893
- const {
91894
- reduxFormEntities,
91895
- reduxFormCellValidation
91896
- } = reduxForm.formValueSelector(`editableCellTable-${i}`)(
91877
+ const { reduxFormEntities, reduxFormCellValidation } = reduxForm.formValueSelector(`editableCellTable-${i}`)(
91897
91878
  state,
91898
91879
  "reduxFormEntities",
91899
91880
  "reduxFormCellValidation"
@@ -92270,6 +92251,8 @@ const PreviewCsvData = observer(function(props) {
92270
92251
  userSchema = exampleData,
92271
92252
  initialEntities
92272
92253
  } = props;
92254
+ const rerenderKey = React$1.useRef(0);
92255
+ rerenderKey.current = rerenderKey.current + 1;
92273
92256
  const data = userSchema.userData && userSchema.userData.length && userSchema.userData.map((row) => {
92274
92257
  const toRet = {
92275
92258
  _isClean: row._isClean
@@ -92316,6 +92299,7 @@ const PreviewCsvData = observer(function(props) {
92316
92299
  {
92317
92300
  maxWidth: 800,
92318
92301
  maxHeight: 500,
92302
+ rerenderKey: rerenderKey.current,
92319
92303
  destroyOnUnmount: false,
92320
92304
  doNotValidateUntouchedRows: true,
92321
92305
  formName: datatableFormName || "editableCellTable",
@@ -104272,7 +104256,14 @@ const EnhancedMenuItem = compose(
104272
104256
  }
104273
104257
  }),
104274
104258
  branch(({ navTo }) => navTo, withRouter$1)
104275
- )(function({ navTo, context, staticContext, didMount, willUnmount, ...props }) {
104259
+ )(function({
104260
+ navTo,
104261
+ context,
104262
+ staticContext,
104263
+ didMount,
104264
+ willUnmount,
104265
+ ...props
104266
+ }) {
104276
104267
  let MenuItemComp = core$5.MenuItem;
104277
104268
  if (navTo) {
104278
104269
  MenuItemComp = MenuItemLink;
@@ -105654,11 +105645,7 @@ function getCommandHotkeyHandlers(commands) {
105654
105645
  return handlers;
105655
105646
  }
105656
105647
 
105657
- const withCommand = (mappings) => (WrappedComponent) => ({
105658
- cmd,
105659
- cmdOptions = {},
105660
- ...props
105661
- }) => {
105648
+ const withCommand = (mappings) => (WrappedComponent) => ({ cmd, cmdOptions = {}, ...props }) => {
105662
105649
  const mappedProps = {};
105663
105650
  Object.keys(mappings).forEach((k) => {
105664
105651
  mappedProps[k] = mappings[k] === "execute" ? (event) => cmd.execute({ event }) : typeof mappings[k] === "function" ? mappings[k](cmd, props) : cmd[mappings[k]];
package/index.mjs CHANGED
@@ -30454,20 +30454,12 @@ var _cof = function (it) {
30454
30454
  return toString$6.call(it).slice(8, -1);
30455
30455
  };
30456
30456
 
30457
- var _iobject;
30458
- var hasRequired_iobject;
30459
-
30460
- function require_iobject () {
30461
- if (hasRequired_iobject) return _iobject;
30462
- hasRequired_iobject = 1;
30463
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
30464
- var cof = _cof;
30465
- // eslint-disable-next-line no-prototype-builtins
30466
- _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
30467
- return cof(it) == 'String' ? it.split('') : Object(it);
30468
- };
30469
- return _iobject;
30470
- }
30457
+ // fallback for non-array-like ES3 and non-enumerable old V8 strings
30458
+ var cof$2 = _cof;
30459
+ // eslint-disable-next-line no-prototype-builtins
30460
+ var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
30461
+ return cof$2(it) == 'String' ? it.split('') : Object(it);
30462
+ };
30471
30463
 
30472
30464
  // 7.2.1 RequireObjectCoercible(argument)
30473
30465
  var _defined = function (it) {
@@ -30476,7 +30468,7 @@ var _defined = function (it) {
30476
30468
  };
30477
30469
 
30478
30470
  // to indexed object, toObject with fallback for non-array-like ES3 strings
30479
- var IObject = require_iobject();
30471
+ var IObject = _iobject;
30480
30472
  var defined$2 = _defined;
30481
30473
  var _toIobject = function (it) {
30482
30474
  return IObject(defined$2(it));
@@ -30623,7 +30615,7 @@ function require_objectAssign () {
30623
30615
  var gOPS = _objectGops;
30624
30616
  var pIE = require_objectPie();
30625
30617
  var toObject = _toObject;
30626
- var IObject = require_iobject();
30618
+ var IObject = _iobject;
30627
30619
  var $assign = Object.assign;
30628
30620
 
30629
30621
  // should work with symbols and should have deterministic property order (V8 bug)
@@ -85583,13 +85575,7 @@ function withTableParams(compOrOpts, pTopLevelOpts) {
85583
85575
  return {};
85584
85576
  }
85585
85577
  const mergedOpts = getMergedOpts(topLevelOptions, ownProps);
85586
- const {
85587
- formName,
85588
- urlConnected,
85589
- history,
85590
- defaults,
85591
- onlyOneFilter
85592
- } = mergedOpts;
85578
+ const { formName, urlConnected, history, defaults, onlyOneFilter } = mergedOpts;
85593
85579
  function updateSearch(val) {
85594
85580
  setTimeout(function() {
85595
85581
  dispatch(change(formName, "reduxFormSearchInput", val || ""));
@@ -85628,12 +85614,7 @@ function withTableParams(compOrOpts, pTopLevelOpts) {
85628
85614
  action(...args, currentParams);
85629
85615
  };
85630
85616
  });
85631
- const {
85632
- variables,
85633
- selectedEntities,
85634
- mergedOpts,
85635
- ...restStateProps
85636
- } = stateProps;
85617
+ const { variables, selectedEntities, mergedOpts, ...restStateProps } = stateProps;
85637
85618
  const changeFormValue = (...args) => dispatchProps.dispatch(change(formName, ...args));
85638
85619
  const tableParams = {
85639
85620
  changeFormValue,
@@ -89529,7 +89510,9 @@ const wrapDialog = (topLevelDialogProps = {}) => (Component) => (props) => {
89529
89510
  return doNotTriggerClick();
89530
89511
  }
89531
89512
  const parentEl = r.current?.closest(".bp3-dialog-container");
89532
- const dialogs = document.querySelectorAll(".bp3-dialog-container");
89513
+ const dialogs = document.querySelectorAll(
89514
+ ".bp3-dialog-container"
89515
+ );
89533
89516
  const numDialogs = dialogs?.length;
89534
89517
  if (numDialogs > 1) {
89535
89518
  const topMostDialog = dialogs[numDialogs - 1];
@@ -89881,6 +89864,7 @@ function MatchHeaders({
89881
89864
  marginBottom: 10,
89882
89865
  marginLeft: 20,
89883
89866
  fontSize: 10
89867
+ /* color: Colors.RED1 */
89884
89868
  }
89885
89869
  },
89886
89870
  userMatchedHeader && [
@@ -91869,10 +91853,7 @@ const UploadCsvWizardDialog = compose(
91869
91853
  if (props.filesWIssues.length > 0) {
91870
91854
  const reduxFormEntitiesArray = [];
91871
91855
  const finishedFiles = props.filesWIssues.map((f, i) => {
91872
- const {
91873
- reduxFormEntities,
91874
- reduxFormCellValidation
91875
- } = formValueSelector(`editableCellTable-${i}`)(
91856
+ const { reduxFormEntities, reduxFormCellValidation } = formValueSelector(`editableCellTable-${i}`)(
91876
91857
  state,
91877
91858
  "reduxFormEntities",
91878
91859
  "reduxFormCellValidation"
@@ -92249,6 +92230,8 @@ const PreviewCsvData = observer(function(props) {
92249
92230
  userSchema = exampleData,
92250
92231
  initialEntities
92251
92232
  } = props;
92233
+ const rerenderKey = useRef(0);
92234
+ rerenderKey.current = rerenderKey.current + 1;
92252
92235
  const data = userSchema.userData && userSchema.userData.length && userSchema.userData.map((row) => {
92253
92236
  const toRet = {
92254
92237
  _isClean: row._isClean
@@ -92295,6 +92278,7 @@ const PreviewCsvData = observer(function(props) {
92295
92278
  {
92296
92279
  maxWidth: 800,
92297
92280
  maxHeight: 500,
92281
+ rerenderKey: rerenderKey.current,
92298
92282
  destroyOnUnmount: false,
92299
92283
  doNotValidateUntouchedRows: true,
92300
92284
  formName: datatableFormName || "editableCellTable",
@@ -104251,7 +104235,14 @@ const EnhancedMenuItem = compose(
104251
104235
  }
104252
104236
  }),
104253
104237
  branch(({ navTo }) => navTo, withRouter$1)
104254
- )(function({ navTo, context, staticContext, didMount, willUnmount, ...props }) {
104238
+ )(function({
104239
+ navTo,
104240
+ context,
104241
+ staticContext,
104242
+ didMount,
104243
+ willUnmount,
104244
+ ...props
104245
+ }) {
104255
104246
  let MenuItemComp = MenuItem;
104256
104247
  if (navTo) {
104257
104248
  MenuItemComp = MenuItemLink;
@@ -105633,11 +105624,7 @@ function getCommandHotkeyHandlers(commands) {
105633
105624
  return handlers;
105634
105625
  }
105635
105626
 
105636
- const withCommand = (mappings) => (WrappedComponent) => ({
105637
- cmd,
105638
- cmdOptions = {},
105639
- ...props
105640
- }) => {
105627
+ const withCommand = (mappings) => (WrappedComponent) => ({ cmd, cmdOptions = {}, ...props }) => {
105641
105628
  const mappedProps = {};
105642
105629
  Object.keys(mappings).forEach((k) => {
105643
105630
  mappedProps[k] = mappings[k] === "execute" ? (event) => cmd.execute({ event }) : typeof mappings[k] === "function" ? mappings[k](cmd, props) : cmd[mappings[k]];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/ui",
3
- "version": "0.3.10",
3
+ "version": "0.3.12",
4
4
  "main": "./src/index.js",
5
5
  "dependencies": {
6
6
  "@teselagen/file-utils": "0.3.9",
@@ -10,7 +10,9 @@ describe("AdvancedOptions", () => {
10
10
  expect(queryByText("Test Label")).toBeInTheDocument();
11
11
  expect(queryByText("Test Content")).not.toBeInTheDocument();
12
12
 
13
- expect(container.querySelector(".bp3-icon-caret-right")).toBeInTheDocument();
13
+ expect(
14
+ container.querySelector(".bp3-icon-caret-right")
15
+ ).toBeInTheDocument();
14
16
  });
15
17
 
16
18
  test("toggles content when clicked", () => {
@@ -14,7 +14,7 @@ export function CellDragHandle({
14
14
  const rowsToSelect = useRef();
15
15
  const rectangleCellPaths = useRef();
16
16
 
17
- const handleDrag = useRef((e) => {
17
+ const handleDrag = useRef(e => {
18
18
  const table = ReactDOM.findDOMNode(thisTable).querySelector(".rt-table");
19
19
  const trs = table.querySelectorAll(`.rt-tr-group.with-row-data`);
20
20
  const [rowId, path] = cellId.split(":");
@@ -60,7 +60,7 @@ export function CellDragHandle({
60
60
  //add dashed borders
61
61
 
62
62
  if (rectangleCellPaths.current) {
63
- rectangleCellPaths.current.forEach((path) => {
63
+ rectangleCellPaths.current.forEach(path => {
64
64
  changeDashedBorder(path, true);
65
65
  });
66
66
  } else {
@@ -70,7 +70,7 @@ export function CellDragHandle({
70
70
  }
71
71
  if (!isSelectedForUpdate) {
72
72
  if (rectangleCellPaths.current) {
73
- rectangleCellPaths.current.forEach((path) => {
73
+ rectangleCellPaths.current.forEach(path => {
74
74
  changeDashedBorder(path, false);
75
75
  });
76
76
  } else {
@@ -87,9 +87,9 @@ export function CellDragHandle({
87
87
  const trs = table.querySelectorAll(`.rt-tr-group.with-row-data`);
88
88
  const [, path] = cellId.split(":");
89
89
  //remove the dashed borders
90
- forEach(trs, (tr) => {
90
+ forEach(trs, tr => {
91
91
  if (rectangleCellPaths.current) {
92
- rectangleCellPaths.current.forEach((path) => {
92
+ rectangleCellPaths.current.forEach(path => {
93
93
  const el = tr.querySelector(`[data-test="tgCell_${path}"]`);
94
94
  el.parentNode.classList.remove("selectedForUpdate");
95
95
  });
@@ -101,9 +101,9 @@ export function CellDragHandle({
101
101
  document.removeEventListener("mousemove", handleDrag.current, false);
102
102
  document.removeEventListener("mouseup", mouseup.current, false);
103
103
  onDragEnd(
104
- flatMap(rowsToSelect.current, (id) => {
104
+ flatMap(rowsToSelect.current, id => {
105
105
  if (rectangleCellPaths.current) {
106
- return rectangleCellPaths.current.map((path) => {
106
+ return rectangleCellPaths.current.map(path => {
107
107
  return `${id}:${path}`;
108
108
  });
109
109
  } else {
@@ -115,7 +115,7 @@ export function CellDragHandle({
115
115
 
116
116
  return (
117
117
  <div
118
- onMouseDown={(e) => {
118
+ onMouseDown={e => {
119
119
  rowsToSelect.current = [];
120
120
  xStart.current = e.clientX;
121
121
  const { isRect, selectedPaths } = isSelectionARectangle();
@@ -47,9 +47,9 @@ const filterTypesDictionary = {
47
47
  regex: "text"
48
48
  };
49
49
 
50
- const isInvalidFilterValue = (value) => {
50
+ const isInvalidFilterValue = value => {
51
51
  if (Array.isArray(value) && value.length) {
52
- return value.some((item) => isInvalidFilterValue(item));
52
+ return value.some(item => isInvalidFilterValue(item));
53
53
  }
54
54
  return value === "" || value === undefined || value.length === 0;
55
55
  };
@@ -64,7 +64,7 @@ export default class FilterAndSortMenu extends React.Component {
64
64
  ...this.props.currentFilter
65
65
  };
66
66
  }
67
- handleFilterChange = (selectedFilter) => {
67
+ handleFilterChange = selectedFilter => {
68
68
  const { filterValue } = this.state;
69
69
  if (
70
70
  filterValue &&
@@ -84,7 +84,7 @@ export default class FilterAndSortMenu extends React.Component {
84
84
  }
85
85
  this.setState({ selectedFilter: camelCase(selectedFilter) });
86
86
  };
87
- handleFilterValueChange = (filterValue) => {
87
+ handleFilterValueChange = filterValue => {
88
88
  this.setState({ filterValue });
89
89
  };
90
90
  handleFilterSubmit = () => {
@@ -108,7 +108,7 @@ export default class FilterAndSortMenu extends React.Component {
108
108
  if (dataType === "number") {
109
109
  filterValToUse =
110
110
  filterValue &&
111
- filterValue.map((val) => parseFloat(val.replaceAll(",", "")));
111
+ filterValue.map(val => parseFloat(val.replaceAll(",", "")));
112
112
  }
113
113
  }
114
114
 
@@ -244,15 +244,15 @@ class FilterInput extends React.Component {
244
244
  noResults={null}
245
245
  multi={true}
246
246
  creatable={true}
247
- value={(filterValue || []).map((val) => ({
247
+ value={(filterValue || []).map(val => ({
248
248
  label: val,
249
249
  value: val
250
250
  }))}
251
- onChange={(selectedOptions) => {
252
- selectedOptions.some((opt) => opt.value === "")
251
+ onChange={selectedOptions => {
252
+ selectedOptions.some(opt => opt.value === "")
253
253
  ? handleFilterSubmit()
254
254
  : handleFilterValueChange(
255
- selectedOptions.map((opt) => opt.value)
255
+ selectedOptions.map(opt => opt.value)
256
256
  );
257
257
  }}
258
258
  options={[]}
@@ -310,7 +310,7 @@ class FilterInput extends React.Component {
310
310
  value={filterValue ? dayjs(filterValue).toDate() : undefined}
311
311
  {...getDayjsFormatter("L")}
312
312
  {...dateMinMaxHelpers}
313
- onChange={(selectedDates) => {
313
+ onChange={selectedDates => {
314
314
  handleFilterValueChange(selectedDates);
315
315
  }}
316
316
  />
@@ -341,13 +341,13 @@ class FilterInput extends React.Component {
341
341
  captureDismiss: true
342
342
  }}
343
343
  {...{
344
- formatDate: (date) =>
344
+ formatDate: date =>
345
345
  date == null ? "" : date.toLocaleDateString(),
346
- parseDate: (str) => new Date(Date.parse(str)),
346
+ parseDate: str => new Date(Date.parse(str)),
347
347
  placeholder: "JS Date"
348
348
  }}
349
349
  {...dateMinMaxHelpers}
350
- onChange={(selectedDates) => {
350
+ onChange={selectedDates => {
351
351
  if (selectedDates[0] && selectedDates[1]) {
352
352
  handleFilterValueChange(selectedDates);
353
353
  }
@@ -219,14 +219,16 @@ export default compose(
219
219
  };
220
220
  }),
221
221
  withHandlers({
222
- onPageChange: ({ entities, keepSelectionOnPageChange, change }) => () => {
223
- const record = get(entities, "[0]");
224
- if (
225
- !keepSelectionOnPageChange &&
226
- (!record || !getIdOrCodeOrIndex(record))
227
- ) {
228
- change("reduxFormSelectedEntityIdMap", {});
222
+ onPageChange:
223
+ ({ entities, keepSelectionOnPageChange, change }) =>
224
+ () => {
225
+ const record = get(entities, "[0]");
226
+ if (
227
+ !keepSelectionOnPageChange &&
228
+ (!record || !getIdOrCodeOrIndex(record))
229
+ ) {
230
+ change("reduxFormSelectedEntityIdMap", {});
231
+ }
229
232
  }
230
- }
231
233
  })
232
234
  )(PagingTool);
@@ -163,14 +163,14 @@ export default compose(
163
163
  if (syncDisplayOptionsToDb) {
164
164
  //sync up to db
165
165
  let tableConfigurationId;
166
- resetDefaultVisibility = function() {
166
+ resetDefaultVisibility = function () {
167
167
  tableConfigurationId = tableConfig.id;
168
168
 
169
169
  if (tableConfigurationId) {
170
170
  deleteTableConfiguration(tableConfigurationId);
171
171
  }
172
172
  };
173
- updateColumnVisibility = function({ shouldShow, path }) {
173
+ updateColumnVisibility = function ({ shouldShow, path }) {
174
174
  if (tableConfigurationId) {
175
175
  const existingFieldOpt = fieldOptsByPath[path] || {};
176
176
  upsertFieldOption({
@@ -198,10 +198,10 @@ export default compose(
198
198
  };
199
199
 
200
200
  //sync display options with localstorage
201
- resetDefaultVisibility = function() {
201
+ resetDefaultVisibility = function () {
202
202
  window.localStorage.removeItem(formName);
203
203
  };
204
- updateColumnVisibility = function({ path, paths, shouldShow }) {
204
+ updateColumnVisibility = function ({ path, paths, shouldShow }) {
205
205
  const newFieldOpts = {
206
206
  ...fieldOptsByPath
207
207
  };
@@ -212,15 +212,15 @@ export default compose(
212
212
  tableConfig.fieldOptions = toArray(newFieldOpts);
213
213
  syncStorage();
214
214
  };
215
- updateTableDisplayDensity = function(density) {
215
+ updateTableDisplayDensity = function (density) {
216
216
  tableConfig.density = density;
217
217
  syncStorage();
218
218
  };
219
- persistPageSize = function(pageSize) {
219
+ persistPageSize = function (pageSize) {
220
220
  tableConfig.userSetPageSize = pageSize;
221
221
  syncStorage();
222
222
  };
223
- moveColumnPersist = function({ oldIndex, newIndex }) {
223
+ moveColumnPersist = function ({ oldIndex, newIndex }) {
224
224
  // we might already have an array of the fields [path1, path2, ..etc]
225
225
  const columnOrderings =
226
226
  tableConfig.columnOrderings ||
@@ -233,7 +233,7 @@ export default compose(
233
233
  );
234
234
  syncStorage();
235
235
  };
236
- resizePersist = function(newResized) {
236
+ resizePersist = function (newResized) {
237
237
  tableConfig.resized = newResized;
238
238
  syncStorage();
239
239
  };
@@ -287,5 +287,5 @@ export default compose(
287
287
  // "reduxFormExpandedEntityIdMap"
288
288
  // ]
289
289
  // }),
290
- branch(props => !props.alwaysRerender, pureNoFunc)
290
+ branch(props => !props.alwaysRerender, pureNoFunc),
291
291
  );