@undp/carbon-library 1.0.135-CARBON-343.5 → 1.0.135-CARBON-343.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.js +17 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +17 -5
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
@@ -23624,7 +23624,7 @@ var EditableCell = function (_a) {
|
|
23624
23624
|
return React.createElement("td", __assign({}, restProps), childNode);
|
23625
23625
|
};
|
23626
23626
|
|
23627
|
-
var css_248z$4 = ".steps-actions {\n display: flex;\n flex-direction: row-reverse;\n margin-right: 1rem; }\n .steps-actions .action-btn {\n border: 1px solid #16b1ff;\n color: #16b1ff;\n margin-right: 1rem; }\n .steps-actions .back-btn {\n border: 1px solid rgba(140, 140, 140, 0.7);\n color: rgba(140, 140, 140, 0.7);\n margin-right: 1rem; }\n .steps-actions .mg-left-1 {\n margin-left: 1rem; }\n";
|
23627
|
+
var css_248z$4 = ".steps-actions {\n display: flex;\n flex-direction: row-reverse;\n margin-right: 1rem;\n justify-content: center; }\n .steps-actions .action-btn {\n border: 1px solid #16b1ff;\n color: #16b1ff;\n margin-right: 1rem; }\n .steps-actions .back-btn {\n border: 1px solid rgba(140, 140, 140, 0.7);\n color: rgba(140, 140, 140, 0.7);\n margin-right: 1rem; }\n .steps-actions .mg-left-1 {\n margin-left: 1rem; }\n";
|
23628
23628
|
styleInject(css_248z$4);
|
23629
23629
|
|
23630
23630
|
var NdcDetailsComponent = function (props) {
|
@@ -23710,6 +23710,9 @@ var NdcDetailsComponent = function (props) {
|
|
23710
23710
|
);
|
23711
23711
|
}
|
23712
23712
|
var onCancelPeriod = function () { };
|
23713
|
+
var inRange = function (num, min, max) {
|
23714
|
+
return num >= min && num <= max;
|
23715
|
+
};
|
23713
23716
|
var onAddNewPeriod = function () {
|
23714
23717
|
if (selectedPeriod && selectedPeriod.current) {
|
23715
23718
|
var newPeriodItem_1 = {
|
@@ -23719,7 +23722,10 @@ var NdcDetailsComponent = function (props) {
|
|
23719
23722
|
end: selectedPeriod.current.end,
|
23720
23723
|
children: ndcDetailsTableContent(),
|
23721
23724
|
};
|
23722
|
-
var existingIndex = periodItemsRef.current.findIndex(function (item) {
|
23725
|
+
var existingIndex = periodItemsRef.current.findIndex(function (item) {
|
23726
|
+
return inRange(newPeriodItem_1.start, item.start, item.end) ||
|
23727
|
+
inRange(newPeriodItem_1.end, item.start, item.end);
|
23728
|
+
});
|
23723
23729
|
if (existingIndex === -1) {
|
23724
23730
|
setPeriodItems(function (items) { return __spreadArray(__spreadArray([], items, true), [newPeriodItem_1], false); });
|
23725
23731
|
periodItemsRef.current = __spreadArray(__spreadArray([], periodItemsRef.current, true), [newPeriodItem_1], false);
|
@@ -23734,6 +23740,11 @@ var NdcDetailsComponent = function (props) {
|
|
23734
23740
|
}
|
23735
23741
|
}
|
23736
23742
|
};
|
23743
|
+
React.useEffect(function () {
|
23744
|
+
if (periodItems && periodItems.length > 1) {
|
23745
|
+
setSelectedTab(periodItems[periodItems.length - 1].key);
|
23746
|
+
}
|
23747
|
+
}, [periodItems]);
|
23737
23748
|
var onDateRangeChanged = function (range) {
|
23738
23749
|
var period = {
|
23739
23750
|
start: Number(moment(range[0]).year()),
|
@@ -23743,9 +23754,9 @@ var NdcDetailsComponent = function (props) {
|
|
23743
23754
|
};
|
23744
23755
|
function addNewPeriodContent() {
|
23745
23756
|
return (React.createElement("div", null,
|
23746
|
-
React.createElement(antd.Row,
|
23757
|
+
React.createElement(antd.Row, { justify: "center" },
|
23747
23758
|
React.createElement(RangePicker, { onChange: onDateRangeChanged, picker: "year" })),
|
23748
|
-
React.createElement(antd.Row, { className: "mg-top-1" },
|
23759
|
+
React.createElement(antd.Row, { className: "mg-top-1", justify: "center" },
|
23749
23760
|
React.createElement("div", { className: "steps-actions" },
|
23750
23761
|
React.createElement(antd.Button, { type: "primary", onClick: onAddNewPeriod, htmlType: "submit", loading: loading }, t("ndc:submit")),
|
23751
23762
|
React.createElement(antd.Button, { className: "back-btn", onClick: onCancelPeriod, loading: loading }, t("ndc:back"))))));
|
@@ -23794,8 +23805,9 @@ var NdcDetailsComponent = function (props) {
|
|
23794
23805
|
selectedTab !== "add_new" && (React.createElement("div", null,
|
23795
23806
|
React.createElement("div", null,
|
23796
23807
|
React.createElement(antd.Table, { components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: ndcDetailsData, columns: columns, footer: function () { return (React.createElement(antd.Row, { justify: "center" },
|
23797
|
-
React.createElement(antd.Button, { onClick: onAddNewNdcDetail, type: "
|
23808
|
+
React.createElement(antd.Button, { onClick: onAddNewNdcDetail, type: "default", style: {
|
23798
23809
|
marginBottom: 16,
|
23810
|
+
width: '100%'
|
23799
23811
|
} }, t("ndc:addNdcAction")))); } }))))));
|
23800
23812
|
};
|
23801
23813
|
|