Skip to content

Commit

Permalink
Merge branch 'main' into jh/experimental-readme-page
Browse files Browse the repository at this point in the history
  • Loading branch information
jamdelion authored Jan 16, 2025
2 parents 135cc46 + cde4c94 commit a339586
Show file tree
Hide file tree
Showing 31 changed files with 902 additions and 480 deletions.
2 changes: 1 addition & 1 deletion api.planx.uk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@airbrake/node": "^2.1.8",
"@aws-sdk/client-s3": "^3.696.0",
"@aws-sdk/s3-request-presigner": "^3.701.0",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#574df5e",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#ae6e7f4",
"@types/isomorphic-fetch": "^0.0.36",
"adm-zip": "^0.5.10",
"axios": "^1.7.4",
Expand Down
8 changes: 4 additions & 4 deletions api.planx.uk/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion e2e/tests/api-driven/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"packageManager": "[email protected]",
"dependencies": {
"@cucumber/cucumber": "^11.1.1",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#574df5e",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#ae6e7f4",
"axios": "^1.7.4",
"dotenv": "^16.3.1",
"dotenv-expand": "^10.0.0",
Expand Down
10 changes: 5 additions & 5 deletions e2e/tests/api-driven/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion e2e/tests/ui-driven/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"type": "module",
"dependencies": {
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#574df5e",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#ae6e7f4",
"axios": "^1.7.4",
"dotenv": "^16.3.1",
"eslint": "^8.56.0",
Expand Down
8 changes: 4 additions & 4 deletions e2e/tests/ui-driven/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { DataFieldAutocomplete } from "@planx/components/shared/DataFieldAutocomplete";
import { FormikErrors, FormikValues, useFormik } from "formik";
import React, { useEffect, useRef } from "react";
import ImgInput from "ui/editor/ImgInput/ImgInput";
Expand All @@ -12,7 +13,6 @@ import Input from "ui/shared/Input/Input";
import InputRow from "ui/shared/InputRow";
import { Switch } from "ui/shared/Switch";

import { DataFieldAutocomplete } from "@planx/components/shared/DataFieldAutocomplete";
import { Option, parseBaseNodeData } from "../../shared";
import { ICONS } from "../../shared/icons";
import type { Checklist } from "../model";
Expand Down Expand Up @@ -41,7 +41,7 @@ export const ChecklistEditor: React.FC<ChecklistProps> = (props) => {
: groupedOptions?.flatMap((group) => group.children);

const filteredOptions = (sourceOptions || []).filter(
(option) => option.data.text
(option) => option.data.text,
);

const processedOptions = filteredOptions.map((option) => ({
Expand All @@ -68,7 +68,7 @@ export const ChecklistEditor: React.FC<ChecklistProps> = (props) => {
}),
},
},
processedOptions
processedOptions,
);
} else {
alert(JSON.stringify({ type, ...values, options }, null, 2));
Expand All @@ -77,16 +77,16 @@ export const ChecklistEditor: React.FC<ChecklistProps> = (props) => {
validate: ({ options, groupedOptions, allRequired, ...values }) => {
const errors: FormikErrors<FormikValues> = {};

// Account for flat or expandable Checklist options
options = options || groupedOptions?.flatMap((group) => group.children);

const exclusiveOptions: Option[] | undefined = options?.filter(
(option) => option.data.exclusive
(option) => option.data.exclusive,
);
if (allRequired && exclusiveOptions && exclusiveOptions.length > 0) {
errors.allRequired =
'Cannot configure exclusive "or" option alongside "all required" setting';
}
// Account for flat or expandable Checklist options
options =
options || groupedOptions?.map((group) => group.children)?.flat();
if (values.fn && !options?.some((option) => option.data.val)) {
errors.fn =
"At least one option must set a data value when the checklist has a data field";
Expand Down Expand Up @@ -164,7 +164,7 @@ export const ChecklistEditor: React.FC<ChecklistProps> = (props) => {
onChange={() =>
formik.setFieldValue(
"allRequired",
!formik.values.allRequired
!formik.values.allRequired,
)
}
label="All required"
Expand All @@ -177,7 +177,7 @@ export const ChecklistEditor: React.FC<ChecklistProps> = (props) => {
onChange={() =>
formik.setFieldValue(
"neverAutoAnswer",
!formik.values.neverAutoAnswer
!formik.values.neverAutoAnswer,
)
}
label="Always put to user (forgo automation)"
Expand Down
Loading

0 comments on commit a339586

Please sign in to comment.