@economic/taco 2.10.1 → 2.11.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -16977,18 +16977,7 @@ function useSettingsStateListener$1(table, onChangeSettings) {
16977
16977
  let handler;
16978
16978
  if (typeof onChangeSettings === 'function') {
16979
16979
  handler = setTimeout(() => {
16980
- onChangeSettings({
16981
- // adding a new setting? you need to add it to the print settings in PrintButton.tsx!
16982
- columnFreezingIndex: meta.columnFreezing.frozenColumnIndex,
16983
- columnOrder: meta.columnOrdering.isEnabled ? state.columnOrder : undefined,
16984
- columnSizing: table.options.enableColumnResizing ? state.columnSizing : undefined,
16985
- columnVisibility: table.options.enableHiding ? state.columnVisibility : undefined,
16986
- excludeUnmatchedRecordsInSearch: meta.search.excludeUnmatchedResults,
16987
- fontSize: meta.fontSize.isEnabled ? meta.fontSize.size : undefined,
16988
- rowHeight: meta.rowHeight.isEnabled ? meta.rowHeight.height : undefined,
16989
- showWarningWhenPrintingLargeDataset: meta.printing.printWarningDialogVisibility,
16990
- sorting: state.sorting
16991
- });
16980
+ onChangeSettings(meta.getSettings());
16992
16981
  }, 250);
16993
16982
  }
16994
16983
  return () => clearTimeout(handler);
@@ -18938,6 +18927,20 @@ function useTable$2(props) {
18938
18927
  }
18939
18928
  return state;
18940
18929
  }, []);
18930
+ const getSettings = () => {
18931
+ const state = table.getState();
18932
+ return {
18933
+ columnFreezingIndex: columnFreezing.frozenColumnIndex,
18934
+ columnOrder: columnOrdering.isEnabled ? state.columnOrder : undefined,
18935
+ columnSizing: table.options.enableColumnResizing ? state.columnSizing : undefined,
18936
+ columnVisibility: table.options.enableHiding ? state.columnVisibility : undefined,
18937
+ excludeUnmatchedRecordsInSearch: search.excludeUnmatchedResults,
18938
+ fontSize: fontSize.isEnabled ? fontSize.size : undefined,
18939
+ rowHeight: rowHeight.isEnabled ? rowHeight.height : undefined,
18940
+ showWarningWhenPrintingLargeDataset: printing.printWarningDialogVisibility,
18941
+ sorting: state.sorting
18942
+ };
18943
+ };
18941
18944
  const table = reactTable$1.useReactTable({
18942
18945
  data: props.data,
18943
18946
  columns,
@@ -18952,6 +18955,7 @@ function useTable$2(props) {
18952
18955
  editing,
18953
18956
  enableFooter: options.enableFooter,
18954
18957
  fontSize,
18958
+ getSettings,
18955
18959
  hoverState,
18956
18960
  isPrinting: props.id.endsWith('_print'),
18957
18961
  isUsingServer: !!props.loadPage,
@@ -20771,6 +20775,7 @@ function FontSize$1(props) {
20771
20775
 
20772
20776
  function SettingsButton(props) {
20773
20777
  const {
20778
+ customSettings,
20774
20779
  table
20775
20780
  } = props;
20776
20781
  const {
@@ -20813,7 +20818,10 @@ function SettingsButton(props) {
20813
20818
  subMenu: () => /*#__PURE__*/React__default.createElement(FontSize$1, {
20814
20819
  table: table
20815
20820
  })
20816
- }, texts.table3.fontSize.tooltip) : null)),
20821
+ }, texts.table3.fontSize.tooltip) : null, customSettings ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Menu$1.Separator, null), customSettings.map(customSetting => {
20822
+ const props = tableMeta.getSettings();
20823
+ return customSetting(props);
20824
+ })) : null)),
20817
20825
  popover: popoverElement,
20818
20826
  onClickCapture: event => event.preventDefault(),
20819
20827
  tooltip: texts.table3.otherOptions.tooltip
@@ -20822,6 +20830,7 @@ function SettingsButton(props) {
20822
20830
 
20823
20831
  function Toolbar(props) {
20824
20832
  const {
20833
+ customSettings,
20825
20834
  left,
20826
20835
  right,
20827
20836
  scrollToIndex,
@@ -20847,7 +20856,8 @@ function Toolbar(props) {
20847
20856
  table: table,
20848
20857
  tableProps: tableProps
20849
20858
  }) : null, isSettingsVisible(props) ? /*#__PURE__*/React__default.createElement(SettingsButton, {
20850
- table: table
20859
+ table: table,
20860
+ customSettings: customSettings
20851
20861
  }) : null, tableMeta.search.isEnabled ? /*#__PURE__*/React__default.createElement(Search$3, {
20852
20862
  scrollToIndex: scrollToIndex,
20853
20863
  table: table
@@ -21127,6 +21137,7 @@ const fixedForwardRef = React__default.forwardRef;
21127
21137
  const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
21128
21138
  const {
21129
21139
  emptyState: EmptyState,
21140
+ customSettings,
21130
21141
  toolbarLeft,
21131
21142
  toolbarRight
21132
21143
  } = props;
@@ -21218,6 +21229,7 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
21218
21229
  total: length,
21219
21230
  left: toolbarLeft,
21220
21231
  right: toolbarRight,
21232
+ customSettings: customSettings,
21221
21233
  scrollToIndex: scrollToIndex
21222
21234
  }), /*#__PURE__*/React__default.createElement("div", {
21223
21235
  className: className,