@abgov/jsonforms-components 1.27.0 → 1.27.1

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/index.esm.js CHANGED
@@ -4496,6 +4496,9 @@ const ReviewItem = styled.div(_t$4 || (_t$4 = _$4`
4496
4496
  border-radius: var(--goa-border-radius-m);
4497
4497
  margin: var(--goa-space-2xs);
4498
4498
  padding: var(--goa-space-xs);
4499
+ div:empty {
4500
+ display: none;
4501
+ }
4499
4502
  `));
4500
4503
  const ReviewItemSection = styled.div(_t2$2 || (_t2$2 = _$4`
4501
4504
  background-color: #f1f1f1;
@@ -4910,6 +4913,16 @@ const mapToVisibleStep = (step, allSteps, visibleSteps) => {
4910
4913
  };
4911
4914
 
4912
4915
  const summaryLabel = 'Summary';
4916
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4917
+ const getProperty = (obj, propName) => {
4918
+ if (obj[propName] !== undefined) return obj[propName];
4919
+ for (const key in obj) {
4920
+ if (typeof obj[key] === 'object' && obj[key] !== null) {
4921
+ const result = getProperty(obj[key], propName);
4922
+ if (result !== undefined) return result;
4923
+ }
4924
+ }
4925
+ };
4913
4926
  const FormStepper = props => {
4914
4927
  var _a, _b, _c, _d, _e;
4915
4928
  const {
@@ -5086,7 +5099,20 @@ const FormStepper = props => {
5086
5099
  })]
5087
5100
  }), jsx(GoAGrid, {
5088
5101
  minChildWidth: "600px",
5089
- children: category.elements.map((element, index) => {
5102
+ children: category.elements.filter(field => {
5103
+ var _a, _b;
5104
+ const conditionProps = (_a = field.rule) === null || _a === void 0 ? void 0 : _a.condition;
5105
+ if (conditionProps && data) {
5106
+ const canHideControlParts = (_b = conditionProps === null || conditionProps === void 0 ? void 0 : conditionProps.scope) === null || _b === void 0 ? void 0 : _b.split('/');
5107
+ const canHideControl = canHideControlParts && canHideControlParts[(canHideControlParts === null || canHideControlParts === void 0 ? void 0 : canHideControlParts.length) - 1];
5108
+ const isHidden = getProperty(data, canHideControl);
5109
+ if (!isHidden) {
5110
+ return field;
5111
+ }
5112
+ } else {
5113
+ return field;
5114
+ }
5115
+ }).map((element, index) => {
5090
5116
  return jsx("div", {
5091
5117
  children: jsx(JsonFormsDispatch, {
5092
5118
  "data-testid": `jsonforms-object-list-defined-elements-dispatch`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.27.0",
3
+ "version": "1.27.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Government of Alberta - React renderers for JSON Forms based on the design system.",
6
6
  "repository": "https://github.com/GovAlta/adsp-monorepo",
@@ -14,6 +14,7 @@ export interface FormStepperOptionProps {
14
14
  previousButtonLabel?: string;
15
15
  previousButtonType?: GoAButtonType;
16
16
  }
17
+ export declare const getProperty: any;
17
18
  export declare const FormStepper: (props: CategorizationStepperLayoutRendererProps) => JSX.Element;
18
19
  export declare const FormStepperControl: (props: CategorizationStepperLayoutRendererProps & import("@jsonforms/core").OwnPropsOfLayout) => import("react/jsx-runtime").JSX.Element;
19
20
  export default FormStepper;