How to use the @bentley/ui-components.useModelSource function in @bentley/ui-components

To help you get started, we’ve selected a few @bentley/ui-components examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / appui / widgets / NavigationTreeWidget.tsx View on Github external
const NavigationTree: React.FC = (props: NavigationTreeProps) => {
  const nodeLoader = usePresentationNodeLoader({
    imodel: props.iModelConnection,
    rulesetId: props.rulesetId,
    pageSize: 20,
  });
  const modelSource = useModelSource(nodeLoader)!;
  const eventHandler = React.useMemo(() => new TreeEventHandler({ modelSource, nodeLoader, collapsedChildrenDisposalEnabled: true }), [modelSource, nodeLoader]);
  const unifiedSelectionEventHandler = useControlledTreeUnifiedSelection(modelSource, eventHandler, nodeLoader.getDataProvider());
  const visibleNodes = useVisibleTreeNodes(modelSource);

  return (
    
  );
};
github imodeljs / imodeljs / presentation / components / src / tree / controlled / UseControlledTreeFiltering.ts View on Github external
export function useControlledTreeFiltering(
  nodeLoader: ITreeNodeLoaderWithProvider,
  modelSource: TreeModelSource,
  filter: string | undefined,
  activeMatch?: number,
) {
  const {
    filteredNodeLoader,
    isFiltering,
    matchesCount,
  } = useFilteredNodeLoader(nodeLoader, filter);

  const filteredModelSource = useModelSource(filteredNodeLoader);
  const nodeHighlightingProps = useNodeHighlightingProps(filter, filteredNodeLoader, activeMatch);

  return {
    nodeHighlightingProps,
    filteredNodeLoader: filteredNodeLoader || nodeLoader,
    filteredModelSource: filteredModelSource || modelSource,
    isFiltering,
    matchesCount,
  };
}