some fixes for filters and form elements

This commit is contained in:
rlx 2011-09-08 08:16:31 +00:00
commit 3f3edac8c7
9 changed files with 113 additions and 79 deletions

View file

@ -9,7 +9,7 @@ Ox.TimeInput <f:Ox.Element> TimeInput Object
ampm <b|false> 24h/ampm
seconds <b|false> show seconds
milliseconds <b|false> show milliseconds
value <d> value, defaults to now
value <d> value, defaults to current time
self <o> shared private variable
@*/
@ -23,7 +23,7 @@ Ox.TimeInput = function(options, self) {
seconds: false,
milliseconds: false,
value: Ox.formatDate(new Date(), '%T'),
/*
///*
width: {
hours: 32,
minutes: 32,
@ -31,7 +31,7 @@ Ox.TimeInput = function(options, self) {
milliseconds: 40,
ampm: 32
}
*/
//*/
})
.options(options || {});
@ -47,48 +47,48 @@ Ox.TimeInput = function(options, self) {
self.$input = {
hours: Ox.Input({
autocomplete: $.map(self.options.ampm ? Ox.range(1, 13) : Ox.range(0, 24), function(v) {
return Ox.pad(v, 2);
autocomplete: (self.options.ampm ? Ox.range(1, 13) : Ox.range(0, 24)).map(function(i) {
return Ox.pad(i, 2);
}),
autocompleteReplace: true,
autocompleteReplaceCorrect: true,
id: 'hours',
textAlign: 'right',
value: self.values.hours,
width: 32//self.options.width.hours
width: self.options.width.hours
}),
minutes: Ox.Input({
autocomplete: $.map(Ox.range(0, 60), function(v) {
return Ox.pad(v, 2);
autocomplete: Ox.range(0, 60).map(function(i) {
return Ox.pad(i, 2);
}),
autocompleteReplace: true,
autocompleteReplaceCorrect: true,
id: 'minutes',
textAlign: 'right',
value: self.values.minutes,
width: 32//self.options.width.minutes
width: self.options.width.minutes
}),
seconds: Ox.Input({
autocomplete: $.map(Ox.range(0, 60), function(v) {
return Ox.pad(v, 2);
autocomplete: Ox.range(0, 60).map(function(i) {
return Ox.pad(i, 2);
}),
autocompleteReplace: true,
autocompleteReplaceCorrect: true,
id: 'seconds',
textAlign: 'right',
value: self.values.seconds,
width: 32//self.options.width.seconds
width: self.options.width.seconds
}),
milliseconds: Ox.Input({
autocomplete: $.map(Ox.range(0, 1000), function(v) {
return Ox.pad(v, 3);
autocomplete: Ox.range(0, 1000).map(function(i) {
return Ox.pad(i, 3);
}),
autocompleteReplace: true,
autocompleteReplaceCorrect: true,
id: 'milliseconds',
textAlign: 'right',
value: self.values.milliseconds,
width: 40//self.options.width.milliseconds
width: self.options.width.milliseconds
}),
ampm: Ox.Input({
autocomplete: ['AM', 'PM'],
@ -96,30 +96,31 @@ Ox.TimeInput = function(options, self) {
autocompleteReplaceCorrect: true,
id: 'ampm',
value: self.values.ampm,
width: 32//self.options.width.seconds
width: self.options.width.ampm
})
};
that = Ox.InputGroup($.extend(self.options, {
inputs: $.merge($.merge($.merge([
that = Ox.InputGroup(Ox.extend(self.options, {
inputs: Ox.merge([
self.$input.hours,
self.$input.minutes,
], self.options.seconds ? [
self.$input.seconds
] : []), self.options.milliseconds ? [
] : [], self.options.milliseconds ? [
self.$input.milliseconds
] : []), self.options.ampm ? [
] : [], self.options.ampm ? [
self.$input.ampm
] : []),
separators: $.merge($.merge($.merge([
separators: Ox.merge([
{title: ':', width: 8},
], self.options.seconds ? [
{title: ':', width: 8}
] : []), self.options.milliseconds ? [
] : [], self.options.milliseconds ? [
{title: '.', width: 8}
] : []), self.options.ampm ? [
] : [], self.options.ampm ? [
{title: '', width: 8}
] : []),
width: 0
//width: self.options.width || 128
}), self)
.bindEvent('change', setValue);