material-datetimepicker-rails 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/material/datetimepicker/rails.rb +9 -0
- data/lib/material/datetimepicker/rails/version.rb +7 -0
- data/material-datetimepicker-rails.gemspec +38 -0
- data/vendor/assets/javascripts/material-datetime-picker.js +744 -0
- data/vendor/assets/stylesheets/material-datetime-picker.css +548 -0
- metadata +141 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a8f23e83c5665cd36f28070dd49c69a12773bb63
|
4
|
+
data.tar.gz: 2ce52086a4e408dccaeea286685106b92802e8d2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e20a7cf8150f194ae19f78eca6fb17e3faf587ad0558e36dcb906801f5da8a62567777e8af338cf6f7b447f6c83739183deb49060bd792bee26db6a6ffc5da7c
|
7
|
+
data.tar.gz: 6de06b6fb8235a769d5ee697868e2add9c5b36916625173672e65b9806283b5d1182ec50b9379e0d63450fb44d37d82b69d5389204c0f9e8e53ab204aa292762
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at al3xander.koval@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 hetsketch
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Material::Datetimepicker::Rails
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/material/datetimepicker/rails`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'material-datetimepicker-rails'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install material-datetimepicker-rails
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/material-datetimepicker-rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "material/datetimepicker/rails"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'material/datetimepicker/rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "material-datetimepicker-rails"
|
8
|
+
spec.version = Material::Datetimepicker::Rails::VERSION
|
9
|
+
spec.authors = ["hetsketch"]
|
10
|
+
spec.email = ["al3xander.koval@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Material date and time picker assets for Rails}
|
13
|
+
spec.description = %q{Simple wrapper for material-datetime-picker JS library}
|
14
|
+
spec.homepage = "https://github.com/hetsketch/material-datetimepicker-rails"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "http://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
34
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
35
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
36
|
+
spec.add_runtime_dependency "momentjs-rails", "~> 2.17", ">= 2.17.1"
|
37
|
+
spec.add_runtime_dependency "rome-rails", "~> 2.1", ">= 2.1.22"
|
38
|
+
end
|
@@ -0,0 +1,744 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('rome'), require('moment')) :
|
3
|
+
typeof define === 'function' && define.amd ? define(['rome', 'moment'], factory) :
|
4
|
+
(global.MaterialDatetimePicker = factory(global.rome,global.moment));
|
5
|
+
}(this, (function (rome,moment) { 'use strict';
|
6
|
+
|
7
|
+
rome = 'default' in rome ? rome['default'] : rome;
|
8
|
+
moment = 'default' in moment ? moment['default'] : moment;
|
9
|
+
|
10
|
+
var popupTemplate = (function () {
|
11
|
+
return "\n<div class=\"c-datepicker\">\n <a class=\"c-datepicker__toggle c-datepicker__toggle--right c-datepicker--show-time js-show-clock\" title=\"show time picker\">\n </a>\n\n <a class=\"c-datepicker__toggle c-datepicker__toggle--left c-datepicker--show-calendar is-selected js-show-calendar\" title=\"show date picker\">\n </a>\n\n <div class=\"c-datepicker__header\">\n <div class=\"c-datepicker__header-day\">\n <span class=\"js-day\">Monday</span>\n </div>\n <div class=\"c-datepicker__header-date\">\n <span class=\"c-datepicker__header-date__month js-date-month\"></span>\n <span class=\"c-datepicker__header-date__day js-date-day\"></span>\n <span class=\"c-datepicker__header-date__time js-date-time\">\n <span class=\"c-datepicker__header-date__hours js-date-hours active\">09</span>:<span class=\"c-datepicker__header-date__minutes js-date-minutes\">00</span>\n </span>\n </div>\n </div>\n\n <div class=\"c-datepicker__calendar\"></div>\n <div class=\"c-datepicker__clock\">\n <div class=\"c-datepicker__clock__am-pm-toggle\">\n <label class=\"c-datepicker__toggle--checked\">\n <input checked=\"checked\" class=\"c-datepicker__toggle c-datepicker__toggle--right c-datepicker__clock--am\" type=\"radio\" name=\"time-date-toggle\" value=\"AM\" />\n AM\n </label>\n\n <label>\n <input class=\"c-datepicker__toggle c-datepicker__toggle--right c-datepicker__clock--pm\" type=\"radio\" name=\"time-date-toggle\" value=\"PM\" />\n PM\n </label>\n </div>\n <div class=\"c-datepicker__mask\"></div>\n <div class=\"c-datepicker__clock__hours js-clock-hours active\">\n <div class=\"c-datepicker__clock__num\" data-number=\"3\">3</div>\n <div class=\"c-datepicker__clock__num\" data-number=\"4\">4</div>\n <div class=\"c-datepicker__clock__num\" data-number=\"5\">5</div>\n <div class=\"c-datepicker__clock__num\" data-number=\"6\">6</div>\n <div class=\"c-datepicker__clock__num\" data-number=\"7\">7</div>\n <div class=\"c-datepicker__clock__num\" data-number=\"8\">8</div>\n <div class=\"c-datepicker__clock__num\" data-number=\"9\">9</div>\n <div class=\"c-datepicker__clock__num\" data-number=\"10\">10</div>\n <div class=\"c-datepicker__clock__num\" data-number=\"11\">11</div>\n <div class=\"c-datepicker__clock__num\" data-number=\"0\">12</div>\n <div class=\"c-datepicker__clock__num\" data-number=\"1\">1</div>\n <div class=\"c-datepicker__clock__num\" data-number=\"2\">2</div>\n <div class=\"c-datepicker__clock-hands\">\n <div class=\"c-datepicker__hour-hand\"></div>\n </div>\n </div>\n <div class=\"c-datepicker__clock__minutes js-clock-minutes\">\n <div class=\"c-datepicker__clock__num\" data-number=\"15\">15</div>\n <div class=\"c-datepicker__clock__num\" data-number=\"20\">20</div>\n <div class=\"c-datepicker__clock__num\" data-number=\"25\">25</div>\n <div class=\"c-datepicker__clock__num\" data-number=\"30\">30</div>\n <div class=\"c-datepicker__clock__num\" data-number=\"35\">35</div>\n <div class=\"c-datepicker__clock__num\" data-number=\"40\">40</div>\n <div class=\"c-datepicker__clock__num\" data-number=\"45\">45</div>\n <div class=\"c-datepicker__clock__num\" data-number=\"50\">50</div>\n <div class=\"c-datepicker__clock__num\" data-number=\"55\">55</div>\n <div class=\"c-datepicker__clock__num\" data-number=\"0\">0</div>\n <div class=\"c-datepicker__clock__num\" data-number=\"5\">5</div>\n <div class=\"c-datepicker__clock__num\" data-number=\"10\">10</div>\n <div class=\"c-datepicker__clock-hands\">\n <div class=\"c-datepicker__hour-hand\"></div>\n </div>\n </div>\n </div>\n <div class=\"modal-btns\">\n <a class=\"c-btn c-btn--flat js-cancel\">Cancel</a>\n <a class=\"c-btn c-btn--flat js-ok\">OK</a>\n </div>\n</div>\n";
|
12
|
+
});
|
13
|
+
|
14
|
+
var scrimTemplate = (function (_ref) {
|
15
|
+
var styles = _ref.styles;
|
16
|
+
return "\n<div class=\"" + styles.scrim + "\"></div>\n";
|
17
|
+
});
|
18
|
+
|
19
|
+
var classCallCheck = function (instance, Constructor) {
|
20
|
+
if (!(instance instanceof Constructor)) {
|
21
|
+
throw new TypeError("Cannot call a class as a function");
|
22
|
+
}
|
23
|
+
};
|
24
|
+
|
25
|
+
var createClass = function () {
|
26
|
+
function defineProperties(target, props) {
|
27
|
+
for (var i = 0; i < props.length; i++) {
|
28
|
+
var descriptor = props[i];
|
29
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
30
|
+
descriptor.configurable = true;
|
31
|
+
if ("value" in descriptor) descriptor.writable = true;
|
32
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
return function (Constructor, protoProps, staticProps) {
|
37
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
38
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
39
|
+
return Constructor;
|
40
|
+
};
|
41
|
+
}();
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
var inherits = function (subClass, superClass) {
|
52
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
53
|
+
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
54
|
+
}
|
55
|
+
|
56
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
57
|
+
constructor: {
|
58
|
+
value: subClass,
|
59
|
+
enumerable: false,
|
60
|
+
writable: true,
|
61
|
+
configurable: true
|
62
|
+
}
|
63
|
+
});
|
64
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
65
|
+
};
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
var possibleConstructorReturn = function (self, call) {
|
78
|
+
if (!self) {
|
79
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
80
|
+
}
|
81
|
+
|
82
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
83
|
+
};
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
var slicedToArray = function () {
|
90
|
+
function sliceIterator(arr, i) {
|
91
|
+
var _arr = [];
|
92
|
+
var _n = true;
|
93
|
+
var _d = false;
|
94
|
+
var _e = undefined;
|
95
|
+
|
96
|
+
try {
|
97
|
+
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
98
|
+
_arr.push(_s.value);
|
99
|
+
|
100
|
+
if (i && _arr.length === i) break;
|
101
|
+
}
|
102
|
+
} catch (err) {
|
103
|
+
_d = true;
|
104
|
+
_e = err;
|
105
|
+
} finally {
|
106
|
+
try {
|
107
|
+
if (!_n && _i["return"]) _i["return"]();
|
108
|
+
} finally {
|
109
|
+
if (_d) throw _e;
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
return _arr;
|
114
|
+
}
|
115
|
+
|
116
|
+
return function (arr, i) {
|
117
|
+
if (Array.isArray(arr)) {
|
118
|
+
return arr;
|
119
|
+
} else if (Symbol.iterator in Object(arr)) {
|
120
|
+
return sliceIterator(arr, i);
|
121
|
+
} else {
|
122
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
123
|
+
}
|
124
|
+
};
|
125
|
+
}();
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
var toConsumableArray = function (arr) {
|
140
|
+
if (Array.isArray(arr)) {
|
141
|
+
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
142
|
+
|
143
|
+
return arr2;
|
144
|
+
} else {
|
145
|
+
return Array.from(arr);
|
146
|
+
}
|
147
|
+
};
|
148
|
+
|
149
|
+
//
|
150
|
+
// basic event triggering and listening
|
151
|
+
//
|
152
|
+
var Events = function () {
|
153
|
+
function Events() {
|
154
|
+
classCallCheck(this, Events);
|
155
|
+
|
156
|
+
this._events = {
|
157
|
+
'*': []
|
158
|
+
};
|
159
|
+
}
|
160
|
+
|
161
|
+
createClass(Events, [{
|
162
|
+
key: 'trigger',
|
163
|
+
value: function trigger(eventName, evtData) {
|
164
|
+
var _this = this;
|
165
|
+
|
166
|
+
eventName.split(' ').forEach(function (evtName) {
|
167
|
+
// trigger a global event event
|
168
|
+
_this._events['*'].forEach(function (evt) {
|
169
|
+
return evt.fn.call(evt.scope, evtName, evtData);
|
170
|
+
});
|
171
|
+
// if there are any listeners to this event
|
172
|
+
// then fire their handlers
|
173
|
+
if (_this._events[evtName]) {
|
174
|
+
_this._events[evtName].forEach(function (evt) {
|
175
|
+
evt.fn.call(evt.scope, evtData);
|
176
|
+
});
|
177
|
+
}
|
178
|
+
});
|
179
|
+
return this;
|
180
|
+
}
|
181
|
+
}, {
|
182
|
+
key: 'on',
|
183
|
+
value: function on(eventName, fn, scope) {
|
184
|
+
if (!this._events[eventName]) this._events[eventName] = [];
|
185
|
+
this._events[eventName].push({
|
186
|
+
eventName: eventName,
|
187
|
+
fn: fn,
|
188
|
+
scope: scope || this
|
189
|
+
});
|
190
|
+
return this;
|
191
|
+
}
|
192
|
+
}, {
|
193
|
+
key: 'off',
|
194
|
+
value: function off(eventName, fn) {
|
195
|
+
if (!this._events[eventName]) return this;
|
196
|
+
if (!fn) {
|
197
|
+
this._events[eventName] = [];
|
198
|
+
}
|
199
|
+
this._events[eventName] = this._events[eventName].filter(function (evt) {
|
200
|
+
return evt.fn !== fn;
|
201
|
+
});
|
202
|
+
return this;
|
203
|
+
}
|
204
|
+
}, {
|
205
|
+
key: 'once',
|
206
|
+
value: function once(eventName, fn, scope) {
|
207
|
+
var _this2 = this;
|
208
|
+
|
209
|
+
var func = function func() {
|
210
|
+
fn.call(scope, eventName, fn, scope);
|
211
|
+
_this2.off(eventName, func);
|
212
|
+
};
|
213
|
+
return this.on(eventName, func, scope);
|
214
|
+
}
|
215
|
+
}]);
|
216
|
+
return Events;
|
217
|
+
}();
|
218
|
+
|
219
|
+
var ESC_KEY = 27;
|
220
|
+
|
221
|
+
var prefix = 'c-datepicker';
|
222
|
+
var defaults$$1 = function defaults$$1() {
|
223
|
+
return {
|
224
|
+
default: moment().startOf('hour'),
|
225
|
+
// allow the user to override all the classes
|
226
|
+
// used for styling the calendar
|
227
|
+
styles: {
|
228
|
+
scrim: 'c-scrim',
|
229
|
+
back: prefix + '__back',
|
230
|
+
container: prefix + '__calendar',
|
231
|
+
date: prefix + '__date',
|
232
|
+
dayBody: prefix + '__days-body',
|
233
|
+
dayBodyElem: prefix + '__day-body',
|
234
|
+
dayConcealed: prefix + '__day--concealed',
|
235
|
+
dayDisabled: prefix + '__day--disabled',
|
236
|
+
dayHead: prefix + '__days-head',
|
237
|
+
dayHeadElem: prefix + '__day-head',
|
238
|
+
dayRow: prefix + '__days-row',
|
239
|
+
dayTable: prefix + '__days',
|
240
|
+
month: prefix + '__month',
|
241
|
+
next: prefix + '__next',
|
242
|
+
positioned: prefix + '--fixed',
|
243
|
+
selectedDay: prefix + '__day--selected',
|
244
|
+
selectedTime: prefix + '__time--selected',
|
245
|
+
time: prefix + '__time',
|
246
|
+
timeList: prefix + '__time-list',
|
247
|
+
timeOption: prefix + '__time-option',
|
248
|
+
clockNum: prefix + '__clock__num'
|
249
|
+
},
|
250
|
+
// format to display in the input, or set on the element
|
251
|
+
format: 'DD/MM/YY',
|
252
|
+
// the container to append the picker
|
253
|
+
container: document.body,
|
254
|
+
// allow any dates
|
255
|
+
dateValidator: undefined
|
256
|
+
};
|
257
|
+
};
|
258
|
+
|
259
|
+
var DateTimePicker = function (_Events) {
|
260
|
+
inherits(DateTimePicker, _Events);
|
261
|
+
|
262
|
+
function DateTimePicker() {
|
263
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
264
|
+
classCallCheck(this, DateTimePicker);
|
265
|
+
|
266
|
+
var _this = possibleConstructorReturn(this, (DateTimePicker.__proto__ || Object.getPrototypeOf(DateTimePicker)).call(this));
|
267
|
+
|
268
|
+
var styles = Object.assign(defaults$$1().styles, options.styles);
|
269
|
+
_this.options = Object.assign(defaults$$1(), options);
|
270
|
+
_this.options.styles = styles;
|
271
|
+
|
272
|
+
// listen to any event
|
273
|
+
_this.on('*', function (evtName, evtData) {
|
274
|
+
if (_this.options.el) {
|
275
|
+
// if there is a custom element, fire a real dom
|
276
|
+
// event on that now
|
277
|
+
var event = new CustomEvent(evtName, _this, evtData);
|
278
|
+
_this.options.el.dispatchEvent(event);
|
279
|
+
}
|
280
|
+
});
|
281
|
+
return _this;
|
282
|
+
}
|
283
|
+
|
284
|
+
// intialize the rom calendar with our default date and
|
285
|
+
// style options
|
286
|
+
|
287
|
+
|
288
|
+
createClass(DateTimePicker, [{
|
289
|
+
key: 'initializeRome',
|
290
|
+
value: function initializeRome(container, validator) {
|
291
|
+
var onData = this.onChangeDate.bind(this);
|
292
|
+
|
293
|
+
return rome(container, {
|
294
|
+
styles: this.options.styles,
|
295
|
+
time: false,
|
296
|
+
dateValidator: validator,
|
297
|
+
initialValue: this.value
|
298
|
+
}).on('data', onData);
|
299
|
+
}
|
300
|
+
|
301
|
+
// called to open the picker
|
302
|
+
|
303
|
+
}, {
|
304
|
+
key: 'open',
|
305
|
+
value: function open() {
|
306
|
+
var scrimEl = scrimTemplate(this.options);
|
307
|
+
_appendTemplate(document.body, scrimEl);
|
308
|
+
_appendTemplate(this.options.container, popupTemplate());
|
309
|
+
this.pickerEl = this.options.container.querySelector('.' + prefix);
|
310
|
+
this.scrimEl = document.body.querySelector('.' + this.options.styles.scrim);
|
311
|
+
this.amToggleEl = this.$('.c-datepicker__clock--am');
|
312
|
+
this.pmToggleEl = this.$('.c-datepicker__clock--pm');
|
313
|
+
|
314
|
+
if (!this.value) {
|
315
|
+
// TODO hack
|
316
|
+
// set/setDate/setTime need refactoring to have single concerns
|
317
|
+
// (set: set the value; setDate/setTime rename to renderDate/renderTime
|
318
|
+
// and deal with updating the view only).
|
319
|
+
// For now this allows us to set the default time using the same quantize
|
320
|
+
// rules as setting the date explicitly. Setting this.value meets setTime|Date's
|
321
|
+
// expectation that we have a value, and `0` guarantees that we will detect
|
322
|
+
this.value = moment(0);
|
323
|
+
this.setDate(this.options.default);
|
324
|
+
this.setTime(this.options.default);
|
325
|
+
} else {
|
326
|
+
this.setDate(this.value);
|
327
|
+
this.setTime(this.value);
|
328
|
+
}
|
329
|
+
|
330
|
+
this.initializeRome(this.$('.' + this.options.styles.container), this.options.dateValidator);
|
331
|
+
this._listenForCloseEvents();
|
332
|
+
|
333
|
+
this._show();
|
334
|
+
}
|
335
|
+
}, {
|
336
|
+
key: 'close',
|
337
|
+
value: function close() {
|
338
|
+
this._stopListeningForCloseEvents();
|
339
|
+
this._hide();
|
340
|
+
}
|
341
|
+
}, {
|
342
|
+
key: '_hide',
|
343
|
+
value: function _hide() {
|
344
|
+
var _this2 = this;
|
345
|
+
|
346
|
+
this.pickerEl.classList.remove('open');
|
347
|
+
window.setTimeout(function () {
|
348
|
+
_this2.options.container.removeChild(_this2.pickerEl);
|
349
|
+
document.body.removeChild(_this2.scrimEl);
|
350
|
+
_this2.trigger('close');
|
351
|
+
}, 200);
|
352
|
+
return this;
|
353
|
+
}
|
354
|
+
}, {
|
355
|
+
key: '_show',
|
356
|
+
value: function _show() {
|
357
|
+
var _this3 = this;
|
358
|
+
|
359
|
+
this.delegateEvents();
|
360
|
+
// add the animation classes on the next animation tick
|
361
|
+
// so that they actually work
|
362
|
+
window.requestAnimationFrame(function () {
|
363
|
+
_this3.scrimEl.classList.add(_this3.options.styles.scrim + '--shown');
|
364
|
+
_this3.pickerEl.classList.add(prefix + '--open');
|
365
|
+
_this3.trigger('open');
|
366
|
+
});
|
367
|
+
return this;
|
368
|
+
}
|
369
|
+
}, {
|
370
|
+
key: '_listenForCloseEvents',
|
371
|
+
value: function _listenForCloseEvents() {
|
372
|
+
var _this4 = this;
|
373
|
+
|
374
|
+
this._onWindowKeypress = function (e) {
|
375
|
+
if (e.which === ESC_KEY) {
|
376
|
+
_this4.close();
|
377
|
+
}
|
378
|
+
};
|
379
|
+
|
380
|
+
window.addEventListener("keydown", this._onWindowKeypress);
|
381
|
+
}
|
382
|
+
}, {
|
383
|
+
key: '_stopListeningForCloseEvents',
|
384
|
+
value: function _stopListeningForCloseEvents() {
|
385
|
+
window.removeEventListener("keydown", this._onWindowKeypress);
|
386
|
+
this._closeHandler = null;
|
387
|
+
}
|
388
|
+
}, {
|
389
|
+
key: 'delegateEvents',
|
390
|
+
value: function delegateEvents() {
|
391
|
+
var _this5 = this;
|
392
|
+
|
393
|
+
this.$('.js-cancel').addEventListener('click', function () {
|
394
|
+
return _this5.clickCancel();
|
395
|
+
}, false);
|
396
|
+
this.$('.js-ok').addEventListener('click', function () {
|
397
|
+
return _this5.clickSubmit();
|
398
|
+
}, false);
|
399
|
+
|
400
|
+
this.$('.js-date-hours').addEventListener('click', function (e) {
|
401
|
+
return _this5.showHourClock(e);
|
402
|
+
}, false);
|
403
|
+
this.$('.js-date-minutes').addEventListener('click', function (e) {
|
404
|
+
return _this5.showMinuteClock(e);
|
405
|
+
}, false);
|
406
|
+
|
407
|
+
this.$('.js-clock-hours').addEventListener('mouseleave', function (e) {
|
408
|
+
return _this5.mouseOutHourClock(e);
|
409
|
+
}, false);
|
410
|
+
this.$('.js-clock-hours .' + this.options.styles.clockNum).forEach(function (el) {
|
411
|
+
el.addEventListener('click', function (e) {
|
412
|
+
return _this5.clickClickHour(e).showMinuteClock();
|
413
|
+
}, false);
|
414
|
+
el.addEventListener('mouseenter', function (e) {
|
415
|
+
return _this5.mouseInHourClock(e);
|
416
|
+
}, false);
|
417
|
+
});
|
418
|
+
|
419
|
+
this.$('.js-clock-minutes').addEventListener('mouseleave', function (e) {
|
420
|
+
return _this5.mouseOutMinuteClock(e);
|
421
|
+
}, false);
|
422
|
+
this.$('.js-clock-minutes .' + this.options.styles.clockNum).forEach(function (el) {
|
423
|
+
el.addEventListener('click', function (e) {
|
424
|
+
return _this5.clickClockMinute(e);
|
425
|
+
}, false);
|
426
|
+
el.addEventListener('mouseenter', function (e) {
|
427
|
+
return _this5.mouseInMinuteClock(e);
|
428
|
+
}, false);
|
429
|
+
});
|
430
|
+
|
431
|
+
this.$('.c-datepicker__clock--am').addEventListener('click', function (e) {
|
432
|
+
return _this5.clickAm(e);
|
433
|
+
}, false);
|
434
|
+
this.$('.c-datepicker__clock--pm').addEventListener('click', function (e) {
|
435
|
+
return _this5.clickPm(e);
|
436
|
+
}, false);
|
437
|
+
|
438
|
+
this.$('.js-show-calendar').addEventListener('click', function (e) {
|
439
|
+
return _this5.clickShowCalendar(e);
|
440
|
+
}, false);
|
441
|
+
this.$('.js-date-day').addEventListener('click', function (e) {
|
442
|
+
return _this5.clickShowCalendar(e);
|
443
|
+
}, false);
|
444
|
+
this.$('.js-date-month').addEventListener('click', function (e) {
|
445
|
+
return _this5.clickShowCalendar(e);
|
446
|
+
}, false);
|
447
|
+
|
448
|
+
this.$('.js-show-clock').addEventListener('click', function (e) {
|
449
|
+
return _this5.clickShowClock(e);
|
450
|
+
}, false);
|
451
|
+
|
452
|
+
this.scrimEl.addEventListener('click', function () {
|
453
|
+
return _this5.close();
|
454
|
+
}, false);
|
455
|
+
|
456
|
+
return this;
|
457
|
+
}
|
458
|
+
}, {
|
459
|
+
key: 'clickSubmit',
|
460
|
+
value: function clickSubmit() {
|
461
|
+
this.close();
|
462
|
+
this.trigger('submit', this.value, this);
|
463
|
+
return this;
|
464
|
+
}
|
465
|
+
}, {
|
466
|
+
key: 'clickCancel',
|
467
|
+
value: function clickCancel() {
|
468
|
+
this.close();
|
469
|
+
this.trigger('cancel', this.value, this);
|
470
|
+
return this;
|
471
|
+
}
|
472
|
+
}, {
|
473
|
+
key: 'clickClickHour',
|
474
|
+
value: function clickClickHour(e) {
|
475
|
+
var newValue = moment(this.value);
|
476
|
+
var number = parseInt(e.currentTarget.getAttribute('data-number'), 10);
|
477
|
+
if (number === 0 && this.meridiem === 'pm') {
|
478
|
+
number = 12;
|
479
|
+
} else if (this.meridiem === 'pm') {
|
480
|
+
number += 12;
|
481
|
+
}
|
482
|
+
|
483
|
+
newValue.hour(number);
|
484
|
+
this.set(newValue);
|
485
|
+
return this;
|
486
|
+
}
|
487
|
+
}, {
|
488
|
+
key: 'clickClockMinute',
|
489
|
+
value: function clickClockMinute(e) {
|
490
|
+
var newValue = moment(this.value);
|
491
|
+
var number = parseInt(e.currentTarget.getAttribute('data-number'), 10);
|
492
|
+
|
493
|
+
newValue.minute(number);
|
494
|
+
this.set(newValue);
|
495
|
+
return this;
|
496
|
+
}
|
497
|
+
}, {
|
498
|
+
key: 'onChangeDate',
|
499
|
+
value: function onChangeDate(dateString) {
|
500
|
+
var newValue = moment(this.value);
|
501
|
+
|
502
|
+
var _dateString$split = dateString.split('-'),
|
503
|
+
_dateString$split2 = slicedToArray(_dateString$split, 3),
|
504
|
+
year = _dateString$split2[0],
|
505
|
+
month = _dateString$split2[1],
|
506
|
+
date = _dateString$split2[2];
|
507
|
+
|
508
|
+
newValue.set({ year: year, month: month - 1, date: date });
|
509
|
+
|
510
|
+
this.set(newValue);
|
511
|
+
return this;
|
512
|
+
}
|
513
|
+
}, {
|
514
|
+
key: 'mouseInHourClock',
|
515
|
+
value: function mouseInHourClock() {
|
516
|
+
var active = this.$('.js-clock-hours .' + this.options.styles.clockNum + '--active');
|
517
|
+
|
518
|
+
if (active) {
|
519
|
+
active.classList.add('hide-hand');
|
520
|
+
}
|
521
|
+
}
|
522
|
+
}, {
|
523
|
+
key: 'mouseInMinuteClock',
|
524
|
+
value: function mouseInMinuteClock() {
|
525
|
+
var active = this.$('.js-clock-minutes .' + this.options.styles.clockNum + '--active');
|
526
|
+
|
527
|
+
if (active) {
|
528
|
+
active.classList.add('hide-hand');
|
529
|
+
}
|
530
|
+
}
|
531
|
+
}, {
|
532
|
+
key: 'mouseOutHourClock',
|
533
|
+
value: function mouseOutHourClock() {
|
534
|
+
var hideHand = this.$('.js-clock-hours .' + this.options.styles.clockNum + '--active.hide-hand');
|
535
|
+
|
536
|
+
if (hideHand) {
|
537
|
+
hideHand.classList.remove('hide-hand');
|
538
|
+
}
|
539
|
+
}
|
540
|
+
}, {
|
541
|
+
key: 'mouseOutMinuteClock',
|
542
|
+
value: function mouseOutMinuteClock() {
|
543
|
+
var hideHand = this.$('.js-clock-minutes .' + this.options.styles.clockNum + '--active.hide-hand');
|
544
|
+
|
545
|
+
if (hideHand) {
|
546
|
+
hideHand.classList.remove('hide-hand');
|
547
|
+
}
|
548
|
+
}
|
549
|
+
}, {
|
550
|
+
key: 'clickAm',
|
551
|
+
value: function clickAm() {
|
552
|
+
var newValue = moment(this.value);
|
553
|
+
if (this.meridiem === 'pm') {
|
554
|
+
this.meridiem = 'am';
|
555
|
+
newValue.hour(newValue.hour() - 12);
|
556
|
+
}
|
557
|
+
this.set(newValue);
|
558
|
+
return this;
|
559
|
+
}
|
560
|
+
}, {
|
561
|
+
key: 'clickPm',
|
562
|
+
value: function clickPm() {
|
563
|
+
var newValue = moment(this.value);
|
564
|
+
if (this.meridiem === 'am') {
|
565
|
+
this.meridiem = 'pm';
|
566
|
+
newValue.hour(newValue.hour() + 12);
|
567
|
+
}
|
568
|
+
this.set(newValue);
|
569
|
+
return this;
|
570
|
+
}
|
571
|
+
}, {
|
572
|
+
key: 'showHourClock',
|
573
|
+
value: function showHourClock() {
|
574
|
+
this.clickShowClock();
|
575
|
+
this.$('.js-clock-hours').classList.add('active');
|
576
|
+
this.$('.js-clock-minutes').classList.remove('active');
|
577
|
+
this.$('.js-date-hours').classList.add('active');
|
578
|
+
this.$('.js-date-minutes').classList.remove('active');
|
579
|
+
}
|
580
|
+
}, {
|
581
|
+
key: 'showMinuteClock',
|
582
|
+
value: function showMinuteClock() {
|
583
|
+
this.clickShowClock();
|
584
|
+
this.$('.js-clock-hours').classList.remove('active');
|
585
|
+
this.$('.js-clock-minutes').classList.add('active');
|
586
|
+
this.$('.js-date-hours').classList.remove('active');
|
587
|
+
this.$('.js-date-minutes').classList.add('active');
|
588
|
+
}
|
589
|
+
}, {
|
590
|
+
key: 'clickShowCalendar',
|
591
|
+
value: function clickShowCalendar() {
|
592
|
+
this.$('.js-show-calendar').classList.add('is-selected');
|
593
|
+
this.$('.js-show-clock').classList.remove('is-selected');
|
594
|
+
}
|
595
|
+
}, {
|
596
|
+
key: 'clickShowClock',
|
597
|
+
value: function clickShowClock() {
|
598
|
+
this.$('.js-show-clock').classList.add('is-selected');
|
599
|
+
this.$('.js-show-calendar').classList.remove('is-selected');
|
600
|
+
}
|
601
|
+
}, {
|
602
|
+
key: 'data',
|
603
|
+
value: function data(val) {
|
604
|
+
console.warn('MaterialDatetimePicker#data is deprecated and will be removed in a future release. Please use get or set.');
|
605
|
+
return val ? this.set(val) : this.value;
|
606
|
+
}
|
607
|
+
}, {
|
608
|
+
key: 'get',
|
609
|
+
value: function get$$1() {
|
610
|
+
return moment(this.value);
|
611
|
+
}
|
612
|
+
|
613
|
+
// update the picker's date/time value
|
614
|
+
// value: moment
|
615
|
+
// silent: if true, do not fire any events on change
|
616
|
+
|
617
|
+
}, {
|
618
|
+
key: 'set',
|
619
|
+
value: function set$$1(value) {
|
620
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
621
|
+
_ref$silent = _ref.silent,
|
622
|
+
silent = _ref$silent === undefined ? false : _ref$silent;
|
623
|
+
|
624
|
+
var m = moment(value);
|
625
|
+
|
626
|
+
// maintain a list of change events to fire all at once later
|
627
|
+
var evts = [];
|
628
|
+
if (m.date() !== this.value.date() || m.month() !== this.value.month() || m.year() !== this.value.year()) {
|
629
|
+
this.setDate(m);
|
630
|
+
evts.push('change:date');
|
631
|
+
}
|
632
|
+
|
633
|
+
if (m.hour() !== this.value.hour() || m.minutes() !== this.value.minutes()) {
|
634
|
+
this.setTime(m);
|
635
|
+
evts.push('change:time');
|
636
|
+
}
|
637
|
+
|
638
|
+
if (this.options.el) {
|
639
|
+
// if there is an element to fire events on
|
640
|
+
if (this.options.el.tagName === 'INPUT') {
|
641
|
+
// and it is an input element then set the value
|
642
|
+
this.options.el.value = m.format(this.options.format);
|
643
|
+
} else {
|
644
|
+
// or any other element set a data-value attribute
|
645
|
+
this.options.el.setAttribute('data-value', m.format(this.options.format));
|
646
|
+
}
|
647
|
+
}
|
648
|
+
if (evts.length > 0 && !silent) {
|
649
|
+
// fire all the events we've collected
|
650
|
+
this.trigger(['change'].concat(evts).join(' '), this.value, this);
|
651
|
+
}
|
652
|
+
}
|
653
|
+
|
654
|
+
// set the value and header elements to `date`
|
655
|
+
// the calendar will be updated automatically
|
656
|
+
// by rome when clicked
|
657
|
+
|
658
|
+
}, {
|
659
|
+
key: 'setDate',
|
660
|
+
value: function setDate(date) {
|
661
|
+
var m = moment(date);
|
662
|
+
var month = m.format('MMM');
|
663
|
+
var day = m.format('Do');
|
664
|
+
var dayOfWeek = m.format('dddd');
|
665
|
+
var year = m.format('YYYY');
|
666
|
+
|
667
|
+
this.$('.js-day').innerText = dayOfWeek;
|
668
|
+
this.$('.js-date-month').innerText = month + ' ' + year;
|
669
|
+
this.$('.js-date-day').innerText = day;
|
670
|
+
this.value.year(m.year());
|
671
|
+
this.value.month(m.month());
|
672
|
+
this.value.date(m.date());
|
673
|
+
return this;
|
674
|
+
}
|
675
|
+
|
676
|
+
// set the value and header elements to `time`
|
677
|
+
// also update the hands of the clock
|
678
|
+
|
679
|
+
}, {
|
680
|
+
key: 'setTime',
|
681
|
+
value: function setTime(time) {
|
682
|
+
var m = moment(time);
|
683
|
+
var minuteAsInt = Math.round(parseInt(m.format('mm'), 10) / 5) * 5;
|
684
|
+
m.minutes(minuteAsInt);
|
685
|
+
|
686
|
+
var hour = m.format('HH');
|
687
|
+
var minutes = m.format('mm');
|
688
|
+
var hourAsInt = parseInt(hour, 10) % 12;
|
689
|
+
|
690
|
+
var oldActiveHours = this.$('.js-clock-hours .' + this.options.styles.clockNum + '--active');
|
691
|
+
var oldActiveMinutes = this.$('.js-clock-minutes .' + this.options.styles.clockNum + '--active');
|
692
|
+
|
693
|
+
this.$('.js-date-hours').innerText = hour;
|
694
|
+
this.$('.js-date-minutes').innerText = minutes;
|
695
|
+
|
696
|
+
if (oldActiveHours) {
|
697
|
+
oldActiveHours.classList.remove(this.options.styles.clockNum + '--active');
|
698
|
+
}
|
699
|
+
|
700
|
+
if (oldActiveMinutes) {
|
701
|
+
oldActiveMinutes.classList.remove(this.options.styles.clockNum + '--active');
|
702
|
+
}
|
703
|
+
|
704
|
+
this.$('.js-clock-hours .' + this.options.styles.clockNum + '[data-number="' + hourAsInt + '"]').classList.add(this.options.styles.clockNum + '--active');
|
705
|
+
this.$('.js-clock-minutes .' + this.options.styles.clockNum + '[data-number="' + minuteAsInt + '"]').classList.add(this.options.styles.clockNum + '--active');
|
706
|
+
|
707
|
+
this.value.hours(m.hours());
|
708
|
+
this.value.minutes(m.minutes());
|
709
|
+
this.meridiem = this.value.format('a');
|
710
|
+
|
711
|
+
if (this.meridiem === 'pm') {
|
712
|
+
this.amToggleEl.removeAttribute('checked');
|
713
|
+
this.pmToggleEl.setAttribute('checked', 'checked');
|
714
|
+
this.amToggleEl.parentElement.classList.remove('c-datepicker__toggle--checked');
|
715
|
+
this.pmToggleEl.parentElement.classList.add('c-datepicker__toggle--checked');
|
716
|
+
} else {
|
717
|
+
this.pmToggleEl.removeAttribute('checked');
|
718
|
+
this.amToggleEl.setAttribute('checked', 'checked');
|
719
|
+
this.pmToggleEl.parentElement.classList.remove('c-datepicker__toggle--checked');
|
720
|
+
this.amToggleEl.parentElement.classList.add('c-datepicker__toggle--checked');
|
721
|
+
}
|
722
|
+
return this;
|
723
|
+
}
|
724
|
+
}, {
|
725
|
+
key: '$',
|
726
|
+
value: function $(selector) {
|
727
|
+
var els = this.pickerEl.querySelectorAll(selector);
|
728
|
+
return els.length > 1 ? [].concat(toConsumableArray(els)) : els[0];
|
729
|
+
}
|
730
|
+
}]);
|
731
|
+
return DateTimePicker;
|
732
|
+
}(Events);
|
733
|
+
|
734
|
+
function _appendTemplate(parent, template) {
|
735
|
+
var tempEl = document.createElement('div');
|
736
|
+
tempEl.innerHTML = template.trim();
|
737
|
+
parent.appendChild(tempEl.firstChild);
|
738
|
+
return this;
|
739
|
+
}
|
740
|
+
|
741
|
+
return DateTimePicker;
|
742
|
+
|
743
|
+
})));
|
744
|
+
//# sourceMappingURL=material-datetime-picker.js.map
|