diff --git a/packages/ui/package.json b/packages/ui/package.json index 475def0bb..c8f5f53bf 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -42,7 +42,7 @@ "lint:style:fix": "yarn lint:style --fix" }, "dependencies": { - "@kaoto-next/uniforms-patternfly": "^0.5.0", + "@kaoto-next/uniforms-patternfly": "^0.5.7", "@kie-tools-core/editor": "0.32.0", "@kie-tools-core/notifications": "0.32.0", "@patternfly/patternfly": "^5.0.0", diff --git a/packages/ui/src/components/Form/CustomAutoField.test.tsx b/packages/ui/src/components/Form/CustomAutoField.test.tsx index 0835c9ee9..c38a2f8d7 100644 --- a/packages/ui/src/components/Form/CustomAutoField.test.tsx +++ b/packages/ui/src/components/Form/CustomAutoField.test.tsx @@ -8,11 +8,12 @@ jest.mock('uniforms', () => { }; }); -import { DateField, ListField, NestField, RadioField, SelectField, TextField } from '@kaoto-next/uniforms-patternfly'; +import { DateField, ListField, NestField, RadioField, TextField } from '@kaoto-next/uniforms-patternfly'; import { AutoFieldProps } from 'uniforms'; import { CustomAutoField } from './CustomAutoField'; -import { DisabledField } from './DisabledField'; import BoolField from './customField/BoolField'; +import { CustomSelectField } from './customField/CustomSelectField'; +import { DisabledField } from './customField/DisabledField'; describe('CustomAutoField', () => { it('should return `RadioField` if `props.options` & `props.checkboxes` are defined and `props.fieldType` is not `Array`', () => { @@ -38,7 +39,7 @@ describe('CustomAutoField', () => { const result = CustomAutoField(props); - expect(result).toBe(SelectField); + expect(result).toBe(CustomSelectField); }); it('should return `DisabledField` if `props.name` ends with `steps`', () => { diff --git a/packages/ui/src/components/Form/CustomAutoField.tsx b/packages/ui/src/components/Form/CustomAutoField.tsx index 7a4f2ade8..697caafcd 100644 --- a/packages/ui/src/components/Form/CustomAutoField.tsx +++ b/packages/ui/src/components/Form/CustomAutoField.tsx @@ -1,11 +1,12 @@ -import { DateField, ListField, NestField, RadioField, SelectField, TextField } from '@kaoto-next/uniforms-patternfly'; +import { DateField, ListField, NestField, RadioField, TextField } from '@kaoto-next/uniforms-patternfly'; import { createAutoField } from 'uniforms'; -import { DisabledField } from './DisabledField'; -import { PropertiesField } from './properties/PropertiesField'; +import { CustomSelectField } from './customField/CustomSelectField'; +import { DisabledField } from './customField/DisabledField'; import { BeanReferenceField } from './bean/BeanReferenceField'; -import { ExpressionField } from './expression/ExpressionField'; -import { ExpressionAwareNestField } from './expression/ExpressionAwareNestField'; import BoolField from './customField/BoolField'; +import { ExpressionAwareNestField } from './expression/ExpressionAwareNestField'; +import { ExpressionField } from './expression/ExpressionField'; +import { PropertiesField } from './properties/PropertiesField'; /** * Custom AutoField that supports all the fields from Uniforms PatternFly @@ -13,7 +14,7 @@ import BoolField from './customField/BoolField'; */ export const CustomAutoField = createAutoField((props) => { if (props.options) { - return props.checkboxes && props.fieldType !== Array ? RadioField : SelectField; + return props.checkboxes && props.fieldType !== Array ? RadioField : CustomSelectField; } const comment = props['$comment'] as string; diff --git a/packages/ui/src/components/Form/customField/CustomSelectField.tsx b/packages/ui/src/components/Form/customField/CustomSelectField.tsx new file mode 100644 index 000000000..132beef06 --- /dev/null +++ b/packages/ui/src/components/Form/customField/CustomSelectField.tsx @@ -0,0 +1,6 @@ +import { SelectField, SelectFieldProps } from '@kaoto-next/uniforms-patternfly'; +import { FunctionComponent } from 'react'; + +export const CustomSelectField: FunctionComponent = (props) => { + return ; +}; diff --git a/packages/ui/src/components/Form/DisabledField.test.tsx b/packages/ui/src/components/Form/customField/DisabledField.test.tsx similarity index 100% rename from packages/ui/src/components/Form/DisabledField.test.tsx rename to packages/ui/src/components/Form/customField/DisabledField.test.tsx diff --git a/packages/ui/src/components/Form/DisabledField.tsx b/packages/ui/src/components/Form/customField/DisabledField.tsx similarity index 90% rename from packages/ui/src/components/Form/DisabledField.tsx rename to packages/ui/src/components/Form/customField/DisabledField.tsx index 9f8062418..265faaefd 100644 --- a/packages/ui/src/components/Form/DisabledField.tsx +++ b/packages/ui/src/components/Form/customField/DisabledField.tsx @@ -1,5 +1,5 @@ import { ConnectedFieldProps, connectField } from 'uniforms'; -import { ExpandableDetails } from './ExpandableDetails'; +import { ExpandableDetails } from '../ExpandableDetails'; import { Card, CardBody, CardTitle } from '@patternfly/react-core'; interface CustomStepsFieldProps { diff --git a/packages/ui/src/components/Form/__snapshots__/DisabledField.test.tsx.snap b/packages/ui/src/components/Form/customField/__snapshots__/DisabledField.test.tsx.snap similarity index 100% rename from packages/ui/src/components/Form/__snapshots__/DisabledField.test.tsx.snap rename to packages/ui/src/components/Form/customField/__snapshots__/DisabledField.test.tsx.snap diff --git a/yarn.lock b/yarn.lock index 9a3a9f967..35401e963 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2624,7 +2624,7 @@ __metadata: "@babel/preset-react": ^7.18.6 "@babel/preset-typescript": ^7.21.5 "@kaoto-next/camel-catalog": "workspace:*" - "@kaoto-next/uniforms-patternfly": ^0.5.0 + "@kaoto-next/uniforms-patternfly": ^0.5.7 "@kie-tools-core/editor": 0.32.0 "@kie-tools-core/notifications": 0.32.0 "@patternfly/patternfly": ^5.0.0 @@ -2694,9 +2694,9 @@ __metadata: languageName: unknown linkType: soft -"@kaoto-next/uniforms-patternfly@npm:^0.5.0": - version: 0.5.0 - resolution: "@kaoto-next/uniforms-patternfly@npm:0.5.0" +"@kaoto-next/uniforms-patternfly@npm:^0.5.7": + version: 0.5.7 + resolution: "@kaoto-next/uniforms-patternfly@npm:0.5.7" dependencies: "@types/invariant": ^2.2.35 invariant: ^2.2.4 @@ -2704,7 +2704,7 @@ __metadata: react: ^18.2.0 react-dom: ^18.2.0 uniforms: 4.0.0-alpha.5 - checksum: d50f480d7647fee7f97d851c6783431846fd8459623728df154f4b92673870f67bcd3f49d67ec89f101317b544e2b338886eb74b1c77cffbc0cc31eb1a3f7ee1 + checksum: 169e3e39fc12591d039347500b7fc8acc1c4c6a5d7c6261896a434409de8c848bd20e59ce03a6b47c822b9f52e869a4c4ab1b372a2e0b922edf31e02d5ed524c languageName: node linkType: hard