UNPKG

@mui/x-tree-view

Version:

The community edition of the MUI X Tree View components.

24 lines (23 loc) 865 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.idSelectors = void 0; var _store = require("@mui/x-internals/store"); const idSelectors = exports.idSelectors = { /** * Get the id attribute of the tree view. */ treeId: (0, _store.createSelector)(state => state.treeId), /** * Generate the id attribute (i.e.: the `id` attribute passed to the DOM element) of a Tree Item. * If the user explicitly defined an id attribute, it will be returned. * Otherwise, the method creates a unique id for the item based on the Tree View id attribute and the item `itemId` */ treeItemIdAttribute: (0, _store.createSelector)(state => state.treeId, (treeId, itemId, providedIdAttribute) => { if (providedIdAttribute != null) { return providedIdAttribute; } return `${treeId ?? ''}-${itemId}`; }) };