@abgov/jsonforms-components 1.50.2 → 1.50.3

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 +12 -59
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import * as runtime from 'react/jsx-runtime';
2
2
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
- import React, { createContext, useContext, useReducer, useMemo, useEffect, useState, useRef, useCallback } from 'react';
4
3
  import { GoAFormItem, GoAInput, GoATextArea, GoACallout, GoAInputDate, GoAInputDateTime, GoAInputTime, GoARadioGroup, GoARadioItem, GoACheckbox, GoAGrid, GoAFormStepper, GoAFormStep, GoAPages, GoAButton, GoAModal, GoAButtonGroup, GoAIconButton, GoAFileUploadInput, GoACircularProgress, GoAContainer, GoATable, GoADropdown, GoADropdownItem, GoADetails, GoASpinner } from '@abgov/react-components';
5
- import { useJsonForms, withJsonFormsControlProps, withJsonFormsRendererProps, withJsonFormsEnumProps, withTranslateProps, JsonFormsDispatch, withJsonFormsLayoutProps, withJsonFormsArrayLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
6
4
  import styled from 'styled-components';
5
+ import React, { createContext, useContext, useReducer, useMemo, useEffect, useState, useRef, useCallback } from 'react';
7
6
  import axios from 'axios';
8
7
  import get$1 from 'lodash/get';
9
8
  import { rankWith, isStringControl, and, optionIs, uiTypeIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, isEnumControl, isBooleanControl, getAjv, isVisible, toDataPath, deriveLabelForUISchemaElement, isEnabled, schemaTypeIs, formatIs, createDefaultValue, Paths, or, isObjectArrayControl, isPrimitiveArrayControl, schemaMatches, hasType, isControl, isCategorization, isLayout } from '@jsonforms/core';
9
+ import { withJsonFormsControlProps, withJsonFormsRendererProps, withJsonFormsEnumProps, withTranslateProps, useJsonForms, JsonFormsDispatch, withJsonFormsLayoutProps, withJsonFormsArrayLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
10
10
  import * as _$b from 'lodash';
11
11
  import { isEqual, isObject as isObject$f } from 'lodash';
12
12
  import merge from 'lodash/merge';
@@ -2807,7 +2807,7 @@ const isRequiredAndHasNoData = props => {
2807
2807
  data,
2808
2808
  required
2809
2809
  } = props;
2810
- return required && (data === undefined || data.length === 0);
2810
+ return required && (data === undefined || (data === null || data === void 0 ? void 0 : data.length) === 0);
2811
2811
  };
2812
2812
  /**
2813
2813
  * Checks the key press value to determine if the key press is a 'Shift' or 'Tab'.
@@ -3862,46 +3862,15 @@ const GoAInputBaseControl = props => {
3862
3862
  label,
3863
3863
  input,
3864
3864
  required,
3865
- errors,
3866
3865
  path,
3867
- isStepperReview,
3868
- id
3866
+ isStepperReview
3869
3867
  } = props;
3870
3868
  const InnerComponent = input;
3871
3869
  const labelToUpdate = getLabelText(uischema.scope, label || '');
3872
- const ctx = useJsonForms();
3873
3870
  let modifiedErrors = checkFieldValidity(props);
3874
3871
  if (modifiedErrors === 'must be equal to one of the allowed values') {
3875
3872
  modifiedErrors = '';
3876
3873
  }
3877
- useEffect(() => {
3878
- var _a, _b, _c, _d;
3879
- if ((_a = ctx.core) === null || _a === void 0 ? void 0 : _a.ajv) {
3880
- // eslint-disable-next-line
3881
- const newError = {
3882
- instancePath: path,
3883
- message: modifiedErrors,
3884
- schemaPath: id,
3885
- keyword: '',
3886
- params: {}
3887
- };
3888
- const existingErrorIndex = (ctx.core.ajv.errors || []).findIndex(error => {
3889
- return (error === null || error === void 0 ? void 0 : error.schemaPath) === id;
3890
- });
3891
- if (modifiedErrors) {
3892
- if (existingErrorIndex > -1) {
3893
- (ctx.core.ajv.errors || [])[existingErrorIndex] = newError;
3894
- } else {
3895
- ctx.core.ajv.errors = [...(ctx.core.ajv.errors || []), newError];
3896
- }
3897
- } else {
3898
- if (existingErrorIndex > -1) {
3899
- delete (ctx.core.ajv.errors || [])[existingErrorIndex];
3900
- }
3901
- }
3902
- ctx.core.ajv.errors = ((_d = (_c = (_b = ctx.core) === null || _b === void 0 ? void 0 : _b.ajv) === null || _c === void 0 ? void 0 : _c.errors) === null || _d === void 0 ? void 0 : _d.filter(e => e !== null)) || [];
3903
- }
3904
- }, [modifiedErrors, ctx, path, id]);
3905
3874
  return jsx(JsonFormRegisterProvider, {
3906
3875
  defaultRegisters: undefined,
3907
3876
  children: jsx(Visible, {
@@ -4152,12 +4121,14 @@ const MultiLineText = props => {
4152
4121
  controlProps: props
4153
4122
  });
4154
4123
  }
4124
+ onChangeForInputControl({
4125
+ name,
4126
+ value: newValue,
4127
+ controlProps: props
4128
+ });
4155
4129
  },
4156
4130
  onChange: (name, value) => {
4157
- if (data !== value) {
4158
- const newValue = autoCapitalize ? value.toUpperCase() : value;
4159
- handleChange(path, newValue);
4160
- }
4131
+ // this is not triggered unless you tab out
4161
4132
  }
4162
4133
  }, (_l = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _l === void 0 ? void 0 : _l.componentProps));
4163
4134
  return txtAreaComponent;
@@ -5353,7 +5324,7 @@ const ReviewItemSection = styled.div(_t2$4 || (_t2$4 = _$5`
5353
5324
  border-radius: 5px;
5354
5325
 
5355
5326
  .element-style {
5356
- max-width: 1439px;
5327
+ max-width: 1600px;
5357
5328
  }
5358
5329
  `));
5359
5330
  const ReviewItemHeader = styled.div(_t3$3 || (_t3$3 = _$5`
@@ -6678,7 +6649,7 @@ const NonEmptyCellStyle = styled.div(_t2$2 || (_t2$2 = _$2`
6678
6649
  const ToolBarHeader = styled.div(_t3$1 || (_t3$1 = _$2`
6679
6650
  margin-bottom: var(--goa-space-l);
6680
6651
  `));
6681
- const ObjectArrayTitle = styled.h2(_t4$1 || (_t4$1 = _$2`
6652
+ const ObjectArrayTitle = styled.h3(_t4$1 || (_t4$1 = _$2`
6682
6653
  margin-bottom: var(--goa-space-l);
6683
6654
  `));
6684
6655
  const TextCenter = styled.div(_t5$1 || (_t5$1 = _$2`
@@ -8397,7 +8368,6 @@ const AddressLookUpControl = props => {
8397
8368
  const formCtx = useContext(JsonFormContext);
8398
8369
  const formHost = formCtx === null || formCtx === void 0 ? void 0 : formCtx.formUrl;
8399
8370
  const formUrl = `${formHost}/${ADDRESS_PATH}`;
8400
- const ctx = useJsonForms();
8401
8371
  const autocompletion = ((_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.autocomplete) !== false;
8402
8372
  const [open, setOpen] = useState(false);
8403
8373
  const label = typeof (uischema === null || uischema === void 0 ? void 0 : uischema.label) === 'string' && uischema.label ? uischema.label : '';
@@ -8451,23 +8421,6 @@ const AddressLookUpControl = props => {
8451
8421
  showLabel: false
8452
8422
  }));
8453
8423
  };
8454
- useEffect(() => {
8455
- var _a;
8456
- if ((_a = ctx.core) === null || _a === void 0 ? void 0 : _a.ajv) {
8457
- // eslint-disable-next-line
8458
- const newError = [];
8459
- Object.keys(errors).forEach(err => {
8460
- newError.push({
8461
- instancePath: path,
8462
- message: err,
8463
- schemaPath: '',
8464
- keyword: '',
8465
- params: {}
8466
- });
8467
- });
8468
- ctx.core.ajv.errors = newError;
8469
- }
8470
- }, [errors, ctx, path]);
8471
8424
  useEffect(() => {
8472
8425
  const fetchSuggestions = () => __awaiter(void 0, void 0, void 0, function* () {
8473
8426
  if (searchTerm.length > 2 && dropdownSelected === false) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.50.2",
3
+ "version": "1.50.3",
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",