@abgov/jsonforms-components 1.25.2 → 1.25.4

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 +43 -34
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -3463,7 +3463,7 @@ const GoATextControlTester = rankWith(1, isStringControl);
3463
3463
  const GoAInputTextControl = withJsonFormsControlProps(GoATextControl);
3464
3464
 
3465
3465
  const MultiLineText = props => {
3466
- var _a, _b, _c, _d, _e, _f, _g, _h;
3466
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
3467
3467
  const {
3468
3468
  data,
3469
3469
  config,
@@ -3482,10 +3482,11 @@ const MultiLineText = props => {
3482
3482
  const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
3483
3483
  const placeholder = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
3484
3484
  const errorsFormInput = checkFieldValidity(props);
3485
- const autoCapitalize = ((_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.autoCapitalize) === true || ((_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.autoCapitalize) === true;
3486
- const readOnly = (_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.readOnly) !== null && _f !== void 0 ? _f : false;
3485
+ const width = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : '100%';
3486
+ const autoCapitalize = ((_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.autoCapitalize) === true || ((_f = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _f === void 0 ? void 0 : _f.autoCapitalize) === true;
3487
+ const readOnly = (_j = (_h = (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps) === null || _h === void 0 ? void 0 : _h.readOnly) !== null && _j !== void 0 ? _j : false;
3487
3488
  const textAreaName = `${label || path}-text-area` || '';
3488
- const textarea = (_g = document.getElementsByName(textAreaName)[0]) !== null && _g !== void 0 ? _g : null;
3489
+ const textarea = (_k = document.getElementsByName(textAreaName)[0]) !== null && _k !== void 0 ? _k : null;
3489
3490
  useEffect(() => {
3490
3491
  if (textarea) {
3491
3492
  textarea.addEventListener('blur', onBlur);
@@ -3516,7 +3517,7 @@ const MultiLineText = props => {
3516
3517
  placeholder: placeholder,
3517
3518
  testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
3518
3519
  name: textAreaName,
3519
- width: '100%',
3520
+ width: width,
3520
3521
  // Note: Paul Jan-09-2023. The latest ui-component come with the maxCount. We need to uncomment the following line when the component is updated
3521
3522
  // maxCount={schema.maxLength || 256}
3522
3523
  onKeyPress: (name, value, key) => {
@@ -3536,7 +3537,7 @@ const MultiLineText = props => {
3536
3537
  handleChange(path, newValue);
3537
3538
  }
3538
3539
  }
3539
- }, (_h = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _h === void 0 ? void 0 : _h.componentProps));
3540
+ }, (_l = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _l === void 0 ? void 0 : _l.componentProps));
3540
3541
  return txtAreaComponent;
3541
3542
  };
3542
3543
  const MultiLineTextControlInput = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
@@ -3592,7 +3593,7 @@ const reformatDateProps = props => {
3592
3593
  return newProps;
3593
3594
  };
3594
3595
  const GoADateInput = props => {
3595
- var _a, _b, _c, _d, _e, _f, _g, _h;
3596
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
3596
3597
  const {
3597
3598
  data,
3598
3599
  config,
@@ -3605,17 +3606,18 @@ const GoADateInput = props => {
3605
3606
  } = props;
3606
3607
  const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
3607
3608
  const readOnly = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : false;
3608
- const minDate = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.min;
3609
+ const width = (_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.width) !== null && _f !== void 0 ? _f : '100%';
3610
+ const minDate = (_h = (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps) === null || _h === void 0 ? void 0 : _h.min;
3609
3611
  if (minDate && !isValidDateFormat(minDate)) {
3610
3612
  return invalidDateFormat(uischema.scope, 'Min');
3611
3613
  }
3612
- const maxDate = (_g = (_f = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _f === void 0 ? void 0 : _f.componentProps) === null || _g === void 0 ? void 0 : _g.max;
3614
+ const maxDate = (_k = (_j = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _j === void 0 ? void 0 : _j.componentProps) === null || _k === void 0 ? void 0 : _k.max;
3613
3615
  if (maxDate && !isValidDateFormat(maxDate)) {
3614
3616
  return invalidDateFormat(uischema.scope, 'Max');
3615
3617
  }
3616
3618
  return jsx(GoAInputDate, Object.assign({
3617
3619
  error: checkFieldValidity(props).length > 0,
3618
- width: "100%",
3620
+ width: width,
3619
3621
  name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
3620
3622
  value: standardizeDate(data) || '',
3621
3623
  testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
@@ -3643,7 +3645,7 @@ const GoADateInput = props => {
3643
3645
  controlProps: props
3644
3646
  });
3645
3647
  }
3646
- }, reformatDateProps((_h = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _h === void 0 ? void 0 : _h.componentProps)));
3648
+ }, reformatDateProps((_l = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _l === void 0 ? void 0 : _l.componentProps)));
3647
3649
  };
3648
3650
  const GoADateControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
3649
3651
  input: GoADateInput
@@ -3759,7 +3761,7 @@ if ($stringify) {
3759
3761
  }
3760
3762
 
3761
3763
  const GoANumberInput = props => {
3762
- var _a, _b, _c, _d;
3764
+ var _a, _b, _c, _d, _e, _f, _g;
3763
3765
  // eslint-disable-next-line
3764
3766
  const {
3765
3767
  data,
@@ -3781,6 +3783,7 @@ const GoANumberInput = props => {
3781
3783
  const MinValue = clonedSchema.minimum ? clonedSchema.minimum : '';
3782
3784
  const MaxValue = clonedSchema.exclusiveMaximum ? clonedSchema.exclusiveMaximum : '';
3783
3785
  const readOnly = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : false;
3786
+ const width = (_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.width) !== null && _f !== void 0 ? _f : '100%';
3784
3787
  const errorsFormInput = checkFieldValidity(props);
3785
3788
  return jsx(GoAInput, Object.assign({
3786
3789
  type: "number",
@@ -3792,7 +3795,7 @@ const GoANumberInput = props => {
3792
3795
  step: StepValue,
3793
3796
  min: MinValue,
3794
3797
  max: MaxValue,
3795
- width: "100%",
3798
+ width: width,
3796
3799
  name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
3797
3800
  testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
3798
3801
  onKeyPress: (name, value, key) => {
@@ -3817,7 +3820,7 @@ const GoANumberInput = props => {
3817
3820
  controlProps: props
3818
3821
  });
3819
3822
  }
3820
- }, (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps));
3823
+ }, (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps));
3821
3824
  };
3822
3825
  const GoANumberControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
3823
3826
  input: GoANumberInput
@@ -3826,7 +3829,7 @@ const GoANumberControlTester = rankWith(2, isNumberControl);
3826
3829
  const GoAInputNumberControl = withJsonFormsControlProps(GoANumberControl);
3827
3830
 
3828
3831
  const GoAInputInteger = props => {
3829
- var _a, _b, _c, _d;
3832
+ var _a, _b, _c, _d, _e, _f, _g;
3830
3833
  // eslint-disable-next-line
3831
3834
  const {
3832
3835
  data,
@@ -3848,11 +3851,12 @@ const GoAInputInteger = props => {
3848
3851
  const MinValue = clonedSchema.minimum ? clonedSchema.minimum : '';
3849
3852
  const MaxValue = clonedSchema.exclusiveMaximum ? clonedSchema.exclusiveMaximum : '';
3850
3853
  const readOnly = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : false;
3854
+ const width = (_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.width) !== null && _f !== void 0 ? _f : '100%';
3851
3855
  const errorsFormInput = checkFieldValidity(props);
3852
3856
  return jsx(GoAInput, Object.assign({
3853
3857
  type: "number",
3854
3858
  error: errorsFormInput.length > 0,
3855
- width: "100%",
3859
+ width: width,
3856
3860
  disabled: !enabled,
3857
3861
  readonly: readOnly,
3858
3862
  value: InputValue,
@@ -3884,7 +3888,7 @@ const GoAInputInteger = props => {
3884
3888
  controlProps: props
3885
3889
  });
3886
3890
  }
3887
- }, (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps));
3891
+ }, (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps));
3888
3892
  };
3889
3893
  const GoAIntegerControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
3890
3894
  input: GoAInputInteger
@@ -3893,7 +3897,7 @@ const GoAIntegerControlTester = rankWith(2, isIntegerControl);
3893
3897
  const GoAInputIntegerControl = withJsonFormsControlProps(GoAIntegerControl);
3894
3898
 
3895
3899
  const GoADateTimeInput = props => {
3896
- var _a, _b, _c, _d;
3900
+ var _a, _b, _c, _d, _e, _f, _g;
3897
3901
  // eslint-disable-next-line
3898
3902
  const {
3899
3903
  data,
@@ -3910,9 +3914,10 @@ const GoADateTimeInput = props => {
3910
3914
  } = props;
3911
3915
  const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
3912
3916
  const readOnly = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : false;
3917
+ const width = (_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.width) !== null && _f !== void 0 ? _f : '100%';
3913
3918
  return jsx(GoAInputDateTime, Object.assign({
3914
3919
  error: checkFieldValidity(props).length > 0,
3915
- width: "100%",
3920
+ width: width,
3916
3921
  name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
3917
3922
  value: data ? new Date(data).toISOString() : '',
3918
3923
  testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
@@ -3940,7 +3945,7 @@ const GoADateTimeInput = props => {
3940
3945
  controlProps: props
3941
3946
  });
3942
3947
  }
3943
- }, (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps));
3948
+ }, (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps));
3944
3949
  };
3945
3950
  const GoADateTimeControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
3946
3951
  input: GoADateTimeInput
@@ -3949,7 +3954,7 @@ const GoADateTimeControlTester = rankWith(2, isDateTimeControl);
3949
3954
  const GoAInputDateTimeControl = withJsonFormsControlProps(GoADateTimeControl);
3950
3955
 
3951
3956
  const GoATimeInput = props => {
3952
- var _a, _b, _c, _d;
3957
+ var _a, _b, _c, _d, _e, _f, _g;
3953
3958
  // eslint-disable-next-line
3954
3959
  const {
3955
3960
  data,
@@ -3967,12 +3972,13 @@ const GoATimeInput = props => {
3967
3972
  (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
3968
3973
  const readOnly = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : false;
3969
3974
  const errorsFormInput = checkFieldValidity(props);
3975
+ const width = (_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.readOnly) !== null && _f !== void 0 ? _f : '100%';
3970
3976
  return jsx(GoAInputTime, Object.assign({
3971
3977
  error: errorsFormInput.length > 0,
3972
3978
  name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
3973
3979
  value: data,
3974
3980
  step: 1,
3975
- width: "100%",
3981
+ width: width,
3976
3982
  disabled: !enabled,
3977
3983
  readonly: readOnly,
3978
3984
  testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
@@ -3995,7 +4001,7 @@ const GoATimeInput = props => {
3995
4001
  controlProps: props
3996
4002
  });
3997
4003
  }
3998
- }, (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps));
4004
+ }, (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps));
3999
4005
  };
4000
4006
  const GoATimeControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
4001
4007
  input: GoATimeInput
@@ -5865,7 +5871,8 @@ const ArrayBaseReviewControl = props => {
5865
5871
  visible: visible,
5866
5872
  children: jsx(ObjectArrayControl, Object.assign({}, props, {
5867
5873
  openDeleteDialog: () => {},
5868
- isStepperReview: true
5874
+ isStepperReview: true,
5875
+ enabled: true
5869
5876
  }))
5870
5877
  });
5871
5878
  };
@@ -6056,7 +6063,7 @@ const LeftTab = ({
6056
6063
  translations
6057
6064
  }) => {
6058
6065
  return jsx("div", {
6059
- children: enabled ? jsx(SideMenuItem, {
6066
+ children: jsx(SideMenuItem, {
6060
6067
  style: currentTab === rowIndex ? {
6061
6068
  background: '#EFF8FF'
6062
6069
  } : {},
@@ -6064,15 +6071,15 @@ const LeftTab = ({
6064
6071
  children: jsxs(RowFlexMenu, {
6065
6072
  children: [jsx(TabName, {
6066
6073
  children: name
6067
- }), jsx(Trash, {
6074
+ }), enabled ? jsx(Trash, {
6068
6075
  children: jsx(GoAIconButton, {
6069
6076
  icon: "trash",
6070
6077
  "aria-label": translations.removeAriaLabel,
6071
6078
  onClick: () => openDeleteDialog(childPath, rowIndex, name)
6072
6079
  })
6073
- })]
6080
+ }) : null]
6074
6081
  })
6075
- }) : null
6082
+ })
6076
6083
  }, childPath);
6077
6084
  };
6078
6085
  const NonEmptyList = /*#__PURE__*/React.memo(NonEmptyRowComponent);
@@ -6090,11 +6097,12 @@ const ObjectArrayList = ({
6090
6097
  const isEmptyList = data === 0;
6091
6098
  const rightRef = useRef(null);
6092
6099
  const current = rightRef.current;
6093
- const [rightHeight, setRightHeight] = useState(0);
6100
+ const minHeight = 300;
6101
+ const [rightHeight, setRightHeight] = useState(minHeight);
6094
6102
  const [currentTab, setCurrentTab] = useState(0);
6095
6103
  useEffect(() => {
6096
- const resizeObserver = new ResizeObserver(entries => {
6097
- if (rightHeight !== (current === null || current === void 0 ? void 0 : current.offsetHeight)) setRightHeight(current === null || current === void 0 ? void 0 : current.offsetHeight);
6104
+ const resizeObserver = new ResizeObserver(() => {
6105
+ if (rightHeight !== (current === null || current === void 0 ? void 0 : current.offsetHeight) && (current === null || current === void 0 ? void 0 : current.offsetHeight)) setRightHeight((current === null || current === void 0 ? void 0 : current.offsetHeight) > minHeight ? current === null || current === void 0 ? void 0 : current.offsetHeight : minHeight);
6098
6106
  });
6099
6107
  if (current) {
6100
6108
  resizeObserver.observe(current);
@@ -6105,7 +6113,7 @@ const ObjectArrayList = ({
6105
6113
  }
6106
6114
  };
6107
6115
  // eslint-disable-next-line react-hooks/exhaustive-deps
6108
- }, [current]);
6116
+ }, [current, rightHeight, rightRef]);
6109
6117
  if (isEmptyList) {
6110
6118
  return jsx(EmptyList, {
6111
6119
  numColumns: getValidColumnProps(schema).length + 1,
@@ -6125,7 +6133,7 @@ const ObjectArrayList = ({
6125
6133
  },
6126
6134
  children: range(data).map(index => {
6127
6135
  const childPath = Paths.compose(path, `${index}`);
6128
- const name = `${index}: ${path}`;
6136
+ const name = `${path} ${index + 1}`;
6129
6137
  return jsx(LeftTab, {
6130
6138
  childPath: childPath,
6131
6139
  rowIndex: index,
@@ -6247,7 +6255,8 @@ const ListWithDetailsControl = props => {
6247
6255
  return jsxs(Visible, {
6248
6256
  visible: visible,
6249
6257
  children: [jsx(ListWithDetailControl, Object.assign({}, props, {
6250
- openDeleteDialog: openDeleteDialog
6258
+ openDeleteDialog: openDeleteDialog,
6259
+ enabled: true
6251
6260
  })), jsx(DeleteDialog, {
6252
6261
  open: open,
6253
6262
  onCancel: deleteCancel,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.25.2",
3
+ "version": "1.25.4",
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",