@abgov/jsonforms-components 1.25.6 → 1.26.1

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
@@ -2635,6 +2635,25 @@ const onChangeForDateControl = props => {
2635
2635
  }
2636
2636
  }
2637
2637
  };
2638
+ /**
2639
+ * Helper function to process onChange event for Input controls.
2640
+ * @param props - EventChangeControlProps
2641
+ */
2642
+ const onChangeForInputControl = props => {
2643
+ const {
2644
+ value
2645
+ } = props;
2646
+ const {
2647
+ controlProps
2648
+ } = props;
2649
+ const {
2650
+ handleChange,
2651
+ path
2652
+ } = controlProps;
2653
+ if (value && value !== null) {
2654
+ handleChange(path, value);
2655
+ }
2656
+ };
2638
2657
  /**
2639
2658
  * Helper function to process onChange event for Date controls.
2640
2659
  * @param props - EventChangeControlProps
@@ -3438,7 +3457,13 @@ const GoAInputText = props => {
3438
3457
  // Don't use handleChange in the onChange event, use the keyPress or onBlur.
3439
3458
  // If you use it onChange along with keyPress event it will cause a
3440
3459
  // side effect that causes the validation to render when it shouldn't.
3441
- onChange: (name, value) => {},
3460
+ onChange: (name, value) => {
3461
+ onChangeForInputControl({
3462
+ name,
3463
+ value,
3464
+ controlProps: props
3465
+ });
3466
+ },
3442
3467
  onKeyPress: (name, value, key) => {
3443
3468
  onKeyPressForTextControl({
3444
3469
  name,
@@ -4032,6 +4057,7 @@ const EnumSelect = props => {
4032
4057
  } = props;
4033
4058
  const registerCtx = useContext(JsonFormsRegisterContext);
4034
4059
  const registerConfig = fetchRegisterConfigFromOptions((_b = (_a = props.uischema) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.register);
4060
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4035
4061
  let registerData = [];
4036
4062
  if (registerConfig) {
4037
4063
  registerData = registerCtx === null || registerCtx === void 0 ? void 0 : registerCtx.selectRegisterData(registerConfig);
@@ -4039,7 +4065,7 @@ const EnumSelect = props => {
4039
4065
  const autocompletion = ((_d = (_c = props.uischema) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.autocomplete) === true;
4040
4066
  const appliedUiSchemaOptions = merge({}, config, props.uischema.options);
4041
4067
  const mergedOptions = useMemo(() => {
4042
- return [...(options || []), ...registerData.map(d => {
4068
+ const newOptions = [...(options || []), ...registerData.map(d => {
4043
4069
  if (typeof d === 'string') {
4044
4070
  return {
4045
4071
  value: d,
@@ -4049,6 +4075,13 @@ const EnumSelect = props => {
4049
4075
  return Object.assign({}, d);
4050
4076
  }
4051
4077
  })];
4078
+ if (newOptions && newOptions.length === 0) {
4079
+ newOptions.push({
4080
+ label: '',
4081
+ value: ''
4082
+ });
4083
+ }
4084
+ return newOptions;
4052
4085
  }, [registerData, options]);
4053
4086
  useEffect(() => {
4054
4087
  if (registerConfig) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.25.6",
3
+ "version": "1.26.1",
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",
@@ -57,6 +57,11 @@ export declare const onBlurForTimeControl: (props: EventBlurControlProps) => voi
57
57
  * @param props - EventChangeControlProps
58
58
  */
59
59
  export declare const onChangeForDateControl: (props: EventChangeControlProps) => void;
60
+ /**
61
+ * Helper function to process onChange event for Input controls.
62
+ * @param props - EventChangeControlProps
63
+ */
64
+ export declare const onChangeForInputControl: (props: EventChangeControlProps) => void;
60
65
  /**
61
66
  * Helper function to process onChange event for Date controls.
62
67
  * @param props - EventChangeControlProps