@abgov/jsonforms-components 2.6.2 → 2.6.4

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 +19 -6
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -8506,7 +8506,6 @@ const FileUploaderReview = props => {
8506
8506
  };
8507
8507
  const FileUploader = _ref => {
8508
8508
  let {
8509
- data,
8510
8509
  path,
8511
8510
  handleChange,
8512
8511
  uischema
@@ -8521,6 +8520,7 @@ const FileUploader = _ref => {
8521
8520
  const deleteTriggerFunction = (_c = enumerators === null || enumerators === void 0 ? void 0 : enumerators.functions) === null || _c === void 0 ? void 0 : _c.get('delete-file');
8522
8521
  const deleteTrigger = deleteTriggerFunction && deleteTriggerFunction();
8523
8522
  const fileListValue = enumerators === null || enumerators === void 0 ? void 0 : enumerators.data.get('file-list');
8523
+ const [loadingFileName, setLoadingFileName] = useState(undefined);
8524
8524
  const countries = ['Argentina', 'Brazil', 'Canada', 'Denmark', 'Egypt', 'France', 'Greece', 'India', 'Japan', 'Kenya'];
8525
8525
  enumerators === null || enumerators === void 0 ? void 0 : enumerators.addFormContextData('countries', countries);
8526
8526
  const user = enumerators === null || enumerators === void 0 ? void 0 : enumerators.getFormContextData('user');
@@ -8544,6 +8544,7 @@ const FileUploader = _ref => {
8544
8544
  deleteTrigger(fileInList, propertyId);
8545
8545
  }
8546
8546
  }
8547
+ setLoadingFileName(file === null || file === void 0 ? void 0 : file.name);
8547
8548
  // To support multipleFileUploader, the propertyId (path) is in propertyId.index format
8548
8549
  uploadTrigger(file, `${propertyId}.${fileListLength}`);
8549
8550
  setDeleteHide(false);
@@ -8568,6 +8569,9 @@ const FileUploader = _ref => {
8568
8569
  return (_a = fileList === null || fileList === void 0 ? void 0 : fileList[props.i18nKeyPrefix]) === null || _a === void 0 ? void 0 : _a[index];
8569
8570
  }
8570
8571
  useEffect(() => {
8572
+ if (loadingFileName !== undefined) {
8573
+ setLoadingFileName(undefined);
8574
+ }
8571
8575
  // UseEffect is required because not having it causes a react update error, but
8572
8576
  // it doesn't function correctly within jsonforms unless there is a minor delay here
8573
8577
  const delayedFunction = () => {
@@ -8662,13 +8666,13 @@ const FileUploader = _ref => {
8662
8666
  }), helpText && jsx(HelpText, {
8663
8667
  children: helpText
8664
8668
  }), jsx("div", {
8665
- children: Array.isArray(data) && data[0] === 'Loading' ? jsx(GoAModal, {
8666
- open: Array.isArray(data) && data[0] === 'Loading',
8669
+ children: loadingFileName !== undefined ? jsx(GoAModal, {
8670
+ open: loadingFileName !== undefined,
8667
8671
  children: jsx("div", {
8668
8672
  className: "align-center",
8669
8673
  children: jsx(GoACircularProgress, {
8670
8674
  visible: true,
8671
- message: `Uploading ${data[1]}`,
8675
+ message: `Uploading ${loadingFileName}`,
8672
8676
  size: "large"
8673
8677
  })
8674
8678
  })
@@ -9867,6 +9871,11 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
9867
9871
  };
9868
9872
  })
9869
9873
  };
9874
+ const hasNoElements = () => {
9875
+ var _a, _b, _c, _d;
9876
+ const hasNoLayoutElements = ((_a = uischema === null || uischema === void 0 ? void 0 : uischema.elements) === null || _a === void 0 ? void 0 : _a.length) === 0 && ((_d = (_c = (_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.detail) === null || _c === void 0 ? void 0 : _c.elements) === null || _d === void 0 ? void 0 : _d.length) === 0;
9877
+ return hasNoLayoutElements;
9878
+ };
9870
9879
  return jsxs(Fragment, {
9871
9880
  children: [
9872
9881
  // eslint-disable-next-line
@@ -9892,7 +9901,7 @@ const NonEmptyCellComponent = /*#__PURE__*/React.memo(function NonEmptyCellCompo
9892
9901
  renderers: renderers,
9893
9902
  cells: cells
9894
9903
  }, `${rowPath}-${index}`);
9895
- }), ((_e = uiSchemaElementsForNotDefined === null || uiSchemaElementsForNotDefined === void 0 ? void 0 : uiSchemaElementsForNotDefined.elements) === null || _e === void 0 ? void 0 : _e.length) > 0 && jsx(JsonFormsDispatch, {
9904
+ }), hasNoElements() && ((_e = uiSchemaElementsForNotDefined === null || uiSchemaElementsForNotDefined === void 0 ? void 0 : uiSchemaElementsForNotDefined.elements) === null || _e === void 0 ? void 0 : _e.length) > 0 && jsx(JsonFormsDispatch, {
9896
9905
  schema: schema,
9897
9906
  uischema: uiSchemaElementsForNotDefined,
9898
9907
  path: rowPath,
@@ -9917,10 +9926,14 @@ const NonEmptyRowComponent = ({
9917
9926
  cells,
9918
9927
  uischema
9919
9928
  }) => {
9929
+ var _a, _b;
9930
+ const isHorizontal = ((_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.detail) === null || _b === void 0 ? void 0 : _b.type) === 'HorizontalLayout';
9920
9931
  return jsx("div", {
9921
- children: enabled ? jsx(GoAGrid, {
9932
+ children: enabled && isHorizontal ? jsx(GoAGrid, {
9922
9933
  minChildWidth: "30ch",
9923
9934
  children: GenerateRows(NonEmptyCell, schema, childPath, enabled, cells, uischema)
9935
+ }) : enabled && !isHorizontal ? jsx(Fragment, {
9936
+ children: GenerateRows(NonEmptyCell, schema, childPath, enabled, cells, uischema)
9924
9937
  }) : null
9925
9938
  }, childPath);
9926
9939
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.6.2",
3
+ "version": "2.6.4",
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",