@abgov/jsonforms-components 1.18.1 → 1.19.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.
package/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
1
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
2
  import React, { createContext, useContext, useReducer, useMemo, useEffect, 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';
@@ -2883,9 +2883,15 @@ const JsonFormRegisterProvider = ({
2883
2883
  return {
2884
2884
  isProvided: true,
2885
2885
  registerDispatch: dispatch,
2886
- selectRegisterDataByUrl: url => {
2887
- var _a;
2888
- return ((_a = registers === null || registers === void 0 ? void 0 : registers.find(r => r.url === url)) === null || _a === void 0 ? void 0 : _a.data) || [];
2886
+ selectRegisterData: criteria => {
2887
+ var _a, _b;
2888
+ if (criteria === null || criteria === void 0 ? void 0 : criteria.url) {
2889
+ return ((_a = registers === null || registers === void 0 ? void 0 : registers.find(r => r.url === criteria.url)) === null || _a === void 0 ? void 0 : _a.data) || [];
2890
+ }
2891
+ if (criteria === null || criteria === void 0 ? void 0 : criteria.urn) {
2892
+ return ((_b = registers === null || registers === void 0 ? void 0 : registers.find(r => r.urn === criteria.urn)) === null || _b === void 0 ? void 0 : _b.data) || [];
2893
+ }
2894
+ return [];
2889
2895
  },
2890
2896
  fetchRegisterByUrl: registerConfig => __awaiter(void 0, void 0, void 0, function* () {
2891
2897
  // Prevent re-freshing remote data
@@ -2932,7 +2938,10 @@ const JsonFormRegisterProvider = ({
2932
2938
  }, [dispatch, defaultRegisters]);
2933
2939
  /* The client might use the context outside of the Jsonform to provide custom register data */
2934
2940
  if (registerCtx === null || registerCtx === void 0 ? void 0 : registerCtx.isProvided) {
2935
- return children;
2941
+ // eslint-disable-next-line
2942
+ return jsx(Fragment, {
2943
+ children: children
2944
+ });
2936
2945
  }
2937
2946
  return jsx(JsonFormsRegisterContext.Provider, {
2938
2947
  value: context,
@@ -3623,7 +3632,7 @@ const GoATimeControlTester = rankWith(4, isTimeControl);
3623
3632
  const GoAInputTimeControl = withJsonFormsControlProps(GoATimeControl);
3624
3633
 
3625
3634
  function fetchRegisterConfigFromOptions(options) {
3626
- if (!(options === null || options === void 0 ? void 0 : options.url)) return undefined;
3635
+ if (!(options === null || options === void 0 ? void 0 : options.url) && !(options === null || options === void 0 ? void 0 : options.urn)) return undefined;
3627
3636
  const config = Object.assign({}, options);
3628
3637
  return config;
3629
3638
  }
@@ -3647,7 +3656,7 @@ const EnumSelect = props => {
3647
3656
  const registerConfig = fetchRegisterConfigFromOptions((_b = (_a = props.uischema) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.register);
3648
3657
  let registerData = [];
3649
3658
  if (registerConfig) {
3650
- registerData = registerCtx === null || registerCtx === void 0 ? void 0 : registerCtx.selectRegisterDataByUrl(registerConfig.url);
3659
+ registerData = registerCtx === null || registerCtx === void 0 ? void 0 : registerCtx.selectRegisterData(registerConfig);
3651
3660
  }
3652
3661
  const autocompletion = ((_d = (_c = props.uischema) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.autocomplete) === true;
3653
3662
  const appliedUiSchemaOptions = merge({}, config, props.uischema.options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.18.1",
3
+ "version": "1.19.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",
@@ -3,7 +3,7 @@ import { RegisterConfig, RegisterData, JsonFormRegisterDispatch } from './action
3
3
  interface JsonFormsRegisterContextProps {
4
4
  registerDispatch: JsonFormRegisterDispatch;
5
5
  fetchRegisterByUrl: (registerConfig: RegisterConfig) => Promise<void>;
6
- selectRegisterDataByUrl: (url: string) => string[];
6
+ selectRegisterData: (registerConfig: RegisterConfig) => string[];
7
7
  isProvided: boolean;
8
8
  }
9
9
  export declare const JsonFormsRegisterContext: import("react").Context<JsonFormsRegisterContextProps | undefined>;
@@ -11,5 +11,5 @@ interface JsonFormsRegisterProviderProps {
11
11
  children: ReactNode;
12
12
  defaultRegisters: RegisterConfig[] | RegisterData | undefined;
13
13
  }
14
- export declare const JsonFormRegisterProvider: ({ children, defaultRegisters, }: JsonFormsRegisterProviderProps) => JSX.Element | ReactNode;
14
+ export declare const JsonFormRegisterProvider: ({ children, defaultRegisters, }: JsonFormsRegisterProviderProps) => JSX.Element;
15
15
  export {};