feat: option widget

This commit is contained in:
1ambda 2017-03-16 19:26:38 +09:00
parent 5d3efc932f
commit 11b7eaac94
3 changed files with 27 additions and 9 deletions

View file

@ -45,7 +45,7 @@ limitations under the License.
<label class="radio-inline">
<input type="radio" style="margin-top: 1px; margin-left: -17px;"
ng-checked="config.chart.current === chart"
ng-click="chartChanged(chart)" value="{{chart}}">
ng-click="chartChanged(chart)" value="{{chart}}" />
<span style="vertical-align: middle;">{{chart}}</span>
</label>
</li>
@ -227,12 +227,31 @@ limitations under the License.
<td style="font-weight: 400; vertical-align: middle;">{{paramSpec.valueType}}</td>
<td style="font-weight: 400; vertical-align: middle;">{{paramSpec.description}}</td>
<td>
<div class="input-group">
<input type="text" class="form-control"
<div ng-if="!paramSpec.widget || paramSpec.widget === 'input'"
class="input-group">
<input type="text" class="form-control input-sm"
style="font-weight: 400; font-size: 12px; vertical-align:middle; border-radius: 5px;"
ng-keypress="keyEventOnDynamicParameter($event)"
data-ng-model="config.parameter[config.chart.current][paramSpec.name]" />
</div>
<div class="btn-group"
ng-if="paramSpec.widget === 'option'">
<select class="form-control input-sm"
data-ng-model="config.parameter[config.chart.current][paramSpec.name]"
data-ng-options="optionValue for optionValue in paramSpec.optionValues"
style="font-weight: 400; font-size: 12px;">
</select>
</div>
<div ng-if="paramSpec.widget === 'checkbox'">
<input type="checkbox" value="option1" />
</div>
<div ng-if="paramSpec.widget === 'textarea'">
<textarea class="form-control" rows="3"
style="font-weight: 400; font-size: 12px;"></textarea>
</div>
</td>
</tr>
</table>

View file

@ -12,8 +12,6 @@
* limitations under the License.
*/
const lo = _; /** provided by bower */
import {
getCurrentChartAxis,
getCurrentChartTransform,
@ -67,7 +65,7 @@ export function getAvailableChartNames(charts) {
}
export function applyMaxAxisCount(config, axisSpec) {
if (isSingleDimension(axisSpec) || typeof axisSpec.maxAxisCount === "undefined") {
if (isSingleDimension(axisSpec) || typeof axisSpec.maxAxisCount === 'undefined') {
return;
}
@ -366,7 +364,7 @@ export function getFlattenCube(cube, schema) {
const keyColumnName = schema.keyColumns.map(c => c.name).join('.')
if (!schema.key) {
keys = [ "root", ]
keys = [ 'root', ]
cube = { root: cube, }
}

View file

@ -63,7 +63,7 @@ class AdvancedTransformation extends Transformation {
getAxisTypeAnnotation: (axisSpec) => {
let anno = `${axisSpec.axisType}`
if (typeof axisSpec.maxAxisCount !== "undefined") {
if (typeof axisSpec.maxAxisCount !== 'undefined') {
anno = `${anno} (${axisSpec.maxAxisCount})`
}
@ -113,11 +113,12 @@ class AdvancedTransformation extends Transformation {
},
parameterChanged: (paramSpec) => {
console.log(configInstance.parameter[configInstance.chart.current])
self.emitConfig(configInstance)
},
keyEventOnDynamicParameter: (event) => {
if (event.which == 13 || event.keyCode == 13) {
if (event.which === 13 || event.keyCode === 13) {
/** enter */
configInstance.panel.parameterPanelOpened = !configInstance.panel.parameterPanelOpened
self.emitConfig(configInstance)