Vulture/VApp/node_modules/vuetify/lib/composables/nested/openStrategies.mjs

67 lines
1.3 KiB
JavaScript
Raw Normal View History

export const singleOpenStrategy = {
open: _ref => {
let {
id,
value,
opened,
parents
} = _ref;
if (value) {
const newOpened = new Set();
newOpened.add(id);
let parent = parents.get(id);
while (parent != null) {
newOpened.add(parent);
parent = parents.get(parent);
}
return newOpened;
} else {
opened.delete(id);
return opened;
}
},
select: () => null
};
export const multipleOpenStrategy = {
open: _ref2 => {
let {
id,
value,
opened,
parents
} = _ref2;
if (value) {
let parent = parents.get(id);
opened.add(id);
while (parent != null && parent !== id) {
opened.add(parent);
parent = parents.get(parent);
}
return opened;
} else {
opened.delete(id);
}
return opened;
},
select: () => null
};
export const listOpenStrategy = {
open: multipleOpenStrategy.open,
select: _ref3 => {
let {
id,
value,
opened,
parents
} = _ref3;
if (!value) return opened;
const path = [];
let parent = parents.get(id);
while (parent != null) {
path.push(parent);
parent = parents.get(parent);
}
return new Set(path);
}
};
//# sourceMappingURL=openStrategies.mjs.map