Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@uppy/dashboard: add dashboard:show-panel event #4108

Merged
merged 4 commits into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/@uppy/dashboard/src/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ export default class Dashboard extends UIPlugin {
activePickerPanel,
activeOverlayType: 'PickerPanel',
})

this.uppy.emit('dashboard:show-panel', id)
}

canEditFile = (file) => {
Expand Down
4 changes: 3 additions & 1 deletion packages/@uppy/dashboard/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,13 @@ export default Dashboard

export type DashboardFileEditStartCallback<TMeta extends IndexedObject<any>> = (file?: UppyFile<TMeta>) => void;
export type DashboardFileEditCompleteCallback<TMeta extends IndexedObject<any>> = (file?: UppyFile<TMeta>) => void;
export type DashboardShowPlanelCallback = (id: UIPlugin<DashboardOptions>['id']) => void;
jsanchez034 marked this conversation as resolved.
Show resolved Hide resolved
declare module '@uppy/core' {
export interface UppyEventMap<TMeta> {
'dashboard:modal-open': GenericEventCallback
'dashboard:modal-closed': GenericEventCallback
'dashboard:file-edit-state': DashboardFileEditStartCallback<TMeta>
'dashboard:show-panel': DashboardShowPlanelCallback
'dashboard:file-edit-start': DashboardFileEditStartCallback<TMeta>
'dashboard:file-edit-complete': DashboardFileEditCompleteCallback<TMeta>
}
}
6 changes: 5 additions & 1 deletion packages/@uppy/dashboard/types/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ import Dashboard from '..'
onDragLeave: (event) => event.clientX,
})

uppy.on('dashboard:file-edit-state', (file) => {
uppy.on('dashboard:file-edit-start', (file) => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const fileName = file?.name
})
uppy.on('dashboard:show-panel', (id) => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const pluginId = id
})
}

{
Expand Down
25 changes: 14 additions & 11 deletions website/src/_posts/2021-08-2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,19 @@ With that in mind, we felt it was high time to give Uppy some more much-needed t

## Table of Contents

- [Highlights since 1.0](#Highlights-since-1-0)
- [Smaller bundles](#Smaller-bundles)
- [Faster](#Faster)
- [Preact X and upgraded dependencies](#Preact-X-and-upgraded-dependencies)
- [`Plugin` is replaced with `BasePlugin` and `UIPlugin`](#Plugin-is-replaced-with-BasePlugin-and-UIPlugin)
- [Strict TypeScript types by default](#Strict-TypeScript-types-by-default)
- [Batch pre-signing URL's for AWS S3 Multipart](#Batch-pre-signing-URLs-for-AWS-S3-Multipart)
- [And more](#And-more)
- [What future remains for 1.0?](#What-future-remains-for-1-0?)
- [That's it](#That’s-it)
- [A pup no more](#a-pup-no-more)
jsanchez034 marked this conversation as resolved.
Show resolved Hide resolved
- [Table of Contents](#table-of-contents)
- [Highlights since 1.0](#highlights-since-10)
- [Smaller bundles](#smaller-bundles)
- [Faster](#faster)
- [Preact X and upgraded dependencies](#preact-x-and-upgraded-dependencies)
- [`Plugin` is replaced with `BasePlugin` and `UIPlugin`](#plugin-is-replaced-with-baseplugin-and-uiplugin)
- [Strict TypeScript types by default](#strict-typescript-types-by-default)
- [Event types](#event-types)
- [Batch pre-signing URLs for AWS S3 Multipart](#batch-pre-signing-urls-for-aws-s3-multipart)
- [And more](#and-more)
- [What future remains for 1.0?](#what-future-remains-for-10)
- [That's it!](#thats-it)

<video alt="Video demo showing updated Uppy 2.0 UI" muted autoplay loop>
<source src="/images/uppy-2-0-demo-aug-2021.mp4" type="video/mp4">
Expand Down Expand Up @@ -212,7 +215,7 @@ Plugins that add their own events can merge with existing ones in `@uppy/core` w

<!-- eslint-disable @typescript-eslint/no-unused-vars -->
```ts
uppy.on('dashboard:file-edit-state', (file) => {
uppy.on('dashboard:file-edit-start', (file) => {
const fileName = file.name
})
```
Expand Down
8 changes: 8 additions & 0 deletions website/src/docs/dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,14 @@ uppy.on('dashboard:modal-open', () => {

Fired when the Dashboard modal is closed.

### `dashboard:show-panel`

**Parameters:**

* `id` — The unique identifier of the plugin that is being shown

Fired when a user clicks on a specific source plugin in the Dashboard
jsanchez034 marked this conversation as resolved.
Show resolved Hide resolved

### `dashboard:file-edit-start`

**Parameters:**
Expand Down
2 changes: 1 addition & 1 deletion website/src/docs/migration-guides.md
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ Plugins that add their own events can merge with existing ones in `@uppy/core` w
<!-- eslint-disable @typescript-eslint/no-unused-vars -->

```ts
uppy.on('dashboard:file-edit-state', (file) => {
uppy.on('dashboard:file-edit-start', (file) => {
const fileName = file.name
})
```
Expand Down