Skip to content

Commit

Permalink
exposed default options with a setter
Browse files Browse the repository at this point in the history
  • Loading branch information
Eonasdan committed Dec 21, 2017
1 parent 0f79e45 commit bc03358
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 130 deletions.
113 changes: 57 additions & 56 deletions build/js/tempusdominus-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var DateTimePicker = function ($, moment) {
// ReSharper disable InconsistentNaming
var NAME = 'datetimepicker',
VERSION = '5.0.0-alpha7',
VERSION = '5.0.0-alpha12',
DATA_KEY = '' + NAME,
EVENT_KEY = '.' + DATA_KEY,
EMIT_EVENT_KEY = DATA_KEY + '.',
Expand All @@ -30,6 +30,58 @@ var DateTimePicker = function ($, moment) {
HIDE: EMIT_EVENT_KEY + 'hide',
SHOW: EMIT_EVENT_KEY + 'show'
},
DatePickerModes = [{
CLASS_NAME: 'days',
NAV_FUNCTION: 'M',
NAV_STEP: 1
}, {
CLASS_NAME: 'months',
NAV_FUNCTION: 'y',
NAV_STEP: 1
}, {
CLASS_NAME: 'years',
NAV_FUNCTION: 'y',
NAV_STEP: 10
}, {
CLASS_NAME: 'decades',
NAV_FUNCTION: 'y',
NAV_STEP: 100
}],
KeyMap = {
'up': 38,
38: 'up',
'down': 40,
40: 'down',
'left': 37,
37: 'left',
'right': 39,
39: 'right',
'tab': 9,
9: 'tab',
'escape': 27,
27: 'escape',
'enter': 13,
13: 'enter',
'pageUp': 33,
33: 'pageUp',
'pageDown': 34,
34: 'pageDown',
'shift': 16,
16: 'shift',
'control': 17,
17: 'control',
'space': 32,
32: 'space',
't': 84,
84: 't',
'delete': 46,
46: 'delete'
},
ViewModes = ['times', 'days', 'months', 'years', 'decades'],
keyState = {},
keyPressHandled = {};

var MinViewModeNumber = 0,
Default = {
timeZone: '',
format: false,
Expand Down Expand Up @@ -234,59 +286,8 @@ var DateTimePicker = function ($, moment) {
viewDate: false,
allowMultidate: false,
multidateSeparator: ','
},
DatePickerModes = [{
CLASS_NAME: 'days',
NAV_FUNCTION: 'M',
NAV_STEP: 1
}, {
CLASS_NAME: 'months',
NAV_FUNCTION: 'y',
NAV_STEP: 1
}, {
CLASS_NAME: 'years',
NAV_FUNCTION: 'y',
NAV_STEP: 10
}, {
CLASS_NAME: 'decades',
NAV_FUNCTION: 'y',
NAV_STEP: 100
}],
KeyMap = {
'up': 38,
38: 'up',
'down': 40,
40: 'down',
'left': 37,
37: 'left',
'right': 39,
39: 'right',
'tab': 9,
9: 'tab',
'escape': 27,
27: 'escape',
'enter': 13,
13: 'enter',
'pageUp': 33,
33: 'pageUp',
'pageDown': 34,
34: 'pageDown',
'shift': 16,
16: 'shift',
'control': 17,
17: 'control',
'space': 32,
32: 'space',
't': 84,
84: 't',
'delete': 46,
46: 'delete'
},
ViewModes = ['times', 'days', 'months', 'years', 'decades'],
keyState = {},
keyPressHandled = {};
};

var MinViewModeNumber = 0;
// ReSharper restore InconsistentNaming

// ReSharper disable once DeclarationHides
Expand Down Expand Up @@ -815,9 +816,6 @@ var DateTimePicker = function ($, moment) {
};

DateTimePicker.prototype.format = function format(newFormat) {
///<summary>test su</summary>
///<param name="newFormat">info about para</param>
///<returns type="string|boolean">returns foo</returns>
if (arguments.length === 0) {
return this._options.format;
}
Expand Down Expand Up @@ -1537,6 +1535,9 @@ var DateTimePicker = function ($, moment) {
key: 'Default',
get: function get() {
return Default;
},
set: function set(value) {
Default = value;
}
}, {
key: 'ClassName',
Expand Down
2 changes: 1 addition & 1 deletion build/js/tempusdominus-core.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tempusdominus-core",
"version": "5.0.0-alpha10",
"version": "5.0.0-alpha12",
"main": "build/js/tempusdominus-core.min.js",
"dependencies": {
"jquery": ">=1.8.3",
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tempusdominus/core",
"type": "component",
"version": "5.0.0-alpha10",
"version": "5.0.0-alpha12",
"description": "Tempus Dominus core",
"keywords": [
"bootstrap",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"type": "git",
"url": "https://github.com/tempusdominus/core.git"
},
"version": "5.0.0-alpha10",
"version": "5.0.0-alpha12",
"files": [
"build",
"src/js/**/*.js",
Expand Down
114 changes: 58 additions & 56 deletions src/js/tempusdominus-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import moment from 'moment';
const DateTimePicker = (($, moment) => {
// ReSharper disable InconsistentNaming
const NAME = 'datetimepicker',
VERSION = '5.0.0-alpha7',
VERSION = '5.0.0-alpha12',
DATA_KEY = `${NAME}`,
EVENT_KEY = `.${DATA_KEY}`,
EMIT_EVENT_KEY = `${DATA_KEY}.`,
Expand All @@ -29,6 +29,58 @@ const DateTimePicker = (($, moment) => {
HIDE: `${EMIT_EVENT_KEY}hide`,
SHOW: `${EMIT_EVENT_KEY}show`
},
DatePickerModes = [{
CLASS_NAME: 'days',
NAV_FUNCTION: 'M',
NAV_STEP: 1
}, {
CLASS_NAME: 'months',
NAV_FUNCTION: 'y',
NAV_STEP: 1
}, {
CLASS_NAME: 'years',
NAV_FUNCTION: 'y',
NAV_STEP: 10
}, {
CLASS_NAME: 'decades',
NAV_FUNCTION: 'y',
NAV_STEP: 100
}],
KeyMap = {
'up': 38,
38: 'up',
'down': 40,
40: 'down',
'left': 37,
37: 'left',
'right': 39,
39: 'right',
'tab': 9,
9: 'tab',
'escape': 27,
27: 'escape',
'enter': 13,
13: 'enter',
'pageUp': 33,
33: 'pageUp',
'pageDown': 34,
34: 'pageDown',
'shift': 16,
16: 'shift',
'control': 17,
17: 'control',
'space': 32,
32: 'space',
't': 84,
84: 't',
'delete': 46,
46: 'delete'
},
ViewModes = ['times', 'days', 'months', 'years', 'decades'],
keyState = {},
keyPressHandled = {};

let MinViewModeNumber = 0,
Default = {
timeZone: '',
format: false,
Expand Down Expand Up @@ -233,59 +285,8 @@ const DateTimePicker = (($, moment) => {
viewDate: false,
allowMultidate: false,
multidateSeparator: ','
},
DatePickerModes = [{
CLASS_NAME: 'days',
NAV_FUNCTION: 'M',
NAV_STEP: 1
}, {
CLASS_NAME: 'months',
NAV_FUNCTION: 'y',
NAV_STEP: 1
}, {
CLASS_NAME: 'years',
NAV_FUNCTION: 'y',
NAV_STEP: 10
}, {
CLASS_NAME: 'decades',
NAV_FUNCTION: 'y',
NAV_STEP: 100
}],
KeyMap = {
'up': 38,
38: 'up',
'down': 40,
40: 'down',
'left': 37,
37: 'left',
'right': 39,
39: 'right',
'tab': 9,
9: 'tab',
'escape': 27,
27: 'escape',
'enter': 13,
13: 'enter',
'pageUp': 33,
33: 'pageUp',
'pageDown': 34,
34: 'pageDown',
'shift': 16,
16: 'shift',
'control': 17,
17: 'control',
'space': 32,
32: 'space',
't': 84,
84: 't',
'delete': 46,
46: 'delete'
},
ViewModes = ['times', 'days', 'months', 'years', 'decades'],
keyState = {},
keyPressHandled = {};
};

let MinViewModeNumber = 0;
// ReSharper restore InconsistentNaming

// ReSharper disable once DeclarationHides
Expand Down Expand Up @@ -373,6 +374,10 @@ const DateTimePicker = (($, moment) => {
return Default;
}

static set Default(value) {
Default = value;
}

static get ClassName() {
return ClassName;
}
Expand Down Expand Up @@ -866,9 +871,6 @@ const DateTimePicker = (($, moment) => {
}

format(newFormat) {
///<summary>test su</summary>
///<param name="newFormat">info about para</param>
///<returns type="string|boolean">returns foo</returns>
if (arguments.length === 0) {
return this._options.format;
}
Expand Down
15 changes: 1 addition & 14 deletions tasks/bump-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,7 @@ module.exports = function (grunt) {
]
}
});

grunt.config('string-replace.bower-json', {
files: {'bower.json': 'bower.json'},
options: {
replacements: [
{
pattern: /"version": .*/,
replacement: '"version": "' + version + '",'
}
]
}
});


grunt.config('string-replace.component-json', {
files: {'component.json': 'component.json'},
options: {
Expand Down Expand Up @@ -66,7 +54,6 @@ module.exports = function (grunt) {

grunt.task.run([
'string-replace:package-json',
'string-replace:bower-json',
'string-replace:component-json',
'string-replace:composer-json',
'string-replace:js'
Expand Down

0 comments on commit bc03358

Please sign in to comment.