@abgov/jsonforms-components 1.53.9 → 1.53.11

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 +22 -17
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -3043,17 +3043,10 @@ const onChangeForNumericControl = props => {
3043
3043
  }
3044
3044
  handleChange(path, newValue);
3045
3045
  }
3046
+ } else {
3047
+ handleChange(path, value);
3046
3048
  }
3047
3049
  };
3048
- /**
3049
- * Helper function to process onChange event for input enum checkboxes controls.
3050
- * @param data
3051
- * @param name
3052
- * @param value
3053
- * @returns {string[]}
3054
- */
3055
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3056
- const onChangeForCheckboxData = (data, name, value) => data ? !value ? data === null || data === void 0 ? void 0 : data.filter(item => item !== name) : [...data, name] : [name];
3057
3050
 
3058
3051
  let _$a = t => t,
3059
3052
  _t$a,
@@ -5188,7 +5181,7 @@ const CheckboxGroup = props => {
5188
5181
  text: enumValue,
5189
5182
  testId: `${enumValue}-checkbox`,
5190
5183
  onChange: (name, value) => {
5191
- handleChange(path, onChangeForCheckboxData(data, name, value));
5184
+ handleChange(path, value === 'true' ? 'Yes' : 'No');
5192
5185
  }
5193
5186
  }));
5194
5187
  })
@@ -5964,7 +5957,7 @@ const stepperReducer = (state, action) => {
5964
5957
  if (id > lastId) {
5965
5958
  state.isOnReview = true;
5966
5959
  state.hasNextButton = false;
5967
- state.hasPrevButton = false;
5960
+ state.hasPrevButton = true;
5968
5961
  return Object.assign({}, state);
5969
5962
  } else {
5970
5963
  state.categories[id].isVisited = true;
@@ -5988,6 +5981,7 @@ const stepperReducer = (state, action) => {
5988
5981
  const errorsInCategory = getErrorsInScopes(errors, state.categories[id].scopes || []);
5989
5982
  state.categories[id].isCompleted = (incompletePaths === null || incompletePaths === void 0 ? void 0 : incompletePaths.length) === 0;
5990
5983
  state.categories[id].isValid = errorsInCategory.length === 0;
5984
+ state.categories[id].isVisited = true;
5991
5985
  return Object.assign({}, state);
5992
5986
  }
5993
5987
  case 'validate/form':
@@ -6065,7 +6059,8 @@ const JsonFormsStepperContextProvider = ({
6065
6059
  },
6066
6060
  selectIsDisabled: () => {
6067
6061
  var _a;
6068
- return !((_a = stepperState.categories[stepperState.activeId]) === null || _a === void 0 ? void 0 : _a.isEnabled);
6062
+ const category = (_a = stepperState.categories) === null || _a === void 0 ? void 0 : _a[stepperState.activeId];
6063
+ return category === undefined ? false : !(category === null || category === void 0 ? void 0 : category.isEnabled);
6069
6064
  },
6070
6065
  selectIsActive: id => {
6071
6066
  return id === stepperState.activeId;
@@ -6079,7 +6074,7 @@ const JsonFormsStepperContextProvider = ({
6079
6074
  goToPage: (id, updateCategoryId) => {
6080
6075
  var _a, _b, _c, _d;
6081
6076
  ajv.validate(schema, ((_a = ctx.core) === null || _a === void 0 ? void 0 : _a.data) || {});
6082
- if (updateCategoryId !== undefined) {
6077
+ if (updateCategoryId !== undefined && updateCategoryId < stepperState.categories.length) {
6083
6078
  stepperDispatch({
6084
6079
  type: 'update/category',
6085
6080
  payload: {
@@ -6177,6 +6172,7 @@ const FormStepperView = props => {
6177
6172
  const submitForm = submitFormFunction && submitFormFunction();
6178
6173
  const optionProps = uischema.options || {};
6179
6174
  const [isOpen, setIsOpen] = useState(false);
6175
+ const [isSelected, setIsSelected] = useState(false);
6180
6176
  const handleSubmit = () => {
6181
6177
  if (submitForm) {
6182
6178
  submitForm(data);
@@ -6196,7 +6192,9 @@ const FormStepperView = props => {
6196
6192
  className: "formStepper",
6197
6193
  children: [jsxs(GoAFormStepper, {
6198
6194
  testId: `form-stepper-headers-${(_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.testId}` || 'form-stepper-test',
6195
+ step: isSelected === false ? -1 : activeId + 1,
6199
6196
  onChange: step => {
6197
+ setIsSelected(true);
6200
6198
  goToPage(step - 1);
6201
6199
  },
6202
6200
  children: [categories === null || categories === void 0 ? void 0 : categories.map((c, index) => {
@@ -7867,8 +7865,10 @@ class ListWithDetailControl extends React.Component {
7867
7865
  visible: visible,
7868
7866
  "data-testid": "jsonforms-object-list-wrapper",
7869
7867
  children: [jsxs(ToolBarHeader, {
7870
- children: [listTitle && jsx(ObjectArrayTitle, {
7871
- children: listTitle
7868
+ children: [listTitle && jsxs(ObjectArrayTitle, {
7869
+ children: [listTitle, " ", jsx("span", {
7870
+ children: additionalProps.required && '(required)'
7871
+ })]
7872
7872
  }), jsx(ObjectArrayToolBar, {
7873
7873
  errors: errors,
7874
7874
  label: label,
@@ -7905,7 +7905,8 @@ const ListWithDetailsControl = props => {
7905
7905
  const [rowData, setRowData] = useState(0);
7906
7906
  const {
7907
7907
  removeItems,
7908
- visible
7908
+ visible,
7909
+ handleChange
7909
7910
  } = props;
7910
7911
  const openDeleteDialog = useCallback((p, rowIndex, name) => {
7911
7912
  setOpen(true);
@@ -7918,7 +7919,11 @@ const ListWithDetailsControl = props => {
7918
7919
  const deleteConfirm = useCallback(() => {
7919
7920
  const p = path === null || path === void 0 ? void 0 : path.substring(0, path.lastIndexOf('.'));
7920
7921
  if (removeItems && p) {
7921
- removeItems(p, [rowData])();
7922
+ if (props.data === 1) {
7923
+ handleChange(p, null);
7924
+ } else {
7925
+ removeItems(p, [rowData])();
7926
+ }
7922
7927
  }
7923
7928
  setOpen(false);
7924
7929
  // eslint-disable-next-line
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.53.9",
3
+ "version": "1.53.11",
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",