-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #1678 Adds a button in the legend for import of layer as file. Future improvement can be to put this along with the layer manager plugin in a context menu. Defaults to false. { "name": "draganddrop", "options": { "showLegendButton": true } },
- Loading branch information
Showing
3 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import Component from './component'; | ||
|
||
export default function Input(options = {}) { | ||
const { | ||
labelCls = '', | ||
inputCls = '', | ||
label = '', | ||
change | ||
} = options; | ||
|
||
return Component({ | ||
onInit() { | ||
if (change) { | ||
this.on('change', change.bind(this)); | ||
this.on('clear', () => { | ||
this.un('change', change.bind(this)); | ||
}); | ||
} | ||
}, | ||
onRender() { | ||
const el = document.getElementById(this.getId()); | ||
el.addEventListener('change', this.onChange.bind(this)); | ||
}, | ||
onChange(evt) { | ||
this.dispatch('change', evt); | ||
}, | ||
render() { | ||
return ` | ||
<label for="${this.getId()}" class="${labelCls}">${label}</label><input id="${this.getId()}" type="file" class="${inputCls}"> | ||
`; | ||
} | ||
}); | ||
} |