@carbon/ibm-products 2.43.2-canary.211 → 2.43.2-canary.212
Sign up to get free protection for your applications and to get access to all the features.
@@ -148,11 +148,13 @@ var stateReducer = function stateReducer(newState, action) {
|
|
148
148
|
isChecked = _ref5.isChecked;
|
149
149
|
var newSelectedRowIds = {};
|
150
150
|
if (rows) {
|
151
|
+
var _rows$find, _rows$find$getRowProp;
|
151
152
|
var newSelectedRowData = {};
|
153
|
+
var nonSelectableRows = ((_rows$find = rows.find(function (row) {
|
154
|
+
return row.getRowProps;
|
155
|
+
})) === null || _rows$find === void 0 || (_rows$find$getRowProp = _rows$find.getRowProps) === null || _rows$find$getRowProp === void 0 || (_rows$find$getRowProp = _rows$find$getRowProp.call(_rows$find)) === null || _rows$find$getRowProp === void 0 ? void 0 : _rows$find$getRowProp.nonselectablerows) || [];
|
152
156
|
rows.forEach(function (row) {
|
153
|
-
|
154
|
-
var props = (_row$getRowProps = row.getRowProps) === null || _row$getRowProps === void 0 ? void 0 : _row$getRowProps.call(row);
|
155
|
-
if (props && props.disabled) {
|
157
|
+
if (nonSelectableRows.length > 0 && nonSelectableRows.includes(row.id)) {
|
156
158
|
return;
|
157
159
|
}
|
158
160
|
newSelectedRowIds[getRowId(row.original, row.index)] = true;
|
@@ -178,8 +180,8 @@ var stateReducer = function stateReducer(newState, action) {
|
|
178
180
|
if (_rows) {
|
179
181
|
var _newSelectedRowData = {};
|
180
182
|
_rows.forEach(function (row) {
|
181
|
-
var _row$
|
182
|
-
var props = (_row$
|
183
|
+
var _row$getRowProps;
|
184
|
+
var props = (_row$getRowProps = row.getRowProps) === null || _row$getRowProps === void 0 ? void 0 : _row$getRowProps.call(row);
|
183
185
|
if (props && props.disabled) {
|
184
186
|
return;
|
185
187
|
}
|
@@ -5,24 +5,39 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
+
var nonselectablerowsList = function nonselectablerowsList(instance) {
|
9
|
+
var _instance$rows;
|
10
|
+
var nonselectablerows = (instance === null || instance === void 0 || (_instance$rows = instance.rows) === null || _instance$rows === void 0 ? void 0 : _instance$rows.filter(function (row) {
|
11
|
+
return instance.shouldDisableSelectRow && instance.shouldDisableSelectRow(row);
|
12
|
+
}).map(function (row) {
|
13
|
+
return row.id;
|
14
|
+
})) || [];
|
15
|
+
return nonselectablerows;
|
16
|
+
};
|
8
17
|
var useDisableSelectRows = function useDisableSelectRows(hooks) {
|
9
18
|
updateSelectAll(hooks);
|
10
19
|
updatePageSelectAll(hooks);
|
20
|
+
var nonselectablerows = [];
|
21
|
+
var useInstance = function useInstance(instance) {
|
22
|
+
nonselectablerows = nonselectablerowsList(instance);
|
23
|
+
};
|
24
|
+
hooks.useInstance.push(useInstance);
|
11
25
|
var getRowProps = function getRowProps(props, _ref) {
|
12
26
|
var _instance$shouldDisab;
|
13
27
|
var row = _ref.row,
|
14
28
|
instance = _ref.instance;
|
15
29
|
return [props, {
|
16
|
-
disabled: instance === null || instance === void 0 || (_instance$shouldDisab = instance.shouldDisableSelectRow) === null || _instance$shouldDisab === void 0 ? void 0 : _instance$shouldDisab.call(instance, row)
|
30
|
+
disabled: instance === null || instance === void 0 || (_instance$shouldDisab = instance.shouldDisableSelectRow) === null || _instance$shouldDisab === void 0 ? void 0 : _instance$shouldDisab.call(instance, row),
|
31
|
+
nonselectablerows: nonselectablerows
|
17
32
|
}];
|
18
33
|
};
|
19
34
|
hooks.getRowProps.push(getRowProps);
|
20
35
|
};
|
21
36
|
var updateSelectAll = function updateSelectAll(hooks) {
|
22
37
|
var getToggleAllRowsSelectedProps = function getToggleAllRowsSelectedProps(props, _ref2) {
|
23
|
-
var _instance$
|
38
|
+
var _instance$rows2, _instance$disableSele, _instance$state2;
|
24
39
|
var instance = _ref2.instance;
|
25
|
-
var selectableRows = (instance === null || instance === void 0 || (_instance$
|
40
|
+
var selectableRows = (instance === null || instance === void 0 || (_instance$rows2 = instance.rows) === null || _instance$rows2 === void 0 ? void 0 : _instance$rows2.filter(function (row) {
|
26
41
|
return !(instance.shouldDisableSelectRow && instance.shouldDisableSelectRow(row));
|
27
42
|
})) || [];
|
28
43
|
var isAllRowsSelected = (selectableRows === null || selectableRows === void 0 ? void 0 : selectableRows.length) > 0 && selectableRows.every(function (_ref3) {
|
@@ -152,11 +152,13 @@ var stateReducer = function stateReducer(newState, action) {
|
|
152
152
|
isChecked = _ref5.isChecked;
|
153
153
|
var newSelectedRowIds = {};
|
154
154
|
if (rows) {
|
155
|
+
var _rows$find, _rows$find$getRowProp;
|
155
156
|
var newSelectedRowData = {};
|
157
|
+
var nonSelectableRows = ((_rows$find = rows.find(function (row) {
|
158
|
+
return row.getRowProps;
|
159
|
+
})) === null || _rows$find === void 0 || (_rows$find$getRowProp = _rows$find.getRowProps) === null || _rows$find$getRowProp === void 0 || (_rows$find$getRowProp = _rows$find$getRowProp.call(_rows$find)) === null || _rows$find$getRowProp === void 0 ? void 0 : _rows$find$getRowProp.nonselectablerows) || [];
|
156
160
|
rows.forEach(function (row) {
|
157
|
-
|
158
|
-
var props = (_row$getRowProps = row.getRowProps) === null || _row$getRowProps === void 0 ? void 0 : _row$getRowProps.call(row);
|
159
|
-
if (props && props.disabled) {
|
161
|
+
if (nonSelectableRows.length > 0 && nonSelectableRows.includes(row.id)) {
|
160
162
|
return;
|
161
163
|
}
|
162
164
|
newSelectedRowIds[getRowId(row.original, row.index)] = true;
|
@@ -182,8 +184,8 @@ var stateReducer = function stateReducer(newState, action) {
|
|
182
184
|
if (_rows) {
|
183
185
|
var _newSelectedRowData = {};
|
184
186
|
_rows.forEach(function (row) {
|
185
|
-
var _row$
|
186
|
-
var props = (_row$
|
187
|
+
var _row$getRowProps;
|
188
|
+
var props = (_row$getRowProps = row.getRowProps) === null || _row$getRowProps === void 0 ? void 0 : _row$getRowProps.call(row);
|
187
189
|
if (props && props.disabled) {
|
188
190
|
return;
|
189
191
|
}
|
@@ -9,24 +9,39 @@
|
|
9
9
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
11
11
|
|
12
|
+
var nonselectablerowsList = function nonselectablerowsList(instance) {
|
13
|
+
var _instance$rows;
|
14
|
+
var nonselectablerows = (instance === null || instance === void 0 || (_instance$rows = instance.rows) === null || _instance$rows === void 0 ? void 0 : _instance$rows.filter(function (row) {
|
15
|
+
return instance.shouldDisableSelectRow && instance.shouldDisableSelectRow(row);
|
16
|
+
}).map(function (row) {
|
17
|
+
return row.id;
|
18
|
+
})) || [];
|
19
|
+
return nonselectablerows;
|
20
|
+
};
|
12
21
|
var useDisableSelectRows = function useDisableSelectRows(hooks) {
|
13
22
|
updateSelectAll(hooks);
|
14
23
|
updatePageSelectAll(hooks);
|
24
|
+
var nonselectablerows = [];
|
25
|
+
var useInstance = function useInstance(instance) {
|
26
|
+
nonselectablerows = nonselectablerowsList(instance);
|
27
|
+
};
|
28
|
+
hooks.useInstance.push(useInstance);
|
15
29
|
var getRowProps = function getRowProps(props, _ref) {
|
16
30
|
var _instance$shouldDisab;
|
17
31
|
var row = _ref.row,
|
18
32
|
instance = _ref.instance;
|
19
33
|
return [props, {
|
20
|
-
disabled: instance === null || instance === void 0 || (_instance$shouldDisab = instance.shouldDisableSelectRow) === null || _instance$shouldDisab === void 0 ? void 0 : _instance$shouldDisab.call(instance, row)
|
34
|
+
disabled: instance === null || instance === void 0 || (_instance$shouldDisab = instance.shouldDisableSelectRow) === null || _instance$shouldDisab === void 0 ? void 0 : _instance$shouldDisab.call(instance, row),
|
35
|
+
nonselectablerows: nonselectablerows
|
21
36
|
}];
|
22
37
|
};
|
23
38
|
hooks.getRowProps.push(getRowProps);
|
24
39
|
};
|
25
40
|
var updateSelectAll = function updateSelectAll(hooks) {
|
26
41
|
var getToggleAllRowsSelectedProps = function getToggleAllRowsSelectedProps(props, _ref2) {
|
27
|
-
var _instance$
|
42
|
+
var _instance$rows2, _instance$disableSele, _instance$state2;
|
28
43
|
var instance = _ref2.instance;
|
29
|
-
var selectableRows = (instance === null || instance === void 0 || (_instance$
|
44
|
+
var selectableRows = (instance === null || instance === void 0 || (_instance$rows2 = instance.rows) === null || _instance$rows2 === void 0 ? void 0 : _instance$rows2.filter(function (row) {
|
30
45
|
return !(instance.shouldDisableSelectRow && instance.shouldDisableSelectRow(row));
|
31
46
|
})) || [];
|
32
47
|
var isAllRowsSelected = (selectableRows === null || selectableRows === void 0 ? void 0 : selectableRows.length) > 0 && selectableRows.every(function (_ref3) {
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@carbon/ibm-products",
|
3
3
|
"description": "Carbon for IBM Products",
|
4
|
-
"version": "2.43.2-canary.
|
4
|
+
"version": "2.43.2-canary.212+01d973f95",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "lib/index.js",
|
7
7
|
"module": "es/index.js",
|
@@ -120,5 +120,5 @@
|
|
120
120
|
"react": "^16.8.6 || ^17.0.1 || ^18.2.0",
|
121
121
|
"react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0"
|
122
122
|
},
|
123
|
-
"gitHead": "
|
123
|
+
"gitHead": "01d973f95256ee174e59c902e4c46ddc4781b13f"
|
124
124
|
}
|