@abgov/jsonforms-components 2.47.0 → 2.47.2

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.
Files changed (2) hide show
  1. package/index.esm.js +40 -39
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -6784,6 +6784,8 @@ const GoAInputBaseControl = props => {
6784
6784
  visible: visible,
6785
6785
  children: jsx(FormFieldWrapper, {
6786
6786
  ref: controlRef,
6787
+ className: "jsonforms-elements-wrapper",
6788
+ id: isStepperReview === true ? `review-base-${path}-element-wrapper` : `${path}-element-wrappe`,
6787
6789
  children: jsx(GoabFormItem, {
6788
6790
  requirement: (_uischema$options$com = uischema == null || (_uischema$options = uischema.options) == null || (_uischema$options = _uischema$options.componentProps) == null ? void 0 : _uischema$options.requirement) != null ? _uischema$options$com : requiredNow ? 'required' : undefined,
6789
6791
  error: isVisited === true ? modifiedErrors : undefined,
@@ -12753,89 +12755,88 @@ const GoABaseTableReviewRenderers$1 = [
12753
12755
  renderer: CalloutReviewControl
12754
12756
  }];
12755
12757
  const FormStepperReviewer = props => {
12756
- var _uischema$options$com, _uischema$options, _componentProps$readO;
12758
+ var _uischema$options$com, _uischema$options;
12757
12759
  const {
12758
12760
  uischema,
12759
12761
  data,
12760
12762
  schema,
12761
12763
  ajv,
12762
12764
  cells,
12763
- enabled,
12764
- navigationFunc
12765
+ enabled
12765
12766
  } = props;
12766
- const componentProps = (_uischema$options$com = (_uischema$options = uischema.options) == null ? void 0 : _uischema$options.componentProps) != null ? _uischema$options$com : {};
12767
- (_componentProps$readO = componentProps == null ? void 0 : componentProps.readOnly) != null ? _componentProps$readO : false;
12767
+ (_uischema$options$com = (_uischema$options = uischema.options) == null ? void 0 : _uischema$options.componentProps) != null ? _uischema$options$com : {};
12768
12768
  const categorization = uischema;
12769
- const categories = categorization.elements.filter(category => isVisible(category, data, '', ajv, undefined));
12769
+ const categories = categorization.elements;
12770
12770
  const rescopeMaps = ['#/properties/albertaAddress', '#/properties/canadianAddress', '#/properties/sin'];
12771
+ const hasVisibleContent = element => {
12772
+ if (!isVisible(element, data, '', ajv, undefined)) {
12773
+ return false;
12774
+ }
12775
+ // Exclude non-reviewable types
12776
+ if (element.type === 'HelpContent' || element.type === 'Callout') {
12777
+ return false;
12778
+ }
12779
+ // Recurse into layouts
12780
+ if (element.elements && Array.isArray(element.elements)) {
12781
+ return element.elements.some(child => hasVisibleContent(child));
12782
+ }
12783
+ return true;
12784
+ };
12771
12785
  return jsx(ReviewItem, {
12772
12786
  children: categories.map((category, categoryIndex) => {
12787
+ // Preserve index stability
12788
+ if (!isVisible(category, data, '', ajv, undefined)) {
12789
+ return null;
12790
+ }
12773
12791
  const categoryLabel = category.label || category.i18n || 'Unknown Category';
12774
- const hasVisibleContent = element => {
12775
- if (!isVisible(element, data, '', ajv, undefined)) {
12776
- return false;
12777
- }
12778
- if (element.type === 'HelpContent' || element.type === 'Callout') {
12779
- return false;
12780
- }
12781
- if (element.elements && Array.isArray(element.elements)) {
12782
- return element.elements.some(child => hasVisibleContent(child));
12783
- }
12784
- return true;
12785
- };
12786
- const elementsToRender = category.elements
12787
- //eslint-disable-next-line
12788
- .filter(field => {
12792
+ // Build visible elements list
12793
+ const elementsToRender = category.elements.filter(field => {
12789
12794
  var _field$rule;
12790
12795
  if (!hasVisibleContent(field)) {
12791
12796
  return false;
12792
12797
  }
12793
12798
  const conditionProps = (_field$rule = field.rule) == null ? void 0 : _field$rule.condition;
12794
- /* istanbul ignore next */
12795
12799
  if (conditionProps && data) {
12796
12800
  var _conditionProps$scope;
12797
- const canHideControlParts = conditionProps == null || (_conditionProps$scope = conditionProps.scope) == null ? void 0 : _conditionProps$scope.split('/');
12798
- const canHideControl = canHideControlParts && canHideControlParts[(canHideControlParts == null ? void 0 : canHideControlParts.length) - 1];
12799
- const isHidden = getProperty(data, canHideControl);
12800
- if (!isHidden) {
12801
- return field;
12802
- }
12803
- return false;
12801
+ const parts = (_conditionProps$scope = conditionProps.scope) == null ? void 0 : _conditionProps$scope.split('/');
12802
+ const property = parts == null ? void 0 : parts[parts.length - 1];
12803
+ const isHidden = getProperty(data, property);
12804
+ return !isHidden;
12804
12805
  }
12805
12806
  return true;
12806
12807
  }).map(e => {
12807
12808
  const layout = e;
12808
12809
  if (rescopeMaps.some(scope => {
12809
12810
  var _layout$elements;
12810
- return (_layout$elements = layout.elements) == null ? void 0 : _layout$elements.map(el => {
12811
- const element = el;
12812
- return element.scope;
12813
- }).includes(scope);
12811
+ return (_layout$elements = layout.elements) == null ? void 0 : _layout$elements.map(el => el.scope).includes(scope);
12814
12812
  })) {
12815
12813
  return layout.elements;
12816
- } else {
12817
- return e;
12818
12814
  }
12815
+ return e;
12819
12816
  }).flat();
12817
+ // Do not render empty categories
12820
12818
  if (elementsToRender.length === 0) {
12821
12819
  return null;
12822
12820
  }
12823
12821
  return jsxs(ReviewItemSection, {
12822
+ className: "jsonforms-table-review-section",
12823
+ id: `jsonforms-table-review-section-${categoryIndex}`,
12824
12824
  children: [jsx(ReviewItemHeader, {
12825
12825
  children: jsx(ReviewItemTitle, {
12826
12826
  children: categoryLabel
12827
12827
  })
12828
12828
  }), elementsToRender.map((element, elementIndex) => {
12829
- const stepperElement = Object.assign({}, element);
12830
- stepperElement.options = Object.assign({}, stepperElement.options, {
12831
- stepId: categoryIndex
12829
+ const stepperElement = Object.assign({}, element, {
12830
+ options: Object.assign({}, element.options, {
12831
+ stepId: categoryIndex
12832
+ })
12832
12833
  });
12833
12834
  return jsx(GoabTable, {
12834
12835
  width: "100%",
12835
12836
  mb: "m",
12836
12837
  children: jsx("tbody", {
12837
12838
  children: jsx(JsonFormsDispatch, {
12838
- "data-testid": `jsonforms-object-list-defined-elements-dispatch`,
12839
+ "data-testid": "jsonforms-object-list-defined-elements-dispatch",
12839
12840
  schema: schema,
12840
12841
  uischema: stepperElement,
12841
12842
  enabled: enabled,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.47.0",
3
+ "version": "2.47.2",
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",