Skip to content

Commit

Permalink
Merge pull request #193 from open-formulieren/feature/4813-number-com…
Browse files Browse the repository at this point in the history
…ponent-prefill

Added prefill tab to number component edit
  • Loading branch information
sergei-maertens authored Nov 12, 2024
2 parents 8b48584 + 511f547 commit 2b5adeb
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 9 deletions.
17 changes: 9 additions & 8 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"@formatjs/cli": "^6.1.1",
"@formatjs/ts-transformer": "^3.12.0",
"@fortawesome/fontawesome-free": "^6.4.0",
"@open-formulieren/types": "^0.32.0",
"@open-formulieren/types": "^0.33.0",
"@storybook/addon-actions": "^8.3.5",
"@storybook/addon-essentials": "^8.3.5",
"@storybook/addon-interactions": "^8.3.5",
Expand Down
5 changes: 5 additions & 0 deletions src/components/ComponentConfiguration.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,11 @@ export const NumberField: Story = {
max: '',
},
},
prefill: {
attribute: '',
identifierRole: 'main',
plugin: '',
},
registration: {
attribute: '',
},
Expand Down
12 changes: 12 additions & 0 deletions src/registry/number/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
IsSensitiveData,
Key,
Label,
Prefill,
PresentationConfig,
Registration,
SimpleConditional,
Expand Down Expand Up @@ -58,6 +59,7 @@ const EditForm: EditFormDefinition<NumberComponentSchema> = () => {
<BuilderTabs.Advanced hasErrors={hasAnyError('conditional')} />
<BuilderTabs.Validation hasErrors={hasAnyError('validate')} />
<BuilderTabs.Registration hasErrors={hasAnyError('registration')} />
<BuilderTabs.Prefill hasErrors={hasAnyError('prefill')} />
<BuilderTabs.Translations hasErrors={hasAnyError('openForms.translations')} />
</TabList>

Expand Down Expand Up @@ -96,6 +98,11 @@ const EditForm: EditFormDefinition<NumberComponentSchema> = () => {
<Registration.RegistrationAttributeSelect />
</TabPanel>

{/* Prefill tab */}
<TabPanel>
<Prefill.PrefillConfiguration />
</TabPanel>

{/* Translations */}
<TabPanel>
<Translations.ComponentTranslations<NumberComponentSchema>
Expand Down Expand Up @@ -148,6 +155,11 @@ EditForm.defaultValues = {
registration: {
attribute: '',
},
prefill: {
plugin: '',
attribute: '',
identifierRole: 'main',
},
};

const DefaultValue: React.FC = () => {
Expand Down

0 comments on commit 2b5adeb

Please sign in to comment.