@abgov/jsonforms-components 1.15.4 → 1.15.6

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.
package/index.esm.js CHANGED
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import React, { createContext, useContext, useEffect, useMemo, useState, useCallback } from 'react';
3
3
  import { GoAFormItem, GoAInput, GoATextArea, GoACallout, GoAInputDate, GoAInputDateTime, GoAInputTime, GoADropdown, GoADropdownItem, GoARadioGroup, GoARadioItem, GoACheckbox, GoAGrid, GoAFormStepper, GoAFormStep, GoAPages, GoAButton, GoAModal, GoAButtonGroup, GoAIconButton, GoAFileUploadInput, GoACircularProgress, GoAContainer, GoADetails } from '@abgov/react-components';
4
4
  import styled from 'styled-components';
5
- import { rankWith, isStringControl, and, optionIs, uiTypeIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, isEnumControl, isBooleanControl, isDescriptionHidden, getAjv, isVisible, isEnabled, deriveLabelForUISchemaElement, schemaTypeIs, formatIs, createDefaultValue, Paths, or, isObjectArrayControl, isPrimitiveArrayControl, withIncreasedRank, hasType, isControl, isCategorization, isLayout } from '@jsonforms/core';
5
+ import { rankWith, isStringControl, and, optionIs, uiTypeIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, isEnumControl, isBooleanControl, getAjv, isVisible, isEnabled, deriveLabelForUISchemaElement, schemaTypeIs, formatIs, createDefaultValue, Paths, or, isObjectArrayControl, isPrimitiveArrayControl, withIncreasedRank, hasType, isControl, isCategorization, isLayout } from '@jsonforms/core';
6
6
  import { withJsonFormsControlProps, withJsonFormsRendererProps, withJsonFormsEnumProps, withTranslateProps, useJsonForms, JsonFormsDispatch, withJsonFormsLayoutProps, withJsonFormsArrayLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
7
7
  import merge from 'lodash/merge';
8
8
  import axios from 'axios';
@@ -4065,20 +4065,15 @@ const GoARadioGroupControlTester = rankWith(20, and(isEnumControl, optionIs('for
4065
4065
 
4066
4066
  const BooleanComponent = ({
4067
4067
  data,
4068
- visible,
4069
4068
  enabled,
4070
4069
  uischema,
4071
4070
  handleChange,
4072
4071
  path,
4073
- config,
4074
4072
  label,
4075
4073
  required,
4076
- errors,
4077
- description
4074
+ errors
4078
4075
  }) => {
4079
4076
  var _a;
4080
- const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema.options);
4081
- !isDescriptionHidden(visible, description, false, appliedUiSchemaOptions.showUnfocusedDescription);
4082
4077
  const errorsFormInput = checkFieldValidity({
4083
4078
  data,
4084
4079
  uischema,
@@ -4086,13 +4081,7 @@ const BooleanComponent = ({
4086
4081
  required,
4087
4082
  errors
4088
4083
  });
4089
- let text = label + (required ? ' (required)' : '');
4090
- if (label && description) {
4091
- text = description;
4092
- if (required) {
4093
- text = `${description} ` + (required ? ' (required)' : '');
4094
- }
4095
- }
4084
+ const text = label + (required ? ' (required)' : '');
4096
4085
  return jsx(GoACheckbox, Object.assign({
4097
4086
  error: errorsFormInput.length > 0,
4098
4087
  testId: `${path}-checkbox-test-id`,
@@ -4100,7 +4089,7 @@ const BooleanComponent = ({
4100
4089
  text: text,
4101
4090
  name: `${path}`,
4102
4091
  checked: data,
4103
- onChange: (name, checked, value) => {
4092
+ onChange: (_, checked) => {
4104
4093
  handleChange(path, checked);
4105
4094
  }
4106
4095
  }, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps));
@@ -4475,12 +4464,6 @@ const RenderFormFields = ({
4475
4464
  const fileListValue = (_b = enumerators === null || enumerators === void 0 ? void 0 : enumerators.data) === null || _b === void 0 ? void 0 : _b.get('file-list');
4476
4465
  // eslint-disable-next-line
4477
4466
  const fileList = fileListValue && fileListValue();
4478
- const toCamelCase = input => {
4479
- const words = input.split(' ');
4480
- const firstWord = words[0].toLowerCase();
4481
- const capitalizedWords = words.slice(1).map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase());
4482
- return [firstWord, ...capitalizedWords].join('');
4483
- };
4484
4467
  const downloadFile = (file, propertyId) => {
4485
4468
  if (downloadTrigger) {
4486
4469
  downloadTrigger(file, propertyId);
@@ -4494,7 +4477,7 @@ const RenderFormFields = ({
4494
4477
  const label = clonedElement.label ? clonedElement.label : resolveLabelFromScope(clonedElement.scope);
4495
4478
  if (!label) return null;
4496
4479
  const isFileUploader = clonedElement.scope.includes('fileUploader');
4497
- const fileUploaderElement = isFileUploader ? fileList && fileList[toCamelCase(label)] : null;
4480
+ const fileUploaderElement = isFileUploader ? fileList && fileList[lastSegment] : null;
4498
4481
  const value = getFormFieldValue(clonedElement.scope, data ? data : {}).toString();
4499
4482
  const isRequired = requiredFields.includes(lastSegment);
4500
4483
  const asterisk = isRequired ? ' *' : '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.15.4",
3
+ "version": "1.15.6",
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",
@@ -1,6 +1,6 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import { RankedTester, ControlProps } from '@jsonforms/core';
3
- export declare const BooleanComponent: ({ data, visible, enabled, uischema, handleChange, path, config, label, required, errors, description, }: ControlProps) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const BooleanComponent: ({ data, enabled, uischema, handleChange, path, label, required, errors, }: ControlProps) => import("react/jsx-runtime").JSX.Element;
4
4
  export declare const BooleanControl: (props: ControlProps) => import("react/jsx-runtime").JSX.Element;
5
5
  export declare const GoABooleanControlTester: RankedTester;
6
- export declare const GoABooleanControl: React.ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
6
+ export declare const GoABooleanControl: import("react").ComponentType<import("@jsonforms/core").OwnPropsOfControl>;