Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit b7f776f

Browse files
authored
Upload Component (#73)
* upload component 🎉 * integration test * update circle python requirements * lint * ✨ sort imports
1 parent fbfe532 commit b7f776f

17 files changed

+687
-24
lines changed

CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## [0.14.0] - 2017-10-13
6+
### :sparkles: Added
7+
- An `Upload` component! :tada:
8+
59
## [0.13.0] - 2017-10-05
610
### Added
711
- Bumped [plotly.js](https://github.com/plotly/plotly.js) from `v1.29.3` to `v1.30.0`.
@@ -53,7 +57,6 @@ The following improvements from this version update apply to dash:
5357
- Non-ascii characters, like chinese characters, are now supported as
5458
search strings in the `dcc.Dropdown` component (https://github.com/plotly/dash-core-components/pull/75)
5559

56-
5760
## [0.12.5] - 2017-09-11
5861
### :bug: Fixed
5962
- The `Interval` component was constantly resetting its interval on every update. Initially reported in https://community.plot.ly/t/multiple-interval-object-in-a-single-page/5699/3

dash_core_components/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
{
2222
"relative_package_path": "bundle.js",
2323
"external_url": (
24-
"https://unpkg.com/dash-core-components@{}"
24+
"https://unpkg.com/dash-core-components@0.13.0-rc3"
2525
"/dash_core_components/bundle.js"
26-
).format(__version__),
26+
),
2727
"namespace": "dash_core_components"
2828
}
2929
]

dash_core_components/metadata.json

+236
Original file line numberDiff line numberDiff line change
@@ -2567,5 +2567,241 @@
25672567
"description": ""
25682568
}
25692569
}
2570+
},
2571+
"src/components/Upload.react.js": {
2572+
"description": "",
2573+
"methods": [
2574+
{
2575+
"name": "onDrop",
2576+
"docblock": null,
2577+
"modifiers": [],
2578+
"params": [
2579+
{
2580+
"name": "files",
2581+
"type": null
2582+
}
2583+
],
2584+
"returns": null
2585+
}
2586+
],
2587+
"props": {
2588+
"id": {
2589+
"type": {
2590+
"name": "string"
2591+
},
2592+
"required": false,
2593+
"description": "ID of the component. Used to identify component\nin Dash callback functions."
2594+
},
2595+
"contents": {
2596+
"type": {
2597+
"name": "union",
2598+
"value": [
2599+
{
2600+
"name": "string"
2601+
},
2602+
{
2603+
"name": "arrayOf",
2604+
"value": {
2605+
"name": "string"
2606+
}
2607+
}
2608+
]
2609+
},
2610+
"required": false,
2611+
"description": "The contents of the uploaded file as a binary string"
2612+
},
2613+
"filename": {
2614+
"type": {
2615+
"name": "union",
2616+
"value": [
2617+
{
2618+
"name": "string"
2619+
},
2620+
{
2621+
"name": "arrayOf",
2622+
"value": {
2623+
"name": "string"
2624+
}
2625+
}
2626+
]
2627+
},
2628+
"required": false,
2629+
"description": "The name of the file(s) that was(were) uploaded.\nNote that this does not include the path of the file\n(for security reasons)."
2630+
},
2631+
"last_modified": {
2632+
"type": {
2633+
"name": "union",
2634+
"value": [
2635+
{
2636+
"name": "number"
2637+
},
2638+
{
2639+
"name": "arrayOf",
2640+
"value": {
2641+
"name": "number"
2642+
}
2643+
}
2644+
]
2645+
},
2646+
"required": false,
2647+
"description": "The last modified date of the file that was uploaded in unix time\n(seconds since 1970)."
2648+
},
2649+
"children": {
2650+
"type": {
2651+
"name": "union",
2652+
"value": [
2653+
{
2654+
"name": "node"
2655+
},
2656+
{
2657+
"name": "string"
2658+
}
2659+
]
2660+
},
2661+
"required": false,
2662+
"description": "Contents of the upload component"
2663+
},
2664+
"accept": {
2665+
"type": {
2666+
"name": "string"
2667+
},
2668+
"required": false,
2669+
"description": "Allow specific types of files.\nSee https://github.com/okonet/attr-accept for more information.\nKeep in mind that mime type determination is not reliable across\nplatforms. CSV files, for example, are reported as text/plain\nunder macOS but as application/vnd.ms-excel under Windows.\nIn some cases there might not be a mime type set at all.\nSee: https://github.com/react-dropzone/react-dropzone/issues/276"
2670+
},
2671+
"disabled": {
2672+
"type": {
2673+
"name": "bool"
2674+
},
2675+
"required": false,
2676+
"description": "Enable/disable the upload component entirely",
2677+
"defaultValue": {
2678+
"value": "false",
2679+
"computed": false
2680+
}
2681+
},
2682+
"disable_click": {
2683+
"type": {
2684+
"name": "bool"
2685+
},
2686+
"required": false,
2687+
"description": "Disallow clicking on the component to open the file dialog",
2688+
"defaultValue": {
2689+
"value": "false",
2690+
"computed": false
2691+
}
2692+
},
2693+
"max_size": {
2694+
"type": {
2695+
"name": "number"
2696+
},
2697+
"required": false,
2698+
"description": "Maximum file size. If `-1`, then infinite",
2699+
"defaultValue": {
2700+
"value": "-1",
2701+
"computed": false
2702+
}
2703+
},
2704+
"min_size": {
2705+
"type": {
2706+
"name": "number"
2707+
},
2708+
"required": false,
2709+
"description": "Minimum file size",
2710+
"defaultValue": {
2711+
"value": "0",
2712+
"computed": false
2713+
}
2714+
},
2715+
"multiple": {
2716+
"type": {
2717+
"name": "bool"
2718+
},
2719+
"required": false,
2720+
"description": "Allow dropping multiple files",
2721+
"defaultValue": {
2722+
"value": "false",
2723+
"computed": false
2724+
}
2725+
},
2726+
"className": {
2727+
"type": {
2728+
"name": "string"
2729+
},
2730+
"required": false,
2731+
"description": "HTML class name of the component"
2732+
},
2733+
"className_active": {
2734+
"type": {
2735+
"name": "string"
2736+
},
2737+
"required": false,
2738+
"description": "HTML class name of the component while active"
2739+
},
2740+
"className_reject": {
2741+
"type": {
2742+
"name": "string"
2743+
},
2744+
"required": false,
2745+
"description": "HTML class name of the component if rejected"
2746+
},
2747+
"className_disabled": {
2748+
"type": {
2749+
"name": "string"
2750+
},
2751+
"required": false,
2752+
"description": "HTML class name of the component if disabled"
2753+
},
2754+
"style": {
2755+
"type": {
2756+
"name": "object"
2757+
},
2758+
"required": false,
2759+
"description": "CSS styles to apply",
2760+
"defaultValue": {
2761+
"value": "{}",
2762+
"computed": false
2763+
}
2764+
},
2765+
"style_active": {
2766+
"type": {
2767+
"name": "object"
2768+
},
2769+
"required": false,
2770+
"description": "CSS styles to apply while active",
2771+
"defaultValue": {
2772+
"value": "{\n borderStyle: 'solid',\n borderColor: '#6c6',\n backgroundColor: '#eee'\n}",
2773+
"computed": false
2774+
}
2775+
},
2776+
"style_reject": {
2777+
"type": {
2778+
"name": "object"
2779+
},
2780+
"required": false,
2781+
"description": "CSS styles if rejected",
2782+
"defaultValue": {
2783+
"value": "{\n borderStyle: 'solid',\n borderColor: '#c66',\n backgroundColor: '#eee'\n}",
2784+
"computed": false
2785+
}
2786+
},
2787+
"style_disabled": {
2788+
"type": {
2789+
"name": "object"
2790+
},
2791+
"required": false,
2792+
"description": "CSS styles if disabled",
2793+
"defaultValue": {
2794+
"value": "{\n opacity: 0.5\n}",
2795+
"computed": false
2796+
}
2797+
},
2798+
"setProps": {
2799+
"type": {
2800+
"name": "func"
2801+
},
2802+
"required": false,
2803+
"description": "Dash-supplied function for updating props"
2804+
}
2805+
}
25702806
}
25712807
}

