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

Sign up to get free protection for your applications and to get access to all the features.
package/dist/esm/index.js CHANGED
@@ -18121,35 +18121,7 @@ var SocialEnvironmentalRisk = function (props) {
18121
18121
  var t = translator.t;
18122
18122
  var form = Form.useForm()[0];
18123
18123
  var _a = useState(), socialEnvironmentalFormDetails = _a[0], setSocialEnvironmentalFormDetails = _a[1];
18124
- useEffect(function () {
18125
- onFormSubmit(socialEnvironmentalFormDetails);
18126
- }, [socialEnvironmentalFormDetails]);
18127
- useEffect(function () {
18128
- if (SocialEnvironmentalRiskData && !viewOnly) {
18129
- setSocialEnvironmentalFormDetails(SocialEnvironmentalRiskData);
18130
- form.setFieldsValue(SocialEnvironmentalRiskData);
18131
- }
18132
- else if (SocialEnvironmentalRiskData && viewOnly) {
18133
- checkHeaderAvailability();
18134
- }
18135
- }, [SocialEnvironmentalRiskData]);
18136
- var checkHeaderAvailability = function () {
18137
- SocialEnvironmentalDetails.forEach(function (section) {
18138
- section.isTitleVisible = false;
18139
- section.subItems.forEach(function (subSection) {
18140
- subSection.isTitleVisible = false;
18141
- subSection.subItems.forEach(function (element) {
18142
- if (SocialEnvironmentalRiskData.hasOwnProperty(element === null || element === void 0 ? void 0 : element.name)) {
18143
- subSection.isTitleVisible = true;
18144
- }
18145
- });
18146
- if (subSection.isTitleVisible) {
18147
- section.isTitleVisible = true;
18148
- }
18149
- });
18150
- });
18151
- };
18152
- var SocialEnvironmentalDetails = [
18124
+ var _b = useState([
18153
18125
  {
18154
18126
  title: t("humanRightsSubHeader"),
18155
18127
  isTitleVisible: true,
@@ -18512,7 +18484,36 @@ var SocialEnvironmentalRisk = function (props) {
18512
18484
  },
18513
18485
  ],
18514
18486
  },
18515
- ];
18487
+ ]), socialEnvironmentalDetails = _b[0], setSocialEnvironmentalDetails = _b[1];
18488
+ useEffect(function () {
18489
+ onFormSubmit(socialEnvironmentalFormDetails);
18490
+ }, [socialEnvironmentalFormDetails]);
18491
+ useEffect(function () {
18492
+ if (SocialEnvironmentalRiskData && !viewOnly) {
18493
+ setSocialEnvironmentalFormDetails(SocialEnvironmentalRiskData);
18494
+ form.setFieldsValue(SocialEnvironmentalRiskData);
18495
+ }
18496
+ else if (SocialEnvironmentalRiskData && viewOnly) {
18497
+ checkHeaderAvailability();
18498
+ }
18499
+ }, [SocialEnvironmentalRiskData]);
18500
+ var checkHeaderAvailability = function () {
18501
+ socialEnvironmentalDetails.forEach(function (section) {
18502
+ section.isTitleVisible = false;
18503
+ section.subItems.forEach(function (subSection) {
18504
+ subSection.isTitleVisible = false;
18505
+ subSection.subItems.forEach(function (element) {
18506
+ if (SocialEnvironmentalRiskData.hasOwnProperty(element === null || element === void 0 ? void 0 : element.name)) {
18507
+ subSection.isTitleVisible = true;
18508
+ }
18509
+ });
18510
+ if (subSection.isTitleVisible) {
18511
+ section.isTitleVisible = true;
18512
+ }
18513
+ });
18514
+ });
18515
+ setSocialEnvironmentalDetails(socialEnvironmentalDetails);
18516
+ };
18516
18517
  var SocialEnvironmentalDetailsChanged = function (changedValues) { return __awaiter(void 0, void 0, void 0, function () {
18517
18518
  return __generator(this, function (_a) {
18518
18519
  setSocialEnvironmentalFormDetails(function (pre) { return (__assign(__assign({}, pre), changedValues)); });
@@ -18523,7 +18524,7 @@ var SocialEnvironmentalRisk = function (props) {
18523
18524
  viewOnly && !SocialEnvironmentalRiskData && (React.createElement(Empty, { image: Empty.PRESENTED_IMAGE_SIMPLE })),
18524
18525
  ((viewOnly && SocialEnvironmentalRiskData) || !viewOnly) && (React.createElement(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 },
18525
18526
  !viewOnly &&
18526
- SocialEnvironmentalDetails.map(function (section) {
18527
+ socialEnvironmentalDetails.map(function (section) {
18527
18528
  return (React.createElement(React.Fragment, null,
18528
18529
  React.createElement("div", { style: { marginBottom: "15px" } },
18529
18530
  React.createElement("label", { className: "co-sub-header-text" }, section.title)),
@@ -18543,7 +18544,7 @@ var SocialEnvironmentalRisk = function (props) {
18543
18544
  }),
18544
18545
  viewOnly &&
18545
18546
  SocialEnvironmentalRiskData &&
18546
- SocialEnvironmentalDetails.map(function (section) {
18547
+ socialEnvironmentalDetails.map(function (section) {
18547
18548
  return (React.createElement(React.Fragment, null,
18548
18549
  section.isTitleVisible && (React.createElement("div", { style: { marginBottom: "15px" } },
18549
18550
  React.createElement("label", { className: "co-sub-header-text" }, section.title))),
@@ -18552,10 +18553,10 @@ var SocialEnvironmentalRisk = function (props) {
18552
18553
  subSection.isTitleVisible && (React.createElement("div", { style: { marginBottom: "15px" } },
18553
18554
  React.createElement("label", { className: "co-sub-title-text" }, subSection.title))),
18554
18555
  subSection.subItems.map(function (element) {
18555
- return (React.createElement(Form.Item, { className: "mg-left-2", label: element.label, name: element.name },
18556
- React.createElement(Radio.Group, { size: "middle" },
18556
+ return (React.createElement(React.Fragment, null, SocialEnvironmentalRiskData.hasOwnProperty(element === null || element === void 0 ? void 0 : element.name) && (React.createElement(Form.Item, { className: "mg-left-2", label: element.label, name: element.name },
18557
+ React.createElement(Radio.Group, { size: "middle", disabled: true },
18557
18558
  React.createElement("div", { className: "radio-container" },
18558
- React.createElement(Radio.Button, { className: "radio" }, SocialEnvironmentalRiskData[element.name])))));
18559
+ React.createElement(Radio.Button, { className: "radio" }, SocialEnvironmentalRiskData[element.name])))))));
18559
18560
  })));
18560
18561
  })));
18561
18562
  })))));