forked from 0x2620/oxjs
updates to url and filter
This commit is contained in:
parent
07c79ed7ac
commit
d2a2ddb66e
4 changed files with 73 additions and 19 deletions
|
|
@ -64,7 +64,7 @@ Ox.Filter = function(options, self) {
|
|||
{id: '=,', title: 'is between'},
|
||||
{id: '!=,', title: 'is not between'}
|
||||
],
|
||||
list: [
|
||||
enum: [
|
||||
{id: '=', title: 'is'},
|
||||
{id: '!=', title: 'is not'},
|
||||
{id: '<', title: 'is less than'},
|
||||
|
|
@ -74,6 +74,10 @@ Ox.Filter = function(options, self) {
|
|||
{id: '=,', title: 'is between'},
|
||||
{id: '!=,', title: 'is not between'}
|
||||
],
|
||||
list: [
|
||||
{id: '=', title: 'is'},
|
||||
{id: '!=', title: 'is not'}
|
||||
],
|
||||
number: [
|
||||
{id: '=', title: 'is'},
|
||||
{id: '!=', title: 'is not'},
|
||||
|
|
@ -97,11 +101,22 @@ Ox.Filter = function(options, self) {
|
|||
text: [
|
||||
{id: '=', title: 'contains'},
|
||||
{id: '!=', title: 'does not contain'}
|
||||
],
|
||||
year: [
|
||||
{id: '==', title: 'is'},
|
||||
{id: '!==', title: 'is not'},
|
||||
{id: '<', title: 'is before'},
|
||||
{id: '!<', title: 'is not before'},
|
||||
{id: '>', title: 'is after'},
|
||||
{id: '!>', title: 'is not after'},
|
||||
{id: '=,', title: 'is between'},
|
||||
{id: '!=,', title: 'is not between'}
|
||||
]
|
||||
};
|
||||
self.defaultValue = {
|
||||
boolean: 'true',
|
||||
date: Ox.formatDate(new Date(), '%F'),
|
||||
enum: 0,
|
||||
float: 0,
|
||||
hue: 0,
|
||||
integer: 0,
|
||||
|
|
@ -109,7 +124,7 @@ Ox.Filter = function(options, self) {
|
|||
string: '',
|
||||
text: '',
|
||||
time: '00:00:00',
|
||||
year: new Date().getFullYear()
|
||||
year: new Date().getFullYear().toString()
|
||||
};
|
||||
self.operators = [
|
||||
{id: '&', title: 'all'},
|
||||
|
|
@ -389,7 +404,7 @@ Ox.Filter = function(options, self) {
|
|||
|
||||
function getConditionType(type) {
|
||||
type = Ox.isArray(type) ? type[0] : type;
|
||||
if (['float', 'hue', 'integer', 'time', 'year'].indexOf(type) > -1) {
|
||||
if (['float', 'hue', 'integer', 'time'].indexOf(type) > -1) {
|
||||
type = 'number';
|
||||
}
|
||||
return type;
|
||||
|
|
@ -668,14 +683,22 @@ Ox.Filter = function(options, self) {
|
|||
],
|
||||
width: 288
|
||||
});
|
||||
} else if (type == 'list') {
|
||||
} else if (type == 'enum') {
|
||||
Ox.Log('FILTER', findKey, condition)
|
||||
$input = Ox.Select({
|
||||
items: findKey.list.map(function(v, i) {
|
||||
items: findKey.values.map(function(v, i) {
|
||||
return {id: i, title: v, checked: i == value}
|
||||
}),
|
||||
width: !isArray ? 288 : 128
|
||||
});
|
||||
} else if (type == 'list') {
|
||||
Ox.Log('FILTER', findKey)
|
||||
$input = Ox.Input({
|
||||
autocomplete: findKey.values,
|
||||
autocompleteSelect: true,
|
||||
value: value,
|
||||
width: 288
|
||||
});
|
||||
} else if (findKey.format) {
|
||||
formatArgs = findKey.format.args
|
||||
formatType = findKey.format.type;
|
||||
|
|
@ -694,7 +717,8 @@ Ox.Filter = function(options, self) {
|
|||
'rgb(0, 255, 0)', 'rgb(0, 255, 255)',
|
||||
'rgb(0, 0, 255)', 'rgb(255, 0, 255)',
|
||||
'rgb(255, 0, 0)'
|
||||
] : ['rgb(0, 0, 0)', 'rgb(255, 255, 255)']
|
||||
] : ['rgb(0, 0, 0)', 'rgb(255, 255, 255)'],
|
||||
value: value
|
||||
});
|
||||
} else if (formatType == 'date') {
|
||||
$input = Ox.DateInput(!isArray ? {
|
||||
|
|
@ -714,6 +738,23 @@ Ox.Filter = function(options, self) {
|
|||
value: value,
|
||||
width: {hours: 38, minutes: 37, seconds: 37}
|
||||
});
|
||||
} else if (formatType == 'resolution') {
|
||||
$input = Ox.InputGroup({
|
||||
inputs: [
|
||||
Ox.Input({
|
||||
id: 'width',
|
||||
type: 'int',
|
||||
value: value
|
||||
}),
|
||||
Ox.Input({
|
||||
id: 'height',
|
||||
type: 'int',
|
||||
value: value
|
||||
})
|
||||
],
|
||||
separators: [{title: 'x', width: 16}],
|
||||
width: !isArray ? 288 : 128
|
||||
})
|
||||
} else if ([
|
||||
'currency', 'percent', 'unit', 'value'
|
||||
].indexOf(formatType) > -1) {
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ Ox.Range = function(options, self) {
|
|||
self = self || {};
|
||||
var that = Ox.Element({}, self)
|
||||
.defaults({
|
||||
// fixme: needs a changeOnDrag option (default true)
|
||||
arrows: false,
|
||||
arrowStep: 1,
|
||||
arrowSymbols: ['left', 'right'],
|
||||
|
|
@ -240,7 +241,9 @@ Ox.Range = function(options, self) {
|
|||
}
|
||||
|
||||
function setValue(value, animate) {
|
||||
value = Ox.limit(value, self.options.min, self.options.max);
|
||||
// fixme: toPrecision helps with imprecise results of divisions,
|
||||
// but won't work for very large values. And is 10 a good value?
|
||||
value = Ox.limit(value.toPrecision(10), self.options.min, self.options.max);
|
||||
if (value != self.options.value) {
|
||||
//time = getTime(self.options.value, value);
|
||||
self.options.value = value;
|
||||
|
|
@ -259,6 +262,15 @@ Ox.Range = function(options, self) {
|
|||
}
|
||||
}
|
||||
|
||||
that.value = function() {
|
||||
if (arguments.length == 0) {
|
||||
return self.options.value;
|
||||
} else {
|
||||
self.options.type = arguments[0];
|
||||
setThumb();
|
||||
}
|
||||
};
|
||||
|
||||
return that;
|
||||
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue