You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
559 B
21 lines
559 B
2 years ago
|
// eslint-disable-next-line no-undef
|
||
|
export default Behavior({
|
||
|
definitionFilter(defFields) {
|
||
|
const {
|
||
|
properties
|
||
|
} = defFields;
|
||
|
const propsKey = Object.keys(properties);
|
||
|
propsKey.forEach(name => {
|
||
|
const {
|
||
|
options
|
||
|
} = properties[name];
|
||
|
if (options) {
|
||
|
properties[name].observer = function (newValue) {
|
||
|
if (!options.includes(newValue) && newValue) {
|
||
|
console.error(`${name}: ${newValue} must be in the [${options}]`);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
});
|