@innovaccer/design-system 2.31.0 → 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 CHANGED
@@ -1,3 +1,39 @@
1
+ ## 2.31.1 (2024-04-19)
2
+
3
+ ### Highlights
4
+
5
+ - fix(table): update table selection behaviour in sync table (aa39ac56)
6
+
7
+ ### Breaking changes
8
+
9
+ NA
10
+
11
+ ### Migration guide
12
+
13
+ NA
14
+
15
+ ### Deprecations
16
+
17
+ NA
18
+
19
+ ### Features
20
+
21
+ NA
22
+
23
+ ### Fixes
24
+
25
+ - fix(table): update table selection behaviour in sync table (aa39ac56)
26
+
27
+ ### Improvements
28
+
29
+ NA
30
+
31
+ ### Documentation
32
+
33
+ NA
34
+
35
+ ---
36
+
1
37
  ## 2.31.0 (2024-04-15)
2
38
 
3
39
  ### Highlights
@@ -1442,17 +1442,17 @@
1442
1442
  "affectsGlobalScope": false
1443
1443
  },
1444
1444
  "../../core/components/organisms/table/Header.tsx": {
1445
- "version": "83707cf85387fcdd0fd573238510fd819ddcf64fe80fa8bee497b4ad71aa1040",
1445
+ "version": "0c26a544af7e767dfb90c62b7468dfe398ad7afbecc725114660d13fe34e1a04",
1446
1446
  "signature": "a15955f6aa0ca3d2d2cd6b8619b5a9bea81500fad8d18515c3914f8605e56688",
1447
1447
  "affectsGlobalScope": false
1448
1448
  },
1449
1449
  "../../core/components/organisms/table/utils.tsx": {
1450
- "version": "22c72eb66d3854b8f01f77cc7ea33e4b0ce02899b6499fd4bab695ea31ae32f7",
1451
- "signature": "2f9fd66ccdd1799bf995a0f8a5aa81cf3243a96fb874b5fa26fb433a99e752c5",
1450
+ "version": "312d0397081e5ffbcdb061b17e43c87964f05e6226bba2dbb27e8ea3d3855650",
1451
+ "signature": "1864c5d66715271163493b60731f982e9aa850ecd52ffab1c2835c73cd54660b",
1452
1452
  "affectsGlobalScope": false
1453
1453
  },
1454
1454
  "../../core/components/organisms/table/Table.tsx": {
1455
- "version": "420d8c23b537b8fa2bab3e7e16b0e1825b8b579dda20fd6d29128da3c97b388b",
1455
+ "version": "94b4a480a004cbf3758c812b10108002c5cea3c9144736602b7811e845338148",
1456
1456
  "signature": "d1b01f382f3550d66f528697b3255a8322e143078ff37888c1ad2a1db87f4dc2",
1457
1457
  "affectsGlobalScope": false
1458
1458
  },
@@ -1,3 +1,3 @@
1
1
  import { RowData, GridProps } from "../grid";
2
- export declare const getUpdatedData: (data: GridProps['data'], uniqueColumnName: string, selectedList: [], isCancelSelection?: boolean | undefined, isSelectAll?: boolean | undefined) => RowData[];
3
- export declare const removeDuplicate: (data: RowData[], uniqueColumnName: string) => RowData[];
2
+ export declare const getUpdatedData: (data: GridProps['data'], selectedList: [], uniqueColumnName?: string | undefined, isCancelSelection?: boolean | undefined, isSelectAll?: boolean | undefined) => RowData[];
3
+ export declare const removeDuplicate: (data: RowData[], uniqueColumnName?: string | undefined) => RowData[];
package/dist/index.esm.js CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  /**
3
- * Generated on: 1713188219337
3
+ * Generated on: 1713523162579
4
4
  * Package: @innovaccer/design-system
5
- * Version: v2.31.0
5
+ * Version: v2.31.1
6
6
  * License: MIT
7
7
  * Docs: https://innovaccer.github.io/design-system
8
8
  */
@@ -21007,9 +21007,11 @@ var Header = function Header(props) {
21007
21007
  return "Selected ".concat(selectedRowsCount, " ").concat(customLabel).concat(getPluralSuffix(selectedRowsCount));
21008
21008
  } else if (selectedCount && !uniqueColumnName && withCheckbox) {
21009
21009
  return "Selected ".concat(selectedCount, " ").concat(customLabel).concat(getPluralSuffix(selectedCount));
21010
+ } else if (withPagination) {
21011
+ return "Showing ".concat(startIndex, "-").concat(endIndex, " of ").concat(totalRecords, " ").concat(customLabel).concat(getPluralSuffix(totalRecords));
21010
21012
  }
