@luftborn/custom-elements 2.8.1 → 2.8.3

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.
Files changed (24) hide show
  1. package/demo/index.js +680 -2852
  2. package/demo/index.min.js +679 -2851
  3. package/demo/index.min.js.map +1 -1
  4. package/dist/elements/CustomFormatDateFieldElement/CustomDatepicker/CustomDatepicker.d.ts +48 -0
  5. package/dist/elements/CustomFormatDateFieldElement/CustomDatepicker/CustomDatepicker.js +333 -0
  6. package/dist/elements/CustomFormatDateFieldElement/CustomDatepicker/CustomDatepicker.js.map +1 -0
  7. package/dist/elements/CustomFormatDateFieldElement/CustomDatepicker/CustomDatepickerStyles.d.ts +1 -0
  8. package/dist/elements/CustomFormatDateFieldElement/CustomDatepicker/CustomDatepickerStyles.js +5 -0
  9. package/dist/elements/CustomFormatDateFieldElement/CustomDatepicker/CustomDatepickerStyles.js.map +1 -0
  10. package/dist/elements/CustomFormatDateFieldElement/CustomDatepicker/CustomDatepickerUtils.d.ts +6 -0
  11. package/dist/elements/CustomFormatDateFieldElement/CustomDatepicker/CustomDatepickerUtils.js +45 -0
  12. package/dist/elements/CustomFormatDateFieldElement/CustomDatepicker/CustomDatepickerUtils.js.map +1 -0
  13. package/dist/elements/CustomFormatDateFieldElement/CustomDatepicker/DatepickerTranslations.d.ts +2 -0
  14. package/dist/elements/CustomFormatDateFieldElement/CustomDatepicker/DatepickerTranslations.js +194 -0
  15. package/dist/elements/CustomFormatDateFieldElement/CustomDatepicker/DatepickerTranslations.js.map +1 -0
  16. package/dist/elements/CustomFormatDateFieldElement/CustomFormatDateFieldElement.d.ts +7 -6
  17. package/dist/elements/CustomFormatDateFieldElement/CustomFormatDateFieldElement.js +27 -59
  18. package/dist/elements/CustomFormatDateFieldElement/CustomFormatDateFieldElement.js.map +1 -1
  19. package/package.json +2 -6
  20. package/src/elements/CustomFormatDateFieldElement/CustomDatepicker/CustomDatepicker.ts +363 -0
  21. package/src/elements/CustomFormatDateFieldElement/CustomDatepicker/CustomDatepickerStyles.ts +101 -0
  22. package/src/elements/CustomFormatDateFieldElement/CustomDatepicker/CustomDatepickerUtils.ts +44 -0
  23. package/src/elements/CustomFormatDateFieldElement/CustomDatepicker/DatepickerTranslations.ts +188 -0
  24. package/src/elements/CustomFormatDateFieldElement/CustomFormatDateFieldElement.ts +30 -67
package/demo/index.min.js CHANGED
@@ -11,7 +11,7 @@ document.onreadystatechange = function () {
11
11
  }
12
12
  };
13
13
 
