@luminati-io/uikit 3.3.5-beta.1 → 3.3.5-beta.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -43516,7 +43516,9 @@ var WIDTH = 54;
43516
43516
  var IndeterminateCheckbox = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function (_ref, ref) {
43517
43517
  var onChange = _ref.onChange,
43518
43518
  rest = _objectWithoutProperties(_ref, _excluded);
43519
- var handleChange = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (checked) {
43519
+ var handleChange = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (checked, evt) {
43520
+ evt.preventDefault();
43521
+ evt.stopPropagation();
43520
43522
  onChange === null || onChange === void 0 ? void 0 : onChange({
43521
43523
  target: {
43522
43524
  checked: checked
@@ -43529,16 +43531,21 @@ var IndeterminateCheckbox = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.f
43529
43531
  }, rest));
43530
43532
  });
43531
43533
  IndeterminateCheckbox.displayName = 'IndeterminateCheckbox';
43534
+ function reducer(state, action, _previousState, instance) {
43535
+ var onSelectRows = instance.onSelectRows;
43536
+ if (onSelectRows) {
43537
+ // if (action.type === actions.resetSelectedRows)
43538
+ if (action.type == react_table__WEBPACK_IMPORTED_MODULE_1__.actions.toggleAllRowsSelected || action.type == react_table__WEBPACK_IMPORTED_MODULE_1__.actions.toggleRowSelected || action.type == react_table__WEBPACK_IMPORTED_MODULE_1__.actions.toggleAllPageRowsSelected) {
43539
+ onSelectRows(state.selectedRowIds);
43540
+ }
43541
+ }
43542
+ return state;
43543
+ }
43532
43544
  var useInstance = function useInstance(instance) {
43533
- var onSelectRows = instance.onSelectRows,
43534
- dispatch = instance.dispatch,
43535
- state = instance.state,
43545
+ var dispatch = instance.dispatch,
43536
43546
  initialState = instance.initialState;
43537
- (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
43538
- if (onSelectRows) onSelectRows(state.selectedRowIds);
43539
- }, [onSelectRows, state.selectedRowIds]);
43540
43547
  (0,_hooks__WEBPACK_IMPORTED_MODULE_3__.useDidUpdate)(function () {
43541
- console.log('ch', initialState.selectedRowIds);
43548
+ console.log('did update', initialState.selectedRowIds);
43542
43549
  dispatch({
43543
43550
  type: react_table__WEBPACK_IMPORTED_MODULE_1__.actions.resetSelectedRows
43544
43551
  });
@@ -43562,10 +43569,6 @@ var useSelectRows = function useSelectRows(hooks) {
43562
43569
  hooks.visibleColumns.push(function (columns, _ref2) {
43563
43570
  var instance = _ref2.instance;
43564
43571
  if (!instance.onSelectRows) return columns;
43565
- var onClick = function onClick(e) {
43566
- // e.preventDefault();
43567
- e.stopPropagation();
43568
- };
43569
43572
  // Let's make a column for selection
43570
43573
  return [{
43571
43574
  id: 'selection',
@@ -43579,9 +43582,7 @@ var useSelectRows = function useSelectRows(hooks) {
43579
43582
  // method to the render a checkbox
43580
43583
  Cell: function Cell(_ref4) {
43581
43584
  var row = _ref4.row;
43582
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
43583
- onClick: onClick
43584
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(IndeterminateCheckbox, row.getToggleRowSelectedProps()));
43585
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(IndeterminateCheckbox, row.getToggleRowSelectedProps());
43585
43586
  },
43586
43587
  disableResizing: true,
43587
43588
  disableHiding: true,
@@ -43591,6 +43592,7 @@ var useSelectRows = function useSelectRows(hooks) {
43591
43592
  minWidth: WIDTH
43592
43593
  }].concat(_toConsumableArray(columns));
43593
43594
  });
43595
+ hooks.stateReducers.push(reducer);
43594
43596
  hooks.useInstance.push(useInstance);
43595
43597
  hooks.getHeaderProps.push(function (props, _ref5) {
43596
43598
  var instance = _ref5.instance,