@desynova-digital/components 9.1.30 → 9.1.32

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.
@@ -37,6 +37,8 @@ var _Shimmer = _interopRequireDefault(require("../../atoms/loader/ShimmerCompone
37
37
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16;
38
38
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
39
39
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
40
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
41
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
40
42
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
41
43
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
42
44
  var Table = /*#__PURE__*/function (_Component) {
@@ -108,6 +110,24 @@ var Table = /*#__PURE__*/function (_Component) {
108
110
  showColumnArr: _this.getFieldArr(_this.defaultShowColumns)
109
111
  };
110
112
  });
113
+ /**
114
+ *
115
+ * remove all selction from items state
116
+ * clear commonActions
117
+ * clear selectedRows
118
+ */
119
+ (0, _defineProperty2["default"])(_this, "resetTableSelection", function () {
120
+ var updatedData = _this.state.items.map(function (item) {
121
+ return _objectSpread(_objectSpread({}, item), {}, {
122
+ rowChecked: false
123
+ });
124
+ });
125
+ _this.setState({
126
+ commonActionsSelected: [],
127
+ selectedRows: [],
128
+ items: updatedData
129
+ });
130
+ });
111
131
  (0, _defineProperty2["default"])(_this, "getFieldArr", function (cols) {
112
132
  return cols.map(function (item) {
113
133
  return item.field;
@@ -613,9 +633,14 @@ var Table = /*#__PURE__*/function (_Component) {
613
633
  key: "componentDidUpdate",
614
634
  value: function componentDidUpdate(prevProps, prevState) {
615
635
  if (prevState.items !== this.state.items) {
636
+ var checkedIndexes = prevState.items.map(function (item, index) {
637
+ return item.rowChecked ? index : -1;
638
+ }).filter(function (index) {
639
+ return index !== -1;
640
+ });
616
641
  this.setState({
617
- commonActionsSelected: [],
618
- selectedRows: []
642
+ // commonActionsSelected: [],
643
+ selectedRows: prevProps.tableTitle ? checkedIndexes : []
619
644
  });
620
645
  }
621
646
  if (prevProps.tableLoading !== this.props.tableLoading) {
@@ -666,7 +691,7 @@ var Table = /*#__PURE__*/function (_Component) {
666
691
  defaultShowColumns: spiltColumns.defaultShowColumns,
667
692
  extraColumns: spiltColumns.extraColumns,
668
693
  nestedTable: spiltColumns.nestedTable,
669
- items: this.getDisplayedItems(this.columns, newProps.items),
694
+ items: newProps.tableTitle == 'Archive History' ? this.getDisplayedItems(this.columns, this.state.items) : this.getDisplayedItems(this.columns, newProps.items),
670
695
  showColumnArr: this.getFieldArr(spiltColumns.defaultShowColumns)
671
696
  /*
672
697
  * ...(newProps.tableTitle !== this.props.tableTitle
@@ -1324,16 +1349,28 @@ var Table = /*#__PURE__*/function (_Component) {
1324
1349
  key: idx,
1325
1350
  onClick: function onClick(e) {
1326
1351
  if (_this4.props.commonActionClickHandler) {
1327
- items.map(function (ele) {
1328
- return ele.rowChecked = false;
1329
- });
1330
- _this4.setState({
1331
- ingestedDbIdArray: [],
1352
+ if (item !== 'restore') {
1353
+ items.map(function (ele) {
1354
+ return ele.rowChecked = false;
1355
+ });
1356
+ }
1357
+ _this4.setState(_objectSpread(_objectSpread({}, _this4.state), {}, {
1358
+ ingestedDbIdArray: _this4.props.bulkRestoreAllowed ? _this4.state.selectedRows.map(function (index) {
1359
+ var _this4$state$items$in;
1360
+ return (_this4$state$items$in = _this4.state.items[index]) === null || _this4$state$items$in === void 0 ? void 0 : _this4$state$items$in.ingest_db_id;
1361
+ }) : [],
1332
1362
  isAllRowsSelected: false,
1333
- commonActionsSelected: [],
1334
- selectedRows: []
1335
- });
1336
- _this4.props.commonActionClickHandler(item, e, _this4.state.ingestedDbIdArray, "common-action");
1363
+ commonActionsSelected: _this4.props.bulkRestoreAllowed ? _this4.state.commonActionsSelected : [],
1364
+ selectedRows: _this4.props.bulkRestoreAllowed ? _this4.state.selectedRows : []
1365
+ }));
1366
+ switch (item) {
1367
+ case 'restore':
1368
+ _this4.state.ingestedDbIdArray.length > 1 ? _this4.props.actionClickHandler('restoreCommon', _this4.state.ingestedDbIdArray) : null;
1369
+ break;
1370
+ default:
1371
+ _this4.props.commonActionClickHandler(item, e, _this4.state.ingestedDbIdArray, "common-action");
1372
+ break;
1373
+ }
1337
1374
  } else {
1338
1375
  console.log("pass func as props named 'commonActionClickHandler'... receive args as actionItem name and event obj. ");
1339
1376
  }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@desynova-digital/components",
3
- "version": "9.1.30",
3
+ "version": "9.1.32",
4
4
  "description": "Components for Desynova Digital",
5
5
  "main": "index.js",
6
6
  "author": "desynova-digital",
7
7
  "license": "MIT",
8
8
  "repository": "desynova-digital",
9
9
  "dependencies": {
10
- "@desynova-digital/tokens": "9.1.30",
10
+ "@desynova-digital/tokens": "9.1.32",
11
11
  "prop-types": "^15.7.2",
12
12
  "styled-components": "^4.3.2"
13
13
  },