devextreme
Version:
JavaScript/TypeScript Component Suite for Responsive Web Development
29 lines (28 loc) • 1.29 kB
JavaScript
/**
* DevExtreme (cjs/__internal/scheduler/utils/resource_manager/agenda_group_utils.js)
* Version: 25.2.7
* Build date: Tue May 05 2026
*
* Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.reduceResourcesTree = void 0;
const hasGroupAppointments = (resourceById, appointments, node) => {
const resource = resourceById[node.resourceIndex];
const value = node.grouped[node.resourceIndex];
return appointments.some(appointment => resource.idsGetter(appointment.itemData).includes(value))
};
const filterGroupTree = (resourceById, appointments, node) => {
if (!hasGroupAppointments(resourceById, appointments, node)) {
return
}
return Object.assign({}, node, {
children: node.children.length ? node.children.map(childrenNode => filterGroupTree(resourceById, appointments, childrenNode)).filter(Boolean) : []
})
};
const reduceResourcesTree = (resourceById, groupsTree, appointments) => groupsTree.map(node => filterGroupTree(resourceById, appointments, node)).filter(Boolean);
exports.reduceResourcesTree = reduceResourcesTree;