dash_core_components/version.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
__version__ = '0.13.0'
1+
__version__ = '0.14.0'
2+

demo/Demo.react.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,16 @@ import {
1111
Slider,
1212
SyntaxHighlighter,
1313
Interval,
14-
Markdown
14+
Markdown,
15+
Upload
1516
} from '../src';
1617

18+
19+
const UploadExample = `
20+
const properties = {};
21+
22+
ReactDOM.render(<Upload {...properties}/>, mountNode);`
23+
1724
const MarkdownExample = `
1825
1926
const markdown = \`
@@ -294,6 +301,7 @@ ReactDOM.render(<Controller/>, mountNode);`
294301

295302

296303
const examples = [
304+
{name: 'Upload', code: UploadExample},
297305
{name: 'Markdown', code: MarkdownExample},
298306
{name: 'Interval', code: SetTimeoutExample},
299307
{name: 'Graph', code: GraphExample},
@@ -318,7 +326,7 @@ class Demo extends Component {
318326
<h3>{example.name}</h3>
319327
<Playground
320328
codeText={example.code}
321-
scope={{Component, React, ReactDOM, Checklist, Dropdown, Graph, Input, RadioItems, RangeSlider, Slider, SyntaxHighlighter, Interval, Markdown}}
329+
scope={{Component, React, ReactDOM, Checklist, Dropdown, Graph, Input, RadioItems, RangeSlider, Slider, SyntaxHighlighter, Interval, Markdown, Upload}}
322330
noRender={false}
323331
theme={'xq-light'}
324332
/>

dev-requirements.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
dash_html_components
22
dash_renderer
33
dash
4-
git+git://github.com/chriddyp/python-percy-client.git@print-request
4+
percy
55
selenium
66
mock
77
tox
@@ -10,3 +10,6 @@ six
1010
plotly>=2.0.8
1111
requests[security]
1212
ipdb
13+
dash-table-experiments
14+
xlrd
15+
pandas

images/upload-component.gif

2.77 MB
Loading

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dash-core-components",
3-
"version": "0.13.0",
3+
"version": "0.14.0",
44
"description": "Core component suite for Dash",
55
"repository": {
66
"type": "git",
@@ -34,6 +34,7 @@
3434
"react-addons-shallow-compare": "^15.6.0",
3535
"react-dates": "^12.3.0",
3636
"react-dom": "^15.4.0",
37+
"react-dropzone": "^4.1.2",
3738
"react-markdown": "^2.4.5",
3839
"react-select": "^1.0.0-rc.10",
3940
"react-select-fast-filter-options": "^0.2.2",

0 commit comments

Comments
 (0)