@abgov/jsonforms-components 2.12.0 → 2.13.0

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 +57 -50
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -3548,9 +3548,9 @@ const onChangeForNumericControl = props => {
3548
3548
  };
3549
3549
 
3550
3550
  let _$a = t => t,
3551
- _t$b,
3551
+ _t$a,
3552
3552
  _t2$7;
3553
- styled.div(_t$b || (_t$b = _$a`
3553
+ styled.div(_t$a || (_t$a = _$a`
3554
3554
  height: 70vh;
3555
3555
  overflow-y: auto;
3556
3556
  padding-left: var(--goa-space-2xs);
@@ -5189,15 +5189,15 @@ const JsonFormRegisterProvider = ({
5189
5189
  };
5190
5190
 
5191
5191
  let _$9 = t => t,
5192
- _t$a,
5192
+ _t$9,
5193
5193
  _t2$6,
5194
5194
  _t3$5,
5195
5195
  _t4$5,
5196
- _t5$3,
5196
+ _t5$4,
5197
5197
  _t6$3,
5198
5198
  _t7$2,
5199
5199
  _t8$2;
5200
- const FormFieldWrapper = styled.div(_t$a || (_t$a = _$9`
5200
+ const FormFieldWrapper = styled.div(_t$9 || (_t$9 = _$9`
5201
5201
  margin-bottom: var(--goa-space-l);
5202
5202
  `));
5203
5203
  const WarningIconDiv = styled.div(_t2$6 || (_t2$6 = _$9`
@@ -5220,7 +5220,7 @@ const PageReviewNameCol = styled.td(_t4$5 || (_t4$5 = _$9`
5220
5220
  padding-bottom: var(--goa-space-s);
5221
5221
  padding-right: var(--goa-space-m);
5222
5222
  `));
5223
- const PageReviewValueCol = styled.td(_t5$3 || (_t5$3 = _$9`
5223
+ const PageReviewValueCol = styled.td(_t5$4 || (_t5$4 = _$9`
5224
5224
  width: 20%;
5225
5225
  text-align: left;
5226
5226
  `));
@@ -5458,11 +5458,11 @@ const ALT_KEY = 'Alt';
5458
5458
  const SHIFT_KEY = 'Shift';
5459
5459
 
5460
5460
  let _$8 = t => t,
5461
- _t$9,
5461
+ _t$8,
5462
5462
  _t2$5,
5463
5463
  _t3$4,
5464
5464
  _t4$4;
5465
- const GoADropdownTextbox = styled.div(_t$9 || (_t$9 = _$8`
5465
+ const GoADropdownTextbox = styled.div(_t$8 || (_t$8 = _$8`
5466
5466
  border-radius: var(--goa-space-2xs);
5467
5467
  box-shadow: ${0};
5468
5468
  &:hover {
@@ -6564,7 +6564,7 @@ const GoABooleanRadioControlTester = rankWith(3, and(isBooleanControl, optionIs(
6564
6564
  const GoABooleanRadioControl = withJsonFormsControlProps(BooleanRadioControl);
6565
6565
 
6566
6566
  let _$7 = t => t,
6567
- _t$8;
6567
+ _t$7;
6568
6568
  const Checkboxes = ({
6569
6569
  children,
6570
6570
  orientation,
@@ -6576,7 +6576,7 @@ const Checkboxes = ({
6576
6576
  children: children
6577
6577
  });
6578
6578
  };
6579
- const CheckBoxGroupDiv = styled.div(_t$8 || (_t$8 = _$7`
6579
+ const CheckBoxGroupDiv = styled.div(_t$7 || (_t$7 = _$7`
6580
6580
  .horizontal {
6581
6581
  display: flex;
6582
6582
  flex-direction: row;
@@ -6783,7 +6783,7 @@ const GoAInputBaseTableReview = props => {
6783
6783
  const GoAInputBaseTableReviewControl = withJsonFormsControlProps(GoAInputBaseTableReview);
6784
6784
 
6785
6785
  let _$6 = t => t,
6786
- _t$7;
6786
+ _t$6;
6787
6787
  const renderLayoutElements = (elements, schema, path, enabled, renderers, cells) => {
6788
6788
  return elements.map((child, index) => jsx(JsonFormsDispatch, {
6789
6789
  uischema: child,
@@ -6862,18 +6862,18 @@ const ReviewLayoutRenderer = ({
6862
6862
  }
6863
6863
  }
6864
6864
  };
6865
- const ReviewGrid = styled.div(_t$7 || (_t$7 = _$6`
6865
+ const ReviewGrid = styled.div(_t$6 || (_t$6 = _$6`
6866
6866
  display: grid;
6867
6867
  grid-template-columns: repeat(auto-fit, minmax(250px, calc(50% - 8px)));
6868
6868
  gap: 16px;
6869
6869
  `));
6870
6870
 
6871
6871
  let _$5 = t => t,
6872
- _t$6,
6872
+ _t$5,
6873
6873
  _t2$4,
6874
6874
  _t3$3,
6875
6875
  _t4$3,
6876
- _t5$2,
6876
+ _t5$3,
6877
6877
  _t6$2,
6878
6878
  _t7$1,
6879
6879
  _t8$1,
@@ -6890,7 +6890,7 @@ let _$5 = t => t,
6890
6890
  _t19$1,
6891
6891
  _t20$1,
6892
6892
  _t21;
6893
- const ReviewItem = styled.div(_t$6 || (_t$6 = _$5`
6893
+ const ReviewItem = styled.div(_t$5 || (_t$5 = _$5`
6894
6894
  display: flex;
6895
6895
  flex-direction: column;
6896
6896
  border: var(--goa-border-width-s) solid grey;
@@ -6923,7 +6923,7 @@ const ReviewItemTitle = styled.div(_t4$3 || (_t4$3 = _$5`
6923
6923
  line-height: var(--goa-space-xl);
6924
6924
  font-weight: 300;
6925
6925
  `));
6926
- const Anchor = styled.div(_t5$2 || (_t5$2 = _$5`
6926
+ const Anchor = styled.div(_t5$3 || (_t5$3 = _$5`
6927
6927
  color: #0070c4;
6928
6928
  text-decoration: underline;
6929
6929
  outline: none;
@@ -8240,8 +8240,8 @@ const FormStepperPageReviewer = props => {
8240
8240
  withAjvProps(withTranslateProps(withJsonFormsLayoutProps(FormStepperPageReviewer)));
8241
8241
 
8242
8242
  let _$4 = t => t,
8243
- _t$5;
8244
- const BackButtonWrapper = styled.span(_t$5 || (_t$5 = _$4`
8243
+ _t$4;
8244
+ const BackButtonWrapper = styled.span(_t$4 || (_t$4 = _$4`
8245
8245
  .back-link::before {
8246
8246
  content: '';
8247
8247
  display: inline-block;
@@ -8516,7 +8516,7 @@ function _objectWithoutPropertiesLoose(r, e) {
8516
8516
  }
8517
8517
 
8518
8518
  let _$3 = t => t,
8519
- _t$4;
8519
+ _t$3;
8520
8520
  const GoAContextMenuIcon = props => {
8521
8521
  return jsx(GoAIconButton, {
8522
8522
  icon: props.type,
@@ -8527,7 +8527,7 @@ const GoAContextMenuIcon = props => {
8527
8527
  disabled: props.disabled
8528
8528
  });
8529
8529
  };
8530
- const GoAContextMenu = styled.div(_t$4 || (_t$4 = _$3`
8530
+ const GoAContextMenu = styled.div(_t$3 || (_t$3 = _$3`
8531
8531
  display: flex;
8532
8532
  align-items: center;
8533
8533
  background-color: #fff;
@@ -8575,10 +8575,10 @@ const DeleteFileModal = ({
8575
8575
  };
8576
8576
 
8577
8577
  let _2 = t => t,
8578
- _t$3,
8579
8578
  _t2$3,
8580
8579
  _t3$2,
8581
- _t4$2;
8580
+ _t4$2,
8581
+ _t5$2;
8582
8582
  const _excluded$3 = ["data", "path", "handleChange", "uischema"];
8583
8583
  const DELAY_DELETE_TIMEOUT_MS = 5;
8584
8584
  const FileUploaderReview = props => {
@@ -8593,7 +8593,7 @@ const FileUploader = _ref => {
8593
8593
  uischema
8594
8594
  } = _ref,
8595
8595
  props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
8596
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
8596
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
8597
8597
  const enumerators = useContext(JsonFormContext);
8598
8598
  const uploadTriggerFunction = (_a = enumerators === null || enumerators === void 0 ? void 0 : enumerators.functions) === null || _a === void 0 ? void 0 : _a.get('upload-file');
8599
8599
  const uploadTrigger = uploadTriggerFunction && uploadTriggerFunction();
@@ -8617,22 +8617,27 @@ const FileUploader = _ref => {
8617
8617
  const propertyId = i18nKeyPrefix;
8618
8618
  const variant = ((_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.variant) || 'button';
8619
8619
  const noDownloadButton = (_f = (_e = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _e === void 0 ? void 0 : _e.format) === null || _f === void 0 ? void 0 : _f.noDownloadButton;
8620
- const multiFileUploader = variant === 'dragdrop';
8620
+ const noDownloadButtonInReview = (_j = (_h = (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.format) === null || _h === void 0 ? void 0 : _h.review) === null || _j === void 0 ? void 0 : _j.noDownloadButton;
8621
+ const noDeleteButton = (_m = (_l = (_k = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _k === void 0 ? void 0 : _k.format) === null || _l === void 0 ? void 0 : _l.review) === null || _m === void 0 ? void 0 : _m.noDeleteButton;
8621
8622
  const [deleteHide, setDeleteHide] = useState(false);
8622
- const fileListLength = fileList && ((_g = fileList[props.i18nKeyPrefix]) === null || _g === void 0 ? void 0 : _g.length) || 0;
8623
+ const fileListLength = fileList && ((_o = fileList[props.i18nKeyPrefix]) === null || _o === void 0 ? void 0 : _o.length) || 0;
8624
+ const maxFiles = (_r = (_q = (_p = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _p === void 0 ? void 0 : _p.componentProps) === null || _q === void 0 ? void 0 : _q.maximum) !== null && _r !== void 0 ? _r : 1;
8625
+ const isMultiFile = maxFiles > 1;
8623
8626
  function uploadFile(file) {
8624
- if (uploadTrigger) {
8625
- if (!multiFileUploader) {
8626
- const fileInList = getFile(fileListLength - 1);
8627
- if (fileInList) {
8628
- deleteTrigger(fileInList, propertyId);
8627
+ if (!uploadTrigger) return;
8628
+ if (fileListLength >= maxFiles) {
8629
+ if (!isMultiFile && maxFiles === 1) {
8630
+ const existingFile = getFile(0);
8631
+ if (existingFile) {
8632
+ deleteTrigger(existingFile, propertyId);
8629
8633
  }
8634
+ } else {
8635
+ return;
8630
8636
  }
8631
- setLoadingFileName(file === null || file === void 0 ? void 0 : file.name);
8632
- // To support multipleFileUploader, the propertyId (path) is in propertyId.index format
8633
- uploadTrigger(file, `${propertyId}.${fileListLength}`);
8634
- setDeleteHide(false);
8635
8637
  }
8638
+ setLoadingFileName(file === null || file === void 0 ? void 0 : file.name);
8639
+ uploadTrigger(file, `${propertyId}.${fileListLength}`);
8640
+ setDeleteHide(false);
8636
8641
  }
8637
8642
  function downloadFile(file) {
8638
8643
  if (downloadTrigger) {
@@ -8675,13 +8680,13 @@ const FileUploader = _ref => {
8675
8680
  const timeoutId = setTimeout(delayedFunction, 1);
8676
8681
  return () => clearTimeout(timeoutId);
8677
8682
  }, [handleChange, fileList, propertyId]);
8678
- const readOnly = ((_j = (_h = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _h === void 0 ? void 0 : _h.componentProps) === null || _j === void 0 ? void 0 : _j.readOnly) === true || (props === null || props === void 0 ? void 0 : props.isStepperReview) === true || user === null;
8679
- const maxFileSize = (_m = (_l = (_k = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _k === void 0 ? void 0 : _k.componentProps) === null || _l === void 0 ? void 0 : _l.maxFileSize) !== null && _m !== void 0 ? _m : '';
8680
- const accept = (_q = (_p = (_o = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _o === void 0 ? void 0 : _o.componentProps) === null || _p === void 0 ? void 0 : _p.accept) !== null && _q !== void 0 ? _q : '';
8683
+ const readOnly = ((_t = (_s = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _s === void 0 ? void 0 : _s.componentProps) === null || _t === void 0 ? void 0 : _t.readOnly) === true || (props === null || props === void 0 ? void 0 : props.isStepperReview) === true || user === null;
8684
+ const maxFileSize = (_w = (_v = (_u = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _u === void 0 ? void 0 : _u.componentProps) === null || _v === void 0 ? void 0 : _v.maxFileSize) !== null && _w !== void 0 ? _w : '';
8685
+ const accept = (_z = (_y = (_x = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _x === void 0 ? void 0 : _x.componentProps) === null || _y === void 0 ? void 0 : _y.accept) !== null && _z !== void 0 ? _z : '';
8681
8686
  if (!enumerators) {
8682
8687
  return jsx(Fragment, {});
8683
8688
  }
8684
- const helpText = (_r = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _r === void 0 ? void 0 : _r.help;
8689
+ const helpText = (_0 = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _0 === void 0 ? void 0 : _0.help;
8685
8690
  const sentenceCaseLabel = convertToSentenceCase(label);
8686
8691
  const DownloadFileWidget = ({
8687
8692
  index
@@ -8690,7 +8695,7 @@ const FileUploader = _ref => {
8690
8695
  const [showFileDeleteConfirmation, setShowFileDeleteConfirmation] = useState(false);
8691
8696
  return jsx("div", {
8692
8697
  children: readOnly ? jsxs(AttachmentBorderDisabled, {
8693
- children: [getFileName(index), jsx(GoAContextMenuIcon, {
8698
+ children: [getFileName(index), noDownloadButtonInReview !== true && jsx(GoAContextMenuIcon, {
8694
8699
  testId: "download-icon",
8695
8700
  title: "Download",
8696
8701
  type: "download",
@@ -8705,7 +8710,7 @@ const FileUploader = _ref => {
8705
8710
  title: "Download",
8706
8711
  type: "download",
8707
8712
  onClick: () => downloadFile(getFile(index))
8708
- }), jsx(GoAContextMenuIcon, {
8713
+ }), noDeleteButton !== true && jsx(GoAContextMenuIcon, {
8709
8714
  "data-testid": "delete-icon",
8710
8715
  title: "Delete",
8711
8716
  type: "trash",
@@ -8763,11 +8768,9 @@ const FileUploader = _ref => {
8763
8768
  })
8764
8769
  })
8765
8770
  }) : jsx("div", {
8766
- children: multiFileUploader ? fileList && (fileList[props.i18nKeyPrefix] || []).map((_, index) => {
8767
- return jsx(DownloadFileWidget, {
8768
- index: index
8769
- });
8770
- }) : fileList && !deleteHide && getFile(fileListLength - 1) && fileListLength >= 0 && jsx(DownloadFileWidget, {
8771
+ children: fileList && isMultiFile ? (fileList[props.i18nKeyPrefix] || []).map((_, index) => jsx(DownloadFileWidget, {
8772
+ index: index
8773
+ }, index)) : !deleteHide && getFile(fileListLength - 1) && fileListLength >= 0 && jsx(DownloadFileWidget, {
8771
8774
  index: fileListLength - 1
8772
8775
  })
8773
8776
  })
@@ -8775,12 +8778,12 @@ const FileUploader = _ref => {
8775
8778
  })
8776
8779
  });
8777
8780
  };
8778
- const HelpText = styled.div(_t$3 || (_t$3 = _2`
8781
+ const HelpText = styled.div(_t2$3 || (_t2$3 = _2`
8779
8782
  margin-top: var(--goa-space-xs);
8780
8783
  font-size: var(--goa-font-size-3);
8781
8784
  color: var(--goa-color-text-secondary);
8782
8785
  `));
8783
- const AttachmentBorderDisabled = styled.div(_t2$3 || (_t2$3 = _2`
8786
+ const AttachmentBorderDisabled = styled.div(_t3$2 || (_t3$2 = _2`
8784
8787
  display: flex;
8785
8788
  flex-direction: row;
8786
8789
  border: var(--goa-border-width-s) solid #dcdcdc;
@@ -8789,7 +8792,7 @@ const AttachmentBorderDisabled = styled.div(_t2$3 || (_t2$3 = _2`
8789
8792
  width: fit-content;
8790
8793
  background-color: #f1f1f1;
8791
8794
  `));
8792
- const AttachmentBorder = styled.div(_t3$2 || (_t3$2 = _2`
8795
+ const AttachmentBorder = styled.div(_t4$2 || (_t4$2 = _2`
8793
8796
  display: flex;
8794
8797
  flex-direction: row;
8795
8798
  border: var(--goa-border-width-s) solid #dcdcdc;
@@ -8798,7 +8801,7 @@ const AttachmentBorder = styled.div(_t3$2 || (_t3$2 = _2`
8798
8801
  width: fit-content;
8799
8802
  margin-top: var(--goa-space-2xs);
8800
8803
  `));
8801
- const FileUploaderStyle = styled.div(_t4$2 || (_t4$2 = _2`
8804
+ const FileUploaderStyle = styled.div(_t5$2 || (_t5$2 = _2`
8802
8805
  margin-bottom: var(--goa-space-l);
8803
8806
  .label {
8804
8807
  display: block;
@@ -10288,6 +10291,7 @@ class ListWithDetailControl extends React.Component {
10288
10291
  }
10289
10292
 
10290
10293
  const ListWithDetailsControl = props => {
10294
+ var _a, _b;
10291
10295
  const [open, setOpen] = useState(false);
10292
10296
  const [path, setPath] = useState();
10293
10297
  const [name, setName] = useState();
@@ -10320,6 +10324,9 @@ const ListWithDetailsControl = props => {
10320
10324
  setOpen(false);
10321
10325
  // eslint-disable-next-line
10322
10326
  }, [setOpen, path, rowData, rowData]);
10327
+ if (((_a = props.translations) === null || _a === void 0 ? void 0 : _a.deleteDialogTitle) === undefined || props.translations.deleteDialogTitle === null) {
10328
+ props.translations.deleteDialogTitle = '';
10329
+ }
10323
10330
  return jsxs(Visible, {
10324
10331
  visible: visible,
10325
10332
  children: [jsx(ListWithDetailControl, Object.assign({}, props, {
@@ -10331,7 +10338,7 @@ const ListWithDetailsControl = props => {
10331
10338
  open: open,
10332
10339
  onCancel: deleteCancel,
10333
10340
  onConfirm: deleteConfirm,
10334
- title: props.translations.deleteDialogTitle || '',
10341
+ title: (_b = props.translations.deleteDialogTitle) !== null && _b !== void 0 ? _b : '',
10335
10342
  message: `Are you sure you wish to delete ${name}`
10336
10343
  })]
10337
10344
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.12.0",
3
+ "version": "2.13.0",
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",