Skip to content

Commit

Permalink
Merge branch 'feat/create-action-input-variable-configuration-PAGE-48…
Browse files Browse the repository at this point in the history
…55' into edge
  • Loading branch information
ingmar-stipriaan committed Dec 17, 2024
2 parents 2f177a5 + 147decf commit fc34e7b
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 35 deletions.
53 changes: 27 additions & 26 deletions src/prefabs/structures/ActionJSForm/children.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,61 +7,62 @@ import {
DateTimePicker,
FileUpload,
MultiAutocomplete,
PriceInput,
RadioInput,
RatingInput,
RichTextInput,
SelectInput,
TextArea,
TextInput,
autocompleteInputOptions,
checkboxGroupInputOptions,
checkboxInputOptions,
dateTimePickerOptions,
fileUploadOptions,
multiAutocompleteOptions,
priceInputOptions,
radioInputOptions,
ratingInputOptions,
richTextOptions,
selectInputOptions,
textAreaOptions,
textInputOptions,
} from '..';

export const inputTypes = [
TextInput({ label: 'Text field', options: { ...textInputOptions } }),
SelectInput({ label: 'Select', options: { ...selectInputOptions } }),
PriceInput({ label: 'Price', options: { ...priceInputOptions } }),
TextArea({ label: 'Textarea', options: { ...textAreaOptions } }),
];

const defaultOptions = {
property: property('Property', { value: '', showInReconfigure: true }),
label: variable('Label', { value: [''], showInReconfigure: true }),
property: property('Property', {
value: '',
showInReconfigure: true,
}),
label: variable('Label', {
value: [''],
showInReconfigure: true,
}),
};

export const children = [
TextInput({
options: { ...textInputOptions, ...defaultOptions },
}),
SelectInput({
options: { ...selectInputOptions, ...defaultOptions },
}),
CheckboxInput({
options: { ...checkboxInputOptions, ...defaultOptions },
}),
TextInput({ options: { ...textInputOptions, ...defaultOptions } }),
SelectInput({ options: { ...selectInputOptions, ...defaultOptions } }),
CheckboxInput({ options: { ...checkboxInputOptions, ...defaultOptions } }),
AutocompleteInput({
options: { ...autocompleteInputOptions, ...defaultOptions },
}),
DateTimePicker({
options: { ...dateTimePickerOptions, ...defaultOptions },
}),
DateTimePicker({ options: { ...dateTimePickerOptions, ...defaultOptions } }),
CheckboxGroup({
options: { ...checkboxGroupInputOptions, ...defaultOptions },
}),
RadioInput({
options: { ...radioInputOptions, ...defaultOptions },
}),
RadioInput({ options: { ...radioInputOptions, ...defaultOptions } }),
MultiAutocomplete({
options: { ...multiAutocompleteOptions, ...defaultOptions },
}),
FileUpload({
options: { ...fileUploadOptions, ...defaultOptions },
}),
RatingInput({
options: { ...ratingInputOptions, ...defaultOptions },
}),
RichTextInput({
options: { ...richTextOptions, ...defaultOptions },
}),
FileUpload({ options: { ...fileUploadOptions, ...defaultOptions } }),
RatingInput({ options: { ...ratingInputOptions, ...defaultOptions } }),
RichTextInput({ options: { ...richTextOptions, ...defaultOptions } }),
];
9 changes: 8 additions & 1 deletion src/prefabs/structures/ActionJSForm/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import {
number,
showIf,
reconfigure,
addChild,
} from '@betty-blocks/component-sdk';
import { advanced } from './advanced';
import { children } from './children';
import { children, inputTypes } from './children';

