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