Skip to content

Commit

Permalink
Merge pull request #3829 from bcgov/NDT-680-Remove-Null-option-for-CR…
Browse files Browse the repository at this point in the history
…TC-and-Connected-Coast-Dependent-dropdowns

feat: allow selects to not have null value
  • Loading branch information
ccbc-service-account authored Feb 1, 2025
2 parents 310ded8 + 72e17a1 commit cb1ad64
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# [1.234.0](https://github.com/bcgov/CONN-CCBC-portal/compare/v1.233.0...v1.234.0) (2025-01-31)

### Features

- allow selects to not have null value ([a7c798c](https://github.com/bcgov/CONN-CCBC-portal/commit/a7c798cd3e5ef0486458c4bf124412d32a4809cf))

# [1.233.0](https://github.com/bcgov/CONN-CCBC-portal/compare/v1.232.0...v1.233.0) (2025-01-31)

### Features
Expand Down
2 changes: 2 additions & 0 deletions app/formSchema/uiSchema/analyst/assessmentsUiSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ const assessmentsUiSchema = {
},
connectedCoastNetworkDependent: {
'ui:widget': 'SelectWidget',
'ui:shownull': false,
'ui:options': {
boldTitle: true,
},
},
crtcProjectDependent: {
'ui:widget': 'SelectWidget',
'ui:shownull': false,
'ui:options': {
boldTitle: true,
},
Expand Down
11 changes: 7 additions & 4 deletions app/lib/theme/widgets/SelectWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ const SelectWidget: React.FC<SelectWidgetProps> = ({
// @ts-ignore
const options = objectOptions ?? (schema.enum as Array<string>);
const description = uiSchema ? uiSchema['ui:description'] : null;
const showNull = uiSchema?.['ui:shownull'] ?? true;
const isError = rawErrors && rawErrors.length > 0 && !value;

return (
<StyledDiv className="select-widget-wrapper">
<StyledSelect
Expand All @@ -95,9 +95,12 @@ const SelectWidget: React.FC<SelectWidgetProps> = ({
value={value}
aria-label={label}
>
<option key={`option-placeholder-${id}`} value={undefined}>
{placeholder}
</option>
{showNull && (
<option key={`option-placeholder-${id}`} value={undefined}>
{placeholder}
</option>
)}
;
{options?.map((opt, index) => {
return (
<option
Expand Down
1 change: 1 addition & 0 deletions db/sqitch.plan
Original file line number Diff line number Diff line change
Expand Up @@ -795,3 +795,4 @@ tables/application_map_data 2025-01-28T17:53:59Z Rafael Solorzano <61289255+rafa
@1.231.0 2025-01-31T05:19:13Z CCBC Service Account <[email protected]> # release v1.231.0
@1.232.0 2025-01-31T17:43:27Z CCBC Service Account <[email protected]> # release v1.232.0
@1.233.0 2025-01-31T22:40:56Z CCBC Service Account <[email protected]> # release v1.233.0
@1.234.0 2025-01-31T23:42:58Z CCBC Service Account <[email protected]> # release v1.234.0
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "CONN-CCBC-portal",
"version": "1.233.0",
"version": "1.234.0",
"main": "index.js",
"repository": "https://github.com/bcgov/CONN-CCBC-portal.git",
"author": "Romer, Meherzad CITZ:EX <[email protected]>",
Expand Down

0 comments on commit cb1ad64

Please sign in to comment.