@undp/carbon-library 1.0.134-CARBON-332.3 → 1.0.134-CARBON-332.4

Sign up to get free protection for your applications and to get access to all the features.
package/dist/cjs/index.js CHANGED
@@ -18141,35 +18141,7 @@ var SocialEnvironmentalRisk = function (props) {
18141
18141
  var t = translator.t;
18142
18142
  var form = antd.Form.useForm()[0];
18143
18143
  var _a = React.useState(), socialEnvironmentalFormDetails = _a[0], setSocialEnvironmentalFormDetails = _a[1];
18144
- React.useEffect(function () {
18145
- onFormSubmit(socialEnvironmentalFormDetails);
18146
- }, [socialEnvironmentalFormDetails]);
18147
- React.useEffect(function () {
18148
- if (SocialEnvironmentalRiskData && !viewOnly) {
18149
- setSocialEnvironmentalFormDetails(SocialEnvironmentalRiskData);
18150
- form.setFieldsValue(SocialEnvironmentalRiskData);
18151
- }
18152
- else if (SocialEnvironmentalRiskData && viewOnly) {
18153
- checkHeaderAvailability();
18154
- }
18155
- }, [SocialEnvironmentalRiskData]);
18156
- var checkHeaderAvailability = function () {
18157
- SocialEnvironmentalDetails.forEach(function (section) {
18158
- section.isTitleVisible = false;
18159
- section.subItems.forEach(function (subSection) {
18160
- subSection.isTitleVisible = false;
18161
- subSection.subItems.forEach(function (element) {
18162
- if (SocialEnvironmentalRiskData.hasOwnProperty(element === null || element === void 0 ? void 0 : element.name)) {
18163
- subSection.isTitleVisible = true;
18164
- }
18165
- });
18166
- if (subSection.isTitleVisible) {
18167
- section.isTitleVisible = true;
18168
- }
18169
- });
18170
- });
18171
- };
18172
- var SocialEnvironmentalDetails = [
18144
+ var _b = React.useState([
18173
18145
  {
18174
18146
  title: t("humanRightsSubHeader"),
18175
18147
  isTitleVisible: true,
@@ -18532,7 +18504,36 @@ var SocialEnvironmentalRisk = function (props) {
18532
18504
  },
18533
18505
  ],
18534
18506
  },
18535
- ];
18507
+ ]), socialEnvironmentalDetails = _b[0], setSocialEnvironmentalDetails = _b[1];
18508
+ React.useEffect(function () {
18509
+ onFormSubmit(socialEnvironmentalFormDetails);
18510
+ }, [socialEnvironmentalFormDetails]);
18511
+ React.useEffect(function () {
18512
+ if (SocialEnvironmentalRiskData && !viewOnly) {
18513
+ setSocialEnvironmentalFormDetails(SocialEnvironmentalRiskData);
18514
+ form.setFieldsValue(SocialEnvironmentalRiskData);
18515
+ }
18516
+ else if (SocialEnvironmentalRiskData && viewOnly) {
18517
+ checkHeaderAvailability();
18518
+ }
18519
+ }, [SocialEnvironmentalRiskData]);
18520
+ var checkHeaderAvailability = function () {
18521
+ socialEnvironmentalDetails.forEach(function (section) {
18522
+ section.isTitleVisible = false;
18523
+ section.subItems.forEach(function (subSection) {
18524
+ subSection.isTitleVisible = false;
18525
+ subSection.subItems.forEach(function (element) {
18526
+ if (SocialEnvironmentalRiskData.hasOwnProperty(element === null || element === void 0 ? void 0 : element.name)) {
18527
+ subSection.isTitleVisible = true;
18528
+ }
18529
+ });
18530
+ if (subSection.isTitleVisible) {
18531
+ section.isTitleVisible = true;
18532
+ }
18533
+ });
18534
+ });
18535
+ setSocialEnvironmentalDetails(socialEnvironmentalDetails);
18536
+ };
18536
18537
  var SocialEnvironmentalDetailsChanged = function (changedValues) { return __awaiter(void 0, void 0, void 0, function () {
18537
18538
  return __generator(this, function (_a) {
18538
18539
  setSocialEnvironmentalFormDetails(function (pre) { return (__assign(__assign({}, pre), changedValues)); });
@@ -18543,7 +18544,7 @@ var SocialEnvironmentalRisk = function (props) {
18543
18544
  viewOnly && !SocialEnvironmentalRiskData && (React.createElement(antd.Empty, { image: antd.Empty.PRESENTED_IMAGE_SIMPLE })),
18544
18545
  ((viewOnly && SocialEnvironmentalRiskData) || !viewOnly) && (React.createElement(antd.Form, { name: "SocialEnvironmentalDetails", labelWrap: true, form: form, labelAlign: "left", labelCol: { md: 16, lg: 18, xl: 18 }, wrapperCol: { md: 8, lg: 6, xl: 6 }, layout: "horizontal", onValuesChange: SocialEnvironmentalDetailsChanged },
18545
18546
  !viewOnly &&
18546
- SocialEnvironmentalDetails.map(function (section) {
18547
+ socialEnvironmentalDetails.map(function (section) {
18547
18548
  return (React.createElement(React.Fragment, null,
18548
18549
  React.createElement("div", { style: { marginBottom: "15px" } },
18549
18550
  React.createElement("label", { className: "co-sub-header-text" }, section.title)),
@@ -18563,7 +18564,7 @@ var SocialEnvironmentalRisk = function (props) {
18563
18564
  }),
18564
18565
  viewOnly &&
18565
18566
  SocialEnvironmentalRiskData &&
18566
- SocialEnvironmentalDetails.map(function (section) {
18567
+ socialEnvironmentalDetails.map(function (section) {
18567
18568
  return (React.createElement(React.Fragment, null,
18568
18569
  section.isTitleVisible && (React.createElement("div", { style: { marginBottom: "15px" } },
18569
18570
  React.createElement("label", { className: "co-sub-header-text" }, section.title))),
@@ -18572,10 +18573,10 @@ var SocialEnvironmentalRisk = function (props) {
18572
18573
  subSection.isTitleVisible && (React.createElement("div", { style: { marginBottom: "15px" } },
18573
18574
  React.createElement("label", { className: "co-sub-title-text" }, subSection.title))),
18574
18575
  subSection.subItems.map(function (element) {
18575
- return (React.createElement(antd.Form.Item, { className: "mg-left-2", label: element.label, name: element.name },
18576
+ return (React.createElement(React.Fragment, null, SocialEnvironmentalRiskData.hasOwnProperty(element === null || element === void 0 ? void 0 : element.name) && (React.createElement(antd.Form.Item, { className: "mg-left-2", label: element.label, name: element.name },
18576
18577
  React.createElement(antd.Radio.Group, { size: "middle" },
18577
18578
  React.createElement("div", { className: "radio-container" },
18578
- React.createElement(antd.Radio.Button, { className: "radio" }, SocialEnvironmentalRiskData[element.name])))));
18579
+ React.createElement(antd.Radio.Button, { className: "radio" }, SocialEnvironmentalRiskData[element.name])))))));
18579
18580
  })));
18580
18581
  })));
18581
18582
  })))));