@databricks/appkit-ui 0.18.0 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +8 -1
- package/dist/cli/commands/plugin/create/scaffold.js +2 -8
- package/dist/cli/commands/plugin/create/scaffold.js.map +1 -1
- package/dist/react/file-browser/directory-list.d.ts +54 -0
- package/dist/react/file-browser/directory-list.d.ts.map +1 -0
- package/dist/react/file-browser/directory-list.js +74 -0
- package/dist/react/file-browser/directory-list.js.map +1 -0
- package/dist/react/file-browser/file-breadcrumb.d.ts +25 -0
- package/dist/react/file-browser/file-breadcrumb.d.ts.map +1 -0
- package/dist/react/file-browser/file-breadcrumb.js +27 -0
- package/dist/react/file-browser/file-breadcrumb.js.map +1 -0
- package/dist/react/file-browser/file-entry.d.ts +27 -0
- package/dist/react/file-browser/file-entry.d.ts.map +1 -0
- package/dist/react/file-browser/file-entry.js +31 -0
- package/dist/react/file-browser/file-entry.js.map +1 -0
- package/dist/react/file-browser/file-preview-panel.d.ts +42 -0
- package/dist/react/file-browser/file-preview-panel.d.ts.map +1 -0
- package/dist/react/file-browser/file-preview-panel.js +135 -0
- package/dist/react/file-browser/file-preview-panel.js.map +1 -0
- package/dist/react/file-browser/index.d.ts +7 -0
- package/dist/react/file-browser/index.js +6 -0
- package/dist/react/file-browser/new-folder-input.d.ts +36 -0
- package/dist/react/file-browser/new-folder-input.d.ts.map +1 -0
- package/dist/react/file-browser/new-folder-input.js +52 -0
- package/dist/react/file-browser/new-folder-input.js.map +1 -0
- package/dist/react/file-browser/types.d.ts +52 -0
- package/dist/react/file-browser/types.d.ts.map +1 -0
- package/dist/react/genie/genie-chat-message-list.js +1 -1
- package/dist/react/genie/genie-chat-message.js +1 -1
- package/dist/react/index.d.ts +9 -1
- package/dist/react/index.js +12 -5
- package/dist/react/lib/format.d.ts +14 -0
- package/dist/react/lib/format.d.ts.map +1 -0
- package/dist/react/lib/format.js +17 -1
- package/dist/react/lib/format.js.map +1 -1
- package/dist/react/table/data-table.js +1 -1
- package/dist/react/table/table-wrapper.js +1 -1
- package/dist/react/ui/breadcrumb.js +1 -1
- package/dist/react/ui/index.js +3 -3
- package/dist/react/ui/navigation-menu.js +1 -1
- package/dist/react/ui/sidebar.js +1 -1
- package/docs/api/appkit/Class.Plugin.md +60 -12
- package/docs/api/appkit/Class.ResourceRegistry.md +3 -3
- package/docs/api/appkit/Function.createApp.md +3 -3
- package/docs/api/appkit/Interface.PluginManifest.md +9 -3
- package/docs/api/appkit/TypeAlias.PluginData.md +45 -0
- package/docs/api/appkit/TypeAlias.ToPlugin.md +1 -1
- package/docs/api/appkit-ui/files/DirectoryList.md +36 -0
- package/docs/api/appkit-ui/files/FileBreadcrumb.md +27 -0
- package/docs/api/appkit-ui/files/FileEntry.md +27 -0
- package/docs/api/appkit-ui/files/FilePreviewPanel.md +32 -0
- package/docs/api/appkit-ui/files/NewFolderInput.md +30 -0
- package/docs/api/appkit.md +1 -0
- package/docs/configuration.md +15 -0
- package/docs/plugins/custom-plugins.md +4 -13
- package/docs/plugins/files.md +350 -0
- package/docs/plugins.md +2 -1
- package/llms.txt +8 -1
- package/package.json +1 -1
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
# Interface: PluginManifest
|
|
1
|
+
# Interface: PluginManifest\<TName>
|
|
2
2
|
|
|
3
3
|
Plugin manifest that declares metadata and resource requirements. Attached to plugin classes as a static property.
|
|
4
4
|
|
|
5
|
+
## Type Parameters[](#type-parameters "Direct link to Type Parameters")
|
|
6
|
+
|
|
7
|
+
| Type Parameter | Default type |
|
|
8
|
+
| -------------------------- | ------------ |
|
|
9
|
+
| `TName` *extends* `string` | `string` |
|
|
10
|
+
|
|
5
11
|
## Properties[](#properties "Direct link to Properties")
|
|
6
12
|
|
|
7
13
|
### author?[](#author "Direct link to author?")
|
|
@@ -89,11 +95,11 @@ optional license: string;
|
|
|
89
95
|
### name[](#name "Direct link to name")
|
|
90
96
|
|
|
91
97
|
```ts
|
|
92
|
-
name:
|
|
98
|
+
name: TName;
|
|
93
99
|
|
|
94
100
|
```
|
|
95
101
|
|
|
96
|
-
Plugin identifier
|
|
102
|
+
Plugin identifier — the single source of truth for the plugin's name
|
|
97
103
|
|
|
98
104
|
***
|
|
99
105
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Type Alias: PluginData\<T, U, N>
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
type PluginData<T, U, N> = {
|
|
5
|
+
config: U;
|
|
6
|
+
name: N;
|
|
7
|
+
plugin: T;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Type Parameters[](#type-parameters "Direct link to Type Parameters")
|
|
13
|
+
|
|
14
|
+
| Type Parameter |
|
|
15
|
+
| -------------- |
|
|
16
|
+
| `T` |
|
|
17
|
+
| `U` |
|
|
18
|
+
| `N` |
|
|
19
|
+
|
|
20
|
+
## Properties[](#properties "Direct link to Properties")
|
|
21
|
+
|
|
22
|
+
### config[](#config "Direct link to config")
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
config: U;
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
***
|
|
30
|
+
|
|
31
|
+
### name[](#name "Direct link to name")
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
name: N;
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
***
|
|
39
|
+
|
|
40
|
+
### plugin[](#plugin "Direct link to plugin")
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
plugin: T;
|
|
44
|
+
|
|
45
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# DirectoryList
|
|
2
|
+
|
|
3
|
+
Card-wrapped directory listing with loading, error, and empty states
|
|
4
|
+
|
|
5
|
+
## DirectoryList[](#directorylist-1 "Direct link to DirectoryList")
|
|
6
|
+
|
|
7
|
+
Card-wrapped directory listing with loading, error, and empty states
|
|
8
|
+
|
|
9
|
+
**Source:** [`packages/appkit-ui/src/react/file-browser/directory-list.tsx`](https://github.com/databricks/appkit/blob/main/packages/appkit-ui/src/react/file-browser/directory-list.tsx)
|
|
10
|
+
|
|
11
|
+
### Props[](#props "Direct link to Props")
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Required | Default | Description |
|
|
14
|
+
| -------------------- | ------------------------------------------------------------------------------------------------ | -------- | ------- | ---------------------------------------------------------------------------------- |
|
|
15
|
+
| `entries` | `DirectoryEntry[]` | ✓ | - | Directory entries to display |
|
|
16
|
+
| `loading` | `boolean` | | - | Whether the directory is currently loading |
|
|
17
|
+
| `error` | `string \| null` | | - | Error message to display |
|
|
18
|
+
| `onEntryClick` | `(entry: DirectoryEntry) => void` | ✓ | - | Called when an entry is clicked |
|
|
19
|
+
| `onNavigateToParent` | `(() => void)` | | - | Called when the back/parent button is clicked |
|
|
20
|
+
| `onRetry` | `(() => void)` | | - | Called when the retry button is clicked |
|
|
21
|
+
| `isAtRoot` | `boolean` | | - | Whether the user is at the root directory (hides back button) |
|
|
22
|
+
| `selectedPath` | `string \| null` | | - | Currently selected file path for highlighting |
|
|
23
|
+
| `resolveEntryPath` | `(entry: DirectoryEntry) => string` | ✓ | - | Resolves a DirectoryEntry to its full path |
|
|
24
|
+
| `headerContent` | `ReactNode` | | - | Content rendered between the back button and the entry list (e.g., NewFolderInput) |
|
|
25
|
+
| `hasCurrentPath` | `boolean` | | - | Whether a current path is set (affects empty state message) |
|
|
26
|
+
| `formatSize` | `((bytes: number) => string)` | | - | Custom file size formatter |
|
|
27
|
+
| `labels` | `Pick<FileBrowserLabels, "backToParent" \| "emptyDirectory" \| "noVolumeConfigured" \| "retry">` | | - | Customizable labels |
|
|
28
|
+
|
|
29
|
+
### Usage[](#usage "Direct link to Usage")
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { DirectoryList } from '@databricks/appkit-ui';
|
|
33
|
+
|
|
34
|
+
<DirectoryList /* props */ />
|
|
35
|
+
|
|
36
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# FileBreadcrumb
|
|
2
|
+
|
|
3
|
+
Path-aware breadcrumb navigation built on top of Breadcrumb primitives
|
|
4
|
+
|
|
5
|
+
## FileBreadcrumb[](#filebreadcrumb-1 "Direct link to FileBreadcrumb")
|
|
6
|
+
|
|
7
|
+
Path-aware breadcrumb navigation built on top of Breadcrumb primitives
|
|
8
|
+
|
|
9
|
+
**Source:** [`packages/appkit-ui/src/react/file-browser/file-breadcrumb.tsx`](https://github.com/databricks/appkit/blob/main/packages/appkit-ui/src/react/file-browser/file-breadcrumb.tsx)
|
|
10
|
+
|
|
11
|
+
### Props[](#props "Direct link to Props")
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Required | Default | Description |
|
|
14
|
+
| --------------------- | ------------------------- | -------- | ------- | -------------------------------------------------------------------- |
|
|
15
|
+
| `rootLabel` | `string` | ✓ | - | Label for the root breadcrumb item |
|
|
16
|
+
| `segments` | `string[]` | ✓ | - | Path segments after the root |
|
|
17
|
+
| `onNavigateToRoot` | `() => void` | ✓ | - | Called when the root breadcrumb is clicked |
|
|
18
|
+
| `onNavigateToSegment` | `(index: number) => void` | ✓ | - | Called when a segment breadcrumb is clicked (receives segment index) |
|
|
19
|
+
|
|
20
|
+
### Usage[](#usage "Direct link to Usage")
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import { FileBreadcrumb } from '@databricks/appkit-ui';
|
|
24
|
+
|
|
25
|
+
<FileBreadcrumb /* props */ />
|
|
26
|
+
|
|
27
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# FileEntry
|
|
2
|
+
|
|
3
|
+
Single file or directory row with icon, name, size, and selection state
|
|
4
|
+
|
|
5
|
+
## FileEntry[](#fileentry-1 "Direct link to FileEntry")
|
|
6
|
+
|
|
7
|
+
Single file or directory row with icon, name, size, and selection state
|
|
8
|
+
|
|
9
|
+
**Source:** [`packages/appkit-ui/src/react/file-browser/file-entry.tsx`](https://github.com/databricks/appkit/blob/main/packages/appkit-ui/src/react/file-browser/file-entry.tsx)
|
|
10
|
+
|
|
11
|
+
### Props[](#props "Direct link to Props")
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Required | Default | Description |
|
|
14
|
+
| ------------ | ----------------------------- | -------- | ------- | ------------------------------------------------------- |
|
|
15
|
+
| `entry` | `DirectoryEntry` | ✓ | - | The directory entry to render |
|
|
16
|
+
| `entryPath` | `string` | ✓ | - | Resolved full path for this entry |
|
|
17
|
+
| `isSelected` | `boolean` | | - | Whether this entry is currently selected |
|
|
18
|
+
| `formatSize` | `((bytes: number) => string)` | | - | Custom file size formatter (defaults to formatFileSize) |
|
|
19
|
+
|
|
20
|
+
### Usage[](#usage "Direct link to Usage")
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import { FileEntry } from '@databricks/appkit-ui';
|
|
24
|
+
|
|
25
|
+
<FileEntry /* props */ />
|
|
26
|
+
|
|
27
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# FilePreviewPanel
|
|
2
|
+
|
|
3
|
+
Preview panel displaying file metadata, image/text preview, and download/delete actions
|
|
4
|
+
|
|
5
|
+
## FilePreviewPanel[](#filepreviewpanel-1 "Direct link to FilePreviewPanel")
|
|
6
|
+
|
|
7
|
+
Preview panel displaying file metadata, image/text preview, and download/delete actions
|
|
8
|
+
|
|
9
|
+
**Source:** [`packages/appkit-ui/src/react/file-browser/file-preview-panel.tsx`](https://github.com/databricks/appkit/blob/main/packages/appkit-ui/src/react/file-browser/file-preview-panel.tsx)
|
|
10
|
+
|
|
11
|
+
### Props[](#props "Direct link to Props")
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Required | Default | Description |
|
|
14
|
+
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ------- | ------------------------------------------------------------------------- |
|
|
15
|
+
| `selectedFile` | `string \| null` | ✓ | - | Full path of the selected file (null when nothing is selected) |
|
|
16
|
+
| `preview` | `FilePreview \| null` | ✓ | - | Preview data for the selected file |
|
|
17
|
+
| `previewLoading` | `boolean` | | - | Whether the preview is loading |
|
|
18
|
+
| `onDownload` | `((filePath: string) => void)` | | - | Called when the download button is clicked |
|
|
19
|
+
| `onDelete` | `((filePath: string) => void)` | | - | Called when the delete button is clicked |
|
|
20
|
+
| `deleting` | `boolean` | | - | Whether a delete operation is in progress |
|
|
21
|
+
| `imagePreviewSrc` | `string \| ((filePath: string) => string)` | | - | Image preview source — string URL or function that receives the file path |
|
|
22
|
+
| `formatSize` | `((bytes: number) => string)` | | - | Custom file size formatter (defaults to formatFileSize) |
|
|
23
|
+
| `labels` | `Pick<FileBrowserLabels, "type" \| "download" \| "size" \| "selectFilePrompt" \| "previewNotAvailable" \| "previewFailed" \| "modified" \| "unknown">` | | - | Customizable labels |
|
|
24
|
+
|
|
25
|
+
### Usage[](#usage "Direct link to Usage")
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { FilePreviewPanel } from '@databricks/appkit-ui';
|
|
29
|
+
|
|
30
|
+
<FilePreviewPanel /* props */ />
|
|
31
|
+
|
|
32
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# NewFolderInput
|
|
2
|
+
|
|
3
|
+
Inline folder-name input with create/cancel actions
|
|
4
|
+
|
|
5
|
+
## NewFolderInput[](#newfolderinput-1 "Direct link to NewFolderInput")
|
|
6
|
+
|
|
7
|
+
Inline folder-name input with create/cancel actions
|
|
8
|
+
|
|
9
|
+
**Source:** [`packages/appkit-ui/src/react/file-browser/new-folder-input.tsx`](https://github.com/databricks/appkit/blob/main/packages/appkit-ui/src/react/file-browser/new-folder-input.tsx)
|
|
10
|
+
|
|
11
|
+
### Props[](#props "Direct link to Props")
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Required | Default | Description |
|
|
14
|
+
| ----------- | -------------------------------------------------------------- | -------- | ------- | -------------------------------------- |
|
|
15
|
+
| `value` | `string` | ✓ | - | Current folder name value |
|
|
16
|
+
| `onChange` | `(value: string) => void` | ✓ | - | Called when folder name changes |
|
|
17
|
+
| `onCreate` | `() => void` | ✓ | - | Called when the user confirms creation |
|
|
18
|
+
| `onCancel` | `() => void` | ✓ | - | Called when the user cancels |
|
|
19
|
+
| `creating` | `boolean` | | - | Whether folder creation is in progress |
|
|
20
|
+
| `autoFocus` | `boolean` | | `true` | Auto-focus the input on mount |
|
|
21
|
+
| `labels` | `Pick<FileBrowserLabels, "create" \| "folderNamePlaceholder">` | | - | Customizable labels |
|
|
22
|
+
|
|
23
|
+
### Usage[](#usage "Direct link to Usage")
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { NewFolderInput } from '@databricks/appkit-ui';
|
|
27
|
+
|
|
28
|
+
<NewFolderInput /* props */ />
|
|
29
|
+
|
|
30
|
+
```
|
package/docs/api/appkit.md
CHANGED
|
@@ -51,6 +51,7 @@ Core library for building Databricks applications with type-safe SQL queries, pl
|
|
|
51
51
|
| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
|
|
52
52
|
| [ConfigSchema](./docs/api/appkit/TypeAlias.ConfigSchema.md) | Configuration schema definition for plugin config. Re-exported from the standard JSON Schema Draft 7 types. |
|
|
53
53
|
| [IAppRouter](./docs/api/appkit/TypeAlias.IAppRouter.md) | Express router type for plugin route registration |
|
|
54
|
+
| [PluginData](./docs/api/appkit/TypeAlias.PluginData.md) | - |
|
|
54
55
|
| [ResourcePermission](./docs/api/appkit/TypeAlias.ResourcePermission.md) | Union of all possible permission levels across all resource types. |
|
|
55
56
|
| [ToPlugin](./docs/api/appkit/TypeAlias.ToPlugin.md) | - |
|
|
56
57
|
|
package/docs/configuration.md
CHANGED
|
@@ -46,6 +46,21 @@ env:
|
|
|
46
46
|
|
|
47
47
|
This makes the warehouse ID available to your app at runtime. The `valueFrom: sql-warehouse` directive tells Databricks Apps to inject the configured warehouse ID.
|
|
48
48
|
|
|
49
|
+
### Binding Unity Catalog volumes (files plugin)[](#binding-unity-catalog-volumes-files-plugin "Direct link to Binding Unity Catalog volumes (files plugin)")
|
|
50
|
+
|
|
51
|
+
The files plugin uses named volumes. Each volume key maps to an environment variable `DATABRICKS_VOLUME_{KEY_UPPERCASE}`:
|
|
52
|
+
|
|
53
|
+
```yaml
|
|
54
|
+
env:
|
|
55
|
+
- name: DATABRICKS_VOLUME_UPLOADS
|
|
56
|
+
valueFrom: volume
|
|
57
|
+
- name: DATABRICKS_VOLUME_EXPORTS
|
|
58
|
+
valueFrom: volume
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
See the [Files plugin](./docs/plugins/files.md) documentation for details.
|
|
63
|
+
|
|
49
64
|
For advanced configuration options (authorization, networking, resource limits), see the [Databricks Apps Configuration](https://docs.databricks.com/aws/en/dev-tools/databricks-apps/configuration) documentation.
|
|
50
65
|
|
|
51
66
|
## Environment variables[](#environment-variables "Direct link to Environment variables")
|
|
@@ -14,13 +14,10 @@ For a deeper understanding of the plugin structure, read on.
|
|
|
14
14
|
Extend the [`Plugin`](./docs/api/appkit/Class.Plugin.md) class and export with `toPlugin()`:
|
|
15
15
|
|
|
16
16
|
```typescript
|
|
17
|
-
import { Plugin, toPlugin } from "@databricks/appkit";
|
|
17
|
+
import { Plugin, toPlugin, type PluginManifest } from "@databricks/appkit";
|
|
18
18
|
import type express from "express";
|
|
19
19
|
|
|
20
20
|
class MyPlugin extends Plugin {
|
|
21
|
-
name = "myPlugin";
|
|
22
|
-
|
|
23
|
-
// Define resource requirements in the static manifest
|
|
24
21
|
static manifest = {
|
|
25
22
|
name: "myPlugin",
|
|
26
23
|
displayName: "My Plugin",
|
|
@@ -41,7 +38,7 @@ class MyPlugin extends Plugin {
|
|
|
41
38
|
],
|
|
42
39
|
optional: []
|
|
43
40
|
}
|
|
44
|
-
}
|
|
41
|
+
} satisfies PluginManifest<"myPlugin">;
|
|
45
42
|
|
|
46
43
|
async setup() {
|
|
47
44
|
// Initialize your plugin
|
|
@@ -56,17 +53,13 @@ class MyPlugin extends Plugin {
|
|
|
56
53
|
}
|
|
57
54
|
|
|
58
55
|
exports() {
|
|
59
|
-
// an object with the methods from this plugin to expose
|
|
60
56
|
return {
|
|
61
57
|
myCustomMethod: this.myCustomMethod
|
|
62
58
|
}
|
|
63
59
|
}
|
|
64
60
|
}
|
|
65
61
|
|
|
66
|
-
export const myPlugin = toPlugin
|
|
67
|
-
MyPlugin,
|
|
68
|
-
"myPlugin",
|
|
69
|
-
);
|
|
62
|
+
export const myPlugin = toPlugin(MyPlugin);
|
|
70
63
|
|
|
71
64
|
```
|
|
72
65
|
|
|
@@ -80,8 +73,6 @@ interface MyPluginConfig extends BasePluginConfig {
|
|
|
80
73
|
}
|
|
81
74
|
|
|
82
75
|
class MyPlugin extends Plugin<MyPluginConfig> {
|
|
83
|
-
name = "myPlugin";
|
|
84
|
-
|
|
85
76
|
static manifest = {
|
|
86
77
|
name: "myPlugin",
|
|
87
78
|
displayName: "My Plugin",
|
|
@@ -95,7 +86,7 @@ class MyPlugin extends Plugin<MyPluginConfig> {
|
|
|
95
86
|
{ type: "database", alias: "cache", resourceKey: "cache", description: "Query result caching (if enabled)", permission: "CAN_CONNECT_AND_CREATE", fields: { instance_name: { env: "DATABRICKS_CACHE_INSTANCE" }, database_name: { env: "DATABRICKS_CACHE_DB" } } }
|
|
96
87
|
]
|
|
97
88
|
}
|
|
98
|
-
}
|
|
89
|
+
} satisfies PluginManifest<"myPlugin">;
|
|
99
90
|
|
|
100
91
|
// Runtime: Convert optional resources to required based on config
|
|
101
92
|
static getResourceRequirements(config: MyPluginConfig) {
|