trestle 0.8.3 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/trestle/_confirmation.js +23 -0
- data/app/assets/javascripts/trestle/_datepicker.js +22 -0
- data/app/assets/javascripts/trestle/_errors.js +11 -0
- data/app/assets/javascripts/trestle/_form.js +6 -0
- data/app/assets/javascripts/trestle/_gallery.js +27 -0
- data/app/assets/javascripts/trestle/_select.js +11 -0
- data/app/assets/javascripts/trestle/_sidebar.js +52 -0
- data/app/assets/javascripts/trestle/_table.js +21 -0
- data/app/assets/javascripts/trestle/_tabs.js +13 -0
- data/app/assets/javascripts/trestle/_tooltips.js +3 -0
- data/app/assets/javascripts/trestle/admin.js +23 -0
- data/app/assets/javascripts/trestle/custom.js +4 -0
- data/app/assets/stylesheets/trestle/components/_table.scss +6 -0
- data/app/helpers/trestle/form_helper.rb +1 -1
- data/app/helpers/trestle/format_helper.rb +48 -0
- data/app/helpers/trestle/url_helper.rb +2 -8
- data/app/views/layouts/trestle/admin.html.erb +3 -3
- data/app/views/trestle/admin/index.html.erb +1 -1
- data/app/views/trestle/dashboard/index.html.erb +2 -2
- data/app/views/trestle/resource/_form.html.erb +1 -1
- data/app/views/trestle/resource/edit.html.erb +2 -2
- data/app/views/trestle/resource/index.html.erb +1 -1
- data/app/views/trestle/resource/new.html.erb +1 -1
- data/app/views/trestle/resource/show.html.erb +2 -2
- data/app/views/trestle/shared/_sidebar.html.erb +4 -2
- data/bower.json +1 -1
- data/config/locales/en.yml +16 -2
- data/lib/generators/trestle/install/install_generator.rb +3 -3
- data/lib/generators/trestle/install/templates/custom.js +7 -0
- data/lib/generators/trestle/install/templates/trestle.rb.erb +3 -2
- data/lib/trestle/adapters.rb +7 -64
- data/lib/trestle/adapters/active_record_adapter.rb +46 -20
- data/lib/trestle/adapters/adapter.rb +176 -0
- data/lib/trestle/adapters/sequel_adapter.rb +85 -0
- data/lib/trestle/admin.rb +1 -1
- data/lib/trestle/attribute.rb +14 -37
- data/lib/trestle/breadcrumb.rb +6 -0
- data/lib/trestle/configuration.rb +1 -1
- data/lib/trestle/form/automatic.rb +29 -21
- data/lib/trestle/form/builder.rb +4 -0
- data/lib/trestle/form/field.rb +2 -2
- data/lib/trestle/form/fields/check_box.rb +1 -1
- data/lib/trestle/form/fields/collection_select.rb +1 -1
- data/lib/trestle/form/fields/date_select.rb +1 -1
- data/lib/trestle/form/fields/datetime_select.rb +1 -1
- data/lib/trestle/form/fields/grouped_collection_select.rb +1 -1
- data/lib/trestle/form/fields/select.rb +2 -2
- data/lib/trestle/form/fields/tag_select.rb +1 -2
- data/lib/trestle/form/fields/time_select.rb +1 -1
- data/lib/trestle/form/fields/time_zone_select.rb +1 -1
- data/lib/trestle/resource.rb +11 -7
- data/lib/trestle/resource/builder.rb +2 -1
- data/lib/trestle/resource/controller.rb +61 -17
- data/lib/trestle/scope.rb +1 -1
- data/lib/trestle/table/automatic.rb +5 -11
- data/lib/trestle/table/builder.rb +1 -0
- data/lib/trestle/table/column.rb +24 -43
- data/lib/trestle/version.rb +1 -1
- data/trestle.gemspec +3 -4
- data/vendor/assets/bower_components/trestle/flatpickr/dist/flatpickr.css +51 -26
- data/vendor/assets/bower_components/trestle/flatpickr/dist/flatpickr.js +349 -299
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/ar.js +5 -5
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/bg.js +5 -5
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/bn.js +5 -5
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/cat.js +7 -7
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/cs.js +7 -7
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/cy.js +7 -7
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/da.js +6 -6
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/de.js +10 -10
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/eo.js +11 -11
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/es.js +7 -7
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/et.js +11 -11
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/fa.js +6 -6
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/fi.js +7 -7
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/fr.js +11 -11
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/gr.js +13 -13
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/he.js +5 -5
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/hi.js +5 -5
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/hr.js +6 -6
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/hu.js +10 -10
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/id.js +7 -7
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/index.js +97 -0
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/it.js +10 -10
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/ja.js +5 -5
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/ko.js +6 -6
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/lt.js +10 -10
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/lv.js +6 -6
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/mk.js +8 -8
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/ms.js +7 -7
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/my.js +7 -7
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/nl.js +11 -11
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/no.js +11 -11
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/pa.js +5 -5
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/pl.js +6 -6
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/pt.js +6 -8
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/ro.js +7 -9
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/ru.js +6 -8
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/si.js +5 -7
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/sk.js +8 -8
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/sl.js +8 -10
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/sq.js +5 -7
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/sr.js +9 -10
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/sv.js +8 -10
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/th.js +10 -11
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/tr.js +6 -8
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/uk.js +6 -7
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/vn.js +6 -8
- data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/zh.js +9 -11
- metadata +24 -34
- data/app/assets/javascripts/trestle/_confirmation.js.coffee +0 -18
- data/app/assets/javascripts/trestle/_datepicker.js.coffee +0 -18
- data/app/assets/javascripts/trestle/_errors.js.coffee +0 -8
- data/app/assets/javascripts/trestle/_form.js.coffee +0 -4
- data/app/assets/javascripts/trestle/_gallery.js.coffee +0 -21
- data/app/assets/javascripts/trestle/_select.js.coffee +0 -7
- data/app/assets/javascripts/trestle/_sidebar.js.coffee +0 -45
- data/app/assets/javascripts/trestle/_table.js.coffee +0 -16
- data/app/assets/javascripts/trestle/_tabs.js.coffee +0 -9
- data/app/assets/javascripts/trestle/_tooltips.js.coffee +0 -2
- data/app/assets/javascripts/trestle/admin.js.coffee +0 -22
- data/app/assets/javascripts/trestle/custom.js.coffee +0 -4
- data/lib/generators/trestle/install/templates/custom.js.coffee +0 -7
data/lib/trestle/scope.rb
CHANGED
@@ -11,20 +11,14 @@ module Trestle
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def content_columns
|
14
|
-
@admin.
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
if attribute.association?
|
14
|
+
@admin.default_table_attributes.map.with_index do |attribute, index|
|
15
|
+
case attribute.type
|
16
|
+
when :association
|
19
17
|
Column.new(self, attribute.association_name, sort: false)
|
20
|
-
elsif attribute.text?
|
21
|
-
Column.new(self, attribute.name, link: index.zero?) do |instance|
|
22
|
-
truncate(instance.public_send(attribute.name))
|
23
|
-
end
|
24
18
|
else
|
25
|
-
Column.new(self, attribute.name, link: index.zero?, align: (:center if
|
19
|
+
Column.new(self, attribute.name, link: index.zero?, align: (:center if [:datetime, :boolean].include?(attribute.type)))
|
26
20
|
end
|
27
|
-
end
|
21
|
+
end
|
28
22
|
end
|
29
23
|
|
30
24
|
def actions_column
|
data/lib/trestle/table/column.rb
CHANGED
@@ -28,6 +28,16 @@ module Trestle
|
|
28
28
|
options[:sort].is_a?(Hash) ? options[:sort] : {}
|
29
29
|
end
|
30
30
|
|
31
|
+
def header
|
32
|
+
if options[:header]
|
33
|
+
options[:header]
|
34
|
+
elsif admin = table.options[:admin]
|
35
|
+
admin.human_attribute_name(field)
|
36
|
+
else
|
37
|
+
field.to_s.humanize.titleize
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
31
41
|
class Renderer
|
32
42
|
delegate :options, to: :@column
|
33
43
|
|
@@ -38,17 +48,14 @@ module Trestle
|
|
38
48
|
def header
|
39
49
|
return if options.has_key?(:header) && options[:header].in?([nil, false])
|
40
50
|
|
41
|
-
header = I18n.t("admin.table.headers.#{@column.field}", default:
|
51
|
+
header = I18n.t("admin.table.headers.#{@column.field}", default: @column.header)
|
42
52
|
header = @template.sort_link(header, @column.sort_field, @column.sort_options) if @column.sortable?
|
43
53
|
header
|
44
54
|
end
|
45
55
|
|
46
56
|
def content(instance)
|
47
57
|
value = column_value(instance)
|
48
|
-
|
49
|
-
return blank_column(instance) if value.nil?
|
50
|
-
|
51
|
-
content = format_column(value)
|
58
|
+
content = @template.format_value(value, options)
|
52
59
|
|
53
60
|
if value.respond_to?(:id) && options[:link] != false
|
54
61
|
# Automatically link to instance's admin if available
|
@@ -72,48 +79,22 @@ module Trestle
|
|
72
79
|
private
|
73
80
|
def column_value(instance)
|
74
81
|
if @column.block
|
75
|
-
|
82
|
+
if defined?(Haml) && Haml::Helpers.block_is_haml?(@column.block)
|
83
|
+
# In order for table column blocks to work properly within Haml templates,
|
84
|
+
# the _hamlout local variable needs to be defined in the scope of the block,
|
85
|
+
# so that the Haml version of the capture method is used. Because we
|
86
|
+
# evaluate the block using instance_exec, we need to set this up manually.
|
87
|
+
-> {
|
88
|
+
_hamlout = eval('_hamlout', @column.block.binding)
|
89
|
+
@template.capture { @template.instance_exec(instance, &@column.block).to_s }
|
90
|
+
}.call
|
91
|
+
else
|
92
|
+
@template.capture { @template.instance_exec(instance, &@column.block).to_s }
|
93
|
+
end
|
76
94
|
else
|
77
95
|
instance.send(@column.field)
|
78
96
|
end
|
79
97
|
end
|
80
|
-
|
81
|
-
def blank_column(value)
|
82
|
-
text = options.key?(:blank) ? options[:blank] : I18n.t("admin.table.column.blank")
|
83
|
-
@template.content_tag(:span, text, class: "blank")
|
84
|
-
end
|
85
|
-
|
86
|
-
def format_column(value)
|
87
|
-
if options.key?(:format)
|
88
|
-
format_from_options(value)
|
89
|
-
else
|
90
|
-
autoformat_value(value)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
def format_from_options(value)
|
95
|
-
case options[:format]
|
96
|
-
when :currency
|
97
|
-
@template.number_to_currency(value)
|
98
|
-
else
|
99
|
-
value
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
def autoformat_value(value)
|
104
|
-
case value
|
105
|
-
when Time, DateTime
|
106
|
-
@template.timestamp(value)
|
107
|
-
when Date
|
108
|
-
@template.datestamp(value)
|
109
|
-
when TrueClass, FalseClass
|
110
|
-
@template.status_tag(@template.icon("fa fa-check"), :success) if value
|
111
|
-
when ->(value) { value.respond_to?(:id) }
|
112
|
-
@template.display(value)
|
113
|
-
else
|
114
|
-
value
|
115
|
-
end
|
116
|
-
end
|
117
98
|
end
|
118
99
|
end
|
119
100
|
end
|
data/lib/trestle/version.rb
CHANGED
data/trestle.gemspec
CHANGED
@@ -33,11 +33,10 @@ Gem::Specification.new do |spec|
|
|
33
33
|
|
34
34
|
spec.required_ruby_version = ">= 2.2.2"
|
35
35
|
|
36
|
-
spec.add_dependency "
|
36
|
+
spec.add_dependency "railties", ">= 4.2.0"
|
37
37
|
spec.add_dependency "sass-rails", "~> 5.0.6"
|
38
|
-
spec.add_dependency "
|
39
|
-
spec.add_dependency "
|
40
|
-
spec.add_dependency "kaminari", "~> 0.17.0"
|
38
|
+
spec.add_dependency "autoprefixer-rails", "~> 7.1.2"
|
39
|
+
spec.add_dependency "kaminari", "~> 1.0.1"
|
41
40
|
|
42
41
|
spec.add_development_dependency "bundler", "~> 1.12"
|
43
42
|
spec.add_development_dependency "rake", "~> 10.0"
|
@@ -14,12 +14,14 @@
|
|
14
14
|
line-height: 24px;
|
15
15
|
border-radius: 5px;
|
16
16
|
position: absolute;
|
17
|
-
width:
|
18
|
-
box-sizing: border-box;
|
17
|
+
width: 307.875px;
|
18
|
+
-webkit-box-sizing: border-box;
|
19
|
+
box-sizing: border-box;
|
19
20
|
-ms-touch-action: manipulation;
|
20
21
|
touch-action: manipulation;
|
21
22
|
background: #fff;
|
22
|
-
box-shadow: 1px 0 0 #e6e6e6, -1px 0 0 #e6e6e6, 0 1px 0 #e6e6e6, 0 -1px 0 #e6e6e6, 0 3px 13px rgba(0,0,0,0.08);
|
23
|
+
-webkit-box-shadow: 1px 0 0 #e6e6e6, -1px 0 0 #e6e6e6, 0 1px 0 #e6e6e6, 0 -1px 0 #e6e6e6, 0 3px 13px rgba(0,0,0,0.08);
|
24
|
+
box-shadow: 1px 0 0 #e6e6e6, -1px 0 0 #e6e6e6, 0 1px 0 #e6e6e6, 0 -1px 0 #e6e6e6, 0 3px 13px rgba(0,0,0,0.08);
|
23
25
|
}
|
24
26
|
.flatpickr-calendar.open,
|
25
27
|
.flatpickr-calendar.inline {
|
@@ -194,6 +196,7 @@
|
|
194
196
|
}
|
195
197
|
.flatpickr-prev-month svg path,
|
196
198
|
.flatpickr-next-month svg path {
|
199
|
+
-webkit-transition: fill 0.1s;
|
197
200
|
transition: fill 0.1s;
|
198
201
|
fill: inherit;
|
199
202
|
}
|
@@ -218,7 +221,8 @@
|
|
218
221
|
opacity: 0;
|
219
222
|
cursor: pointer;
|
220
223
|
border: 1px solid rgba(57,57,57,0.05);
|
221
|
-
box-sizing: border-box;
|
224
|
+
-webkit-box-sizing: border-box;
|
225
|
+
box-sizing: border-box;
|
222
226
|
}
|
223
227
|
.numInputWrapper span:hover {
|
224
228
|
background: rgba(0,0,0,0.1);
|
@@ -326,7 +330,8 @@
|
|
326
330
|
}
|
327
331
|
.flatpickr-current-month input.cur-year {
|
328
332
|
background: transparent;
|
329
|
-
box-sizing: border-box;
|
333
|
+
-webkit-box-sizing: border-box;
|
334
|
+
box-sizing: border-box;
|
330
335
|
color: inherit;
|
331
336
|
cursor: default;
|
332
337
|
padding: 0 0 0 0.5ch;
|
@@ -355,10 +360,12 @@
|
|
355
360
|
background: transparent;
|
356
361
|
text-align: center;
|
357
362
|
overflow: hidden;
|
358
|
-
width:
|
363
|
+
width: 100%;
|
364
|
+
display: -webkit-box;
|
359
365
|
display: -webkit-flex;
|
360
366
|
display: -ms-flexbox;
|
361
367
|
display: flex;
|
368
|
+
-webkit-box-align: center;
|
362
369
|
-webkit-align-items: center;
|
363
370
|
-ms-flex-align: center;
|
364
371
|
align-items: center;
|
@@ -373,6 +380,7 @@ span.flatpickr-weekday {
|
|
373
380
|
margin: 0;
|
374
381
|
text-align: center;
|
375
382
|
display: block;
|
383
|
+
-webkit-box-flex: 1;
|
376
384
|
-webkit-flex: 1;
|
377
385
|
-ms-flex: 1;
|
378
386
|
flex: 1;
|
@@ -385,10 +393,11 @@ span.flatpickr-weekday {
|
|
385
393
|
.flatpickr-days {
|
386
394
|
position: relative;
|
387
395
|
overflow: hidden;
|
396
|
+
display: -webkit-box;
|
388
397
|
display: -webkit-flex;
|
389
398
|
display: -ms-flexbox;
|
390
399
|
display: flex;
|
391
|
-
width:
|
400
|
+
width: 307.875px;
|
392
401
|
}
|
393
402
|
.flatpickr-days:focus {
|
394
403
|
outline: 0;
|
@@ -397,12 +406,14 @@ span.flatpickr-weekday {
|
|
397
406
|
padding: 0;
|
398
407
|
outline: 0;
|
399
408
|
text-align: left;
|
400
|
-
width:
|
401
|
-
min-width:
|
402
|
-
max-width:
|
403
|
-
box-sizing: border-box;
|
409
|
+
width: 307.875px;
|
410
|
+
min-width: 307.875px;
|
411
|
+
max-width: 307.875px;
|
412
|
+
-webkit-box-sizing: border-box;
|
413
|
+
box-sizing: border-box;
|
404
414
|
display: inline-block;
|
405
415
|
display: -ms-flexbox;
|
416
|
+
display: -webkit-box;
|
406
417
|
display: -webkit-flex;
|
407
418
|
display: flex;
|
408
419
|
-webkit-flex-wrap: wrap;
|
@@ -442,7 +453,8 @@ span.flatpickr-weekday {
|
|
442
453
|
background: none;
|
443
454
|
border: 1px solid transparent;
|
444
455
|
border-radius: 150px;
|
445
|
-
box-sizing: border-box;
|
456
|
+
-webkit-box-sizing: border-box;
|
457
|
+
box-sizing: border-box;
|
446
458
|
color: #393939;
|
447
459
|
cursor: pointer;
|
448
460
|
font-weight: 400;
|
@@ -450,12 +462,13 @@ span.flatpickr-weekday {
|
|
450
462
|
-webkit-flex-basis: 14.2857143%;
|
451
463
|
-ms-flex-preferred-size: 14.2857143%;
|
452
464
|
flex-basis: 14.2857143%;
|
453
|
-
max-width:
|
454
|
-
height:
|
455
|
-
line-height:
|
465
|
+
max-width: 39px;
|
466
|
+
height: 39px;
|
467
|
+
line-height: 39px;
|
456
468
|
margin: 0;
|
457
469
|
display: inline-block;
|
458
470
|
position: relative;
|
471
|
+
-webkit-box-pack: center;
|
459
472
|
-webkit-justify-content: center;
|
460
473
|
-ms-flex-pack: center;
|
461
474
|
justify-content: center;
|
@@ -506,7 +519,8 @@ span.flatpickr-weekday {
|
|
506
519
|
.flatpickr-day.startRange.nextMonthDay,
|
507
520
|
.flatpickr-day.endRange.nextMonthDay {
|
508
521
|
background: #569ff7;
|
509
|
-
box-shadow: none;
|
522
|
+
-webkit-box-shadow: none;
|
523
|
+
box-shadow: none;
|
510
524
|
color: #fff;
|
511
525
|
border-color: #569ff7;
|
512
526
|
}
|
@@ -523,7 +537,8 @@ span.flatpickr-weekday {
|
|
523
537
|
.flatpickr-day.selected.startRange + .endRange,
|
524
538
|
.flatpickr-day.startRange.startRange + .endRange,
|
525
539
|
.flatpickr-day.endRange.startRange + .endRange {
|
526
|
-
box-shadow: -10px 0 0 #569ff7;
|
540
|
+
-webkit-box-shadow: -10px 0 0 #569ff7;
|
541
|
+
box-shadow: -10px 0 0 #569ff7;
|
527
542
|
}
|
528
543
|
.flatpickr-day.selected.startRange.endRange,
|
529
544
|
.flatpickr-day.startRange.startRange.endRange,
|
@@ -532,7 +547,8 @@ span.flatpickr-weekday {
|
|
532
547
|
}
|
533
548
|
.flatpickr-day.inRange {
|
534
549
|
border-radius: 0;
|
535
|
-
box-shadow: -5px 0 0 #e6e6e6, 5px 0 0 #e6e6e6;
|
550
|
+
-webkit-box-shadow: -5px 0 0 #e6e6e6, 5px 0 0 #e6e6e6;
|
551
|
+
box-shadow: -5px 0 0 #e6e6e6, 5px 0 0 #e6e6e6;
|
536
552
|
}
|
537
553
|
.flatpickr-day.disabled,
|
538
554
|
.flatpickr-day.disabled:hover {
|
@@ -552,7 +568,8 @@ span.flatpickr-weekday {
|
|
552
568
|
}
|
553
569
|
.flatpickr-day.week.selected {
|
554
570
|
border-radius: 0;
|
555
|
-
box-shadow: -5px 0 0 #569ff7, 5px 0 0 #569ff7;
|
571
|
+
-webkit-box-shadow: -5px 0 0 #569ff7, 5px 0 0 #569ff7;
|
572
|
+
box-shadow: -5px 0 0 #569ff7, 5px 0 0 #569ff7;
|
556
573
|
}
|
557
574
|
.rangeMode .flatpickr-day {
|
558
575
|
margin-top: 1px;
|
@@ -563,7 +580,8 @@ span.flatpickr-weekday {
|
|
563
580
|
}
|
564
581
|
.flatpickr-weekwrapper .flatpickr-weeks {
|
565
582
|
padding: 0 12px;
|
566
|
-
box-shadow: 1px 0 0 #e6e6e6;
|
583
|
+
-webkit-box-shadow: 1px 0 0 #e6e6e6;
|
584
|
+
box-shadow: 1px 0 0 #e6e6e6;
|
567
585
|
}
|
568
586
|
.flatpickr-weekwrapper .flatpickr-weekday {
|
569
587
|
float: none;
|
@@ -577,16 +595,19 @@ span.flatpickr-weekday {
|
|
577
595
|
}
|
578
596
|
.flatpickr-innerContainer {
|
579
597
|
display: block;
|
598
|
+
display: -webkit-box;
|
580
599
|
display: -webkit-flex;
|
581
600
|
display: -ms-flexbox;
|
582
601
|
display: flex;
|
583
|
-
box-sizing: border-box;
|
602
|
+
-webkit-box-sizing: border-box;
|
603
|
+
box-sizing: border-box;
|
584
604
|
overflow: hidden;
|
585
605
|
}
|
586
606
|
.flatpickr-rContainer {
|
587
607
|
display: inline-block;
|
588
608
|
padding: 0;
|
589
|
-
box-sizing: border-box;
|
609
|
+
-webkit-box-sizing: border-box;
|
610
|
+
box-sizing: border-box;
|
590
611
|
}
|
591
612
|
.flatpickr-time {
|
592
613
|
text-align: center;
|
@@ -595,8 +616,10 @@ span.flatpickr-weekday {
|
|
595
616
|
height: 0;
|
596
617
|
line-height: 40px;
|
597
618
|
max-height: 40px;
|
598
|
-
box-sizing: border-box;
|
619
|
+
-webkit-box-sizing: border-box;
|
620
|
+
box-sizing: border-box;
|
599
621
|
overflow: hidden;
|
622
|
+
display: -webkit-box;
|
600
623
|
display: -webkit-flex;
|
601
624
|
display: -ms-flexbox;
|
602
625
|
display: flex;
|
@@ -607,6 +630,7 @@ span.flatpickr-weekday {
|
|
607
630
|
clear: both;
|
608
631
|
}
|
609
632
|
.flatpickr-time .numInputWrapper {
|
633
|
+
-webkit-box-flex: 1;
|
610
634
|
-webkit-flex: 1;
|
611
635
|
-ms-flex: 1;
|
612
636
|
flex: 1;
|
@@ -628,7 +652,8 @@ span.flatpickr-weekday {
|
|
628
652
|
}
|
629
653
|
.flatpickr-time input {
|
630
654
|
background: transparent;
|
631
|
-
box-shadow: none;
|
655
|
+
-webkit-box-shadow: none;
|
656
|
+
box-shadow: none;
|
632
657
|
border: 0;
|
633
658
|
border-radius: 0;
|
634
659
|
text-align: center;
|
@@ -640,7 +665,8 @@ span.flatpickr-weekday {
|
|
640
665
|
color: #393939;
|
641
666
|
font-size: 14px;
|
642
667
|
position: relative;
|
643
|
-
box-sizing: border-box;
|
668
|
+
-webkit-box-sizing: border-box;
|
669
|
+
box-sizing: border-box;
|
644
670
|
}
|
645
671
|
.flatpickr-time input.flatpickr-hour {
|
646
672
|
font-weight: bold;
|
@@ -668,7 +694,6 @@ span.flatpickr-weekday {
|
|
668
694
|
user-select: none;
|
669
695
|
-webkit-align-self: center;
|
670
696
|
-ms-flex-item-align: center;
|
671
|
-
-ms-grid-row-align: center;
|
672
697
|
align-self: center;
|
673
698
|
}
|
674
699
|
.flatpickr-time .flatpickr-am-pm {
|
@@ -2,12 +2,15 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
|
|
2
2
|
|
3
3
|
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
4
4
|
|
5
|
-
/*! flatpickr
|
6
|
-
function
|
5
|
+
/*! flatpickr v3.0.6, @license MIT */
|
6
|
+
function FlatpickrInstance(element, config) {
|
7
7
|
var self = this;
|
8
8
|
|
9
9
|
self._ = {};
|
10
10
|
self._.afterDayAnim = afterDayAnim;
|
11
|
+
self._bind = bind;
|
12
|
+
self._compareDates = compareDates;
|
13
|
+
self._setHoursFromDate = setHoursFromDate;
|
11
14
|
self.changeMonth = changeMonth;
|
12
15
|
self.changeYear = changeYear;
|
13
16
|
self.clear = clear;
|
@@ -25,8 +28,8 @@ function Flatpickr(element, config) {
|
|
25
28
|
function init() {
|
26
29
|
self.element = self.input = element;
|
27
30
|
self.instanceConfig = config || {};
|
28
|
-
self.parseDate =
|
29
|
-
self.formatDate =
|
31
|
+
self.parseDate = FlatpickrInstance.prototype.parseDate.bind(self);
|
32
|
+
self.formatDate = FlatpickrInstance.prototype.formatDate.bind(self);
|
30
33
|
|
31
34
|
setupFormats();
|
32
35
|
parseConfig();
|
@@ -47,15 +50,15 @@ function Flatpickr(element, config) {
|
|
47
50
|
if (self.config.enableTime) {
|
48
51
|
setHoursFromDate(self.config.noCalendar ? self.latestSelectedDateObj || self.config.minDate : null);
|
49
52
|
}
|
50
|
-
updateValue();
|
53
|
+
updateValue(false);
|
51
54
|
}
|
52
55
|
|
56
|
+
self.showTimeInput = self.selectedDates.length > 0 || self.config.noCalendar;
|
57
|
+
|
53
58
|
if (self.config.weekNumbers) {
|
54
59
|
self.calendarContainer.style.width = self.daysContainer.offsetWidth + self.weekWrapper.offsetWidth + "px";
|
55
60
|
}
|
56
61
|
|
57
|
-
self.showTimeInput = self.selectedDates.length > 0 || self.config.noCalendar;
|
58
|
-
|
59
62
|
if (!self.isMobile) positionCalendar();
|
60
63
|
|
61
64
|
triggerEvent("Ready");
|
@@ -238,7 +241,10 @@ function Flatpickr(element, config) {
|
|
238
241
|
bind(window.document, "mousedown", onClick(documentClick));
|
239
242
|
bind(self._input, "blur", documentClick);
|
240
243
|
|
241
|
-
if (self.config.clickOpens === true)
|
244
|
+
if (self.config.clickOpens === true) {
|
245
|
+
bind(self._input, "focus", self.open);
|
246
|
+
bind(self._input, "mousedown", onClick(self.open));
|
247
|
+
}
|
242
248
|
|
243
249
|
if (!self.config.noCalendar) {
|
244
250
|
self.monthNav.addEventListener("wheel", function (e) {
|
@@ -667,7 +673,7 @@ function Flatpickr(element, config) {
|
|
667
673
|
|
668
674
|
self.hourElement.tabIndex = self.minuteElement.tabIndex = -1;
|
669
675
|
|
670
|
-
self.hourElement.value = self.pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getHours() : self.config.defaultHour);
|
676
|
+
self.hourElement.value = self.pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getHours() : self.config.defaultHour % (self.time_24hr ? 24 : 12));
|
671
677
|
|
672
678
|
self.minuteElement.value = self.pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getMinutes() : self.config.defaultMinute);
|
673
679
|
|
@@ -694,7 +700,7 @@ function Flatpickr(element, config) {
|
|
694
700
|
var secondInput = createNumberInput("flatpickr-second");
|
695
701
|
self.secondElement = secondInput.childNodes[0];
|
696
702
|
|
697
|
-
self.secondElement.value = self.latestSelectedDateObj ? self.
|
703
|
+
self.secondElement.value = self.pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getSeconds() : self.config.defaultSeconds);
|
698
704
|
|
699
705
|
self.secondElement.step = self.minuteElement.step;
|
700
706
|
self.secondElement.min = self.minuteElement.min;
|
@@ -706,7 +712,7 @@ function Flatpickr(element, config) {
|
|
706
712
|
|
707
713
|
if (!self.config.time_24hr) {
|
708
714
|
// add self.amPM if appropriate
|
709
|
-
self.amPM = createElement("span", "flatpickr-am-pm", ["AM", "PM"][self.hourElement.value > 11 | 0]);
|
715
|
+
self.amPM = createElement("span", "flatpickr-am-pm", ["AM", "PM"][(self.latestSelectedDateObj ? self.hourElement.value : self.config.defaultHour) > 11 | 0]);
|
710
716
|
self.amPM.title = self.l10n.toggleTitle;
|
711
717
|
self.amPM.tabIndex = -1;
|
712
718
|
self.timeContainer.appendChild(self.amPM);
|
@@ -840,6 +846,8 @@ function Flatpickr(element, config) {
|
|
840
846
|
}
|
841
847
|
|
842
848
|
function destroy() {
|
849
|
+
if (self.config !== undefined) triggerEvent("Destroy");
|
850
|
+
|
843
851
|
for (var i = self._handlers.length; i--;) {
|
844
852
|
var h = self._handlers[i];
|
845
853
|
h.element.removeEventListener(h.event, h.handler);
|
@@ -866,7 +874,9 @@ function Flatpickr(element, config) {
|
|
866
874
|
}
|
867
875
|
|
868
876
|
["_showTimeInput", "latestSelectedDateObj", "_hideNextMonthArrow", "_hidePrevMonthArrow", "__hideNextMonthArrow", "__hidePrevMonthArrow", "isMobile", "isOpen", "selectedDateElem", "minDateHasTime", "maxDateHasTime", "days", "daysContainer", "_input", "_positionElement", "innerContainer", "rContainer", "monthNav", "todayDateElem", "calendarContainer", "weekdayContainer", "prevMonthNav", "nextMonthNav", "currentMonthElement", "currentYearElement", "navigationCurrentMonth", "selectedDateElem", "config"].forEach(function (k) {
|
869
|
-
|
877
|
+
try {
|
878
|
+
delete self[k];
|
879
|
+
} catch (e) {}
|
870
880
|
});
|
871
881
|
}
|
872
882
|
|
@@ -885,8 +895,7 @@ function Flatpickr(element, config) {
|
|
885
895
|
|
886
896
|
var lostFocus = e.type === "blur" ? isInput && e.relatedTarget && !isCalendarElem(e.relatedTarget) : !isInput && !isCalendarElement;
|
887
897
|
|
888
|
-
if (lostFocus) {
|
889
|
-
e.preventDefault();
|
898
|
+
if (lostFocus && self.config.ignoredFocusElements.indexOf(e.target) === -1) {
|
890
899
|
self.close();
|
891
900
|
|
892
901
|
if (self.config.mode === "range" && self.selectedDates.length === 1) {
|
@@ -966,6 +975,11 @@ function Flatpickr(element, config) {
|
|
966
975
|
self.close();
|
967
976
|
break;
|
968
977
|
|
978
|
+
case "Backspace":
|
979
|
+
case "Delete":
|
980
|
+
if (!self.config.allowInput) self.clear();
|
981
|
+
break;
|
982
|
+
|
969
983
|
case "ArrowLeft":
|
970
984
|
case "ArrowRight":
|
971
985
|
if (!isTimeObj) {
|
@@ -993,6 +1007,7 @@ function Flatpickr(element, config) {
|
|
993
1007
|
} else if (self.config.enableTime) {
|
994
1008
|
if (!isTimeObj) self.hourElement.focus();
|
995
1009
|
updateTime(e);
|
1010
|
+
self.debouncedChange();
|
996
1011
|
}
|
997
1012
|
|
998
1013
|
break;
|
@@ -1089,7 +1104,7 @@ function Flatpickr(element, config) {
|
|
1089
1104
|
if (self.isOpen && !self.config.static && !self.config.inline) positionCalendar();
|
1090
1105
|
}
|
1091
1106
|
|
1092
|
-
function open(e) {
|
1107
|
+
function open(e, positionElement) {
|
1093
1108
|
if (self.isMobile) {
|
1094
1109
|
if (e) {
|
1095
1110
|
e.preventDefault();
|
@@ -1108,7 +1123,7 @@ function Flatpickr(element, config) {
|
|
1108
1123
|
|
1109
1124
|
self.isOpen = true;
|
1110
1125
|
self.calendarContainer.classList.add("open");
|
1111
|
-
positionCalendar();
|
1126
|
+
positionCalendar(positionElement);
|
1112
1127
|
self._input.classList.add("active");
|
1113
1128
|
|
1114
1129
|
triggerEvent("Open");
|
@@ -1144,25 +1159,43 @@ function Flatpickr(element, config) {
|
|
1144
1159
|
}
|
1145
1160
|
|
1146
1161
|
function parseConfig() {
|
1147
|
-
var boolOpts = ["
|
1162
|
+
var boolOpts = ["wrap", "weekNumbers", "allowInput", "clickOpens", "time_24hr", "enableTime", "noCalendar", "altInput", "shorthandCurrentMonth", "inline", "static", "enableSeconds", "disableMobile"];
|
1148
1163
|
|
1149
|
-
var hooks = ["onChange", "onClose", "onDayCreate", "onKeyDown", "onMonthChange", "onOpen", "onParseConfig", "onReady", "onValueUpdate", "onYearChange"];
|
1164
|
+
var hooks = ["onChange", "onClose", "onDayCreate", "onDestroy", "onKeyDown", "onMonthChange", "onOpen", "onParseConfig", "onReady", "onValueUpdate", "onYearChange"];
|
1150
1165
|
|
1151
|
-
self.config = Object.create(
|
1166
|
+
self.config = Object.create(flatpickr.defaultConfig);
|
1152
1167
|
|
1153
1168
|
var userConfig = _extends({}, self.instanceConfig, JSON.parse(JSON.stringify(self.element.dataset || {})));
|
1154
1169
|
|
1155
1170
|
self.config.parseDate = userConfig.parseDate;
|
1156
1171
|
self.config.formatDate = userConfig.formatDate;
|
1157
1172
|
|
1173
|
+
Object.defineProperty(self.config, "enable", {
|
1174
|
+
get: function get() {
|
1175
|
+
return self.config._enable || [];
|
1176
|
+
},
|
1177
|
+
set: function set(dates) {
|
1178
|
+
return self.config._enable = parseDateRules(dates);
|
1179
|
+
}
|
1180
|
+
});
|
1181
|
+
|
1182
|
+
Object.defineProperty(self.config, "disable", {
|
1183
|
+
get: function get() {
|
1184
|
+
return self.config._disable || [];
|
1185
|
+
},
|
1186
|
+
set: function set(dates) {
|
1187
|
+
return self.config._disable = parseDateRules(dates);
|
1188
|
+
}
|
1189
|
+
});
|
1190
|
+
|
1158
1191
|
_extends(self.config, userConfig);
|
1159
1192
|
|
1160
1193
|
if (!userConfig.dateFormat && userConfig.enableTime) {
|
1161
|
-
self.config.dateFormat = self.config.noCalendar ? "H:i" + (self.config.enableSeconds ? ":S" : "") :
|
1194
|
+
self.config.dateFormat = self.config.noCalendar ? "H:i" + (self.config.enableSeconds ? ":S" : "") : flatpickr.defaultConfig.dateFormat + " H:i" + (self.config.enableSeconds ? ":S" : "");
|
1162
1195
|
}
|
1163
1196
|
|
1164
1197
|
if (userConfig.altInput && userConfig.enableTime && !userConfig.altFormat) {
|
1165
|
-
self.config.altFormat = self.config.noCalendar ? "h:i" + (self.config.enableSeconds ? ":S K" : " K") :
|
1198
|
+
self.config.altFormat = self.config.noCalendar ? "h:i" + (self.config.enableSeconds ? ":S K" : " K") : flatpickr.defaultConfig.altFormat + (" h:i" + (self.config.enableSeconds ? ":S" : "") + " K");
|
1166
1199
|
}
|
1167
1200
|
|
1168
1201
|
Object.defineProperty(self.config, "minDate", {
|
@@ -1204,22 +1237,24 @@ function Flatpickr(element, config) {
|
|
1204
1237
|
}
|
1205
1238
|
|
1206
1239
|
function setupLocale() {
|
1207
|
-
if (_typeof(self.config.locale) !== "object" && typeof
|
1240
|
+
if (_typeof(self.config.locale) !== "object" && typeof flatpickr.l10ns[self.config.locale] === "undefined") console.warn("flatpickr: invalid locale " + self.config.locale);
|
1208
1241
|
|
1209
|
-
self.l10n = _extends(Object.create(
|
1242
|
+
self.l10n = _extends(Object.create(flatpickr.l10ns.default), _typeof(self.config.locale) === "object" ? self.config.locale : self.config.locale !== "default" ? flatpickr.l10ns[self.config.locale] || {} : {});
|
1210
1243
|
}
|
1211
1244
|
|
1212
1245
|
function positionCalendar() {
|
1246
|
+
var positionElement = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : self._positionElement;
|
1247
|
+
|
1213
1248
|
if (self.calendarContainer === undefined) return;
|
1214
1249
|
|
1215
1250
|
var calendarHeight = self.calendarContainer.offsetHeight,
|
1216
1251
|
calendarWidth = self.calendarContainer.offsetWidth,
|
1217
1252
|
configPos = self.config.position,
|
1218
|
-
inputBounds =
|
1253
|
+
inputBounds = positionElement.getBoundingClientRect(),
|
1219
1254
|
distanceFromBottom = window.innerHeight - inputBounds.bottom,
|
1220
1255
|
showOnTop = configPos === "above" || configPos !== "below" && distanceFromBottom < calendarHeight && inputBounds.top > calendarHeight;
|
1221
1256
|
|
1222
|
-
var top = window.pageYOffset + inputBounds.top + (!showOnTop ?
|
1257
|
+
var top = window.pageYOffset + inputBounds.top + (!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2);
|
1223
1258
|
|
1224
1259
|
toggleClass(self.calendarContainer, "arrowTop", !showOnTop);
|
1225
1260
|
toggleClass(self.calendarContainer, "arrowBottom", showOnTop);
|
@@ -1315,7 +1350,7 @@ function Flatpickr(element, config) {
|
|
1315
1350
|
|
1316
1351
|
// maintain focus
|
1317
1352
|
if (!shouldChangeMonth) focusOnDay(e.target.$i, 0);else afterDayAnim(function () {
|
1318
|
-
return self.selectedDateElem.focus();
|
1353
|
+
return self.selectedDateElem && self.selectedDateElem.focus();
|
1319
1354
|
});
|
1320
1355
|
|
1321
1356
|
if (self.config.enableTime) setTimeout(function () {
|
@@ -1331,7 +1366,8 @@ function Flatpickr(element, config) {
|
|
1331
1366
|
}
|
1332
1367
|
|
1333
1368
|
function set(option, value) {
|
1334
|
-
self.config[option] = value;
|
1369
|
+
if (option !== null && (typeof option === "undefined" ? "undefined" : _typeof(option)) === "object") _extends(self.config, option);else self.config[option] = value;
|
1370
|
+
|
1335
1371
|
self.redraw();
|
1336
1372
|
jumpToDate();
|
1337
1373
|
}
|
@@ -1373,7 +1409,7 @@ function Flatpickr(element, config) {
|
|
1373
1409
|
}
|
1374
1410
|
|
1375
1411
|
function setDate(date, triggerChange, format) {
|
1376
|
-
if (!date) return self.clear(triggerChange);
|
1412
|
+
if (date !== 0 && !date) return self.clear(triggerChange);
|
1377
1413
|
|
1378
1414
|
setSelectedDate(date, format);
|
1379
1415
|
|
@@ -1389,27 +1425,23 @@ function Flatpickr(element, config) {
|
|
1389
1425
|
if (triggerChange) triggerEvent("Change");
|
1390
1426
|
}
|
1391
1427
|
|
1392
|
-
function
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
arr[i].to = self.parseDate(arr[i].to);
|
1398
|
-
}
|
1428
|
+
function parseDateRules(arr) {
|
1429
|
+
for (var i = arr.length; i--;) {
|
1430
|
+
if (typeof arr[i] === "string" || +arr[i]) arr[i] = self.parseDate(arr[i], null, true);else if (arr[i] && arr[i].from && arr[i].to) {
|
1431
|
+
arr[i].from = self.parseDate(arr[i].from);
|
1432
|
+
arr[i].to = self.parseDate(arr[i].to);
|
1399
1433
|
}
|
1400
|
-
|
1401
|
-
return arr.filter(function (x) {
|
1402
|
-
return x;
|
1403
|
-
}); // remove falsy values
|
1404
1434
|
}
|
1405
1435
|
|
1436
|
+
return arr.filter(function (x) {
|
1437
|
+
return x;
|
1438
|
+
}); // remove falsy values
|
1439
|
+
}
|
1440
|
+
|
1441
|
+
function setupDates() {
|
1406
1442
|
self.selectedDates = [];
|
1407
1443
|
self.now = new Date();
|
1408
1444
|
|
1409
|
-
if (self.config.disable.length) self.config.disable = parseDateRules(self.config.disable);
|
1410
|
-
|
1411
|
-
if (self.config.enable.length) self.config.enable = parseDateRules(self.config.enable);
|
1412
|
-
|
1413
1445
|
var preloadedDate = self.config.defaultDate || self.input.value;
|
1414
1446
|
if (preloadedDate) setSelectedDate(preloadedDate, self.config.dateFormat);
|
1415
1447
|
|
@@ -1471,12 +1503,13 @@ function Flatpickr(element, config) {
|
|
1471
1503
|
|
1472
1504
|
/* istanbul ignore next */
|
1473
1505
|
function setupFormats() {
|
1506
|
+
self.formats = Object.create(FlatpickrInstance.prototype.formats);
|
1474
1507
|
["D", "F", "J", "M", "W", "l"].forEach(function (f) {
|
1475
|
-
self.formats[f] =
|
1508
|
+
self.formats[f] = FlatpickrInstance.prototype.formats[f].bind(self);
|
1476
1509
|
});
|
1477
1510
|
|
1478
|
-
self.revFormat.F =
|
1479
|
-
self.revFormat.M =
|
1511
|
+
self.revFormat.F = FlatpickrInstance.prototype.revFormat.F.bind(self);
|
1512
|
+
self.revFormat.M = FlatpickrInstance.prototype.revFormat.M.bind(self);
|
1480
1513
|
}
|
1481
1514
|
|
1482
1515
|
function setupInputs() {
|
@@ -1497,6 +1530,7 @@ function Flatpickr(element, config) {
|
|
1497
1530
|
self._input = self.altInput;
|
1498
1531
|
self.altInput.placeholder = self.input.placeholder;
|
1499
1532
|
self.altInput.disabled = self.input.disabled;
|
1533
|
+
self.altInput.required = self.input.required;
|
1500
1534
|
self.altInput.type = "text";
|
1501
1535
|
self.input.type = "hidden";
|
1502
1536
|
|
@@ -1512,7 +1546,7 @@ function Flatpickr(element, config) {
|
|
1512
1546
|
var inputType = self.config.enableTime ? self.config.noCalendar ? "time" : "datetime-local" : "date";
|
1513
1547
|
|
1514
1548
|
self.mobileInput = createElement("input", self.input.className + " flatpickr-mobile");
|
1515
|
-
self.mobileInput.step = "any";
|
1549
|
+
self.mobileInput.step = self.input.getAttribute("step") || "any";
|
1516
1550
|
self.mobileInput.tabIndex = 1;
|
1517
1551
|
self.mobileInput.type = inputType;
|
1518
1552
|
self.mobileInput.disabled = self.input.disabled;
|
@@ -1625,7 +1659,8 @@ function Flatpickr(element, config) {
|
|
1625
1659
|
return self.formatDate(dObj, self.config.altFormat);
|
1626
1660
|
}).join(joinChar);
|
1627
1661
|
}
|
1628
|
-
|
1662
|
+
|
1663
|
+
if (triggerChange !== false) triggerEvent("ValueUpdate");
|
1629
1664
|
}
|
1630
1665
|
|
1631
1666
|
function mouseDelta(e) {
|
@@ -1760,204 +1795,7 @@ function Flatpickr(element, config) {
|
|
1760
1795
|
return self;
|
1761
1796
|
}
|
1762
1797
|
|
1763
|
-
|
1764
|
-
Flatpickr.defaultConfig = {
|
1765
|
-
mode: "single",
|
1766
|
-
|
1767
|
-
position: "auto",
|
1768
|
-
|
1769
|
-
animate: window.navigator.userAgent.indexOf("MSIE") === -1,
|
1770
|
-
|
1771
|
-
/* if true, dates will be parsed, formatted, and displayed in UTC.
|
1772
|
-
preloading date strings w/ timezones is recommended but not necessary */
|
1773
|
-
utc: false,
|
1774
|
-
|
1775
|
-
// wrap: see https://chmln.github.io/flatpickr/examples/#flatpickr-external-elements
|
1776
|
-
wrap: false,
|
1777
|
-
|
1778
|
-
// enables week numbers
|
1779
|
-
weekNumbers: false,
|
1780
|
-
|
1781
|
-
// allow manual datetime input
|
1782
|
-
allowInput: false,
|
1783
|
-
|
1784
|
-
/*
|
1785
|
-
clicking on input opens the date(time)picker.
|
1786
|
-
disable if you wish to open the calendar manually with .open()
|
1787
|
-
*/
|
1788
|
-
clickOpens: true,
|
1789
|
-
|
1790
|
-
/*
|
1791
|
-
closes calendar after date selection,
|
1792
|
-
unless 'mode' is 'multiple' or enableTime is true
|
1793
|
-
*/
|
1794
|
-
closeOnSelect: true,
|
1795
|
-
|
1796
|
-
// display time picker in 24 hour mode
|
1797
|
-
time_24hr: false,
|
1798
|
-
|
1799
|
-
// enables the time picker functionality
|
1800
|
-
enableTime: false,
|
1801
|
-
|
1802
|
-
// noCalendar: true will hide the calendar. use for a time picker along w/ enableTime
|
1803
|
-
noCalendar: false,
|
1804
|
-
|
1805
|
-
// more date format chars at https://chmln.github.io/flatpickr/#dateformat
|
1806
|
-
dateFormat: "Y-m-d",
|
1807
|
-
|
1808
|
-
// date format used in aria-label for days
|
1809
|
-
ariaDateFormat: "F j, Y",
|
1810
|
-
|
1811
|
-
// altInput - see https://chmln.github.io/flatpickr/#altinput
|
1812
|
-
altInput: false,
|
1813
|
-
|
1814
|
-
// the created altInput element will have this class.
|
1815
|
-
altInputClass: "form-control input",
|
1816
|
-
|
1817
|
-
// same as dateFormat, but for altInput
|
1818
|
-
altFormat: "F j, Y", // defaults to e.g. June 10, 2016
|
1819
|
-
|
1820
|
-
// defaultDate - either a datestring or a date object. used for datetimepicker"s initial value
|
1821
|
-
defaultDate: null,
|
1822
|
-
|
1823
|
-
// the minimum date that user can pick (inclusive)
|
1824
|
-
minDate: null,
|
1825
|
-
|
1826
|
-
// the maximum date that user can pick (inclusive)
|
1827
|
-
maxDate: null,
|
1828
|
-
|
1829
|
-
// dateparser that transforms a given string to a date object
|
1830
|
-
parseDate: null,
|
1831
|
-
|
1832
|
-
// dateformatter that transforms a given date object to a string, according to passed format
|
1833
|
-
formatDate: null,
|
1834
|
-
|
1835
|
-
getWeek: function getWeek(givenDate) {
|
1836
|
-
var date = new Date(givenDate.getTime());
|
1837
|
-
var onejan = new Date(date.getFullYear(), 0, 1);
|
1838
|
-
return Math.ceil(((date - onejan) / 86400000 + onejan.getDay() + 1) / 7);
|
1839
|
-
},
|
1840
|
-
|
1841
|
-
|
1842
|
-
// see https://chmln.github.io/flatpickr/#disable
|
1843
|
-
enable: [],
|
1844
|
-
|
1845
|
-
// see https://chmln.github.io/flatpickr/#disable
|
1846
|
-
disable: [],
|
1847
|
-
|
1848
|
-
// display the short version of month names - e.g. Sep instead of September
|
1849
|
-
shorthandCurrentMonth: false,
|
1850
|
-
|
1851
|
-
// displays calendar inline. see https://chmln.github.io/flatpickr/#inline-calendar
|
1852
|
-
inline: false,
|
1853
|
-
|
1854
|
-
// position calendar inside wrapper and next to the input element
|
1855
|
-
// leave at false unless you know what you"re doing
|
1856
|
-
"static": false,
|
1857
|
-
|
1858
|
-
// DOM node to append the calendar to in *static* mode
|
1859
|
-
appendTo: null,
|
1860
|
-
|
1861
|
-
// code for previous/next icons. this is where you put your custom icon code e.g. fontawesome
|
1862
|
-
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>",
|
1863
|
-
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>",
|
1864
|
-
|
1865
|
-
// enables seconds in the time picker
|
1866
|
-
enableSeconds: false,
|
1867
|
-
|
1868
|
-
// step size used when scrolling/incrementing the hour element
|
1869
|
-
hourIncrement: 1,
|
1870
|
-
|
1871
|
-
// step size used when scrolling/incrementing the minute element
|
1872
|
-
minuteIncrement: 5,
|
1873
|
-
|
1874
|
-
// initial value in the hour element
|
1875
|
-
defaultHour: 12,
|
1876
|
-
|
1877
|
-
// initial value in the minute element
|
1878
|
-
defaultMinute: 0,
|
1879
|
-
|
1880
|
-
// disable native mobile datetime input support
|
1881
|
-
disableMobile: false,
|
1882
|
-
|
1883
|
-
// default locale
|
1884
|
-
locale: "default",
|
1885
|
-
|
1886
|
-
plugins: [],
|
1887
|
-
|
1888
|
-
// called every time calendar is closed
|
1889
|
-
onClose: undefined, // function (dateObj, dateStr) {}
|
1890
|
-
|
1891
|
-
// onChange callback when user selects a date or time
|
1892
|
-
onChange: undefined, // function (dateObj, dateStr) {}
|
1893
|
-
|
1894
|
-
// called for every day element
|
1895
|
-
onDayCreate: undefined,
|
1896
|
-
|
1897
|
-
// called every time the month is changed
|
1898
|
-
onMonthChange: undefined,
|
1899
|
-
|
1900
|
-
// called every time calendar is opened
|
1901
|
-
onOpen: undefined, // function (dateObj, dateStr) {}
|
1902
|
-
|
1903
|
-
// called after the configuration has been parsed
|
1904
|
-
onParseConfig: undefined,
|
1905
|
-
|
1906
|
-
// called after calendar is ready
|
1907
|
-
onReady: undefined, // function (dateObj, dateStr) {}
|
1908
|
-
|
1909
|
-
// called after input value updated
|
1910
|
-
onValueUpdate: undefined,
|
1911
|
-
|
1912
|
-
// called every time the year is changed
|
1913
|
-
onYearChange: undefined,
|
1914
|
-
|
1915
|
-
onKeyDown: undefined
|
1916
|
-
};
|
1917
|
-
|
1918
|
-
/* istanbul ignore next */
|
1919
|
-
Flatpickr.l10ns = {
|
1920
|
-
en: {
|
1921
|
-
weekdays: {
|
1922
|
-
shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
1923
|
-
longhand: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
|
1924
|
-
},
|
1925
|
-
months: {
|
1926
|
-
shorthand: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
|
1927
|
-
longhand: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
|
1928
|
-
},
|
1929
|
-
daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
|
1930
|
-
firstDayOfWeek: 0,
|
1931
|
-
ordinal: function ordinal(nth) {
|
1932
|
-
var s = nth % 100;
|
1933
|
-
if (s > 3 && s < 21) return "th";
|
1934
|
-
switch (s % 10) {
|
1935
|
-
case 1:
|
1936
|
-
return "st";
|
1937
|
-
case 2:
|
1938
|
-
return "nd";
|
1939
|
-
case 3:
|
1940
|
-
return "rd";
|
1941
|
-
default:
|
1942
|
-
return "th";
|
1943
|
-
}
|
1944
|
-
},
|
1945
|
-
rangeSeparator: " to ",
|
1946
|
-
weekAbbreviation: "Wk",
|
1947
|
-
scrollTitle: "Scroll to increment",
|
1948
|
-
toggleTitle: "Click to toggle"
|
1949
|
-
}
|
1950
|
-
};
|
1951
|
-
|
1952
|
-
Flatpickr.l10ns.default = Object.create(Flatpickr.l10ns.en);
|
1953
|
-
Flatpickr.localize = function (l10n) {
|
1954
|
-
return _extends(Flatpickr.l10ns.default, l10n || {});
|
1955
|
-
};
|
1956
|
-
Flatpickr.setDefaults = function (config) {
|
1957
|
-
return _extends(Flatpickr.defaultConfig, config || {});
|
1958
|
-
};
|
1959
|
-
|
1960
|
-
Flatpickr.prototype = {
|
1798
|
+
FlatpickrInstance.prototype = {
|
1961
1799
|
formats: {
|
1962
1800
|
// get the date in UTC
|
1963
1801
|
Z: function Z(date) {
|
@@ -1976,12 +1814,12 @@ Flatpickr.prototype = {
|
|
1976
1814
|
|
1977
1815
|
// padded hour 1-12
|
1978
1816
|
G: function G(date) {
|
1979
|
-
return
|
1817
|
+
return FlatpickrInstance.prototype.pad(FlatpickrInstance.prototype.formats.h(date));
|
1980
1818
|
},
|
1981
1819
|
|
1982
1820
|
// hours with leading zero e.g. 03
|
1983
1821
|
H: function H(date) {
|
1984
|
-
return
|
1822
|
+
return FlatpickrInstance.prototype.pad(date.getHours());
|
1985
1823
|
},
|
1986
1824
|
|
1987
1825
|
// day (1-30) with ordinal suffix e.g. 1st, 2nd
|
@@ -2001,7 +1839,7 @@ Flatpickr.prototype = {
|
|
2001
1839
|
|
2002
1840
|
// seconds 00-59
|
2003
1841
|
S: function S(date) {
|
2004
|
-
return
|
1842
|
+
return FlatpickrInstance.prototype.pad(date.getSeconds());
|
2005
1843
|
},
|
2006
1844
|
|
2007
1845
|
// unix timestamp
|
@@ -2020,7 +1858,7 @@ Flatpickr.prototype = {
|
|
2020
1858
|
|
2021
1859
|
// day in month, padded (01-30)
|
2022
1860
|
d: function d(date) {
|
2023
|
-
return
|
1861
|
+
return FlatpickrInstance.prototype.pad(date.getDate());
|
2024
1862
|
},
|
2025
1863
|
|
2026
1864
|
// hour from 1-12 (am/pm)
|
@@ -2030,7 +1868,7 @@ Flatpickr.prototype = {
|
|
2030
1868
|
|
2031
1869
|
// minutes, padded with leading zero e.g. 09
|
2032
1870
|
i: function i(date) {
|
2033
|
-
return
|
1871
|
+
return FlatpickrInstance.prototype.pad(date.getMinutes());
|
2034
1872
|
},
|
2035
1873
|
|
2036
1874
|
// day in month (1-30)
|
@@ -2045,7 +1883,7 @@ Flatpickr.prototype = {
|
|
2045
1883
|
|
2046
1884
|
// padded month number (01-12)
|
2047
1885
|
m: function m(date) {
|
2048
|
-
return
|
1886
|
+
return FlatpickrInstance.prototype.pad(date.getMonth() + 1);
|
2049
1887
|
},
|
2050
1888
|
|
2051
1889
|
// the month number (1-12)
|
@@ -2160,7 +1998,7 @@ Flatpickr.prototype = {
|
|
2160
1998
|
G: "(\\d\\d|\\d)",
|
2161
1999
|
H: "(\\d\\d|\\d)",
|
2162
2000
|
J: "(\\d\\d|\\d)\\w+",
|
2163
|
-
K: "(
|
2001
|
+
K: "(am|AM|Am|aM|pm|PM|Pm|pM)",
|
2164
2002
|
M: "(\\w+)",
|
2165
2003
|
S: "(\\d\\d|\\d)",
|
2166
2004
|
U: "(.+)",
|
@@ -2191,45 +2029,58 @@ Flatpickr.prototype = {
|
|
2191
2029
|
* @return {Date} the parsed Date object
|
2192
2030
|
*/
|
2193
2031
|
parseDate: function parseDate(date, givenFormat, timeless) {
|
2194
|
-
|
2032
|
+
var _this2 = this;
|
2033
|
+
|
2034
|
+
if (date !== 0 && !date) return null;
|
2195
2035
|
|
2196
2036
|
var date_orig = date;
|
2197
2037
|
|
2198
|
-
if (date instanceof Date)
|
2199
|
-
|
2200
|
-
|
2201
|
-
|
2202
|
-
|
2203
|
-
|
2204
|
-
|
2205
|
-
|
2206
|
-
|
2207
|
-
|
2208
|
-
|
2209
|
-
|
2210
|
-
|
2211
|
-
|
2212
|
-
|
2213
|
-
|
2214
|
-
|
2215
|
-
|
2216
|
-
|
2217
|
-
|
2218
|
-
|
2219
|
-
|
2220
|
-
|
2221
|
-
|
2222
|
-
|
2223
|
-
|
2224
|
-
|
2225
|
-
|
2038
|
+
if (date instanceof Date) date = new Date(date.getTime()); // create a copy
|
2039
|
+
|
2040
|
+
else if (date.toFixed !== undefined) // timestamp
|
2041
|
+
date = new Date(date);else {
|
2042
|
+
// date string
|
2043
|
+
var format = givenFormat || (this.config || flatpickr.defaultConfig).dateFormat;
|
2044
|
+
date = String(date).trim();
|
2045
|
+
|
2046
|
+
if (date === "today") {
|
2047
|
+
date = new Date();
|
2048
|
+
timeless = true;
|
2049
|
+
} else if (/Z$/.test(date) || /GMT$/.test(date)) // datestrings w/ timezone
|
2050
|
+
date = new Date(date);else if (this.config && this.config.parseDate) date = this.config.parseDate(date, format);else {
|
2051
|
+
(function () {
|
2052
|
+
var parsedDate = !_this2.config || !_this2.config.noCalendar ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0) : new Date(new Date().setHours(0, 0, 0, 0));
|
2053
|
+
|
2054
|
+
var matched = void 0,
|
2055
|
+
ops = [];
|
2056
|
+
|
2057
|
+
for (var i = 0, matchIndex = 0, regexStr = ""; i < format.length; i++) {
|
2058
|
+
var token = format[i];
|
2059
|
+
var isBackSlash = token === "\\";
|
2060
|
+
var escaped = format[i - 1] === "\\" || isBackSlash;
|
2061
|
+
|
2062
|
+
if (_this2.tokenRegex[token] && !escaped) {
|
2063
|
+
regexStr += _this2.tokenRegex[token];
|
2064
|
+
var match = new RegExp(regexStr).exec(date);
|
2065
|
+
if (match && (matched = true)) {
|
2066
|
+
ops[token !== "Y" ? "push" : "unshift"]({
|
2067
|
+
fn: _this2.revFormat[token],
|
2068
|
+
val: match[++matchIndex]
|
2069
|
+
});
|
2070
|
+
}
|
2071
|
+
} else if (!isBackSlash) regexStr += "."; // don't really care
|
2072
|
+
|
2073
|
+
ops.forEach(function (_ref) {
|
2074
|
+
var fn = _ref.fn,
|
2075
|
+
val = _ref.val;
|
2076
|
+
return parsedDate = fn(parsedDate, val) || parsedDate;
|
2077
|
+
});
|
2226
2078
|
}
|
2227
|
-
} else if (!isBackSlash) regexStr += "."; // don't really care
|
2228
|
-
}
|
2229
2079
|
|
2230
|
-
|
2080
|
+
date = matched ? parsedDate : null;
|
2081
|
+
})();
|
2082
|
+
}
|
2231
2083
|
}
|
2232
|
-
}
|
2233
2084
|
|
2234
2085
|
/* istanbul ignore next */
|
2235
2086
|
if (!(date instanceof Date)) {
|
@@ -2238,8 +2089,6 @@ Flatpickr.prototype = {
|
|
2238
2089
|
return null;
|
2239
2090
|
}
|
2240
2091
|
|
2241
|
-
if (this.config && this.config.utc && !date.fp_isUTC) date = date.fp_toUTC();
|
2242
|
-
|
2243
2092
|
if (timeless === true) date.setHours(0, 0, 0, 0);
|
2244
2093
|
|
2245
2094
|
return date;
|
@@ -2252,7 +2101,14 @@ function _flatpickr(nodeList, config) {
|
|
2252
2101
|
var instances = [];
|
2253
2102
|
for (var i = 0; i < nodes.length; i++) {
|
2254
2103
|
try {
|
2255
|
-
nodes[i].
|
2104
|
+
if (nodes[i].getAttribute("data-fp-omit") !== null) continue;
|
2105
|
+
|
2106
|
+
if (nodes[i]._flatpickr) {
|
2107
|
+
nodes[i]._flatpickr.destroy();
|
2108
|
+
nodes[i]._flatpickr = null;
|
2109
|
+
}
|
2110
|
+
|
2111
|
+
nodes[i]._flatpickr = new FlatpickrInstance(nodes[i], config || {});
|
2256
2112
|
instances.push(nodes[i]._flatpickr);
|
2257
2113
|
} catch (e) {
|
2258
2114
|
console.warn(e, e.stack);
|
@@ -2276,9 +2132,211 @@ if (typeof HTMLElement !== "undefined") {
|
|
2276
2132
|
|
2277
2133
|
/* istanbul ignore next */
|
2278
2134
|
function flatpickr(selector, config) {
|
2279
|
-
return _flatpickr(window.document.querySelectorAll(selector), config);
|
2135
|
+
if (selector instanceof NodeList) return _flatpickr(selector, config);else if (!(selector instanceof HTMLElement)) return _flatpickr(window.document.querySelectorAll(selector), config);
|
2136
|
+
|
2137
|
+
return _flatpickr([selector], config);
|
2280
2138
|
}
|
2281
2139
|
|
2140
|
+
/* istanbul ignore next */
|
2141
|
+
flatpickr.defaultConfig = FlatpickrInstance.defaultConfig = {
|
2142
|
+
mode: "single",
|
2143
|
+
|
2144
|
+
position: "auto",
|
2145
|
+
|
2146
|
+
animate: typeof window !== "undefined" && window.navigator.userAgent.indexOf("MSIE") === -1,
|
2147
|
+
|
2148
|
+
// wrap: see https://chmln.github.io/flatpickr/examples/#flatpickr-external-elements
|
2149
|
+
wrap: false,
|
2150
|
+
|
2151
|
+
// enables week numbers
|
2152
|
+
weekNumbers: false,
|
2153
|
+
|
2154
|
+
// allow manual datetime input
|
2155
|
+
allowInput: false,
|
2156
|
+
|
2157
|
+
/*
|
2158
|
+
clicking on input opens the date(time)picker.
|
2159
|
+
disable if you wish to open the calendar manually with .open()
|
2160
|
+
*/
|
2161
|
+
clickOpens: true,
|
2162
|
+
|
2163
|
+
/*
|
2164
|
+
closes calendar after date selection,
|
2165
|
+
unless 'mode' is 'multiple' or enableTime is true
|
2166
|
+
*/
|
2167
|
+
closeOnSelect: true,
|
2168
|
+
|
2169
|
+
// display time picker in 24 hour mode
|
2170
|
+
time_24hr: false,
|
2171
|
+
|
2172
|
+
// enables the time picker functionality
|
2173
|
+
enableTime: false,
|
2174
|
+
|
2175
|
+
// noCalendar: true will hide the calendar. use for a time picker along w/ enableTime
|
2176
|
+
noCalendar: false,
|
2177
|
+
|
2178
|
+
// more date format chars at https://chmln.github.io/flatpickr/#dateformat
|
2179
|
+
dateFormat: "Y-m-d",
|
2180
|
+
|
2181
|
+
// date format used in aria-label for days
|
2182
|
+
ariaDateFormat: "F j, Y",
|
2183
|
+
|
2184
|
+
// altInput - see https://chmln.github.io/flatpickr/#altinput
|
2185
|
+
altInput: false,
|
2186
|
+
|
2187
|
+
// the created altInput element will have this class.
|
2188
|
+
altInputClass: "form-control input",
|
2189
|
+
|
2190
|
+
// same as dateFormat, but for altInput
|
2191
|
+
altFormat: "F j, Y", // defaults to e.g. June 10, 2016
|
2192
|
+
|
2193
|
+
// defaultDate - either a datestring or a date object. used for datetimepicker"s initial value
|
2194
|
+
defaultDate: null,
|
2195
|
+
|
2196
|
+
// the minimum date that user can pick (inclusive)
|
2197
|
+
minDate: null,
|
2198
|
+
|
2199
|
+
// the maximum date that user can pick (inclusive)
|
2200
|
+
maxDate: null,
|
2201
|
+
|
2202
|
+
// dateparser that transforms a given string to a date object
|
2203
|
+
parseDate: null,
|
2204
|
+
|
2205
|
+
// dateformatter that transforms a given date object to a string, according to passed format
|
2206
|
+
formatDate: null,
|
2207
|
+
|
2208
|
+
getWeek: function getWeek(givenDate) {
|
2209
|
+
var date = new Date(givenDate.getTime());
|
2210
|
+
var onejan = new Date(date.getFullYear(), 0, 1);
|
2211
|
+
return Math.ceil(((date - onejan) / 86400000 + onejan.getDay() + 1) / 7);
|
2212
|
+
},
|
2213
|
+
|
2214
|
+
|
2215
|
+
// see https://chmln.github.io/flatpickr/#disable
|
2216
|
+
enable: [],
|
2217
|
+
|
2218
|
+
// see https://chmln.github.io/flatpickr/#disable
|
2219
|
+
disable: [],
|
2220
|
+
|
2221
|
+
// display the short version of month names - e.g. Sep instead of September
|
2222
|
+
shorthandCurrentMonth: false,
|
2223
|
+
|
2224
|
+
// displays calendar inline. see https://chmln.github.io/flatpickr/#inline-calendar
|
2225
|
+
inline: false,
|
2226
|
+
|
2227
|
+
// position calendar inside wrapper and next to the input element
|
2228
|
+
// leave at false unless you know what you"re doing
|
2229
|
+
"static": false,
|
2230
|
+
|
2231
|
+
// DOM node to append the calendar to in *static* mode
|
2232
|
+
appendTo: null,
|
2233
|
+
|
2234
|
+
// code for previous/next icons. this is where you put your custom icon code e.g. fontawesome
|
2235
|
+
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>",
|
2236
|
+
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>",
|
2237
|
+
|
2238
|
+
// enables seconds in the time picker
|
2239
|
+
enableSeconds: false,
|
2240
|
+
|
2241
|
+
// step size used when scrolling/incrementing the hour element
|
2242
|
+
hourIncrement: 1,
|
2243
|
+
|
2244
|
+
// step size used when scrolling/incrementing the minute element
|
2245
|
+
minuteIncrement: 5,
|
2246
|
+
|
2247
|
+
// initial value in the hour element
|
2248
|
+
defaultHour: 12,
|
2249
|
+
|
2250
|
+
// initial value in the minute element
|
2251
|
+
defaultMinute: 0,
|
2252
|
+
|
2253
|
+
// initial value in the seconds element
|
2254
|
+
defaultSeconds: 0,
|
2255
|
+
|
2256
|
+
// disable native mobile datetime input support
|
2257
|
+
disableMobile: false,
|
2258
|
+
|
2259
|
+
// default locale
|
2260
|
+
locale: "default",
|
2261
|
+
|
2262
|
+
plugins: [],
|
2263
|
+
|
2264
|
+
ignoredFocusElements: [],
|
2265
|
+
|
2266
|
+
// called every time calendar is closed
|
2267
|
+
onClose: undefined, // function (dateObj, dateStr) {}
|
2268
|
+
|
2269
|
+
// onChange callback when user selects a date or time
|
2270
|
+
onChange: undefined, // function (dateObj, dateStr) {}
|
2271
|
+
|
2272
|
+
// called for every day element
|
2273
|
+
onDayCreate: undefined,
|
2274
|
+
|
2275
|
+
// called every time the month is changed
|
2276
|
+
onMonthChange: undefined,
|
2277
|
+
|
2278
|
+
// called every time calendar is opened
|
2279
|
+
onOpen: undefined, // function (dateObj, dateStr) {}
|
2280
|
+
|
2281
|
+
// called after the configuration has been parsed
|
2282
|
+
onParseConfig: undefined,
|
2283
|
+
|
2284
|
+
// called after calendar is ready
|
2285
|
+
onReady: undefined, // function (dateObj, dateStr) {}
|
2286
|
+
|
2287
|
+
// called after input value updated
|
2288
|
+
onValueUpdate: undefined,
|
2289
|
+
|
2290
|
+
// called every time the year is changed
|
2291
|
+
onYearChange: undefined,
|
2292
|
+
|
2293
|
+
onKeyDown: undefined,
|
2294
|
+
|
2295
|
+
onDestroy: undefined
|
2296
|
+
};
|
2297
|
+
|
2298
|
+
/* istanbul ignore next */
|
2299
|
+
flatpickr.l10ns = {
|
2300
|
+
en: {
|
2301
|
+
weekdays: {
|
2302
|
+
shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
2303
|
+
longhand: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
|
2304
|
+
},
|
2305
|
+
months: {
|
2306
|
+
shorthand: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
|
2307
|
+
longhand: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
|
2308
|
+
},
|
2309
|
+
daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
|
2310
|
+
firstDayOfWeek: 0,
|
2311
|
+
ordinal: function ordinal(nth) {
|
2312
|
+
var s = nth % 100;
|
2313
|
+
if (s > 3 && s < 21) return "th";
|
2314
|
+
switch (s % 10) {
|
2315
|
+
case 1:
|
2316
|
+
return "st";
|
2317
|
+
case 2:
|
2318
|
+
return "nd";
|
2319
|
+
case 3:
|
2320
|
+
return "rd";
|
2321
|
+
default:
|
2322
|
+
return "th";
|
2323
|
+
}
|
2324
|
+
},
|
2325
|
+
rangeSeparator: " to ",
|
2326
|
+
weekAbbreviation: "Wk",
|
2327
|
+
scrollTitle: "Scroll to increment",
|
2328
|
+
toggleTitle: "Click to toggle"
|
2329
|
+
}
|
2330
|
+
};
|
2331
|
+
|
2332
|
+
flatpickr.l10ns.default = Object.create(flatpickr.l10ns.en);
|
2333
|
+
flatpickr.localize = function (l10n) {
|
2334
|
+
return _extends(flatpickr.l10ns.default, l10n || {});
|
2335
|
+
};
|
2336
|
+
flatpickr.setDefaults = function (config) {
|
2337
|
+
return _extends(flatpickr.defaultConfig, config || {});
|
2338
|
+
};
|
2339
|
+
|
2282
2340
|
/* istanbul ignore next */
|
2283
2341
|
if (typeof jQuery !== "undefined") {
|
2284
2342
|
jQuery.fn.flatpickr = function (config) {
|
@@ -2290,12 +2348,4 @@ Date.prototype.fp_incr = function (days) {
|
|
2290
2348
|
return new Date(this.getFullYear(), this.getMonth(), this.getDate() + parseInt(days, 10));
|
2291
2349
|
};
|
2292
2350
|
|
2293
|
-
|
2294
|
-
Date.prototype.fp_toUTC = function () {
|
2295
|
-
var newDate = new Date(this.getUTCFullYear(), this.getUTCMonth(), this.getUTCDate(), this.getUTCHours(), this.getUTCMinutes(), this.getUTCSeconds());
|
2296
|
-
|
2297
|
-
newDate.fp_isUTC = true;
|
2298
|
-
return newDate;
|
2299
|
-
};
|
2300
|
-
|
2301
|
-
if (typeof module !== "undefined") module.exports = Flatpickr;
|
2351
|
+
if (typeof module !== "undefined") module.exports = flatpickr;
|