@wernfried/daterangepicker 5.4.1 → 5.4.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.
- package/API_Doc.md +4 -4
- package/README.md +8 -8
- package/dist/cjs/daterangepicker.cjs +34 -17
- 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 +34 -17
- 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 +34 -17
- 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
|
@@ -6,7 +6,7 @@ var DateRangePicker = (function(exports, luxon2) {
|
|
|
6
6
|
constructor(element, options, cb) {
|
|
7
7
|
if (typeof element === "string" && document.querySelectorAll(element).length > 1)
|
|
8
8
|
throw new RangeError(`Option 'element' must match to one element only`);
|
|
9
|
-
this.parentEl = "body";
|
|
9
|
+
this.parentEl = document.querySelector("body");
|
|
10
10
|
this.element = element instanceof HTMLElement ? element : document.querySelector(element);
|
|
11
11
|
this.isInputText = this.element instanceof HTMLInputElement && this.element.type === "text";
|
|
12
12
|
this.button = null;
|
|
@@ -161,7 +161,11 @@ var DateRangePicker = (function(exports, luxon2) {
|
|
|
161
161
|
options.template = template.join("");
|
|
162
162
|
this.container = createElementFromHTML(options.template);
|
|
163
163
|
}
|
|
164
|
-
|
|
164
|
+
if (options.parentEl instanceof HTMLElement) {
|
|
165
|
+
this.parentEl = options.parentEl;
|
|
166
|
+
} else if (typeof options.parentEl === "string") {
|
|
167
|
+
this.parentEl = document.querySelector(options.parentEl) ?? this.parentEl;
|
|
168
|
+
}
|
|
165
169
|
this.parentEl.appendChild(this.container);
|
|
166
170
|
if (typeof options.timePicker === "boolean")
|
|
167
171
|
this.timePicker = options.timePicker;
|
|
@@ -2365,21 +2369,34 @@ var DateRangePicker = (function(exports, luxon2) {
|
|
|
2365
2369
|
const style = getComputedStyle(el);
|
|
2366
2370
|
return el.offsetHeight + parseFloat(style.marginTop) + parseFloat(style.marginBottom);
|
|
2367
2371
|
}
|
|
2368
|
-
function daterangepicker(
|
|
2369
|
-
if (
|
|
2370
|
-
return
|
|
2371
|
-
if (elements instanceof
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2372
|
+
function daterangepicker(element, options, callback) {
|
|
2373
|
+
if (element instanceof HTMLElement) {
|
|
2374
|
+
return new DateRangePicker2(element, options || {}, callback);
|
|
2375
|
+
} else if (elements instanceof NodeList || element instanceof HTMLCollection) {
|
|
2376
|
+
const ret = [];
|
|
2377
|
+
for (const el of Array.from(element)) {
|
|
2378
|
+
if (el._daterangepicker && typeof el._daterangepicker.remove === "function")
|
|
2379
|
+
el._daterangepicker.remove();
|
|
2380
|
+
ret.push(new DateRangePicker2(el, options || {}, callback));
|
|
2381
|
+
}
|
|
2382
|
+
return ret;
|
|
2383
|
+
} else if (typeof element === "string") {
|
|
2384
|
+
if (document.querySelectorAll(element).length > 1) {
|
|
2385
|
+
const ret = [];
|
|
2386
|
+
for (const el of Array.from(document.querySelectorAll(element))) {
|
|
2387
|
+
if (el._daterangepicker && typeof el._daterangepicker.remove === "function")
|
|
2388
|
+
el._daterangepicker.remove();
|
|
2389
|
+
ret.push(new DateRangePicker2(el, options || {}, callback));
|
|
2390
|
+
}
|
|
2391
|
+
return ret;
|
|
2392
|
+
} else if (document.querySelectorAll(element).length === 1) {
|
|
2393
|
+
return new DateRangePicker2(element, options || {}, callback);
|
|
2394
|
+
} else {
|
|
2395
|
+
return null;
|
|
2396
|
+
}
|
|
2397
|
+
} else {
|
|
2398
|
+
return null;
|
|
2399
|
+
}
|
|
2383
2400
|
}
|
|
2384
2401
|
function getDateRangePicker(target) {
|
|
2385
2402
|
if (typeof target === "string")
|