@abgov/jsonforms-components 2.12.0 → 2.12.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 +52 -47
  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;
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,25 @@ 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';
8621
8620
  const [deleteHide, setDeleteHide] = useState(false);
8622
8621
  const fileListLength = fileList && ((_g = fileList[props.i18nKeyPrefix]) === null || _g === void 0 ? void 0 : _g.length) || 0;
8622
+ const maxFiles = (_k = (_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.maximum) !== null && _k !== void 0 ? _k : 1;
8623
+ const isMultiFile = maxFiles > 1;
8623
8624
  function uploadFile(file) {
8624
- if (uploadTrigger) {
8625
- if (!multiFileUploader) {
8626
- const fileInList = getFile(fileListLength - 1);
8627
- if (fileInList) {
8628
- deleteTrigger(fileInList, propertyId);
8625
+ if (!uploadTrigger) return;
8626
+ if (fileListLength >= maxFiles) {
8627
+ if (!isMultiFile && maxFiles === 1) {
8628
+ const existingFile = getFile(0);
8629
+ if (existingFile) {
8630
+ deleteTrigger(existingFile, propertyId);
8629
8631
  }
8632
+ } else {
8633
+ return;
8630
8634
  }
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
8635
  }
8636
+ setLoadingFileName(file === null || file === void 0 ? void 0 : file.name);
8637
+ uploadTrigger(file, `${propertyId}.${fileListLength}`);
8638
+ setDeleteHide(false);
8636
8639
  }
8637
8640
  function downloadFile(file) {
8638
8641
  if (downloadTrigger) {
@@ -8675,13 +8678,13 @@ const FileUploader = _ref => {
8675
8678
  const timeoutId = setTimeout(delayedFunction, 1);
8676
8679
  return () => clearTimeout(timeoutId);
8677
8680
  }, [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 : '';
8681
+ const readOnly = ((_m = (_l = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _l === void 0 ? void 0 : _l.componentProps) === null || _m === void 0 ? void 0 : _m.readOnly) === true || (props === null || props === void 0 ? void 0 : props.isStepperReview) === true || user === null;
8682
+ const maxFileSize = (_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.maxFileSize) !== null && _q !== void 0 ? _q : '';
8683
+ const accept = (_t = (_s = (_r = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _r === void 0 ? void 0 : _r.componentProps) === null || _s === void 0 ? void 0 : _s.accept) !== null && _t !== void 0 ? _t : '';
8681
8684
  if (!enumerators) {
8682
8685
  return jsx(Fragment, {});
8683
8686
  }
8684
- const helpText = (_r = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _r === void 0 ? void 0 : _r.help;
8687
+ const helpText = (_u = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _u === void 0 ? void 0 : _u.help;
8685
8688
  const sentenceCaseLabel = convertToSentenceCase(label);
8686
8689
  const DownloadFileWidget = ({
8687
8690
  index
@@ -8763,11 +8766,9 @@ const FileUploader = _ref => {
8763
8766
  })
8764
8767
  })
8765
8768
  }) : 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, {
8769
+ children: fileList && isMultiFile ? (fileList[props.i18nKeyPrefix] || []).map((_, index) => jsx(DownloadFileWidget, {
8770
+ index: index
8771
+ }, index)) : !deleteHide && getFile(fileListLength - 1) && fileListLength >= 0 && jsx(DownloadFileWidget, {
8771
8772
  index: fileListLength - 1
8772
8773
  })
8773
8774
  })
@@ -8775,12 +8776,12 @@ const FileUploader = _ref => {
8775
8776
  })
8776
8777
  });
8777
8778
  };
8778
- const HelpText = styled.div(_t$3 || (_t$3 = _2`
8779
+ const HelpText = styled.div(_t2$3 || (_t2$3 = _2`
8779
8780
  margin-top: var(--goa-space-xs);
8780
8781
  font-size: var(--goa-font-size-3);
8781
8782
  color: var(--goa-color-text-secondary);
8782
8783
  `));
8783
- const AttachmentBorderDisabled = styled.div(_t2$3 || (_t2$3 = _2`
8784
+ const AttachmentBorderDisabled = styled.div(_t3$2 || (_t3$2 = _2`
8784
8785
  display: flex;
8785
8786
  flex-direction: row;
8786
8787
  border: var(--goa-border-width-s) solid #dcdcdc;
@@ -8789,7 +8790,7 @@ const AttachmentBorderDisabled = styled.div(_t2$3 || (_t2$3 = _2`
8789
8790
  width: fit-content;
8790
8791
  background-color: #f1f1f1;
8791
8792
  `));
8792
- const AttachmentBorder = styled.div(_t3$2 || (_t3$2 = _2`
8793
+ const AttachmentBorder = styled.div(_t4$2 || (_t4$2 = _2`
8793
8794
  display: flex;
8794
8795
  flex-direction: row;
8795
8796
  border: var(--goa-border-width-s) solid #dcdcdc;
@@ -8798,7 +8799,7 @@ const AttachmentBorder = styled.div(_t3$2 || (_t3$2 = _2`
8798
8799
  width: fit-content;
8799
8800
  margin-top: var(--goa-space-2xs);
8800
8801
  `));
8801
- const FileUploaderStyle = styled.div(_t4$2 || (_t4$2 = _2`
8802
+ const FileUploaderStyle = styled.div(_t5$2 || (_t5$2 = _2`
8802
8803
  margin-bottom: var(--goa-space-l);
8803
8804
  .label {
8804
8805
  display: block;
@@ -10288,6 +10289,7 @@ class ListWithDetailControl extends React.Component {
10288
10289
  }
10289
10290
 
10290
10291
  const ListWithDetailsControl = props => {
10292
+ var _a, _b;
10291
10293
  const [open, setOpen] = useState(false);
10292
10294
  const [path, setPath] = useState();
10293
10295
  const [name, setName] = useState();
@@ -10320,6 +10322,9 @@ const ListWithDetailsControl = props => {
10320
10322
  setOpen(false);
10321
10323
  // eslint-disable-next-line
10322
10324
  }, [setOpen, path, rowData, rowData]);
10325
+ if (((_a = props.translations) === null || _a === void 0 ? void 0 : _a.deleteDialogTitle) === undefined || props.translations.deleteDialogTitle === null) {
10326
+ props.translations.deleteDialogTitle = '';
10327
+ }
10323
10328
  return jsxs(Visible, {
10324
10329
  visible: visible,
10325
10330
  children: [jsx(ListWithDetailControl, Object.assign({}, props, {
@@ -10331,7 +10336,7 @@ const ListWithDetailsControl = props => {
10331
10336
  open: open,
10332
10337
  onCancel: deleteCancel,
10333
10338
  onConfirm: deleteConfirm,
10334
- title: props.translations.deleteDialogTitle || '',
10339
+ title: (_b = props.translations.deleteDialogTitle) !== null && _b !== void 0 ? _b : '',
10335
10340
  message: `Are you sure you wish to delete ${name}`
10336
10341
  })]
10337
10342
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.12.0",
3
+ "version": "2.12.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",