@wernfried/daterangepicker 5.4.10 → 5.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API_Doc.md +1 -0
- package/README.md +9 -8
- package/dist/cjs/daterangepicker.cjs +12 -8
- package/dist/cjs/daterangepicker.cjs.map +1 -1
- package/dist/cjs/daterangepicker.min.cjs +1 -1
- package/dist/cjs/daterangepicker.min.cjs.map +1 -1
- package/dist/esm/daterangepicker.js +12 -8
- package/dist/esm/daterangepicker.js.map +1 -1
- package/dist/esm/daterangepicker.min.js +1 -1
- package/dist/esm/daterangepicker.min.js.map +1 -1
- package/dist/global/daterangepicker.js +12 -8
- package/dist/global/daterangepicker.js.map +1 -1
- package/dist/global/daterangepicker.min.js +1 -1
- package/dist/global/daterangepicker.min.js.map +1 -1
- package/package.json +1 -1
package/API_Doc.md
CHANGED
|
@@ -674,6 +674,7 @@ Options for DateRangePicker
|
|
|
674
674
|
| showISOWeekNumbers | <code>boolean</code> | <code>false</code> | Show **ISO** week numbers at the start of each week on the calendars.<br> Takes precedence over localized `showWeekNumbers` |
|
|
675
675
|
| button | <code>string</code> \| [<code>HTMLButtonElement</code>](https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement) | <code>null</code> | A dedicated element to show the DateRangePicker on click.<br> Main reason of this option is to prevent hide/flicker of the picker on `outsideClick()` |
|
|
676
676
|
| showOnClick | <code>boolean</code> | <code>true</code> | Shows/toggle the DateRangePicker on click or focus at `element`.<br> You may want to set it to `false` only when option `button` is provided or when you use `show()` programmatically. |
|
|
677
|
+
| stopPropagation | <code>boolean</code> | <code>true</code> | Set this option to `false` if you want to listen on DOM-Events outside this instance. |
|
|
677
678
|
| timePicker | <code>boolean</code> | <code>false</code> | Adds select boxes to choose times in addition to dates |
|
|
678
679
|
| timePicker24Hour | <code>boolean</code> | | Use 24-hour instead of 12-hour times, removing the AM/PM selection.<br> Default is derived from current locale [Intl.DateTimeFormat.resolvedOptions.hour12](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/resolvedOptions#hour12). |
|
|
679
680
|
| timePickerStepSize | [<code>Duration</code>](https://moment.github.io/luxon/api-docs/index.html#duration) \| <code>string</code> \| <code>number</code> | | Default: `Duration.fromObject({minutes:1})`<br>Set the time picker step size.<br> Must be a `luxon.Duration` or the number of seconds or a string according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) duration.<br> Valid values are 1,2,3,4,5,6,10,12,15,20,30 for `Duration.fromObject({seconds: ...})` and `Duration.fromObject({minutes: ...})` and 1,2,3,4,6,(8,12) for `Duration.fromObject({hours: ...})`.<br> Duration must be greater than `minSpan` and smaller than `maxSpan`.<br> For example `timePickerStepSize: 600` will disable time picker seconds and time picker minutes are set to step size of 10 Minutes. |
|
package/README.md
CHANGED
|
@@ -19,8 +19,8 @@ Above samples are based on the [original repository](https://github.com/dangross
|
|
|
19
19
|
#### Global import with `<script>` tags
|
|
20
20
|
```html
|
|
21
21
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/luxon@3.5.0/build/global/luxon.min.js"></script>
|
|
22
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.
|
|
23
|
-
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.
|
|
22
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.1/dist/global/daterangepicker.min.js"></script>
|
|
23
|
+
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.1/css/daterangepicker.min.css" rel="stylesheet" />
|
|
24
24
|
|
|
25
25
|
<input type="text" id="picker" />
|
|
26
26
|
|
|
@@ -40,11 +40,11 @@ Above samples are based on the [original repository](https://github.com/dangross
|
|
|
40
40
|
{
|
|
41
41
|
"imports": {
|
|
42
42
|
"luxon": "https://cdn.jsdelivr.net/npm/luxon@3.7.2/+esm",
|
|
43
|
-
"daterangepicker": "https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.
|
|
43
|
+
"daterangepicker": "https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.1/+esm"
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
</script>
|
|
47
|
-
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.
|
|
47
|
+
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.1/css/daterangepicker.min.css" rel="stylesheet" />
|
|
48
48
|
|
|
49
49
|
<input type="text" id="picker" />
|
|
50
50
|
|
|
@@ -63,9 +63,9 @@ Above samples are based on the [original repository](https://github.com/dangross
|
|
|
63
63
|
#### Style with Bulma
|
|
64
64
|
```html
|
|
65
65
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/luxon@3.5.0/build/global/luxon.min.js"></script>
|
|
66
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.
|
|
66
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.1/dist/global/daterangepicker.min.js"></script>
|
|
67
67
|
<link type="text/css" href="https://cdn.jsdelivr.net/npm/bulma@1.0.4/css/bulma.min.css" rel="stylesheet" />
|
|
68
|
-
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.
|
|
68
|
+
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.1/css/daterangepicker.bulma.min.css" rel="stylesheet" />
|
|
69
69
|
|
|
70
70
|
<input type="text" id="picker" />
|
|
71
71
|
|
|
@@ -121,8 +121,8 @@ Initialisation with jQuery is supported in version 5.x
|
|
|
121
121
|
```html
|
|
122
122
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
|
|
123
123
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/luxon@3.5.0/build/global/luxon.min.js"></script>
|
|
124
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.
|
|
125
|
-
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.
|
|
124
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.1/dist/global/daterangepicker.min.js"></script>
|
|
125
|
+
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.5.1/css/daterangepicker.min.css" rel="stylesheet" />
|
|
126
126
|
|
|
127
127
|
<input type="text" id="picker" />
|
|
128
128
|
|
|
@@ -366,6 +366,7 @@ Options for DateRangePicker
|
|
|
366
366
|
| showISOWeekNumbers | <code>boolean</code> | <code>false</code> | Show **ISO** week numbers at the start of each week on the calendars.<br> Takes precedence over localized `showWeekNumbers` |
|
|
367
367
|
| button | <code>string</code> \| [<code>HTMLButtonElement</code>](https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement) | <code>null</code> | A dedicated element to show the DateRangePicker on click.<br> Main reason of this option is to prevent hide/flicker of the picker on `outsideClick()` |
|
|
368
368
|
| showOnClick | <code>boolean</code> | <code>true</code> | Shows/toggle the DateRangePicker on click or focus at `element`.<br> You may want to set it to `false` only when option `button` is provided or when you use `show()` programmatically. |
|
|
369
|
+
| stopPropagation | <code>boolean</code> | <code>true</code> | Set this option to `false` if you want to listen on DOM-Events outside this instance. |
|
|
369
370
|
| timePicker | <code>boolean</code> | <code>false</code> | Adds select boxes to choose times in addition to dates |
|
|
370
371
|
| timePicker24Hour | <code>boolean</code> | | Use 24-hour instead of 12-hour times, removing the AM/PM selection.<br> Default is derived from current locale [Intl.DateTimeFormat.resolvedOptions.hour12](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/resolvedOptions#hour12). |
|
|
371
372
|
| timePickerStepSize | [<code>Duration</code>](https://moment.github.io/luxon/api-docs/index.html#duration) \| <code>string</code> \| <code>number</code> | | Default: `Duration.fromObject({minutes:1})`<br>Set the time picker step size.<br> Must be a `luxon.Duration` or the number of seconds or a string according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) duration.<br> Valid values are 1,2,3,4,5,6,10,12,15,20,30 for `Duration.fromObject({seconds: ...})` and `Duration.fromObject({minutes: ...})` and 1,2,3,4,6,(8,12) for `Duration.fromObject({hours: ...})`.<br> Duration must be greater than `minSpan` and smaller than `maxSpan`.<br> For example `timePickerStepSize: 600` will disable time picker seconds and time picker minutes are set to step size of 10 Minutes. |
|
|
@@ -40,6 +40,7 @@ class DateRangePicker {
|
|
|
40
40
|
this.isInvalidTime = null;
|
|
41
41
|
this.isCustomDate = null;
|
|
42
42
|
this.onOutsideClick = "apply";
|
|
43
|
+
this.stopPropagation = true;
|
|
43
44
|
this.opens = this.element?.classList.contains("pull-right") ? "left" : "right";
|
|
44
45
|
this.drops = this.element?.classList.contains("dropup") ? "up" : "down";
|
|
45
46
|
this.buttonClasses = "btn btn-sm";
|
|
@@ -221,7 +222,8 @@ class DateRangePicker {
|
|
|
221
222
|
"autoApply",
|
|
222
223
|
"autoUpdateInput",
|
|
223
224
|
"showLabel",
|
|
224
|
-
"showOnClick"
|
|
225
|
+
"showOnClick",
|
|
226
|
+
"stopPropagation"
|
|
225
227
|
]) {
|
|
226
228
|
if (typeof options[key2] === "boolean")
|
|
227
229
|
this[key2] = options[key2];
|
|
@@ -2320,11 +2322,15 @@ class DateRangePicker {
|
|
|
2320
2322
|
* @private
|
|
2321
2323
|
*/
|
|
2322
2324
|
addListener(element, eventName, selector, delegate) {
|
|
2325
|
+
const stopPropagation = this.stopPropagation;
|
|
2323
2326
|
this.container.querySelectorAll(element).forEach((el) => {
|
|
2324
2327
|
el.addEventListener(eventName, function(event) {
|
|
2325
2328
|
const target = event.target.closest(selector);
|
|
2326
|
-
if (target && el.contains(target))
|
|
2329
|
+
if (target && el.contains(target)) {
|
|
2330
|
+
if (stopPropagation)
|
|
2331
|
+
event.stopPropagation();
|
|
2327
2332
|
delegate.call(target, event);
|
|
2333
|
+
}
|
|
2328
2334
|
});
|
|
2329
2335
|
});
|
|
2330
2336
|
}
|
|
@@ -2399,9 +2405,8 @@ function daterangepicker(element, options, callback) {
|
|
|
2399
2405
|
for (const el of Array.from(element)) {
|
|
2400
2406
|
if (el._daterangepicker && typeof el._daterangepicker.remove === "function")
|
|
2401
2407
|
el._daterangepicker.remove();
|
|
2402
|
-
|
|
2403
|
-
el._daterangepicker
|
|
2404
|
-
ret.push(picker);
|
|
2408
|
+
el._daterangepicker = new DateRangePicker(el, options || {}, callback);
|
|
2409
|
+
ret.push(el._daterangepicker);
|
|
2405
2410
|
}
|
|
2406
2411
|
return ret;
|
|
2407
2412
|
} else if (typeof element === "string") {
|
|
@@ -2410,9 +2415,8 @@ function daterangepicker(element, options, callback) {
|
|
|
2410
2415
|
for (const el of Array.from(document.querySelectorAll(element))) {
|
|
2411
2416
|
if (el._daterangepicker && typeof el._daterangepicker.remove === "function")
|
|
2412
2417
|
el._daterangepicker.remove();
|
|
2413
|
-
|
|
2414
|
-
el._daterangepicker
|
|
2415
|
-
ret.push(picker);
|
|
2418
|
+
el._daterangepicker = new DateRangePicker(el, options || {}, callback);
|
|
2419
|
+
ret.push(el._daterangepicker);
|
|
2416
2420
|
}
|
|
2417
2421
|
return ret;
|
|
2418
2422
|
} else if (document.querySelectorAll(element).length === 1) {
|