UNPKG

@seidhr/sanity-plugin-muna-schemas

Version:

Muna or ᛗᚢᚾᚨ means remember in norse. Muna is a schema for the Sanity Studio that enables detailed descriptions of cultural heritage objects and knowledge about their contexts as well as pages about them (or anything else really.)

162 lines (151 loc) 4.62 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _fa = require("react-icons/fa"); var _helpers = require("../../../../helpers"); var _datatype = require("../../../properties/datatype"); var _object = require("../../../properties/object"); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var _default = { name: 'Project', type: 'document', title: 'Project', icon: _fa.FaProjectDiagram, fieldsets: [{ name: 'state', title: 'Status', options: { collapsible: true, collapsed: false, columns: 2 } }, { name: 'core', title: 'Basic metadata', options: { collapsible: true, collapsed: false } }, { name: 'relations', title: 'Relations to other stuff', options: { collapsible: true, collapsed: false } }], fields: [_datatype.editorialState, _datatype.accessState, _datatype.label, { name: 'active', title: 'Pågående?', titleEN: 'Ongoing?', type: 'boolean', fieldset: 'core', initialValue: true, options: { semanticSanity: { "@type": "xsd:boolean" } } }, _objectSpread(_objectSpread({}, _object.identifiedBy), {}, { fieldset: 'core' }), _objectSpread(_objectSpread({}, _object.referredToBy), {}, { fieldset: 'core' }), _objectSpread(_objectSpread({}, _object.timespanSingleton), {}, { fieldset: 'core' }), { name: 'isAbout', title: 'Omhandler', titleEN: 'About', description: 'Which collection(s) or object(s) is this project was about.', type: 'array', of: [{ type: 'reference', to: [{ type: 'HumanMadeObject' }, { type: 'Collection' }, { type: 'Actor' }] }], options: { semanticSanity: { '@container': '@set', '@type': '@id' } } }, { name: 'consistsOf', title: 'Underprosjekt', titleEN: 'Sub projects', type: 'array', of: [{ type: 'Project' }], options: { editModal: 'fullscreen', semanticSanity: { '@container': '@set', '@type': '@id' } } }, { name: 'documentedIn', title: 'Documented in', titleEN: 'Dokumentert i', type: 'array', of: [{ type: 'file' }], options: { semanticSanity: { exclude: true } } }], preview: { select: { type: 'hasType.0.label', title: 'label', blocks: 'referredToBy.0.body', published: 'accessState', active: 'active' }, prepare(selection) { var type = selection.type, title = selection.title, blocks = selection.blocks, published = selection.published, active = selection.active; var desc = (blocks || []).find(block => block._type === 'block'); var secret = published === 'secret' ? '🔒' : ''; var a = active ? 'Active' : 'Completed'; return { title: (0, _helpers.coalesceLabel)(title), subtitle: "".concat(secret, " ").concat(a, " ").concat((0, _helpers.coalesceLabel)(type) || ''), description: desc ? desc.children.filter(child => child._type === 'span').map(span => span.text).join('') : 'No description' }; } }, orderings: [{ title: 'Title, A-Å', name: 'label', by: [{ field: 'label', direction: 'desc' }] }, { title: 'Title, Å-A', name: 'label', by: [{ field: 'label', direction: 'asc' }] }] }; exports.default = _default; //# sourceMappingURL=Project.js.map