Merge pull request #14162 from strapi/custom-fields/remove-map-cf

[Custom fields] remove map cf
This commit is contained in:
markkaylor 2022-08-22 17:18:11 +02:00 committed by GitHub
commit d84d954e43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,131 +5,112 @@ import ColorPickerIcon from './components/ColorPicker/ColorPickerIcon';
export default { export default {
register(app) { register(app) {
app.customFields.register([ app.customFields.register({
{ name: 'color',
name: 'map', pluginId: 'mycustomfields',
pluginId: 'mycustomfields', type: 'string',
type: 'json', icon: ColorPickerIcon,
intlLabel: { intlLabel: {
id: 'mycustomfields.map.label', id: 'mycustomfields.color.label',
defaultMessage: 'Map', defaultMessage: 'Color',
},
intlDescription: {
id: 'mycustomfields.map.description',
defaultMessage: 'Select any location',
},
components: {
Input: async () =>
import(/* webpackChunkName: "input-component" */ './components/Map/MapInput'),
},
}, },
{ intlDescription: {
name: 'color', id: 'mycustomfields.color.description',
pluginId: 'mycustomfields', defaultMessage: 'Select any color',
type: 'string', },
icon: ColorPickerIcon, components: {
intlLabel: { Input: async () =>
id: 'mycustomfields.color.label', import(
defaultMessage: 'Color', /* webpackChunkName: "input-component" */ './components/ColorPicker/ColorPickerInput'
}, ),
intlDescription: { },
id: 'mycustomfields.color.description', options: {
defaultMessage: 'Select any color', base: [
}, {
components: { intlLabel: {
Input: async () => id: 'color-picker.color.format.label',
import( defaultMessage: 'Color format',
/* webpackChunkName: "input-component" */ './components/ColorPicker/ColorPickerInput'
),
},
options: {
base: [
{
intlLabel: {
id: 'color-picker.color.format.label',
defaultMessage: 'Color format',
},
name: 'options.format',
type: 'select',
value: 'hex',
options: [
{
key: '__null_reset_value__',
value: '',
metadatas: {
intlLabel: {
id: 'color-picker.color.format.placeholder',
defaultMessage: 'Select a format',
},
hidden: true,
},
},
{
key: 'hex',
value: 'hex',
metadatas: {
intlLabel: {
id: 'color-picker.color.format.hex',
defaultMessage: 'Hexadecimal',
},
},
},
{
key: 'rgba',
value: 'rgba',
metadatas: {
intlLabel: {
id: 'color-picker.color.format.rgba',
defaultMessage: 'RGBA',
},
},
},
],
}, },
], name: 'options.format',
advanced: [ type: 'select',
{ value: 'hex',
sectionTitle: { options: [
id: 'global.settings', {
defaultMessage: 'Settings', key: '__null_reset_value__',
value: '',
metadatas: {
intlLabel: {
id: 'color-picker.color.format.placeholder',
defaultMessage: 'Select a format',
},
hidden: true,
},
}, },
items: [ {
{ key: 'hex',
name: 'required', value: 'hex',
type: 'checkbox', metadatas: {
intlLabel: { intlLabel: {
id: 'form.attribute.item.requiredField', id: 'color-picker.color.format.hex',
defaultMessage: 'Required field', defaultMessage: 'Hexadecimal',
},
description: {
id: 'form.attribute.item.requiredField.description',
defaultMessage: "You won't be able to create an entry if this field is empty",
}, },
}, },
{ },
name: 'private', {
type: 'checkbox', key: 'rgba',
value: 'rgba',
metadatas: {
intlLabel: { intlLabel: {
id: 'form.attribute.item.privateField', id: 'color-picker.color.format.rgba',
defaultMessage: 'Private field', defaultMessage: 'RGBA',
},
description: {
id: 'form.attribute.item.privateField.description',
defaultMessage: 'This field will not show up in the API response',
}, },
}, },
], },
],
},
],
advanced: [
{
sectionTitle: {
id: 'global.settings',
defaultMessage: 'Settings',
}, },
], items: [
validator: (args) => ({ {
format: yup.string().required({ name: 'required',
id: 'options.color-picker.format.error', type: 'checkbox',
defaultMessage: 'The color format is required', intlLabel: {
}), id: 'form.attribute.item.requiredField',
defaultMessage: 'Required field',
},
description: {
id: 'form.attribute.item.requiredField.description',
defaultMessage: "You won't be able to create an entry if this field is empty",
},
},
{
name: 'private',
type: 'checkbox',
intlLabel: {
id: 'form.attribute.item.privateField',
defaultMessage: 'Private field',
},
description: {
id: 'form.attribute.item.privateField.description',
defaultMessage: 'This field will not show up in the API response',
},
},
],
},
],
validator: (args) => ({
format: yup.string().required({
id: 'options.color-picker.format.error',
defaultMessage: 'The color format is required',
}), }),
}, }),
}, },
]); });
}, },
bootstrap(app) {}, bootstrap(app) {},
async registerTrads({ locales }) { async registerTrads({ locales }) {