14
- },{"./../src/index":74}],2:[function(require,module,exports){
14
+ },{"./../src/index":77}],2:[function(require,module,exports){
15
15
  /**
16
16
  @license @nocompile
17
17
  Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
@@ -403,7 +403,7 @@ var hj=window.customElements,ij=!1,jj=null;hj.polyfillWrapFlushCallback&&hj.poly
403
403
 
404
404
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate)
405
405
 
406
- },{"timers":9}],4:[function(require,module,exports){
406
+ },{"timers":8}],4:[function(require,module,exports){
407
407
  /**
408
408
  * @license
409
409
  * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
@@ -612,2727 +612,6 @@ var hj=window.customElements,ij=!1,jj=null;hj.polyfillWrapFlushCallback&&hj.poly
612
612
  })();
613
613
 
614
614
  },{}],5:[function(require,module,exports){
615
- /* flatpickr v4.6.13, @license MIT */
616
- (function (global, factory) {
617
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
618
- typeof define === 'function' && define.amd ? define(factory) :
619
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.flatpickr = factory());
620
- }(this, (function () { 'use strict';
621
-
622
- /*! *****************************************************************************
623
- Copyright (c) Microsoft Corporation.
624
-
625
- Permission to use, copy, modify, and/or distribute this software for any
626
- purpose with or without fee is hereby granted.
627
-
628
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
629
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
630
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
631
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
632
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
633
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
634
- PERFORMANCE OF THIS SOFTWARE.
635
- ***************************************************************************** */
636
-
637
- var __assign = function() {
638
- __assign = Object.assign || function __assign(t) {
639
- for (var s, i = 1, n = arguments.length; i < n; i++) {
640
- s = arguments[i];
641
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
642
- }
643
- return t;
644
- };
645
- return __assign.apply(this, arguments);
646
- };
647
-
648
- function __spreadArrays() {
649
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
650
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
651
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
652
- r[k] = a[j];
653
- return r;
654
- }
655
-
656
- var HOOKS = [
657
- "onChange",
658
- "onClose",
659
- "onDayCreate",
660
- "onDestroy",
661
- "onKeyDown",
662
- "onMonthChange",
663
- "onOpen",
664
- "onParseConfig",
665
- "onReady",
666
- "onValueUpdate",
667
- "onYearChange",
668
- "onPreCalendarPosition",
669
- ];
670
- var defaults = {
671
- _disable: [],
672
- allowInput: false,
673
- allowInvalidPreload: false,
674
- altFormat: "F j, Y",
675
- altInput: false,
676
- altInputClass: "form-control input",
677
- animate: typeof window === "object" &&
678
- window.navigator.userAgent.indexOf("MSIE") === -1,
679
- ariaDateFormat: "F j, Y",
680
- autoFillDefaultTime: true,
681
- clickOpens: true,
682
- closeOnSelect: true,
683
- conjunction: ", ",
684
- dateFormat: "Y-m-d",
685
- defaultHour: 12,
686
- defaultMinute: 0,
687
- defaultSeconds: 0,
688
- disable: [],
689
- disableMobile: false,
690
- enableSeconds: false,
691
- enableTime: false,
692
- errorHandler: function (err) {
693
- return typeof console !== "undefined" && console.warn(err);
694
- },
695
- getWeek: function (givenDate) {
696
- var date = new Date(givenDate.getTime());
697
- date.setHours(0, 0, 0, 0);
698
- // Thursday in current week decides the year.
699
- date.setDate(date.getDate() + 3 - ((date.getDay() + 6) % 7));
700
- // January 4 is always in week 1.
701
- var week1 = new Date(date.getFullYear(), 0, 4);
702
- // Adjust to Thursday in week 1 and count number of weeks from date to week1.
703
- return (1 +
704
- Math.round(((date.getTime() - week1.getTime()) / 86400000 -
705
- 3 +
706
- ((week1.getDay() + 6) % 7)) /
707
- 7));
708
- },
709
- hourIncrement: 1,
710
- ignoredFocusElements: [],
711
- inline: false,
712
- locale: "default",
713
- minuteIncrement: 5,
714
- mode: "single",
715
- monthSelectorType: "dropdown",
716
- 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>",
717
- noCalendar: false,
718
- now: new Date(),
719
- onChange: [],
720
- onClose: [],
721
- onDayCreate: [],
722
- onDestroy: [],
723
- onKeyDown: [],
724
- onMonthChange: [],
725
- onOpen: [],
726
- onParseConfig: [],
727
- onReady: [],
728
- onValueUpdate: [],
729
- onYearChange: [],
730
- onPreCalendarPosition: [],
731
- plugins: [],
732
- position: "auto",
733
- positionElement: undefined,
734
- 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>",
735
- shorthandCurrentMonth: false,
736
- showMonths: 1,
737
- static: false,
738
- time_24hr: false,
739
- weekNumbers: false,
740
- wrap: false,
741
- };
742
-
743
- var english = {
744
- weekdays: {
745
- shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
746
- longhand: [
747
- "Sunday",
748
- "Monday",
749
- "Tuesday",
750
- "Wednesday",
751
- "Thursday",
752
- "Friday",
753
- "Saturday",
754
- ],
755
- },
756
- months: {
757
- shorthand: [
758
- "Jan",
759
- "Feb",
760
- "Mar",
761
- "Apr",
762
- "May",
763
- "Jun",
764
- "Jul",
765
- "Aug",
766
- "Sep",
767
- "Oct",
768
- "Nov",
769
- "Dec",
770
- ],
771
- longhand: [
772
- "January",
773
- "February",
774
- "March",
775
- "April",
776
- "May",
777
- "June",
778
- "July",
779
- "August",
780
- "September",
781
- "October",
782
- "November",
783
- "December",
784
- ],
785
- },
786
- daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
787
- firstDayOfWeek: 0,
788
- ordinal: function (nth) {
789
- var s = nth % 100;
790
- if (s > 3 && s < 21)
791
- return "th";
792
- switch (s % 10) {
793
- case 1:
794
- return "st";
795
- case 2:
796
- return "nd";
797
- case 3:
798
- return "rd";
799
- default:
800
- return "th";
801
- }
802
- },
803
- rangeSeparator: " to ",
804
- weekAbbreviation: "Wk",
805
- scrollTitle: "Scroll to increment",
806
- toggleTitle: "Click to toggle",
807
- amPM: ["AM", "PM"],
808
- yearAriaLabel: "Year",
809
- monthAriaLabel: "Month",
810
- hourAriaLabel: "Hour",
811
- minuteAriaLabel: "Minute",
812
- time_24hr: false,
813
- };
814
-
815
- var pad = function (number, length) {
816
- if (length === void 0) { length = 2; }
817
- return ("000" + number).slice(length * -1);
818
- };
819
- var int = function (bool) { return (bool === true ? 1 : 0); };
820
- /* istanbul ignore next */
821
- function debounce(fn, wait) {
822
- var t;
823
- return function () {
824
- var _this = this;
825
- var args = arguments;
826
- clearTimeout(t);
827
- t = setTimeout(function () { return fn.apply(_this, args); }, wait);
828
- };
829
- }
830
- var arrayify = function (obj) {
831
- return obj instanceof Array ? obj : [obj];
832
- };
833
-
834
- function toggleClass(elem, className, bool) {
835
- if (bool === true)
836
- return elem.classList.add(className);
837
- elem.classList.remove(className);
838
- }
839
- function createElement(tag, className, content) {
840
- var e = window.document.createElement(tag);
841
- className = className || "";
842
- content = content || "";
843
- e.className = className;
844
- if (content !== undefined)
845
- e.textContent = content;
846
- return e;
847
- }
848
- function clearNode(node) {
849
- while (node.firstChild)
850
- node.removeChild(node.firstChild);
851
- }
852
- function findParent(node, condition) {
853
- if (condition(node))
854
- return node;
855
- else if (node.parentNode)
856
- return findParent(node.parentNode, condition);
857
- return undefined; // nothing found
858
- }
859
- function createNumberInput(inputClassName, opts) {
860
- var wrapper = createElement("div", "numInputWrapper"), numInput = createElement("input", "numInput " + inputClassName), arrowUp = createElement("span", "arrowUp"), arrowDown = createElement("span", "arrowDown");
861
- if (navigator.userAgent.indexOf("MSIE 9.0") === -1) {
862
- numInput.type = "number";
863
- }
864
- else {
865
- numInput.type = "text";
866
- numInput.pattern = "\\d*";
867
- }
868
- if (opts !== undefined)
869
- for (var key in opts)
870
- numInput.setAttribute(key, opts[key]);
871
- wrapper.appendChild(numInput);
872
- wrapper.appendChild(arrowUp);
873
- wrapper.appendChild(arrowDown);
874
- return wrapper;
875
- }
876
- function getEventTarget(event) {
877
- try {
878
- if (typeof event.composedPath === "function") {
879
- var path = event.composedPath();
880
- return path[0];
881
- }
882
- return event.target;
883
- }
884
- catch (error) {
885
- return event.target;
886
- }
887
- }
888
-
889
- var doNothing = function () { return undefined; };
890
- var monthToStr = function (monthNumber, shorthand, locale) { return locale.months[shorthand ? "shorthand" : "longhand"][monthNumber]; };
891
- var revFormat = {
892
- D: doNothing,
893
- F: function (dateObj, monthName, locale) {
894
- dateObj.setMonth(locale.months.longhand.indexOf(monthName));
895
- },
896
- G: function (dateObj, hour) {
897
- dateObj.setHours((dateObj.getHours() >= 12 ? 12 : 0) + parseFloat(hour));
898
- },
899
- H: function (dateObj, hour) {
900
- dateObj.setHours(parseFloat(hour));
901
- },
902
- J: function (dateObj, day) {
903
- dateObj.setDate(parseFloat(day));
904
- },
905
- K: function (dateObj, amPM, locale) {
906
- dateObj.setHours((dateObj.getHours() % 12) +
907
- 12 * int(new RegExp(locale.amPM[1], "i").test(amPM)));
908
- },
909
- M: function (dateObj, shortMonth, locale) {
910
- dateObj.setMonth(locale.months.shorthand.indexOf(shortMonth));
911
- },
912
- S: function (dateObj, seconds) {
913
- dateObj.setSeconds(parseFloat(seconds));
914
- },
915
- U: function (_, unixSeconds) { return new Date(parseFloat(unixSeconds) * 1000); },
916
- W: function (dateObj, weekNum, locale) {
917
- var weekNumber = parseInt(weekNum);
918
- var date = new Date(dateObj.getFullYear(), 0, 2 + (weekNumber - 1) * 7, 0, 0, 0, 0);
919
- date.setDate(date.getDate() - date.getDay() + locale.firstDayOfWeek);
920
- return date;
921
- },
922
- Y: function (dateObj, year) {
923
- dateObj.setFullYear(parseFloat(year));
924
- },
925
- Z: function (_, ISODate) { return new Date(ISODate); },
926
- d: function (dateObj, day) {
927
- dateObj.setDate(parseFloat(day));
928
- },
929
- h: function (dateObj, hour) {
930
- dateObj.setHours((dateObj.getHours() >= 12 ? 12 : 0) + parseFloat(hour));
931
- },
932
- i: function (dateObj, minutes) {
933
- dateObj.setMinutes(parseFloat(minutes));
934
- },
935
- j: function (dateObj, day) {
936
- dateObj.setDate(parseFloat(day));
937
- },
938
- l: doNothing,
939
- m: function (dateObj, month) {
940
- dateObj.setMonth(parseFloat(month) - 1);
941
- },
942
- n: function (dateObj, month) {
943
- dateObj.setMonth(parseFloat(month) - 1);
944
- },
945
- s: function (dateObj, seconds) {
946
- dateObj.setSeconds(parseFloat(seconds));
947
- },
948
- u: function (_, unixMillSeconds) {
949
- return new Date(parseFloat(unixMillSeconds));
950
- },
951
- w: doNothing,
952
- y: function (dateObj, year) {
953
- dateObj.setFullYear(2000 + parseFloat(year));
954
- },
955
- };
956
- var tokenRegex = {
957
- D: "",
958
- F: "",
959
- G: "(\\d\\d|\\d)",
960
- H: "(\\d\\d|\\d)",
961
- J: "(\\d\\d|\\d)\\w+",
962
- K: "",
963
- M: "",
964
- S: "(\\d\\d|\\d)",
965
- U: "(.+)",
966
- W: "(\\d\\d|\\d)",
967
- Y: "(\\d{4})",
968
- Z: "(.+)",
969
- d: "(\\d\\d|\\d)",
970
- h: "(\\d\\d|\\d)",
971
- i: "(\\d\\d|\\d)",
972
- j: "(\\d\\d|\\d)",
973
- l: "",
974
- m: "(\\d\\d|\\d)",
975
- n: "(\\d\\d|\\d)",
976
- s: "(\\d\\d|\\d)",
977
- u: "(.+)",
978
- w: "(\\d\\d|\\d)",
979
- y: "(\\d{2})",
980
- };
981
- var formats = {
982
- // get the date in UTC
983
- Z: function (date) { return date.toISOString(); },
984
- // weekday name, short, e.g. Thu
985
- D: function (date, locale, options) {
986
- return locale.weekdays.shorthand[formats.w(date, locale, options)];
987
- },
988
- // full month name e.g. January
989
- F: function (date, locale, options) {
990
- return monthToStr(formats.n(date, locale, options) - 1, false, locale);
991
- },
992
- // padded hour 1-12
993
- G: function (date, locale, options) {
994
- return pad(formats.h(date, locale, options));
995
- },
996
- // hours with leading zero e.g. 03
997
- H: function (date) { return pad(date.getHours()); },
998
- // day (1-30) with ordinal suffix e.g. 1st, 2nd
999
- J: function (date, locale) {
1000
- return locale.ordinal !== undefined
1001
- ? date.getDate() + locale.ordinal(date.getDate())
1002
- : date.getDate();
1003
- },
1004
- // AM/PM
1005
- K: function (date, locale) { return locale.amPM[int(date.getHours() > 11)]; },
1006
- // shorthand month e.g. Jan, Sep, Oct, etc
1007
- M: function (date, locale) {
1008
- return monthToStr(date.getMonth(), true, locale);
1009
- },
1010
- // seconds 00-59
1011
- S: function (date) { return pad(date.getSeconds()); },
1012
- // unix timestamp
1013
- U: function (date) { return date.getTime() / 1000; },
1014
- W: function (date, _, options) {
1015
- return options.getWeek(date);
1016
- },
1017
- // full year e.g. 2016, padded (0001-9999)
1018
- Y: function (date) { return pad(date.getFullYear(), 4); },
1019
- // day in month, padded (01-30)
1020
- d: function (date) { return pad(date.getDate()); },
1021
- // hour from 1-12 (am/pm)
1022
- h: function (date) { return (date.getHours() % 12 ? date.getHours() % 12 : 12); },
1023
- // minutes, padded with leading zero e.g. 09
1024
- i: function (date) { return pad(date.getMinutes()); },
1025
- // day in month (1-30)
1026
- j: function (date) { return date.getDate(); },
1027
- // weekday name, full, e.g. Thursday
1028
- l: function (date, locale) {
1029
- return locale.weekdays.longhand[date.getDay()];
1030
- },
1031
- // padded month number (01-12)
1032
- m: function (date) { return pad(date.getMonth() + 1); },
1033
- // the month number (1-12)
1034
- n: function (date) { return date.getMonth() + 1; },
1035
- // seconds 0-59
1036
- s: function (date) { return date.getSeconds(); },
1037
- // Unix Milliseconds
1038
- u: function (date) { return date.getTime(); },
1039
- // number of the day of the week
1040
- w: function (date) { return date.getDay(); },
1041
- // last two digits of year e.g. 16 for 2016
1042
- y: function (date) { return String(date.getFullYear()).substring(2); },
1043
- };
1044
-
1045
- var createDateFormatter = function (_a) {
1046
- var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c, _d = _a.isMobile, isMobile = _d === void 0 ? false : _d;
1047
- return function (dateObj, frmt, overrideLocale) {
1048
- var locale = overrideLocale || l10n;
1049
- if (config.formatDate !== undefined && !isMobile) {
1050
- return config.formatDate(dateObj, frmt, locale);
1051
- }
1052
- return frmt
1053
- .split("")
1054
- .map(function (c, i, arr) {
1055
- return formats[c] && arr[i - 1] !== "\\"
1056
- ? formats[c](dateObj, locale, config)
1057
- : c !== "\\"
1058
- ? c
1059
- : "";
1060
- })
1061
- .join("");
1062
- };
1063
- };
1064
- var createDateParser = function (_a) {
1065
- var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c;
1066
- return function (date, givenFormat, timeless, customLocale) {
1067
- if (date !== 0 && !date)
1068
- return undefined;
1069
- var locale = customLocale || l10n;
1070
- var parsedDate;
1071
- var dateOrig = date;
1072
- if (date instanceof Date)
1073
- parsedDate = new Date(date.getTime());
1074
- else if (typeof date !== "string" &&
1075
- date.toFixed !== undefined // timestamp
1076
- )
1077
- // create a copy
1078
- parsedDate = new Date(date);
1079
- else if (typeof date === "string") {
1080
- // date string
1081
- var format = givenFormat || (config || defaults).dateFormat;
1082
- var datestr = String(date).trim();
1083
- if (datestr === "today") {
1084
- parsedDate = new Date();
1085
- timeless = true;
1086
- }
1087
- else if (config && config.parseDate) {
1088
- parsedDate = config.parseDate(date, format);
1089
- }
1090
- else if (/Z$/.test(datestr) ||
1091
- /GMT$/.test(datestr) // datestrings w/ timezone
1092
- ) {
1093
- parsedDate = new Date(date);
1094
- }
1095
- else {
1096
- var matched = void 0, ops = [];
1097
- for (var i = 0, matchIndex = 0, regexStr = ""; i < format.length; i++) {
1098
- var token_1 = format[i];
1099
- var isBackSlash = token_1 === "\\";
1100
- var escaped = format[i - 1] === "\\" || isBackSlash;
1101
- if (tokenRegex[token_1] && !escaped) {
1102
- regexStr += tokenRegex[token_1];
1103
- var match = new RegExp(regexStr).exec(date);
1104
- if (match && (matched = true)) {
1105
- ops[token_1 !== "Y" ? "push" : "unshift"]({
1106
- fn: revFormat[token_1],
1107
- val: match[++matchIndex],
1108
- });
1109
- }
1110
- }
1111
- else if (!isBackSlash)
1112
- regexStr += "."; // don't really care
1113
- }
1114
- parsedDate =
1115
- !config || !config.noCalendar
1116
- ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0)
1117
- : new Date(new Date().setHours(0, 0, 0, 0));
1118
- ops.forEach(function (_a) {
1119
- var fn = _a.fn, val = _a.val;
1120
- return (parsedDate = fn(parsedDate, val, locale) || parsedDate);
1121
- });
1122
- parsedDate = matched ? parsedDate : undefined;
1123
- }
1124
- }
1125
- /* istanbul ignore next */
1126
- if (!(parsedDate instanceof Date && !isNaN(parsedDate.getTime()))) {
1127
- config.errorHandler(new Error("Invalid date provided: " + dateOrig));
1128
- return undefined;
1129
- }
1130
- if (timeless === true)
1131
- parsedDate.setHours(0, 0, 0, 0);
1132
- return parsedDate;
1133
- };
1134
- };
1135
- /**
1136
- * Compute the difference in dates, measured in ms
1137
- */
1138
- function compareDates(date1, date2, timeless) {
1139
- if (timeless === void 0) { timeless = true; }
1140
- if (timeless !== false) {
1141
- return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -
1142
- new Date(date2.getTime()).setHours(0, 0, 0, 0));
1143
- }
1144
- return date1.getTime() - date2.getTime();
1145
- }
1146
- var isBetween = function (ts, ts1, ts2) {
1147
- return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2);
1148
- };
1149
- var calculateSecondsSinceMidnight = function (hours, minutes, seconds) {
1150
- return hours * 3600 + minutes * 60 + seconds;
1151
- };
1152
- var parseSeconds = function (secondsSinceMidnight) {
1153
- var hours = Math.floor(secondsSinceMidnight / 3600), minutes = (secondsSinceMidnight - hours * 3600) / 60;
1154
- return [hours, minutes, secondsSinceMidnight - hours * 3600 - minutes * 60];
1155
- };
1156
- var duration = {
1157
- DAY: 86400000,
1158
- };
1159
- function getDefaultHours(config) {
1160
- var hours = config.defaultHour;
1161
- var minutes = config.defaultMinute;
1162
- var seconds = config.defaultSeconds;
1163
- if (config.minDate !== undefined) {
1164
- var minHour = config.minDate.getHours();
1165
- var minMinutes = config.minDate.getMinutes();
1166
- var minSeconds = config.minDate.getSeconds();
1167
- if (hours < minHour) {
1168
- hours = minHour;
1169
- }
1170
- if (hours === minHour && minutes < minMinutes) {
1171
- minutes = minMinutes;
1172
- }
1173
- if (hours === minHour && minutes === minMinutes && seconds < minSeconds)
1174
- seconds = config.minDate.getSeconds();
1175
- }
1176
- if (config.maxDate !== undefined) {
1177
- var maxHr = config.maxDate.getHours();
1178
- var maxMinutes = config.maxDate.getMinutes();
1179
- hours = Math.min(hours, maxHr);
1180
- if (hours === maxHr)
1181
- minutes = Math.min(maxMinutes, minutes);
1182
- if (hours === maxHr && minutes === maxMinutes)
1183
- seconds = config.maxDate.getSeconds();
1184
- }
1185
- return { hours: hours, minutes: minutes, seconds: seconds };
1186
- }
1187
-
1188
- if (typeof Object.assign !== "function") {
1189
- Object.assign = function (target) {
1190
- var args = [];
1191
- for (var _i = 1; _i < arguments.length; _i++) {
1192
- args[_i - 1] = arguments[_i];
1193
- }
1194
- if (!target) {
1195
- throw TypeError("Cannot convert undefined or null to object");
1196
- }
1197
- var _loop_1 = function (source) {
1198
- if (source) {
1199
- Object.keys(source).forEach(function (key) { return (target[key] = source[key]); });
1200
- }
1201
- };
1202
- for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
1203
- var source = args_1[_a];
1204
- _loop_1(source);
1205
- }
1206
- return target;
1207
- };
1208
- }
1209
-
1210
- var DEBOUNCED_CHANGE_MS = 300;
1211
- function FlatpickrInstance(element, instanceConfig) {
1212
- var self = {
1213
- config: __assign(__assign({}, defaults), flatpickr.defaultConfig),
1214
- l10n: english,
1215
- };
1216
- self.parseDate = createDateParser({ config: self.config, l10n: self.l10n });
1217
- self._handlers = [];
1218
- self.pluginElements = [];
1219
- self.loadedPlugins = [];
1220
- self._bind = bind;
1221
- self._setHoursFromDate = setHoursFromDate;
1222
- self._positionCalendar = positionCalendar;
1223
- self.changeMonth = changeMonth;
1224
- self.changeYear = changeYear;
1225
- self.clear = clear;
1226
- self.close = close;
1227
- self.onMouseOver = onMouseOver;
1228
- self._createElement = createElement;
1229
- self.createDay = createDay;
1230
- self.destroy = destroy;
1231
- self.isEnabled = isEnabled;
1232
- self.jumpToDate = jumpToDate;
1233
- self.updateValue = updateValue;
1234
- self.open = open;
1235
- self.redraw = redraw;
1236
- self.set = set;
1237
- self.setDate = setDate;
1238
- self.toggle = toggle;
1239
- function setupHelperFunctions() {
1240
- self.utils = {
1241
- getDaysInMonth: function (month, yr) {
1242
- if (month === void 0) { month = self.currentMonth; }
1243
- if (yr === void 0) { yr = self.currentYear; }
1244
- if (month === 1 && ((yr % 4 === 0 && yr % 100 !== 0) || yr % 400 === 0))
1245
- return 29;
1246
- return self.l10n.daysInMonth[month];
1247
- },
1248
- };
1249
- }
1250
- function init() {
1251
- self.element = self.input = element;
1252
- self.isOpen = false;
1253
- parseConfig();
1254
- setupLocale();
1255
- setupInputs();
1256
- setupDates();
1257
- setupHelperFunctions();
1258
- if (!self.isMobile)
1259
- build();
1260
- bindEvents();
1261
- if (self.selectedDates.length || self.config.noCalendar) {
1262
- if (self.config.enableTime) {
1263
- setHoursFromDate(self.config.noCalendar ? self.latestSelectedDateObj : undefined);
1264
- }
1265
- updateValue(false);
1266
- }
1267
- setCalendarWidth();
1268
- var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
1269
- /* TODO: investigate this further
1270
-
1271
- Currently, there is weird positioning behavior in safari causing pages
1272
- to scroll up. https://github.com/chmln/flatpickr/issues/563
1273
-
1274
- However, most browsers are not Safari and positioning is expensive when used
1275
- in scale. https://github.com/chmln/flatpickr/issues/1096
1276
- */
1277
- if (!self.isMobile && isSafari) {
1278
- positionCalendar();
1279
- }
1280
- triggerEvent("onReady");
1281
- }
1282
- function getClosestActiveElement() {
1283
- var _a;
1284
- return (((_a = self.calendarContainer) === null || _a === void 0 ? void 0 : _a.getRootNode())
1285
- .activeElement || document.activeElement);
1286
- }
1287
- function bindToInstance(fn) {
1288
- return fn.bind(self);
1289
- }
1290
- function setCalendarWidth() {
1291
- var config = self.config;
1292
- if (config.weekNumbers === false && config.showMonths === 1) {
1293
- return;
1294
- }
1295
- else if (config.noCalendar !== true) {
1296
- window.requestAnimationFrame(function () {
1297
- if (self.calendarContainer !== undefined) {
1298
- self.calendarContainer.style.visibility = "hidden";
1299
- self.calendarContainer.style.display = "block";
1300
- }
1301
- if (self.daysContainer !== undefined) {
1302
- var daysWidth = (self.days.offsetWidth + 1) * config.showMonths;
1303
- self.daysContainer.style.width = daysWidth + "px";
1304
- self.calendarContainer.style.width =
1305
- daysWidth +
1306
- (self.weekWrapper !== undefined
1307
- ? self.weekWrapper.offsetWidth
1308
- : 0) +
1309
- "px";
1310
- self.calendarContainer.style.removeProperty("visibility");
1311
- self.calendarContainer.style.removeProperty("display");
1312
- }
1313
- });
1314
- }
1315
- }
1316
- /**
1317
- * The handler for all events targeting the time inputs
1318
- */
1319
- function updateTime(e) {
1320
- if (self.selectedDates.length === 0) {
1321
- var defaultDate = self.config.minDate === undefined ||
1322
- compareDates(new Date(), self.config.minDate) >= 0
1323
- ? new Date()
1324
- : new Date(self.config.minDate.getTime());
1325
- var defaults = getDefaultHours(self.config);
1326
- defaultDate.setHours(defaults.hours, defaults.minutes, defaults.seconds, defaultDate.getMilliseconds());
1327
- self.selectedDates = [defaultDate];
1328
- self.latestSelectedDateObj = defaultDate;
1329
- }
1330
- if (e !== undefined && e.type !== "blur") {
1331
- timeWrapper(e);
1332
- }
1333
- var prevValue = self._input.value;
1334
- setHoursFromInputs();
1335
- updateValue();
1336
- if (self._input.value !== prevValue) {
1337
- self._debouncedChange();
1338
- }
1339
- }
1340
- function ampm2military(hour, amPM) {
1341
- return (hour % 12) + 12 * int(amPM === self.l10n.amPM[1]);
1342
- }
1343
- function military2ampm(hour) {
1344
- switch (hour % 24) {
1345
- case 0:
1346
- case 12:
1347
- return 12;
1348
- default:
1349
- return hour % 12;
1350
- }
1351
- }
1352
- /**
1353
- * Syncs the selected date object time with user's time input
1354
- */
1355
- function setHoursFromInputs() {
1356
- if (self.hourElement === undefined || self.minuteElement === undefined)
1357
- return;
1358
- var hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24, minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60, seconds = self.secondElement !== undefined
1359
- ? (parseInt(self.secondElement.value, 10) || 0) % 60
1360
- : 0;
1361
- if (self.amPM !== undefined) {
1362
- hours = ampm2military(hours, self.amPM.textContent);
1363
- }
1364
- var limitMinHours = self.config.minTime !== undefined ||
1365
- (self.config.minDate &&
1366
- self.minDateHasTime &&
1367
- self.latestSelectedDateObj &&
1368
- compareDates(self.latestSelectedDateObj, self.config.minDate, true) ===
1369
- 0);
1370
- var limitMaxHours = self.config.maxTime !== undefined ||
1371
- (self.config.maxDate &&
1372
- self.maxDateHasTime &&
1373
- self.latestSelectedDateObj &&
1374
- compareDates(self.latestSelectedDateObj, self.config.maxDate, true) ===
1375
- 0);
1376
- if (self.config.maxTime !== undefined &&
1377
- self.config.minTime !== undefined &&
1378
- self.config.minTime > self.config.maxTime) {
1379
- var minBound = calculateSecondsSinceMidnight(self.config.minTime.getHours(), self.config.minTime.getMinutes(), self.config.minTime.getSeconds());
1380
- var maxBound = calculateSecondsSinceMidnight(self.config.maxTime.getHours(), self.config.maxTime.getMinutes(), self.config.maxTime.getSeconds());
1381
- var currentTime = calculateSecondsSinceMidnight(hours, minutes, seconds);
1382
- if (currentTime > maxBound && currentTime < minBound) {
1383
- var result = parseSeconds(minBound);
1384
- hours = result[0];
1385
- minutes = result[1];
1386
- seconds = result[2];
1387
- }
1388
- }
1389
- else {
1390
- if (limitMaxHours) {
1391
- var maxTime = self.config.maxTime !== undefined
1392
- ? self.config.maxTime
1393
- : self.config.maxDate;
1394
- hours = Math.min(hours, maxTime.getHours());
1395
- if (hours === maxTime.getHours())
1396
- minutes = Math.min(minutes, maxTime.getMinutes());
1397
- if (minutes === maxTime.getMinutes())
1398
- seconds = Math.min(seconds, maxTime.getSeconds());
1399
- }
1400
- if (limitMinHours) {
1401
- var minTime = self.config.minTime !== undefined
1402
- ? self.config.minTime
1403
- : self.config.minDate;
1404
- hours = Math.max(hours, minTime.getHours());
1405
- if (hours === minTime.getHours() && minutes < minTime.getMinutes())
1406
- minutes = minTime.getMinutes();
1407
- if (minutes === minTime.getMinutes())
1408
- seconds = Math.max(seconds, minTime.getSeconds());
1409
- }
1410
- }
1411
- setHours(hours, minutes, seconds);
1412
- }
1413
- /**
1414
- * Syncs time input values with a date
1415
- */
1416
- function setHoursFromDate(dateObj) {
1417
- var date = dateObj || self.latestSelectedDateObj;
1418
- if (date && date instanceof Date) {
1419
- setHours(date.getHours(), date.getMinutes(), date.getSeconds());
1420
- }
1421
- }
1422
- /**
1423
- * Sets the hours, minutes, and optionally seconds
1424
- * of the latest selected date object and the
1425
- * corresponding time inputs
1426
- * @param {Number} hours the hour. whether its military
1427
- * or am-pm gets inferred from config
1428
- * @param {Number} minutes the minutes
1429
- * @param {Number} seconds the seconds (optional)
1430
- */
1431
- function setHours(hours, minutes, seconds) {
1432
- if (self.latestSelectedDateObj !== undefined) {
1433
- self.latestSelectedDateObj.setHours(hours % 24, minutes, seconds || 0, 0);
1434
- }
1435
- if (!self.hourElement || !self.minuteElement || self.isMobile)
1436
- return;
1437
- self.hourElement.value = pad(!self.config.time_24hr
1438
- ? ((12 + hours) % 12) + 12 * int(hours % 12 === 0)
1439
- : hours);
1440
- self.minuteElement.value = pad(minutes);
1441
- if (self.amPM !== undefined)
1442
- self.amPM.textContent = self.l10n.amPM[int(hours >= 12)];
1443
- if (self.secondElement !== undefined)
1444
- self.secondElement.value = pad(seconds);
1445
- }
1446
- /**
1447
- * Handles the year input and incrementing events
1448
- * @param {Event} event the keyup or increment event
1449
- */
1450
- function onYearInput(event) {
1451
- var eventTarget = getEventTarget(event);
1452
- var year = parseInt(eventTarget.value) + (event.delta || 0);
1453
- if (year / 1000 > 1 ||
1454
- (event.key === "Enter" && !/[^\d]/.test(year.toString()))) {
1455
- changeYear(year);
1456
- }
1457
- }
1458
- /**
1459
- * Essentially addEventListener + tracking
1460
- * @param {Element} element the element to addEventListener to
1461
- * @param {String} event the event name
1462
- * @param {Function} handler the event handler
1463
- */
1464
- function bind(element, event, handler, options) {
1465
- if (event instanceof Array)
1466
- return event.forEach(function (ev) { return bind(element, ev, handler, options); });
1467
- if (element instanceof Array)
1468
- return element.forEach(function (el) { return bind(el, event, handler, options); });
1469
- element.addEventListener(event, handler, options);
1470
- self._handlers.push({
1471
- remove: function () { return element.removeEventListener(event, handler, options); },
1472
- });
1473
- }
1474
- function triggerChange() {
1475
- triggerEvent("onChange");
1476
- }
1477
- /**
1478
- * Adds all the necessary event listeners
1479
- */
1480
- function bindEvents() {
1481
- if (self.config.wrap) {
1482
- ["open", "close", "toggle", "clear"].forEach(function (evt) {
1483
- Array.prototype.forEach.call(self.element.querySelectorAll("[data-" + evt + "]"), function (el) {
1484
- return bind(el, "click", self[evt]);
1485
- });
1486
- });
1487
- }
1488
- if (self.isMobile) {
1489
- setupMobile();
1490
- return;
1491
- }
1492
- var debouncedResize = debounce(onResize, 50);
1493
- self._debouncedChange = debounce(triggerChange, DEBOUNCED_CHANGE_MS);
1494
- if (self.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent))
1495
- bind(self.daysContainer, "mouseover", function (e) {
1496
- if (self.config.mode === "range")
1497
- onMouseOver(getEventTarget(e));
1498
- });
1499
- bind(self._input, "keydown", onKeyDown);
1500
- if (self.calendarContainer !== undefined) {
1501
- bind(self.calendarContainer, "keydown", onKeyDown);
1502
- }
1503
- if (!self.config.inline && !self.config.static)
1504
- bind(window, "resize", debouncedResize);
1505
- if (window.ontouchstart !== undefined)
1506
- bind(window.document, "touchstart", documentClick);
1507
- else
1508
- bind(window.document, "mousedown", documentClick);
1509
- bind(window.document, "focus", documentClick, { capture: true });
1510
- if (self.config.clickOpens === true) {
1511
- bind(self._input, "focus", self.open);
1512
- bind(self._input, "click", self.open);
1513
- }
1514
- if (self.daysContainer !== undefined) {
1515
- bind(self.monthNav, "click", onMonthNavClick);
1516
- bind(self.monthNav, ["keyup", "increment"], onYearInput);
1517
- bind(self.daysContainer, "click", selectDate);
1518
- }
1519
- if (self.timeContainer !== undefined &&
1520
- self.minuteElement !== undefined &&
1521
- self.hourElement !== undefined) {
1522
- var selText = function (e) {
1523
- return getEventTarget(e).select();
1524
- };
1525
- bind(self.timeContainer, ["increment"], updateTime);
1526
- bind(self.timeContainer, "blur", updateTime, { capture: true });
1527
- bind(self.timeContainer, "click", timeIncrement);
1528
- bind([self.hourElement, self.minuteElement], ["focus", "click"], selText);
1529
- if (self.secondElement !== undefined)
1530
- bind(self.secondElement, "focus", function () { return self.secondElement && self.secondElement.select(); });
1531
- if (self.amPM !== undefined) {
1532
- bind(self.amPM, "click", function (e) {
1533
- updateTime(e);
1534
- });
1535
- }
1536
- }
1537
- if (self.config.allowInput) {
1538
- bind(self._input, "blur", onBlur);
1539
- }
1540
- }
1541
- /**
1542
- * Set the calendar view to a particular date.
1543
- * @param {Date} jumpDate the date to set the view to
1544
- * @param {boolean} triggerChange if change events should be triggered
1545
- */
1546
- function jumpToDate(jumpDate, triggerChange) {
1547
- var jumpTo = jumpDate !== undefined
1548
- ? self.parseDate(jumpDate)
1549
- : self.latestSelectedDateObj ||
1550
- (self.config.minDate && self.config.minDate > self.now
1551
- ? self.config.minDate
1552
- : self.config.maxDate && self.config.maxDate < self.now
1553
- ? self.config.maxDate
1554
- : self.now);
1555
- var oldYear = self.currentYear;
1556
- var oldMonth = self.currentMonth;
1557
- try {
1558
- if (jumpTo !== undefined) {
1559
- self.currentYear = jumpTo.getFullYear();
1560
- self.currentMonth = jumpTo.getMonth();
1561
- }
1562
- }
1563
- catch (e) {
1564
- /* istanbul ignore next */
1565
- e.message = "Invalid date supplied: " + jumpTo;
1566
- self.config.errorHandler(e);
1567
- }
1568
- if (triggerChange && self.currentYear !== oldYear) {
1569
- triggerEvent("onYearChange");
1570
- buildMonthSwitch();
1571
- }
1572
- if (triggerChange &&
1573
- (self.currentYear !== oldYear || self.currentMonth !== oldMonth)) {
1574
- triggerEvent("onMonthChange");
1575
- }
1576
- self.redraw();
1577
- }
1578
- /**
1579
- * The up/down arrow handler for time inputs
1580
- * @param {Event} e the click event
1581
- */
1582
- function timeIncrement(e) {
1583
- var eventTarget = getEventTarget(e);
1584
- if (~eventTarget.className.indexOf("arrow"))
1585
- incrementNumInput(e, eventTarget.classList.contains("arrowUp") ? 1 : -1);
1586
- }
1587
- /**
1588
- * Increments/decrements the value of input associ-
1589
- * ated with the up/down arrow by dispatching an
1590
- * "increment" event on the input.
1591
- *
1592
- * @param {Event} e the click event
1593
- * @param {Number} delta the diff (usually 1 or -1)
1594
- * @param {Element} inputElem the input element
1595
- */
1596
- function incrementNumInput(e, delta, inputElem) {
1597
- var target = e && getEventTarget(e);
1598
- var input = inputElem ||
1599
- (target && target.parentNode && target.parentNode.firstChild);
1600
- var event = createEvent("increment");
1601
- event.delta = delta;
1602
- input && input.dispatchEvent(event);
1603
- }
1604
- function build() {
1605
- var fragment = window.document.createDocumentFragment();
1606
- self.calendarContainer = createElement("div", "flatpickr-calendar");
1607
- self.calendarContainer.tabIndex = -1;
1608
- if (!self.config.noCalendar) {
1609
- fragment.appendChild(buildMonthNav());
1610
- self.innerContainer = createElement("div", "flatpickr-innerContainer");
1611
- if (self.config.weekNumbers) {
1612
- var _a = buildWeeks(), weekWrapper = _a.weekWrapper, weekNumbers = _a.weekNumbers;
1613
- self.innerContainer.appendChild(weekWrapper);
1614
- self.weekNumbers = weekNumbers;
1615
- self.weekWrapper = weekWrapper;
1616
- }
1617
- self.rContainer = createElement("div", "flatpickr-rContainer");
1618
- self.rContainer.appendChild(buildWeekdays());
1619
- if (!self.daysContainer) {
1620
- self.daysContainer = createElement("div", "flatpickr-days");
1621
- self.daysContainer.tabIndex = -1;
1622
- }
1623
- buildDays();
1624
- self.rContainer.appendChild(self.daysContainer);
1625
- self.innerContainer.appendChild(self.rContainer);
1626
- fragment.appendChild(self.innerContainer);
1627
- }
1628
- if (self.config.enableTime) {
1629
- fragment.appendChild(buildTime());
1630
- }
1631
- toggleClass(self.calendarContainer, "rangeMode", self.config.mode === "range");
1632
- toggleClass(self.calendarContainer, "animate", self.config.animate === true);
1633
- toggleClass(self.calendarContainer, "multiMonth", self.config.showMonths > 1);
1634
- self.calendarContainer.appendChild(fragment);
1635
- var customAppend = self.config.appendTo !== undefined &&
1636
- self.config.appendTo.nodeType !== undefined;
1637
- if (self.config.inline || self.config.static) {
1638
- self.calendarContainer.classList.add(self.config.inline ? "inline" : "static");
1639
- if (self.config.inline) {
1640
- if (!customAppend && self.element.parentNode)
1641
- self.element.parentNode.insertBefore(self.calendarContainer, self._input.nextSibling);
1642
- else if (self.config.appendTo !== undefined)
1643
- self.config.appendTo.appendChild(self.calendarContainer);
1644
- }
1645
- if (self.config.static) {
1646
- var wrapper = createElement("div", "flatpickr-wrapper");
1647
- if (self.element.parentNode)
1648
- self.element.parentNode.insertBefore(wrapper, self.element);
1649
- wrapper.appendChild(self.element);
1650
- if (self.altInput)
1651
- wrapper.appendChild(self.altInput);
1652
- wrapper.appendChild(self.calendarContainer);
1653
- }
1654
- }
1655
- if (!self.config.static && !self.config.inline)
1656
- (self.config.appendTo !== undefined
1657
- ? self.config.appendTo
1658
- : window.document.body).appendChild(self.calendarContainer);
1659
- }
1660
- function createDay(className, date, _dayNumber, i) {
1661
- var dateIsEnabled = isEnabled(date, true), dayElement = createElement("span", className, date.getDate().toString());
1662
- dayElement.dateObj = date;
1663
- dayElement.$i = i;
1664
- dayElement.setAttribute("aria-label", self.formatDate(date, self.config.ariaDateFormat));
1665
- if (className.indexOf("hidden") === -1 &&
1666
- compareDates(date, self.now) === 0) {
1667
- self.todayDateElem = dayElement;
1668
- dayElement.classList.add("today");
1669
- dayElement.setAttribute("aria-current", "date");
1670
- }
1671
- if (dateIsEnabled) {
1672
- dayElement.tabIndex = -1;
1673
- if (isDateSelected(date)) {
1674
- dayElement.classList.add("selected");
1675
- self.selectedDateElem = dayElement;
1676
- if (self.config.mode === "range") {
1677
- toggleClass(dayElement, "startRange", self.selectedDates[0] &&
1678
- compareDates(date, self.selectedDates[0], true) === 0);
1679
- toggleClass(dayElement, "endRange", self.selectedDates[1] &&
1680
- compareDates(date, self.selectedDates[1], true) === 0);
1681
- if (className === "nextMonthDay")
1682
- dayElement.classList.add("inRange");
1683
- }
1684
- }
1685
- }
1686
- else {
1687
- dayElement.classList.add("flatpickr-disabled");
1688
- }
1689
- if (self.config.mode === "range") {
1690
- if (isDateInRange(date) && !isDateSelected(date))
1691
- dayElement.classList.add("inRange");
1692
- }
1693
- if (self.weekNumbers &&
1694
- self.config.showMonths === 1 &&
1695
- className !== "prevMonthDay" &&
1696
- i % 7 === 6) {
1697
- self.weekNumbers.insertAdjacentHTML("beforeend", "<span class='flatpickr-day'>" + self.config.getWeek(date) + "</span>");
1698
- }
1699
- triggerEvent("onDayCreate", dayElement);
1700
- return dayElement;
1701
- }
1702
- function focusOnDayElem(targetNode) {
1703
- targetNode.focus();
1704
- if (self.config.mode === "range")
1705
- onMouseOver(targetNode);
1706
- }
1707
- function getFirstAvailableDay(delta) {
1708
- var startMonth = delta > 0 ? 0 : self.config.showMonths - 1;
1709
- var endMonth = delta > 0 ? self.config.showMonths : -1;
1710
- for (var m = startMonth; m != endMonth; m += delta) {
1711
- var month = self.daysContainer.children[m];
1712
- var startIndex = delta > 0 ? 0 : month.children.length - 1;
1713
- var endIndex = delta > 0 ? month.children.length : -1;
1714
- for (var i = startIndex; i != endIndex; i += delta) {
1715
- var c = month.children[i];
1716
- if (c.className.indexOf("hidden") === -1 && isEnabled(c.dateObj))
1717
- return c;
1718
- }
1719
- }
1720
- return undefined;
1721
- }
1722
- function getNextAvailableDay(current, delta) {
1723
- var givenMonth = current.className.indexOf("Month") === -1
1724
- ? current.dateObj.getMonth()
1725
- : self.currentMonth;
1726
- var endMonth = delta > 0 ? self.config.showMonths : -1;
1727
- var loopDelta = delta > 0 ? 1 : -1;
1728
- for (var m = givenMonth - self.currentMonth; m != endMonth; m += loopDelta) {
1729
- var month = self.daysContainer.children[m];
1730
- var startIndex = givenMonth - self.currentMonth === m
1731
- ? current.$i + delta
1732
- : delta < 0
1733
- ? month.children.length - 1
1734
- : 0;
1735
- var numMonthDays = month.children.length;
1736
- for (var i = startIndex; i >= 0 && i < numMonthDays && i != (delta > 0 ? numMonthDays : -1); i += loopDelta) {
1737
- var c = month.children[i];
1738
- if (c.className.indexOf("hidden") === -1 &&
1739
- isEnabled(c.dateObj) &&
1740
- Math.abs(current.$i - i) >= Math.abs(delta))
1741
- return focusOnDayElem(c);
1742
- }
1743
- }
1744
- self.changeMonth(loopDelta);
1745
- focusOnDay(getFirstAvailableDay(loopDelta), 0);
1746
- return undefined;
1747
- }
1748
- function focusOnDay(current, offset) {
1749
- var activeElement = getClosestActiveElement();
1750
- var dayFocused = isInView(activeElement || document.body);
1751
- var startElem = current !== undefined
1752
- ? current
1753
- : dayFocused
1754
- ? activeElement
1755
- : self.selectedDateElem !== undefined && isInView(self.selectedDateElem)
1756
- ? self.selectedDateElem
1757
- : self.todayDateElem !== undefined && isInView(self.todayDateElem)
1758
- ? self.todayDateElem
1759
- : getFirstAvailableDay(offset > 0 ? 1 : -1);
1760
- if (startElem === undefined) {
1761
- self._input.focus();
1762
- }
1763
- else if (!dayFocused) {
1764
- focusOnDayElem(startElem);
1765
- }
1766
- else {
1767
- getNextAvailableDay(startElem, offset);
1768
- }
1769
- }
1770
- function buildMonthDays(year, month) {
1771
- var firstOfMonth = (new Date(year, month, 1).getDay() - self.l10n.firstDayOfWeek + 7) % 7;
1772
- var prevMonthDays = self.utils.getDaysInMonth((month - 1 + 12) % 12, year);
1773
- var daysInMonth = self.utils.getDaysInMonth(month, year), days = window.document.createDocumentFragment(), isMultiMonth = self.config.showMonths > 1, prevMonthDayClass = isMultiMonth ? "prevMonthDay hidden" : "prevMonthDay", nextMonthDayClass = isMultiMonth ? "nextMonthDay hidden" : "nextMonthDay";
1774
- var dayNumber = prevMonthDays + 1 - firstOfMonth, dayIndex = 0;
1775
- // prepend days from the ending of previous month
1776
- for (; dayNumber <= prevMonthDays; dayNumber++, dayIndex++) {
1777
- days.appendChild(createDay("flatpickr-day " + prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex));
1778
- }
1779
- // Start at 1 since there is no 0th day
1780
- for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) {
1781
- days.appendChild(createDay("flatpickr-day", new Date(year, month, dayNumber), dayNumber, dayIndex));
1782
- }
1783
- // append days from the next month
1784
- for (var dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth &&
1785
- (self.config.showMonths === 1 || dayIndex % 7 !== 0); dayNum++, dayIndex++) {
1786
- days.appendChild(createDay("flatpickr-day " + nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex));
1787
- }
1788
- //updateNavigationCurrentMonth();
1789
- var dayContainer = createElement("div", "dayContainer");
1790
- dayContainer.appendChild(days);
1791
- return dayContainer;
1792
- }
1793
- function buildDays() {
1794
- if (self.daysContainer === undefined) {
1795
- return;
1796
- }
1797
- clearNode(self.daysContainer);
1798
- // TODO: week numbers for each month
1799
- if (self.weekNumbers)
1800
- clearNode(self.weekNumbers);
1801
- var frag = document.createDocumentFragment();
1802
- for (var i = 0; i < self.config.showMonths; i++) {
1803
- var d = new Date(self.currentYear, self.currentMonth, 1);
1804
- d.setMonth(self.currentMonth + i);
1805
- frag.appendChild(buildMonthDays(d.getFullYear(), d.getMonth()));
1806
- }
1807
- self.daysContainer.appendChild(frag);
1808
- self.days = self.daysContainer.firstChild;
1809
- if (self.config.mode === "range" && self.selectedDates.length === 1) {
1810
- onMouseOver();
1811
- }
1812
- }
1813
- function buildMonthSwitch() {
1814
- if (self.config.showMonths > 1 ||
1815
- self.config.monthSelectorType !== "dropdown")
1816
- return;
1817
- var shouldBuildMonth = function (month) {
1818
- if (self.config.minDate !== undefined &&
1819
- self.currentYear === self.config.minDate.getFullYear() &&
1820
- month < self.config.minDate.getMonth()) {
1821
- return false;
1822
- }
1823
- return !(self.config.maxDate !== undefined &&
1824
- self.currentYear === self.config.maxDate.getFullYear() &&
1825
- month > self.config.maxDate.getMonth());
1826
- };
1827
- self.monthsDropdownContainer.tabIndex = -1;
1828
- self.monthsDropdownContainer.innerHTML = "";
1829
- for (var i = 0; i < 12; i++) {
1830
- if (!shouldBuildMonth(i))
1831
- continue;
1832
- var month = createElement("option", "flatpickr-monthDropdown-month");
1833
- month.value = new Date(self.currentYear, i).getMonth().toString();
1834
- month.textContent = monthToStr(i, self.config.shorthandCurrentMonth, self.l10n);
1835
- month.tabIndex = -1;
1836
- if (self.currentMonth === i) {
1837
- month.selected = true;
1838
- }
1839
- self.monthsDropdownContainer.appendChild(month);
1840
- }
1841
- }
1842
- function buildMonth() {
1843
- var container = createElement("div", "flatpickr-month");
1844
- var monthNavFragment = window.document.createDocumentFragment();
1845
- var monthElement;
1846
- if (self.config.showMonths > 1 ||
1847
- self.config.monthSelectorType === "static") {
1848
- monthElement = createElement("span", "cur-month");
1849
- }
1850
- else {
1851
- self.monthsDropdownContainer = createElement("select", "flatpickr-monthDropdown-months");
1852
- self.monthsDropdownContainer.setAttribute("aria-label", self.l10n.monthAriaLabel);
1853
- bind(self.monthsDropdownContainer, "change", function (e) {
1854
- var target = getEventTarget(e);
1855
- var selectedMonth = parseInt(target.value, 10);
1856
- self.changeMonth(selectedMonth - self.currentMonth);
1857
- triggerEvent("onMonthChange");
1858
- });
1859
- buildMonthSwitch();
1860
- monthElement = self.monthsDropdownContainer;
1861
- }
1862
- var yearInput = createNumberInput("cur-year", { tabindex: "-1" });
1863
- var yearElement = yearInput.getElementsByTagName("input")[0];
1864
- yearElement.setAttribute("aria-label", self.l10n.yearAriaLabel);
1865
- if (self.config.minDate) {
1866
- yearElement.setAttribute("min", self.config.minDate.getFullYear().toString());
1867
- }
1868
- if (self.config.maxDate) {
1869
- yearElement.setAttribute("max", self.config.maxDate.getFullYear().toString());
1870
- yearElement.disabled =
1871
- !!self.config.minDate &&
1872
- self.config.minDate.getFullYear() === self.config.maxDate.getFullYear();
1873
- }
1874
- var currentMonth = createElement("div", "flatpickr-current-month");
1875
- currentMonth.appendChild(monthElement);
1876
- currentMonth.appendChild(yearInput);
1877
- monthNavFragment.appendChild(currentMonth);
1878
- container.appendChild(monthNavFragment);
1879
- return {
1880
- container: container,
1881
- yearElement: yearElement,
1882
- monthElement: monthElement,
1883
- };
1884
- }
1885
- function buildMonths() {
1886
- clearNode(self.monthNav);
1887
- self.monthNav.appendChild(self.prevMonthNav);
1888
- if (self.config.showMonths) {
1889
- self.yearElements = [];
1890
- self.monthElements = [];
1891
- }
1892
- for (var m = self.config.showMonths; m--;) {
1893
- var month = buildMonth();
1894
- self.yearElements.push(month.yearElement);
1895
- self.monthElements.push(month.monthElement);
1896
- self.monthNav.appendChild(month.container);
1897
- }
1898
- self.monthNav.appendChild(self.nextMonthNav);
1899
- }
1900
- function buildMonthNav() {
1901
- self.monthNav = createElement("div", "flatpickr-months");
1902
- self.yearElements = [];
1903
- self.monthElements = [];
1904
- self.prevMonthNav = createElement("span", "flatpickr-prev-month");
1905
- self.prevMonthNav.innerHTML = self.config.prevArrow;
1906
- self.nextMonthNav = createElement("span", "flatpickr-next-month");
1907
- self.nextMonthNav.innerHTML = self.config.nextArrow;
1908
- buildMonths();
1909
- Object.defineProperty(self, "_hidePrevMonthArrow", {
1910
- get: function () { return self.__hidePrevMonthArrow; },
1911
- set: function (bool) {
1912
- if (self.__hidePrevMonthArrow !== bool) {
1913
- toggleClass(self.prevMonthNav, "flatpickr-disabled", bool);
1914
- self.__hidePrevMonthArrow = bool;
1915
- }
1916
- },
1917
- });
1918
- Object.defineProperty(self, "_hideNextMonthArrow", {
1919
- get: function () { return self.__hideNextMonthArrow; },
1920
- set: function (bool) {
1921
- if (self.__hideNextMonthArrow !== bool) {
1922
- toggleClass(self.nextMonthNav, "flatpickr-disabled", bool);
1923
- self.__hideNextMonthArrow = bool;
1924
- }
1925
- },
1926
- });
1927
- self.currentYearElement = self.yearElements[0];
1928
- updateNavigationCurrentMonth();
1929
- return self.monthNav;
1930
- }
1931
- function buildTime() {
1932
- self.calendarContainer.classList.add("hasTime");
1933
- if (self.config.noCalendar)
1934
- self.calendarContainer.classList.add("noCalendar");
1935
- var defaults = getDefaultHours(self.config);
1936
- self.timeContainer = createElement("div", "flatpickr-time");
1937
- self.timeContainer.tabIndex = -1;
1938
- var separator = createElement("span", "flatpickr-time-separator", ":");
1939
- var hourInput = createNumberInput("flatpickr-hour", {
1940
- "aria-label": self.l10n.hourAriaLabel,
1941
- });
1942
- self.hourElement = hourInput.getElementsByTagName("input")[0];
1943
- var minuteInput = createNumberInput("flatpickr-minute", {
1944
- "aria-label": self.l10n.minuteAriaLabel,
1945
- });
1946
- self.minuteElement = minuteInput.getElementsByTagName("input")[0];
1947
- self.hourElement.tabIndex = self.minuteElement.tabIndex = -1;
1948
- self.hourElement.value = pad(self.latestSelectedDateObj
1949
- ? self.latestSelectedDateObj.getHours()
1950
- : self.config.time_24hr
1951
- ? defaults.hours
1952
- : military2ampm(defaults.hours));
1953
- self.minuteElement.value = pad(self.latestSelectedDateObj
1954
- ? self.latestSelectedDateObj.getMinutes()
1955
- : defaults.minutes);
1956
- self.hourElement.setAttribute("step", self.config.hourIncrement.toString());
1957
- self.minuteElement.setAttribute("step", self.config.minuteIncrement.toString());
1958
- self.hourElement.setAttribute("min", self.config.time_24hr ? "0" : "1");
1959
- self.hourElement.setAttribute("max", self.config.time_24hr ? "23" : "12");
1960
- self.hourElement.setAttribute("maxlength", "2");
1961
- self.minuteElement.setAttribute("min", "0");
1962
- self.minuteElement.setAttribute("max", "59");
1963
- self.minuteElement.setAttribute("maxlength", "2");
1964
- self.timeContainer.appendChild(hourInput);
1965
- self.timeContainer.appendChild(separator);
1966
- self.timeContainer.appendChild(minuteInput);
1967
- if (self.config.time_24hr)
1968
- self.timeContainer.classList.add("time24hr");
1969
- if (self.config.enableSeconds) {
1970
- self.timeContainer.classList.add("hasSeconds");
1971
- var secondInput = createNumberInput("flatpickr-second");
1972
- self.secondElement = secondInput.getElementsByTagName("input")[0];
1973
- self.secondElement.value = pad(self.latestSelectedDateObj
1974
- ? self.latestSelectedDateObj.getSeconds()
1975
- : defaults.seconds);
1976
- self.secondElement.setAttribute("step", self.minuteElement.getAttribute("step"));
1977
- self.secondElement.setAttribute("min", "0");
1978
- self.secondElement.setAttribute("max", "59");
1979
- self.secondElement.setAttribute("maxlength", "2");
1980
- self.timeContainer.appendChild(createElement("span", "flatpickr-time-separator", ":"));
1981
- self.timeContainer.appendChild(secondInput);
1982
- }
1983
- if (!self.config.time_24hr) {
1984
- // add self.amPM if appropriate
1985
- self.amPM = createElement("span", "flatpickr-am-pm", self.l10n.amPM[int((self.latestSelectedDateObj
1986
- ? self.hourElement.value
1987
- : self.config.defaultHour) > 11)]);
1988
- self.amPM.title = self.l10n.toggleTitle;
1989
- self.amPM.tabIndex = -1;
1990
- self.timeContainer.appendChild(self.amPM);
1991
- }
1992
- return self.timeContainer;
1993
- }
1994
- function buildWeekdays() {
1995
- if (!self.weekdayContainer)
1996
- self.weekdayContainer = createElement("div", "flatpickr-weekdays");
1997
- else
1998
- clearNode(self.weekdayContainer);
1999
- for (var i = self.config.showMonths; i--;) {
2000
- var container = createElement("div", "flatpickr-weekdaycontainer");
2001
- self.weekdayContainer.appendChild(container);
2002
- }
2003
- updateWeekdays();
2004
- return self.weekdayContainer;
2005
- }
2006
- function updateWeekdays() {
2007
- if (!self.weekdayContainer) {
2008
- return;
2009
- }
2010
- var firstDayOfWeek = self.l10n.firstDayOfWeek;
2011
- var weekdays = __spreadArrays(self.l10n.weekdays.shorthand);
2012
- if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) {
2013
- weekdays = __spreadArrays(weekdays.splice(firstDayOfWeek, weekdays.length), weekdays.splice(0, firstDayOfWeek));
2014
- }
2015
- for (var i = self.config.showMonths; i--;) {
2016
- self.weekdayContainer.children[i].innerHTML = "\n <span class='flatpickr-weekday'>\n " + weekdays.join("</span><span class='flatpickr-weekday'>") + "\n </span>\n ";
2017
- }
2018
- }
2019
- /* istanbul ignore next */
2020
- function buildWeeks() {
2021
- self.calendarContainer.classList.add("hasWeeks");
2022
- var weekWrapper = createElement("div", "flatpickr-weekwrapper");
2023
- weekWrapper.appendChild(createElement("span", "flatpickr-weekday", self.l10n.weekAbbreviation));
2024
- var weekNumbers = createElement("div", "flatpickr-weeks");
2025
- weekWrapper.appendChild(weekNumbers);
2026
- return {
2027
- weekWrapper: weekWrapper,
2028
- weekNumbers: weekNumbers,
2029
- };
2030
- }
2031
- function changeMonth(value, isOffset) {
2032
- if (isOffset === void 0) { isOffset = true; }
2033
- var delta = isOffset ? value : value - self.currentMonth;
2034
- if ((delta < 0 && self._hidePrevMonthArrow === true) ||
2035
- (delta > 0 && self._hideNextMonthArrow === true))
2036
- return;
2037
- self.currentMonth += delta;
2038
- if (self.currentMonth < 0 || self.currentMonth > 11) {
2039
- self.currentYear += self.currentMonth > 11 ? 1 : -1;
2040
- self.currentMonth = (self.currentMonth + 12) % 12;
2041
- triggerEvent("onYearChange");
2042
- buildMonthSwitch();
2043
- }
2044
- buildDays();
2045
- triggerEvent("onMonthChange");
2046
- updateNavigationCurrentMonth();
2047
- }
2048
- function clear(triggerChangeEvent, toInitial) {
2049
- if (triggerChangeEvent === void 0) { triggerChangeEvent = true; }
2050
- if (toInitial === void 0) { toInitial = true; }
2051
- self.input.value = "";
2052
- if (self.altInput !== undefined)
2053
- self.altInput.value = "";
2054
- if (self.mobileInput !== undefined)
2055
- self.mobileInput.value = "";
2056
- self.selectedDates = [];
2057
- self.latestSelectedDateObj = undefined;
2058
- if (toInitial === true) {
2059
- self.currentYear = self._initialDate.getFullYear();
2060
- self.currentMonth = self._initialDate.getMonth();
2061
- }
2062
- if (self.config.enableTime === true) {
2063
- var _a = getDefaultHours(self.config), hours = _a.hours, minutes = _a.minutes, seconds = _a.seconds;
2064
- setHours(hours, minutes, seconds);
2065
- }
2066
- self.redraw();
2067
- if (triggerChangeEvent)
2068
- // triggerChangeEvent is true (default) or an Event
2069
- triggerEvent("onChange");
2070
- }
2071
- function close() {
2072
- self.isOpen = false;
2073
- if (!self.isMobile) {
2074
- if (self.calendarContainer !== undefined) {
2075
- self.calendarContainer.classList.remove("open");
2076
- }
2077
- if (self._input !== undefined) {
2078
- self._input.classList.remove("active");
2079
- }
2080
- }
2081
- triggerEvent("onClose");
2082
- }
2083
- function destroy() {
2084
- if (self.config !== undefined)
2085
- triggerEvent("onDestroy");
2086
- for (var i = self._handlers.length; i--;) {
2087
- self._handlers[i].remove();
2088
- }
2089
- self._handlers = [];
2090
- if (self.mobileInput) {
2091
- if (self.mobileInput.parentNode)
2092
- self.mobileInput.parentNode.removeChild(self.mobileInput);
2093
- self.mobileInput = undefined;
2094
- }
2095
- else if (self.calendarContainer && self.calendarContainer.parentNode) {
2096
- if (self.config.static && self.calendarContainer.parentNode) {
2097
- var wrapper = self.calendarContainer.parentNode;
2098
- wrapper.lastChild && wrapper.removeChild(wrapper.lastChild);
2099
- if (wrapper.parentNode) {
2100
- while (wrapper.firstChild)
2101
- wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper);
2102
- wrapper.parentNode.removeChild(wrapper);
2103
- }
2104
- }
2105
- else
2106
- self.calendarContainer.parentNode.removeChild(self.calendarContainer);
2107
- }
2108
- if (self.altInput) {
2109
- self.input.type = "text";
2110
- if (self.altInput.parentNode)
2111
- self.altInput.parentNode.removeChild(self.altInput);
2112
- delete self.altInput;
2113
- }
2114
- if (self.input) {
2115
- self.input.type = self.input._type;
2116
- self.input.classList.remove("flatpickr-input");
2117
- self.input.removeAttribute("readonly");
2118
- }
2119
- [
2120
- "_showTimeInput",
2121
- "latestSelectedDateObj",
2122
- "_hideNextMonthArrow",
2123
- "_hidePrevMonthArrow",
2124
- "__hideNextMonthArrow",
2125
- "__hidePrevMonthArrow",
2126
- "isMobile",
2127
- "isOpen",
2128
- "selectedDateElem",
2129
- "minDateHasTime",
2130
- "maxDateHasTime",
2131
- "days",
2132
- "daysContainer",
2133
- "_input",
2134
- "_positionElement",
2135
- "innerContainer",
2136
- "rContainer",
2137
- "monthNav",
2138
- "todayDateElem",
2139
- "calendarContainer",
2140
- "weekdayContainer",
2141
- "prevMonthNav",
2142
- "nextMonthNav",
2143
- "monthsDropdownContainer",
2144
- "currentMonthElement",
2145
- "currentYearElement",
2146
- "navigationCurrentMonth",
2147
- "selectedDateElem",
2148
- "config",
2149
- ].forEach(function (k) {
2150
- try {
2151
- delete self[k];
2152
- }
2153
- catch (_) { }
2154
- });
2155
- }
2156
- function isCalendarElem(elem) {
2157
- return self.calendarContainer.contains(elem);
2158
- }
2159
- function documentClick(e) {
2160
- if (self.isOpen && !self.config.inline) {
2161
- var eventTarget_1 = getEventTarget(e);
2162
- var isCalendarElement = isCalendarElem(eventTarget_1);
2163
- var isInput = eventTarget_1 === self.input ||
2164
- eventTarget_1 === self.altInput ||
2165
- self.element.contains(eventTarget_1) ||
2166
- // web components
2167
- // e.path is not present in all browsers. circumventing typechecks
2168
- (e.path &&
2169
- e.path.indexOf &&
2170
- (~e.path.indexOf(self.input) ||
2171
- ~e.path.indexOf(self.altInput)));
2172
- var lostFocus = !isInput &&
2173
- !isCalendarElement &&
2174
- !isCalendarElem(e.relatedTarget);
2175
- var isIgnored = !self.config.ignoredFocusElements.some(function (elem) {
2176
- return elem.contains(eventTarget_1);
2177
- });
2178
- if (lostFocus && isIgnored) {
2179
- if (self.config.allowInput) {
2180
- self.setDate(self._input.value, false, self.config.altInput
2181
- ? self.config.altFormat
2182
- : self.config.dateFormat);
2183
- }
2184
- if (self.timeContainer !== undefined &&
2185
- self.minuteElement !== undefined &&
2186
- self.hourElement !== undefined &&
2187
- self.input.value !== "" &&
2188
- self.input.value !== undefined) {
2189
- updateTime();
2190
- }
2191
- self.close();
2192
- if (self.config &&
2193
- self.config.mode === "range" &&
2194
- self.selectedDates.length === 1)
2195
- self.clear(false);
2196
- }
2197
- }
2198
- }
2199
- function changeYear(newYear) {
2200
- if (!newYear ||
2201
- (self.config.minDate && newYear < self.config.minDate.getFullYear()) ||
2202
- (self.config.maxDate && newYear > self.config.maxDate.getFullYear()))
2203
- return;
2204
- var newYearNum = newYear, isNewYear = self.currentYear !== newYearNum;
2205
- self.currentYear = newYearNum || self.currentYear;
2206
- if (self.config.maxDate &&
2207
- self.currentYear === self.config.maxDate.getFullYear()) {
2208
- self.currentMonth = Math.min(self.config.maxDate.getMonth(), self.currentMonth);
2209
- }
2210
- else if (self.config.minDate &&
2211
- self.currentYear === self.config.minDate.getFullYear()) {
2212
- self.currentMonth = Math.max(self.config.minDate.getMonth(), self.currentMonth);
2213
- }
2214
- if (isNewYear) {
2215
- self.redraw();
2216
- triggerEvent("onYearChange");
2217
- buildMonthSwitch();
2218
- }
2219
- }
2220
- function isEnabled(date, timeless) {
2221
- var _a;
2222
- if (timeless === void 0) { timeless = true; }
2223
- var dateToCheck = self.parseDate(date, undefined, timeless); // timeless
2224
- if ((self.config.minDate &&
2225
- dateToCheck &&
2226
- compareDates(dateToCheck, self.config.minDate, timeless !== undefined ? timeless : !self.minDateHasTime) < 0) ||
2227
- (self.config.maxDate &&
2228
- dateToCheck &&
2229
- compareDates(dateToCheck, self.config.maxDate, timeless !== undefined ? timeless : !self.maxDateHasTime) > 0))
2230
- return false;
2231
- if (!self.config.enable && self.config.disable.length === 0)
2232
- return true;
2233
- if (dateToCheck === undefined)
2234
- return false;
2235
- var bool = !!self.config.enable, array = (_a = self.config.enable) !== null && _a !== void 0 ? _a : self.config.disable;
2236
- for (var i = 0, d = void 0; i < array.length; i++) {
2237
- d = array[i];
2238
- if (typeof d === "function" &&
2239
- d(dateToCheck) // disabled by function
2240
- )
2241
- return bool;
2242
- else if (d instanceof Date &&
2243
- dateToCheck !== undefined &&
2244
- d.getTime() === dateToCheck.getTime())
2245
- // disabled by date
2246
- return bool;
2247
- else if (typeof d === "string") {
2248
- // disabled by date string
2249
- var parsed = self.parseDate(d, undefined, true);
2250
- return parsed && parsed.getTime() === dateToCheck.getTime()
2251
- ? bool
2252
- : !bool;
2253
- }
2254
- else if (
2255
- // disabled by range
2256
- typeof d === "object" &&
2257
- dateToCheck !== undefined &&
2258
- d.from &&
2259
- d.to &&
2260
- dateToCheck.getTime() >= d.from.getTime() &&
2261
- dateToCheck.getTime() <= d.to.getTime())
2262
- return bool;
2263
- }
2264
- return !bool;
2265
- }
2266
- function isInView(elem) {
2267
- if (self.daysContainer !== undefined)
2268
- return (elem.className.indexOf("hidden") === -1 &&
2269
- elem.className.indexOf("flatpickr-disabled") === -1 &&
2270
- self.daysContainer.contains(elem));
2271
- return false;
2272
- }
2273
- function onBlur(e) {
2274
- var isInput = e.target === self._input;
2275
- var valueChanged = self._input.value.trimEnd() !== getDateStr();
2276
- if (isInput &&
2277
- valueChanged &&
2278
- !(e.relatedTarget && isCalendarElem(e.relatedTarget))) {
2279
- self.setDate(self._input.value, true, e.target === self.altInput
2280
- ? self.config.altFormat
2281
- : self.config.dateFormat);
2282
- }
2283
- }
2284
- function onKeyDown(e) {
2285
- // e.key e.keyCode
2286
- // "Backspace" 8
2287
- // "Tab" 9
2288
- // "Enter" 13
2289
- // "Escape" (IE "Esc") 27
2290
- // "ArrowLeft" (IE "Left") 37
2291
- // "ArrowUp" (IE "Up") 38
2292
- // "ArrowRight" (IE "Right") 39
2293
- // "ArrowDown" (IE "Down") 40
2294
- // "Delete" (IE "Del") 46
2295
- var eventTarget = getEventTarget(e);
2296
- var isInput = self.config.wrap
2297
- ? element.contains(eventTarget)
2298
- : eventTarget === self._input;
2299
- var allowInput = self.config.allowInput;
2300
- var allowKeydown = self.isOpen && (!allowInput || !isInput);
2301
- var allowInlineKeydown = self.config.inline && isInput && !allowInput;
2302
- if (e.keyCode === 13 && isInput) {
2303
- if (allowInput) {
2304
- self.setDate(self._input.value, true, eventTarget === self.altInput
2305
- ? self.config.altFormat
2306
- : self.config.dateFormat);
2307
- self.close();
2308
- return eventTarget.blur();
2309
- }
2310
- else {
2311
- self.open();
2312
- }
2313
- }
2314
- else if (isCalendarElem(eventTarget) ||
2315
- allowKeydown ||
2316
- allowInlineKeydown) {
2317
- var isTimeObj = !!self.timeContainer &&
2318
- self.timeContainer.contains(eventTarget);
2319
- switch (e.keyCode) {
2320
- case 13:
2321
- if (isTimeObj) {
2322
- e.preventDefault();
2323
- updateTime();
2324
- focusAndClose();
2325
- }
2326
- else
2327
- selectDate(e);
2328
- break;
2329
- case 27: // escape
2330
- e.preventDefault();
2331
- focusAndClose();
2332
- break;
2333
- case 8:
2334
- case 46:
2335
- if (isInput && !self.config.allowInput) {
2336
- e.preventDefault();
2337
- self.clear();
2338
- }
2339
- break;
2340
- case 37:
2341
- case 39:
2342
- if (!isTimeObj && !isInput) {
2343
- e.preventDefault();
2344
- var activeElement = getClosestActiveElement();
2345
- if (self.daysContainer !== undefined &&
2346
- (allowInput === false ||
2347
- (activeElement && isInView(activeElement)))) {
2348
- var delta_1 = e.keyCode === 39 ? 1 : -1;
2349
- if (!e.ctrlKey)
2350
- focusOnDay(undefined, delta_1);
2351
- else {
2352
- e.stopPropagation();
2353
- changeMonth(delta_1);
2354
- focusOnDay(getFirstAvailableDay(1), 0);
2355
- }
2356
- }
2357
- }
2358
- else if (self.hourElement)
2359
- self.hourElement.focus();
2360
- break;
2361
- case 38:
2362
- case 40:
2363
- e.preventDefault();
2364
- var delta = e.keyCode === 40 ? 1 : -1;
2365
- if ((self.daysContainer &&
2366
- eventTarget.$i !== undefined) ||
2367
- eventTarget === self.input ||
2368
- eventTarget === self.altInput) {
2369
- if (e.ctrlKey) {
2370
- e.stopPropagation();
2371
- changeYear(self.currentYear - delta);
2372
- focusOnDay(getFirstAvailableDay(1), 0);
2373
- }
2374
- else if (!isTimeObj)
2375
- focusOnDay(undefined, delta * 7);
2376
- }
2377
- else if (eventTarget === self.currentYearElement) {
2378
- changeYear(self.currentYear - delta);
2379
- }
2380
- else if (self.config.enableTime) {
2381
- if (!isTimeObj && self.hourElement)
2382
- self.hourElement.focus();
2383
- updateTime(e);
2384
- self._debouncedChange();
2385
- }
2386
- break;
2387
- case 9:
2388
- if (isTimeObj) {
2389
- var elems = [
2390
- self.hourElement,
2391
- self.minuteElement,
2392
- self.secondElement,
2393
- self.amPM,
2394
- ]
2395
- .concat(self.pluginElements)
2396
- .filter(function (x) { return x; });
2397
- var i = elems.indexOf(eventTarget);
2398
- if (i !== -1) {
2399
- var target = elems[i + (e.shiftKey ? -1 : 1)];
2400
- e.preventDefault();
2401
- (target || self._input).focus();
2402
- }
2403
- }
2404
- else if (!self.config.noCalendar &&
2405
- self.daysContainer &&
2406
- self.daysContainer.contains(eventTarget) &&
2407
- e.shiftKey) {
2408
- e.preventDefault();
2409
- self._input.focus();
2410
- }
2411
- break;
2412
- }
2413
- }
2414
- if (self.amPM !== undefined && eventTarget === self.amPM) {
2415
- switch (e.key) {
2416
- case self.l10n.amPM[0].charAt(0):
2417
- case self.l10n.amPM[0].charAt(0).toLowerCase():
2418
- self.amPM.textContent = self.l10n.amPM[0];
2419
- setHoursFromInputs();
2420
- updateValue();
2421
- break;
2422
- case self.l10n.amPM[1].charAt(0):
2423
- case self.l10n.amPM[1].charAt(0).toLowerCase():
2424
- self.amPM.textContent = self.l10n.amPM[1];
2425
- setHoursFromInputs();
2426
- updateValue();
2427
- break;
2428
- }
2429
- }
2430
- if (isInput || isCalendarElem(eventTarget)) {
2431
- triggerEvent("onKeyDown", e);
2432
- }
2433
- }
2434
- function onMouseOver(elem, cellClass) {
2435
- if (cellClass === void 0) { cellClass = "flatpickr-day"; }
2436
- if (self.selectedDates.length !== 1 ||
2437
- (elem &&
2438
- (!elem.classList.contains(cellClass) ||
2439
- elem.classList.contains("flatpickr-disabled"))))
2440
- return;
2441
- var hoverDate = elem
2442
- ? elem.dateObj.getTime()
2443
- : self.days.firstElementChild.dateObj.getTime(), initialDate = self.parseDate(self.selectedDates[0], undefined, true).getTime(), rangeStartDate = Math.min(hoverDate, self.selectedDates[0].getTime()), rangeEndDate = Math.max(hoverDate, self.selectedDates[0].getTime());
2444
- var containsDisabled = false;
2445
- var minRange = 0, maxRange = 0;
2446
- for (var t = rangeStartDate; t < rangeEndDate; t += duration.DAY) {
2447
- if (!isEnabled(new Date(t), true)) {
2448
- containsDisabled =
2449
- containsDisabled || (t > rangeStartDate && t < rangeEndDate);
2450
- if (t < initialDate && (!minRange || t > minRange))
2451
- minRange = t;
2452
- else if (t > initialDate && (!maxRange || t < maxRange))
2453
- maxRange = t;
2454
- }
2455
- }
2456
- var hoverableCells = Array.from(self.rContainer.querySelectorAll("*:nth-child(-n+" + self.config.showMonths + ") > ." + cellClass));
2457
- hoverableCells.forEach(function (dayElem) {
2458
- var date = dayElem.dateObj;
2459
- var timestamp = date.getTime();
2460
- var outOfRange = (minRange > 0 && timestamp < minRange) ||
2461
- (maxRange > 0 && timestamp > maxRange);
2462
- if (outOfRange) {
2463
- dayElem.classList.add("notAllowed");
2464
- ["inRange", "startRange", "endRange"].forEach(function (c) {
2465
- dayElem.classList.remove(c);
2466
- });
2467
- return;
2468
- }
2469
- else if (containsDisabled && !outOfRange)
2470
- return;
2471
- ["startRange", "inRange", "endRange", "notAllowed"].forEach(function (c) {
2472
- dayElem.classList.remove(c);
2473
- });
2474
- if (elem !== undefined) {
2475
- elem.classList.add(hoverDate <= self.selectedDates[0].getTime()
2476
- ? "startRange"
2477
- : "endRange");
2478
- if (initialDate < hoverDate && timestamp === initialDate)
2479
- dayElem.classList.add("startRange");
2480
- else if (initialDate > hoverDate && timestamp === initialDate)
2481
- dayElem.classList.add("endRange");
2482
- if (timestamp >= minRange &&
2483
- (maxRange === 0 || timestamp <= maxRange) &&
2484
- isBetween(timestamp, initialDate, hoverDate))
2485
- dayElem.classList.add("inRange");
2486
- }
2487
- });
2488
- }
2489
- function onResize() {
2490
- if (self.isOpen && !self.config.static && !self.config.inline)
2491
- positionCalendar();
2492
- }
2493
- function open(e, positionElement) {
2494
- if (positionElement === void 0) { positionElement = self._positionElement; }
2495
- if (self.isMobile === true) {
2496
- if (e) {
2497
- e.preventDefault();
2498
- var eventTarget = getEventTarget(e);
2499
- if (eventTarget) {
2500
- eventTarget.blur();
2501
- }
2502
- }
2503
- if (self.mobileInput !== undefined) {
2504
- self.mobileInput.focus();
2505
- self.mobileInput.click();
2506
- }
2507
- triggerEvent("onOpen");
2508
- return;
2509
- }
2510
- else if (self._input.disabled || self.config.inline) {
2511
- return;
2512
- }
2513
- var wasOpen = self.isOpen;
2514
- self.isOpen = true;
2515
- if (!wasOpen) {
2516
- self.calendarContainer.classList.add("open");
2517
- self._input.classList.add("active");
2518
- triggerEvent("onOpen");
2519
- positionCalendar(positionElement);
2520
- }
2521
- if (self.config.enableTime === true && self.config.noCalendar === true) {
2522
- if (self.config.allowInput === false &&
2523
- (e === undefined ||
2524
- !self.timeContainer.contains(e.relatedTarget))) {
2525
- setTimeout(function () { return self.hourElement.select(); }, 50);
2526
- }
2527
- }
2528
- }
2529
- function minMaxDateSetter(type) {
2530
- return function (date) {
2531
- var dateObj = (self.config["_" + type + "Date"] = self.parseDate(date, self.config.dateFormat));
2532
- var inverseDateObj = self.config["_" + (type === "min" ? "max" : "min") + "Date"];
2533
- if (dateObj !== undefined) {
2534
- self[type === "min" ? "minDateHasTime" : "maxDateHasTime"] =
2535
- dateObj.getHours() > 0 ||
2536
- dateObj.getMinutes() > 0 ||
2537
- dateObj.getSeconds() > 0;
2538
- }
2539
- if (self.selectedDates) {
2540
- self.selectedDates = self.selectedDates.filter(function (d) { return isEnabled(d); });
2541
- if (!self.selectedDates.length && type === "min")
2542
- setHoursFromDate(dateObj);
2543
- updateValue();
2544
- }
2545
- if (self.daysContainer) {
2546
- redraw();
2547
- if (dateObj !== undefined)
2548
- self.currentYearElement[type] = dateObj.getFullYear().toString();
2549
- else
2550
- self.currentYearElement.removeAttribute(type);
2551
- self.currentYearElement.disabled =
2552
- !!inverseDateObj &&
2553
- dateObj !== undefined &&
2554
- inverseDateObj.getFullYear() === dateObj.getFullYear();
2555
- }
2556
- };
2557
- }
2558
- function parseConfig() {
2559
- var boolOpts = [
2560
- "wrap",
2561
- "weekNumbers",
2562
- "allowInput",
2563
- "allowInvalidPreload",
2564
- "clickOpens",
2565
- "time_24hr",
2566
- "enableTime",
2567
- "noCalendar",
2568
- "altInput",
2569
- "shorthandCurrentMonth",
2570
- "inline",
2571
- "static",
2572
- "enableSeconds",
2573
- "disableMobile",
2574
- ];
2575
- var userConfig = __assign(__assign({}, JSON.parse(JSON.stringify(element.dataset || {}))), instanceConfig);
2576
- var formats = {};
2577
- self.config.parseDate = userConfig.parseDate;
2578
- self.config.formatDate = userConfig.formatDate;
2579
- Object.defineProperty(self.config, "enable", {
2580
- get: function () { return self.config._enable; },
2581
- set: function (dates) {
2582
- self.config._enable = parseDateRules(dates);
2583
- },
2584
- });
2585
- Object.defineProperty(self.config, "disable", {
2586
- get: function () { return self.config._disable; },
2587
- set: function (dates) {
2588
- self.config._disable = parseDateRules(dates);
2589
- },
2590
- });
2591
- var timeMode = userConfig.mode === "time";
2592
- if (!userConfig.dateFormat && (userConfig.enableTime || timeMode)) {
2593
- var defaultDateFormat = flatpickr.defaultConfig.dateFormat || defaults.dateFormat;
2594
- formats.dateFormat =
2595
- userConfig.noCalendar || timeMode
2596
- ? "H:i" + (userConfig.enableSeconds ? ":S" : "")
2597
- : defaultDateFormat + " H:i" + (userConfig.enableSeconds ? ":S" : "");
2598
- }
2599
- if (userConfig.altInput &&
2600
- (userConfig.enableTime || timeMode) &&
2601
- !userConfig.altFormat) {
2602
- var defaultAltFormat = flatpickr.defaultConfig.altFormat || defaults.altFormat;
2603
- formats.altFormat =
2604
- userConfig.noCalendar || timeMode
2605
- ? "h:i" + (userConfig.enableSeconds ? ":S K" : " K")
2606
- : defaultAltFormat + (" h:i" + (userConfig.enableSeconds ? ":S" : "") + " K");
2607
- }
2608
- Object.defineProperty(self.config, "minDate", {
2609
- get: function () { return self.config._minDate; },
2610
- set: minMaxDateSetter("min"),
2611
- });
2612
- Object.defineProperty(self.config, "maxDate", {
2613
- get: function () { return self.config._maxDate; },
2614
- set: minMaxDateSetter("max"),
2615
- });
2616
- var minMaxTimeSetter = function (type) { return function (val) {
2617
- self.config[type === "min" ? "_minTime" : "_maxTime"] = self.parseDate(val, "H:i:S");
2618
- }; };
2619
- Object.defineProperty(self.config, "minTime", {
2620
- get: function () { return self.config._minTime; },
2621
- set: minMaxTimeSetter("min"),
2622
- });
2623
- Object.defineProperty(self.config, "maxTime", {
2624
- get: function () { return self.config._maxTime; },
2625
- set: minMaxTimeSetter("max"),
2626
- });
2627
- if (userConfig.mode === "time") {
2628
- self.config.noCalendar = true;
2629
- self.config.enableTime = true;
2630
- }
2631
- Object.assign(self.config, formats, userConfig);
2632
- for (var i = 0; i < boolOpts.length; i++)
2633
- // https://github.com/microsoft/TypeScript/issues/31663
2634
- self.config[boolOpts[i]] =
2635
- self.config[boolOpts[i]] === true ||
2636
- self.config[boolOpts[i]] === "true";
2637
- HOOKS.filter(function (hook) { return self.config[hook] !== undefined; }).forEach(function (hook) {
2638
- self.config[hook] = arrayify(self.config[hook] || []).map(bindToInstance);
2639
- });
2640
- self.isMobile =
2641
- !self.config.disableMobile &&
2642
- !self.config.inline &&
2643
- self.config.mode === "single" &&
2644
- !self.config.disable.length &&
2645
- !self.config.enable &&
2646
- !self.config.weekNumbers &&
2647
- /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
2648
- for (var i = 0; i < self.config.plugins.length; i++) {
2649
- var pluginConf = self.config.plugins[i](self) || {};
2650
- for (var key in pluginConf) {
2651
- if (HOOKS.indexOf(key) > -1) {
2652
- self.config[key] = arrayify(pluginConf[key])
2653
- .map(bindToInstance)
2654
- .concat(self.config[key]);
2655
- }
2656
- else if (typeof userConfig[key] === "undefined")
2657
- self.config[key] = pluginConf[key];
2658
- }
2659
- }
2660
- if (!userConfig.altInputClass) {
2661
- self.config.altInputClass =
2662
- getInputElem().className + " " + self.config.altInputClass;
2663
- }
2664
- triggerEvent("onParseConfig");
2665
- }
2666
- function getInputElem() {
2667
- return self.config.wrap
2668
- ? element.querySelector("[data-input]")
2669
- : element;
2670
- }
2671
- function setupLocale() {
2672
- if (typeof self.config.locale !== "object" &&
2673
- typeof flatpickr.l10ns[self.config.locale] === "undefined")
2674
- self.config.errorHandler(new Error("flatpickr: invalid locale " + self.config.locale));
2675
- self.l10n = __assign(__assign({}, flatpickr.l10ns.default), (typeof self.config.locale === "object"
2676
- ? self.config.locale
2677
- : self.config.locale !== "default"
2678
- ? flatpickr.l10ns[self.config.locale]
2679
- : undefined));
2680
- tokenRegex.D = "(" + self.l10n.weekdays.shorthand.join("|") + ")";
2681
- tokenRegex.l = "(" + self.l10n.weekdays.longhand.join("|") + ")";
2682
- tokenRegex.M = "(" + self.l10n.months.shorthand.join("|") + ")";
2683
- tokenRegex.F = "(" + self.l10n.months.longhand.join("|") + ")";
2684
- tokenRegex.K = "(" + self.l10n.amPM[0] + "|" + self.l10n.amPM[1] + "|" + self.l10n.amPM[0].toLowerCase() + "|" + self.l10n.amPM[1].toLowerCase() + ")";
2685
- var userConfig = __assign(__assign({}, instanceConfig), JSON.parse(JSON.stringify(element.dataset || {})));
2686
- if (userConfig.time_24hr === undefined &&
2687
- flatpickr.defaultConfig.time_24hr === undefined) {
2688
- self.config.time_24hr = self.l10n.time_24hr;
2689
- }
2690
- self.formatDate = createDateFormatter(self);
2691
- self.parseDate = createDateParser({ config: self.config, l10n: self.l10n });
2692
- }
2693
- function positionCalendar(customPositionElement) {
2694
- if (typeof self.config.position === "function") {
2695
- return void self.config.position(self, customPositionElement);
2696
- }
2697
- if (self.calendarContainer === undefined)
2698
- return;
2699
- triggerEvent("onPreCalendarPosition");
2700
- var positionElement = customPositionElement || self._positionElement;
2701
- var calendarHeight = Array.prototype.reduce.call(self.calendarContainer.children, (function (acc, child) { return acc + child.offsetHeight; }), 0), calendarWidth = self.calendarContainer.offsetWidth, configPos = self.config.position.split(" "), configPosVertical = configPos[0], configPosHorizontal = configPos.length > 1 ? configPos[1] : null, inputBounds = positionElement.getBoundingClientRect(), distanceFromBottom = window.innerHeight - inputBounds.bottom, showOnTop = configPosVertical === "above" ||
2702
- (configPosVertical !== "below" &&
2703
- distanceFromBottom < calendarHeight &&
2704
- inputBounds.top > calendarHeight);
2705
- var top = window.pageYOffset +
2706
- inputBounds.top +
2707
- (!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2);
2708
- toggleClass(self.calendarContainer, "arrowTop", !showOnTop);
2709
- toggleClass(self.calendarContainer, "arrowBottom", showOnTop);
2710
- if (self.config.inline)
2711
- return;
2712
- var left = window.pageXOffset + inputBounds.left;
2713
- var isCenter = false;
2714
- var isRight = false;
2715
- if (configPosHorizontal === "center") {
2716
- left -= (calendarWidth - inputBounds.width) / 2;
2717
- isCenter = true;
2718
- }
2719
- else if (configPosHorizontal === "right") {
2720
- left -= calendarWidth - inputBounds.width;
2721
- isRight = true;
2722
- }
2723
- toggleClass(self.calendarContainer, "arrowLeft", !isCenter && !isRight);
2724
- toggleClass(self.calendarContainer, "arrowCenter", isCenter);
2725
- toggleClass(self.calendarContainer, "arrowRight", isRight);
2726
- var right = window.document.body.offsetWidth -
2727
- (window.pageXOffset + inputBounds.right);
2728
- var rightMost = left + calendarWidth > window.document.body.offsetWidth;
2729
- var centerMost = right + calendarWidth > window.document.body.offsetWidth;
2730
- toggleClass(self.calendarContainer, "rightMost", rightMost);
2731
- if (self.config.static)
2732
- return;
2733
- self.calendarContainer.style.top = top + "px";
2734
- if (!rightMost) {
2735
- self.calendarContainer.style.left = left + "px";
2736
- self.calendarContainer.style.right = "auto";
2737
- }
2738
- else if (!centerMost) {
2739
- self.calendarContainer.style.left = "auto";
2740
- self.calendarContainer.style.right = right + "px";
2741
- }
2742
- else {
2743
- var doc = getDocumentStyleSheet();
2744
- // some testing environments don't have css support
2745
- if (doc === undefined)
2746
- return;
2747
- var bodyWidth = window.document.body.offsetWidth;
2748
- var centerLeft = Math.max(0, bodyWidth / 2 - calendarWidth / 2);
2749
- var centerBefore = ".flatpickr-calendar.centerMost:before";
2750
- var centerAfter = ".flatpickr-calendar.centerMost:after";
2751
- var centerIndex = doc.cssRules.length;
2752
- var centerStyle = "{left:" + inputBounds.left + "px;right:auto;}";
2753
- toggleClass(self.calendarContainer, "rightMost", false);
2754
- toggleClass(self.calendarContainer, "centerMost", true);
2755
- doc.insertRule(centerBefore + "," + centerAfter + centerStyle, centerIndex);
2756
- self.calendarContainer.style.left = centerLeft + "px";
2757
- self.calendarContainer.style.right = "auto";
2758
- }
2759
- }
2760
- function getDocumentStyleSheet() {
2761
- var editableSheet = null;
2762
- for (var i = 0; i < document.styleSheets.length; i++) {
2763
- var sheet = document.styleSheets[i];
2764
- if (!sheet.cssRules)
2765
- continue;
2766
- try {
2767
- sheet.cssRules;
2768
- }
2769
- catch (err) {
2770
- continue;
2771
- }
2772
- editableSheet = sheet;
2773
- break;
2774
- }
2775
- return editableSheet != null ? editableSheet : createStyleSheet();
2776
- }
2777
- function createStyleSheet() {
2778
- var style = document.createElement("style");
2779
- document.head.appendChild(style);
2780
- return style.sheet;
2781
- }
2782
- function redraw() {
2783
- if (self.config.noCalendar || self.isMobile)
2784
- return;
2785
- buildMonthSwitch();
2786
- updateNavigationCurrentMonth();
2787
- buildDays();
2788
- }
2789
- function focusAndClose() {
2790
- self._input.focus();
2791
- if (window.navigator.userAgent.indexOf("MSIE") !== -1 ||
2792
- navigator.msMaxTouchPoints !== undefined) {
2793
- // hack - bugs in the way IE handles focus keeps the calendar open
2794
- setTimeout(self.close, 0);
2795
- }
2796
- else {
2797
- self.close();
2798
- }
2799
- }
2800
- function selectDate(e) {
2801
- e.preventDefault();
2802
- e.stopPropagation();
2803
- var isSelectable = function (day) {
2804
- return day.classList &&
2805
- day.classList.contains("flatpickr-day") &&
2806
- !day.classList.contains("flatpickr-disabled") &&
2807
- !day.classList.contains("notAllowed");
2808
- };
2809
- var t = findParent(getEventTarget(e), isSelectable);
2810
- if (t === undefined)
2811
- return;
2812
- var target = t;
2813
- var selectedDate = (self.latestSelectedDateObj = new Date(target.dateObj.getTime()));
2814
- var shouldChangeMonth = (selectedDate.getMonth() < self.currentMonth ||
2815
- selectedDate.getMonth() >
2816
- self.currentMonth + self.config.showMonths - 1) &&
2817
- self.config.mode !== "range";
2818
- self.selectedDateElem = target;
2819
- if (self.config.mode === "single")
2820
- self.selectedDates = [selectedDate];
2821
- else if (self.config.mode === "multiple") {
2822
- var selectedIndex = isDateSelected(selectedDate);
2823
- if (selectedIndex)
2824
- self.selectedDates.splice(parseInt(selectedIndex), 1);
2825
- else
2826
- self.selectedDates.push(selectedDate);
2827
- }
2828
- else if (self.config.mode === "range") {
2829
- if (self.selectedDates.length === 2) {
2830
- self.clear(false, false);
2831
- }
2832
- self.latestSelectedDateObj = selectedDate;
2833
- self.selectedDates.push(selectedDate);
2834
- // unless selecting same date twice, sort ascendingly
2835
- if (compareDates(selectedDate, self.selectedDates[0], true) !== 0)
2836
- self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });
2837
- }
2838
- setHoursFromInputs();
2839
- if (shouldChangeMonth) {
2840
- var isNewYear = self.currentYear !== selectedDate.getFullYear();
2841
- self.currentYear = selectedDate.getFullYear();
2842
- self.currentMonth = selectedDate.getMonth();
2843
- if (isNewYear) {
2844
- triggerEvent("onYearChange");
2845
- buildMonthSwitch();
2846
- }
2847
- triggerEvent("onMonthChange");
2848
- }
2849
- updateNavigationCurrentMonth();
2850
- buildDays();
2851
- updateValue();
2852
- // maintain focus
2853
- if (!shouldChangeMonth &&
2854
- self.config.mode !== "range" &&
2855
- self.config.showMonths === 1)
2856
- focusOnDayElem(target);
2857
- else if (self.selectedDateElem !== undefined &&
2858
- self.hourElement === undefined) {
2859
- self.selectedDateElem && self.selectedDateElem.focus();
2860
- }
2861
- if (self.hourElement !== undefined)
2862
- self.hourElement !== undefined && self.hourElement.focus();
2863
- if (self.config.closeOnSelect) {
2864
- var single = self.config.mode === "single" && !self.config.enableTime;
2865
- var range = self.config.mode === "range" &&
2866
- self.selectedDates.length === 2 &&
2867
- !self.config.enableTime;
2868
- if (single || range) {
2869
- focusAndClose();
2870
- }
2871
- }
2872
- triggerChange();
2873
- }
2874
- var CALLBACKS = {
2875
- locale: [setupLocale, updateWeekdays],
2876
- showMonths: [buildMonths, setCalendarWidth, buildWeekdays],
2877
- minDate: [jumpToDate],
2878
- maxDate: [jumpToDate],
2879
- positionElement: [updatePositionElement],
2880
- clickOpens: [
2881
- function () {
2882
- if (self.config.clickOpens === true) {
2883
- bind(self._input, "focus", self.open);
2884
- bind(self._input, "click", self.open);
2885
- }
2886
- else {
2887
- self._input.removeEventListener("focus", self.open);
2888
- self._input.removeEventListener("click", self.open);
2889
- }
2890
- },
2891
- ],
2892
- };
2893
- function set(option, value) {
2894
- if (option !== null && typeof option === "object") {
2895
- Object.assign(self.config, option);
2896
- for (var key in option) {
2897
- if (CALLBACKS[key] !== undefined)
2898
- CALLBACKS[key].forEach(function (x) { return x(); });
2899
- }
2900
- }
2901
- else {
2902
- self.config[option] = value;
2903
- if (CALLBACKS[option] !== undefined)
2904
- CALLBACKS[option].forEach(function (x) { return x(); });
2905
- else if (HOOKS.indexOf(option) > -1)
2906
- self.config[option] = arrayify(value);
2907
- }
2908
- self.redraw();
2909
- updateValue(true);
2910
- }
2911
- function setSelectedDate(inputDate, format) {
2912
- var dates = [];
2913
- if (inputDate instanceof Array)
2914
- dates = inputDate.map(function (d) { return self.parseDate(d, format); });
2915
- else if (inputDate instanceof Date || typeof inputDate === "number")
2916
- dates = [self.parseDate(inputDate, format)];
2917
- else if (typeof inputDate === "string") {
2918
- switch (self.config.mode) {
2919
- case "single":
2920
- case "time":
2921
- dates = [self.parseDate(inputDate, format)];
2922
- break;
2923
- case "multiple":
2924
- dates = inputDate
2925
- .split(self.config.conjunction)
2926
- .map(function (date) { return self.parseDate(date, format); });
2927
- break;
2928
- case "range":
2929
- dates = inputDate
2930
- .split(self.l10n.rangeSeparator)
2931
- .map(function (date) { return self.parseDate(date, format); });
2932
- break;
2933
- }
2934
- }
2935
- else
2936
- self.config.errorHandler(new Error("Invalid date supplied: " + JSON.stringify(inputDate)));
2937
- self.selectedDates = (self.config.allowInvalidPreload
2938
- ? dates
2939
- : dates.filter(function (d) { return d instanceof Date && isEnabled(d, false); }));
2940
- if (self.config.mode === "range")
2941
- self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });
2942
- }
2943
- function setDate(date, triggerChange, format) {
2944
- if (triggerChange === void 0) { triggerChange = false; }
2945
- if (format === void 0) { format = self.config.dateFormat; }
2946
- if ((date !== 0 && !date) || (date instanceof Array && date.length === 0))
2947
- return self.clear(triggerChange);
2948
- setSelectedDate(date, format);
2949
- self.latestSelectedDateObj =
2950
- self.selectedDates[self.selectedDates.length - 1];
2951
- self.redraw();
2952
- jumpToDate(undefined, triggerChange);
2953
- setHoursFromDate();
2954
- if (self.selectedDates.length === 0) {
2955
- self.clear(false);
2956
- }
2957
- updateValue(triggerChange);
2958
- if (triggerChange)
2959
- triggerEvent("onChange");
2960
- }
2961
- function parseDateRules(arr) {
2962
- return arr
2963
- .slice()
2964
- .map(function (rule) {
2965
- if (typeof rule === "string" ||
2966
- typeof rule === "number" ||
2967
- rule instanceof Date) {
2968
- return self.parseDate(rule, undefined, true);
2969
- }
2970
- else if (rule &&
2971
- typeof rule === "object" &&
2972
- rule.from &&
2973
- rule.to)
2974
- return {
2975
- from: self.parseDate(rule.from, undefined),
2976
- to: self.parseDate(rule.to, undefined),
2977
- };
2978
- return rule;
2979
- })
2980
- .filter(function (x) { return x; }); // remove falsy values
2981
- }
2982
- function setupDates() {
2983
- self.selectedDates = [];
2984
- self.now = self.parseDate(self.config.now) || new Date();
2985
- // Workaround IE11 setting placeholder as the input's value
2986
- var preloadedDate = self.config.defaultDate ||
2987
- ((self.input.nodeName === "INPUT" ||
2988
- self.input.nodeName === "TEXTAREA") &&
2989
- self.input.placeholder &&
2990
- self.input.value === self.input.placeholder
2991
- ? null
2992
- : self.input.value);
2993
- if (preloadedDate)
2994
- setSelectedDate(preloadedDate, self.config.dateFormat);
2995
- self._initialDate =
2996
- self.selectedDates.length > 0
2997
- ? self.selectedDates[0]
2998
- : self.config.minDate &&
2999
- self.config.minDate.getTime() > self.now.getTime()
3000
- ? self.config.minDate
3001
- : self.config.maxDate &&
3002
- self.config.maxDate.getTime() < self.now.getTime()
3003
- ? self.config.maxDate
3004
- : self.now;
3005
- self.currentYear = self._initialDate.getFullYear();
3006
- self.currentMonth = self._initialDate.getMonth();
3007
- if (self.selectedDates.length > 0)
3008
- self.latestSelectedDateObj = self.selectedDates[0];
3009
- if (self.config.minTime !== undefined)
3010
- self.config.minTime = self.parseDate(self.config.minTime, "H:i");
3011
- if (self.config.maxTime !== undefined)
3012
- self.config.maxTime = self.parseDate(self.config.maxTime, "H:i");
3013
- self.minDateHasTime =
3014
- !!self.config.minDate &&
3015
- (self.config.minDate.getHours() > 0 ||
3016
- self.config.minDate.getMinutes() > 0 ||
3017
- self.config.minDate.getSeconds() > 0);
3018
- self.maxDateHasTime =
3019
- !!self.config.maxDate &&
3020
- (self.config.maxDate.getHours() > 0 ||
3021
- self.config.maxDate.getMinutes() > 0 ||
3022
- self.config.maxDate.getSeconds() > 0);
3023
- }
3024
- function setupInputs() {
3025
- self.input = getInputElem();
3026
- /* istanbul ignore next */
3027
- if (!self.input) {
3028
- self.config.errorHandler(new Error("Invalid input element specified"));
3029
- return;
3030
- }
3031
- // hack: store previous type to restore it after destroy()
3032
- self.input._type = self.input.type;
3033
- self.input.type = "text";
3034
- self.input.classList.add("flatpickr-input");
3035
- self._input = self.input;
3036
- if (self.config.altInput) {
3037
- // replicate self.element
3038
- self.altInput = createElement(self.input.nodeName, self.config.altInputClass);
3039
- self._input = self.altInput;
3040
- self.altInput.placeholder = self.input.placeholder;
3041
- self.altInput.disabled = self.input.disabled;
3042
- self.altInput.required = self.input.required;
3043
- self.altInput.tabIndex = self.input.tabIndex;
3044
- self.altInput.type = "text";
3045
- self.input.setAttribute("type", "hidden");
3046
- if (!self.config.static && self.input.parentNode)
3047
- self.input.parentNode.insertBefore(self.altInput, self.input.nextSibling);
3048
- }
3049
- if (!self.config.allowInput)
3050
- self._input.setAttribute("readonly", "readonly");
3051
- updatePositionElement();
3052
- }
3053
- function updatePositionElement() {
3054
- self._positionElement = self.config.positionElement || self._input;
3055
- }
3056
- function setupMobile() {
3057
- var inputType = self.config.enableTime
3058
- ? self.config.noCalendar
3059
- ? "time"
3060
- : "datetime-local"
3061
- : "date";
3062
- self.mobileInput = createElement("input", self.input.className + " flatpickr-mobile");
3063
- self.mobileInput.tabIndex = 1;
3064
- self.mobileInput.type = inputType;
3065
- self.mobileInput.disabled = self.input.disabled;
3066
- self.mobileInput.required = self.input.required;
3067
- self.mobileInput.placeholder = self.input.placeholder;
3068
- self.mobileFormatStr =
3069
- inputType === "datetime-local"
3070
- ? "Y-m-d\\TH:i:S"
3071
- : inputType === "date"
3072
- ? "Y-m-d"
3073
- : "H:i:S";
3074
- if (self.selectedDates.length > 0) {
3075
- self.mobileInput.defaultValue = self.mobileInput.value = self.formatDate(self.selectedDates[0], self.mobileFormatStr);
3076
- }
3077
- if (self.config.minDate)
3078
- self.mobileInput.min = self.formatDate(self.config.minDate, "Y-m-d");
3079
- if (self.config.maxDate)
3080
- self.mobileInput.max = self.formatDate(self.config.maxDate, "Y-m-d");
3081
- if (self.input.getAttribute("step"))
3082
- self.mobileInput.step = String(self.input.getAttribute("step"));
3083
- self.input.type = "hidden";
3084
- if (self.altInput !== undefined)
3085
- self.altInput.type = "hidden";
3086
- try {
3087
- if (self.input.parentNode)
3088
- self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling);
3089
- }
3090
- catch (_a) { }
3091
- bind(self.mobileInput, "change", function (e) {
3092
- self.setDate(getEventTarget(e).value, false, self.mobileFormatStr);
3093
- triggerEvent("onChange");
3094
- triggerEvent("onClose");
3095
- });
3096
- }
3097
- function toggle(e) {
3098
- if (self.isOpen === true)
3099
- return self.close();
3100
- self.open(e);
3101
- }
3102
- function triggerEvent(event, data) {
3103
- // If the instance has been destroyed already, all hooks have been removed
3104
- if (self.config === undefined)
3105
- return;
3106
- var hooks = self.config[event];
3107
- if (hooks !== undefined && hooks.length > 0) {
3108
- for (var i = 0; hooks[i] && i < hooks.length; i++)
3109
- hooks[i](self.selectedDates, self.input.value, self, data);
3110
- }
3111
- if (event === "onChange") {
3112
- self.input.dispatchEvent(createEvent("change"));
3113
- // many front-end frameworks bind to the input event
3114
- self.input.dispatchEvent(createEvent("input"));
3115
- }
3116
- }
3117
- function createEvent(name) {
3118
- var e = document.createEvent("Event");
3119
- e.initEvent(name, true, true);
3120
- return e;
3121
- }
3122
- function isDateSelected(date) {
3123
- for (var i = 0; i < self.selectedDates.length; i++) {
3124
- var selectedDate = self.selectedDates[i];
3125
- if (selectedDate instanceof Date &&
3126
- compareDates(selectedDate, date) === 0)
3127
- return "" + i;
3128
- }
3129
- return false;
3130
- }
3131
- function isDateInRange(date) {
3132
- if (self.config.mode !== "range" || self.selectedDates.length < 2)
3133
- return false;
3134
- return (compareDates(date, self.selectedDates[0]) >= 0 &&
3135
- compareDates(date, self.selectedDates[1]) <= 0);
3136
- }
3137
- function updateNavigationCurrentMonth() {
3138
- if (self.config.noCalendar || self.isMobile || !self.monthNav)
3139
- return;
3140
- self.yearElements.forEach(function (yearElement, i) {
3141
- var d = new Date(self.currentYear, self.currentMonth, 1);
3142
- d.setMonth(self.currentMonth + i);
3143
- if (self.config.showMonths > 1 ||
3144
- self.config.monthSelectorType === "static") {
3145
- self.monthElements[i].textContent =
3146
- monthToStr(d.getMonth(), self.config.shorthandCurrentMonth, self.l10n) + " ";
3147
- }
3148
- else {
3149
- self.monthsDropdownContainer.value = d.getMonth().toString();
3150
- }
3151
- yearElement.value = d.getFullYear().toString();
3152
- });
3153
- self._hidePrevMonthArrow =
3154
- self.config.minDate !== undefined &&
3155
- (self.currentYear === self.config.minDate.getFullYear()
3156
- ? self.currentMonth <= self.config.minDate.getMonth()
3157
- : self.currentYear < self.config.minDate.getFullYear());
3158
- self._hideNextMonthArrow =
3159
- self.config.maxDate !== undefined &&
3160
- (self.currentYear === self.config.maxDate.getFullYear()
3161
- ? self.currentMonth + 1 > self.config.maxDate.getMonth()
3162
- : self.currentYear > self.config.maxDate.getFullYear());
3163
- }
3164
- function getDateStr(specificFormat) {
3165
- var format = specificFormat ||
3166
- (self.config.altInput ? self.config.altFormat : self.config.dateFormat);
3167
- return self.selectedDates
3168
- .map(function (dObj) { return self.formatDate(dObj, format); })
3169
- .filter(function (d, i, arr) {
3170
- return self.config.mode !== "range" ||
3171
- self.config.enableTime ||
3172
- arr.indexOf(d) === i;
3173
- })
3174
- .join(self.config.mode !== "range"
3175
- ? self.config.conjunction
3176
- : self.l10n.rangeSeparator);
3177
- }
3178
- /**
3179
- * Updates the values of inputs associated with the calendar
3180
- */
3181
- function updateValue(triggerChange) {
3182
- if (triggerChange === void 0) { triggerChange = true; }
3183
- if (self.mobileInput !== undefined && self.mobileFormatStr) {
3184
- self.mobileInput.value =
3185
- self.latestSelectedDateObj !== undefined
3186
- ? self.formatDate(self.latestSelectedDateObj, self.mobileFormatStr)
3187
- : "";
3188
- }
3189
- self.input.value = getDateStr(self.config.dateFormat);
3190
- if (self.altInput !== undefined) {
3191
- self.altInput.value = getDateStr(self.config.altFormat);
3192
- }
3193
- if (triggerChange !== false)
3194
- triggerEvent("onValueUpdate");
3195
- }
3196
- function onMonthNavClick(e) {
3197
- var eventTarget = getEventTarget(e);
3198
- var isPrevMonth = self.prevMonthNav.contains(eventTarget);
3199
- var isNextMonth = self.nextMonthNav.contains(eventTarget);
3200
- if (isPrevMonth || isNextMonth) {
3201
- changeMonth(isPrevMonth ? -1 : 1);
3202
- }
3203
- else if (self.yearElements.indexOf(eventTarget) >= 0) {
3204
- eventTarget.select();
3205
- }
3206
- else if (eventTarget.classList.contains("arrowUp")) {
3207
- self.changeYear(self.currentYear + 1);
3208
- }
3209
- else if (eventTarget.classList.contains("arrowDown")) {
3210
- self.changeYear(self.currentYear - 1);
3211
- }
3212
- }
3213
- function timeWrapper(e) {
3214
- e.preventDefault();
3215
- var isKeyDown = e.type === "keydown", eventTarget = getEventTarget(e), input = eventTarget;
3216
- if (self.amPM !== undefined && eventTarget === self.amPM) {
3217
- self.amPM.textContent =
3218
- self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];
3219
- }
3220
- var min = parseFloat(input.getAttribute("min")), max = parseFloat(input.getAttribute("max")), step = parseFloat(input.getAttribute("step")), curValue = parseInt(input.value, 10), delta = e.delta ||
3221
- (isKeyDown ? (e.which === 38 ? 1 : -1) : 0);
3222
- var newValue = curValue + step * delta;
3223
- if (typeof input.value !== "undefined" && input.value.length === 2) {
3224
- var isHourElem = input === self.hourElement, isMinuteElem = input === self.minuteElement;
3225
- if (newValue < min) {
3226
- newValue =
3227
- max +
3228
- newValue +
3229
- int(!isHourElem) +
3230
- (int(isHourElem) && int(!self.amPM));
3231
- if (isMinuteElem)
3232
- incrementNumInput(undefined, -1, self.hourElement);
3233
- }
3234
- else if (newValue > max) {
3235
- newValue =
3236
- input === self.hourElement ? newValue - max - int(!self.amPM) : min;
3237
- if (isMinuteElem)
3238
- incrementNumInput(undefined, 1, self.hourElement);
3239
- }
3240
- if (self.amPM &&
3241
- isHourElem &&
3242
- (step === 1
3243
- ? newValue + curValue === 23
3244
- : Math.abs(newValue - curValue) > step)) {
3245
- self.amPM.textContent =
3246
- self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];
3247
- }
3248
- input.value = pad(newValue);
3249
- }
3250
- }
3251
- init();
3252
- return self;
3253
- }
3254
- /* istanbul ignore next */
3255
- function _flatpickr(nodeList, config) {
3256
- // static list
3257
- var nodes = Array.prototype.slice
3258
- .call(nodeList)
3259
- .filter(function (x) { return x instanceof HTMLElement; });
3260
- var instances = [];
3261
- for (var i = 0; i < nodes.length; i++) {
3262
- var node = nodes[i];
3263
- try {
3264
- if (node.getAttribute("data-fp-omit") !== null)
3265
- continue;
3266
- if (node._flatpickr !== undefined) {
3267
- node._flatpickr.destroy();
3268
- node._flatpickr = undefined;
3269
- }
3270
- node._flatpickr = FlatpickrInstance(node, config || {});
3271
- instances.push(node._flatpickr);
3272
- }
3273
- catch (e) {
3274
- console.error(e);
3275
- }
3276
- }
3277
- return instances.length === 1 ? instances[0] : instances;
3278
- }
3279
- /* istanbul ignore next */
3280
- if (typeof HTMLElement !== "undefined" &&
3281
- typeof HTMLCollection !== "undefined" &&
3282
- typeof NodeList !== "undefined") {
3283
- // browser env
3284
- HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (config) {
3285
- return _flatpickr(this, config);
3286
- };
3287
- HTMLElement.prototype.flatpickr = function (config) {
3288
- return _flatpickr([this], config);
3289
- };
3290
- }
3291
- /* istanbul ignore next */
3292
- var flatpickr = function (selector, config) {
3293
- if (typeof selector === "string") {
3294
- return _flatpickr(window.document.querySelectorAll(selector), config);
3295
- }
3296
- else if (selector instanceof Node) {
3297
- return _flatpickr([selector], config);
3298
- }
3299
- else {
3300
- return _flatpickr(selector, config);
3301
- }
3302
- };
3303
- /* istanbul ignore next */
3304
- flatpickr.defaultConfig = {};
3305
- flatpickr.l10ns = {
3306
- en: __assign({}, english),
3307
- default: __assign({}, english),
3308
- };
3309
- flatpickr.localize = function (l10n) {
3310
- flatpickr.l10ns.default = __assign(__assign({}, flatpickr.l10ns.default), l10n);
3311
- };
3312
- flatpickr.setDefaults = function (config) {
3313
- flatpickr.defaultConfig = __assign(__assign({}, flatpickr.defaultConfig), config);
3314
- };
3315
- flatpickr.parseDate = createDateParser({});
3316
- flatpickr.formatDate = createDateFormatter({});
3317
- flatpickr.compareDates = compareDates;
3318
- /* istanbul ignore next */
3319
- if (typeof jQuery !== "undefined" && typeof jQuery.fn !== "undefined") {
3320
- jQuery.fn.flatpickr = function (config) {
3321
- return _flatpickr(this, config);
3322
- };
3323
- }
3324
- Date.prototype.fp_incr = function (days) {
3325
- return new Date(this.getFullYear(), this.getMonth(), this.getDate() + (typeof days === "string" ? parseInt(days, 10) : days));
3326
- };
3327
- if (typeof window !== "undefined") {
3328
- window.flatpickr = flatpickr;
3329
- }
3330
-
3331
- return flatpickr;
3332
-
3333
- })));
3334
-
3335
- },{}],6:[function(require,module,exports){
3336
615
  /*
3337
616
  * International Telephone Input v16.1.0
3338
617
  * https://github.com/jackocnr/intl-tel-input.git
@@ -4664,13 +1943,13 @@ var hj=window.customElements,ij=!1,jj=null;hj.polyfillWrapFlushCallback&&hj.poly
4664
1943
  };
4665
1944
  }();
4666
1945
  });
4667
- },{}],7:[function(require,module,exports){
1946
+ },{}],6:[function(require,module,exports){
4668
1947
  /**
4669
1948
  * Exposing intl-tel-input as a component
4670
1949
  */
4671
1950
  module.exports = require("./build/js/intlTelInput");
4672
1951
 
4673
- },{"./build/js/intlTelInput":6}],8:[function(require,module,exports){
1952
+ },{"./build/js/intlTelInput":5}],7:[function(require,module,exports){
4674
1953
  // shim for using process in browser
4675
1954
  var process = module.exports = {};
4676
1955
 
@@ -4856,7 +2135,7 @@ process.chdir = function (dir) {
4856
2135
  };
4857
2136
  process.umask = function() { return 0; };
4858
2137
 
4859
- },{}],9:[function(require,module,exports){
2138
+ },{}],8:[function(require,module,exports){
4860
2139
  (function (setImmediate,clearImmediate){(function (){
4861
2140
  var nextTick = require('process/browser.js').nextTick;
4862
2141
  var apply = Function.prototype.apply;
@@ -4936,7 +2215,7 @@ exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate :
4936
2215
  };
4937
2216
  }).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate)
4938
2217
 
4939
- },{"process/browser.js":8,"timers":9}],10:[function(require,module,exports){
2218
+ },{"process/browser.js":7,"timers":8}],9:[function(require,module,exports){
4940
2219
  "use strict";
4941
2220
  Object.defineProperty(exports, "__esModule", { value: true });
4942
2221
  exports.CustomForm = void 0;
@@ -5088,7 +2367,7 @@ var CustomForm = /** @class */ (function () {
5088
2367
  }());
5089
2368
  exports.CustomForm = CustomForm;
5090
2369
 
5091
- },{"./elements/FileField/FileFieldElement":22,"./framework/Utilities/ArrayUtil":58,"./framework/Utilities/MakeRequest":61}],11:[function(require,module,exports){
2370
+ },{"./elements/FileField/FileFieldElement":25,"./framework/Utilities/ArrayUtil":61,"./framework/Utilities/MakeRequest":64}],10:[function(require,module,exports){
5092
2371
  "use strict";
5093
2372
  var __extends = (this && this.__extends) || (function () {
5094
2373
  var extendStatics = function (d, b) {
@@ -5296,7 +2575,7 @@ var AddressElement = /** @class */ (function (_super) {
5296
2575
  }(CustomInputElement_1.CustomInputElement));
5297
2576
  exports.AddressElement = AddressElement;
5298
2577
 
5299
- },{"../../framework/CustomEvents":34,"../../framework/CustomInputElement":35,"../../framework/Language/Translator":56,"../../framework/Polyfills/getAttributeNamesPolyfill":57,"../../framework/Utilities/debouncer":64,"../../framework/custom-element.decorator":73}],12:[function(require,module,exports){
2578
+ },{"../../framework/CustomEvents":37,"../../framework/CustomInputElement":38,"../../framework/Language/Translator":59,"../../framework/Polyfills/getAttributeNamesPolyfill":60,"../../framework/Utilities/debouncer":67,"../../framework/custom-element.decorator":76}],11:[function(require,module,exports){
5300
2579
  "use strict";
5301
2580
  var __extends = (this && this.__extends) || (function () {
5302
2581
  var extendStatics = function (d, b) {
@@ -5425,7 +2704,7 @@ var BankFieldElement = /** @class */ (function (_super) {
5425
2704
  }(CustomInputElement_1.CustomInputElement));
5426
2705
  exports.BankFieldElement = BankFieldElement;
5427
2706
 
5428
- },{"../../framework/CustomEvents":34,"../../framework/CustomInputElement":35,"../../framework/Language/Translator":56,"../../framework/Validation/Validators/BankAccount":65,"../../framework/Validation/Validators/BankAccountRegistrationNumber":66,"../../framework/custom-element.decorator":73}],13:[function(require,module,exports){
2707
+ },{"../../framework/CustomEvents":37,"../../framework/CustomInputElement":38,"../../framework/Language/Translator":59,"../../framework/Validation/Validators/BankAccount":68,"../../framework/Validation/Validators/BankAccountRegistrationNumber":69,"../../framework/custom-element.decorator":76}],12:[function(require,module,exports){
5429
2708
  "use strict";
5430
2709
  var __extends = (this && this.__extends) || (function () {
5431
2710
  var extendStatics = function (d, b) {
@@ -5509,7 +2788,7 @@ var CPRElement = /** @class */ (function (_super) {
5509
2788
  }(CustomInputElement_1.CustomInputElement));
5510
2789
  exports.CPRElement = CPRElement;
5511
2790
 
5512
- },{"../../framework/CustomEvents":34,"../../framework/CustomInputElement":35,"../../framework/Validation/Validators/CPR":69,"../../framework/custom-element.decorator":73}],14:[function(require,module,exports){
2791
+ },{"../../framework/CustomEvents":37,"../../framework/CustomInputElement":38,"../../framework/Validation/Validators/CPR":72,"../../framework/custom-element.decorator":76}],13:[function(require,module,exports){
5513
2792
  "use strict";
5514
2793
  var __extends = (this && this.__extends) || (function () {
5515
2794
  var extendStatics = function (d, b) {
@@ -5593,7 +2872,7 @@ var CVRElement = /** @class */ (function (_super) {
5593
2872
  }(CustomInputElement_1.CustomInputElement));
5594
2873
  exports.CVRElement = CVRElement;
5595
2874
 
5596
- },{"../../framework/CustomEvents":34,"../../framework/CustomInputElement":35,"../../framework/Validation/Validators/CVR":70,"../../framework/custom-element.decorator":73}],15:[function(require,module,exports){
2875
+ },{"../../framework/CustomEvents":37,"../../framework/CustomInputElement":38,"../../framework/Validation/Validators/CVR":73,"../../framework/custom-element.decorator":76}],14:[function(require,module,exports){
5597
2876
  "use strict";
5598
2877
  var __extends = (this && this.__extends) || (function () {
5599
2878
  var extendStatics = function (d, b) {
@@ -5691,7 +2970,588 @@ var CheckBoxElement = /** @class */ (function (_super) {
5691
2970
  }(CustomInputElement_1.CustomInputElement));
5692
2971
  exports.CheckBoxElement = CheckBoxElement;
5693
2972
 
5694
- },{"../../framework/CustomEvents":34,"../../framework/CustomInputElement":35,"../../framework/Utilities/StringUtil":62,"../../framework/custom-element.decorator":73}],16:[function(require,module,exports){
2973
+ },{"../../framework/CustomEvents":37,"../../framework/CustomInputElement":38,"../../framework/Utilities/StringUtil":65,"../../framework/custom-element.decorator":76}],15:[function(require,module,exports){
2974
+ "use strict";
2975
+ Object.defineProperty(exports, "__esModule", { value: true });
2976
+ var CustomDatepickerStyles_1 = require("./CustomDatepickerStyles");
2977
+ var CustomDatepickerUtils_1 = require("./CustomDatepickerUtils");
2978
+ var DatepickerTranslations_1 = require("./DatepickerTranslations");
2979
+ var CustomDatepicker = /** @class */ (function () {
2980
+ function CustomDatepicker(options) {
2981
+ this.months = [];
2982
+ this.daysOfWeek = [];
2983
+ this.input = options.input;
2984
+ this.dateFormat = CustomDatepickerUtils_1.supportedDateFormats.includes(options.dateFormat) ? options.dateFormat : CustomDatepickerUtils_1.defaultDateFormat;
2985
+ this.otherTriggers = options.otherTriggers || [];
2986
+ this.parentElement = options.parentElement;
2987
+ this.currentDate = new Date();
2988
+ this.currentMonth = this.currentDate.getMonth();
2989
+ this.currentYear = this.currentDate.getFullYear();
2990
+ this.selectedDate = new Date();
2991
+ this.selectedMonth = this.selectedDate.getMonth();
2992
+ this.selectedYear = this.selectedDate.getFullYear();
2993
+ this.selectedDay = this.selectedDate.getDate();
2994
+ this.firstDayOfMonth = new Date(this.currentYear, this.currentMonth, 1);
2995
+ this.lastDayOfMonth = new Date(this.currentYear, this.currentMonth + 1, 0);
2996
+ this.firstDay = this.firstDayOfMonth.getDay();
2997
+ this.lastDay = this.lastDayOfMonth.getDate();
2998
+ this.months = (0, DatepickerTranslations_1.GetMonths)(options.language);
2999
+ this.daysOfWeek = (0, DatepickerTranslations_1.GetWeekdays)(options.language, 'short');
3000
+ this.createDatePickerElements();
3001
+ this.renderCalendar();
3002
+ this.initSelectMonthYear();
3003
+ this.addEventListeners();
3004
+ }
3005
+ CustomDatepicker.prototype.createDatePickerElements = function () {
3006
+ var _this = this;
3007
+ this.datepicker = document.createElement('div');
3008
+ this.datepicker.classList.add('datepicker');
3009
+ this.header = document.createElement('div');
3010
+ this.header.classList.add('header');
3011
+ this.monthYear = document.createElement('span');
3012
+ this.monthYear.classList.add('month-year');
3013
+ this.monthYear.onclick = function () { return _this.toggleSelectMonthYear(); };
3014
+ this.selectNextMonth = document.createElement('span');
3015
+ this.selectNextMonth.classList.add('next-month');
3016
+ this.selectNextMonth.innerHTML = '&#9654;';
3017
+ this.selectNextMonth.onclick = function () { return _this.moveMonth(1); };
3018
+ this.selectPrevMonth = document.createElement('span');
3019
+ this.selectPrevMonth.classList.add('prev-month');
3020
+ this.selectPrevMonth.innerHTML = '&#9664;';
3021
+ this.selectPrevMonth.onclick = function () { return _this.moveMonth(-1); };
3022
+ this.header.appendChild(this.selectPrevMonth);
3023
+ this.header.appendChild(this.monthYear);
3024
+ this.header.appendChild(this.selectNextMonth);
3025
+ this.weekdays = document.createElement('div');
3026
+ this.weekdays.classList.add('weekdays');
3027
+ this.days = document.createElement('div');
3028
+ this.days.classList.add('days');
3029
+ this.selectMonthYear = document.createElement('div');
3030
+ this.selectMonthYear.classList.add('select-month-year');
3031
+ this.selectDate = document.createElement('div');
3032
+ this.selectDate.classList.add('select-date');
3033
+ this.datepicker.appendChild(this.header);
3034
+ this.datepicker.appendChild(this.selectDate);
3035
+ this.selectDate.appendChild(this.weekdays);
3036
+ this.selectDate.appendChild(this.days);
3037
+ this.datepicker.appendChild(this.selectMonthYear);
3038
+ var actions = document.createElement('div');
3039
+ actions.classList.add('actions');
3040
+ this.selectDate.appendChild(actions);
3041
+ var cancel = document.createElement('input');
3042
+ cancel.type = 'reset';
3043
+ cancel.value = 'Cancel';
3044
+ cancel.onclick = function () { return _this.showPicker(false); };
3045
+ actions.appendChild(cancel);
3046
+ var today = document.createElement('input');
3047
+ today.type = 'reset';
3048
+ today.value = 'Today';
3049
+ today.onclick = function () { return _this.setDateForToday(); };
3050
+ actions.appendChild(today);
3051
+ if (this.input.parentElement) {
3052
+ this.input.parentElement.appendChild(this.datepicker);
3053
+ }
3054
+ else {
3055
+ document.body.appendChild(this.datepicker);
3056
+ }
3057
+ this.applyStyles();
3058
+ };
3059
+ CustomDatepicker.prototype.applyStyles = function () {
3060
+ var style = document.createElement('style');
3061
+ style.innerHTML = CustomDatepickerStyles_1.CustomDatepickerStyles;
3062
+ this.datepicker.appendChild(style);
3063
+ };
3064
+ CustomDatepicker.prototype.moveMonth = function (steps) {
3065
+ var newMonth = this.currentMonth + steps;
3066
+ var newYear = this.currentYear;
3067
+ if (newMonth < 0) {
3068
+ newYear = this.currentYear + Math.floor(newMonth / 12);
3069
+ newMonth = 12 + (newMonth % 12);
3070
+ }
3071
+ else if (newMonth > 11) {
3072
+ newYear = this.currentYear + Math.floor(newMonth / 12);
3073
+ newMonth = newMonth % 12;
3074
+ }
3075
+ this.currentMonth = newMonth;
3076
+ this.currentYear = newYear;
3077
+ this.firstDayOfMonth = new Date(this.currentYear, this.currentMonth, 1);
3078
+ this.lastDayOfMonth = new Date(this.currentYear, this.currentMonth + 1, 0);
3079
+ this.firstDay = this.firstDayOfMonth.getDay();
3080
+ this.lastDay = this.lastDayOfMonth.getDate();
3081
+ this.renderCalendar();
3082
+ };
3083
+ CustomDatepicker.prototype.renderCalendar = function () {
3084
+ var _this = this;
3085
+ this.monthYear.innerHTML = this.months[this.currentMonth] + ' ' + this.currentYear;
3086
+ this.weekdays.innerHTML = '';
3087
+ for (var i = 0; i < this.daysOfWeek.length; i++) {
3088
+ var span = document.createElement('span');
3089
+ span.innerHTML = this.daysOfWeek[i];
3090
+ this.weekdays.appendChild(span);
3091
+ }
3092
+ this.days.innerHTML = '';
3093
+ var _loop_1 = function (i) {
3094
+ var span = document.createElement('span');
3095
+ if (i < this_1.firstDay) {
3096
+ span.classList.add('day-of-previous-month');
3097
+ span.style.color = '#ccc';
3098
+ var currentDate = new Date(this_1.currentYear, this_1.currentMonth, 0);
3099
+ span.innerHTML = (currentDate.getDate() - this_1.firstDay + i + 1).toString();
3100
+ }
3101
+ else if (i < this_1.lastDay + this_1.firstDay) {
3102
+ span.classList.add('day-of-current-month');
3103
+ span.innerHTML = (i - this_1.firstDay + 1).toString();
3104
+ if (i - this_1.firstDay + 1 === this_1.selectedDay && this_1.currentMonth === this_1.selectedMonth && this_1.currentYear === this_1.selectedYear) {
3105
+ span.classList.add('selected-day');
3106
+ }
3107
+ }
3108
+ else {
3109
+ span.classList.add('day-of-next-month');
3110
+ span.style.color = '#ccc';
3111
+ span.innerHTML = (i - this_1.lastDay - this_1.firstDay + 1).toString();
3112
+ }
3113
+ span.onclick = function () {
3114
+ var moveMonthSteps = 0;
3115
+ _this.selectedDay = parseInt(span.innerHTML);
3116
+ if (span.classList.contains('day-of-previous-month')) {
3117
+ _this.selectedMonth = _this.currentMonth - 1;
3118
+ _this.selectedYear = _this.currentYear;
3119
+ moveMonthSteps = -1;
3120
+ }
3121
+ else if (span.classList.contains('day-of-current-month')) {
3122
+ _this.selectedMonth = _this.currentMonth;
3123
+ _this.selectedYear = _this.currentYear;
3124
+ }
3125
+ else {
3126
+ _this.selectedMonth = _this.currentMonth + 1;
3127
+ _this.selectedYear = _this.currentYear;
3128
+ moveMonthSteps = 1;
3129
+ }
3130
+ _this.selectedDate = new Date(_this.selectedYear, _this.selectedMonth, _this.selectedDay);
3131
+ var selectedDayElement = _this.days.querySelector('.selected-day');
3132
+ if (selectedDayElement) {
3133
+ selectedDayElement.classList.remove('selected-day');
3134
+ }
3135
+ span.classList.add('selected-day');
3136
+ var formattedDate = (0, CustomDatepickerUtils_1.formatDate)(_this.selectedDate, _this.dateFormat);
3137
+ _this.input.value = formattedDate;
3138
+ _this.showPicker(false);
3139
+ };
3140
+ this_1.days.appendChild(span);
3141
+ };
3142
+ var this_1 = this;
3143
+ for (var i = 0; i < 42; i++) {
3144
+ _loop_1(i);
3145
+ }
3146
+ this.positionPicker();
3147
+ };
3148
+ CustomDatepicker.prototype.initSelectMonthYear = function () {
3149
+ var _this = this;
3150
+ this.selectMonthYear.style.display = 'none';
3151
+ this.selectMonthYear.style.height = '200px';
3152
+ if ((0, CustomDatepickerUtils_1.isMobileDevice)()) {
3153
+ this.selectMonthYear.style.height = '300px';
3154
+ }
3155
+ this.selectMonthYear.innerHTML = '';
3156
+ var monthsContainer = document.createElement('div');
3157
+ monthsContainer.classList.add('months');
3158
+ var _loop_2 = function (i) {
3159
+ var span = document.createElement('span');
3160
+ span.innerHTML = this_2.months[i].substring(0, 3);
3161
+ span.classList.add('select-month');
3162
+ monthsContainer.appendChild(span);
3163
+ span.onclick = function () {
3164
+ _this.selectedMonth = _this.months.findIndex(function (month) { return month.substring(0, 3) === span.innerHTML; });
3165
+ var moveMonthSteps = (_this.selectedYear - _this.currentYear) * 12 + _this.selectedMonth - _this.currentMonth;
3166
+ _this.moveMonth(moveMonthSteps);
3167
+ _this.hideSelectMonthYear();
3168
+ };
3169
+ };
3170
+ var this_2 = this;
3171
+ for (var i = 0; i < this.months.length; i++) {
3172
+ _loop_2(i);
3173
+ }
3174
+ for (var i = this.currentYear - 100; i < this.currentYear + 100; i++) {
3175
+ var year = document.createElement('div');
3176
+ year.classList.add('year');
3177
+ year.innerHTML = i.toString();
3178
+ this.selectMonthYear.appendChild(year);
3179
+ if (i === this.currentYear) {
3180
+ year.appendChild(monthsContainer);
3181
+ }
3182
+ }
3183
+ var years = this.selectMonthYear.querySelectorAll('.year');
3184
+ var tempSelectedYear = this.selectedYear;
3185
+ var _loop_3 = function (i) {
3186
+ years[i].addEventListener('click', function () {
3187
+ var year = parseInt(years[i].innerHTML);
3188
+ if (year === tempSelectedYear) {
3189
+ return;
3190
+ }
3191
+ else {
3192
+ tempSelectedYear = year;
3193
+ _this.selectedYear = year;
3194
+ var monthsContainers = _this.selectMonthYear.querySelectorAll('.months');
3195
+ for (var i_1 = 0; i_1 < monthsContainers.length; i_1++) {
3196
+ monthsContainers[i_1].remove();
3197
+ }
3198
+ years[i].appendChild(monthsContainer);
3199
+ }
3200
+ });
3201
+ };
3202
+ for (var i = 0; i < years.length; i++) {
3203
+ _loop_3(i);
3204
+ }
3205
+ };
3206
+ CustomDatepicker.prototype.toggleSelectMonthYear = function () {
3207
+ if (this.selectMonthYear.style.display === 'none') {
3208
+ this.selectDate.style.display = 'none';
3209
+ this.selectMonthYear.style.display = 'block';
3210
+ this.header.style.color = '#ccc';
3211
+ var years = this.selectMonthYear.querySelectorAll('.year');
3212
+ for (var i = 0; i < years.length; i++) {
3213
+ if (years[i].querySelector('.months')) {
3214
+ years[i].scrollIntoView();
3215
+ break;
3216
+ }
3217
+ }
3218
+ }
3219
+ else {
3220
+ this.hideSelectMonthYear();
3221
+ }
3222
+ };
3223
+ CustomDatepicker.prototype.hideSelectMonthYear = function () {
3224
+ this.selectDate.style.display = 'block';
3225
+ this.selectMonthYear.style.display = 'none';
3226
+ this.header.style.color = '#000';
3227
+ };
3228
+ CustomDatepicker.prototype.showPicker = function (showpicker) {
3229
+ if (showpicker === void 0) { showpicker = true; }
3230
+ if (showpicker) {
3231
+ this.positionPicker();
3232
+ this.datepicker.style.display = 'block';
3233
+ }
3234
+ else {
3235
+ this.datepicker.style.display = 'none';
3236
+ this.hideSelectMonthYear();
3237
+ return;
3238
+ }
3239
+ };
3240
+ CustomDatepicker.prototype.positionPicker = function () {
3241
+ this.datepicker.style.position = 'fixed';
3242
+ var datepickerHeight = 250;
3243
+ if ((0, CustomDatepickerUtils_1.isMobileDevice)()) {
3244
+ this.datepicker.style.height = '400px';
3245
+ this.datepicker.style.top = '50%';
3246
+ this.datepicker.style.left = '50%';
3247
+ this.datepicker.style.transform = 'translate(-50%, -50%)';
3248
+ this.datepicker.style.width = '90%';
3249
+ this.datepicker.style.maxWidth = '300px';
3250
+ this.datepicker.style.fontSize = '16px';
3251
+ this.datepicker.style.padding = '30px';
3252
+ this.header.style.marginBottom = '20px';
3253
+ var weekdaysSpans = this.weekdays.querySelectorAll('span');
3254
+ var daysSpans = this.days.querySelectorAll('span');
3255
+ weekdaysSpans.forEach(function (span) { return span.style.marginBottom = '10px'; });
3256
+ daysSpans.forEach(function (span) { return span.style.marginBottom = '10px'; });
3257
+ }
3258
+ else {
3259
+ this.datepicker.style.height = datepickerHeight + 'px';
3260
+ var dateInputRect = this.input.getBoundingClientRect();
3261
+ datepickerHeight += 20;
3262
+ if (window.innerHeight - dateInputRect.bottom < datepickerHeight) {
3263
+ this.datepicker.style.top = 'auto';
3264
+ this.datepicker.style.bottom = window.innerHeight - dateInputRect.top + 'px';
3265
+ }
3266
+ else {
3267
+ this.datepicker.style.bottom = 'auto';
3268
+ this.datepicker.style.top = dateInputRect.bottom + 'px';
3269
+ }
3270
+ this.datepicker.style.left = dateInputRect.left + 'px';
3271
+ }
3272
+ };
3273
+ CustomDatepicker.prototype.setDateForToday = function () {
3274
+ this.input.value = (0, CustomDatepickerUtils_1.formatDate)(this.selectedDate, this.dateFormat);
3275
+ this.showPicker(false);
3276
+ };
3277
+ CustomDatepicker.prototype.addEventListeners = function () {
3278
+ var _this = this;
3279
+ this.input.addEventListener('click', function () { return _this.showPicker(true); });
3280
+ this.input.addEventListener('focus', function () { return _this.showPicker(true); });
3281
+ this.input.addEventListener('change', function () {
3282
+ var date = new Date(_this.input.value);
3283
+ if (date.toString() !== 'Invalid Date') {
3284
+ _this.selectedDate = date;
3285
+ _this.selectedMonth = date.getMonth();
3286
+ _this.selectedYear = date.getFullYear();
3287
+ _this.selectedDay = date.getDate();
3288
+ _this.renderCalendar();
3289
+ }
3290
+ });
3291
+ this.otherTriggers.forEach(function (trigger) {
3292
+ trigger.addEventListener('click', function () { return _this.showPicker(true); });
3293
+ });
3294
+ document.onclick = function (event) {
3295
+ var elementsToNeglect = [_this.input, _this.datepicker, _this.monthYear, _this.weekdays, _this.days, _this.header, _this.selectMonthYear];
3296
+ var element = event.target;
3297
+ var isNeglected = elementsToNeglect.includes(element) || elementsToNeglect.includes(element.parentElement) || (element).classList.contains('select-month') || element === _this.parentElement;
3298
+ if (!isNeglected) {
3299
+ _this.showPicker(false);
3300
+ }
3301
+ };
3302
+ };
3303
+ return CustomDatepicker;
3304
+ }());
3305
+ exports.default = CustomDatepicker;
3306
+
3307
+ },{"./CustomDatepickerStyles":16,"./CustomDatepickerUtils":17,"./DatepickerTranslations":18}],16:[function(require,module,exports){
3308
+ "use strict";
3309
+ Object.defineProperty(exports, "__esModule", { value: true });
3310
+ exports.CustomDatepickerStyles = void 0;
3311
+ exports.CustomDatepickerStyles = "\n .datepicker {\n position: fixed;\n background-color: #fff;\n display: none;\n width: 200px;\n border: 1px solid #ccc;\n border-radius: 5px;\n padding: 10px;\n margin: 0 auto;\n box-shadow: 0 0 10px 0 #ccc;\n font: 12px Arial, sans-serif;\n }\n\n .header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 10px;\n }\n .weekdays {\n display: flex;\n justify-content: space-between;\n }\n .weekdays span {\n width: 14.28%;\n text-align: center;\n padding: 5px 0;\n }\n .days {\n display: flex;\n flex-wrap: wrap;\n }\n .days span {\n width: 14.28%;\n text-align: center;\n padding: 5px 0;\n }\n .days span:hover {\n background-color: #B2d5ff;\n cursor: pointer;\n }\n .days span.today {\n border: 1px solid #000;\n }\n .days span.selected-day {\n background-color: #0075ff;\n color: #fff;\n }\n .prev-month, .next-month {\n cursor: pointer;\n }\n .month-year {\n font-weight: bold;\n }\n .month-year:hover {\n cursor: pointer;\n }\n .select-month-year {\n display: none;\n width: 100%;\n overflow-y: auto;\n }\n .select-month-year .year {\n text-align: center;\n background-color: #f0f0f0;\n border-bottom: 1px solid #3f3d3d;\n padding: 5px 0;\n cursor: pointer;\n }\n .select-month-year .year .months {\n display: flex;\n flex-wrap: wrap;\n }\n .select-month-year .year .months span {\n width: 25%;\n text-align: center;\n padding: 10px 0;\n background-color: #fff;\n }\n .select-month-year .year .months span:hover {\n background-color: #B2d5ff;\n cursor: pointer;\n }\n .actions {\n display: flex;\n justify-content: space-between;\n margin-top: 10px;\n }\n .actions input {\n color: #0075ff;\n border: none;\n background-color: transparent;\n padding: 5px;\n border: 1px solid transparent;\n }\n .actions input:hover {\n background-color: #B2d5ff;\n border-color: #000;\n }\n";
3312
+
3313
+ },{}],17:[function(require,module,exports){
3314
+ "use strict";
3315
+ Object.defineProperty(exports, "__esModule", { value: true });
3316
+ exports.isMobileDevice = exports.formatDate = exports.supportedDateFormats = exports.defaultDateFormat = exports.daysOfWeek = exports.months = void 0;
3317
+ exports.months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
3318
+ exports.daysOfWeek = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
3319
+ exports.defaultDateFormat = 'yyyy-mm-dd';
3320
+ exports.supportedDateFormats = [
3321
+ 'ddmmyyyy',
3322
+ 'mmddyyyy',
3323
+ 'dd/mm/yyyy',
3324
+ 'mm/dd/yyyy',
3325
+ 'dd-mm-yyyy',
3326
+ 'mm-dd-yyyy',
3327
+ 'yyyy-mm-dd',
3328
+ 'yyyy-dd-mm',
3329
+ 'Month dd, yyyy',
3330
+ 'mm/dd/yy',
3331
+ 'dd/mm/yy',
3332
+ ];
3333
+ function formatDate(date, dateFormat) {
3334
+ var year = date.getFullYear();
3335
+ var month = (date.getMonth() + 1).toString().padStart(2, '0');
3336
+ var day = date.getDate().toString().padStart(2, '0');
3337
+ var monthName = date.toLocaleString('default', { month: 'long' });
3338
+ var dateFormats = {
3339
+ 'ddmmyyyy': "" + day + month + year,
3340
+ 'mmddyyyy': "" + month + day + year,
3341
+ 'dd/mm/yyyy': day + "/" + month + "/" + year,
3342
+ 'mm/dd/yyyy': month + "/" + day + "/" + year,
3343
+ 'dd-mm-yyyy': day + "-" + month + "-" + year,
3344
+ 'mm-dd-yyyy': month + "-" + day + "-" + year,
3345
+ 'yyyy-mm-dd': year + "-" + month + "-" + day,
3346
+ 'yyyy-dd-mm': year + "-" + day + "-" + month,
3347
+ 'Month dd, yyyy': monthName + " " + day + ", " + year,
3348
+ 'mm/dd/yy': month + "/" + day + "/" + year.toString().slice(-2),
3349
+ 'dd/mm/yy': day + "/" + month + "/" + year.toString().slice(-2),
3350
+ };
3351
+ return dateFormats[dateFormat];
3352
+ }
3353
+ exports.formatDate = formatDate;
3354
+ function isMobileDevice() {
3355
+ return /Android|webOS|iPhone|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth < 480;
3356
+ }
3357
+ exports.isMobileDevice = isMobileDevice;
3358
+
3359
+ },{}],18:[function(require,module,exports){
3360
+ "use strict";
3361
+ Object.defineProperty(exports, "__esModule", { value: true });
3362
+ exports.GetMonths = exports.GetWeekdays = void 0;
3363
+ function GetWeekdays(language, type) {
3364
+ if (language === void 0) { language = 'en'; }
3365
+ if (type === void 0) { type = 'wide'; }
3366
+ language = supportedLanguages.includes(language) ? language : 'en';
3367
+ return weekdays[language][type];
3368
+ }
3369
+ exports.GetWeekdays = GetWeekdays;
3370
+ function GetMonths(language, type) {
3371
+ if (language === void 0) { language = 'en'; }
3372
+ if (type === void 0) { type = 'wide'; }
3373
+ language = supportedLanguages.includes(language) ? language : 'en';
3374
+ return months[language][type];
3375
+ }
3376
+ exports.GetMonths = GetMonths;
3377
+ var supportedLanguages = ['en', 'sv', 'de', 'fr', 'it', 'es', 'cs', 'pt', 'pl', 'nl', 'no', 'da', 'el', 'fi', 'is', 'et', 'lv', 'lt', 'hu'];
3378
+ var weekdays = {
3379
+ 'en': {
3380
+ 'short': ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
3381
+ 'abbreviated': ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
3382
+ 'wide': ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
3383
+ },
3384
+ 'sv': {
3385
+ 'short': ['sö', 'må', 'ti', 'on', 'to', 'fr', 'lö'],
3386
+ 'abbreviated': ['sön', 'mån', 'tis', 'ons', 'tor', 'fre', 'lör'],
3387
+ 'wide': ['söndag', 'måndag', 'tisdag', 'onsdag', 'torsdag', 'fredag', 'lördag']
3388
+ },
3389
+ 'de': {
3390
+ 'short': ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
3391
+ 'abbreviated': ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
3392
+ 'wide': ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag']
3393
+ },
3394
+ 'fr': {
3395
+ 'short': ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'],
3396
+ 'abbreviated': ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],
3397
+ 'wide': ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi']
3398
+ },
3399
+ 'it': {
3400
+ 'short': ['do', 'lu', 'ma', 'me', 'gi', 've', 'sa'],
3401
+ 'abbreviated': ['dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab'],
3402
+ 'wide': ['domenica', 'lunedì', 'martedì', 'mercoledì', 'giovedì', 'venerdì', 'sabato']
3403
+ },
3404
+ 'es': {
3405
+ 'short': ['do', 'lu', 'ma', 'mi', 'ju', 'vi', 'sá'],
3406
+ 'abbreviated': ['dom', 'lun', 'mar', 'mié', 'jue', 'vie', 'sáb'],
3407
+ 'wide': ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado']
3408
+ },
3409
+ 'cs': {
3410
+ 'short': ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],
3411
+ 'abbreviated': ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],
3412
+ 'wide': ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota']
3413
+ },
3414
+ 'pt': {
3415
+ 'short': ['do', '2ª', '3ª', '4ª', '5ª', '6ª', 'sá'],
3416
+ 'abbreviated': ['dom', '2ª', '3ª', '4ª', '5ª', '6ª', 'sáb'],
3417
+ 'wide': ['domingo', 'segunda-feira', 'terça-feira', 'quarta-feira', 'quinta-feira', 'sexta-feira', 'sábado']
3418
+ },
3419
+ 'pl': {
3420
+ 'short': ['nd', 'pn', 'wt', 'śr', 'cz', 'pt', 'so'],
3421
+ 'abbreviated': ['nd', 'pn', 'wt', 'śr', 'cz', 'pt', 'so'],
3422
+ 'wide': ['niedziela', 'poniedziałek', 'wtorek', 'środa', 'czwartek', 'piątek', 'sobota']
3423
+ },
3424
+ 'nl': {
3425
+ 'short': ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
3426
+ 'abbreviated': ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
3427
+ 'wide': ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag']
3428
+ },
3429
+ 'no': {
3430
+ 'short': ['sø', 'ma', 'ti', 'on', 'to', 'fr', 'lø'],
3431
+ 'abbreviated': ['sø', 'ma', 'ti', 'on', 'to', 'fr', 'lø'],
3432
+ 'wide': ['søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag']
3433
+ },
3434
+ 'da': {
3435
+ 'short': ['sø', 'ma', 'ti', 'on', 'to', 'fr', 'lø'],
3436
+ 'abbreviated': ['sø', 'ma', 'ti', 'on', 'to', 'fr', 'lø'],
3437
+ 'wide': ['søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag']
3438
+ },
3439
+ 'el': {
3440
+ 'short': ['Κυ', 'Δε', 'Τρ', 'Τε', 'Πε', 'Πα', 'Σα'],
3441
+ 'abbreviated': ['Κυρ', 'Δευ', 'Τρί', 'Τετ', 'Πέμ', 'Παρ', 'Σάβ'],
3442
+ 'wide': ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο']
3443
+ },
3444
+ 'fi': {
3445
+ 'short': ['su', 'ma', 'ti', 'ke', 'to', 'pe', 'la'],
3446
+ 'abbreviated': ['su', 'ma', 'ti', 'ke', 'to', 'pe', 'la'],
3447
+ 'wide': ['sunnuntai', 'maanantai', 'tiistai', 'keskiviikko', 'torstai', 'perjantai', 'lauantai']
3448
+ },
3449
+ 'is': {
3450
+ 'short': ['su', 'má', 'þr', 'mi', 'fi', 'fö', 'la'],
3451
+ 'abbreviated': ['sun', 'mán', 'þri', 'mið', 'fim', 'fös', 'lau'],
3452
+ 'wide': ['sunnudagur', 'mánudagur', 'þriðjudagur', 'miðvikudagur', 'fimmtudagur', 'föstudagur', 'laugardagur']
3453
+ },
3454
+ 'et': {
3455
+ 'short': ['P', 'E', 'T', 'K', 'N', 'R', 'L'],
3456
+ 'abbreviated': ['P', 'E', 'T', 'K', 'N', 'R', 'L'],
3457
+ 'wide': ['pühapäev', 'esmaspäev', 'teisipäev', 'kolmapäev', 'neljapäev', 'reede', 'laupäev']
3458
+ },
3459
+ 'lv': {
3460
+ 'short': ['Sv', 'P', 'O', 'T', 'C', 'Pk', 'Se'],
3461
+ 'abbreviated': ['Sv', 'P', 'O', 'T', 'C', 'Pk', 'Se'],
3462
+ 'wide': ['svētdiena', 'pirmdiena', 'otrdiena', 'trešdiena', 'ceturtdiena', 'piektdiena', 'sestdiena']
3463
+ },
3464
+ 'lt': {
3465
+ 'short': ['Sk', 'Pr', 'An', 'Tr', 'Kt', 'Pn', 'Št'],
3466
+ 'abbreviated': ['Sk', 'Pr', 'An', 'Tr', 'Kt', 'Pn', 'Št'],
3467
+ 'wide': ['sekmadienis', 'pirmadienis', 'antradienis', 'trečiadienis', 'ketvirtadienis', 'penktadienis', 'šeštadienis']
3468
+ },
3469
+ 'hu': {
3470
+ 'short': ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'],
3471
+ 'abbreviated': ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'],
3472
+ 'wide': ['vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat']
3473
+ },
3474
+ };
3475
+ var months = {
3476
+ 'en': {
3477
+ 'abbreviated': ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
3478
+ 'wide': ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
3479
+ },
3480
+ 'sv': {
3481
+ 'abbreviated': ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
3482
+ 'wide': ['januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december']
3483
+ },
3484
+ 'de': {
3485
+ 'abbreviated': ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
3486
+ 'wide': ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember']
3487
+ },
3488
+ 'fr': {
3489
+ 'abbreviated': ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'],
3490
+ 'wide': ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre']
3491
+ },
3492
+ 'it': {
3493
+ 'abbreviated': ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'],
3494
+ 'wide': ['gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre']
3495
+ },
3496
+ 'es': {
3497
+ 'abbreviated': ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic'],
3498
+ 'wide': ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre']
3499
+ },
3500
+ 'pt': {
3501
+ 'abbreviated': ['jan', 'fev', 'mar', 'abr', 'mai', 'jun', 'jul', 'ago', 'set', 'out', 'nov', 'dez'],
3502
+ 'wide': ['janeiro', 'fevereiro', 'março', 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro']
3503
+ },
3504
+ 'cs': {
3505
+ 'abbreviated': ['led', 'úno', 'bře', 'dub', 'kvě', 'čer', 'čvc', 'srp', 'zář', 'říj', 'lis', 'pro'],
3506
+ 'wide': ['leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec']
3507
+ },
3508
+ 'pl': {
3509
+ 'abbreviated': ['sty', 'lut', 'mar', 'kwi', 'maj', 'cze', 'lip', 'sie', 'wrz', 'paź', 'lis', 'gru'],
3510
+ 'wide': ['styczeń', 'luty', 'marzec', 'kwiecień', 'maj', 'czerwiec', 'lipiec', 'sierpień', 'wrzesień', 'październik', 'listopad', 'grudzień']
3511
+ },
3512
+ 'nl': {
3513
+ 'abbreviated': ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
3514
+ 'wide': ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december']
3515
+ },
3516
+ 'no': {
3517
+ 'abbreviated': ['jan', 'feb', 'mar', 'apr', 'mai', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'des'],
3518
+ 'wide': ['januar', 'februar', 'mars', 'april', 'mai', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'desember']
3519
+ },
3520
+ 'da': {
3521
+ 'abbreviated': ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
3522
+ 'wide': ['januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december']
3523
+ },
3524
+ 'el': {
3525
+ 'abbreviated': ['Ιαν', 'Φεβ', 'Μάρ', 'Απρ', 'Μάι', 'Ιούν', 'Ιούλ', 'Αύγ', 'Σεπ', 'Οκτ', 'Νοέ', 'Δεκ'],
3526
+ 'wide': ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος']
3527
+ },
3528
+ 'fi': {
3529
+ 'abbreviated': ['tammi', 'helmi', 'maalis', 'huhti', 'touko', 'kesä', 'heinä', 'elo', 'syys', 'lok', 'marras', 'joulu'],
3530
+ 'wide': ['tammikuu', 'helmikuu', 'maaliskuu', 'huhtikuu', 'toukokuu', 'kesäkuu', 'heinäkuu', 'elokuu', 'syyskuu', 'lokakuu', 'marraskuu', 'joulukuu']
3531
+ },
3532
+ 'is': {
3533
+ 'abbreviated': ['jan', 'feb', 'mar', 'apr', 'maí', 'jún', 'júl', 'ágú', 'sep', 'okt', 'nóv', 'des'],
3534
+ 'wide': ['janúar', 'febrúar', 'mars', 'apríl', 'maí', 'júní', 'júlí', 'ágúst', 'september', 'október', 'nóvember', 'desember']
3535
+ },
3536
+ 'et': {
3537
+ 'abbreviated': ['jaan', 'veebr', 'märts', 'apr', 'mai', 'juuni', 'juuli', 'aug', 'sept', 'okt', 'nov', 'dets'],
3538
+ 'wide': ['jaanuar', 'veebruar', 'märts', 'aprill', 'mai', 'juuni', 'juuli', 'august', 'september', 'oktoober', 'november', 'detsember']
3539
+ },
3540
+ 'lv': {
3541
+ 'abbreviated': ['jan', 'feb', 'mar', 'apr', 'mai', 'jūn', 'jūl', 'aug', 'sep', 'okt', 'nov', 'dec'],
3542
+ 'wide': ['janvāris', 'februāris', 'marts', 'aprīlis', 'maijs', 'jūnijs', 'jūlijs', 'augusts', 'septembris', 'oktobris', 'novembris', 'decembris']
3543
+ },
3544
+ 'lt': {
3545
+ 'abbreviated': ['sau', 'vas', 'kov', 'bal', 'geg', 'bir', 'lie', 'rugp', 'rugs', 'spal', 'lapkr', 'gruod'],
3546
+ 'wide': ['sausis', 'vasaris', 'kovas', 'balandis', 'gegužė', 'birželis', 'liepa', 'rugpjūtis', 'rugsėjis', 'spalis', 'lapkritis', 'gruodis']
3547
+ },
3548
+ 'hu': {
3549
+ 'abbreviated': ['jan', 'feb', 'már', 'ápr', 'máj', 'jún', 'júl', 'aug', 'szept', 'okt', 'nov', 'dec'],
3550
+ 'wide': ['január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus', 'szeptember', 'október', 'november', 'december']
3551
+ },
3552
+ };
3553
+
3554
+ },{}],19:[function(require,module,exports){
5695
3555
  "use strict";
5696
3556
  var __extends = (this && this.__extends) || (function () {
5697
3557
  var extendStatics = function (d, b) {
@@ -5719,26 +3579,12 @@ exports.CustomFormatDateFieldElement = void 0;
5719
3579
  var custom_element_decorator_1 = require("../../framework/custom-element.decorator");
5720
3580
  var CustomInputElement_1 = require("../../framework/CustomInputElement");
5721
3581
  var CustomEvents_1 = require("../../framework/CustomEvents");
5722
- var flatpickr = require('flatpickr');
3582
+ var CustomDatepicker_1 = require("./CustomDatepicker/CustomDatepicker");
3583
+ var CustomDatepickerUtils_1 = require("./CustomDatepicker/CustomDatepickerUtils");
5723
3584
  var CustomFormatDateFieldElement = /** @class */ (function (_super) {
5724
3585
  __extends(CustomFormatDateFieldElement, _super);
5725
3586
  function CustomFormatDateFieldElement() {
5726
- var _this = _super.call(this) || this;
5727
- _this.defaultDateFormat = 'yyyy-mm-dd';
5728
- _this.supportedDateFormats = [
5729
- 'ddmmyyyy',
5730
- 'mmddyyyy',
5731
- 'dd/mm/yyyy',
5732
- 'mm/dd/yyyy',
5733
- 'dd-mm-yyyy',
5734
- 'mm-dd-yyyy',
5735
- 'yyyy-mm-dd',
5736
- 'yyyy-dd-mm',
5737
- 'Month dd, yyyy',
5738
- 'mm/dd/yy',
5739
- 'dd/mm/yy',
5740
- ];
5741
- return _this;
3587
+ return _super.call(this) || this;
5742
3588
  }
5743
3589
  Object.defineProperty(CustomFormatDateFieldElement.prototype, "value", {
5744
3590
  get: function () {
@@ -5761,9 +3607,10 @@ var CustomFormatDateFieldElement = /** @class */ (function (_super) {
5761
3607
  _super.prototype.connectedCallback.call(this);
5762
3608
  };
5763
3609
  CustomFormatDateFieldElement.prototype.initChildInputs = function () {
3610
+ var _a;
5764
3611
  this.date = _super.prototype.getChildInput.call(this, '#date-field');
5765
- this.dateWrapper = _super.prototype.getChildInput.call(this, '.flatpickr');
5766
- this.validateDateFormats();
3612
+ this.pickerTrigger = this.getChildElement('#picker-trigger');
3613
+ this.dateFormat = CustomDatepickerUtils_1.supportedDateFormats.includes(this.dateFormat) ? this.dateFormat : CustomDatepickerUtils_1.defaultDateFormat;
5767
3614
  this.date.placeholder = this.dateFormat;
5768
3615
  this.date.addEventListener('change', this.change.bind(this));
5769
3616
  if (this.required) {
@@ -5775,7 +3622,8 @@ var CustomFormatDateFieldElement = /** @class */ (function (_super) {
5775
3622
  if (this.min) {
5776
3623
  this.date.setAttribute('min', this.min);
5777
3624
  }
5778
- this.initFlatpickr();
3625
+ this.language = ((_a = this.attributes.getNamedItem('language')) === null || _a === void 0 ? void 0 : _a.value) || 'en';
3626
+ this.initCustomPicker();
5779
3627
  };
5780
3628
  // events
5781
3629
  CustomFormatDateFieldElement.prototype.change = function ($event) {
@@ -5786,51 +3634,31 @@ var CustomFormatDateFieldElement = /** @class */ (function (_super) {
5786
3634
  this.valid;
5787
3635
  this.onValidate.emit(new CustomEvents_1.CustomElementEventArgs(this.value, 'validate'));
5788
3636
  };
5789
- CustomFormatDateFieldElement.prototype.initFlatpickr = function () {
5790
- var _this = this;
5791
- flatpickr(this.dateWrapper, {
5792
- wrap: true,
5793
- altInput: true,
5794
- appendTo: this.shadowRoot.querySelector('.wrapper'),
5795
- disableMobile: true,
5796
- parseDate: function (datestr) {
5797
- return new Date(datestr);
5798
- },
5799
- formatDate: function (date, format) {
5800
- return _this.formatDate(date);
5801
- }
5802
- });
5803
- };
5804
- CustomFormatDateFieldElement.prototype.formatDate = function (date) {
5805
- var year = date.getFullYear();
5806
- var month = (date.getMonth() + 1).toString().padStart(2, '0');
5807
- var day = date.getDate().toString().padStart(2, '0');
5808
- var monthName = date.toLocaleString('default', { month: 'long' });
5809
- var dateFormats = {
5810
- 'ddmmyyyy': "" + day + month + year,
5811
- 'mmddyyyy': "" + month + day + year,
5812
- 'dd/mm/yyyy': day + "/" + month + "/" + year,
5813
- 'mm/dd/yyyy': month + "/" + day + "/" + year,
5814
- 'dd-mm-yyyy': day + "-" + month + "-" + year,
5815
- 'mm-dd-yyyy': month + "-" + day + "-" + year,
5816
- 'yyyy-mm-dd': year + "-" + month + "-" + day,
5817
- 'yyyy-dd-mm': year + "-" + day + "-" + month,
5818
- 'Month dd, yyyy': monthName + " " + day + ", " + year,
5819
- 'mm/dd/yy': month + "/" + day + "/" + year.toString().slice(-2),
5820
- 'dd/mm/yy': day + "/" + month + "/" + year.toString().slice(-2),
5821
- };
5822
- return dateFormats[this.dateFormat];
3637
+ CustomFormatDateFieldElement.prototype.attributeChangedCallback = function (name, oldValue, newValue) {
3638
+ this.attributeChanged(name, oldValue, newValue);
5823
3639
  };
5824
- CustomFormatDateFieldElement.prototype.validateDateFormats = function () {
5825
- if (!this.supportedDateFormats.includes(this.dateFormat)) {
5826
- this.dateFormat = this.defaultDateFormat;
3640
+ CustomFormatDateFieldElement.prototype.attributeChanged = function (name, oldValue, newValue) {
3641
+ switch (name) {
3642
+ case 'language':
3643
+ this.language = newValue;
3644
+ this.initCustomPicker();
3645
+ break;
5827
3646
  }
5828
3647
  };
3648
+ CustomFormatDateFieldElement.prototype.initCustomPicker = function () {
3649
+ this.datePicker = new CustomDatepicker_1.default({
3650
+ input: this.date,
3651
+ dateFormat: this.dateFormat,
3652
+ otherTriggers: [this.pickerTrigger],
3653
+ parentElement: this,
3654
+ language: this.language,
3655
+ });
3656
+ };
5829
3657
  CustomFormatDateFieldElement = __decorate([
5830
3658
  (0, custom_element_decorator_1.default)({
5831
3659
  selector: 'custom-format-date-element',
5832
- template: "\n\t\t<div class=\"wrapper flatpickr\">\n\t\t\t<input type=\"text\" id=\"date-field\" data-input />\n\t\t\t<svg id=\"picker-trigger\" data-toggle viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><rect x=\"2\" y=\"4\" width=\"20\" height=\"18\" rx=\"1\" fill=\"#000\"/><rect x=\"4\" y=\"8\" width=\"16\" height=\"12\" fill=\"white\"/><path d=\"M4 10H20\" stroke=\"#000\" stroke-width=\"1\"/><circle cx=\"16\" cy=\"14\" r=\"2\" fill=\"#F44336\"/><rect x=\"6\" y=\"2\" width=\"3\" height=\"4\" rx=\".5\" fill=\"#000\"/><rect x=\"15\" y=\"2\" width=\"3\" height=\"4\" rx=\".5\" fill=\"#000\"/></svg>\n\t\t</div>",
5833
- style: "\n\t\t@import '../../../node_modules/flatpickr/dist/flatpickr.min.css';\n\t\t:host{\n\t\t\twidth:100%;\n\t\t}\n\t\t.wrapper{\n\t\t\tdisplay:flex;\n\t\t\tposition: relative;\n\t\t}\n\t\tinput{\n\t\t\tbox-sizing: border-box;\n\t\t\twidth: 100% !important;\n\t\t\tborder: none;\n\t\t\tbackground-color: #f1f4ff;\n\t\t\tmargin: 2px;\n\t\t\tresize: none;\n\t\t}\n\t\t#date-field::after {\n\t\t\tcontent: url('path/to/datepicker-icon.png'); /* Path to your datepicker icon */\n\t\t\tcursor: pointer;\n\t\t\tright: 10px;\n\t\t}\n\t\t#picker-trigger {\n\t\t\tcursor: pointer;\n\t\t\twidth: 15px;\n\t\t\theight: 15px;\n\t\t\tposition:absolute;\n\t\t\tright: 2px;\n\t\t\ttop: 15%;\n\t\t}\n\t\t.flatpickr-calendar {\n\t\t\tposition: fixed !important; /* Use fixed positioning */\n\t\t\ttop: 50% !important; /* Center vertically */\n\t\t\tleft: 50% !important; /* Center horizontally */\n\t\t\tz-index: 1000 !important; /* Ensure it's above other content */\n\t\t}\n\t",
3660
+ template: "\n\t\t<div class=\"wrapper\">\n\t\t\t<input type=\"text\" id=\"date-field\" readonly />\n\t\t\t<svg id=\"picker-trigger\" data-toggle viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><rect x=\"2\" y=\"4\" width=\"20\" height=\"18\" rx=\"1\" fill=\"#000\"/><rect x=\"4\" y=\"8\" width=\"16\" height=\"12\" fill=\"white\"/><path d=\"M4 10H20\" stroke=\"#000\" stroke-width=\"1\"/><circle cx=\"16\" cy=\"14\" r=\"2\" fill=\"#F44336\"/><rect x=\"6\" y=\"2\" width=\"3\" height=\"4\" rx=\".5\" fill=\"#000\"/><rect x=\"15\" y=\"2\" width=\"3\" height=\"4\" rx=\".5\" fill=\"#000\"/></svg>\n\t\t</div>",
3661
+ style: "\n\t\t:host{\n\t\t\twidth:100%;\n\t\t}\n\t\t* {\n\t\t\tbox-sizing: border-box;\n\t\t}\n\t\t.wrapper{\n\t\t\tdisplay:flex;\n\t\t\tposition: relative;\n\t\t}\n\t\tinput{\n\t\t\tbox-sizing: border-box;\n\t\t\twidth: 100% !important;\n\t\t\tborder: none;\n\t\t\tbackground-color: #f1f4ff;\n\t\t\tmargin: 2px;\n\t\t\tresize: none;\n\t\t}\n\t\t#date-field::after {\n\t\t\tcontent: url('path/to/datepicker-icon.png'); /* Path to your datepicker icon */\n\t\t\tcursor: pointer;\n\t\t\tright: 10px;\n\t\t}\n\t\t#picker-trigger {\n\t\t\tcursor: pointer;\n\t\t\twidth: 15px;\n\t\t\theight: 15px;\n\t\t\tposition:absolute;\n\t\t\tright: 2px;\n\t\t\ttop: 15%;\n\t\t}\n\t",
5834
3662
  useShadow: true,
5835
3663
  })
5836
3664
  ], CustomFormatDateFieldElement);
@@ -5838,7 +3666,7 @@ var CustomFormatDateFieldElement = /** @class */ (function (_super) {
5838
3666
  }(CustomInputElement_1.CustomInputElement));
5839
3667
  exports.CustomFormatDateFieldElement = CustomFormatDateFieldElement;
5840
3668
 
5841
- },{"../../framework/CustomEvents":34,"../../framework/CustomInputElement":35,"../../framework/custom-element.decorator":73,"flatpickr":5}],17:[function(require,module,exports){
3669
+ },{"../../framework/CustomEvents":37,"../../framework/CustomInputElement":38,"../../framework/custom-element.decorator":76,"./CustomDatepicker/CustomDatepicker":15,"./CustomDatepicker/CustomDatepickerUtils":17}],20:[function(require,module,exports){
5842
3670
  "use strict";
5843
3671
  var __extends = (this && this.__extends) || (function () {
5844
3672
  var extendStatics = function (d, b) {
@@ -5931,7 +3759,7 @@ var CustomRegularExpressionElement = /** @class */ (function (_super) {
5931
3759
  }(CustomInputElement_1.CustomInputElement));
5932
3760
  exports.CustomRegularExpressionElement = CustomRegularExpressionElement;
5933
3761
 
5934
- },{"../../framework/CustomEvents":34,"../../framework/CustomInputElement":35,"../../framework/custom-element.decorator":73}],18:[function(require,module,exports){
3762
+ },{"../../framework/CustomEvents":37,"../../framework/CustomInputElement":38,"../../framework/custom-element.decorator":76}],21:[function(require,module,exports){
5935
3763
  "use strict";
5936
3764
  var __extends = (this && this.__extends) || (function () {
5937
3765
  var extendStatics = function (d, b) {
@@ -6018,7 +3846,7 @@ var DateFieldElement = /** @class */ (function (_super) {
6018
3846
  }(CustomInputElement_1.CustomInputElement));
6019
3847
  exports.DateFieldElement = DateFieldElement;
6020
3848
 
6021
- },{"../../framework/CustomEvents":34,"../../framework/CustomInputElement":35,"../../framework/custom-element.decorator":73}],19:[function(require,module,exports){
3849
+ },{"../../framework/CustomEvents":37,"../../framework/CustomInputElement":38,"../../framework/custom-element.decorator":76}],22:[function(require,module,exports){
6022
3850
  "use strict";
6023
3851
  var __extends = (this && this.__extends) || (function () {
6024
3852
  var extendStatics = function (d, b) {
@@ -6119,7 +3947,7 @@ var DropDownListElement = /** @class */ (function (_super) {
6119
3947
  }(CustomInputElement_1.CustomInputElement));
6120
3948
  exports.DropDownListElement = DropDownListElement;
6121
3949
 
6122
- },{"../../framework/CustomEvents":34,"../../framework/CustomInputElement":35,"../../framework/Utilities/StringUtil":62,"../../framework/custom-element.decorator":73}],20:[function(require,module,exports){
3950
+ },{"../../framework/CustomEvents":37,"../../framework/CustomInputElement":38,"../../framework/Utilities/StringUtil":65,"../../framework/custom-element.decorator":76}],23:[function(require,module,exports){
6123
3951
  "use strict";
6124
3952
  Object.defineProperty(exports, "__esModule", { value: true });
6125
3953
  exports.SECompanyRegistrationElement = exports.SEPersonalNumberElement = exports.TypeAheadElement = exports.BankFieldElement = exports.IdentificationElement = exports.CVRElement = exports.CPRElement = exports.IntPhoneFieldElement = exports.CustomFormatDateFieldElement = exports.DateFieldElement = exports.CustomRegularExpressionElement = exports.NumericFieldElement = exports.FileFieldElement = exports.DropDownListElement = exports.TextAreaElement = exports.RadioButtonGroupElement = exports.CheckBoxElement = exports.EmailFieldElement = exports.TextFieldElement = exports.AddressElement = void 0;
@@ -6164,7 +3992,7 @@ Object.defineProperty(exports, "SECompanyRegistrationElement", { enumerable: tru
6164
3992
  var CustomFormatDateFieldElement_1 = require("./CustomFormatDateFieldElement/CustomFormatDateFieldElement");
6165
3993
  Object.defineProperty(exports, "CustomFormatDateFieldElement", { enumerable: true, get: function () { return CustomFormatDateFieldElement_1.CustomFormatDateFieldElement; } });
6166
3994
 
6167
- },{"./Address/AddressElement":11,"./BankField/BankFieldElement":12,"./CPRElement/CPRElement":13,"./CVRElement/CVRElement":14,"./CheckBoxElement/CheckBoxElement":15,"./CustomFormatDateFieldElement/CustomFormatDateFieldElement":16,"./CustomRegularExpression/CustomRegularExpressionElement":17,"./DateField/DateFieldElement":18,"./DropDownList/DropDownListElement":19,"./EmailField/EmailFieldElement":21,"./FileField/FileFieldElement":22,"./IdentificationElement/IdentificationElement":23,"./InternationaPhoneNumber/InternationaPhoneNumberElement":26,"./NumericField/NumericFieldElement":27,"./RadioButtonGroup/RadioButtonGroupElement":28,"./SECompanyRegistrationElement/SECompanyRegistrationElement":29,"./SEPersonalNumberElement/SEPersonalNumberElement":30,"./TextAreaElement/TextAreaElement":31,"./TextField/TextFieldElement":32,"./TypeAhead/TypeAheadElement":33}],21:[function(require,module,exports){
3995
+ },{"./Address/AddressElement":10,"./BankField/BankFieldElement":11,"./CPRElement/CPRElement":12,"./CVRElement/CVRElement":13,"./CheckBoxElement/CheckBoxElement":14,"./CustomFormatDateFieldElement/CustomFormatDateFieldElement":19,"./CustomRegularExpression/CustomRegularExpressionElement":20,"./DateField/DateFieldElement":21,"./DropDownList/DropDownListElement":22,"./EmailField/EmailFieldElement":24,"./FileField/FileFieldElement":25,"./IdentificationElement/IdentificationElement":26,"./InternationaPhoneNumber/InternationaPhoneNumberElement":29,"./NumericField/NumericFieldElement":30,"./RadioButtonGroup/RadioButtonGroupElement":31,"./SECompanyRegistrationElement/SECompanyRegistrationElement":32,"./SEPersonalNumberElement/SEPersonalNumberElement":33,"./TextAreaElement/TextAreaElement":34,"./TextField/TextFieldElement":35,"./TypeAhead/TypeAheadElement":36}],24:[function(require,module,exports){
6168
3996
  "use strict";
6169
3997
  var __extends = (this && this.__extends) || (function () {
6170
3998
  var extendStatics = function (d, b) {
@@ -6252,7 +4080,7 @@ var EmailFieldElement = /** @class */ (function (_super) {
6252
4080
  }(CustomInputElement_1.CustomInputElement));
6253
4081
  exports.EmailFieldElement = EmailFieldElement;
6254
4082
 
6255
- },{"../../framework/CustomEvents":34,"../../framework/CustomInputElement":35,"../../framework/custom-element.decorator":73}],22:[function(require,module,exports){
4083
+ },{"../../framework/CustomEvents":37,"../../framework/CustomInputElement":38,"../../framework/custom-element.decorator":76}],25:[function(require,module,exports){
6256
4084
  "use strict";
6257
4085
  var __extends = (this && this.__extends) || (function () {
6258
4086
  var extendStatics = function (d, b) {
@@ -6357,7 +4185,7 @@ var FileFieldElement = /** @class */ (function (_super) {
6357
4185
  }(CustomInputElement_1.CustomInputElement));
6358
4186
  exports.FileFieldElement = FileFieldElement;
6359
4187
 
6360
- },{"../../framework/CustomEvents":34,"../../framework/CustomInputElement":35,"../../framework/Polyfills/getAttributeNamesPolyfill":57,"../../framework/custom-element.decorator":73}],23:[function(require,module,exports){
4188
+ },{"../../framework/CustomEvents":37,"../../framework/CustomInputElement":38,"../../framework/Polyfills/getAttributeNamesPolyfill":60,"../../framework/custom-element.decorator":76}],26:[function(require,module,exports){
6361
4189
  "use strict";
6362
4190
  var __extends = (this && this.__extends) || (function () {
6363
4191
  var extendStatics = function (d, b) {
@@ -6453,7 +4281,7 @@ var IdentificationElement = /** @class */ (function (_super) {
6453
4281
  }(CustomInputElement_1.CustomInputElement));
6454
4282
  exports.IdentificationElement = IdentificationElement;
6455
4283
 
6456
- },{"../../framework/CustomEvents":34,"../../framework/CustomInputElement":35,"../../framework/Validation/Validators/BankIdNorway":67,"../../framework/Validation/Validators/BankIdSweden":68,"../../framework/Validation/Validators/CPR":69,"../../framework/Validation/Validators/CVR":70,"../../framework/custom-element.decorator":73}],24:[function(require,module,exports){
4284
+ },{"../../framework/CustomEvents":37,"../../framework/CustomInputElement":38,"../../framework/Validation/Validators/BankIdNorway":70,"../../framework/Validation/Validators/BankIdSweden":71,"../../framework/Validation/Validators/CPR":72,"../../framework/Validation/Validators/CVR":73,"../../framework/custom-element.decorator":76}],27:[function(require,module,exports){
6457
4285
  "use strict";
6458
4286
  Object.defineProperty(exports, "__esModule", { value: true });
6459
4287
  function GetFlagsUrl() {
@@ -6461,7 +4289,7 @@ function GetFlagsUrl() {
6461
4289
  }
6462
4290
  exports.default = GetFlagsUrl;
6463
4291
 
6464
- },{}],25:[function(require,module,exports){
4292
+ },{}],28:[function(require,module,exports){
6465
4293
  "use strict";
6466
4294
  Object.defineProperty(exports, "__esModule", { value: true });
6467
4295
  function GetFlags2XUrl() {
@@ -6469,7 +4297,7 @@ function GetFlags2XUrl() {
6469
4297
  }
6470
4298
  exports.default = GetFlags2XUrl;
6471
4299
 
6472
- },{}],26:[function(require,module,exports){
4300
+ },{}],29:[function(require,module,exports){
6473
4301
  "use strict";
6474
4302
  var __extends = (this && this.__extends) || (function () {
6475
4303
  var extendStatics = function (d, b) {
@@ -6601,7 +4429,7 @@ var IntPhoneFieldElement = /** @class */ (function (_super) {
6601
4429
  }(CustomInputElement_1.CustomInputElement));
6602
4430
  exports.IntPhoneFieldElement = IntPhoneFieldElement;
6603
4431
 
6604
- },{"../../framework/CustomEvents":34,"../../framework/CustomInputElement":35,"../../framework/Utilities/MakeRequest":61,"../../framework/custom-element.decorator":73,"./Flags":24,"./Flags2x":25,"intl-tel-input":7}],27:[function(require,module,exports){
4432
+ },{"../../framework/CustomEvents":37,"../../framework/CustomInputElement":38,"../../framework/Utilities/MakeRequest":64,"../../framework/custom-element.decorator":76,"./Flags":27,"./Flags2x":28,"intl-tel-input":6}],30:[function(require,module,exports){
6605
4433
  "use strict";
6606
4434
  var __extends = (this && this.__extends) || (function () {
6607
4435
  var extendStatics = function (d, b) {
@@ -6697,7 +4525,7 @@ var NumericFieldElement = /** @class */ (function (_super) {
6697
4525
  }(CustomInputElement_1.CustomInputElement));
6698
4526
  exports.NumericFieldElement = NumericFieldElement;
6699
4527
 
6700
- },{"../../framework/CustomEvents":34,"../../framework/CustomInputElement":35,"../../framework/custom-element.decorator":73}],28:[function(require,module,exports){
4528
+ },{"../../framework/CustomEvents":37,"../../framework/CustomInputElement":38,"../../framework/custom-element.decorator":76}],31:[function(require,module,exports){
6701
4529
  "use strict";
6702
4530
  var __extends = (this && this.__extends) || (function () {
6703
4531
  var extendStatics = function (d, b) {
@@ -6798,7 +4626,7 @@ var RadioButtonGroupElement = /** @class */ (function (_super) {
6798
4626
  }(CustomInputElement_1.CustomInputElement));
6799
4627
  exports.RadioButtonGroupElement = RadioButtonGroupElement;
6800
4628
 
6801
- },{"../../framework/CustomEvents":34,"../../framework/CustomInputElement":35,"../../framework/Utilities/StringUtil":62,"../../framework/custom-element.decorator":73}],29:[function(require,module,exports){
4629
+ },{"../../framework/CustomEvents":37,"../../framework/CustomInputElement":38,"../../framework/Utilities/StringUtil":65,"../../framework/custom-element.decorator":76}],32:[function(require,module,exports){
6802
4630
  "use strict";
6803
4631
  var __extends = (this && this.__extends) || (function () {
6804
4632
  var extendStatics = function (d, b) {
@@ -6882,7 +4710,7 @@ var SECompanyRegistrationElement = /** @class */ (function (_super) {
6882
4710
  }(CustomInputElement_1.CustomInputElement));
6883
4711
  exports.SECompanyRegistrationElement = SECompanyRegistrationElement;
6884
4712
 
6885
- },{"../../framework/CustomEvents":34,"../../framework/CustomInputElement":35,"../../framework/Validation/Validators/SECompanyRegistration":71,"../../framework/custom-element.decorator":73}],30:[function(require,module,exports){
4713
+ },{"../../framework/CustomEvents":37,"../../framework/CustomInputElement":38,"../../framework/Validation/Validators/SECompanyRegistration":74,"../../framework/custom-element.decorator":76}],33:[function(require,module,exports){
6886
4714
  "use strict";
6887
4715
  var __extends = (this && this.__extends) || (function () {
6888
4716
  var extendStatics = function (d, b) {
@@ -6966,7 +4794,7 @@ var SEPersonalNumberElement = /** @class */ (function (_super) {
6966
4794
  }(CustomInputElement_1.CustomInputElement));
6967
4795
  exports.SEPersonalNumberElement = SEPersonalNumberElement;
6968
4796
 
6969
- },{"../../framework/CustomEvents":34,"../../framework/CustomInputElement":35,"../../framework/Validation/Validators/SEPersonalNumber":72,"../../framework/custom-element.decorator":73}],31:[function(require,module,exports){
4797
+ },{"../../framework/CustomEvents":37,"../../framework/CustomInputElement":38,"../../framework/Validation/Validators/SEPersonalNumber":75,"../../framework/custom-element.decorator":76}],34:[function(require,module,exports){
6970
4798
  "use strict";
6971
4799
  var __extends = (this && this.__extends) || (function () {
6972
4800
  var extendStatics = function (d, b) {
@@ -7050,7 +4878,7 @@ var TextAreaElement = /** @class */ (function (_super) {
7050
4878
  }(CustomInputElement_1.CustomInputElement));
7051
4879
  exports.TextAreaElement = TextAreaElement;
7052
4880
 
7053
- },{"../../framework/CustomEvents":34,"../../framework/CustomInputElement":35,"../../framework/custom-element.decorator":73}],32:[function(require,module,exports){
4881
+ },{"../../framework/CustomEvents":37,"../../framework/CustomInputElement":38,"../../framework/custom-element.decorator":76}],35:[function(require,module,exports){
7054
4882
  "use strict";
7055
4883
  var __extends = (this && this.__extends) || (function () {
7056
4884
  var extendStatics = function (d, b) {
@@ -7134,7 +4962,7 @@ var TextFieldElement = /** @class */ (function (_super) {
7134
4962
  }(CustomInputElement_1.CustomInputElement));
7135
4963
  exports.TextFieldElement = TextFieldElement;
7136
4964
 
7137
- },{"../../framework/CustomEvents":34,"../../framework/CustomInputElement":35,"../../framework/custom-element.decorator":73}],33:[function(require,module,exports){
4965
+ },{"../../framework/CustomEvents":37,"../../framework/CustomInputElement":38,"../../framework/custom-element.decorator":76}],36:[function(require,module,exports){
7138
4966
  "use strict";
7139
4967
  var __extends = (this && this.__extends) || (function () {
7140
4968
  var extendStatics = function (d, b) {
@@ -7348,7 +5176,7 @@ var TypeAheadElement = /** @class */ (function (_super) {
7348
5176
  }(CustomInputElement_1.CustomInputElement));
7349
5177
  exports.TypeAheadElement = TypeAheadElement;
7350
5178
 
7351
- },{"../../framework/CustomEvents":34,"../../framework/CustomInputElement":35,"../../framework/Utilities/DomUtility":60,"../../framework/custom-element.decorator":73}],34:[function(require,module,exports){
5179
+ },{"../../framework/CustomEvents":37,"../../framework/CustomInputElement":38,"../../framework/Utilities/DomUtility":63,"../../framework/custom-element.decorator":76}],37:[function(require,module,exports){
7352
5180
  "use strict";
7353
5181
  Object.defineProperty(exports, "__esModule", { value: true });
7354
5182
  exports.CustomElementEvent = exports.CustomElementEventArgs = void 0;
@@ -7397,7 +5225,7 @@ var CustomElementEvent = /** @class */ (function () {
7397
5225
  }());
7398
5226
  exports.CustomElementEvent = CustomElementEvent;
7399
5227
 
7400
- },{}],35:[function(require,module,exports){
5228
+ },{}],38:[function(require,module,exports){
7401
5229
  "use strict";
7402
5230
  var __extends = (this && this.__extends) || (function () {
7403
5231
  var extendStatics = function (d, b) {
@@ -7659,7 +5487,7 @@ var CustomInputElement = /** @class */ (function (_super) {
7659
5487
  }(HTMLElement));
7660
5488
  exports.CustomInputElement = CustomInputElement;
7661
5489
 
7662
- },{"./CustomEvents":34,"./Utilities/ArrayUtil":58,"./Utilities/DomUtil":59}],36:[function(require,module,exports){
5490
+ },{"./CustomEvents":37,"./Utilities/ArrayUtil":61,"./Utilities/DomUtil":62}],39:[function(require,module,exports){
7663
5491
  "use strict";
7664
5492
  Object.defineProperty(exports, "__esModule", { value: true });
7665
5493
  var BaseDictionary = /** @class */ (function () {
@@ -7681,7 +5509,7 @@ var BaseDictionary = /** @class */ (function () {
7681
5509
  }());
7682
5510
  exports.default = BaseDictionary;
7683
5511
 
7684
- },{}],37:[function(require,module,exports){
5512
+ },{}],40:[function(require,module,exports){
7685
5513
  "use strict";
7686
5514
  var __extends = (this && this.__extends) || (function () {
7687
5515
  var extendStatics = function (d, b) {
@@ -7722,7 +5550,7 @@ var CzechDictionary = /** @class */ (function (_super) {
7722
5550
  }(BaseDictionary_1.default));
7723
5551
  exports.default = CzechDictionary;
7724
5552
 
7725
- },{"./Base/BaseDictionary":36}],38:[function(require,module,exports){
5553
+ },{"./Base/BaseDictionary":39}],41:[function(require,module,exports){
7726
5554
  "use strict";
7727
5555
  var __extends = (this && this.__extends) || (function () {
7728
5556
  var extendStatics = function (d, b) {
@@ -7763,7 +5591,7 @@ var DanishDictionary = /** @class */ (function (_super) {
7763
5591
  }(BaseDictionary_1.default));
7764
5592
  exports.default = DanishDictionary;
7765
5593
 
7766
- },{"./Base/BaseDictionary":36}],39:[function(require,module,exports){
5594
+ },{"./Base/BaseDictionary":39}],42:[function(require,module,exports){
7767
5595
  "use strict";
7768
5596
  var __extends = (this && this.__extends) || (function () {
7769
5597
  var extendStatics = function (d, b) {
@@ -7804,7 +5632,7 @@ var DutchDictionary = /** @class */ (function (_super) {
7804
5632
  }(BaseDictionary_1.default));
7805
5633
  exports.default = DutchDictionary;
7806
5634
 
7807
- },{"./Base/BaseDictionary":36}],40:[function(require,module,exports){
5635
+ },{"./Base/BaseDictionary":39}],43:[function(require,module,exports){
7808
5636
  "use strict";
7809
5637
  var __extends = (this && this.__extends) || (function () {
7810
5638
  var extendStatics = function (d, b) {
@@ -7845,7 +5673,7 @@ var EnglishDictionary = /** @class */ (function (_super) {
7845
5673
  }(BaseDictionary_1.default));
7846
5674
  exports.default = EnglishDictionary;
7847
5675
 
7848
- },{"./Base/BaseDictionary":36}],41:[function(require,module,exports){
5676
+ },{"./Base/BaseDictionary":39}],44:[function(require,module,exports){
7849
5677
  "use strict";
7850
5678
  var __extends = (this && this.__extends) || (function () {
7851
5679
  var extendStatics = function (d, b) {
@@ -7886,7 +5714,7 @@ var EstonianDictionary = /** @class */ (function (_super) {
7886
5714
  }(BaseDictionary_1.default));
7887
5715
  exports.default = EstonianDictionary;
7888
5716
 
7889
- },{"./Base/BaseDictionary":36}],42:[function(require,module,exports){
5717
+ },{"./Base/BaseDictionary":39}],45:[function(require,module,exports){
7890
5718
  "use strict";
7891
5719
  var __extends = (this && this.__extends) || (function () {
7892
5720
  var extendStatics = function (d, b) {
@@ -7927,7 +5755,7 @@ var FinnishDictionary = /** @class */ (function (_super) {
7927
5755
  }(BaseDictionary_1.default));
7928
5756
  exports.default = FinnishDictionary;
7929
5757
 
7930
- },{"./Base/BaseDictionary":36}],43:[function(require,module,exports){
5758
+ },{"./Base/BaseDictionary":39}],46:[function(require,module,exports){
7931
5759
  "use strict";
7932
5760
  var __extends = (this && this.__extends) || (function () {
7933
5761
  var extendStatics = function (d, b) {
@@ -7968,7 +5796,7 @@ var FrenchDictionary = /** @class */ (function (_super) {
7968
5796
  }(BaseDictionary_1.default));
7969
5797
  exports.default = FrenchDictionary;
7970
5798
 
7971
- },{"./Base/BaseDictionary":36}],44:[function(require,module,exports){
5799
+ },{"./Base/BaseDictionary":39}],47:[function(require,module,exports){
7972
5800
  "use strict";
7973
5801
  var __extends = (this && this.__extends) || (function () {
7974
5802
  var extendStatics = function (d, b) {
@@ -8009,7 +5837,7 @@ var GermanDictionary = /** @class */ (function (_super) {
8009
5837
  }(BaseDictionary_1.default));
8010
5838
  exports.default = GermanDictionary;
8011
5839
 
8012
- },{"./Base/BaseDictionary":36}],45:[function(require,module,exports){
5840
+ },{"./Base/BaseDictionary":39}],48:[function(require,module,exports){
8013
5841
  "use strict";
8014
5842
  var __extends = (this && this.__extends) || (function () {
8015
5843
  var extendStatics = function (d, b) {
@@ -8050,7 +5878,7 @@ var GreekDictionary = /** @class */ (function (_super) {
8050
5878
  }(BaseDictionary_1.default));
8051
5879
  exports.default = GreekDictionary;
8052
5880
 
8053
- },{"./Base/BaseDictionary":36}],46:[function(require,module,exports){
5881
+ },{"./Base/BaseDictionary":39}],49:[function(require,module,exports){
8054
5882
  "use strict";
8055
5883
  var __extends = (this && this.__extends) || (function () {
8056
5884
  var extendStatics = function (d, b) {
@@ -8091,7 +5919,7 @@ var HungarianDictionary = /** @class */ (function (_super) {
8091
5919
  }(BaseDictionary_1.default));
8092
5920
  exports.default = HungarianDictionary;
8093
5921
 
8094
- },{"./Base/BaseDictionary":36}],47:[function(require,module,exports){
5922
+ },{"./Base/BaseDictionary":39}],50:[function(require,module,exports){
8095
5923
  "use strict";
8096
5924
  var __extends = (this && this.__extends) || (function () {
8097
5925
  var extendStatics = function (d, b) {
@@ -8132,7 +5960,7 @@ var IcelandicDictionary = /** @class */ (function (_super) {
8132
5960
  }(BaseDictionary_1.default));
8133
5961
  exports.default = IcelandicDictionary;
8134
5962
 
8135
- },{"./Base/BaseDictionary":36}],48:[function(require,module,exports){
5963
+ },{"./Base/BaseDictionary":39}],51:[function(require,module,exports){
8136
5964
  "use strict";
8137
5965
  var __extends = (this && this.__extends) || (function () {
8138
5966
  var extendStatics = function (d, b) {
@@ -8173,7 +6001,7 @@ var ItalianDictionary = /** @class */ (function (_super) {
8173
6001
  }(BaseDictionary_1.default));
8174
6002
  exports.default = ItalianDictionary;
8175
6003
 
8176
- },{"./Base/BaseDictionary":36}],49:[function(require,module,exports){
6004
+ },{"./Base/BaseDictionary":39}],52:[function(require,module,exports){
8177
6005
  "use strict";
8178
6006
  var __extends = (this && this.__extends) || (function () {
8179
6007
  var extendStatics = function (d, b) {
@@ -8214,7 +6042,7 @@ var LatvianDictionary = /** @class */ (function (_super) {
8214
6042
  }(BaseDictionary_1.default));
8215
6043
  exports.default = LatvianDictionary;
8216
6044
 
8217
- },{"./Base/BaseDictionary":36}],50:[function(require,module,exports){
6045
+ },{"./Base/BaseDictionary":39}],53:[function(require,module,exports){
8218
6046
  "use strict";
8219
6047
  var __extends = (this && this.__extends) || (function () {
8220
6048
  var extendStatics = function (d, b) {
@@ -8255,7 +6083,7 @@ var LituanianDictionary = /** @class */ (function (_super) {
8255
6083
  }(BaseDictionary_1.default));
8256
6084
  exports.default = LituanianDictionary;
8257
6085
 
8258
- },{"./Base/BaseDictionary":36}],51:[function(require,module,exports){
6086
+ },{"./Base/BaseDictionary":39}],54:[function(require,module,exports){
8259
6087
  "use strict";
8260
6088
  var __extends = (this && this.__extends) || (function () {
8261
6089
  var extendStatics = function (d, b) {
@@ -8296,7 +6124,7 @@ var NorwegianDictionary = /** @class */ (function (_super) {
8296
6124
  }(BaseDictionary_1.default));
8297
6125
  exports.default = NorwegianDictionary;
8298
6126
 
8299
- },{"./Base/BaseDictionary":36}],52:[function(require,module,exports){
6127
+ },{"./Base/BaseDictionary":39}],55:[function(require,module,exports){
8300
6128
  "use strict";
8301
6129
  var __extends = (this && this.__extends) || (function () {
8302
6130
  var extendStatics = function (d, b) {
@@ -8337,7 +6165,7 @@ var PolishDictionary = /** @class */ (function (_super) {
8337
6165
  }(BaseDictionary_1.default));
8338
6166
  exports.default = PolishDictionary;
8339
6167
 
8340
- },{"./Base/BaseDictionary":36}],53:[function(require,module,exports){
6168
+ },{"./Base/BaseDictionary":39}],56:[function(require,module,exports){
8341
6169
  "use strict";
8342
6170
  var __extends = (this && this.__extends) || (function () {
8343
6171
  var extendStatics = function (d, b) {
@@ -8378,7 +6206,7 @@ var PortugueseDictionary = /** @class */ (function (_super) {
8378
6206
  }(BaseDictionary_1.default));
8379
6207
  exports.default = PortugueseDictionary;
8380
6208
 
8381
- },{"./Base/BaseDictionary":36}],54:[function(require,module,exports){
6209
+ },{"./Base/BaseDictionary":39}],57:[function(require,module,exports){
8382
6210
  "use strict";
8383
6211
  var __extends = (this && this.__extends) || (function () {
8384
6212
  var extendStatics = function (d, b) {
@@ -8419,7 +6247,7 @@ var SpanishDictionary = /** @class */ (function (_super) {
8419
6247
  }(BaseDictionary_1.default));
8420
6248
  exports.default = SpanishDictionary;
8421
6249
 
8422
- },{"./Base/BaseDictionary":36}],55:[function(require,module,exports){
6250
+ },{"./Base/BaseDictionary":39}],58:[function(require,module,exports){
8423
6251
  "use strict";
8424
6252
  var __extends = (this && this.__extends) || (function () {
8425
6253
  var extendStatics = function (d, b) {
@@ -8460,7 +6288,7 @@ var SwedishDictionary = /** @class */ (function (_super) {
8460
6288
  }(BaseDictionary_1.default));
8461
6289
  exports.default = SwedishDictionary;
8462
6290
 
8463
- },{"./Base/BaseDictionary":36}],56:[function(require,module,exports){
6291
+ },{"./Base/BaseDictionary":39}],59:[function(require,module,exports){
8464
6292
  "use strict";
8465
6293
  Object.defineProperty(exports, "__esModule", { value: true });
8466
6294
  var DanishDictionary_1 = require("./Languages/DanishDictionary");
@@ -8577,7 +6405,7 @@ var Translator = /** @class */ (function () {
8577
6405
  }());
8578
6406
  exports.default = Translator;
8579
6407
 
8580
- },{"./Languages/CzechDictionary":37,"./Languages/DanishDictionary":38,"./Languages/DutchDictionary":39,"./Languages/EnglishDictionary":40,"./Languages/EstonianDictionary":41,"./Languages/FinnishDictionary":42,"./Languages/FrenchDictionary":43,"./Languages/GermanDictionary":44,"./Languages/GreekDictionary":45,"./Languages/HungarianDictionary":46,"./Languages/IcelandicDictionary":47,"./Languages/ItalianDictionary":48,"./Languages/LatvianDictionary":49,"./Languages/LituanianDictionary":50,"./Languages/NorwegianDictionary":51,"./Languages/PolishDictionary":52,"./Languages/PortugueseDictionary":53,"./Languages/SpanishDictionary":54,"./Languages/SwedishDictionary":55}],57:[function(require,module,exports){
6408
+ },{"./Languages/CzechDictionary":40,"./Languages/DanishDictionary":41,"./Languages/DutchDictionary":42,"./Languages/EnglishDictionary":43,"./Languages/EstonianDictionary":44,"./Languages/FinnishDictionary":45,"./Languages/FrenchDictionary":46,"./Languages/GermanDictionary":47,"./Languages/GreekDictionary":48,"./Languages/HungarianDictionary":49,"./Languages/IcelandicDictionary":50,"./Languages/ItalianDictionary":51,"./Languages/LatvianDictionary":52,"./Languages/LituanianDictionary":53,"./Languages/NorwegianDictionary":54,"./Languages/PolishDictionary":55,"./Languages/PortugueseDictionary":56,"./Languages/SpanishDictionary":57,"./Languages/SwedishDictionary":58}],60:[function(require,module,exports){
8581
6409
  "use strict";
8582
6410
  Object.defineProperty(exports, "__esModule", { value: true });
8583
6411
  function getAttributeNamesPolyfill() {
@@ -8596,7 +6424,7 @@ function getAttributeNamesPolyfill() {
8596
6424
  exports.default = getAttributeNamesPolyfill;
8597
6425
  ;
8598
6426
 
8599
- },{}],58:[function(require,module,exports){
6427
+ },{}],61:[function(require,module,exports){
8600
6428
  "use strict";
8601
6429
  Object.defineProperty(exports, "__esModule", { value: true });
8602
6430
  var ArrayUtil = /** @class */ (function () {
@@ -8634,7 +6462,7 @@ var ArrayUtil = /** @class */ (function () {
8634
6462
  }());
8635
6463
  exports.default = ArrayUtil;
8636
6464
 
8637
- },{}],59:[function(require,module,exports){
6465
+ },{}],62:[function(require,module,exports){
8638
6466
  "use strict";
8639
6467
  Object.defineProperty(exports, "__esModule", { value: true });
8640
6468
  var ViewportUtil_1 = require("./ViewportUtil");
@@ -8737,7 +6565,7 @@ var DomUtil = /** @class */ (function () {
8737
6565
  }());
8738
6566
  exports.default = DomUtil;
8739
6567
 
8740
- },{"./ViewportUtil":63}],60:[function(require,module,exports){
6568
+ },{"./ViewportUtil":66}],63:[function(require,module,exports){
8741
6569
  "use strict";
8742
6570
  Object.defineProperty(exports, "__esModule", { value: true });
8743
6571
  var DomUtility = /** @class */ (function () {
@@ -8751,7 +6579,7 @@ var DomUtility = /** @class */ (function () {
8751
6579
  }());
8752
6580
  exports.default = DomUtility;
8753
6581
 
8754
- },{}],61:[function(require,module,exports){
6582
+ },{}],64:[function(require,module,exports){
8755
6583
  "use strict";
8756
6584
  Object.defineProperty(exports, "__esModule", { value: true });
8757
6585
  var MakeRequest = /** @class */ (function () {
@@ -8801,7 +6629,7 @@ var MakeRequest = /** @class */ (function () {
8801
6629
  }());
8802
6630
  exports.default = MakeRequest;
8803
6631
 
8804
- },{}],62:[function(require,module,exports){
6632
+ },{}],65:[function(require,module,exports){
8805
6633
  "use strict";
8806
6634
  Object.defineProperty(exports, "__esModule", { value: true });
8807
6635
  exports.StringUtil = void 0;
@@ -8819,7 +6647,7 @@ var StringUtil = /** @class */ (function () {
8819
6647
  }());
8820
6648
  exports.StringUtil = StringUtil;
8821
6649
 
8822
- },{}],63:[function(require,module,exports){
6650
+ },{}],66:[function(require,module,exports){
8823
6651
  "use strict";
8824
6652
  Object.defineProperty(exports, "__esModule", { value: true });
8825
6653
  exports.ViewportUtil = void 0;
@@ -8863,7 +6691,7 @@ var ViewportUtil = /** @class */ (function () {
8863
6691
  }());
8864
6692
  exports.ViewportUtil = ViewportUtil;
8865
6693
 
8866
- },{}],64:[function(require,module,exports){
6694
+ },{}],67:[function(require,module,exports){
8867
6695
  "use strict";
8868
6696
  Object.defineProperty(exports, "__esModule", { value: true });
8869
6697
  var debouncer = function (func, wait, immediate) {
@@ -8916,7 +6744,7 @@ var debouncer = function (func, wait, immediate) {
8916
6744
  };
8917
6745
  exports.default = debouncer;
8918
6746
 
8919
- },{}],65:[function(require,module,exports){
6747
+ },{}],68:[function(require,module,exports){
8920
6748
  "use strict";
8921
6749
  Object.defineProperty(exports, "__esModule", { value: true });
8922
6750
  var BankAccountValidator = /** @class */ (function () {
@@ -8930,7 +6758,7 @@ var BankAccountValidator = /** @class */ (function () {
8930
6758
  }());
8931
6759
  exports.default = BankAccountValidator;
8932
6760
 
8933
- },{}],66:[function(require,module,exports){
6761
+ },{}],69:[function(require,module,exports){
8934
6762
  "use strict";
8935
6763
  Object.defineProperty(exports, "__esModule", { value: true });
8936
6764
  var BankAccountRegistrationNumberValidator = /** @class */ (function () {
@@ -8944,7 +6772,7 @@ var BankAccountRegistrationNumberValidator = /** @class */ (function () {
8944
6772
  }());
8945
6773
  exports.default = BankAccountRegistrationNumberValidator;
8946
6774
 
8947
- },{}],67:[function(require,module,exports){
6775
+ },{}],70:[function(require,module,exports){
8948
6776
  "use strict";
8949
6777
  Object.defineProperty(exports, "__esModule", { value: true });
8950
6778
  var BankIdNorwayValidator = /** @class */ (function () {
@@ -8967,7 +6795,7 @@ var BankIdNorwayValidator = /** @class */ (function () {
8967
6795
  }());
8968
6796
  exports.default = BankIdNorwayValidator;
8969
6797
 
8970
- },{}],68:[function(require,module,exports){
6798
+ },{}],71:[function(require,module,exports){
8971
6799
  "use strict";
8972
6800
  Object.defineProperty(exports, "__esModule", { value: true });
8973
6801
  var BankIdSwedenValidator = /** @class */ (function () {
@@ -8990,7 +6818,7 @@ var BankIdSwedenValidator = /** @class */ (function () {
8990
6818
  }());
8991
6819
  exports.default = BankIdSwedenValidator;
8992
6820
 
8993
- },{}],69:[function(require,module,exports){
6821
+ },{}],72:[function(require,module,exports){
8994
6822
  "use strict";
8995
6823
  Object.defineProperty(exports, "__esModule", { value: true });
8996
6824
  var CprValidator = /** @class */ (function () {
@@ -9067,7 +6895,7 @@ var CprValidator = /** @class */ (function () {
9067
6895
  }());
9068
6896
  exports.default = CprValidator;
9069
6897
 
9070
- },{}],70:[function(require,module,exports){
6898
+ },{}],73:[function(require,module,exports){
9071
6899
  "use strict";
9072
6900
  Object.defineProperty(exports, "__esModule", { value: true });
9073
6901
  var CvrValidator = /** @class */ (function () {
@@ -9099,7 +6927,7 @@ var CvrValidator = /** @class */ (function () {
9099
6927
  }());
9100
6928
  exports.default = CvrValidator;
9101
6929
 
9102
- },{}],71:[function(require,module,exports){
6930
+ },{}],74:[function(require,module,exports){
9103
6931
  "use strict";
9104
6932
  Object.defineProperty(exports, "__esModule", { value: true });
9105
6933
  var SECompanyRegistrationValidator = /** @class */ (function () {
@@ -9138,7 +6966,7 @@ var SECompanyRegistrationValidator = /** @class */ (function () {
9138
6966
  }());
9139
6967
  exports.default = SECompanyRegistrationValidator;
9140
6968
 
9141
- },{}],72:[function(require,module,exports){
6969
+ },{}],75:[function(require,module,exports){
9142
6970
  "use strict";
9143
6971
  Object.defineProperty(exports, "__esModule", { value: true });
9144
6972
  var SEPersonalNumberValidator = /** @class */ (function () {
@@ -9182,7 +7010,7 @@ var SEPersonalNumberValidator = /** @class */ (function () {
9182
7010
  }());
9183
7011
  exports.default = SEPersonalNumberValidator;
9184
7012
 
9185
- },{}],73:[function(require,module,exports){
7013
+ },{}],76:[function(require,module,exports){
9186
7014
  "use strict";
9187
7015
  Object.defineProperty(exports, "__esModule", { value: true });
9188
7016
  var elementConfig = /** @class */ (function () {
@@ -9235,7 +7063,7 @@ var CustomElement = function (config) {
9235
7063
  };
9236
7064
  exports.default = CustomElement;
9237
7065
 
9238
- },{}],74:[function(require,module,exports){
7066
+ },{}],77:[function(require,module,exports){
9239
7067
  "use strict";
9240
7068
  Object.defineProperty(exports, "__esModule", { value: true });
9241
7069
  exports.CustomInputElement = exports.elements = exports.CustomForm = void 0;
@@ -9251,6 +7079,6 @@ Object.defineProperty(exports, "CustomInputElement", { enumerable: true, get: fu
9251
7079
  var elements = require("./elements/Elements");
9252
7080
  exports.elements = elements;
9253
7081
 
9254
- },{"./custom-form":10,"./elements/Elements":20,"./framework/CustomInputElement":35,"@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js":2,"@webcomponents/webcomponentsjs/webcomponents-bundle":3,"@webcomponents/webcomponentsjs/webcomponents-loader.js":4}]},{},[1])
7082
+ },{"./custom-form":9,"./elements/Elements":23,"./framework/CustomInputElement":38,"@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js":2,"@webcomponents/webcomponentsjs/webcomponents-bundle":3,"@webcomponents/webcomponentsjs/webcomponents-loader.js":4}]},{},[1])
9255
7083
 
9256
7084
  //# sourceMappingURL=index.min.js.map