UNPKG

payload

Version:

Node, React, Headless CMS and Application Framework built on Next.js

68 lines (67 loc) 1.81 kB
// @ts-strict-ignore import { versionSnapshotField } from './baseFields.js'; export const buildVersionGlobalFields = (config, global, flatten)=>{ const fields = [ { name: 'version', type: 'group', fields: global.fields, ...flatten && { flattenedFields: global.flattenedFields } }, { name: 'createdAt', type: 'date', admin: { disabled: true }, index: true }, { name: 'updatedAt', type: 'date', admin: { disabled: true }, index: true } ]; if (global?.versions?.drafts) { if (config.localization) { fields.push(versionSnapshotField); fields.push({ name: 'publishedLocale', type: 'select', admin: { disableBulkEdit: true, disabled: true }, index: true, options: config.localization.locales.map((locale)=>{ if (typeof locale === 'string') { return locale; } return locale.code; }) }); } fields.push({ name: 'latest', type: 'checkbox', admin: { disabled: true }, index: true }); if (global?.versions?.drafts?.autosave) { fields.push({ name: 'autosave', type: 'checkbox', index: true }); } } return fields; }; //# sourceMappingURL=buildGlobalFields.js.map