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

feat(file-upload): change API from tables to lists #1085

Merged
merged 5 commits into from
Jan 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 38 additions & 26 deletions src/platform/core/file/file-upload/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,34 @@ export class Demo {

## API Summary

Properties:

| Name | Type | Description |
| --- | --- | 650--- |
| `defaultColor` | `string` | Sets browse button color. Uses same color palette accepted as [MatButton] and defaults to 'primary'.
| `activeColor` | `string` | Sets upload button color. Uses same color palette accepted as [MatButton] and defaults to 'accent'.
| `cancelColor` | `string` | Sets cancel button color. Uses same color palette accepted as [MatButton] and defaults to 'warn'.
| `multiple` | `boolean` | Sets if multiple files can be dropped/selected at once in [TdFileUploadComponent].
| `accept` | `string` | Sets files accepted when opening the file browser dialog. Same as "accept" attribute in `<input/>` element.
| `disabled` | `boolean` | Disables [TdFileUploadComponent] and clears selected/dropped files.
| `upload` | `function($event)` | Event emitted when upload button is clicked. Emits a [File or FileList] object.
| `select` | `function($event)` | Event emitted when a file is selected. Emits a [File or FileList] object.
| `cancel` | `function()` | Event emitted when cancel button is clicked.
#### Inputs

+ defaultColor: string
+ Sets browse button color. Uses same color palette accepted as [MatButton] and defaults to 'primary'.
+ activeColor: string
+ Sets upload button color. Uses same color palette accepted as [MatButton] and defaults to 'accent'.
+ cancelColor: string
+ Sets cancel button color. Uses same color palette accepted as [MatButton] and defaults to 'warn'.
+ multiple: boolean
+ Sets if multiple files can be dropped/selected at once in [TdFileUploadComponent].
+ accept: string
+ Sets files accepted when opening the file browser dialog. Same as "accept" attribute in `<input/>` element.
+ disabled: boolean
+ Disables [TdFileUploadComponent] and clears selected/dropped files.

#### Events

+ upload: function($event)
+ Event emitted when upload button is clicked. Emits a [File or FileList] object.
+ select: function($event)
+ Event emitted when a file is selected. Emits a [File or FileList] object.
+ cancel: function
+ Event emitted when cancel button is clicked.

#### Methods

+ cancel: function
+ Method used to clear the files selected.

## Setup

Expand All @@ -81,10 +96,18 @@ export class MyModule {}

## tdFileService

## Usage

Service provided with methods that wrap complexity for as easier file upload experience.

## API Summary

#### Methods

+ upload: function(IUploadState)
+ Uses underlying [XMLHttpRequest] to upload a file to a url.
+ Will be depricated when angular fixes [Http] to allow [FormData] as body.

## Usage

Recieves as parameter an object that implements the [IUploadOptions] interface. You have to assign a value either to `[file]` or to `[formData]`. If `[file]` is assigned then `[formData]` will be ignored; when only `[formData]` is assigned then it will be sent as form data.

```typescript
Expand Down Expand Up @@ -124,14 +147,3 @@ export class Demo {

}
```

## API Summary

Methods:

| Name | Type | Description |
| --- | --- | 650--- |
| upload | function(IUploadState) | Uses underlying [XMLHttpRequest] to upload a file to a url. Will be depricated when angular fixes [Http] to allow [FormData] as body.


---