@rededor/cura 1.1.0 → 1.2.0-alpha.0
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.
- package/dist/assets/assets/cura-assets.zip +0 -0
- package/dist/cjs/app-globals-4d07f363.js.map +1 -1
- package/dist/cjs/cura-accordion_12.cjs.entry.js +21 -15
- package/dist/cjs/cura-accordion_12.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-alert.cjs.entry.js +2 -2
- package/dist/cjs/cura-avatar.cjs.entry.js +2 -2
- package/dist/cjs/cura-badge-distance.cjs.entry.js +1 -1
- package/dist/cjs/cura-badge-number.cjs.entry.js +29 -0
- package/dist/cjs/cura-badge-number.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-button-outline.cjs.entry.js +2 -2
- package/dist/cjs/cura-button-select.cjs.entry.js +69 -58
- package/dist/cjs/cura-button-select.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-button-transparent.cjs.entry.js +2 -2
- package/dist/cjs/cura-calendar.cjs.entry.js +120 -234
- package/dist/cjs/cura-calendar.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-card.cjs.entry.js +2 -2
- package/dist/cjs/cura-checkbox.cjs.entry.js +2 -2
- package/dist/cjs/cura-display.cjs.entry.js +2 -2
- package/dist/cjs/cura-dropdown-search-option-title.cjs.entry.js +2 -2
- package/dist/cjs/cura-dropdown-search-option.cjs.entry.js +3 -3
- package/dist/cjs/cura-dropdown-search.cjs.entry.js +30 -4
- package/dist/cjs/cura-dropdown-search.cjs.entry.js.map +1 -1
- package/dist/cjs/cura-icons-view.cjs.entry.js +4 -4
- package/dist/cjs/cura-input-date.cjs.entry.js +188 -0
- package/dist/cjs/cura-input-date.cjs.entry.js.map +1 -0
- package/dist/cjs/cura-loader-bar.cjs.entry.js +2 -2
- package/dist/cjs/cura-radio.cjs.entry.js +2 -2
- package/dist/cjs/cura-switch.cjs.entry.js +2 -2
- package/dist/cjs/cura-toast.cjs.entry.js +2 -2
- package/dist/cjs/cura.cjs.js +2 -2
- package/dist/cjs/index-6dc29195.js +126 -0
- package/dist/cjs/index-6dc29195.js.map +1 -0
- package/dist/cjs/{index-98e7ba54.js → index-e6d728ec.js} +70 -3
- package/dist/{esm/index-1ad98520.js.map → cjs/index-e6d728ec.js.map} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/badges/cura-badge-number/cura-badge-number.css +30 -0
- package/dist/collection/components/badges/cura-badge-number/cura-badge-number.js +66 -0
- package/dist/collection/components/badges/cura-badge-number/cura-badge-number.js.map +1 -0
- package/dist/collection/components/badges/cura-badge-number/cura-badge-number.stories.js +56 -0
- package/dist/collection/components/badges/cura-badge-number/cura-badge-number.stories.js.map +1 -0
- package/dist/collection/components/buttons/cura-button/cura-button.js +1 -1
- package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.js +1 -1
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.css +49 -21
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.js +110 -113
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.js.map +1 -1
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.stories.js +133 -0
- package/dist/collection/components/buttons/cura-button-select/cura-button-select.stories.js.map +1 -0
- package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.js +1 -1
- package/dist/collection/components/cura-alert/cura-alert.js +1 -1
- package/dist/collection/components/cura-avatar/cura-avatar.js +1 -1
- package/dist/collection/components/cura-calendar/cura-calendar.css +2 -0
- package/dist/collection/components/cura-calendar/cura-calendar.js +79 -47
- package/dist/collection/components/cura-calendar/cura-calendar.js.map +1 -1
- package/dist/collection/components/cura-card/cura-card.js +1 -1
- package/dist/collection/components/cura-icon/cura-icon.js +1 -1
- package/dist/collection/components/cura-icons-view/cura-icons-view.js +3 -3
- package/dist/collection/components/cura-page-template/cura-page-template.js +1 -1
- package/dist/collection/components/cura-toast/cura-toast.js +1 -1
- package/dist/collection/components/forms/cura-checkbox/cura-checkbox.js +1 -1
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.js +2 -2
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option-title/cura-dropdown-search-option-title.js +1 -1
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.css +1 -1
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.js +28 -2
- package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.js.map +1 -1
- package/dist/collection/components/forms/cura-input-date/cura-input-date.css +79 -0
- package/dist/collection/components/forms/cura-input-date/cura-input-date.js +424 -0
- package/dist/collection/components/forms/cura-input-date/cura-input-date.js.map +1 -0
- package/dist/collection/components/forms/cura-input-date/cura-input-date.stories.js +138 -0
- package/dist/collection/components/forms/cura-input-date/cura-input-date.stories.js.map +1 -0
- package/dist/collection/components/forms/cura-input-text/cura-input-text.css +5 -2
- package/dist/collection/components/forms/cura-input-text/cura-input-text.js +41 -2
- package/dist/collection/components/forms/cura-input-text/cura-input-text.js.map +1 -1
- package/dist/collection/components/forms/cura-input-text/cura-input-text.stories.js +73 -21
- package/dist/collection/components/forms/cura-input-text/cura-input-text.stories.js.map +1 -1
- package/dist/collection/components/forms/cura-input-text/mask-presets/input-mask-presets.js +3 -0
- package/dist/collection/components/forms/cura-input-text/mask-presets/input-mask-presets.js.map +1 -1
- package/dist/collection/components/forms/cura-label/cura-label.js +1 -1
- package/dist/collection/components/forms/cura-radio/cura-radio.js +1 -1
- package/dist/collection/components/forms/cura-select/cura-select.css +5 -2
- package/dist/collection/components/forms/cura-select/cura-select.js +3 -3
- package/dist/collection/components/forms/cura-select-options/cura-select-option.js +1 -1
- package/dist/collection/components/forms/cura-switch/cura-switch.js +1 -1
- package/dist/collection/components/loaders/cura-loader-bar/cura-loader-bar.js +1 -1
- package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.js +1 -1
- package/dist/collection/components/text/cura-display/cura-display.js +1 -1
- package/dist/collection/components/text/cura-heading/cura-heading.js +1 -1
- package/dist/collection/components/text/cura-paragraph/cura-paragraph.js +1 -1
- package/dist/components/cura-alert.js +1 -1
- package/dist/components/cura-avatar.js +1 -1
- package/dist/components/cura-badge-number.d.ts +11 -0
- package/dist/components/cura-badge-number.js +8 -0
- package/dist/components/cura-badge-number.js.map +1 -0
- package/dist/components/cura-badge-number2.js +49 -0
- package/dist/components/cura-badge-number2.js.map +1 -0
- package/dist/components/cura-button-outline.js +1 -1
- package/dist/components/cura-button-select.js +81 -65
- package/dist/components/cura-button-select.js.map +1 -1
- package/dist/components/cura-button-transparent2.js +1 -1
- package/dist/components/cura-button.js +1 -1
- package/dist/components/cura-calendar.js +1 -4073
- package/dist/components/cura-calendar.js.map +1 -1
- package/dist/components/cura-calendar2.js +4082 -0
- package/dist/components/cura-calendar2.js.map +1 -0
- package/dist/components/cura-card.js +1 -1
- package/dist/components/cura-checkbox.js +1 -1
- package/dist/components/cura-display.js +1 -1
- package/dist/components/cura-dropdown-search-option-title.js +1 -1
- package/dist/components/cura-dropdown-search-option.js +2 -2
- package/dist/components/cura-dropdown-search.js +29 -3
- package/dist/components/cura-dropdown-search.js.map +1 -1
- package/dist/components/cura-heading2.js +1 -1
- package/dist/components/cura-icon2.js +1 -1
- package/dist/components/cura-icons-view.js +3 -3
- package/dist/components/cura-input-date.d.ts +11 -0
- package/dist/components/cura-input-date.js +270 -0
- package/dist/components/cura-input-date.js.map +1 -0
- package/dist/components/cura-input-text2.js +10 -2
- package/dist/components/cura-input-text2.js.map +1 -1
- package/dist/components/cura-label2.js +1 -1
- package/dist/components/cura-loader-bar2.js +1 -1
- package/dist/components/cura-loader-circle2.js +1 -1
- package/dist/components/cura-page-template.js +1 -1
- package/dist/components/cura-paragraph2.js +1 -1
- package/dist/components/cura-radio.js +1 -1
- package/dist/components/cura-select-option2.js +1 -1
- package/dist/components/cura-select2.js +4 -4
- package/dist/components/cura-select2.js.map +1 -1
- package/dist/components/cura-switch.js +1 -1
- package/dist/components/cura-toast.js +1 -1
- package/dist/components/index.js +4 -0
- package/dist/components/index.js.map +1 -1
- package/dist/cura/cura.esm.js +1 -1
- package/dist/cura/cura.esm.js.map +1 -1
- package/dist/cura/p-0b7a7306.js.map +1 -1
- package/dist/cura/{p-0d435e42.entry.js → p-116a1cd6.entry.js} +2 -2
- package/dist/cura/p-272c784a.js +2 -0
- package/dist/cura/p-272c784a.js.map +1 -0
- package/dist/cura/{p-4c7a2419.entry.js → p-2d267d23.entry.js} +2 -2
- package/dist/cura/{p-9b658260.entry.js → p-33772510.entry.js} +2 -2
- package/dist/cura/{p-afd2c148.entry.js → p-41c3d47d.entry.js} +2 -2
- package/dist/cura/{p-fbf20e5a.entry.js → p-44e3325a.entry.js} +2 -2
- package/dist/cura/p-4e14c01c.entry.js +2 -0
- package/dist/cura/p-563ba0cd.entry.js +2 -0
- package/dist/cura/p-563ba0cd.entry.js.map +1 -0
- package/dist/cura/{p-57b8b468.entry.js → p-8f3db0fe.entry.js} +2 -2
- package/dist/cura/{p-a00d2c68.entry.js → p-907b3d12.entry.js} +2 -2
- package/dist/cura/p-a2ae6bd2.entry.js +2 -0
- package/dist/cura/p-a2ae6bd2.entry.js.map +1 -0
- package/dist/cura/{p-6682619b.entry.js → p-b2d5db22.entry.js} +2 -2
- package/dist/cura/p-b43b69f3.entry.js +2 -0
- package/dist/cura/p-b43b69f3.entry.js.map +1 -0
- package/dist/cura/{p-5ac9d510.entry.js → p-be10b681.entry.js} +2 -2
- package/dist/cura/p-be10b681.entry.js.map +1 -0
- package/dist/cura/{p-a5cf0fd6.entry.js → p-c6508bd7.entry.js} +2 -2
- package/dist/cura/{p-2203e829.entry.js → p-dcd2e5bb.entry.js} +2 -2
- package/dist/cura/{p-84d8c67d.entry.js → p-e5023e34.entry.js} +2 -2
- package/dist/cura/p-e8bc6381.entry.js +2 -0
- package/dist/cura/p-e8bc6381.entry.js.map +1 -0
- package/dist/cura/p-ed97cf3c.entry.js +2 -0
- package/dist/cura/p-ed97cf3c.entry.js.map +1 -0
- package/dist/cura/{p-ad8a7e0f.entry.js → p-fcbf4311.entry.js} +2 -2
- package/dist/cura/{p-66c5cf5f.entry.js → p-fd083399.entry.js} +2 -2
- package/dist/cura/p-fd5ed6b0.js +3 -0
- package/dist/cura/p-fd5ed6b0.js.map +1 -0
- package/dist/cura/{p-f9433d24.entry.js → p-fdce91a7.entry.js} +2 -2
- package/dist/esm/app-globals-6ca7103d.js.map +1 -1
- package/dist/esm/cura-accordion_12.entry.js +21 -15
- package/dist/esm/cura-accordion_12.entry.js.map +1 -1
- package/dist/esm/cura-alert.entry.js +2 -2
- package/dist/esm/cura-avatar.entry.js +2 -2
- package/dist/esm/cura-badge-distance.entry.js +1 -1
- package/dist/esm/cura-badge-number.entry.js +25 -0
- package/dist/esm/cura-badge-number.entry.js.map +1 -0
- package/dist/esm/cura-button-outline.entry.js +2 -2
- package/dist/esm/cura-button-select.entry.js +69 -58
- package/dist/esm/cura-button-select.entry.js.map +1 -1
- package/dist/esm/cura-button-transparent.entry.js +2 -2
- package/dist/esm/cura-calendar.entry.js +51 -165
- package/dist/esm/cura-calendar.entry.js.map +1 -1
- package/dist/esm/cura-card.entry.js +2 -2
- package/dist/esm/cura-checkbox.entry.js +2 -2
- package/dist/esm/cura-display.entry.js +2 -2
- package/dist/esm/cura-dropdown-search-option-title.entry.js +2 -2
- package/dist/esm/cura-dropdown-search-option.entry.js +3 -3
- package/dist/esm/cura-dropdown-search.entry.js +30 -4
- package/dist/esm/cura-dropdown-search.entry.js.map +1 -1
- package/dist/esm/cura-icons-view.entry.js +4 -4
- package/dist/esm/cura-input-date.entry.js +184 -0
- package/dist/esm/cura-input-date.entry.js.map +1 -0
- package/dist/esm/cura-loader-bar.entry.js +2 -2
- package/dist/esm/cura-radio.entry.js +2 -2
- package/dist/esm/cura-switch.entry.js +2 -2
- package/dist/esm/cura-toast.entry.js +2 -2
- package/dist/esm/cura.js +3 -3
- package/dist/esm/{index-1ad98520.js → index-747aad85.js} +70 -3
- package/dist/esm/index-747aad85.js.map +1 -0
- package/dist/esm/index-fbee309a.js +120 -0
- package/dist/esm/index-fbee309a.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/types/components/badges/cura-badge-number/cura-badge-number.d.ts +8 -0
- package/dist/types/components/badges/cura-badge-number/cura-badge-number.stories.d.ts +39 -0
- package/dist/types/components/buttons/cura-button-select/cura-button-select.d.ts +12 -34
- package/dist/types/components/buttons/cura-button-select/cura-button-select.stories.d.ts +105 -0
- package/dist/types/components/cura-calendar/cura-calendar.d.ts +50 -42
- package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search.d.ts +2 -0
- package/dist/types/components/forms/cura-input-date/cura-input-date.d.ts +92 -0
- package/dist/types/components/forms/cura-input-date/cura-input-date.stories.d.ts +125 -0
- package/dist/types/components/forms/cura-input-text/cura-input-text.d.ts +6 -0
- package/dist/types/components/forms/cura-input-text/cura-input-text.stories.d.ts +15 -0
- package/dist/types/components.d.ts +158 -48
- package/package.json +2 -2
- package/dist/cjs/index-98e7ba54.js.map +0 -1
- package/dist/cura/p-312791fb.js +0 -3
- package/dist/cura/p-312791fb.js.map +0 -1
- package/dist/cura/p-42dfa3a7.entry.js +0 -2
- package/dist/cura/p-42dfa3a7.entry.js.map +0 -1
- package/dist/cura/p-5ac9d510.entry.js.map +0 -1
- package/dist/cura/p-a9cda3b1.entry.js +0 -2
- package/dist/cura/p-a9cda3b1.entry.js.map +0 -1
- package/dist/cura/p-df5c3a86.entry.js +0 -2
- package/dist/cura/p-df5c3a86.entry.js.map +0 -1
- package/dist/cura/p-dfc65f66.entry.js +0 -2
- /package/dist/cura/{p-0d435e42.entry.js.map → p-116a1cd6.entry.js.map} +0 -0
- /package/dist/cura/{p-4c7a2419.entry.js.map → p-2d267d23.entry.js.map} +0 -0
- /package/dist/cura/{p-9b658260.entry.js.map → p-33772510.entry.js.map} +0 -0
- /package/dist/cura/{p-afd2c148.entry.js.map → p-41c3d47d.entry.js.map} +0 -0
- /package/dist/cura/{p-fbf20e5a.entry.js.map → p-44e3325a.entry.js.map} +0 -0
- /package/dist/cura/{p-dfc65f66.entry.js.map → p-4e14c01c.entry.js.map} +0 -0
- /package/dist/cura/{p-57b8b468.entry.js.map → p-8f3db0fe.entry.js.map} +0 -0
- /package/dist/cura/{p-a00d2c68.entry.js.map → p-907b3d12.entry.js.map} +0 -0
- /package/dist/cura/{p-6682619b.entry.js.map → p-b2d5db22.entry.js.map} +0 -0
- /package/dist/cura/{p-a5cf0fd6.entry.js.map → p-c6508bd7.entry.js.map} +0 -0
- /package/dist/cura/{p-2203e829.entry.js.map → p-dcd2e5bb.entry.js.map} +0 -0
- /package/dist/cura/{p-84d8c67d.entry.js.map → p-e5023e34.entry.js.map} +0 -0
- /package/dist/cura/{p-ad8a7e0f.entry.js.map → p-fcbf4311.entry.js.map} +0 -0
- /package/dist/cura/{p-66c5cf5f.entry.js.map → p-fd083399.entry.js.map} +0 -0
- /package/dist/cura/{p-f9433d24.entry.js.map → p-fdce91a7.entry.js.map} +0 -0
|
@@ -2,17 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
|
|
7
|
-
function _typeof(o) {
|
|
8
|
-
"@babel/helpers - typeof";
|
|
9
|
-
|
|
10
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
11
|
-
return typeof o;
|
|
12
|
-
} : function (o) {
|
|
13
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
14
|
-
}, _typeof(o);
|
|
15
|
-
}
|
|
5
|
+
const index$1 = require('./index-e6d728ec.js');
|
|
6
|
+
const index = require('./index-6dc29195.js');
|
|
16
7
|
|
|
17
8
|
function toInteger(dirtyNumber) {
|
|
18
9
|
if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
|
|
@@ -25,63 +16,6 @@ function toInteger(dirtyNumber) {
|
|
|
25
16
|
return number < 0 ? Math.ceil(number) : Math.floor(number);
|
|
26
17
|
}
|
|
27
18
|
|
|
28
|
-
function requiredArgs(required, args) {
|
|
29
|
-
if (args.length < required) {
|
|
30
|
-
throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* @name toDate
|
|
36
|
-
* @category Common Helpers
|
|
37
|
-
* @summary Convert the given argument to an instance of Date.
|
|
38
|
-
*
|
|
39
|
-
* @description
|
|
40
|
-
* Convert the given argument to an instance of Date.
|
|
41
|
-
*
|
|
42
|
-
* If the argument is an instance of Date, the function returns its clone.
|
|
43
|
-
*
|
|
44
|
-
* If the argument is a number, it is treated as a timestamp.
|
|
45
|
-
*
|
|
46
|
-
* If the argument is none of the above, the function returns Invalid Date.
|
|
47
|
-
*
|
|
48
|
-
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
|
|
49
|
-
*
|
|
50
|
-
* @param {Date|Number} argument - the value to convert
|
|
51
|
-
* @returns {Date} the parsed date in the local time zone
|
|
52
|
-
* @throws {TypeError} 1 argument required
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* // Clone the date:
|
|
56
|
-
* const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
|
|
57
|
-
* //=> Tue Feb 11 2014 11:30:30
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* // Convert the timestamp to date:
|
|
61
|
-
* const result = toDate(1392098430000)
|
|
62
|
-
* //=> Tue Feb 11 2014 11:30:30
|
|
63
|
-
*/
|
|
64
|
-
function toDate(argument) {
|
|
65
|
-
requiredArgs(1, arguments);
|
|
66
|
-
var argStr = Object.prototype.toString.call(argument);
|
|
67
|
-
|
|
68
|
-
// Clone the date
|
|
69
|
-
if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
|
|
70
|
-
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
|
|
71
|
-
return new Date(argument.getTime());
|
|
72
|
-
} else if (typeof argument === 'number' || argStr === '[object Number]') {
|
|
73
|
-
return new Date(argument);
|
|
74
|
-
} else {
|
|
75
|
-
if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
|
|
76
|
-
// eslint-disable-next-line no-console
|
|
77
|
-
console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
|
|
78
|
-
// eslint-disable-next-line no-console
|
|
79
|
-
console.warn(new Error().stack);
|
|
80
|
-
}
|
|
81
|
-
return new Date(NaN);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
19
|
/**
|
|
86
20
|
* @name addDays
|
|
87
21
|
* @category Day Helpers
|
|
@@ -101,8 +35,8 @@ function toDate(argument) {
|
|
|
101
35
|
* //=> Thu Sep 11 2014 00:00:00
|
|
102
36
|
*/
|
|
103
37
|
function addDays(dirtyDate, dirtyAmount) {
|
|
104
|
-
requiredArgs(2, arguments);
|
|
105
|
-
var date = toDate(dirtyDate);
|
|
38
|
+
index.requiredArgs(2, arguments);
|
|
39
|
+
var date = index.toDate(dirtyDate);
|
|
106
40
|
var amount = toInteger(dirtyAmount);
|
|
107
41
|
if (isNaN(amount)) {
|
|
108
42
|
return new Date(NaN);
|
|
@@ -134,8 +68,8 @@ function addDays(dirtyDate, dirtyAmount) {
|
|
|
134
68
|
* //=> Sun Feb 01 2015 00:00:00
|
|
135
69
|
*/
|
|
136
70
|
function addMonths(dirtyDate, dirtyAmount) {
|
|
137
|
-
requiredArgs(2, arguments);
|
|
138
|
-
var date = toDate(dirtyDate);
|
|
71
|
+
index.requiredArgs(2, arguments);
|
|
72
|
+
var date = index.toDate(dirtyDate);
|
|
139
73
|
var amount = toInteger(dirtyAmount);
|
|
140
74
|
if (isNaN(amount)) {
|
|
141
75
|
return new Date(NaN);
|
|
@@ -193,8 +127,8 @@ function addMonths(dirtyDate, dirtyAmount) {
|
|
|
193
127
|
* //=> Thu Jul 10 2014 12:45:30.750
|
|
194
128
|
*/
|
|
195
129
|
function addMilliseconds(dirtyDate, dirtyAmount) {
|
|
196
|
-
requiredArgs(2, arguments);
|
|
197
|
-
var timestamp = toDate(dirtyDate).getTime();
|
|
130
|
+
index.requiredArgs(2, arguments);
|
|
131
|
+
var timestamp = index.toDate(dirtyDate).getTime();
|
|
198
132
|
var amount = toInteger(dirtyAmount);
|
|
199
133
|
return new Date(timestamp + amount);
|
|
200
134
|
}
|
|
@@ -233,7 +167,7 @@ function getDefaultOptions() {
|
|
|
233
167
|
*/
|
|
234
168
|
function startOfWeek(dirtyDate, options) {
|
|
235
169
|
var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
|
|
236
|
-
requiredArgs(1, arguments);
|
|
170
|
+
index.requiredArgs(1, arguments);
|
|
237
171
|
var defaultOptions = getDefaultOptions();
|
|
238
172
|
var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
|
|
239
173
|
|
|
@@ -241,7 +175,7 @@ function startOfWeek(dirtyDate, options) {
|
|
|
241
175
|
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
|
|
242
176
|
throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
|
|
243
177
|
}
|
|
244
|
-
var date = toDate(dirtyDate);
|
|
178
|
+
var date = index.toDate(dirtyDate);
|
|
245
179
|
var day = date.getDay();
|
|
246
180
|
var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
|
247
181
|
date.setDate(date.getDate() - diff);
|
|
@@ -285,8 +219,8 @@ function getTimezoneOffsetInMilliseconds(date) {
|
|
|
285
219
|
* //=> Tue Sep 02 2014 00:00:00
|
|
286
220
|
*/
|
|
287
221
|
function startOfDay(dirtyDate) {
|
|
288
|
-
requiredArgs(1, arguments);
|
|
289
|
-
var date = toDate(dirtyDate);
|
|
222
|
+
index.requiredArgs(1, arguments);
|
|
223
|
+
var date = index.toDate(dirtyDate);
|
|
290
224
|
date.setHours(0, 0, 0, 0);
|
|
291
225
|
return date;
|
|
292
226
|
}
|
|
@@ -310,7 +244,7 @@ function startOfDay(dirtyDate) {
|
|
|
310
244
|
* //=> Mon Sep 29 2014 00:00:00
|
|
311
245
|
*/
|
|
312
246
|
function addWeeks(dirtyDate, dirtyAmount) {
|
|
313
|
-
requiredArgs(2, arguments);
|
|
247
|
+
index.requiredArgs(2, arguments);
|
|
314
248
|
var amount = toInteger(dirtyAmount);
|
|
315
249
|
var days = amount * 7;
|
|
316
250
|
return addDays(dirtyDate, days);
|
|
@@ -374,7 +308,7 @@ var millisecondsInHour = 3600000;
|
|
|
374
308
|
* //=> false
|
|
375
309
|
*/
|
|
376
310
|
function isSameDay(dirtyDateLeft, dirtyDateRight) {
|
|
377
|
-
requiredArgs(2, arguments);
|
|
311
|
+
index.requiredArgs(2, arguments);
|
|
378
312
|
var dateLeftStartOfDay = startOfDay(dirtyDateLeft);
|
|
379
313
|
var dateRightStartOfDay = startOfDay(dirtyDateRight);
|
|
380
314
|
return dateLeftStartOfDay.getTime() === dateRightStartOfDay.getTime();
|
|
@@ -413,8 +347,8 @@ function isSameDay(dirtyDateLeft, dirtyDateRight) {
|
|
|
413
347
|
* //=> false
|
|
414
348
|
*/
|
|
415
349
|
function isDate(value) {
|
|
416
|
-
requiredArgs(1, arguments);
|
|
417
|
-
return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
|
|
350
|
+
index.requiredArgs(1, arguments);
|
|
351
|
+
return value instanceof Date || index._typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
|
|
418
352
|
}
|
|
419
353
|
|
|
420
354
|
/**
|
|
@@ -449,11 +383,11 @@ function isDate(value) {
|
|
|
449
383
|
* //=> false
|
|
450
384
|
*/
|
|
451
385
|
function isValid(dirtyDate) {
|
|
452
|
-
requiredArgs(1, arguments);
|
|
386
|
+
index.requiredArgs(1, arguments);
|
|
453
387
|
if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
|
|
454
388
|
return false;
|
|
455
389
|
}
|
|
456
|
-
var date = toDate(dirtyDate);
|
|
390
|
+
var date = index.toDate(dirtyDate);
|
|
457
391
|
return !isNaN(Number(date));
|
|
458
392
|
}
|
|
459
393
|
|
|
@@ -476,8 +410,8 @@ function isValid(dirtyDate) {
|
|
|
476
410
|
* //=> Tue Sep 30 2014 23:59:59.999
|
|
477
411
|
*/
|
|
478
412
|
function endOfMonth(dirtyDate) {
|
|
479
|
-
requiredArgs(1, arguments);
|
|
480
|
-
var date = toDate(dirtyDate);
|
|
413
|
+
index.requiredArgs(1, arguments);
|
|
414
|
+
var date = index.toDate(dirtyDate);
|
|
481
415
|
var month = date.getMonth();
|
|
482
416
|
date.setFullYear(date.getFullYear(), month + 1, 0);
|
|
483
417
|
date.setHours(23, 59, 59, 999);
|
|
@@ -517,10 +451,10 @@ function endOfMonth(dirtyDate) {
|
|
|
517
451
|
*/
|
|
518
452
|
function eachDayOfInterval(dirtyInterval, options) {
|
|
519
453
|
var _options$step;
|
|
520
|
-
requiredArgs(1, arguments);
|
|
454
|
+
index.requiredArgs(1, arguments);
|
|
521
455
|
var interval = dirtyInterval || {};
|
|
522
|
-
var startDate = toDate(interval.start);
|
|
523
|
-
var endDate = toDate(interval.end);
|
|
456
|
+
var startDate = index.toDate(interval.start);
|
|
457
|
+
var endDate = index.toDate(interval.end);
|
|
524
458
|
var endTime = endDate.getTime();
|
|
525
459
|
|
|
526
460
|
// Throw an exception if start date is after end date or if any date is `Invalid Date`
|
|
@@ -533,7 +467,7 @@ function eachDayOfInterval(dirtyInterval, options) {
|
|
|
533
467
|
var step = Number((_options$step = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step !== void 0 ? _options$step : 1);
|
|
534
468
|
if (step < 1 || isNaN(step)) throw new RangeError('`options.step` must be a number greater than 1');
|
|
535
469
|
while (currentDate.getTime() <= endTime) {
|
|
536
|
-
dates.push(toDate(currentDate));
|
|
470
|
+
dates.push(index.toDate(currentDate));
|
|
537
471
|
currentDate.setDate(currentDate.getDate() + step);
|
|
538
472
|
currentDate.setHours(0, 0, 0, 0);
|
|
539
473
|
}
|
|
@@ -571,10 +505,10 @@ function eachDayOfInterval(dirtyInterval, options) {
|
|
|
571
505
|
* // ]
|
|
572
506
|
*/
|
|
573
507
|
function eachMonthOfInterval(dirtyInterval) {
|
|
574
|
-
requiredArgs(1, arguments);
|
|
508
|
+
index.requiredArgs(1, arguments);
|
|
575
509
|
var interval = dirtyInterval || {};
|
|
576
|
-
var startDate = toDate(interval.start);
|
|
577
|
-
var endDate = toDate(interval.end);
|
|
510
|
+
var startDate = index.toDate(interval.start);
|
|
511
|
+
var endDate = index.toDate(interval.end);
|
|
578
512
|
var endTime = endDate.getTime();
|
|
579
513
|
var dates = [];
|
|
580
514
|
|
|
@@ -586,7 +520,7 @@ function eachMonthOfInterval(dirtyInterval) {
|
|
|
586
520
|
currentDate.setHours(0, 0, 0, 0);
|
|
587
521
|
currentDate.setDate(1);
|
|
588
522
|
while (currentDate.getTime() <= endTime) {
|
|
589
|
-
dates.push(toDate(currentDate));
|
|
523
|
+
dates.push(index.toDate(currentDate));
|
|
590
524
|
currentDate.setMonth(currentDate.getMonth() + 1);
|
|
591
525
|
}
|
|
592
526
|
return dates;
|
|
@@ -611,8 +545,8 @@ function eachMonthOfInterval(dirtyInterval) {
|
|
|
611
545
|
* //=> Mon Sep 01 2014 00:00:00
|
|
612
546
|
*/
|
|
613
547
|
function startOfMonth(dirtyDate) {
|
|
614
|
-
requiredArgs(1, arguments);
|
|
615
|
-
var date = toDate(dirtyDate);
|
|
548
|
+
index.requiredArgs(1, arguments);
|
|
549
|
+
var date = index.toDate(dirtyDate);
|
|
616
550
|
date.setDate(1);
|
|
617
551
|
date.setHours(0, 0, 0, 0);
|
|
618
552
|
return date;
|
|
@@ -637,8 +571,8 @@ function startOfMonth(dirtyDate) {
|
|
|
637
571
|
* //=> Wed Jan 01 2014 00:00:00
|
|
638
572
|
*/
|
|
639
573
|
function startOfYear(dirtyDate) {
|
|
640
|
-
requiredArgs(1, arguments);
|
|
641
|
-
var cleanDate = toDate(dirtyDate);
|
|
574
|
+
index.requiredArgs(1, arguments);
|
|
575
|
+
var cleanDate = index.toDate(dirtyDate);
|
|
642
576
|
var date = new Date(0);
|
|
643
577
|
date.setFullYear(cleanDate.getFullYear(), 0, 1);
|
|
644
578
|
date.setHours(0, 0, 0, 0);
|
|
@@ -674,7 +608,7 @@ function startOfYear(dirtyDate) {
|
|
|
674
608
|
*/
|
|
675
609
|
function endOfWeek(dirtyDate, options) {
|
|
676
610
|
var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
|
|
677
|
-
requiredArgs(1, arguments);
|
|
611
|
+
index.requiredArgs(1, arguments);
|
|
678
612
|
var defaultOptions = getDefaultOptions();
|
|
679
613
|
var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
|
|
680
614
|
|
|
@@ -682,7 +616,7 @@ function endOfWeek(dirtyDate, options) {
|
|
|
682
616
|
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
|
|
683
617
|
throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
|
|
684
618
|
}
|
|
685
|
-
var date = toDate(dirtyDate);
|
|
619
|
+
var date = index.toDate(dirtyDate);
|
|
686
620
|
var day = date.getDay();
|
|
687
621
|
var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
|
|
688
622
|
date.setDate(date.getDate() + diff);
|
|
@@ -709,15 +643,15 @@ function endOfWeek(dirtyDate, options) {
|
|
|
709
643
|
* //=> Thu Jul 10 2014 12:45:29.250
|
|
710
644
|
*/
|
|
711
645
|
function subMilliseconds(dirtyDate, dirtyAmount) {
|
|
712
|
-
requiredArgs(2, arguments);
|
|
646
|
+
index.requiredArgs(2, arguments);
|
|
713
647
|
var amount = toInteger(dirtyAmount);
|
|
714
648
|
return addMilliseconds(dirtyDate, -amount);
|
|
715
649
|
}
|
|
716
650
|
|
|
717
651
|
var MILLISECONDS_IN_DAY = 86400000;
|
|
718
652
|
function getUTCDayOfYear(dirtyDate) {
|
|
719
|
-
requiredArgs(1, arguments);
|
|
720
|
-
var date = toDate(dirtyDate);
|
|
653
|
+
index.requiredArgs(1, arguments);
|
|
654
|
+
var date = index.toDate(dirtyDate);
|
|
721
655
|
var timestamp = date.getTime();
|
|
722
656
|
date.setUTCMonth(0, 1);
|
|
723
657
|
date.setUTCHours(0, 0, 0, 0);
|
|
@@ -727,9 +661,9 @@ function getUTCDayOfYear(dirtyDate) {
|
|
|
727
661
|
}
|
|
728
662
|
|
|
729
663
|
function startOfUTCISOWeek(dirtyDate) {
|
|
730
|
-
requiredArgs(1, arguments);
|
|
664
|
+
index.requiredArgs(1, arguments);
|
|
731
665
|
var weekStartsOn = 1;
|
|
732
|
-
var date = toDate(dirtyDate);
|
|
666
|
+
var date = index.toDate(dirtyDate);
|
|
733
667
|
var day = date.getUTCDay();
|
|
734
668
|
var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
|
735
669
|
date.setUTCDate(date.getUTCDate() - diff);
|
|
@@ -738,8 +672,8 @@ function startOfUTCISOWeek(dirtyDate) {
|
|
|
738
672
|
}
|
|
739
673
|
|
|
740
674
|
function getUTCISOWeekYear(dirtyDate) {
|
|
741
|
-
requiredArgs(1, arguments);
|
|
742
|
-
var date = toDate(dirtyDate);
|
|
675
|
+
index.requiredArgs(1, arguments);
|
|
676
|
+
var date = index.toDate(dirtyDate);
|
|
743
677
|
var year = date.getUTCFullYear();
|
|
744
678
|
var fourthOfJanuaryOfNextYear = new Date(0);
|
|
745
679
|
fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
|
|
@@ -759,7 +693,7 @@ function getUTCISOWeekYear(dirtyDate) {
|
|
|
759
693
|
}
|
|
760
694
|
|
|
761
695
|
function startOfUTCISOWeekYear(dirtyDate) {
|
|
762
|
-
requiredArgs(1, arguments);
|
|
696
|
+
index.requiredArgs(1, arguments);
|
|
763
697
|
var year = getUTCISOWeekYear(dirtyDate);
|
|
764
698
|
var fourthOfJanuary = new Date(0);
|
|
765
699
|
fourthOfJanuary.setUTCFullYear(year, 0, 4);
|
|
@@ -770,8 +704,8 @@ function startOfUTCISOWeekYear(dirtyDate) {
|
|
|
770
704
|
|
|
771
705
|
var MILLISECONDS_IN_WEEK$1 = 604800000;
|
|
772
706
|
function getUTCISOWeek(dirtyDate) {
|
|
773
|
-
requiredArgs(1, arguments);
|
|
774
|
-
var date = toDate(dirtyDate);
|
|
707
|
+
index.requiredArgs(1, arguments);
|
|
708
|
+
var date = index.toDate(dirtyDate);
|
|
775
709
|
var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
|
|
776
710
|
|
|
777
711
|
// Round the number of days to the nearest integer
|
|
@@ -782,7 +716,7 @@ function getUTCISOWeek(dirtyDate) {
|
|
|
782
716
|
|
|
783
717
|
function startOfUTCWeek(dirtyDate, options) {
|
|
784
718
|
var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
|
|
785
|
-
requiredArgs(1, arguments);
|
|
719
|
+
index.requiredArgs(1, arguments);
|
|
786
720
|
var defaultOptions = getDefaultOptions();
|
|
787
721
|
var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
|
|
788
722
|
|
|
@@ -790,7 +724,7 @@ function startOfUTCWeek(dirtyDate, options) {
|
|
|
790
724
|
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
|
|
791
725
|
throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
|
|
792
726
|
}
|
|
793
|
-
var date = toDate(dirtyDate);
|
|
727
|
+
var date = index.toDate(dirtyDate);
|
|
794
728
|
var day = date.getUTCDay();
|
|
795
729
|
var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
|
796
730
|
date.setUTCDate(date.getUTCDate() - diff);
|
|
@@ -800,8 +734,8 @@ function startOfUTCWeek(dirtyDate, options) {
|
|
|
800
734
|
|
|
801
735
|
function getUTCWeekYear(dirtyDate, options) {
|
|
802
736
|
var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
|
|
803
|
-
requiredArgs(1, arguments);
|
|
804
|
-
var date = toDate(dirtyDate);
|
|
737
|
+
index.requiredArgs(1, arguments);
|
|
738
|
+
var date = index.toDate(dirtyDate);
|
|
805
739
|
var year = date.getUTCFullYear();
|
|
806
740
|
var defaultOptions = getDefaultOptions();
|
|
807
741
|
var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
|
|
@@ -829,7 +763,7 @@ function getUTCWeekYear(dirtyDate, options) {
|
|
|
829
763
|
|
|
830
764
|
function startOfUTCWeekYear(dirtyDate, options) {
|
|
831
765
|
var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
|
|
832
|
-
requiredArgs(1, arguments);
|
|
766
|
+
index.requiredArgs(1, arguments);
|
|
833
767
|
var defaultOptions = getDefaultOptions();
|
|
834
768
|
var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
|
|
835
769
|
var year = getUTCWeekYear(dirtyDate, options);
|
|
@@ -842,8 +776,8 @@ function startOfUTCWeekYear(dirtyDate, options) {
|
|
|
842
776
|
|
|
843
777
|
var MILLISECONDS_IN_WEEK = 604800000;
|
|
844
778
|
function getUTCWeek(dirtyDate, options) {
|
|
845
|
-
requiredArgs(1, arguments);
|
|
846
|
-
var date = toDate(dirtyDate);
|
|
779
|
+
index.requiredArgs(1, arguments);
|
|
780
|
+
var date = index.toDate(dirtyDate);
|
|
847
781
|
var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
|
|
848
782
|
|
|
849
783
|
// Round the number of days to the nearest integer
|
|
@@ -2605,7 +2539,7 @@ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
|
2605
2539
|
|
|
2606
2540
|
function format(dirtyDate, dirtyFormatStr, options) {
|
|
2607
2541
|
var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;
|
|
2608
|
-
requiredArgs(2, arguments);
|
|
2542
|
+
index.requiredArgs(2, arguments);
|
|
2609
2543
|
var formatStr = String(dirtyFormatStr);
|
|
2610
2544
|
var defaultOptions = getDefaultOptions();
|
|
2611
2545
|
var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;
|
|
@@ -2627,7 +2561,7 @@ function format(dirtyDate, dirtyFormatStr, options) {
|
|
|
2627
2561
|
if (!locale.formatLong) {
|
|
2628
2562
|
throw new RangeError('locale must contain formatLong property');
|
|
2629
2563
|
}
|
|
2630
|
-
var originalDate = toDate(dirtyDate);
|
|
2564
|
+
var originalDate = index.toDate(dirtyDate);
|
|
2631
2565
|
if (!isValid(originalDate)) {
|
|
2632
2566
|
throw new RangeError('Invalid time value');
|
|
2633
2567
|
}
|
|
@@ -2702,8 +2636,8 @@ function cleanEscapedString(input) {
|
|
|
2702
2636
|
* //=> 3
|
|
2703
2637
|
*/
|
|
2704
2638
|
function getDay(dirtyDate) {
|
|
2705
|
-
requiredArgs(1, arguments);
|
|
2706
|
-
var date = toDate(dirtyDate);
|
|
2639
|
+
index.requiredArgs(1, arguments);
|
|
2640
|
+
var date = index.toDate(dirtyDate);
|
|
2707
2641
|
var day = date.getDay();
|
|
2708
2642
|
return day;
|
|
2709
2643
|
}
|
|
@@ -2726,8 +2660,8 @@ function getDay(dirtyDate) {
|
|
|
2726
2660
|
* //=> 1
|
|
2727
2661
|
*/
|
|
2728
2662
|
function getMonth(dirtyDate) {
|
|
2729
|
-
requiredArgs(1, arguments);
|
|
2730
|
-
var date = toDate(dirtyDate);
|
|
2663
|
+
index.requiredArgs(1, arguments);
|
|
2664
|
+
var date = index.toDate(dirtyDate);
|
|
2731
2665
|
var month = date.getMonth();
|
|
2732
2666
|
return month;
|
|
2733
2667
|
}
|
|
@@ -2750,58 +2684,8 @@ function getMonth(dirtyDate) {
|
|
|
2750
2684
|
* //=> 2014
|
|
2751
2685
|
*/
|
|
2752
2686
|
function getYear(dirtyDate) {
|
|
2753
|
-
requiredArgs(1, arguments);
|
|
2754
|
-
return toDate(dirtyDate).getFullYear();
|
|
2755
|
-
}
|
|
2756
|
-
|
|
2757
|
-
/**
|
|
2758
|
-
* @name isAfter
|
|
2759
|
-
* @category Common Helpers
|
|
2760
|
-
* @summary Is the first date after the second one?
|
|
2761
|
-
*
|
|
2762
|
-
* @description
|
|
2763
|
-
* Is the first date after the second one?
|
|
2764
|
-
*
|
|
2765
|
-
* @param {Date|Number} date - the date that should be after the other one to return true
|
|
2766
|
-
* @param {Date|Number} dateToCompare - the date to compare with
|
|
2767
|
-
* @returns {Boolean} the first date is after the second date
|
|
2768
|
-
* @throws {TypeError} 2 arguments required
|
|
2769
|
-
*
|
|
2770
|
-
* @example
|
|
2771
|
-
* // Is 10 July 1989 after 11 February 1987?
|
|
2772
|
-
* const result = isAfter(new Date(1989, 6, 10), new Date(1987, 1, 11))
|
|
2773
|
-
* //=> true
|
|
2774
|
-
*/
|
|
2775
|
-
function isAfter(dirtyDate, dirtyDateToCompare) {
|
|
2776
|
-
requiredArgs(2, arguments);
|
|
2777
|
-
var date = toDate(dirtyDate);
|
|
2778
|
-
var dateToCompare = toDate(dirtyDateToCompare);
|
|
2779
|
-
return date.getTime() > dateToCompare.getTime();
|
|
2780
|
-
}
|
|
2781
|
-
|
|
2782
|
-
/**
|
|
2783
|
-
* @name isBefore
|
|
2784
|
-
* @category Common Helpers
|
|
2785
|
-
* @summary Is the first date before the second one?
|
|
2786
|
-
*
|
|
2787
|
-
* @description
|
|
2788
|
-
* Is the first date before the second one?
|
|
2789
|
-
*
|
|
2790
|
-
* @param {Date|Number} date - the date that should be before the other one to return true
|
|
2791
|
-
* @param {Date|Number} dateToCompare - the date to compare with
|
|
2792
|
-
* @returns {Boolean} the first date is before the second date
|
|
2793
|
-
* @throws {TypeError} 2 arguments required
|
|
2794
|
-
*
|
|
2795
|
-
* @example
|
|
2796
|
-
* // Is 10 July 1989 before 11 February 1987?
|
|
2797
|
-
* const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
|
|
2798
|
-
* //=> false
|
|
2799
|
-
*/
|
|
2800
|
-
function isBefore(dirtyDate, dirtyDateToCompare) {
|
|
2801
|
-
requiredArgs(2, arguments);
|
|
2802
|
-
var date = toDate(dirtyDate);
|
|
2803
|
-
var dateToCompare = toDate(dirtyDateToCompare);
|
|
2804
|
-
return date.getTime() < dateToCompare.getTime();
|
|
2687
|
+
index.requiredArgs(1, arguments);
|
|
2688
|
+
return index.toDate(dirtyDate).getFullYear();
|
|
2805
2689
|
}
|
|
2806
2690
|
|
|
2807
2691
|
/**
|
|
@@ -2826,7 +2710,7 @@ function isBefore(dirtyDate, dirtyDateToCompare) {
|
|
|
2826
2710
|
* //=> true
|
|
2827
2711
|
*/
|
|
2828
2712
|
function isToday(dirtyDate) {
|
|
2829
|
-
requiredArgs(1, arguments);
|
|
2713
|
+
index.requiredArgs(1, arguments);
|
|
2830
2714
|
return isSameDay(dirtyDate, Date.now());
|
|
2831
2715
|
}
|
|
2832
2716
|
|
|
@@ -2849,7 +2733,7 @@ function isToday(dirtyDate) {
|
|
|
2849
2733
|
* //=> Fri Aug 22 2014 00:00:00
|
|
2850
2734
|
*/
|
|
2851
2735
|
function subDays(dirtyDate, dirtyAmount) {
|
|
2852
|
-
requiredArgs(2, arguments);
|
|
2736
|
+
index.requiredArgs(2, arguments);
|
|
2853
2737
|
var amount = toInteger(dirtyAmount);
|
|
2854
2738
|
return addDays(dirtyDate, -amount);
|
|
2855
2739
|
}
|
|
@@ -2888,7 +2772,7 @@ function subDays(dirtyDate, dirtyAmount) {
|
|
|
2888
2772
|
*/
|
|
2889
2773
|
function parseISO(argument, options) {
|
|
2890
2774
|
var _options$additionalDi;
|
|
2891
|
-
requiredArgs(1, arguments);
|
|
2775
|
+
index.requiredArgs(1, arguments);
|
|
2892
2776
|
var additionalDigits = toInteger((_options$additionalDi = options === null || options === void 0 ? void 0 : options.additionalDigits) !== null && _options$additionalDi !== void 0 ? _options$additionalDi : 2);
|
|
2893
2777
|
if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {
|
|
2894
2778
|
throw new RangeError('additionalDigits must be 0, 1 or 2');
|
|
@@ -3099,7 +2983,7 @@ function validateTimezone(_hours, minutes) {
|
|
|
3099
2983
|
* //=> Mon Sep 01 2014 00:00:00
|
|
3100
2984
|
*/
|
|
3101
2985
|
function subMonths(dirtyDate, dirtyAmount) {
|
|
3102
|
-
requiredArgs(2, arguments);
|
|
2986
|
+
index.requiredArgs(2, arguments);
|
|
3103
2987
|
var amount = toInteger(dirtyAmount);
|
|
3104
2988
|
return addMonths(dirtyDate, -amount);
|
|
3105
2989
|
}
|
|
@@ -3123,7 +3007,7 @@ function subMonths(dirtyDate, dirtyAmount) {
|
|
|
3123
3007
|
* //=> Mon Aug 04 2014 00:00:00
|
|
3124
3008
|
*/
|
|
3125
3009
|
function subWeeks(dirtyDate, dirtyAmount) {
|
|
3126
|
-
requiredArgs(2, arguments);
|
|
3010
|
+
index.requiredArgs(2, arguments);
|
|
3127
3011
|
var amount = toInteger(dirtyAmount);
|
|
3128
3012
|
return addWeeks(dirtyDate, -amount);
|
|
3129
3013
|
}
|
|
@@ -3567,13 +3451,13 @@ var locale = {
|
|
|
3567
3451
|
};
|
|
3568
3452
|
const ptBR = locale;
|
|
3569
3453
|
|
|
3570
|
-
const curaCalendarCss = ":host{display:block;width:var(--width)}:host .calendar{display:flex;flex-direction:column;gap:5px;width:var(--width);min-width:268px;border-radius:4px;overflow:hidden;background:#fff;font-family:var(--font-family)}:host .calendar.embedded{border:2px solid var(--neutral-light);padding:0px 12px 12px 12px}:host .calendar.floating{box-shadow:0 4px 8px var(--neutral-light)}:host .header{position:relative;padding:12px 0}:host .header::after{content:\"\";position:absolute;bottom:0;left:2px;right:2px;border-bottom:2px dotted var(--neutral-light)}:host .month-year{display:flex;padding:12px 8px;justify-content:space-between;align-self:stretch}:host .month-year.dropdown{padding:0%}:host .select{display:flex;padding:7px 10px 0px;justify-content:center;align-items:center;gap:6px;flex:1 0 0}:host .drop-month{display:flex;max-width:118px;padding:0px;align-items:flex-start;gap:0px;flex:1 0 0}:host .drop-year{display:flex;min-width:80px;max-width:85px;padding:0px;align-items:flex-start;gap:0px;flex:1 0 0}:host .days-of-week{display:flex;height:30px;padding:4px;justify-content:center;align-items:center;gap:4px;flex-shrink:0}:host .day{flex:1;text-align:center}:host .dates{display:flex;flex-wrap:wrap;align-items:center;align-self:stretch;gap:0}:host .icon{cursor:pointer;position:relative;overflow:hidden;border-radius:50%}:host .icon.dropdown{margin-top:10px}:host .icon::before{content:\"\";position:absolute;border-radius:50%;top:50%;left:50%;width:20px;height:20px;background:var(--accent-base);transform:translate(-50%, -50%) scale(0);transition:transform 0.2s ease}:host .icon:active::before{transform:translate(-50%, -50%) scale(1)}:host .icon:active{transform:scale(1)}:host .collapsed-container{text-align:center;position:relative;display:flex;align-items:center;justify-content:center;padding-top:10px}:host .collapsed-container::before{content:\"\";position:absolute;bottom:0;top:0;left:2px;right:2px;border-top:2px dotted var(--neutral-light)}:host .date{display:flex;justify-content:center;align-items:center;height:auto;width:14.2857142857%;aspect-ratio:1;font-size:14px;cursor:pointer;position:relative;box-sizing:border-box;text-align:center;flex-shrink:0}:host .date.today{border:2px solid var(--primary-darker);border-radius:50%;color:var(--primary-darker)}:host .date.selected,:host .date.default-dates{color:var(--neutral-black) !important;background:var(--accent-base);border-radius:50%;border:none}:host .date.invalid{color:var(--neutral-dark) !important;cursor:not-allowed}:host .date.invalid:hover{background:none;box-shadow:none}:host .date.valid{color:var(--primary-darker);font-weight:var(--font-weight-bold)}:host .date.range.start{border-radius:50% 0 0 50%;color:var(--primary-darker) !important;background:var(--accent-base)}:host .date.range.interval{border-radius:0;background-color:var(--accent-light);color:var(--neutral-black)}:host .date.range.interval.today{border:none}:host .date.range.end{border-radius:0 50% 50% 0;color:var(--primary-darker) !important;background:var(--accent-base)}:host .date:hover{background:var(--accent-light);border-radius:50%;color:var(--neutral-black)}:host select,:host input{width:60px;font-size:16px;box-shadow:0 2px 2px var(--neutral-black);padding:5px;border-radius:4px;border:1px solid #ccc;background:#f7f7f7}.teste{width:100%}";
|
|
3454
|
+
const curaCalendarCss = ":host{display:block;width:var(--width);max-width:400px;margin:0 auto}:host .calendar{display:flex;flex-direction:column;gap:5px;width:var(--width);min-width:268px;border-radius:4px;overflow:hidden;background:#fff;font-family:var(--font-family)}:host .calendar.embedded{border:2px solid var(--neutral-light);padding:0px 12px 12px 12px}:host .calendar.floating{box-shadow:0 4px 8px var(--neutral-light)}:host .header{position:relative;padding:12px 0}:host .header::after{content:\"\";position:absolute;bottom:0;left:2px;right:2px;border-bottom:2px dotted var(--neutral-light)}:host .month-year{display:flex;padding:12px 8px;justify-content:space-between;align-self:stretch}:host .month-year.dropdown{padding:0%}:host .select{display:flex;padding:7px 10px 0px;justify-content:center;align-items:center;gap:6px;flex:1 0 0}:host .drop-month{display:flex;max-width:118px;padding:0px;align-items:flex-start;gap:0px;flex:1 0 0}:host .drop-year{display:flex;min-width:80px;max-width:85px;padding:0px;align-items:flex-start;gap:0px;flex:1 0 0}:host .days-of-week{display:flex;height:30px;padding:4px;justify-content:center;align-items:center;gap:4px;flex-shrink:0}:host .day{flex:1;text-align:center}:host .dates{display:flex;flex-wrap:wrap;align-items:center;align-self:stretch;gap:0}:host .icon{cursor:pointer;position:relative;overflow:hidden;border-radius:50%}:host .icon.dropdown{margin-top:10px}:host .icon::before{content:\"\";position:absolute;border-radius:50%;top:50%;left:50%;width:20px;height:20px;background:var(--accent-base);transform:translate(-50%, -50%) scale(0);transition:transform 0.2s ease}:host .icon:active::before{transform:translate(-50%, -50%) scale(1)}:host .icon:active{transform:scale(1)}:host .collapsed-container{text-align:center;position:relative;display:flex;align-items:center;justify-content:center;padding-top:10px}:host .collapsed-container::before{content:\"\";position:absolute;bottom:0;top:0;left:2px;right:2px;border-top:2px dotted var(--neutral-light)}:host .date{display:flex;justify-content:center;align-items:center;height:auto;width:14.2857142857%;aspect-ratio:1;font-size:14px;cursor:pointer;position:relative;box-sizing:border-box;text-align:center;flex-shrink:0}:host .date.today{border:2px solid var(--primary-darker);border-radius:50%;color:var(--primary-darker)}:host .date.selected,:host .date.default-dates{color:var(--neutral-black) !important;background:var(--accent-base);border-radius:50%;border:none}:host .date.invalid{color:var(--neutral-dark) !important;cursor:not-allowed}:host .date.invalid:hover{background:none;box-shadow:none}:host .date.valid{color:var(--primary-darker);font-weight:var(--font-weight-bold)}:host .date.range.start{border-radius:50% 0 0 50%;color:var(--primary-darker) !important;background:var(--accent-base)}:host .date.range.interval{border-radius:0;background-color:var(--accent-light);color:var(--neutral-black)}:host .date.range.interval.today{border:none}:host .date.range.end{border-radius:0 50% 50% 0;color:var(--primary-darker) !important;background:var(--accent-base)}:host .date:hover{background:var(--accent-light);border-radius:50%;color:var(--neutral-black)}:host select,:host input{width:60px;font-size:16px;box-shadow:0 2px 2px var(--neutral-black);padding:5px;border-radius:4px;border:1px solid #ccc;background:#f7f7f7}.teste{width:100%}";
|
|
3571
3455
|
const CuraCalendarStyle0 = curaCalendarCss;
|
|
3572
3456
|
|
|
3573
3457
|
const CuraCalendar = class {
|
|
3574
3458
|
constructor(hostRef) {
|
|
3575
|
-
index.registerInstance(this, hostRef);
|
|
3576
|
-
this.onchangeday = index.createEvent(this, "onchangeday", 7);
|
|
3459
|
+
index$1.registerInstance(this, hostRef);
|
|
3460
|
+
this.onchangeday = index$1.createEvent(this, "onchangeday", 7);
|
|
3577
3461
|
this.theme = window.CuraAPI.theme;
|
|
3578
3462
|
this.weights = this.theme.fonts.getWeights();
|
|
3579
3463
|
this.optionsLocale = { 'pt-BR': ptBR, 'en-US': enAU };
|
|
@@ -3586,6 +3470,7 @@ const CuraCalendar = class {
|
|
|
3586
3470
|
this.disable = [];
|
|
3587
3471
|
this.enable = [];
|
|
3588
3472
|
this.defaultDate = [];
|
|
3473
|
+
this.customDates = [];
|
|
3589
3474
|
this.limitRange = null;
|
|
3590
3475
|
this.disablePassDates = undefined;
|
|
3591
3476
|
this.disableFutureDates = undefined;
|
|
@@ -3601,7 +3486,6 @@ const CuraCalendar = class {
|
|
|
3601
3486
|
this.styles = {};
|
|
3602
3487
|
}
|
|
3603
3488
|
connectedCallback() {
|
|
3604
|
-
this.initializeDefaultDates();
|
|
3605
3489
|
this.setFontProperties();
|
|
3606
3490
|
const colors = [
|
|
3607
3491
|
{ name: '--accent-base', theme: 'accent-base' },
|
|
@@ -3611,7 +3495,7 @@ const CuraCalendar = class {
|
|
|
3611
3495
|
{ name: '--neutral-dark', theme: 'neutral-dark' },
|
|
3612
3496
|
{ name: '--neutral-light', theme: 'neutral-light' },
|
|
3613
3497
|
];
|
|
3614
|
-
colors.forEach(color => this.styles = Object.assign(Object.assign({}, this.styles), { [color.name]: this.theme.colors.getColor(color.theme) }));
|
|
3498
|
+
colors.forEach(color => (this.styles = Object.assign(Object.assign({}, this.styles), { [color.name]: this.theme.colors.getColor(color.theme) })));
|
|
3615
3499
|
}
|
|
3616
3500
|
setFontProperties() {
|
|
3617
3501
|
this.styles['--font-family'] = window.CuraAPI.theme.fonts.getFamily();
|
|
@@ -3628,19 +3512,19 @@ const CuraCalendar = class {
|
|
|
3628
3512
|
this.defaultDates = this.expandDateRanges(this.defaultDate);
|
|
3629
3513
|
}
|
|
3630
3514
|
/**
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3515
|
+
* Get the locale for the calendar.
|
|
3516
|
+
*
|
|
3517
|
+
* @returns {Locale} The locale object.
|
|
3518
|
+
*/
|
|
3635
3519
|
determineLocale() {
|
|
3636
3520
|
return this.optionsLocale[this.locale] || this.locale;
|
|
3637
3521
|
}
|
|
3638
3522
|
/**
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3523
|
+
* Check if a date is within the valid period.
|
|
3524
|
+
*
|
|
3525
|
+
* @param {Date} date - The date to check.
|
|
3526
|
+
* @returns {boolean} Whether the date is valid.
|
|
3527
|
+
*/
|
|
3644
3528
|
isDateInValidPeriod(date) {
|
|
3645
3529
|
if (this.period === null) {
|
|
3646
3530
|
return true;
|
|
@@ -3675,9 +3559,9 @@ const CuraCalendar = class {
|
|
|
3675
3559
|
const today = new Date();
|
|
3676
3560
|
today.setHours(0, 0, 0, 0);
|
|
3677
3561
|
if (this.disablePassDates)
|
|
3678
|
-
return isBefore(date, today);
|
|
3562
|
+
return index.isBefore(date, today);
|
|
3679
3563
|
if (this.disableFutureDates)
|
|
3680
|
-
return isAfter(date, today);
|
|
3564
|
+
return index.isAfter(date, today);
|
|
3681
3565
|
if (this.disable === null)
|
|
3682
3566
|
return false;
|
|
3683
3567
|
return this.isDateInList(this.expandDateRanges(this.disable), date);
|
|
@@ -3694,12 +3578,12 @@ const CuraCalendar = class {
|
|
|
3694
3578
|
return this.isDateInList(this.expandDateRanges(this.enable), date);
|
|
3695
3579
|
}
|
|
3696
3580
|
/**
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3581
|
+
* Checks if a date is in the provided list of dates.
|
|
3582
|
+
*
|
|
3583
|
+
* @param {Date[]} dates - The list of dates to check against.
|
|
3584
|
+
* @param {Date} date - The date to check.
|
|
3585
|
+
* @returns {boolean} Whether the date is in the list.
|
|
3586
|
+
*/
|
|
3703
3587
|
isDateInList(dates, date) {
|
|
3704
3588
|
return dates.some(d => isSameDay(d, date));
|
|
3705
3589
|
}
|
|
@@ -3780,7 +3664,7 @@ const CuraCalendar = class {
|
|
|
3780
3664
|
*/
|
|
3781
3665
|
selectMultiplesDate(date) {
|
|
3782
3666
|
if (!this.isDateSelected(date) || !this.isDateInDefaultSelection(date))
|
|
3783
|
-
return this.selectedDates = [...this.selectedDates, date];
|
|
3667
|
+
return (this.selectedDates = [...this.selectedDates, date]);
|
|
3784
3668
|
this.selectedDates = this.removeDateFromSelection(this.selectedDates, date);
|
|
3785
3669
|
this.defaultDates = this.removeDateFromSelection(this.defaultDates, date);
|
|
3786
3670
|
}
|
|
@@ -3791,8 +3675,8 @@ const CuraCalendar = class {
|
|
|
3791
3675
|
*/
|
|
3792
3676
|
selectDateRange(date) {
|
|
3793
3677
|
this.defaultDates = [];
|
|
3794
|
-
const start = isBefore(this.rangeStart, date) ? this.rangeStart : date;
|
|
3795
|
-
const end = isAfter(this.rangeStart, date) ? this.rangeStart : date;
|
|
3678
|
+
const start = index.isBefore(this.rangeStart, date) ? this.rangeStart : date;
|
|
3679
|
+
const end = index.isAfter(this.rangeStart, date) ? this.rangeStart : date;
|
|
3796
3680
|
const range = eachDayOfInterval({ start, end });
|
|
3797
3681
|
if (!this.rangeStart || this.selectedDates.length === 2) {
|
|
3798
3682
|
this.rangeStart = date;
|
|
@@ -3815,16 +3699,16 @@ const CuraCalendar = class {
|
|
|
3815
3699
|
const selectionHandlers = {
|
|
3816
3700
|
single: this.selectSingleDate.bind(this),
|
|
3817
3701
|
multiple: this.selectMultiplesDate.bind(this),
|
|
3818
|
-
range: this.selectDateRange.bind(this)
|
|
3702
|
+
range: this.selectDateRange.bind(this),
|
|
3819
3703
|
};
|
|
3820
3704
|
selectionHandlers[this.mode](date);
|
|
3821
3705
|
this.onchangeday.emit({ days: [...this.defaultDates, ...this.selectedDates].filter(d => this.isDateInValidPeriod(d)) });
|
|
3822
3706
|
}
|
|
3823
3707
|
/**
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3708
|
+
* Get the days of the week.
|
|
3709
|
+
*
|
|
3710
|
+
* @returns {string[]} An array of abbreviated day names.
|
|
3711
|
+
*/
|
|
3828
3712
|
fetchWeekDays() {
|
|
3829
3713
|
const start = startOfWeek(new Date(2021, 0, 3), { locale: this.determineLocale() });
|
|
3830
3714
|
const end = endOfWeek(new Date(2021, 0, 3), { locale: this.determineLocale() });
|
|
@@ -3840,7 +3724,7 @@ const CuraCalendar = class {
|
|
|
3840
3724
|
this.fetchDaysOfWeek();
|
|
3841
3725
|
}
|
|
3842
3726
|
else
|
|
3843
|
-
|
|
3727
|
+
this.fetchDaysOfMonth();
|
|
3844
3728
|
this.collapsed = false;
|
|
3845
3729
|
}
|
|
3846
3730
|
showColapsedCalendar() {
|
|
@@ -3872,20 +3756,16 @@ const CuraCalendar = class {
|
|
|
3872
3756
|
const prevMonthEnd = endOfMonth(prevMonthStart);
|
|
3873
3757
|
const daysInPrevMonth = eachDayOfInterval({
|
|
3874
3758
|
start: subDays(prevMonthEnd, getDay(start)),
|
|
3875
|
-
end: prevMonthEnd
|
|
3759
|
+
end: prevMonthEnd,
|
|
3876
3760
|
});
|
|
3877
3761
|
const nextMonthStart = startOfMonth(addMonths(end, 1));
|
|
3878
3762
|
const nextMonthEnd = endOfMonth(nextMonthStart);
|
|
3879
3763
|
const remainingDays = WEEKS_IN_CALENDAR_VIEW - getDay(end);
|
|
3880
3764
|
const daysInNextMonth = eachDayOfInterval({
|
|
3881
3765
|
start: nextMonthStart,
|
|
3882
|
-
end: addDays(nextMonthEnd, remainingDays)
|
|
3766
|
+
end: addDays(nextMonthEnd, remainingDays),
|
|
3883
3767
|
});
|
|
3884
|
-
const totalDays = [
|
|
3885
|
-
...daysInPrevMonth.slice(-getDay(start)),
|
|
3886
|
-
...daysIncurrentDate,
|
|
3887
|
-
...daysInNextMonth
|
|
3888
|
-
];
|
|
3768
|
+
const totalDays = [...daysInPrevMonth.slice(-getDay(start)), ...daysIncurrentDate, ...daysInNextMonth];
|
|
3889
3769
|
return totalDays.slice(0, DAYS_IN_CALENDAR_VIEW);
|
|
3890
3770
|
}
|
|
3891
3771
|
/**
|
|
@@ -3898,7 +3778,7 @@ const CuraCalendar = class {
|
|
|
3898
3778
|
const locale = this.determineLocale();
|
|
3899
3779
|
const months = eachMonthOfInterval({
|
|
3900
3780
|
start: startOfYear(new Date(currentYear, 0, 1)),
|
|
3901
|
-
end: new Date(currentYear, 11, 31)
|
|
3781
|
+
end: new Date(currentYear, 11, 31),
|
|
3902
3782
|
}).map(month => format(month, 'MMMM', { locale }));
|
|
3903
3783
|
const capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
|
3904
3784
|
return {
|
|
@@ -3915,20 +3795,20 @@ const CuraCalendar = class {
|
|
|
3915
3795
|
return Array.from({ length: 100 }, (_, i) => currentYear - i);
|
|
3916
3796
|
}
|
|
3917
3797
|
/**
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3798
|
+
* Get the color for the previous button.
|
|
3799
|
+
*
|
|
3800
|
+
* @returns {string} The color name for the previous button.
|
|
3801
|
+
*/
|
|
3922
3802
|
determinePrevButtonColor() {
|
|
3923
|
-
const isPrevDisabled = isBefore(new Date(getYear(this.currentDate), getMonth(this.currentDate) - 1, 1), startOfMonth(new Date()));
|
|
3803
|
+
const isPrevDisabled = index.isBefore(new Date(getYear(this.currentDate), getMonth(this.currentDate) - 1, 1), startOfMonth(new Date()));
|
|
3924
3804
|
return isPrevDisabled && 'primary-base';
|
|
3925
3805
|
}
|
|
3926
3806
|
/**
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3807
|
+
* Get the status of a given date, determining its position and interval status.
|
|
3808
|
+
*
|
|
3809
|
+
* @param {Date | null} date - The date to evaluate.
|
|
3810
|
+
* @returns {Object} An object containing the status flags for the date.
|
|
3811
|
+
*/
|
|
3932
3812
|
getDateStatus(date) {
|
|
3933
3813
|
const [startSelected, endSelected] = [this.selectedDates[0], this.selectedDates[this.selectedDates.length - 1]];
|
|
3934
3814
|
const [startDefault, endDefault] = [this.defaultDates[0], this.defaultDates[this.defaultDates.length - 1]];
|
|
@@ -3958,7 +3838,7 @@ const CuraCalendar = class {
|
|
|
3958
3838
|
isSelected,
|
|
3959
3839
|
isRange,
|
|
3960
3840
|
isDefault,
|
|
3961
|
-
isInterval
|
|
3841
|
+
isInterval,
|
|
3962
3842
|
};
|
|
3963
3843
|
}
|
|
3964
3844
|
/**
|
|
@@ -3968,7 +3848,7 @@ const CuraCalendar = class {
|
|
|
3968
3848
|
* @returns {Object} An object containing the CSS classes for the date.
|
|
3969
3849
|
*/
|
|
3970
3850
|
getClasses(date) {
|
|
3971
|
-
const classes = {
|
|
3851
|
+
const classes = { date: true };
|
|
3972
3852
|
if (date === null)
|
|
3973
3853
|
return classes;
|
|
3974
3854
|
const dateStatus = this.getDateStatus(date);
|
|
@@ -3993,12 +3873,18 @@ const CuraCalendar = class {
|
|
|
3993
3873
|
'--width': this.width,
|
|
3994
3874
|
};
|
|
3995
3875
|
}
|
|
3876
|
+
watchDefaultDatesArray() {
|
|
3877
|
+
this.selectedDates = this.customDates;
|
|
3878
|
+
}
|
|
3996
3879
|
render() {
|
|
3997
3880
|
const { months } = this.fetchMonthNames();
|
|
3998
|
-
return (index.h(index.Host, { key: '
|
|
3999
|
-
this.fetchDaysOfMonth().map((day, index
|
|
4000
|
-
this.fetchDaysOfWeek().map((day, index
|
|
3881
|
+
return (index$1.h(index$1.Host, { key: '3c3a06e4eee0a100a0a9e1eab8d42d839a1cb945', style: this.getHostCSSProperties() }, index$1.h("div", { key: 'b82154d8bb381b3452c90e26e2cbae69db670add', class: `calendar ${this.floating ? 'floating' : ''} ${this.embedded ? 'embedded' : ''}`, style: this.styles }, index$1.h("header", { key: '0c9a5ce68444d2ae931aff60efeb20c52172b2cf', class: "header" }, index$1.h("div", { key: '68e6c5e716ea1919f423950a22341721d0094d8c', class: `month-year ${this.type === 'dropdown' && 'dropdown'}` }, index$1.h("cura-icon", { key: '54f6799b4d54bed92a671dc75045c52076d3adab', class: `icon ${this.type === 'dropdown' && 'dropdown'}`, name: "left", color: this.determinePrevButtonColor(), onClick: !this.collapsed ? () => this.updateCurrentMonth('prev') : () => this.updateCurrentWeek('prev') }), this.type === 'dropdown' ? (index$1.h("div", { class: "select" }, index$1.h("cura-select", { size: "small", class: "drop-month", mode: "transparent", value: months[getMonth(this.currentDate)], onSelected: e => this.onMonthDropdownChange(e) }, months.map((month, index) => (index$1.h("cura-select-option", { size: "xsmall", key: index, value: month }, month)))), index$1.h("cura-select", { size: "small", class: "drop-year", mode: "transparent", value: getYear(this.currentDate).toString(), onSelected: e => this.onYearDropdownChange(e) }, this.fetchYearList().map((year, index) => (index$1.h("cura-select-option", { key: index, value: year.toString() }, year.toString())))))) : (index$1.h("cura-label", { color: "neutral-black", size: "large" }, months[getMonth(this.currentDate)].slice(0, 3), ", ", getYear(this.currentDate))), index$1.h("cura-icon", { key: '66f0f20be96bc0517fb88c284435eda3f85e5227', class: `icon ${this.type === 'dropdown' && 'dropdown'}`, name: "right", color: "primary-base", onClick: !this.collapsed ? () => this.updateCurrentMonth('next') : () => this.updateCurrentWeek('next') }))), index$1.h("span", { key: '5df4ad92b85833a2284830cd69418e9c740fd0f6', class: "days-of-week" }, this.fetchWeekDays().map((day, index) => (index$1.h("cura-label", { class: "day", size: "xsmall", color: "neutral-black", weight: "bold", key: index }, day === 'sab' ? 'SÁB' : day.toLocaleUpperCase())))), index$1.h("div", { key: 'c94c9a2eae554149126f729953245b27a6f82a86', class: "dates" }, !this.collapsed
|
|
3882
|
+
? this.fetchDaysOfMonth().map((day, index) => (index$1.h("div", { key: index, class: this.getClasses(day), onClick: () => this.onDateClick(day) }, day ? format(day, 'd') : '')))
|
|
3883
|
+
: this.fetchDaysOfWeek().map((day, index) => (index$1.h("div", { key: index, class: this.getClasses(day), onClick: () => this.onDateClick(day) }, day ? format(day, 'd') : '')))), this.collapsed !== null ? (this.collapsed ? (index$1.h("div", { class: "collapsed-container" }, index$1.h("cura-button-transparent", { onClick: () => this.showNotColapsedCalendar(), size: "small", color: "primary", fontColor: "dark", iconName: "plusCircle" }, "Veja mais datas"))) : (index$1.h("div", { class: "collapsed-container" }, index$1.h("cura-button-transparent", { onClick: () => this.showColapsedCalendar(), size: "small", color: "primary", fontColor: "dark", iconName: "minusCircle" }, "Veja menos datas")))) : null)));
|
|
4001
3884
|
}
|
|
3885
|
+
static get watchers() { return {
|
|
3886
|
+
"customDates": ["watchDefaultDatesArray"]
|
|
3887
|
+
}; }
|
|
4002
3888
|
};
|
|
4003
3889
|
CuraCalendar.style = CuraCalendarStyle0;
|
|
4004
3890
|
|