@teselagen/ui 0.5.23-beta.27 → 0.5.23-beta.29

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.
@@ -0,0 +1,7 @@
1
+ export function EditableCell({ cancelEdit, dataTest, finishEdit, isNumeric, initialValue }: {
2
+ cancelEdit: any;
3
+ dataTest: any;
4
+ finishEdit: any;
5
+ isNumeric: any;
6
+ initialValue: any;
7
+ }): import("react/jsx-runtime").JSX.Element;
@@ -11,9 +11,8 @@ export function getMergedOpts(topLevel?: {}, instanceLevel?: {}): {
11
11
  export function getCCDisplayName(field: object): string;
12
12
  export function getCurrentParamsFromUrl(location: any, isSimple: any): any;
13
13
  export function setCurrentParamsOnUrl(newParams: any, replace: any, isSimple: any): void;
14
- export function makeDataTableHandlers({ setNewParams, updateSearch, defaults, onlyOneFilter }: {
14
+ export function makeDataTableHandlers({ setNewParams, defaults, onlyOneFilter }: {
15
15
  setNewParams: any;
16
- updateSearch: any;
17
16
  defaults: any;
18
17
  onlyOneFilter: any;
19
18
  }): {
package/index.cjs.js CHANGED
@@ -20106,7 +20106,6 @@ function buildRef(qb, reference2, searchField, expression) {
20106
20106
  __name(buildRef, "buildRef");
20107
20107
  function makeDataTableHandlers({
20108
20108
  setNewParams,
20109
- updateSearch,
20110
20109
  defaults: defaults2,
20111
20110
  onlyOneFilter
20112
20111
  }) {
@@ -20117,7 +20116,6 @@ function makeDataTableHandlers({
20117
20116
  searchTerm: searchTerm === defaults2.searchTerm ? void 0 : searchTerm
20118
20117
  });
20119
20118
  setNewParams(newParams);
20120
- updateSearch(searchTerm);
20121
20119
  onlyOneFilter && clearFilters();
20122
20120
  }
20123
20121
  __name(setSearchTerm, "setSearchTerm");
@@ -20134,7 +20132,6 @@ function makeDataTableHandlers({
20134
20132
  filters
20135
20133
  });
20136
20134
  setNewParams(newParams);
20137
- onlyOneFilter && updateSearch();
20138
20135
  }
20139
20136
  __name(addFilters, "addFilters");
20140
20137
  function removeSingleFilter(filterOn, currentParams) {
@@ -20157,7 +20154,6 @@ function makeDataTableHandlers({
20157
20154
  toClear[key] = void 0;
20158
20155
  });
20159
20156
  setNewParams(toClear);
20160
- updateSearch();
20161
20157
  }
20162
20158
  __name(clearFilters, "clearFilters");
20163
20159
  function setPageSize(pageSize, currentParams) {
@@ -33014,13 +33010,13 @@ const SearchBar = /* @__PURE__ */ __name(({
33014
33010
  disabled,
33015
33011
  loading,
33016
33012
  type: "search",
33017
- name: "reduxFormSearchInput",
33013
+ defaultValue: searchInput,
33018
33014
  className: classNames("datatable-search-input", core.Classes.ROUND),
33019
33015
  placeholder: "Search..."
33020
33016
  }, onEnterHelper((e2) => {
33021
33017
  e2.preventDefault();
33022
33018
  e2.stopPropagation();
33023
- setSearchTerm(searchInput);
33019
+ setSearchTerm(e2.target.value);
33024
33020
  e2.nativeEvent.stopImmediatePropagation();
33025
33021
  })), {
33026
33022
  rightElement
@@ -52489,7 +52485,6 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
52489
52485
  reduxFormEditingCell,
52490
52486
  reduxFormEntities,
52491
52487
  reduxFormQueryParams: _reduxFormQueryParams = {},
52492
- reduxFormSearchInput: _reduxFormSearchInput = "",
52493
52488
  reduxFormSelectedEntityIdMap: _reduxFormSelectedEntityIdMap = {}
52494
52489
  } = reactRedux.useSelector(
52495
52490
  (state) => reduxForm.formValueSelector(formName)(
@@ -52497,13 +52492,11 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
52497
52492
  "reduxFormCellValidation",
52498
52493
  "reduxFormEntities",
52499
52494
  "reduxFormQueryParams",
52500
- "reduxFormSearchInput",
52501
52495
  "reduxFormSelectedEntityIdMap"
52502
52496
  )
52503
52497
  );
52504
52498
  const reduxFormCellValidation = useDeepEqualMemo(_reduxFormCellValidation);
52505
52499
  const reduxFormQueryParams = useDeepEqualMemo(_reduxFormQueryParams);
52506
- const reduxFormSearchInput = useDeepEqualMemo(_reduxFormSearchInput);
52507
52500
  const reduxFormSelectedEntityIdMap = useDeepEqualMemo(
52508
52501
  _reduxFormSelectedEntityIdMap
52509
52502
  );
@@ -52578,22 +52571,17 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
52578
52571
  });
52579
52572
  const _currentParams = React$1.useMemo(() => {
52580
52573
  const tmp = (urlConnected ? getCurrentParamsFromUrl(history.location) : reduxFormQueryParams) || {};
52581
- tmp.searchTerm = reduxFormSearchInput;
52582
52574
  return tmp;
52583
- }, [history, reduxFormQueryParams, reduxFormSearchInput, urlConnected]);
52575
+ }, [history, reduxFormQueryParams, urlConnected]);
52584
52576
  const currentParams = useDeepEqualMemo(_currentParams);
52585
52577
  const tableParams = React$1.useMemo(() => {
52586
52578
  if (!isTableParamsConnected) {
52587
- const updateSearch = /* @__PURE__ */ __name((val) => {
52588
- change("reduxFormSearchInput", val || "");
52589
- }, "updateSearch");
52590
52579
  const setNewParams2 = /* @__PURE__ */ __name((newParams) => {
52591
52580
  urlConnected && setCurrentParamsOnUrl(newParams, history.replace);
52592
52581
  change("reduxFormQueryParams", newParams);
52593
52582
  }, "setNewParams2");
52594
52583
  const bindThese = makeDataTableHandlers({
52595
52584
  setNewParams: setNewParams2,
52596
- updateSearch,
52597
52585
  defaults: defaults2,
52598
52586
  onlyOneFilter: props.onlyOneFilter
52599
52587
  });
@@ -55014,7 +55002,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
55014
55002
  )) : "", /* @__PURE__ */ React$1.createElement(
55015
55003
  SearchBar,
55016
55004
  {
55017
- searchInput: reduxFormSearchInput,
55005
+ searchInput: currentParams.searchTerm,
55018
55006
  setSearchTerm,
55019
55007
  loading: isLoading,
55020
55008
  searchMenuButton,
@@ -68612,31 +68600,22 @@ const useTableParams = /* @__PURE__ */ __name((props) => {
68612
68600
  }
68613
68601
  const {
68614
68602
  reduxFormQueryParams: _reduxFormQueryParams = {},
68615
- reduxFormSearchInput: _reduxFormSearchInput = "",
68616
68603
  reduxFormSelectedEntityIdMap: _reduxFormSelectedEntityIdMap = {}
68617
68604
  } = reactRedux.useSelector(
68618
68605
  (state) => reduxForm.formValueSelector(formName)(
68619
68606
  state,
68620
68607
  "reduxFormQueryParams",
68621
- "reduxFormSearchInput",
68622
68608
  "reduxFormSelectedEntityIdMap"
68623
68609
  )
68624
68610
  );
68625
68611
  const reduxFormQueryParams = useDeepEqualMemo(_reduxFormQueryParams);
68626
- const reduxFormSearchInput = useDeepEqualMemo(_reduxFormSearchInput);
68627
68612
  const reduxFormSelectedEntityIdMap = useDeepEqualMemo(
68628
68613
  _reduxFormSelectedEntityIdMap
68629
68614
  );
68630
68615
  const _currentParams = React$1.useMemo(() => {
68631
68616
  const tmp = (urlConnected ? getCurrentParamsFromUrl(history == null ? void 0 : history.location) : reduxFormQueryParams) || {};
68632
- tmp.searchTerm = reduxFormSearchInput;
68633
68617
  return tmp;
68634
- }, [
68635
- history == null ? void 0 : history.location,
68636
- reduxFormQueryParams,
68637
- reduxFormSearchInput,
68638
- urlConnected
68639
- ]);
68618
+ }, [history == null ? void 0 : history.location, reduxFormQueryParams, urlConnected]);
68640
68619
  const selectedEntities = React$1.useMemo(
68641
68620
  () => withSelectedEntities2 ? Object.values(reduxFormSelectedEntityIdMap).sort((a2, b2) => a2.rowIndex - b2.rowIndex).map((item) => item.entity) : void 0,
68642
68621
  [reduxFormSelectedEntityIdMap, withSelectedEntities2]
@@ -68657,11 +68636,12 @@ const useTableParams = /* @__PURE__ */ __name((props) => {
68657
68636
  formName: "tgDataTable"
68658
68637
  }, props), {
68659
68638
  pageSize: controlled_pageSize || pageSize,
68660
- defaults: defaultsToUse
68639
+ defaults: defaultsToUse,
68640
+ location: history.location
68661
68641
  }),
68662
68642
  // We don't want to rerender this every time a prop changes
68663
68643
  // eslint-disable-next-line react-hooks/exhaustive-deps
68664
- [controlled_pageSize, defaultsToUse, pageSize]
68644
+ [controlled_pageSize, defaultsToUse, pageSize, history.location]
68665
68645
  );
68666
68646
  const queryParams = React$1.useMemo(() => {
68667
68647
  const additionalFilterToUse = typeof additionalFilter === "function" ? additionalFilter.bind(void 0, passingProps) : () => additionalFilter;
@@ -68702,16 +68682,12 @@ const useTableParams = /* @__PURE__ */ __name((props) => {
68702
68682
  const dispatch = reactRedux.useDispatch();
68703
68683
  const tableParams = React$1.useMemo(() => {
68704
68684
  const change = /* @__PURE__ */ __name((...args) => dispatch(reduxForm.change(formName, ...args)), "change");
68705
- const updateSearch = /* @__PURE__ */ __name((val) => {
68706
- change("reduxFormSearchInput", val || "");
68707
- }, "updateSearch");
68708
68685
  const setNewParams = /* @__PURE__ */ __name((newParams) => {
68709
68686
  urlConnected && setCurrentParamsOnUrl(newParams, history == null ? void 0 : history.replace);
68710
68687
  change("reduxFormQueryParams", newParams);
68711
68688
  }, "setNewParams");
68712
68689
  const bindThese = makeDataTableHandlers({
68713
68690
  setNewParams,
68714
- updateSearch,
68715
68691
  defaults: defaults2,
68716
68692
  onlyOneFilter
68717
68693
  });
package/index.es.js CHANGED
@@ -20088,7 +20088,6 @@ function buildRef(qb, reference2, searchField, expression) {
20088
20088
  __name(buildRef, "buildRef");
20089
20089
  function makeDataTableHandlers({
20090
20090
  setNewParams,
20091
- updateSearch,
20092
20091
  defaults: defaults2,
20093
20092
  onlyOneFilter
20094
20093
  }) {
@@ -20099,7 +20098,6 @@ function makeDataTableHandlers({
20099
20098
  searchTerm: searchTerm === defaults2.searchTerm ? void 0 : searchTerm
20100
20099
  });
20101
20100
  setNewParams(newParams);
20102
- updateSearch(searchTerm);
20103
20101
  onlyOneFilter && clearFilters();
20104
20102
  }
20105
20103
  __name(setSearchTerm, "setSearchTerm");
@@ -20116,7 +20114,6 @@ function makeDataTableHandlers({
20116
20114
  filters
20117
20115
  });
20118
20116
  setNewParams(newParams);
20119
- onlyOneFilter && updateSearch();
20120
20117
  }
20121
20118
  __name(addFilters, "addFilters");
20122
20119
  function removeSingleFilter(filterOn, currentParams) {
@@ -20139,7 +20136,6 @@ function makeDataTableHandlers({
20139
20136
  toClear[key] = void 0;
20140
20137
  });
20141
20138
  setNewParams(toClear);
20142
- updateSearch();
20143
20139
  }
20144
20140
  __name(clearFilters, "clearFilters");
20145
20141
  function setPageSize(pageSize, currentParams) {
@@ -32996,13 +32992,13 @@ const SearchBar = /* @__PURE__ */ __name(({
32996
32992
  disabled,
32997
32993
  loading,
32998
32994
  type: "search",
32999
- name: "reduxFormSearchInput",
32995
+ defaultValue: searchInput,
33000
32996
  className: classNames("datatable-search-input", Classes.ROUND),
33001
32997
  placeholder: "Search..."
33002
32998
  }, onEnterHelper((e2) => {
33003
32999
  e2.preventDefault();
33004
33000
  e2.stopPropagation();
33005
- setSearchTerm(searchInput);
33001
+ setSearchTerm(e2.target.value);
33006
33002
  e2.nativeEvent.stopImmediatePropagation();
33007
33003
  })), {
33008
33004
  rightElement
@@ -52471,7 +52467,6 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
52471
52467
  reduxFormEditingCell,
52472
52468
  reduxFormEntities,
52473
52469
  reduxFormQueryParams: _reduxFormQueryParams = {},
52474
- reduxFormSearchInput: _reduxFormSearchInput = "",
52475
52470
  reduxFormSelectedEntityIdMap: _reduxFormSelectedEntityIdMap = {}
52476
52471
  } = useSelector(
52477
52472
  (state) => formValueSelector(formName)(
@@ -52479,13 +52474,11 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
52479
52474
  "reduxFormCellValidation",
52480
52475
  "reduxFormEntities",
52481
52476
  "reduxFormQueryParams",
52482
- "reduxFormSearchInput",
52483
52477
  "reduxFormSelectedEntityIdMap"
52484
52478
  )
52485
52479
  );
52486
52480
  const reduxFormCellValidation = useDeepEqualMemo(_reduxFormCellValidation);
52487
52481
  const reduxFormQueryParams = useDeepEqualMemo(_reduxFormQueryParams);
52488
- const reduxFormSearchInput = useDeepEqualMemo(_reduxFormSearchInput);
52489
52482
  const reduxFormSelectedEntityIdMap = useDeepEqualMemo(
52490
52483
  _reduxFormSelectedEntityIdMap
52491
52484
  );
@@ -52560,22 +52553,17 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
52560
52553
  });
52561
52554
  const _currentParams = useMemo(() => {
52562
52555
  const tmp = (urlConnected ? getCurrentParamsFromUrl(history.location) : reduxFormQueryParams) || {};
52563
- tmp.searchTerm = reduxFormSearchInput;
52564
52556
  return tmp;
52565
- }, [history, reduxFormQueryParams, reduxFormSearchInput, urlConnected]);
52557
+ }, [history, reduxFormQueryParams, urlConnected]);
52566
52558
  const currentParams = useDeepEqualMemo(_currentParams);
52567
52559
  const tableParams = useMemo(() => {
52568
52560
  if (!isTableParamsConnected) {
52569
- const updateSearch = /* @__PURE__ */ __name((val) => {
52570
- change$1("reduxFormSearchInput", val || "");
52571
- }, "updateSearch");
52572
52561
  const setNewParams2 = /* @__PURE__ */ __name((newParams) => {
52573
52562
  urlConnected && setCurrentParamsOnUrl(newParams, history.replace);
52574
52563
  change$1("reduxFormQueryParams", newParams);
52575
52564
  }, "setNewParams2");
52576
52565
  const bindThese = makeDataTableHandlers({
52577
52566
  setNewParams: setNewParams2,
52578
- updateSearch,
52579
52567
  defaults: defaults2,
52580
52568
  onlyOneFilter: props.onlyOneFilter
52581
52569
  });
@@ -54996,7 +54984,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
54996
54984
  )) : "", /* @__PURE__ */ React__default.createElement(
54997
54985
  SearchBar,
54998
54986
  {
54999
- searchInput: reduxFormSearchInput,
54987
+ searchInput: currentParams.searchTerm,
55000
54988
  setSearchTerm,
55001
54989
  loading: isLoading,
55002
54990
  searchMenuButton,
@@ -68594,31 +68582,22 @@ const useTableParams = /* @__PURE__ */ __name((props) => {
68594
68582
  }
68595
68583
  const {
68596
68584
  reduxFormQueryParams: _reduxFormQueryParams = {},
68597
- reduxFormSearchInput: _reduxFormSearchInput = "",
68598
68585
  reduxFormSelectedEntityIdMap: _reduxFormSelectedEntityIdMap = {}
68599
68586
  } = useSelector(
68600
68587
  (state) => formValueSelector(formName)(
68601
68588
  state,
68602
68589
  "reduxFormQueryParams",
68603
- "reduxFormSearchInput",
68604
68590
  "reduxFormSelectedEntityIdMap"
68605
68591
  )
68606
68592
  );
68607
68593
  const reduxFormQueryParams = useDeepEqualMemo(_reduxFormQueryParams);
68608
- const reduxFormSearchInput = useDeepEqualMemo(_reduxFormSearchInput);
68609
68594
  const reduxFormSelectedEntityIdMap = useDeepEqualMemo(
68610
68595
  _reduxFormSelectedEntityIdMap
68611
68596
  );
68612
68597
  const _currentParams = useMemo(() => {
68613
68598
  const tmp = (urlConnected ? getCurrentParamsFromUrl(history == null ? void 0 : history.location) : reduxFormQueryParams) || {};
68614
- tmp.searchTerm = reduxFormSearchInput;
68615
68599
  return tmp;
68616
- }, [
68617
- history == null ? void 0 : history.location,
68618
- reduxFormQueryParams,
68619
- reduxFormSearchInput,
68620
- urlConnected
68621
- ]);
68600
+ }, [history == null ? void 0 : history.location, reduxFormQueryParams, urlConnected]);
68622
68601
  const selectedEntities = useMemo(
68623
68602
  () => withSelectedEntities2 ? Object.values(reduxFormSelectedEntityIdMap).sort((a2, b2) => a2.rowIndex - b2.rowIndex).map((item) => item.entity) : void 0,
68624
68603
  [reduxFormSelectedEntityIdMap, withSelectedEntities2]
@@ -68639,11 +68618,12 @@ const useTableParams = /* @__PURE__ */ __name((props) => {
68639
68618
  formName: "tgDataTable"
68640
68619
  }, props), {
68641
68620
  pageSize: controlled_pageSize || pageSize,
68642
- defaults: defaultsToUse
68621
+ defaults: defaultsToUse,
68622
+ location: history.location
68643
68623
  }),
68644
68624
  // We don't want to rerender this every time a prop changes
68645
68625
  // eslint-disable-next-line react-hooks/exhaustive-deps
68646
- [controlled_pageSize, defaultsToUse, pageSize]
68626
+ [controlled_pageSize, defaultsToUse, pageSize, history.location]
68647
68627
  );
68648
68628
  const queryParams = useMemo(() => {
68649
68629
  const additionalFilterToUse = typeof additionalFilter === "function" ? additionalFilter.bind(void 0, passingProps) : () => additionalFilter;
@@ -68684,16 +68664,12 @@ const useTableParams = /* @__PURE__ */ __name((props) => {
68684
68664
  const dispatch = useDispatch();
68685
68665
  const tableParams = useMemo(() => {
68686
68666
  const change$1 = /* @__PURE__ */ __name((...args) => dispatch(change(formName, ...args)), "change$1");
68687
- const updateSearch = /* @__PURE__ */ __name((val) => {
68688
- change$1("reduxFormSearchInput", val || "");
68689
- }, "updateSearch");
68690
68667
  const setNewParams = /* @__PURE__ */ __name((newParams) => {
68691
68668
  urlConnected && setCurrentParamsOnUrl(newParams, history == null ? void 0 : history.replace);
68692
68669
  change$1("reduxFormQueryParams", newParams);
68693
68670
  }, "setNewParams");
68694
68671
  const bindThese = makeDataTableHandlers({
68695
68672
  setNewParams,
68696
- updateSearch,
68697
68673
  defaults: defaults2,
68698
68674
  onlyOneFilter
68699
68675
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/ui",
3
- "version": "0.5.23-beta.27",
3
+ "version": "0.5.23-beta.29",
4
4
  "main": "./src/index.js",
5
5
  "exports": {
6
6
  ".": {