21011
21013
 
21012
- return;
21014
+ return "Showing ".concat(totalRecords, " ").concat(customLabel).concat(getPluralSuffix(totalRecords));
21013
21015
  };
21014
21016
 
21015
21017
  return /*#__PURE__*/React.createElement("div", {
@@ -21123,9 +21125,9 @@ var isElementPresent = function isElementPresent(list, uniqueColumnName, value)
21123
21125
  return arr.length > 0;
21124
21126
  };
21125
21127
 
21126
- var getUpdatedData = function getUpdatedData(data, uniqueColumnName, selectedList, isCancelSelection, isSelectAll) {
21128
+ var getUpdatedData = function getUpdatedData(data, selectedList, uniqueColumnName, isCancelSelection, isSelectAll) {
21127
21129
  var updatedData = data.map(function (item) {
21128
- if (isSelectAll || item._selected && !isCancelSelection || item[uniqueColumnName] && selectedList && isElementPresent(selectedList, uniqueColumnName, item[uniqueColumnName]) && !isCancelSelection) {
21130
+ if (isSelectAll || item._selected && !isCancelSelection || uniqueColumnName && item[uniqueColumnName] && selectedList && isElementPresent(selectedList, uniqueColumnName, item[uniqueColumnName]) && !isCancelSelection) {
21129
21131
  item._selected = true;
21130
21132
  } else if (isCancelSelection) {
21131
21133
  item._selected = false;
@@ -21153,7 +21155,11 @@ var uniqueByKey = function uniqueByKey(arr, key) {
21153
21155
  };
21154
21156
 
21155
21157
  var removeDuplicate = function removeDuplicate(data, uniqueColumnName) {
21156
- return uniqueByKey(data, uniqueColumnName);
21158
+ if (uniqueColumnName) {
21159
+ return uniqueByKey(data, uniqueColumnName);
21160
+ }
21161
+
21162
+ return data;
21157
21163
  };
21158
21164
 
21159
21165
  var _excluded$l = ["children"];
@@ -21262,8 +21268,7 @@ var Table = /*#__PURE__*/function (_React$Component) {
21262
21268
  withPagination = _this$props.withPagination,
21263
21269
  dataProp = _this$props.data,
21264
21270
  onSearch = _this$props.onSearch,
21265
- _this$props$uniqueCol = _this$props.uniqueColumnName,
21266
- uniqueColumnName = _this$props$uniqueCol === void 0 ? 'id' : _this$props$uniqueCol;
21271
+ uniqueColumnName = _this$props.uniqueColumnName;
21267
21272
  var _this$state = _this.state,
21268
21273
  async = _this$state.async,
21269
21274
  page = _this$state.page,
@@ -21304,7 +21309,7 @@ var Table = /*#__PURE__*/function (_React$Component) {
21304
21309
  _this.selectedRowsRef.current = _this.selectedRowsRef.current ? removeDuplicate([].concat(_toConsumableArray(_this.selectedRowsRef.current), _toConsumableArray(preSelectedRows)), uniqueColumnName) : removeDuplicate(_toConsumableArray(preSelectedRows), uniqueColumnName);
21305
21310
  }
21306
21311
 
21307
- var selectedData = getUpdatedData(dataReplica, uniqueColumnName, _this.selectedRowsRef.current, _this.clearSelectionRef.current, _this.selectAllRef.current);
21312
+ var selectedData = getUpdatedData(dataReplica, _this.selectedRowsRef.current, uniqueColumnName, _this.clearSelectionRef.current, _this.selectAllRef.current);
21308
21313
 
21309
21314
  _this.setState({
21310
21315
  data: selectedData,
@@ -21341,6 +21346,7 @@ var Table = /*#__PURE__*/function (_React$Component) {
21341
21346
  var preSelectedRows = renderedData.filter(function (item) {
21342
21347
  return item._selected;
21343
21348
  });
21349
+ var renderedDataReplica = JSON.parse(JSON.stringify(renderedData));
21344
21350
 
21345
21351
  if (_this.clearSelectionRef.current) {
21346
21352
  _this.selectedRowsRef.current = [];
@@ -21348,7 +21354,7 @@ var Table = /*#__PURE__*/function (_React$Component) {
21348
21354
  _this.selectedRowsRef.current = _this.selectedRowsRef.current ? removeDuplicate([].concat(_toConsumableArray(_this.selectedRowsRef.current), _toConsumableArray(preSelectedRows)), uniqueColumnName) : removeDuplicate(_toConsumableArray(preSelectedRows), uniqueColumnName);
21349
21355
  }
21350
21356
 
21351
- var selectedData = getUpdatedData(renderedData, uniqueColumnName, _this.selectedRowsRef.current, _this.clearSelectionRef.current, _this.selectAllRef.current);
21357
+ var selectedData = getUpdatedData(renderedDataReplica, _this.selectedRowsRef.current, uniqueColumnName, _this.clearSelectionRef.current, _this.selectAllRef.current);
21352
21358
 
21353
21359
  _this.setState({
21354
21360
  totalRecords: totalRecords,
@@ -21366,8 +21372,7 @@ var Table = /*#__PURE__*/function (_React$Component) {
21366
21372
  var data = _this.state.data;
21367
21373
  var _this$props2 = _this.props,
21368
21374
  onSelect = _this$props2.onSelect,
21369
- _this$props2$uniqueCo = _this$props2.uniqueColumnName,
21370
- uniqueColumnName = _this$props2$uniqueCo === void 0 ? 'id' : _this$props2$uniqueCo;
21375
+ uniqueColumnName = _this$props2.uniqueColumnName;
21371
21376
 
21372
21377
  if (_this.selectAllRef.current && rowIndexes !== -1 && !selected) {
21373
21378
  _this.selectAllRef.current = false;
@@ -21428,7 +21433,7 @@ var Table = /*#__PURE__*/function (_React$Component) {
21428
21433
  })].concat(_toConsumableArray(_this.selectedRowsRef.current));
21429
21434
  }
21430
21435
 
21431
- if (!selected) {
21436
+ if (!selected && uniqueColumnName) {
21432
21437
  selectedItemList = _this.selectedRowsRef.current.filter(function (item) {
21433
21438
  return item[uniqueColumnName] !== rowData[uniqueColumnName];
21434
21439
  });
@@ -21456,8 +21461,7 @@ var Table = /*#__PURE__*/function (_React$Component) {
21456
21461
  _defineProperty$1(_assertThisInitialized$1(_this), "onSelectAll", function (selected, selectAll, headerCheckbox) {
21457
21462
  var _this$props3 = _this.props,
21458
21463
  onSelect = _this$props3.onSelect,
21459
- _this$props3$uniqueCo = _this$props3.uniqueColumnName,
21460
- uniqueColumnName = _this$props3$uniqueCo === void 0 ? 'id' : _this$props3$uniqueCo;
21464
+ uniqueColumnName = _this$props3.uniqueColumnName;
21461
21465
  var data = _this.state.data;
21462
21466
  var indexes = Array.from({
21463
21467
  length: data.length
@@ -21481,7 +21485,7 @@ var Table = /*#__PURE__*/function (_React$Component) {
21481
21485
  selectedData = selectAll === undefined ? [].concat(_toConsumableArray(_this.selectedRowsRef.current || []), _toConsumableArray(newData.filter(function (d) {
21482
21486
  return d._selected;
21483
21487
  }))) : _this.selectedRowsRef.current;
21484
- } else if (!selected && headerCheckbox) {
21488
+ } else if (!selected && headerCheckbox && uniqueColumnName) {
21485
21489
  _this.selectAllRef.current = false;
21486
21490
  _this.selectedRowsRef.current = [].concat(_toConsumableArray(_this.selectedRowsRef.current || []), _toConsumableArray(newData));
21487
21491
  _this.selectedRowsRef.current = _this.selectedRowsRef.current.filter(function (item1) {
@@ -26534,6 +26538,6 @@ Menu.defaultProps = {
26534
26538
  position: 'bottom-start'
26535
26539
  };
26536
26540
 
26537
- var version = "2.31.0";
26541
+ var version = "2.31.1";
26538
26542
 
26539
26543
  export { ActionCard, Avatar, AvatarGroup, AvatarSelection, Backdrop, Badge, Breadcrumbs, Button, Calendar, Caption, Card, CardBody, CardFooter, CardHeader, CardSubdued, ChatMessage, Checkbox, Chip, ChipGroup, ChipInput, ChoiceList, Collapsible, Column, Combobox, DatePicker, DateRangePicker, Dialog, Divider, Dropdown, Dropzone, EditableChipInput, EditableDropdown, EditableInput, EmptyState, FileList, FileUploader, FileUploaderList, FullscreenModal, Grid, GridCell, Heading, HelpText, HorizontalNav, Icon, InlineMessage, Input, X as InputMask, Label, Legend, Link, LinkButton, List, Listbox, Menu, Message, MetaList, MetricInput, Modal, ModalBody, ModalDescription, ModalFooter, ModalHeader, MultiSlider, Navigation, OutsideClick, PageHeader, Pagination, Paragraph, Pills, Placeholder, PlaceholderImage, PlaceholderParagraph, Popover, ProgressBar, ProgressRing, Radio, RangeSlider, Row, Select, SelectionCard, Sidesheet, Slider, Spinner, StatusHint, Stepper, Subheading, Switch, Tab, Table, Tabs, TabsWrapper, Text, TextField, Textarea, TimePicker, Toast, Tooltip, index as Utils, VerificationCodeInput, VerticalNav, version };
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  /**
3
- * Generated on: 1713188219586
3
+ * Generated on: 1713523162818
4
4
  * Package: @innovaccer/design-system
5
- * Version: v2.31.0
5
+ * Version: v2.31.1
6
6
  * License: MIT
7
7
  * Docs: https://innovaccer.github.io/design-system
8
8
  */
@@ -15359,9 +15359,11 @@
15359
15359
  return "Selected " + selectedRowsCount + " " + customLabel + getPluralSuffix(selectedRowsCount);
15360
15360
  } else if (selectedCount && !uniqueColumnName && withCheckbox) {
15361
15361
  return "Selected " + selectedCount + " " + customLabel + getPluralSuffix(selectedCount);
15362
+ } else if (withPagination) {
15363
+ return "Showing " + startIndex + "-" + endIndex + " of " + totalRecords + " " + customLabel + getPluralSuffix(totalRecords);
15362
15364
  }
15363
15365
 
15364
- return;
15366
+ return "Showing " + totalRecords + " " + customLabel + getPluralSuffix(totalRecords);
15365
15367
  };
15366
15368
 
15367
15369
  return /*#__PURE__*/React__namespace.createElement("div", {
@@ -15475,9 +15477,9 @@
15475
15477
  return arr.length > 0;
15476
15478
  };
15477
15479
 
15478
- var getUpdatedData = function getUpdatedData(data, uniqueColumnName, selectedList, isCancelSelection, isSelectAll) {
15480
+ var getUpdatedData = function getUpdatedData(data, selectedList, uniqueColumnName, isCancelSelection, isSelectAll) {
15479
15481
  var updatedData = data.map(function (item) {
15480
- if (isSelectAll || item._selected && !isCancelSelection || item[uniqueColumnName] && selectedList && isElementPresent(selectedList, uniqueColumnName, item[uniqueColumnName]) && !isCancelSelection) {
15482
+ if (isSelectAll || item._selected && !isCancelSelection || uniqueColumnName && item[uniqueColumnName] && selectedList && isElementPresent(selectedList, uniqueColumnName, item[uniqueColumnName]) && !isCancelSelection) {
15481
15483
  item._selected = true;
15482
15484
  } else if (isCancelSelection) {
15483
15485
  item._selected = false;
@@ -15505,7 +15507,11 @@
15505
15507
  };
15506
15508
 
15507
15509
  var removeDuplicate = function removeDuplicate(data, uniqueColumnName) {
15508
- return uniqueByKey(data, uniqueColumnName);
15510
+ if (uniqueColumnName) {
15511
+ return uniqueByKey(data, uniqueColumnName);
15512
+ }
15513
+
15514
+ return data;
15509
15515
  };
15510
15516
 
15511
15517
  var defaultErrorTemplate = function defaultErrorTemplate(props) {
@@ -15576,14 +15582,13 @@
15576
15582
  withPagination = _a.withPagination,
15577
15583
  dataProp = _a.data,
15578
15584
  onSearch = _a.onSearch,
15579
- _b = _a.uniqueColumnName,
15580
- uniqueColumnName = _b === void 0 ? 'id' : _b;
15581
- var _c = _this.state,
15582
- async = _c.async,
15583
- page = _c.page,
15584
- sortingList = _c.sortingList,
15585
- filterList = _c.filterList,
15586
- searchTerm = _c.searchTerm;
15585
+ uniqueColumnName = _a.uniqueColumnName;
15586
+ var _b = _this.state,
15587
+ async = _b.async,
15588
+ page = _b.page,
15589
+ sortingList = _b.sortingList,
15590
+ filterList = _b.filterList,
15591
+ searchTerm = _b.searchTerm;
15587
15592
 
15588
15593
  _this.onSelect(-1, false);
15589
15594
 
@@ -15617,7 +15622,7 @@
15617
15622
  _this.selectedRowsRef.current = _this.selectedRowsRef.current ? removeDuplicate(__spreadArrays(_this.selectedRowsRef.current, preSelectedRows), uniqueColumnName) : removeDuplicate(__spreadArrays(preSelectedRows), uniqueColumnName);
15618
15623
  }
15619
15624
 
15620
- var selectedData = getUpdatedData(dataReplica, uniqueColumnName, _this.selectedRowsRef.current, _this.clearSelectionRef.current, _this.selectAllRef.current);
15625
+ var selectedData = getUpdatedData(dataReplica, _this.selectedRowsRef.current, uniqueColumnName, _this.clearSelectionRef.current, _this.selectAllRef.current);
15621
15626
 
15622
15627
  _this.setState({
15623
15628
  data: selectedData,
@@ -15654,6 +15659,7 @@
15654
15659
  var preSelectedRows = renderedData.filter(function (item) {
15655
15660
  return item._selected;
15656
15661
  });
15662
+ var renderedDataReplica = JSON.parse(JSON.stringify(renderedData));
15657
15663
 
15658
15664
  if (_this.clearSelectionRef.current) {
15659
15665
  _this.selectedRowsRef.current = [];
@@ -15661,7 +15667,7 @@
15661
15667
  _this.selectedRowsRef.current = _this.selectedRowsRef.current ? removeDuplicate(__spreadArrays(_this.selectedRowsRef.current, preSelectedRows), uniqueColumnName) : removeDuplicate(__spreadArrays(preSelectedRows), uniqueColumnName);
15662
15668
  }
15663
15669
 
15664
- var selectedData = getUpdatedData(renderedData, uniqueColumnName, _this.selectedRowsRef.current, _this.clearSelectionRef.current, _this.selectAllRef.current);
15670
+ var selectedData = getUpdatedData(renderedDataReplica, _this.selectedRowsRef.current, uniqueColumnName, _this.clearSelectionRef.current, _this.selectAllRef.current);
15665
15671
 
15666
15672
  _this.setState({
15667
15673
  totalRecords: totalRecords,
@@ -15679,8 +15685,7 @@
15679
15685
  var data = _this.state.data;
15680
15686
  var _a = _this.props,
15681
15687
  onSelect = _a.onSelect,
15682
- _b = _a.uniqueColumnName,
15683
- uniqueColumnName = _b === void 0 ? 'id' : _b;
15688
+ uniqueColumnName = _a.uniqueColumnName;
15684
15689
 
15685
15690
  if (_this.selectAllRef.current && rowIndexes !== -1 && !selected) {
15686
15691
  _this.selectAllRef.current = false;
@@ -15738,7 +15743,7 @@
15738
15743
  })], _this.selectedRowsRef.current);
15739
15744
  }
15740
15745
 
15741
- if (!selected) {
15746
+ if (!selected && uniqueColumnName) {
15742
15747
  selectedItemList = _this.selectedRowsRef.current.filter(function (item) {
15743
15748
  return item[uniqueColumnName] !== rowData[uniqueColumnName];
15744
15749
  });
@@ -15763,8 +15768,7 @@
15763
15768
  _this.onSelectAll = function (selected, selectAll, headerCheckbox) {
15764
15769
  var _a = _this.props,
15765
15770
  onSelect = _a.onSelect,
15766
- _b = _a.uniqueColumnName,
15767
- uniqueColumnName = _b === void 0 ? 'id' : _b;
15771
+ uniqueColumnName = _a.uniqueColumnName;
15768
15772
  var data = _this.state.data;
15769
15773
  var indexes = Array.from({
15770
15774
  length: data.length
@@ -15788,7 +15792,7 @@
15788
15792
  selectedData = selectAll === undefined ? __spreadArrays(_this.selectedRowsRef.current || [], newData.filter(function (d) {
15789
15793
  return d._selected;
15790
15794
  })) : _this.selectedRowsRef.current;
15791
- } else if (!selected && headerCheckbox) {
15795
+ } else if (!selected && headerCheckbox && uniqueColumnName) {
15792
15796
  _this.selectAllRef.current = false;
15793
15797
  _this.selectedRowsRef.current = __spreadArrays(_this.selectedRowsRef.current || [], newData);
15794
15798
  _this.selectedRowsRef.current = _this.selectedRowsRef.current.filter(function (item1) {
@@ -20699,7 +20703,7 @@
20699
20703
  position: 'bottom-start'
20700
20704
  };
20701
20705
 
20702
- var version = "2.31.0";
20706
+ var version = "2.31.1";
20703
20707
 
20704
20708
  exports.ActionCard = ActionCard;
20705
20709
  exports.Avatar = Avatar;