Skip to content

Commit

Permalink
Fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
nosir committed Dec 16, 2018
1 parent 861c80c commit 707ed1e
Show file tree
Hide file tree
Showing 10 changed files with 143 additions and 45 deletions.
46 changes: 36 additions & 10 deletions dist/cleave-angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ return /******/ (function(modules) { // webpackBootstrap
return;
}

pps.timeFormatter = new Cleave.TimeFormatter(pps.timePattern);
pps.timeFormatter = new Cleave.TimeFormatter(pps.timePattern, pps.timeFormat);
pps.blocks = pps.timeFormatter.getBlocks();
pps.blocksLength = pps.blocks.length;
pps.maxLength = Cleave.Util.getMaxLength(pps.blocks);
Expand Down Expand Up @@ -192,8 +192,11 @@ return /******/ (function(modules) { // webpackBootstrap
Util = Cleave.Util,
currentValue = owner.element.value;

if (charCode === 229
&& Util.isAndroidBackspaceKeydown(owner.lastInputValue, currentValue)
// if we got any charCode === 8, this means, that this device correctly
// sends backspace keys in event, so we do not need to apply any hacks
owner.hasBackspaceSupport = owner.hasBackspaceSupport || charCode === 8;
if (!owner.hasBackspaceSupport
&& Util.isAndroidBackspaceKeydown(owner.lastInputValue, currentValue)
) {
charCode = 8;
}
Expand Down Expand Up @@ -837,12 +840,13 @@ return /******/ (function(modules) { // webpackBootstrap

'use strict';

var TimeFormatter = function (timePattern) {
var TimeFormatter = function (timePattern, timeFormat) {
var owner = this;

owner.time = [];
owner.blocks = [];
owner.timePattern = timePattern;
owner.timeFormat = timeFormat;
owner.initBlocks();
};

Expand All @@ -867,11 +871,32 @@ return /******/ (function(modules) { // webpackBootstrap
return this.blocks;
},

getTimeFormatOptions: function () {
var owner = this;
if (String(owner.timeFormat) === '12') {
return {
maxHourFirstDigit: 1,
maxHours: 12,
maxMinutesFirstDigit: 5,
maxMinutes: 60
};
}

return {
maxHourFirstDigit: 2,
maxHours: 23,
maxMinutesFirstDigit: 5,
maxMinutes: 60
};
},

getValidatedTime: function (value) {
var owner = this, result = '';

value = value.replace(/[^\d]/g, '');

var timeFormatOptions = owner.getTimeFormatOptions();

owner.blocks.forEach(function (length, index) {
if (value.length > 0) {
var sub = value.slice(0, length),
Expand All @@ -881,20 +906,20 @@ return /******/ (function(modules) { // webpackBootstrap
switch (owner.timePattern[index]) {

case 'h':
if (parseInt(sub0, 10) > 2) {
if (parseInt(sub0, 10) > timeFormatOptions.maxHourFirstDigit) {
sub = '0' + sub0;
} else if (parseInt(sub, 10) > 23) {
sub = '23';
} else if (parseInt(sub, 10) > timeFormatOptions.maxHours) {
sub = timeFormatOptions.maxHours + '';
}

break;

case 'm':
case 's':
if (parseInt(sub0, 10) > 5) {
if (parseInt(sub0, 10) > timeFormatOptions.maxMinutesFirstDigit) {
sub = '0' + sub0;
} else if (parseInt(sub, 10) > 60) {
sub = '60';
} else if (parseInt(sub, 10) > timeFormatOptions.maxMinutes) {
sub = timeFormatOptions.maxMinutes + '';
}
break;
}
Expand Down Expand Up @@ -1423,6 +1448,7 @@ return /******/ (function(modules) { // webpackBootstrap
// time
target.time = !!opts.time;
target.timePattern = opts.timePattern || ['h', 'm', 's'];
target.timeFormat = opts.timeFormat || '24';
target.timeFormatter = {};

// date
Expand Down
2 changes: 1 addition & 1 deletion dist/cleave-angular.min.js

Large diffs are not rendered by default.

39 changes: 31 additions & 8 deletions dist/cleave-react-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ return /******/ (function(modules) { // webpackBootstrap
return;
}

pps.timeFormatter = new TimeFormatter(pps.timePattern);
pps.timeFormatter = new TimeFormatter(pps.timePattern, pps.timeFormat);
pps.blocks = pps.timeFormatter.getBlocks();
pps.blocksLength = pps.blocks.length;
pps.maxLength = Util.getMaxLength(pps.blocks);
Expand Down Expand Up @@ -1995,12 +1995,13 @@ return /******/ (function(modules) { // webpackBootstrap

'use strict';

var TimeFormatter = function TimeFormatter(timePattern) {
var TimeFormatter = function TimeFormatter(timePattern, timeFormat) {
var owner = this;

owner.time = [];
owner.blocks = [];
owner.timePattern = timePattern;
owner.timeFormat = timeFormat;
owner.initBlocks();
};

Expand All @@ -2023,12 +2024,33 @@ return /******/ (function(modules) { // webpackBootstrap
return this.blocks;
},

getTimeFormatOptions: function getTimeFormatOptions() {
var owner = this;
if (String(owner.timeFormat) === '12') {
return {
maxHourFirstDigit: 1,
maxHours: 12,
maxMinutesFirstDigit: 5,
maxMinutes: 60
};
}

return {
maxHourFirstDigit: 2,
maxHours: 23,
maxMinutesFirstDigit: 5,
maxMinutes: 60
};
},

getValidatedTime: function getValidatedTime(value) {
var owner = this,
result = '';

value = value.replace(/[^\d]/g, '');

var timeFormatOptions = owner.getTimeFormatOptions();

owner.blocks.forEach(function (length, index) {
if (value.length > 0) {
var sub = value.slice(0, length),
Expand All @@ -2038,20 +2060,20 @@ return /******/ (function(modules) { // webpackBootstrap
switch (owner.timePattern[index]) {

case 'h':
if (parseInt(sub0, 10) > 2) {
if (parseInt(sub0, 10) > timeFormatOptions.maxHourFirstDigit) {
sub = '0' + sub0;
} else if (parseInt(sub, 10) > 23) {
sub = '23';
} else if (parseInt(sub, 10) > timeFormatOptions.maxHours) {
sub = timeFormatOptions.maxHours + '';
}

break;

case 'm':
case 's':
if (parseInt(sub0, 10) > 5) {
if (parseInt(sub0, 10) > timeFormatOptions.maxMinutesFirstDigit) {
sub = '0' + sub0;
} else if (parseInt(sub, 10) > 60) {
sub = '60';
} else if (parseInt(sub, 10) > timeFormatOptions.maxMinutes) {
sub = timeFormatOptions.maxMinutes + '';
}
break;
}
Expand Down Expand Up @@ -2588,6 +2610,7 @@ return /******/ (function(modules) { // webpackBootstrap
// time
target.time = !!opts.time;
target.timePattern = opts.timePattern || ['h', 'm', 's'];
target.timeFormat = opts.timeFormat || '24';
target.timeFormatter = {};

// date
Expand Down
2 changes: 1 addition & 1 deletion dist/cleave-react-node.min.js

Large diffs are not rendered by default.

39 changes: 31 additions & 8 deletions dist/cleave-react.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ return /******/ (function(modules) { // webpackBootstrap
return;
}

pps.timeFormatter = new TimeFormatter(pps.timePattern);
pps.timeFormatter = new TimeFormatter(pps.timePattern, pps.timeFormat);
pps.blocks = pps.timeFormatter.getBlocks();
pps.blocksLength = pps.blocks.length;
pps.maxLength = Util.getMaxLength(pps.blocks);
Expand Down Expand Up @@ -2189,12 +2189,13 @@ return /******/ (function(modules) { // webpackBootstrap

'use strict';

var TimeFormatter = function TimeFormatter(timePattern) {
var TimeFormatter = function TimeFormatter(timePattern, timeFormat) {
var owner = this;

owner.time = [];
owner.blocks = [];
owner.timePattern = timePattern;
owner.timeFormat = timeFormat;
owner.initBlocks();
};

Expand All @@ -2217,12 +2218,33 @@ return /******/ (function(modules) { // webpackBootstrap
return this.blocks;
},

getTimeFormatOptions: function getTimeFormatOptions() {
var owner = this;
if (String(owner.timeFormat) === '12') {
return {
maxHourFirstDigit: 1,
maxHours: 12,
maxMinutesFirstDigit: 5,
maxMinutes: 60
};
}

return {
maxHourFirstDigit: 2,
maxHours: 23,
maxMinutesFirstDigit: 5,
maxMinutes: 60
};
},

getValidatedTime: function getValidatedTime(value) {
var owner = this,
result = '';

value = value.replace(/[^\d]/g, '');

var timeFormatOptions = owner.getTimeFormatOptions();

owner.blocks.forEach(function (length, index) {
if (value.length > 0) {
var sub = value.slice(0, length),
Expand All @@ -2232,20 +2254,20 @@ return /******/ (function(modules) { // webpackBootstrap
switch (owner.timePattern[index]) {

case 'h':
if (parseInt(sub0, 10) > 2) {
if (parseInt(sub0, 10) > timeFormatOptions.maxHourFirstDigit) {
sub = '0' + sub0;
} else if (parseInt(sub, 10) > 23) {
sub = '23';
} else if (parseInt(sub, 10) > timeFormatOptions.maxHours) {
sub = timeFormatOptions.maxHours + '';
}

break;

case 'm':
case 's':
if (parseInt(sub0, 10) > 5) {
if (parseInt(sub0, 10) > timeFormatOptions.maxMinutesFirstDigit) {
sub = '0' + sub0;
} else if (parseInt(sub, 10) > 60) {
sub = '60';
} else if (parseInt(sub, 10) > timeFormatOptions.maxMinutes) {
sub = timeFormatOptions.maxMinutes + '';
}
break;
}
Expand Down Expand Up @@ -2782,6 +2804,7 @@ return /******/ (function(modules) { // webpackBootstrap
// time
target.time = !!opts.time;
target.timePattern = opts.timePattern || ['h', 'm', 's'];
target.timeFormat = opts.timeFormat || '24';
target.timeFormatter = {};

// date
Expand Down
2 changes: 1 addition & 1 deletion dist/cleave-react.min.js

Large diffs are not rendered by default.

46 changes: 36 additions & 10 deletions dist/cleave.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ return /******/ (function(modules) { // webpackBootstrap
return;
}

pps.timeFormatter = new Cleave.TimeFormatter(pps.timePattern);
pps.timeFormatter = new Cleave.TimeFormatter(pps.timePattern, pps.timeFormat);
pps.blocks = pps.timeFormatter.getBlocks();
pps.blocksLength = pps.blocks.length;
pps.maxLength = Cleave.Util.getMaxLength(pps.blocks);
Expand Down Expand Up @@ -192,8 +192,11 @@ return /******/ (function(modules) { // webpackBootstrap
Util = Cleave.Util,
currentValue = owner.element.value;

if (charCode === 229
&& Util.isAndroidBackspaceKeydown(owner.lastInputValue, currentValue)
// if we got any charCode === 8, this means, that this device correctly
// sends backspace keys in event, so we do not need to apply any hacks
owner.hasBackspaceSupport = owner.hasBackspaceSupport || charCode === 8;
if (!owner.hasBackspaceSupport
&& Util.isAndroidBackspaceKeydown(owner.lastInputValue, currentValue)
) {
charCode = 8;
}
Expand Down Expand Up @@ -780,12 +783,13 @@ return /******/ (function(modules) { // webpackBootstrap

'use strict';

var TimeFormatter = function (timePattern) {
var TimeFormatter = function (timePattern, timeFormat) {
var owner = this;

owner.time = [];
owner.blocks = [];
owner.timePattern = timePattern;
owner.timeFormat = timeFormat;
owner.initBlocks();
};

Expand All @@ -810,11 +814,32 @@ return /******/ (function(modules) { // webpackBootstrap
return this.blocks;
},

getTimeFormatOptions: function () {
var owner = this;
if (String(owner.timeFormat) === '12') {
return {
maxHourFirstDigit: 1,
maxHours: 12,
maxMinutesFirstDigit: 5,
maxMinutes: 60
};
}

return {
maxHourFirstDigit: 2,
maxHours: 23,
maxMinutesFirstDigit: 5,
maxMinutes: 60
};
},

getValidatedTime: function (value) {
var owner = this, result = '';

value = value.replace(/[^\d]/g, '');

var timeFormatOptions = owner.getTimeFormatOptions();

owner.blocks.forEach(function (length, index) {
if (value.length > 0) {
var sub = value.slice(0, length),
Expand All @@ -824,20 +849,20 @@ return /******/ (function(modules) { // webpackBootstrap
switch (owner.timePattern[index]) {

case 'h':
if (parseInt(sub0, 10) > 2) {
if (parseInt(sub0, 10) > timeFormatOptions.maxHourFirstDigit) {
sub = '0' + sub0;
} else if (parseInt(sub, 10) > 23) {
sub = '23';
} else if (parseInt(sub, 10) > timeFormatOptions.maxHours) {
sub = timeFormatOptions.maxHours + '';
}

break;

case 'm':
case 's':
if (parseInt(sub0, 10) > 5) {
if (parseInt(sub0, 10) > timeFormatOptions.maxMinutesFirstDigit) {
sub = '0' + sub0;
} else if (parseInt(sub, 10) > 60) {
sub = '60';
} else if (parseInt(sub, 10) > timeFormatOptions.maxMinutes) {
sub = timeFormatOptions.maxMinutes + '';
}
break;
}
Expand Down Expand Up @@ -1366,6 +1391,7 @@ return /******/ (function(modules) { // webpackBootstrap
// time
target.time = !!opts.time;
target.timePattern = opts.timePattern || ['h', 'm', 's'];
target.timeFormat = opts.timeFormat || '24';
target.timeFormatter = {};

// date
Expand Down
Loading

0 comments on commit 707ed1e

Please sign in to comment.