Added autocomplete for fields that expect variable names

This commit is contained in:
Thaum Rystra
2020-04-29 10:53:06 +02:00
parent 966fcc449d
commit ed9cfee9f9
13 changed files with 128 additions and 35 deletions

View File

@@ -56,21 +56,16 @@
watch: {
'value': {
immediate: true,
handler(newValue, oldValue){
handler(newValue){
let newIcon = proficiencyIcon(newValue);
if (!oldValue){
// Skip animation
this.iconClass='leaving';
setTimeout(() => {
this.displayedIcon = newIcon;
} else {
this.iconClass='leaving';
setTimeout(() => {
this.displayedIcon = newIcon;
this.iconClass='arriving';
requestAnimationFrame(() => {
this.iconClass='';
});
}, ICON_SPIN_DURATION / 2);
}
this.iconClass='arriving';
requestAnimationFrame(() => {
this.iconClass='';
});
}, ICON_SPIN_DURATION / 2);
},
},
}

View File

@@ -0,0 +1,11 @@
import createListOfProperties from '/imports/ui/properties/forms/shared/lists/createListOfProperties.js';
const attributeListMixin = {
meteor: {
attributeList(){
return createListOfProperties({type: 'attribute'});
},
},
};
export default attributeListMixin;

View File

@@ -0,0 +1,21 @@
import CreatureProperties from '/imports/api/creature/CreatureProperties.js';
import LibraryNodes from '/imports/api/library/LibraryNodes.js';
export default function createListOfProperties(filter = {}){
filter.removed = {$ne: true};
let propertyList = [];
let variableNames = new Set();
function addUniquePropertys(property){
if (property.variableName && !variableNames.has(property.variableName)){
variableNames.add(property.variableName);
propertyList.push({
text: property.name || property.variableName,
value: property.variableName,
propertyType: property.propertyType,
});
}
}
CreatureProperties.find(filter).forEach(addUniquePropertys);
LibraryNodes.find(filter).forEach(addUniquePropertys);
return Array.from(variableNames);
}

View File

@@ -0,0 +1,11 @@
import createListOfProperties from '/imports/ui/properties/forms/shared/lists/createListOfProperties.js'
const skillListMixin = {
meteor: {
skillList(){
return createListOfProperties({type: 'skill'});
},
},
};
export default skillListMixin;