super 0.0.8 → 0.0.13
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 +4 -4
- data/.yardopts +0 -7
- data/README.md +53 -79
- data/app/assets/javascripts/super/application.js +2728 -96
- data/app/assets/stylesheets/super/application.css +6405 -0
- data/app/controllers/super/application_controller.rb +19 -13
- data/app/helpers/super/form_builder_helper.rb +25 -0
- data/app/views/layouts/super/application.html.erb +11 -5
- data/app/views/super/application/{_super_schema_display_actions.html.erb → _display_actions.html.erb} +0 -0
- data/app/views/super/application/{_super_schema_display_index.html.erb → _display_index.html.erb} +5 -5
- data/app/views/super/application/_display_rich_text.html.erb +1 -0
- data/app/views/super/application/_display_show.html.erb +8 -0
- data/app/views/super/application/_filter.html.erb +5 -13
- data/app/views/super/application/_filter_type_select.html.erb +9 -19
- data/app/views/super/application/_filter_type_text.html.erb +7 -11
- data/app/views/super/application/_filter_type_timestamp.html.erb +6 -17
- data/app/views/super/application/_form.html.erb +15 -0
- data/app/views/super/application/_form_field__destroy.html.erb +1 -9
- data/app/views/super/application/_form_field_checkbox.html.erb +1 -0
- data/app/views/super/application/_form_field_flatpickr_date.html.erb +8 -0
- data/app/views/super/application/_form_field_flatpickr_datetime.html.erb +8 -0
- data/app/views/super/application/_form_field_flatpickr_time.html.erb +8 -0
- data/app/views/super/application/_form_field_rich_text_area.html.erb +1 -0
- data/app/views/super/application/_form_field_select.html.erb +1 -23
- data/app/views/super/application/_form_field_text.html.erb +1 -13
- data/app/views/super/application/{_super_layout.html.erb → _layout.html.erb} +7 -7
- data/app/views/super/application/{_super_pagination.html.erb → _pagination.html.erb} +1 -1
- data/app/views/super/application/{_super_panel.html.erb → _panel.html.erb} +2 -2
- data/app/views/super/application/_query.html.erb +18 -0
- data/app/views/super/application/_sort.html.erb +18 -0
- data/app/views/super/application/_sort_expression.html.erb +25 -0
- data/app/views/super/application/edit.html.erb +1 -0
- data/app/views/super/application/index.html.erb +1 -0
- data/app/views/super/application/new.html.erb +1 -0
- data/app/views/super/application/show.html.erb +1 -0
- data/app/views/super/feather/README.md +1 -0
- data/app/views/super/feather/_x.html +15 -0
- data/config/routes.rb +2 -0
- data/docs/cheat.md +8 -8
- data/frontend/super-frontend/dist/application.css +6405 -0
- data/frontend/super-frontend/dist/application.js +2728 -96
- data/lib/generators/super/action_text/USAGE +23 -0
- data/lib/generators/super/action_text/action_text_generator.rb +32 -0
- data/lib/generators/super/action_text/templates/pack_super_action_text.css +23 -0
- data/lib/generators/super/action_text/templates/pack_super_action_text.js +4 -0
- data/lib/generators/super/install/install_generator.rb +18 -7
- data/lib/generators/super/install/templates/base_controller.rb.tt +9 -1
- data/lib/generators/super/install/templates/initializer.rb.tt +9 -2
- data/lib/generators/super/resource/resource_generator.rb +107 -30
- data/lib/generators/super/resource/templates/resources_controller.rb.tt +3 -9
- data/lib/generators/super/webpacker/USAGE +5 -4
- data/lib/generators/super/webpacker/webpacker_generator.rb +2 -0
- data/lib/super.rb +7 -1
- data/lib/super/action_inquirer.rb +2 -0
- data/lib/super/assets.rb +6 -0
- data/lib/super/client_error.rb +2 -0
- data/lib/super/compatibility.rb +2 -0
- data/lib/super/configuration.rb +16 -24
- data/lib/super/controls.rb +11 -2
- data/lib/super/controls/optional.rb +35 -1
- data/lib/super/controls/steps.rb +27 -35
- data/lib/super/controls/view.rb +55 -0
- data/lib/super/display.rb +29 -13
- data/lib/super/display/guesser.rb +4 -0
- data/lib/super/display/schema_types.rb +74 -28
- data/lib/super/engine.rb +4 -0
- data/lib/super/error.rb +21 -0
- data/lib/super/filter.rb +2 -0
- data/lib/super/filter/form_object.rb +5 -8
- data/lib/super/filter/guesser.rb +2 -0
- data/lib/super/filter/operator.rb +2 -0
- data/lib/super/filter/schema_types.rb +2 -0
- data/lib/super/form.rb +3 -1
- data/lib/super/form/builder.rb +289 -39
- data/lib/super/form/guesser.rb +12 -1
- data/lib/super/form/inline_errors.rb +28 -0
- data/lib/super/form/schema_types.rb +25 -0
- data/lib/super/form/strong_params.rb +2 -0
- data/lib/super/layout.rb +3 -1
- data/lib/super/link.rb +7 -0
- data/lib/super/navigation/automatic.rb +4 -2
- data/lib/super/pagination.rb +3 -1
- data/lib/super/panel.rb +3 -1
- data/lib/super/partial.rb +2 -0
- data/lib/super/partial/resolving.rb +2 -0
- data/lib/super/plugin.rb +2 -0
- data/lib/super/query/form_object.rb +48 -0
- data/lib/super/schema.rb +2 -0
- data/lib/super/schema/common.rb +2 -0
- data/lib/super/schema/guesser.rb +2 -0
- data/lib/super/sort.rb +110 -0
- data/lib/super/useful/builder.rb +25 -0
- data/lib/super/useful/enum.rb +63 -0
- data/lib/super/version.rb +3 -1
- data/lib/super/view_helper.rb +2 -19
- metadata +56 -38
- data/CONTRIBUTING.md +0 -56
- data/Rakefile +0 -34
- data/STABILITY.md +0 -50
- data/app/views/super/application/_form_inline_errors.html.erb +0 -10
- data/app/views/super/application/_super_schema_display_show.html.erb +0 -8
- data/app/views/super/application/_super_schema_form.html.erb +0 -15
- data/docs/README.md +0 -6
- data/docs/faq.md +0 -44
- data/docs/quick_start.md +0 -45
- data/docs/webpacker.md +0 -17
- data/docs/yard_customizations.rb +0 -41
- data/frontend/super-frontend/build.js +0 -36
- data/frontend/super-frontend/package.json +0 -21
- data/frontend/super-frontend/postcss.config.js +0 -6
- data/frontend/super-frontend/src/javascripts/super/application.ts +0 -15
- data/frontend/super-frontend/src/javascripts/super/apply_template_controller.ts +0 -19
- data/frontend/super-frontend/src/javascripts/super/rails__ujs.d.ts +0 -1
- data/frontend/super-frontend/src/javascripts/super/toggle_pending_destruction_controller.ts +0 -15
- data/frontend/super-frontend/src/stylesheets/super/application.css +0 -77
- data/frontend/super-frontend/tailwind.config.js +0 -15
- data/frontend/super-frontend/tsconfig.json +0 -13
- data/frontend/super-frontend/yarn.lock +0 -5448
- data/lib/super/controls/required.rb +0 -13
- data/lib/super/filter/plugin.rb +0 -47
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6991cb6e58516e762e5a7919bdf1c13154a0d1c2aaca8298f7d04b8cc06dda1e
|
|
4
|
+
data.tar.gz: d09bec5c0812b7546c519e3c8ee414378c07352843f2fa9787b068c68786b0ce
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8c3339e689d591856fe0a977ae1849b5c285bf1069edae98a272d7b94f8d37b576918f5e2c47fa3a3a274dcb67f93405c4a333ca20f905140dab1e432c8fcca0
|
|
7
|
+
data.tar.gz: 6f02e2cb0d4307fd9b370df617e73a3620e59b9d063eb6027b6b2800241671b792140706467cce79fddd87c526446051c177d9e1fe9aac09395362484b551bda
|
data/.yardopts
CHANGED
data/README.md
CHANGED
|
@@ -2,100 +2,79 @@
|
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|
[][gem]
|
|
5
|
-
[][demo]
|
|
6
|
+
[][docs]
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
Super is an admin framework for Ruby on Rails applications. Super helps you make
|
|
9
|
-
|
|
10
|
-
app that make it great.
|
|
10
|
+
admin pages quickly and provides a powerful interface for admins to use.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
It's distinguishing feature is that it's easy for you to maintain in your
|
|
13
|
+
application. It does this by having zero dependencies—this lets you update your
|
|
14
|
+
app's dependencies without worrying about breaking your admin pages, and vice
|
|
15
|
+
versa, update your admin pages without breaking your app.
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* Preferring plain Ruby objects rather than requiring DSLs
|
|
17
|
-
* Supporting a wide range of Ruby and Rails versions
|
|
18
|
-
* Having zero dependencies
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Super has no dependencies. That means when you install Super, only Super gets
|
|
22
|
-
added to your `Gemfile.lock`. This leads to many benefits:
|
|
23
|
-
|
|
24
|
-
* Super doesn't require common Rails libraries like [Kaminari][Kaminari],
|
|
25
|
-
[Devise][Devise], or [Sass][Sass], so it'll never conflict with the libraries
|
|
26
|
-
you have installed. If you want to upgrade Super, you won't have to upgrade
|
|
27
|
-
any of your other gems. And if you want to upgrade your other gems, you won't
|
|
28
|
-
have to upgrade Super! This will greatly reduce your maintenance burden since
|
|
29
|
-
your admin framework won't dictate which libraries and which versions your
|
|
30
|
-
application uses.
|
|
31
|
-
* All code has the possibility of bugs and security issues, whether they're
|
|
32
|
-
written by you or by others. Having fewer dependencies can reduce the risk of
|
|
33
|
-
introducing problems into your application.
|
|
17
|
+
Note: There may be lots of breaking changes since Super is still fairly young.
|
|
18
|
+
See the [stability doc](./STABILITY.md) for an idea of what might be changed.
|
|
34
19
|
|
|
35
20
|
|
|
36
21
|
## Features
|
|
37
22
|
|
|
38
|
-
*
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
*
|
|
42
|
-
*
|
|
23
|
+
* Responsive and mobile-friendly web pages
|
|
24
|
+
* Automatic controllers that work without any configuration
|
|
25
|
+
* Configurable forms
|
|
26
|
+
* Supports nested attributes `accepts_nested_attributes_for`
|
|
27
|
+
* New and edit forms can be totally different
|
|
43
28
|
* Configurable display (index and show tables)
|
|
44
|
-
*
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
If you need a ton of features, I'd probably suggest looking at ActiveAdmin. It
|
|
59
|
-
relies pretty heavily on DSLs but is pretty flexible and popular.
|
|
60
|
-
|
|
61
|
-
I like Administrate as well. I found that it doesn't have quite as many features
|
|
62
|
-
as ActiveAdmin, but it's nice and feels like developing a normal Rails app.
|
|
63
|
-
There's no DSL.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
## Paid editions
|
|
67
|
-
|
|
68
|
-
If you have additional requirements, there are some paid editions to consider:
|
|
29
|
+
* Supports showing computed values that aren't backed by database fields
|
|
30
|
+
* Advanced filtering/search
|
|
31
|
+
* Compatible with Sprockets and Webpacker
|
|
32
|
+
* Pre-built frontend assets. Super doesn't depend on Sass, PostCSS, Babel, etc
|
|
33
|
+
* Carefully chosen, vendored frontend assets
|
|
34
|
+
* Stimulus JS v2
|
|
35
|
+
* Tailwind CSS v1
|
|
36
|
+
* Rails UJS
|
|
37
|
+
* Flatpickr
|
|
38
|
+
* Builds on top of standard Rails controllers and ERB views
|
|
39
|
+
* Plenty of escape hatches for those very customized pages
|
|
40
|
+
* No DSL. Configure your admin pages by setting methods and returning objects
|
|
41
|
+
* Supports Rails 5.0+, 6.0+
|
|
42
|
+
* Supports Ruby 2.3+, 3.0+
|
|
69
43
|
|
|
70
|
-
**Super Premium** provides:
|
|
71
44
|
|
|
72
|
-
|
|
73
|
-
|
|
45
|
+
See the [demo][demo] and its [source][demo_source] for an example of some of its
|
|
46
|
+
features. See the [docs][docs] for a walkthrough.
|
|
74
47
|
|
|
75
|
-
**Super Professional** provides everything in Premium and:
|
|
76
48
|
|
|
77
|
-
|
|
78
|
-
* An LGPL exemption
|
|
49
|
+
## Quick start
|
|
79
50
|
|
|
80
|
-
|
|
81
|
-
[newsletter][newsletter] to be notified of its availability and for brief,
|
|
82
|
-
occasional updates to Super.
|
|
51
|
+
Add this line anywhere in your Gemfile:
|
|
83
52
|
|
|
53
|
+
```ruby
|
|
54
|
+
gem "super"
|
|
55
|
+
```
|
|
84
56
|
|
|
85
|
-
|
|
57
|
+
Then install Super by running:
|
|
86
58
|
|
|
87
|
-
|
|
88
|
-
|
|
59
|
+
```
|
|
60
|
+
bundle install
|
|
61
|
+
bin/rails g super:install
|
|
62
|
+
```
|
|
89
63
|
|
|
64
|
+
You can create admin pages by running this for all the models you want:
|
|
90
65
|
|
|
91
|
-
|
|
66
|
+
```
|
|
67
|
+
bin/rails g super:resource ModelName
|
|
68
|
+
```
|
|
92
69
|
|
|
93
|
-
See [Quick start](./docs/quick_start.md)
|
|
94
70
|
|
|
71
|
+
## Super doesn't fit my needs. What are some alternatives?
|
|
95
72
|
|
|
96
|
-
|
|
73
|
+
[ActiveAdmin](https://github.com/activeadmin/activeadmin) is great if you need
|
|
74
|
+
lots of features. It relies heavily on DSLs but is flexible and popular.
|
|
97
75
|
|
|
98
|
-
|
|
76
|
+
[Administrate](https://github.com/thoughtbot/administrate) doesn't have as many
|
|
77
|
+
features as ActiveAdmin, but it feels like developing a normal Rails app.
|
|
99
78
|
|
|
100
79
|
|
|
101
80
|
## Contributing
|
|
@@ -109,12 +88,7 @@ The gem is available under the terms of the [GNU LGPLv3](./LICENSE).
|
|
|
109
88
|
|
|
110
89
|
|
|
111
90
|
[gem]: https://rubygems.org/gems/super
|
|
112
|
-
[
|
|
113
|
-
[
|
|
114
|
-
[
|
|
115
|
-
[
|
|
116
|
-
[Devise]: https://github.com/heartcombo/devise
|
|
117
|
-
[Sass]: https://github.com/sass/sassc-ruby
|
|
118
|
-
[newsletter]: https://tinyletter.com/zachahn
|
|
119
|
-
[super_demo]: https://demo-super.herokuapp.com/admin/members
|
|
120
|
-
[super_demo_source]: https://github.com/zachahn/super_demo
|
|
91
|
+
[discussions]: https://github.com/zachahn/super/discussions
|
|
92
|
+
[docs]: https://superadministration.github.io/
|
|
93
|
+
[demo]: https://demo-super.herokuapp.com/admin/members
|
|
94
|
+
[demo_source]: https://github.com/zachahn/super_demo
|
|
@@ -4271,154 +4271,2786 @@ Object.keys(_core).forEach(function (key) {
|
|
|
4271
4271
|
}
|
|
4272
4272
|
});
|
|
4273
4273
|
});
|
|
4274
|
-
},{"@stimulus/core":"../node_modules/@stimulus/core/dist/index.js"}],"javascripts/super/apply_template_controller.
|
|
4274
|
+
},{"@stimulus/core":"../node_modules/@stimulus/core/dist/index.js"}],"javascripts/super/apply_template_controller.js":[function(require,module,exports) {
|
|
4275
4275
|
"use strict";
|
|
4276
4276
|
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4277
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4278
|
+
value: true
|
|
4279
|
+
});
|
|
4280
|
+
exports.default = void 0;
|
|
4281
|
+
|
|
4282
|
+
var _stimulus = require("stimulus");
|
|
4283
|
+
|
|
4284
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4285
|
+
|
|
4286
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4287
|
+
|
|
4288
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
4289
|
+
|
|
4290
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
4291
|
+
|
|
4292
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
4293
|
+
|
|
4294
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
4295
|
+
|
|
4296
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
4297
|
+
|
|
4298
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
4299
|
+
|
|
4300
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
4301
|
+
|
|
4302
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
4303
|
+
|
|
4304
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
4305
|
+
|
|
4306
|
+
var _default = /*#__PURE__*/function (_Controller) {
|
|
4307
|
+
_inherits(_default, _Controller);
|
|
4308
|
+
|
|
4309
|
+
var _super = _createSuper(_default);
|
|
4310
|
+
|
|
4311
|
+
function _default() {
|
|
4312
|
+
_classCallCheck(this, _default);
|
|
4313
|
+
|
|
4314
|
+
return _super.apply(this, arguments);
|
|
4315
|
+
}
|
|
4316
|
+
|
|
4317
|
+
_createClass(_default, [{
|
|
4318
|
+
key: "call",
|
|
4319
|
+
value: function call(event) {
|
|
4320
|
+
event.preventDefault();
|
|
4321
|
+
var unixtime = new Date().getTime();
|
|
4322
|
+
var content = this.templateTarget.innerHTML.replace(/TEMPLATEINDEX/g, unixtime.toString());
|
|
4323
|
+
this.templateTarget.insertAdjacentHTML("beforebegin", content);
|
|
4324
|
+
}
|
|
4325
|
+
}], [{
|
|
4326
|
+
key: "targets",
|
|
4327
|
+
get: function get() {
|
|
4328
|
+
return ["template"];
|
|
4329
|
+
}
|
|
4330
|
+
}]);
|
|
4331
|
+
|
|
4332
|
+
return _default;
|
|
4333
|
+
}(_stimulus.Controller);
|
|
4334
|
+
|
|
4335
|
+
exports.default = _default;
|
|
4336
|
+
},{"stimulus":"../node_modules/stimulus/index.js"}],"javascripts/super/clean_filter_param_controller.js":[function(require,module,exports) {
|
|
4337
|
+
"use strict";
|
|
4338
|
+
|
|
4339
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4340
|
+
value: true
|
|
4341
|
+
});
|
|
4342
|
+
exports.default = void 0;
|
|
4343
|
+
|
|
4344
|
+
var _stimulus = require("stimulus");
|
|
4345
|
+
|
|
4346
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4347
|
+
|
|
4348
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4349
|
+
|
|
4350
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
4351
|
+
|
|
4352
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
4353
|
+
|
|
4354
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
4355
|
+
|
|
4356
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
4357
|
+
|
|
4358
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
4359
|
+
|
|
4360
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
4361
|
+
|
|
4362
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
4363
|
+
|
|
4364
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
4365
|
+
|
|
4366
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
4367
|
+
|
|
4368
|
+
var _default = /*#__PURE__*/function (_Controller) {
|
|
4369
|
+
_inherits(_default, _Controller);
|
|
4370
|
+
|
|
4371
|
+
var _super = _createSuper(_default);
|
|
4372
|
+
|
|
4373
|
+
function _default() {
|
|
4374
|
+
_classCallCheck(this, _default);
|
|
4375
|
+
|
|
4376
|
+
return _super.apply(this, arguments);
|
|
4377
|
+
}
|
|
4378
|
+
|
|
4379
|
+
_createClass(_default, [{
|
|
4380
|
+
key: "call",
|
|
4381
|
+
value: function call() {
|
|
4382
|
+
var allControlsBlank = this.controlTargets.every(function (el) {
|
|
4383
|
+
return el.value === "";
|
|
4384
|
+
});
|
|
4385
|
+
|
|
4386
|
+
if (!allControlsBlank) {
|
|
4387
|
+
return;
|
|
4388
|
+
}
|
|
4389
|
+
|
|
4390
|
+
this.candidateTargets.forEach(function (el) {
|
|
4391
|
+
el.disabled = true;
|
|
4392
|
+
});
|
|
4393
|
+
}
|
|
4394
|
+
}], [{
|
|
4395
|
+
key: "targets",
|
|
4396
|
+
get: function get() {
|
|
4397
|
+
return ["candidate", "control"];
|
|
4398
|
+
}
|
|
4399
|
+
}]);
|
|
4400
|
+
|
|
4401
|
+
return _default;
|
|
4402
|
+
}(_stimulus.Controller);
|
|
4403
|
+
|
|
4404
|
+
exports.default = _default;
|
|
4405
|
+
},{"stimulus":"../node_modules/stimulus/index.js"}],"javascripts/super/clean_filter_params_controller.js":[function(require,module,exports) {
|
|
4406
|
+
"use strict";
|
|
4407
|
+
|
|
4408
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4409
|
+
value: true
|
|
4410
|
+
});
|
|
4411
|
+
exports.default = void 0;
|
|
4412
|
+
|
|
4413
|
+
var _stimulus = require("stimulus");
|
|
4414
|
+
|
|
4415
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4416
|
+
|
|
4417
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4418
|
+
|
|
4419
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
4420
|
+
|
|
4421
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
4422
|
+
|
|
4423
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
4424
|
+
|
|
4425
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
4426
|
+
|
|
4427
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
4428
|
+
|
|
4429
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
4430
|
+
|
|
4431
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
4432
|
+
|
|
4433
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
4434
|
+
|
|
4435
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
4436
|
+
|
|
4437
|
+
var _default = /*#__PURE__*/function (_Controller) {
|
|
4438
|
+
_inherits(_default, _Controller);
|
|
4439
|
+
|
|
4440
|
+
var _super = _createSuper(_default);
|
|
4441
|
+
|
|
4442
|
+
function _default() {
|
|
4443
|
+
_classCallCheck(this, _default);
|
|
4444
|
+
|
|
4445
|
+
return _super.apply(this, arguments);
|
|
4446
|
+
}
|
|
4447
|
+
|
|
4448
|
+
_createClass(_default, [{
|
|
4449
|
+
key: "call",
|
|
4450
|
+
value: function call(event) {
|
|
4451
|
+
this.element.querySelectorAll("[data-controller='clean-filter-param']").forEach(function (el) {
|
|
4452
|
+
var controller = this.application.getControllerForElementAndIdentifier(el, "clean-filter-param");
|
|
4453
|
+
controller.call();
|
|
4454
|
+
}.bind(this));
|
|
4455
|
+
}
|
|
4456
|
+
}]);
|
|
4457
|
+
|
|
4458
|
+
return _default;
|
|
4459
|
+
}(_stimulus.Controller);
|
|
4460
|
+
|
|
4461
|
+
exports.default = _default;
|
|
4462
|
+
},{"stimulus":"../node_modules/stimulus/index.js"}],"javascripts/super/delete_controller.js":[function(require,module,exports) {
|
|
4463
|
+
"use strict";
|
|
4464
|
+
|
|
4465
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4466
|
+
value: true
|
|
4467
|
+
});
|
|
4468
|
+
exports.default = void 0;
|
|
4469
|
+
|
|
4470
|
+
var _stimulus = require("stimulus");
|
|
4471
|
+
|
|
4472
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4473
|
+
|
|
4474
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4475
|
+
|
|
4476
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
4477
|
+
|
|
4478
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
4479
|
+
|
|
4480
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
4481
|
+
|
|
4482
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
4483
|
+
|
|
4484
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
4485
|
+
|
|
4486
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
4487
|
+
|
|
4488
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
4489
|
+
|
|
4490
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
4491
|
+
|
|
4492
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
4493
|
+
|
|
4494
|
+
var _default = /*#__PURE__*/function (_Controller) {
|
|
4495
|
+
_inherits(_default, _Controller);
|
|
4496
|
+
|
|
4497
|
+
var _super = _createSuper(_default);
|
|
4498
|
+
|
|
4499
|
+
function _default() {
|
|
4500
|
+
_classCallCheck(this, _default);
|
|
4501
|
+
|
|
4502
|
+
return _super.apply(this, arguments);
|
|
4503
|
+
}
|
|
4504
|
+
|
|
4505
|
+
_createClass(_default, [{
|
|
4506
|
+
key: "call",
|
|
4507
|
+
value: function call(event) {
|
|
4508
|
+
event.preventDefault();
|
|
4509
|
+
this.element.remove();
|
|
4510
|
+
}
|
|
4511
|
+
}]);
|
|
4512
|
+
|
|
4513
|
+
return _default;
|
|
4514
|
+
}(_stimulus.Controller);
|
|
4515
|
+
|
|
4516
|
+
exports.default = _default;
|
|
4517
|
+
},{"stimulus":"../node_modules/stimulus/index.js"}],"../node_modules/flatpickr/dist/esm/types/options.js":[function(require,module,exports) {
|
|
4518
|
+
"use strict";
|
|
4519
|
+
|
|
4520
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4521
|
+
value: true
|
|
4522
|
+
});
|
|
4523
|
+
exports.defaults = exports.HOOKS = void 0;
|
|
4524
|
+
const HOOKS = ["onChange", "onClose", "onDayCreate", "onDestroy", "onKeyDown", "onMonthChange", "onOpen", "onParseConfig", "onReady", "onValueUpdate", "onYearChange", "onPreCalendarPosition"];
|
|
4525
|
+
exports.HOOKS = HOOKS;
|
|
4526
|
+
const defaults = {
|
|
4527
|
+
_disable: [],
|
|
4528
|
+
allowInput: false,
|
|
4529
|
+
allowInvalidPreload: false,
|
|
4530
|
+
altFormat: "F j, Y",
|
|
4531
|
+
altInput: false,
|
|
4532
|
+
altInputClass: "form-control input",
|
|
4533
|
+
animate: typeof window === "object" && window.navigator.userAgent.indexOf("MSIE") === -1,
|
|
4534
|
+
ariaDateFormat: "F j, Y",
|
|
4535
|
+
autoFillDefaultTime: true,
|
|
4536
|
+
clickOpens: true,
|
|
4537
|
+
closeOnSelect: true,
|
|
4538
|
+
conjunction: ", ",
|
|
4539
|
+
dateFormat: "Y-m-d",
|
|
4540
|
+
defaultHour: 12,
|
|
4541
|
+
defaultMinute: 0,
|
|
4542
|
+
defaultSeconds: 0,
|
|
4543
|
+
disable: [],
|
|
4544
|
+
disableMobile: false,
|
|
4545
|
+
enableSeconds: false,
|
|
4546
|
+
enableTime: false,
|
|
4547
|
+
errorHandler: err => typeof console !== "undefined" && console.warn(err),
|
|
4548
|
+
getWeek: givenDate => {
|
|
4549
|
+
const date = new Date(givenDate.getTime());
|
|
4550
|
+
date.setHours(0, 0, 0, 0);
|
|
4551
|
+
date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7);
|
|
4552
|
+
var week1 = new Date(date.getFullYear(), 0, 4);
|
|
4553
|
+
return 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + (week1.getDay() + 6) % 7) / 7);
|
|
4554
|
+
},
|
|
4555
|
+
hourIncrement: 1,
|
|
4556
|
+
ignoredFocusElements: [],
|
|
4557
|
+
inline: false,
|
|
4558
|
+
locale: "default",
|
|
4559
|
+
minuteIncrement: 5,
|
|
4560
|
+
mode: "single",
|
|
4561
|
+
monthSelectorType: "dropdown",
|
|
4562
|
+
nextArrow: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",
|
|
4563
|
+
noCalendar: false,
|
|
4564
|
+
now: new Date(),
|
|
4565
|
+
onChange: [],
|
|
4566
|
+
onClose: [],
|
|
4567
|
+
onDayCreate: [],
|
|
4568
|
+
onDestroy: [],
|
|
4569
|
+
onKeyDown: [],
|
|
4570
|
+
onMonthChange: [],
|
|
4571
|
+
onOpen: [],
|
|
4572
|
+
onParseConfig: [],
|
|
4573
|
+
onReady: [],
|
|
4574
|
+
onValueUpdate: [],
|
|
4575
|
+
onYearChange: [],
|
|
4576
|
+
onPreCalendarPosition: [],
|
|
4577
|
+
plugins: [],
|
|
4578
|
+
position: "auto",
|
|
4579
|
+
positionElement: undefined,
|
|
4580
|
+
prevArrow: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",
|
|
4581
|
+
shorthandCurrentMonth: false,
|
|
4582
|
+
showMonths: 1,
|
|
4583
|
+
static: false,
|
|
4584
|
+
time_24hr: false,
|
|
4585
|
+
weekNumbers: false,
|
|
4586
|
+
wrap: false
|
|
4587
|
+
};
|
|
4588
|
+
exports.defaults = defaults;
|
|
4589
|
+
},{}],"../node_modules/flatpickr/dist/esm/l10n/default.js":[function(require,module,exports) {
|
|
4590
|
+
"use strict";
|
|
4591
|
+
|
|
4592
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4593
|
+
value: true
|
|
4594
|
+
});
|
|
4595
|
+
exports.default = exports.english = void 0;
|
|
4596
|
+
const english = {
|
|
4597
|
+
weekdays: {
|
|
4598
|
+
shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
4599
|
+
longhand: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
|
|
4600
|
+
},
|
|
4601
|
+
months: {
|
|
4602
|
+
shorthand: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
|
|
4603
|
+
longhand: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
|
|
4604
|
+
},
|
|
4605
|
+
daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
|
|
4606
|
+
firstDayOfWeek: 0,
|
|
4607
|
+
ordinal: nth => {
|
|
4608
|
+
const s = nth % 100;
|
|
4609
|
+
if (s > 3 && s < 21) return "th";
|
|
4610
|
+
|
|
4611
|
+
switch (s % 10) {
|
|
4612
|
+
case 1:
|
|
4613
|
+
return "st";
|
|
4614
|
+
|
|
4615
|
+
case 2:
|
|
4616
|
+
return "nd";
|
|
4617
|
+
|
|
4618
|
+
case 3:
|
|
4619
|
+
return "rd";
|
|
4620
|
+
|
|
4621
|
+
default:
|
|
4622
|
+
return "th";
|
|
4623
|
+
}
|
|
4624
|
+
},
|
|
4625
|
+
rangeSeparator: " to ",
|
|
4626
|
+
weekAbbreviation: "Wk",
|
|
4627
|
+
scrollTitle: "Scroll to increment",
|
|
4628
|
+
toggleTitle: "Click to toggle",
|
|
4629
|
+
amPM: ["AM", "PM"],
|
|
4630
|
+
yearAriaLabel: "Year",
|
|
4631
|
+
monthAriaLabel: "Month",
|
|
4632
|
+
hourAriaLabel: "Hour",
|
|
4633
|
+
minuteAriaLabel: "Minute",
|
|
4634
|
+
time_24hr: false
|
|
4635
|
+
};
|
|
4636
|
+
exports.english = english;
|
|
4637
|
+
var _default = english;
|
|
4638
|
+
exports.default = _default;
|
|
4639
|
+
},{}],"../node_modules/flatpickr/dist/esm/utils/index.js":[function(require,module,exports) {
|
|
4640
|
+
"use strict";
|
|
4641
|
+
|
|
4642
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4643
|
+
value: true
|
|
4644
|
+
});
|
|
4645
|
+
exports.debounce = debounce;
|
|
4646
|
+
exports.arrayify = exports.int = exports.pad = void 0;
|
|
4647
|
+
|
|
4648
|
+
const pad = (number, length = 2) => `000${number}`.slice(length * -1);
|
|
4649
|
+
|
|
4650
|
+
exports.pad = pad;
|
|
4651
|
+
|
|
4652
|
+
const int = bool => bool === true ? 1 : 0;
|
|
4653
|
+
|
|
4654
|
+
exports.int = int;
|
|
4655
|
+
|
|
4656
|
+
function debounce(fn, wait) {
|
|
4657
|
+
let t;
|
|
4658
|
+
return function () {
|
|
4659
|
+
clearTimeout(t);
|
|
4660
|
+
t = setTimeout(() => fn.apply(this, arguments), wait);
|
|
4661
|
+
};
|
|
4662
|
+
}
|
|
4663
|
+
|
|
4664
|
+
const arrayify = obj => obj instanceof Array ? obj : [obj];
|
|
4665
|
+
|
|
4666
|
+
exports.arrayify = arrayify;
|
|
4667
|
+
},{}],"../node_modules/flatpickr/dist/esm/utils/dom.js":[function(require,module,exports) {
|
|
4668
|
+
"use strict";
|
|
4669
|
+
|
|
4670
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4671
|
+
value: true
|
|
4672
|
+
});
|
|
4673
|
+
exports.toggleClass = toggleClass;
|
|
4674
|
+
exports.createElement = createElement;
|
|
4675
|
+
exports.clearNode = clearNode;
|
|
4676
|
+
exports.findParent = findParent;
|
|
4677
|
+
exports.createNumberInput = createNumberInput;
|
|
4678
|
+
exports.getEventTarget = getEventTarget;
|
|
4679
|
+
|
|
4680
|
+
function toggleClass(elem, className, bool) {
|
|
4681
|
+
if (bool === true) return elem.classList.add(className);
|
|
4682
|
+
elem.classList.remove(className);
|
|
4683
|
+
}
|
|
4684
|
+
|
|
4685
|
+
function createElement(tag, className, content) {
|
|
4686
|
+
const e = window.document.createElement(tag);
|
|
4687
|
+
className = className || "";
|
|
4688
|
+
content = content || "";
|
|
4689
|
+
e.className = className;
|
|
4690
|
+
if (content !== undefined) e.textContent = content;
|
|
4691
|
+
return e;
|
|
4692
|
+
}
|
|
4693
|
+
|
|
4694
|
+
function clearNode(node) {
|
|
4695
|
+
while (node.firstChild) node.removeChild(node.firstChild);
|
|
4696
|
+
}
|
|
4697
|
+
|
|
4698
|
+
function findParent(node, condition) {
|
|
4699
|
+
if (condition(node)) return node;else if (node.parentNode) return findParent(node.parentNode, condition);
|
|
4700
|
+
return undefined;
|
|
4701
|
+
}
|
|
4702
|
+
|
|
4703
|
+
function createNumberInput(inputClassName, opts) {
|
|
4704
|
+
const wrapper = createElement("div", "numInputWrapper"),
|
|
4705
|
+
numInput = createElement("input", "numInput " + inputClassName),
|
|
4706
|
+
arrowUp = createElement("span", "arrowUp"),
|
|
4707
|
+
arrowDown = createElement("span", "arrowDown");
|
|
4708
|
+
|
|
4709
|
+
if (navigator.userAgent.indexOf("MSIE 9.0") === -1) {
|
|
4710
|
+
numInput.type = "number";
|
|
4711
|
+
} else {
|
|
4712
|
+
numInput.type = "text";
|
|
4713
|
+
numInput.pattern = "\\d*";
|
|
4714
|
+
}
|
|
4715
|
+
|
|
4716
|
+
if (opts !== undefined) for (const key in opts) numInput.setAttribute(key, opts[key]);
|
|
4717
|
+
wrapper.appendChild(numInput);
|
|
4718
|
+
wrapper.appendChild(arrowUp);
|
|
4719
|
+
wrapper.appendChild(arrowDown);
|
|
4720
|
+
return wrapper;
|
|
4721
|
+
}
|
|
4722
|
+
|
|
4723
|
+
function getEventTarget(event) {
|
|
4724
|
+
try {
|
|
4725
|
+
if (typeof event.composedPath === "function") {
|
|
4726
|
+
const path = event.composedPath();
|
|
4727
|
+
return path[0];
|
|
4728
|
+
}
|
|
4729
|
+
|
|
4730
|
+
return event.target;
|
|
4731
|
+
} catch (error) {
|
|
4732
|
+
return event.target;
|
|
4733
|
+
}
|
|
4734
|
+
}
|
|
4735
|
+
},{}],"../node_modules/flatpickr/dist/esm/utils/formatting.js":[function(require,module,exports) {
|
|
4736
|
+
"use strict";
|
|
4737
|
+
|
|
4738
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4739
|
+
value: true
|
|
4740
|
+
});
|
|
4741
|
+
exports.formats = exports.tokenRegex = exports.revFormat = exports.monthToStr = void 0;
|
|
4742
|
+
|
|
4743
|
+
var _utils = require("../utils");
|
|
4744
|
+
|
|
4745
|
+
const doNothing = () => undefined;
|
|
4746
|
+
|
|
4747
|
+
const monthToStr = (monthNumber, shorthand, locale) => locale.months[shorthand ? "shorthand" : "longhand"][monthNumber];
|
|
4748
|
+
|
|
4749
|
+
exports.monthToStr = monthToStr;
|
|
4750
|
+
const revFormat = {
|
|
4751
|
+
D: doNothing,
|
|
4752
|
+
F: function (dateObj, monthName, locale) {
|
|
4753
|
+
dateObj.setMonth(locale.months.longhand.indexOf(monthName));
|
|
4754
|
+
},
|
|
4755
|
+
G: (dateObj, hour) => {
|
|
4756
|
+
dateObj.setHours(parseFloat(hour));
|
|
4757
|
+
},
|
|
4758
|
+
H: (dateObj, hour) => {
|
|
4759
|
+
dateObj.setHours(parseFloat(hour));
|
|
4760
|
+
},
|
|
4761
|
+
J: (dateObj, day) => {
|
|
4762
|
+
dateObj.setDate(parseFloat(day));
|
|
4763
|
+
},
|
|
4764
|
+
K: (dateObj, amPM, locale) => {
|
|
4765
|
+
dateObj.setHours(dateObj.getHours() % 12 + 12 * (0, _utils.int)(new RegExp(locale.amPM[1], "i").test(amPM)));
|
|
4766
|
+
},
|
|
4767
|
+
M: function (dateObj, shortMonth, locale) {
|
|
4768
|
+
dateObj.setMonth(locale.months.shorthand.indexOf(shortMonth));
|
|
4769
|
+
},
|
|
4770
|
+
S: (dateObj, seconds) => {
|
|
4771
|
+
dateObj.setSeconds(parseFloat(seconds));
|
|
4772
|
+
},
|
|
4773
|
+
U: (_, unixSeconds) => new Date(parseFloat(unixSeconds) * 1000),
|
|
4774
|
+
W: function (dateObj, weekNum, locale) {
|
|
4775
|
+
const weekNumber = parseInt(weekNum);
|
|
4776
|
+
const date = new Date(dateObj.getFullYear(), 0, 2 + (weekNumber - 1) * 7, 0, 0, 0, 0);
|
|
4777
|
+
date.setDate(date.getDate() - date.getDay() + locale.firstDayOfWeek);
|
|
4778
|
+
return date;
|
|
4779
|
+
},
|
|
4780
|
+
Y: (dateObj, year) => {
|
|
4781
|
+
dateObj.setFullYear(parseFloat(year));
|
|
4782
|
+
},
|
|
4783
|
+
Z: (_, ISODate) => new Date(ISODate),
|
|
4784
|
+
d: (dateObj, day) => {
|
|
4785
|
+
dateObj.setDate(parseFloat(day));
|
|
4786
|
+
},
|
|
4787
|
+
h: (dateObj, hour) => {
|
|
4788
|
+
dateObj.setHours(parseFloat(hour));
|
|
4789
|
+
},
|
|
4790
|
+
i: (dateObj, minutes) => {
|
|
4791
|
+
dateObj.setMinutes(parseFloat(minutes));
|
|
4792
|
+
},
|
|
4793
|
+
j: (dateObj, day) => {
|
|
4794
|
+
dateObj.setDate(parseFloat(day));
|
|
4795
|
+
},
|
|
4796
|
+
l: doNothing,
|
|
4797
|
+
m: (dateObj, month) => {
|
|
4798
|
+
dateObj.setMonth(parseFloat(month) - 1);
|
|
4799
|
+
},
|
|
4800
|
+
n: (dateObj, month) => {
|
|
4801
|
+
dateObj.setMonth(parseFloat(month) - 1);
|
|
4802
|
+
},
|
|
4803
|
+
s: (dateObj, seconds) => {
|
|
4804
|
+
dateObj.setSeconds(parseFloat(seconds));
|
|
4805
|
+
},
|
|
4806
|
+
u: (_, unixMillSeconds) => new Date(parseFloat(unixMillSeconds)),
|
|
4807
|
+
w: doNothing,
|
|
4808
|
+
y: (dateObj, year) => {
|
|
4809
|
+
dateObj.setFullYear(2000 + parseFloat(year));
|
|
4810
|
+
}
|
|
4811
|
+
};
|
|
4812
|
+
exports.revFormat = revFormat;
|
|
4813
|
+
const tokenRegex = {
|
|
4814
|
+
D: "(\\w+)",
|
|
4815
|
+
F: "(\\w+)",
|
|
4816
|
+
G: "(\\d\\d|\\d)",
|
|
4817
|
+
H: "(\\d\\d|\\d)",
|
|
4818
|
+
J: "(\\d\\d|\\d)\\w+",
|
|
4819
|
+
K: "",
|
|
4820
|
+
M: "(\\w+)",
|
|
4821
|
+
S: "(\\d\\d|\\d)",
|
|
4822
|
+
U: "(.+)",
|
|
4823
|
+
W: "(\\d\\d|\\d)",
|
|
4824
|
+
Y: "(\\d{4})",
|
|
4825
|
+
Z: "(.+)",
|
|
4826
|
+
d: "(\\d\\d|\\d)",
|
|
4827
|
+
h: "(\\d\\d|\\d)",
|
|
4828
|
+
i: "(\\d\\d|\\d)",
|
|
4829
|
+
j: "(\\d\\d|\\d)",
|
|
4830
|
+
l: "(\\w+)",
|
|
4831
|
+
m: "(\\d\\d|\\d)",
|
|
4832
|
+
n: "(\\d\\d|\\d)",
|
|
4833
|
+
s: "(\\d\\d|\\d)",
|
|
4834
|
+
u: "(.+)",
|
|
4835
|
+
w: "(\\d\\d|\\d)",
|
|
4836
|
+
y: "(\\d{2})"
|
|
4837
|
+
};
|
|
4838
|
+
exports.tokenRegex = tokenRegex;
|
|
4839
|
+
const formats = {
|
|
4840
|
+
Z: date => date.toISOString(),
|
|
4841
|
+
D: function (date, locale, options) {
|
|
4842
|
+
return locale.weekdays.shorthand[formats.w(date, locale, options)];
|
|
4843
|
+
},
|
|
4844
|
+
F: function (date, locale, options) {
|
|
4845
|
+
return monthToStr(formats.n(date, locale, options) - 1, false, locale);
|
|
4846
|
+
},
|
|
4847
|
+
G: function (date, locale, options) {
|
|
4848
|
+
return (0, _utils.pad)(formats.h(date, locale, options));
|
|
4849
|
+
},
|
|
4850
|
+
H: date => (0, _utils.pad)(date.getHours()),
|
|
4851
|
+
J: function (date, locale) {
|
|
4852
|
+
return locale.ordinal !== undefined ? date.getDate() + locale.ordinal(date.getDate()) : date.getDate();
|
|
4853
|
+
},
|
|
4854
|
+
K: (date, locale) => locale.amPM[(0, _utils.int)(date.getHours() > 11)],
|
|
4855
|
+
M: function (date, locale) {
|
|
4856
|
+
return monthToStr(date.getMonth(), true, locale);
|
|
4857
|
+
},
|
|
4858
|
+
S: date => (0, _utils.pad)(date.getSeconds()),
|
|
4859
|
+
U: date => date.getTime() / 1000,
|
|
4860
|
+
W: function (date, _, options) {
|
|
4861
|
+
return options.getWeek(date);
|
|
4862
|
+
},
|
|
4863
|
+
Y: date => (0, _utils.pad)(date.getFullYear(), 4),
|
|
4864
|
+
d: date => (0, _utils.pad)(date.getDate()),
|
|
4865
|
+
h: date => date.getHours() % 12 ? date.getHours() % 12 : 12,
|
|
4866
|
+
i: date => (0, _utils.pad)(date.getMinutes()),
|
|
4867
|
+
j: date => date.getDate(),
|
|
4868
|
+
l: function (date, locale) {
|
|
4869
|
+
return locale.weekdays.longhand[date.getDay()];
|
|
4870
|
+
},
|
|
4871
|
+
m: date => (0, _utils.pad)(date.getMonth() + 1),
|
|
4872
|
+
n: date => date.getMonth() + 1,
|
|
4873
|
+
s: date => date.getSeconds(),
|
|
4874
|
+
u: date => date.getTime(),
|
|
4875
|
+
w: date => date.getDay(),
|
|
4876
|
+
y: date => String(date.getFullYear()).substring(2)
|
|
4877
|
+
};
|
|
4878
|
+
exports.formats = formats;
|
|
4879
|
+
},{"../utils":"../node_modules/flatpickr/dist/esm/utils/index.js"}],"../node_modules/flatpickr/dist/esm/utils/dates.js":[function(require,module,exports) {
|
|
4880
|
+
"use strict";
|
|
4881
|
+
|
|
4882
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4883
|
+
value: true
|
|
4884
|
+
});
|
|
4885
|
+
exports.compareDates = compareDates;
|
|
4886
|
+
exports.compareTimes = compareTimes;
|
|
4887
|
+
exports.getDefaultHours = getDefaultHours;
|
|
4888
|
+
exports.duration = exports.isBetween = exports.createDateParser = exports.createDateFormatter = void 0;
|
|
4889
|
+
|
|
4890
|
+
var _formatting = require("./formatting");
|
|
4891
|
+
|
|
4892
|
+
var _options = require("../types/options");
|
|
4893
|
+
|
|
4894
|
+
var _default = require("../l10n/default");
|
|
4895
|
+
|
|
4896
|
+
const createDateFormatter = ({
|
|
4897
|
+
config = _options.defaults,
|
|
4898
|
+
l10n = _default.english,
|
|
4899
|
+
isMobile = false
|
|
4900
|
+
}) => (dateObj, frmt, overrideLocale) => {
|
|
4901
|
+
const locale = overrideLocale || l10n;
|
|
4902
|
+
|
|
4903
|
+
if (config.formatDate !== undefined && !isMobile) {
|
|
4904
|
+
return config.formatDate(dateObj, frmt, locale);
|
|
4905
|
+
}
|
|
4906
|
+
|
|
4907
|
+
return frmt.split("").map((c, i, arr) => _formatting.formats[c] && arr[i - 1] !== "\\" ? _formatting.formats[c](dateObj, locale, config) : c !== "\\" ? c : "").join("");
|
|
4908
|
+
};
|
|
4909
|
+
|
|
4910
|
+
exports.createDateFormatter = createDateFormatter;
|
|
4911
|
+
|
|
4912
|
+
const createDateParser = ({
|
|
4913
|
+
config = _options.defaults,
|
|
4914
|
+
l10n = _default.english
|
|
4915
|
+
}) => (date, givenFormat, timeless, customLocale) => {
|
|
4916
|
+
if (date !== 0 && !date) return undefined;
|
|
4917
|
+
const locale = customLocale || l10n;
|
|
4918
|
+
let parsedDate;
|
|
4919
|
+
const dateOrig = date;
|
|
4920
|
+
if (date instanceof Date) parsedDate = new Date(date.getTime());else if (typeof date !== "string" && date.toFixed !== undefined) parsedDate = new Date(date);else if (typeof date === "string") {
|
|
4921
|
+
const format = givenFormat || (config || _options.defaults).dateFormat;
|
|
4922
|
+
const datestr = String(date).trim();
|
|
4923
|
+
|
|
4924
|
+
if (datestr === "today") {
|
|
4925
|
+
parsedDate = new Date();
|
|
4926
|
+
timeless = true;
|
|
4927
|
+
} else if (/Z$/.test(datestr) || /GMT$/.test(datestr)) parsedDate = new Date(date);else if (config && config.parseDate) parsedDate = config.parseDate(date, format);else {
|
|
4928
|
+
parsedDate = !config || !config.noCalendar ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0) : new Date(new Date().setHours(0, 0, 0, 0));
|
|
4929
|
+
let matched,
|
|
4930
|
+
ops = [];
|
|
4931
|
+
|
|
4932
|
+
for (let i = 0, matchIndex = 0, regexStr = ""; i < format.length; i++) {
|
|
4933
|
+
const token = format[i];
|
|
4934
|
+
const isBackSlash = token === "\\";
|
|
4935
|
+
const escaped = format[i - 1] === "\\" || isBackSlash;
|
|
4936
|
+
|
|
4937
|
+
if (_formatting.tokenRegex[token] && !escaped) {
|
|
4938
|
+
regexStr += _formatting.tokenRegex[token];
|
|
4939
|
+
const match = new RegExp(regexStr).exec(date);
|
|
4940
|
+
|
|
4941
|
+
if (match && (matched = true)) {
|
|
4942
|
+
ops[token !== "Y" ? "push" : "unshift"]({
|
|
4943
|
+
fn: _formatting.revFormat[token],
|
|
4944
|
+
val: match[++matchIndex]
|
|
4945
|
+
});
|
|
4946
|
+
}
|
|
4947
|
+
} else if (!isBackSlash) regexStr += ".";
|
|
4948
|
+
|
|
4949
|
+
ops.forEach(({
|
|
4950
|
+
fn,
|
|
4951
|
+
val
|
|
4952
|
+
}) => parsedDate = fn(parsedDate, val, locale) || parsedDate);
|
|
4953
|
+
}
|
|
4954
|
+
|
|
4955
|
+
parsedDate = matched ? parsedDate : undefined;
|
|
4956
|
+
}
|
|
4957
|
+
}
|
|
4958
|
+
|
|
4959
|
+
if (!(parsedDate instanceof Date && !isNaN(parsedDate.getTime()))) {
|
|
4960
|
+
config.errorHandler(new Error(`Invalid date provided: ${dateOrig}`));
|
|
4961
|
+
return undefined;
|
|
4962
|
+
}
|
|
4963
|
+
|
|
4964
|
+
if (timeless === true) parsedDate.setHours(0, 0, 0, 0);
|
|
4965
|
+
return parsedDate;
|
|
4966
|
+
};
|
|
4967
|
+
|
|
4968
|
+
exports.createDateParser = createDateParser;
|
|
4969
|
+
|
|
4970
|
+
function compareDates(date1, date2, timeless = true) {
|
|
4971
|
+
if (timeless !== false) {
|
|
4972
|
+
return new Date(date1.getTime()).setHours(0, 0, 0, 0) - new Date(date2.getTime()).setHours(0, 0, 0, 0);
|
|
4973
|
+
}
|
|
4974
|
+
|
|
4975
|
+
return date1.getTime() - date2.getTime();
|
|
4976
|
+
}
|
|
4977
|
+
|
|
4978
|
+
function compareTimes(date1, date2) {
|
|
4979
|
+
return 3600 * (date1.getHours() - date2.getHours()) + 60 * (date1.getMinutes() - date2.getMinutes()) + date1.getSeconds() - date2.getSeconds();
|
|
4980
|
+
}
|
|
4981
|
+
|
|
4982
|
+
const isBetween = (ts, ts1, ts2) => {
|
|
4983
|
+
return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2);
|
|
4984
|
+
};
|
|
4985
|
+
|
|
4986
|
+
exports.isBetween = isBetween;
|
|
4987
|
+
const duration = {
|
|
4988
|
+
DAY: 86400000
|
|
4989
|
+
};
|
|
4990
|
+
exports.duration = duration;
|
|
4991
|
+
|
|
4992
|
+
function getDefaultHours(config) {
|
|
4993
|
+
let hours = config.defaultHour;
|
|
4994
|
+
let minutes = config.defaultMinute;
|
|
4995
|
+
let seconds = config.defaultSeconds;
|
|
4996
|
+
|
|
4997
|
+
if (config.minDate !== undefined) {
|
|
4998
|
+
const minHour = config.minDate.getHours();
|
|
4999
|
+
const minMinutes = config.minDate.getMinutes();
|
|
5000
|
+
const minSeconds = config.minDate.getSeconds();
|
|
5001
|
+
|
|
5002
|
+
if (hours < minHour) {
|
|
5003
|
+
hours = minHour;
|
|
5004
|
+
}
|
|
5005
|
+
|
|
5006
|
+
if (hours === minHour && minutes < minMinutes) {
|
|
5007
|
+
minutes = minMinutes;
|
|
5008
|
+
}
|
|
5009
|
+
|
|
5010
|
+
if (hours === minHour && minutes === minMinutes && seconds < minSeconds) seconds = config.minDate.getSeconds();
|
|
5011
|
+
}
|
|
5012
|
+
|
|
5013
|
+
if (config.maxDate !== undefined) {
|
|
5014
|
+
const maxHr = config.maxDate.getHours();
|
|
5015
|
+
const maxMinutes = config.maxDate.getMinutes();
|
|
5016
|
+
hours = Math.min(hours, maxHr);
|
|
5017
|
+
if (hours === maxHr) minutes = Math.min(maxMinutes, minutes);
|
|
5018
|
+
if (hours === maxHr && minutes === maxMinutes) seconds = config.maxDate.getSeconds();
|
|
5019
|
+
}
|
|
5020
|
+
|
|
5021
|
+
return {
|
|
5022
|
+
hours,
|
|
5023
|
+
minutes,
|
|
5024
|
+
seconds
|
|
5025
|
+
};
|
|
5026
|
+
}
|
|
5027
|
+
},{"./formatting":"../node_modules/flatpickr/dist/esm/utils/formatting.js","../types/options":"../node_modules/flatpickr/dist/esm/types/options.js","../l10n/default":"../node_modules/flatpickr/dist/esm/l10n/default.js"}],"../node_modules/flatpickr/dist/esm/utils/polyfills.js":[function(require,module,exports) {
|
|
5028
|
+
"use strict";
|
|
5029
|
+
|
|
5030
|
+
if (typeof Object.assign !== "function") {
|
|
5031
|
+
Object.assign = function (target, ...args) {
|
|
5032
|
+
if (!target) {
|
|
5033
|
+
throw TypeError("Cannot convert undefined or null to object");
|
|
5034
|
+
}
|
|
5035
|
+
|
|
5036
|
+
for (const source of args) {
|
|
5037
|
+
if (source) {
|
|
5038
|
+
Object.keys(source).forEach(key => target[key] = source[key]);
|
|
5039
|
+
}
|
|
5040
|
+
}
|
|
5041
|
+
|
|
5042
|
+
return target;
|
|
5043
|
+
};
|
|
5044
|
+
}
|
|
5045
|
+
},{}],"../node_modules/flatpickr/dist/esm/index.js":[function(require,module,exports) {
|
|
5046
|
+
"use strict";
|
|
5047
|
+
|
|
5048
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5049
|
+
value: true
|
|
5050
|
+
});
|
|
5051
|
+
exports.default = void 0;
|
|
5052
|
+
|
|
5053
|
+
var _options = require("./types/options");
|
|
5054
|
+
|
|
5055
|
+
var _default2 = _interopRequireDefault(require("./l10n/default"));
|
|
5056
|
+
|
|
5057
|
+
var _utils = require("./utils");
|
|
5058
|
+
|
|
5059
|
+
var _dom = require("./utils/dom");
|
|
5060
|
+
|
|
5061
|
+
var _dates = require("./utils/dates");
|
|
5062
|
+
|
|
5063
|
+
var _formatting = require("./utils/formatting");
|
|
5064
|
+
|
|
5065
|
+
require("./utils/polyfills");
|
|
5066
|
+
|
|
5067
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
5068
|
+
|
|
5069
|
+
const DEBOUNCED_CHANGE_MS = 300;
|
|
5070
|
+
|
|
5071
|
+
function FlatpickrInstance(element, instanceConfig) {
|
|
5072
|
+
const self = {
|
|
5073
|
+
config: Object.assign(Object.assign({}, _options.defaults), flatpickr.defaultConfig),
|
|
5074
|
+
l10n: _default2.default
|
|
5075
|
+
};
|
|
5076
|
+
self.parseDate = (0, _dates.createDateParser)({
|
|
5077
|
+
config: self.config,
|
|
5078
|
+
l10n: self.l10n
|
|
5079
|
+
});
|
|
5080
|
+
self._handlers = [];
|
|
5081
|
+
self.pluginElements = [];
|
|
5082
|
+
self.loadedPlugins = [];
|
|
5083
|
+
self._bind = bind;
|
|
5084
|
+
self._setHoursFromDate = setHoursFromDate;
|
|
5085
|
+
self._positionCalendar = positionCalendar;
|
|
5086
|
+
self.changeMonth = changeMonth;
|
|
5087
|
+
self.changeYear = changeYear;
|
|
5088
|
+
self.clear = clear;
|
|
5089
|
+
self.close = close;
|
|
5090
|
+
self._createElement = _dom.createElement;
|
|
5091
|
+
self.destroy = destroy;
|
|
5092
|
+
self.isEnabled = isEnabled;
|
|
5093
|
+
self.jumpToDate = jumpToDate;
|
|
5094
|
+
self.open = open;
|
|
5095
|
+
self.redraw = redraw;
|
|
5096
|
+
self.set = set;
|
|
5097
|
+
self.setDate = setDate;
|
|
5098
|
+
self.toggle = toggle;
|
|
5099
|
+
|
|
5100
|
+
function setupHelperFunctions() {
|
|
5101
|
+
self.utils = {
|
|
5102
|
+
getDaysInMonth(month = self.currentMonth, yr = self.currentYear) {
|
|
5103
|
+
if (month === 1 && (yr % 4 === 0 && yr % 100 !== 0 || yr % 400 === 0)) return 29;
|
|
5104
|
+
return self.l10n.daysInMonth[month];
|
|
5105
|
+
}
|
|
5106
|
+
|
|
5107
|
+
};
|
|
5108
|
+
}
|
|
5109
|
+
|
|
5110
|
+
function init() {
|
|
5111
|
+
self.element = self.input = element;
|
|
5112
|
+
self.isOpen = false;
|
|
5113
|
+
parseConfig();
|
|
5114
|
+
setupLocale();
|
|
5115
|
+
setupInputs();
|
|
5116
|
+
setupDates();
|
|
5117
|
+
setupHelperFunctions();
|
|
5118
|
+
if (!self.isMobile) build();
|
|
5119
|
+
bindEvents();
|
|
5120
|
+
|
|
5121
|
+
if (self.selectedDates.length || self.config.noCalendar) {
|
|
5122
|
+
if (self.config.enableTime) {
|
|
5123
|
+
setHoursFromDate(self.config.noCalendar ? self.latestSelectedDateObj : undefined);
|
|
5124
|
+
}
|
|
5125
|
+
|
|
5126
|
+
updateValue(false);
|
|
5127
|
+
}
|
|
5128
|
+
|
|
5129
|
+
setCalendarWidth();
|
|
5130
|
+
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
5131
|
+
|
|
5132
|
+
if (!self.isMobile && isSafari) {
|
|
5133
|
+
positionCalendar();
|
|
5134
|
+
}
|
|
5135
|
+
|
|
5136
|
+
triggerEvent("onReady");
|
|
5137
|
+
}
|
|
5138
|
+
|
|
5139
|
+
function bindToInstance(fn) {
|
|
5140
|
+
return fn.bind(self);
|
|
5141
|
+
}
|
|
5142
|
+
|
|
5143
|
+
function setCalendarWidth() {
|
|
5144
|
+
const config = self.config;
|
|
5145
|
+
|
|
5146
|
+
if (config.weekNumbers === false && config.showMonths === 1) {
|
|
5147
|
+
return;
|
|
5148
|
+
} else if (config.noCalendar !== true) {
|
|
5149
|
+
window.requestAnimationFrame(function () {
|
|
5150
|
+
if (self.calendarContainer !== undefined) {
|
|
5151
|
+
self.calendarContainer.style.visibility = "hidden";
|
|
5152
|
+
self.calendarContainer.style.display = "block";
|
|
5153
|
+
}
|
|
5154
|
+
|
|
5155
|
+
if (self.daysContainer !== undefined) {
|
|
5156
|
+
const daysWidth = (self.days.offsetWidth + 1) * config.showMonths;
|
|
5157
|
+
self.daysContainer.style.width = daysWidth + "px";
|
|
5158
|
+
self.calendarContainer.style.width = daysWidth + (self.weekWrapper !== undefined ? self.weekWrapper.offsetWidth : 0) + "px";
|
|
5159
|
+
self.calendarContainer.style.removeProperty("visibility");
|
|
5160
|
+
self.calendarContainer.style.removeProperty("display");
|
|
5161
|
+
}
|
|
5162
|
+
});
|
|
5163
|
+
}
|
|
5164
|
+
}
|
|
5165
|
+
|
|
5166
|
+
function updateTime(e) {
|
|
5167
|
+
if (self.selectedDates.length === 0) {
|
|
5168
|
+
const defaultDate = self.config.minDate === undefined || (0, _dates.compareDates)(new Date(), self.config.minDate) >= 0 ? new Date() : new Date(self.config.minDate.getTime());
|
|
5169
|
+
const defaults = (0, _dates.getDefaultHours)(self.config);
|
|
5170
|
+
defaultDate.setHours(defaults.hours, defaults.minutes, defaults.seconds, defaultDate.getMilliseconds());
|
|
5171
|
+
self.selectedDates = [defaultDate];
|
|
5172
|
+
self.latestSelectedDateObj = defaultDate;
|
|
5173
|
+
}
|
|
5174
|
+
|
|
5175
|
+
if (e !== undefined && e.type !== "blur") {
|
|
5176
|
+
timeWrapper(e);
|
|
5177
|
+
}
|
|
5178
|
+
|
|
5179
|
+
const prevValue = self._input.value;
|
|
5180
|
+
setHoursFromInputs();
|
|
5181
|
+
updateValue();
|
|
5182
|
+
|
|
5183
|
+
if (self._input.value !== prevValue) {
|
|
5184
|
+
self._debouncedChange();
|
|
5185
|
+
}
|
|
5186
|
+
}
|
|
5187
|
+
|
|
5188
|
+
function ampm2military(hour, amPM) {
|
|
5189
|
+
return hour % 12 + 12 * (0, _utils.int)(amPM === self.l10n.amPM[1]);
|
|
5190
|
+
}
|
|
5191
|
+
|
|
5192
|
+
function military2ampm(hour) {
|
|
5193
|
+
switch (hour % 24) {
|
|
5194
|
+
case 0:
|
|
5195
|
+
case 12:
|
|
5196
|
+
return 12;
|
|
5197
|
+
|
|
5198
|
+
default:
|
|
5199
|
+
return hour % 12;
|
|
5200
|
+
}
|
|
5201
|
+
}
|
|
5202
|
+
|
|
5203
|
+
function setHoursFromInputs() {
|
|
5204
|
+
if (self.hourElement === undefined || self.minuteElement === undefined) return;
|
|
5205
|
+
let hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24,
|
|
5206
|
+
minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60,
|
|
5207
|
+
seconds = self.secondElement !== undefined ? (parseInt(self.secondElement.value, 10) || 0) % 60 : 0;
|
|
5208
|
+
|
|
5209
|
+
if (self.amPM !== undefined) {
|
|
5210
|
+
hours = ampm2military(hours, self.amPM.textContent);
|
|
5211
|
+
}
|
|
5212
|
+
|
|
5213
|
+
const limitMinHours = self.config.minTime !== undefined || self.config.minDate && self.minDateHasTime && self.latestSelectedDateObj && (0, _dates.compareDates)(self.latestSelectedDateObj, self.config.minDate, true) === 0;
|
|
5214
|
+
const limitMaxHours = self.config.maxTime !== undefined || self.config.maxDate && self.maxDateHasTime && self.latestSelectedDateObj && (0, _dates.compareDates)(self.latestSelectedDateObj, self.config.maxDate, true) === 0;
|
|
5215
|
+
|
|
5216
|
+
if (limitMaxHours) {
|
|
5217
|
+
const maxTime = self.config.maxTime !== undefined ? self.config.maxTime : self.config.maxDate;
|
|
5218
|
+
hours = Math.min(hours, maxTime.getHours());
|
|
5219
|
+
if (hours === maxTime.getHours()) minutes = Math.min(minutes, maxTime.getMinutes());
|
|
5220
|
+
if (minutes === maxTime.getMinutes()) seconds = Math.min(seconds, maxTime.getSeconds());
|
|
5221
|
+
}
|
|
5222
|
+
|
|
5223
|
+
if (limitMinHours) {
|
|
5224
|
+
const minTime = self.config.minTime !== undefined ? self.config.minTime : self.config.minDate;
|
|
5225
|
+
hours = Math.max(hours, minTime.getHours());
|
|
5226
|
+
if (hours === minTime.getHours() && minutes < minTime.getMinutes()) minutes = minTime.getMinutes();
|
|
5227
|
+
if (minutes === minTime.getMinutes()) seconds = Math.max(seconds, minTime.getSeconds());
|
|
5228
|
+
}
|
|
5229
|
+
|
|
5230
|
+
setHours(hours, minutes, seconds);
|
|
5231
|
+
}
|
|
5232
|
+
|
|
5233
|
+
function setHoursFromDate(dateObj) {
|
|
5234
|
+
const date = dateObj || self.latestSelectedDateObj;
|
|
5235
|
+
|
|
5236
|
+
if (date) {
|
|
5237
|
+
setHours(date.getHours(), date.getMinutes(), date.getSeconds());
|
|
5238
|
+
}
|
|
5239
|
+
}
|
|
5240
|
+
|
|
5241
|
+
function setHours(hours, minutes, seconds) {
|
|
5242
|
+
if (self.latestSelectedDateObj !== undefined) {
|
|
5243
|
+
self.latestSelectedDateObj.setHours(hours % 24, minutes, seconds || 0, 0);
|
|
5244
|
+
}
|
|
5245
|
+
|
|
5246
|
+
if (!self.hourElement || !self.minuteElement || self.isMobile) return;
|
|
5247
|
+
self.hourElement.value = (0, _utils.pad)(!self.config.time_24hr ? (12 + hours) % 12 + 12 * (0, _utils.int)(hours % 12 === 0) : hours);
|
|
5248
|
+
self.minuteElement.value = (0, _utils.pad)(minutes);
|
|
5249
|
+
if (self.amPM !== undefined) self.amPM.textContent = self.l10n.amPM[(0, _utils.int)(hours >= 12)];
|
|
5250
|
+
if (self.secondElement !== undefined) self.secondElement.value = (0, _utils.pad)(seconds);
|
|
5251
|
+
}
|
|
5252
|
+
|
|
5253
|
+
function onYearInput(event) {
|
|
5254
|
+
const eventTarget = (0, _dom.getEventTarget)(event);
|
|
5255
|
+
const year = parseInt(eventTarget.value) + (event.delta || 0);
|
|
5256
|
+
|
|
5257
|
+
if (year / 1000 > 1 || event.key === "Enter" && !/[^\d]/.test(year.toString())) {
|
|
5258
|
+
changeYear(year);
|
|
5259
|
+
}
|
|
5260
|
+
}
|
|
5261
|
+
|
|
5262
|
+
function bind(element, event, handler, options) {
|
|
5263
|
+
if (event instanceof Array) return event.forEach(ev => bind(element, ev, handler, options));
|
|
5264
|
+
if (element instanceof Array) return element.forEach(el => bind(el, event, handler, options));
|
|
5265
|
+
element.addEventListener(event, handler, options);
|
|
5266
|
+
|
|
5267
|
+
self._handlers.push({
|
|
5268
|
+
remove: () => element.removeEventListener(event, handler)
|
|
5269
|
+
});
|
|
5270
|
+
}
|
|
5271
|
+
|
|
5272
|
+
function triggerChange() {
|
|
5273
|
+
triggerEvent("onChange");
|
|
5274
|
+
}
|
|
5275
|
+
|
|
5276
|
+
function bindEvents() {
|
|
5277
|
+
if (self.config.wrap) {
|
|
5278
|
+
["open", "close", "toggle", "clear"].forEach(evt => {
|
|
5279
|
+
Array.prototype.forEach.call(self.element.querySelectorAll(`[data-${evt}]`), el => bind(el, "click", self[evt]));
|
|
5280
|
+
});
|
|
5281
|
+
}
|
|
5282
|
+
|
|
5283
|
+
if (self.isMobile) {
|
|
5284
|
+
setupMobile();
|
|
5285
|
+
return;
|
|
5286
|
+
}
|
|
5287
|
+
|
|
5288
|
+
const debouncedResize = (0, _utils.debounce)(onResize, 50);
|
|
5289
|
+
self._debouncedChange = (0, _utils.debounce)(triggerChange, DEBOUNCED_CHANGE_MS);
|
|
5290
|
+
if (self.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent)) bind(self.daysContainer, "mouseover", e => {
|
|
5291
|
+
if (self.config.mode === "range") onMouseOver((0, _dom.getEventTarget)(e));
|
|
5292
|
+
});
|
|
5293
|
+
bind(window.document.body, "keydown", onKeyDown);
|
|
5294
|
+
if (!self.config.inline && !self.config.static) bind(window, "resize", debouncedResize);
|
|
5295
|
+
if (window.ontouchstart !== undefined) bind(window.document, "touchstart", documentClick);else bind(window.document, "mousedown", documentClick);
|
|
5296
|
+
bind(window.document, "focus", documentClick, {
|
|
5297
|
+
capture: true
|
|
5298
|
+
});
|
|
5299
|
+
|
|
5300
|
+
if (self.config.clickOpens === true) {
|
|
5301
|
+
bind(self._input, "focus", self.open);
|
|
5302
|
+
bind(self._input, "click", self.open);
|
|
5303
|
+
}
|
|
5304
|
+
|
|
5305
|
+
if (self.daysContainer !== undefined) {
|
|
5306
|
+
bind(self.monthNav, "click", onMonthNavClick);
|
|
5307
|
+
bind(self.monthNav, ["keyup", "increment"], onYearInput);
|
|
5308
|
+
bind(self.daysContainer, "click", selectDate);
|
|
5309
|
+
}
|
|
5310
|
+
|
|
5311
|
+
if (self.timeContainer !== undefined && self.minuteElement !== undefined && self.hourElement !== undefined) {
|
|
5312
|
+
const selText = e => (0, _dom.getEventTarget)(e).select();
|
|
5313
|
+
|
|
5314
|
+
bind(self.timeContainer, ["increment"], updateTime);
|
|
5315
|
+
bind(self.timeContainer, "blur", updateTime, {
|
|
5316
|
+
capture: true
|
|
5317
|
+
});
|
|
5318
|
+
bind(self.timeContainer, "click", timeIncrement);
|
|
5319
|
+
bind([self.hourElement, self.minuteElement], ["focus", "click"], selText);
|
|
5320
|
+
if (self.secondElement !== undefined) bind(self.secondElement, "focus", () => self.secondElement && self.secondElement.select());
|
|
5321
|
+
|
|
5322
|
+
if (self.amPM !== undefined) {
|
|
5323
|
+
bind(self.amPM, "click", e => {
|
|
5324
|
+
updateTime(e);
|
|
5325
|
+
triggerChange();
|
|
5326
|
+
});
|
|
5327
|
+
}
|
|
5328
|
+
}
|
|
5329
|
+
|
|
5330
|
+
if (self.config.allowInput) {
|
|
5331
|
+
bind(self._input, "blur", onBlur);
|
|
5332
|
+
}
|
|
5333
|
+
}
|
|
5334
|
+
|
|
5335
|
+
function jumpToDate(jumpDate, triggerChange) {
|
|
5336
|
+
const jumpTo = jumpDate !== undefined ? self.parseDate(jumpDate) : self.latestSelectedDateObj || (self.config.minDate && self.config.minDate > self.now ? self.config.minDate : self.config.maxDate && self.config.maxDate < self.now ? self.config.maxDate : self.now);
|
|
5337
|
+
const oldYear = self.currentYear;
|
|
5338
|
+
const oldMonth = self.currentMonth;
|
|
5339
|
+
|
|
5340
|
+
try {
|
|
5341
|
+
if (jumpTo !== undefined) {
|
|
5342
|
+
self.currentYear = jumpTo.getFullYear();
|
|
5343
|
+
self.currentMonth = jumpTo.getMonth();
|
|
5344
|
+
}
|
|
5345
|
+
} catch (e) {
|
|
5346
|
+
e.message = "Invalid date supplied: " + jumpTo;
|
|
5347
|
+
self.config.errorHandler(e);
|
|
5348
|
+
}
|
|
5349
|
+
|
|
5350
|
+
if (triggerChange && self.currentYear !== oldYear) {
|
|
5351
|
+
triggerEvent("onYearChange");
|
|
5352
|
+
buildMonthSwitch();
|
|
5353
|
+
}
|
|
5354
|
+
|
|
5355
|
+
if (triggerChange && (self.currentYear !== oldYear || self.currentMonth !== oldMonth)) {
|
|
5356
|
+
triggerEvent("onMonthChange");
|
|
5357
|
+
}
|
|
5358
|
+
|
|
5359
|
+
self.redraw();
|
|
5360
|
+
}
|
|
5361
|
+
|
|
5362
|
+
function timeIncrement(e) {
|
|
5363
|
+
const eventTarget = (0, _dom.getEventTarget)(e);
|
|
5364
|
+
if (~eventTarget.className.indexOf("arrow")) incrementNumInput(e, eventTarget.classList.contains("arrowUp") ? 1 : -1);
|
|
5365
|
+
}
|
|
5366
|
+
|
|
5367
|
+
function incrementNumInput(e, delta, inputElem) {
|
|
5368
|
+
const target = e && (0, _dom.getEventTarget)(e);
|
|
5369
|
+
const input = inputElem || target && target.parentNode && target.parentNode.firstChild;
|
|
5370
|
+
const event = createEvent("increment");
|
|
5371
|
+
event.delta = delta;
|
|
5372
|
+
input && input.dispatchEvent(event);
|
|
5373
|
+
}
|
|
5374
|
+
|
|
5375
|
+
function build() {
|
|
5376
|
+
const fragment = window.document.createDocumentFragment();
|
|
5377
|
+
self.calendarContainer = (0, _dom.createElement)("div", "flatpickr-calendar");
|
|
5378
|
+
self.calendarContainer.tabIndex = -1;
|
|
5379
|
+
|
|
5380
|
+
if (!self.config.noCalendar) {
|
|
5381
|
+
fragment.appendChild(buildMonthNav());
|
|
5382
|
+
self.innerContainer = (0, _dom.createElement)("div", "flatpickr-innerContainer");
|
|
5383
|
+
|
|
5384
|
+
if (self.config.weekNumbers) {
|
|
5385
|
+
const {
|
|
5386
|
+
weekWrapper,
|
|
5387
|
+
weekNumbers
|
|
5388
|
+
} = buildWeeks();
|
|
5389
|
+
self.innerContainer.appendChild(weekWrapper);
|
|
5390
|
+
self.weekNumbers = weekNumbers;
|
|
5391
|
+
self.weekWrapper = weekWrapper;
|
|
5392
|
+
}
|
|
5393
|
+
|
|
5394
|
+
self.rContainer = (0, _dom.createElement)("div", "flatpickr-rContainer");
|
|
5395
|
+
self.rContainer.appendChild(buildWeekdays());
|
|
5396
|
+
|
|
5397
|
+
if (!self.daysContainer) {
|
|
5398
|
+
self.daysContainer = (0, _dom.createElement)("div", "flatpickr-days");
|
|
5399
|
+
self.daysContainer.tabIndex = -1;
|
|
5400
|
+
}
|
|
5401
|
+
|
|
5402
|
+
buildDays();
|
|
5403
|
+
self.rContainer.appendChild(self.daysContainer);
|
|
5404
|
+
self.innerContainer.appendChild(self.rContainer);
|
|
5405
|
+
fragment.appendChild(self.innerContainer);
|
|
5406
|
+
}
|
|
5407
|
+
|
|
5408
|
+
if (self.config.enableTime) {
|
|
5409
|
+
fragment.appendChild(buildTime());
|
|
5410
|
+
}
|
|
5411
|
+
|
|
5412
|
+
(0, _dom.toggleClass)(self.calendarContainer, "rangeMode", self.config.mode === "range");
|
|
5413
|
+
(0, _dom.toggleClass)(self.calendarContainer, "animate", self.config.animate === true);
|
|
5414
|
+
(0, _dom.toggleClass)(self.calendarContainer, "multiMonth", self.config.showMonths > 1);
|
|
5415
|
+
self.calendarContainer.appendChild(fragment);
|
|
5416
|
+
const customAppend = self.config.appendTo !== undefined && self.config.appendTo.nodeType !== undefined;
|
|
5417
|
+
|
|
5418
|
+
if (self.config.inline || self.config.static) {
|
|
5419
|
+
self.calendarContainer.classList.add(self.config.inline ? "inline" : "static");
|
|
5420
|
+
|
|
5421
|
+
if (self.config.inline) {
|
|
5422
|
+
if (!customAppend && self.element.parentNode) self.element.parentNode.insertBefore(self.calendarContainer, self._input.nextSibling);else if (self.config.appendTo !== undefined) self.config.appendTo.appendChild(self.calendarContainer);
|
|
5423
|
+
}
|
|
5424
|
+
|
|
5425
|
+
if (self.config.static) {
|
|
5426
|
+
const wrapper = (0, _dom.createElement)("div", "flatpickr-wrapper");
|
|
5427
|
+
if (self.element.parentNode) self.element.parentNode.insertBefore(wrapper, self.element);
|
|
5428
|
+
wrapper.appendChild(self.element);
|
|
5429
|
+
if (self.altInput) wrapper.appendChild(self.altInput);
|
|
5430
|
+
wrapper.appendChild(self.calendarContainer);
|
|
5431
|
+
}
|
|
5432
|
+
}
|
|
5433
|
+
|
|
5434
|
+
if (!self.config.static && !self.config.inline) (self.config.appendTo !== undefined ? self.config.appendTo : window.document.body).appendChild(self.calendarContainer);
|
|
5435
|
+
}
|
|
5436
|
+
|
|
5437
|
+
function createDay(className, date, dayNumber, i) {
|
|
5438
|
+
const dateIsEnabled = isEnabled(date, true),
|
|
5439
|
+
dayElement = (0, _dom.createElement)("span", "flatpickr-day " + className, date.getDate().toString());
|
|
5440
|
+
dayElement.dateObj = date;
|
|
5441
|
+
dayElement.$i = i;
|
|
5442
|
+
dayElement.setAttribute("aria-label", self.formatDate(date, self.config.ariaDateFormat));
|
|
5443
|
+
|
|
5444
|
+
if (className.indexOf("hidden") === -1 && (0, _dates.compareDates)(date, self.now) === 0) {
|
|
5445
|
+
self.todayDateElem = dayElement;
|
|
5446
|
+
dayElement.classList.add("today");
|
|
5447
|
+
dayElement.setAttribute("aria-current", "date");
|
|
5448
|
+
}
|
|
5449
|
+
|
|
5450
|
+
if (dateIsEnabled) {
|
|
5451
|
+
dayElement.tabIndex = -1;
|
|
5452
|
+
|
|
5453
|
+
if (isDateSelected(date)) {
|
|
5454
|
+
dayElement.classList.add("selected");
|
|
5455
|
+
self.selectedDateElem = dayElement;
|
|
5456
|
+
|
|
5457
|
+
if (self.config.mode === "range") {
|
|
5458
|
+
(0, _dom.toggleClass)(dayElement, "startRange", self.selectedDates[0] && (0, _dates.compareDates)(date, self.selectedDates[0], true) === 0);
|
|
5459
|
+
(0, _dom.toggleClass)(dayElement, "endRange", self.selectedDates[1] && (0, _dates.compareDates)(date, self.selectedDates[1], true) === 0);
|
|
5460
|
+
if (className === "nextMonthDay") dayElement.classList.add("inRange");
|
|
5461
|
+
}
|
|
5462
|
+
}
|
|
5463
|
+
} else {
|
|
5464
|
+
dayElement.classList.add("flatpickr-disabled");
|
|
5465
|
+
}
|
|
5466
|
+
|
|
5467
|
+
if (self.config.mode === "range") {
|
|
5468
|
+
if (isDateInRange(date) && !isDateSelected(date)) dayElement.classList.add("inRange");
|
|
5469
|
+
}
|
|
5470
|
+
|
|
5471
|
+
if (self.weekNumbers && self.config.showMonths === 1 && className !== "prevMonthDay" && dayNumber % 7 === 1) {
|
|
5472
|
+
self.weekNumbers.insertAdjacentHTML("beforeend", "<span class='flatpickr-day'>" + self.config.getWeek(date) + "</span>");
|
|
5473
|
+
}
|
|
5474
|
+
|
|
5475
|
+
triggerEvent("onDayCreate", dayElement);
|
|
5476
|
+
return dayElement;
|
|
5477
|
+
}
|
|
5478
|
+
|
|
5479
|
+
function focusOnDayElem(targetNode) {
|
|
5480
|
+
targetNode.focus();
|
|
5481
|
+
if (self.config.mode === "range") onMouseOver(targetNode);
|
|
5482
|
+
}
|
|
5483
|
+
|
|
5484
|
+
function getFirstAvailableDay(delta) {
|
|
5485
|
+
const startMonth = delta > 0 ? 0 : self.config.showMonths - 1;
|
|
5486
|
+
const endMonth = delta > 0 ? self.config.showMonths : -1;
|
|
5487
|
+
|
|
5488
|
+
for (let m = startMonth; m != endMonth; m += delta) {
|
|
5489
|
+
const month = self.daysContainer.children[m];
|
|
5490
|
+
const startIndex = delta > 0 ? 0 : month.children.length - 1;
|
|
5491
|
+
const endIndex = delta > 0 ? month.children.length : -1;
|
|
5492
|
+
|
|
5493
|
+
for (let i = startIndex; i != endIndex; i += delta) {
|
|
5494
|
+
const c = month.children[i];
|
|
5495
|
+
if (c.className.indexOf("hidden") === -1 && isEnabled(c.dateObj)) return c;
|
|
5496
|
+
}
|
|
5497
|
+
}
|
|
5498
|
+
|
|
5499
|
+
return undefined;
|
|
5500
|
+
}
|
|
5501
|
+
|
|
5502
|
+
function getNextAvailableDay(current, delta) {
|
|
5503
|
+
const givenMonth = current.className.indexOf("Month") === -1 ? current.dateObj.getMonth() : self.currentMonth;
|
|
5504
|
+
const endMonth = delta > 0 ? self.config.showMonths : -1;
|
|
5505
|
+
const loopDelta = delta > 0 ? 1 : -1;
|
|
5506
|
+
|
|
5507
|
+
for (let m = givenMonth - self.currentMonth; m != endMonth; m += loopDelta) {
|
|
5508
|
+
const month = self.daysContainer.children[m];
|
|
5509
|
+
const startIndex = givenMonth - self.currentMonth === m ? current.$i + delta : delta < 0 ? month.children.length - 1 : 0;
|
|
5510
|
+
const numMonthDays = month.children.length;
|
|
5511
|
+
|
|
5512
|
+
for (let i = startIndex; i >= 0 && i < numMonthDays && i != (delta > 0 ? numMonthDays : -1); i += loopDelta) {
|
|
5513
|
+
const c = month.children[i];
|
|
5514
|
+
if (c.className.indexOf("hidden") === -1 && isEnabled(c.dateObj) && Math.abs(current.$i - i) >= Math.abs(delta)) return focusOnDayElem(c);
|
|
5515
|
+
}
|
|
5516
|
+
}
|
|
5517
|
+
|
|
5518
|
+
self.changeMonth(loopDelta);
|
|
5519
|
+
focusOnDay(getFirstAvailableDay(loopDelta), 0);
|
|
5520
|
+
return undefined;
|
|
5521
|
+
}
|
|
5522
|
+
|
|
5523
|
+
function focusOnDay(current, offset) {
|
|
5524
|
+
const dayFocused = isInView(document.activeElement || document.body);
|
|
5525
|
+
const startElem = current !== undefined ? current : dayFocused ? document.activeElement : self.selectedDateElem !== undefined && isInView(self.selectedDateElem) ? self.selectedDateElem : self.todayDateElem !== undefined && isInView(self.todayDateElem) ? self.todayDateElem : getFirstAvailableDay(offset > 0 ? 1 : -1);
|
|
5526
|
+
|
|
5527
|
+
if (startElem === undefined) {
|
|
5528
|
+
self._input.focus();
|
|
5529
|
+
} else if (!dayFocused) {
|
|
5530
|
+
focusOnDayElem(startElem);
|
|
5531
|
+
} else {
|
|
5532
|
+
getNextAvailableDay(startElem, offset);
|
|
5533
|
+
}
|
|
5534
|
+
}
|
|
5535
|
+
|
|
5536
|
+
function buildMonthDays(year, month) {
|
|
5537
|
+
const firstOfMonth = (new Date(year, month, 1).getDay() - self.l10n.firstDayOfWeek + 7) % 7;
|
|
5538
|
+
const prevMonthDays = self.utils.getDaysInMonth((month - 1 + 12) % 12, year);
|
|
5539
|
+
const daysInMonth = self.utils.getDaysInMonth(month, year),
|
|
5540
|
+
days = window.document.createDocumentFragment(),
|
|
5541
|
+
isMultiMonth = self.config.showMonths > 1,
|
|
5542
|
+
prevMonthDayClass = isMultiMonth ? "prevMonthDay hidden" : "prevMonthDay",
|
|
5543
|
+
nextMonthDayClass = isMultiMonth ? "nextMonthDay hidden" : "nextMonthDay";
|
|
5544
|
+
let dayNumber = prevMonthDays + 1 - firstOfMonth,
|
|
5545
|
+
dayIndex = 0;
|
|
5546
|
+
|
|
5547
|
+
for (; dayNumber <= prevMonthDays; dayNumber++, dayIndex++) {
|
|
5548
|
+
days.appendChild(createDay(prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex));
|
|
5549
|
+
}
|
|
5550
|
+
|
|
5551
|
+
for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) {
|
|
5552
|
+
days.appendChild(createDay("", new Date(year, month, dayNumber), dayNumber, dayIndex));
|
|
5553
|
+
}
|
|
5554
|
+
|
|
5555
|
+
for (let dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth && (self.config.showMonths === 1 || dayIndex % 7 !== 0); dayNum++, dayIndex++) {
|
|
5556
|
+
days.appendChild(createDay(nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex));
|
|
5557
|
+
}
|
|
5558
|
+
|
|
5559
|
+
const dayContainer = (0, _dom.createElement)("div", "dayContainer");
|
|
5560
|
+
dayContainer.appendChild(days);
|
|
5561
|
+
return dayContainer;
|
|
5562
|
+
}
|
|
5563
|
+
|
|
5564
|
+
function buildDays() {
|
|
5565
|
+
if (self.daysContainer === undefined) {
|
|
5566
|
+
return;
|
|
5567
|
+
}
|
|
5568
|
+
|
|
5569
|
+
(0, _dom.clearNode)(self.daysContainer);
|
|
5570
|
+
if (self.weekNumbers) (0, _dom.clearNode)(self.weekNumbers);
|
|
5571
|
+
const frag = document.createDocumentFragment();
|
|
5572
|
+
|
|
5573
|
+
for (let i = 0; i < self.config.showMonths; i++) {
|
|
5574
|
+
const d = new Date(self.currentYear, self.currentMonth, 1);
|
|
5575
|
+
d.setMonth(self.currentMonth + i);
|
|
5576
|
+
frag.appendChild(buildMonthDays(d.getFullYear(), d.getMonth()));
|
|
5577
|
+
}
|
|
5578
|
+
|
|
5579
|
+
self.daysContainer.appendChild(frag);
|
|
5580
|
+
self.days = self.daysContainer.firstChild;
|
|
5581
|
+
|
|
5582
|
+
if (self.config.mode === "range" && self.selectedDates.length === 1) {
|
|
5583
|
+
onMouseOver();
|
|
5584
|
+
}
|
|
5585
|
+
}
|
|
5586
|
+
|
|
5587
|
+
function buildMonthSwitch() {
|
|
5588
|
+
if (self.config.showMonths > 1 || self.config.monthSelectorType !== "dropdown") return;
|
|
5589
|
+
|
|
5590
|
+
const shouldBuildMonth = function (month) {
|
|
5591
|
+
if (self.config.minDate !== undefined && self.currentYear === self.config.minDate.getFullYear() && month < self.config.minDate.getMonth()) {
|
|
5592
|
+
return false;
|
|
5593
|
+
}
|
|
5594
|
+
|
|
5595
|
+
return !(self.config.maxDate !== undefined && self.currentYear === self.config.maxDate.getFullYear() && month > self.config.maxDate.getMonth());
|
|
5596
|
+
};
|
|
5597
|
+
|
|
5598
|
+
self.monthsDropdownContainer.tabIndex = -1;
|
|
5599
|
+
self.monthsDropdownContainer.innerHTML = "";
|
|
5600
|
+
|
|
5601
|
+
for (let i = 0; i < 12; i++) {
|
|
5602
|
+
if (!shouldBuildMonth(i)) continue;
|
|
5603
|
+
const month = (0, _dom.createElement)("option", "flatpickr-monthDropdown-month");
|
|
5604
|
+
month.value = new Date(self.currentYear, i).getMonth().toString();
|
|
5605
|
+
month.textContent = (0, _formatting.monthToStr)(i, self.config.shorthandCurrentMonth, self.l10n);
|
|
5606
|
+
month.tabIndex = -1;
|
|
5607
|
+
|
|
5608
|
+
if (self.currentMonth === i) {
|
|
5609
|
+
month.selected = true;
|
|
5610
|
+
}
|
|
5611
|
+
|
|
5612
|
+
self.monthsDropdownContainer.appendChild(month);
|
|
5613
|
+
}
|
|
5614
|
+
}
|
|
5615
|
+
|
|
5616
|
+
function buildMonth() {
|
|
5617
|
+
const container = (0, _dom.createElement)("div", "flatpickr-month");
|
|
5618
|
+
const monthNavFragment = window.document.createDocumentFragment();
|
|
5619
|
+
let monthElement;
|
|
5620
|
+
|
|
5621
|
+
if (self.config.showMonths > 1 || self.config.monthSelectorType === "static") {
|
|
5622
|
+
monthElement = (0, _dom.createElement)("span", "cur-month");
|
|
5623
|
+
} else {
|
|
5624
|
+
self.monthsDropdownContainer = (0, _dom.createElement)("select", "flatpickr-monthDropdown-months");
|
|
5625
|
+
self.monthsDropdownContainer.setAttribute("aria-label", self.l10n.monthAriaLabel);
|
|
5626
|
+
bind(self.monthsDropdownContainer, "change", e => {
|
|
5627
|
+
const target = (0, _dom.getEventTarget)(e);
|
|
5628
|
+
const selectedMonth = parseInt(target.value, 10);
|
|
5629
|
+
self.changeMonth(selectedMonth - self.currentMonth);
|
|
5630
|
+
triggerEvent("onMonthChange");
|
|
5631
|
+
});
|
|
5632
|
+
buildMonthSwitch();
|
|
5633
|
+
monthElement = self.monthsDropdownContainer;
|
|
5634
|
+
}
|
|
5635
|
+
|
|
5636
|
+
const yearInput = (0, _dom.createNumberInput)("cur-year", {
|
|
5637
|
+
tabindex: "-1"
|
|
5638
|
+
});
|
|
5639
|
+
const yearElement = yearInput.getElementsByTagName("input")[0];
|
|
5640
|
+
yearElement.setAttribute("aria-label", self.l10n.yearAriaLabel);
|
|
5641
|
+
|
|
5642
|
+
if (self.config.minDate) {
|
|
5643
|
+
yearElement.setAttribute("min", self.config.minDate.getFullYear().toString());
|
|
5644
|
+
}
|
|
5645
|
+
|
|
5646
|
+
if (self.config.maxDate) {
|
|
5647
|
+
yearElement.setAttribute("max", self.config.maxDate.getFullYear().toString());
|
|
5648
|
+
yearElement.disabled = !!self.config.minDate && self.config.minDate.getFullYear() === self.config.maxDate.getFullYear();
|
|
5649
|
+
}
|
|
5650
|
+
|
|
5651
|
+
const currentMonth = (0, _dom.createElement)("div", "flatpickr-current-month");
|
|
5652
|
+
currentMonth.appendChild(monthElement);
|
|
5653
|
+
currentMonth.appendChild(yearInput);
|
|
5654
|
+
monthNavFragment.appendChild(currentMonth);
|
|
5655
|
+
container.appendChild(monthNavFragment);
|
|
5656
|
+
return {
|
|
5657
|
+
container,
|
|
5658
|
+
yearElement,
|
|
5659
|
+
monthElement
|
|
5660
|
+
};
|
|
5661
|
+
}
|
|
5662
|
+
|
|
5663
|
+
function buildMonths() {
|
|
5664
|
+
(0, _dom.clearNode)(self.monthNav);
|
|
5665
|
+
self.monthNav.appendChild(self.prevMonthNav);
|
|
5666
|
+
|
|
5667
|
+
if (self.config.showMonths) {
|
|
5668
|
+
self.yearElements = [];
|
|
5669
|
+
self.monthElements = [];
|
|
5670
|
+
}
|
|
5671
|
+
|
|
5672
|
+
for (let m = self.config.showMonths; m--;) {
|
|
5673
|
+
const month = buildMonth();
|
|
5674
|
+
self.yearElements.push(month.yearElement);
|
|
5675
|
+
self.monthElements.push(month.monthElement);
|
|
5676
|
+
self.monthNav.appendChild(month.container);
|
|
5677
|
+
}
|
|
5678
|
+
|
|
5679
|
+
self.monthNav.appendChild(self.nextMonthNav);
|
|
5680
|
+
}
|
|
5681
|
+
|
|
5682
|
+
function buildMonthNav() {
|
|
5683
|
+
self.monthNav = (0, _dom.createElement)("div", "flatpickr-months");
|
|
5684
|
+
self.yearElements = [];
|
|
5685
|
+
self.monthElements = [];
|
|
5686
|
+
self.prevMonthNav = (0, _dom.createElement)("span", "flatpickr-prev-month");
|
|
5687
|
+
self.prevMonthNav.innerHTML = self.config.prevArrow;
|
|
5688
|
+
self.nextMonthNav = (0, _dom.createElement)("span", "flatpickr-next-month");
|
|
5689
|
+
self.nextMonthNav.innerHTML = self.config.nextArrow;
|
|
5690
|
+
buildMonths();
|
|
5691
|
+
Object.defineProperty(self, "_hidePrevMonthArrow", {
|
|
5692
|
+
get: () => self.__hidePrevMonthArrow,
|
|
5693
|
+
|
|
5694
|
+
set(bool) {
|
|
5695
|
+
if (self.__hidePrevMonthArrow !== bool) {
|
|
5696
|
+
(0, _dom.toggleClass)(self.prevMonthNav, "flatpickr-disabled", bool);
|
|
5697
|
+
self.__hidePrevMonthArrow = bool;
|
|
5698
|
+
}
|
|
5699
|
+
}
|
|
5700
|
+
|
|
5701
|
+
});
|
|
5702
|
+
Object.defineProperty(self, "_hideNextMonthArrow", {
|
|
5703
|
+
get: () => self.__hideNextMonthArrow,
|
|
5704
|
+
|
|
5705
|
+
set(bool) {
|
|
5706
|
+
if (self.__hideNextMonthArrow !== bool) {
|
|
5707
|
+
(0, _dom.toggleClass)(self.nextMonthNav, "flatpickr-disabled", bool);
|
|
5708
|
+
self.__hideNextMonthArrow = bool;
|
|
5709
|
+
}
|
|
5710
|
+
}
|
|
5711
|
+
|
|
5712
|
+
});
|
|
5713
|
+
self.currentYearElement = self.yearElements[0];
|
|
5714
|
+
updateNavigationCurrentMonth();
|
|
5715
|
+
return self.monthNav;
|
|
5716
|
+
}
|
|
5717
|
+
|
|
5718
|
+
function buildTime() {
|
|
5719
|
+
self.calendarContainer.classList.add("hasTime");
|
|
5720
|
+
if (self.config.noCalendar) self.calendarContainer.classList.add("noCalendar");
|
|
5721
|
+
const defaults = (0, _dates.getDefaultHours)(self.config);
|
|
5722
|
+
self.timeContainer = (0, _dom.createElement)("div", "flatpickr-time");
|
|
5723
|
+
self.timeContainer.tabIndex = -1;
|
|
5724
|
+
const separator = (0, _dom.createElement)("span", "flatpickr-time-separator", ":");
|
|
5725
|
+
const hourInput = (0, _dom.createNumberInput)("flatpickr-hour", {
|
|
5726
|
+
"aria-label": self.l10n.hourAriaLabel
|
|
5727
|
+
});
|
|
5728
|
+
self.hourElement = hourInput.getElementsByTagName("input")[0];
|
|
5729
|
+
const minuteInput = (0, _dom.createNumberInput)("flatpickr-minute", {
|
|
5730
|
+
"aria-label": self.l10n.minuteAriaLabel
|
|
5731
|
+
});
|
|
5732
|
+
self.minuteElement = minuteInput.getElementsByTagName("input")[0];
|
|
5733
|
+
self.hourElement.tabIndex = self.minuteElement.tabIndex = -1;
|
|
5734
|
+
self.hourElement.value = (0, _utils.pad)(self.latestSelectedDateObj ? self.latestSelectedDateObj.getHours() : self.config.time_24hr ? defaults.hours : military2ampm(defaults.hours));
|
|
5735
|
+
self.minuteElement.value = (0, _utils.pad)(self.latestSelectedDateObj ? self.latestSelectedDateObj.getMinutes() : defaults.minutes);
|
|
5736
|
+
self.hourElement.setAttribute("step", self.config.hourIncrement.toString());
|
|
5737
|
+
self.minuteElement.setAttribute("step", self.config.minuteIncrement.toString());
|
|
5738
|
+
self.hourElement.setAttribute("min", self.config.time_24hr ? "0" : "1");
|
|
5739
|
+
self.hourElement.setAttribute("max", self.config.time_24hr ? "23" : "12");
|
|
5740
|
+
self.hourElement.setAttribute("maxlength", "2");
|
|
5741
|
+
self.minuteElement.setAttribute("min", "0");
|
|
5742
|
+
self.minuteElement.setAttribute("max", "59");
|
|
5743
|
+
self.minuteElement.setAttribute("maxlength", "2");
|
|
5744
|
+
self.timeContainer.appendChild(hourInput);
|
|
5745
|
+
self.timeContainer.appendChild(separator);
|
|
5746
|
+
self.timeContainer.appendChild(minuteInput);
|
|
5747
|
+
if (self.config.time_24hr) self.timeContainer.classList.add("time24hr");
|
|
5748
|
+
|
|
5749
|
+
if (self.config.enableSeconds) {
|
|
5750
|
+
self.timeContainer.classList.add("hasSeconds");
|
|
5751
|
+
const secondInput = (0, _dom.createNumberInput)("flatpickr-second");
|
|
5752
|
+
self.secondElement = secondInput.getElementsByTagName("input")[0];
|
|
5753
|
+
self.secondElement.value = (0, _utils.pad)(self.latestSelectedDateObj ? self.latestSelectedDateObj.getSeconds() : defaults.seconds);
|
|
5754
|
+
self.secondElement.setAttribute("step", self.minuteElement.getAttribute("step"));
|
|
5755
|
+
self.secondElement.setAttribute("min", "0");
|
|
5756
|
+
self.secondElement.setAttribute("max", "59");
|
|
5757
|
+
self.secondElement.setAttribute("maxlength", "2");
|
|
5758
|
+
self.timeContainer.appendChild((0, _dom.createElement)("span", "flatpickr-time-separator", ":"));
|
|
5759
|
+
self.timeContainer.appendChild(secondInput);
|
|
5760
|
+
}
|
|
5761
|
+
|
|
5762
|
+
if (!self.config.time_24hr) {
|
|
5763
|
+
self.amPM = (0, _dom.createElement)("span", "flatpickr-am-pm", self.l10n.amPM[(0, _utils.int)((self.latestSelectedDateObj ? self.hourElement.value : self.config.defaultHour) > 11)]);
|
|
5764
|
+
self.amPM.title = self.l10n.toggleTitle;
|
|
5765
|
+
self.amPM.tabIndex = -1;
|
|
5766
|
+
self.timeContainer.appendChild(self.amPM);
|
|
5767
|
+
}
|
|
5768
|
+
|
|
5769
|
+
return self.timeContainer;
|
|
5770
|
+
}
|
|
5771
|
+
|
|
5772
|
+
function buildWeekdays() {
|
|
5773
|
+
if (!self.weekdayContainer) self.weekdayContainer = (0, _dom.createElement)("div", "flatpickr-weekdays");else (0, _dom.clearNode)(self.weekdayContainer);
|
|
5774
|
+
|
|
5775
|
+
for (let i = self.config.showMonths; i--;) {
|
|
5776
|
+
const container = (0, _dom.createElement)("div", "flatpickr-weekdaycontainer");
|
|
5777
|
+
self.weekdayContainer.appendChild(container);
|
|
5778
|
+
}
|
|
5779
|
+
|
|
5780
|
+
updateWeekdays();
|
|
5781
|
+
return self.weekdayContainer;
|
|
5782
|
+
}
|
|
5783
|
+
|
|
5784
|
+
function updateWeekdays() {
|
|
5785
|
+
if (!self.weekdayContainer) {
|
|
5786
|
+
return;
|
|
5787
|
+
}
|
|
5788
|
+
|
|
5789
|
+
const firstDayOfWeek = self.l10n.firstDayOfWeek;
|
|
5790
|
+
let weekdays = [...self.l10n.weekdays.shorthand];
|
|
5791
|
+
|
|
5792
|
+
if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) {
|
|
5793
|
+
weekdays = [...weekdays.splice(firstDayOfWeek, weekdays.length), ...weekdays.splice(0, firstDayOfWeek)];
|
|
5794
|
+
}
|
|
5795
|
+
|
|
5796
|
+
for (let i = self.config.showMonths; i--;) {
|
|
5797
|
+
self.weekdayContainer.children[i].innerHTML = `
|
|
5798
|
+
<span class='flatpickr-weekday'>
|
|
5799
|
+
${weekdays.join("</span><span class='flatpickr-weekday'>")}
|
|
5800
|
+
</span>
|
|
5801
|
+
`;
|
|
5802
|
+
}
|
|
5803
|
+
}
|
|
5804
|
+
|
|
5805
|
+
function buildWeeks() {
|
|
5806
|
+
self.calendarContainer.classList.add("hasWeeks");
|
|
5807
|
+
const weekWrapper = (0, _dom.createElement)("div", "flatpickr-weekwrapper");
|
|
5808
|
+
weekWrapper.appendChild((0, _dom.createElement)("span", "flatpickr-weekday", self.l10n.weekAbbreviation));
|
|
5809
|
+
const weekNumbers = (0, _dom.createElement)("div", "flatpickr-weeks");
|
|
5810
|
+
weekWrapper.appendChild(weekNumbers);
|
|
5811
|
+
return {
|
|
5812
|
+
weekWrapper,
|
|
5813
|
+
weekNumbers
|
|
5814
|
+
};
|
|
5815
|
+
}
|
|
5816
|
+
|
|
5817
|
+
function changeMonth(value, isOffset = true) {
|
|
5818
|
+
const delta = isOffset ? value : value - self.currentMonth;
|
|
5819
|
+
if (delta < 0 && self._hidePrevMonthArrow === true || delta > 0 && self._hideNextMonthArrow === true) return;
|
|
5820
|
+
self.currentMonth += delta;
|
|
5821
|
+
|
|
5822
|
+
if (self.currentMonth < 0 || self.currentMonth > 11) {
|
|
5823
|
+
self.currentYear += self.currentMonth > 11 ? 1 : -1;
|
|
5824
|
+
self.currentMonth = (self.currentMonth + 12) % 12;
|
|
5825
|
+
triggerEvent("onYearChange");
|
|
5826
|
+
buildMonthSwitch();
|
|
5827
|
+
}
|
|
5828
|
+
|
|
5829
|
+
buildDays();
|
|
5830
|
+
triggerEvent("onMonthChange");
|
|
5831
|
+
updateNavigationCurrentMonth();
|
|
5832
|
+
}
|
|
5833
|
+
|
|
5834
|
+
function clear(triggerChangeEvent = true, toInitial = true) {
|
|
5835
|
+
self.input.value = "";
|
|
5836
|
+
if (self.altInput !== undefined) self.altInput.value = "";
|
|
5837
|
+
if (self.mobileInput !== undefined) self.mobileInput.value = "";
|
|
5838
|
+
self.selectedDates = [];
|
|
5839
|
+
self.latestSelectedDateObj = undefined;
|
|
5840
|
+
|
|
5841
|
+
if (toInitial === true) {
|
|
5842
|
+
self.currentYear = self._initialDate.getFullYear();
|
|
5843
|
+
self.currentMonth = self._initialDate.getMonth();
|
|
5844
|
+
}
|
|
5845
|
+
|
|
5846
|
+
if (self.config.enableTime === true) {
|
|
5847
|
+
const {
|
|
5848
|
+
hours,
|
|
5849
|
+
minutes,
|
|
5850
|
+
seconds
|
|
5851
|
+
} = (0, _dates.getDefaultHours)(self.config);
|
|
5852
|
+
setHours(hours, minutes, seconds);
|
|
5853
|
+
}
|
|
5854
|
+
|
|
5855
|
+
self.redraw();
|
|
5856
|
+
if (triggerChangeEvent) triggerEvent("onChange");
|
|
5857
|
+
}
|
|
5858
|
+
|
|
5859
|
+
function close() {
|
|
5860
|
+
self.isOpen = false;
|
|
5861
|
+
|
|
5862
|
+
if (!self.isMobile) {
|
|
5863
|
+
if (self.calendarContainer !== undefined) {
|
|
5864
|
+
self.calendarContainer.classList.remove("open");
|
|
5865
|
+
}
|
|
5866
|
+
|
|
5867
|
+
if (self._input !== undefined) {
|
|
5868
|
+
self._input.classList.remove("active");
|
|
5869
|
+
}
|
|
5870
|
+
}
|
|
5871
|
+
|
|
5872
|
+
triggerEvent("onClose");
|
|
5873
|
+
}
|
|
5874
|
+
|
|
5875
|
+
function destroy() {
|
|
5876
|
+
if (self.config !== undefined) triggerEvent("onDestroy");
|
|
5877
|
+
|
|
5878
|
+
for (let i = self._handlers.length; i--;) {
|
|
5879
|
+
self._handlers[i].remove();
|
|
5880
|
+
}
|
|
5881
|
+
|
|
5882
|
+
self._handlers = [];
|
|
5883
|
+
|
|
5884
|
+
if (self.mobileInput) {
|
|
5885
|
+
if (self.mobileInput.parentNode) self.mobileInput.parentNode.removeChild(self.mobileInput);
|
|
5886
|
+
self.mobileInput = undefined;
|
|
5887
|
+
} else if (self.calendarContainer && self.calendarContainer.parentNode) {
|
|
5888
|
+
if (self.config.static && self.calendarContainer.parentNode) {
|
|
5889
|
+
const wrapper = self.calendarContainer.parentNode;
|
|
5890
|
+
wrapper.lastChild && wrapper.removeChild(wrapper.lastChild);
|
|
5891
|
+
|
|
5892
|
+
if (wrapper.parentNode) {
|
|
5893
|
+
while (wrapper.firstChild) wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper);
|
|
5894
|
+
|
|
5895
|
+
wrapper.parentNode.removeChild(wrapper);
|
|
5896
|
+
}
|
|
5897
|
+
} else self.calendarContainer.parentNode.removeChild(self.calendarContainer);
|
|
5898
|
+
}
|
|
5899
|
+
|
|
5900
|
+
if (self.altInput) {
|
|
5901
|
+
self.input.type = "text";
|
|
5902
|
+
if (self.altInput.parentNode) self.altInput.parentNode.removeChild(self.altInput);
|
|
5903
|
+
delete self.altInput;
|
|
5904
|
+
}
|
|
5905
|
+
|
|
5906
|
+
if (self.input) {
|
|
5907
|
+
self.input.type = self.input._type;
|
|
5908
|
+
self.input.classList.remove("flatpickr-input");
|
|
5909
|
+
self.input.removeAttribute("readonly");
|
|
5910
|
+
}
|
|
5911
|
+
|
|
5912
|
+
["_showTimeInput", "latestSelectedDateObj", "_hideNextMonthArrow", "_hidePrevMonthArrow", "__hideNextMonthArrow", "__hidePrevMonthArrow", "isMobile", "isOpen", "selectedDateElem", "minDateHasTime", "maxDateHasTime", "days", "daysContainer", "_input", "_positionElement", "innerContainer", "rContainer", "monthNav", "todayDateElem", "calendarContainer", "weekdayContainer", "prevMonthNav", "nextMonthNav", "monthsDropdownContainer", "currentMonthElement", "currentYearElement", "navigationCurrentMonth", "selectedDateElem", "config"].forEach(k => {
|
|
5913
|
+
try {
|
|
5914
|
+
delete self[k];
|
|
5915
|
+
} catch (_) {}
|
|
5916
|
+
});
|
|
5917
|
+
}
|
|
5918
|
+
|
|
5919
|
+
function isCalendarElem(elem) {
|
|
5920
|
+
if (self.config.appendTo && self.config.appendTo.contains(elem)) return true;
|
|
5921
|
+
return self.calendarContainer.contains(elem);
|
|
5922
|
+
}
|
|
5923
|
+
|
|
5924
|
+
function documentClick(e) {
|
|
5925
|
+
if (self.isOpen && !self.config.inline) {
|
|
5926
|
+
const eventTarget = (0, _dom.getEventTarget)(e);
|
|
5927
|
+
const isCalendarElement = isCalendarElem(eventTarget);
|
|
5928
|
+
const isInput = eventTarget === self.input || eventTarget === self.altInput || self.element.contains(eventTarget) || e.path && e.path.indexOf && (~e.path.indexOf(self.input) || ~e.path.indexOf(self.altInput));
|
|
5929
|
+
const lostFocus = e.type === "blur" ? isInput && e.relatedTarget && !isCalendarElem(e.relatedTarget) : !isInput && !isCalendarElement && !isCalendarElem(e.relatedTarget);
|
|
5930
|
+
const isIgnored = !self.config.ignoredFocusElements.some(elem => elem.contains(eventTarget));
|
|
5931
|
+
|
|
5932
|
+
if (lostFocus && isIgnored) {
|
|
5933
|
+
if (self.timeContainer !== undefined && self.minuteElement !== undefined && self.hourElement !== undefined && self.input.value !== "" && self.input.value !== undefined) {
|
|
5934
|
+
updateTime();
|
|
5935
|
+
}
|
|
5936
|
+
|
|
5937
|
+
self.close();
|
|
5938
|
+
|
|
5939
|
+
if (self.config && self.config.mode === "range" && self.selectedDates.length === 1) {
|
|
5940
|
+
self.clear(false);
|
|
5941
|
+
self.redraw();
|
|
5942
|
+
}
|
|
5943
|
+
}
|
|
5944
|
+
}
|
|
5945
|
+
}
|
|
5946
|
+
|
|
5947
|
+
function changeYear(newYear) {
|
|
5948
|
+
if (!newYear || self.config.minDate && newYear < self.config.minDate.getFullYear() || self.config.maxDate && newYear > self.config.maxDate.getFullYear()) return;
|
|
5949
|
+
const newYearNum = newYear,
|
|
5950
|
+
isNewYear = self.currentYear !== newYearNum;
|
|
5951
|
+
self.currentYear = newYearNum || self.currentYear;
|
|
5952
|
+
|
|
5953
|
+
if (self.config.maxDate && self.currentYear === self.config.maxDate.getFullYear()) {
|
|
5954
|
+
self.currentMonth = Math.min(self.config.maxDate.getMonth(), self.currentMonth);
|
|
5955
|
+
} else if (self.config.minDate && self.currentYear === self.config.minDate.getFullYear()) {
|
|
5956
|
+
self.currentMonth = Math.max(self.config.minDate.getMonth(), self.currentMonth);
|
|
5957
|
+
}
|
|
5958
|
+
|
|
5959
|
+
if (isNewYear) {
|
|
5960
|
+
self.redraw();
|
|
5961
|
+
triggerEvent("onYearChange");
|
|
5962
|
+
buildMonthSwitch();
|
|
5963
|
+
}
|
|
5964
|
+
}
|
|
5965
|
+
|
|
5966
|
+
function isEnabled(date, timeless = true) {
|
|
5967
|
+
var _a;
|
|
5968
|
+
|
|
5969
|
+
const dateToCheck = self.parseDate(date, undefined, timeless);
|
|
5970
|
+
if (self.config.minDate && dateToCheck && (0, _dates.compareDates)(dateToCheck, self.config.minDate, timeless !== undefined ? timeless : !self.minDateHasTime) < 0 || self.config.maxDate && dateToCheck && (0, _dates.compareDates)(dateToCheck, self.config.maxDate, timeless !== undefined ? timeless : !self.maxDateHasTime) > 0) return false;
|
|
5971
|
+
if (!self.config.enable && self.config.disable.length === 0) return true;
|
|
5972
|
+
if (dateToCheck === undefined) return false;
|
|
5973
|
+
const bool = !!self.config.enable,
|
|
5974
|
+
array = (_a = self.config.enable) !== null && _a !== void 0 ? _a : self.config.disable;
|
|
5975
|
+
|
|
5976
|
+
for (let i = 0, d; i < array.length; i++) {
|
|
5977
|
+
d = array[i];
|
|
5978
|
+
if (typeof d === "function" && d(dateToCheck)) return bool;else if (d instanceof Date && dateToCheck !== undefined && d.getTime() === dateToCheck.getTime()) return bool;else if (typeof d === "string") {
|
|
5979
|
+
const parsed = self.parseDate(d, undefined, true);
|
|
5980
|
+
return parsed && parsed.getTime() === dateToCheck.getTime() ? bool : !bool;
|
|
5981
|
+
} else if (typeof d === "object" && dateToCheck !== undefined && d.from && d.to && dateToCheck.getTime() >= d.from.getTime() && dateToCheck.getTime() <= d.to.getTime()) return bool;
|
|
5982
|
+
}
|
|
5983
|
+
|
|
5984
|
+
return !bool;
|
|
5985
|
+
}
|
|
5986
|
+
|
|
5987
|
+
function isInView(elem) {
|
|
5988
|
+
if (self.daysContainer !== undefined) return elem.className.indexOf("hidden") === -1 && elem.className.indexOf("flatpickr-disabled") === -1 && self.daysContainer.contains(elem);
|
|
5989
|
+
return false;
|
|
5990
|
+
}
|
|
5991
|
+
|
|
5992
|
+
function onBlur(e) {
|
|
5993
|
+
const isInput = e.target === self._input;
|
|
5994
|
+
|
|
5995
|
+
if (isInput && (self.selectedDates.length > 0 || self._input.value.length > 0) && !(e.relatedTarget && isCalendarElem(e.relatedTarget))) {
|
|
5996
|
+
self.setDate(self._input.value, true, e.target === self.altInput ? self.config.altFormat : self.config.dateFormat);
|
|
5997
|
+
}
|
|
5998
|
+
}
|
|
5999
|
+
|
|
6000
|
+
function onKeyDown(e) {
|
|
6001
|
+
const eventTarget = (0, _dom.getEventTarget)(e);
|
|
6002
|
+
const isInput = self.config.wrap ? element.contains(eventTarget) : eventTarget === self._input;
|
|
6003
|
+
const allowInput = self.config.allowInput;
|
|
6004
|
+
const allowKeydown = self.isOpen && (!allowInput || !isInput);
|
|
6005
|
+
const allowInlineKeydown = self.config.inline && isInput && !allowInput;
|
|
6006
|
+
|
|
6007
|
+
if (e.keyCode === 13 && isInput) {
|
|
6008
|
+
if (allowInput) {
|
|
6009
|
+
self.setDate(self._input.value, true, eventTarget === self.altInput ? self.config.altFormat : self.config.dateFormat);
|
|
6010
|
+
return eventTarget.blur();
|
|
6011
|
+
} else {
|
|
6012
|
+
self.open();
|
|
6013
|
+
}
|
|
6014
|
+
} else if (isCalendarElem(eventTarget) || allowKeydown || allowInlineKeydown) {
|
|
6015
|
+
const isTimeObj = !!self.timeContainer && self.timeContainer.contains(eventTarget);
|
|
6016
|
+
|
|
6017
|
+
switch (e.keyCode) {
|
|
6018
|
+
case 13:
|
|
6019
|
+
if (isTimeObj) {
|
|
6020
|
+
e.preventDefault();
|
|
6021
|
+
updateTime();
|
|
6022
|
+
focusAndClose();
|
|
6023
|
+
} else selectDate(e);
|
|
6024
|
+
|
|
6025
|
+
break;
|
|
6026
|
+
|
|
6027
|
+
case 27:
|
|
6028
|
+
e.preventDefault();
|
|
6029
|
+
focusAndClose();
|
|
6030
|
+
break;
|
|
6031
|
+
|
|
6032
|
+
case 8:
|
|
6033
|
+
case 46:
|
|
6034
|
+
if (isInput && !self.config.allowInput) {
|
|
6035
|
+
e.preventDefault();
|
|
6036
|
+
self.clear();
|
|
6037
|
+
}
|
|
6038
|
+
|
|
6039
|
+
break;
|
|
6040
|
+
|
|
6041
|
+
case 37:
|
|
6042
|
+
case 39:
|
|
6043
|
+
if (!isTimeObj && !isInput) {
|
|
6044
|
+
e.preventDefault();
|
|
6045
|
+
|
|
6046
|
+
if (self.daysContainer !== undefined && (allowInput === false || document.activeElement && isInView(document.activeElement))) {
|
|
6047
|
+
const delta = e.keyCode === 39 ? 1 : -1;
|
|
6048
|
+
if (!e.ctrlKey) focusOnDay(undefined, delta);else {
|
|
6049
|
+
e.stopPropagation();
|
|
6050
|
+
changeMonth(delta);
|
|
6051
|
+
focusOnDay(getFirstAvailableDay(1), 0);
|
|
6052
|
+
}
|
|
6053
|
+
}
|
|
6054
|
+
} else if (self.hourElement) self.hourElement.focus();
|
|
6055
|
+
|
|
6056
|
+
break;
|
|
6057
|
+
|
|
6058
|
+
case 38:
|
|
6059
|
+
case 40:
|
|
6060
|
+
e.preventDefault();
|
|
6061
|
+
const delta = e.keyCode === 40 ? 1 : -1;
|
|
6062
|
+
|
|
6063
|
+
if (self.daysContainer && eventTarget.$i !== undefined || eventTarget === self.input || eventTarget === self.altInput) {
|
|
6064
|
+
if (e.ctrlKey) {
|
|
6065
|
+
e.stopPropagation();
|
|
6066
|
+
changeYear(self.currentYear - delta);
|
|
6067
|
+
focusOnDay(getFirstAvailableDay(1), 0);
|
|
6068
|
+
} else if (!isTimeObj) focusOnDay(undefined, delta * 7);
|
|
6069
|
+
} else if (eventTarget === self.currentYearElement) {
|
|
6070
|
+
changeYear(self.currentYear - delta);
|
|
6071
|
+
} else if (self.config.enableTime) {
|
|
6072
|
+
if (!isTimeObj && self.hourElement) self.hourElement.focus();
|
|
6073
|
+
updateTime(e);
|
|
6074
|
+
|
|
6075
|
+
self._debouncedChange();
|
|
6076
|
+
}
|
|
6077
|
+
|
|
6078
|
+
break;
|
|
6079
|
+
|
|
6080
|
+
case 9:
|
|
6081
|
+
if (isTimeObj) {
|
|
6082
|
+
const elems = [self.hourElement, self.minuteElement, self.secondElement, self.amPM].concat(self.pluginElements).filter(x => x);
|
|
6083
|
+
const i = elems.indexOf(eventTarget);
|
|
6084
|
+
|
|
6085
|
+
if (i !== -1) {
|
|
6086
|
+
const target = elems[i + (e.shiftKey ? -1 : 1)];
|
|
6087
|
+
e.preventDefault();
|
|
6088
|
+
|
|
6089
|
+
(target || self._input).focus();
|
|
6090
|
+
}
|
|
6091
|
+
} else if (!self.config.noCalendar && self.daysContainer && self.daysContainer.contains(eventTarget) && e.shiftKey) {
|
|
6092
|
+
e.preventDefault();
|
|
6093
|
+
|
|
6094
|
+
self._input.focus();
|
|
6095
|
+
}
|
|
6096
|
+
|
|
6097
|
+
break;
|
|
6098
|
+
|
|
6099
|
+
default:
|
|
6100
|
+
break;
|
|
6101
|
+
}
|
|
6102
|
+
}
|
|
6103
|
+
|
|
6104
|
+
if (self.amPM !== undefined && eventTarget === self.amPM) {
|
|
6105
|
+
switch (e.key) {
|
|
6106
|
+
case self.l10n.amPM[0].charAt(0):
|
|
6107
|
+
case self.l10n.amPM[0].charAt(0).toLowerCase():
|
|
6108
|
+
self.amPM.textContent = self.l10n.amPM[0];
|
|
6109
|
+
setHoursFromInputs();
|
|
6110
|
+
updateValue();
|
|
6111
|
+
break;
|
|
6112
|
+
|
|
6113
|
+
case self.l10n.amPM[1].charAt(0):
|
|
6114
|
+
case self.l10n.amPM[1].charAt(0).toLowerCase():
|
|
6115
|
+
self.amPM.textContent = self.l10n.amPM[1];
|
|
6116
|
+
setHoursFromInputs();
|
|
6117
|
+
updateValue();
|
|
6118
|
+
break;
|
|
6119
|
+
}
|
|
6120
|
+
}
|
|
6121
|
+
|
|
6122
|
+
if (isInput || isCalendarElem(eventTarget)) {
|
|
6123
|
+
triggerEvent("onKeyDown", e);
|
|
6124
|
+
}
|
|
6125
|
+
}
|
|
6126
|
+
|
|
6127
|
+
function onMouseOver(elem) {
|
|
6128
|
+
if (self.selectedDates.length !== 1 || elem && (!elem.classList.contains("flatpickr-day") || elem.classList.contains("flatpickr-disabled"))) return;
|
|
6129
|
+
const hoverDate = elem ? elem.dateObj.getTime() : self.days.firstElementChild.dateObj.getTime(),
|
|
6130
|
+
initialDate = self.parseDate(self.selectedDates[0], undefined, true).getTime(),
|
|
6131
|
+
rangeStartDate = Math.min(hoverDate, self.selectedDates[0].getTime()),
|
|
6132
|
+
rangeEndDate = Math.max(hoverDate, self.selectedDates[0].getTime());
|
|
6133
|
+
let containsDisabled = false;
|
|
6134
|
+
let minRange = 0,
|
|
6135
|
+
maxRange = 0;
|
|
6136
|
+
|
|
6137
|
+
for (let t = rangeStartDate; t < rangeEndDate; t += _dates.duration.DAY) {
|
|
6138
|
+
if (!isEnabled(new Date(t), true)) {
|
|
6139
|
+
containsDisabled = containsDisabled || t > rangeStartDate && t < rangeEndDate;
|
|
6140
|
+
if (t < initialDate && (!minRange || t > minRange)) minRange = t;else if (t > initialDate && (!maxRange || t < maxRange)) maxRange = t;
|
|
6141
|
+
}
|
|
6142
|
+
}
|
|
6143
|
+
|
|
6144
|
+
for (let m = 0; m < self.config.showMonths; m++) {
|
|
6145
|
+
const month = self.daysContainer.children[m];
|
|
6146
|
+
|
|
6147
|
+
for (let i = 0, l = month.children.length; i < l; i++) {
|
|
6148
|
+
const dayElem = month.children[i],
|
|
6149
|
+
date = dayElem.dateObj;
|
|
6150
|
+
const timestamp = date.getTime();
|
|
6151
|
+
const outOfRange = minRange > 0 && timestamp < minRange || maxRange > 0 && timestamp > maxRange;
|
|
6152
|
+
|
|
6153
|
+
if (outOfRange) {
|
|
6154
|
+
dayElem.classList.add("notAllowed");
|
|
6155
|
+
["inRange", "startRange", "endRange"].forEach(c => {
|
|
6156
|
+
dayElem.classList.remove(c);
|
|
6157
|
+
});
|
|
6158
|
+
continue;
|
|
6159
|
+
} else if (containsDisabled && !outOfRange) continue;
|
|
6160
|
+
|
|
6161
|
+
["startRange", "inRange", "endRange", "notAllowed"].forEach(c => {
|
|
6162
|
+
dayElem.classList.remove(c);
|
|
6163
|
+
});
|
|
6164
|
+
|
|
6165
|
+
if (elem !== undefined) {
|
|
6166
|
+
elem.classList.add(hoverDate <= self.selectedDates[0].getTime() ? "startRange" : "endRange");
|
|
6167
|
+
if (initialDate < hoverDate && timestamp === initialDate) dayElem.classList.add("startRange");else if (initialDate > hoverDate && timestamp === initialDate) dayElem.classList.add("endRange");
|
|
6168
|
+
if (timestamp >= minRange && (maxRange === 0 || timestamp <= maxRange) && (0, _dates.isBetween)(timestamp, initialDate, hoverDate)) dayElem.classList.add("inRange");
|
|
6169
|
+
}
|
|
6170
|
+
}
|
|
6171
|
+
}
|
|
6172
|
+
}
|
|
6173
|
+
|
|
6174
|
+
function onResize() {
|
|
6175
|
+
if (self.isOpen && !self.config.static && !self.config.inline) positionCalendar();
|
|
6176
|
+
}
|
|
6177
|
+
|
|
6178
|
+
function open(e, positionElement = self._positionElement) {
|
|
6179
|
+
if (self.isMobile === true) {
|
|
6180
|
+
if (e) {
|
|
6181
|
+
e.preventDefault();
|
|
6182
|
+
const eventTarget = (0, _dom.getEventTarget)(e);
|
|
6183
|
+
|
|
6184
|
+
if (eventTarget) {
|
|
6185
|
+
eventTarget.blur();
|
|
6186
|
+
}
|
|
6187
|
+
}
|
|
6188
|
+
|
|
6189
|
+
if (self.mobileInput !== undefined) {
|
|
6190
|
+
self.mobileInput.focus();
|
|
6191
|
+
self.mobileInput.click();
|
|
6192
|
+
}
|
|
6193
|
+
|
|
6194
|
+
triggerEvent("onOpen");
|
|
6195
|
+
return;
|
|
6196
|
+
} else if (self._input.disabled || self.config.inline) {
|
|
6197
|
+
return;
|
|
6198
|
+
}
|
|
6199
|
+
|
|
6200
|
+
const wasOpen = self.isOpen;
|
|
6201
|
+
self.isOpen = true;
|
|
6202
|
+
|
|
6203
|
+
if (!wasOpen) {
|
|
6204
|
+
self.calendarContainer.classList.add("open");
|
|
6205
|
+
|
|
6206
|
+
self._input.classList.add("active");
|
|
6207
|
+
|
|
6208
|
+
triggerEvent("onOpen");
|
|
6209
|
+
positionCalendar(positionElement);
|
|
6210
|
+
}
|
|
6211
|
+
|
|
6212
|
+
if (self.config.enableTime === true && self.config.noCalendar === true) {
|
|
6213
|
+
if (self.config.allowInput === false && (e === undefined || !self.timeContainer.contains(e.relatedTarget))) {
|
|
6214
|
+
setTimeout(() => self.hourElement.select(), 50);
|
|
6215
|
+
}
|
|
6216
|
+
}
|
|
6217
|
+
}
|
|
6218
|
+
|
|
6219
|
+
function minMaxDateSetter(type) {
|
|
6220
|
+
return date => {
|
|
6221
|
+
const dateObj = self.config[`_${type}Date`] = self.parseDate(date, self.config.dateFormat);
|
|
6222
|
+
const inverseDateObj = self.config[`_${type === "min" ? "max" : "min"}Date`];
|
|
6223
|
+
|
|
6224
|
+
if (dateObj !== undefined) {
|
|
6225
|
+
self[type === "min" ? "minDateHasTime" : "maxDateHasTime"] = dateObj.getHours() > 0 || dateObj.getMinutes() > 0 || dateObj.getSeconds() > 0;
|
|
6226
|
+
}
|
|
6227
|
+
|
|
6228
|
+
if (self.selectedDates) {
|
|
6229
|
+
self.selectedDates = self.selectedDates.filter(d => isEnabled(d));
|
|
6230
|
+
if (!self.selectedDates.length && type === "min") setHoursFromDate(dateObj);
|
|
6231
|
+
updateValue();
|
|
6232
|
+
}
|
|
6233
|
+
|
|
6234
|
+
if (self.daysContainer) {
|
|
6235
|
+
redraw();
|
|
6236
|
+
if (dateObj !== undefined) self.currentYearElement[type] = dateObj.getFullYear().toString();else self.currentYearElement.removeAttribute(type);
|
|
6237
|
+
self.currentYearElement.disabled = !!inverseDateObj && dateObj !== undefined && inverseDateObj.getFullYear() === dateObj.getFullYear();
|
|
6238
|
+
}
|
|
6239
|
+
};
|
|
6240
|
+
}
|
|
6241
|
+
|
|
6242
|
+
function parseConfig() {
|
|
6243
|
+
const boolOpts = ["wrap", "weekNumbers", "allowInput", "allowInvalidPreload", "clickOpens", "time_24hr", "enableTime", "noCalendar", "altInput", "shorthandCurrentMonth", "inline", "static", "enableSeconds", "disableMobile"];
|
|
6244
|
+
const userConfig = Object.assign(Object.assign({}, JSON.parse(JSON.stringify(element.dataset || {}))), instanceConfig);
|
|
6245
|
+
const formats = {};
|
|
6246
|
+
self.config.parseDate = userConfig.parseDate;
|
|
6247
|
+
self.config.formatDate = userConfig.formatDate;
|
|
6248
|
+
Object.defineProperty(self.config, "enable", {
|
|
6249
|
+
get: () => self.config._enable,
|
|
6250
|
+
set: dates => {
|
|
6251
|
+
self.config._enable = parseDateRules(dates);
|
|
6252
|
+
}
|
|
6253
|
+
});
|
|
6254
|
+
Object.defineProperty(self.config, "disable", {
|
|
6255
|
+
get: () => self.config._disable,
|
|
6256
|
+
set: dates => {
|
|
6257
|
+
self.config._disable = parseDateRules(dates);
|
|
6258
|
+
}
|
|
6259
|
+
});
|
|
6260
|
+
const timeMode = userConfig.mode === "time";
|
|
6261
|
+
|
|
6262
|
+
if (!userConfig.dateFormat && (userConfig.enableTime || timeMode)) {
|
|
6263
|
+
const defaultDateFormat = flatpickr.defaultConfig.dateFormat || _options.defaults.dateFormat;
|
|
6264
|
+
formats.dateFormat = userConfig.noCalendar || timeMode ? "H:i" + (userConfig.enableSeconds ? ":S" : "") : defaultDateFormat + " H:i" + (userConfig.enableSeconds ? ":S" : "");
|
|
6265
|
+
}
|
|
6266
|
+
|
|
6267
|
+
if (userConfig.altInput && (userConfig.enableTime || timeMode) && !userConfig.altFormat) {
|
|
6268
|
+
const defaultAltFormat = flatpickr.defaultConfig.altFormat || _options.defaults.altFormat;
|
|
6269
|
+
formats.altFormat = userConfig.noCalendar || timeMode ? "h:i" + (userConfig.enableSeconds ? ":S K" : " K") : defaultAltFormat + ` h:i${userConfig.enableSeconds ? ":S" : ""} K`;
|
|
6270
|
+
}
|
|
6271
|
+
|
|
6272
|
+
Object.defineProperty(self.config, "minDate", {
|
|
6273
|
+
get: () => self.config._minDate,
|
|
6274
|
+
set: minMaxDateSetter("min")
|
|
6275
|
+
});
|
|
6276
|
+
Object.defineProperty(self.config, "maxDate", {
|
|
6277
|
+
get: () => self.config._maxDate,
|
|
6278
|
+
set: minMaxDateSetter("max")
|
|
6279
|
+
});
|
|
6280
|
+
|
|
6281
|
+
const minMaxTimeSetter = type => val => {
|
|
6282
|
+
self.config[type === "min" ? "_minTime" : "_maxTime"] = self.parseDate(val, "H:i:S");
|
|
6283
|
+
};
|
|
6284
|
+
|
|
6285
|
+
Object.defineProperty(self.config, "minTime", {
|
|
6286
|
+
get: () => self.config._minTime,
|
|
6287
|
+
set: minMaxTimeSetter("min")
|
|
6288
|
+
});
|
|
6289
|
+
Object.defineProperty(self.config, "maxTime", {
|
|
6290
|
+
get: () => self.config._maxTime,
|
|
6291
|
+
set: minMaxTimeSetter("max")
|
|
6292
|
+
});
|
|
6293
|
+
|
|
6294
|
+
if (userConfig.mode === "time") {
|
|
6295
|
+
self.config.noCalendar = true;
|
|
6296
|
+
self.config.enableTime = true;
|
|
6297
|
+
}
|
|
6298
|
+
|
|
6299
|
+
Object.assign(self.config, formats, userConfig);
|
|
6300
|
+
|
|
6301
|
+
for (let i = 0; i < boolOpts.length; i++) self.config[boolOpts[i]] = self.config[boolOpts[i]] === true || self.config[boolOpts[i]] === "true";
|
|
6302
|
+
|
|
6303
|
+
_options.HOOKS.filter(hook => self.config[hook] !== undefined).forEach(hook => {
|
|
6304
|
+
self.config[hook] = (0, _utils.arrayify)(self.config[hook] || []).map(bindToInstance);
|
|
6305
|
+
});
|
|
6306
|
+
|
|
6307
|
+
self.isMobile = !self.config.disableMobile && !self.config.inline && self.config.mode === "single" && !self.config.disable.length && !self.config.enable && !self.config.weekNumbers && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
6308
|
+
|
|
6309
|
+
for (let i = 0; i < self.config.plugins.length; i++) {
|
|
6310
|
+
const pluginConf = self.config.plugins[i](self) || {};
|
|
6311
|
+
|
|
6312
|
+
for (const key in pluginConf) {
|
|
6313
|
+
if (_options.HOOKS.indexOf(key) > -1) {
|
|
6314
|
+
self.config[key] = (0, _utils.arrayify)(pluginConf[key]).map(bindToInstance).concat(self.config[key]);
|
|
6315
|
+
} else if (typeof userConfig[key] === "undefined") self.config[key] = pluginConf[key];
|
|
4286
6316
|
}
|
|
4287
|
-
}
|
|
6317
|
+
}
|
|
4288
6318
|
|
|
4289
|
-
|
|
4290
|
-
|
|
6319
|
+
if (!userConfig.altInputClass) {
|
|
6320
|
+
self.config.altInputClass = getInputElem().className + " " + self.config.altInputClass;
|
|
6321
|
+
}
|
|
4291
6322
|
|
|
4292
|
-
|
|
4293
|
-
|
|
6323
|
+
triggerEvent("onParseConfig");
|
|
6324
|
+
}
|
|
4294
6325
|
|
|
4295
|
-
|
|
4296
|
-
|
|
6326
|
+
function getInputElem() {
|
|
6327
|
+
return self.config.wrap ? element.querySelector("[data-input]") : element;
|
|
6328
|
+
}
|
|
6329
|
+
|
|
6330
|
+
function setupLocale() {
|
|
6331
|
+
if (typeof self.config.locale !== "object" && typeof flatpickr.l10ns[self.config.locale] === "undefined") self.config.errorHandler(new Error(`flatpickr: invalid locale ${self.config.locale}`));
|
|
6332
|
+
self.l10n = Object.assign(Object.assign({}, flatpickr.l10ns.default), typeof self.config.locale === "object" ? self.config.locale : self.config.locale !== "default" ? flatpickr.l10ns[self.config.locale] : undefined);
|
|
6333
|
+
_formatting.tokenRegex.K = `(${self.l10n.amPM[0]}|${self.l10n.amPM[1]}|${self.l10n.amPM[0].toLowerCase()}|${self.l10n.amPM[1].toLowerCase()})`;
|
|
6334
|
+
const userConfig = Object.assign(Object.assign({}, instanceConfig), JSON.parse(JSON.stringify(element.dataset || {})));
|
|
6335
|
+
|
|
6336
|
+
if (userConfig.time_24hr === undefined && flatpickr.defaultConfig.time_24hr === undefined) {
|
|
6337
|
+
self.config.time_24hr = self.l10n.time_24hr;
|
|
4297
6338
|
}
|
|
4298
6339
|
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
6340
|
+
self.formatDate = (0, _dates.createDateFormatter)(self);
|
|
6341
|
+
self.parseDate = (0, _dates.createDateParser)({
|
|
6342
|
+
config: self.config,
|
|
6343
|
+
l10n: self.l10n
|
|
6344
|
+
});
|
|
6345
|
+
}
|
|
4302
6346
|
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
6347
|
+
function positionCalendar(customPositionElement) {
|
|
6348
|
+
if (typeof self.config.position === "function") {
|
|
6349
|
+
return void self.config.position(self, customPositionElement);
|
|
6350
|
+
}
|
|
4306
6351
|
|
|
4307
|
-
|
|
6352
|
+
if (self.calendarContainer === undefined) return;
|
|
6353
|
+
triggerEvent("onPreCalendarPosition");
|
|
6354
|
+
const positionElement = customPositionElement || self._positionElement;
|
|
6355
|
+
const calendarHeight = Array.prototype.reduce.call(self.calendarContainer.children, (acc, child) => acc + child.offsetHeight, 0),
|
|
6356
|
+
calendarWidth = self.calendarContainer.offsetWidth,
|
|
6357
|
+
configPos = self.config.position.split(" "),
|
|
6358
|
+
configPosVertical = configPos[0],
|
|
6359
|
+
configPosHorizontal = configPos.length > 1 ? configPos[1] : null,
|
|
6360
|
+
inputBounds = positionElement.getBoundingClientRect(),
|
|
6361
|
+
distanceFromBottom = window.innerHeight - inputBounds.bottom,
|
|
6362
|
+
showOnTop = configPosVertical === "above" || configPosVertical !== "below" && distanceFromBottom < calendarHeight && inputBounds.top > calendarHeight;
|
|
6363
|
+
const top = window.pageYOffset + inputBounds.top + (!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2);
|
|
6364
|
+
(0, _dom.toggleClass)(self.calendarContainer, "arrowTop", !showOnTop);
|
|
6365
|
+
(0, _dom.toggleClass)(self.calendarContainer, "arrowBottom", showOnTop);
|
|
6366
|
+
if (self.config.inline) return;
|
|
6367
|
+
let left = window.pageXOffset + inputBounds.left;
|
|
6368
|
+
let isCenter = false;
|
|
6369
|
+
let isRight = false;
|
|
6370
|
+
|
|
6371
|
+
if (configPosHorizontal === "center") {
|
|
6372
|
+
left -= (calendarWidth - inputBounds.width) / 2;
|
|
6373
|
+
isCenter = true;
|
|
6374
|
+
} else if (configPosHorizontal === "right") {
|
|
6375
|
+
left -= calendarWidth - inputBounds.width;
|
|
6376
|
+
isRight = true;
|
|
6377
|
+
}
|
|
4308
6378
|
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
6379
|
+
(0, _dom.toggleClass)(self.calendarContainer, "arrowLeft", !isCenter && !isRight);
|
|
6380
|
+
(0, _dom.toggleClass)(self.calendarContainer, "arrowCenter", isCenter);
|
|
6381
|
+
(0, _dom.toggleClass)(self.calendarContainer, "arrowRight", isRight);
|
|
6382
|
+
const right = window.document.body.offsetWidth - (window.pageXOffset + inputBounds.right);
|
|
6383
|
+
const rightMost = left + calendarWidth > window.document.body.offsetWidth;
|
|
6384
|
+
const centerMost = right + calendarWidth > window.document.body.offsetWidth;
|
|
6385
|
+
(0, _dom.toggleClass)(self.calendarContainer, "rightMost", rightMost);
|
|
6386
|
+
if (self.config.static) return;
|
|
6387
|
+
self.calendarContainer.style.top = `${top}px`;
|
|
6388
|
+
|
|
6389
|
+
if (!rightMost) {
|
|
6390
|
+
self.calendarContainer.style.left = `${left}px`;
|
|
6391
|
+
self.calendarContainer.style.right = "auto";
|
|
6392
|
+
} else if (!centerMost) {
|
|
6393
|
+
self.calendarContainer.style.left = "auto";
|
|
6394
|
+
self.calendarContainer.style.right = `${right}px`;
|
|
6395
|
+
} else {
|
|
6396
|
+
const doc = getDocumentStyleSheet();
|
|
6397
|
+
if (doc === undefined) return;
|
|
6398
|
+
const bodyWidth = window.document.body.offsetWidth;
|
|
6399
|
+
const centerLeft = Math.max(0, bodyWidth / 2 - calendarWidth / 2);
|
|
6400
|
+
const centerBefore = ".flatpickr-calendar.centerMost:before";
|
|
6401
|
+
const centerAfter = ".flatpickr-calendar.centerMost:after";
|
|
6402
|
+
const centerIndex = doc.cssRules.length;
|
|
6403
|
+
const centerStyle = `{left:${inputBounds.left}px;right:auto;}`;
|
|
6404
|
+
(0, _dom.toggleClass)(self.calendarContainer, "rightMost", false);
|
|
6405
|
+
(0, _dom.toggleClass)(self.calendarContainer, "centerMost", true);
|
|
6406
|
+
doc.insertRule(`${centerBefore},${centerAfter}${centerStyle}`, centerIndex);
|
|
6407
|
+
self.calendarContainer.style.left = `${centerLeft}px`;
|
|
6408
|
+
self.calendarContainer.style.right = "auto";
|
|
6409
|
+
}
|
|
6410
|
+
}
|
|
6411
|
+
|
|
6412
|
+
function getDocumentStyleSheet() {
|
|
6413
|
+
let editableSheet = null;
|
|
6414
|
+
|
|
6415
|
+
for (let i = 0; i < document.styleSheets.length; i++) {
|
|
6416
|
+
const sheet = document.styleSheets[i];
|
|
6417
|
+
|
|
6418
|
+
try {
|
|
6419
|
+
sheet.cssRules;
|
|
6420
|
+
} catch (err) {
|
|
6421
|
+
continue;
|
|
6422
|
+
}
|
|
6423
|
+
|
|
6424
|
+
editableSheet = sheet;
|
|
6425
|
+
break;
|
|
6426
|
+
}
|
|
4313
6427
|
|
|
4314
|
-
|
|
4315
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
6428
|
+
return editableSheet != null ? editableSheet : createStyleSheet();
|
|
4316
6429
|
}
|
|
4317
6430
|
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
};
|
|
6431
|
+
function createStyleSheet() {
|
|
6432
|
+
const style = document.createElement("style");
|
|
6433
|
+
document.head.appendChild(style);
|
|
6434
|
+
return style.sheet;
|
|
6435
|
+
}
|
|
4324
6436
|
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
6437
|
+
function redraw() {
|
|
6438
|
+
if (self.config.noCalendar || self.isMobile) return;
|
|
6439
|
+
buildMonthSwitch();
|
|
6440
|
+
updateNavigationCurrentMonth();
|
|
6441
|
+
buildDays();
|
|
6442
|
+
}
|
|
4328
6443
|
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
"use strict";
|
|
6444
|
+
function focusAndClose() {
|
|
6445
|
+
self._input.focus();
|
|
4332
6446
|
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
}
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
6447
|
+
if (window.navigator.userAgent.indexOf("MSIE") !== -1 || navigator.msMaxTouchPoints !== undefined) {
|
|
6448
|
+
setTimeout(self.close, 0);
|
|
6449
|
+
} else {
|
|
6450
|
+
self.close();
|
|
6451
|
+
}
|
|
6452
|
+
}
|
|
6453
|
+
|
|
6454
|
+
function selectDate(e) {
|
|
6455
|
+
e.preventDefault();
|
|
6456
|
+
e.stopPropagation();
|
|
6457
|
+
|
|
6458
|
+
const isSelectable = day => day.classList && day.classList.contains("flatpickr-day") && !day.classList.contains("flatpickr-disabled") && !day.classList.contains("notAllowed");
|
|
6459
|
+
|
|
6460
|
+
const t = (0, _dom.findParent)((0, _dom.getEventTarget)(e), isSelectable);
|
|
6461
|
+
if (t === undefined) return;
|
|
6462
|
+
const target = t;
|
|
6463
|
+
const selectedDate = self.latestSelectedDateObj = new Date(target.dateObj.getTime());
|
|
6464
|
+
const shouldChangeMonth = (selectedDate.getMonth() < self.currentMonth || selectedDate.getMonth() > self.currentMonth + self.config.showMonths - 1) && self.config.mode !== "range";
|
|
6465
|
+
self.selectedDateElem = target;
|
|
6466
|
+
if (self.config.mode === "single") self.selectedDates = [selectedDate];else if (self.config.mode === "multiple") {
|
|
6467
|
+
const selectedIndex = isDateSelected(selectedDate);
|
|
6468
|
+
if (selectedIndex) self.selectedDates.splice(parseInt(selectedIndex), 1);else self.selectedDates.push(selectedDate);
|
|
6469
|
+
} else if (self.config.mode === "range") {
|
|
6470
|
+
if (self.selectedDates.length === 2) {
|
|
6471
|
+
self.clear(false, false);
|
|
4342
6472
|
}
|
|
4343
|
-
};
|
|
4344
6473
|
|
|
4345
|
-
|
|
4346
|
-
|
|
6474
|
+
self.latestSelectedDateObj = selectedDate;
|
|
6475
|
+
self.selectedDates.push(selectedDate);
|
|
6476
|
+
if ((0, _dates.compareDates)(selectedDate, self.selectedDates[0], true) !== 0) self.selectedDates.sort((a, b) => a.getTime() - b.getTime());
|
|
6477
|
+
}
|
|
6478
|
+
setHoursFromInputs();
|
|
4347
6479
|
|
|
4348
|
-
|
|
4349
|
-
|
|
6480
|
+
if (shouldChangeMonth) {
|
|
6481
|
+
const isNewYear = self.currentYear !== selectedDate.getFullYear();
|
|
6482
|
+
self.currentYear = selectedDate.getFullYear();
|
|
6483
|
+
self.currentMonth = selectedDate.getMonth();
|
|
4350
6484
|
|
|
4351
|
-
|
|
4352
|
-
|
|
6485
|
+
if (isNewYear) {
|
|
6486
|
+
triggerEvent("onYearChange");
|
|
6487
|
+
buildMonthSwitch();
|
|
6488
|
+
}
|
|
6489
|
+
|
|
6490
|
+
triggerEvent("onMonthChange");
|
|
4353
6491
|
}
|
|
4354
6492
|
|
|
4355
|
-
|
|
6493
|
+
updateNavigationCurrentMonth();
|
|
6494
|
+
buildDays();
|
|
6495
|
+
updateValue();
|
|
6496
|
+
if (!shouldChangeMonth && self.config.mode !== "range" && self.config.showMonths === 1) focusOnDayElem(target);else if (self.selectedDateElem !== undefined && self.hourElement === undefined) {
|
|
6497
|
+
self.selectedDateElem && self.selectedDateElem.focus();
|
|
6498
|
+
}
|
|
6499
|
+
if (self.hourElement !== undefined) self.hourElement !== undefined && self.hourElement.focus();
|
|
6500
|
+
|
|
6501
|
+
if (self.config.closeOnSelect) {
|
|
6502
|
+
const single = self.config.mode === "single" && !self.config.enableTime;
|
|
6503
|
+
const range = self.config.mode === "range" && self.selectedDates.length === 2 && !self.config.enableTime;
|
|
6504
|
+
|
|
6505
|
+
if (single || range) {
|
|
6506
|
+
focusAndClose();
|
|
6507
|
+
}
|
|
6508
|
+
}
|
|
6509
|
+
|
|
6510
|
+
triggerChange();
|
|
6511
|
+
}
|
|
6512
|
+
|
|
6513
|
+
const CALLBACKS = {
|
|
6514
|
+
locale: [setupLocale, updateWeekdays],
|
|
6515
|
+
showMonths: [buildMonths, setCalendarWidth, buildWeekdays],
|
|
6516
|
+
minDate: [jumpToDate],
|
|
6517
|
+
maxDate: [jumpToDate],
|
|
6518
|
+
clickOpens: [() => {
|
|
6519
|
+
if (self.config.clickOpens === true) {
|
|
6520
|
+
bind(self._input, "focus", self.open);
|
|
6521
|
+
bind(self._input, "click", self.open);
|
|
6522
|
+
} else {
|
|
6523
|
+
self._input.removeEventListener("focus", self.open);
|
|
6524
|
+
|
|
6525
|
+
self._input.removeEventListener("click", self.open);
|
|
6526
|
+
}
|
|
6527
|
+
}]
|
|
4356
6528
|
};
|
|
4357
|
-
}();
|
|
4358
6529
|
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
6530
|
+
function set(option, value) {
|
|
6531
|
+
if (option !== null && typeof option === "object") {
|
|
6532
|
+
Object.assign(self.config, option);
|
|
6533
|
+
|
|
6534
|
+
for (const key in option) {
|
|
6535
|
+
if (CALLBACKS[key] !== undefined) CALLBACKS[key].forEach(x => x());
|
|
6536
|
+
}
|
|
6537
|
+
} else {
|
|
6538
|
+
self.config[option] = value;
|
|
6539
|
+
if (CALLBACKS[option] !== undefined) CALLBACKS[option].forEach(x => x());else if (_options.HOOKS.indexOf(option) > -1) self.config[option] = (0, _utils.arrayify)(value);
|
|
6540
|
+
}
|
|
6541
|
+
|
|
6542
|
+
self.redraw();
|
|
6543
|
+
updateValue(true);
|
|
6544
|
+
}
|
|
4362
6545
|
|
|
4363
|
-
|
|
6546
|
+
function setSelectedDate(inputDate, format) {
|
|
6547
|
+
let dates = [];
|
|
6548
|
+
if (inputDate instanceof Array) dates = inputDate.map(d => self.parseDate(d, format));else if (inputDate instanceof Date || typeof inputDate === "number") dates = [self.parseDate(inputDate, format)];else if (typeof inputDate === "string") {
|
|
6549
|
+
switch (self.config.mode) {
|
|
6550
|
+
case "single":
|
|
6551
|
+
case "time":
|
|
6552
|
+
dates = [self.parseDate(inputDate, format)];
|
|
6553
|
+
break;
|
|
4364
6554
|
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
6555
|
+
case "multiple":
|
|
6556
|
+
dates = inputDate.split(self.config.conjunction).map(date => self.parseDate(date, format));
|
|
6557
|
+
break;
|
|
6558
|
+
|
|
6559
|
+
case "range":
|
|
6560
|
+
dates = inputDate.split(self.l10n.rangeSeparator).map(date => self.parseDate(date, format));
|
|
6561
|
+
break;
|
|
6562
|
+
|
|
6563
|
+
default:
|
|
6564
|
+
break;
|
|
6565
|
+
}
|
|
6566
|
+
} else self.config.errorHandler(new Error(`Invalid date supplied: ${JSON.stringify(inputDate)}`));
|
|
6567
|
+
self.selectedDates = self.config.allowInvalidPreload ? dates : dates.filter(d => d instanceof Date && isEnabled(d, false));
|
|
6568
|
+
if (self.config.mode === "range") self.selectedDates.sort((a, b) => a.getTime() - b.getTime());
|
|
6569
|
+
}
|
|
6570
|
+
|
|
6571
|
+
function setDate(date, triggerChange = false, format = self.config.dateFormat) {
|
|
6572
|
+
if (date !== 0 && !date || date instanceof Array && date.length === 0) return self.clear(triggerChange);
|
|
6573
|
+
setSelectedDate(date, format);
|
|
6574
|
+
self.latestSelectedDateObj = self.selectedDates[self.selectedDates.length - 1];
|
|
6575
|
+
self.redraw();
|
|
6576
|
+
jumpToDate(undefined, triggerChange);
|
|
6577
|
+
setHoursFromDate();
|
|
6578
|
+
|
|
6579
|
+
if (self.selectedDates.length === 0) {
|
|
6580
|
+
self.clear(false);
|
|
6581
|
+
}
|
|
6582
|
+
|
|
6583
|
+
updateValue(triggerChange);
|
|
6584
|
+
if (triggerChange) triggerEvent("onChange");
|
|
6585
|
+
}
|
|
6586
|
+
|
|
6587
|
+
function parseDateRules(arr) {
|
|
6588
|
+
return arr.slice().map(rule => {
|
|
6589
|
+
if (typeof rule === "string" || typeof rule === "number" || rule instanceof Date) {
|
|
6590
|
+
return self.parseDate(rule, undefined, true);
|
|
6591
|
+
} else if (rule && typeof rule === "object" && rule.from && rule.to) return {
|
|
6592
|
+
from: self.parseDate(rule.from, undefined),
|
|
6593
|
+
to: self.parseDate(rule.to, undefined)
|
|
6594
|
+
};
|
|
6595
|
+
|
|
6596
|
+
return rule;
|
|
6597
|
+
}).filter(x => x);
|
|
6598
|
+
}
|
|
6599
|
+
|
|
6600
|
+
function setupDates() {
|
|
6601
|
+
self.selectedDates = [];
|
|
6602
|
+
self.now = self.parseDate(self.config.now) || new Date();
|
|
6603
|
+
const preloadedDate = self.config.defaultDate || ((self.input.nodeName === "INPUT" || self.input.nodeName === "TEXTAREA") && self.input.placeholder && self.input.value === self.input.placeholder ? null : self.input.value);
|
|
6604
|
+
if (preloadedDate) setSelectedDate(preloadedDate, self.config.dateFormat);
|
|
6605
|
+
self._initialDate = self.selectedDates.length > 0 ? self.selectedDates[0] : self.config.minDate && self.config.minDate.getTime() > self.now.getTime() ? self.config.minDate : self.config.maxDate && self.config.maxDate.getTime() < self.now.getTime() ? self.config.maxDate : self.now;
|
|
6606
|
+
self.currentYear = self._initialDate.getFullYear();
|
|
6607
|
+
self.currentMonth = self._initialDate.getMonth();
|
|
6608
|
+
if (self.selectedDates.length > 0) self.latestSelectedDateObj = self.selectedDates[0];
|
|
6609
|
+
if (self.config.minTime !== undefined) self.config.minTime = self.parseDate(self.config.minTime, "H:i");
|
|
6610
|
+
if (self.config.maxTime !== undefined) self.config.maxTime = self.parseDate(self.config.maxTime, "H:i");
|
|
6611
|
+
self.minDateHasTime = !!self.config.minDate && (self.config.minDate.getHours() > 0 || self.config.minDate.getMinutes() > 0 || self.config.minDate.getSeconds() > 0);
|
|
6612
|
+
self.maxDateHasTime = !!self.config.maxDate && (self.config.maxDate.getHours() > 0 || self.config.maxDate.getMinutes() > 0 || self.config.maxDate.getSeconds() > 0);
|
|
6613
|
+
}
|
|
6614
|
+
|
|
6615
|
+
function setupInputs() {
|
|
6616
|
+
self.input = getInputElem();
|
|
6617
|
+
|
|
6618
|
+
if (!self.input) {
|
|
6619
|
+
self.config.errorHandler(new Error("Invalid input element specified"));
|
|
6620
|
+
return;
|
|
6621
|
+
}
|
|
6622
|
+
|
|
6623
|
+
self.input._type = self.input.type;
|
|
6624
|
+
self.input.type = "text";
|
|
6625
|
+
self.input.classList.add("flatpickr-input");
|
|
6626
|
+
self._input = self.input;
|
|
6627
|
+
|
|
6628
|
+
if (self.config.altInput) {
|
|
6629
|
+
self.altInput = (0, _dom.createElement)(self.input.nodeName, self.config.altInputClass);
|
|
6630
|
+
self._input = self.altInput;
|
|
6631
|
+
self.altInput.placeholder = self.input.placeholder;
|
|
6632
|
+
self.altInput.disabled = self.input.disabled;
|
|
6633
|
+
self.altInput.required = self.input.required;
|
|
6634
|
+
self.altInput.tabIndex = self.input.tabIndex;
|
|
6635
|
+
self.altInput.type = "text";
|
|
6636
|
+
self.input.setAttribute("type", "hidden");
|
|
6637
|
+
if (!self.config.static && self.input.parentNode) self.input.parentNode.insertBefore(self.altInput, self.input.nextSibling);
|
|
6638
|
+
}
|
|
6639
|
+
|
|
6640
|
+
if (!self.config.allowInput) self._input.setAttribute("readonly", "readonly");
|
|
6641
|
+
self._positionElement = self.config.positionElement || self._input;
|
|
6642
|
+
}
|
|
6643
|
+
|
|
6644
|
+
function setupMobile() {
|
|
6645
|
+
const inputType = self.config.enableTime ? self.config.noCalendar ? "time" : "datetime-local" : "date";
|
|
6646
|
+
self.mobileInput = (0, _dom.createElement)("input", self.input.className + " flatpickr-mobile");
|
|
6647
|
+
self.mobileInput.tabIndex = 1;
|
|
6648
|
+
self.mobileInput.type = inputType;
|
|
6649
|
+
self.mobileInput.disabled = self.input.disabled;
|
|
6650
|
+
self.mobileInput.required = self.input.required;
|
|
6651
|
+
self.mobileInput.placeholder = self.input.placeholder;
|
|
6652
|
+
self.mobileFormatStr = inputType === "datetime-local" ? "Y-m-d\\TH:i:S" : inputType === "date" ? "Y-m-d" : "H:i:S";
|
|
6653
|
+
|
|
6654
|
+
if (self.selectedDates.length > 0) {
|
|
6655
|
+
self.mobileInput.defaultValue = self.mobileInput.value = self.formatDate(self.selectedDates[0], self.mobileFormatStr);
|
|
6656
|
+
}
|
|
6657
|
+
|
|
6658
|
+
if (self.config.minDate) self.mobileInput.min = self.formatDate(self.config.minDate, "Y-m-d");
|
|
6659
|
+
if (self.config.maxDate) self.mobileInput.max = self.formatDate(self.config.maxDate, "Y-m-d");
|
|
6660
|
+
if (self.input.getAttribute("step")) self.mobileInput.step = String(self.input.getAttribute("step"));
|
|
6661
|
+
self.input.type = "hidden";
|
|
6662
|
+
if (self.altInput !== undefined) self.altInput.type = "hidden";
|
|
6663
|
+
|
|
6664
|
+
try {
|
|
6665
|
+
if (self.input.parentNode) self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling);
|
|
6666
|
+
} catch (_a) {}
|
|
6667
|
+
|
|
6668
|
+
bind(self.mobileInput, "change", e => {
|
|
6669
|
+
self.setDate((0, _dom.getEventTarget)(e).value, false, self.mobileFormatStr);
|
|
6670
|
+
triggerEvent("onChange");
|
|
6671
|
+
triggerEvent("onClose");
|
|
6672
|
+
});
|
|
6673
|
+
}
|
|
6674
|
+
|
|
6675
|
+
function toggle(e) {
|
|
6676
|
+
if (self.isOpen === true) return self.close();
|
|
6677
|
+
self.open(e);
|
|
6678
|
+
}
|
|
6679
|
+
|
|
6680
|
+
function triggerEvent(event, data) {
|
|
6681
|
+
if (self.config === undefined) return;
|
|
6682
|
+
const hooks = self.config[event];
|
|
6683
|
+
|
|
6684
|
+
if (hooks !== undefined && hooks.length > 0) {
|
|
6685
|
+
for (let i = 0; hooks[i] && i < hooks.length; i++) hooks[i](self.selectedDates, self.input.value, self, data);
|
|
6686
|
+
}
|
|
6687
|
+
|
|
6688
|
+
if (event === "onChange") {
|
|
6689
|
+
self.input.dispatchEvent(createEvent("change"));
|
|
6690
|
+
self.input.dispatchEvent(createEvent("input"));
|
|
6691
|
+
}
|
|
6692
|
+
}
|
|
6693
|
+
|
|
6694
|
+
function createEvent(name) {
|
|
6695
|
+
const e = document.createEvent("Event");
|
|
6696
|
+
e.initEvent(name, true, true);
|
|
6697
|
+
return e;
|
|
6698
|
+
}
|
|
6699
|
+
|
|
6700
|
+
function isDateSelected(date) {
|
|
6701
|
+
for (let i = 0; i < self.selectedDates.length; i++) {
|
|
6702
|
+
if ((0, _dates.compareDates)(self.selectedDates[i], date) === 0) return "" + i;
|
|
6703
|
+
}
|
|
6704
|
+
|
|
6705
|
+
return false;
|
|
6706
|
+
}
|
|
4369
6707
|
|
|
4370
|
-
function
|
|
4371
|
-
|
|
6708
|
+
function isDateInRange(date) {
|
|
6709
|
+
if (self.config.mode !== "range" || self.selectedDates.length < 2) return false;
|
|
6710
|
+
return (0, _dates.compareDates)(date, self.selectedDates[0]) >= 0 && (0, _dates.compareDates)(date, self.selectedDates[1]) <= 0;
|
|
4372
6711
|
}
|
|
4373
6712
|
|
|
4374
|
-
|
|
4375
|
-
|
|
6713
|
+
function updateNavigationCurrentMonth() {
|
|
6714
|
+
if (self.config.noCalendar || self.isMobile || !self.monthNav) return;
|
|
6715
|
+
self.yearElements.forEach((yearElement, i) => {
|
|
6716
|
+
const d = new Date(self.currentYear, self.currentMonth, 1);
|
|
6717
|
+
d.setMonth(self.currentMonth + i);
|
|
4376
6718
|
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
this.element.classList.add("opacity-75", "bg-gray-100");
|
|
6719
|
+
if (self.config.showMonths > 1 || self.config.monthSelectorType === "static") {
|
|
6720
|
+
self.monthElements[i].textContent = (0, _formatting.monthToStr)(d.getMonth(), self.config.shorthandCurrentMonth, self.l10n) + " ";
|
|
4380
6721
|
} else {
|
|
4381
|
-
|
|
6722
|
+
self.monthsDropdownContainer.value = d.getMonth().toString();
|
|
4382
6723
|
}
|
|
6724
|
+
|
|
6725
|
+
yearElement.value = d.getFullYear().toString();
|
|
6726
|
+
});
|
|
6727
|
+
self._hidePrevMonthArrow = self.config.minDate !== undefined && (self.currentYear === self.config.minDate.getFullYear() ? self.currentMonth <= self.config.minDate.getMonth() : self.currentYear < self.config.minDate.getFullYear());
|
|
6728
|
+
self._hideNextMonthArrow = self.config.maxDate !== undefined && (self.currentYear === self.config.maxDate.getFullYear() ? self.currentMonth + 1 > self.config.maxDate.getMonth() : self.currentYear > self.config.maxDate.getFullYear());
|
|
6729
|
+
}
|
|
6730
|
+
|
|
6731
|
+
function getDateStr(format) {
|
|
6732
|
+
return self.selectedDates.map(dObj => self.formatDate(dObj, format)).filter((d, i, arr) => self.config.mode !== "range" || self.config.enableTime || arr.indexOf(d) === i).join(self.config.mode !== "range" ? self.config.conjunction : self.l10n.rangeSeparator);
|
|
6733
|
+
}
|
|
6734
|
+
|
|
6735
|
+
function updateValue(triggerChange = true) {
|
|
6736
|
+
if (self.mobileInput !== undefined && self.mobileFormatStr) {
|
|
6737
|
+
self.mobileInput.value = self.latestSelectedDateObj !== undefined ? self.formatDate(self.latestSelectedDateObj, self.mobileFormatStr) : "";
|
|
6738
|
+
}
|
|
6739
|
+
|
|
6740
|
+
self.input.value = getDateStr(self.config.dateFormat);
|
|
6741
|
+
|
|
6742
|
+
if (self.altInput !== undefined) {
|
|
6743
|
+
self.altInput.value = getDateStr(self.config.altFormat);
|
|
6744
|
+
}
|
|
6745
|
+
|
|
6746
|
+
if (triggerChange !== false) triggerEvent("onValueUpdate");
|
|
6747
|
+
}
|
|
6748
|
+
|
|
6749
|
+
function onMonthNavClick(e) {
|
|
6750
|
+
const eventTarget = (0, _dom.getEventTarget)(e);
|
|
6751
|
+
const isPrevMonth = self.prevMonthNav.contains(eventTarget);
|
|
6752
|
+
const isNextMonth = self.nextMonthNav.contains(eventTarget);
|
|
6753
|
+
|
|
6754
|
+
if (isPrevMonth || isNextMonth) {
|
|
6755
|
+
changeMonth(isPrevMonth ? -1 : 1);
|
|
6756
|
+
} else if (self.yearElements.indexOf(eventTarget) >= 0) {
|
|
6757
|
+
eventTarget.select();
|
|
6758
|
+
} else if (eventTarget.classList.contains("arrowUp")) {
|
|
6759
|
+
self.changeYear(self.currentYear + 1);
|
|
6760
|
+
} else if (eventTarget.classList.contains("arrowDown")) {
|
|
6761
|
+
self.changeYear(self.currentYear - 1);
|
|
6762
|
+
}
|
|
6763
|
+
}
|
|
6764
|
+
|
|
6765
|
+
function timeWrapper(e) {
|
|
6766
|
+
e.preventDefault();
|
|
6767
|
+
const isKeyDown = e.type === "keydown",
|
|
6768
|
+
eventTarget = (0, _dom.getEventTarget)(e),
|
|
6769
|
+
input = eventTarget;
|
|
6770
|
+
|
|
6771
|
+
if (self.amPM !== undefined && eventTarget === self.amPM) {
|
|
6772
|
+
self.amPM.textContent = self.l10n.amPM[(0, _utils.int)(self.amPM.textContent === self.l10n.amPM[0])];
|
|
6773
|
+
}
|
|
6774
|
+
|
|
6775
|
+
const min = parseFloat(input.getAttribute("min")),
|
|
6776
|
+
max = parseFloat(input.getAttribute("max")),
|
|
6777
|
+
step = parseFloat(input.getAttribute("step")),
|
|
6778
|
+
curValue = parseInt(input.value, 10),
|
|
6779
|
+
delta = e.delta || (isKeyDown ? e.which === 38 ? 1 : -1 : 0);
|
|
6780
|
+
let newValue = curValue + step * delta;
|
|
6781
|
+
|
|
6782
|
+
if (typeof input.value !== "undefined" && input.value.length === 2) {
|
|
6783
|
+
const isHourElem = input === self.hourElement,
|
|
6784
|
+
isMinuteElem = input === self.minuteElement;
|
|
6785
|
+
|
|
6786
|
+
if (newValue < min) {
|
|
6787
|
+
newValue = max + newValue + (0, _utils.int)(!isHourElem) + ((0, _utils.int)(isHourElem) && (0, _utils.int)(!self.amPM));
|
|
6788
|
+
if (isMinuteElem) incrementNumInput(undefined, -1, self.hourElement);
|
|
6789
|
+
} else if (newValue > max) {
|
|
6790
|
+
newValue = input === self.hourElement ? newValue - max - (0, _utils.int)(!self.amPM) : min;
|
|
6791
|
+
if (isMinuteElem) incrementNumInput(undefined, 1, self.hourElement);
|
|
6792
|
+
}
|
|
6793
|
+
|
|
6794
|
+
if (self.amPM && isHourElem && (step === 1 ? newValue + curValue === 23 : Math.abs(newValue - curValue) > step)) {
|
|
6795
|
+
self.amPM.textContent = self.l10n.amPM[(0, _utils.int)(self.amPM.textContent === self.l10n.amPM[0])];
|
|
6796
|
+
}
|
|
6797
|
+
|
|
6798
|
+
input.value = (0, _utils.pad)(newValue);
|
|
6799
|
+
}
|
|
6800
|
+
}
|
|
6801
|
+
|
|
6802
|
+
init();
|
|
6803
|
+
return self;
|
|
6804
|
+
}
|
|
6805
|
+
|
|
6806
|
+
function _flatpickr(nodeList, config) {
|
|
6807
|
+
const nodes = Array.prototype.slice.call(nodeList).filter(x => x instanceof HTMLElement);
|
|
6808
|
+
const instances = [];
|
|
6809
|
+
|
|
6810
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
6811
|
+
const node = nodes[i];
|
|
6812
|
+
|
|
6813
|
+
try {
|
|
6814
|
+
if (node.getAttribute("data-fp-omit") !== null) continue;
|
|
6815
|
+
|
|
6816
|
+
if (node._flatpickr !== undefined) {
|
|
6817
|
+
node._flatpickr.destroy();
|
|
6818
|
+
|
|
6819
|
+
node._flatpickr = undefined;
|
|
6820
|
+
}
|
|
6821
|
+
|
|
6822
|
+
node._flatpickr = FlatpickrInstance(node, config || {});
|
|
6823
|
+
instances.push(node._flatpickr);
|
|
6824
|
+
} catch (e) {
|
|
6825
|
+
console.error(e);
|
|
4383
6826
|
}
|
|
6827
|
+
}
|
|
6828
|
+
|
|
6829
|
+
return instances.length === 1 ? instances[0] : instances;
|
|
6830
|
+
}
|
|
6831
|
+
|
|
6832
|
+
if (typeof HTMLElement !== "undefined" && typeof HTMLCollection !== "undefined" && typeof NodeList !== "undefined") {
|
|
6833
|
+
HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (config) {
|
|
6834
|
+
return _flatpickr(this, config);
|
|
4384
6835
|
};
|
|
4385
6836
|
|
|
4386
|
-
|
|
4387
|
-
|
|
6837
|
+
HTMLElement.prototype.flatpickr = function (config) {
|
|
6838
|
+
return _flatpickr([this], config);
|
|
6839
|
+
};
|
|
6840
|
+
}
|
|
4388
6841
|
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
6842
|
+
var flatpickr = function (selector, config) {
|
|
6843
|
+
if (typeof selector === "string") {
|
|
6844
|
+
return _flatpickr(window.document.querySelectorAll(selector), config);
|
|
6845
|
+
} else if (selector instanceof Node) {
|
|
6846
|
+
return _flatpickr([selector], config);
|
|
6847
|
+
} else {
|
|
6848
|
+
return _flatpickr(selector, config);
|
|
6849
|
+
}
|
|
6850
|
+
};
|
|
6851
|
+
|
|
6852
|
+
flatpickr.defaultConfig = {};
|
|
6853
|
+
flatpickr.l10ns = {
|
|
6854
|
+
en: Object.assign({}, _default2.default),
|
|
6855
|
+
default: Object.assign({}, _default2.default)
|
|
6856
|
+
};
|
|
4392
6857
|
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
6858
|
+
flatpickr.localize = l10n => {
|
|
6859
|
+
flatpickr.l10ns.default = Object.assign(Object.assign({}, flatpickr.l10ns.default), l10n);
|
|
6860
|
+
};
|
|
6861
|
+
|
|
6862
|
+
flatpickr.setDefaults = config => {
|
|
6863
|
+
flatpickr.defaultConfig = Object.assign(Object.assign({}, flatpickr.defaultConfig), config);
|
|
6864
|
+
};
|
|
6865
|
+
|
|
6866
|
+
flatpickr.parseDate = (0, _dates.createDateParser)({});
|
|
6867
|
+
flatpickr.formatDate = (0, _dates.createDateFormatter)({});
|
|
6868
|
+
flatpickr.compareDates = _dates.compareDates;
|
|
6869
|
+
|
|
6870
|
+
if (typeof jQuery !== "undefined" && typeof jQuery.fn !== "undefined") {
|
|
6871
|
+
jQuery.fn.flatpickr = function (config) {
|
|
6872
|
+
return _flatpickr(this, config);
|
|
4396
6873
|
};
|
|
6874
|
+
}
|
|
6875
|
+
|
|
6876
|
+
Date.prototype.fp_incr = function (days) {
|
|
6877
|
+
return new Date(this.getFullYear(), this.getMonth(), this.getDate() + (typeof days === "string" ? parseInt(days, 10) : days));
|
|
4397
6878
|
};
|
|
4398
6879
|
|
|
6880
|
+
if (typeof window !== "undefined") {
|
|
6881
|
+
window.flatpickr = flatpickr;
|
|
6882
|
+
}
|
|
6883
|
+
|
|
6884
|
+
var _default = flatpickr;
|
|
6885
|
+
exports.default = _default;
|
|
6886
|
+
},{"./types/options":"../node_modules/flatpickr/dist/esm/types/options.js","./l10n/default":"../node_modules/flatpickr/dist/esm/l10n/default.js","./utils":"../node_modules/flatpickr/dist/esm/utils/index.js","./utils/dom":"../node_modules/flatpickr/dist/esm/utils/dom.js","./utils/dates":"../node_modules/flatpickr/dist/esm/utils/dates.js","./utils/formatting":"../node_modules/flatpickr/dist/esm/utils/formatting.js","./utils/polyfills":"../node_modules/flatpickr/dist/esm/utils/polyfills.js"}],"javascripts/super/flatpickr_controller.js":[function(require,module,exports) {
|
|
6887
|
+
"use strict";
|
|
6888
|
+
|
|
6889
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6890
|
+
value: true
|
|
6891
|
+
});
|
|
6892
|
+
exports.default = void 0;
|
|
6893
|
+
|
|
6894
|
+
var _stimulus = require("stimulus");
|
|
6895
|
+
|
|
6896
|
+
var _flatpickr = _interopRequireDefault(require("flatpickr"));
|
|
6897
|
+
|
|
6898
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
6899
|
+
|
|
6900
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
6901
|
+
|
|
6902
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6903
|
+
|
|
6904
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
6905
|
+
|
|
6906
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
6907
|
+
|
|
6908
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
6909
|
+
|
|
6910
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
6911
|
+
|
|
6912
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
6913
|
+
|
|
6914
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
6915
|
+
|
|
6916
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
6917
|
+
|
|
6918
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
6919
|
+
|
|
6920
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
6921
|
+
|
|
6922
|
+
var _default = /*#__PURE__*/function (_Controller) {
|
|
6923
|
+
_inherits(_default, _Controller);
|
|
6924
|
+
|
|
6925
|
+
var _super = _createSuper(_default);
|
|
6926
|
+
|
|
6927
|
+
function _default() {
|
|
6928
|
+
_classCallCheck(this, _default);
|
|
6929
|
+
|
|
6930
|
+
return _super.apply(this, arguments);
|
|
6931
|
+
}
|
|
6932
|
+
|
|
6933
|
+
_createClass(_default, [{
|
|
6934
|
+
key: "connect",
|
|
6935
|
+
value: function connect() {
|
|
6936
|
+
this.flatpickrInstance = (0, _flatpickr.default)(this.element, this.optionsValue);
|
|
6937
|
+
}
|
|
6938
|
+
}], [{
|
|
6939
|
+
key: "values",
|
|
6940
|
+
get: function get() {
|
|
6941
|
+
return {
|
|
6942
|
+
options: Object
|
|
6943
|
+
};
|
|
6944
|
+
}
|
|
6945
|
+
}]);
|
|
6946
|
+
|
|
6947
|
+
return _default;
|
|
6948
|
+
}(_stimulus.Controller);
|
|
6949
|
+
|
|
6950
|
+
exports.default = _default;
|
|
6951
|
+
},{"stimulus":"../node_modules/stimulus/index.js","flatpickr":"../node_modules/flatpickr/dist/esm/index.js"}],"javascripts/super/toggle_pending_destruction_controller.js":[function(require,module,exports) {
|
|
6952
|
+
"use strict";
|
|
6953
|
+
|
|
4399
6954
|
Object.defineProperty(exports, "__esModule", {
|
|
4400
6955
|
value: true
|
|
4401
6956
|
});
|
|
4402
|
-
exports.
|
|
6957
|
+
exports.default = void 0;
|
|
6958
|
+
|
|
6959
|
+
var _stimulus = require("stimulus");
|
|
6960
|
+
|
|
6961
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
6962
|
+
|
|
6963
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6964
|
+
|
|
6965
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
6966
|
+
|
|
6967
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
6968
|
+
|
|
6969
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
4403
6970
|
|
|
4404
|
-
|
|
6971
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
4405
6972
|
|
|
4406
|
-
var
|
|
6973
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
4407
6974
|
|
|
6975
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
6976
|
+
|
|
6977
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
6978
|
+
|
|
6979
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
6980
|
+
|
|
6981
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
6982
|
+
|
|
6983
|
+
var _default = /*#__PURE__*/function (_Controller) {
|
|
6984
|
+
_inherits(_default, _Controller);
|
|
6985
|
+
|
|
6986
|
+
var _super = _createSuper(_default);
|
|
6987
|
+
|
|
6988
|
+
function _default() {
|
|
6989
|
+
_classCallCheck(this, _default);
|
|
6990
|
+
|
|
6991
|
+
return _super.apply(this, arguments);
|
|
6992
|
+
}
|
|
6993
|
+
|
|
6994
|
+
_createClass(_default, [{
|
|
6995
|
+
key: "call",
|
|
6996
|
+
value: function call(event) {
|
|
6997
|
+
var target = event.target;
|
|
6998
|
+
|
|
6999
|
+
if (target) {
|
|
7000
|
+
if (target.checked) {
|
|
7001
|
+
this.element.classList.add("opacity-75", "bg-gray-100");
|
|
7002
|
+
} else {
|
|
7003
|
+
this.element.classList.remove("opacity-75", "bg-gray-100");
|
|
7004
|
+
}
|
|
7005
|
+
}
|
|
7006
|
+
}
|
|
7007
|
+
}]);
|
|
7008
|
+
|
|
7009
|
+
return _default;
|
|
7010
|
+
}(_stimulus.Controller);
|
|
7011
|
+
|
|
7012
|
+
exports.default = _default;
|
|
7013
|
+
},{"stimulus":"../node_modules/stimulus/index.js"}],"javascripts/super/application.js":[function(require,module,exports) {
|
|
7014
|
+
"use strict";
|
|
7015
|
+
|
|
7016
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7017
|
+
value: true
|
|
7018
|
+
});
|
|
4408
7019
|
Object.defineProperty(exports, "StimulusController", {
|
|
4409
7020
|
enumerable: true,
|
|
4410
|
-
get: function
|
|
4411
|
-
return
|
|
7021
|
+
get: function () {
|
|
7022
|
+
return _stimulus.Controller;
|
|
4412
7023
|
}
|
|
4413
7024
|
});
|
|
7025
|
+
exports.StimulusApplication = void 0;
|
|
7026
|
+
|
|
7027
|
+
var _ujs = _interopRequireDefault(require("@rails/ujs"));
|
|
7028
|
+
|
|
7029
|
+
var _stimulus = require("stimulus");
|
|
7030
|
+
|
|
7031
|
+
var _apply_template_controller = _interopRequireDefault(require("./apply_template_controller"));
|
|
7032
|
+
|
|
7033
|
+
var _clean_filter_param_controller = _interopRequireDefault(require("./clean_filter_param_controller"));
|
|
7034
|
+
|
|
7035
|
+
var _clean_filter_params_controller = _interopRequireDefault(require("./clean_filter_params_controller"));
|
|
7036
|
+
|
|
7037
|
+
var _delete_controller = _interopRequireDefault(require("./delete_controller"));
|
|
7038
|
+
|
|
7039
|
+
var _flatpickr_controller = _interopRequireDefault(require("./flatpickr_controller"));
|
|
7040
|
+
|
|
7041
|
+
var _toggle_pending_destruction_controller = _interopRequireDefault(require("./toggle_pending_destruction_controller"));
|
|
7042
|
+
|
|
7043
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
4414
7044
|
|
|
4415
|
-
|
|
7045
|
+
_ujs.default.start();
|
|
4416
7046
|
|
|
4417
|
-
var
|
|
7047
|
+
var StimulusApplication = _stimulus.Application.start();
|
|
4418
7048
|
|
|
4419
|
-
ujs_1.default.start();
|
|
4420
|
-
var StimulusApplication = stimulus_1.Application.start();
|
|
4421
7049
|
exports.StimulusApplication = StimulusApplication;
|
|
4422
|
-
StimulusApplication.register("apply-template",
|
|
4423
|
-
StimulusApplication.register("
|
|
4424
|
-
|
|
7050
|
+
StimulusApplication.register("apply-template", _apply_template_controller.default);
|
|
7051
|
+
StimulusApplication.register("clean-filter-param", _clean_filter_param_controller.default);
|
|
7052
|
+
StimulusApplication.register("clean-filter-params", _clean_filter_params_controller.default);
|
|
7053
|
+
StimulusApplication.register("delete", _delete_controller.default);
|
|
7054
|
+
StimulusApplication.register("flatpickr", _flatpickr_controller.default);
|
|
7055
|
+
StimulusApplication.register("toggle-pending-destruction", _toggle_pending_destruction_controller.default);
|
|
7056
|
+
},{"@rails/ujs":"../node_modules/@rails/ujs/lib/assets/compiled/rails-ujs.js","stimulus":"../node_modules/stimulus/index.js","./apply_template_controller":"javascripts/super/apply_template_controller.js","./clean_filter_param_controller":"javascripts/super/clean_filter_param_controller.js","./clean_filter_params_controller":"javascripts/super/clean_filter_params_controller.js","./delete_controller":"javascripts/super/delete_controller.js","./flatpickr_controller":"javascripts/super/flatpickr_controller.js","./toggle_pending_destruction_controller":"javascripts/super/toggle_pending_destruction_controller.js"}]},{},["javascripts/super/application.js"], "Super")
|