146 lines
2.7 KiB
TypeScript
146 lines
2.7 KiB
TypeScript
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types.js'
|
|
|
|
import { selectFieldsSlug } from '../../slugs.js'
|
|
|
|
const SelectFields: CollectionConfig = {
|
|
slug: selectFieldsSlug,
|
|
fields: [
|
|
{
|
|
name: 'select',
|
|
type: 'select',
|
|
admin: {
|
|
isClearable: true,
|
|
},
|
|
options: [
|
|
{
|
|
label: 'Value One',
|
|
value: 'one',
|
|
},
|
|
{
|
|
label: 'Value Two',
|
|
value: 'two',
|
|
},
|
|
{
|
|
label: 'Value Three',
|
|
value: 'three',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: 'selectReadOnly',
|
|
type: 'select',
|
|
admin: {
|
|
readOnly: true,
|
|
},
|
|
options: [
|
|
{
|
|
label: 'Value One',
|
|
value: 'one',
|
|
},
|
|
{
|
|
label: 'Value Two',
|
|
value: 'two',
|
|
},
|
|
{
|
|
label: 'Value Three',
|
|
value: 'three',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: 'selectHasMany',
|
|
hasMany: true,
|
|
type: 'select',
|
|
admin: {
|
|
isClearable: true,
|
|
isSortable: true,
|
|
},
|
|
options: [
|
|
{
|
|
label: 'Value One',
|
|
value: 'one',
|
|
},
|
|
{
|
|
label: 'Value Two',
|
|
value: 'two',
|
|
},
|
|
{
|
|
label: 'Value Three',
|
|
value: 'three',
|
|
},
|
|
{
|
|
label: 'Value Four',
|
|
value: 'four',
|
|
},
|
|
{
|
|
label: 'Value Five',
|
|
value: 'five',
|
|
},
|
|
{
|
|
label: 'Value Six',
|
|
value: 'six',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: 'selectHasManyLocalized',
|
|
type: 'select',
|
|
hasMany: true,
|
|
localized: true,
|
|
options: [
|
|
{
|
|
label: 'Value One',
|
|
value: 'one',
|
|
},
|
|
{
|
|
label: 'Value Two',
|
|
value: 'two',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: 'selectI18n',
|
|
type: 'select',
|
|
admin: {
|
|
isClearable: true,
|
|
},
|
|
options: [
|
|
{
|
|
value: 'one',
|
|
label: { en: 'One', es: 'Uno' },
|
|
},
|
|
{
|
|
value: 'two',
|
|
label: { en: 'Two', es: 'Dos' },
|
|
},
|
|
{
|
|
value: 'three',
|
|
label: { en: 'Three', es: 'Tres' },
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: 'simple',
|
|
type: 'select',
|
|
options: ['One', 'Two', 'Three'],
|
|
},
|
|
{
|
|
type: 'group',
|
|
name: 'settings',
|
|
fields: [
|
|
{
|
|
name: 'category',
|
|
type: 'select',
|
|
hasMany: true,
|
|
options: [
|
|
{ value: 'a', label: 'A' },
|
|
{ value: 'b', label: 'B' },
|
|
],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
}
|
|
|
|
export default SelectFields
|