2020-03-09 13:42:32 +05:30
|
|
|
export const findDefaultOption = options => {
|
|
|
|
const item = options.find(o => o.default);
|
|
|
|
return item ? item.key : null;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mapComputedToEvent = (list, root) => {
|
|
|
|
const result = {};
|
|
|
|
list.forEach(e => {
|
|
|
|
result[e] = {
|
|
|
|
get() {
|
|
|
|
return this[root][e];
|
|
|
|
},
|
|
|
|
set(value) {
|
2020-07-28 23:09:34 +05:30
|
|
|
this.$emit('input', { newValue: { ...this[root], [e]: value }, modified: e });
|
2020-03-09 13:42:32 +05:30
|
|
|
},
|
|
|
|
};
|
|
|
|
});
|
|
|
|
return result;
|
|
|
|
};
|