@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.)
115 lines (106 loc) • 2.72 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _gi = require("react-icons/gi");
var _ = require("../../../..");
var _datatype = require("../../../properties/datatype");
var _object = require("../../../properties/object");
var capitalize = require('capitalize');
var _default = {
name: 'Leaving',
type: 'document',
title: 'Utmeldelse',
titleEN: 'Leaving',
icon: _gi.GiExitDoor,
fieldsets: _.defaultFieldsets,
fields: [_datatype.featured, {
name: 'hasType',
title: 'Klassifisert som',
titleEN: 'Classified as',
type: 'array',
of: [{
type: 'reference',
to: [{
type: 'EventType'
}]
}],
options: {
semanticSanity: {
'@container': '@set',
'@type': '@id'
}
}
}, _object.timespanSingleton, _object.tookPlaceAt, {
name: 'separatedFrom',
title: 'Forlot',
titleEN: 'Left',
description: 'Actor(s) that left this group',
type: 'reference',
to: [{
type: 'Actor'
}],
options: {
filter: '_type == "Actor" && references($id)',
filterParams: {
id: 'd4ad3e47-1498-4b95-9b7f-c25be386691a'
},
semanticSanity: {
'@container': '@set',
'@type': '@id'
}
}
}, {
name: 'separated',
title: 'Forlot',
titleEN: 'Left',
description: 'Actor(s) that left this group',
type: 'array',
of: [{
type: 'reference',
to: [{
type: 'Actor'
}],
options: {
filter: '_type == "Actor" && references($id)',
filterParams: {
id: 'd4ad3e47-1498-4b95-9b7f-c25be386691a'
}
}
}],
options: {
semanticSanity: {
'@container': '@set',
'@type': '@id'
}
}
}, _object.referredToBy],
preview: {
select: {
type: '_type',
separatedFrom: 'separatedFrom.label',
bb: 'timespan.beginOfTheBegin',
eb: 'timespan.endOfTheBegin',
date: 'timespan.date',
be: 'timespan.beginOfTheEnd',
ee: 'timespan.endOfTheEnd'
},
prepare(selection) {
var type = selection.type,
separatedFrom = selection.separatedFrom,
bb = selection.bb,
eb = selection.eb,
date = selection.date,
be = selection.be,
ee = selection.ee;
var timespanString = (0, _.timespanAsString)(bb, eb, date, be, ee, 'nb');
return {
title: "".concat(capitalize(type), " ").concat(separatedFrom ? (0, _.coalesceLabel)(separatedFrom) : ''),
subtitle: "".concat(timespanString ? timespanString : '')
};
}
}
};
exports.default = _default;
//# sourceMappingURL=Leaving.js.map