@grafana/runtime
Version:
Grafana Runtime Library
1 lines • 2.06 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 /* Start tree from this folder instead of root */\n rootFolderUID?: 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":";;;AA8BA,IAAI,qBAAA;AAOG,SAAS,gBAAgB,SAAA,EAAsC;AACpE,EAAA,qBAAA,GAAwB,SAAA;AAC1B;AAEO,SAAS,aAAa,KAAA,EAA0B;AACrD,EAAA,IAAI,qBAAA,EAAuB;AACzB,IAAA,uBAAO,GAAA,CAAC,qBAAA,EAAA,EAAuB,GAAG,KAAA,EAAO,CAAA;AAAA,EAC3C;AAEA,EAAA,IAAI,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,YAAA,EAAc;AACzC,IAAA,uBAAO,GAAA,CAAC,SAAI,QAAA,EAAA,0CAAA,EAAwC,CAAA;AAAA,EACtD;AAEA,EAAA,OAAO,IAAA;AACT;;;;"}