@pdg/react-table 1.0.53 → 1.0.55

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/dist/index.js CHANGED
@@ -2872,13 +2872,15 @@ var TableBodyCell = function (_a) {
2872
2872
  var item = _a.item, index = _a.index, column = _a.column, defaultAlign = _a.defaultAlign, defaultEllipsis = _a.defaultEllipsis, onClick = _a.onClick, onCheckChange = _a.onCheckChange;
2873
2873
  var _b = useTableState(), menuOpen = _b.menuOpen, setItemColumnChecked = _b.setItemColumnChecked, setItemColumnCheckDisabled = _b.setItemColumnCheckDisabled, setItemColumnCommands = _b.setItemColumnCommands;
2874
2874
  // State -------------------------------------------------------------------------------------------------------------
2875
- var _c = React.useState(false), checked = _c[0], setChecked = _c[1];
2876
- var _d = React.useState(false), checkDisabled = _d[0], setCheckDisabled = _d[1];
2875
+ var _c = React.useState(false), initialized = _c[0], setInitialized = _c[1];
2876
+ var _d = React.useState(false), checked = _d[0], setChecked = _d[1];
2877
+ var _e = React.useState(false), checkDisabled = _e[0], setCheckDisabled = _e[1];
2877
2878
  // Effect ------------------------------------------------------------------------------------------------------------
2878
2879
  React.useEffect(function () {
2879
2880
  if (column.type === 'check') {
2880
2881
  setChecked(column.onInitChecked ? column.onInitChecked(item) : false);
2881
2882
  setCheckDisabled(column.onCheckDisabled ? column.onCheckDisabled(item) : false);
2883
+ setInitialized(true);
2882
2884
  }
2883
2885
  setItemColumnCommands(item, column, {
2884
2886
  setChecked: function (checked) {
@@ -2896,14 +2898,9 @@ var TableBodyCell = function (_a) {
2896
2898
  React.useEffect(function () {
2897
2899
  if (column.type === 'check') {
2898
2900
  setItemColumnChecked(item, column, checked);
2899
- column.onCheckChange && column.onCheckChange(item, checked);
2900
- }
2901
- // eslint-disable-next-line react-hooks/exhaustive-deps
2902
- }, [checked]);
2903
- React.useEffect(function () {
2904
- if (column.type === 'check') {
2905
- setItemColumnChecked(item, column, checked);
2906
- column.onCheckChange && column.onCheckChange(item, checked);
2901
+ if (initialized) {
2902
+ column.onCheckChange && column.onCheckChange(item, checked);
2903
+ }
2907
2904
  }
2908
2905
  // eslint-disable-next-line react-hooks/exhaustive-deps
2909
2906
  }, [checked]);