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