更新 widgets-types.js
This commit is contained in:
parent
4e46d89b97
commit
d587ca08cf
@ -82,6 +82,48 @@ module.exports = [
|
||||
};
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'formula_mini',
|
||||
createOptionModels: function (tuplesItems) {
|
||||
return _.reduce(tuplesItems, function (memo, tuples) {
|
||||
var columnModel = tuples[0].columnModel;
|
||||
var columnName = columnModel.get('name');
|
||||
var operation = 'avg';
|
||||
var title = columnName;
|
||||
|
||||
if (columnModel.get('type') === 'number') {
|
||||
if (columnName === CARTODB_ID) {
|
||||
operation = 'count';
|
||||
title = _t('editor.data.stats.feature-count');
|
||||
}
|
||||
|
||||
var m = new FormulaOptionModel({
|
||||
tuples: tuples,
|
||||
title: title,
|
||||
operation: operation,
|
||||
name: columnModel.get('name')
|
||||
});
|
||||
memo.push(m);
|
||||
}
|
||||
return memo;
|
||||
}, []);
|
||||
},
|
||||
createTabPaneItem: function (optionsCollection) {
|
||||
return {
|
||||
label: _t('components.modals.add-widgets.tab-pane.formula_mini-label'),
|
||||
name: 'formula_mini',
|
||||
createContentView: function () {
|
||||
return new ScrollView({
|
||||
createContentView: function () {
|
||||
return new FormulaOptionsView({
|
||||
collection: optionsCollection
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'formula',
|
||||
createOptionModels: function (tuplesItems) {
|
||||
|
Loading…
Reference in New Issue
Block a user