Added "moreFields" property to the field schema

The "Add field" dropdown can now be used to add preset-specific fields in addition to universal fields
This commit is contained in:
Quincy Morgan
2018-12-09 13:51:57 -08:00
parent cbcafaee15
commit 4285f2f5c0
19 changed files with 185 additions and 121 deletions
+1
View File
@@ -10,6 +10,7 @@ export function presetPreset(id, preset, fields) {
preset.id = id;
preset.fields = (preset.fields || []).map(getFields);
preset.moreFields = (preset.moreFields || []).map(getFields);
preset.geometry = (preset.geometry || []);
+9 -1
View File
@@ -53,7 +53,7 @@ export function uiPresetEditor(context) {
);
}
presets.universal().forEach(function(field) {
_preset.moreFields.forEach(function(field) {
if (_preset.fields.indexOf(field) === -1) {
_fieldsArr.push(
uiField(context, field, entity, { show: false })
@@ -61,6 +61,14 @@ export function uiPresetEditor(context) {
}
});
presets.universal().forEach(function(field) {
if (_preset.fields.indexOf(field) === -1 && _preset.moreFields.indexOf(field) === -1) {
_fieldsArr.push(
uiField(context, field, entity, { show: false })
);
}
});
_fieldsArr.forEach(function(field) {
field
.on('change', function(t, onInput) {