Skip to content

Commit

Permalink
pkp/pkp-lib#9736 consider only sorting in FieldOptions story
Browse files Browse the repository at this point in the history
  • Loading branch information
bozana committed Feb 16, 2024
1 parent 827c28c commit f67c7ad
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/components/Form/fields/FieldOptions.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import FieldOptionsUserLocales from '../mocks/field-options-user-locales';
import FieldOptionsEmails from '../mocks/field-options-emails';
import FieldOptionsConfirmation from '../mocks/field-options-confirmation';
import FieldOptionsOrderable from '../mocks/field-options-orderable';
import FieldOptionsOnlySorting from '../mocks/field-options-onlySorting';

export default {
title: 'Forms/FieldOptions',
Expand Down Expand Up @@ -34,6 +35,7 @@ export const Base = {
export const Radio = {
args: {...FieldBaseMock, ...FieldOptionsEmails},
};

export const Confirm = {
args: {...FieldBaseMock, ...FieldOptionsConfirmation},
};
Expand All @@ -42,10 +44,6 @@ export const Orderable = {
args: {...FieldBaseMock, ...FieldOptionsOrderable},
};

export const allowOnlySorting = {
args: {
...FieldBaseMock,
...FieldOptionsOrderable,
...{allowOnlySorting: true},
},
export const OnlySorting = {
args: {...FieldBaseMock, ...FieldOptionsOnlySorting},
};
1 change: 1 addition & 0 deletions src/components/Form/fields/FieldOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export default {
},
extends: FieldBase,
props: {
/** Allow only sorting (and not selection) of options. In this case only options.value(s) must be provided in the `value` property. */
allowOnlySorting: {
type: Boolean,
default: false,
Expand Down
23 changes: 23 additions & 0 deletions src/components/Form/mocks/field-options-onlySorting.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export default {
name: 'options-onlySorting',
component: 'field-options',
label: 'Masthead',
description: 'Define the order of masthead roles for public display.',
isOrderable: true,
allowOnlySorting: true,
value: [3, 5, 16],
options: [
{
value: 3,
label: 'Journal editor',
},
{
value: 5,
label: 'Section editor',
},
{
value: 16,
label: 'Reviewer',
},
],
};

0 comments on commit f67c7ad

Please sign in to comment.