@abgov/jsonforms-components 2.60.14 → 2.60.16

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
@@ -8888,7 +8888,7 @@ styled.div(_t18$1 || (_t18$1 = _$8`
8888
8888
  padding: 0 1.5rem 0 0;
8889
8889
  border: 1px solid #dcdcdc;
8890
8890
  `));
8891
- const TableTHHeader = styled.th(_t19$1 || (_t19$1 = _$8`
8891
+ styled.th(_t19$1 || (_t19$1 = _$8`
8892
8892
  background-color: var(--goa-color-greyscale-100) !important;
8893
8893
  vertical-align: top;
8894
8894
  `));
@@ -9376,7 +9376,13 @@ const SummaryDisplay = ({
9376
9376
  paddingTop: 'var(--goa-space-xs)',
9377
9377
  paddingBottom: 'var(--goa-space-xs)'
9378
9378
  },
9379
- children: String(pair.value)
9379
+ children: typeof pair.value === 'boolean' ? pair.value ? 'Yes' : 'No' : pair.value !== null && typeof pair.value === 'object' ? (() => {
9380
+ const v = pair.value;
9381
+ if (('day' in v || 'date' in v) && 'month' in v && 'year' in v) {
9382
+ return `${v.year}-${v.month}-${'day' in v ? v.day : v.date}`;
9383
+ }
9384
+ return Object.values(v).filter(x => x !== undefined && x !== null && x !== '').join(' ');
9385
+ })() : String(pair.value)
9380
9386
  })]
9381
9387
  }, `${pair.label}-${index}`))
9382
9388
  })
@@ -11752,6 +11758,16 @@ const DeleteDialog = /*#__PURE__*/React.memo(function DeleteDialog({
11752
11758
  }, 1);
11753
11759
  });
11754
11760
 
11761
+ const jsonPreviewStyle = {
11762
+ display: 'block',
11763
+ width: '100%',
11764
+ boxSizing: 'border-box',
11765
+ margin: 0,
11766
+ padding: 0,
11767
+ whiteSpace: 'pre-wrap',
11768
+ textAlign: 'left',
11769
+ overflowX: 'auto'
11770
+ };
11755
11771
  function prettify(prop) {
11756
11772
  return prop.replace(/([A-Z])/g, ' $1').replace(/[_-]/g, ' ').replace(/^./, c => c.toUpperCase());
11757
11773
  }
@@ -11853,28 +11869,36 @@ const renderCellColumn = ({
11853
11869
  const path = `/${rowPath}/${index}/${element}/${index === 0 ? index : index - 1}`;
11854
11870
  const nestedErrors = errors == null ? void 0 : errors.filter(e => e.instancePath.includes(path));
11855
11871
  /* istanbul ignore next */
11856
- if (typeof data === 'string') {
11872
+ if (typeof data === 'boolean') {
11873
+ return data ? 'Yes' : 'No';
11874
+ } else if (typeof data === 'number') {
11875
+ return String(data);
11876
+ } else if (typeof data === 'string') {
11857
11877
  return data;
11858
11878
  } else if (typeof data === 'object' || Array.isArray(data)) {
11859
11879
  const result = Object.keys(data);
11860
11880
  if (!isRequired && nestedErrors.length === 0) {
11861
- if ('year' in data && 'month' in data && 'day' in data) {
11881
+ if ('year' in data && 'month' in data && ('day' in data || 'date' in data)) {
11862
11882
  const dateObj = data;
11863
- return `${dateObj.year}-${dateObj.month}-${dateObj.day}`;
11883
+ const dayValue = 'day' in dateObj ? dateObj.day : dateObj.date;
11884
+ return `${dateObj.year}-${dateObj.month}-${dayValue}`;
11864
11885
  }
11865
11886
  return jsx("pre", {
11887
+ style: jsonPreviewStyle,
11866
11888
  children: JSON.stringify(data, null, 2)
11867
11889
  });
11868
11890
  } else if (result.length === 0) {
11869
11891
  return renderWarningCell();
11870
11892
  } else if (result.length > 0 && (isObjectArrayEmpty(data) || nestedErrors.length > 0)) {
11871
11893
  return jsx("pre", {
11894
+ style: jsonPreviewStyle,
11872
11895
  children: renderWarningCell(JSON.stringify(data, null, 2))
11873
11896
  });
11874
11897
  } else if (data !== undefined && result.length > 0 && error !== '' && error !== undefined) {
11875
11898
  const values = Object.values(data);
11876
11899
  if (values && values.length > 0) {
11877
11900
  return jsx("pre", {
11901
+ style: jsonPreviewStyle,
11878
11902
  children: renderWarningCell(JSON.stringify(values.at(0), null, 2))
11879
11903
  });
11880
11904
  }
@@ -12010,41 +12034,103 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
12010
12034
  return err.instancePath.includes(rowPath);
12011
12035
  })) == null ? void 0 : _errors$filter.length) > 0 : false;
12012
12036
  return jsxs(NonEmptyCellStyle, {
12013
- children: [uischema == null || (_uischema$elements = uischema.elements) == null ? void 0 : _uischema$elements.map(element => {
12037
+ children: [!isInReview && (uischema == null || (_uischema$elements = uischema.elements) == null ? void 0 : _uischema$elements.map(element => {
12014
12038
  return jsx(JsonFormsDispatch, {
12015
12039
  "data-testid": `jsonforms-object-list-defined-elements-dispatch`,
12016
12040
  schema: schema,
12017
12041
  uischema: element,
12018
12042
  path: rowPath,
12019
12043
  enabled: enabled,
12020
- renderers: isInReview ? GoAReviewRenderers : renderers,
12044
+ renderers: renderers,
12021
12045
  cells: cells
12022
12046
  }, rowPath);
12023
- }), properties && Object.keys(properties).length > 0 && jsxs(Fragment, {
12024
- children: [jsx(FixTableHeaderAlignment, {
12047
+ })), properties && Object.keys(properties).length > 0 && jsxs(Fragment, {
12048
+ children: [isInReview ? jsx("div", {
12049
+ style: {
12050
+ padding: '0.75rem 0'
12051
+ },
12052
+ children: range(count || 0).map(i => {
12053
+ const rowData = data && data[i];
12054
+ if (!rowData) return null;
12055
+ const hasAnyValue = Object.keys(tableKeys).some(key => {
12056
+ const value = rowData[key];
12057
+ return value !== undefined && value !== null && value !== '';
12058
+ });
12059
+ const hasRowErrors = (errors || []).some(e => e.instancePath.includes(`/${props.rowPath.replace(/\./g, '/')}/${i}`));
12060
+ if (!hasAnyValue && !hasRowErrors) return null;
12061
+ return jsx("div", {
12062
+ style: {
12063
+ marginBottom: '1.5rem'
12064
+ },
12065
+ children: Object.entries(tableKeys).map(([key, label]) => {
12066
+ var _required$includes, _properties$key;
12067
+ const value = rowData[key];
12068
+ const isRequiredField = (_required$includes = required == null ? void 0 : required.includes(key)) != null ? _required$includes : false;
12069
+ const fieldPath = `/${props.rowPath.replace(/\./g, '/')}/${i}/${key}`;
12070
+ const rowPathMatch = `/${props.rowPath.replace(/\./g, '/')}/${i}`;
12071
+ const fieldError = (errors || []).find(e => {
12072
+ var _msg$match;
12073
+ const msg = e.message || '';
12074
+ const requiredProperty = (_msg$match = msg.match(/'([^']+)'/)) == null ? void 0 : _msg$match[1];
12075
+ return e.instancePath === fieldPath || e.instancePath === rowPathMatch && msg.includes(key) || e.instancePath === rowPathMatch && requiredProperty === key;
12076
+ });
12077
+ const isEmptyValue = value === undefined || value === null || value === '';
12078
+ if (isEmptyValue && !isRequiredField && !fieldError) return null;
12079
+ let reviewError = '';
12080
+ if (fieldError) {
12081
+ const raw = fieldError.message || '';
12082
+ reviewError = raw.includes('required') ? `${capitalizeFirstLetter(key.replace(/[_-]/g, ' '))} is required` : raw;
12083
+ } else if (isRequiredField && isEmptyValue) {
12084
+ reviewError = `${capitalizeFirstLetter(key.replace(/[_-]/g, ' '))} is required`;
12085
+ }
12086
+ return jsxs("div", {
12087
+ style: {
12088
+ display: 'flex',
12089
+ marginBottom: '0.5rem',
12090
+ alignItems: 'center'
12091
+ },
12092
+ children: [jsxs("strong", {
12093
+ style: {
12094
+ width: '50%',
12095
+ flexShrink: 0
12096
+ },
12097
+ children: [(properties == null || (_properties$key = properties[key]) == null ? void 0 : _properties$key.title) || (label !== key ? label : key.replace(/([A-Z])/g, ' $1').replace(/[_-]/g, ' ').replace(/^./, c => c.toUpperCase())), isRequiredField && jsx(RequiredSpan, {
12098
+ children: " (required)"
12099
+ }), " :"]
12100
+ }), jsx("span", {
12101
+ style: {
12102
+ marginLeft: '1rem'
12103
+ },
12104
+ "data-testid": `#/properties/${key}-input-${i}-review`,
12105
+ children: renderCellColumn({
12106
+ data: isEmptyValue ? undefined : value,
12107
+ error: reviewError,
12108
+ isRequired: isRequiredField,
12109
+ errors: errors !== undefined ? errors : [],
12110
+ element: key,
12111
+ rowPath,
12112
+ index: i
12113
+ })
12114
+ })]
12115
+ }, key);
12116
+ })
12117
+ }, i);
12118
+ })
12119
+ }) : jsx(FixTableHeaderAlignment, {
12025
12120
  children: jsxs(GoabTable, {
12026
12121
  width: "100%",
12027
12122
  children: [jsx("thead", {
12028
12123
  children: jsxs("tr", {
12029
12124
  children: [Object.entries(tableKeys).map(([value, index]) => {
12030
12125
  const currentProperty = properties[value];
12031
- if (!isInReview) {
12032
- return jsx("th", {
12033
- children: jsxs("p", {
12034
- children: [(currentProperty == null ? void 0 : currentProperty.title) || index, (required == null ? void 0 : required.includes(value)) && jsx(RequiredSpan, {
12035
- children: "(required)"
12036
- })]
12037
- })
12038
- }, index);
12039
- }
12040
- return jsx(TableTHHeader, {
12126
+ return jsx("th", {
12041
12127
  children: jsxs("p", {
12042
- children: [`${(currentProperty == null ? void 0 : currentProperty.title) || index}`, (required == null ? void 0 : required.includes(value)) && jsxs(RequiredSpan, {
12043
- children: [jsx("br", {}), " (required)"]
12128
+ children: [(currentProperty == null ? void 0 : currentProperty.title) || index, (required == null ? void 0 : required.includes(value)) && jsx(RequiredSpan, {
12129
+ children: "(required)"
12044
12130
  })]
12045
12131
  })
12046
12132
  }, index);
12047
- }), isInReview !== true && jsx("th", {
12133
+ }), jsx("th", {
12048
12134
  children: jsx("p", {
12049
12135
  children: "Actions"
12050
12136
  })
@@ -12092,26 +12178,6 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
12092
12178
  if (error != null && (_error$message = error.message) != null && _error$message.includes('must NOT have fewer') && required.find(r => r === schemaName) && (isEmptyBoolean(schema, currentData) || isEmptyNumber(schema, currentData))) {
12093
12179
  humanMessage = `${capitalizeFirstLetter(schemaName)} is required`;
12094
12180
  }
12095
- if (isInReview === true) {
12096
- var _required$includes;
12097
- return jsx("td", {
12098
- children: jsx("div", {
12099
- "data-testid": `#/properties/${schemaName}-input-${i}-review`,
12100
- style: {
12101
- display: 'block'
12102
- },
12103
- children: renderCellColumn({
12104
- data: currentData !== '' && currentData !== null && currentData !== undefined ? currentData : undefined,
12105
- error: humanMessage,
12106
- isRequired: (_required$includes = required == null ? void 0 : required.includes(element)) != null ? _required$includes : false,
12107
- errors: errors !== undefined ? errors : [],
12108
- element,
12109
- rowPath,
12110
- index: i
12111
- })
12112
- })
12113
- }, ix);
12114
- }
12115
12181
  return jsx("td", {
12116
12182
  children: jsx(GoabFormItem, {
12117
12183
  error: humanMessage != null ? humanMessage : '',
@@ -12584,6 +12650,7 @@ const ArrayControlReview = props => {
12584
12650
  const GoAArrayControlRenderer = withJsonFormsControlProps(ArrayControlBase);
12585
12651
  const GoAArrayControlReviewRenderer = withJsonFormsControlProps(ArrayControlReview);
12586
12652
  const PrimitiveArrayControl = props => {
12653
+ var _enumerators$function;
12587
12654
  const {
12588
12655
  data,
12589
12656
  path,
@@ -12595,8 +12662,13 @@ const PrimitiveArrayControl = props => {
12595
12662
  renderers,
12596
12663
  cells
12597
12664
  } = props;
12665
+ const enumerators = useContext(JsonFormContext);
12598
12666
  const rawItems = Array.isArray(data) ? data : [];
12599
12667
  const items = rawItems.filter(item => item !== undefined && item !== null);
12668
+ const deleteTriggerFunction = enumerators == null || (_enumerators$function = enumerators.functions) == null ? void 0 : _enumerators$function.get('delete-file');
12669
+ const deleteTrigger = deleteTriggerFunction && deleteTriggerFunction();
12670
+ const fileListValue = enumerators == null ? void 0 : enumerators.data.get('file-list');
12671
+ const fileList = fileListValue && fileListValue();
12600
12672
  useEffect(() => {
12601
12673
  if (rawItems.length !== items.length) {
12602
12674
  handleChange(path, items.length > 0 ? items : undefined);
@@ -12609,9 +12681,20 @@ const PrimitiveArrayControl = props => {
12609
12681
  const getOptionLabel = option => typeof option === 'string' ? option : option.title || option.const;
12610
12682
  const getOptionDescription = option => typeof option === 'string' ? undefined : option.description;
12611
12683
  const removeItem = index => {
12684
+ const itemSchema = schema == null ? void 0 : schema.items;
12685
+ const removedItem = items[index];
12686
+ const itemPath = composePaths(path, `${index}`);
12687
+ if ((itemSchema == null ? void 0 : itemSchema.format) === 'file-urn' && deleteTrigger && removedItem) {
12688
+ var _fileList$itemPath;
12689
+ const allUploadedFiles = Object.values(fileList || {}).flat() || [];
12690
+ const rowFile = (fileList == null || (_fileList$itemPath = fileList[itemPath]) == null ? void 0 : _fileList$itemPath.find(file => (file == null ? void 0 : file.urn) === removedItem)) || allUploadedFiles.find(file => (file == null ? void 0 : file.urn) === removedItem);
12691
+ if (rowFile != null && rowFile.urn) {
12692
+ deleteTrigger(rowFile, itemPath);
12693
+ }
12694
+ }
12612
12695
  const copy = [...items];
12613
12696
  copy.splice(index, 1);
12614
- handleChange(path, copy);
12697
+ handleChange(path, copy.length > 0 ? copy : undefined);
12615
12698
  };
12616
12699
  const getPrimitiveArrayOptions = schema => {
12617
12700
  const itemSchema = schema == null ? void 0 : schema.items;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.60.14",
3
+ "version": "2.60.16",
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-04-27T15:21:40.298Z",
4
- "sourceCommit": "e57ed99fcade0b72edeaba79895fc83296644fdc",
3
+ "generatedAt": "2026-04-27T20:33:20.640Z",
4
+ "sourceCommit": "39950b0288e24ea3e4d895bf4bbe2b79c542625f",
5
5
  "sourcePath": "libs/jsonforms-components/src/index.ts",
6
6
  "rendererCount": 33,
7
7
  "renderers": [