@desynova-digital/components 8.19.3 → 8.19.5
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/atoms/label/label.js +2 -2
- package/molecules/table/table.js +126 -58
- package/package.json +2 -2
package/atoms/label/label.js
CHANGED
|
@@ -42,7 +42,7 @@ var LABEL_STYLES = [{
|
|
|
42
42
|
background: "#F9E900"
|
|
43
43
|
}
|
|
44
44
|
}, {
|
|
45
|
-
code: ["finished", "archived", "restored", "approved", "success", "complete", "upload_finished", "delivered", "ingested", "tagged"],
|
|
45
|
+
code: ["finished", "archived", "restored", "approved", "success", "complete", "upload_finished", "delivered", "ingested", "tagged", "created"],
|
|
46
46
|
hex: {
|
|
47
47
|
background: "#18B96E"
|
|
48
48
|
}
|
|
@@ -57,7 +57,7 @@ var LABEL_STYLES = [{
|
|
|
57
57
|
background: "#AFB2BA"
|
|
58
58
|
}
|
|
59
59
|
}, {
|
|
60
|
-
code: ["in_progress", "in_review"],
|
|
60
|
+
code: ["in_progress", "in_review", "dummy"],
|
|
61
61
|
hex: {
|
|
62
62
|
background: "#FF8D29"
|
|
63
63
|
}
|
package/molecules/table/table.js
CHANGED
|
@@ -90,8 +90,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
90
90
|
|
|
91
91
|
function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
92
92
|
|
|
93
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
94
|
-
|
|
95
93
|
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
|
96
94
|
|
|
97
95
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -454,6 +452,24 @@ var Table = function (_Component) {
|
|
|
454
452
|
}
|
|
455
453
|
}
|
|
456
454
|
|
|
455
|
+
case "rowChecked":
|
|
456
|
+
{
|
|
457
|
+
return _react2.default.createElement(
|
|
458
|
+
"div",
|
|
459
|
+
{
|
|
460
|
+
onClick: function onClick(e) {
|
|
461
|
+
_this.rowCheckChange(e, !item.rowChecked, item, idx);
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
_react2.default.createElement("input", { checked: item.rowChecked ? true : false, type: "checkbox" }),
|
|
465
|
+
_react2.default.createElement(
|
|
466
|
+
"label",
|
|
467
|
+
null,
|
|
468
|
+
_react2.default.createElement("span", null)
|
|
469
|
+
)
|
|
470
|
+
);
|
|
471
|
+
}
|
|
472
|
+
|
|
457
473
|
default:
|
|
458
474
|
if (typeof item[column.field] === "string" || typeof item[column.field] === "number" || Array.isArray(item[column.field])) {
|
|
459
475
|
var className = 'text-box';
|
|
@@ -600,13 +616,25 @@ var Table = function (_Component) {
|
|
|
600
616
|
selectedRows: [],
|
|
601
617
|
showColumnArr: spiltColumns.showColumnArr ? spiltColumns.showColumnArr : [],
|
|
602
618
|
// isAllRowsSelected:false,
|
|
603
|
-
searchedText: props.searchValue || ''
|
|
619
|
+
searchedText: props.searchValue || '',
|
|
620
|
+
commonActionsSelected: [],
|
|
621
|
+
ingestedDbIdArray: []
|
|
604
622
|
};
|
|
605
623
|
|
|
606
624
|
return _this;
|
|
607
625
|
}
|
|
608
626
|
|
|
609
627
|
_createClass(Table, [{
|
|
628
|
+
key: "componentDidUpdate",
|
|
629
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
630
|
+
if (prevState.items !== this.state.items) {
|
|
631
|
+
this.setState({
|
|
632
|
+
commonActionsSelected: [],
|
|
633
|
+
selectedRows: []
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}, {
|
|
610
638
|
key: "toggleExtraDetails",
|
|
611
639
|
value: function toggleExtraDetails(e, idx) {
|
|
612
640
|
if (this.state.showExtraRow !== idx) {
|
|
@@ -692,87 +720,126 @@ var Table = function (_Component) {
|
|
|
692
720
|
if (typeof sampleValue === "number") return Table.compare.numbers;
|
|
693
721
|
return Table.compare.strings;
|
|
694
722
|
}
|
|
723
|
+
/**
|
|
724
|
+
*
|
|
725
|
+
* @param {array of selected asset items} array
|
|
726
|
+
* @returns array of all actions common b/w selected items
|
|
727
|
+
*/
|
|
728
|
+
|
|
729
|
+
}, {
|
|
730
|
+
key: "findCommon",
|
|
731
|
+
value: function findCommon(array) {
|
|
732
|
+
if (array.length === 0) {
|
|
733
|
+
return [];
|
|
734
|
+
}
|
|
735
|
+
var reference = array[0].actions;
|
|
736
|
+
var commonActionsArray = reference.filter(function (ele) {
|
|
737
|
+
return array.every(function (obj) {
|
|
738
|
+
return obj.actions.includes(ele);
|
|
739
|
+
});
|
|
740
|
+
});
|
|
741
|
+
return commonActionsArray;
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
*
|
|
745
|
+
* @param {array of items} arr
|
|
746
|
+
* @param {index of selected item} indexesToRemove
|
|
747
|
+
* @returns
|
|
748
|
+
*/
|
|
749
|
+
|
|
750
|
+
}, {
|
|
751
|
+
key: "removeObjects",
|
|
752
|
+
value: function removeObjects(arr, indexesToRemove) {
|
|
753
|
+
return arr.filter(function (obj, index) {
|
|
754
|
+
return indexesToRemove.includes(index);
|
|
755
|
+
});
|
|
756
|
+
}
|
|
695
757
|
}, {
|
|
696
758
|
key: "rowCheckChange",
|
|
697
759
|
value: function rowCheckChange(e, value, item, idx) {
|
|
698
760
|
var _this2 = this;
|
|
699
761
|
|
|
762
|
+
var _state = this.state,
|
|
763
|
+
items = _state.items,
|
|
764
|
+
selectedRows = _state.selectedRows;
|
|
765
|
+
|
|
700
766
|
var table = e.target.closest("table");
|
|
701
767
|
var checkboxNodes = table.querySelectorAll('thead tr th input[type="checkbox"]');
|
|
702
768
|
|
|
703
|
-
// e.target.setAttribute("checked",true);
|
|
704
769
|
if (value) {
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
this.state.items.map(function (itemSelectedRows, i) {
|
|
770
|
+
items.map(function (itemSelectedRows, i) {
|
|
708
771
|
if (idx === i) {
|
|
709
772
|
itemSelectedRows.rowChecked = true;
|
|
710
|
-
}
|
|
773
|
+
}
|
|
711
774
|
return itemSelectedRows;
|
|
712
|
-
// }
|
|
713
775
|
});
|
|
714
776
|
|
|
777
|
+
var selected_row_items = this.removeObjects(items, selectedRows);
|
|
778
|
+
selected_row_items = selected_row_items.concat(items[idx]);
|
|
779
|
+
var arrayIngestDbId = selected_row_items.map(function (ele) {
|
|
780
|
+
return ele.ingest_db_id;
|
|
781
|
+
});
|
|
782
|
+
/**
|
|
783
|
+
* finalAns is an array of all selected asset items common Actions
|
|
784
|
+
*/
|
|
785
|
+
var finalAns = this.findCommon(selected_row_items);
|
|
786
|
+
if (finalAns.length != 0) {
|
|
787
|
+
var intersectionDashboardCommonActions = this.props.dashboard_common_actions.filter(function (item) {
|
|
788
|
+
return finalAns.includes(item);
|
|
789
|
+
});
|
|
790
|
+
this.setState({ commonActionsSelected: intersectionDashboardCommonActions, ingestedDbIdArray: arrayIngestDbId });
|
|
791
|
+
} else {
|
|
792
|
+
this.setState({ commonActionsSelected: finalAns, ingestedDbIdArray: arrayIngestDbId });
|
|
793
|
+
}
|
|
715
794
|
this.setState(function (prevState) {
|
|
716
795
|
return {
|
|
717
|
-
items:
|
|
718
|
-
selectedRows:
|
|
796
|
+
items: items,
|
|
797
|
+
selectedRows: selectedRows.concat(idx)
|
|
719
798
|
};
|
|
720
|
-
}, function () {
|
|
721
|
-
_this2.props.rowSelectionChange(_this2.state.selectedRows);
|
|
722
|
-
|
|
723
|
-
if (_this2.state.selectedRows.length === _this2.state.items.length) {
|
|
724
|
-
// checkboxNodes[0].removeAttribute("checked");
|
|
725
|
-
checkboxNodes[0].checked = true;
|
|
726
|
-
_this2.setState({
|
|
727
|
-
isAllRowsSelected: true
|
|
728
|
-
});
|
|
729
|
-
}
|
|
730
|
-
});
|
|
799
|
+
}, function () {});
|
|
731
800
|
} else {
|
|
732
|
-
/*
|
|
733
|
-
* e.target.removeAttribute("checked");
|
|
734
|
-
* var table = e.target.parentNode.parentNode.parentNode.parentNode
|
|
735
|
-
* console.log(table );
|
|
736
|
-
* var checkboxNodes= table.querySelectorAll('thead tr th input[type="checkbox"]');
|
|
737
|
-
* console.log(checkboxNodes[0])
|
|
738
|
-
* checkboxNodes[0].removeAttribute("checked");
|
|
739
|
-
*/
|
|
740
801
|
|
|
741
|
-
|
|
802
|
+
items.map(function (itemSelectedRows, i) {
|
|
742
803
|
if (idx === i) {
|
|
743
804
|
itemSelectedRows.rowChecked = false;
|
|
744
|
-
}
|
|
805
|
+
}
|
|
745
806
|
return itemSelectedRows;
|
|
746
|
-
// }
|
|
747
807
|
});
|
|
748
808
|
|
|
749
|
-
|
|
750
|
-
* var filterItems = this.state.selectedRows.filter(function (selectedRowItem) {
|
|
751
|
-
* return (JSON.stringify(item) !== JSON.stringify(selectedRowItem))
|
|
752
|
-
* });
|
|
753
|
-
*/
|
|
754
|
-
|
|
755
|
-
var arrOfSelected = this.state.selectedRows;
|
|
809
|
+
var arrOfSelected = selectedRows;
|
|
756
810
|
var idxOfSelected = arrOfSelected.indexOf(idx);
|
|
757
811
|
|
|
758
812
|
if (idxOfSelected >= 0) {
|
|
759
813
|
arrOfSelected.splice(idxOfSelected, 1);
|
|
760
814
|
}
|
|
761
815
|
|
|
816
|
+
var _selected_row_items = this.removeObjects(items, arrOfSelected);
|
|
817
|
+
var _arrayIngestDbId = _selected_row_items.map(function (ele) {
|
|
818
|
+
return ele.ingest_db_id;
|
|
819
|
+
});
|
|
820
|
+
|
|
821
|
+
/**
|
|
822
|
+
* finalAns is an array of all selected asset items common Actions
|
|
823
|
+
*/
|
|
824
|
+
var _finalAns = this.findCommon(_selected_row_items);
|
|
825
|
+
|
|
826
|
+
if (_finalAns.length != 0) {
|
|
827
|
+
var _intersectionDashboardCommonActions = this.props.dashboard_common_actions.filter(function (item) {
|
|
828
|
+
return _finalAns.includes(item);
|
|
829
|
+
});
|
|
830
|
+
this.setState({ commonActionsSelected: _intersectionDashboardCommonActions, ingestedDbIdArray: _arrayIngestDbId });
|
|
831
|
+
} else {
|
|
832
|
+
this.setState({ commonActionsSelected: _finalAns, ingestedDbIdArray: _arrayIngestDbId });
|
|
833
|
+
}
|
|
834
|
+
|
|
762
835
|
this.setState({
|
|
763
836
|
selectedRows: arrOfSelected
|
|
764
837
|
}, function () {
|
|
765
|
-
_this2.
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
checkboxNodes[0].checked = false; // .removeAttribute("checked");
|
|
769
|
-
_this2.setState({
|
|
770
|
-
isAllRowsSelected: false
|
|
771
|
-
});
|
|
772
|
-
}
|
|
838
|
+
_this2.setState({
|
|
839
|
+
isAllRowsSelected: false
|
|
840
|
+
});
|
|
773
841
|
});
|
|
774
842
|
}
|
|
775
|
-
// console.log(e.target.checked,item);
|
|
776
843
|
}
|
|
777
844
|
}, {
|
|
778
845
|
key: "allRowCheckChange",
|
|
@@ -874,9 +941,9 @@ var Table = function (_Component) {
|
|
|
874
941
|
pageDropdown = _props.pageDropdown,
|
|
875
942
|
getTableData = _props.getTableData,
|
|
876
943
|
downloadAvailable = _props.downloadAvailable;
|
|
877
|
-
var
|
|
878
|
-
nestedTable =
|
|
879
|
-
searchedText =
|
|
944
|
+
var _state2 = this.state,
|
|
945
|
+
nestedTable = _state2.nestedTable,
|
|
946
|
+
searchedText = _state2.searchedText;
|
|
880
947
|
|
|
881
948
|
|
|
882
949
|
var rows = this.state.items.map(function (item, index) {
|
|
@@ -914,12 +981,13 @@ var Table = function (_Component) {
|
|
|
914
981
|
{ theme: theme, key: "row-" + index + "extra" },
|
|
915
982
|
_react2.default.createElement(
|
|
916
983
|
Table.Cell,
|
|
917
|
-
|
|
984
|
+
{
|
|
918
985
|
className: "table-inner-cell",
|
|
919
986
|
theme: theme,
|
|
920
987
|
column: {},
|
|
921
988
|
colSpan: _this4.props.maxShowNoOfColumns + 1
|
|
922
|
-
|
|
989
|
+
// className="tableHolder"
|
|
990
|
+
},
|
|
923
991
|
nestedTable.length > 0 && item[nestedTable[0].field].rows.length > 0 ? _react2.default.createElement(
|
|
924
992
|
Table.Card,
|
|
925
993
|
{ width: "100%" },
|
|
@@ -1202,22 +1270,22 @@ var Table = function (_Component) {
|
|
|
1202
1270
|
width: "100%",
|
|
1203
1271
|
radius: 2
|
|
1204
1272
|
}),
|
|
1205
|
-
this.
|
|
1273
|
+
this.state.commonActionsSelected.length > 0 ? _react2.default.createElement(
|
|
1206
1274
|
Table.SelectedAction,
|
|
1207
1275
|
{
|
|
1208
1276
|
theme: this.props.theme,
|
|
1209
|
-
className: this.state.selectedRows.length > 0 && this.
|
|
1277
|
+
className: this.state.selectedRows.length > 0 && this.state.commonActionsSelected.length > 0 ? "selectedAction show" : "selectedAction"
|
|
1210
1278
|
},
|
|
1211
1279
|
_react2.default.createElement(
|
|
1212
1280
|
"div",
|
|
1213
1281
|
{ className: "action-icons-common" },
|
|
1214
|
-
this.
|
|
1282
|
+
this.state.commonActionsSelected.map(function (item, idx) {
|
|
1215
1283
|
return item !== "play" ? _react2.default.createElement(_button2.default, {
|
|
1216
1284
|
className: "action-button " + (item === "play" ? "play" : "default"),
|
|
1217
1285
|
key: idx,
|
|
1218
1286
|
onClick: function onClick(e) {
|
|
1219
1287
|
if (_this4.props.commonActionClickHandler) {
|
|
1220
|
-
_this4.props.commonActionClickHandler(item, e, _this4.state.
|
|
1288
|
+
_this4.props.commonActionClickHandler(item, e, _this4.state.ingestedDbIdArray, "common-action");
|
|
1221
1289
|
} else {
|
|
1222
1290
|
console.log("pass func as props named 'commonActionClickHandler'... receive args as actionItem name and event obj. ");
|
|
1223
1291
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@desynova-digital/components",
|
|
3
|
-
"version": "8.19.
|
|
3
|
+
"version": "8.19.5",
|
|
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": "8.19.
|
|
10
|
+
"@desynova-digital/tokens": "8.19.5",
|
|
11
11
|
"prop-types": "^15.7.2",
|
|
12
12
|
"styled-components": "^4.3.2"
|
|
13
13
|
},
|