1
0
Fork 0
forked from 0x2620/oxjs

use [].concat, not Ox.merge

This commit is contained in:
rolux 2012-05-24 09:45:33 +02:00
commit 1c40fb007b
27 changed files with 87 additions and 90 deletions

View file

@ -78,7 +78,7 @@ Ox.DateInput = function(options, self) {
})
.bindEvent('autocomplete', changeMonthOrYear),
year: Ox.Input({
autocomplete: Ox.merge(Ox.range(1900, 3000), Ox.range(1000, 1900)).map(function(i) {
autocomplete: Ox.range(1900, 3000).concat(Ox.range(1000, 1900)).map(function(i) {
return i.toString();
}),
autocompleteReplace: true,
@ -92,7 +92,7 @@ Ox.DateInput = function(options, self) {
that = Ox.InputGroup(Ox.extend(self.options, {
id: self.options.id,
inputs: Ox.merge(self.options.weekday ? [
inputs: [].concat(self.options.weekday ? [
self.$input.weekday
] : [], self.options.format == 'short' ? [
self.$input.year, self.$input.month, self.$input.day
@ -100,7 +100,7 @@ Ox.DateInput = function(options, self) {
self.$input.month, self.$input.day, self.$input.year
]),
join: join,
separators: Ox.merge(self.options.weekday ? [
separators: [].concat(self.options.weekday ? [
{title: self.options.format == 'short' ? '' : ',', width: 8},
] : [], self.options.format == 'short' ? [
{title: '-', width: 8}, {title: '-', width: 8}
@ -202,13 +202,13 @@ Ox.DateInput = function(options, self) {
function split() {
var values = getValues();
return Ox.merge(self.options.weekday ? [
return [].concat(self.options.weekday ? [
values.weekday
] : [], self.options.format == 'short' ? [
values.year, values.month, values.day
] : [
values.month, values.day, values.year
])
]);
}
return that;

View file

@ -449,7 +449,7 @@ Ox.Filter = function(options, self) {
function renderButtons(pos, subpos) {
subpos = Ox.isUndefined(subpos) ? -1 : subpos;
var isGroup = subpos == -1 && self.options.query.conditions[pos].conditions;
return Ox.merge([
return [].concat([
Ox.Button({
id: 'remove',
title: self.options.query.conditions.length == 1 ? 'close' : 'remove',
@ -524,11 +524,11 @@ Ox.Filter = function(options, self) {
: self.options.query.conditions[pos].conditions[subpos];
Ox.Log('Form', 'renderCondition', condition, pos, subpos)
return Ox.FormElementGroup({
elements: Ox.merge([
elements: [
renderConditionKey(condition),
renderConditionOperator(condition),
renderConditionValue(condition)
], renderButtons(pos, subpos))
].concat(renderButtons(pos, subpos))
})
.css({marginLeft: subpos == -1 ? 0 : '24px'})
.data({position: pos, subposition: subpos});
@ -628,7 +628,7 @@ Ox.Filter = function(options, self) {
function renderGroup(condition, pos) {
var subpos = -1;
var $condition = Ox.FormElementGroup({
elements: Ox.merge([
elements: [
Ox.Label({
title: self.options.query.operator == '&'
? (pos == 0 ? 'Both' : 'and')
@ -661,7 +661,7 @@ Ox.Filter = function(options, self) {
float: 'right',
width: 208
}),
], renderButtons(pos, subpos, true)),
].concat(renderButtons(pos, subpos, true)),
float: 'left'
})
.data({position: pos});

View file

@ -328,7 +328,7 @@ Ox.Input = function(options, self) {
function autocompleteFunction() {
var values = Ox.find(self.options.autocomplete, self.options.value);
return self.options.autocompleteReplace
? values[0] : Ox.merge(values[0], values[1]);
? values[0] : values[0].concat(values[1]);
}
function autocompleteCallback(values) {

View file

@ -20,7 +20,7 @@ Ox.OptionGroup = function(items, min, max, property) {
// returns the position of the last checked item before position pos
var last = -1;
// fixme: why is length not == items.length here?
Ox.forEach(Ox.merge(
Ox.forEach([].concat(
pos > 0 ? Ox.range(pos - 1, -1, -1) : [],
pos < items.length - 1 ? Ox.range(items.length - 1, pos, -1) : []
), function(v) {

View file

@ -105,9 +105,9 @@ Ox.Spreadsheet = function(options, self) {
height: 16 * (self.rows + 2) + 'px'
});
Ox.merge([self.options.title], Ox.clone(self.options.value.rows), ['Total']).forEach(function(row, r) {
[self.options.title].concat(Ox.clone(self.options.value.rows), ['Total']).forEach(function(row, r) {
r--;
Ox.merge([''], Ox.clone(self.options.value.columns), ['Total']).forEach(function(column, c) {
[''].concat(Ox.clone(self.options.value.columns), ['Total']).forEach(function(column, c) {
c--;
if (r == -1) {
if (c == -1 || c == self.columns) {

View file

@ -91,7 +91,7 @@ Ox.TimeInput = function(options, self) {
that = Ox.InputGroup(Ox.extend(self.options, {
id: self.options.id,
inputs: Ox.merge([
inputs: [].concat([
self.$input.hours,
self.$input.minutes,
], self.options.seconds ? [
@ -102,7 +102,7 @@ Ox.TimeInput = function(options, self) {
self.$input.ampm
] : []),
join: join,
separators: Ox.merge([
separators: [].concat([
{title: ':', width: 8},
], self.options.seconds ? [
{title: ':', width: 8}
@ -156,7 +156,7 @@ Ox.TimeInput = function(options, self) {
function split(value) {
var values = getValues();
return Ox.merge([
return [].concat([
values.hours,
values.minutes,
], self.options.seconds ? [