@luminati-io/uikit 3.3.5-beta.1 → 3.3.5
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,22 @@ 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
|
+
setTimeout(function () {
|
43540
|
+
onSelectRows(state.selectedRowIds);
|
43541
|
+
}, 0);
|
43542
|
+
}
|
43543
|
+
}
|
43544
|
+
return state;
|
43545
|
+
}
|
43532
43546
|
var useInstance = function useInstance(instance) {
|
43533
|
-
var
|
43534
|
-
dispatch = instance.dispatch,
|
43535
|
-
state = instance.state,
|
43547
|
+
var dispatch = instance.dispatch,
|
43536
43548
|
initialState = instance.initialState;
|
43537
|
-
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
|
43538
|
-
if (onSelectRows) onSelectRows(state.selectedRowIds);
|
43539
|
-
}, [onSelectRows, state.selectedRowIds]);
|
43540
43549
|
(0,_hooks__WEBPACK_IMPORTED_MODULE_3__.useDidUpdate)(function () {
|
43541
|
-
console.log('ch', initialState.selectedRowIds);
|
43542
43550
|
dispatch({
|
43543
43551
|
type: react_table__WEBPACK_IMPORTED_MODULE_1__.actions.resetSelectedRows
|
43544
43552
|
});
|
@@ -43562,10 +43570,6 @@ var useSelectRows = function useSelectRows(hooks) {
|
|
43562
43570
|
hooks.visibleColumns.push(function (columns, _ref2) {
|
43563
43571
|
var instance = _ref2.instance;
|
43564
43572
|
if (!instance.onSelectRows) return columns;
|
43565
|
-
var onClick = function onClick(e) {
|
43566
|
-
// e.preventDefault();
|
43567
|
-
e.stopPropagation();
|
43568
|
-
};
|
43569
43573
|
// Let's make a column for selection
|
43570
43574
|
return [{
|
43571
43575
|
id: 'selection',
|
@@ -43579,9 +43583,7 @@ var useSelectRows = function useSelectRows(hooks) {
|
|
43579
43583
|
// method to the render a checkbox
|
43580
43584
|
Cell: function Cell(_ref4) {
|
43581
43585
|
var row = _ref4.row;
|
43582
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(
|
43583
|
-
onClick: onClick
|
43584
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(IndeterminateCheckbox, row.getToggleRowSelectedProps()));
|
43586
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(IndeterminateCheckbox, row.getToggleRowSelectedProps());
|
43585
43587
|
},
|
43586
43588
|
disableResizing: true,
|
43587
43589
|
disableHiding: true,
|
@@ -43591,6 +43593,7 @@ var useSelectRows = function useSelectRows(hooks) {
|
|
43591
43593
|
minWidth: WIDTH
|
43592
43594
|
}].concat(_toConsumableArray(columns));
|
43593
43595
|
});
|
43596
|
+
hooks.stateReducers.push(reducer);
|
43594
43597
|
hooks.useInstance.push(useInstance);
|
43595
43598
|
hooks.getHeaderProps.push(function (props, _ref5) {
|
43596
43599
|
var instance = _ref5.instance,
|