@abgov/jsonforms-components 1.26.0 → 1.26.2

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,
@@ -4050,13 +4075,17 @@ const EnumSelect = props => {
4050
4075
  return Object.assign({}, d);
4051
4076
  }
4052
4077
  })];
4078
+ const hasNonEmptyOptions = newOptions.some(option => option.value !== '');
4079
+ if (!hasNonEmptyOptions && newOptions.length === 1 && newOptions[0].value === '') {
4080
+ return newOptions;
4081
+ }
4053
4082
  if (newOptions && newOptions.length === 0) {
4054
4083
  newOptions.push({
4055
4084
  label: '',
4056
4085
  value: ''
4057
4086
  });
4058
4087
  }
4059
- return newOptions;
4088
+ return newOptions.filter(option => option.value !== '');
4060
4089
  }, [registerData, options]);
4061
4090
  useEffect(() => {
4062
4091
  if (registerConfig) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.26.0",
3
+ "version": "1.26.2",
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