@abgov/jsonforms-components 2.12.1 → 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 +11 -9
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -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, _s, _t, _u;
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,9 +8617,11 @@ 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 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;
8620
8622
  const [deleteHide, setDeleteHide] = useState(false);
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 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;
8623
8625
  const isMultiFile = maxFiles > 1;
8624
8626
  function uploadFile(file) {
8625
8627
  if (!uploadTrigger) return;
@@ -8678,13 +8680,13 @@ const FileUploader = _ref => {
8678
8680
  const timeoutId = setTimeout(delayedFunction, 1);
8679
8681
  return () => clearTimeout(timeoutId);
8680
8682
  }, [handleChange, fileList, propertyId]);
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 : '';
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 : '';
8684
8686
  if (!enumerators) {
8685
8687
  return jsx(Fragment, {});
8686
8688
  }
8687
- const helpText = (_u = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _u === void 0 ? void 0 : _u.help;
8689
+ const helpText = (_0 = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _0 === void 0 ? void 0 : _0.help;
8688
8690
  const sentenceCaseLabel = convertToSentenceCase(label);
8689
8691
  const DownloadFileWidget = ({
8690
8692
  index
@@ -8693,7 +8695,7 @@ const FileUploader = _ref => {
8693
8695
  const [showFileDeleteConfirmation, setShowFileDeleteConfirmation] = useState(false);
8694
8696
  return jsx("div", {
8695
8697
  children: readOnly ? jsxs(AttachmentBorderDisabled, {
8696
- children: [getFileName(index), jsx(GoAContextMenuIcon, {
8698
+ children: [getFileName(index), noDownloadButtonInReview !== true && jsx(GoAContextMenuIcon, {
8697
8699
  testId: "download-icon",
8698
8700
  title: "Download",
8699
8701
  type: "download",
@@ -8708,7 +8710,7 @@ const FileUploader = _ref => {
8708
8710
  title: "Download",
8709
8711
  type: "download",
8710
8712
  onClick: () => downloadFile(getFile(index))
8711
- }), jsx(GoAContextMenuIcon, {
8713
+ }), noDeleteButton !== true && jsx(GoAContextMenuIcon, {
8712
8714
  "data-testid": "delete-icon",
8713
8715
  title: "Delete",
8714
8716
  type: "trash",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.12.1",
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",