@grafana/runtime
Version:
Grafana Runtime Library
1 lines • 1.97 kB
Source Map (JSON)
{"version":3,"file":"FolderPicker.mjs","sources":["../../../src/components/FolderPicker.tsx"],"sourcesContent":["import * as React from 'react';\n\ninterface FolderPickerProps {\n /* Folder UID to show as selected */\n value?: string;\n\n /** Show an invalid state around the folder picker */\n invalid?: boolean;\n\n /* Whether to show the root 'Dashboards' (formally General) folder as selectable */\n showRootFolder?: boolean;\n\n /* Folder UIDs to exclude from the picker, to prevent invalid operations */\n excludeUIDs?: string[];\n\n /* Show folders matching this permission, mainly used to also show folders user can view. Defaults to showing only folders user has Edit */\n permission?: 'view' | 'edit';\n\n /* Callback for when the user selects a folder */\n onChange?: (folderUID: string | undefined, folderName: string | undefined) => void;\n\n /* Whether the picker should be clearable */\n clearable?: boolean;\n}\n\ntype FolderPickerComponentType = React.ComponentType<FolderPickerProps>;\n\nlet FolderPickerComponent: FolderPickerComponentType | undefined;\n\n/**\n * Used to bootstrap the FolderPicker during application start\n *\n * @internal\n */\nexport function setFolderPicker(component: FolderPickerComponentType) {\n FolderPickerComponent = component;\n}\n\nexport function FolderPicker(props: FolderPickerProps) {\n if (FolderPickerComponent) {\n return <FolderPickerComponent {...props} />;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n return <div>@grafana/runtime FolderPicker is not set</div>;\n }\n\n return null;\n}\n"],"names":[],"mappings":";;AA2BA,IAAI,qBAAA;AAOG,SAAS,gBAAgB,SAAsC,EAAA;AACpE,EAAwB,qBAAA,GAAA,SAAA;AAC1B;AAEO,SAAS,aAAa,KAA0B,EAAA;AACrD,EAAA,IAAI,qBAAuB,EAAA;AACzB,IAAO,uBAAA,GAAA,CAAC,qBAAuB,EAAA,EAAA,GAAG,KAAO,EAAA,CAAA;AAAA;AAG3C,EAAI,IAAA,OAAA,CAAQ,GAAI,CAAA,QAAA,KAAa,YAAc,EAAA;AACzC,IAAO,uBAAA,GAAA,CAAC,SAAI,QAAwC,EAAA,0CAAA,EAAA,CAAA;AAAA;AAGtD,EAAO,OAAA,IAAA;AACT;;;;"}