@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.)
90 lines (78 loc) • 2.71 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _fa = require("react-icons/fa");
var _ = require("../../../..");
var _datatype = require("../../../properties/datatype");
var _object = require("../../../properties/object");
/* eslint-disable prefer-template */
var _default = {
name: 'Measurement',
type: 'document',
title: 'Måling',
titleEN: 'Measurement',
icon: _fa.FaRulerCombined,
fieldsets: _.defaultFieldsets,
fields: [_datatype.featured, {
name: 'observedDimension',
title: 'Dimensjon',
titleEN: 'Dimension',
description: 'Events and activities connected to this object',
type: 'array',
of: [{
type: 'Dimension'
}],
options: {
semanticSanity: {
'@container': '@set',
'@type': '@id'
}
}
}, _object.timespanSingleton, _object.carriedOutBy, _object.referredToBy, _object.tookPlaceAt],
preview: {
select: {
actor: 'carriedOutBy.0.actor.label',
dimension0: 'observedDimension.0.hasType.label',
unit0: 'observedDimension.0.hasUnit.label',
value0: 'observedDimension.0.value',
dimension1: 'observedDimension.1.hasType.label',
unit1: 'observedDimension.1.hasUnit.label',
value1: 'observedDimension.1.value',
dimension2: 'observedDimension.2.hasType.label',
unit2: 'observedDimension.2.hasUnit.label',
value2: 'observedDimension.2.value'
},
prepare(selection) {
var actor = selection.actor,
dimension0 = selection.dimension0,
dimension1 = selection.dimension1,
dimension2 = selection.dimension2,
unit0 = selection.unit0,
unit1 = selection.unit1,
unit2 = selection.unit2,
value0 = selection.value0,
value1 = selection.value1,
value2 = selection.value2;
var d0;
var d1;
var d2;
if (dimension0) {
d0 = "".concat((0, _.coalesceLabel)(dimension0) + ': ' || '').concat(value0 + ' ' || '').concat((0, _.coalesceLabel)(unit0) || '');
}
if (dimension1) {
d1 = "".concat((0, _.coalesceLabel)(dimension1) + ': ' || '').concat(value1 + ' ' || '').concat((0, _.coalesceLabel)(unit1) || '');
}
if (dimension2) {
d2 = "".concat((0, _.coalesceLabel)(dimension2) + ': ' || '').concat(value2 + ' ' || '').concat((0, _.coalesceLabel)(unit2) || '');
}
return {
title: "".concat(d0 ? d0 : '').concat(d1 ? ', ' + d1 : '').concat(d2 ? ', ' + d2 : ''),
subtitle: "M\xE5ling ".concat(actor ? 'utført av ' + actor : '')
};
}
}
};
exports.default = _default;
//# sourceMappingURL=Measurement.js.map