Skip to content

Commit

Permalink
fix: Added CustomLongTextField and using it for 'Expression', 'Sasl J…
Browse files Browse the repository at this point in the history
…aas Config' fields
  • Loading branch information
Shivam Gupta committed Apr 29, 2024
1 parent 4a0fdaf commit 6830955
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"lint:style:fix": "yarn lint:style --fix"
},
"dependencies": {
"@kaoto-next/uniforms-patternfly": "^0.6.8",
"@kaoto-next/uniforms-patternfly": "^0.6.10",
"@kie-tools-core/editor": "0.32.0",
"@kie-tools-core/notifications": "0.32.0",
"@patternfly/patternfly": "5.2.1",
Expand Down
8 changes: 6 additions & 2 deletions packages/ui/src/components/Form/CustomAutoField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import { TypeaheadField } from './customField/TypeaheadField';
import { ExpressionAwareNestField } from './expression/ExpressionAwareNestField';
import { ExpressionField } from './expression/ExpressionField';
import { PropertiesField } from './properties/PropertiesField';
import { CustomLongTextField } from './customField/CustomLongTextField';

// Name of the properties that should load CustomLongTextField
const CustomLongTextProps = ['Expression', 'Sasl Jaas Config'];

/**
* Custom AutoField that supports all the fields from Uniforms PatternFly
Expand Down Expand Up @@ -53,8 +57,8 @@ export const CustomAutoField = createAutoField((props) => {
/* catalog preprocessor put 'string' as a type and the javaType as a schema $comment */
if (comment?.startsWith('class:')) {
return BeanReferenceField;
} else if (title === 'Expression') {
return LongTextField;
} else if (CustomLongTextProps.includes(title)) {
return CustomLongTextField;
}
return TextField;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.custom-long-test-field {
textarea {
padding: 6px 8px 0;
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { HTMLFieldProps } from 'uniforms';
import { LongTextField } from '@kaoto-next/uniforms-patternfly';
import './CustomLongTextField.scss';

export type CustomLongTextFieldProps = HTMLFieldProps<string, HTMLDivElement>;

export const CustomLongTextField = (props: CustomLongTextFieldProps) => {
return <LongTextField className="custom-long-test-field" {...props} rows={1} autoResize={true} />;
};
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2453,7 +2453,7 @@ __metadata:
"@babel/preset-react": ^7.18.6
"@babel/preset-typescript": ^7.21.5
"@kaoto-next/camel-catalog": "workspace:*"
"@kaoto-next/uniforms-patternfly": ^0.6.8
"@kaoto-next/uniforms-patternfly": ^0.6.10
"@kie-tools-core/editor": 0.32.0
"@kie-tools-core/notifications": 0.32.0
"@patternfly/patternfly": 5.2.1
Expand Down Expand Up @@ -2531,16 +2531,16 @@ __metadata:
languageName: unknown
linkType: soft

"@kaoto-next/uniforms-patternfly@npm:^0.6.8":
version: 0.6.8
resolution: "@kaoto-next/uniforms-patternfly@npm:0.6.8"
"@kaoto-next/uniforms-patternfly@npm:^0.6.10":
version: 0.6.10
resolution: "@kaoto-next/uniforms-patternfly@npm:0.6.10"
dependencies:
invariant: ^2.2.4
lodash: ^4.17.21
react: ^18.2.0
react-dom: ^18.2.0
uniforms: 4.0.0-alpha.5
checksum: 882aa818eba9af30b73fd54a7f0b5c17871feda34e53b6fedb098662fc8f4206387fa2dccc077d9a8437133d90a1ab5e80349c3db6e7dc540abedf609cb5371f
checksum: 3d8565d4ce5a9eaa4a6c6128bc7c8a93d6f473c73713279971054ec2fda816e5c8a0d3871717caef31c61c3ef71b6855a9030836ff6dae46459cb3fd8ed4ec43
languageName: node
linkType: hard

Expand Down

0 comments on commit 6830955

Please sign in to comment.