export const categories = [
{
Expand All @@ -29,6 +30,12 @@ export const options = {
reconfigureWizardType: 'ChildrenSelector',
},
}),
addChild: addChild('Add form input', {
value: {
children: inputTypes,
addChildWizardType: 'ChildSelector',
},
}),
actionId: option('ACTION_JS', { label: 'Action', value: '' }),
model: model('Model'),
filter: filter('Filter', { configuration: { dependsOn: 'model' } }),
Expand Down
10 changes: 8 additions & 2 deletions src/prefabs/structures/PriceInput/options/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ export const options = {
propertyBased: buttongroup(
'Type',
[
['Property based', 'true'],
['Non property based', 'false'],
['Property-based', 'true'],
['Non-property-based', 'false'],
],
{
value: 'true',
showInAddChild: true,
configuration: {
showOnDrop: true,
},
Expand All @@ -35,6 +36,7 @@ export const options = {
actionVariableId: option('ACTION_JS_VARIABLE', {
label: 'Action input variable',
value: '',
showInAddChild: true,
configuration: {
condition: showIf('propertyBased', 'EQ', 'false'),
showOnDrop: true,
Expand All @@ -46,11 +48,15 @@ export const options = {

property: property('Property', {
value: '',
showInAddChild: true,
configuration: {
allowedKinds: ['INTEGER', 'PRICE', 'PRICE_EXPRESSION'],
disabled: true,
condition: showIf('propertyBased', 'EQ', 'true'),
showOnDrop: true,
createActionInputVariable: {
type: CreateActionInputVariableKind.NUMBER,
},
},
}),

Expand Down
10 changes: 8 additions & 2 deletions src/prefabs/structures/SelectInput/options/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ export const options = {
propertyBased: buttongroup(
'Type',
[
['Property based', 'true'],
['Non property based', 'false'],
['Property-based', 'true'],
['Non-property-based', 'false'],
],
{
value: 'true',
showInAddChild: true,
configuration: {
showOnDrop: true,
},
Expand All @@ -32,6 +33,7 @@ export const options = {
actionVariableId: option('ACTION_JS_VARIABLE', {
label: 'Action input variable',
value: '',
showInAddChild: true,
configuration: {
condition: showIf('propertyBased', 'EQ', 'false'),
createActionInputVariable: {
Expand All @@ -44,12 +46,16 @@ export const options = {
property: property('Property', {
value: '',
showInReconfigure: true,
showInAddChild: true,
configuration: {
allowedKinds: ['LIST', 'BELONGS_TO'],
allowRelations: true,
disabled: true,
condition: showIf('propertyBased', 'EQ', 'true'),
showOnDrop: true,
createActionInputVariable: {
type: CreateActionInputVariableKind.NUMBER,
},
},
}),

Expand Down
10 changes: 8 additions & 2 deletions src/prefabs/structures/TextArea/options/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ export const options = {
propertyBased: buttongroup(
'Type',
[
['Property based', 'true'],
['Non property based', 'false'],
['Property-based', 'true'],
['Non-property-based', 'false'],
],
{
value: 'true',
showInAddChild: true,
configuration: {
showOnDrop: true,
},
Expand All @@ -30,6 +31,7 @@ export const options = {
actionVariableId: option('ACTION_JS_VARIABLE', {
label: 'Action input variable',
value: '',
showInAddChild: true,
configuration: {
condition: showIf('propertyBased', 'EQ', 'false'),
createActionInputVariable: {
Expand All @@ -41,12 +43,16 @@ export const options = {

property: property('Property', {
value: '',
showInAddChild: true,
showInReconfigure: true,
configuration: {
allowedKinds: ['TEXT', 'URL', 'IBAN', 'STRING'],
disabled: true,
condition: showIf('propertyBased', 'EQ', 'true'),
showOnDrop: true,
createActionInputVariable: {
type: CreateActionInputVariableKind.TEXT,
},
},
}),

Expand Down
10 changes: 8 additions & 2 deletions src/prefabs/structures/TextInput/options/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ export const options = {
propertyBased: buttongroup(
'Type',
[
['Property based', 'true'],
['Non property based', 'false'],
['Property-based', 'true'],
['Non-property-based', 'false'],
],
{
value: 'true',
showInAddChild: true,
configuration: {
showOnDrop: true,
},
Expand All @@ -28,6 +29,7 @@ export const options = {
actionVariableId: option('ACTION_JS_VARIABLE', {
label: 'Action input variable',
value: '',
showInAddChild: true,
configuration: {
condition: showIf('propertyBased', 'EQ', 'false'),
createActionInputVariable: {
Expand All @@ -40,11 +42,15 @@ export const options = {
property: property('Property', {
value: '',
showInReconfigure: true,
showInAddChild: true,
configuration: {
allowedKinds: ['TEXT', 'URL', 'IBAN', 'STRING'],
disabled: true,
condition: showIf('propertyBased', 'EQ', 'true'),
showOnDrop: true,
createActionInputVariable: {
type: CreateActionInputVariableKind.TEXT,
},
},
}),

Expand Down

0 comments on commit fc34e7b

Please sign in to comment.