@abgov/jsonforms-components 2.78.1 → 2.78.3

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
@@ -12753,6 +12753,20 @@ function prettify(prop) {
12753
12753
  * @param names
12754
12754
  * @returns A key value of the data attribute name and the uiSchema label value
12755
12755
  */
12756
+ // Top-level property names referenced by any control scope (e.g. "#/properties/address/properties/street" -> "address").
12757
+ const extractScopedProperties = (obj, names = new Set()) => {
12758
+ if (Array.isArray(obj)) {
12759
+ obj.forEach(item => extractScopedProperties(item, names));
12760
+ } else if (typeof obj === 'object' && obj !== null) {
12761
+ const typedObj = obj;
12762
+ const match = typeof typedObj.scope === 'string' ? typedObj.scope.match(/^#\/properties\/([^/]+)/) : null;
12763
+ if (match) {
12764
+ names.add(match[1]);
12765
+ }
12766
+ Object.values(typedObj).forEach(value => extractScopedProperties(value, names));
12767
+ }
12768
+ return names;
12769
+ };
12756
12770
  const extractNames = (obj, names = {}) => {
12757
12771
  if (Array.isArray(obj)) {
12758
12772
  obj.forEach(item => extractNames(item, names));
@@ -15495,7 +15509,7 @@ const ctxToNonEmptyCellProps = (ctx, ownProps) => {
15495
15509
  };
15496
15510
  };
15497
15511
  const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellComponent(props) {
15498
- var _schema$properties, _uischema$options, _errors$filter, _uischema$elements;
15512
+ var _schema$properties, _uischema$options, _uischema$options2, _errors$filter, _uischema$elements;
15499
15513
  const {
15500
15514
  schema,
15501
15515
  enabled,
@@ -15534,6 +15548,9 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
15534
15548
  });
15535
15549
  tableKeys = tempTableKeys;
15536
15550
  }
15551
+ // Review only shows properties that have a control in the detail UI schema.
15552
+ const detailProperties = extractScopedProperties(uischema == null || (_uischema$options2 = uischema.options) == null ? void 0 : _uischema$options2.detail);
15553
+ const reviewKeys = detailProperties.size > 0 ? Object.fromEntries(Object.entries(tableKeys).filter(([key]) => detailProperties.has(key))) : tableKeys;
15537
15554
  const hasAnyErrors = Array.isArray(errors) ? (errors == null || (_errors$filter = errors.filter(err => {
15538
15555
  return err.instancePath.includes(rowPath);
15539
15556
  })) == null ? void 0 : _errors$filter.length) > 0 : false;
@@ -15558,7 +15575,7 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
15558
15575
  children: range(count || 0).map((i, key) => {
15559
15576
  const rowData = data && data[i];
15560
15577
  if (!rowData) return null;
15561
- const hasAnyValue = Object.keys(tableKeys).some(key => {
15578
+ const hasAnyValue = Object.keys(reviewKeys).some(key => {
15562
15579
  const value = rowData[key];
15563
15580
  return value !== undefined && value !== null && value !== '';
15564
15581
  });
@@ -15566,7 +15583,7 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
15566
15583
  if (!hasAnyValue && !hasRowErrors) return null;
15567
15584
  return jsx(ReviewItemFrame, {
15568
15585
  "data-testid": `${rowPath}.objectList-${key}`,
15569
- children: Object.entries(tableKeys).map(([key, label]) => {
15586
+ children: Object.entries(reviewKeys).map(([key, label]) => {
15570
15587
  var _required$includes, _properties$key;
15571
15588
  const value = rowData[key];
15572
15589
  const isRequiredField = (_required$includes = required == null ? void 0 : required.includes(key)) != null ? _required$includes : false;
@@ -15582,9 +15599,9 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
15582
15599
  let reviewError = '';
15583
15600
  if (fieldError) {
15584
15601
  const raw = fieldError.message || '';
15585
- reviewError = raw.includes('required') ? `${capitalizeFirstLetter(key.replace(/[_-]/g, ' '))} is required` : raw;
15602
+ reviewError = raw.includes('required') ? `${capitalizeFirstLetter(label.replace(/[_-]/g, ' '))} is required` : raw;
15586
15603
  } else if (isRequiredField && isEmptyValue) {
15587
- reviewError = `${capitalizeFirstLetter(key.replace(/[_-]/g, ' '))} is required`;
15604
+ reviewError = `${capitalizeFirstLetter(label.replace(/[_-]/g, ' '))} is required`;
15588
15605
  }
15589
15606
  return jsxs("div", {
15590
15607
  style: {
@@ -15798,8 +15815,8 @@ const ObjectArrayList = ({
15798
15815
  }) => {
15799
15816
  const isEmptyList = count === 0;
15800
15817
  if (isEmptyList) {
15801
- var _uischema$options$noD, _uischema$options2;
15802
- const noDataMessage = (_uischema$options$noD = (_uischema$options2 = uischema.options) == null ? void 0 : _uischema$options2.noDataMessage) != null ? _uischema$options$noD : 'No data';
15818
+ var _uischema$options$noD, _uischema$options3;
15819
+ const noDataMessage = (_uischema$options$noD = (_uischema$options3 = uischema.options) == null ? void 0 : _uischema$options3.noDataMessage) != null ? _uischema$options$noD : 'No data';
15803
15820
  return jsx(EmptyList, {
15804
15821
  noDataMessage: noDataMessage,
15805
15822
  numColumns: getValidColumnProps(schema).length + 1,
@@ -15826,7 +15843,7 @@ const ObjectArrayList = ({
15826
15843
  }, 0);
15827
15844
  };
15828
15845
  const ObjectArrayControl = props => {
15829
- var _registers$categories, _registers$categories2, _registers$categories3, _registers$categories4, _uischema$options5;
15846
+ var _registers$categories, _registers$categories2, _registers$categories3, _registers$categories4, _uischema$options6;
15830
15847
  const [registers, dispatch] = useReducer(objectListReducer, initialState);
15831
15848
  const [open, setOpen] = useState(false);
15832
15849
  const [rowData, setRowData] = useState(0);
@@ -15865,8 +15882,8 @@ const ObjectArrayControl = props => {
15865
15882
  };
15866
15883
  // eslint-disable-next-line
15867
15884
  const addItem = (path, value) => {
15868
- var _uischema$options3, _uischema$options4;
15869
- const maxItems = (_uischema$options3 = uischema.options) != null && (_uischema$options3 = _uischema$options3.detail) != null && _uischema$options3.maxItems ? (_uischema$options4 = uischema.options) == null || (_uischema$options4 = _uischema$options4.detail) == null ? void 0 : _uischema$options4.maxItems : DEFAULT_MAX_ITEMS;
15885
+ var _uischema$options4, _uischema$options5;
15886
+ const maxItems = (_uischema$options4 = uischema.options) != null && (_uischema$options4 = _uischema$options4.detail) != null && _uischema$options4.maxItems ? (_uischema$options5 = uischema.options) == null || (_uischema$options5 = _uischema$options5.detail) == null ? void 0 : _uischema$options5.maxItems : DEFAULT_MAX_ITEMS;
15870
15887
  if (latestCount < maxItems) {
15871
15888
  return () => {
15872
15889
  const currentRows = hasDataRows ? parsedData : Object.keys(latestData).sort((a, b) => Number(a) - Number(b)).map(key => latestData[key]);
@@ -15977,11 +15994,11 @@ const ObjectArrayControl = props => {
15977
15994
  });
15978
15995
  }, [parsedData, path]);
15979
15996
  const controlElement = uischema;
15980
- const listTitle = label || ((_uischema$options5 = uischema.options) == null ? void 0 : _uischema$options5.title);
15997
+ const listTitle = label || ((_uischema$options6 = uischema.options) == null ? void 0 : _uischema$options6.title);
15981
15998
  const isInReview = isStepperReview === true;
15982
15999
  const isListWithDetail = controlElement.type === 'ListWithDetail';
15983
16000
  if (isInReview) {
15984
- var _uischema$options6, _uischema$options7;
16001
+ var _uischema$options7, _uischema$options8;
15985
16002
  return jsx("tr", {
15986
16003
  children: jsxs(PageReviewContainer, {
15987
16004
  colSpan: 3,
@@ -16013,12 +16030,12 @@ const ObjectArrayControl = props => {
16013
16030
  },
16014
16031
  children: maxItemsError
16015
16032
  })]
16016
- }), showChangeButtons && ((_uischema$options6 = uischema.options) == null ? void 0 : _uischema$options6.stepId) !== undefined && !((_uischema$options7 = uischema.options) != null && (_uischema$options7 = _uischema$options7.componentProps) != null && _uischema$options7.readOnly) && jsx(GoabButton, {
16033
+ }), showChangeButtons && ((_uischema$options7 = uischema.options) == null ? void 0 : _uischema$options7.stepId) !== undefined && !((_uischema$options8 = uischema.options) != null && (_uischema$options8 = _uischema$options8.componentProps) != null && _uischema$options8.readOnly) && jsx(GoabButton, {
16017
16034
  type: "text",
16018
16035
  size: "compact",
16019
16036
  onClick: () => {
16020
- var _uischema$options8;
16021
- return reportChange((_uischema$options8 = uischema.options) == null ? void 0 : _uischema$options8.stepId, uischema.scope);
16037
+ var _uischema$options9;
16038
+ return reportChange((_uischema$options9 = uischema.options) == null ? void 0 : _uischema$options9.stepId, uischema.scope);
16022
16039
  },
16023
16040
  children: "Change"
16024
16041
  })]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.78.1",
3
+ "version": "2.78.3",
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",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": "1.0.0",
3
- "generatedAt": "2026-09-18T15:58:28.089Z",
4
- "sourceCommit": "2b81b8262d5fb2c49f666e5f742d4cf1c61b8e0b",
3
+ "generatedAt": "2026-09-24T16:54:07.414Z",
4
+ "sourceCommit": "6e29aac20db75925ddab749fa1d9ed84bba71548",
5
5
  "sourcePath": "libs/jsonforms-components/src/index.ts",
6
6
  "rendererCount": 23,
7
7
  "renderers": [
@@ -9,6 +9,7 @@ export declare function prettify(prop: string): string;
9
9
  * @param names
10
10
  * @returns A key value of the data attribute name and the uiSchema label value
11
11
  */
12
+ export declare const extractScopedProperties: (obj: unknown, names?: Set<string>) => Set<string>;
12
13
  export declare const extractNames: (obj: unknown, names?: Record<string, string>) => Record<string, string>;
13
14
  export interface TableProps {
14
15
  itemsSchema: Record<string, unknown>;