@innovaccer/design-system 2.30.1 → 2.31.1
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/CHANGELOG.md +79 -0
- package/css/dist/index.css +60 -9
- package/css/dist/index.css.map +1 -1
- package/css/src/components/grid.css +24 -4
- package/css/src/components/listbox.css +18 -5
- package/css/src/components/table.css +14 -0
- package/dist/.lib/tsconfig.type.tsbuildinfo +26 -11
- package/dist/core/components/organisms/grid/Grid.d.ts +1 -1
- package/dist/core/components/organisms/grid/utility.d.ts +1 -1
- package/dist/core/components/organisms/table/Header.d.ts +7 -1
- package/dist/core/components/organisms/table/Table.d.ts +7 -0
- package/dist/core/components/organisms/table/utils.d.ts +3 -0
- package/dist/index.esm.js +377 -75
- package/dist/index.js +344 -54
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.br +0 -0
- package/dist/index.umd.js.gz +0 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* Generated on:
|
|
3
|
+
* Generated on: 1713523162818
|
|
4
4
|
* Package: @innovaccer/design-system
|
|
5
|
-
* Version: v2.
|
|
5
|
+
* Version: v2.31.1
|
|
6
6
|
* License: MIT
|
|
7
7
|
* Docs: https://innovaccer.github.io/design-system
|
|
8
8
|
*/
|
|
@@ -6910,6 +6910,7 @@
|
|
|
6910
6910
|
switch (eventType) {
|
|
6911
6911
|
case 'edit':
|
|
6912
6912
|
setEditing(true);
|
|
6913
|
+
setShowComponent(true);
|
|
6913
6914
|
break;
|
|
6914
6915
|
|
|
6915
6916
|
case 'hover':
|
|
@@ -6929,6 +6930,7 @@
|
|
|
6929
6930
|
|
|
6930
6931
|
var onClose = function onClose(selected) {
|
|
6931
6932
|
setEditing(false);
|
|
6933
|
+
setShowComponent(false);
|
|
6932
6934
|
if (onDropdownClose) onDropdownClose(selected);
|
|
6933
6935
|
};
|
|
6934
6936
|
|
|
@@ -9488,7 +9490,7 @@
|
|
|
9488
9490
|
var element = elementRef ? elementRef : childrenRef;
|
|
9489
9491
|
setIsTruncated(detectTruncation(element));
|
|
9490
9492
|
}, [childrenRef, elementRef]);
|
|
9491
|
-
var
|
|
9493
|
+
var renderChildren = elementRef || ! /*#__PURE__*/React__namespace.isValidElement(children) ? children : /*#__PURE__*/React__namespace.cloneElement(children, {
|
|
9492
9494
|
ref: childrenRef
|
|
9493
9495
|
});
|
|
9494
9496
|
|
|
@@ -9505,7 +9507,7 @@
|
|
|
9505
9507
|
|
|
9506
9508
|
if (showOnTruncation) {
|
|
9507
9509
|
return isTruncated ? /*#__PURE__*/React__namespace.createElement(Popover, __assign({
|
|
9508
|
-
trigger:
|
|
9510
|
+
trigger: renderChildren,
|
|
9509
9511
|
on: 'hover',
|
|
9510
9512
|
offset: 'medium'
|
|
9511
9513
|
}, rest, {
|
|
@@ -9514,7 +9516,7 @@
|
|
|
9514
9516
|
close: "Tooltip-animation-close-" + positionValue[props.position]
|
|
9515
9517
|
},
|
|
9516
9518
|
className: "Tooltip-container"
|
|
9517
|
-
}), tooltipWrapper) :
|
|
9519
|
+
}), tooltipWrapper) : renderChildren;
|
|
9518
9520
|
}
|
|
9519
9521
|
|
|
9520
9522
|
return /*#__PURE__*/React__namespace.createElement(Popover, __assign({
|
|
@@ -13861,7 +13863,14 @@
|
|
|
13861
13863
|
var getTotalPages = function getTotalPages(totalRecords, pageSize) {
|
|
13862
13864
|
return Math.ceil(totalRecords / pageSize);
|
|
13863
13865
|
};
|
|
13864
|
-
var getSelectAll = function getSelectAll(tableData, selectDisabledRow) {
|
|
13866
|
+
var getSelectAll = function getSelectAll(tableData, selectDisabledRow, clearSelection) {
|
|
13867
|
+
if (clearSelection) {
|
|
13868
|
+
return {
|
|
13869
|
+
indeterminate: false,
|
|
13870
|
+
checked: false
|
|
13871
|
+
};
|
|
13872
|
+
}
|
|
13873
|
+
|
|
13865
13874
|
var data = tableData.filter(function (d) {
|
|
13866
13875
|
return d.disabled && selectDisabledRow || !d.disabled;
|
|
13867
13876
|
});
|
|
@@ -14693,7 +14702,7 @@
|
|
|
14693
14702
|
var onSelectAll = _this.props.onSelectAll;
|
|
14694
14703
|
|
|
14695
14704
|
if (onSelectAll) {
|
|
14696
|
-
onSelectAll(event.target.checked);
|
|
14705
|
+
onSelectAll(event.target.checked, undefined, true);
|
|
14697
14706
|
}
|
|
14698
14707
|
};
|
|
14699
14708
|
|
|
@@ -15187,6 +15196,8 @@
|
|
|
15187
15196
|
};
|
|
15188
15197
|
|
|
15189
15198
|
var Header = function Header(props) {
|
|
15199
|
+
var _a;
|
|
15200
|
+
|
|
15190
15201
|
var loading = props.loading,
|
|
15191
15202
|
error = props.error,
|
|
15192
15203
|
data = props.data,
|
|
@@ -15200,11 +15211,11 @@
|
|
|
15200
15211
|
withCheckbox = props.withCheckbox,
|
|
15201
15212
|
children = props.children,
|
|
15202
15213
|
updateSchema = props.updateSchema,
|
|
15203
|
-
|
|
15204
|
-
filterList =
|
|
15214
|
+
_b = props.filterList,
|
|
15215
|
+
filterList = _b === void 0 ? {} : _b,
|
|
15205
15216
|
updateFilterList = props.updateFilterList,
|
|
15206
|
-
|
|
15207
|
-
totalRecords =
|
|
15217
|
+
_c = props.totalRecords,
|
|
15218
|
+
totalRecords = _c === void 0 ? 0 : _c,
|
|
15208
15219
|
onSelectAll = props.onSelectAll,
|
|
15209
15220
|
searchPlaceholder = props.searchPlaceholder,
|
|
15210
15221
|
selectAll = props.selectAll,
|
|
@@ -15214,16 +15225,73 @@
|
|
|
15214
15225
|
dynamicColumn = props.dynamicColumn,
|
|
15215
15226
|
allowSelectAll = props.allowSelectAll,
|
|
15216
15227
|
showFilters = props.showFilters,
|
|
15217
|
-
customSelectionLabel = props.customSelectionLabel
|
|
15228
|
+
customSelectionLabel = props.customSelectionLabel,
|
|
15229
|
+
selectedRowsRef = props.selectedRowsRef,
|
|
15230
|
+
selectedAllRef = props.selectedAllRef,
|
|
15231
|
+
onClearSelection = props.onClearSelection,
|
|
15232
|
+
onSelectAllRows = props.onSelectAllRows,
|
|
15233
|
+
selectionActionRenderer = props.selectionActionRenderer,
|
|
15234
|
+
uniqueColumnName = props.uniqueColumnName;
|
|
15218
15235
|
|
|
15219
|
-
var
|
|
15220
|
-
selectAllRecords =
|
|
15221
|
-
setSelectAllRecords =
|
|
15236
|
+
var _d = React__namespace.useState(false),
|
|
15237
|
+
selectAllRecords = _d[0],
|
|
15238
|
+
setSelectAllRecords = _d[1];
|
|
15239
|
+
|
|
15240
|
+
var _e = React__namespace.useState(true),
|
|
15241
|
+
flag = _e[0],
|
|
15242
|
+
setFlag = _e[1];
|
|
15243
|
+
|
|
15244
|
+
var customLabel = customSelectionLabel ? customSelectionLabel : 'item';
|
|
15245
|
+
var selectedCount = data.filter(function (d) {
|
|
15246
|
+
return d._selected;
|
|
15247
|
+
}).length;
|
|
15248
|
+
var startIndex = (page - 1) * pageSize + 1;
|
|
15249
|
+
var endIndex = Math.min(page * pageSize, totalRecords);
|
|
15250
|
+
var selectedRowsCount = (selectedAllRef === null || selectedAllRef === void 0 ? void 0 : selectedAllRef.current) === true ? totalRecords : ((_a = selectedRowsRef === null || selectedRowsRef === void 0 ? void 0 : selectedRowsRef.current) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
15251
|
+
var showSelectedRowLabel = withCheckbox && (selectedCount || selectedRowsCount > 0);
|
|
15252
|
+
|
|
15253
|
+
var _f = React__namespace.useState(true),
|
|
15254
|
+
showSelectedLabel = _f[0],
|
|
15255
|
+
setShowSelectedLabel = _f[1];
|
|
15256
|
+
|
|
15257
|
+
var _g = React__namespace.useState(false),
|
|
15258
|
+
animateSelectedLabel = _g[0],
|
|
15259
|
+
setAnimateSelectedLabel = _g[1];
|
|
15260
|
+
|
|
15261
|
+
var _h = React__namespace.useState(false),
|
|
15262
|
+
animateUnSelectedLabel = _h[0],
|
|
15263
|
+
setAnimateUnSelectedLabel = _h[1];
|
|
15264
|
+
|
|
15265
|
+
React__namespace.useEffect(function () {
|
|
15266
|
+
if (showSelectedRowLabel) {
|
|
15267
|
+
setAnimateUnSelectedLabel(true);
|
|
15268
|
+
setAnimateSelectedLabel(false);
|
|
15269
|
+
} else {
|
|
15270
|
+
setAnimateUnSelectedLabel(false);
|
|
15271
|
+
setAnimateSelectedLabel(true);
|
|
15272
|
+
}
|
|
15273
|
+
}, [showSelectedRowLabel]);
|
|
15222
15274
|
|
|
15223
|
-
var
|
|
15224
|
-
|
|
15225
|
-
|
|
15275
|
+
var onUnSelectAnimationEnd = function onUnSelectAnimationEnd() {
|
|
15276
|
+
showSelectedRowLabel ? setShowSelectedLabel(true) : setShowSelectedLabel(false);
|
|
15277
|
+
setAnimateSelectedLabel(true);
|
|
15278
|
+
setAnimateUnSelectedLabel(false);
|
|
15279
|
+
};
|
|
15226
15280
|
|
|
15281
|
+
var onSelectAnimationEnd = function onSelectAnimationEnd() {
|
|
15282
|
+
showSelectedRowLabel ? setShowSelectedLabel(true) : setShowSelectedLabel(false);
|
|
15283
|
+
setAnimateSelectedLabel(false);
|
|
15284
|
+
setAnimateUnSelectedLabel(true);
|
|
15285
|
+
};
|
|
15286
|
+
|
|
15287
|
+
var unselectedRowLabelClass = classNames__default["default"]({
|
|
15288
|
+
'Table-Header-Label--hide': animateUnSelectedLabel && showSelectedRowLabel,
|
|
15289
|
+
'Table-Header-Label--show': animateUnSelectedLabel && !showSelectedRowLabel
|
|
15290
|
+
});
|
|
15291
|
+
var selectedRowLabelClass = classNames__default["default"]({
|
|
15292
|
+
'Table-Header-Label--hide': animateSelectedLabel && !showSelectedRowLabel,
|
|
15293
|
+
'Table-Header-Label--show': animateSelectedLabel && showSelectedRowLabel
|
|
15294
|
+
});
|
|
15227
15295
|
React__namespace.useEffect(function () {
|
|
15228
15296
|
setFlag(!flag);
|
|
15229
15297
|
}, [schema]);
|
|
@@ -15276,13 +15344,28 @@
|
|
|
15276
15344
|
if (updateSchema) updateSchema(newSchema);
|
|
15277
15345
|
};
|
|
15278
15346
|
|
|
15279
|
-
var
|
|
15280
|
-
|
|
15281
|
-
|
|
15282
|
-
|
|
15283
|
-
|
|
15284
|
-
|
|
15285
|
-
|
|
15347
|
+
var getUnSelectedRowLabel = function getUnSelectedRowLabel() {
|
|
15348
|
+
if (error) {
|
|
15349
|
+
return "Showing 0 " + customLabel + "s";
|
|
15350
|
+
} else if (withPagination) {
|
|
15351
|
+
return "Showing " + startIndex + "-" + endIndex + " of " + totalRecords + " " + customLabel + getPluralSuffix(totalRecords);
|
|
15352
|
+
}
|
|
15353
|
+
|
|
15354
|
+
return "Showing " + totalRecords + " " + customLabel + getPluralSuffix(totalRecords);
|
|
15355
|
+
};
|
|
15356
|
+
|
|
15357
|
+
var getSelectedRowLabel = function getSelectedRowLabel() {
|
|
15358
|
+
if (selectedRowsCount > 0 && uniqueColumnName && withCheckbox) {
|
|
15359
|
+
return "Selected " + selectedRowsCount + " " + customLabel + getPluralSuffix(selectedRowsCount);
|
|
15360
|
+
} else if (selectedCount && !uniqueColumnName && withCheckbox) {
|
|
15361
|
+
return "Selected " + selectedCount + " " + customLabel + getPluralSuffix(selectedCount);
|
|
15362
|
+
} else if (withPagination) {
|
|
15363
|
+
return "Showing " + startIndex + "-" + endIndex + " of " + totalRecords + " " + customLabel + getPluralSuffix(totalRecords);
|
|
15364
|
+
}
|
|
15365
|
+
|
|
15366
|
+
return "Showing " + totalRecords + " " + customLabel + getPluralSuffix(totalRecords);
|
|
15367
|
+
};
|
|
15368
|
+
|
|
15286
15369
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
15287
15370
|
className: "Header"
|
|
15288
15371
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
@@ -15346,21 +15429,33 @@
|
|
|
15346
15429
|
}, /*#__PURE__*/React__namespace.createElement(PlaceholderParagraph, {
|
|
15347
15430
|
length: 'small',
|
|
15348
15431
|
size: 's'
|
|
15349
|
-
})) : /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null,
|
|
15350
|
-
className:
|
|
15351
|
-
|
|
15432
|
+
})) : /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, showSelectedLabel ? /*#__PURE__*/React__namespace.createElement("span", {
|
|
15433
|
+
className: selectedRowLabelClass,
|
|
15434
|
+
onAnimationEnd: onSelectAnimationEnd
|
|
15435
|
+
}, /*#__PURE__*/React__namespace.createElement(Label, null, getSelectedRowLabel())) : /*#__PURE__*/React__namespace.createElement("span", {
|
|
15436
|
+
className: unselectedRowLabelClass,
|
|
15437
|
+
onAnimationEnd: onUnSelectAnimationEnd
|
|
15438
|
+
}, /*#__PURE__*/React__namespace.createElement(Label, null, getUnSelectedRowLabel())), selectedRowsCount > 0 && allowSelectAll && showSelectedLabel && /*#__PURE__*/React__namespace.createElement("div", {
|
|
15439
|
+
className: selectedRowLabelClass
|
|
15440
|
+
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
15441
|
+
className: "ml-4 d-flex"
|
|
15442
|
+
}, /*#__PURE__*/React__namespace.createElement(Button, {
|
|
15352
15443
|
"data-test": "DesignSystem-Table-Header--selectAllItemsButton",
|
|
15353
15444
|
size: "tiny",
|
|
15354
|
-
|
|
15355
|
-
|
|
15356
|
-
|
|
15357
|
-
}, "Select all " + totalRecords + " " + customLabel + "s") : /*#__PURE__*/React__namespace.createElement(Button, {
|
|
15445
|
+
disabled: selectedRowsCount === totalRecords,
|
|
15446
|
+
onClick: onSelectAllRows
|
|
15447
|
+
}, "Select " + totalRecords + " " + customLabel + "s"), /*#__PURE__*/React__namespace.createElement(Button, {
|
|
15358
15448
|
"data-test": "DesignSystem-Table-Header--clearSelectionItemsButton",
|
|
15359
15449
|
size: "tiny",
|
|
15360
|
-
|
|
15361
|
-
|
|
15362
|
-
|
|
15363
|
-
|
|
15450
|
+
className: "ml-4",
|
|
15451
|
+
onClick: onClearSelection
|
|
15452
|
+
}, "Clear Selection"), selectionActionRenderer && /*#__PURE__*/React__namespace.createElement(Divider, {
|
|
15453
|
+
vertical: true,
|
|
15454
|
+
className: "mx-4 Table-Header--Divider"
|
|
15455
|
+
}))), selectionActionRenderer && selectedRowsCount > 0 && showSelectedLabel && /*#__PURE__*/React__namespace.createElement("div", {
|
|
15456
|
+
"data-test": "DesignSystem-Table-Header--ActionRenderer",
|
|
15457
|
+
className: selectedRowLabelClass
|
|
15458
|
+
}, selectionActionRenderer(selectedRowsRef === null || selectedRowsRef === void 0 ? void 0 : selectedRowsRef.current, selectedAllRef === null || selectedAllRef === void 0 ? void 0 : selectedAllRef.current)))), dynamicColumn && /*#__PURE__*/React__namespace.createElement("div", {
|
|
15364
15459
|
className: "Header-hideColumns"
|
|
15365
15460
|
}, /*#__PURE__*/React__namespace.createElement(DraggableDropdown, {
|
|
15366
15461
|
options: columnOptions,
|
|
@@ -15375,6 +15470,50 @@
|
|
|
15375
15470
|
showFilters: true
|
|
15376
15471
|
};
|
|
15377
15472
|
|
|
15473
|
+
var isElementPresent = function isElementPresent(list, uniqueColumnName, value) {
|
|
15474
|
+
var arr = list === null || list === void 0 ? void 0 : list.filter(function (item) {
|
|
15475
|
+
return item[uniqueColumnName] === value;
|
|
15476
|
+
});
|
|
15477
|
+
return arr.length > 0;
|
|
15478
|
+
};
|
|
15479
|
+
|
|
15480
|
+
var getUpdatedData = function getUpdatedData(data, selectedList, uniqueColumnName, isCancelSelection, isSelectAll) {
|
|
15481
|
+
var updatedData = data.map(function (item) {
|
|
15482
|
+
if (isSelectAll || item._selected && !isCancelSelection || uniqueColumnName && item[uniqueColumnName] && selectedList && isElementPresent(selectedList, uniqueColumnName, item[uniqueColumnName]) && !isCancelSelection) {
|
|
15483
|
+
item._selected = true;
|
|
15484
|
+
} else if (isCancelSelection) {
|
|
15485
|
+
item._selected = false;
|
|
15486
|
+
} else {
|
|
15487
|
+
item._selected = false;
|
|
15488
|
+
}
|
|
15489
|
+
|
|
15490
|
+
return item;
|
|
15491
|
+
});
|
|
15492
|
+
return updatedData;
|
|
15493
|
+
};
|
|
15494
|
+
|
|
15495
|
+
var uniqueByKey = function uniqueByKey(arr, key) {
|
|
15496
|
+
var list = new Set();
|
|
15497
|
+
return arr.filter(function (obj) {
|
|
15498
|
+
var value = obj[key];
|
|
15499
|
+
|
|
15500
|
+
if (list.has(value)) {
|
|
15501
|
+
return false;
|
|
15502
|
+
} else {
|
|
15503
|
+
list.add(value);
|
|
15504
|
+
return true;
|
|
15505
|
+
}
|
|
15506
|
+
});
|
|
15507
|
+
};
|
|
15508
|
+
|
|
15509
|
+
var removeDuplicate = function removeDuplicate(data, uniqueColumnName) {
|
|
15510
|
+
if (uniqueColumnName) {
|
|
15511
|
+
return uniqueByKey(data, uniqueColumnName);
|
|
15512
|
+
}
|
|
15513
|
+
|
|
15514
|
+
return data;
|
|
15515
|
+
};
|
|
15516
|
+
|
|
15378
15517
|
var defaultErrorTemplate = function defaultErrorTemplate(props) {
|
|
15379
15518
|
var _a = props.errorType,
|
|
15380
15519
|
errorType = _a === void 0 ? 'DEFAULT' : _a;
|
|
@@ -15418,6 +15557,10 @@
|
|
|
15418
15557
|
function Table(props) {
|
|
15419
15558
|
var _this = _super.call(this, props) || this;
|
|
15420
15559
|
|
|
15560
|
+
_this.selectedRowsRef = /*#__PURE__*/React__namespace.createRef();
|
|
15561
|
+
_this.clearSelectionRef = /*#__PURE__*/React__namespace.createRef();
|
|
15562
|
+
_this.selectAllRef = /*#__PURE__*/React__namespace.createRef();
|
|
15563
|
+
|
|
15421
15564
|
_this.updateData = function (searchUpdate) {
|
|
15422
15565
|
if (_this.state.async) {
|
|
15423
15566
|
_this.setState({
|
|
@@ -15438,7 +15581,8 @@
|
|
|
15438
15581
|
pageSize = _a.pageSize,
|
|
15439
15582
|
withPagination = _a.withPagination,
|
|
15440
15583
|
dataProp = _a.data,
|
|
15441
|
-
onSearch = _a.onSearch
|
|
15584
|
+
onSearch = _a.onSearch,
|
|
15585
|
+
uniqueColumnName = _a.uniqueColumnName;
|
|
15442
15586
|
var _b = _this.state,
|
|
15443
15587
|
async = _b.async,
|
|
15444
15588
|
page = _b.page,
|
|
@@ -15466,13 +15610,25 @@
|
|
|
15466
15610
|
fetchData(opts).then(function (res) {
|
|
15467
15611
|
if (!res.searchTerm || res.searchTerm && res.searchTerm === _this.state.searchTerm) {
|
|
15468
15612
|
var data = res.data;
|
|
15613
|
+
var dataReplica = JSON.parse(JSON.stringify(data));
|
|
15469
15614
|
var schema = _this.state.schema.length ? _this.state.schema : res.schema;
|
|
15615
|
+
var preSelectedRows = data.filter(function (item) {
|
|
15616
|
+
return item._selected;
|
|
15617
|
+
});
|
|
15618
|
+
|
|
15619
|
+
if (_this.clearSelectionRef.current) {
|
|
15620
|
+
_this.selectedRowsRef.current = [];
|
|
15621
|
+
} else {
|
|
15622
|
+
_this.selectedRowsRef.current = _this.selectedRowsRef.current ? removeDuplicate(__spreadArrays(_this.selectedRowsRef.current, preSelectedRows), uniqueColumnName) : removeDuplicate(__spreadArrays(preSelectedRows), uniqueColumnName);
|
|
15623
|
+
}
|
|
15624
|
+
|
|
15625
|
+
var selectedData = getUpdatedData(dataReplica, _this.selectedRowsRef.current, uniqueColumnName, _this.clearSelectionRef.current, _this.selectAllRef.current);
|
|
15470
15626
|
|
|
15471
15627
|
_this.setState({
|
|
15472
|
-
data:
|
|
15628
|
+
data: selectedData,
|
|
15473
15629
|
displayData: data,
|
|
15474
15630
|
schema: schema,
|
|
15475
|
-
selectAll: getSelectAll(
|
|
15631
|
+
selectAll: getSelectAll(selectedData, _this.props.selectDisabledRow, _this.clearSelectionRef.current),
|
|
15476
15632
|
totalRecords: res.count,
|
|
15477
15633
|
loading: false,
|
|
15478
15634
|
error: !data.length,
|
|
@@ -15500,23 +15656,73 @@
|
|
|
15500
15656
|
}
|
|
15501
15657
|
|
|
15502
15658
|
var renderedSchema = _this.state.schema.length ? _this.state.schema : schema;
|
|
15659
|
+
var preSelectedRows = renderedData.filter(function (item) {
|
|
15660
|
+
return item._selected;
|
|
15661
|
+
});
|
|
15662
|
+
var renderedDataReplica = JSON.parse(JSON.stringify(renderedData));
|
|
15663
|
+
|
|
15664
|
+
if (_this.clearSelectionRef.current) {
|
|
15665
|
+
_this.selectedRowsRef.current = [];
|
|
15666
|
+
} else {
|
|
15667
|
+
_this.selectedRowsRef.current = _this.selectedRowsRef.current ? removeDuplicate(__spreadArrays(_this.selectedRowsRef.current, preSelectedRows), uniqueColumnName) : removeDuplicate(__spreadArrays(preSelectedRows), uniqueColumnName);
|
|
15668
|
+
}
|
|
15669
|
+
|
|
15670
|
+
var selectedData = getUpdatedData(renderedDataReplica, _this.selectedRowsRef.current, uniqueColumnName, _this.clearSelectionRef.current, _this.selectAllRef.current);
|
|
15503
15671
|
|
|
15504
15672
|
_this.setState({
|
|
15505
15673
|
totalRecords: totalRecords,
|
|
15506
15674
|
error: !renderedData.length,
|
|
15507
15675
|
errorType: 'NO_RECORDS_FOUND',
|
|
15508
|
-
selectAll: getSelectAll(renderedData, _this.props.selectDisabledRow),
|
|
15676
|
+
selectAll: getSelectAll(renderedData, _this.props.selectDisabledRow, _this.clearSelectionRef.current),
|
|
15509
15677
|
schema: renderedSchema,
|
|
15510
15678
|
displayData: sortedData,
|
|
15511
|
-
data:
|
|
15679
|
+
data: selectedData
|
|
15512
15680
|
});
|
|
15513
15681
|
}
|
|
15514
15682
|
};
|
|
15515
15683
|
|
|
15516
15684
|
_this.onSelect = function (rowIndexes, selected) {
|
|
15517
15685
|
var data = _this.state.data;
|
|
15518
|
-
var
|
|
15686
|
+
var _a = _this.props,
|
|
15687
|
+
onSelect = _a.onSelect,
|
|
15688
|
+
uniqueColumnName = _a.uniqueColumnName;
|
|
15689
|
+
|
|
15690
|
+
if (_this.selectAllRef.current && rowIndexes !== -1 && !selected) {
|
|
15691
|
+
_this.selectAllRef.current = false;
|
|
15692
|
+
_this.selectedRowsRef.current = [];
|
|
15693
|
+
var indexes_1 = Array.from({
|
|
15694
|
+
length: data.length
|
|
15695
|
+
}, function (_, i) {
|
|
15696
|
+
return i;
|
|
15697
|
+
});
|
|
15698
|
+
var newData_1 = updateBatchData(data, indexes_1, {
|
|
15699
|
+
_selected: false
|
|
15700
|
+
}, _this.props.selectDisabledRow);
|
|
15701
|
+
|
|
15702
|
+
_this.setState({
|
|
15703
|
+
data: newData_1,
|
|
15704
|
+
selectAll: {
|
|
15705
|
+
checked: false,
|
|
15706
|
+
indeterminate: false
|
|
15707
|
+
}
|
|
15708
|
+
});
|
|
15709
|
+
|
|
15710
|
+
if (onSelect) {
|
|
15711
|
+
if (_this.props.uniqueColumnName) {
|
|
15712
|
+
onSelect(indexes_1, selected, _this.selectedRowsRef.current, _this.selectAllRef.current);
|
|
15713
|
+
} else {
|
|
15714
|
+
onSelect(indexes_1, selected, rowIndexes === -1 ? [] : newData_1.filter(function (d) {
|
|
15715
|
+
return d._selected;
|
|
15716
|
+
}));
|
|
15717
|
+
}
|
|
15718
|
+
}
|
|
15719
|
+
|
|
15720
|
+
return;
|
|
15721
|
+
}
|
|
15722
|
+
|
|
15519
15723
|
var indexes = [rowIndexes];
|
|
15724
|
+
var rowData = data[rowIndexes];
|
|
15725
|
+
var selectedItemList = rowIndexes === -1 ? [] : [rowData];
|
|
15520
15726
|
var newData = data;
|
|
15521
15727
|
|
|
15522
15728
|
if (rowIndexes >= 0) {
|
|
@@ -15524,21 +15730,45 @@
|
|
|
15524
15730
|
_selected: selected
|
|
15525
15731
|
}, _this.props.selectDisabledRow);
|
|
15526
15732
|
|
|
15733
|
+
_this.resetClearSelection();
|
|
15734
|
+
|
|
15527
15735
|
_this.setState({
|
|
15528
15736
|
data: newData,
|
|
15529
|
-
selectAll: getSelectAll(newData, _this.props.selectDisabledRow)
|
|
15737
|
+
selectAll: getSelectAll(newData, _this.props.selectDisabledRow, _this.clearSelectionRef.current)
|
|
15530
15738
|
});
|
|
15739
|
+
|
|
15740
|
+
if (_this.selectedRowsRef.current && selected) {
|
|
15741
|
+
selectedItemList = __spreadArrays([__assign(__assign({}, rowData), {
|
|
15742
|
+
_selected: selected
|
|
15743
|
+
})], _this.selectedRowsRef.current);
|
|
15744
|
+
}
|
|
15745
|
+
|
|
15746
|
+
if (!selected && uniqueColumnName) {
|
|
15747
|
+
selectedItemList = _this.selectedRowsRef.current.filter(function (item) {
|
|
15748
|
+
return item[uniqueColumnName] !== rowData[uniqueColumnName];
|
|
15749
|
+
});
|
|
15750
|
+
}
|
|
15751
|
+
|
|
15752
|
+
_this.selectedRowsRef.current = removeDuplicate(selectedItemList, uniqueColumnName);
|
|
15753
|
+
} else if (rowIndexes === -1 && _this.selectedRowsRef.current) {
|
|
15754
|
+
selectedItemList = _this.selectedRowsRef.current;
|
|
15531
15755
|
}
|
|
15532
15756
|
|
|
15533
15757
|
if (onSelect) {
|
|
15534
|
-
|
|
15535
|
-
|
|
15536
|
-
}
|
|
15758
|
+
if (_this.props.uniqueColumnName) {
|
|
15759
|
+
onSelect(indexes, selected, rowIndexes === -1 && (selectedItemList === null || selectedItemList === void 0 ? void 0 : selectedItemList.length) === 0 ? [] : _this.selectedRowsRef.current, _this.selectAllRef.current);
|
|
15760
|
+
} else {
|
|
15761
|
+
onSelect(indexes, selected, rowIndexes === -1 ? [] : newData.filter(function (d) {
|
|
15762
|
+
return d._selected;
|
|
15763
|
+
}));
|
|
15764
|
+
}
|
|
15537
15765
|
}
|
|
15538
15766
|
};
|
|
15539
15767
|
|
|
15540
|
-
_this.onSelectAll = function (selected, selectAll) {
|
|
15541
|
-
var
|
|
15768
|
+
_this.onSelectAll = function (selected, selectAll, headerCheckbox) {
|
|
15769
|
+
var _a = _this.props,
|
|
15770
|
+
onSelect = _a.onSelect,
|
|
15771
|
+
uniqueColumnName = _a.uniqueColumnName;
|
|
15542
15772
|
var data = _this.state.data;
|
|
15543
15773
|
var indexes = Array.from({
|
|
15544
15774
|
length: data.length
|
|
@@ -15554,11 +15784,43 @@
|
|
|
15554
15784
|
selectedIndex.push(key);
|
|
15555
15785
|
}
|
|
15556
15786
|
});
|
|
15787
|
+
var selectedData = [];
|
|
15557
15788
|
|
|
15558
|
-
if (
|
|
15559
|
-
|
|
15789
|
+
if (selected) {
|
|
15790
|
+
_this.resetClearSelection();
|
|
15791
|
+
|
|
15792
|
+
selectedData = selectAll === undefined ? __spreadArrays(_this.selectedRowsRef.current || [], newData.filter(function (d) {
|
|
15560
15793
|
return d._selected;
|
|
15561
|
-
})
|
|
15794
|
+
})) : _this.selectedRowsRef.current;
|
|
15795
|
+
} else if (!selected && headerCheckbox && uniqueColumnName) {
|
|
15796
|
+
_this.selectAllRef.current = false;
|
|
15797
|
+
_this.selectedRowsRef.current = __spreadArrays(_this.selectedRowsRef.current || [], newData);
|
|
15798
|
+
_this.selectedRowsRef.current = _this.selectedRowsRef.current.filter(function (item1) {
|
|
15799
|
+
return !newData.some(function (item2) {
|
|
15800
|
+
return item1[uniqueColumnName] === item2[uniqueColumnName];
|
|
15801
|
+
});
|
|
15802
|
+
});
|
|
15803
|
+
} else {
|
|
15804
|
+
_this.selectedRowsRef.current = [];
|
|
15805
|
+
_this.selectAllRef.current = false;
|
|
15806
|
+
}
|
|
15807
|
+
|
|
15808
|
+
if (!(headerCheckbox && !selected)) {
|
|
15809
|
+
_this.selectedRowsRef.current = removeDuplicate(selectedData, uniqueColumnName);
|
|
15810
|
+
}
|
|
15811
|
+
|
|
15812
|
+
if (onSelect) {
|
|
15813
|
+
if (_this.props.uniqueColumnName) {
|
|
15814
|
+
if (headerCheckbox && !selected) {
|
|
15815
|
+
onSelect(selectedIndex, selected, removeDuplicate(_this.selectedRowsRef.current, uniqueColumnName), _this.selectAllRef.current);
|
|
15816
|
+
} else {
|
|
15817
|
+
onSelect(selectedIndex, selected, removeDuplicate(selectedData, uniqueColumnName), _this.selectAllRef.current);
|
|
15818
|
+
}
|
|
15819
|
+
} else {
|
|
15820
|
+
onSelect(selectedIndex, selected, newData.filter(function (d) {
|
|
15821
|
+
return d._selected;
|
|
15822
|
+
}), selectAll);
|
|
15823
|
+
}
|
|
15562
15824
|
}
|
|
15563
15825
|
|
|
15564
15826
|
_this.setState({
|
|
@@ -15602,6 +15864,28 @@
|
|
|
15602
15864
|
});
|
|
15603
15865
|
};
|
|
15604
15866
|
|
|
15867
|
+
_this.onClearSelection = function () {
|
|
15868
|
+
_this.selectedRowsRef.current = [];
|
|
15869
|
+
_this.clearSelectionRef.current = true;
|
|
15870
|
+
_this.selectAllRef.current = false;
|
|
15871
|
+
|
|
15872
|
+
_this.onSelectAll(false);
|
|
15873
|
+
|
|
15874
|
+
_this.setState({
|
|
15875
|
+
selectAll: getSelectAll([], _this.props.selectDisabledRow, _this.clearSelectionRef.current)
|
|
15876
|
+
});
|
|
15877
|
+
};
|
|
15878
|
+
|
|
15879
|
+
_this.resetClearSelection = function () {
|
|
15880
|
+
_this.clearSelectionRef.current = false;
|
|
15881
|
+
};
|
|
15882
|
+
|
|
15883
|
+
_this.onSelectAllRows = function () {
|
|
15884
|
+
_this.selectAllRef.current = _this.props.uniqueColumnName ? true : false;
|
|
15885
|
+
|
|
15886
|
+
_this.onSelectAll(true, true);
|
|
15887
|
+
};
|
|
15888
|
+
|
|
15605
15889
|
var async = ('fetchData' in _this.props);
|
|
15606
15890
|
var data = props.data || [];
|
|
15607
15891
|
var schema = props.schema || [];
|
|
@@ -15707,7 +15991,8 @@
|
|
|
15707
15991
|
loaderSchema = _a.loaderSchema,
|
|
15708
15992
|
errorTemplate = _a.errorTemplate,
|
|
15709
15993
|
className = _a.className,
|
|
15710
|
-
filterPosition = _a.filterPosition
|
|
15994
|
+
filterPosition = _a.filterPosition,
|
|
15995
|
+
uniqueColumnName = _a.uniqueColumnName;
|
|
15711
15996
|
var baseProps = extractBaseProps(this.props);
|
|
15712
15997
|
|
|
15713
15998
|
var _b = headerOptions,
|
|
@@ -15732,7 +16017,12 @@
|
|
|
15732
16017
|
withCheckbox: withCheckbox,
|
|
15733
16018
|
withPagination: withPagination,
|
|
15734
16019
|
pageSize: pageSize,
|
|
15735
|
-
showFilters: filterPosition === 'HEADER'
|
|
16020
|
+
showFilters: filterPosition === 'HEADER',
|
|
16021
|
+
selectedRowsRef: this.selectedRowsRef,
|
|
16022
|
+
onClearSelection: this.onClearSelection,
|
|
16023
|
+
onSelectAllRows: this.onSelectAllRows,
|
|
16024
|
+
selectedAllRef: this.selectAllRef,
|
|
16025
|
+
uniqueColumnName: uniqueColumnName
|
|
15736
16026
|
}, headerAttr), headerChildren)), /*#__PURE__*/React__namespace.createElement("div", {
|
|
15737
16027
|
className: "Table-grid"
|
|
15738
16028
|
}, /*#__PURE__*/React__namespace.createElement(Grid, __assign({}, this.state, {
|
|
@@ -20413,7 +20703,7 @@
|
|
|
20413
20703
|
position: 'bottom-start'
|
|
20414
20704
|
};
|
|
20415
20705
|
|
|
20416
|
-
var version = "2.
|
|
20706
|
+
var version = "2.31.1";
|
|
20417
20707
|
|
|
20418
20708
|
exports.ActionCard = ActionCard;
|
|
20419
20709
|
exports.Avatar = Avatar;
|